Added a config option to disable mob movement and combat.

This will come in handy when gruntwork starts.
Also fixed a bug where the ACCLEVEL setting was read as a boolean.
This commit is contained in:
dongresource 2020-09-22 20:53:44 +02:00
parent ac1fd1e5be
commit ba5998d53a
4 changed files with 11 additions and 1 deletions

View File

@ -24,6 +24,9 @@ chunksize=40000
# time, in milliseconds, to wait before kicking a non-responsive client # time, in milliseconds, to wait before kicking a non-responsive client
# default is 1 minute # default is 1 minute
timeout=60000 timeout=60000
# should mobs move around and fight back?
# can be disabled for easier mob placement
simulatemobs=true
# little message players see when they enter the game # little message players see when they enter the game
motd=Welcome to OpenFusion! motd=Welcome to OpenFusion!
# NPC json data # NPC json data

View File

@ -216,6 +216,10 @@ void MobManager::step(time_t currTime) {
if (!ChunkManager::inPopulatedChunks(x, y)) if (!ChunkManager::inPopulatedChunks(x, y))
continue; continue;
// skip mob movement and combat if disabled
if (!settings::SIMULATEMOBS && pair.second->state != MobState::DEAD)
continue;
switch (pair.second->state) { switch (pair.second->state) {
case MobState::ROAMING: case MobState::ROAMING:
roamingStep(pair.second, currTime); roamingStep(pair.second, currTime);

View File

@ -13,6 +13,7 @@ int settings::SHARDPORT = 8002;
std::string settings::SHARDSERVERIP = "127.0.0.1"; std::string settings::SHARDSERVERIP = "127.0.0.1";
time_t settings::TIMEOUT = 60000; time_t settings::TIMEOUT = 60000;
int settings::CHUNKSIZE = 40000; int settings::CHUNKSIZE = 40000;
bool settings::SIMULATEMOBS = true;
// default spawn point is Sector V (future) // default spawn point is Sector V (future)
int settings::SPAWN_X = 632032; int settings::SPAWN_X = 632032;
@ -46,6 +47,7 @@ void settings::init() {
DBSAVEINTERVAL = reader.GetInteger("shard", "dbsaveinterval", DBSAVEINTERVAL); DBSAVEINTERVAL = reader.GetInteger("shard", "dbsaveinterval", DBSAVEINTERVAL);
TIMEOUT = reader.GetInteger("shard", "timeout", TIMEOUT); TIMEOUT = reader.GetInteger("shard", "timeout", TIMEOUT);
CHUNKSIZE = reader.GetInteger("shard", "chunksize", CHUNKSIZE); CHUNKSIZE = reader.GetInteger("shard", "chunksize", CHUNKSIZE);
SIMULATEMOBS = reader.GetBoolean("shard", "simulatemobs", SIMULATEMOBS);
SPAWN_X = reader.GetInteger("shard", "spawnx", SPAWN_X); SPAWN_X = reader.GetInteger("shard", "spawnx", SPAWN_X);
SPAWN_Y = reader.GetInteger("shard", "spawny", SPAWN_Y); SPAWN_Y = reader.GetInteger("shard", "spawny", SPAWN_Y);
SPAWN_Z = reader.GetInteger("shard", "spawnz", SPAWN_Z); SPAWN_Z = reader.GetInteger("shard", "spawnz", SPAWN_Z);
@ -55,5 +57,5 @@ void settings::init() {
MOBJSON = reader.Get("shard", "mobdata", MOBJSON); MOBJSON = reader.Get("shard", "mobdata", MOBJSON);
PATHJSON = reader.Get("shard", "pathdata", PATHJSON); PATHJSON = reader.Get("shard", "pathdata", PATHJSON);
MOTDSTRING = reader.Get("shard", "motd", MOTDSTRING); MOTDSTRING = reader.Get("shard", "motd", MOTDSTRING);
ACCLEVEL = reader.GetBoolean("shard", "accountlevel", ACCLEVEL); ACCLEVEL = reader.GetInteger("shard", "accountlevel", ACCLEVEL);
} }

View File

@ -9,6 +9,7 @@ namespace settings {
extern std::string SHARDSERVERIP; extern std::string SHARDSERVERIP;
extern time_t TIMEOUT; extern time_t TIMEOUT;
extern int CHUNKSIZE; extern int CHUNKSIZE;
extern bool SIMULATEMOBS;
extern int SPAWN_X; extern int SPAWN_X;
extern int SPAWN_Y; extern int SPAWN_Y;
extern int SPAWN_Z; extern int SPAWN_Z;