1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Dehardcode the death formspec (#15155)

Co-authored-by: Paul Ouellette <oue.paul18@gmail.com>
This commit is contained in:
grorp 2024-09-24 22:37:44 +02:00 committed by GitHub
parent 3c48671076
commit 526a2f7b8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
79 changed files with 242 additions and 172 deletions

View file

@ -126,7 +126,7 @@ class EmergeManager;
| TOCLIENT_INVENTORY | | | |
| TOCLIENT_HP (opt) | \-----------------/ |
| TOCLIENT_BREATH | |
| TOCLIENT_DEATHSCREEN | |
| TOCLIENT_DEATHSCREEN_LEGACY | |
+-----------------------------+ |
| |
v |

View file

@ -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;

View file

@ -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