2024-06-10 20:11:25 +02:00
|
|
|
#include "./factorio.hpp"
|
2024-06-11 10:09:55 +02:00
|
|
|
#include "factorio_log_parser.hpp"
|
2024-06-10 20:11:25 +02:00
|
|
|
|
|
|
|
#include <solanaceae/message3/components.hpp>
|
|
|
|
#include <solanaceae/contact/components.hpp>
|
|
|
|
|
2024-06-11 10:09:55 +02:00
|
|
|
Factorio::Factorio(Contact3Registry& cr, RegistryMessageModel& rmm, FactorioLogParser& flp) :
|
2024-06-10 22:27:19 +02:00
|
|
|
_cr(cr),
|
2024-06-11 10:09:55 +02:00
|
|
|
_rmm(rmm),
|
|
|
|
_flp(flp)
|
2024-06-10 22:27:19 +02:00
|
|
|
{
|
2024-06-10 20:11:25 +02:00
|
|
|
_rmm.subscribe(this, RegistryMessageModel_Event::message_construct);
|
2024-06-11 10:09:55 +02:00
|
|
|
|
|
|
|
_flp.subscribe(this, FactorioLogParser_Event::join);
|
|
|
|
_flp.subscribe(this, FactorioLogParser_Event::leave);
|
|
|
|
_flp.subscribe(this, FactorioLogParser_Event::chat);
|
|
|
|
_flp.subscribe(this, FactorioLogParser_Event::died);
|
|
|
|
_flp.subscribe(this, FactorioLogParser_Event::evolution);
|
|
|
|
_flp.subscribe(this, FactorioLogParser_Event::research_started);
|
|
|
|
_flp.subscribe(this, FactorioLogParser_Event::research_finished);
|
|
|
|
_flp.subscribe(this, FactorioLogParser_Event::research_cancelled);
|
2024-06-10 20:11:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Factorio::~Factorio(void) {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Factorio::onEvent(const Message::Events::MessageConstruct& e) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2024-06-11 10:09:55 +02:00
|
|
|
bool Factorio::onEvent(const FactorioLog::Events::Join& e) {
|
2024-06-11 12:02:53 +02:00
|
|
|
std::cout << "F: event join " << e.player_name << "\n";
|
2024-06-11 10:09:55 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Factorio::onEvent(const FactorioLog::Events::Leave& e) {
|
2024-06-11 12:02:53 +02:00
|
|
|
std::cout << "F: event leave " << e.player_name << " " << e.reason << "\n";
|
2024-06-11 10:09:55 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Factorio::onEvent(const FactorioLog::Events::Chat& e) {
|
2024-06-11 12:02:53 +02:00
|
|
|
std::cout << "F: event chat " << e.player_name << ": " << e.message << "\n";
|
2024-06-11 10:09:55 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Factorio::onEvent(const FactorioLog::Events::Died& e) {
|
2024-06-11 12:02:53 +02:00
|
|
|
std::cout << "F: event died " << e.player_name << ": " << e.reason << "\n";
|
2024-06-11 10:09:55 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Factorio::onEvent(const FactorioLog::Events::Evolution& e) {
|
2024-06-11 12:02:53 +02:00
|
|
|
std::cout << "F: event evolution " << e.evo << "\n";
|
2024-06-11 10:09:55 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Factorio::onEvent(const FactorioLog::Events::ResearchStarted& e) {
|
2024-06-11 12:02:53 +02:00
|
|
|
std::cout << "F: event research started " << e.name << "\n";
|
2024-06-11 10:09:55 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Factorio::onEvent(const FactorioLog::Events::ResearchFinished& e) {
|
2024-06-11 12:02:53 +02:00
|
|
|
std::cout << "F: event research finished " << e.name << "\n";
|
2024-06-11 10:09:55 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Factorio::onEvent(const FactorioLog::Events::ResearchCancelled& e) {
|
2024-06-11 12:02:53 +02:00
|
|
|
std::cout << "F: event research cancelled " << e.name << "\n";
|
2024-06-11 10:09:55 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|