diff --git a/gamemode/cl_init.lua b/gamemode/cl_init.lua index 63ae20b..7aa0459 100644 --- a/gamemode/cl_init.lua +++ b/gamemode/cl_init.lua @@ -8,9 +8,6 @@ if CLIENT then include( "shared.lua" ) Quantum.Client = Quantum.Client || {} - Quantum.Client.Cache = Quantum.Client.Cache || {} - Quantum.Client.ResolutionScale = ScrH() / 1080 - Quantum.Client.ServerBannerPath = "gamemodes/" .. GM.FolderName .. "/gamemode/content/materials/quantum/server_banner.png" 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 4b98184..d40ba70 100644 --- a/gamemode/engine/lib/server/sv_inventory.lua +++ b/gamemode/engine/lib/server/sv_inventory.lua @@ -31,18 +31,20 @@ local function isStackable( item ) return item.stack || false end -function Quantum.Server.Inventory.SetEquipSlotItem( pl, itemindex ) +function Quantum.Server.Inventory.EquipItem( pl, itemindex ) local char = Quantum.Server.Char.GetCurrentCharacter( pl ) local slotitem = Quantum.Server.Inventory.GetSlotItem( char, index ) local itemTbl = Quantum.Item.Get( slotitem[1] ) - local equipslot = itemTbl.equipslot + if( itemTbl != nil ) then + local equipslot = itemTbl.equipslot - if( equipslot == nil ) then - Quantum.Error( tostring(pl) .. " tried to equip an non-equipable item (" .. tostring(itemTbl[1]) .. ")" ) - return - else - + if( equipslot == nil ) then + Quantum.Error( tostring(pl) .. " tried to equip an non-equipable item (" .. tostring(itemTbl[1]) .. ")" ) + return + else + + end end end diff --git a/gamemode/engine/lib/sh_effects.lua b/gamemode/engine/lib/sh_effects.lua index 359c938..a19b5c5 100644 --- a/gamemode/engine/lib/sh_effects.lua +++ b/gamemode/engine/lib/sh_effects.lua @@ -94,4 +94,5 @@ if SERVER then -- server only functions end end end + end \ No newline at end of file diff --git a/gamemode/engine/lib/sh_vars.lua b/gamemode/engine/lib/sh_vars.lua new file mode 100644 index 0000000..3a4eab2 --- /dev/null +++ b/gamemode/engine/lib/sh_vars.lua @@ -0,0 +1,56 @@ +-- __ _ _______ _ __ +-- / / /\ | | |__ __| | | \ \ +-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \ +-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > > +-- \ \ / ____ \| | | | | | | | __/ (__| | | | / / +-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ + +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 + + +Quantum.Rarity = { + None = { txt = "gnomerd the mvp", color = Color( 0, 0, 0, 120 ) }, + Trash = { txt = "Trash", color = Color( 100, 100, 100, 40 ) }, + Common = { txt = "Common", color = Color( 250, 250, 250, 40 ) }, + Rare = { txt = "Rare", color = Color( 48, 163, 230, 40 ) }, + Epic = { txt = "Epic", color = Color( 220, 90, 90, 40 ) }, + Legendary = { txt = "Legendary", color = Color( 235, 125, 52, 40 ) } +} + +---- Placeholders ---- + +Quantum.EmptyFunction = function() end + +---- NETWORKING VARS DO NOT TOUCH ---- + +Quantum.IntCode = { + SET_ITEM = 0, + DROP_ITEM = 1, + USE_ITEM = 2, + EAT_ITEM = 3, + EQUIP_ITEM = 4, + DESTROY_ITEM = 5, + UPDATE = 6, + BIT_SIZE = 3 +} + +function Quantum.calculateNeededBits( n ) return math.ceil( math.log( n, 2 ) ) end + +function Quantum.WriteIntcode( intcode ) net.WriteInt( intcode, Quantum.IntCode.BIT_SIZE ) end \ No newline at end of file diff --git a/gamemode/settings/sh_settings.lua b/gamemode/settings/sh_settings.lua index b899f1e..d6cec72 100644 --- a/gamemode/settings/sh_settings.lua +++ b/gamemode/settings/sh_settings.lua @@ -6,7 +6,7 @@ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ Quantum.CharacterLimit = 5 -Quantum.CharacterNameLimit = 12 +Quantum.CharacterNameLimit = 18 Quantum.CharacterNameMin = 3 Quantum.ServerTitle = "Electron Networks: CityRP" Quantum.DiscordInvite = "https://discord.gg/heUJB4B" @@ -28,24 +28,12 @@ Quantum.EquipSlots = { Quantum.InventoryOpenDelay = 0.35 Quantum.ItemPickupTime = 0.5 -- seconds -Quantum.ItemInfoDisplayMaxDistance = 200 - -Quantum.CharInfoDisplayDistance = 400 Quantum.Money = { Prefix = "$", Surfix = "" } -Quantum.Rarity = { - None = { txt = "gnomerd the mvp", color = Color( 0, 0, 0, 120 ) }, - Trash = { txt = "Trash", color = Color( 100, 100, 100, 40 ) }, - Common = { txt = "Common", color = Color( 250, 250, 250, 40 ) }, - Rare = { txt = "Rare", color = Color( 48, 163, 230, 40 ) }, - Epic = { txt = "Epic", color = Color( 220, 90, 90, 40 ) }, - Legendary = { txt = "Legendary", color = Color( 235, 125, 52, 40 ) } -} - Quantum.Bind = { OpenInventory = KEY_TAB } diff --git a/gamemode/shared.lua b/gamemode/shared.lua index ad33950..7aabec1 100644 --- a/gamemode/shared.lua +++ b/gamemode/shared.lua @@ -13,24 +13,6 @@ GM.Website = "N/A" Quantum = {} Quantum.Version = "v0.3-alpha" -Quantum.EmptyFunction = function() end - include( "engine/sh_debug.lua" ) -- add the debug functions and stuff include( "settings/sh_settings.lua" ) - - -Quantum.IntCode = { - SET_ITEM = 0, - DROP_ITEM = 1, - USE_ITEM = 2, - EAT_ITEM = 3, - EQUIP_ITEM = 4, - DESTROY_ITEM = 5, - UPDATE = 6, - BIT_SIZE = 3 -} - -function Quantum.calculateNeededBits( n ) return math.ceil( math.log( n, 2 ) ) end - -function Quantum.WriteIntcode( intcode ) net.WriteInt( intcode, Quantum.IntCode.BIT_SIZE ) end \ No newline at end of file