diff --git a/gamemode/engine/lib/server/sv_crafting.lua b/gamemode/engine/lib/server/sv_crafting.lua index 6d41caf..2738b0b 100644 --- a/gamemode/engine/lib/server/sv_crafting.lua +++ b/gamemode/engine/lib/server/sv_crafting.lua @@ -34,7 +34,7 @@ function Quantum.Server.Crafting.MakeItem( pl, itemid ) if( canMake ) then cancelCrafting( pl ) -- stop the crafting if the player is allready crafting something - + -- and then craft this item instead setPlayerIsCrafting( pl, true ) @@ -44,9 +44,13 @@ function Quantum.Server.Crafting.MakeItem( pl, itemid ) for k, reqItem in pairs( recipe.recipe ) do print( "##", k, reqItem.item ) + Quantum.Server.Inventory.RemoveSlotItem( pl, char, k, reqItem.amount ) end -- create item + + Quantum.Server.Inventory.GiveItem( pl, recipe.creates, recipe.amount ) + end) else diff --git a/gamemode/engine/lib/sh_recipe.lua b/gamemode/engine/lib/sh_recipe.lua index ac51369..6dd84f7 100644 --- a/gamemode/engine/lib/sh_recipe.lua +++ b/gamemode/engine/lib/sh_recipe.lua @@ -21,7 +21,8 @@ function Quantum.Recipe.Add( itemid, station, tbl ) recipe = tbl.recipe || {} } - Quantum.Recipes[ itemid ] = returnTbl + Quantum.Recipes[ itemid ] = returnTbl + Quantum.Recipes[ itemid ].delay = math.Clamp( Quantum.Recipes[ itemid ].delay, Quantum.MinCraftDelay, Quantum.MaxCraftDelay ) return returnTbl end diff --git a/gamemode/settings/sh_recipes.lua b/gamemode/settings/sh_recipes.lua index 5d8a3b5..d866540 100644 --- a/gamemode/settings/sh_recipes.lua +++ b/gamemode/settings/sh_recipes.lua @@ -6,7 +6,7 @@ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -Quantum.Recipe.Add( "potatoe", nil, { +Quantum.Recipe.Add( "potatoe", nil, { --Quantum.Server.Crafting.MakeItem( Entity(1), "potatoe" ) name = "Legendary Potatoe Recipe", amount = 1, recipe = { diff --git a/gamemode/settings/sh_settings.lua b/gamemode/settings/sh_settings.lua index 07224a1..7170769 100644 --- a/gamemode/settings/sh_settings.lua +++ b/gamemode/settings/sh_settings.lua @@ -23,6 +23,9 @@ Quantum.ItemPickupTime = 0.5 -- seconds Quantum.HolsterTime = 1 -- seconds +Quantum.MinCraftDelay = 2 +Quantum.MaxCraftDelay = 60 + Quantum.Money = { Prefix = "$", Surfix = ""