aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core/inventory
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2018-07-21 19:08:34 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2018-07-21 19:08:34 -0400
commit81d3d4eb333e226432a591461b84ed12f5ac9a3f (patch)
treed802983c3caf6683f1fd8eb881c7df65afa0d27b /gamemode/core/inventory
parentbfdf805676684a838dde5d4cdeb3d8c972d5003d (diff)
downloadartery-81d3d4eb333e226432a591461b84ed12f5ac9a3f.tar.gz
artery-81d3d4eb333e226432a591461b84ed12f5ac9a3f.tar.bz2
artery-81d3d4eb333e226432a591461b84ed12f5ac9a3f.zip
Various updates
* Animation api now allows sequences to be played * items now have a .inv attribute that is set when they are added to shaped or equipment inventories * Refactored the way skill inventory is structured * Added some more methods to cl_common to move items around on a player * Minor update to nrequire to display purple message when asked to include a file that dosn't exist.
Diffstat (limited to 'gamemode/core/inventory')
-rw-r--r--gamemode/core/inventory/cl_invtracker.lua3
-rw-r--r--gamemode/core/inventory/sv_invtracker.lua14
2 files changed, 16 insertions, 1 deletions
diff --git a/gamemode/core/inventory/cl_invtracker.lua b/gamemode/core/inventory/cl_invtracker.lua
index dac1cc2..e6633f9 100644
--- a/gamemode/core/inventory/cl_invtracker.lua
+++ b/gamemode/core/inventory/cl_invtracker.lua
@@ -4,7 +4,7 @@
local inv = nrequire("inventory/inventory.lua")
local itm = nrequire("item.lua")
-nrequire("cl_loadglobals.lua")
+-- nrequire("cl_loadglobals.lua")
--local state = nrequire("cl_state.lua")
local q = {}
@@ -98,6 +98,7 @@ net.Receive("art_UpdateInventory",function()
local item_data = net.ReadData(net.ReadUInt(32))
local item = itm.GetItemFromData(item_name,item_data)
known_inventories[id]:Put(position,item)
+ item.inv = known_inventories[id]
--print("Inventorie's observers:")
--PrintTable(known_inventories[id].observers)
--print("Inventory is now")
diff --git a/gamemode/core/inventory/sv_invtracker.lua b/gamemode/core/inventory/sv_invtracker.lua
index ed5da4a..b6f6b52 100644
--- a/gamemode/core/inventory/sv_invtracker.lua
+++ b/gamemode/core/inventory/sv_invtracker.lua
@@ -223,6 +223,20 @@ function plymeta:HasItem(ptr)
return false
end
+--- Gets a refrence to an item without removeing it
+-- Gets an item, if you want to look at the fields without changing them.
+-- If you do need to change fields, remove the item, change the field, then
+-- re-give the item.
+--@metamethod player:GetItem(loc)
+--@tparam table loc The position of the item (returned by plymeta:HasItem())
+--@treturn itemtbl The item at the location
+function plymeta:GetItem(loc)
+ local nid = loc[1]
+ local pos = loc[2]
+ local item = self.data.inventories[nid]:Get(pos)
+ return item
+end
+
---A shortcut to remove an item from a player.
-- Removes an item from a player and returns the item
--@metamethod player:RemoveItem(tbl)