Page 1 of 1

onplayercrafteditem

Posted: Mon Dec 23, 2013 3:21 pm
by Dysoch
i created an onplayercrafteditem event that checks how many gears have been created by the player.
like this:

Code: Select all

stonegear_counter=0
game.onevent(defines.events.onplayercrafteditem, function(event)
	if event.itemstack.name=="stone-gear-wheel" then
		if stonegear_counter == nil then return
		elseif stonegear_counter < 99 then
			stonegear_counter = stonegear_counter + event.itemstack.count
		elseif stonegear_counter > 98 then
			game.player.force.recipes["iron-gear-wheel"].enabled = true
			game.player.print("I think i can make stronger gears with Iron Plates")
			stonegear_counter=nil
		end
	end
end)
but the problem is, it doesnt check intermediate items being crafted, eg. crafting belts directly from scratch)
devs, anyway i can check those intermediates so they can be added to the counter?