Remove Util.QuantizeFacing from trait code.

This commit is contained in:
Paul Chote
2016-01-14 21:18:56 +00:00
parent 275be64f05
commit e46fc644c1
3 changed files with 20 additions and 3 deletions

View File

@@ -21,12 +21,14 @@ namespace OpenRA.Mods.Common.Activities
readonly IFacing facing;
readonly ResourceClaimLayer territory;
readonly ResourceLayer resLayer;
readonly BodyOrientation body;
public HarvestResource(Actor self)
{
harv = self.Trait<Harvester>();
harvInfo = self.Info.TraitInfo<HarvesterInfo>();
facing = self.Trait<IFacing>();
body = self.Trait<BodyOrientation>();
territory = self.World.WorldActor.TraitOrDefault<ResourceClaimLayer>();
resLayer = self.World.WorldActor.Trait<ResourceLayer>();
}
@@ -53,7 +55,7 @@ namespace OpenRA.Mods.Common.Activities
if (harvInfo.HarvestFacings != 0)
{
var current = facing.Facing;
var desired = Util.QuantizeFacing(current, harvInfo.HarvestFacings) * (256 / harvInfo.HarvestFacings);
var desired = body.QuantizeFacing(current, harvInfo.HarvestFacings);
if (desired != current)
return Util.SequenceActivities(new Turn(self, desired), this);
}