From e2dc5bf1fec1e634a60801aca3acf41422e0c880 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Tue, 9 Jan 2018 18:19:26 -0500 Subject: Changed nrequire() to do the job of dataloader As a side effect, this means that mods can now nrequire() from other mods, and that the dataloader is depriciated. --- gamemode/client/cl_inventory.lua | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'gamemode/client/cl_inventory.lua') diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua index 1fe53b0..002ea73 100644 --- a/gamemode/client/cl_inventory.lua +++ b/gamemode/client/cl_inventory.lua @@ -38,13 +38,6 @@ inv.tabsheet = nil local clt = nrequire("cl_invtracker.lua") -local player_data --The data the player needs to show the q panel -net.Receive("art_load_player_data",function() - player_data = net.ReadTable() - credits = player_data.credits - if creditslabel then creditslabel:SetText(credits or 0) end -end) - local function CreateSheetTree(tabs,dpropertysheet) for k,v in pairs(tabs) do if type(k) == "string" then @@ -64,8 +57,6 @@ end local function BuildInventory() if qframe and IsValid(qframe) then return end - --if not player_data then error("no player data!") player_data = {credits = 0} end - if not player_data then return end --We havn't loaded in yet... qframe = vgui.Create("DFrame") qframe:SetPos(0,0) qframe:SetSize(width / 4, height) @@ -102,8 +93,13 @@ end ---Shows the player's inventory. -- If the player's inventory hasn't been built yet, builds the inventory, then displays it. function inv.ShowInventory() - if not qframe then BuildInventory() - else qframe:Show() end + print('Showing inventory') + if not qframe then + BuildInventory() + assert(qframe ~= nil, "qframe was still nil after building inventory") + else + qframe:Show() + end state.invopen = true droppanel = vgui.Create("DPanel") droppanel:SetSize(ScrW(),ScrH()) -- cgit v1.2.3-70-g09d2