Skip to content

Commit

Permalink
Process triggered events each pulse
Browse files Browse the repository at this point in the history
  • Loading branch information
Lpsd committed Nov 27, 2023
1 parent 72aeb95 commit 3150666
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
8 changes: 1 addition & 7 deletions Server/mods/deathmatch/logic/CGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,7 @@ void CGame::DoPulse()
// Process our resource stop/restart queue
CLOCK_CALL1(m_pResourceManager->ProcessQueue(););

if (GetTickCount64_() + m_iClientTriggeredEventsIntervalMs > m_lClientTriggeredEventsLastCheck)
ProcessClientTriggeredEventSpam();
ProcessClientTriggeredEventSpam();

// Delete all items requested
CLOCK_CALL1(m_ElementDeleter.DoDeleteAll(););
Expand Down Expand Up @@ -4731,10 +4730,7 @@ void CGame::ProcessClientTriggeredEventSpam()
if (GetTickCount64_() - pair.second >= m_iClientTriggeredEventsIntervalMs)
{
if (pair.first > m_iMaxClientTriggeredEventsPerInterval)
{
player->CallEvent("onPlayerTriggerEventThreshold", {});
m_mapClientTriggeredEvents.erase(player);
}

m_mapClientTriggeredEvents.erase(player);
}
Expand All @@ -4744,6 +4740,4 @@ void CGame::ProcessClientTriggeredEventSpam()
m_mapClientTriggeredEvents.erase(player);
}
}

m_lClientTriggeredEventsLastCheck = GetTickCount64_();
}
1 change: 0 additions & 1 deletion Server/mods/deathmatch/logic/CGame.h
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,6 @@ class CGame

int m_iMaxClientTriggeredEventsPerInterval = 100;
int m_iClientTriggeredEventsIntervalMs = 1000;
long long m_lClientTriggeredEventsLastCheck = 0;

std::map<CPlayer*, std::pair<int, int>> m_mapClientTriggeredEvents;
};

0 comments on commit 3150666

Please sign in to comment.