Page 1 of 1

[0.17.4] Scenario locale is not available to error until after scenario control.lua runs

Posted: Sat Mar 02, 2019 10:04 am
by project6
A continuation of viewtopic.php?f=11&t=60767&p=366009

It seems that this was half-resolved: the locale data seems loaded, just unavailable to error while it is available to log.

3 control.luas for 3 test runs:

1) log in control init

Code: Select all

log({'apocalypse.apocalypse_already_running'})
As expected:

Code: Select all

  27.596 Info Scenario.cpp:147: Map version 0.17.4-1
  27.626 Script @C:/Users/Matthew/AppData/Roaming/Factorio/temp/currently-playing/control.lua:2: The apocalypse has already begun. There is nothing more to do in this world.
2) error in control init

Code: Select all

error({'apocalypse.apocalypse_already_running'})
Does not give the contents of locale:

Code: Select all

 226.463 Loading Level.dat: 1272918 bytes.
 226.464 Info Scenario.cpp:147: Map version 0.17.4-1
 226.635 Error AppManager.cpp:597: Unknown key: "apocalypse.apocalypse_already_running"
stack traceback:
	[C]: in function 'error'
	...Data/Roaming/Factorio/temp/currently-playing/control.lua:2: in main chunk
3) error in init

Code: Select all

script.on_init(
    function()
        error({'apocalypse.apocalypse_already_running'})
    end
)
As expected, the log shows the error correctly:

Code: Select all

Error while running event level::on_init()
The apocalypse has already begun. There is nothing more to do in this world.
stack traceback:
	[C]: in function 'error'
	...Data/Roaming/Factorio/temp/currently-playing/control.lua:3: in function <...Data/Roaming/Factorio/temp/currently-playing/control.lua:2>

Re: [0.17.4] Scenario locale is not available to error until after scenario control.lua runs

Posted: Wed Mar 06, 2019 1:09 pm
by Rseding91
Thanks for the report however this isn't going to be fixed.

The locale isn't valid for errors when the game has crashed since the locale is stored in the game and the game is gone at the point the crash happens.