mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
fix immortality and make items less easy to break
This commit is contained in:
parent
871994640c
commit
88c3f4c571
3 changed files with 38 additions and 16 deletions
|
@ -213,6 +213,10 @@ function inventory_helper.get_item_data(player_data, fresh)
|
|||
if immortal ~= 0 then
|
||||
EntityRemoveComponent(item, immortal)
|
||||
end
|
||||
local damage_component = EntityGetFirstComponentIncludingDisabled(item, "DamageModelComponent")
|
||||
if damage_component and damage_component ~= 0 then
|
||||
ComponentSetValue2(damage_component, "wait_for_kill_flag_on_death", false)
|
||||
end
|
||||
|
||||
SetRandomSeed(item + slot_x + item_x, slot_y + item_y)
|
||||
|
||||
|
@ -254,6 +258,16 @@ 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
|
||||
local damage_component = EntityGetFirstComponentIncludingDisabled(item, "DamageModelComponent")
|
||||
if damage_component and damage_component ~= 0 then
|
||||
ComponentSetValue2(damage_component, "wait_for_kill_flag_on_death", false)
|
||||
end
|
||||
|
||||
|
||||
SetRandomSeed(item + slot_x + item_x, slot_y + item_y)
|
||||
|
||||
-- local item_id = entity.GetVariable(item, "arena_entity_id")
|
||||
|
|
|
@ -499,7 +499,11 @@ function rpc.item_globalize(item_data)
|
|||
ComponentSetValue2(com, "value_int", GameGetFrameNum())
|
||||
end
|
||||
end
|
||||
local damage_component = EntityGetFirstComponentIncludingDisabled(item, "DamageModelComponent")
|
||||
if damage_component and damage_component ~= 0 then
|
||||
ComponentSetValue2(damage_component, "wait_for_kill_flag_on_death", true)
|
||||
EntityAddComponent2(item, "LuaComponent", {_tags="ew_immortal", script_damage_about_to_be_received = "mods/quant.ew/files/resource/cbs/immortal.lua"})
|
||||
end
|
||||
if not is_my_item(item_data.gid) then
|
||||
local itemcom = EntityGetFirstComponentIncludingDisabled(item, "ItemComponent")
|
||||
if ComponentGetValue2(itemcom, "play_hover_animation") then
|
||||
|
|
|
@ -22,6 +22,10 @@ function rpc.got_thrown(peer_id, vx, vy)
|
|||
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
|
||||
local damage_component = EntityGetFirstComponentIncludingDisabled(item, "DamageModelComponent")
|
||||
if damage_component and damage_component ~= 0 then
|
||||
ComponentSetValue2(damage_component, "wait_for_kill_flag_on_death", true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue