Page 1 of 1

freeplay or scenario

Posted: Tue Jan 10, 2017 2:28 pm
by mophydeen
Is there a way to know if a map is a scenario or a freeplay?

single player or multi player?

Re: freeplay or scenario

Posted: Tue Jan 10, 2017 2:53 pm
by daniel34
mophydeen wrote:Is there a way to know if a map is a scenario or a freeplay?
Freeplay is a scenario.
In 0.15 a remote interface will be added to freeplay and sandbox, you can probably check for that.
mophydeen wrote:single player or multi player?
Checking the count of LuaGameScript.players should be able to tell you. I'm not sure what this will look like if the game was started in multiplayer with only one player, though. Or if the game is considered to be multiplayer then.

Re: freeplay or scenario

Posted: Tue Jan 10, 2017 3:00 pm
by mophydeen
daniel34 wrote: Checking the count of LuaGameScript.players should be able to tell you.
I could start a multiplayer and play it alone. It's multiplayer but only 1 player ..

Re: freeplay or scenario

Posted: Tue Jan 10, 2017 3:15 pm
by daniel34
I probably edited my answer while you were writing yours, but yes, I didn't find a way to distinguish between a singleplayer game and a multiplayer game with 1 player (connected_players returns 1 in a singleplayer game).

The question is though: why would you need to do that? Factorio behaves the same way (from the API side) in both cases.

Re: freeplay or scenario

Posted: Tue Jan 10, 2017 3:21 pm
by mophydeen
daniel34 wrote: The question is though: why would you need to do that? Factorio behaves the same way (from the API side) in both cases.

on_join is not called in singleplayer