From feba9f2b9ff877cff4c06f43b324cc71fa0f8de9 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 30 May 2021 21:36:28 +0200 Subject: [PATCH] Make orientation caching in HitShape readonly HitShape Requires anyway. --- OpenRA.Mods.Common/Traits/HitShape.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/HitShape.cs b/OpenRA.Mods.Common/Traits/HitShape.cs index 917010c72c39..48047c45cf4c 100644 --- a/OpenRA.Mods.Common/Traits/HitShape.cs +++ b/OpenRA.Mods.Common/Traits/HitShape.cs @@ -69,16 +69,18 @@ static object LoadShape(MiniYaml yaml) public class HitShape : ConditionalTrait, ITargetablePositions { - BodyOrientation orientation; + readonly BodyOrientation orientation; ITargetableCells targetableCells; Turreted turret; public HitShape(Actor self, HitShapeInfo info) - : base(info) { } + : base(info) + { + orientation = self.Trait(); + } protected override void Created(Actor self) { - orientation = self.Trait(); targetableCells = self.TraitOrDefault(); turret = self.TraitsImplementing().FirstOrDefault(t => t.Name == Info.Turret);