1
0
mirror of https://github.com/minetest/minetest.git synced 2025-07-01 23:50:22 +02:00

Add API function to invoke player respawn

closes #12272
This commit is contained in:
sfan5
2022-05-25 19:29:11 +02:00
parent da71e86633
commit f195db2d14
5 changed files with 27 additions and 3 deletions

View File

@ -2784,9 +2784,10 @@ void Server::RespawnPlayer(session_t peer_id)
<< playersao->getPlayer()->getName()
<< " respawns" << std::endl;
playersao->setHP(playersao->accessObjectProperties()->hp_max,
const auto *prop = playersao->accessObjectProperties();
playersao->setHP(prop->hp_max,
PlayerHPChangeReason(PlayerHPChangeReason::RESPAWN));
playersao->setBreath(playersao->accessObjectProperties()->breath_max);
playersao->setBreath(prop->breath_max);
bool repositioned = m_script->on_respawnplayer(playersao);
if (!repositioned) {