[1.0.0] becoming spectator makes "player.opened=nil" but not fires "on_gui_closed" event

We are aware of them, but they have low priority. We have more important things to do. They go here in order not to take space in the main bug thread list.
Post Reply
x2605
Inserter
Inserter
Posts: 41
Joined: Fri Jul 31, 2020 4:08 pm
Contact:

[1.0.0] becoming spectator makes "player.opened=nil" but not fires "on_gui_closed" event

Post by x2605 »

becoming spectator using

Code: Select all

player.character.destroy() -- or
player.set_controller{type = defines.controllers.spectator} --or other ghost modes...
player.character.die() -- or just killed by something and lose body
closes built-in guis and makes "player.opened = nil" but not fires event "on_gui_closed".

So, CustomGuiElements relying on "on_gui_closed" event still covers screen and doesn't answer to escape key after some situations.

is this intended?
English is not my native language. Sorry for bad English.
My mods :
Lua API global Variable Viewer (mod portal)
Lua API Event Trace (mod portal)
My tools :
Locale String Editor (github.io webapp)

Rseding91
Factorio Staff
Factorio Staff
Posts: 13171
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.0.0] becoming spectator makes "player.opened=nil" but not fires "on_gui_closed" event

Post by Rseding91 »

It's more "how it has to work". Invalidating the controller invalidates the gui target and so it can't track that it was closed to fire the event.

The same thing happens when a player gets disconnected, or killed, or any other number of ways a players controller becomes invalid to use.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Minor issues”