Fixed bugs with file loader etc

master
El Al 5 years ago
parent 36f1535615
commit 7d535482fb
  1. 30
      gamemode/cl_init.lua
  2. 4
      gamemode/core/server/sv_player_init.lua
  3. 14
      gamemode/core/sh_debug.lua
  4. 49
      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 Quantum.Client.Load()
local fol = GM.FolderName .. "/gamemode/core/"
function GM.Client.Load() -- Shared files
local fol = GM.FolderName .. "/gamemode/core/" local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" )
for _, file in pairs( shFiles ) do
include( fol .. file )
end
-- CLient files -- CLient files
local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" ) local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" )
for _, file in pairs( clFiles ) do for _, file in pairs( clFiles ) do
include( fol .. "client/" .. file ) include( fol .. "client/" .. file )
end
Quantum.Debug( "Loaded all files." )
end end
Quantum.Client.Load()
end end
GM.Client.Load()

@ -11,7 +11,7 @@ function GM:PlayerSpawn( ply )
if( !ply:GetModel() || !ply:GetModel() == "" ) then if( !ply:GetModel() || !ply:GetModel() == "" ) then
ply:SetupHands() ply:SetupHands()
else 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 end
self.Debug( tostring( ply ) .. " spawned." ) Quantum.Debug( tostring( ply ) .. " spawned." )
end end

@ -6,14 +6,20 @@
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
--- This is used for debugging :D --- This is used for debugging :D
local prefix
if CLIENT then prefix = "[Quantum] : " else prefix = "" end
function GM.Debug( txt ) function Quantum.Debug( txt )
if( txt ) then MsgC( Color( 100, 100, 100 ), "[Debug] " .. txt .. "\n" ) else MsgC( Color( 100, 100, 100 ), "[Debug]" .. "\n" ) end if( txt ) then
MsgC( Color( 200, 200, 200 ), prefix .. "[Debug] " .. txt .. "\n" )
else
MsgC( Color( 200, 200, 200 ), prefix .. "[Debug]\n" )
end
end end
function GM.Error( txt ) function Quantum.Error( txt )
if( txt ) then if( txt ) then
MsgC( Color( 255, 10, 10 ), "[ERROR] " .. txt .. "\n" ) MsgC( Color( 255, 10, 10 ), prefix .. "[ERROR] " .. txt .. "\n" )
else else
return return
end end

@ -5,35 +5,38 @@
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / / -- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
AddCSLuaFile( "cl_init.lua" ) if SERVER then
AddCSLuaFile( "shared.lua" ) 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/" local fol = GM.FolderName .. "/gamemode/core/"
-- Server files -- Shared files
local cFiles = file.Find( fol .. "/server/sv_*.lua", "LUA" ) local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" )
for _, file in pairs( cFiles ) do for _, file in pairs( shFiles ) do
include( fol .. "server/" .. file ) AddCSLuaFile( fol .. file )
end include( fol .. file )
end
-- CLient files -- CLient files
local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" ) local clFiles = file.Find( fol .. "/client/cl_*.lua", "LUA" )
for _, file in pairs( clFiles ) do for _, file in pairs( clFiles ) do
AddCSLuaFile( fol .. "client/" .. file ) AddCSLuaFile( fol .. "client/" .. file )
end end
-- Shared files -- Server files
local shFiles = file.Find( fol .. "/sh_*.lua", "LUA" ) local cFiles = file.Find( fol .. "/server/sv_*.lua", "LUA" )
for _, file in pairs( shFiles ) do for _, file in pairs( cFiles ) do
AddCSLuaFile( fol .. file ) include( fol .. "server/" .. file )
end
end end
end
GM.Server.Load() Quantum.Server.Load()
end

@ -10,15 +10,4 @@ GM.Author = "AlmTech"
GM.Email = "elias@almtech.se" GM.Email = "elias@almtech.se"
GM.Website = "N/A" GM.Website = "N/A"
GM.Shared = {} Quantum = {}
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()
Loading…
Cancel
Save