From bfed037a5d5b2e31a1c6d7793ee8aa8b8307930f Mon Sep 17 00:00:00 2001 From: AlmTech Software Date: Sun, 5 Jan 2020 20:54:11 +0100 Subject: [PATCH] Created new var file structure --- gamemode/cl_init.lua | 3 +++ gamemode/engine/lib/server/sv_inventory.lua | 4 +++- gamemode/engine/vars/cl_vars.lua | 9 +++++++++ gamemode/engine/{lib => vars}/sh_vars.lua | 17 +---------------- gamemode/engine/vars/sv_vars.lua | 6 ++++++ gamemode/init.lua | 6 ++++++ gamemode/shared.lua | 2 ++ 7 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 gamemode/engine/vars/cl_vars.lua rename gamemode/engine/{lib => vars}/sh_vars.lua (75%) create mode 100644 gamemode/engine/vars/sv_vars.lua diff --git a/gamemode/cl_init.lua b/gamemode/cl_init.lua index 7aa0459..d0d2aff 100644 --- a/gamemode/cl_init.lua +++ b/gamemode/cl_init.lua @@ -8,6 +8,9 @@ if CLIENT then include( "shared.lua" ) Quantum.Client = Quantum.Client || {} + Quantum.Client.Cache = Quantum.Client.Cache || {} + + include( "engine/vars/cl_vars.lua" ) local function loadCoreFiles() local fol = GM.FolderName .. "/gamemode/engine/core/" diff --git a/gamemode/engine/lib/server/sv_inventory.lua b/gamemode/engine/lib/server/sv_inventory.lua index a9e27f6..d2cd3d4 100644 --- a/gamemode/engine/lib/server/sv_inventory.lua +++ b/gamemode/engine/lib/server/sv_inventory.lua @@ -45,7 +45,9 @@ function Quantum.Server.Inventory.EquipItem( pl, itemindex ) else if( Quantum.EquipSlots[equipslot] != nil ) then char.equiped[equipslot] = slotitem[1] -- set it in the table - + if( itemTbl.equipeffect != nil ) then + Quantum.Effect.Give( pl, itemTbl.equipeffect ) -- give the player the effect + end else Quantum.Error( tostring(pl) .. " tried to equip an item in a non-existent equip slot: (" .. tostring(equipslot) .. ")" ) return diff --git a/gamemode/engine/vars/cl_vars.lua b/gamemode/engine/vars/cl_vars.lua new file mode 100644 index 0000000..ddea923 --- /dev/null +++ b/gamemode/engine/vars/cl_vars.lua @@ -0,0 +1,9 @@ +-- __ _ _______ _ __ +-- / / /\ | | |__ __| | | \ \ +-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \ +-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > > +-- \ \ / ____ \| | | | | | | | __/ (__| | | | / / +-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ + +Quantum.Client.ResolutionScale = ScrH() / 1080 +Quantum.Client.ServerBannerPath = "gamemodes/" .. GM.FolderName .. "/gamemode/content/materials/quantum/server_banner.png" \ No newline at end of file diff --git a/gamemode/engine/lib/sh_vars.lua b/gamemode/engine/vars/sh_vars.lua similarity index 75% rename from gamemode/engine/lib/sh_vars.lua rename to gamemode/engine/vars/sh_vars.lua index 3cb42ba..f04c2e9 100644 --- a/gamemode/engine/lib/sh_vars.lua +++ b/gamemode/engine/vars/sh_vars.lua @@ -5,21 +5,6 @@ -- \ \ / ____ \| | | | | | | | __/ (__| | | | / / -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -if SERVER then -- SERVER VARS UNDER THIS LINE - - -end -- - -if CLIENT then -- SERVER VARS UNDER THIS LINE - - Quantum.Client.Cache = Quantum.Client.Cache || {} - Quantum.Client.ResolutionScale = ScrH() / 1080 - Quantum.Client.ServerBannerPath = "gamemodes/" .. GM.FolderName .. "/gamemode/content/materials/quantum/server_banner.png" - -end -- - --- SHARED VARS UNDER THIS LINE - Quantum.ItemInfoDisplayMaxDistance = 200 Quantum.CharInfoDisplayDistance = 400 @@ -55,7 +40,7 @@ Quantum.IntCode = { USE_ITEM = 2, EAT_ITEM = 3, EQUIP_ITEM = 4, - DESTROY_ITEM = 5, + DESTROY_ITEM = 5, -- to be added UPDATE = 6, BIT_SIZE = 3 } diff --git a/gamemode/engine/vars/sv_vars.lua b/gamemode/engine/vars/sv_vars.lua new file mode 100644 index 0000000..77fd27b --- /dev/null +++ b/gamemode/engine/vars/sv_vars.lua @@ -0,0 +1,6 @@ +-- __ _ _______ _ __ +-- / / /\ | | |__ __| | | \ \ +-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \ +-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > > +-- \ \ / ____ \| | | | | | | | __/ (__| | | | / / +-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ \ No newline at end of file diff --git a/gamemode/init.lua b/gamemode/init.lua index 5b62f61..ad05dcb 100644 --- a/gamemode/init.lua +++ b/gamemode/init.lua @@ -7,8 +7,13 @@ if SERVER then AddCSLuaFile( "engine/sh_debug.lua" ) + + AddCSLuaFile( "engine/vars/sh_vars.lua" ) + AddCSLuaFile( "engine/vars/cl_vars.lua" ) + AddCSLuaFile( "settings/sh_settings.lua" ) AddCSLuaFile( "settings/sh_items.lua" ) + AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) @@ -23,6 +28,7 @@ if SERVER then Quantum.Server = {} include( "settings/sv_settings.lua" ) -- include the settings + include( "engine/vars/sv_vars.lua" ) -- include vars local function loadCoreFiles() diff --git a/gamemode/shared.lua b/gamemode/shared.lua index 7aabec1..a0c1f27 100644 --- a/gamemode/shared.lua +++ b/gamemode/shared.lua @@ -13,6 +13,8 @@ GM.Website = "N/A" Quantum = {} Quantum.Version = "v0.3-alpha" +include( "engine/vars/sh_vars.lua" ) -- include the shared constant vars + include( "engine/sh_debug.lua" ) -- add the debug functions and stuff include( "settings/sh_settings.lua" )