Fixed bugs with file loader etc

master
El Al 5 years ago
parent 36f1535615
commit 7d535482fb
  1. 22
      gamemode/cl_init.lua
  2. 4
      gamemode/core/server/sv_player_init.lua
  3. 14
      gamemode/core/sh_debug.lua
  4. 35
      gamemode/init.lua
  5. 13
      gamemode/shared.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 GM.Client.Load()
function Quantum.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
end
Quantum.Debug( "Loaded all files." )
end
GM.Client.Load()
Quantum.Client.Load()
end

@ -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

@ -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

@ -5,22 +5,24 @@
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
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()
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 )
-- 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
@ -29,11 +31,12 @@ function GM.Server.Load()
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()
Quantum.Server.Load()
end

@ -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()
Quantum = {}
Loading…
Cancel
Save