Skip to content

Commit 929e0b0

Browse files
SmallJokerZeno-
authored andcommittedFeb 5, 2015
Give full breath after death
1 parent 5e075c3 commit 929e0b0

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed
 

‎src/constants.h

+3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
8989
// Maximum hit points of a player
9090
#define PLAYER_MAX_HP 20
9191

92+
// Maximal breath of a player
93+
#define PLAYER_MAX_BREATH 11
94+
9295
// Number of different files to try to save a player to if the first fails
9396
// (because of a case-insensitive filesystem)
9497
// TODO: Use case-insensitive player names instead of this hack.

‎src/player.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Player::Player(IGameDef *gamedef, const char *name):
4747
keyPressed(0),
4848
// protected
4949
m_gamedef(gamedef),
50-
m_breath(-1),
50+
m_breath(PLAYER_MAX_BREATH),
5151
m_pitch(0),
5252
m_yaw(0),
5353
m_speed(0,0,0),
@@ -213,12 +213,12 @@ void Player::deSerialize(std::istream &is, std::string playername)
213213
try{
214214
hp = args.getS32("hp");
215215
}catch(SettingNotFoundException &e) {
216-
hp = 20;
216+
hp = PLAYER_MAX_HP;
217217
}
218218
try{
219219
m_breath = args.getS32("breath");
220220
}catch(SettingNotFoundException &e) {
221-
m_breath = 11;
221+
m_breath = PLAYER_MAX_BREATH;
222222
}
223223

224224
inventory.deSerialize(is);

‎src/server.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -4294,6 +4294,7 @@ void Server::RespawnPlayer(u16 peer_id)
42944294
<<" respawns"<<std::endl;
42954295

42964296
playersao->setHP(PLAYER_MAX_HP);
4297+
playersao->setBreath(PLAYER_MAX_BREATH);
42974298

42984299
bool repositioned = m_script->on_respawnplayer(playersao);
42994300
if(!repositioned){

0 commit comments

Comments
 (0)