Skip to content

Commit

Permalink
Make orientation caching in HitShape readonly
Browse files Browse the repository at this point in the history
HitShape Requires<BodyOrientation> anyway.
  • Loading branch information
reaperrr authored and pchote committed Jul 2, 2021
1 parent 6d55161 commit feba9f2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions OpenRA.Mods.Common/Traits/HitShape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,18 @@ static object LoadShape(MiniYaml yaml)

public class HitShape : ConditionalTrait<HitShapeInfo>, ITargetablePositions
{
BodyOrientation orientation;
readonly BodyOrientation orientation;
ITargetableCells targetableCells;
Turreted turret;

public HitShape(Actor self, HitShapeInfo info)
: base(info) { }
: base(info)
{
orientation = self.Trait<BodyOrientation>();
}

protected override void Created(Actor self)
{
orientation = self.Trait<BodyOrientation>();
targetableCells = self.TraitOrDefault<ITargetableCells>();
turret = self.TraitsImplementing<Turreted>().FirstOrDefault(t => t.Name == Info.Turret);

Expand Down

0 comments on commit feba9f2

Please sign in to comment.