Merge INotifyBeingResupplied into INotifyDockClient
This commit is contained in:
@@ -28,7 +28,8 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
readonly RepairableNear repairableNear;
|
readonly RepairableNear repairableNear;
|
||||||
readonly Rearmable rearmable;
|
readonly Rearmable rearmable;
|
||||||
readonly INotifyResupply[] notifyResupplies;
|
readonly INotifyResupply[] notifyResupplies;
|
||||||
readonly INotifyBeingResupplied[] notifyBeingResupplied;
|
readonly INotifyDockHost[] notifyDockHosts;
|
||||||
|
readonly INotifyDockClient[] notifyDockClients;
|
||||||
readonly ICallForTransport[] transportCallers;
|
readonly ICallForTransport[] transportCallers;
|
||||||
readonly IMove move;
|
readonly IMove move;
|
||||||
readonly Aircraft aircraft;
|
readonly Aircraft aircraft;
|
||||||
@@ -54,7 +55,8 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
repairableNear = self.TraitOrDefault<RepairableNear>();
|
repairableNear = self.TraitOrDefault<RepairableNear>();
|
||||||
rearmable = self.TraitOrDefault<Rearmable>();
|
rearmable = self.TraitOrDefault<Rearmable>();
|
||||||
notifyResupplies = host.TraitsImplementing<INotifyResupply>().ToArray();
|
notifyResupplies = host.TraitsImplementing<INotifyResupply>().ToArray();
|
||||||
notifyBeingResupplied = self.TraitsImplementing<INotifyBeingResupplied>().ToArray();
|
notifyDockHosts = host.TraitsImplementing<INotifyDockHost>().ToArray();
|
||||||
|
notifyDockClients = self.TraitsImplementing<INotifyDockClient>().ToArray();
|
||||||
transportCallers = self.TraitsImplementing<ICallForTransport>().ToArray();
|
transportCallers = self.TraitsImplementing<ICallForTransport>().ToArray();
|
||||||
move = self.Trait<IMove>();
|
move = self.Trait<IMove>();
|
||||||
aircraft = move as Aircraft;
|
aircraft = move as Aircraft;
|
||||||
@@ -150,8 +152,11 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
foreach (var notifyResupply in notifyResupplies)
|
foreach (var notifyResupply in notifyResupplies)
|
||||||
notifyResupply.BeforeResupply(host.Actor, self, activeResupplyTypes);
|
notifyResupply.BeforeResupply(host.Actor, self, activeResupplyTypes);
|
||||||
|
|
||||||
foreach (var br in notifyBeingResupplied)
|
foreach (var nd in notifyDockClients)
|
||||||
br.StartingResupply(self, host.Actor);
|
nd.Docked(self, host.Actor);
|
||||||
|
|
||||||
|
foreach (var nd in notifyDockHosts)
|
||||||
|
nd.Docked(host.Actor, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activeResupplyTypes.HasFlag(ResupplyType.Repair))
|
if (activeResupplyTypes.HasFlag(ResupplyType.Repair))
|
||||||
@@ -241,8 +246,11 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
QueueChild(move.MoveToTarget(self, host));
|
QueueChild(move.MoveToTarget(self, host));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var br in notifyBeingResupplied)
|
foreach (var nd in notifyDockClients)
|
||||||
br.StoppingResupply(self, isHostInvalid ? null : host.Actor);
|
nd.Undocked(self, host.Actor);
|
||||||
|
|
||||||
|
foreach (var nd in notifyDockHosts)
|
||||||
|
nd.Undocked(host.Actor, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RepairTick(Actor self)
|
void RepairTick(Actor self)
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class Cloak : PausableConditionalTrait<CloakInfo>, IRenderModifier, INotifyDamage, INotifyUnload, INotifyDemolition, INotifyInfiltration,
|
public class Cloak : PausableConditionalTrait<CloakInfo>, IRenderModifier, INotifyDamage, INotifyUnload, INotifyDemolition, INotifyInfiltration,
|
||||||
INotifyAttack, ITick, IVisibilityModifier, IRadarColorModifier, INotifyCreated, INotifyDockClient, INotifyBeingResupplied
|
INotifyAttack, ITick, IVisibilityModifier, IRadarColorModifier, INotifyCreated, INotifyDockClient
|
||||||
{
|
{
|
||||||
[Sync]
|
[Sync]
|
||||||
int remainingTime;
|
int remainingTime;
|
||||||
@@ -281,6 +281,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
void INotifyDockClient.Undocked(Actor self, Actor host)
|
void INotifyDockClient.Undocked(Actor self, Actor host)
|
||||||
{
|
{
|
||||||
|
if (Info.UncloakOn.HasFlag(UncloakType.Dock))
|
||||||
isDocking = false;
|
isDocking = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,20 +302,5 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (Info.UncloakOn.HasFlag(UncloakType.Infiltrate))
|
if (Info.UncloakOn.HasFlag(UncloakType.Infiltrate))
|
||||||
Uncloak();
|
Uncloak();
|
||||||
}
|
}
|
||||||
|
|
||||||
void INotifyBeingResupplied.StartingResupply(Actor self, Actor host)
|
|
||||||
{
|
|
||||||
if (Info.UncloakOn.HasFlag(UncloakType.Dock))
|
|
||||||
{
|
|
||||||
isDocking = true;
|
|
||||||
Uncloak();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void INotifyBeingResupplied.StoppingResupply(Actor self, Actor host)
|
|
||||||
{
|
|
||||||
if (Info.UncloakOn.HasFlag(UncloakType.Dock))
|
|
||||||
isDocking = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,13 +140,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
void ResupplyTick(Actor host, Actor target, ResupplyType types);
|
void ResupplyTick(Actor host, Actor target, ResupplyType types);
|
||||||
}
|
}
|
||||||
|
|
||||||
[RequireExplicitImplementation]
|
|
||||||
public interface INotifyBeingResupplied
|
|
||||||
{
|
|
||||||
void StartingResupply(Actor self, Actor host);
|
|
||||||
void StoppingResupply(Actor self, Actor host);
|
|
||||||
}
|
|
||||||
|
|
||||||
[RequireExplicitImplementation]
|
[RequireExplicitImplementation]
|
||||||
public interface INotifyTakeOff { void TakeOff(Actor self); }
|
public interface INotifyTakeOff { void TakeOff(Actor self); }
|
||||||
[RequireExplicitImplementation]
|
[RequireExplicitImplementation]
|
||||||
|
|||||||
Reference in New Issue
Block a user