From 5a8df27096a19a848fc46a00033a1d09a56c2a8f Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 27 Nov 2016 18:40:25 +0100 Subject: [PATCH] Make MP start units facing customizable There might be modders or mappers who prefer different initial facing settings than the hardcoded ones. --- OpenRA.Mods.Common/Traits/World/MPStartUnits.cs | 6 ++++++ OpenRA.Mods.Common/Traits/World/SpawnMPUnits.cs | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/World/MPStartUnits.cs b/OpenRA.Mods.Common/Traits/World/MPStartUnits.cs index 84762f0fd9..d93041aa08 100644 --- a/OpenRA.Mods.Common/Traits/World/MPStartUnits.cs +++ b/OpenRA.Mods.Common/Traits/World/MPStartUnits.cs @@ -37,6 +37,12 @@ namespace OpenRA.Mods.Common.Traits [Desc("Outer radius for spawning support actors")] public readonly int OuterSupportRadius = 4; + + [Desc("Initial facing of BaseActor. -1 means random.")] + public readonly int BaseActorFacing = 128; + + [Desc("Initial facing of SupportActors. -1 means random.")] + public readonly int SupportActorsFacing = -1; } public class MPStartUnits { } diff --git a/OpenRA.Mods.Common/Traits/World/SpawnMPUnits.cs b/OpenRA.Mods.Common/Traits/World/SpawnMPUnits.cs index 8d2fa93120..11bdc4ba4d 100644 --- a/OpenRA.Mods.Common/Traits/World/SpawnMPUnits.cs +++ b/OpenRA.Mods.Common/Traits/World/SpawnMPUnits.cs @@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Traits new LocationInit(sp), new OwnerInit(p), new SkipMakeAnimsInit(), - new FacingInit(128), + new FacingInit(unitGroup.BaseActorFacing < 0 ? w.SharedRandom.Next(256) : unitGroup.BaseActorFacing), }); } @@ -99,7 +99,7 @@ namespace OpenRA.Mods.Common.Traits new OwnerInit(p), new LocationInit(cell), new SubCellInit(subCell), - new FacingInit(w.SharedRandom.Next(256)) + new FacingInit(unitGroup.SupportActorsFacing < 0 ? w.SharedRandom.Next(256) : unitGroup.SupportActorsFacing) }); } }