For state bot AI instruction, reduce default search distance for players to at most 1000 blocks away (was 20000)

This commit is contained in:
UnknownShadow200 2023-10-31 22:06:19 +11:00
parent ff958802aa
commit 4560ac8527
3 changed files with 10 additions and 20 deletions

View File

@ -133,7 +133,7 @@ namespace MCGalaxy.Bots
public StareInstruction() { Name = "stare"; } public StareInstruction() { Name = "stare"; }
public override bool Execute(PlayerBot bot, InstructionData data) { public override bool Execute(PlayerBot bot, InstructionData data) {
int search = 20000; int search = 1000;
if (data.Metadata != null) search = (ushort)data.Metadata; if (data.Metadata != null) search = (ushort)data.Metadata;
Player closest = HuntInstruction.ClosestPlayer(bot, search); Player closest = HuntInstruction.ClosestPlayer(bot, search);
@ -170,7 +170,7 @@ namespace MCGalaxy.Bots
static string[] help = new string[] { static string[] help = new string[] {
"&T/BotAI add [name] stare <radius>", "&T/BotAI add [name] stare <radius>",
"&HCauses the bot to stare at the closest player in the search radius.", "&HCauses the bot to stare at the closest player in the search radius.",
"&H <radius> defaults to 20000 blocks.", "&H <radius> defaults to 1000 blocks.",
}; };
} }
} }

View File

@ -115,7 +115,7 @@ namespace MCGalaxy.Network
static string lastUrls; static string lastUrls;
public static void ReloadDefault() { internal static void ReloadDefault() {
string urls = Server.Config.HeartbeatURL; string urls = Server.Config.HeartbeatURL;
// don't reload heartbeats unless absolutely have to // don't reload heartbeats unless absolutely have to
if (urls == lastUrls) return; if (urls == lastUrls) return;

View File

@ -66,25 +66,15 @@ namespace MCGalaxy.Authentication
} }
static string lastUrls; /// <summary> Updates list of authentication services from authservices.properties </summary>
/// <summary> Reloads list of authentication services from server config </summary> internal static void UpdateList() {
public static void UpdateList() {
string urls = Server.Config.HeartbeatURL;
LoadServices();
if (urls == lastUrls) return;
lastUrls = urls;
// only update services with defaults when absolutely have to
foreach (string url in urls.SplitComma())
{
GetOrCreate(url);
}
}
static void LoadServices() {
AuthService cur = null; AuthService cur = null;
PropertiesFile.Read(Paths.AuthServicesFile, ref cur, ParseProperty, '=', true); PropertiesFile.Read(Paths.AuthServicesFile, ref cur, ParseProperty, '=', true);
// NOTE: Heartbeat.ReloadDefault will call GetOrCreate for all of the
// URLs specified in the HeartbeatURL server configuration property
// Therefore it is unnecessary to create default AuthServices here
// (e.g. for when authservices.properties is empty or is missing a URL)
} }
static void ParseProperty(string key, string value, ref AuthService cur) { static void ParseProperty(string key, string value, ref AuthService cur) {