Oh oh oh oh oh!!!

This commit is contained in:
MarcEricMartel
2023-12-06 14:31:05 -05:00
parent 42ea83d73e
commit 242250f251
5 changed files with 40 additions and 28 deletions

View File

@@ -80,9 +80,6 @@ void Connection::sendPacks(SOCKET sock, std::unordered_map<uint64_t, Connection*
for (auto& [key, conn] : conns) {
if (m_playinfo.id == conn->GetHash(false))
continue;
//std::cout << m_playinfo.id << ": " << m_playinfo.name << ": " << conn->GetName() << std::endl;
//std::cout << out.id << ": " << out.position << std::endl;
sendPackTo<Output>(sock, &out, &m_bufout, conn->getAddr());
}
++outs;
@@ -142,8 +139,8 @@ Timestamp Connection::Run(World* world) {
in.keys.right,
in.keys.jump, false, el), world, el);
if (player->GetPosition().y < -10.) {
player->InflictDamage(9000);
if (player->GetPosition().y < -20.) {
player->InflictDamage(9000.);
player->Killer = GetHash(true);
}

View File

@@ -276,16 +276,14 @@ void Server::Run() {
Chat* chat = new Chat();
chat->dest_id = chat->dest_team_id = chat->src_id = 0;
std::string killer = m_conns.at(key)->player->GetUsername();
std::string killer = m_conns.at(conn->player->Killer)->player->GetUsername();
std::string mess = getDeathMessage(conn->player->GetUsername(), killer);
strcpy(chat->mess, 140, mess.c_str());
Log(mess, false, false);
chatlog.emplace_back(chat);
++deadplayers;
conn->m_nsync == false;
conn->m_nsync = false;
}
else {
for (auto& chmo : conn->ChunkDiffs)
@@ -342,12 +340,6 @@ void Server::Run() {
delete chmo;
}
//for (auto& bull : outbox_bullets)
//delete bull;
//for (auto& bull : netbull)
//delete bull;
outbox_bullets.clear();
netbull.clear();
chunkdiffs.clear();
@@ -358,7 +350,7 @@ void Server::Run() {
end.src_id = 0;
char endmess[] = "Game over, mothereffers.";
strcpy(end.mess, endmess);
strcpy(end.mess, 140, endmess);
for (auto& [key, conn] : m_conns)
sendPackTo<Chat>(m_sock_udp, &end, &m_buf, conn->getAddr());
@@ -451,6 +443,7 @@ std::string Server::getDeathMessage(std::string username, std::string killer) co
mess.append(killer);
mess.append(temp.substr(indk + 1));
}
else mess.append(temp.substr(ind + 1));
}
else {
mess.append(temp.substr(0, indk));