Skip to content

Commit

Permalink
Fix crashing when transports are loaded via lua
Browse files Browse the repository at this point in the history
  • Loading branch information
PunkPun committed Sep 27, 2023
1 parent 686040a commit 73c0c31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion OpenRA.Mods.Common/Traits/Air/Aircraft.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,10 @@ void IActorPreviewInitModifier.ModifyActorPreviewInit(Actor self, TypeDictionary

Activity ICreationActivity.GetCreationActivity()
{
return new AssociateWithAirfieldActivity(self, creationActivityDelay, creationRallyPoint);
if (creationRallyPoint != null || creationActivityDelay > 0)
return new AssociateWithAirfieldActivity(self, creationActivityDelay, creationRallyPoint);

return null;
}

sealed class AssociateWithAirfieldActivity : Activity
Expand Down
6 changes: 5 additions & 1 deletion OpenRA.Mods.Common/Traits/Mobile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,11 @@ protected override void OnFirstRun(Actor self)

Activity ICreationActivity.GetCreationActivity()
{
return new LeaveProductionActivity(self, creationActivityDelay, creationRallypoint, returnToCellOnCreation ? new ReturnToCellActivity(self, creationActivityDelay, returnToCellOnCreationRecalculateSubCell) : null);
if (returnToCellOnCreation || creationRallypoint != null || creationActivityDelay > 0)
return new LeaveProductionActivity(self, creationActivityDelay, creationRallypoint,
returnToCellOnCreation ? new ReturnToCellActivity(self, creationActivityDelay, returnToCellOnCreationRecalculateSubCell) : null);

return null;
}

sealed class MoveOrderTargeter : IOrderTargeter
Expand Down

0 comments on commit 73c0c31

Please sign in to comment.