--
-- ███████████████████████████████████████████████████████████████████████████████████████████████████████████████████
function Craft_this(p,fr,box_items,recipe_items,path,quantity)
local enough_ingredients = 1
for i=1,#box_items do
if box_items[i] < recipe_items[i] then
enough_ingredients = 0
break
end
end
if enough_ingredients == 1 then
local newEnt = world:CreateEntity(path,quantity)
p:AddToInventory(newEnt)
if tonumber(quantity) > 1 then
if fr == "non" then
world:CombatLog(COMBATLOG_FEW,"<Cg>"..p:GetName().." crafts " .. quantity .. " items<C->")
else
world:CombatLog(COMBATLOG_FEW,"<Cg>"..p:GetName().." fabrique " .. quantity .. " objets<C->")
end
else
if fr == "non" then
world:CombatLog(COMBATLOG_FEW,"<Cg>"..p:GetName().." crafts an item<C->")
else
world:CombatLog(COMBATLOG_FEW,"<Cg>"..p:GetName().." fabrique un objet<C->")
end
end
return 1
else
return 0
end
end
-- ███████████████████████████████████████████████████████████████████████████████████████████████████████████████████
function Remove_this(recipe,icount,box,invent)
if recipe > 0 then
if icount >= recipe then
local removedent = box:RemoveInventory(invent,recipe)
if type(removedent) == "table" then removedent:Destruct() end --Clear memory
recipe = 0 --Removing of this ingredient completed
else
local removedent = box:RemoveInventory(invent,icount)
if type(removedent) == "table" then removedent:Destruct() end --Clear memory
recipe = recipe - icount --Will need to remove more of this ingredient
end
end
return recipe
end
-- ███████████████████████████████████████████████████████████████████████████████████████████████████████████████████
function Crafting_spend_items(recipe) --Remove items
local box = world:GetEntitiesByTag("Crafting_bench_box")
if box[1] then --Crafting bench found
local items = box[1]:GetInventory()
for _,invent in ipairs(items) do --Scan all available ingredients to remove
local nom = invent:GetName()
local nomi = invent:GetInternalName()
local icount = invent:GetCount()
--**********************************************Fill list**********************************************
if nom == "Bois" or nom == "Wood" then
recipe[1] = Remove_this(recipe[1],icount,box[1],invent)
elseif nom == "Papiers" or nom == "Papers" then
recipe[2] = Remove_this(recipe[2],icount,box[1],invent)
elseif nom == "Pièces" or nom == "Parts" then
recipe[3] = Remove_this(recipe[3],icount,box[1],invent)
elseif nom == "Métal" or nom == "Metal" then
recipe[4] = Remove_this(recipe[4],icount,box[1],invent)
elseif nom == "Produit chimique" or nom == "Chemicals" then
recipe[5] = Remove_this(recipe[5],icount,box[1],invent)
elseif nom == "Plastique" or nom == "Plastic" then
recipe[6] = Remove_this(recipe[6],icount,box[1],invent)
elseif nom == "Verre" or nom == "Glass" then
recipe[7] = Remove_this(recipe[7],icount,box[1],invent)
elseif nom == "Caoutchouc" or nom == "Rubber" then
recipe[8] = Remove_this(recipe[8],icount,box[1],invent)
elseif nom == "Tuyau" or nom == "Pipe" then
recipe[9] = Remove_this(recipe[9],icount,box[1],invent)
elseif nom == "Corde" or nom == "Rope" then
recipe[10] = Remove_this(recipe[10],icount,box[1],invent)
elseif nom == "Fils" or nom == "Wires" then
recipe[11] = Remove_this(recipe[11],icount,box[1],invent)
elseif nom == "Chiffons" or nom == "Rags" then
recipe[12] = Remove_this(recipe[12],icount,box[1],invent)
elseif nom == "Peau" or nom == "Pelt" then
recipe[13] = Remove_this(recipe[13],icount,box[1],invent)
elseif nom == "Plumes" or nom == "Feathers" then
recipe[14] = Remove_this(recipe[14],icount,box[1],invent)
elseif nom == "Pierre" or nom == "Rock" then
recipe[15] = Remove_this(recipe[15],icount,box[1],invent)
elseif nom == "Vracs" or nom == "Trinks" then
recipe[16] = Remove_this(recipe[16],icount,box[1],invent)
elseif invent.ClassType == "Consumable" then --Is consumable
if invent:GetEffectedMainAttribute() == "radPoints" then --Is food
local hunred = invent:GetEffectMinimum() --Get hunger reduction
if hunred <= -150 then
if invent:GetEffectAttribute(0, "fireResist") >= 400 then --Food (meat)
recipe[17] = Remove_this(recipe[17],icount,box[1],invent)
else
recipe[18] = Remove_this(recipe[18],icount,box[1],invent)
end
end
if invent:GetEffectAttribute(0, "fireResist") >= 400 then --Food (meat)
recipe[19] = Remove_this(recipe[19],icount,box[1],invent)
else
recipe[20] = Remove_this(recipe[20],icount,box[1],invent)
end
end
end
end
end
end
-- ███████████████████████████████████████████████████████████████████████████████████████████████████████████████████
function Crafting_scan(box_items) --Populate the box_items list
local box = world:GetEntitiesByTag("Crafting_bench_box")
if box[1] then --Crafting bench found
local items = box[1]:GetInventory() --Scan all available ingredients
for _,invent in ipairs(items) do
local nom = invent:GetName()
local nomi = invent:GetInternalName()
local icount = invent:GetCount()
--**********************************************Fill list**********************************************
if nom == "Bois" or nom == "Wood" then
box_items[1] = box_items[1] + icount --Add item to "Wood" ingredients list
elseif nom == "Papiers" or nom == "Papers" then
box_items[2] = box_items[2] + icount --Add item to "Papers" ingredients list
elseif nom == "Pièces" or nom == "Parts" then
box_items[3] = box_items[3] + icount --Add item to "Parts" ingredients list
elseif nom == "Métal" or nom == "Metal" then
box_items[4] = box_items[4] + icount --Add item to "Metal" ingredients list
elseif nom == "Produit chimique" or nom == "Chemicals" then
box_items[5] = box_items[5] + icount --Add item to "Chemicals" ingredients list
elseif nom == "Plastique" or nom == "Plastic" then
box_items[6] = box_items[6] + icount --Add item to "Plastic" ingredients list
elseif nom == "Verre" or nom == "Glass" then
box_items[7] = box_items[7] + icount --Add item to "Glass" ingredients list
elseif nom == "Caoutchouc" or nom == "Rubber" then
box_items[8] = box_items[8] + icount --Add item to "Rubber" ingredients list
elseif nom == "Tuyau" or nom == "Pipe" then
box_items[9] = box_items[9] + icount --Add item to "Pipe" ingredients list
elseif nom == "Corde" or nom == "Rope" then
box_items[10] = box_items[10] + icount --Add item to "Rope" ingredients list
elseif nom == "Fils" or nom == "Wires" then
box_items[11] = box_items[11] + icount --Add item to "Wires" ingredients list
elseif nom == "Chiffons" or nom == "Rags" then
box_items[12] = box_items[12] + icount --Add item to "Rags" ingredients list
elseif nom == "Peau" or nom == "Pelt" then
box_items[13] = box_items[13] + icount --Add item to "Pelt" ingredients list
elseif nom == "Plumes" or nom == "Feathers" then
box_items[14] = box_items[14] + icount --Add item to "Pelt" ingredients list
elseif nom == "Pierre" or nom == "Rock" then
box_items[15] = box_items[15] + icount --Add item to "Rock" ingredients list
elseif nom == "Vracs" or nom == "Trinks" then
box_items[16] = box_items[16] + icount --Add item to "Trinks" ingredients list
elseif invent.ClassType == "Consumable" then --Is consumable
if invent:GetEffectedMainAttribute() == "radPoints" then --Is food
local hunred = invent:GetEffectMinimum() --Get hunger reduction
if hunred <= -150 then
if invent:GetEffectAttribute(0, "fireResist") >= 400 then --Food (meat)
box_items[17] = box_items[17] + icount --Add item to "Meat" ingredients list
else
box_items[18] = box_items[18] + icount --Add item to "Vege" ingredients list
end
end
if invent:GetEffectAttribute(0, "fireResist") >= 400 then --Food (meat)
box_items[19] = box_items[19] + icount --Add any food to "Small Meat" ingredients list
else
box_items[20] = box_items[20] + icount --Add any food to "Small Vege" ingredients list
end
end
end
end
end
return box_items
end
-- ███████████████████████████████████████████████████████████████████████████████████████████████████████████████████
function Crafting(p,fr)
local recipe = {}
local to_craft = {}
local box_items = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} --20 available ingredients
--Scan box inventory for all available ingredients, adding them to items
box_items = Crafting_scan(box_items)
--Fill each recipe and crafted items informations
--to_craft variables : Difficulty (Repair needed), Path of item crafted, Quantity to craft
recipe[1] = {0,0,2,3,0,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0}
to_craft[1] = {75,"entities/items/Armor/raiderArmor2.ent",1}
recipe[2] = {1,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0}
to_craft[2] = {50,"entities/items/Useful/LampeDePoche3.ent",1}
recipe[3] = {1,0,1,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}
to_craft[3] = {50,"entities/weapons/Pistols/flamerPistol.ent",1}
recipe[4] = {2,0,1,2,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0}
to_craft[4] = {75,"entities/weapons/Rifles/9mmPipeGun.ent",1}
recipe[5] = {0,0,2,2,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}
to_craft[5] = {75,"entities/weapons/heavy/FlamerLeger2.ent",1}
recipe[6] = {0,0,1,2,0,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0}
to_craft[6] = {50,"entities/items/Armor/raiderArmor.ent",1}
recipe[7] = {0,0,1,3,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}
to_craft[7] = {50,"entities/weapons/heavy/FlamerLeger3.ent",1}
recipe[8] = {0,0,0,2,0,2,0,0,0,0,1,0,1,0,0,0,0,0,0,0}
to_craft[8] = {25,"entities/items/Armor/ArmureImprovisee.ent",1}
recipe[9] = {1,0,1,2,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0}
to_craft[9] = {50,"entities/weapons/Pistols/zipGunPistol2.ent",1}
recipe[10] = {2,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0}
to_craft[10] = {50,"entities/weapons/Pistols/zipGunPistol.ent",1}
recipe[11] = {0,0,0,0,0,0,0,0,0,0,3,0,5,0,0,0,0,0,0,0}
to_craft[11] = {75,"entities/items/Armor/bosLeather2.ent",1}
recipe[12] = {0,0,3,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[12] = {75,"entities/items/Armor/bosMetal.ent",1}
recipe[13] = {0,0,2,3,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}
to_craft[13] = {75,"entities/items/Useful/lockPicksEXP2.ent",1}
recipe[14] = {0,0,3,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0}
to_craft[14] = {50,"entities/weapons/Melee/cattleProdDIY.ent",1}
recipe[15] = {0,0,1,0,3,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0}
to_craft[15] = {75,"entities/weapons/Explosives/PipeBomb.ent",1}
recipe[16] = {0,0,1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[16] = {50,"entities/weapons/Grenades/Stick.ent",1}
recipe[17] = {2,0,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0}
to_craft[17] = {50,"entities/items/Useful/CANNEPECHEDIY.ent",1}
recipe[18] = {0,1,0,0,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,0}
to_craft[18] = {0,"entities/items/Armor/Veste_Dechets.ent",1}
recipe[19] = {3,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}
to_craft[19] = {0,"entities/weapons/Rifles/sniperRifle.ent",1}
recipe[20] = {0,0,0,0,0,0,0,0,0,0,1,0,5,0,0,0,0,0,0,0}
to_craft[20] = {50,"entities/items/Armor/bosLeather.ent",1}
recipe[21] = {0,0,1,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[21] = {50,"entities/items/Armor/bosMetalRouille2.ent",1}
recipe[22] = {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,5,0,0,0,0}
to_craft[22] = {50,"entities/items/Armor/ArmureCaps.ent",1}
recipe[23] = {0,0,0,0,0,0,0,5,0,0,1,0,0,0,0,0,0,0,0,0}
to_craft[23] = {50,"entities/items/Armor/ArmurePneus.ent",1}
recipe[24] = {0,0,0,0,0,0,0,0,0,0,1,5,0,0,0,0,0,0,0,0}
to_craft[24] = {50,"entities/items/Useful/SleepingBag1_IMPROVISE.ent",1}
recipe[25] = {0,0,0,0,0,0,0,1,0,0,0,5,0,0,0,0,0,0,0,0}
to_craft[25] = {25,"entities/items/Armor/CostumeMutantCuir.ent",1}
recipe[26] = {0,0,0,0,0,5,0,0,0,0,1,0,0,0,0,0,0,0,0,0}
to_craft[26] = {25,"entities/items/Armor/ArmurePlastique.ent",1}
recipe[27] = {0,0,1,0,0,2,0,0,0,0,1,0,0,0,0,0,0,0,0,0}
to_craft[27] = {50,"entities/weapons/SMG/ArbaletePlastique.ent",1}
recipe[28] = {2,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0}
to_craft[28] = {50,"entities/weapons/SMG/spearGunSub.ent",1}
recipe[29] = {0,0,0,0,1,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0}
to_craft[29] = {50,"entities/items/Useful/medsupplies.ent",1}
recipe[30] = {0,0,1,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}
to_craft[30] = {50,"entities/items/Useful/lockPicks2.ent",1}
recipe[31] = {0,0,0,0,2,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0}
to_craft[31] = {25,"entities/weapons/Grenades/molotov.ent",1}
recipe[32] = {1,0,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0}
to_craft[32] = {25,"entities/items/Useful/CANNEPECHEDIY.ent",1}
recipe[33] = {2,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0}
to_craft[33] = {25,"entities/items/Armor/BouclierPlanche.ent",1}
recipe[34] = {0,0,0,4,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}
to_craft[34] = {75,"entities/weapons/Blades/Epee_DIY.ent",1}
recipe[35] = {0,0,0,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[35] = {50,"entities/items/Ammo/ammo9mmBall_2.ent",10}
recipe[36] = {3,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[36] = {50,"entities/weapons/Pistols/SlingShotPistol.ent",1}
recipe[37] = {0,0,0,0,0,0,0,0,0,0,1,0,4,0,0,0,0,0,0,0}
to_craft[37] = {50,"entities/items/Useful/SleepingBag1_IMPROVISE.ent",1}
recipe[38] = {0,0,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[38] = {50,"entities/items/___RECUS/Repair.ent",1}
recipe[39] = {0,0,0,0,0,0,0,0,0,0,1,4,0,0,0,0,0,0,0,0}
to_craft[39] = {25,"entities/items/Useful/SleepingBag1_IMPROVISE.ent",1}
recipe[40] = {0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,3,0,0,0,0}
to_craft[40] = {25,"entities/items/Ammo/ammo12Guage_2.ent",10}
recipe[41] = {1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}
to_craft[41] = {75,"entities/weapons/Blades/Neshca.ent",1}
recipe[42] = {0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}
to_craft[42] = {25,"entities/weapons/Explosives/poo.ent",1}
recipe[43] = {3,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0}
to_craft[43] = {25,"entities/weapons/thrown/Atlatl.ent",1}
recipe[44] = {0,0,0,0,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[44] = {25,"entities/weapons/Grenades/chemicalGrenade.ent",1}
recipe[45] = {3,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[45] = {25,"entities/weapons/Spear/Spear.ent",1}
recipe[46] = {3,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0}
to_craft[46] = {0,"entities/weapons/Rifles/ak47Rifle.ent",1}
recipe[47] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0}
to_craft[47] = {0,"entities/items/Food/RepasVege.ent",1}
recipe[48] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4}
to_craft[48] = {0,"entities/items/Food/RepasVege.ent",1}
recipe[49] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0}
to_craft[49] = {0,"entities/items/Food/Repas.ent",1}
recipe[50] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0}
to_craft[50] = {0,"entities/items/Food/Repas.ent",1}
recipe[51] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0}
to_craft[51] = {0,"entities/items/Food/Repas.ent",1}
recipe[52] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2}
to_craft[52] = {0,"entities/items/Food/Repas.ent",1}
recipe[53] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0}
to_craft[53] = {25,"entities/items/Armor/ArmurePullTabs.ent",1}
recipe[54] = {0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0}
to_craft[54] = {25,"entities/items/Misc/rope.ent",1}
recipe[55] = {0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[55] = {0,"entities/items/Armor/ArmureCarton.ent",1}
recipe[56] = {0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[56] = {50,"entities/items/Ammo/ammo762mm_2.ent",10}
recipe[57] = {0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0}
to_craft[57] = {50,"entities/weapons/Melee/HachePrimitive.ent",1}
recipe[58] = {2,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[58] = {50,"entities/weapons/Pistols/SlingShotPistol.ent",1}
recipe[59] = {2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}
to_craft[59] = {25,"entities/weapons/thrown/throwingStars.ent",5}
recipe[60] = {0,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}
to_craft[60] = {25,"entities/items/Armor/Chaussures_improvisees1.ent",1}
recipe[61] = {0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0}
to_craft[61] = {25,"entities/items/Armor/Chaussures_improvisees4.ent",1}
recipe[62] = {0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0}
to_craft[62] = {25,"entities/items/Armor/Chaussures_improvisees3.ent",1}
recipe[63] = {2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}
to_craft[63] = {25,"entities/weapons/Melee/HacheTresPrimitive.ent",1}
recipe[64] = {0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[64] = {50,"entities/items/Ammo/ammo22.ent",10}
recipe[65] = {0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0}
to_craft[65] = {50,"entities/weapons/Blades/CouteauPierre.ent",1}
recipe[66] = {0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[66] = {50,"entities/weapons/Blades/knife.ent",1}
recipe[67] = {0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[67] = {50,"entities/items/Drugs/healingPowder.ent",1}
recipe[68] = {0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}
to_craft[68] = {50,"entities/items/Useful/Flint_Steel.ent",1}
recipe[69] = {1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}
to_craft[69] = {25,"entities/items/Ammo/ammoBoltFleche.ent",5}
recipe[70] = {0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[70] = {25,"entities/items/Useful/FireStarter.ent",2}
recipe[71] = {0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0}
to_craft[71] = {25,"entities/weapons/Melee/fleauDIY.ent",1}
recipe[72] = {0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}
to_craft[72] = {25,"entities/weapons/Blades/shiv2.ent",1}
recipe[73] = {1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[73] = {25,"entities/weapons/Blades/shiv4.ent",1}
recipe[74] = {1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[74] = {25,"entities/weapons/thrown/SlingShotBranche.ent",1}
recipe[75] = {1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}
to_craft[75] = {0,"entities/weapons/Spear/Sstick.ent",1}
recipe[76] = {0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0}
to_craft[76] = {0,"entities/weapons/Misc/Fauxbras.ent",1}
recipe[77] = {0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}
to_craft[77] = {0,"entities/items/Misc/Cache-Yeux.ent",1}
recipe[78] = {0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[78] = {25,"entities/weapons/Melee/ClubDIY.ent",1}
recipe[79] = {3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[79] = {25,"entities/weapons/Spear/sharpenedPole.ent",1}
recipe[80] = {0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0}
to_craft[80] = {25,"entities/items/Enhancers/bag.ent",1}
recipe[81] = {0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0}
to_craft[81] = {50,"entities/weapons/Melee/PipeHammer.ent",1}
recipe[82] = {0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[82] = {50,"entities/items/Misc/SavonNoir.ent",1}
recipe[83] = {0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0}
to_craft[83] = {25,"entities/items/Enhancers/Sacoche1.ent",1}
recipe[84] = {0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0}
to_craft[84] = {25,"entities/items/Useful/Masque_DIY.ent",1}
recipe[85] = {0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[85] = {25,"entities/weapons/Blades/CouteauPlastique.ent",1}
recipe[86] = {0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[86] = {0,"entities/weapons/Unarmed/brassKnucklesDIY.ent",1}
recipe[87] = {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[87] = {20,"entities/items/Ammo/ammoBBs.ent",1}
recipe[88] = {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
to_craft[88] = {0,"entities/weapons/Blades/WoodDagger.ent",1}
recipe[89] = {0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0}
to_craft[89] = {25,"entities/items/Useful/Pansement.ent",1}
--For each recipe, compare ressources
local crafted = 0
for i=1,#recipe do
if p:GetAttribute("repair",ACTOR_TABLE_CURRENT) >= to_craft[i][1] then
crafted = Craft_this(p,fr,box_items,recipe[i],to_craft[i][2],to_craft[i][3])
end
if crafted == 1 then
Crafting_spend_items(recipe[i])
break
end
end
if crafted == 0 then
if fr == "non" then
world:CombatLog(COMBATLOG_FEW,"<Co>"..p:GetName().." didn't find anything to craft<C->")
else
world:CombatLog(COMBATLOG_FEW,"<Co>"..p:GetName().." n'a rien trouvé à fabriquer<C->")
end
end
end