Node mining & inventory bug stuff

master
E. Almqvist 5 years ago
parent 259b682620
commit e2d184ad5d
  1. 1
      gamemode/engine/derma/menus/menu_charinfo.lua
  2. 20
      gamemode/engine/lib/server/sv_inventory.lua
  3. 4
      gamemode/engine/vars/sh_vars.lua
  4. 8
      gamemode/settings/sh_items.lua
  5. 10
      gamemode/settings/sh_nodes.lua

@ -157,6 +157,7 @@ end
function menu.open( dt ) function menu.open( dt )
local items = Quantum.Client.Inventory local items = Quantum.Client.Inventory
PrintTable( items )
local equipped = Quantum.Client.Equipped local equipped = Quantum.Client.Equipped
if( Quantum.Client.Character == nil ) then if( Quantum.Client.Character == nil ) then

@ -223,7 +223,7 @@ end
local function sortItem( pl, char, itemid, amount ) local function sortItem( pl, char, itemid, amount )
-- Quantum.Debug( "--Stacking Debug--" ) Quantum.Debug( "--Stacking Debug--" )
local item = Quantum.Item.Get( itemid ) local item = Quantum.Item.Get( itemid )
local slotitem = Quantum.Server.Inventory.GetSlotItem( char, index ) local slotitem = Quantum.Server.Inventory.GetSlotItem( char, index )
@ -252,7 +252,7 @@ local function sortItem( pl, char, itemid, amount )
local setAmt = math.Clamp( add, 1, stacksize ) local setAmt = math.Clamp( add, 1, stacksize )
Quantum.Server.Inventory.SetSlotItem( pl, char, index, itemid, setAmt ) Quantum.Server.Inventory.SetSlotItem( pl, char, index, itemid, setAmt )
--print( "1", itemid, setAmt, rest, index ) print( "1", itemid, setAmt, rest, index )
end end
else else
@ -261,7 +261,7 @@ local function sortItem( pl, char, itemid, amount )
rest = rest - setAmt rest = rest - setAmt
Quantum.Server.Inventory.SetSlotItem( pl, char, pos, itemid, setAmt ) Quantum.Server.Inventory.SetSlotItem( pl, char, pos, itemid, setAmt )
--print( "2", itemid, setAmt, rest, pos ) print( "2", itemid, setAmt, rest, pos )
end end
while( rest >= stacksize ) do while( rest >= stacksize ) do
@ -278,7 +278,7 @@ local function sortItem( pl, char, itemid, amount )
local pos = Quantum.Server.Inventory.FindItemSpot( char ) local pos = Quantum.Server.Inventory.FindItemSpot( char )
Quantum.Server.Inventory.SetSlotItem( pl, char, pos, itemid, setAmt ) Quantum.Server.Inventory.SetSlotItem( pl, char, pos, itemid, setAmt )
--print( "3", itemid, setAmt, rest, pos ) print( "3", itemid, setAmt, rest, pos )
else else
index = index + 1 index = index + 1
itemInSlot = Quantum.Server.Inventory.GetSlotItem( char, index ) itemInSlot = Quantum.Server.Inventory.GetSlotItem( char, index )
@ -288,7 +288,7 @@ local function sortItem( pl, char, itemid, amount )
rest = rest - ( stacksize - itemInSlot[2] ) rest = rest - ( stacksize - itemInSlot[2] )
Quantum.Server.Inventory.SetSlotItem( pl, char, index, itemid, stacksize ) Quantum.Server.Inventory.SetSlotItem( pl, char, index, itemid, stacksize )
--print( "4", itemid, stacksize, rest, index ) print( "4", itemid, stacksize, rest, index )
if( rest <= 0 ) then if( rest <= 0 ) then
rest = 0 rest = 0
@ -298,18 +298,18 @@ local function sortItem( pl, char, itemid, amount )
else else
rest = rest - stacksize rest = rest - stacksize
Quantum.Server.Inventory.SetSlotItem( pl, char, index, itemid, stacksize ) Quantum.Server.Inventory.SetSlotItem( pl, char, index, itemid, stacksize )
--print( "5", itemid, stacksize, rest, index ) print( "5", itemid, stacksize, rest, index )
end end
end end
end end
local stackIndex = Quantum.Server.Inventory.FindStackable( char, item ) local stackIndex = Quantum.Server.Inventory.FindStackable( char, item )
--print( "stackIndex=", stackIndex ) print( "stackIndex=", stackIndex )
local pos local pos
if( stackIndex == nil ) then if( stackIndex == nil ) then
pos = Quantum.Server.Inventory.FindItemSpot( char ) pos = Quantum.Server.Inventory.FindItemSpot( char )
Quantum.Server.Inventory.SetSlotItem( pl, char, pos, itemid, rest ) Quantum.Server.Inventory.SetSlotItem( pl, char, pos, itemid, rest )
--print( "6", itemid, rest, rest, pos ) print( "6", itemid, rest, rest, pos )
else else
if( rest > 0 ) then if( rest > 0 ) then
pos = stackIndex pos = stackIndex
@ -321,11 +321,11 @@ local function sortItem( pl, char, itemid, amount )
if( rest <= 0 ) then if( rest <= 0 ) then
Quantum.Server.Inventory.SetSlotItem( pl, char, pos, itemid, setAmt ) Quantum.Server.Inventory.SetSlotItem( pl, char, pos, itemid, setAmt )
--print( "7", itemid, setAmt, rest, pos ) print( "7", itemid, setAmt, rest, pos )
end end
end end
end end
-- Quantum.Debug( "--End of Stacking Debug--" ) Quantum.Debug( "--End of Stacking Debug--" )
end end
function Quantum.Server.Inventory.GiveItem( pl, itemid, amount ) -- Quantum.Server.Inventory.GiveItem( Entity(1), "test2", 21 ) function Quantum.Server.Inventory.GiveItem( pl, itemid, amount ) -- Quantum.Server.Inventory.GiveItem( Entity(1), "test2", 21 )

@ -13,8 +13,8 @@ Quantum.CharInfoDisplayDistance = 400
Quantum.Rarity = { Quantum.Rarity = {
None = { txt = "gnomerd the mvp", color = Color( 0, 0, 0, 120 ) }, None = { txt = "gnomerd the mvp", color = Color( 0, 0, 0, 120 ) },
Trash = { txt = "Trash", color = Color( 150, 150, 150, 40 ) }, Trash = { txt = "Trash", color = Color( 120, 120, 120, 40 ) },
Common = { txt = "Common", color = Color( 250, 250, 250, 40 ) }, Common = { txt = "Common", color = Color( 150, 150, 150, 40 ) },
Rare = { txt = "Rare", color = Color( 48, 163, 230, 40 ) }, Rare = { txt = "Rare", color = Color( 48, 163, 230, 40 ) },
Epic = { txt = "Epic", color = Color( 220, 90, 90, 40 ) }, Epic = { txt = "Epic", color = Color( 220, 90, 90, 40 ) },
Legendary = { txt = "Legendary", color = Color( 235, 125, 52, 40 ) }, Legendary = { txt = "Legendary", color = Color( 235, 125, 52, 40 ) },

@ -72,13 +72,13 @@ Quantum.Item.Create( "pickaxe", {
} ) } )
---- RESOURCES ---- models/props_junk/rock001a.mdl ---- RESOURCES ----
Quantum.Item.Create( "stone", { Quantum.Item.Create( "rock", {
name = "Stone", name = "Stone",
--desc = "A stone", desc = "A stone which could be sold to someone who wants it.",
model = "models/props_junk/rock001a.mdl", model = "models/props_junk/rock001a.mdl",
stack = 5, stack = 15,
soulbound = false, soulbound = false,
rarity = Quantum.Rarity.Common, rarity = Quantum.Rarity.Common,
} ) } )

@ -12,9 +12,8 @@ Quantum.Node.Create( "stone", {
model = "models/props/cs_militia/militiarock05.mdl", model = "models/props/cs_militia/militiarock05.mdl",
toolids = miningTools, toolids = miningTools,
give = { give = {
{ item = "stone", amount = 1 }, { item = "rock", amount = 1 },
{ item = "stone", amount = 2 }, { item = "rock", amount = 2 }
{ item = "stone", amount = 3 }
}, },
giveprobability = 1/2, giveprobability = 1/2,
health = 20, health = 20,
@ -26,9 +25,8 @@ Quantum.Node.Create( "bigstone", {
model = "models/props/cs_militia/militiarock03.mdl", model = "models/props/cs_militia/militiarock03.mdl",
toolids = miningTools, toolids = miningTools,
give = { give = {
{ item = "stone", amount = 1 }, { item = "rock", amount = 1 },
{ item = "stone", amount = 2 }, { item = "rock", amount = 2 }
{ item = "stone", amount = 3 }
}, },
giveprobability = 3/4, giveprobability = 3/4,
health = 20, health = 20,

Loading…
Cancel
Save