Fix hunt bot ai from last commits, fix it so you can't use kill ai in /botai if you can't use it in /botset.

This commit is contained in:
UnknownShadow200 2016-09-10 10:42:01 +10:00
parent 7180a01704
commit a14f469daa
2 changed files with 14 additions and 6 deletions

View File

@ -37,9 +37,11 @@ namespace MCGalaxy.Bots {
if (p.level != bot.level || p.invincible) continue;
int dx = p.pos[0] - bot.pos[0], dy = p.pos[1] - bot.pos[1], dz = p.pos[2] - bot.pos[2];
int curDist = Math.Abs(dx) + Math.Abs(dy) + Math.Abs(dz);
if (curDist >= dist) continue;
int playerDist = Math.Abs(dx) + Math.Abs(dy) + Math.Abs(dz);
if (playerDist >= dist) continue;
closest = p;
dist = playerDist;
}
if (closest == null) { bot.NextInstruction(); return false; }

View File

@ -14,7 +14,7 @@
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
*/
using System;
using System.IO;
@ -55,10 +55,16 @@ namespace MCGalaxy.Bots {
BotInstruction ins = BotInstruction.Find(action);
if (ins == null) {
Player.Message(p, "Could not find instruction \"" + action + "\"");
} else {
ins.Output(p, args, w);
Player.Message(p, "Could not find instruction \"" + action + "\""); return;
}
var perms = CommandOtherPerms.Find("cmdset");
LevelPermission killPerm = (LevelPermission)perms.Permission;
if (ins.Name.CaselessEq("kill") && p.Rank < killPerm) {
Formatter.MessageNeedMinPerm(p, "toggle a bot's killer instinct.", killPerm);
return;
}
ins.Output(p, args, w);
}
}
}