A counterpart to only_in_alt_mode for LuaRendering
Posted: Fri Aug 28, 2026 4:43 pm
The request
A LuaRendering object can be told to show only while alt mode is on, through only_in_alt_mode. There is no way to say the opposite: show only while alt mode is off. I would like to ask for that counterpart.Why it is needed
Without it, a mod that wants to draw something only while alt mode is off has to ask the player whether alt mode is on -- LuaPlayer::game_view_settings::show_entity_info -- and decide from that whether to create the object at all. That is where it comes apart: the render object is game state, the value it was decided from is not.show_entity_info is not part of the simulated state; it does not appear in the desync heuristic. A peer keeps it current for its own player and leaves the values of the other players as they arrived with the map. Two peers can therefore hold different values for the same player, and neither of them is wrong. But a mod that draws from it creates game state on one peer and not on the other.
What that looked like in practice
My mod Hover ALT Mode draws the alt mode icons for whatever the cursor points at while alt mode is off, and steps aside when it is on. A player reported repeated desyncs on his server, on Factorio 2.1.14 build 87180, and uploaded the desync report.Both saves in it are from the same tick. In the tagged level dump, all 470 MB of it, the complete difference is two render objects: a recipe icon and its backdrop on an assembling machine, present on the server and absent on the client. Everything else that differs -- around 7000 values across a dozen mods -- is the knock-on effect of those two missing objects shifting every object id after them by two.
In the player block, exactly one byte differs, inside <game-view-settings>: the fourth of the eighteen booleans, which is show_entity_info. The client held true for that player, the server held false. The player it belonged to was not the one who desynced -- it was the other player on the server, whose value had gone stale on the reporting client.
The report and the analysis are here: https://mods.factorio.com/mod/hover-alt ... d791b494e9
What the workaround costs
I have fixed it in the mod by keeping my own copy in storage, written from on_player_toggled_alt_mode. That event does reach every peer in the same tick -- I measured it with a server and a client side by side before relying on it. Two costs come with the workaround:- A save from before that copy existed cannot be migrated honestly. Reading the field to seed the copy is precisely the thing that cannot be trusted, so the mod now switches alt mode off for every player once, on the first load. Everyone who had it on loses it.
- Toggling alt mode now takes effect only once the input comes back confirmed. With only_in_alt_mode the engine resolves visibility locally and there is no wait at all. Mine has one, and it grows with the latency.
Both would disappear with the counterpart flag, and so would the whole copy.