Added basic crafting

master
AlmTech Software 5 years ago
parent bc0a0d4872
commit 95bced1cda
  1. 6
      gamemode/engine/lib/server/sv_crafting.lua
  2. 3
      gamemode/engine/lib/sh_recipe.lua
  3. 2
      gamemode/settings/sh_recipes.lua
  4. 3
      gamemode/settings/sh_settings.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

@ -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

@ -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 = {

@ -23,6 +23,9 @@ Quantum.ItemPickupTime = 0.5 -- seconds
Quantum.HolsterTime = 1 -- seconds
Quantum.MinCraftDelay = 2
Quantum.MaxCraftDelay = 60
Quantum.Money = {
Prefix = "$",
Surfix = ""

Loading…
Cancel
Save