diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-05-20 11:37:23 -0400 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-05-20 11:37:23 -0400 |
| commit | c6698dad925e75ffd2ca2f2e30a595d4ce48d240 (patch) | |
| tree | 226338dc7ee26a6316951554cf953112ba072c76 /gamemode/inventorysystem/equipment | |
| parent | 9e0537b0aa417e88a6a61238484ddcef74080ae0 (diff) | |
| download | artery-c6698dad925e75ffd2ca2f2e30a595d4ce48d240.tar.gz artery-c6698dad925e75ffd2ca2f2e30a595d4ce48d240.tar.bz2 artery-c6698dad925e75ffd2ca2f2e30a595d4ce48d240.zip | |
Massive changes I guess
Diffstat (limited to 'gamemode/inventorysystem/equipment')
| -rw-r--r-- | gamemode/inventorysystem/equipment/cl_equipment.lua | 22 | ||||
| -rw-r--r-- | gamemode/inventorysystem/equipment/sh_equipment.lua | 4 |
2 files changed, 11 insertions, 15 deletions
diff --git a/gamemode/inventorysystem/equipment/cl_equipment.lua b/gamemode/inventorysystem/equipment/cl_equipment.lua index 8a14a1a..82560be 100644 --- a/gamemode/inventorysystem/equipment/cl_equipment.lua +++ b/gamemode/inventorysystem/equipment/cl_equipment.lua @@ -104,7 +104,7 @@ inv.DrawOnDPanel = function(self,panel) print("Drawing equipment on panel") local prox = {} for k,v in pairs(eqp) do - local pn = vgui.Create("DButton",panel) + local pn = vgui.Create("DModelPanel",panel) pn:SetSize(iconsize,iconsize) pn:SetPos(v.x,v.y) pn.info = {} @@ -125,13 +125,8 @@ inv.DrawOnDPanel = function(self,panel) print("Found something equiped in ", k) if self.equiped[k].OnEqpPaint then pn.Paint = self.equiped[k].OnEqpPaint - else - pn.Paint = function(tp,w,h) - draw.RoundedBox( 8, 0, 0, w, h, Color( 255, 0, 0 ) ) - end end else --We don't have something equiped! - print("Nothing was equiped in ", k) if v.img and v.img.material then local c = col.ui.border pn.Paint = function(tp,w,h) @@ -149,10 +144,8 @@ inv.DrawOnDPanel = function(self,panel) end prox[k] = pn end + prox.Put = function(self,position,item) - print("Put was called!",position,item) - PrintTable(position) - PrintTable(item) assert(self[position[1]] ~= nil, "Tried to put an item into an unknown slot! Slot:" .. position[1]) if item.GetOptions then self[position[1]].DoClick = function() @@ -164,10 +157,13 @@ inv.DrawOnDPanel = function(self,panel) if item.OnEqpPaint then self[position[1]].Paint = item.OnEqpPaint else - self[position[1]].Paint = function(tp,w,h) - draw.RoundedBox( 8, 0, 0, w, h, Color( 255, 0, 0 ) ) + self[position[1]].Paint = function(panel) + draw.DrawText( item.Name, "DermaDefault", 10, 10, Color( 0, 0, 0, 0 )) end end + if item.DoOnEquipPanel then + item:DoOnEquipPanel(self[position[1]]) + end self[position[1]]:Droppable("item") end prox.Remove = function(self,position) @@ -181,8 +177,10 @@ inv.DrawOnDPanel = function(self,panel) surface.SetMaterial( eqp[position[1]].img.material ) surface.DrawTexturedRect( 0, 0, w, h ) end - print("Remove was called!",position) pn:Droppable("none") + for k,v in pairs(pn:GetChildren()) do + v:Remove() + end end return prox end diff --git a/gamemode/inventorysystem/equipment/sh_equipment.lua b/gamemode/inventorysystem/equipment/sh_equipment.lua index 793eeac..be930e0 100644 --- a/gamemode/inventorysystem/equipment/sh_equipment.lua +++ b/gamemode/inventorysystem/equipment/sh_equipment.lua @@ -5,8 +5,6 @@ local itm = nrequire("item.lua") local ste = nrequire("utility/stream.lua") local inventory = nrequire("inventory/inventory.lua") local col = nrequire("config/colortheme.lua") -print("Got invnetory table, it is:") -PrintTable(inventory) local slots = { "Head", "Shoulders", @@ -98,6 +96,7 @@ end inv.Remove = function(self,position) local item = self.equiped[position[1]] + 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 end @@ -115,7 +114,6 @@ inv.Serialize = function(self) end inv.DeSerialize = function(self,data) - print("deserializeing, data was",data) if data ~= nil and data ~= "" then local tbl = util.JSONToTable(data) local cpy = table.Copy(self) |
