1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-12-23 08:08:47 -05:00

Give full breath after death

This commit is contained in:
SmallJoker 2015-02-04 09:00:34 +01:00 committed by Craig Robbins
parent 5e075c3344
commit 929e0b0ad8
3 changed files with 7 additions and 3 deletions

View File

@ -89,6 +89,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
// Maximum hit points of a player // Maximum hit points of a player
#define PLAYER_MAX_HP 20 #define PLAYER_MAX_HP 20
// Maximal breath of a player
#define PLAYER_MAX_BREATH 11
// Number of different files to try to save a player to if the first fails // Number of different files to try to save a player to if the first fails
// (because of a case-insensitive filesystem) // (because of a case-insensitive filesystem)
// TODO: Use case-insensitive player names instead of this hack. // TODO: Use case-insensitive player names instead of this hack.

View File

@ -47,7 +47,7 @@ Player::Player(IGameDef *gamedef, const char *name):
keyPressed(0), keyPressed(0),
// protected // protected
m_gamedef(gamedef), m_gamedef(gamedef),
m_breath(-1), m_breath(PLAYER_MAX_BREATH),
m_pitch(0), m_pitch(0),
m_yaw(0), m_yaw(0),
m_speed(0,0,0), m_speed(0,0,0),
@ -213,12 +213,12 @@ void Player::deSerialize(std::istream &is, std::string playername)
try{ try{
hp = args.getS32("hp"); hp = args.getS32("hp");
}catch(SettingNotFoundException &e) { }catch(SettingNotFoundException &e) {
hp = 20; hp = PLAYER_MAX_HP;
} }
try{ try{
m_breath = args.getS32("breath"); m_breath = args.getS32("breath");
}catch(SettingNotFoundException &e) { }catch(SettingNotFoundException &e) {
m_breath = 11; m_breath = PLAYER_MAX_BREATH;
} }
inventory.deSerialize(is); inventory.deSerialize(is);

View File

@ -4294,6 +4294,7 @@ void Server::RespawnPlayer(u16 peer_id)
<<" respawns"<<std::endl; <<" respawns"<<std::endl;
playersao->setHP(PLAYER_MAX_HP); playersao->setHP(PLAYER_MAX_HP);
playersao->setBreath(PLAYER_MAX_BREATH);
bool repositioned = m_script->on_respawnplayer(playersao); bool repositioned = m_script->on_respawnplayer(playersao);
if(!repositioned){ if(!repositioned){