Skip to content
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

Merged
merged 1 commit into from Jun 7, 2018
Merged

Spawn mod: Also reposition players on respawn #2139

merged 1 commit into from Jun 7, 2018

Conversation

paramat
Copy link
Contributor

@paramat paramat commented Jun 5, 2018

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.

@paramat paramat added Feature WIP and removed WIP labels Jun 5, 2018
@paramat
Copy link
Contributor Author

paramat commented Jun 5, 2018

Tested.

-- position.

minetest.register_on_newplayer(function(player)
if not searched then
success = search()
searched = true
end
if success then
player:setpos(spawn_pos)
Copy link
Member

@SmallJoker SmallJoker Jun 5, 2018

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@paramat paramat added the WIP label Jun 5, 2018
To avoid respawn position being possibly very distant from new player
spawn position.
@paramat paramat removed the WIP label Jun 6, 2018
@paramat
Copy link
Contributor Author

paramat commented Jun 6, 2018

Updated and retested.

end
end

minetest.register_on_newplayer(function(player)
Copy link
Member

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)

Copy link
Member

@SmallJoker SmallJoker left a 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.

@paramat paramat merged commit abe1b9f into minetest:master Jun 7, 2018
@paramat paramat deleted the respawnsearch branch July 13, 2018 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants