diff options
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/client.cpp b/src/client.cpp index 0463aa81c..bc303bc4b 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -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) { |