API Docs don't mention updates to SimulationDefinition

User avatar
bolderbrush10
Burner Inserter
Burner Inserter
Posts: 14
Joined: Thu Oct 14, 2021 4:12 am
Contact:

API Docs don't mention updates to SimulationDefinition

Post 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.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3057
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: API Docs don't mention updates to SimulationDefinition

Post by boskid »

Looks like a documentation improvement request disguised as a bug report. Moving.
User avatar
bolderbrush10
Burner Inserter
Burner Inserter
Posts: 14
Joined: Thu Oct 14, 2021 4:12 am
Contact:

Re: API Docs don't mention updates to SimulationDefinition

Post by bolderbrush10 »

Thanks
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 250
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: API Docs don't mention updates to SimulationDefinition

Post by Therenas »

Thanks for the report, LuaSimulation at runtime is now properly documented for the next release.
Post Reply

Return to “Resolved Requests”