Make Cargo and Carryall conditional.

This commit is contained in:
Matthias Mailänder
2023-07-25 21:43:23 +02:00
committed by Gustas
parent a14cc8cc4d
commit 98896f9a75
7 changed files with 47 additions and 27 deletions

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Activities
protected override void OnFirstRun(Actor self)
{
// The cargo might have become invalid while we were moving towards it.
if (cargo.IsDead || carryable.IsTraitDisabled || !cargo.AppearsFriendlyTo(self))
if (cargo.IsDead || carryable.IsTraitDisabled || carryall.IsTraitDisabled || !cargo.AppearsFriendlyTo(self))
return;
if (carryall.ReserveCarryable(self, cargo))
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Activities
if (IsCanceling)
return true;
if (cargo.IsDead || carryable.IsTraitDisabled || !cargo.AppearsFriendlyTo(self) || cargo != carryall.Carryable)
if (cargo.IsDead || carryable.IsTraitDisabled || carryall.IsTraitDisabled || !cargo.AppearsFriendlyTo(self) || cargo != carryall.Carryable)
{
Cancel(self, true);
return false;
@@ -160,7 +160,7 @@ namespace OpenRA.Mods.Common.Activities
protected override void OnFirstRun(Actor self)
{
// The cargo might have become invalid while we were moving towards it.
if (cargo == null || cargo.IsDead || carryable.IsTraitDisabled || carryall.Carryable != cargo || !cargo.AppearsFriendlyTo(self))
if (cargo == null || cargo.IsDead || carryable.IsTraitDisabled || carryall.IsTraitDisabled || carryall.Carryable != cargo || !cargo.AppearsFriendlyTo(self))
return;
self.World.AddFrameEndTask(w =>