enable_suffocation and enable_hunger should have no effect if enable_damage is false

This commit is contained in:
darkrose 2014-09-22 22:47:21 +10:00
parent 3266833cb9
commit f01e9a72f4
1 changed files with 20 additions and 16 deletions

View File

@ -4283,12 +4283,11 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
s8 suffocate = readS8(is);
s8 hunger = readS8(is);
if (damage && g_settings->getBool("enable_damage")) {
if (g_settings->getBool("enable_damage")) {
if (damage) {
actionstream<<player->getName()<<" damaged by "
<<(int)damage<<" hp at "<<PP(player->getPosition()/BS)
<<std::endl;
}else{
damage = 0;
}
if (suffocate && g_settings->getBool("enable_suffocation")) {
actionstream<<player->getName()<<" lost "
@ -4304,6 +4303,11 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
}else{
hunger = 0;
}
}else{
damage = 0;
suffocate = 0;
hunger = 0;
}
if (!damage && !suffocate && !hunger) {
SendPlayerHP(player);