[status='solved'] Disable/enable recipe in game session

Place to get help with not working mods / modding interface.
User avatar
semvoz
Inserter
Inserter
Posts: 30
Joined: Wed Jun 17, 2015 12:03 pm
Contact:

[status='solved'] Disable/enable recipe in game session

Post by semvoz »

Hello,

I am trying to write a mod where the player can craft a special item only once.
Therefore, I was thinking to leave the recipe enabled and disable it once the player crafted the item.

I could not find a way to disable the recipe while in a game session (data.raw won't work).
Is there any other way or do I have to intercept the crafting and 'reimburse' the ingredients (wasting the crafting time) to the player?
Last edited by semvoz on Thu Jun 18, 2015 6:53 am, edited 1 time in total.
User avatar
semvoz
Inserter
Inserter
Posts: 30
Joined: Wed Jun 17, 2015 12:03 pm
Contact:

Re: Disable/enable recipe in game session

Post by semvoz »

My bad, I found the solution to alter recipe in a game session:

Code: Select all

game.players[1].force.recipes['recipe-name'].enabled = true/false
from this thread.
Post Reply

Return to “Modding help”