Page 1 of 1

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

Posted: Thu Jul 28, 2016 8:50 pm
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.

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

Posted: Thu Jul 28, 2016 9:10 pm
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.

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

Posted: Thu Jul 28, 2016 10:15 pm
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)

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

Posted: Thu Jul 28, 2016 11:30 pm
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.

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

Posted: Thu Jul 28, 2016 11:53 pm
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/".

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

Posted: Fri Jul 29, 2016 12:11 am
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."

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

Posted: Fri Jul 29, 2016 12:49 am
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.

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

Posted: Fri Jul 29, 2016 1:00 am
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.

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

Posted: Fri Jul 29, 2016 1:21 am
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!

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

Posted: Fri Jul 29, 2016 7:12 pm
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" :-)