Disable enemy attacks in Factorio

Is it possible to enable "Enemies never attack first" option in an existing save game? Could I modify a specific file to achieve the same?


Solution 1:

You can use the console (open via the ` button) and enter this command:

/c game.player.surface.peaceful_mode = true

You will need to enter it twice (as the console text will inform you), and it will disable the achievements from that point onwards for the saved game.

Solution 2:

You can use this command to turn peaceful mode on:

/c game.player.surface.peaceful_mode = true

You can open the console by using the ` key.

Peaceful mode will make it so enemies will not attack you unless you attack first. Checkout the Wiki for more commands. Note that this will disable achievements.