mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-05 06:50:04 +00:00
Make monitor parameters configurable
This commit is contained in:
parent
15b63f3cbd
commit
c8b011913a
@ -65,3 +65,10 @@ eventcratechance=10
|
|||||||
spawnx=632032
|
spawnx=632032
|
||||||
spawny=187177
|
spawny=187177
|
||||||
spawnz=-5500
|
spawnz=-5500
|
||||||
|
|
||||||
|
# Player location monitor interface configuration
|
||||||
|
[monitor]
|
||||||
|
# the port to listen for connections on
|
||||||
|
port=8003
|
||||||
|
# how often the listeners should be updated (in milliseconds)
|
||||||
|
interval=5000
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "PlayerManager.hpp"
|
#include "PlayerManager.hpp"
|
||||||
#include "CNStructs.hpp"
|
#include "CNStructs.hpp"
|
||||||
#include "Monitor.hpp"
|
#include "Monitor.hpp"
|
||||||
|
#include "settings.hpp"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ void Monitor::init() {
|
|||||||
|
|
||||||
address.sin_family = AF_INET;
|
address.sin_family = AF_INET;
|
||||||
address.sin_addr.s_addr = INADDR_ANY;
|
address.sin_addr.s_addr = INADDR_ANY;
|
||||||
address.sin_port = htons(8003);
|
address.sin_port = htons(settings::MONITORPORT);
|
||||||
|
|
||||||
if (bind(listener, (struct sockaddr*)&address, sizeof(address)) < 0) {
|
if (bind(listener, (struct sockaddr*)&address, sizeof(address)) < 0) {
|
||||||
perror("bind");
|
perror("bind");
|
||||||
@ -38,9 +39,9 @@ void Monitor::init() {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "[INFO] Monitor listening on *:8003" << std::endl;
|
std::cout << "[INFO] Monitor listening on *:" << settings::MONITORPORT << std::endl;
|
||||||
|
|
||||||
REGISTER_SHARD_TIMER(tick, 5000);
|
REGISTER_SHARD_TIMER(tick, settings::MONITORINTERVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool transmit(std::list<int>::iterator& it, char *buff, int len) {
|
static bool transmit(std::list<int>::iterator& it, char *buff, int len) {
|
||||||
|
@ -30,6 +30,10 @@ std::string settings::GRUNTWORKJSON = "tdata/gruntwork.json";
|
|||||||
std::string settings::MOTDSTRING = "Welcome to OpenFusion!";
|
std::string settings::MOTDSTRING = "Welcome to OpenFusion!";
|
||||||
int settings::ACCLEVEL = 1;
|
int settings::ACCLEVEL = 1;
|
||||||
|
|
||||||
|
// monitor settings
|
||||||
|
int settings::MONITORPORT = 8003;
|
||||||
|
int settings::MONITORINTERVAL = 5000;
|
||||||
|
|
||||||
// event mode settings
|
// event mode settings
|
||||||
int settings::EVENTMODE = 0;
|
int settings::EVENTMODE = 0;
|
||||||
int settings::EVENTCRATECHANCE = 10;
|
int settings::EVENTCRATECHANCE = 10;
|
||||||
@ -70,4 +74,6 @@ void settings::init() {
|
|||||||
ACCLEVEL = reader.GetInteger("shard", "accountlevel", ACCLEVEL);
|
ACCLEVEL = reader.GetInteger("shard", "accountlevel", ACCLEVEL);
|
||||||
EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE);
|
EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE);
|
||||||
EVENTCRATECHANCE = reader.GetInteger("shard", "eventcratechance", EVENTCRATECHANCE);
|
EVENTCRATECHANCE = reader.GetInteger("shard", "eventcratechance", EVENTCRATECHANCE);
|
||||||
|
MONITORPORT = reader.GetInteger("monitor", "port", MONITORPORT);
|
||||||
|
MONITORINTERVAL = reader.GetInteger("monitor", "interval", MONITORINTERVAL);
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@ namespace settings {
|
|||||||
extern std::string GRUNTWORKJSON;
|
extern std::string GRUNTWORKJSON;
|
||||||
extern int EVENTMODE;
|
extern int EVENTMODE;
|
||||||
extern int EVENTCRATECHANCE;
|
extern int EVENTCRATECHANCE;
|
||||||
|
extern int MONITORPORT;
|
||||||
|
extern int MONITORINTERVAL;
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user