From 021d8e86d264e098f9fdce265300ceeb9207506e Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 6 Nov 2017 23:20:38 -0500 Subject: Removed unused code --- gamemode/autolua.lua | 99 ---------------------- gamemode/client/areas/loadareas.lua | 3 - gamemode/client/hud/cl_svgtest.lua | 46 ---------- gamemode/client/qtabs/cl_qinventory.lua | 145 -------------------------------- gamemode/client/qtabs/cl_qprayers.lua | 8 -- 5 files changed, 301 deletions(-) delete mode 100644 gamemode/autolua.lua delete mode 100644 gamemode/client/areas/loadareas.lua delete mode 100644 gamemode/client/hud/cl_svgtest.lua delete mode 100644 gamemode/client/qtabs/cl_qinventory.lua delete mode 100644 gamemode/client/qtabs/cl_qprayers.lua (limited to 'gamemode') diff --git a/gamemode/autolua.lua b/gamemode/autolua.lua deleted file mode 100644 index e38a107..0000000 --- a/gamemode/autolua.lua +++ /dev/null @@ -1,99 +0,0 @@ ---[[ - A few functions to make it easier to include files and folders - Thanks to TheMaw for this idea, this entire file is basically ripped form GearFox. - - module functions: - a.AddMixedFolder(foldername, recursive) :: nil - DarkRP style file include(cl_,sv_,sh_) - a.AddCSLuaFolder(foldername,recursive) :: nil - a.AddSHLuaFolder(foldername,recursive) :: nil - a.AddSVLuaFolder(foldername,recursive) :: nil -]] -do return end --- @module autolua -local auto = {} - -local function ExecuteOnFolder(dir, recursive, func) - recursive = recursive ~= nil and recursive or false - local path = GM.Folder:gsub("gamemodes/","") .. "/gamemode/" - local fpath = table.concat({path,dir,"/*"}) - local files, directories = file.Find(fpath,"LUA") - for k,v in pairs(files) do - if string.GetExtensionFromFilename(v) ~= "lua" then continue end - local callpath = table.concat({path,dir,"/",v}) - func(callpath) - end - if recursive then - for k,v in pairs(directories) do - local npath = table.concat({dir,"/",v}) - ExecuteOnFolder(npath,true,func) - end - end -end - -auto.AddMixedFolder = function(dir,recursive) - ExecuteOnFolder(dir,recursive,function(f) - print("Doing file" .. f) - if f:find("/cl_%w+%.lua$") then - print("found cl") - if SERVER then AddCSLuaFile(f) else include(f) end - elseif f:find("/sv_%w+%.lua$") then - print("Foudn sv") - if SERVER then include(f) end - else - print("otherwise") - if SERVER then AddCSLuaFile(f) end - include(f) - end - end) -end - ---- Adds files client side. --- Calls AddCSLuaFile on all files under a folder server side, and include() client side, if the recursive flag is checked, calls all files under all folders as well. --- @string dir The directory relative to /gamemode/ to add client side --- @param recursive boolean value that when true includes all sub-folders recursively. -auto.AddLuaCSFolder = function(dir,recursive) - ExecuteOnFolder(dir,recursive,function(f) - if SERVER then AddCSLuaFile(f) - else include(f) end - end) -end - ---- Adds files server side. --- Calls include() on all files under a folder, if the recursive flag is checked, calls all files under all folders as well. --- @string dir The directory relative to /gamemode/ to add client side --- @param recursive boolean value that when true includes all sub-folders recursively. -auto.AddLuaSVFolder = function(dir,recursive) - if CLIENT then return end - ExecuteOnFolder(dir,recursive,function(f) - include(f) - end) -end - ---- Adds files server side. --- Calls include() and AddCSLuaFile() on all files under a folder server side, and include() client side, if the recursive flag is checked, calls all files under all folders as well. --- @string dir The directory relative to /gamemode/ to add client side --- @param recursive boolean value that when true includes all sub-folders recursively. -auto.AddLuaSHFolder = function(dir,recursive) - ExecuteOnFolder(dir,recursive,function(f) - if SERVER then AddCSLuaFile(f) end - include(f) - end) -end - ---- Adds resources for the client to download --- Calls resource.AddFile() on all files under a directory, recursive. --- @param the path to add all files under, relative to the /content/ directory. -auto.AddContentFolder = function(dir) - local path = string.format("gamemodes/artery/content/%s/",dir) - local files, directories = file.Find(path .. "*","MOD") - for k,v in pairs(files) do - resource.AddFile(path .. v) - end - for k,v in pairs(directories) do - local npath = table.concat({dir,"/",v}) - auto.AddContentFolder(npath) - end -end - -return auto diff --git a/gamemode/client/areas/loadareas.lua b/gamemode/client/areas/loadareas.lua deleted file mode 100644 index a8c506d..0000000 --- a/gamemode/client/areas/loadareas.lua +++ /dev/null @@ -1,3 +0,0 @@ ---[[ - Loads the area names for the current map -]] diff --git a/gamemode/client/hud/cl_svgtest.lua b/gamemode/client/hud/cl_svgtest.lua deleted file mode 100644 index 9a55c8c..0000000 --- a/gamemode/client/hud/cl_svgtest.lua +++ /dev/null @@ -1,46 +0,0 @@ --- do return end --- local svg = nrequire("cl_svg.lua") --- local mats = {} --- local matstrs = {} --- for i = 2,10 do --- for _,t in pairs({"clubs","diamonds","hearts","spades"}) do --- matstrs[#matstrs + 1] = string.format( "materials/svg/aussiesim/cards/svg/000000/transparent/card-%d-%s.svg",i,t) --- end --- end --- --- for k,v in pairs(matstrs) do --- mats[k] = file.Read(v,"GAME") --- end --- local truemats = {} --- for k,v in pairs(matstrs) do --- truemats[k] = svg.MaterialFromSVG(v) --- end --- --local parsed = xmlparser:parse(matstr) --- local htmls = {} --- local nx = ScrW()/64 --- local ny = ScrH()/64 --- for x = 1,nx do --- for y = 1,ny do --- local thtml = vgui.Create("DSprite") --svg.SvgOnDpanel("materials/svg/aussiesim/cards/svg/000000/transparent/card-2-clubs.svg") --- thtml:SetSize(64,64) --- thtml:SetPos(x * 64,y * 64) --- htmls[y * nx + x] = thtml --- end --- end --- --- hook.Add("HUDPaint","paint_svg",function() --- --local randommat = table.Random(matstrs) --- --html:RunJavascript( string.format("document.body.innerHTML = 'HTML changed from Lua using JavaScript!';"" ) --- --[[ --- for k,v in pairs(htmls) do --- v:UpdateImage(randommat) --- end --- ]] --- --- for k,v in pairs(htmls) do --- local randommat = table.Random(truemats) --- if randommat.material then --- v:SetMaterial(randommat.material) --- end --- end --- end) diff --git a/gamemode/client/qtabs/cl_qinventory.lua b/gamemode/client/qtabs/cl_qinventory.lua deleted file mode 100644 index 32fd441..0000000 --- a/gamemode/client/qtabs/cl_qinventory.lua +++ /dev/null @@ -1,145 +0,0 @@ ---[[ - One of the tabs in the inventory -]] -do return end -local inv = nrequire("inventory/inventory.lua") -local itm = nrequire("item.lua") ---local state = nrequire("cl_state.lua") - -local q = {} - -local known_inventories = {} -local inventory_frames = {} -local invsheet -q.known_inventories = known_inventories - -local drawfloatinginventory = function(id, inventory) - --print("Drawing a floating inventory!") - local frame = vgui.Create("DFrame") - frame:SetPos( ScrW() - (ScrW() / 4), 0 ) - frame:SetSize( ScrW() / 4, ScrH() / 4 ) - frame:SetTitle( inventory.Name ) - frame:SetDraggable( true ) - local panel = vgui.Create("DPanel",frame) - panel:Dock(FILL) - if inventory.DrawOnDPanel then - local prox = inventory:DrawOnDPanel(panel) - frame.id = known_inventories[id]:AddObserver(prox) - else - error("Inventory needs a DrawOnDPanel method!") - end - frame:MakePopup() - frame.OnClose = function(self) - --print("Closeing chest id", id) - --print("entity is", known_inventories[id].Owner) - known_inventories[id]:RemoveObserver(self.id) - net.Start("closechestinv") - net.WriteEntity(known_inventories[id].Owner) - net.SendToServer() - known_inventories[id] = nil - self:Remove() - end -end - -local drawsheeton = function(id,inventory) - --print("Drawing an inventory on a sheet!") - if invsheet == nil then return end - 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 inventory.DrawOnDPanel then - --print("Has drawondpanel") - local prox = inventory:DrawOnDPanel(tpanel) - --print("Prox returned was",prox) - --PrintTable(prox) - known_inventories[id]:AddObserver(prox) - --print("Oservers is now") - --PrintTable(known_inventories[id].observers) - end - invsheet:AddSheet( inventory.Name, tpanel, "icon16/tab.png" ) -end - -net.Receive("art_ObserveInventory",function() - print("Got call to observe inventory") - local id = net.ReadUInt(32) - local inv_type = net.ReadString() - --print("Got inv type", inv_type,"id",id) - local datalen = net.ReadUInt(32) - local inital_data = net.ReadData(datalen) - local ownent = net.ReadEntity() - assert(known_inventories[id] == nil, "Trying to observe the same inventory twice!",id) - local tinv = inv.CreateInventoryFromData(inv_type,inital_data,ownent) - tinv.id = id - known_inventories[id] = tinv - if id > 10 then - drawfloatinginventory(id,tinv) - hook.Call("OnSpawnMenuOpen") - else - drawsheeton(id,tinv) - end -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() - --print("Putting ", item_name, "into inventory ",id, " at position") - --PrintTable(position) - local item_data = net.ReadData(net.ReadUInt(32)) - local item = itm.GetItemFromData(item_name,item_data) - known_inventories[id]:Put(position,item) - --print("Inventorie's observers:") - --PrintTable(known_inventories[id].observers) - --print("Inventory is now") - --PrintTable(known_inventories[id]) - 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) - -q.CreateInventorySheet = function(dpanel_parent) - --assert(known_inventories[watch_id] ~= nil,"Attempted to watch an inventory that dosn't exist!") - --Display the equipment inventories - invsheet = vgui.Create( "DPropertySheet", dpanel_parent ) - invsheet:Dock( FILL ) - - for k,v in pairs(known_inventories) do - --print("This inventory id in known_inventories is", k) - if k <= 10 then - drawsheeton(k,v) - else - drawfloatinginventory(k,v) - end - --[[ - 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 - -concommand.Add("PrintKnownInventories",function(ply,cmd,args) - PrintTable(known_inventories) -end) - -return q diff --git a/gamemode/client/qtabs/cl_qprayers.lua b/gamemode/client/qtabs/cl_qprayers.lua deleted file mode 100644 index af2b29f..0000000 --- a/gamemode/client/qtabs/cl_qprayers.lua +++ /dev/null @@ -1,8 +0,0 @@ -do return end -local p = {} - -function p.CreatePrayerSheet(dpanel_parent) - -end - -return p -- cgit v1.2.3-70-g09d2