mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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:
parent
e15de8b70d
commit
88cdd3a363
8 changed files with 104 additions and 70 deletions
|
@ -1171,8 +1171,18 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
|||
std::istringstream is(datastring, std::ios_base::binary);
|
||||
Player *player = m_env.getLocalPlayer();
|
||||
assert(player != NULL);
|
||||
u8 oldhp = player->hp;
|
||||
u8 hp = readU8(is);
|
||||
player->hp = hp;
|
||||
|
||||
if(hp < oldhp)
|
||||
{
|
||||
// Add to ClientEvent queue
|
||||
ClientEvent event;
|
||||
event.type = CE_PLAYER_DAMAGE;
|
||||
event.player_damage.amount = oldhp - hp;
|
||||
m_client_event_queue.push_back(event);
|
||||
}
|
||||
}
|
||||
else if(command == TOCLIENT_MOVE_PLAYER)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue