diff --git a/MCGalaxy/Bots/BotsFile.cs b/MCGalaxy/Bots/BotsFile.cs index a5f4438e7..0aa942b2e 100644 --- a/MCGalaxy/Bots/BotsFile.cs +++ b/MCGalaxy/Bots/BotsFile.cs @@ -98,6 +98,7 @@ namespace MCGalaxy.Bots { public bool Kill { get; set; } public bool Hunt { get; set; } public int CurInstruction { get; set; } + public sbyte CurJump { get; set; } public int X { get; set; } public int Y { get; set; } @@ -113,7 +114,7 @@ namespace MCGalaxy.Bots { Model = bot.Model; Color = bot.color; Kill = bot.kill; Hunt = bot.hunt; DisplayName = bot.DisplayName; - CurInstruction = bot.cur; + CurInstruction = bot.cur; CurJump = bot.curJump; ClickedOnText = bot.ClickedOnText; X = bot.Pos.X; Y = bot.Pos.Y; Z = bot.Pos.Z; @@ -132,7 +133,7 @@ namespace MCGalaxy.Bots { bot.AIName = AI; bot.hunt = Hunt; bot.kill = Kill; bot.DisplayName = DisplayName; - bot.cur = CurInstruction; + bot.cur = CurInstruction; bot.curJump = CurJump; bot.ClickedOnText = ClickedOnText; } @@ -143,7 +144,7 @@ namespace MCGalaxy.Bots { copy.Model = Model; copy.Color = Color; copy.AI = AI; copy.Kill = Kill; copy.Hunt = Hunt; - copy.CurInstruction = CurInstruction; + copy.CurInstruction = CurInstruction; copy.CurJump = CurJump; copy.ClickedOnText = ClickedOnText; copy.X = X; copy.Y = Y; copy.Z = Z; diff --git a/MCGalaxy/Bots/BotsScheduler.cs b/MCGalaxy/Bots/BotsScheduler.cs index dcfa9486c..cbde5b303 100644 --- a/MCGalaxy/Bots/BotsScheduler.cs +++ b/MCGalaxy/Bots/BotsScheduler.cs @@ -66,7 +66,7 @@ namespace MCGalaxy { } } - if (bot.jumping) DoJump(bot); + if (bot.curJump > 0) DoJump(bot); } static bool DoInstruction(PlayerBot bot) { @@ -75,16 +75,16 @@ namespace MCGalaxy { return ins.Execute(bot, bot.Instructions[bot.cur]); } - static void DoJump(PlayerBot bot) { - bot.currentjump++; + static void DoJump(PlayerBot bot) { Position pos = bot.Pos; - switch (bot.currentjump) { - case 1: pos.Y += 24; break; - case 2: pos.Y += 12; break; - case 3: break; - case 4: pos.Y -= 12; break; - case 5: pos.Y -= 24; bot.jumping = false; bot.currentjump = 0; break; + switch (bot.curJump) { + case 1: pos.Y += 24; break; + case 2: pos.Y += 12; break; + case 3: break; + case 4: pos.Y -= 12; break; + case 5: pos.Y -= 24; bot.curJump = -1; break; } + bot.curJump++; bot.Pos = pos; } } diff --git a/MCGalaxy/Bots/Instructions/MoveInstructions.cs b/MCGalaxy/Bots/Instructions/MoveInstructions.cs index 74661dcfd..20981def4 100644 --- a/MCGalaxy/Bots/Instructions/MoveInstructions.cs +++ b/MCGalaxy/Bots/Instructions/MoveInstructions.cs @@ -94,7 +94,7 @@ namespace MCGalaxy.Bots { public JumpInstruction() { Name = "jump"; } public override bool Execute(PlayerBot bot, InstructionData data) { - bot.jumping = true; + if (bot.curJump <= 0) bot.curJump = 1; bot.NextInstruction(); return false; } diff --git a/MCGalaxy/Bots/PlayerBot.cs b/MCGalaxy/Bots/PlayerBot.cs index 17e1f4894..3c908c968 100644 --- a/MCGalaxy/Bots/PlayerBot.cs +++ b/MCGalaxy/Bots/PlayerBot.cs @@ -43,8 +43,7 @@ namespace MCGalaxy { public Position TargetPos; public bool movement = false; public int movementSpeed = 3; - internal bool jumping = false; - internal int currentjump = 0; + internal sbyte curJump = 0; public PlayerBot(string n, Level lvl) { Init(n, lvl); } @@ -78,7 +77,7 @@ namespace MCGalaxy { public static void Remove(PlayerBot bot, bool save = true) { bot.level.Bots.Remove(bot); bot.GlobalDespawn(); - bot.jumping = false; + bot.curJump = 0; if (save) BotsFile.Save(bot.level); }