Allow Harvester to define the number of harvestable facings.
This commit is contained in:
@@ -146,6 +146,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
}
|
||||
|
||||
var harv = self.Trait<Harvester>();
|
||||
var harvInfo = self.Info.Traits.Get<HarvesterInfo>();
|
||||
harv.LastHarvestedCell = self.Location;
|
||||
|
||||
if (harv.IsFull)
|
||||
@@ -155,6 +156,15 @@ namespace OpenRA.Mods.RA.Activities
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
// Turn to one of the harvestable facings
|
||||
if (harvInfo.HarvestFacings != 0)
|
||||
{
|
||||
var facing = self.Trait<IFacing>().Facing;
|
||||
var desired = Util.QuantizeFacing(facing, harvInfo.HarvestFacings) * (256 / harvInfo.HarvestFacings);
|
||||
if (desired != facing)
|
||||
return Util.SequenceActivities(new Turn(desired), this);
|
||||
}
|
||||
|
||||
var resLayer = self.World.WorldActor.Trait<ResourceLayer>();
|
||||
var resource = resLayer.Harvest(self.Location);
|
||||
if (resource == null)
|
||||
@@ -169,7 +179,6 @@ namespace OpenRA.Mods.RA.Activities
|
||||
foreach (var t in self.TraitsImplementing<INotifyHarvest>())
|
||||
t.Harvested(self, resource);
|
||||
|
||||
var harvInfo = self.Info.Traits.Get<HarvesterInfo>();
|
||||
return Util.SequenceActivities(new Wait(harvInfo.LoadTicksPerBale), this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace OpenRA.Mods.RA
|
||||
public readonly int LoadTicksPerBale = 4;
|
||||
public readonly int UnloadTicksPerBale = 4;
|
||||
public readonly int PipCount = 7;
|
||||
public readonly int HarvestFacings = 0;
|
||||
public readonly string[] Resources = { };
|
||||
public readonly decimal FullyLoadedSpeed = .85m;
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user