mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
fix immortal bug
This commit is contained in:
parent
5f1b0e6eff
commit
14e347ed43
5 changed files with 13 additions and 3 deletions
|
@ -209,6 +209,11 @@ function inventory_helper.get_item_data(player_data, fresh)
|
||||||
local slot_x, slot_y = ComponentGetValue2(item_comp, "inventory_slot")
|
local slot_x, slot_y = ComponentGetValue2(item_comp, "inventory_slot")
|
||||||
local item_x, item_y = EntityGetTransform(item)
|
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)
|
SetRandomSeed(item + slot_x + item_x, slot_y + item_y)
|
||||||
|
|
||||||
if(entity_is_wand(item))then
|
if(entity_is_wand(item))then
|
||||||
|
|
|
@ -114,7 +114,7 @@ function module.on_client_spawned(peer_id, playerdata)
|
||||||
if ctx.is_host then
|
if ctx.is_host then
|
||||||
EntityAddComponent2(playerdata.entity, "LuaComponent", {script_damage_received = "mods/quant.ew/files/system/damage/cbs/send_damage_to_client.lua"})
|
EntityAddComponent2(playerdata.entity, "LuaComponent", {script_damage_received = "mods/quant.ew/files/system/damage/cbs/send_damage_to_client.lua"})
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -384,7 +384,7 @@ end
|
||||||
|
|
||||||
function module.on_client_spawned(peer_id, playerdata)
|
function module.on_client_spawned(peer_id, playerdata)
|
||||||
playerdata.status = { is_alive = true }
|
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
|
if ctx.is_host then
|
||||||
EntityAddComponent2(playerdata.entity, "LuaComponent", {script_damage_received = "mods/quant.ew/files/system/damage/cbs/send_damage_to_client.lua"})
|
EntityAddComponent2(playerdata.entity, "LuaComponent", {script_damage_received = "mods/quant.ew/files/system/damage/cbs/send_damage_to_client.lua"})
|
||||||
end
|
end
|
||||||
|
|
|
@ -161,7 +161,7 @@ local function apply_seri_ent(player_data, seri_ent)
|
||||||
EntityAddTag(ent, "ew_no_enemy_sync")
|
EntityAddTag(ent, "ew_no_enemy_sync")
|
||||||
EntityAddTag(ent, "ew_client")
|
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 poly-like effects to prevent spawn of another player character when it runs out
|
||||||
remove_all_effects(ent)
|
remove_all_effects(ent)
|
||||||
|
|
|
@ -17,6 +17,11 @@ function rpc.got_thrown(peer_id, vx, vy)
|
||||||
local phys_component = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "PhysicsBodyComponent")
|
local phys_component = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "PhysicsBodyComponent")
|
||||||
local px, py, pr, pvx, pvy, pvr = np.PhysBodyGetTransform(phys_component)
|
local px, py, pr, pvx, pvy, pvr = np.PhysBodyGetTransform(phys_component)
|
||||||
np.PhysBodySetTransform(phys_component, px, py, pr, pvx + vx, pvy + vy, pvr)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue