dont remove spell inventory when revived

This commit is contained in:
bgkillas 2024-08-22 13:57:59 -04:00
parent 1be2aa6992
commit 21ad8e8a63
2 changed files with 20 additions and 7 deletions

View file

@ -281,10 +281,16 @@ function inventory_helper.set_item_data(item_data, player_data)
return return
end end
local items = GameGetAllInventoryItems(player) or {} local children = EntityGetAllChildren(player)
for _, item_id in ipairs(items) do for _, child in pairs(children) do
GameKillInventoryItem(player, item_id) if EntityGetName(child) == "inventory_quick" then
EntityKill(item_id) local inv = EntityGetAllChildren(child)
if inv ~= nil then
for _, item in pairs(inv) do
EntityKill(item)
end
end
end
end end

View file

@ -33,9 +33,16 @@ local function remove_inventory_tags()
end end
local function remove_inventory() local function remove_inventory()
local items = GameGetAllInventoryItems(ctx.my_player.entity) local children = EntityGetAllChildren(ctx.my_player.entity)
for _, item in ipairs(items) do for _, child in pairs(children) do
EntityKill(item) if EntityGetName(child) == "inventory_quick" then
local inv = EntityGetAllChildren(child)
if inv ~= nil then
for _, item in pairs(inv) do
EntityKill(item)
end
end
end
end end
end end