diff --git a/SQCSim-common/bullet.cpp b/SQCSim-common/bullet.cpp index 72da0c1..87412da 100644 --- a/SQCSim-common/bullet.cpp +++ b/SQCSim-common/bullet.cpp @@ -18,7 +18,7 @@ bool Bullet::Update(World* world, float elapsedtime, int perframe, std::unordere for (auto& [key, player] : mapPlayer) { bool hit = false; - if ((m_currentpos - player->GetPosition()).Length() < .6f) { + if ((m_currentpos - player->GetPosition()).Length() < 1.f) { hit = true; } if ((m_currentpos - player->GetPOV()).Length() < .2f) { diff --git a/SQCSim-srv/connection.cpp b/SQCSim-srv/connection.cpp index 700c1da..c9fd885 100644 --- a/SQCSim-srv/connection.cpp +++ b/SQCSim-srv/connection.cpp @@ -59,7 +59,9 @@ void Connection::getPacks(SOCKET sock) { switch (netprot::getType(pck, 1)) { using enum netprot::PACKET_TYPE; case INPUT: - if (Deserialize(&in, pck, &bsize)) { + if (player->AmIDead()) + break; + else if (Deserialize(&in, pck, &bsize)) { m_input_manifest[in.timestamp] = in; m_input_vector.push_back(in); } @@ -77,6 +79,19 @@ void Connection::getPacks(SOCKET sock) { void Connection::sendPacks(SOCKET sock, std::unordered_map conns, const uint32_t timer) { static int outs = 0; static Timestamp last = 0; + static uint32_t lasttimer = timer; + + if (m_output_vector.empty() && player->AmIDead()) { + if (timer != lasttimer) { + lasttimer = timer; + Sync sync; + sync.timestamp = sync.sid = m_loginfo.sid; + sync.hp = 0; + sync.ammo = -1; + sync.timer = timer; + sendPackTo(sock, &sync, &m_bufout, &m_addr); + } + } while (!m_output_vector.empty()) { Output out = m_output_vector.front(); diff --git a/SQCSim-srv/server.cpp b/SQCSim-srv/server.cpp index 6d7153c..2a8825e 100644 --- a/SQCSim-srv/server.cpp +++ b/SQCSim-srv/server.cpp @@ -374,7 +374,7 @@ void Server::Run() { for (auto bull = bullets.begin(); bull != bullets.end(); ++bull) { ChunkMod* cmod = nullptr; Bullet* bullet = *bull; - if (bullet->Update(m_world, (1. / 60.), 10, m_players, &cmod)) { + if (bullet->Update(m_world, (1. / 60.), 100, m_players, &cmod)) { if (cmod) chunkdiffs.emplace_back(cmod); bullit.push_back(bull);