aboutsummaryrefslogtreecommitdiff
path: root/gamemode/inventorysystem/shapedinventory
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode/inventorysystem/shapedinventory')
-rw-r--r--gamemode/inventorysystem/shapedinventory/cl_shaped.lua3
-rw-r--r--gamemode/inventorysystem/shapedinventory/sh_shaped.lua7
2 files changed, 7 insertions, 3 deletions
diff --git a/gamemode/inventorysystem/shapedinventory/cl_shaped.lua b/gamemode/inventorysystem/shapedinventory/cl_shaped.lua
index 7c60156..d9a4a08 100644
--- a/gamemode/inventorysystem/shapedinventory/cl_shaped.lua
+++ b/gamemode/inventorysystem/shapedinventory/cl_shaped.lua
@@ -46,6 +46,9 @@ end
--Draw the item in a position
local function drawitemat(self,x,y,item)
+ assert(self ~= nil, "I am nil!")
+ assert(self.gridpanels ~= nil, "My gridpanels were nil!")
+ assert(self.gridpanels[x] ~= nil, "Could not find that row!")
local tp = self.gridpanels[x][y]
if tp == nil then
error("Unable to continue, could not find item at (" .. x .. "," .. y .. ")")
diff --git a/gamemode/inventorysystem/shapedinventory/sh_shaped.lua b/gamemode/inventorysystem/shapedinventory/sh_shaped.lua
index 5de6272..42edaa6 100644
--- a/gamemode/inventorysystem/shapedinventory/sh_shaped.lua
+++ b/gamemode/inventorysystem/shapedinventory/sh_shaped.lua
@@ -119,17 +119,18 @@ function inv:Serialize()
end
function inv:DeSerialize(str)
- local ret = table.Copy(self)
+ self.tracker = {}
local tbl = util.JSONToTable(str)
+ tbl = tbl or {}
for k,v in pairs(tbl) do
local name = k
local pos = v[1]
local data = v[2]
local item = itm.GetItemFromData(name,data)
- ret:Put(pos,item)
+ self:Put(pos,item)
--ret.tracker[pos] = itm.GetItemFromData(name,data)
end
- return ret
+ return self
end