Skip to content
Permalink
Browse files
If player is dead, permit it to respawn, even if damages are not enabled
* Mods can do setHP function to do damages and override the enable_damage value sometimes
  • Loading branch information
nerzhul committed Mar 16, 2015
1 parent b2801d8 commit aaf26b3a4410c4a1dc2f4a8bb9c61122648fedf3
Showing 1 changed file with 1 addition and 1 deletion.
@@ -1335,7 +1335,7 @@ void Server::handleCommand_Respawn(NetworkPacket* pkt)
return;
}

if (!player->isDead() || !g_settings->getBool("enable_damage"))
if (!player->isDead())
return;

RespawnPlayer(pkt->getPeerId());

4 comments on commit aaf26b3

@HybridDog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usually mods only should be able to damage the player, e.g. by changing hp, if enable_damage is true
if they need to look for this manually, a lot mods would need to become updated, I think

@nerzhul
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No set_hp call is correct. I will propre a do_damage PR and this call must be used by mods, because enable_damage will use it :)

set_hp is more powerful but misused by modders

@HybridDog
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly, set_hp only worked for non player entities if damage was disabled.

@nerzhul
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l_object.cpp L251

ServerActiveObject *co = getobject(ref);
co->setHP(hp);

No filtering. Everything can be affected by this

Please sign in to comment.