New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spawn mod: Also reposition players on respawn #2139
Conversation
Tested. |
mods/spawn/init.lua
Outdated
-- position. | ||
|
||
minetest.register_on_newplayer(function(player) | ||
if not searched then | ||
success = search() | ||
searched = true | ||
end | ||
if success then | ||
player:setpos(spawn_pos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecated naming. set_pos
(also for register_on_respawnplayer
)
EDIT: This callback (including return true
) can be defined as regular function and registered in newplayer
and respawnplayer
using the same function name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah of course, ok on both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
To avoid respawn position being possibly very distant from new player spawn position.
Updated and retested. |
end | ||
end | ||
|
||
minetest.register_on_newplayer(function(player) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shorter: minetest.register_on_newplayer(on_spawn)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, feel free to adapt the additional comment on merge or leave as-is.
Previously, respawn after player death could result in an engine spawn position significantly far from the new player mod spawn position, which is also inconsistent with spawning behaviour without the mod. Depending on the mapgen (some have large areas of sea) and the scale of heat and humidity noises, spawn mod position could be 100s-1000s of nodes away from engine spawn.