on character dead crash fix (function rewrite)

This commit is contained in:
Mestima 2021-10-04 20:47:24 +03:00
parent 633abca26f
commit cda33a69c2
No known key found for this signature in database
GPG Key ID: 30B59EB1D7F18807

View File

@ -5,24 +5,21 @@ local assets = {
local prefabs = {} local prefabs = {}
local function onopen(inst) local function onopen(inst)
end end
local function onclose(inst) local function onclose(inst)
--[[ local owner = inst and inst.components and inst.components.inventoryitem and inst.components.inventoryitem.owner or nil
local owner = inst.components.inventoryitem.owner if owner ~= nil then
if owner then local container = owner and owner.components and owner.components.inventory and owner.components.inventory:GetOverflowContainer() or nil
local container = owner.components.inventory:GetOverflowContainer() if container ~= nil then
if container then
container:Open(owner) container:Open(owner)
end end
end end
--]]
end end
local function ondropped(inst) local function ondropped(inst)
if inst.components.container then if inst.components.container ~= nil then
inst.components.container:Close() inst.components.container:Close()
end end
end end
@ -61,7 +58,7 @@ local function fn()
inst:AddComponent("container") inst:AddComponent("container")
inst.components.container:WidgetSetup("pocketwatchpack") inst.components.container:WidgetSetup("pocketwatchpack")
--inst.components.container.onopenfn = onopen --inst.components.container.onopenfn = onopen
--inst.components.container.onclosefn = onclose inst.components.container.onclosefn = onclose
MakeHauntableLaunchAndDropFirstItem(inst) MakeHauntableLaunchAndDropFirstItem(inst)