diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-08-21 17:52:42 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-08-21 17:52:42 -0400 |
| commit | 5e6e88f98300d4c3d41aad7cff5346539f4f9f66 (patch) | |
| tree | bc5de00f63a8b1d5226b0c2988fcdaa06f6e2f13 /gamemode/inventorysystem | |
| parent | 978909d830dd173f8b018f36c5f142d225732ba1 (diff) | |
| download | artery-5e6e88f98300d4c3d41aad7cff5346539f4f9f66.tar.gz artery-5e6e88f98300d4c3d41aad7cff5346539f4f9f66.tar.bz2 artery-5e6e88f98300d4c3d41aad7cff5346539f4f9f66.zip | |
Fixed loading bug
Fixed a bug where the equipment inventory would not load correctly.
Diffstat (limited to 'gamemode/inventorysystem')
| -rw-r--r-- | gamemode/inventorysystem/equipment/cl_equipment.lua | 3 | ||||
| -rw-r--r-- | gamemode/inventorysystem/equipment/sh_equipment.lua | 19 |
2 files changed, 13 insertions, 9 deletions
diff --git a/gamemode/inventorysystem/equipment/cl_equipment.lua b/gamemode/inventorysystem/equipment/cl_equipment.lua index 57a07ad..ca03bf6 100644 --- a/gamemode/inventorysystem/equipment/cl_equipment.lua +++ b/gamemode/inventorysystem/equipment/cl_equipment.lua @@ -126,6 +126,9 @@ inv.DrawOnDPanel = function(self,panel) if self.equiped[k].OnEqpPaint then pn.PaintOver = self.equiped[k].OnEqpPaint end + if self.equiped[k].DoOnEquipPanel then + self.equiped[k]:DoOnEquipPanel(pn) + end else --We don't have something equiped! if v.img and v.img.material then local c = col.ui.border diff --git a/gamemode/inventorysystem/equipment/sh_equipment.lua b/gamemode/inventorysystem/equipment/sh_equipment.lua index 8dc9442..7095363 100644 --- a/gamemode/inventorysystem/equipment/sh_equipment.lua +++ b/gamemode/inventorysystem/equipment/sh_equipment.lua @@ -112,20 +112,21 @@ inv.Serialize = function(self) tbl[k] = {v.Name, v:Serialize()} end end - return util.TableToJSON(tbl) + local ret = util.TableToJSON(tbl) + return ret end inv.DeSerialize = function(self,data) - if data ~= nil and data ~= "" then - local tbl = util.JSONToTable(data) - local cpy = table.Copy(self) - for k,v in pairs(tbl) do - cpy.equiped[k] = itm.GetItemByName(v[1]):DeSerialize(v[2]) - end - return cpy - else + if data == nil or data == '' then return table.Copy(self) end + local tbl = util.JSONToTable(data) + local cpy = table.Copy(self) + for k,v in pairs(tbl) do + local te = itm.GetItemByName(v[1]):DeSerialize(v[2]) + cpy:Put({k},te) + end + return cpy end inventory.RegisterInventory(inv) |
