Minetest_game: Spawn mod: make the spawning code a global function usable by mods

Created on 2 May 2018  路  11Comments  路  Source: minetest/minetest_game

With a good spawnpoint finding algorithm in place, it could be utilized in order to teleport multiple players apart in a specific radius with a specific coordinate as center point. It can be part API function, part chat command:

  • minetest.spreadplayers(x, z, min_range, max_range, player)
  • /spreadplayers x z min_range max_range player

(the player variable would be optional)
////////////////////

EDIT by paramat: Request changed, see new thread title and discussion.

Feature request Supported by core dev

Most helpful comment

PR #2257 as a start. Later i might add an optional feature to spawn mod for scattering players across a world, which will lead to very interesting server dynamics as explained in https://github.com/minetest/minetest/issues/6229

All 11 comments

Good idea, something i have wanted to do for a long time, see https://github.com/minetest/minetest/issues/6229
There are some issues, where does a player get respawned? Their initial spawn might need to be stored in a world file to be used for respawn, which could get big and slow to access on a popular server.

In my mind this would be a specialized teleport command and function and thus not update respawn point.

Perhaps it鈥檚 not a true fit for the spawn mod then although the algorithm is the same. On the other hand this would definitely be a good feature to have on on_join for servers who don鈥檛 want all players spawn at one point but evenly spread around an area.

I see, i slightly misunderstood.

Ok, i feel the function you specifically request is too narrow a feature, and i don't see a need for the chat command. However i do feel that the spawnpoint search should be available as a global function for mods to use as they wish for various purposes, so a function that is more neutral and universal.
Then maybe the spawn mod itself could have an option for scattered spawnpoints.

the spawnpoint search should be available as a global function for mods to use as they wish for various purposes, so a function that is more neutral and universal.

Yes, I also realize that the feature is a bit niched so this would provide a good general solution to solving this specific problem.

Let鈥檚 reframe and rename the issue?

I agree.

With the new direction in mind, I want to state my wish for a method of getting and setting the friendly biome IDs.

Rolling #2116 into this, biomes could be an argument of this function.

Related issue: I'm thinking this spawn mod should function 'on respawnplayer' too, i've noticed after a death a player respawns a long way from their initial spawn and in unfriendly biomes. With engine spawning, initial spawn and respawn are similar places.
EDIT: Done.

PR #2257 as a start. Later i might add an optional feature to spawn mod for scattering players across a world, which will lead to very interesting server dynamics as explained in https://github.com/minetest/minetest/issues/6229

Looks like #2257 will be moved to engine 'builtin' for use by all games.

EDIT: If it is, MTG will require changes, so keeping this open.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FeXoR-o-Illuria picture FeXoR-o-Illuria  路  4Comments

paramat picture paramat  路  3Comments

paramat picture paramat  路  3Comments

HybridDog picture HybridDog  路  4Comments

benrob0329 picture benrob0329  路  4Comments