public override void LoadConfig(JsonObject taskConfig, JsonObject aiConfig) { base.LoadConfig(taskConfig, aiConfig); float wanderRangeMin = 3, wanderRangeMax = 30; if (taskConfig["targetDistance"] != null) { targetDistance = taskConfig["targetDistance"].AsFloat(0.12f); } if (taskConfig["movespeed"] != null) { moveSpeed = taskConfig["movespeed"].AsFloat(0.03f); } if (taskConfig["wanderChance"] != null) { wanderChance = taskConfig["wanderChance"].AsFloat(0.015f); } if (taskConfig["wanderRangeMin"] != null) { wanderRangeMin = taskConfig["wanderRangeMin"].AsFloat(3); } if (taskConfig["wanderRangeMax"] != null) { wanderRangeMax = taskConfig["wanderRangeMax"].AsFloat(30); } wanderRangeHorizontal = NatFloat.createStrongerInvexp(wanderRangeMin, wanderRangeMax); if (taskConfig["maxHeight"] != null) { maxHeight = taskConfig["maxHeight"].AsFloat(7f); } if (taskConfig["preferredLightLevel"] != null) { preferredLightLevel = taskConfig["preferredLightLevel"].AsFloat(-99); if (preferredLightLevel < 0) { preferredLightLevel = null; } } if (taskConfig["awaitReached"] != null) { awaitReached = taskConfig["awaitReached"].AsBool(true); } }
public override void LoadConfig(JsonObject taskConfig, JsonObject aiConfig) { base.LoadConfig(taskConfig, aiConfig); SpawnPosition = new Vec3d(entity.Attributes.GetDouble("spawnX"), entity.Attributes.GetDouble("spawnY"), entity.Attributes.GetDouble("spawnZ")); float wanderRangeMin = 3, wanderRangeMax = 30; if (taskConfig["maxDistanceToSpawn"].Exists) { StayCloseToSpawn = true; MaxDistanceToSpawn = taskConfig["maxDistanceToSpawn"].AsDouble(10); TeleportWhenOutOfRange = taskConfig["teleportWhenOutOfRange"].AsBool(true); TeleportInGameHours = taskConfig["teleportInGameHours"].AsDouble(1); } if (taskConfig["targetDistance"] != null) { targetDistance = taskConfig["targetDistance"].AsFloat(0.12f); } if (taskConfig["movespeed"] != null) { moveSpeed = taskConfig["movespeed"].AsFloat(0.03f); } if (taskConfig["wanderChance"] != null) { wanderChance = taskConfig["wanderChance"].AsFloat(0.015f); } if (taskConfig["wanderRangeMin"] != null) { wanderRangeMin = taskConfig["wanderRangeMin"].AsFloat(3); } if (taskConfig["wanderRangeMax"] != null) { wanderRangeMax = taskConfig["wanderRangeMax"].AsFloat(30); } wanderRangeHorizontal = NatFloat.createStrongerInvexp(wanderRangeMin, wanderRangeMax); if (taskConfig["maxHeight"] != null) { maxHeight = taskConfig["maxHeight"].AsFloat(7f); } if (taskConfig["preferredLightLevel"] != null) { preferredLightLevel = taskConfig["preferredLightLevel"].AsFloat(-99); if (preferredLightLevel < 0) { preferredLightLevel = null; } } if (taskConfig["awaitReached"] != null) { awaitReached = taskConfig["awaitReached"].AsBool(true); } }