Skip to content

Commit 2bf1f58

Browse files
committed
maybe fix an error with no physics body, spawn patsas if a client gets near it
1 parent 3638d52 commit 2bf1f58

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
dofile_once("data/scripts/lib/utilities.lua")
2+
3+
local entity_id = GetUpdatedEntityID()
4+
local pos_x, pos_y = EntityGetTransform( entity_id )
5+
6+
local targets = EntityGetInRadiusWithTag( pos_x, pos_y, 32, "ew_peer" )
7+
8+
if ( targets ~= nil ) and ( #targets > 0 ) then
9+
EntityLoad( "data/entities/animals/statue.xml", pos_x, pos_y )
10+
EntityLoad( "data/entities/particles/dust_explosion.xml", pos_x, pos_y )
11+
EntityKill( entity_id )
12+
13+
GamePlaySound( "data/audio/Desktop/animals.bank", "animals/statue/appear", pos_x, pos_y )
14+
end

quant.ew/files/core/util.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -441,20 +441,20 @@ function util.set_phys_info(entity, data, fps)
441441
local has_set = false
442442
for i, phys_component in ipairs(EntityGetComponent(entity, "PhysicsBodyComponent") or {}) do
443443
local phys_info = phys_infos[i]
444-
if phys_component ~= nil and phys_component ~= 0 and phys_info ~= nil then
444+
if phys_component ~= nil and phys_component ~= 0 and phys_info ~= nil
445+
and ComponentGetValue2(phys_component, "mPixelCount") ~= 0 then
445446
deserialize_phys_component(phys_component, phys_info, fps)
446447
has_set = true
447448
end
448449
end
449450
for i, phys_component in ipairs(EntityGetComponent(entity, "PhysicsBody2Component") or {}) do
450451
local phys_info = phys_infos_2[i]
451-
if phys_component ~= nil and phys_component ~= 0 and phys_info ~= nil then
452-
-- A physics body doesn't exist otherwise, causing a crash
453-
local initialized = ComponentGetValue2(phys_component, "mInitialized")
454-
if initialized then
455-
deserialize_phys_component(phys_component, phys_info, fps)
456-
has_set = true
457-
end
452+
if phys_component ~= nil and phys_component ~= 0 and phys_info ~= nil
453+
and ComponentGetValue2(phys_component, "mPixelCount") ~= 0
454+
-- A physics body doesn't exist otherwise, causing a crash
455+
and ComponentGetValue2(phys_component, "mInitialized") then
456+
deserialize_phys_component(phys_component, phys_info, fps)
457+
has_set = true
458458
end
459459
end
460460
return has_set

quant.ew/settings.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ local function build_settings()
187187
id = "nochathint",
188188
ui_name = "no chat hint",
189189
ui_description = ":c",
190-
value_default = false,
190+
value_default = true,
191191
scope = MOD_SETTING_SCOPE_RUNTIME,
192192
},
193193
{

0 commit comments

Comments
 (0)