Make refinery unblock cell customisable

This commit is contained in:
reaperrr
2015-07-12 18:32:58 +02:00
parent 62e05cf618
commit 61c0b5d59b
2 changed files with 6 additions and 2 deletions

View File

@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Activities
// Only do this if UnblockRefinery did nothing. // Only do this if UnblockRefinery did nothing.
if (self.Location == cachedPosition) if (self.Location == cachedPosition)
{ {
var unblockCell = harv.LastHarvestedCell ?? (self.Location + new CVec(0, 4)); var unblockCell = harv.LastHarvestedCell ?? (self.Location + harvInfo.UnblockCell);
var moveTo = mobile.NearestMoveableCell(unblockCell, 2, 5); var moveTo = mobile.NearestMoveableCell(unblockCell, 2, 5);
self.QueueActivity(mobile.MoveTo(moveTo, 1)); self.QueueActivity(mobile.MoveTo(moveTo, 1));
self.SetTargetLine(Target.FromCell(self.World, moveTo), Color.Gray, false); self.SetTargetLine(Target.FromCell(self.World, moveTo), Color.Gray, false);

View File

@@ -26,6 +26,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("How long (in ticks) to wait until (re-)checking for a nearby available DeliveryBuilding if not yet linked to one.")] [Desc("How long (in ticks) to wait until (re-)checking for a nearby available DeliveryBuilding if not yet linked to one.")]
public readonly int SearchForDeliveryBuildingDelay = 125; public readonly int SearchForDeliveryBuildingDelay = 125;
[Desc("Cell to move to when automatically unblocking DeliveryBuilding.")]
public readonly CVec UnblockCell = new CVec(0, 4);
[Desc("How much resources it can carry.")] [Desc("How much resources it can carry.")]
public readonly int Capacity = 28; public readonly int Capacity = 28;
@@ -196,7 +199,8 @@ namespace OpenRA.Mods.Common.Traits
if (self.Location == deliveryLoc) if (self.Location == deliveryLoc)
{ {
// Get out of the way: // Get out of the way:
var moveTo = LastHarvestedCell ?? (deliveryLoc + new CVec(0, 4)); var unblockCell = LastHarvestedCell ?? (deliveryLoc + info.UnblockCell);
var moveTo = mobile.NearestMoveableCell(unblockCell, 1, 5);
self.QueueActivity(mobile.MoveTo(moveTo, 1)); self.QueueActivity(mobile.MoveTo(moveTo, 1));
self.SetTargetLine(Target.FromCell(self.World, moveTo), Color.Gray, false); self.SetTargetLine(Target.FromCell(self.World, moveTo), Color.Gray, false);