aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core/inventory
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2018-03-25 12:58:22 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2018-03-25 12:58:22 -0400
commit025ef8554016a2647f31244cf6413d80dba91847 (patch)
tree32280de04737bf4a90f96cfe3120c3fd10a06a76 /gamemode/core/inventory
parent563f3e3960221fd9144e9adbde53c09392f772dd (diff)
downloadartery-025ef8554016a2647f31244cf6413d80dba91847.tar.gz
artery-025ef8554016a2647f31244cf6413d80dba91847.tar.bz2
artery-025ef8554016a2647f31244cf6413d80dba91847.zip
Fix #3
Allows pacs that have been loaded on join to be removed Also loads player data much sooner after the player spawns in.
Diffstat (limited to 'gamemode/core/inventory')
-rw-r--r--gamemode/core/inventory/common/items.lua2
-rw-r--r--gamemode/core/inventory/inventory.lua7
-rw-r--r--gamemode/core/inventory/sv_invtracker.lua1
3 files changed, 8 insertions, 2 deletions
diff --git a/gamemode/core/inventory/common/items.lua b/gamemode/core/inventory/common/items.lua
index 0a32f27..65d8e4a 100644
--- a/gamemode/core/inventory/common/items.lua
+++ b/gamemode/core/inventory/common/items.lua
@@ -3,6 +3,7 @@
--@shared items.lua
--@alias items
+local log = nrequire("log.lua")
local items = {}
-- local function drop_provided(ent,invid,frompos)
@@ -28,6 +29,7 @@ function items.DropItem(ent_or_tbl,invid,frompos)
end
]]
assert(CLIENT,"requested to drop an item when we are not the client!")
+ log.debug("Drop item was requested, ent_or_tbl is" .. tostring(ent_or_tbl))
net.Start("art_RequestInvDrop")
net.WriteEntity(ent_or_tbl)
net.WriteUInt(invid,32)
diff --git a/gamemode/core/inventory/inventory.lua b/gamemode/core/inventory/inventory.lua
index ff9cc8c..52443a8 100644
--- a/gamemode/core/inventory/inventory.lua
+++ b/gamemode/core/inventory/inventory.lua
@@ -174,9 +174,12 @@ function inv.CreateInventoryFromData(name,data,owner)
--print("tinv was", tinv)
--PrintTable(tinv)
local ret = tinv:DeSerialize(data)
- --print("is now",tinv)
- --PrintTable(tinv)
+ print("is now",ret)
+ PrintTable(ret)
assert(ret != nil, "Failed to create inventory " .. name .. ", returned nil")
+ assert(ret.Owner != nil, "Creating inventory with no owner!")
+ assert(ret.Owner:IsValid(), "Owner of inventory was not valid!")
+ assert(ret.Owner != Entity(0), "Owner was worldspawn! something went wrong!")
return ret
end
diff --git a/gamemode/core/inventory/sv_invtracker.lua b/gamemode/core/inventory/sv_invtracker.lua
index 257410b..8795d2a 100644
--- a/gamemode/core/inventory/sv_invtracker.lua
+++ b/gamemode/core/inventory/sv_invtracker.lua
@@ -77,6 +77,7 @@ net.Receive("art_RequestInvDrop",function(len,ply)
local froment = net.ReadEntity()
local frominvid = net.ReadUInt(32)
local frompos = net.ReadTable()
+ log.debug("Requesting invdrop from " .. tostring(froment))
assert(not froment:IsPlayer() or froment == ply, "Player tried to drop an item that was from another players inventory")
local frominv = froment.data.inventories[frominvid]
local item = frominv:Get(frompos)