From c36609cc9f500a876f1f0c030fe427f63fafa8e7 Mon Sep 17 00:00:00 2001 From: Gustas <37534529+PunkPun@users.noreply.github.com> Date: Sun, 21 May 2023 15:03:30 +0300 Subject: [PATCH] Don't call DetachCarryable every tick --- OpenRA.Mods.Common/Traits/Carryall.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Carryall.cs b/OpenRA.Mods.Common/Traits/Carryall.cs index a81681c37c..653c0350d9 100644 --- a/OpenRA.Mods.Common/Traits/Carryall.cs +++ b/OpenRA.Mods.Common/Traits/Carryall.cs @@ -142,13 +142,13 @@ namespace OpenRA.Mods.Common.Traits void ITick.Tick(Actor self) { - // Cargo may be killed in the same tick as, but after they are attached - if (Carryable != null && Carryable.IsDead) + // Cargo may be killed in the same tick as, but after they are attached. + if (State == CarryallState.Carrying && (Carryable == null || Carryable.IsDead)) DetachCarryable(self); // HACK: We don't have an efficient way to know when the preview // bounds change, so assume that we need to update the screen map - // (only) when the facing changes + // (only) when the facing changes. if (facing.Facing != cachedFacing && carryablePreview != null) { self.World.ScreenMap.AddOrUpdate(self);