What?
It seems impossible to detect the status of 'toggle-alt-mode' or 'toggle-personal-roboport'.
So what?
I'd like to show some extra info to the player when they have both of these enabled, but the api seems to have no access to them. LuaPlayer.is_shortcut_toggled('toggle-alt-mode') also always returns "false". Presumably because they're not "custom" shortcuts, but it's highly misleading to have a function respond with a wrong answer if it's not supposed to work at all for that purpose.
Regarding alt mod there's even an event on_player_toggled_alt_mode. But it doesn't tell me what the new state is either. So either i'm missing something blatantly obvious or the whole event is pointless.
[1.0.0] is_shortcut_toggled always returns false for built-in shortcuts
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
[1.0.0] is_shortcut_toggled always returns false for built-in shortcuts
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: [1.0.0] is_shortcut_toggled always returns false for built-in shortcuts
This state is not part of the game state, so you can't read it.
Re: [1.0.0] is_shortcut_toggled always returns false for built-in shortcuts
You can access alt mode state with https://lua-api.factorio.com/latest/Con ... ntity_info and the personal roboport state with https://lua-api.factorio.com/latest/Lua ... ing_robots.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: [1.0.0] is_shortcut_toggled always returns false for built-in shortcuts
In that case why does the function return anything at all? Why does it not raise an error instead of giving a misleading wrong answer.kovarex wrote: Mon Nov 16, 2020 11:56 am This state is not part of the game state, so you can't read it.
Thank you again very much for going the extra step and posting links!Bilka wrote: Mon Nov 16, 2020 11:59 am You can access alt mode state with https://lua-api.factorio.com/latest/Con ... ntity_info and the personal roboport state with https://lua-api.factorio.com/latest/Lua ... ing_robots.
Very well hidden it is there in GameViewSettings, can't even find it with a full-text search on the full Classes overview page. I would ask for an addition to the documenation but i'm not sure where to even add that. Though i would appreciate a more explicit comment on is_shortcut_toggled, explaining that the function lies into your face when you ask it about built-in shortcuts (unless @kovarex changes his mind).
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.