ID:1190917
 
(See the best response by Ter13.)
Code:
mob
Player
verb
craftAccept()
if(winget(usr, "craft", "is-visible")=="true")
if(usr.selectedRecipe)
//First check for present tools
var/AnvilPresent, FurnacePresent = 0
for(var/obj/t in oview(1))
if(t.name=="Anvil")
AnvilPresent=1
else if(t.name=="Furnace")
FurnacePresent=1
if(AnvilPresent>=usr.selectedRecipe.AnvilReq && FurnacePresent>=usr.selectedRecipe.FurnaceReq) //If the required equipment is present, continue
if(includeIngreds(usr.contents,usr.selectedRecipe.Ingredients)==0)
removeIgreds(usr.contents,usr.selectedRecipe.Ingredients)
for(var/obj/result in usr.selectedRecipe.Results)
if(istype(result,/obj/Crafting))
var/obj/Crafting/existingResult=typeFind(result,usr.contents)
if(existingResult)
var/obj/Crafting/p = result
existingResult.Quantity+=p.Quantity
else
usr.contents+=result
else
usr.contents+=result

obj
Recipe
Equipment
var/Slot
HelmMk1
name="Iron Helmet"
icon='HelmMark1.dmi'
icon_state=""
FurnaceReq=1
AnvilReq=1
New()
var/obj/Crafting/RawMats/Metals/Iron/a1 = new()
a1.Quantity=1
src.Ingredients+=a1
var/obj/Equipment/Armour/Headwear/HelmMark1/a2 = new()
src.Results+=a2


Problem description:
If I craft a HelmMark1 then Iron is taken from my inventory and a Helm is added, as intended. If I do it again the Iron is removed once more, but a second Helm is not added.

However, if I do this with types of /obj/Crafting the intended Quantity is added to the existing item, as intended.
Best response
That's because you are adding a reference to an existing object. You need to instantiate a new copy of the existing item:

usr.contents += new result.type()
You know I have always wondered about how to do that. Thank you so much!