remove some ground around you when reviving from notplayer, dont have notplayer upwarp water when trying to douse himself

This commit is contained in:
bgkillas 2024-11-02 12:55:14 -04:00
parent 1020bf4e98
commit 2fa5e94d58
3 changed files with 15 additions and 4 deletions

View file

@ -24,14 +24,22 @@ function module.on_player_died(player_entity)
end end
rpc.opts_everywhere() rpc.opts_everywhere()
function rpc.remove_homing() function rpc.remove_homing(clear_area)
local x, y = EntityGetTransform(ctx.rpc_player_data.entity) local x, y
if ctx.rpc_peer_id == ctx.my_id then
x, y = EntityGetTransform(ctx.rpc_player_data.entity)
else
x, y = ctx.rpc_player_data.pos_x, ctx.rpc_player_data.pos_y
end
for _, proj in pairs(EntityGetInRadiusWithTag(x, y, 512, "player_projectile")) do for _, proj in pairs(EntityGetInRadiusWithTag(x, y, 512, "player_projectile")) do
local homing = EntityGetFirstComponentIncludingDisabled(proj, "HomingComponent") local homing = EntityGetFirstComponentIncludingDisabled(proj, "HomingComponent")
if homing ~= nil and ComponentGetValue2(homing, "target_tag") ~= "ew_peer" then if homing ~= nil and ComponentGetValue2(homing, "target_tag") ~= "ew_peer" then
EntitySetComponentIsEnabled(proj, homing, false) EntitySetComponentIsEnabled(proj, homing, false)
end end
end end
if clear_area then
LoadPixelScene("mods/quant.ew/files/system/local_health/revive.png", "", x - 6, y - 13, "", true, true)
end
end end
local function set_camera_free(enable, entity, dont) local function set_camera_free(enable, entity, dont)
@ -158,7 +166,7 @@ local function player_died()
if ctx.my_player.entity == nil then if ctx.my_player.entity == nil then
return return
end end
rpc.remove_homing() rpc.remove_homing(false)
-- Serialize inventory, perks, and max_hp, we'll need to copy it over to notplayer. -- Serialize inventory, perks, and max_hp, we'll need to copy it over to notplayer.
local item_data = inventory_helper.get_item_data(ctx.my_player) local item_data = inventory_helper.get_item_data(ctx.my_player)
remove_inventory() remove_inventory()
@ -329,10 +337,10 @@ ctx.cap.health = {
on_poly_death = function() on_poly_death = function()
local notplayer_active = GameHasFlagRun("ew_flag_notplayer_active") local notplayer_active = GameHasFlagRun("ew_flag_notplayer_active")
if notplayer_active then if notplayer_active then
rpc.remove_homing()
if GameHasFlagRun("ending_game_completed") and not GameHasFlagRun("ew_kill_player") then if GameHasFlagRun("ending_game_completed") and not GameHasFlagRun("ew_kill_player") then
return return
end end
rpc.remove_homing(true)
local item_data = inventory_helper.get_item_data(ctx.my_player) local item_data = inventory_helper.get_item_data(ctx.my_player)
remove_inventory() remove_inventory()
GameRemoveFlagRun("ew_flag_notplayer_active") GameRemoveFlagRun("ew_flag_notplayer_active")

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

View file

@ -859,6 +859,9 @@ local function choose_movement()
end end
local did_hit_up, _, _ = RaytracePlatforms(my_x, my_y, my_x, my_y - 40) local did_hit_up, _, _ = RaytracePlatforms(my_x, my_y, my_x, my_y - 40)
state.control_s = did_hit_up state.control_s = did_hit_up
if did_hit_up and state.water_potion ~= nil then
state.control_w = false
end
local air = ComponentGetValue2(state.damage_model, "air_in_lungs") local air = ComponentGetValue2(state.damage_model, "air_in_lungs")
if air < 1 then if air < 1 then
state.control_w = true state.control_w = true