From db854c77b2c85380b9cb94a369518d97245759a5 Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Wed, 6 Dec 2023 15:47:14 -0500 Subject: [PATCH] :ok_hand: --- SQCSim-common/bullet.cpp | 1 + SQCSim-common/player.h | 1 + SQCSim-srv/connection.cpp | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/SQCSim-common/bullet.cpp b/SQCSim-common/bullet.cpp index c487fcc..ad9e931 100644 --- a/SQCSim-common/bullet.cpp +++ b/SQCSim-common/bullet.cpp @@ -26,6 +26,7 @@ bool Bullet::Update(World* world, float elapsedtime, int perframe, std::unordere } if (hit && !player->AmIDead()) { player->InflictDamage(damage); + player->m_hit = true; if (player->AmIDead()) player->Killer = m_shooter_id; diff --git a/SQCSim-common/player.h b/SQCSim-common/player.h index 7503105..b3d715e 100644 --- a/SQCSim-common/player.h +++ b/SQCSim-common/player.h @@ -41,6 +41,7 @@ public: void addPoint(); uint64_t Killer = 0; std::string m_username; + bool m_hit = false; private: uint64_t getId() const; diff --git a/SQCSim-srv/connection.cpp b/SQCSim-srv/connection.cpp index e28094f..d1d1a9a 100644 --- a/SQCSim-srv/connection.cpp +++ b/SQCSim-srv/connection.cpp @@ -144,8 +144,11 @@ Timestamp Connection::Run(World* world) { player->Killer = GetHash(true); } - out.states.jumping = in.keys.jump; + out.states.jumping = player->GetVelocity().y > 0.1f; out.states.running = player->GetVelocity().Length() > .3f; + out.states.still = !out.states.running; + out.states.hit = player->m_hit; + player->m_hit = false; if (player->AmIDead()) { in.keys.shoot = false; @@ -171,6 +174,8 @@ Timestamp Connection::Run(World* world) { if (in.keys.shoot && m_shoot_acc <= 0.) { Bullets.emplace_back(new Bullet(player->GetPOV() + player->GetDirection(), player->GetDirection(), GetHash(true))); out.states.shooting = true; + if (out.states.jumping) + out.states.jumpshot = true; m_shoot_acc = BULLET_TIME; }