From c816c0d685b674bb3f65d0c312ee74e4f9bf7895 Mon Sep 17 00:00:00 2001 From: AlmTech Software Date: Mon, 13 Jan 2020 20:41:20 +0100 Subject: [PATCH] Added sound effect on craft & bug fix --- gamemode/engine/core/client/cl_hud.lua | 6 ++++++ gamemode/engine/lib/server/sv_crafting.lua | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gamemode/engine/core/client/cl_hud.lua b/gamemode/engine/core/client/cl_hud.lua index 1864c94..77c89f3 100644 --- a/gamemode/engine/core/client/cl_hud.lua +++ b/gamemode/engine/core/client/cl_hud.lua @@ -88,6 +88,12 @@ local function renderItemInfoHUD() end end +local function renderActionDelayHUD() + if( LocalPlayer():GetNWBool( "Quantum_Craft_IsCrafting" ) ) then + + end +end + local function renderCharNamesHUD3D2D() local entsNear = ents.FindInSphere( LocalPlayer():GetPos(), Quantum.CharInfoDisplayDistance ) local txtPadding = 32 * scale diff --git a/gamemode/engine/lib/server/sv_crafting.lua b/gamemode/engine/lib/server/sv_crafting.lua index 45f258d..faa50f2 100644 --- a/gamemode/engine/lib/server/sv_crafting.lua +++ b/gamemode/engine/lib/server/sv_crafting.lua @@ -8,9 +8,15 @@ Quantum.Server.Crafting = {} -local function setPlayerIsCrafting( pl, iscrafting ) +local function setPlayerIsCrafting( pl, iscrafting, delay ) pl.iscrafting = iscrafting pl:SetNWBool( "Quantum_Craft_IsCrafting", iscrafting ) + + if( delay ) then + pl:SetNWInt( "Quantum_Craft_IsCrafting_Delay", delay ) -- a bit expensive but it should do the trick + else + pl:SetNWInt( "Quantum_Craft_IsCrafting_Delay", 0 ) + end end local function isPlayerCrafting( pl ) @@ -63,6 +69,8 @@ function Quantum.Server.Crafting.MakeItem( pl, itemid ) Quantum.Server.Inventory.GiveItem( pl, recipe.creates, recipe.amount ) Quantum.Notify.ItemCrafted( pl, Quantum.Item.Get( recipe.creates ), recipe.amount ) setPlayerIsCrafting( pl, false ) -- when everything is done then set this to false + + pl:EmitSound( Quantum.Server.Settings.ItemPickupSound ) -- make a sound on craft end) end