Add INotifyClientMoving interface

This commit is contained in:
Gustas
2023-01-24 19:33:42 +02:00
committed by Matthias Mailänder
parent d0974cfdd2
commit 82458b5f7e
6 changed files with 45 additions and 36 deletions

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Activities
readonly BodyOrientation body;
readonly IMove move;
readonly CPos targetCell;
readonly INotifyHarvesterAction[] notifyHarvesterActions;
readonly INotifyHarvestAction[] notifyHarvestActions;
public HarvestResource(Actor self, CPos targetCell)
{
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Activities
claimLayer = self.World.WorldActor.Trait<ResourceClaimLayer>();
resourceLayer = self.World.WorldActor.Trait<IResourceLayer>();
this.targetCell = targetCell;
notifyHarvesterActions = self.TraitsImplementing<INotifyHarvesterAction>().ToArray();
notifyHarvestActions = self.TraitsImplementing<INotifyHarvestAction>().ToArray();
}
protected override void OnFirstRun(Actor self)
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Activities
// Move towards the target cell
if (self.Location != targetCell)
{
foreach (var n in notifyHarvesterActions)
foreach (var n in notifyHarvestActions)
n.MovingToResources(self, targetCell);
QueueChild(move.MoveTo(targetCell, 0));
@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Activities
harv.AcceptResource(self, resource.Type);
foreach (var t in notifyHarvesterActions)
foreach (var t in notifyHarvestActions)
t.Harvested(self, resource.Type);
QueueChild(new Wait(harvInfo.BaleLoadDelay));
@@ -103,7 +103,7 @@ namespace OpenRA.Mods.Common.Activities
public override void Cancel(Actor self, bool keepQueue = false)
{
foreach (var n in notifyHarvesterActions)
foreach (var n in notifyHarvestActions)
n.MovementCancelled(self);
base.Cancel(self, keepQueue);