From 80e2dd8483d6d677f887a772ee60f9e2e1c0cd2c Mon Sep 17 00:00:00 2001 From: AlmTech Software Date: Mon, 30 Dec 2019 23:00:13 +0100 Subject: [PATCH] Item bug fixes & inventory stuff --- gamemode/engine/core/sh_player_binds.lua | 2 +- gamemode/engine/derma/lib/cl_menu_iteminfo.lua | 12 +++++++++++- gamemode/engine/lib/sh_items.lua | 6 +++--- gamemode/settings/sh_items.lua | 4 ++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/gamemode/engine/core/sh_player_binds.lua b/gamemode/engine/core/sh_player_binds.lua index 95b5742..f05bbd5 100644 --- a/gamemode/engine/core/sh_player_binds.lua +++ b/gamemode/engine/core/sh_player_binds.lua @@ -18,7 +18,7 @@ if SERVER then name = Quantum.Server.Char.getBasicCharInfo( Quantum.Server.Char.GetCurrentCharacter( pl ) ).name, money = Quantum.Server.Char.getBasicCharInfo( Quantum.Server.Char.GetCurrentCharacter( pl ) ).money - }, items = { [1] = {"test", 1}, [2] = {"test2", Quantum.Inventory.MaxStackSize} } }) + }, items = { [1] = {"test", 1}, [2] = {"test2", Quantum.Inventory.MaxStackSize } } }) end } diff --git a/gamemode/engine/derma/lib/cl_menu_iteminfo.lua b/gamemode/engine/derma/lib/cl_menu_iteminfo.lua index 92349a2..412e9aa 100644 --- a/gamemode/engine/derma/lib/cl_menu_iteminfo.lua +++ b/gamemode/engine/derma/lib/cl_menu_iteminfo.lua @@ -57,8 +57,18 @@ function iteminfo.givetooltip( p, page ) desc:SizeToContents() desc.w, desc.h = desc:GetSize() desc:SetPos( title.x, rare.y + rare.h + padding_s ) - + desc.x, desc.y = desc:GetPos() + if( self.item.soulbound == true ) then + local sb = vgui.Create( "DLabel", self ) + sb:SetText( "Soulbound" ) + sb:SetFont( "q_tooltip_rarity" ) + sb:SetTextColor( Color( 235, 64, 52, 255 ) ) + sb:SizeToContents() + sb.w, sb.h = sb:GetSize() + sb:SetPos( title.x, desc.y + desc.h + padding_s ) + end + -- Correct the tooltips size so its content fits inside of it self:SizeToChildren( true, true ) self.w, self.h = self:GetSize() diff --git a/gamemode/engine/lib/sh_items.lua b/gamemode/engine/lib/sh_items.lua index 0730a9b..2f93740 100644 --- a/gamemode/engine/lib/sh_items.lua +++ b/gamemode/engine/lib/sh_items.lua @@ -13,9 +13,9 @@ function Quantum.Item.Create( id, args ) name = args.name || "ERROR", -- items name desc = args.desc || "ERROR: Some idiot forgot to give this item a description.", -- items description model = args.model || "models/props_phx/gears/bevel12.mdl", -- items model - stack = args.stack || false, -- items max stack size - soulbound = args.soulbound || true, -- if item could be dropped/traded to other players - equipable = args.equipable || false, -- equipable or not + stack = args.stack, -- items max stack size + soulbound = args.soulbound, -- if item could be dropped/traded to other players + equipable = args.equipable, -- equipable or not rarity = args.rarity || Quantum.Rarity.Trash, -- rarity of the item usefunction = args.usefunction, -- use function consumefunction = args.consumefunction --consume function diff --git a/gamemode/settings/sh_items.lua b/gamemode/settings/sh_items.lua index 8e06c0f..d5da324 100644 --- a/gamemode/settings/sh_items.lua +++ b/gamemode/settings/sh_items.lua @@ -19,10 +19,10 @@ Quantum.Item.Create( "test", { Quantum.Item.Create( "test2", { name = "Trash Item Test", - desc = "This is literall trash\nLine breaker test :D\n\nTest", + desc = "This is literall trash\nLine breaker test :D\n\nTest :D", model = "models/props_phx/gears/bevel12.mdl", stack = true, - soulbound = true, + soulbound = false, equipable = false, rarity = Quantum.Rarity.Trash, consumefunction = function( user )