|
|
@ -22,18 +22,20 @@ local function cancelCrafting( pl ) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
function Quantum.Server.Crafting.MakeItem( pl, itemid ) |
|
|
|
function Quantum.Server.Crafting.MakeItem( pl, itemid ) |
|
|
|
|
|
|
|
|
|
|
|
local recipe = Quantum.Recipe.Get( itemid ) |
|
|
|
local recipe = Quantum.Recipe.Get( itemid ) |
|
|
|
local char = Quantum.Server.Char.GetCurrentCharacter( pl ) |
|
|
|
local char = Quantum.Server.Char.GetCurrentCharacter( pl ) |
|
|
|
local inv = Quantum.Server.Char.GetInventory( char ) |
|
|
|
local inv = Quantum.Server.Char.GetInventory( char ) |
|
|
|
|
|
|
|
|
|
|
|
if( recipe != nil ) then |
|
|
|
if( recipe != nil ) then |
|
|
|
|
|
|
|
|
|
|
|
local canMake, failedReq = Quantum.Recipe.CanMake( inv, itemid ) |
|
|
|
local canMake, failedReq = Quantum.Recipe.CanMake( inv, itemid ) |
|
|
|
|
|
|
|
|
|
|
|
if( canMake ) then |
|
|
|
if( canMake ) then |
|
|
|
|
|
|
|
|
|
|
|
cancelCrafting( pl ) -- stop the crafting if the player is allready crafting something |
|
|
|
cancelCrafting( pl ) -- stop the crafting if the player is allready crafting something |
|
|
|
-- and then craft this item instead |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- and then craft this item instead |
|
|
|
setPlayerIsCrafting( pl, true ) |
|
|
|
setPlayerIsCrafting( pl, true ) |
|
|
|
|
|
|
|
|
|
|
|
timer.Create( "Quantum_Crafting_" .. pl:SteamID64(), recipe.delay, 1, function() |
|
|
|
timer.Create( "Quantum_Crafting_" .. pl:SteamID64(), recipe.delay, 1, function() |
|
|
@ -49,7 +51,7 @@ function Quantum.Server.Crafting.MakeItem( pl, itemid ) |
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
-- Dont make the item |
|
|
|
-- Dont make the item |
|
|
|
Quantum.Notify.Deny( pl, "You don't have sufficient resources to create that item!" ) |
|
|
|
Quantum.Notify.Deny( pl, "You don not have sufficient resources to create that item!" ) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|