diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-01-08 22:28:08 -0500 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-01-08 22:28:08 -0500 |
| commit | 98e0462e4f6b13ff26af5211409352d45dd9453e (patch) | |
| tree | fbff14dc9a0fffdda409d9989f2e34cd4bb265f6 /gamemode/client/qtabs | |
| parent | 4879eb1d78520ce0ac9b0bb0ef5244cf65ad7c99 (diff) | |
| download | artery-98e0462e4f6b13ff26af5211409352d45dd9453e.tar.gz artery-98e0462e4f6b13ff26af5211409352d45dd9453e.tar.bz2 artery-98e0462e4f6b13ff26af5211409352d45dd9453e.zip | |
Add a ton of icons, more work on refactoring
Diffstat (limited to 'gamemode/client/qtabs')
| -rw-r--r-- | gamemode/client/qtabs/cl_qinventory.lua | 69 | ||||
| -rw-r--r-- | gamemode/client/qtabs/cl_qprayers.lua | 8 |
2 files changed, 77 insertions, 0 deletions
diff --git a/gamemode/client/qtabs/cl_qinventory.lua b/gamemode/client/qtabs/cl_qinventory.lua new file mode 100644 index 0000000..a3f8a16 --- /dev/null +++ b/gamemode/client/qtabs/cl_qinventory.lua @@ -0,0 +1,69 @@ +--[[ + One of the tabs in the inventory +]] + +local inv = nrequire("inventory/inventory.lua") +local itm = nrequire("item.lua") + +local q = {} + +local known_inventories = {} +local inventory_frames = {} + +net.Receive("art_ObserveInventory",function() + local id = net.ReadUInt(32) + local inv_type = net.ReadString() + print("Got inv type", inv_type,"id",id) + local inital_data = net.ReadData(net.ReadUInt(32)) + known_inventories[id] = inv.CreateInventoryFromData(inv_type,initaldata) +end) + +net.Receive("art_UpdateInventory",function() + local id = net.ReadUInt(32) + local isput = net.ReadBool() + local position = net.ReadTable() + if isput then + local item_name = net.ReadString() + local item_data = net.ReadData(net.ReadUInt(32)) + local item = itm.GetItemFromData(item_name,item_data) + known_inventories[id]:Put(position,item) + else + known_inventories[id]:Remove(position) + end +end) + +net.Receive("art_CloseInventory",function() + local id = net.ReadUInt(32) + known_inventories[id] = nil + if inventory_frames[id] then + inventory_frames[id]:Close() + inventory_frames[id] = nil + end +end) + +local width,height = (ScrW() / 4) - 10, ScrH() +local iconsize = width / 5 + + +q.CreateInventorySheet = function(dpanel_parent) + --assert(known_inventories[watch_id] ~= nil,"Attempted to watch an inventory that dosn't exist!") + --Display the equipment inventories + local invsheet = vgui.Create( "DPropertySheet", dpanel_parent ) + invsheet:Dock( FILL ) + + for k,v in pairs(known_inventories) do + local tpanel = vgui.Create( "DPanel", invsheet ) + tpanel.Paint = function( self, w, h ) + draw.RoundedBox( 4, 0, 0, w, h, Color( 0, 128, 255 ) ) + end + if v.DrawOnDPanel then + local prox = v:DrawOnDPanel(tpanel) + known_inventories[k]:AddObserver(prox) + end + invsheet:AddSheet( v.Name, tpanel, "icon16/tab.png" ) + end + + return invsheet +end + +return q diff --git a/gamemode/client/qtabs/cl_qprayers.lua b/gamemode/client/qtabs/cl_qprayers.lua new file mode 100644 index 0000000..9f1b9ab --- /dev/null +++ b/gamemode/client/qtabs/cl_qprayers.lua @@ -0,0 +1,8 @@ + +local p = {} + +function p.CreatePrayerSheet(dpanel_parent) + +end + +return p |
