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
# default is 1 minute
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
motd=Welcome to OpenFusion!
# NPC json data

View File

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

View File

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