Merge pull request #7246 from Hellhake/stylecop-ra
Fix StyleCop warnings in OpenRA.Mods.RA
This commit is contained in:
@@ -12,8 +12,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AI.Fuzzy.Library;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.AI
|
||||
@@ -201,6 +201,7 @@ namespace OpenRA.Mods.RA.AI
|
||||
if (warhead != null)
|
||||
sumOfDamage += warhead.Damage;
|
||||
}
|
||||
|
||||
return sumOfDamage;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -73,10 +73,9 @@ namespace OpenRA.Mods.RA.AI
|
||||
HackyAI.BotDebug("AI: {0} is starting production of {1}".F(player, item.Name));
|
||||
world.IssueOrder(Order.StartProduction(queue.Actor, item.Name, 1));
|
||||
}
|
||||
|
||||
// Production is complete
|
||||
else if (currentBuilding.Done)
|
||||
{
|
||||
// Production is complete
|
||||
// Choose the placement logic
|
||||
// HACK: HACK HACK HACK
|
||||
var type = BuildingType.Building;
|
||||
|
||||
@@ -735,6 +735,7 @@ namespace OpenRA.Mods.RA.AI
|
||||
foreach (var kv in powers)
|
||||
{
|
||||
var sp = kv.Value;
|
||||
|
||||
// Add power to dictionary if not in delay dictionary yet
|
||||
if (!waitingPowers.ContainsKey(sp))
|
||||
waitingPowers.Add(sp, 0);
|
||||
@@ -743,7 +744,7 @@ namespace OpenRA.Mods.RA.AI
|
||||
waitingPowers[sp]--;
|
||||
|
||||
// If we have recently tried and failed to find a use location for a power, then do not try again until later
|
||||
var isDelayed = (waitingPowers[sp] > 0);
|
||||
var isDelayed = waitingPowers[sp] > 0;
|
||||
if (sp.Ready && !isDelayed && powerDecisions.ContainsKey(sp.Info.OrderName))
|
||||
{
|
||||
var powerDecision = powerDecisions[sp.Info.OrderName];
|
||||
@@ -829,11 +830,11 @@ namespace OpenRA.Mods.RA.AI
|
||||
|
||||
var checkRadius = powerDecision.CoarseScanRadius;
|
||||
var fineCheck = powerDecision.FineScanRadius;
|
||||
for (var i = (0 - extendedRange); i <= (checkRadius + extendedRange); i += fineCheck)
|
||||
for (var i = 0 - extendedRange; i <= (checkRadius + extendedRange); i += fineCheck)
|
||||
{
|
||||
var x = checkPos.X + i;
|
||||
|
||||
for (var j = (0 - extendedRange); j <= (checkRadius + extendedRange); j += fineCheck)
|
||||
for (var j = 0 - extendedRange; j <= (checkRadius + extendedRange); j += fineCheck)
|
||||
{
|
||||
var y = checkPos.Y + j;
|
||||
var pos = world.Map.CenterOfCell(new CPos(x, y));
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.RA
|
||||
/// <summary>Makes up part of a decision, describing how to evaluate a target.</summary>
|
||||
class Consideration
|
||||
{
|
||||
public enum DecisionMetric { Health, Value, None };
|
||||
public enum DecisionMetric { Health, Value, None }
|
||||
|
||||
[Desc("Against whom should this power be used?", "Allowed keywords: Ally, Neutral, Enemy")]
|
||||
public readonly Stance Against = Stance.Enemy;
|
||||
@@ -152,6 +152,7 @@ namespace OpenRA.Mods.RA
|
||||
return Attractiveness;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if (info.Explosion != null)
|
||||
{
|
||||
var weapon = self.World.Map.Rules.Weapons[info.Explosion.ToLowerInvariant()];
|
||||
|
||||
// Use .FromPos since this actor is killed. Cannot use Target.FromActor
|
||||
weapon.Impact(Target.FromPos(self.CenterPosition), self, Enumerable.Empty<int>());
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
else
|
||||
inner = Util.SequenceActivities(new Fly(self, target), new FlyTimed(ticksUntilTurn));
|
||||
}
|
||||
|
||||
inner = Util.RunActivity(self, inner);
|
||||
|
||||
return this;
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
heli.UnReserve();
|
||||
heli.Reservation = res.Reserve(dest, self, heli);
|
||||
}
|
||||
|
||||
var exit = dest.Info.Traits.WithInterface<ExitInfo>().FirstOrDefault();
|
||||
var offset = (exit != null) ? exit.SpawnOffset : WVec.Zero;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
var ret = InnerTick(self, attack);
|
||||
attack.IsAttacking = (ret == this);
|
||||
attack.IsAttacking = ret == this;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,10 @@ namespace OpenRA.Mods.RA.Activities
|
||||
{
|
||||
public class DeliverResources : Activity
|
||||
{
|
||||
const int NextChooseTime = 100;
|
||||
bool isDocking;
|
||||
int chosenTicks;
|
||||
|
||||
const int NextChooseTime = 100;
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (NextActivity != null)
|
||||
|
||||
@@ -12,8 +12,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
{
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
var resType = resLayer.GetResource(loc);
|
||||
|
||||
if (resType == null) return 1;
|
||||
|
||||
// Can the harvester collect this kind of resource?
|
||||
if (!harvInfo.Resources.Contains(resType.Info.Name)) return 1;
|
||||
|
||||
@@ -81,8 +82,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
return 0;
|
||||
})
|
||||
.FromPoint(self.Location)
|
||||
);
|
||||
.FromPoint(self.Location));
|
||||
|
||||
if (path.Count == 0)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,6 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
{
|
||||
// assumes you have Minelayer on that unit
|
||||
|
||||
class LayMines : Activity
|
||||
{
|
||||
public override Activity Tick(Actor self)
|
||||
@@ -30,6 +29,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if (!limitedAmmo.HasAmmo())
|
||||
{
|
||||
var info = self.Info.Traits.Get<MinelayerInfo>();
|
||||
|
||||
// rearm & repair at fix, then back out here to refill the minefield some more
|
||||
var buildings = info.RearmBuildings;
|
||||
var rearmTarget = self.World.Actors.Where(a => self.Owner.Stances[a.Owner] == Stance.Ally
|
||||
@@ -56,7 +56,8 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
if (ml.Minefield.Length > 0)
|
||||
{
|
||||
for (var n = 0; n < 20; n++) // dont get stuck forever here
|
||||
// dont get stuck forever here
|
||||
for (var n = 0; n < 20; n++)
|
||||
{
|
||||
var p = ml.Minefield.Random(self.World.SharedRandom);
|
||||
if (ShouldLayMine(self, p))
|
||||
@@ -65,7 +66,6 @@ namespace OpenRA.Mods.RA.Activities
|
||||
}
|
||||
|
||||
// TODO: return somewhere likely to be safe (near fix) so we're not sitting out in the minefield.
|
||||
|
||||
return new Wait(20); // nothing to do here
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
public class RAHarvesterDockSequence : Activity
|
||||
{
|
||||
enum State { Wait, Turn, Dock, Loop, Undock, Complete };
|
||||
enum State { Wait, Turn, Dock, Loop, Undock, Complete }
|
||||
|
||||
readonly Actor proc;
|
||||
readonly int angle;
|
||||
@@ -88,4 +88,3 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
public class Teleport : Activity
|
||||
{
|
||||
const int maxCellSearchRange = Map.MaxTilesInCircleRange;
|
||||
Actor teleporter;
|
||||
CPos destination;
|
||||
int? maximumDistance;
|
||||
@@ -29,8 +30,6 @@ namespace OpenRA.Mods.RA.Activities
|
||||
bool screenFlash;
|
||||
string sound;
|
||||
|
||||
const int maxCellSearchRange = Map.MaxTilesInCircleRange;
|
||||
|
||||
public Teleport(Actor teleporter, CPos destination, int? maximumDistance, bool killCargo, bool screenFlash, string sound)
|
||||
{
|
||||
if (maximumDistance > maxCellSearchRange)
|
||||
@@ -74,6 +73,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
while (!cargo.IsEmpty(self))
|
||||
{
|
||||
var a = cargo.Unload(self);
|
||||
|
||||
// Kill all the units that are unloaded into the void
|
||||
// Kill() handles kill and death statistics
|
||||
a.Kill(teleporter);
|
||||
|
||||
@@ -74,6 +74,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
foreach (var nbm in blocker.TraitsImplementing<INotifyBlockingMove>())
|
||||
nbm.OnNotifyBlockingMove(blocker, self);
|
||||
}
|
||||
|
||||
return Util.SequenceActivities(new Wait(10), this);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,15 +9,14 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Primitives;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Orders;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
@@ -89,6 +88,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
totalWeight = cargo.Sum(c => GetWeight(c));
|
||||
}
|
||||
|
||||
facing = Exts.Lazy(self.TraitOrDefault<IFacing>);
|
||||
}
|
||||
|
||||
@@ -329,6 +329,7 @@ namespace OpenRA.Mods.RA
|
||||
foreach (var npe in self.TraitsImplementing<INotifyPassengerEntered>())
|
||||
npe.PassengerEntered(self, c);
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
wda.SpawnDeathAnimation(self, wda.Info.CrushedSequence, palette);
|
||||
}
|
||||
|
||||
self.Kill(crusher);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ namespace OpenRA.Mods.RA.Effects
|
||||
{
|
||||
class GpsSatellite : IEffect
|
||||
{
|
||||
WPos pos;
|
||||
readonly Animation anim;
|
||||
WPos pos;
|
||||
|
||||
public GpsSatellite(World world, WPos pos)
|
||||
{
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace OpenRA.Mods.RA.Effects
|
||||
{
|
||||
class SatelliteLaunch : IEffect
|
||||
{
|
||||
int frame = 0;
|
||||
readonly Animation doors;
|
||||
readonly WPos pos;
|
||||
int frame = 0;
|
||||
|
||||
public SatelliteLaunch(Actor a)
|
||||
{
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
var pos = Args.GuidedTarget.IsValidFor(Args.SourceActor) ? Args.GuidedTarget.CenterPosition : Args.PassiveTarget;
|
||||
zap = new TeslaZapRenderable(Args.Source, 0, pos - Args.Source, Info.Image, Info.BrightZaps, Info.DimZaps, Info.Palette);
|
||||
}
|
||||
|
||||
yield return zap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ namespace OpenRA.Mods.RA.Traits
|
||||
var pilot = self.World.CreateActor(false, info.PilotActor.ToLowerInvariant(),
|
||||
new TypeDictionary { new OwnerInit(self.Owner), new LocationInit(self.Location) });
|
||||
|
||||
|
||||
if (info.AllowUnsuitableCell || IsSuitableCell(self, pilot))
|
||||
{
|
||||
if (cp.Z > 0)
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
return (float)cap.CaptureProgressTime / (cap.Info.CaptureCompleteTime * 25);
|
||||
}
|
||||
|
||||
public Color GetColor() { return Color.Orange; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Effects;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
@@ -49,6 +49,7 @@ namespace OpenRA.Mods.RA
|
||||
if (!info.Stances.Contains(e.Attacker.Owner.Stances[self.Owner])) return;
|
||||
|
||||
var cost = self.GetSellValue();
|
||||
|
||||
// 2 hundreds because of GetMultiplier and info.Percentage.
|
||||
var bounty = cost * GetMultiplier(self) * info.Percentage / 10000;
|
||||
|
||||
|
||||
@@ -66,4 +66,3 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,4 +25,3 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,4 +26,3 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,4 +28,3 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,4 +36,3 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
public void Run(Action<string> emitError, Action<string> emitWarning, Map map)
|
||||
{
|
||||
var sequences = MiniYaml.MergeLiberal(map.SequenceDefinitions,
|
||||
Game.modData.Manifest.Sequences.Select(s => MiniYaml.FromFile(s))
|
||||
.Aggregate(MiniYaml.MergeLiberal));
|
||||
var sequences = MiniYaml.MergeLiberal(map.SequenceDefinitions, Game.modData.Manifest.Sequences.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal));
|
||||
|
||||
foreach (var actorInfo in map.Rules.Actors)
|
||||
foreach (var renderInfo in actorInfo.Value.Traits.WithInterface<RenderSimpleInfo>())
|
||||
|
||||
@@ -19,7 +19,6 @@ namespace OpenRA.Mods.RA.Orders
|
||||
{
|
||||
if (mi.Button != MouseButton.Left)
|
||||
world.CancelInputMode();
|
||||
|
||||
else if (!world.ShroudObscures(xy))
|
||||
{
|
||||
world.CancelInputMode();
|
||||
|
||||
@@ -104,6 +104,7 @@ namespace OpenRA.Mods.RA.Orders
|
||||
yield return r;
|
||||
|
||||
var cells = new Dictionary<CPos, bool>();
|
||||
|
||||
// Linebuild for walls.
|
||||
// Requires a 1x1 footprint
|
||||
if (rules.Actors[Building].Traits.Contains<LineBuildInfo>())
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Mods.RA.Effects;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.RA
|
||||
if (!inDropRange || cargo.IsEmpty(self))
|
||||
return;
|
||||
|
||||
if (droppedAt.Contains(self.Location) || checkForSuitableCell && !IsSuitableCell(cargo.Peek(self), self.Location))
|
||||
if (droppedAt.Contains(self.Location) || (checkForSuitableCell && !IsSuitableCell(cargo.Peek(self), self.Location)))
|
||||
return;
|
||||
|
||||
if (!self.World.Map.Contains(self.Location))
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace OpenRA.Mods.RA
|
||||
case AlternateTransportsMode.Always:
|
||||
break;
|
||||
}
|
||||
|
||||
return base.CanTargetActor(self, target, modifiers, ref cursor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,4 +76,3 @@ namespace OpenRA.Mods.RA.Traits
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,4 +68,3 @@ namespace OpenRA.Mods.RA.Traits
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ namespace OpenRA.Mods.RA
|
||||
if (queue == null)
|
||||
return;
|
||||
|
||||
|
||||
var buildingInfo = unit.Traits.Get<BuildingInfo>();
|
||||
|
||||
if (order.OrderString == "LineBuild")
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace OpenRA.Mods.RA
|
||||
return player.PlayerActor.Trait<PlayerResources>().Earned - earnedAtBeginningOfMinute;
|
||||
}
|
||||
}
|
||||
|
||||
public Queue<int> EarnedSamples = new Queue<int>(100);
|
||||
int earnedAtBeginningOfMinute;
|
||||
|
||||
@@ -104,6 +105,7 @@ namespace OpenRA.Mods.RA
|
||||
case "Pong":
|
||||
return;
|
||||
}
|
||||
|
||||
if (order.OrderString.StartsWith("Dev"))
|
||||
return;
|
||||
OrderCount++;
|
||||
@@ -132,6 +134,7 @@ namespace OpenRA.Mods.RA
|
||||
attackerStats.UnitsKilled++;
|
||||
defenderStats.UnitsDead++;
|
||||
}
|
||||
|
||||
if (self.HasTrait<Valued>())
|
||||
{
|
||||
var cost = self.Info.Traits.Get<ValuedInfo>().Cost;
|
||||
|
||||
@@ -70,7 +70,8 @@ namespace OpenRA.Mods.RA
|
||||
// no.. So find a new one
|
||||
var captor = GetInRange(self);
|
||||
|
||||
if (captor != null) // got one
|
||||
// got one
|
||||
if (captor != null)
|
||||
{
|
||||
ChangeOwnership(self, captor);
|
||||
return;
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
@@ -67,6 +67,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
buildComplete = false;
|
||||
}
|
||||
|
||||
public void Sold(Actor self) { }
|
||||
}
|
||||
}
|
||||
@@ -87,6 +87,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
buildComplete = false;
|
||||
}
|
||||
|
||||
public void OnTransform(Actor self) { }
|
||||
public void AfterTransform(Actor self) { }
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
anim.ReplaceAnim(sequence);
|
||||
}
|
||||
|
||||
static public int ZOffsetFromCenter(Actor self, WPos pos, int offset)
|
||||
public static int ZOffsetFromCenter(Actor self, WPos pos, int offset)
|
||||
{
|
||||
var delta = self.CenterPosition - pos;
|
||||
return delta.Y + delta.Z + offset;
|
||||
|
||||
@@ -37,8 +37,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
WRange.FromCells(self.Info.Traits.Get<DetectCloakedInfo>().Range),
|
||||
0,
|
||||
Color.FromArgb(128, Color.LimeGreen),
|
||||
Color.FromArgb(96, Color.Black)
|
||||
);
|
||||
Color.FromArgb(96, Color.Black));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,4 +88,3 @@ namespace OpenRA.Mods.RA.Traits
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,8 +42,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
range,
|
||||
0,
|
||||
Color.FromArgb(128, Color.Yellow),
|
||||
Color.FromArgb(96, Color.Black)
|
||||
);
|
||||
Color.FromArgb(96, Color.Black));
|
||||
|
||||
foreach (var a in w.ActorsWithTrait<RenderRangeCircle>())
|
||||
if (a.Actor.Owner == a.Actor.World.LocalPlayer)
|
||||
@@ -76,8 +75,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
attack.GetMaximumRange(),
|
||||
0,
|
||||
Color.FromArgb(128, Color.Yellow),
|
||||
Color.FromArgb(96, Color.Black)
|
||||
);
|
||||
Color.FromArgb(96, Color.Black));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
ai.Traits.Get<CreatesShroudInfo>().Range,
|
||||
0,
|
||||
Color.FromArgb(128, Color.Cyan),
|
||||
Color.FromArgb(96, Color.Black)
|
||||
);
|
||||
Color.FromArgb(96, Color.Black));
|
||||
|
||||
foreach (var a in w.ActorsWithTrait<RenderShroudCircle>())
|
||||
if (a.Actor.Owner == a.Actor.World.LocalPlayer)
|
||||
@@ -54,9 +53,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
self.Info.Traits.Get<CreatesShroudInfo>().Range,
|
||||
0,
|
||||
Color.FromArgb(128, Color.Cyan),
|
||||
Color.FromArgb(96, Color.Black)
|
||||
);
|
||||
Color.FromArgb(96, Color.Black));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
bool CanRepair()
|
||||
{
|
||||
var li = self.TraitOrDefault<LimitedAmmo>();
|
||||
return (Health.DamageState > DamageState.Undamaged || (li != null && !li.FullAmmo()) );
|
||||
return Health.DamageState > DamageState.Undamaged || (li != null && !li.FullAmmo());
|
||||
}
|
||||
|
||||
public string VoicePhraseForOrder(Actor self, Order order)
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using Eluant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Eluant;
|
||||
using OpenRA;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Effects;
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using Eluant;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Eluant;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Scripting
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Eluant;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Scripting;
|
||||
|
||||
namespace OpenRA.Mods.RA.Scripting
|
||||
{
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using Eluant;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Eluant;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.Common.Scripting;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
|
||||
@@ -15,7 +15,6 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
|
||||
[Desc("Actor can be sold")]
|
||||
public class SellableInfo : UpgradableTraitInfo, ITraitInfo
|
||||
{
|
||||
|
||||
@@ -164,8 +164,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
Info.BeaconPalettePrefix,
|
||||
Info.BeaconPoster,
|
||||
Info.BeaconPosterPalette,
|
||||
() => 1 - ((distanceTestActor.CenterPosition - target).HorizontalLength - info.BeaconDistanceOffset.Range) * 1f / distance
|
||||
);
|
||||
() => 1 - ((distanceTestActor.CenterPosition - target).HorizontalLength - info.BeaconDistanceOffset.Range) * 1f / distance);
|
||||
|
||||
w.Add(beacon);
|
||||
}
|
||||
|
||||
@@ -110,9 +110,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
Info.BeaconPalettePrefix,
|
||||
Info.BeaconPoster,
|
||||
Info.BeaconPosterPalette,
|
||||
() => missile.FractionComplete
|
||||
);
|
||||
|
||||
() => missile.FractionComplete);
|
||||
|
||||
Action removeBeacon = () => self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
[ActorReference]
|
||||
[Desc("Troops to be delivered. They will be distributed between the planes if SquadSize > 1.")]
|
||||
public string[] DropItems = { };
|
||||
public readonly string[] DropItems = { };
|
||||
|
||||
[Desc("Risks stuck units when they don't have the Paratrooper trait.")]
|
||||
public readonly bool AllowImpassableCells = false;
|
||||
@@ -184,8 +184,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
Info.BeaconPalettePrefix,
|
||||
Info.BeaconPoster,
|
||||
Info.BeaconPosterPalette,
|
||||
() => 1 - ((distanceTestActor.CenterPosition - target).HorizontalLength - info.BeaconDistanceOffset.Range) * 1f / distance
|
||||
);
|
||||
() => 1 - ((distanceTestActor.CenterPosition - target).HorizontalLength - info.BeaconDistanceOffset.Range) * 1f / distance);
|
||||
|
||||
w.Add(beacon);
|
||||
}
|
||||
|
||||
@@ -189,7 +189,8 @@ namespace OpenRA.Mods.RA.Traits
|
||||
if (Manager.DevMode.FastCharge && RemainingTime > 25)
|
||||
RemainingTime = 25;
|
||||
|
||||
if (RemainingTime > 0) --RemainingTime;
|
||||
if (RemainingTime > 0)
|
||||
--RemainingTime;
|
||||
if (!notifiedCharging)
|
||||
{
|
||||
power.Charging(power.self, Key);
|
||||
|
||||
@@ -46,7 +46,8 @@ namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
public void Damaged(Actor self, AttackInfo e)
|
||||
{
|
||||
if (e.Damage > 0 && (e.Warhead == null || !e.Warhead.PreventProne)) /* Don't go prone when healed */
|
||||
/* Don't go prone when healed */
|
||||
if (e.Damage > 0 && (e.Warhead == null || !e.Warhead.PreventProne))
|
||||
{
|
||||
if (!isProne)
|
||||
localOffset = info.ProneOffset;
|
||||
|
||||
@@ -176,6 +176,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
SetPosition(self, self.World.Map.CenterOfCell(cell) + new WVec(0, 0, CenterPosition.Z));
|
||||
}
|
||||
|
||||
public void SetVisualPosition(Actor self, WPos pos) { SetPosition(self, pos); }
|
||||
|
||||
public void AddedToWorld(Actor self)
|
||||
|
||||
@@ -70,6 +70,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
return WVec.Zero;
|
||||
|
||||
var dot = WVec.Dot(currentDir, repulsionForce) / length;
|
||||
|
||||
// avoid stalling the plane
|
||||
return dot >= 0 ? repulsionForce : WVec.Zero;
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
harv.QueueActivity(DockSequence(harv, self));
|
||||
harv.QueueActivity(new CallFunc(() => dockedHarv = null, false));
|
||||
}
|
||||
|
||||
harv.QueueActivity(new CallFunc(() => harv.Trait<Harvester>().ContinueHarvesting(harv)));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Traits;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Orders;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.RA.Effects;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Effects;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
@@ -38,7 +38,6 @@ namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
// NOTE: we really dont care about the GC eating DisposableActions that apply to a world *other* than
|
||||
// the one we're playing in.
|
||||
|
||||
return new DisposableAction(
|
||||
() => { reservedFor = null; reservedForAircraft = null; },
|
||||
() => Game.RunAfterTick(
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.Common.Orders;
|
||||
@@ -68,7 +68,6 @@ namespace OpenRA.Mods.RA.Traits
|
||||
self.QueueActivity(new MoveAdjacentTo(self, target));
|
||||
self.QueueActivity(new CallFunc(() => Explode(self)));
|
||||
}
|
||||
|
||||
else if (order.OrderString == "Detonate")
|
||||
Explode(self);
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.Common.Orders;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
IExplodeModifier, IOrderVoice, ISpeedModifier, ISync,
|
||||
INotifyResourceClaimLost, INotifyIdle, INotifyBlockingMove
|
||||
{
|
||||
readonly HarvesterInfo Info;
|
||||
Dictionary<ResourceTypeInfo, int> contents = new Dictionary<ResourceTypeInfo, int>();
|
||||
|
||||
[Sync] public Actor OwnerLinkedProc = null;
|
||||
@@ -56,7 +57,6 @@ namespace OpenRA.Mods.RA.Traits
|
||||
public CPos? LastHarvestedCell = null;
|
||||
public CPos? LastOrderLocation = null;
|
||||
[Sync] public int ContentValue { get { return contents.Sum(c => c.Key.ValuePerUnit * c.Value); } }
|
||||
readonly HarvesterInfo Info;
|
||||
bool idleSmart = true;
|
||||
|
||||
public Harvester(Actor self, HarvesterInfo info)
|
||||
@@ -118,8 +118,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
from r in self.World.ActorsWithTrait<IAcceptOre>()
|
||||
where r.Actor != ignore && r.Actor.Owner == self.Owner && IsAcceptableProcType(r.Actor)
|
||||
let linkedHarvs = self.World.ActorsWithTrait<Harvester>().Where(a => a.Trait.LinkedProc == r.Actor).Count()
|
||||
select new { Location = r.Actor.Location + r.Trait.DeliverOffset, Actor = r.Actor, Occupancy = linkedHarvs }
|
||||
).ToDictionary(r => r.Location);
|
||||
select new { Location = r.Actor.Location + r.Trait.DeliverOffset, Actor = r.Actor, Occupancy = linkedHarvs }).ToDictionary(r => r.Location);
|
||||
|
||||
// Start a search from each refinery's delivery location:
|
||||
var mi = self.Info.Traits.Get<MobileInfo>();
|
||||
@@ -130,13 +129,13 @@ namespace OpenRA.Mods.RA.Traits
|
||||
if (!refs.ContainsKey(loc)) return 0;
|
||||
|
||||
var occupancy = refs[loc].Occupancy;
|
||||
|
||||
// 4 harvesters clogs up the refinery's delivery location:
|
||||
if (occupancy >= 3) return int.MaxValue;
|
||||
|
||||
// Prefer refineries with less occupancy (multiplier is to offset distance cost):
|
||||
return occupancy * 12;
|
||||
})
|
||||
);
|
||||
}));
|
||||
|
||||
// Reverse the found-path to find the refinery location instead of our location:
|
||||
path.Reverse();
|
||||
@@ -192,6 +191,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
// I'm blocking someone else from moving to my location:
|
||||
var act = self.GetCurrentActivity();
|
||||
|
||||
// If I'm just waiting around then get out of the way:
|
||||
if (act is Wait)
|
||||
{
|
||||
@@ -319,6 +319,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
// A bot order gives us a CPos.Zero TargetLocation, so find some good resources for him:
|
||||
var loc = FindNextResourceForBot(self);
|
||||
|
||||
// No more resources? Oh well.
|
||||
if (!loc.HasValue)
|
||||
return;
|
||||
@@ -386,6 +387,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
var resType = resLayer.GetResource(loc);
|
||||
|
||||
if (resType == null) return 1;
|
||||
|
||||
// Can the harvester collect this kind of resource?
|
||||
if (!harvInfo.Resources.Contains(resType.Info.Name)) return 1;
|
||||
|
||||
@@ -398,8 +400,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
return 0;
|
||||
})
|
||||
.FromPoint(self.Location)
|
||||
);
|
||||
.FromPoint(self.Location));
|
||||
|
||||
if (path.Count == 0)
|
||||
return (CPos?)null;
|
||||
@@ -459,6 +460,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
return false;
|
||||
|
||||
var location = self.World.Map.CellContaining(target.CenterPosition);
|
||||
|
||||
// Don't leak info about resources under the shroud
|
||||
if (!self.Owner.Shroud.IsExplored(location))
|
||||
return false;
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using System.Drawing;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.Common.Orders;
|
||||
@@ -72,9 +72,11 @@ namespace OpenRA.Mods.RA.Traits
|
||||
if (info.ThumpDamageWeapon != null)
|
||||
{
|
||||
var weapon = self.World.Map.Rules.Weapons[info.ThumpDamageWeapon.ToLowerInvariant()];
|
||||
|
||||
// Use .FromPos since this weapon needs to affect more than just the MadTank actor
|
||||
weapon.Impact(Target.FromPos(self.CenterPosition), self, Enumerable.Empty<int>());
|
||||
}
|
||||
|
||||
screenShaker.AddEffect(info.ThumpShakeTime, self.CenterPosition, info.ThumpShakeIntensity, info.ThumpShakeMultiplier);
|
||||
tick = 0;
|
||||
}
|
||||
@@ -112,9 +114,11 @@ namespace OpenRA.Mods.RA.Traits
|
||||
if (info.DetonationWeapon != null)
|
||||
{
|
||||
var weapon = self.World.Map.Rules.Weapons[info.DetonationWeapon.ToLowerInvariant()];
|
||||
|
||||
// Use .FromPos since this actor is killed. Cannot use Target.FromActor
|
||||
weapon.Impact(Target.FromPos(self.CenterPosition), self, Enumerable.Empty<int>());
|
||||
}
|
||||
|
||||
self.Kill(self);
|
||||
});
|
||||
}
|
||||
@@ -164,7 +168,6 @@ namespace OpenRA.Mods.RA.Traits
|
||||
self.QueueActivity(new MoveAdjacentTo(self, target));
|
||||
self.QueueActivity(new CallFunc(StartDetonationSequence));
|
||||
}
|
||||
|
||||
else if (order.OrderString == "Detonate")
|
||||
{
|
||||
self.CancelActivity();
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Orders;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
TransientActors,
|
||||
BlockedByMovers,
|
||||
All = TransientActors | BlockedByMovers
|
||||
};
|
||||
}
|
||||
|
||||
[Desc("Unit is able to move.")]
|
||||
public class MobileInfo : ITraitInfo, IOccupySpaceInfo, IFacingInfo, IMoveInfo, UsesInit<FacingInit>, UsesInit<LocationInit>, UsesInit<SubCellInit>
|
||||
@@ -159,7 +159,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
if (otherMobile == null) return false;
|
||||
|
||||
// Sign of dot-product indicates (roughly) if vectors are facing in same or opposite directions:
|
||||
var dp = CVec.Dot((selfMobile.toCell - self.Location), (otherMobile.toCell - other.Location));
|
||||
var dp = CVec.Dot(selfMobile.toCell - self.Location, otherMobile.toCell - other.Location);
|
||||
if (dp <= 0) return false;
|
||||
|
||||
return true;
|
||||
@@ -257,8 +257,6 @@ namespace OpenRA.Mods.RA.Traits
|
||||
CPos __fromCell, __toCell;
|
||||
public SubCell fromSubCell, toSubCell;
|
||||
|
||||
//int __altitude;
|
||||
|
||||
[Sync] public int Facing
|
||||
{
|
||||
get { return __facing; }
|
||||
@@ -333,6 +331,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
if (preferred != SubCell.FullCell)
|
||||
return SubCell.FullCell;
|
||||
}
|
||||
|
||||
return preferred;
|
||||
}
|
||||
|
||||
@@ -388,6 +387,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
return new Order("Move", self, queued) { TargetLocation = self.World.Map.CellContaining(target.CenterPosition) };
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Orders;
|
||||
@@ -130,6 +130,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
cursor = "chrono-target";
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -186,8 +187,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
WRange.FromCells(self.Trait<PortableChrono>().Info.MaxDistance),
|
||||
0,
|
||||
Color.FromArgb(128, Color.LawnGreen),
|
||||
Color.FromArgb(96, Color.Black)
|
||||
);
|
||||
Color.FromArgb(96, Color.Black));
|
||||
}
|
||||
|
||||
public string GetCursor(World world, CPos xy, MouseInput mi)
|
||||
|
||||
@@ -261,6 +261,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!canTeleport)
|
||||
{
|
||||
// Check the terrain types. This will allow chronoshifts to occur on empty terrain to terrain of
|
||||
@@ -268,6 +269,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
// chronoshifter of enemy unit presence
|
||||
canTeleport = power.SimilarTerrain(sourceLocation, xy);
|
||||
}
|
||||
|
||||
return canTeleport;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
void RefreshGranted()
|
||||
{
|
||||
Granted = (actors.Count > 0 && Launched);
|
||||
Granted = actors.Count > 0 && Launched;
|
||||
GrantedAllies = owner.World.ActorsWithTrait<GpsWatcher>().Any(p => p.Actor.Owner.IsAlliedWith(owner) && p.Trait.Granted);
|
||||
|
||||
if (Granted || GrantedAllies)
|
||||
|
||||
@@ -13,8 +13,8 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Support;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
|
||||
@@ -27,7 +27,8 @@ namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
public class PathFinder
|
||||
{
|
||||
readonly static List<CPos> emptyPath = new List<CPos>(0);
|
||||
const int MaxPathAge = 50; /* x 40ms ticks */
|
||||
static readonly List<CPos> emptyPath = new List<CPos>(0);
|
||||
|
||||
readonly World world;
|
||||
public PathFinder(World world) { this.world = world; }
|
||||
@@ -42,7 +43,6 @@ namespace OpenRA.Mods.RA.Traits
|
||||
}
|
||||
|
||||
List<CachedPath> CachedPaths = new List<CachedPath>();
|
||||
const int MaxPathAge = 50; /* x 40ms ticks */
|
||||
|
||||
public List<CPos> FindUnitPath(CPos from, CPos target, Actor self)
|
||||
{
|
||||
@@ -75,8 +75,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
.Reverse();
|
||||
var pb = FindBidiPath(
|
||||
fromPoint,
|
||||
fromPointReverse
|
||||
);
|
||||
fromPointReverse);
|
||||
|
||||
CheckSanePath2(pb, from, target);
|
||||
|
||||
@@ -116,8 +115,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
var path = FindBidiPath(
|
||||
PathSearch.FromPoints(world, mi, self, tilesInRange, src, true),
|
||||
PathSearch.FromPoint(world, mi, self, src, targetCell, true).Reverse()
|
||||
);
|
||||
PathSearch.FromPoint(world, mi, self, src, targetCell, true).Reverse());
|
||||
|
||||
return path;
|
||||
}
|
||||
@@ -231,6 +229,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
ret.Add(q);
|
||||
q = ca[q].Path;
|
||||
}
|
||||
|
||||
ret.Add(q);
|
||||
|
||||
ret.Reverse();
|
||||
|
||||
@@ -339,7 +339,6 @@ namespace OpenRA.Mods.RA.Traits
|
||||
result.CopyValuesFrom(defaultCellInfoLayer);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Effects;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Widgets;
|
||||
using OpenRA.Mods.RA.Widgets;
|
||||
using OpenRA.Network;
|
||||
using OpenRA.Widgets;
|
||||
using OpenRA.Mods.Common.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
{
|
||||
|
||||
@@ -46,8 +46,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
tooltipContainer.BeforeRender = () =>
|
||||
{
|
||||
var latencyPrefixSize = latencyPrefix.Bounds.X + latencyPrefixFont.Measure(latencyPrefix.GetText() + " ").X;
|
||||
var width = Math.Max(locationFont.Measure(location.GetText()).X, Math.Max(adminFont.Measure(admin.GetText()).X,
|
||||
Math.Max(addressFont.Measure(ip.GetText()).X, latencyPrefixSize + latencyFont.Measure(latency.GetText()).X)));
|
||||
var width = Math.Max(locationFont.Measure(location.GetText()).X, Math.Max(adminFont.Measure(admin.GetText()).X, Math.Max(addressFont.Measure(ip.GetText()).X, latencyPrefixSize + latencyFont.Measure(latency.GetText()).X)));
|
||||
widget.Bounds.Width = width + 2 * margin;
|
||||
latency.Bounds.Width = widget.Bounds.Width;
|
||||
ip.Bounds.Width = widget.Bounds.Width;
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using OpenRA.Support;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Support;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
|
||||
@@ -77,7 +77,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
dataSuffix = SizeSuffixes[mag];
|
||||
}
|
||||
|
||||
|
||||
progressBar.Indeterminate = false;
|
||||
progressBar.Percentage = i.ProgressPercentage;
|
||||
|
||||
@@ -143,6 +142,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
if (!string.IsNullOrEmpty(line))
|
||||
mirrorList.Add(line);
|
||||
}
|
||||
|
||||
mirror = mirrorList.Random(new MersenneTwister());
|
||||
|
||||
// Save the package to a temp file
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Widgets;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.RA;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
{
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Widgets;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.RA;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
{
|
||||
public enum IngameInfoPanel { AutoSelect, Map, Objectives, Debug };
|
||||
public enum IngameInfoPanel { AutoSelect, Map, Objectives, Debug }
|
||||
|
||||
class GameInfoLogic
|
||||
{
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Widgets;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.RA;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
{
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Mods.Common.Widgets;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.Common.Widgets;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Mods.Common.Widgets;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.Common.Widgets;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
|
||||
@@ -123,6 +123,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
chatScrollPanel = chatChrome.Get<ScrollPanelWidget>("CHAT_SCROLLPANEL");
|
||||
chatTemplate = chatScrollPanel.Get<ContainerWidget>("CHAT_TEMPLATE");
|
||||
chatScrollPanel.RemoveChildren();
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
Game.RunAfterDelay(exitDelay, () => mpe.Fade(MenuPaletteEffect.EffectType.Black));
|
||||
exitDelay += 40 * mpe.Info.FadeLength;
|
||||
}
|
||||
|
||||
Game.RunAfterDelay(exitDelay, () =>
|
||||
{
|
||||
Game.Disconnect();
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
() => client != null && client.Bot == bot));
|
||||
}
|
||||
}
|
||||
|
||||
options.Add(bots.Any() ? "Bots" : "Bots Disabled", bots);
|
||||
|
||||
Func<SlotDropDownOption, ScrollItemWidget, ScrollItemWidget> setupItem = (o, itemTemplate) =>
|
||||
@@ -350,8 +351,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
orderManager.IssueOrders(
|
||||
orderManager.LobbyInfo.Clients.Where(
|
||||
c => c.IsObserver && !c.IsAdmin).Select(
|
||||
client => Order.Command(String.Format("kick {0} {1}", client.Index, client.Name
|
||||
))).ToArray());
|
||||
client => Order.Command("kick {0} {1}".F(client.Index, client.Name))).ToArray());
|
||||
|
||||
after();
|
||||
};
|
||||
@@ -431,8 +431,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
{
|
||||
var dropdown = parent.Get<DropDownButtonWidget>("SPAWN");
|
||||
dropdown.IsDisabled = () => s.LockSpawn || orderManager.LocalClient.IsReady;
|
||||
dropdown.OnMouseDown = _ => ShowSpawnDropDown(dropdown, c, orderManager, Enumerable.Range(0, map.SpawnPoints.Count + 1)
|
||||
.Except(orderManager.LobbyInfo.Clients.Where(client => client != c && client.SpawnPoint != 0).Select(client => client.SpawnPoint)));
|
||||
dropdown.OnMouseDown = _ => ShowSpawnDropDown(dropdown, c, orderManager, Enumerable.Range(0, map.SpawnPoints.Count + 1).Except(orderManager.LobbyInfo.Clients.Where(client => client != c && client.SpawnPoint != 0).Select(client => client.SpawnPoint)));
|
||||
dropdown.GetText = () => (c.SpawnPoint == 0) ? "-" : Convert.ToChar('A' - 1 + c.SpawnPoint).ToString();
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
mapFilter = mapfilterInput.Text = null;
|
||||
EnumerateMaps(onSelect, filter);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
mapfilterInput.OnEnterKey = () => { approving(); return true; };
|
||||
|
||||
@@ -168,8 +168,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
players.Select(p => new LineGraphSeries(
|
||||
p.PlayerName,
|
||||
p.Color.RGB,
|
||||
(p.PlayerActor.TraitOrDefault<PlayerStatistics>() ?? new PlayerStatistics(p.PlayerActor)).EarnedSamples.Select(s => (float)s)
|
||||
));
|
||||
(p.PlayerActor.TraitOrDefault<PlayerStatistics>() ?? new PlayerStatistics(p.PlayerActor)).EarnedSamples.Select(s => (float)s)));
|
||||
|
||||
playerStatsPanel.AddChild(template);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
{
|
||||
public class ServerBrowserLogic
|
||||
{
|
||||
readonly static Action DoNothing = () => { };
|
||||
static readonly Action DoNothing = () => { };
|
||||
|
||||
GameServer currentServer;
|
||||
ScrollItemWidget serverTemplate;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
{
|
||||
{ "initialMap", preview.Uid },
|
||||
{ "onExit", () => { } },
|
||||
{ "onSelect", (Action<String>)(uid => preview = Game.modData.MapCache[uid]) }
|
||||
{ "onSelect", (Action<string>)(uid => preview = Game.modData.MapCache[uid]) }
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -38,4 +38,3 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,4 +79,3 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
suffix = ": ";
|
||||
toComplete = text;
|
||||
}
|
||||
|
||||
candidates = Names.Where(x => x.StartsWith(toComplete, StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
labelText = viewport.ActorTooltip.TooltipInfo.TooltipForPlayerStance(stance);
|
||||
break;
|
||||
}
|
||||
|
||||
case WorldTooltipType.FrozenActor:
|
||||
{
|
||||
o = viewport.FrozenActorTooltip.TooltipOwner;
|
||||
@@ -100,4 +101,3 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var queues = world.ActorsWithTrait<ProductionQueue>()
|
||||
.Where(a => a.Actor.Owner == player)
|
||||
.Select((a, i) => new { a.Trait, i });
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user