Fix up getopencontainer
This commit is contained in:
@@ -215,26 +215,31 @@ end
|
|||||||
---@return Barotrauma.Item[]
|
---@return Barotrauma.Item[]
|
||||||
local function getOpenContainers()
|
local function getOpenContainers()
|
||||||
debugPrint("Attempting to find open container...")
|
debugPrint("Attempting to find open container...")
|
||||||
local containers = {}
|
-- local containers = {}
|
||||||
for item in Item.ItemList do
|
-- for item in Item.ItemList do
|
||||||
---@cast item Barotrauma.Item
|
-- ---@cast item Barotrauma.Item
|
||||||
local isok = true
|
-- local isok = true
|
||||||
isok = isok and item ~= nil
|
-- isok = isok and item ~= nil
|
||||||
isok = isok and item.OwnInventory ~= nil
|
-- isok = isok and item.OwnInventory ~= nil
|
||||||
isok = isok and item.OwnInventory.visualSlots ~= nil
|
-- isok = isok and item.OwnInventory.visualSlots ~= nil
|
||||||
isok = isok and #item.OwnInventory.visualSlots > 0
|
-- isok = isok and #item.OwnInventory.visualSlots > 0
|
||||||
-- I don't know what rootContainer is
|
-- -- I don't know what rootContainer is
|
||||||
-- It seems to be the parent of the current item...?
|
-- -- It seems to be the parent of the current item...?
|
||||||
-- Maybe the world object...
|
-- -- Maybe the world object...
|
||||||
-- Either way - static objects that we may open have it
|
-- -- Either way - static objects that we may open have it
|
||||||
-- And our own inventory does not
|
-- -- And our own inventory does not
|
||||||
-- So it's a good selector for now
|
-- -- So it's a good selector for now
|
||||||
isok = isok and item.rootContainer ~= nil
|
-- isok = isok and item.rootContainer ~= nil
|
||||||
if isok then
|
-- if isok then
|
||||||
containers[#containers + 1] = item
|
-- containers[#containers + 1] = item
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
return containers
|
|
||||||
|
local controlledCharacter = Character.Controlled
|
||||||
|
if not controlledCharacter then return {} end
|
||||||
|
local selectedItem = controlledCharacter.SelectedItem
|
||||||
|
if not selectedItem then return {} end
|
||||||
|
return { selectedItem }
|
||||||
end
|
end
|
||||||
|
|
||||||
-- We would like to fill larger stacks first
|
-- We would like to fill larger stacks first
|
||||||
|
|||||||
Reference in New Issue
Block a user