Cleanup /help botai, add /botai info.

This commit is contained in:
UnknownShadow200 2016-05-04 10:37:58 +10:00
parent 10dea0a6be
commit 9c0a08f084
2 changed files with 25 additions and 8 deletions

View File

@ -35,7 +35,6 @@ namespace MCGalaxy.Commands
if (who == null) { Player.SendMessage(p, "There is no bot " + message + "!"); return; }
if (p.level != who.level) { Player.SendMessage(p, who.name + " is in a different level."); return; }
who.SetPos(p.pos[0], p.pos[1], p.pos[2], p.rot[0], 0);
//who.SendMessage("You were summoned by " + p.color + p.name + "&e.");
}
public override void Help(Player p)
{

View File

@ -47,6 +47,9 @@ namespace MCGalaxy.Commands
case "del":
HandleDelete(p, ai, args);
break;
case "info":
HandleInfo(p, ai);
break;
default:
Help(p);
return;
@ -77,7 +80,7 @@ namespace MCGalaxy.Commands
}
File.WriteAllLines("bots/" + ai, outLines);
Player.SendMessage(p, "Deleted the last waypoint from " + ai);
Player.SendMessage(p, "Deleted the last instruction from " + ai);
return;
} else {
Help(p); return;
@ -156,13 +159,28 @@ namespace MCGalaxy.Commands
catch { Player.SendMessage(p, "Invalid parameter"); }
}
void HandleInfo(Player p, string ai) {
if (!File.Exists("bots/" + ai)) {
Player.SendMessage(p, "There is no bot AI with that name."); return;
}
string[] lines = File.ReadAllLines("bots/" + ai);
foreach (string l in lines) {
if (l.Length == 0 || l[0] == '#') continue;
Player.SendMessage(p, l);
}
}
public override void Help(Player p) {
Player.SendMessage(p, "/botai <add/del> [AI name] <extra> - Adds or deletes [AI name]");
Player.SendMessage(p, "Extras: walk, teleport, wait, nod, speed, spin, reset, remove, reverse, linkscript, jump");
Player.SendMessage(p, "wait, nod and spin can have an extra '0.1 seconds' parameter");
Player.SendMessage(p, "nod and spin can also take a 'third' speed parameter");
Player.SendMessage(p, "speed sets a percentage of normal speed");
Player.SendMessage(p, "linkscript takes a script name as parameter");
Player.SendMessage(p, "%T/botai del [name] %H- deletes that AI");
Player.SendMessage(p, "%T/botai del [name] last%H- deletes last instruction of that AI");
Player.SendMessage(p, "%T/botai info [name] %H- prints list of instructions that AI has");
Player.SendMessage(p, "%T/botai add [name] [instruction] <args>");
Player.SendMessage(p, "%HInstructions: %Swalk, teleport, wait, nod, speed, " +
"spin, reset, remove, reverse, linkscript, jump");
Player.SendMessage(p, "%Hwait, nod, spin %S- optional arg specifies '0.1 seconds'");
Player.SendMessage(p, "%Hnod, spin %S- optional second arg specifies 'speed'");
Player.SendMessage(p, "%Hspeed %S- arg specifies percentage of normal speed");
Player.SendMessage(p, "%Hlinkscript %S- arg specifies another AI name");
}
}
}