Fix Rearmable using the wrong interface

This commit is contained in:
Gustas
2022-08-07 12:52:32 +03:00
committed by Pavel Penev
parent 0d24f2c08b
commit 12af8506f8

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
public override object Create(ActorInitializer init) { return new Rearmable(this); }
}
public class Rearmable : INotifyCreated, INotifyResupply
public class Rearmable : INotifyCreated, INotifyDockClient
{
public readonly RearmableInfo Info;
@@ -44,17 +44,14 @@ namespace OpenRA.Mods.Common.Traits
RearmableAmmoPools = self.TraitsImplementing<AmmoPool>().Where(p => Info.AmmoPools.Contains(p.Info.Name)).ToArray();
}
void INotifyResupply.BeforeResupply(Actor self, Actor target, ResupplyType types)
void INotifyDockClient.Docked(Actor self, Actor dock)
{
if (!types.HasFlag(ResupplyType.Rearm))
return;
// Reset the ReloadDelay to avoid any issues with early cancellation
// from previous reload attempts (explicit order, host building died, etc).
foreach (var pool in RearmableAmmoPools)
pool.RemainingTicks = pool.Info.ReloadDelay;
}
void INotifyResupply.ResupplyTick(Actor self, Actor target, ResupplyType types) { }
void INotifyDockClient.Undocked(Actor self, Actor dock) { }
}
}