Skip to content

Commit

Permalink
ignore pings, the polute the chat and are unreadable without context
Browse files Browse the repository at this point in the history
  • Loading branch information
Green-Sky committed Jan 9, 2025
1 parent b62ab60 commit f69923c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/factorio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ bool Factorio::onEvent(const FactorioLog::Events::Leave& e) {
bool Factorio::onEvent(const FactorioLog::Events::Chat& e) {
std::cout << "Factorio: event chat " << e.player_name << ": " << e.message << "\n";

// ignore pings
constexpr std::string_view ping_prefix{"[gps="};
if (e.message.size() > ping_prefix.size() && e.message.substr(0, ping_prefix.size()) == ping_prefix) {
return false;
}

std::string message{"<"};
message += e.player_name;
message += ">: ";
Expand Down

0 comments on commit f69923c

Please sign in to comment.