Page 1 of 1

[0.16.12]force.spawn_position ignored on player creation

Posted: Sun Dec 31, 2017 10:49 pm
by Bilka
When a new player joins a multiplayer game, the spawn_position set by force.set_spawn_position is ignored. To reproduce:

1. Start mp game
2. Run:

Code: Select all

/c game.create_surface("2", game.player.surface.map_gen_settings)
	game.player.teleport({0, 0}, "2")
	for _, force in pairs(game.forces) do
		force.set_spawn_position({1,1}, "2")
	end
3. Have a 2nd player join

Expected: The second player spawns next to the first player because their spawn position is set to the second surface.

Actual result: The second player spawns on nauvis.

Re: [0.16.12]force.spawn_position ignored on player creation

Posted: Sun Dec 31, 2017 11:25 pm
by Rseding91
Thanks for the report. Spawn positions are per-surface and aren't exclusive: If you define a spawn position for surface 2 but don't define one for surface 1 then the game defaults to position 0,0 on surface 1 - it pays no attention to what other surfaces have defined.

Additionally joining a MP game always spawns on surface 1 (as it's guaranteed to always exists).

Re: [0.16.12]force.spawn_position ignored on player creation

Posted: Sun Dec 31, 2017 11:30 pm
by chrisgbk
This seems like it was just a misunderstanding: the surface parameter specifies which surface the spawn position is being set for, -not- which surface is the default to spawn to.

Re: [0.16.12]force.spawn_position ignored on player creation

Posted: Sun Dec 31, 2017 11:32 pm
by Bilka
chrisgbk wrote:This seems like it was just a misunderstanding: the surface parameter specifies which surface the spawn position is being set for, -not- which surface is the default to spawn to. Try this out by changing the spawn location for "2" to {100,100} then killing yourself after teleporting to "2" - you'll respawn on surface "2" at {100,100} instead of {0,0}.
That's what Rseding said..?