keep in sync when dead
This commit is contained in:
parent
7b350fa403
commit
325c6b60f9
@ -18,7 +18,7 @@ bool Bullet::Update(World* world, float elapsedtime, int perframe, std::unordere
|
|||||||
|
|
||||||
for (auto& [key, player] : mapPlayer) {
|
for (auto& [key, player] : mapPlayer) {
|
||||||
bool hit = false;
|
bool hit = false;
|
||||||
if ((m_currentpos - player->GetPosition()).Length() < .6f) {
|
if ((m_currentpos - player->GetPosition()).Length() < 1.f) {
|
||||||
hit = true;
|
hit = true;
|
||||||
}
|
}
|
||||||
if ((m_currentpos - player->GetPOV()).Length() < .2f) {
|
if ((m_currentpos - player->GetPOV()).Length() < .2f) {
|
||||||
|
@ -77,6 +77,19 @@ void Connection::getPacks(SOCKET sock) {
|
|||||||
void Connection::sendPacks(SOCKET sock, std::unordered_map<uint64_t, Connection*> conns, const uint32_t timer) {
|
void Connection::sendPacks(SOCKET sock, std::unordered_map<uint64_t, Connection*> conns, const uint32_t timer) {
|
||||||
static int outs = 0;
|
static int outs = 0;
|
||||||
static Timestamp last = 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<Sync>(sock, &sync, &m_bufout, &m_addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (!m_output_vector.empty()) {
|
while (!m_output_vector.empty()) {
|
||||||
Output out = m_output_vector.front();
|
Output out = m_output_vector.front();
|
||||||
|
@ -374,7 +374,7 @@ void Server::Run() {
|
|||||||
for (auto bull = bullets.begin(); bull != bullets.end(); ++bull) {
|
for (auto bull = bullets.begin(); bull != bullets.end(); ++bull) {
|
||||||
ChunkMod* cmod = nullptr;
|
ChunkMod* cmod = nullptr;
|
||||||
Bullet* bullet = *bull;
|
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)
|
if (cmod)
|
||||||
chunkdiffs.emplace_back(cmod);
|
chunkdiffs.emplace_back(cmod);
|
||||||
bullit.push_back(bull);
|
bullit.push_back(bull);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user