diff --git a/gamemode/cl_init.lua b/gamemode/cl_init.lua index 2e7350f..58d23d0 100644 --- a/gamemode/cl_init.lua +++ b/gamemode/cl_init.lua @@ -5,21 +5,29 @@ -- \ \ / ____ \| | | | | | | | __/ (__| | | | / / -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -include( "shared.lua" ) +if CLIENT then + include( "shared.lua" ) + Quantum.Client = {} -GM.Client = {} + -- Add all core files --- Add all core files + function Quantum.Client.Load() + local fol = GM.FolderName .. "/gamemode/core/" -function GM.Client.Load() - local fol = GM.FolderName .. "/gamemode/core/" + -- Shared files + local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" ) + for _, file in pairs( shFiles ) do + include( fol .. file ) + end - -- CLient files - local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" ) - for _, file in pairs( clFiles ) do - include( fol .. "client/" .. file ) - end + -- CLient files + local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" ) + for _, file in pairs( clFiles ) do + include( fol .. "client/" .. file ) + end -end + Quantum.Debug( "Loaded all files." ) + end -GM.Client.Load() \ No newline at end of file + Quantum.Client.Load() +end \ No newline at end of file diff --git a/gamemode/core/server/sv_player_init.lua b/gamemode/core/server/sv_player_init.lua index 0034506..7fd22fd 100644 --- a/gamemode/core/server/sv_player_init.lua +++ b/gamemode/core/server/sv_player_init.lua @@ -11,7 +11,7 @@ function GM:PlayerSpawn( ply ) if( !ply:GetModel() || !ply:GetModel() == "" ) then ply:SetupHands() else - self.Debug( tostring(ply) .. " doesn't have a valid model." ) + Quantum.Error( tostring(ply) .. " doesn't have a valid model. Unable to set up hands!" ) end - self.Debug( tostring( ply ) .. " spawned." ) + Quantum.Debug( tostring( ply ) .. " spawned." ) end \ No newline at end of file diff --git a/gamemode/core/sh_debug.lua b/gamemode/core/sh_debug.lua index 2b29661..bf5ddbc 100644 --- a/gamemode/core/sh_debug.lua +++ b/gamemode/core/sh_debug.lua @@ -6,14 +6,20 @@ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ --- This is used for debugging :D +local prefix +if CLIENT then prefix = "[Quantum] : " else prefix = "" end -function GM.Debug( txt ) - if( txt ) then MsgC( Color( 100, 100, 100 ), "[Debug] " .. txt .. "\n" ) else MsgC( Color( 100, 100, 100 ), "[Debug]" .. "\n" ) end +function Quantum.Debug( txt ) + if( txt ) then + MsgC( Color( 200, 200, 200 ), prefix .. "[Debug] " .. txt .. "\n" ) + else + MsgC( Color( 200, 200, 200 ), prefix .. "[Debug]\n" ) + end end -function GM.Error( txt ) +function Quantum.Error( txt ) if( txt ) then - MsgC( Color( 255, 10, 10 ), "[ERROR] " .. txt .. "\n" ) + MsgC( Color( 255, 10, 10 ), prefix .. "[ERROR] " .. txt .. "\n" ) else return end diff --git a/gamemode/init.lua b/gamemode/init.lua index 7f40ee8..02c46d5 100644 --- a/gamemode/init.lua +++ b/gamemode/init.lua @@ -5,35 +5,38 @@ -- \ \ / ____ \| | | | | | | | __/ (__| | | | / / -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -AddCSLuaFile( "cl_init.lua" ) -AddCSLuaFile( "shared.lua" ) +if SERVER then + AddCSLuaFile( "cl_init.lua" ) + AddCSLuaFile( "shared.lua" ) -include( "shared.lua" ) + include( "shared.lua" ) -GM.Server = {} + Quantum.Server = {} --- Add all core files + -- Add all core files -function GM.Server.Load() - local fol = GM.FolderName .. "/gamemode/core/" + function Quantum.Server.Load() + local fol = GM.FolderName .. "/gamemode/core/" - -- Server files - local cFiles = file.Find( fol .. "/server/sv_*.lua", "LUA" ) - for _, file in pairs( cFiles ) do - include( fol .. "server/" .. file ) - end + -- Shared files + local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" ) + for _, file in pairs( shFiles ) do + AddCSLuaFile( fol .. file ) + include( fol .. file ) + end - -- CLient files - local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" ) - for _, file in pairs( clFiles ) do - AddCSLuaFile( fol .. "client/" .. file ) - end + -- CLient files + local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" ) + for _, file in pairs( clFiles ) do + AddCSLuaFile( fol .. "client/" .. file ) + end - -- Shared files - local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" ) - for _, file in pairs( shFiles ) do - AddCSLuaFile( fol .. file ) + -- Server files + local cFiles = file.Find( fol .. "/server/sv_*.lua", "LUA" ) + for _, file in pairs( cFiles ) do + include( fol .. "server/" .. file ) + end end -end -GM.Server.Load() \ No newline at end of file + Quantum.Server.Load() +end \ No newline at end of file diff --git a/gamemode/shared.lua b/gamemode/shared.lua index 6e4f114..0861f84 100644 --- a/gamemode/shared.lua +++ b/gamemode/shared.lua @@ -10,15 +10,4 @@ GM.Author = "AlmTech" GM.Email = "elias@almtech.se" GM.Website = "N/A" -GM.Shared = {} - -function GM.Shared.Load() - local fol = GM.FolderName .. "/gamemode/core/" - - local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" ) - for _, file in pairs( shFiles ) do - include( fol .. file ) - end -end - -GM.Shared.Load() \ No newline at end of file +Quantum = {} \ No newline at end of file