RCS0056 - roslynator_max_line_length = 160
This commit is contained in:
committed by
Matthias Mailänder
parent
9d5d2ab493
commit
0649f3dc32
@@ -190,12 +190,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
yield return new FacingInit(PreviewFacing);
|
||||
}
|
||||
|
||||
public IReadOnlyDictionary<CPos, SubCell> OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any) { return new Dictionary<CPos, SubCell>(); }
|
||||
public IReadOnlyDictionary<CPos, SubCell> OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any) =>
|
||||
new Dictionary<CPos, SubCell>();
|
||||
|
||||
bool IOccupySpaceInfo.SharesCell => false;
|
||||
|
||||
// Used to determine if an aircraft can spawn landed
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell,
|
||||
SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
{
|
||||
if (!world.Map.Contains(cell))
|
||||
return false;
|
||||
|
||||
@@ -27,7 +27,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
"Strafe: Perform a fixed-length attack run on the target.")]
|
||||
public readonly AirAttackType AttackType = AirAttackType.Default;
|
||||
|
||||
[Desc("Distance the strafing aircraft makes to a target before turning for another pass. When set to WDist.Zero this defaults to the maximum armament range.")]
|
||||
[Desc(
|
||||
"Distance the strafing aircraft makes to a target before turning for another pass. " +
|
||||
"When set to WDist.Zero this defaults to the maximum armament range.")]
|
||||
public readonly WDist StrafeRunLength = WDist.Zero;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new AttackAircraft(init.Self, this); }
|
||||
@@ -45,7 +47,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
aircraftInfo = self.Info.TraitInfo<AircraftInfo>();
|
||||
}
|
||||
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
public override Activity GetAttackActivity(
|
||||
Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
{
|
||||
return new FlyAttack(self, source, newTarget, forceAttack, targetLineColor);
|
||||
}
|
||||
|
||||
@@ -380,7 +380,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Burst = Weapon.Burst;
|
||||
|
||||
if (Weapon.AfterFireSound != null && Weapon.AfterFireSound.Length > 0)
|
||||
ScheduleDelayedAction(Weapon.AfterFireSoundDelay, Burst, (burst) => Game.Sound.Play(SoundType.World, Weapon.AfterFireSound, self.World, self.CenterPosition));
|
||||
ScheduleDelayedAction(
|
||||
Weapon.AfterFireSoundDelay,
|
||||
Burst,
|
||||
burst => Game.Sound.Play(SoundType.World, Weapon.AfterFireSound, self.World, self.CenterPosition));
|
||||
|
||||
foreach (var nbc in notifyBurstComplete)
|
||||
nbc.FiredBurst(self, target, this);
|
||||
|
||||
@@ -226,7 +226,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return order.OrderString == attackOrderName || order.OrderString == forceAttackOrderName ? Info.Voice : null;
|
||||
}
|
||||
|
||||
public abstract Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null);
|
||||
public abstract Activity GetAttackActivity(
|
||||
Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null);
|
||||
|
||||
public bool HasAnyValidWeapons(in Target t, bool checkForCenterTargetingWeapons = false, bool reloadingIsInvalid = false)
|
||||
{
|
||||
|
||||
@@ -159,7 +159,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
base.Tick(self);
|
||||
}
|
||||
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
public override Activity GetAttackActivity(
|
||||
Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
{
|
||||
// HACK: Manually set force attacking if we persisted an opportunity target that required force attacking
|
||||
if (opportunityTargetIsPersistentTarget && opportunityForceAttack && newTarget == OpportunityTarget)
|
||||
|
||||
@@ -39,7 +39,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return TargetInFiringArc(self, target, Info.FacingTolerance);
|
||||
}
|
||||
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
public override Activity GetAttackActivity(
|
||||
Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
{
|
||||
return new Activities.Attack(self, newTarget, allowMove, forceAttack, targetLineColor);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public AttackOmni(Actor self, AttackOmniInfo info)
|
||||
: base(self, info) { }
|
||||
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
public override Activity GetAttackActivity(
|
||||
Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
{
|
||||
return new SetTarget(this, newTarget, allowMove, forceAttack, targetLineColor);
|
||||
}
|
||||
|
||||
@@ -100,8 +100,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
playerBuildings = world.ActorsHavingTrait<Building>().Where(a => a.Owner == player).ToArray();
|
||||
var excessPowerBonus = baseBuilder.Info.ExcessPowerIncrement * (playerBuildings.Length / baseBuilder.Info.ExcessPowerIncreaseThreshold.Clamp(1, int.MaxValue));
|
||||
minimumExcessPower = (baseBuilder.Info.MinimumExcessPower + excessPowerBonus).Clamp(baseBuilder.Info.MinimumExcessPower, baseBuilder.Info.MaximumExcessPower);
|
||||
var excessPowerBonus =
|
||||
baseBuilder.Info.ExcessPowerIncrement *
|
||||
(playerBuildings.Length / baseBuilder.Info.ExcessPowerIncreaseThreshold.Clamp(1, int.MaxValue));
|
||||
minimumExcessPower =
|
||||
(baseBuilder.Info.MinimumExcessPower + excessPowerBonus)
|
||||
.Clamp(baseBuilder.Info.MinimumExcessPower, baseBuilder.Info.MaximumExcessPower);
|
||||
|
||||
// PERF: Queue only one actor at a time per category
|
||||
itemQueuedThisTick = false;
|
||||
@@ -344,7 +348,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var buildingVariantInfo = actorInfo.TraitInfoOrDefault<PlaceBuildingVariantsInfo>();
|
||||
var variants = buildingVariantInfo?.Actors ?? Array.Empty<string>();
|
||||
|
||||
var count = playerBuildings.Count(a => a.Info.Name == name || variants.Contains(a.Info.Name)) + (baseBuilder.BuildingsBeingProduced.TryGetValue(name, out var num) ? num : 0);
|
||||
var count = playerBuildings.Count(a =>
|
||||
a.Info.Name == name || variants.Contains(a.Info.Name)) +
|
||||
(baseBuilder.BuildingsBeingProduced.TryGetValue(name, out var num) ? num : 0);
|
||||
|
||||
// Do we want to build this structure?
|
||||
if (count * 100 > frac.Value * playerBuildings.Length)
|
||||
|
||||
@@ -148,7 +148,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
foreach (var minelayer in minelayers)
|
||||
{
|
||||
var cells = pathFinder.FindPathToTargetCell(minelayer.Actor, new[] { minelayer.Actor.Location }, enemy.Location, BlockedByActor.Immovable, laneBias: false);
|
||||
var cells = pathFinder.FindPathToTargetCell(
|
||||
minelayer.Actor, new[] { minelayer.Actor.Location }, enemy.Location, BlockedByActor.Immovable, laneBias: false);
|
||||
if (cells != null && cells.Count != 0)
|
||||
{
|
||||
AIUtils.BotDebug($"{player}: try find a location to lay mine.");
|
||||
@@ -192,7 +193,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
foreach (var minelayer in minelayers)
|
||||
{
|
||||
var cells = pathFinder.FindPathToTargetCell(minelayer.Actor, new[] { minelayer.Actor.Location }, minelayingPosition, BlockedByActor.Immovable, laneBias: false);
|
||||
var cells = pathFinder.FindPathToTargetCell(
|
||||
minelayer.Actor, new[] { minelayer.Actor.Location }, minelayingPosition, BlockedByActor.Immovable, laneBias: false);
|
||||
if (cells != null && cells.Count != 0)
|
||||
{
|
||||
orderedActors.Add(minelayer.Actor);
|
||||
|
||||
@@ -24,10 +24,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("What support power does this decision apply to?")]
|
||||
public readonly string OrderName = "AirstrikePowerInfoOrder";
|
||||
|
||||
[Desc("What is the coarse scan radius of this power?", "For finding the general target area, before doing a detail scan", "Should be 10 or more to avoid lag")]
|
||||
[Desc(
|
||||
"What is the coarse scan radius of this power?",
|
||||
"For finding the general target area, before doing a detail scan",
|
||||
"Should be 10 or more to avoid lag")]
|
||||
public readonly int CoarseScanRadius = 20;
|
||||
|
||||
[Desc("What is the fine scan radius of this power?", "For doing a detailed scan in the general target area.", "Minimum is 1")]
|
||||
[Desc(
|
||||
"What is the fine scan radius of this power?",
|
||||
"For doing a detailed scan in the general target area.",
|
||||
"Minimum is 1")]
|
||||
public readonly int FineScanRadius = 2;
|
||||
|
||||
[FieldLoader.LoadUsing(nameof(LoadConsiderations))]
|
||||
|
||||
@@ -111,7 +111,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
waitingPowers[sp] += 10;
|
||||
|
||||
// Note: SelectDirectionalTarget uses uint.MaxValue in ExtraData to indicate that the player did not pick a direction.
|
||||
bot.QueueOrder(new Order(sp.Key, supportPowerManager.Self, Target.FromCell(world, attackLocation.Value), false) { SuppressVisualFeedback = true, ExtraData = uint.MaxValue });
|
||||
bot.QueueOrder(
|
||||
new Order(sp.Key, supportPowerManager.Self, Target.FromCell(world, attackLocation.Value), false)
|
||||
{ SuppressVisualFeedback = true, ExtraData = uint.MaxValue });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// Reason: If this is less than SquadSize, the bot might get stuck between not producing more units due to this,
|
||||
// but also not creating squads since there aren't enough idle units.
|
||||
[Desc("If > 0, only produce units as long as there are less than this amount of units idling inside the base.",
|
||||
"Beware: if it is less than squad size, e.g. the `SquadSize` from `SquadManagerBotModule`, the bot might get stuck as there aren't enough idle units to create squad.")]
|
||||
"Beware: if it is less than squad size, e.g. the `SquadSize` from `SquadManagerBotModule`, " +
|
||||
"the bot might get stuck as there aren't enough idle units to create squad.")]
|
||||
public readonly int IdleBaseUnitsMaximum = -1;
|
||||
|
||||
[Desc("Production queues AI uses for producing units.")]
|
||||
|
||||
@@ -140,7 +140,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (Info.RequiresForceMove && !forceEnter)
|
||||
return false;
|
||||
|
||||
return !IsTraitDisabled && target.TraitsImplementing<DockHost>().Any(host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType)));
|
||||
return !IsTraitDisabled && target.TraitsImplementing<DockHost>().Any(
|
||||
host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType)));
|
||||
}
|
||||
|
||||
/// <summary>Clone of <see cref="DockClientManager.DockingPossible(Actor, TargetModifiers)"/>.</summary>
|
||||
@@ -150,7 +151,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (Info.RequiresForceMove && !forceEnter)
|
||||
return false;
|
||||
|
||||
return !IsTraitDisabled && target.TraitsImplementing<DockHost>().Any(host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType, forceEnter)));
|
||||
return !IsTraitDisabled && target.TraitsImplementing<DockHost>().Any(
|
||||
host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType, forceEnter)));
|
||||
}
|
||||
|
||||
/// <summary>Clone of <see cref="DockClientManager.CanDockAt(Actor, bool, bool)"/>.</summary>
|
||||
@@ -159,7 +161,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!(self.CurrentActivity is Transform || transforms.Any(t => !t.IsTraitDisabled && !t.IsTraitPaused)))
|
||||
return false;
|
||||
|
||||
return !IsTraitDisabled && target.TraitsImplementing<DockHost>().Any(host => dockClients.Any(client => client.CanDockAt(target, host, forceEnter, true)));
|
||||
return !IsTraitDisabled && target.TraitsImplementing<DockHost>().Any(
|
||||
host => dockClients.Any(client => client.CanDockAt(target, host, forceEnter, true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,7 +411,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
void INotifyKilled.Killed(Actor self, AttackInfo e)
|
||||
{
|
||||
// IsAtGroundLevel contains Map.Contains(self.Location) check.
|
||||
if (Info.EjectOnDeath && self.IsAtGroundLevel() && (!checkTerrainType || Info.UnloadTerrainTypes.Contains(self.World.Map.GetTerrainInfo(self.Location).Type)))
|
||||
if (Info.EjectOnDeath &&
|
||||
self.IsAtGroundLevel() &&
|
||||
(!checkTerrainType || Info.UnloadTerrainTypes.Contains(self.World.Map.GetTerrainInfo(self.Location).Type)))
|
||||
{
|
||||
while (!IsEmpty())
|
||||
{
|
||||
|
||||
@@ -50,7 +50,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Measured in game ticks.")]
|
||||
public readonly int CloakDelay = 30;
|
||||
|
||||
[Desc("Events leading to the actor getting uncloaked. Possible values are: Attack, Move, Unload, Infiltrate, Demolish, Dock, Damage, Heal, SelfHeal and SupportPower.",
|
||||
[Desc(
|
||||
"Events leading to the actor getting uncloaked. " +
|
||||
"Possible values are: Attack, Move, Unload, Infiltrate, Demolish, Dock, Damage, Heal, SelfHeal and SupportPower.",
|
||||
"'Dock' is triggered when docking to a refinery or resupplying.",
|
||||
"'SupportPower' is triggered when using a support power.")]
|
||||
public readonly UncloakType UncloakOn = UncloakType.Attack
|
||||
@@ -108,7 +110,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public override object Create(ActorInitializer init) { return new Cloak(this); }
|
||||
}
|
||||
|
||||
public class Cloak : PausableConditionalTrait<CloakInfo>, IRenderModifier, INotifyDamage, INotifyUnloadCargo, INotifyLoadCargo, INotifyDemolition, INotifyInfiltration,
|
||||
public class Cloak : PausableConditionalTrait<CloakInfo>,
|
||||
IRenderModifier, INotifyDamage, INotifyUnloadCargo, INotifyLoadCargo, INotifyDemolition, INotifyInfiltration,
|
||||
INotifyAttack, ITick, IVisibilityModifier, IRadarColorModifier, INotifyDockClient, INotifySupportPower
|
||||
{
|
||||
readonly float3 cloakedColor;
|
||||
|
||||
@@ -39,7 +39,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
bool IOccupySpaceInfo.SharesCell => false;
|
||||
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell,
|
||||
SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
{
|
||||
// Since crates don't share cells and GetAvailableSubCell only returns SubCell.Full or SubCell.Invalid, we ignore the subCell parameter
|
||||
return GetAvailableSubCell(world, cell, ignoreActor, check) != SubCell.Invalid;
|
||||
|
||||
@@ -45,7 +45,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
this.self = self;
|
||||
this.info = info;
|
||||
if (info.Units.Length == 0)
|
||||
throw new YamlException("A GiveUnitCrateAction does not specify any units to give. This might be because the yaml is referring to 'Unit' rather than 'Units'.");
|
||||
throw new YamlException(
|
||||
"A GiveUnitCrateAction does not specify any units to give. " +
|
||||
"This might be because the yaml is referring to 'Unit' rather than 'Units'.");
|
||||
}
|
||||
|
||||
public bool CanGiveTo(Actor collector)
|
||||
|
||||
@@ -17,7 +17,8 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[Desc("This actor can grant experience levels equal to it's own current level via entering to other actors with the `" + nameof(AcceptsDeliveredExperience) + "` trait.")]
|
||||
[Desc("This actor can grant experience levels equal to it's own current level " +
|
||||
"via entering to other actors with the `" + nameof(AcceptsDeliveredExperience) + "` trait.")]
|
||||
sealed class DeliversExperienceInfo : TraitInfo, Requires<GainsExperienceInfo>
|
||||
{
|
||||
[Desc("The amount of experience the donating player receives.")]
|
||||
|
||||
@@ -42,7 +42,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public virtual bool CanDockAt(Actor hostActor, IDockHost host, bool forceEnter = false, bool ignoreOccupancy = false)
|
||||
{
|
||||
return (forceEnter || self.Owner.IsAlliedWith(hostActor.Owner)) && IsDockingPossible(host.GetDockType, forceEnter) && host.IsDockingPossible(self, this, ignoreOccupancy);
|
||||
return (forceEnter || self.Owner.IsAlliedWith(hostActor.Owner)) &&
|
||||
IsDockingPossible(host.GetDockType, forceEnter) &&
|
||||
host.IsDockingPossible(self, this, ignoreOccupancy);
|
||||
}
|
||||
|
||||
public virtual void OnDockStarted(Actor self, Actor hostActor, IDockHost host) { }
|
||||
|
||||
@@ -240,26 +240,30 @@ namespace OpenRA.Mods.Common.Traits
|
||||
/// <summary>Does this <paramref name="target"/> contain at least one enabled <see cref="IDockHost"/> with maching <see cref="DockType"/>.</summary>
|
||||
public bool DockingPossible(Actor target)
|
||||
{
|
||||
return !IsTraitDisabled && target.TraitsImplementing<IDockHost>().Any(host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType)));
|
||||
return !IsTraitDisabled && target.TraitsImplementing<IDockHost>().Any(
|
||||
host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType)));
|
||||
}
|
||||
|
||||
/// <summary>Does this <paramref name="target"/> contain at least one enabled <see cref="IDockHost"/> with maching <see cref="DockType"/>.</summary>
|
||||
public bool DockingPossible(Actor target, TargetModifiers modifiers)
|
||||
{
|
||||
var forceEnter = modifiers.HasModifier(TargetModifiers.ForceMove);
|
||||
return !IsTraitDisabled && target.TraitsImplementing<IDockHost>().Any(host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType, forceEnter)));
|
||||
return !IsTraitDisabled && target.TraitsImplementing<IDockHost>().Any(
|
||||
host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType, forceEnter)));
|
||||
}
|
||||
|
||||
/// <summary>Can we dock to this <paramref name="host"/>.</summary>
|
||||
public bool CanDockAt(Actor hostActor, IDockHost host, bool forceEnter = false, bool ignoreOccupancy = false)
|
||||
{
|
||||
return !IsTraitDisabled && dockClients.Any(client => client.CanDockAt(hostActor, host, forceEnter, ignoreOccupancy));
|
||||
return !IsTraitDisabled && dockClients.Any(
|
||||
client => client.CanDockAt(hostActor, host, forceEnter, ignoreOccupancy));
|
||||
}
|
||||
|
||||
/// <summary>Can we dock to this <paramref name="target"/>.</summary>
|
||||
public bool CanDockAt(Actor target, bool forceEnter = false, bool ignoreOccupancy = false)
|
||||
{
|
||||
return !IsTraitDisabled && target.TraitsImplementing<IDockHost>().Any(host => dockClients.Any(client => client.CanDockAt(target, host, forceEnter, ignoreOccupancy)));
|
||||
return !IsTraitDisabled && target.TraitsImplementing<IDockHost>().Any(
|
||||
host => dockClients.Any(client => client.CanDockAt(target, host, forceEnter, ignoreOccupancy)));
|
||||
}
|
||||
|
||||
/// <summary>Find the closest viable <see cref="IDockHost"/>.</summary>
|
||||
@@ -268,7 +272,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var clients = type.IsEmpty ? dockClients : AvailableDockClients(type);
|
||||
return self.World.ActorsWithTrait<IDockHost>()
|
||||
.Where(host => host.Trait != ignore && clients.Any(client => client.CanDockAt(host.Actor, host.Trait, forceEnter, ignoreOccupancy)))
|
||||
.Where(host =>
|
||||
host.Trait != ignore &&
|
||||
clients.Any(client => client.CanDockAt(host.Actor, host.Trait, forceEnter, ignoreOccupancy)))
|
||||
.ClosestDock(self, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
OnDockCompleted(self, dockedClientActor, dockedClient);
|
||||
}
|
||||
|
||||
public virtual bool QueueMoveActivity(Activity moveToDockActivity, Actor self, Actor clientActor, DockClientManager client, MoveCooldownHelper moveCooldownHelper)
|
||||
public virtual bool QueueMoveActivity(
|
||||
Activity moveToDockActivity, Actor self, Actor clientActor, DockClientManager client, MoveCooldownHelper moveCooldownHelper)
|
||||
{
|
||||
var move = clientActor.Trait<IMove>();
|
||||
|
||||
|
||||
@@ -72,7 +72,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var displayedBounty = GetDisplayedBountyValue(self);
|
||||
if (Info.ShowBounty && self.IsInWorld && displayedBounty != 0 && e.Attacker.Owner.IsAlliedWith(self.World.RenderPlayer))
|
||||
e.Attacker.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, e.Attacker.OwnerColor(), FloatingText.FormatCashTick(displayedBounty), 30)));
|
||||
e.Attacker.World.AddFrameEndTask(
|
||||
w => w.Add(new FloatingText(self.CenterPosition, e.Attacker.OwnerColor(), FloatingText.FormatCashTick(displayedBounty), 30)));
|
||||
|
||||
e.Attacker.Owner.PlayerActor.Trait<PlayerResources>().ChangeCash(GetBountyValue(self));
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
bool IOccupySpaceInfo.SharesCell => false;
|
||||
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell,
|
||||
SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
{
|
||||
// IPositionable*Info*.CanEnterCell is only ever used for things like exiting production facilities,
|
||||
// all places relevant for husks check IPositionable.CanEnterCell instead, so we can safely set this to true.
|
||||
|
||||
@@ -127,7 +127,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
/// <summary>
|
||||
/// Note: If the target <paramref name="cell"/> has any free subcell, the value of <paramref name="subCell"/> is ignored.
|
||||
/// </summary>
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell,
|
||||
SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
{
|
||||
// PERF: Avoid repeated trait queries on the hot path
|
||||
locomotor ??= world.WorldActor.TraitsImplementing<Locomotor>()
|
||||
|
||||
@@ -26,7 +26,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public override object Create(ActorInitializer init) { return new FrozenUnderFog(init, this); }
|
||||
}
|
||||
|
||||
public class FrozenUnderFog : ICreatesFrozenActors, IRenderModifier, IDefaultVisibility, ITickRender, ISync, INotifyCreated, INotifyOwnerChanged, INotifyActorDisposing
|
||||
public class FrozenUnderFog : ICreatesFrozenActors, IRenderModifier, IDefaultVisibility,
|
||||
ITickRender, ISync, INotifyCreated, INotifyOwnerChanged, INotifyActorDisposing
|
||||
{
|
||||
[Sync]
|
||||
public int VisibilityHash;
|
||||
|
||||
@@ -63,7 +63,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
ImmutablePalette pal;
|
||||
|
||||
if (info.PlayerIndex.TryGetValue(playerName, out var remap))
|
||||
pal = new ImmutablePalette(basePalette, new IndexedColorRemap(basePalette, info.RemapIndex.Length == 0 ? Enumerable.Range(0, 256).ToArray() : info.RemapIndex, remap));
|
||||
pal = new ImmutablePalette(
|
||||
basePalette,
|
||||
new IndexedColorRemap(basePalette, info.RemapIndex.Length == 0 ? Enumerable.Range(0, 256).ToArray() : info.RemapIndex, remap));
|
||||
else
|
||||
pal = new ImmutablePalette(basePalette);
|
||||
|
||||
|
||||
@@ -61,7 +61,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public override object Create(ActorInitializer init) { return new Passenger(this); }
|
||||
}
|
||||
|
||||
public class Passenger : IIssueOrder, IResolveOrder, IOrderVoice, INotifyRemovedFromWorld, INotifyEnteredCargo, INotifyExitedCargo, INotifyKilled, IObservesVariables
|
||||
public class Passenger : IIssueOrder, IResolveOrder, IOrderVoice,
|
||||
INotifyRemovedFromWorld, INotifyEnteredCargo, INotifyExitedCargo, INotifyKilled, IObservesVariables
|
||||
{
|
||||
public readonly PassengerInfo Info;
|
||||
public Actor Transport;
|
||||
|
||||
@@ -66,7 +66,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(MapPreview map)
|
||||
{
|
||||
yield return new LobbyBooleanOption(map, "cheats", CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked);
|
||||
yield return new LobbyBooleanOption(map, "cheats",
|
||||
CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked);
|
||||
}
|
||||
|
||||
public override object Create(ActorInitializer init) { return new DeveloperMode(this); }
|
||||
|
||||
@@ -28,7 +28,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Human-readable name this bot uses.")]
|
||||
public readonly string Name = "Unnamed Bot";
|
||||
|
||||
[Desc("Minimum portion of pending orders to issue each tick (e.g. 5 issues at least 1/5th of all pending orders). Excess orders remain queued for subsequent ticks.")]
|
||||
[Desc("Minimum portion of pending orders to issue each tick (e.g. 5 issues at least 1/5th of all pending orders). " +
|
||||
"Excess orders remain queued for subsequent ticks.")]
|
||||
public readonly int MinOrderQuotientPerTick = 5;
|
||||
|
||||
string IBotInfo.Type => Type;
|
||||
|
||||
@@ -66,7 +66,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var startingCash = SelectableCash.ToDictionary(c => c.ToStringInvariant(), c => "$" + c.ToString(NumberFormatInfo.CurrentInfo));
|
||||
|
||||
if (startingCash.Count > 0)
|
||||
yield return new LobbyOption(map, "startingcash", DefaultCashDropdownLabel, DefaultCashDropdownDescription, DefaultCashDropdownVisible, DefaultCashDropdownDisplayOrder,
|
||||
yield return new LobbyOption(map, "startingcash",
|
||||
DefaultCashDropdownLabel, DefaultCashDropdownDescription, DefaultCashDropdownVisible, DefaultCashDropdownDisplayOrder,
|
||||
startingCash, DefaultCash.ToStringInvariant(), DefaultCashDropdownLocked);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var pci = rules.Actors[SystemActors.Player].TraitInfoOrDefault<ProximityCaptorInfo>();
|
||||
if (pci == null)
|
||||
throw new YamlException(nameof(ProximityCapturableBase) + " requires the `" + nameof(Player) + "` actor to have the " + nameof(ProximityCaptor) + " trait.");
|
||||
throw new YamlException(
|
||||
nameof(ProximityCapturableBase) + " requires the `" + nameof(Player) + "` actor to have the " + nameof(ProximityCaptor) + " trait.");
|
||||
}
|
||||
|
||||
public abstract override object Create(ActorInitializer init);
|
||||
|
||||
@@ -182,7 +182,10 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var palette = wr.Palette(info.Palette);
|
||||
var alpha = shadow.CurrentSequence.GetAlpha(shadow.CurrentFrame);
|
||||
var tintModifiers = shadow.CurrentSequence.IgnoreWorldTint ? TintModifiers.ReplaceColor | TintModifiers.IgnoreWorldTint : TintModifiers.ReplaceColor;
|
||||
return new IRenderable[] { new SpriteRenderable(shadow.Image, pos, info.ShadowOffset, info.ShadowZOffset, palette, 1, shadowAlpha * alpha, shadowColor, tintModifiers, true) };
|
||||
return new IRenderable[]
|
||||
{
|
||||
new SpriteRenderable(shadow.Image, pos, info.ShadowOffset, info.ShadowZOffset, palette, 1, shadowAlpha * alpha, shadowColor, tintModifiers, true)
|
||||
};
|
||||
}
|
||||
|
||||
IEnumerable<Rectangle> IRender.ScreenBounds(Actor self, WorldRenderer wr)
|
||||
|
||||
@@ -18,7 +18,8 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common.Traits.Render
|
||||
{
|
||||
[Desc("Renders a decorative animation on units and buildings. Overlay switching controlled by " + nameof(PauseOnCondition) + ".")]
|
||||
public class WithSwitchableOverlayInfo : PausableConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<BodyOrientationInfo>
|
||||
public class WithSwitchableOverlayInfo : PausableConditionalTraitInfo,
|
||||
IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<BodyOrientationInfo>
|
||||
{
|
||||
[Desc("Image used for this decoration. Defaults to the actor's type.")]
|
||||
public readonly string Image = null;
|
||||
@@ -123,7 +124,11 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var facing = self.TraitOrDefault<IFacing>();
|
||||
|
||||
var image = info.Image ?? rs.GetImage(self);
|
||||
overlay = new Animation(self.World, image, facing == null ? () => WAngle.Zero : (body == null ? () => facing.Facing : () => body.QuantizeFacing(facing.Facing)), () => false)
|
||||
overlay = new Animation(
|
||||
self.World,
|
||||
image,
|
||||
facing == null ? () => WAngle.Zero : (body == null ? () => facing.Facing : () => body.QuantizeFacing(facing.Facing)),
|
||||
() => false)
|
||||
{
|
||||
IsDecoration = info.IsDecoration
|
||||
};
|
||||
|
||||
@@ -111,7 +111,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
else
|
||||
return;
|
||||
|
||||
self.QueueActivity(order.Queued, new RepairBridge(self, order.Target, info.EnterBehaviour, info.RepairNotification, info.RepairTextNotification, info.TargetLineColor));
|
||||
self.QueueActivity(
|
||||
order.Queued,
|
||||
new RepairBridge(self, order.Target, info.EnterBehaviour, info.RepairNotification, info.RepairTextNotification, info.TargetLineColor));
|
||||
self.ShowTargetLines();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(MapPreview map)
|
||||
{
|
||||
yield return new LobbyBooleanOption(map, "crates", CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked);
|
||||
yield return new LobbyBooleanOption(map, "crates",
|
||||
CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked);
|
||||
}
|
||||
|
||||
public override object Create(ActorInitializer init) { return new CrateSpawner(init.Self, this); }
|
||||
|
||||
@@ -206,7 +206,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return terrainInfos[index].Speed;
|
||||
}
|
||||
|
||||
public short MovementCostToEnterCell(Actor actor, CPos destNode, BlockedByActor check, Actor ignoreActor, bool ignoreSelf = false, SubCell subCell = SubCell.FullCell)
|
||||
public short MovementCostToEnterCell(
|
||||
Actor actor, CPos destNode, BlockedByActor check, Actor ignoreActor, bool ignoreSelf = false, SubCell subCell = SubCell.FullCell)
|
||||
{
|
||||
var cellCost = MovementCostForCell(destNode);
|
||||
|
||||
@@ -217,7 +218,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return cellCost;
|
||||
}
|
||||
|
||||
public short MovementCostToEnterCell(Actor actor, CPos srcNode, CPos destNode, BlockedByActor check, Actor ignoreActor, bool ignoreSelf = false)
|
||||
public short MovementCostToEnterCell(
|
||||
Actor actor, CPos srcNode, CPos destNode, BlockedByActor check, Actor ignoreActor, bool ignoreSelf = false)
|
||||
{
|
||||
var cellCost = MovementCostForCell(destNode, srcNode);
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(MapPreview map)
|
||||
{
|
||||
yield return new LobbyBooleanOption(map, "creeps", CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked);
|
||||
yield return new LobbyBooleanOption(map, "creeps",
|
||||
CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked);
|
||||
}
|
||||
|
||||
public override object Create(ActorInitializer init) { return new MapCreeps(this); }
|
||||
|
||||
@@ -81,14 +81,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(MapPreview map)
|
||||
{
|
||||
yield return new LobbyBooleanOption(map, "shortgame", ShortGameCheckboxLabel, ShortGameCheckboxDescription,
|
||||
yield return new LobbyBooleanOption(map, "shortgame",
|
||||
ShortGameCheckboxLabel, ShortGameCheckboxDescription,
|
||||
ShortGameCheckboxVisible, ShortGameCheckboxDisplayOrder, ShortGameCheckboxEnabled, ShortGameCheckboxLocked);
|
||||
|
||||
var techLevels = map.PlayerActorInfo.TraitInfos<ProvidesTechPrerequisiteInfo>()
|
||||
.ToDictionary(t => t.Id, t => map.GetLocalisedString(t.Name));
|
||||
|
||||
if (techLevels.Count > 0)
|
||||
yield return new LobbyOption(map, "techlevel", TechLevelDropdownLabel, TechLevelDropdownDescription, TechLevelDropdownVisible, TechLevelDropdownDisplayOrder,
|
||||
yield return new LobbyOption(map, "techlevel",
|
||||
TechLevelDropdownLabel, TechLevelDropdownDescription, TechLevelDropdownVisible, TechLevelDropdownDisplayOrder,
|
||||
techLevels, TechLevel, TechLevelDropdownLocked);
|
||||
|
||||
var gameSpeeds = Game.ModData.Manifest.Get<GameSpeeds>();
|
||||
|
||||
@@ -95,7 +95,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
case TargetType.Terrain:
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Add(new SpriteAnnotation(target.CenterPosition, world, info.TerrainFlashImage, info.TerrainFlashSequence, info.TerrainFlashPalette)));
|
||||
world.AddFrameEndTask(w => w.Add(new SpriteAnnotation(
|
||||
target.CenterPosition, world, info.TerrainFlashImage, info.TerrainFlashSequence, info.TerrainFlashPalette)));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[TraitLocation(SystemActors.World)]
|
||||
[Desc("Spawn base actor at the spawnpoint and support units in an annulus around the base actor. Both are defined at MPStartUnits. Attach this to the world actor.")]
|
||||
[Desc("Spawn base actor at the spawnpoint and support units in an annulus around the base actor. " +
|
||||
"Both are defined at MPStartUnits. Attach this to the world actor.")]
|
||||
public class SpawnStartingUnitsInfo : TraitInfo, Requires<StartingUnitsInfo>, NotBefore<LocomotorInfo>, ILobbyOptions
|
||||
{
|
||||
public readonly string StartingUnitsClass = "none";
|
||||
|
||||
Reference in New Issue
Block a user