This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "client/game/ClientGame.h"
|
||||
|
||||
#include "blitz/misc/Log.h"
|
||||
#include "blitz/misc/Random.h"
|
||||
#include "blitz/protocol/PacketDispatcher.h"
|
||||
#include "blitz/protocol/packets/PlayerJoinPacket.h"
|
||||
#include "blitz/protocol/packets/PlayerLeavePacket.h"
|
||||
@@ -53,6 +54,11 @@ void ClientGame::HandlePacket(const protocol::PlayerListPacket* packet) {
|
||||
void ClientGame::HandlePacket(const protocol::UpdateHealthPacket* packet) {
|
||||
game::Player* player = m_Client->GetGame()->GetPlayerById(m_Client->GetPlayerID());
|
||||
player->SetHP(packet->GetNewHealth());
|
||||
|
||||
// we are dead
|
||||
if (player->GetHP() <= 0.0f) {
|
||||
player->SetPosition({utils::GetRandomReal(-10.0f, 10.0f), 0, utils::GetRandomReal(-10.0f, 10.0f)});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user