From 5e6e88f98300d4c3d41aad7cff5346539f4f9f66 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 21 Aug 2017 17:52:42 -0400 Subject: Fixed loading bug Fixed a bug where the equipment inventory would not load correctly. --- gamemode/core/inventory/inventory.lua | 5 +++-- gamemode/core/inventory/sv_invtracker.lua | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'gamemode/core/inventory') diff --git a/gamemode/core/inventory/inventory.lua b/gamemode/core/inventory/inventory.lua index f28cc18..5ff4c10 100644 --- a/gamemode/core/inventory/inventory.lua +++ b/gamemode/core/inventory/inventory.lua @@ -4,7 +4,7 @@ Registers a new inventory prototype, see below CreateInventory(string_name) ::table_inventory Creates a new inventory be sure to set the .owner and .id fields! - CreateInventoryFromData(string_name,string_data)::table_inventory) + CreateInventoryFromData(string_name,string_data,entity_owner)::table_inventory) Just deserializes an inventory. You still need to set .owner and .id! DeriveInventory(string_name) ::table_inventory Creates a new inventory from an old, allows for heiarchy. @@ -144,8 +144,9 @@ function inv.CreateInventory(name) end --Recreates an inventory from data -function inv.CreateInventoryFromData(name,data) +function inv.CreateInventoryFromData(name,data,owner) local tinv = inv.CreateInventory(name) + tinv.Owner = owner --print("tinv was", tinv) --PrintTable(tinv) local ret = tinv:DeSerialize(data) diff --git a/gamemode/core/inventory/sv_invtracker.lua b/gamemode/core/inventory/sv_invtracker.lua index c60298c..bb5aba6 100644 --- a/gamemode/core/inventory/sv_invtracker.lua +++ b/gamemode/core/inventory/sv_invtracker.lua @@ -171,10 +171,9 @@ end function track.GiveInventoryWithData(ply,name,data) print("Giveing inventory with data") - local i = inv.CreateInventoryFromData(name,data) + local i = inv.CreateInventoryFromData(name,data,ply) local nid = #ply.data.inventories + 1 local observer = track.MakeInventoryObserver(ply,nid) - i.Owner = ply i.id = nid i:AddObserver(observer) ply.data.inventories[nid] = i -- cgit v1.2.3-70-g09d2