Make phase transport uncloak on loading cargo

This commit is contained in:
Gustas
2023-07-10 15:18:13 +03:00
committed by Matthias Mailänder
parent 7f37454666
commit 659ec5e335
6 changed files with 43 additions and 20 deletions

View File

@@ -64,6 +64,9 @@ namespace OpenRA.Mods.Common.Activities
if (!enterCargo.CanLoad(self))
return;
foreach (var inl in targetActor.TraitsImplementing<INotifyLoadCargo>())
inl.Loading(self);
enterCargo.Load(enterActor, self);
w.Remove(self);
});

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Activities
{
readonly Actor self;
readonly Cargo cargo;
readonly INotifyUnload[] notifiers;
readonly INotifyUnloadCargo[] notifiers;
readonly bool unloadAll;
readonly Aircraft aircraft;
readonly Mobile mobile;
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Activities
{
this.self = self;
cargo = self.Trait<Cargo>();
notifiers = self.TraitsImplementing<INotifyUnload>().ToArray();
notifiers = self.TraitsImplementing<INotifyUnloadCargo>().ToArray();
this.unloadAll = unloadAll;
aircraft = self.TraitOrDefault<Aircraft>();
mobile = self.TraitOrDefault<Mobile>();

View File

@@ -25,14 +25,15 @@ namespace OpenRA.Mods.Common.Traits
None = 0,
Attack = 1,
Move = 2,
Unload = 4,
Infiltrate = 8,
Demolish = 16,
Damage = 32,
Heal = 64,
SelfHeal = 128,
Dock = 256,
SupportPower = 512,
Load = 4,
Unload = 8,
Infiltrate = 16,
Demolish = 32,
Damage = 64,
Heal = 128,
SelfHeal = 256,
Dock = 512,
SupportPower = 1024,
}
// Type tag for DetectionTypes
@@ -93,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits
public override object Create(ActorInitializer init) { return new Cloak(this); }
}
public class Cloak : PausableConditionalTrait<CloakInfo>, IRenderModifier, INotifyDamage, INotifyUnload, INotifyDemolition, INotifyInfiltration,
public class Cloak : PausableConditionalTrait<CloakInfo>, IRenderModifier, INotifyDamage, INotifyUnloadCargo, INotifyLoadCargo, INotifyDemolition, INotifyInfiltration,
INotifyAttack, ITick, IVisibilityModifier, IRadarColorModifier, INotifyCreated, INotifyDockClient, INotifySupportPower
{
[Sync]
@@ -287,7 +288,13 @@ namespace OpenRA.Mods.Common.Traits
isDocking = false;
}
void INotifyUnload.Unloading(Actor self)
void INotifyLoadCargo.Loading(Actor self)
{
if (Info.UncloakOn.HasFlag(UncloakType.Load))
Uncloak();
}
void INotifyUnloadCargo.Unloading(Actor self)
{
if (Info.UncloakOn.HasFlag(UncloakType.Unload))
Uncloak();

View File

@@ -207,7 +207,13 @@ namespace OpenRA.Mods.Common.Traits
}
[RequireExplicitImplementation]
public interface INotifyUnload
public interface INotifyLoadCargo
{
void Loading(Actor self);
}
[RequireExplicitImplementation]
public interface INotifyUnloadCargo
{
void Unloading(Actor self);
}