Any way to prevent the end-game dialog on rocket launch?

Place to post guides, observations, things related to modding that are not mods themselves.
User avatar
Versepelles
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat May 28, 2016 1:42 pm
Contact:

Any way to prevent the end-game dialog on rocket launch?

Post by Versepelles »

Is there a way to launch a rocket without either the "rocket launched with no satellite" message or the "game finished" dialog appearing? I thought I saw a post somewhere mentioning how to use the game.set_game_state{...} method, but I couldn't find the post and fiddling around didn't yield productive results- one of the afore-mentioned messages always displayed when a rocket was launched.
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Any way to prevent the end-game dialog on rocket launch?

Post by prg »

That code is part of the freeplay scenario's control.lua. I don't think it can be prevented from running by a mod. Create a different scenario with a control.lua without any code showing such messages (or possibly no control.lua at all if you don't care about starting equipment) or remove that code from an existing save game.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
User avatar
Versepelles
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat May 28, 2016 1:42 pm
Contact:

Re: Any way to prevent the end-game dialog on rocket launch?

Post by Versepelles »

prg wrote:That code is part of the freeplay scenario's control.lua. I don't think it can be prevented from running by a mod. Create a different scenario with a control.lua without any code showing such messages (or possibly no control.lua at all if you don't care about starting equipment) or remove that code from an existing save game.
I've heard that solution, but think that most players generally won't bother to play a mod that takes a custom scenario (judging by modding/content creating in other games). I don't think mods have the power to define which scenario the player is playing (do they? I have no experience with custom scenarios)
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Any way to prevent the end-game dialog on rocket launch?

Post by prg »

Players are responsible for selecting which scenario they're using. "New game" results in freeplay which comes with this satellite count logic, I don't see a way this can be avoided. You'd need to get the user to click the "Custom scenario" button.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
User avatar
Versepelles
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat May 28, 2016 1:42 pm
Contact:

Re: Any way to prevent the end-game dialog on rocket launch?

Post by Versepelles »

prg wrote:Players are responsible for selecting which scenario they're using. "New game" results in freeplay which comes with this satellite count logic, I don't see a way this can be avoided. You'd need to get the user to click the "Custom scenario" button.
Thanks for the info! Messed around with the scenario code and saw what you mean. As a follow up, do scenarios have to be copied into the Factorio directory itself, or can they be inserted into somewhere close to the mod directory? I run the game through steam, so the scenario folder looks like ".../Program Files/Steam/.../Factorio/data/base/scenarios/" while the mod directory is ".../Users/Versepelles/AppData/Roaming/Factorio/mods/".
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Any way to prevent the end-game dialog on rocket launch?

Post by prg »

Custom user scenarios go into the write data path, right next to the mods directory (just create a "scenarios" directory if it doesn't exist yet.) Scenarios can also be included in mods (just create the "scenarios" directory inside the mod's directory.)

Oh, and it seems like you need at least an empty control.lua if you want to avoid the freeplay stuff, otherwise "The scenario does not contain control.lua. Loading freeplay scripts."
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
User avatar
Versepelles
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat May 28, 2016 1:42 pm
Contact:

Re: Any way to prevent the end-game dialog on rocket launch?

Post by Versepelles »

prg wrote:Custom user scenarios go into the write data path, right next to the mods directory (just create a "scenarios" directory if it doesn't exist yet.) Scenarios can also be included in mods (just create the "scenarios" directory inside the mod's directory.)

Oh, and it seems like you need at least an empty control.lua if you want to avoid the freeplay stuff, otherwise "The scenario does not contain control.lua. Loading freeplay scripts."

That actually works very nicely, and I think players could be convinced to load the scenario since it's packaged with the mod. You've been very helpful, and I hate to wear out your goodwill, but would you happen to know how to detect whether a scenario has been loaded directly? Global variables don't seem to be accessible between scenarios and mods, and game.active_mods does not contain the scenario. A scenario can be indirectly detected by placing items into a player's inventory, but that seems messy.
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Any way to prevent the end-game dialog on rocket launch?

Post by prg »

The scenario could register a remote interface which the mod could check the existance of. But if some code should only ever run if a certain scenario is used, it could just be placed in that scenario's control.lua instead of the mod's top level control.lua.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
User avatar
Versepelles
Long Handed Inserter
Long Handed Inserter
Posts: 70
Joined: Sat May 28, 2016 1:42 pm
Contact:

Re: Any way to prevent the end-game dialog on rocket launch?

Post by Versepelles »

prg wrote:The scenario could register a remote interface which the mod could check the existance of. But if some code should only ever run if a certain scenario is used, it could just be placed in that scenario's control.lua instead of the mod's top level control.lua.
The remote interface solved it!

My usage is only quality of life; the mod launches rockets from the neutral force and has associated custom messages; the freeplay control.lua sends extraneous messages (annoying orange pop-ups), but does not interfere with the mod's workings. Therefore, the mod is compatible with freeplay mode, which some players may prefer, but a custom scenario without messages on rocket launches yields better immersion which I would prefer for players. So, the mod displays a warning message if the player is in freeplay mode, but allows them to continue if they wish.

Thanks for all the help!
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: Any way to prevent the end-game dialog on rocket launch?

Post by binbinhfr »

I find also this paused dialog quite annoying.
That's why I asked for a little modification of the control.lua of the scenario, just to make it non-blocking.
here :
viewtopic.php?f=28&t=26840

You can add your "vote" :-)
My mods on the Factorio Mod Portal :geek:
Post Reply

Return to “Modding discussion”