Page 1 of 1

API Docs don't mention updates to SimulationDefinition

Posted: Wed Oct 23, 2024 2:27 am
by bolderbrush10
eg, game.camera_position calls should now use game.simulation.camera_position

https://lua-api.factorio.com/latest/typ ... ition.html

Edit: Changes are alluded to here in the version history, actually:
Added LuaSimulation available through LuaGameScript::simulation (read).
https://wiki.factorio.com/Version_history/2.0.0#2.0.8
camera_position wasn't mentioned specifically, so I missed it.

In game, files like \Factorio\data\base\menu-simulations\menu-simulations.lua have already been updated to use game.simulation.whatever


I only happened to notice this when my game crashed (debugging my mod) and the "paused" view of my game world was replaced with a black screen that says "Cannot execute command. Error: LuaGameScript doesn't contain key camera_position."
Seems like menu simulations start running right after the game finishes crashing, even if it's still showing the crashed game's world.

Re: API Docs don't mention updates to SimulationDefinition

Posted: Wed Oct 23, 2024 2:34 am
by boskid
Looks like a documentation improvement request disguised as a bug report. Moving.

Re: API Docs don't mention updates to SimulationDefinition

Posted: Wed Oct 23, 2024 2:36 am
by bolderbrush10
Thanks

Re: API Docs don't mention updates to SimulationDefinition

Posted: Fri Oct 25, 2024 4:45 pm
by Therenas
Thanks for the report, LuaSimulation at runtime is now properly documented for the next release.