mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 11:33:44 +01:00
Disable all HP handling if enable_damage is false
This commit is contained in:
parent
0437abbffb
commit
8aa190606e
@ -2099,7 +2099,8 @@ void the_game(
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(event.type == CE_PLAYER_DAMAGE)
|
else if(event.type == CE_PLAYER_DAMAGE &&
|
||||||
|
client.getHP() != 0)
|
||||||
{
|
{
|
||||||
//u16 damage = event.player_damage.amount;
|
//u16 damage = event.player_damage.amount;
|
||||||
//infostream<<"Player damage: "<<damage<<std::endl;
|
//infostream<<"Player damage: "<<damage<<std::endl;
|
||||||
|
@ -1368,11 +1368,16 @@ void Server::AsyncRunStep()
|
|||||||
/*
|
/*
|
||||||
Handle player HPs (die if hp=0)
|
Handle player HPs (die if hp=0)
|
||||||
*/
|
*/
|
||||||
if(playersao->getHP() == 0 && playersao->m_hp_not_sent)
|
if(playersao->m_hp_not_sent && g_settings->getBool("enable_damage"))
|
||||||
|
{
|
||||||
|
if(playersao->getHP() == 0)
|
||||||
DiePlayer(client->peer_id);
|
DiePlayer(client->peer_id);
|
||||||
|
else
|
||||||
|
SendPlayerHP(client->peer_id);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Send player inventories and HPs if necessary
|
Send player inventories if necessary
|
||||||
*/
|
*/
|
||||||
if(playersao->m_moved){
|
if(playersao->m_moved){
|
||||||
SendMovePlayer(client->peer_id);
|
SendMovePlayer(client->peer_id);
|
||||||
@ -1382,9 +1387,6 @@ void Server::AsyncRunStep()
|
|||||||
UpdateCrafting(client->peer_id);
|
UpdateCrafting(client->peer_id);
|
||||||
SendInventory(client->peer_id);
|
SendInventory(client->peer_id);
|
||||||
}
|
}
|
||||||
if(playersao->m_hp_not_sent){
|
|
||||||
SendPlayerHP(client->peer_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2311,6 +2313,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||||||
SendInventory(peer_id);
|
SendInventory(peer_id);
|
||||||
|
|
||||||
// Send HP
|
// Send HP
|
||||||
|
if(g_settings->getBool("enable_damage"))
|
||||||
SendPlayerHP(peer_id);
|
SendPlayerHP(peer_id);
|
||||||
|
|
||||||
// Send detached inventories
|
// Send detached inventories
|
||||||
@ -2764,6 +2767,8 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||||||
std::istringstream is(datastring, std::ios_base::binary);
|
std::istringstream is(datastring, std::ios_base::binary);
|
||||||
u8 damage = readU8(is);
|
u8 damage = readU8(is);
|
||||||
|
|
||||||
|
if(g_settings->getBool("enable_damage"))
|
||||||
|
{
|
||||||
actionstream<<player->getName()<<" damaged by "
|
actionstream<<player->getName()<<" damaged by "
|
||||||
<<(int)damage<<" hp at "<<PP(player->getPosition()/BS)
|
<<(int)damage<<" hp at "<<PP(player->getPosition()/BS)
|
||||||
<<std::endl;
|
<<std::endl;
|
||||||
@ -2776,6 +2781,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||||||
if(playersao->m_hp_not_sent)
|
if(playersao->m_hp_not_sent)
|
||||||
SendPlayerHP(peer_id);
|
SendPlayerHP(peer_id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if(command == TOSERVER_PASSWORD)
|
else if(command == TOSERVER_PASSWORD)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -2850,7 +2856,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||||||
}
|
}
|
||||||
else if(command == TOSERVER_RESPAWN)
|
else if(command == TOSERVER_RESPAWN)
|
||||||
{
|
{
|
||||||
if(player->hp != 0)
|
if(player->hp != 0 || !g_settings->getBool("enable_damage"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RespawnPlayer(peer_id);
|
RespawnPlayer(peer_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user