move player on death
Some checks failed
Linux arm64 / Build (push) Failing after 3m53s

This commit is contained in:
2024-03-21 16:46:38 +01:00
parent fe68b98ba1
commit 2cbe3f1219

View File

@@ -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)});
}
}