From 81d3d4eb333e226432a591461b84ed12f5ac9a3f Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sat, 21 Jul 2018 19:08:34 -0400 Subject: 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. --- gamemode/inventorysystem/equipment/cl_equipment.lua | 4 ++-- gamemode/inventorysystem/equipment/sh_equipment.lua | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'gamemode/inventorysystem/equipment') diff --git a/gamemode/inventorysystem/equipment/cl_equipment.lua b/gamemode/inventorysystem/equipment/cl_equipment.lua index 8d06594..58fc3f9 100644 --- a/gamemode/inventorysystem/equipment/cl_equipment.lua +++ b/gamemode/inventorysystem/equipment/cl_equipment.lua @@ -118,7 +118,7 @@ inv.DrawOnDPanel = function(self,panel) if self.equiped[k].GetOptions then pn.DoClick = function() local dm = DermaMenu() - com.CreateMenuFor(dm,self.equiped[k].GetOptions()) + com.CreateMenuFor(dm,self.equiped[k]:GetOptions()) dm:Open() end end @@ -153,7 +153,7 @@ inv.DrawOnDPanel = function(self,panel) if item.GetOptions then self[position[1]].DoClick = function() local dm = DermaMenu() - com.CreateMenuFor(dm,item.GetOptions()) + com.CreateMenuFor(dm,item:GetOptions()) dm:Open() end end diff --git a/gamemode/inventorysystem/equipment/sh_equipment.lua b/gamemode/inventorysystem/equipment/sh_equipment.lua index b27dd08..a9b6f83 100644 --- a/gamemode/inventorysystem/equipment/sh_equipment.lua +++ b/gamemode/inventorysystem/equipment/sh_equipment.lua @@ -77,17 +77,18 @@ end inv.Put = function(self,position,item) self.equiped[position[1]] = item if item.onEquip then item:onEquip(self.Owner) end + item.inv = self end inv.Has = function(self,string_or_compare_func) if type(string_or_compare_func) == "string" then for k,v in pairs(self.equiped) do - if v.Name == string_or_compare_func then return k end + if v.Name == string_or_compare_func then return {k} end end return nil elseif type(string_or_compare_func) == "function" then for k,v in pairs(self.equiped) do - if string_or_compare_func(v.Name) then return k end + if string_or_compare_func(v.Name) then return {k} end end return nil end @@ -99,6 +100,7 @@ inv.Remove = function(self,position) if not item then return end --Make sure we'r enot dragging an empty space if item.onUnEquip then item:onUnEquip(self.Owner) end self.equiped[position[1]] = nil + item.inv = nil end inv.Get = function(self,position) -- cgit v1.2.3-70-g09d2