make notplayer deal with solid material damage, also fix him acting weird after touching material damage but not getting attacked by something

This commit is contained in:
bgkillas 2024-11-13 17:59:50 -05:00
parent ccf6c574b3
commit 005c1b29c1

View file

@ -812,14 +812,24 @@ local function choose_movement()
if ComponentGetValue2(state.damage_model, "mLiquidCount") == 0 then if ComponentGetValue2(state.damage_model, "mLiquidCount") == 0 then
if state.dtype == 32 or material_gas > GameGetFrameNum() then if state.dtype == 32 or material_gas > GameGetFrameNum() then
table.insert(state.stay_away, {my_x, my_y - 4, nil, GameGetFrameNum() + 600}) local did_hit_down_10, _, _ = RaytracePlatforms(my_x, my_y, my_x, my_y + 10)
material_gas = GameGetFrameNum() + 30 if did_hit_down_10 then
if (dist > 0 and did_hit_2) or (dist < 0 and did_hit_1) then local did_hit_3, _, _ = RaytracePlatforms(my_x, my_y, my_x + 100, my_y)
give_space = give_space + 10 if not did_hit_3 then
table.insert(state.stay_away, {my_x - 8, my_y + 8, nil, GameGetFrameNum() + 1200})
else
table.insert(state.stay_away, {my_x + 8, my_y + 8, nil, GameGetFrameNum() + 1200})
end
else else
swap_side = true table.insert(state.stay_away, {my_x, my_y - 8, nil, GameGetFrameNum() + 1200})
material_gas = GameGetFrameNum() + 30
if (dist > 0 and did_hit_2) or (dist < 0 and did_hit_1) then
give_space = give_space + 10
else
swap_side = true
end
state.control_w = false
end end
state.control_w = false
else else
material_gas = -1 material_gas = -1
if move > GameGetFrameNum() then if move > GameGetFrameNum() then
@ -836,7 +846,7 @@ local function choose_movement()
end end
end end
elseif state.dtype == 32 or state.init_timer < no_shoot_time then elseif state.dtype == 32 or state.init_timer < no_shoot_time then
table.insert(state.stay_away, {my_x, my_y + 4, nil, GameGetFrameNum() + 600}) table.insert(state.stay_away, {my_x, my_y + 8, nil, GameGetFrameNum() + 1200})
move = GameGetFrameNum() + 120 move = GameGetFrameNum() + 120
state.control_w = true state.control_w = true
if my_x > t_x then if my_x > t_x then
@ -876,6 +886,9 @@ local function choose_movement()
state.control_s = false state.control_s = false
end end
end end
if fly < 0.1 then
state.control_w = false
end
end end
local function teleport_to_area(area) local function teleport_to_area(area)
@ -1442,6 +1455,8 @@ local function update()
cycle_wands() cycle_wands()
stay_away_from() stay_away_from()
ComponentSetValue2(var, "value_int", 0)
end end
function module.on_world_update() function module.on_world_update()