From e2d184ad5d3391846854cd5fb34aae77a1032cb7 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Wed, 12 Feb 2020 17:57:57 +0100 Subject: [PATCH] Node mining & inventory bug stuff --- gamemode/engine/derma/menus/menu_charinfo.lua | 1 + gamemode/engine/lib/server/sv_inventory.lua | 20 +++++++++---------- gamemode/engine/vars/sh_vars.lua | 4 ++-- gamemode/settings/sh_items.lua | 8 ++++---- gamemode/settings/sh_nodes.lua | 10 ++++------ 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/gamemode/engine/derma/menus/menu_charinfo.lua b/gamemode/engine/derma/menus/menu_charinfo.lua index 350675e..e3b549b 100644 --- a/gamemode/engine/derma/menus/menu_charinfo.lua +++ b/gamemode/engine/derma/menus/menu_charinfo.lua @@ -157,6 +157,7 @@ end function menu.open( dt ) local items = Quantum.Client.Inventory + PrintTable( items ) local equipped = Quantum.Client.Equipped if( Quantum.Client.Character == nil ) then diff --git a/gamemode/engine/lib/server/sv_inventory.lua b/gamemode/engine/lib/server/sv_inventory.lua index 1dea845..8a5f40cd 100644 --- a/gamemode/engine/lib/server/sv_inventory.lua +++ b/gamemode/engine/lib/server/sv_inventory.lua @@ -223,7 +223,7 @@ end local function sortItem( pl, char, itemid, amount ) - -- Quantum.Debug( "--Stacking Debug--" ) + Quantum.Debug( "--Stacking Debug--" ) local item = Quantum.Item.Get( itemid ) 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 ) Quantum.Server.Inventory.SetSlotItem( pl, char, index, itemid, setAmt ) - --print( "1", itemid, setAmt, rest, index ) + print( "1", itemid, setAmt, rest, index ) end else @@ -261,7 +261,7 @@ local function sortItem( pl, char, itemid, amount ) rest = rest - setAmt Quantum.Server.Inventory.SetSlotItem( pl, char, pos, itemid, setAmt ) - --print( "2", itemid, setAmt, rest, pos ) + print( "2", itemid, setAmt, rest, pos ) end while( rest >= stacksize ) do @@ -278,7 +278,7 @@ local function sortItem( pl, char, itemid, amount ) local pos = Quantum.Server.Inventory.FindItemSpot( char ) Quantum.Server.Inventory.SetSlotItem( pl, char, pos, itemid, setAmt ) - --print( "3", itemid, setAmt, rest, pos ) + print( "3", itemid, setAmt, rest, pos ) else index = index + 1 itemInSlot = Quantum.Server.Inventory.GetSlotItem( char, index ) @@ -288,7 +288,7 @@ local function sortItem( pl, char, itemid, amount ) rest = rest - ( stacksize - itemInSlot[2] ) 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 rest = 0 @@ -298,18 +298,18 @@ local function sortItem( pl, char, itemid, amount ) else rest = rest - 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 local stackIndex = Quantum.Server.Inventory.FindStackable( char, item ) - --print( "stackIndex=", stackIndex ) + print( "stackIndex=", stackIndex ) local pos if( stackIndex == nil ) then pos = Quantum.Server.Inventory.FindItemSpot( char ) Quantum.Server.Inventory.SetSlotItem( pl, char, pos, itemid, rest ) - --print( "6", itemid, rest, rest, pos ) + print( "6", itemid, rest, rest, pos ) else if( rest > 0 ) then pos = stackIndex @@ -321,11 +321,11 @@ local function sortItem( pl, char, itemid, amount ) if( rest <= 0 ) then Quantum.Server.Inventory.SetSlotItem( pl, char, pos, itemid, setAmt ) - --print( "7", itemid, setAmt, rest, pos ) + print( "7", itemid, setAmt, rest, pos ) end end end - -- Quantum.Debug( "--End of Stacking Debug--" ) + Quantum.Debug( "--End of Stacking Debug--" ) end function Quantum.Server.Inventory.GiveItem( pl, itemid, amount ) -- Quantum.Server.Inventory.GiveItem( Entity(1), "test2", 21 ) diff --git a/gamemode/engine/vars/sh_vars.lua b/gamemode/engine/vars/sh_vars.lua index 9951f9d..3f403a2 100644 --- a/gamemode/engine/vars/sh_vars.lua +++ b/gamemode/engine/vars/sh_vars.lua @@ -13,8 +13,8 @@ Quantum.CharInfoDisplayDistance = 400 Quantum.Rarity = { None = { txt = "gnomerd the mvp", color = Color( 0, 0, 0, 120 ) }, - Trash = { txt = "Trash", color = Color( 150, 150, 150, 40 ) }, - Common = { txt = "Common", color = Color( 250, 250, 250, 40 ) }, + Trash = { txt = "Trash", color = Color( 120, 120, 120, 40 ) }, + Common = { txt = "Common", color = Color( 150, 150, 150, 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 ) }, diff --git a/gamemode/settings/sh_items.lua b/gamemode/settings/sh_items.lua index 2fa7825..3c57661 100644 --- a/gamemode/settings/sh_items.lua +++ b/gamemode/settings/sh_items.lua @@ -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", - --desc = "A stone", + desc = "A stone which could be sold to someone who wants it.", model = "models/props_junk/rock001a.mdl", - stack = 5, + stack = 15, soulbound = false, rarity = Quantum.Rarity.Common, } ) \ No newline at end of file diff --git a/gamemode/settings/sh_nodes.lua b/gamemode/settings/sh_nodes.lua index 83cc94c..9382aea 100644 --- a/gamemode/settings/sh_nodes.lua +++ b/gamemode/settings/sh_nodes.lua @@ -12,9 +12,8 @@ Quantum.Node.Create( "stone", { model = "models/props/cs_militia/militiarock05.mdl", toolids = miningTools, give = { - { item = "stone", amount = 1 }, - { item = "stone", amount = 2 }, - { item = "stone", amount = 3 } + { item = "rock", amount = 1 }, + { item = "rock", amount = 2 } }, giveprobability = 1/2, health = 20, @@ -26,9 +25,8 @@ Quantum.Node.Create( "bigstone", { model = "models/props/cs_militia/militiarock03.mdl", toolids = miningTools, give = { - { item = "stone", amount = 1 }, - { item = "stone", amount = 2 }, - { item = "stone", amount = 3 } + { item = "rock", amount = 1 }, + { item = "rock", amount = 2 } }, giveprobability = 3/4, health = 20,