Players stay in environment even when dead, damage flash and fall damage fixes
Don't set m_removed on dead players (dead players are indicated by hp == 0). Local damage flash is shown whatever the cause was (even from Lua set_hp). PlayerCAO damage flash matches duration of local damage flash. Fall damage is dealt much more consistently (this is done by disallowing jumping when speed.Y is very negative, up to now jumping could sometimes negate fall damage)
This commit is contained in:
@@ -34,7 +34,6 @@ ServerRemotePlayer::ServerRemotePlayer(ServerEnvironment *env):
|
||||
m_wield_index(0),
|
||||
m_inventory_not_sent(false),
|
||||
m_hp_not_sent(false),
|
||||
m_respawn_active(false),
|
||||
m_is_in_environment(false),
|
||||
m_time_from_last_punch(0),
|
||||
m_position_not_sent(false)
|
||||
@@ -159,6 +158,8 @@ std::string ServerRemotePlayer::getClientInitializationData()
|
||||
writeV3F1000(os, getPosition());
|
||||
// yaw
|
||||
writeF1000(os, getYaw());
|
||||
// dead
|
||||
writeU8(os, getHP() == 0);
|
||||
return os.str();
|
||||
}
|
||||
|
||||
@@ -247,6 +248,19 @@ void ServerRemotePlayer::setHP(s16 hp_)
|
||||
|
||||
if(hp != oldhp)
|
||||
m_hp_not_sent = true;
|
||||
|
||||
// On death or reincarnation send an active object message
|
||||
if((hp == 0) != (oldhp == 0))
|
||||
{
|
||||
std::ostringstream os(std::ios::binary);
|
||||
// command (2 = update death state)
|
||||
writeU8(os, 2);
|
||||
// dead?
|
||||
writeU8(os, hp == 0);
|
||||
// create message and add to list
|
||||
ActiveObjectMessage aom(getId(), false, os.str());
|
||||
m_messages_out.push_back(aom);
|
||||
}
|
||||
}
|
||||
s16 ServerRemotePlayer::getHP()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user