Added constant variable file & item equip server side progress

master
AlmTech Software 5 years ago
parent 83eeea9bde
commit a090bc138b
  1. 3
      gamemode/cl_init.lua
  2. 16
      gamemode/engine/lib/server/sv_inventory.lua
  3. 1
      gamemode/engine/lib/sh_effects.lua
  4. 56
      gamemode/engine/lib/sh_vars.lua
  5. 14
      gamemode/settings/sh_settings.lua
  6. 18
      gamemode/shared.lua

@ -8,9 +8,6 @@
if CLIENT then if CLIENT then
include( "shared.lua" ) include( "shared.lua" )
Quantum.Client = Quantum.Client || {} 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 function loadCoreFiles()
local fol = GM.FolderName .. "/gamemode/engine/core/" local fol = GM.FolderName .. "/gamemode/engine/core/"

@ -31,18 +31,20 @@ local function isStackable( item )
return item.stack || false return item.stack || false
end end
function Quantum.Server.Inventory.SetEquipSlotItem( pl, itemindex ) function Quantum.Server.Inventory.EquipItem( pl, itemindex )
local char = Quantum.Server.Char.GetCurrentCharacter( pl ) local char = Quantum.Server.Char.GetCurrentCharacter( pl )
local slotitem = Quantum.Server.Inventory.GetSlotItem( char, index ) local slotitem = Quantum.Server.Inventory.GetSlotItem( char, index )
local itemTbl = Quantum.Item.Get( slotitem[1] ) local itemTbl = Quantum.Item.Get( slotitem[1] )
local equipslot = itemTbl.equipslot if( itemTbl != nil ) then
local equipslot = itemTbl.equipslot
if( equipslot == nil ) then if( equipslot == nil ) then
Quantum.Error( tostring(pl) .. " tried to equip an non-equipable item (" .. tostring(itemTbl[1]) .. ")" ) Quantum.Error( tostring(pl) .. " tried to equip an non-equipable item (" .. tostring(itemTbl[1]) .. ")" )
return return
else else
end
end end
end end

@ -94,4 +94,5 @@ if SERVER then -- server only functions
end end
end end
end end
end end

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

@ -6,7 +6,7 @@
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
Quantum.CharacterLimit = 5 Quantum.CharacterLimit = 5
Quantum.CharacterNameLimit = 12 Quantum.CharacterNameLimit = 18
Quantum.CharacterNameMin = 3 Quantum.CharacterNameMin = 3
Quantum.ServerTitle = "Electron Networks: CityRP" Quantum.ServerTitle = "Electron Networks: CityRP"
Quantum.DiscordInvite = "https://discord.gg/heUJB4B" Quantum.DiscordInvite = "https://discord.gg/heUJB4B"
@ -28,24 +28,12 @@ Quantum.EquipSlots = {
Quantum.InventoryOpenDelay = 0.35 Quantum.InventoryOpenDelay = 0.35
Quantum.ItemPickupTime = 0.5 -- seconds Quantum.ItemPickupTime = 0.5 -- seconds
Quantum.ItemInfoDisplayMaxDistance = 200
Quantum.CharInfoDisplayDistance = 400
Quantum.Money = { Quantum.Money = {
Prefix = "$", Prefix = "$",
Surfix = "" 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 = { Quantum.Bind = {
OpenInventory = KEY_TAB OpenInventory = KEY_TAB
} }

@ -13,24 +13,6 @@ GM.Website = "N/A"
Quantum = {} Quantum = {}
Quantum.Version = "v0.3-alpha" Quantum.Version = "v0.3-alpha"
Quantum.EmptyFunction = function() end
include( "engine/sh_debug.lua" ) -- add the debug functions and stuff include( "engine/sh_debug.lua" ) -- add the debug functions and stuff
include( "settings/sh_settings.lua" ) 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
Loading…
Cancel
Save