local col = nrequire("colortheme.lua") local svg = nrequire("cl_svg.lua") local com = nrequire("cl_common.lua") local inv = {} local width, height = (ScrW() / 4) - 25, ScrH() local iconsize = width / 5 local ucol = col.console.black local ringmat = svg.MaterialFromSVG("materials/svg/delapouite/originals/svg/000000/transparent/ring.svg", nil, ucol) --Positions for the eqipment inventory local eqp = { ["Head"] = { x = (width / 2) - (iconsize / 2), y = 0, img = svg.MaterialFromSVG("materials/svg/lorc/originals/svg/000000/transparent/cracked-helm.svg", nil, ucol), }, ["Shoulders"] = { x = (width / 2) - (iconsize / 2), y = iconsize, img = svg.MaterialFromSVG("materials/svg/skoll/originals/svg/000000/transparent/pauldrons.svg", nil, ucol) }, ["Chest"] = { x = width / 2, y = iconsize * 2, img = svg.MaterialFromSVG("materials/svg/willdabeast/deviations/svg/000000/transparent/chain-mail.svg", nil, ucol) }, ["Back"] = { x = (width / 2) - iconsize, y = iconsize * 2, img = svg.MaterialFromSVG("materials/svg/lorc/originals/svg/000000/transparent/knapsack.svg", nil, ucol), }, ["Arms"] = { x = (width / 2) - (iconsize / 2), y = iconsize * 3, img = svg.MaterialFromSVG("materials/svg/skoll/originals/svg/000000/transparent/bracers.svg", nil, ucol) }, ["Belt"] = { x = (width / 2) - (iconsize * 1.5), y = iconsize * 3, img = svg.MaterialFromSVG("materials/svg/lucasms/equipment/svg/000000/transparent/belt.svg", nil, ucol) }, ["Gloves"] = { x = (width / 2) + (iconsize / 2), y = iconsize * 3, img = svg.MaterialFromSVG("materials/svg/delapouite/originals/svg/000000/transparent/gloves.svg", nil, ucol) }, ["Left Hand"] = { x = width / 2, y = iconsize * 4, img = svg.MaterialFromSVG("materials/svg/sbed/originals/svg/000000/transparent/shield.svg", nil, ucol) }, ["Right Hand"] = { x = (width / 2) - iconsize, y = iconsize * 4, img = svg.MaterialFromSVG("materials/svg/delapouite/originals/svg/000000/transparent/thor-hammer.svg", nil, ucol) }, ["Legs"] = { x = (width / 2) - iconsize, y = iconsize * 5, img = svg.MaterialFromSVG("materials/svg/irongamer/originals/svg/000000/transparent/armored-pants.svg", nil, ucol) }, ["Feet"] = { x = width / 2, y = iconsize * 5, img = svg.MaterialFromSVG("materials/svg/lorc/originals/svg/000000/transparent/boots.svg", nil, ucol), }, ["Ring 1"] = { x = 0, y = iconsize, img = ringmat }, ["Ring 2"] = { x = width - iconsize, y = iconsize, img = ringmat }, ["Ring 3"] = { x = 0, y = iconsize * 2.5, img = ringmat }, ["Ring 4"] = { x = width - iconsize, y = iconsize * 2.5, img = ringmat }, ["Ring 5"] = { x = 0, y = iconsize * 4, img = ringmat }, ["Ring 6"] = { x = width - iconsize, y = iconsize * 4, img = ringmat }, } inv.DrawOnDPanel = function(self,panel) print("Drawing equipment on panel") local prox = {} for k,v in pairs(eqp) do local pn = vgui.Create("DModelPanel",panel) pn:SetSize(iconsize,iconsize) pn:SetPos(v.x,v.y) pn.info = {} pn.info.owner = LocalPlayer() pn.info.id = self.id pn.info.pos = {k} pn.info.inv = self pn:Droppable("item") pn:Receiver("item",com.generatereceiver(),{"one","two","three"}) if self.equiped[k] then --We have something equiped! if self.equiped[k].GetOptions then pn.DoClick = function() local dm = DermaMenu() com.CreateMenuFor(dm,self.equiped[k].GetOptions()) dm:Open() end end print("Found something equiped in ", k) if self.equiped[k].OnEqpPaint then pn.PaintOver = self.equiped[k].OnEqpPaint end if self.equiped[k].DoOnEquipPanel then self.equiped[k]:DoOnEquipPanel(pn) end else --We don't have something equiped! if v.img and v.img.material then local c = col.ui.border pn.PaintOver = function(tp,w,h) surface.SetDrawColor(c.r,c.g,c.b) surface.DrawOutlinedRect(0, 0, w, h) surface.SetDrawColor(255,255,255) surface.SetMaterial( v.img.material ) surface.DrawTexturedRect( 0, 0, w, h ) end else pn.Paint = function(tp,w,h) draw.RoundedBox( 8, 0, 0, w, h, Color( 0, 0, 0 ) ) end end end prox[k] = pn end prox.Put = function(self,position,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() local dm = DermaMenu() com.CreateMenuFor(dm,item.GetOptions()) dm:Open() end end if item.OnEqpPaint then self[position[1]].PaintOver = item.OnEqpPaint else self[position[1]].PaintOver = 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) local pn = self[position[1]] pn.DoClick = function() end local c = col.ui.border pn.PaintOver = function(self,w,h) surface.SetDrawColor(c.r,c.g,c.b) surface.DrawOutlinedRect(0, 0, w, h) surface.SetDrawColor(255,255,255) surface.SetMaterial( eqp[position[1]].img.material ) surface.DrawTexturedRect( 0, 0, w, h ) end pn:Droppable("none") for k,v in pairs(pn:GetChildren()) do v:Remove() end if pn.Entity then pn.Entity:Remove() end end return prox end return inv