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
end
local items = GameGetAllInventoryItems(player) or {}
for _, item_id in ipairs(items) do
GameKillInventoryItem(player, item_id)
EntityKill(item_id)
local children = EntityGetAllChildren(player)
for _, child in pairs(children) do
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

View file

@ -33,10 +33,17 @@ local function remove_inventory_tags()
end
local function remove_inventory()
local items = GameGetAllInventoryItems(ctx.my_player.entity)
for _, item in ipairs(items) do
local children = EntityGetAllChildren(ctx.my_player.entity)
for _, child in pairs(children) do
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
local function allow_notplayer_perk(perk_id)