Moved HarvesterDockSequence notifications to the base class

And fix a minor oversight in VoxelHarvesterDockSequence.cs
This commit is contained in:
Gustas
2022-08-11 22:34:19 +03:00
committed by abcdefg30
parent 77b06ac9f7
commit f56b0ea0d0
3 changed files with 31 additions and 38 deletions

View File

@@ -29,12 +29,6 @@ namespace OpenRA.Mods.Common.Activities
public override void OnStateDock(Actor self)
{
foreach (var nd in self.TraitsImplementing<INotifyDockClient>())
nd.Docked(self, Refinery);
foreach (var nd in Refinery.TraitsImplementing<INotifyDockHost>())
nd.Docked(Refinery, self);
if (wda != null)
wsb.PlayCustomAnimation(self, wda.DockSequence, () => wsb.PlayCustomAnimationRepeating(self, wda.DockLoopSequence));
@@ -54,20 +48,9 @@ namespace OpenRA.Mods.Common.Activities
dockingState = DockingState.Wait;
if (wda == null)
NotifyUndock(self);
dockingState = DockingState.Complete;
else
wsb.PlayCustomAnimationBackwards(self, wda.DockSequence, () => NotifyUndock(self));
}
void NotifyUndock(Actor self)
{
dockingState = DockingState.Complete;
foreach (var nd in self.TraitsImplementing<INotifyDockClient>())
nd.Undocked(self, Refinery);
if (Refinery.IsInWorld && !Refinery.IsDead)
foreach (var nd in Refinery.TraitsImplementing<INotifyDockHost>())
nd.Undocked(Refinery, self);
wsb.PlayCustomAnimationBackwards(self, wda.DockSequence, () => dockingState = DockingState.Complete);
}
}
}