diff options
Diffstat (limited to 'gamemode/inventorysystem/equipment/cl_equipment.lua')
| -rw-r--r-- | gamemode/inventorysystem/equipment/cl_equipment.lua | 22 |
1 files changed, 10 insertions, 12 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 |
