Page 1 of 1

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

Posted: Thu Aug 20, 2020 4:47 am
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?

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

Posted: Thu Aug 20, 2020 3:10 pm
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.