fix immortal bug

This commit is contained in:
bgkillas 2024-11-19 16:08:59 -05:00
parent 5f1b0e6eff
commit 14e347ed43
5 changed files with 13 additions and 3 deletions

View file

@ -209,6 +209,11 @@ function inventory_helper.get_item_data(player_data, fresh)
local slot_x, slot_y = ComponentGetValue2(item_comp, "inventory_slot")
local item_x, item_y = EntityGetTransform(item)
local immortal = EntityGetFirstComponentIncludingDisabled(item, "LuaComponent", "ew_immortal")
if immortal ~= 0 then
EntityRemoveComponent(item, immortal)
end
SetRandomSeed(item + slot_x + item_x, slot_y + item_y)
if(entity_is_wand(item))then

View file

@ -114,7 +114,7 @@ function module.on_client_spawned(peer_id, playerdata)
if ctx.is_host then
EntityAddComponent2(playerdata.entity, "LuaComponent", {script_damage_received = "mods/quant.ew/files/system/damage/cbs/send_damage_to_client.lua"})
else
EntityAddComponent2(playerdata.entity, "LuaComponent", {script_damage_about_to_be_received = "mods/quant.ew/files/resource/cbs/immortal.lua"})
EntityAddComponent2(playerdata.entity, "LuaComponent", {_tags="ew_immortal", script_damage_about_to_be_received = "mods/quant.ew/files/resource/cbs/immortal.lua"})
end
end

View file

@ -384,7 +384,7 @@ end
function module.on_client_spawned(peer_id, playerdata)
playerdata.status = { is_alive = true }
EntityAddComponent2(playerdata.entity, "LuaComponent", {script_damage_about_to_be_received = "mods/quant.ew/files/resource/cbs/immortal.lua"})
EntityAddComponent2(playerdata.entity, "LuaComponent", {_tags="ew_immortal", script_damage_about_to_be_received = "mods/quant.ew/files/resource/cbs/immortal.lua"})
if ctx.is_host then
EntityAddComponent2(playerdata.entity, "LuaComponent", {script_damage_received = "mods/quant.ew/files/system/damage/cbs/send_damage_to_client.lua"})
end

View file

@ -161,7 +161,7 @@ local function apply_seri_ent(player_data, seri_ent)
EntityAddTag(ent, "ew_no_enemy_sync")
EntityAddTag(ent, "ew_client")
EntityAddComponent2(ent, "LuaComponent", {script_damage_about_to_be_received = "mods/quant.ew/files/resource/cbs/immortal.lua"})
EntityAddComponent2(ent, "LuaComponent", {_tags="ew_immortal", script_damage_about_to_be_received = "mods/quant.ew/files/resource/cbs/immortal.lua"})
-- Remove all poly-like effects to prevent spawn of another player character when it runs out
remove_all_effects(ent)

View file

@ -17,6 +17,11 @@ function rpc.got_thrown(peer_id, vx, vy)
local phys_component = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "PhysicsBodyComponent")
local px, py, pr, pvx, pvy, pvr = np.PhysBodyGetTransform(phys_component)
np.PhysBodySetTransform(phys_component, px, py, pr, pvx + vx, pvy + vy, pvr)
else
local immortal = EntityGetFirstComponentIncludingDisabled(item, "LuaComponent", "ew_immortal")
if immortal == 0 then
EntityAddComponent2(item, "LuaComponent", {_tags="ew_immortal", script_damage_about_to_be_received = "mods/quant.ew/files/resource/cbs/immortal.lua"})
end
end
end