mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 04:32:50 -04:00
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:
parent
7180a01704
commit
a14f469daa
@ -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; }
|
||||
|
@ -55,11 +55,17 @@ namespace MCGalaxy.Bots {
|
||||
|
||||
BotInstruction ins = BotInstruction.Find(action);
|
||||
if (ins == null) {
|
||||
Player.Message(p, "Could not find instruction \"" + action + "\"");
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user