Added sound effect on craft & bug fix

master
AlmTech Software 5 years ago
parent 18cbeb0db4
commit c816c0d685
  1. 6
      gamemode/engine/core/client/cl_hud.lua
  2. 10
      gamemode/engine/lib/server/sv_crafting.lua

@ -88,6 +88,12 @@ local function renderItemInfoHUD()
end end
end end
local function renderActionDelayHUD()
if( LocalPlayer():GetNWBool( "Quantum_Craft_IsCrafting" ) ) then
end
end
local function renderCharNamesHUD3D2D() local function renderCharNamesHUD3D2D()
local entsNear = ents.FindInSphere( LocalPlayer():GetPos(), Quantum.CharInfoDisplayDistance ) local entsNear = ents.FindInSphere( LocalPlayer():GetPos(), Quantum.CharInfoDisplayDistance )
local txtPadding = 32 * scale local txtPadding = 32 * scale

@ -8,9 +8,15 @@
Quantum.Server.Crafting = {} Quantum.Server.Crafting = {}
local function setPlayerIsCrafting( pl, iscrafting ) local function setPlayerIsCrafting( pl, iscrafting, delay )
pl.iscrafting = iscrafting pl.iscrafting = iscrafting
pl:SetNWBool( "Quantum_Craft_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 end
local function isPlayerCrafting( pl ) 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.Server.Inventory.GiveItem( pl, recipe.creates, recipe.amount )
Quantum.Notify.ItemCrafted( pl, Quantum.Item.Get( 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 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)
end end

Loading…
Cancel
Save