From c6698dad925e75ffd2ca2f2e30a595d4ce48d240 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sat, 20 May 2017 11:37:23 -0400 Subject: Massive changes I guess --- AUTHORS | 1 - LISCENSE | 17 +++++++-- entities/entities/info_townienode/cl_init.lua | 2 +- entities/entities/info_townienode/init.lua | 2 +- entities/entities/info_townienode/shared.lua | 2 +- entities/entities/npc_townie/init.lua | 2 + gamemode/client/cl_inventory.lua | 22 +++++------ gamemode/client/qpanels/inventory.lua | 4 +- gamemode/client/qtabs/cl_qinventory.lua | 40 ++++++++++---------- gamemode/core/database/sv_setup.lua | 44 +++++++++++----------- gamemode/core/inventory/inventory.lua | 20 +++++----- gamemode/core/inventory/item.lua | 31 +++++++++++---- gamemode/core/inventory/sv_invtracker.lua | 13 ++++--- gamemode/core/npc/cl_shop.lua | 11 ------ gamemode/core/npc/sv_npcsystem.lua | 12 +++--- gamemode/core/pac/sv_pac.lua | 37 +++++++++++++----- gamemode/inventorysystem/cl_common.lua | 3 ++ .../inventorysystem/equipment/cl_equipment.lua | 22 +++++------ .../inventorysystem/equipment/sh_equipment.lua | 4 +- .../inventorysystem/shapedinventory/cl_shaped.lua | 29 +++++++++----- .../inventorysystem/shapedinventory/sh_shaped.lua | 20 ---------- gamemode/itemsystem/armor/balaclava.lua | 2 +- gamemode/itemsystem/exampleitem.lua | 2 +- gamemode/itemsystem/utility/flashlight.lua | 2 +- gamemode/itemsystem/weapons/knuckledclaw.lua | 2 +- gamemode/itemsystem/weapons/rustyaxe.lua | 2 +- gamemode/itemsystem/weapons/seratedknife.lua | 2 +- gamemode/nrequire.lua | 41 +++++++++++++++----- notes.txt | 2 +- 29 files changed, 220 insertions(+), 173 deletions(-) diff --git a/AUTHORS b/AUTHORS index b2a9fa2..d38760d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -7,7 +7,6 @@ Built using work from: TheMaw - Various ideas & item system structure JetBoom - AnimBoneLib (Lua Animation API) CapsAdmin - Pac3 - MiBShidobu - SVG renderer bobbleheadbob - Zones Art & graphics: diff --git a/LISCENSE b/LISCENSE index 2b4768a..cd8c4c1 100644 --- a/LISCENSE +++ b/LISCENSE @@ -1,9 +1,18 @@ Copyright 2016-2017 Alexander "Apickx" Pickering -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +following conditions are met: -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following +disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials provided with the distribution. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/entities/entities/info_townienode/cl_init.lua b/entities/entities/info_townienode/cl_init.lua index 53dec09..7c6a2d1 100644 --- a/entities/entities/info_townienode/cl_init.lua +++ b/entities/entities/info_townienode/cl_init.lua @@ -3,7 +3,7 @@ include('shared.lua') ENT.RenderGroup = RENDERGROUP_BOTH /*--------------------------------------------------------- - Name: Draw + Name: Drawasd Desc: Draw it! ---------------------------------------------------------*/ function ENT:Draw() diff --git a/entities/entities/info_townienode/init.lua b/entities/entities/info_townienode/init.lua index 9fa7f7e..c3226c7 100644 --- a/entities/entities/info_townienode/init.lua +++ b/entities/entities/info_townienode/init.lua @@ -1,5 +1,5 @@ --[[ - This entity gives townies things to do + This entity gives townies things to do asdf ]] AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) diff --git a/entities/entities/info_townienode/shared.lua b/entities/entities/info_townienode/shared.lua index 8b42e7f..ca23db4 100644 --- a/entities/entities/info_townienode/shared.lua +++ b/entities/entities/info_townienode/shared.lua @@ -1,6 +1,6 @@ ENT.Base = "base_entity" -//WS stuff +//WS stuff asdfs ENT.Drops = nil ENT.OnDammage = nil ENT.Speed = 0 diff --git a/entities/entities/npc_townie/init.lua b/entities/entities/npc_townie/init.lua index a110699..908b3e8 100644 --- a/entities/entities/npc_townie/init.lua +++ b/entities/entities/npc_townie/init.lua @@ -37,6 +37,8 @@ function ENT:Initialize() if self.Name then self:SetName(self.Name) else print("NPC created without a name! They won't be able to open doors!") end + + if self.Ang then self:SetAngles(self.Ang) end if self.OnSpawn then self.OnSpawn(self) end diff --git a/gamemode/client/cl_inventory.lua b/gamemode/client/cl_inventory.lua index 7fab07c..758f9b1 100644 --- a/gamemode/client/cl_inventory.lua +++ b/gamemode/client/cl_inventory.lua @@ -14,7 +14,7 @@ local itm = nrequire("core/inventory/common/items.lua") --local qpray = nrequire("cl_qprayers.lua") local inv = {} -print("Hello from cl_inventory.lua") +--print("Hello from cl_inventory.lua") --debug.Trace() local prayerequiped = { @@ -22,7 +22,7 @@ local prayerequiped = { } net.Receive("equiphelpprayer",function() - print("equiphelp received client side!") + --print("equiphelp received client side!") prayerequiped[4] = "Noob Help" end) @@ -39,17 +39,17 @@ local droppanel --Dpanel to drop things on when they are dropped, should be the local player_data --The data the player needs to show the q panel net.Receive("art_load_player_data",function() - print("Got player data") + --print("Got player data") player_data = net.ReadTable() - print("It was") - PrintTable(player_data) + --print("It was") + --PrintTable(player_data) credits = player_data.credits - if creditslabel then creditslabel:SetText(credits) end - print("Credits was", credits) + if creditslabel then creditslabel:SetText(credits or 0) end + --print("Credits was", credits) end) local function BuildInventory() - print("Building inventory") + --print("Building inventory") if qframe and IsValid(qframe) then return end if not player_data then print("no player data!") player_data = {credits = 0} end qframe = vgui.Create("DFrame") @@ -94,7 +94,7 @@ local function BuildInventory() end function inv.ShowInventory() - print("qframe is ", qframe) + --print("qframe is ", qframe) if not qframe then BuildInventory() else qframe:Show() end state.invopen = true @@ -105,9 +105,9 @@ function inv.ShowInventory() droppanel:SetAlpha(10) droppanel:Receiver("item",function(self,panels,dropped,_,_,_) if not dropped then return end - print("Dropedpanel had something dropped on it!") + --print("Dropedpanel had something dropped on it!") --Drop the item - print("Pnl:",pnl) + --print("Pnl:",pnl) local froment = panels[1].info.owner local fromid = panels[1].info.id local frompos = panels[1].info.pos diff --git a/gamemode/client/qpanels/inventory.lua b/gamemode/client/qpanels/inventory.lua index 2850e1d..b93fd7f 100644 --- a/gamemode/client/qpanels/inventory.lua +++ b/gamemode/client/qpanels/inventory.lua @@ -162,8 +162,8 @@ local invsheetfunc = function() if v.PaintEquiped then eqslot.Paint = v.PaintEquiped end - if v.DoOnEqupPanel then - v.DoOnEqupPanel(eqslot) + if v.DoOnEquipPanel then + v.DoOnEquipPanel(eqslot) end eqslot:Droppable("Inventory") eqslot.Item = v diff --git a/gamemode/client/qtabs/cl_qinventory.lua b/gamemode/client/qtabs/cl_qinventory.lua index e4dfaa8..6fc3d37 100644 --- a/gamemode/client/qtabs/cl_qinventory.lua +++ b/gamemode/client/qtabs/cl_qinventory.lua @@ -12,7 +12,7 @@ local inventory_frames = {} local invsheet local drawfloatinginventory = function(id, inventory) - print("Drawing a floating inventory!") + --print("Drawing a floating inventory!") local frame = vgui.Create("DFrame") frame:SetPos( 100, 100 ) frame:SetSize( 300, 200 ) @@ -28,8 +28,8 @@ local drawfloatinginventory = function(id, inventory) end frame:MakePopup() frame.OnClose = function(self) - print("Closeing chest id", id) - print("entity is", known_inventories[id].Owner) + --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) @@ -40,20 +40,20 @@ local drawfloatinginventory = function(id, inventory) end local drawsheeton = function(id,inventory) - print("Drawing an inventory on a sheet!") + --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") + --print("Has drawondpanel") local prox = inventory:DrawOnDPanel(tpanel) - print("Prox returned was",prox) - PrintTable(prox) + --print("Prox returned was",prox) + --PrintTable(prox) known_inventories[id]:AddObserver(prox) - print("Oservers is now") - PrintTable(known_inventories[id].observers) + --print("Oservers is now") + --PrintTable(known_inventories[id].observers) end invsheet:AddSheet( inventory.Name, tpanel, "icon16/tab.png" ) end @@ -61,17 +61,17 @@ end net.Receive("art_ObserveInventory",function() local id = net.ReadUInt(32) local inv_type = net.ReadString() - print("Got inv type", inv_type,"id",id) + --print("Got inv type", inv_type,"id",id) local datalen = net.ReadUInt(32) local inital_data = net.ReadData(datalen) local ownent = net.ReadEntity() - print("Owning ent of this inventory is", ownent) + --print("Owning ent of this inventory is", ownent) assert(known_inventories[id] == nil, "Trying to observe the same inventory twice!",id) local tinv = inv.CreateInventoryFromData(inv_type,inital_data) tinv.Owner = ownent tinv.id = id - print("Created new inventory:") - PrintTable(tinv) + --print("Created new inventory:") + --PrintTable(tinv) known_inventories[id] = tinv if id > 10 then drawfloatinginventory(id,tinv) @@ -87,15 +87,15 @@ net.Receive("art_UpdateInventory",function() local position = net.ReadTable() if isput then local item_name = net.ReadString() - print("Putting ", item_name, "into inventory ",id, " at position") - PrintTable(position) + --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]) + --print("Inventorie's observers:") + --PrintTable(known_inventories[id].observers) + --print("Inventory is now") + --PrintTable(known_inventories[id]) else known_inventories[id]:Remove(position) end @@ -117,7 +117,7 @@ q.CreateInventorySheet = function(dpanel_parent) invsheet:Dock( FILL ) for k,v in pairs(known_inventories) do - print("This inventory id in known_inventories is", k) + --print("This inventory id in known_inventories is", k) if k <= 10 then drawsheeton(k,v) else diff --git a/gamemode/core/database/sv_setup.lua b/gamemode/core/database/sv_setup.lua index 2cb69d1..fd44174 100644 --- a/gamemode/core/database/sv_setup.lua +++ b/gamemode/core/database/sv_setup.lua @@ -30,15 +30,15 @@ end local function connect() - print("Connecting to the database...") + --print("Connecting to the database...") MySQLite.initialize(config) end hook.Add("DatabaseInitialized","setup_table",function() assert(MySQLite.isMySQL(),"Database wasn't mysqloo, something is probably wrong!") local setup_success = function(res,li) - print("Set up connection to db") + --print("Set up connection to db") end - print("Setup query:",setup_db) + --print("Setup query:",setup_db) MySQLite.query(setup_db,setup_success,q_fai) end) @@ -52,56 +52,56 @@ function sql.GetPlayerData(ply) local s64 = ply:SteamID64() local q_str = q.s_fmt(fetch_player_query,s64) local q_suc = function(res,li) - print("Got player's data:",res,type(res)) + --print("Got player's data:",res,type(res)) if res == nil then - print("Was nil, createing player data") + --print("Was nil, createing player data") sql.CreatePlayerTable(ply) else - PrintTable(res) + --PrintTable(res) assert(#res == 1,"Not unique!") - print("Was unique!") + --print("Was unique!") local meta = res[1].MetaData local plyd = res[1].PlayerData local mtbl = util.JSONToTable(meta) - print("About to check if we are on the right server") + --print("About to check if we are on the right server") if mtbl.lastserver ~= game.GetIPAddress() then - print("Connecting player to ", mtbl.lastserver, " was on ", game.GetIPAddress()) + --print("Connecting player to ", mtbl.lastserver, " was on ", game.GetIPAddress()) ply:ConCommand("connect " .. mtbl.lastserver) return end - print("We were on the right server") + --print("We were on the right server") - print("Before finding data in the metatable, mtbl was ") - PrintTable(mtbl) - print(type(mtbl.lastlocation)) + --print("Before finding data in the metatable, mtbl was ") + --PrintTable(mtbl) + --print(type(mtbl.lastlocation)) local _,_,x,y,z = string.find(mtbl.lastlocation,"([-%d%.]+) ([-%d%.]+) ([-%d%.]+)") local vec = {x,y,z} for k,v in pairs(vec) do vec[k] = tonumber(v) end - print("setting player pos to") - PrintTable(vec) + --print("setting player pos to") + --PrintTable(vec) ply:SetPos(Vector(unpack(vec))) q.deserialize_player(ply,plyd) end end - print("doing query",q_str) + --print("doing query",q_str) MySQLite.query(q_str,q_suc,q_fai) end function sql.CreatePlayerTable(ply) - print("Createing player table....") + --print("Createing player table....") local s64 = ply:SteamID64() - print("steamid was", s64) + --print("steamid was", s64) local plytbl = data.newdata() local plymet = data.newmeta() local plydata = util.TableToJSON(plytbl) local metdata = util.TableToJSON(plymet) local q_str = q.s_fmt(create_player_query,s64,plydata,metdata) local q_suc = function(res,li) - print("Inserted new player",ply) + --print("Inserted new player",ply) sql.GetPlayerData(ply) end - print("doing query", q_str) + --print("doing query", q_str) MySQLite.query(q_str,q_suc,q_fai) end @@ -114,7 +114,7 @@ function sql.SendPlayerToInstance(ply,ls,ll) }) local q_str = q.s_fmt(save_player_query,plymeta,plydata,s64) local q_suc = function(res,li) - print("Successfully saved player data") + --print("Successfully saved player data") end MySQLite.query(q_str,q_suc,q_fai) end @@ -131,6 +131,6 @@ concommand.Add("DoQuery",function(ply,cmd,args) end end) -print("In sv_setup.lua, sql before returning is", sql) +--print("In sv_setup.lua, sql before returning is", sql) return sql diff --git a/gamemode/core/inventory/inventory.lua b/gamemode/core/inventory/inventory.lua index 6b6f6f4..62e4819 100644 --- a/gamemode/core/inventory/inventory.lua +++ b/gamemode/core/inventory/inventory.lua @@ -85,8 +85,8 @@ local function SetDefaultObservers(tbl) local oldput,oldremove = tbl.Put,tbl.Remove tbl.Put = function(self,position,item) for k,v in pairs(self.observers) do - print("Calling put on observer:") - PrintTable(v) + --print("Calling put on observer:") + --PrintTable(v) v:Put(position,item) end oldput(self,position,item) @@ -120,20 +120,20 @@ function inv.RegisterInventory(tbl) string.format("Attempted to register inventory with field %q of type %q when it should have been %q",v[1],type(tbl[v[1]]),v[2])) end assert(inventories[tbl.Name] == nil, - "Attempted to register 2 inventories with the same name:" .. tbl.Name) + string.format("Attempted to register 2 inventories with the same name: %q", tbl.Name)) assert((tbl.AddObserver == nil and tbl.RemoveObserver == nil) or (tbl.AddObserver ~= nil and tbl.RemoveObserver ~= nil), - "AddObserver and RemoveObserver must be defined in pairs") + "AddObserver and RemoveObserver must be defined in pairs") if tbl.AddObserver == nil then SetDefaultObservers(tbl) end inventories[tbl.Name] = tbl - print("Registered inventory: " .. tbl.Name) + --print("Registered inventory: " .. tbl.Name) end --Create an inventory function inv.CreateInventory(name) - print("Createing inventory", name) + --print("Createing inventory", name) assert(inventories[name] ~= nil, string.format("Tried to create a copy of inventory that does not exist:%s\nValid inventories are:\n\t%s",name,table.concat(table.GetKeys(inventories),"\n\t"))) local ret = TableCopy(inventories[name]) ret.observers = {} @@ -143,11 +143,11 @@ end --Recreates an inventory from data function inv.CreateInventoryFromData(name,data) local tinv = inv.CreateInventory(name) - print("tinv was", tinv) - PrintTable(tinv) + --print("tinv was", tinv) + --PrintTable(tinv) tinv:DeSerialize(data) - print("is now",tinv) - PrintTable(tinv) + --print("is now",tinv) + --PrintTable(tinv) return tinv end diff --git a/gamemode/core/inventory/item.lua b/gamemode/core/inventory/item.lua index 103da7f..a13efa9 100644 --- a/gamemode/core/inventory/item.lua +++ b/gamemode/core/inventory/item.lua @@ -23,14 +23,19 @@ local required_fields = { "Name","Serialize","DeSerialize" } -local items = {} --Master table of all item prototypes +local items = items or {} --Master table of all item prototypes function itm.RegisterItem(tbl) for k,v in pairs(required_fields) do assert(tbl[v] ~= nil, string.format("Attempted to register item without field %q",v)) end - assert(items[tbl.Name] == nil, string.format("Attempted to register 2 items with the same name %q",tbl.Name)) + --assert(items[tbl.Name] == nil, string.format("Attempted to register 2 items with the same name %q",tbl.Name)) + if items[tbl.Name] ~= nil then + MsgC(Color(255,255,0),"WARNING: attemtpted to register 2 items with the same name " .. tbl.Name .. "\n") + else + MsgC(Color(0,255,0),"Registered Item " .. tbl.Name .. "\n") + end items[tbl.Name] = tbl - print("Registered item: " .. tbl.Name) + --print("Registered item: " .. tbl.Name) end function itm.GetItemByName(name) @@ -49,11 +54,23 @@ function itm.GetItemFromData(name,data) return items[name]:DeSerialize(data) end +local function printitems() + local tbl = {} + for k,v in pairs(items) do + tbl[#tbl + 1] = k + end + print(table.concat(tbl,"\n")) +end + --Must be called in a coroutine. function itm.DeriveItem(tbl,name) + print("Attempting to derive item",name) while items[name] == nil do + print("it dosen't exist yet, items are") + printitems() coroutine.yield() end + print(name,"exists!") --Create a flywieght copy local ret = tbl local mt = { @@ -64,10 +81,8 @@ function itm.DeriveItem(tbl,name) setmetatable(ret,mt) end -concommand.Add("art_printitems",function() - for k,v in pairs(items) do - print(k) - end -end) +hook.Call("artery_include_items") + +concommand.Add("art_printitems",printitems) return itm diff --git a/gamemode/core/inventory/sv_invtracker.lua b/gamemode/core/inventory/sv_invtracker.lua index 47dd164..56407e2 100644 --- a/gamemode/core/inventory/sv_invtracker.lua +++ b/gamemode/core/inventory/sv_invtracker.lua @@ -246,25 +246,26 @@ function track.SendPlayerData(ply) net.Send(ply) end -concommand.Add("SendMeData",function(ply,cmd,args) +concommand.Add("artery_SendMeData",function(ply,cmd,args) track.ClearInventories(ply) track.GiveInventoryTo(ply,"Equipment") track.SendPlayerData(ply) end) -concommand.Add("ShowMyInventories",function(ply,cmd,args) +concommand.Add("artery_ShowMyInventories",function(ply,cmd,args) PrintTable(ply.data.inventories) end) -concommand.Add("AddInventory",function(ply,cmd,args) +concommand.Add("artery_AddInventory",function(ply,cmd,args) track.GiveInventoryTo(ply,args[1]) end) -concommand.Add("GiveItem",function(ply,cmd,args) +concommand.Add("artery_GiveItem",function(ply,cmd,args) xpcall(function() ply:GiveItem(itm.GetItemByName(args[1])) - end,function() - print("Could not find a position to put that in!") + end,function(err) + print("Could not give that item!:") + print(err) end) end) diff --git a/gamemode/core/npc/cl_shop.lua b/gamemode/core/npc/cl_shop.lua index fa076ce..c2c71bc 100644 --- a/gamemode/core/npc/cl_shop.lua +++ b/gamemode/core/npc/cl_shop.lua @@ -52,12 +52,9 @@ local function DrawShopItemOnDPanel(dp,itemtbl,cost) net.SendToServer() end - print("Displaying shape:") - PrintTable(shape) for k = 1, twidth do for i = 1, theight do if not shape[k][i] then - print("Found false spot:",k,i) local emptyslot = vgui.Create("DPanel", dp) emptyslot:SetSize(slotsize,slotsize) emptyslot:SetPos(slotsize * (i - 1) + 2, slotsize * (k - 1) + 2) @@ -81,9 +78,7 @@ local slotsize = math.Round(w / 32) local function DrawShopOnDPanel(dp,items) --This gets pretty involved, lets try to not make it a clusterfuck. dp.Paint = function(self, wi, hi) draw.RoundedBox(4, 0,0,wi,hi,Color(100,0,0)) end - print("dp",dp) local scrollpanel = vgui.Create( "DScrollPanel",dp ) - print("scollpanel",scrollpanel) scrollpanel.Paint = function(self, wi, hi) draw.RoundedBox(4, 0,0,wi,hi,Color(0,0,100)) end scrollpanel:Dock(FILL) for k,v in pairs(items) do @@ -93,13 +88,10 @@ local function DrawShopOnDPanel(dp,items) draw.RoundedBox(4, 1,1,wi-4,hi-4,Color(50,50,50)) draw.RoundedBox(4, 2,2,wi-5,hi-5,Color(100,100,100)) end - print("invpanel",invpanel) DrawShopItemOnDPanel(invpanel,itemtbl,v[2]) scrollpanel:AddItem(invpanel) invpanel:Dock(TOP) local x,_ = invpanel:GetSize() - print("item is",v) - PrintTable(v) invpanel:SetSize(x,slotsize * (#itemtbl.Shape) + 4) invpanel:Dock(TOP) @@ -110,7 +102,6 @@ end local shopwindow,shoppanel local function createshopwindow() - print("Createing shopwindow") shopwindow = vgui.Create( "DFrame" ) shopwindow:SetPos( w - (w / 4), 0 ) shopwindow:SetSize( w / 4, h ) @@ -129,10 +120,8 @@ end createshopwindow() net.Receive("art_openshop",function() - print("shopwindows was ",shopwindow) if not shopwindow:IsValid() then createshopwindow() end assert(shopwindow,"Shopwindow was not created, even after re-createing!") - print("inv was", inv) inv.ShowInventory() shopwindow:SetVisible(true) local stock = net.ReadTable() diff --git a/gamemode/core/npc/sv_npcsystem.lua b/gamemode/core/npc/sv_npcsystem.lua index 78b041f..c53f6ae 100644 --- a/gamemode/core/npc/sv_npcsystem.lua +++ b/gamemode/core/npc/sv_npcsystem.lua @@ -12,7 +12,7 @@ end function n.CreateNPCByName(npcname, pos) assert(npcs[npcname],string.format("No npc named %q, valid names are:\n%s",npcname,table.concat(table.GetKeys(npcs),"\n"))) - print("Createing a ", npcname, " at ", pos) + --print("Createing a ", npcname, " at ", pos) local npctbl = npcs[npcname] local npc = ents.Create("npc_huntable") npc:SetPos(pos) @@ -28,13 +28,13 @@ end --Creates a shop npc with this tbl function n.CreateShop(npc) - print("Createing shop npc") + --print("Createing shop npc") local npcent = ents.Create("npc_shop") for k,v in pairs(npc) do npcent[k] = v end npcent:Spawn() - print("Called spawn") + --print("Called spawn") end --Creates a townie npc with this tbl @@ -87,11 +87,11 @@ local function loadMap() local foldername = "artery/maps/" .. mapname ExecuteOnFolder(foldername,true,function(path) - print("I want to run",path) + --print("I want to run",path) local filetxt = file.Read(path,"DATA") - print("File text is", filetxt) + --print("File text is", filetxt) CompileString(filetxt,path)() - print("I want to execute",path) + --print("I want to execute",path) end) end diff --git a/gamemode/core/pac/sv_pac.lua b/gamemode/core/pac/sv_pac.lua index 482dea6..30d2ef7 100644 --- a/gamemode/core/pac/sv_pac.lua +++ b/gamemode/core/pac/sv_pac.lua @@ -48,28 +48,42 @@ hook.Add("PrePACConfigApply", "stoppacs", function(ply, outfit_data) end end) +local pacsources = { + ["data/artery/pacs/"] = "GAME" +} +function p3.AddPacSource(filepath,from) + pacsources[filepath] = from +end + --When the server starts, get all the pacs and calculate their hashes so we can index them quickly without haveing to read from disk each time. local pachashes = {} local function loadhashes() - local files,_ = file.Find("artery/pacs/*","DATA") - for _,v in ipairs(files) do - local filepath = string.format("artery/pacs/%s",v) - local filetext = file.Read(filepath,"DATA") - local filehash = util.CRC(filetext) - pachashes[string.StripExtension(v)] = tonumber(filehash) + for path,part in pairs(pacsources) do + local files,_ = file.Find(path.."*",part) + for _,v in ipairs(files) do + local filepath = string.format("%s%s",path,v) + local filetext = file.Read(filepath,part) + local filehash = util.CRC(filetext) + pachashes[string.StripExtension(v)] = tonumber(filehash) + end end end loadhashes() +concommand.Add("artery_reload_pac_hashes",loadhashes) local appliedpacs = {} function p3.ApplyPac(what, name) - print("Applying pac", what, "to",name) + print("Applying pac", name, "to",what) appliedpacs[what] = appliedpacs[what] or {} appliedpacs[what][name] = pachashes[name] net.Start("artery_applypac") net.WriteEntity(what) net.WriteString(name) + --If this pac is from an addon that was loaded after this file was, we may need to reload hashes. + if not pachashes[name] then + loadhashes() + end net.WriteUInt(pachashes[name],32) net.Broadcast() end @@ -107,6 +121,7 @@ local pac_cache = {} local function cacheload(key) --If it's already in the cache, just update the time it was last used and return the pac. if pac_cache[key] ~= nil then + print("Pac was already in the cache.") pac_cache[key].time = CurTime() if pac_cache[key].pac == nil then PrintTable(pac_cache) @@ -116,8 +131,9 @@ local function cacheload(key) end --Otherwise, we need to load it. - local pacpath = string.format("artery/pacs/%s.txt",key) - local pacfile = file.Read(pacpath,"DATA") + local pacpath = string.format("data/artery/pacs/%s.txt",key) + local pacfile = file.Read(pacpath,"GAME") + print("Pac was not in cache, reloading, pac txt is",pacfile) --If we haven't reached max cache yet, just put it in if pacs_in_cache < max_pacs_in_cache then @@ -155,6 +171,9 @@ net.Receive("artery_requestpac",function(ln,ply) local pac_txt = cacheload(pac_name) + assert(pac_name,"Pac's name was nil!") + assert(pac_txt, "Pac's txt was nil (from the cache)") + net.Start("artery_downloadpac") net.WriteString(pac_name) net.WriteString(pac_txt) diff --git a/gamemode/inventorysystem/cl_common.lua b/gamemode/inventorysystem/cl_common.lua index 5b461d3..361cf3c 100644 --- a/gamemode/inventorysystem/cl_common.lua +++ b/gamemode/inventorysystem/cl_common.lua @@ -1,4 +1,7 @@ +--[[ + A bunch of functions that a lot of inventories have in common, dragged out here so bugfixing is easier +]] local com = {} --Displays a dropdown of options under the players mouse, if the option is clicked, does the function diff --git a/gamemode/inventorysystem/equipment/cl_equipment.lua b/gamemode/inventorysystem/equipment/cl_equipment.lua index 8a14a1a..82560be 100644 --- a/gamemode/inventorysystem/equipment/cl_equipment.lua +++ b/gamemode/inventorysystem/equipment/cl_equipment.lua @@ -104,7 +104,7 @@ inv.DrawOnDPanel = function(self,panel) print("Drawing equipment on panel") local prox = {} for k,v in pairs(eqp) do - local pn = vgui.Create("DButton",panel) + local pn = vgui.Create("DModelPanel",panel) pn:SetSize(iconsize,iconsize) pn:SetPos(v.x,v.y) pn.info = {} @@ -125,13 +125,8 @@ inv.DrawOnDPanel = function(self,panel) print("Found something equiped in ", k) if self.equiped[k].OnEqpPaint then pn.Paint = self.equiped[k].OnEqpPaint - else - pn.Paint = function(tp,w,h) - draw.RoundedBox( 8, 0, 0, w, h, Color( 255, 0, 0 ) ) - end end else --We don't have something equiped! - print("Nothing was equiped in ", k) if v.img and v.img.material then local c = col.ui.border pn.Paint = function(tp,w,h) @@ -149,10 +144,8 @@ inv.DrawOnDPanel = function(self,panel) end prox[k] = pn end + prox.Put = function(self,position,item) - print("Put was called!",position,item) - PrintTable(position) - PrintTable(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() @@ -164,10 +157,13 @@ inv.DrawOnDPanel = function(self,panel) if item.OnEqpPaint then self[position[1]].Paint = item.OnEqpPaint else - self[position[1]].Paint = function(tp,w,h) - draw.RoundedBox( 8, 0, 0, w, h, Color( 255, 0, 0 ) ) + self[position[1]].Paint = 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) @@ -181,8 +177,10 @@ inv.DrawOnDPanel = function(self,panel) surface.SetMaterial( eqp[position[1]].img.material ) surface.DrawTexturedRect( 0, 0, w, h ) end - print("Remove was called!",position) pn:Droppable("none") + for k,v in pairs(pn:GetChildren()) do + v:Remove() + end end return prox end diff --git a/gamemode/inventorysystem/equipment/sh_equipment.lua b/gamemode/inventorysystem/equipment/sh_equipment.lua index 793eeac..be930e0 100644 --- a/gamemode/inventorysystem/equipment/sh_equipment.lua +++ b/gamemode/inventorysystem/equipment/sh_equipment.lua @@ -5,8 +5,6 @@ local itm = nrequire("item.lua") local ste = nrequire("utility/stream.lua") local inventory = nrequire("inventory/inventory.lua") local col = nrequire("config/colortheme.lua") -print("Got invnetory table, it is:") -PrintTable(inventory) local slots = { "Head", "Shoulders", @@ -98,6 +96,7 @@ end inv.Remove = function(self,position) local item = self.equiped[position[1]] + if not item then return end --Make sure we'r enot dragging an empty space if item.onUnEquip then item:onUnEquip(self.Owner) end self.equiped[position[1]] = nil end @@ -115,7 +114,6 @@ inv.Serialize = function(self) end inv.DeSerialize = function(self,data) - print("deserializeing, data was",data) if data ~= nil and data ~= "" then local tbl = util.JSONToTable(data) local cpy = table.Copy(self) diff --git a/gamemode/inventorysystem/shapedinventory/cl_shaped.lua b/gamemode/inventorysystem/shapedinventory/cl_shaped.lua index c40ffa0..83c2217 100644 --- a/gamemode/inventorysystem/shapedinventory/cl_shaped.lua +++ b/gamemode/inventorysystem/shapedinventory/cl_shaped.lua @@ -6,7 +6,7 @@ local inv = {} local width = ScrW() --local height = ScrH() -local iconsize = width / 40 +local iconsize = ((width / 4) - 20) / 5 local function default_paint(self,w,h) --Draw a box @@ -35,8 +35,6 @@ local function runonshape(self,shape,x,y,func) for i = 1,#shape do for j = 1, #shape[i] do if shape[i][j] then - print("Running on ",i,j) - print("Which translates to", x + j, y + i) func(self.gridpanels[x + i - 1][y + j - 1]) end end @@ -47,6 +45,9 @@ end local function drawitemat(self,x,y,item) print("Drawing item at ",x,y) local tp = self.gridpanels[x][y] + if tp == nil then + error("Unable to continue") + end tp:Droppable("item") runonshape(self,item.Shape,x,y,function(panel) panel:SetVisible(false) @@ -54,17 +55,29 @@ local function drawitemat(self,x,y,item) tp:SetVisible(true) local sx,sy = shapebounds(item.Shape) tp:SetSize(iconsize * sx, iconsize * sy) + tp:SetText(item.Name) tp.DoClick = function() if item.GetOptions then - com.CreateMenuFor(tp,item:GetOptions()) + local dm = DermaMenu() + com.CreateMenuFor(dm,item:GetOptions()) + dm:Open() end end + if item.DoOnPanel then + item:DoOnPanel(tp) + end + if item.Paint then + tp.Paint = item.Paint + end end --Reset the position, using the item and it's shape local function undrawitemat(self,x,y) local item = self:Get({x,y}) - self.gridpanels[x][y]:Droppable("") + local dpn = self.gridpanels[x][y] + dpn:Droppable("") + dpn:SetText("") + for k,v in pairs(dpn:GetChildren()) do v:Remove() end runonshape(self,item.Shape,x,y,function(panel) panel:SetVisible(true) panel:SetSize(iconsize,iconsize) @@ -117,7 +130,6 @@ end ]] inv.DrawOnDPanel = function(self,panel) - print("Drawing shaped on panel") local DScrollPanel = vgui.Create( "DScrollPanel",panel) DScrollPanel:SetPos( 0, 0 ) DScrollPanel:Dock(FILL) @@ -134,9 +146,10 @@ inv.DrawOnDPanel = function(self,panel) --Create the full grid of dpanels for x = 1, self.dimx do for y = 1, self.dimy do - local dp = vgui.Create("DButton") + local dp = vgui.Create("DModelPanel") dp:SetSize(iconsize,iconsize) dp.Paint = default_paint + dp:SetText("") --dp:Droppable("item") dp:Receiver("item",com.generatereceiver(),{"one","two","three"}) dp.info = {} @@ -161,11 +174,9 @@ inv.DrawOnDPanel = function(self,panel) local observer = {} observer.Put = function(obs,position,item) - print("Drawing item at",position[1],position[2]) drawitemat(self,position[1],position[2],item) end observer.Remove = function(obs,position) - print("Undrawing item at",position[1],position[2]) undrawitemat(self,position[1],position[2]) end return observer diff --git a/gamemode/inventorysystem/shapedinventory/sh_shaped.lua b/gamemode/inventorysystem/shapedinventory/sh_shaped.lua index 00beb7f..b77f378 100644 --- a/gamemode/inventorysystem/shapedinventory/sh_shaped.lua +++ b/gamemode/inventorysystem/shapedinventory/sh_shaped.lua @@ -17,13 +17,10 @@ local function calcposition(dimx,dimy,x,y) end local function canfitin(self,x,y,shape) - print("Checking canfitin, tracker was") - PrintTable(self.tracker) for rn,row in ipairs(shape) do for cn,col in ipairs(row) do local absx,absy = x + rn - 1, y + cn - 1 local slot = calcposition(self.dimx,self.dimy,absx,absy) - print("Checking slot", slot) if col and ((self.tracker[slot] ~= nil) or (absx > self.dimx) or (absy > self.dimy)) then return false end @@ -45,19 +42,13 @@ end function inv:CanFitIn(tbl,item) if canfitin(self,tbl[1],tbl[2],item.Shape) then - print("calculated, and can fit") return true else - print("calculated, could not fit") return "Could not fit :(" end end function inv:Put(tbl,item) - print("Before putting ", item) - PrintTable(item) - print("tracker was") - PrintTable(self.tracker) --Set the item's shape to true for rn,row in ipairs(item.Shape) do @@ -72,8 +63,6 @@ function inv:Put(tbl,item) --Now set the item in the correct slot local slot = calcposition(self.dimx,self.dimy,tbl[1],tbl[2]) self.tracker[slot] = item - print("After, tracker was ") - PrintTable(self.tracker) end function inv:Has(ptr) @@ -94,14 +83,8 @@ function inv:Has(ptr) end function inv:Remove(tbl) - print("Removeing from",tbl[1],tbl[2]) local slot = calcposition(self.dimx,self.dimy,tbl[1],tbl[2]) - print("Slot is",slot) - print("Tracking structure is:") - PrintTable(self.tracker) local item = self.tracker[slot] - print("Removeing item",item) - PrintTable(item) self.tracker[slot] = nil for rn,row in ipairs(item.Shape) do for cn,col in ipairs(row) do @@ -111,8 +94,6 @@ function inv:Remove(tbl) end end end - print("After, tracker was") - PrintTable(self.tracker) end function inv:Get(tbl) @@ -132,7 +113,6 @@ function inv:Serialize() end function inv:DeSerialize(str) - print("Deserializeing from ", str) --TODO:Implement local tbl = util.JSONToTable(str) for k,v in pairs(tbl) do diff --git a/gamemode/itemsystem/armor/balaclava.lua b/gamemode/itemsystem/armor/balaclava.lua index 1ea094b..cd31f97 100644 --- a/gamemode/itemsystem/armor/balaclava.lua +++ b/gamemode/itemsystem/armor/balaclava.lua @@ -34,7 +34,7 @@ function item.DoOnPanel(dimagebutton) dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png") end -function item.DoOnEqupPanel(dimagebutton) +function item.DoOnEquipPanel(dimagebutton) print("called with panel:",panel) dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png") end diff --git a/gamemode/itemsystem/exampleitem.lua b/gamemode/itemsystem/exampleitem.lua index a56151f..3c76971 100644 --- a/gamemode/itemsystem/exampleitem.lua +++ b/gamemode/itemsystem/exampleitem.lua @@ -46,7 +46,7 @@ function item.DoOnPanel(dimagebutton) end --Optional. Something run once when this item is drawn in an equiped slot -function item.DoOnEqupPanel(dimagebutton) +function item.DoOnEquipPanel(dimagebutton) print("called with panel:",panel) dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png") end diff --git a/gamemode/itemsystem/utility/flashlight.lua b/gamemode/itemsystem/utility/flashlight.lua index 9a87a75..fa1e3c5 100644 --- a/gamemode/itemsystem/utility/flashlight.lua +++ b/gamemode/itemsystem/utility/flashlight.lua @@ -35,7 +35,7 @@ function item.DoOnPanel(dimagebutton) end --Optional. Something run once when this item is drawn in an equiped slot -function item.DoOnEqupPanel(dimagebutton) +function item.DoOnEquipPanel(dimagebutton) print("called with panel:",panel) dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png") end diff --git a/gamemode/itemsystem/weapons/knuckledclaw.lua b/gamemode/itemsystem/weapons/knuckledclaw.lua index 2f629f6..0665a98 100644 --- a/gamemode/itemsystem/weapons/knuckledclaw.lua +++ b/gamemode/itemsystem/weapons/knuckledclaw.lua @@ -33,7 +33,7 @@ function item.DoOnPanel(dimagebutton) dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png") end -function item.DoOnEqupPanel(dimagebutton) +function item.DoOnEquipPanel(dimagebutton) print("called with panel:",panel) dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png") end diff --git a/gamemode/itemsystem/weapons/rustyaxe.lua b/gamemode/itemsystem/weapons/rustyaxe.lua index 4f613de..359580f 100644 --- a/gamemode/itemsystem/weapons/rustyaxe.lua +++ b/gamemode/itemsystem/weapons/rustyaxe.lua @@ -43,7 +43,7 @@ function item.DoOnPanel(dimagebutton) dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png") end -function item.DoOnEqupPanel(dimagebutton) +function item.DoOnEquipPanel(dimagebutton) print("called with panel:",panel) dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png") end diff --git a/gamemode/itemsystem/weapons/seratedknife.lua b/gamemode/itemsystem/weapons/seratedknife.lua index 7248426..ee116aa 100644 --- a/gamemode/itemsystem/weapons/seratedknife.lua +++ b/gamemode/itemsystem/weapons/seratedknife.lua @@ -34,7 +34,7 @@ function item.DoOnPanel(dimagebutton) dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe.png") end -function item.DoOnEqupPanel(dimagebutton) +function item.DoOnEquipPanel(dimagebutton) print("called with panel:",panel) dimagebutton:SetImage( "weapons/rustyaxe/rustyaxe_eq.png") end diff --git a/gamemode/nrequire.lua b/gamemode/nrequire.lua index 6595fed..1fc70bd 100644 --- a/gamemode/nrequire.lua +++ b/gamemode/nrequire.lua @@ -1,12 +1,15 @@ --[[ A thing that kinda works like require, or at least, works how I wish require worked. + calls hooks: + artery_nrequire_defined + artery_core_loaded ]] --Don't run ourselves, or we'll get stuck in a recursive loop! if nrequire ~= nil then return end print("hello from nrequire!") local path = (GM or GAMEMODE).Folder:gsub("gamemodes/","") .. "/gamemode" --[[ - Calls func on all the files under dir + Calls func on all the files under dir. ]] local function TraverseFolder(dir, func) local fpath = table.concat({path,dir,"/*"}) @@ -102,6 +105,7 @@ local function scan(pretbl, name) pathparts[#pathparts + 1] = part:gsub("/$",""):gsub("^/","") end local filename = name:gfind("[%w_]+%.lua")() + assert(filename ~= nil,string.format("Could not file a filename for %q from parts: %s valid files are:\n\t%s",name,table.concat(pathparts,","),table.concat(collect_paths(pretbl),"\n\t"))) local cursor = pretbl[filename] assert(cursor ~= nil,string.format("Scan did not find a file named %q, valid files are:\n\t%s",filename,table.concat(collect_paths(pretbl),"\n\t"))) local rev = {} @@ -126,39 +130,58 @@ local ntbl = rebuild_include_table(paths) local reqtbl = {} for k,v in pairs(paths) do if SERVER and not v:match("/?sv_[%w_]+%.lua$") then - print("Adding CS lua file",v) + --print("Adding CS lua file",v) AddCSLuaFile(v) end end local pathstack = {} +local coroutines = {} --[[ Returns the table returned by executing a file. The table is cached after is is loaded, so calling nrequire() on a file twice will only run it once. ]] function nrequire(req) - local tpath = scan(ntbl,req) - if reqtbl[tpath] then - --print("Cache hit! returning",reqtbl[tpath]) - --for k,v in pairs(reqtbl[tpath]) do print(k,":",v) end + local tpath = scan(ntbl,req) --Find the full path from partial path + if reqtbl[tpath] then --And just return it if we've already included it. return reqtbl[tpath] end + --Otherwise, make sure we don't have a circular dependancy for k,v in pairs(pathstack) do assert(v ~= tpath,string.format("Circular dependancy detected:\n\t%s\n\t\t|\n\t\tV\n\t%s",table.concat(pathstack,"\n\t\t|\n\t\tV\n\t"),v)) end + + --Override print so it's easy to see what file is printing what local tab_rep = {} for k = 1, #pathstack do tab_rep[k] = "\t" end - print(string.format("%sIncluding %q",table.concat(tab_rep),tpath)) + --print(string.format("%sIncluding %q",table.concat(tab_rep),tpath)) local oldprint = print print = function(...) oldprint(" ",unpack({...})) end + + --Deal with bookkeeping dealing with circular dependancies, and include pathstack[#pathstack + 1] = tpath - reqtbl[tpath] = include(tpath) + co = coroutine.create(function() + reqtbl[tpath] = include(tpath) + --print("Finished ", tpath) + end) + coroutines[#coroutines + 1] = co + coroutine.resume(co) pathstack[#pathstack] = nil + + --Try to resume everyone else waiting on something + for k,v in pairs(coroutines) do + --V will be nil when the coroutine finishes, which removes it from the list, nifty. + coroutine.resume(v) + end + + --Undo the crazy print print = oldprint - print(string.format("%sIncluded %q",table.concat(tab_rep),tpath)) + --print(string.format("%sIncluded %q",table.concat(tab_rep),tpath)) return reqtbl[tpath] end +hook.Call("artery_nrequire_defined") + --[[ Automatically include all the files in the gamemode directory based on the file name. If the file starts with cl_ it will only be included on the client, if it starts with sv_ it will only be included on the server. If it starts with anything else, it will be shared. Will detect and error on circuar dependancy. diff --git a/notes.txt b/notes.txt index 892ce4d..1da07c8 100644 --- a/notes.txt +++ b/notes.txt @@ -7,7 +7,7 @@ Bits and bobs, roughly documentation Quests, Inventory, and Skills might all potentially do mysql injection, be careful in their creation, and don't let users enter any fields about them! -When createing new files, make sure the file has some text in it (even just a comment explaining what the file will eventually hold) include() will crash the game if called on an empty file. +When creating new files, make sure the file has some text in it (even just a comment explaining what the file will eventually hold) include() will crash the game if called on an empty file. If your server starts breaking after a while, it's probably the fault of /gamemode/shared/sh_buff.lua, no you can't put a bandaid on it to fix it, you have to re-write it. -- cgit v1.2.3-70-g09d2