diff --git a/Bots/Instructions/HunterInstructions.cs b/Bots/Instructions/HunterInstructions.cs index f6597bc49..eedc27db6 100644 --- a/Bots/Instructions/HunterInstructions.cs +++ b/Bots/Instructions/HunterInstructions.cs @@ -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; } diff --git a/Bots/ScriptFile.cs b/Bots/ScriptFile.cs index 18e94be36..dcd1775f9 100644 --- a/Bots/ScriptFile.cs +++ b/Bots/ScriptFile.cs @@ -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); } } }