From 66cf912da0128e49b09dc7757469f0fb6d5eaa5f Mon Sep 17 00:00:00 2001 From: michaeldgg2 <119738087+michaeldgg2@users.noreply.github.com> Date: Tue, 18 Jul 2023 20:48:14 +0200 Subject: [PATCH] LayMines: fixed occasional incorrect mine position when using BeginMinefield order When laying mine with PreLayDelay > 0, end activity's tick immediately. That means don't try to immediately move to next cell. This change unifies the behavior with scenario when a mine is laid without any PreLayDelay. --- OpenRA.Mods.Common/Activities/LayMines.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Activities/LayMines.cs b/OpenRA.Mods.Common/Activities/LayMines.cs index 2c93d90e55..76e65efb19 100644 --- a/OpenRA.Mods.Common/Activities/LayMines.cs +++ b/OpenRA.Mods.Common/Activities/LayMines.cs @@ -76,10 +76,10 @@ namespace OpenRA.Mods.Common.Activities if (LayMine(self)) { if (minelayer.Info.AfterLayingDelay > 0) - { QueueChild(new Wait(minelayer.Info.AfterLayingDelay)); - return false; - } + + // The tick has to end now, because otherwise a next cell is picked and Move activity is queued (which will change minelayer's location in current tick). + return false; } } @@ -201,6 +201,9 @@ namespace OpenRA.Mods.Common.Activities self.World.AddFrameEndTask(w => { + if (!CanLayMine(self, self.Location)) + return; + var mine = w.CreateActor(minelayer.Info.Mine, new TypeDictionary { new LocationInit(self.Location),