This commit is contained in:
MarcEricMartel 2023-12-16 14:41:01 -05:00
parent 1c2a691638
commit 63d1f997ca
2 changed files with 9 additions and 5 deletions

View File

@ -35,7 +35,7 @@
#define TIME_DAMAGE_BOOST 10 //secondes
#define TIME_INVINCIBLE_BOOST 4 //secondes
#define STRENGTH_SPEED_BOOST 10 //Pourcentage
#define BULLET_TIME .2
#define BULLET_TIME .2 //secondes
#define SYNC_ACC 200 // ms
#define CMOD_ACC 1500 // ms

View File

@ -281,11 +281,11 @@ void Server::Run() {
/* Process */
if (conn->m_nsync) {
if (conn->player->m_hit) {
/*if (conn->player->m_hit) {
std::string str = conn->player->GetUsername();
str = str.append(" has been hit: ").append(std::to_string(conn->player->GetHP()));
Log(str, false, false);
}
}*/
Timestamp tstamp = conn->Run(m_world);
@ -367,7 +367,7 @@ void Server::Run() {
endtime += .001;
}
}
for (auto& bull : netbull) {
for (auto& [key, conn] : m_conns)
if (bull->id != conn->GetHash(false)) // Pour pas repitcher au joueur sa propre balle.
@ -375,6 +375,9 @@ void Server::Run() {
delete bull;
}
netbull.clear();
if (!bullets.empty())
std::cout << "Bullets: " << bullets.size() << std::endl;
for (auto bull = bullets.begin(); bull != bullets.end(); ++bull) {
ChunkMod* cmod = nullptr;
@ -386,12 +389,13 @@ void Server::Run() {
delete bullet;
}
}
for (auto& bull: bullit)
bullets.erase(bull);
bullit.clear();
for (auto& chat : chatlog) {
Log(chat->mess, false, false);
Log(chat->mess, false, false);
for (auto& [key, conn] : m_conns)
sendPackTo<Chat>(m_sock_udp, chat, &m_buf, conn->getAddr());
delete chat;