aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core/inventory
diff options
context:
space:
mode:
Diffstat (limited to 'gamemode/core/inventory')
-rw-r--r--gamemode/core/inventory/inventory.lua5
-rw-r--r--gamemode/core/inventory/sv_invtracker.lua3
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