From 4be593123df6fcf6d1021dbc1f0bb59d85afca3b Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 24 Dec 2017 11:04:54 +0100 Subject: [PATCH] add me (jongleur1983) to AUTHORS #14558: MovingToRefinery takes actor instead of CPos DeliveryOffset (previously added by the harvester) is now taken into account by the AutoCarryable fix whitespaces --- AUTHORS | 1 + OpenRA.Mods.Common/Activities/DeliverResources.cs | 2 +- OpenRA.Mods.Common/Traits/AutoCarryable.cs | 8 +++++++- OpenRA.Mods.Common/Traits/Cloak.cs | 2 +- OpenRA.Mods.Common/Traits/Harvester.cs | 5 +++-- OpenRA.Mods.Common/Traits/Render/WithHarvestAnimation.cs | 2 +- OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs | 2 +- OpenRA.Mods.Common/TraitsInterfaces.cs | 2 +- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/AUTHORS b/AUTHORS index 6f65659801..48c7639f5a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -109,6 +109,7 @@ Also thanks to: * Paul Dovydaitis (pdovy) * Pavlos Touboulidis (pav) * Pedro Ferreira Ramos (bateramos) + * Peter Amrehn (jongleur1983) * Pizzaoverhead * Pi Delport (pjdelport) * Psydev diff --git a/OpenRA.Mods.Common/Activities/DeliverResources.cs b/OpenRA.Mods.Common/Activities/DeliverResources.cs index 8ec4865794..cfd3a6963a 100644 --- a/OpenRA.Mods.Common/Activities/DeliverResources.cs +++ b/OpenRA.Mods.Common/Activities/DeliverResources.cs @@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Activities { var notify = self.TraitsImplementing(); foreach (var n in notify) - n.MovingToRefinery(self, proc.Location + iao.DeliveryOffset, this); + n.MovingToRefinery(self, proc, this); return ActivityUtils.SequenceActivities(movement.MoveTo(proc.Location + iao.DeliveryOffset, 0), this); } diff --git a/OpenRA.Mods.Common/Traits/AutoCarryable.cs b/OpenRA.Mods.Common/Traits/AutoCarryable.cs index a42ba9f53d..9c637e7e5c 100644 --- a/OpenRA.Mods.Common/Traits/AutoCarryable.cs +++ b/OpenRA.Mods.Common/Traits/AutoCarryable.cs @@ -39,7 +39,13 @@ namespace OpenRA.Mods.Common.Traits public WDist MinimumDistance { get { return info.MinDistance; } } void INotifyHarvesterAction.MovingToResources(Actor self, CPos targetCell, Activity next) { RequestTransport(self, targetCell, next); } - void INotifyHarvesterAction.MovingToRefinery(Actor self, CPos targetCell, Activity next) { RequestTransport(self, targetCell, next); } + + void INotifyHarvesterAction.MovingToRefinery(Actor self, Actor refineryActor, Activity next) + { + var iao = refineryActor.Trait(); + RequestTransport(self, refineryActor.Location + iao.DeliveryOffset, next); + } + void INotifyHarvesterAction.MovementCancelled(Actor self) { MovementCancelled(self); } // We do not handle Harvested notification diff --git a/OpenRA.Mods.Common/Traits/Cloak.cs b/OpenRA.Mods.Common/Traits/Cloak.cs index d86209fcdc..14a0fdec3a 100644 --- a/OpenRA.Mods.Common/Traits/Cloak.cs +++ b/OpenRA.Mods.Common/Traits/Cloak.cs @@ -201,7 +201,7 @@ namespace OpenRA.Mods.Common.Traits void INotifyHarvesterAction.MovingToResources(Actor self, CPos targetCell, Activity next) { } - void INotifyHarvesterAction.MovingToRefinery(Actor self, CPos targetCell, Activity next) { } + void INotifyHarvesterAction.MovingToRefinery(Actor self, Actor refineryActor, Activity next) { } void INotifyHarvesterAction.MovementCancelled(Actor self) { } diff --git a/OpenRA.Mods.Common/Traits/Harvester.cs b/OpenRA.Mods.Common/Traits/Harvester.cs index fce4d1daeb..9b45d4d6e2 100644 --- a/OpenRA.Mods.Common/Traits/Harvester.cs +++ b/OpenRA.Mods.Common/Traits/Harvester.cs @@ -413,8 +413,9 @@ namespace OpenRA.Mods.Common.Traits var deliver = new DeliverResources(self); self.QueueActivity(deliver); - foreach (var n in notify) - n.MovingToRefinery(self, order.Target.Actor.Location, deliver); + if (order.Target.Type == TargetType.Actor) + foreach (var n in notify) + n.MovingToRefinery(self, order.Target.Actor, deliver); } else if (order.OrderString == "Stop" || order.OrderString == "Move") { diff --git a/OpenRA.Mods.Common/Traits/Render/WithHarvestAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithHarvestAnimation.cs index 21f1f64777..0a9d2ed7df 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithHarvestAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithHarvestAnimation.cs @@ -84,7 +84,7 @@ namespace OpenRA.Mods.Common.Traits.Render } void INotifyHarvesterAction.MovingToResources(Actor self, CPos targetCell, Activity next) { } - void INotifyHarvesterAction.MovingToRefinery(Actor self, CPos targetCell, Activity next) { } + void INotifyHarvesterAction.MovingToRefinery(Actor self, Actor refineryActor, Activity next) { } void INotifyHarvesterAction.MovementCancelled(Actor self) { } } } diff --git a/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs index 8274d9de06..2baac0dbe7 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithHarvestOverlay.cs @@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits.Render } public void MovingToResources(Actor self, CPos targetCell, Activity next) { } - public void MovingToRefinery(Actor self, CPos targetCell, Activity next) { } + public void MovingToRefinery(Actor self, Actor targetRefinery, Activity next) { } public void MovementCancelled(Actor self) { } public void Docked() { } public void Undocked() { } diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index 199735b594..cb03196780 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Traits public interface INotifyHarvesterAction { void MovingToResources(Actor self, CPos targetCell, Activity next); - void MovingToRefinery(Actor self, CPos targetCell, Activity next); + void MovingToRefinery(Actor self, Actor refineryActor, Activity next); void MovementCancelled(Actor self); void Harvested(Actor self, ResourceType resource); void Docked();