1
0
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:
grorp
2024-09-24 22:37:44 +02:00
committed by GitHub
parent 3c48671076
commit 526a2f7b8c
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