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

@@ -57,10 +57,11 @@ namespace OpenRA.Mods.Cnc.Traits
None = 0,
Attack = 1,
Damaged = 2,
Unload = 4,
Infiltrate = 8,
Demolish = 16,
Move = 32
Load = 4,
Unload = 8,
Infiltrate = 16,
Demolish = 32,
Move = 64,
}
[Desc("Provides access to the disguise command, which makes the actor appear to be another player's actor.")]
@@ -99,7 +100,7 @@ namespace OpenRA.Mods.Cnc.Traits
}
sealed class Disguise : IEffectiveOwner, IIssueOrder, IResolveOrder, IOrderVoice, IRadarColorModifier, INotifyAttack,
INotifyDamage, INotifyUnload, INotifyDemolition, INotifyInfiltration, ITick
INotifyDamage, INotifyLoadCargo, INotifyUnloadCargo, INotifyDemolition, INotifyInfiltration, ITick
{
public ActorInfo AsActor { get; private set; }
public Player AsPlayer { get; private set; }
@@ -253,7 +254,13 @@ namespace OpenRA.Mods.Cnc.Traits
DisguiseAs(null);
}
void INotifyUnload.Unloading(Actor self)
void INotifyLoadCargo.Loading(Actor self)
{
if (info.RevealDisguiseOn.HasFlag(RevealDisguiseType.Load))
DisguiseAs(null);
}
void INotifyUnloadCargo.Unloading(Actor self)
{
if (info.RevealDisguiseOn.HasFlag(RevealDisguiseType.Unload))
DisguiseAs(null);

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);
}

View File

@@ -922,7 +922,7 @@ STNK:
UncloakSound: appear1.aud
IsPlayerPalette: true
PauseOnCondition: cloak-force-disabled
UncloakOn: Attack, Unload, Heal, Dock
UncloakOn: Attack, Load, Unload, Heal, Dock
GrantConditionOnDamageState@UNCLOAK:
Condition: cloak-force-disabled
ValidDamageStates: Critical