From 222b8a1467b900d306701df9ffc06b99bf94b8c5 Mon Sep 17 00:00:00 2001 From: AlmTech Software Date: Tue, 4 Feb 2020 19:50:42 +0100 Subject: [PATCH] Fixed item effects bug & max health bug --- gamemode/engine/derma/menus/menu_crafting.lua | 4 ++++ gamemode/engine/derma/menus/menu_main.lua | 2 +- gamemode/engine/lib/sh_effects.lua | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/gamemode/engine/derma/menus/menu_crafting.lua b/gamemode/engine/derma/menus/menu_crafting.lua index ac584fe..d67a06f 100644 --- a/gamemode/engine/derma/menus/menu_crafting.lua +++ b/gamemode/engine/derma/menus/menu_crafting.lua @@ -150,6 +150,10 @@ function menu.open( dt ) end end + if( recipes == nil ) then + return + end + local items = Quantum.Client.Inventory local equipped = Quantum.Client.Equipped diff --git a/gamemode/engine/derma/menus/menu_main.lua b/gamemode/engine/derma/menus/menu_main.lua index 7cca176..b688afe 100644 --- a/gamemode/engine/derma/menus/menu_main.lua +++ b/gamemode/engine/derma/menus/menu_main.lua @@ -78,7 +78,7 @@ function main.open(dt) surface.SetFont( buttonFont ) local x, buttonHeight = surface.GetTextSize( "AAAAA" ) - buttonHeight = buttonHeight + padding + buttonHeight = buttonHeight + padding/2 x = nil local f = vgui.Create( "DFrame" ) diff --git a/gamemode/engine/lib/sh_effects.lua b/gamemode/engine/lib/sh_effects.lua index 0b4dfab..cc82095 100644 --- a/gamemode/engine/lib/sh_effects.lua +++ b/gamemode/engine/lib/sh_effects.lua @@ -129,4 +129,22 @@ if SERVER then -- server only functions Quantum.Effect.RemoveAll( ply ) -- remove all effects end) + hook.Add( "PlayerSpawn", "Quantum_Effects_GiveEquippedEffects", function( ply ) + local char = Quantum.Server.Char.GetCurrentCharacter( ply ) + + if( char != nil ) then + local equippedItems = Quantum.Server.Inventory.GetEquippedItems( ply, char ) -- add all of the effects given by equipped items + local slotItemID + local itemTbl + for i, tbl in pairs( equippedItems ) do + slotItemID = Quantum.Server.Inventory.GetSlotItem( char, tbl.slot )[1] + itemTbl = Quantum.Item.Get( slotItemID ) + + if( itemTbl.equipeffect != nil ) then + print("GIVE") + Quantum.Effect.Give( ply, itemTbl.equipeffect ) + end + end + end + end) end \ No newline at end of file