mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 21:51:19 -04:00
Bot changes shouldn't be global (Thanks goodlyay)
This commit is contained in:
parent
a14f469daa
commit
94879791a8
@ -76,10 +76,7 @@ namespace MCGalaxy {
|
||||
bot.GlobalSpawn();
|
||||
|
||||
Player[] players = PlayerInfo.Online.Items;
|
||||
foreach (Player p in players) {
|
||||
if (p.level == bot.level)
|
||||
Player.Message(p, bot.color + bot.name + "%S, the bot, has been added.");
|
||||
}
|
||||
Chat.MessageLevel(bot.level, bot.ColoredName + " %S, the bot, has been added.");
|
||||
if (save)
|
||||
BotsFile.UpdateBot(bot);
|
||||
}
|
||||
|
@ -37,41 +37,38 @@ namespace MCGalaxy.Commands {
|
||||
if (bot == null) return;
|
||||
|
||||
if (args.Length == 1) {
|
||||
try { bot.Instructions.Clear(); } catch { }
|
||||
bot.Instructions.Clear();
|
||||
bot.kill = false;
|
||||
bot.hunt = false;
|
||||
bot.AIName = "";
|
||||
Player.Message(p, bot.ColoredName + "%S's AI was turned off.");
|
||||
Server.s.Log(bot.name + "'s AI was turned off.");
|
||||
UpdateBot(bot, "'s AI was turned off.");
|
||||
return;
|
||||
} else if (args.Length != 2) {
|
||||
Help(p); return;
|
||||
}
|
||||
|
||||
string ai = args[1].ToLower();
|
||||
|
||||
if (ai == "hunt") {
|
||||
bot.hunt = !bot.hunt;
|
||||
try { bot.Instructions.Clear(); }
|
||||
catch { }
|
||||
bot.Instructions.Clear();
|
||||
bot.AIName = "";
|
||||
if (p != null) Chat.GlobalChatLevel(p, bot.ColoredName + "%S's hunt instinct: " + bot.hunt, false);
|
||||
Server.s.Log(bot.name + "'s hunt instinct: " + bot.hunt);
|
||||
BotsFile.UpdateBot(bot);
|
||||
UpdateBot(bot, "'s hunt instinct: " + bot.hunt);
|
||||
return;
|
||||
} else if (ai == "kill") {
|
||||
if (!CheckExtraPerm(p)) { MessageNeedExtra(p, "toggle a bot's killer instinct."); return; }
|
||||
bot.kill = !bot.kill;
|
||||
if (p != null) Chat.GlobalChatLevel(p, bot.ColoredName + "%S's kill instinct: " + bot.kill, false);
|
||||
Server.s.Log(bot.name + "'s kill instinct: " + bot.kill);
|
||||
BotsFile.UpdateBot(bot);
|
||||
UpdateBot(bot, "'s kill instinct: " + bot.kill);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ScriptFile.Parse(p, bot, "bots/" + ai)) return;
|
||||
bot.AIName = ai;
|
||||
if (p != null) Chat.GlobalChatLevel(p, bot.ColoredName + "%S's AI is now set to " + ai, false);
|
||||
Server.s.Log(bot.name + "'s AI was set to " + ai);
|
||||
UpdateBot(bot, "'s AI was set to " + ai);
|
||||
}
|
||||
|
||||
static void UpdateBot(PlayerBot bot, string msg) {
|
||||
Chat.MessageLevel(bot.level, bot.ColoredName + "%S" + msg);
|
||||
Server.s.Log(bot.name + msg);
|
||||
BotsFile.UpdateBot(bot);
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ namespace MCGalaxy.Commands.CPE {
|
||||
if (isBot) {
|
||||
bot.model = model;
|
||||
Entities.UpdateModel(bot.id, model, bot.level, null);
|
||||
Chat.MessageAll("Bot {0}'s %Smodel was changed to a &c{1}", bot.ColoredName, model);
|
||||
Chat.MessageLevel(bot.level, "Bot " + bot.ColoredName + "'s %Smodel was changed to a &c" + model);
|
||||
BotsFile.UpdateBot(bot);
|
||||
} else {
|
||||
who.model = model;
|
||||
|
@ -69,7 +69,7 @@ namespace MCGalaxy.Commands.CPE {
|
||||
bot.SkinName = skin;
|
||||
bot.GlobalDespawn();
|
||||
bot.GlobalSpawn();
|
||||
Chat.MessageAll("Bot {0}'s %Sskin was changed to &c{1}", bot.ColoredName, skin);
|
||||
Chat.MessageLevel(bot.level, "Bot " + bot.ColoredName + "'s %Sskin was changed to &c" + skin);
|
||||
BotsFile.UpdateBot(bot);
|
||||
} else {
|
||||
who.skinName = skin;
|
||||
|
@ -58,8 +58,9 @@ namespace MCGalaxy.Commands {
|
||||
static void SetBotColor(Player p, PlayerBot bot, string[] args) {
|
||||
string color = args.Length == 2 ? "&1" : Colors.Parse(args[2]);
|
||||
if (color == "") { Player.Message(p, "There is no color \"" + args[2] + "\"."); return; }
|
||||
Chat.MessageAll("Bot {0}'s %Scolor was changed to {1}{2}", bot.DisplayName, color, Colors.Name(color));
|
||||
|
||||
Chat.MessageLevel(bot.level, "Bot " + bot.ColoredName + "'s %Scolor was set to "
|
||||
+ color + Colors.Name(color));
|
||||
|
||||
bot.color = color;
|
||||
bot.GlobalDespawn();
|
||||
bot.GlobalSpawn();
|
||||
|
@ -60,11 +60,11 @@ namespace MCGalaxy.Commands {
|
||||
string newName = args.Length > 2 ? args[2] : "";
|
||||
if (newName == "") {
|
||||
bot.DisplayName = bot.name;
|
||||
Chat.MessageAll("Bot {0}'s %Sreverted to their original name.", bot.ColoredName);
|
||||
Chat.MessageLevel(bot.level, "Bot " + bot.ColoredName + " %Sreverted to their original name.");
|
||||
} else {
|
||||
string nameTag = newName.CaselessEq("empty") ? "" : newName;
|
||||
if (newName.Length >= 30) { Player.Message(p, "Name must be under 30 letters."); return; }
|
||||
Chat.MessageAll("Bot {0}'s %Sname was set to {1}%S.", bot.ColoredName, nameTag);
|
||||
Chat.MessageLevel(bot.level, "Bot " + bot.ColoredName + "'s %Sname was set to " + nameTag + "%S.");
|
||||
bot.DisplayName = newName;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user