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/core/inventory | |
| 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/core/inventory')
| -rw-r--r-- | gamemode/core/inventory/inventory.lua | 5 | ||||
| -rw-r--r-- | gamemode/core/inventory/sv_invtracker.lua | 3 |
2 files changed, 4 insertions, 4 deletions
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 |
