From da81a0a23a3704dd2de3ab2249496c1ad1912d1c Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 9 Oct 2017 16:20:46 -0400 Subject: Updated internal representation of inventories --- gamemode/inventorysystem/prayers/sh_prayers.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'gamemode/inventorysystem/prayers/sh_prayers.lua') diff --git a/gamemode/inventorysystem/prayers/sh_prayers.lua b/gamemode/inventorysystem/prayers/sh_prayers.lua index 83414b7..15cd2af 100644 --- a/gamemode/inventorysystem/prayers/sh_prayers.lua +++ b/gamemode/inventorysystem/prayers/sh_prayers.lua @@ -1,7 +1,16 @@ +--[[ + prayers must have a "Pray" method, + a "Name" string, + a "Description" string +]] local reg = nrequire("inventory/inventory.lua") local itm = nrequire("item.lua") local inv = {} +if CLIENT then + inv = nrequire("cl_prayers.lua") +end + inv.Name = "Prayers" inv.track = {} function inv:FindPlaceFor(item) @@ -42,12 +51,14 @@ function inv:Serialize() end function inv:DeSerialize(str) + local cpy = table.Copy(self) local tbl = util.JSONToTable(str) local i = 1 for k,v in pairs(tbl) do local this_prayer = itm.GetItemByName(k):DeSerialize(v) - self:Put({i},this_prayer) + cpy:Put({i},this_prayer) end + return cpy end -- cgit v1.2.3-70-g09d2