mirror of
https://github.com/minetest/minetest.git
synced 2025-07-06 01:40:21 +02:00
Dehardcode the death formspec (#15155)
Co-authored-by: Paul Ouellette <oue.paul18@gmail.com>
This commit is contained in:
@ -126,7 +126,7 @@ class EmergeManager;
|
||||
| TOCLIENT_INVENTORY | | | |
|
||||
| TOCLIENT_HP (opt) | \-----------------/ |
|
||||
| TOCLIENT_BREATH | |
|
||||
| TOCLIENT_DEATHSCREEN | |
|
||||
| TOCLIENT_DEATHSCREEN_LEGACY | |
|
||||
+-----------------------------+ |
|
||||
| |
|
||||
v |
|
||||
|
@ -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;
|
||||
|
@ -124,6 +124,7 @@ public:
|
||||
void setHPRaw(u16 hp) { m_hp = hp; }
|
||||
u16 getBreath() const { return m_breath; }
|
||||
void setBreath(const u16 breath, bool send = true);
|
||||
void respawn();
|
||||
|
||||
/*
|
||||
Inventory interface
|
||||
|
Reference in New Issue
Block a user