Problem with closing player gui

Place to get help with not working mods / modding interface.
_npo6ka_
Fast Inserter
Fast Inserter
Posts: 102
Joined: Mon Sep 26, 2016 10:29 pm
Contact:

Problem with closing player gui

Post by _npo6ka_ »

The goal: to close the gui mod, if it is open, when the player enters the game.
If a player starts a multiplayer game, then for some players, the on_player_joined_game event is called, but for the player who created this game, this event is not called.
The on_player_create event is called 1 time when the player is created, which also does not solve the task.
The on_load event has no information about the players, so it's also impossible to close the gui.
Tell me your thoughts on this matter...
_npo6ka_
Fast Inserter
Fast Inserter
Posts: 102
Joined: Mon Sep 26, 2016 10:29 pm
Contact:

Re: Problem with closing player gui

Post by _npo6ka_ »

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

Re: Problem with closing player gui

Post by Rseding91 »

What "gui mod" do you want to close?
If you want to get ahold of me I'm almost always on Discord.
_npo6ka_
Fast Inserter
Fast Inserter
Posts: 102
Joined: Mon Sep 26, 2016 10:29 pm
Contact:

Re: Problem with closing player gui

Post by _npo6ka_ »

Rseding91 wrote:What "gui mod" do you want to close?
I create a flow container for my mod and add it to the player's opened gui. Further inside the flow of the container, I have the additional elements necessary inside the mod. While the player is using the gui, autosave occurs. Next, I load the preservation of the game and the gui player remains open, which does not look right.
I would like to close this gui while saving/loading the game or when entering/leaving the player from the game, but so far I have not found an available solution
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Problem with closing player gui

Post by eradicator »

The game does not make a difference between "game has just been loaded" and "game has just been saved", it must be deterministically identical in both cases or multiplayer games would desync. Thus what you're trying to do is not something you're supposed to do. Just leave the gui open.
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.
Post Reply

Return to “Modding help”