Page 1 of 1

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

Posted: Wed Jun 17, 2015 10:45 pm
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?

Re: Disable/enable recipe in game session

Posted: Wed Jun 17, 2015 11:03 pm
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.