mirror of
https://github.com/luanti-org/luanti.git
synced 2025-12-14 19:18:29 +01:00
Dehardcode the death formspec (#15155)
Co-authored-by: Paul Ouellette <oue.paul18@gmail.com>
This commit is contained in:
@@ -558,6 +558,21 @@ void PlayerSAO::setBreath(const u16 breath, bool send)
|
||||
m_env->getGameDef()->SendPlayerBreath(this);
|
||||
}
|
||||
|
||||
void PlayerSAO::respawn()
|
||||
{
|
||||
infostream << "PlayerSAO::respawn(): Player " << m_player->getName()
|
||||
<< " respawns" << std::endl;
|
||||
|
||||
setHP(m_prop.hp_max, PlayerHPChangeReason(PlayerHPChangeReason::RESPAWN));
|
||||
setBreath(m_prop.breath_max);
|
||||
|
||||
bool repositioned = m_env->getScriptIface()->on_respawnplayer(this);
|
||||
if (!repositioned) {
|
||||
// setPos will send the new position to client
|
||||
setPos(m_env->getGameDef()->findSpawnPos());
|
||||
}
|
||||
}
|
||||
|
||||
Inventory *PlayerSAO::getInventory() const
|
||||
{
|
||||
return m_player ? &m_player->inventory : nullptr;
|
||||
|
||||
Reference in New Issue
Block a user