Some internal renamings in power-related traits
This commit is contained in:
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public class CanPowerDown : ConditionalTrait<CanPowerDownInfo>, IPowerModifier, IResolveOrder, INotifyOwnerChanged
|
||||
{
|
||||
[Sync] bool poweredDown = false;
|
||||
[Sync] bool isPoweredDown = false;
|
||||
PowerManager power;
|
||||
|
||||
ConditionManager conditionManager;
|
||||
@@ -66,9 +66,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (conditionManager == null)
|
||||
return;
|
||||
|
||||
if (poweredDown && conditionToken == ConditionManager.InvalidConditionToken)
|
||||
if (isPoweredDown && conditionToken == ConditionManager.InvalidConditionToken)
|
||||
conditionToken = conditionManager.GrantCondition(self, Info.PowerdownCondition);
|
||||
else if (!poweredDown && conditionToken != ConditionManager.InvalidConditionToken)
|
||||
else if (!isPoweredDown && conditionToken != ConditionManager.InvalidConditionToken)
|
||||
conditionToken = conditionManager.RevokeCondition(self, conditionToken);
|
||||
}
|
||||
|
||||
@@ -76,18 +76,18 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
if (!IsTraitDisabled && order.OrderString == "PowerDown")
|
||||
{
|
||||
poweredDown = !poweredDown;
|
||||
isPoweredDown = !isPoweredDown;
|
||||
|
||||
if (Info.PowerupSound != null && poweredDown)
|
||||
if (Info.PowerupSound != null && isPoweredDown)
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", Info.PowerupSound, self.Owner.Faction.InternalName);
|
||||
|
||||
if (Info.PowerdownSound != null && !poweredDown)
|
||||
if (Info.PowerdownSound != null && !isPoweredDown)
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", Info.PowerdownSound, self.Owner.Faction.InternalName);
|
||||
|
||||
if (Info.PowerupSpeech != null && poweredDown)
|
||||
if (Info.PowerupSpeech != null && isPoweredDown)
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.PowerupSpeech, self.Owner.Faction.InternalName);
|
||||
|
||||
if (Info.PowerdownSpeech != null && !poweredDown)
|
||||
if (Info.PowerdownSpeech != null && !isPoweredDown)
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.PowerdownSpeech, self.Owner.Faction.InternalName);
|
||||
|
||||
Update(self);
|
||||
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
int IPowerModifier.GetPowerModifier()
|
||||
{
|
||||
return !IsTraitDisabled && poweredDown ? 0 : 100;
|
||||
return !IsTraitDisabled && isPoweredDown ? 0 : 100;
|
||||
}
|
||||
|
||||
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
||||
@@ -107,10 +107,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
protected override void TraitDisabled(Actor self)
|
||||
{
|
||||
if (!poweredDown || !Info.CancelWhenDisabled)
|
||||
if (!isPoweredDown || !Info.CancelWhenDisabled)
|
||||
return;
|
||||
|
||||
poweredDown = false;
|
||||
isPoweredDown = false;
|
||||
|
||||
if (Info.PowerupSound != null)
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sound", Info.PowerupSound, self.Owner.Faction.InternalName);
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public int PowerOutageTotalTicks { get; private set; }
|
||||
|
||||
int nextPowerAdviceTime = 0;
|
||||
bool lowPower = false;
|
||||
bool isLowPower = false;
|
||||
bool wasLowPower = false;
|
||||
bool wasHackEnabled;
|
||||
|
||||
@@ -109,19 +109,19 @@ namespace OpenRA.Mods.Common.Traits
|
||||
wasHackEnabled = devMode.UnlimitedPower;
|
||||
}
|
||||
|
||||
lowPower = ExcessPower < 0;
|
||||
isLowPower = ExcessPower < 0;
|
||||
|
||||
if (lowPower != wasLowPower)
|
||||
UpdateRequiresPowerActors();
|
||||
if (isLowPower != wasLowPower)
|
||||
UpdatePowerRequiringActors();
|
||||
|
||||
if (lowPower && !wasLowPower)
|
||||
if (isLowPower && !wasLowPower)
|
||||
nextPowerAdviceTime = 0;
|
||||
|
||||
wasLowPower = lowPower;
|
||||
wasLowPower = isLowPower;
|
||||
|
||||
if (--nextPowerAdviceTime <= 0)
|
||||
{
|
||||
if (lowPower)
|
||||
if (isLowPower)
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.SpeechNotification, self.Owner.Faction.InternalName);
|
||||
|
||||
nextPowerAdviceTime = info.AdviceInterval;
|
||||
@@ -156,7 +156,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
p.Trait.UpdateStatus(p.Actor);
|
||||
}
|
||||
|
||||
void UpdateRequiresPowerActors()
|
||||
void UpdatePowerRequiringActors()
|
||||
{
|
||||
var traitPairs = self.World.ActorsWithTrait<INotifyPowerLevelChanged>()
|
||||
.Where(p => !p.Actor.IsDead && p.Actor.IsInWorld && p.Actor.Owner == self.Owner);
|
||||
|
||||
Reference in New Issue
Block a user