🚫 👂 🐆

This commit is contained in:
MarcEricMartel
2023-12-09 12:02:04 -05:00
parent 63d70be488
commit 9aaad6426c
11 changed files with 130 additions and 74 deletions

View File

@@ -4,16 +4,18 @@
Connection::Connection(SOCKET sock,
sockaddr_in sockaddr,
LoginInfo log,
PlayerInfo play) :
LoginInfo *log,
PlayerInfo *play) :
m_sock(sock),
m_addr(sockaddr),
m_loginfo(log),
m_playinfo(play) {
m_loginfo(*log),
m_playinfo(*play) {
}
Connection::~Connection() { closesocket(m_sock); }
Connection::~Connection() {
delete player;
closesocket(m_sock); }
uint64_t Connection::GetHash(bool self) const { return self ? m_loginfo.sid : m_playinfo.id; }
@@ -144,7 +146,7 @@ Timestamp Connection::Run(World* world) {
player->Killer = GetHash(true);
}
out.states.jumping = player->GetIsAirborne(); //abs(player->GetVelocity().y) > .2f;
out.states.jumping = player->GetIsAirborne();
out.states.running = player->GetVelocity().Length() > .5f;
out.states.still = !out.states.running && !out.states.jumping;
out.states.hit = player->m_hit;
@@ -166,7 +168,7 @@ Timestamp Connection::Run(World* world) {
player->GetDirection(),
block, true);
if (cmod)
ChunkDiffs.emplace_back(cmod);
ChunkDiffs.push_back(std::move(cmod));
}
}
else toggle = false;
@@ -178,7 +180,7 @@ Timestamp Connection::Run(World* world) {
else out.states.jumpshot = false;
if (in.keys.shoot && m_shoot_acc <= 0.) {
Bullets.emplace_back(new Bullet(player->GetPOV() + player->GetDirection(), player->GetDirection(), GetHash(true)));
Bullets.push_back(std::move(new Bullet(player->GetPOV() + player->GetDirection(), player->GetDirection(), GetHash(true))));
m_shoot_acc = BULLET_TIME;
}