forked from Mirrorlandia_minetest/minetest
Fix multiple death messages (#5305)
Fix multiple death messages (#3565) and damage server logs after death.
This commit is contained in:
parent
63e175dd70
commit
351cc2e79a
@ -919,8 +919,8 @@ void PlayerSAO::step(float dtime, bool send_recommended)
|
|||||||
MapNode n = m_env->getMap().getNodeNoEx(p);
|
MapNode n = m_env->getMap().getNodeNoEx(p);
|
||||||
const ContentFeatures &c = m_env->getGameDef()->ndef()->get(n);
|
const ContentFeatures &c = m_env->getGameDef()->ndef()->get(n);
|
||||||
// If node generates drown
|
// If node generates drown
|
||||||
if (c.drowning > 0) {
|
if (c.drowning > 0 && m_hp > 0) {
|
||||||
if (m_hp > 0 && m_breath > 0)
|
if (m_breath > 0)
|
||||||
setBreath(m_breath - 1);
|
setBreath(m_breath - 1);
|
||||||
|
|
||||||
// No more breath, damage player
|
// No more breath, damage player
|
||||||
|
@ -1107,6 +1107,13 @@ void Server::handleCommand_Damage(NetworkPacket* pkt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (g_settings->getBool("enable_damage")) {
|
if (g_settings->getBool("enable_damage")) {
|
||||||
|
if (playerSAO->isDead()) {
|
||||||
|
verbosestream << "Server::ProcessData(): Info: "
|
||||||
|
"Ignoring damage as player " << player->getName()
|
||||||
|
<< " is already dead." << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
actionstream << player->getName() << " damaged by "
|
actionstream << player->getName() << " damaged by "
|
||||||
<< (int)damage << " hp at " << PP(playersao->getBasePosition() / BS)
|
<< (int)damage << " hp at " << PP(playersao->getBasePosition() / BS)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
@ -1111,16 +1111,15 @@ PlayerSAO* Server::StageTwoClientInit(u16 peer_id)
|
|||||||
// Send inventory
|
// Send inventory
|
||||||
SendInventory(playersao);
|
SendInventory(playersao);
|
||||||
|
|
||||||
// Send HP
|
// Send HP or death screen
|
||||||
|
if (playersao->isDead())
|
||||||
|
SendDeathscreen(peer_id, false, v3f(0,0,0));
|
||||||
|
else
|
||||||
SendPlayerHPOrDie(playersao);
|
SendPlayerHPOrDie(playersao);
|
||||||
|
|
||||||
// Send Breath
|
// Send Breath
|
||||||
SendPlayerBreath(playersao);
|
SendPlayerBreath(playersao);
|
||||||
|
|
||||||
// Show death screen if necessary
|
|
||||||
if (playersao->isDead())
|
|
||||||
SendDeathscreen(peer_id, false, v3f(0,0,0));
|
|
||||||
|
|
||||||
// Note things in chat if not in simple singleplayer mode
|
// Note things in chat if not in simple singleplayer mode
|
||||||
if (!m_simple_singleplayer_mode && g_settings->getBool("show_statusline_on_connect")) {
|
if (!m_simple_singleplayer_mode && g_settings->getBool("show_statusline_on_connect")) {
|
||||||
// Send information about server to player in chat
|
// Send information about server to player in chat
|
||||||
|
Loading…
Reference in New Issue
Block a user