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
|
if immortal ~= 0 then
|
||||||
EntityRemoveComponent(item, immortal)
|
EntityRemoveComponent(item, immortal)
|
||||||
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", false)
|
||||||
|
end
|
||||||
|
|
||||||
SetRandomSeed(item + slot_x + item_x, slot_y + item_y)
|
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 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
|
||||||
|
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)
|
SetRandomSeed(item + slot_x + item_x, slot_y + item_y)
|
||||||
|
|
||||||
-- local item_id = entity.GetVariable(item, "arena_entity_id")
|
-- local item_id = entity.GetVariable(item, "arena_entity_id")
|
||||||
|
@ -261,23 +275,23 @@ function inventory_helper.get_item_data(player_data, fresh)
|
||||||
-- GlobalsSetValue(tostring(item) .. "_item", tostring(k))
|
-- GlobalsSetValue(tostring(item) .. "_item", tostring(k))
|
||||||
if(entity_is_wand(item))then
|
if(entity_is_wand(item))then
|
||||||
table.insert(spellData,
|
table.insert(spellData,
|
||||||
{
|
{
|
||||||
data = inventory_helper.serialize_single_item(item),
|
data = inventory_helper.serialize_single_item(item),
|
||||||
-- id = item_id or (item + Random(1, 10000000)),
|
-- id = item_id or (item + Random(1, 10000000)),
|
||||||
slot_x = slot_x,
|
slot_x = slot_x,
|
||||||
slot_y = slot_y,
|
slot_y = slot_y,
|
||||||
active = (mActiveItem == item),
|
active = (mActiveItem == item),
|
||||||
is_wand = true
|
is_wand = true
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
table.insert(spellData,
|
table.insert(spellData,
|
||||||
{
|
{
|
||||||
data = inventory_helper.serialize_single_item(item),
|
data = inventory_helper.serialize_single_item(item),
|
||||||
-- id = item_id or (item + Random(1, 10000000)),
|
-- id = item_id or (item + Random(1, 10000000)),
|
||||||
slot_x = slot_x,
|
slot_x = slot_x,
|
||||||
slot_y = slot_y,
|
slot_y = slot_y,
|
||||||
active = (mActiveItem == item)
|
active = (mActiveItem == item)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -499,7 +499,11 @@ function rpc.item_globalize(item_data)
|
||||||
ComponentSetValue2(com, "value_int", GameGetFrameNum())
|
ComponentSetValue2(com, "value_int", GameGetFrameNum())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
EntityAddComponent2(item, "LuaComponent", {_tags="ew_immortal", script_damage_about_to_be_received = "mods/quant.ew/files/resource/cbs/immortal.lua"})
|
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
|
if not is_my_item(item_data.gid) then
|
||||||
local itemcom = EntityGetFirstComponentIncludingDisabled(item, "ItemComponent")
|
local itemcom = EntityGetFirstComponentIncludingDisabled(item, "ItemComponent")
|
||||||
if ComponentGetValue2(itemcom, "play_hover_animation") then
|
if ComponentGetValue2(itemcom, "play_hover_animation") then
|
||||||
|
|
|
@ -22,6 +22,10 @@ function rpc.got_thrown(peer_id, vx, vy)
|
||||||
if immortal == 0 then
|
if immortal == 0 then
|
||||||
EntityAddComponent2(item, "LuaComponent", {_tags="ew_immortal", script_damage_about_to_be_received = "mods/quant.ew/files/resource/cbs/immortal.lua"})
|
EntityAddComponent2(item, "LuaComponent", {_tags="ew_immortal", script_damage_about_to_be_received = "mods/quant.ew/files/resource/cbs/immortal.lua"})
|
||||||
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)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue