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,25 +4283,29 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
s8 suffocate = readS8(is); s8 suffocate = readS8(is);
s8 hunger = readS8(is); s8 hunger = readS8(is);
if (damage && g_settings->getBool("enable_damage")) { if (g_settings->getBool("enable_damage")) {
actionstream<<player->getName()<<" damaged by " if (damage) {
<<(int)damage<<" hp at "<<PP(player->getPosition()/BS) actionstream<<player->getName()<<" damaged by "
<<std::endl; <<(int)damage<<" hp at "<<PP(player->getPosition()/BS)
<<std::endl;
}
if (suffocate && g_settings->getBool("enable_suffocation")) {
actionstream<<player->getName()<<" lost "
<<(int)suffocate<<" air at "<<PP(player->getPosition()/BS)
<<std::endl;
}else{
suffocate = 0;
}
if (hunger && g_settings->getBool("enable_hunger")) {
actionstream<<player->getName()<<" lost "
<<(int)hunger<<" hunger at "<<PP(player->getPosition()/BS)
<<std::endl;
}else{
hunger = 0;
}
}else{ }else{
damage = 0; damage = 0;
}
if (suffocate && g_settings->getBool("enable_suffocation")) {
actionstream<<player->getName()<<" lost "
<<(int)suffocate<<" air at "<<PP(player->getPosition()/BS)
<<std::endl;
}else{
suffocate = 0; suffocate = 0;
}
if (hunger && g_settings->getBool("enable_hunger")) {
actionstream<<player->getName()<<" lost "
<<(int)hunger<<" hunger at "<<PP(player->getPosition()/BS)
<<std::endl;
}else{
hunger = 0; hunger = 0;
} }