Added Inventory & more stuff to character system

master
AlmTech 5 years ago
parent 0a23b31c61
commit 307a872108
  1. 1
      gamemode/engine/lib/server/sv_character.lua
  2. 42
      gamemode/engine/lib/server/sv_inventory.lua
  3. 6
      gamemode/settings/sv_settings.lua

@ -13,6 +13,7 @@ function Quantum.Server.Char.CreateCharTable( args )
name = args.name || "UNKNOWN",
model = args.model || "models/player.mdl",
money = args.money || Quantum.Server.Settings.StarterMoney,
inventory = args.inventory || {}, -- create new inventory
jobs = args.jobs || {
[1] = { title = "Hobo", level = -1 },
},

@ -0,0 +1,42 @@
-- __ _ _______ _ __
-- / / /\ | | |__ __| | | \ \
-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \
-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > >
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
Quantum.Server.Inventory = {}
function Quantum.Server.Inventory.Create( char )
char.inventory = {}
for i = 1, Quantum.Server.Settings.Inventory.Width do
char.inventory[i] = {}
end
for h, v in pairs( char.inventory ) do
for w = 1, Quantum.Server.Settings.Inventory.Height do
char.inventory[h][w] = 0
end
end
return char.inventory
end
local function isEquippable( item )
return item.equipable || false
end
function Quantum.Server.Inventory.SetSlotItem( char, x, y, item, amount )
if( isEquippable( item ) ) then
amount = 1
char.inventory[x][y] = { item }
else
amount = amount || 1
char.inventory[x][y] = { item, amount }
end
Quantum.Debug( "Gave " .. char.name .. " " .. amount .. " [" .. item.name .. "]" )
return
end
function Quantum.Server.Inventory.GetSlotItem( char, x, y ) return char.inventory[x][y] end

@ -11,6 +11,12 @@ Quantum.Server.Settings.VoiceChatRange = 400
Quantum.Server.Settings.StarterMoney = 0
Quantum.Server.Settings.Inventory = {
Height = 5,
Width = 5
}
--- Features to be added ---
Quantum.Server.Settings.MaxJobLevel = 250
Quantum.Server.Settings.MaxJobSlots = 2
Quantum.Server.Settings.MaxSkillLevel = 100

Loading…
Cancel
Save