onplayercrafteditem

Place to get help with not working mods / modding interface.
User avatar
Dysoch
Filter Inserter
Filter Inserter
Posts: 445
Joined: Fri Oct 18, 2013 2:27 pm
Contact:

onplayercrafteditem

Post 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?
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6
Post Reply

Return to “Modding help”