summaryrefslogtreecommitdiffstats
path: root/src/GameState.cpp
diff options
context:
space:
mode:
authorLaG1924 <lag1924@gmail.com>2021-07-02 09:26:39 +0200
committerLaG1924 <lag1924@gmail.com>2021-07-03 10:36:56 +0200
commit48e564a32c266c8d4649c6f50bf4eac56f771c0d (patch)
tree34fbd849a2b0f1ded8ab8d87c1e4a300107b2e0e /src/GameState.cpp
parentAdded Loading screen (diff)
downloadAltCraft-48e564a32c266c8d4649c6f50bf4eac56f771c0d.tar
AltCraft-48e564a32c266c8d4649c6f50bf4eac56f771c0d.tar.gz
AltCraft-48e564a32c266c8d4649c6f50bf4eac56f771c0d.tar.bz2
AltCraft-48e564a32c266c8d4649c6f50bf4eac56f771c0d.tar.lz
AltCraft-48e564a32c266c8d4649c6f50bf4eac56f771c0d.tar.xz
AltCraft-48e564a32c266c8d4649c6f50bf4eac56f771c0d.tar.zst
AltCraft-48e564a32c266c8d4649c6f50bf4eac56f771c0d.zip
Diffstat (limited to '')
-rw-r--r--src/GameState.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/GameState.cpp b/src/GameState.cpp
index bb93c45..50a9004 100644
--- a/src/GameState.cpp
+++ b/src/GameState.cpp
@@ -456,9 +456,8 @@ void GameState::UpdatePacket(std::shared_ptr<Packet> ptr) {
auto packet = std::static_pointer_cast<PacketUpdateHealth>(ptr);
playerStatus.health = packet->Health;
if (playerStatus.health <= 0) {
- LOG(INFO) << "Player is dead. Respawning...";
- auto packetPerformRespawn = std::make_shared<PacketClientStatus>(0);
- PUSH_EVENT("SendPacket", std::static_pointer_cast<Packet>(packetPerformRespawn));
+ LOG(INFO) << "Player is dead. Need respawn...";
+ SetState(State::NeedRespawn);
}
break;
}
@@ -681,4 +680,9 @@ void GameState::PlaceBlock() {
auto packet = std::static_pointer_cast<Packet>(packetPlace);
PUSH_EVENT("SendPacket", packet);
-} \ No newline at end of file
+}
+
+void GameState::PerformRespawn() {
+ auto packetPerformRespawn = std::make_shared<PacketClientStatus>(0);
+ PUSH_EVENT("SendPacket", std::static_pointer_cast<Packet>(packetPerformRespawn));
+}