Page 1 of 1

player.opened and events.on_gui_opened do not work for planner

Posted: Tue Mar 25, 2025 9:23 pm
by SunBlade
Issues
  1. events.on_gui_opened and events.on_gui_closed do not supply the opened/closed planner record
  2. player.opened is set to 'nil' if a planner item or planner record is opened.
  3. player.opened can not be used to open planner records.
How to reproduce
  1. put the supplied 'control.lua' and 'info.json' into '{factorio}/mods/test'
  2. enable 'test' mod if not enabled automatically.
  3. load the supplied example save.
  4. open/close the planners.
  5. the log shows that player.opened is never set for planner items and planner records.
  6. the log also shows that planner records are never supplied to the 'event' table.
  7. while this console command opens the planner item gui, player.opened still stays 'nil'.

    Code: Select all

    /c game.player.opened = game.player.get_main_inventory().find_item_stack{name="upgrade-planner"}
  8. this console command however completely fails to open the planner record gui.

    Code: Select all

    /c game.player.opened = game.blueprints[1]
Expected results
  1. open/close a planner item supplies the LuaItemStack to the 'event' table.
  2. open/close a planner record supplies the LuaRecord to the 'event' table.
  3. opening a planner item sets player.opened to the LuaItemStack.
  4. opening a planner record sets player.opened to the LuaRecord.
  5. setting player.opened to a LuaItemStack opens the planner item gui.
  6. setting player.opened to a LuaRecord opens the planner record gui.
Actual results
  1. (+) works as expected: open/close a planner item supplies the LuaItemStack to the 'event' table.
  2. (-) the 'event' table never contains the LuaRecord of the opened/closed planner record.
  3. (-) opening a planner item sets player.opened to 'nil'.
  4. (-) opening a planner record sets player.opened to 'nil'.
  5. (+) works as expected: setting player.opened to a LuaItemStack opens the planner item gui.
  6. (-) setting player.opened to a LuaRecord has no effect.

Re: [2.0.42] player.opened and events.on_gui_opened do not work for planner

Posted: Wed Mar 26, 2025 1:06 pm
by Rseding91
Thanks for the report. player.opened currently does not support the blueprint library in any way. Adding support for that is outside of bug fixing as it was never designed or intended to support them.

I'll move this to modding interface requests.

Re: [2.0.42] player.opened and events.on_gui_opened do not work for planner

Posted: Wed Mar 26, 2025 3:51 pm
by SunBlade
Rseding91 wrote: Wed Mar 26, 2025 1:06 pm... currently does not support the blueprint library in any way.
ah, that explains why the event system also never produces a LuaRecord.

but why stays player.opened 'nil' even for LuaItemStack?
because it can be converted to a LuaRecord?

i hope you guys spread some more love to the planners, they are one of the mightiest tools we can wield in game.