diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2018-01-14 15:38:14 -0500 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2018-01-14 15:38:14 -0500 |
| commit | 5e4b759e6b4fd8af9e66f76090ee868368bee467 (patch) | |
| tree | 0f8eded6108928bf0c5b080201af04ed330bb3a5 /gamemode/ents/art_chest/cl_art_chest.lua | |
| parent | dadd9486581d217c0482ddd639a13b95428e6366 (diff) | |
| download | artery-5e4b759e6b4fd8af9e66f76090ee868368bee467.tar.gz artery-5e4b759e6b4fd8af9e66f76090ee868368bee467.tar.bz2 artery-5e4b759e6b4fd8af9e66f76090ee868368bee467.zip | |
Moved art_chest entity into gamemode folder
Moved the art_chest entity to use the unusual artery system instead of
the default entity system.
Diffstat (limited to 'gamemode/ents/art_chest/cl_art_chest.lua')
| -rw-r--r-- | gamemode/ents/art_chest/cl_art_chest.lua | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/gamemode/ents/art_chest/cl_art_chest.lua b/gamemode/ents/art_chest/cl_art_chest.lua new file mode 100644 index 0000000..6800810 --- /dev/null +++ b/gamemode/ents/art_chest/cl_art_chest.lua @@ -0,0 +1,64 @@ +local ENT = nrequire("sh_art_chest.lua") +--local invfuncs = include("../../../gamemode/shared/inventory_common.lua") +local invfuncs = nrequire("inventory/inventory.lua") + +ENT.RenderGroup = RENDERGROUP_BOTH + +function ENT:Initialize() +end + +function ENT:OnRemove() +end + +function ENT:Think() +end + +function ENT:Draw() + + self:DrawModel() +end + +local oldpanel = nil +local namecache = {} + +net.Receive("openchestinv",function(len,ply) + if oldpanel ~= nil then oldpanel:Remove() end + local what = net.ReadEntity() + local chest = invfuncs.DeSerializeBackpack() + ShowInventory() + local dat = {} + dat.redraw = function() + net.Start("requestchestinv") + net.WriteEntity(what) + net.SendToServer() + end + dat.panel = vgui.Create( "DFrame" ) + oldpanel = dat.panel + dat.panel.OnClose = function() + net.Start("closechestinv") + net.WriteEntity(what) + net.SendToServer() + end + table.insert(LocalPlayer().invdisplays,dat) + local width = ScrW() + local height = ScrH() + local invpanel = dat.panel + invpanel:SetPos( width - (width / 4), 0 ) + invpanel:SetSize( width / 4, height ) + if namecache[what] == nil then + net.Start("requestchestname") + net.WriteEntity(what) + net.SendToServer() + invpanel:SetTitle( "Chest" ) + else + invpanel:SetTitle(namecache[what]) + end + invpanel:SetDraggable( true ) + invpanel:MakePopup() + local innerpanel = vgui.Create("DPanel",dat.panel) + innerpanel:Dock(FILL) + innerpanel.Paint = function( self, w, h ) draw.RoundedBox( 4, 0, 0, w, h, Color( 157, 160, 167 ) ) end + invfuncs.DrawBackpackOnDPanel(innerpanel, chest, 1, what) +end) + +scripted_ents.Register(ENT, "art_chest") |
