Merge pull request #7263 from reaperrr/ra-common26

Moved Armament, Attack, Move, Air features and dependencies to Mods.Common
This commit is contained in:
Matthias Mailänder
2015-01-04 15:33:16 +01:00
113 changed files with 419 additions and 408 deletions

View File

@@ -11,6 +11,7 @@
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Traits;

View File

@@ -12,7 +12,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.RA;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits

View File

@@ -11,10 +11,10 @@
using System.Linq;
using OpenRA.Activities;
using OpenRA.GameRules;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class FallToEarth : Activity
{

View File

@@ -10,10 +10,10 @@
using System.Collections.Generic;
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class Fly : Activity
{

View File

@@ -10,10 +10,10 @@
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class FlyAttack : Activity
{

View File

@@ -9,10 +9,10 @@
#endregion
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class FlyCircle : Activity
{

View File

@@ -9,10 +9,10 @@
#endregion
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class FlyFollow : Activity
{

View File

@@ -9,10 +9,10 @@
#endregion
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class FlyTimed : Activity
{

View File

@@ -9,10 +9,10 @@
#endregion
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class HeliAttack : Activity
{

View File

@@ -10,10 +10,10 @@
using System.Collections.Generic;
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class HeliFly : Activity
{

View File

@@ -11,11 +11,10 @@
using System;
using System.Collections.Generic;
using OpenRA.Activities;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class HeliFlyCircle : Activity
{

View File

@@ -9,9 +9,9 @@
#endregion
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class HeliLand : Activity
{

View File

@@ -10,11 +10,10 @@
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class HeliReturn : Activity
{

View File

@@ -9,10 +9,10 @@
#endregion
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class Land : Activity
{

View File

@@ -12,11 +12,11 @@ using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class ResupplyAircraft : Activity
{

View File

@@ -11,10 +11,10 @@
using System;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class ReturnToBase : Activity
{

View File

@@ -10,10 +10,9 @@
using OpenRA.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class TakeOff : Activity
{

View File

@@ -9,12 +9,10 @@
#endregion
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
/* non-turreted attack */
public class Attack : Activity

View File

@@ -9,10 +9,10 @@
#endregion
using System;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
class EnterTransport : Enter
{

View File

@@ -9,10 +9,10 @@
#endregion
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class Heal : Attack
{

View File

@@ -10,10 +10,10 @@
using System.Collections.Generic;
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class AttackMoveActivity : Activity
{

View File

@@ -9,10 +9,9 @@
#endregion
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class Follow : Activity
{

View File

@@ -13,14 +13,13 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
class Move : Activity
public class Move : Activity
{
static readonly List<CPos> NoPath = new List<CPos>();
@@ -47,7 +46,7 @@ namespace OpenRA.Mods.RA.Activities
getPath = () =>
self.World.WorldActor.Trait<PathFinder>().FindPath(
PathSearch.FromPoint(self.World, mobile.Info, self, mobile.toCell, destination, false)
PathSearch.FromPoint(self.World, mobile.Info, self, mobile.ToCell, destination, false)
.WithoutLaneBias());
this.destination = destination;
this.nearEnough = WRange.Zero;
@@ -63,7 +62,7 @@ namespace OpenRA.Mods.RA.Activities
moveDisablers = self.TraitsImplementing<IDisableMove>();
getPath = () => self.World.WorldActor.Trait<PathFinder>()
.FindUnitPath(mobile.toCell, destination, self);
.FindUnitPath(mobile.ToCell, destination, self);
this.destination = destination;
this.nearEnough = nearEnough;
}
@@ -74,7 +73,7 @@ namespace OpenRA.Mods.RA.Activities
moveDisablers = self.TraitsImplementing<IDisableMove>();
getPath = () => self.World.WorldActor.Trait<PathFinder>()
.FindUnitPathToRange(mobile.fromCell, subCell, self.World.Map.CenterOfSubCell(destination, subCell), nearEnough, self);
.FindUnitPathToRange(mobile.FromCell, subCell, self.World.Map.CenterOfSubCell(destination, subCell), nearEnough, self);
this.destination = destination;
this.nearEnough = nearEnough;
}
@@ -86,7 +85,7 @@ namespace OpenRA.Mods.RA.Activities
getPath = () =>
self.World.WorldActor.Trait<PathFinder>().FindPath(
PathSearch.FromPoint(self.World, mobile.Info, self, mobile.toCell, destination, false)
PathSearch.FromPoint(self.World, mobile.Info, self, mobile.ToCell, destination, false)
.WithIgnoredActor(ignoredActor));
this.destination = destination;
@@ -105,7 +104,7 @@ namespace OpenRA.Mods.RA.Activities
return NoPath;
return self.World.WorldActor.Trait<PathFinder>().FindUnitPathToRange(
mobile.toCell, mobile.toSubCell, target.CenterPosition, range, self);
mobile.ToCell, mobile.ToSubCell, target.CenterPosition, range, self);
};
destination = null;
@@ -135,7 +134,7 @@ namespace OpenRA.Mods.RA.Activities
List<CPos> EvalPath(Actor self, Mobile mobile)
{
var path = getPath().TakeWhile(a => a != mobile.toCell).ToList();
var path = getPath().TakeWhile(a => a != mobile.ToCell).ToList();
mobile.PathHash = HashList(path);
return path;
}
@@ -145,14 +144,14 @@ namespace OpenRA.Mods.RA.Activities
if (moveDisablers.Any(d => d.MoveDisabled(self)))
return this;
if (destination == mobile.toCell)
if (destination == mobile.ToCell)
return NextActivity;
if (path == null)
{
if (mobile.ticksBeforePathing > 0)
if (mobile.TicksBeforePathing > 0)
{
--mobile.ticksBeforePathing;
--mobile.TicksBeforePathing;
return this;
}
@@ -162,7 +161,7 @@ namespace OpenRA.Mods.RA.Activities
if (path.Count == 0)
{
destination = mobile.toCell;
destination = mobile.ToCell;
return this;
}
@@ -172,7 +171,7 @@ namespace OpenRA.Mods.RA.Activities
if (nextCell == null)
return this;
var firstFacing = self.World.Map.FacingBetween(mobile.fromCell, nextCell.Value.First, mobile.Facing);
var firstFacing = self.World.Map.FacingBetween(mobile.FromCell, nextCell.Value.First, mobile.Facing);
if (firstFacing != mobile.Facing)
{
path.Add(nextCell.Value.First);
@@ -180,11 +179,11 @@ namespace OpenRA.Mods.RA.Activities
}
else
{
mobile.SetLocation(mobile.fromCell, mobile.fromSubCell, nextCell.Value.First, nextCell.Value.Second);
mobile.SetLocation(mobile.FromCell, mobile.FromSubCell, nextCell.Value.First, nextCell.Value.Second);
var move = new MoveFirstHalf(
this,
self.World.Map.CenterOfSubCell(mobile.fromCell, mobile.fromSubCell),
Util.BetweenCells(self.World, mobile.fromCell, mobile.toCell) + (self.World.Map.OffsetOfSubCell(mobile.fromSubCell) + self.World.Map.OffsetOfSubCell(mobile.toSubCell)) / 2,
self.World.Map.CenterOfSubCell(mobile.FromCell, mobile.FromSubCell),
Util.BetweenCells(self.World, mobile.FromCell, mobile.ToCell) + (self.World.Map.OffsetOfSubCell(mobile.FromSubCell) + self.World.Map.OffsetOfSubCell(mobile.ToSubCell)) / 2,
mobile.Facing,
mobile.Facing,
0);
@@ -198,7 +197,7 @@ namespace OpenRA.Mods.RA.Activities
{
if (path.Count == 0)
return;
var d = path[path.Count - 1] - mobile.toCell;
var d = path[path.Count - 1] - mobile.ToCell;
if (d.LengthSquared > 2)
throw new InvalidOperationException("(Move) Sanity check failed");
}
@@ -225,7 +224,7 @@ namespace OpenRA.Mods.RA.Activities
{
// Are we close enough?
var cellRange = nearEnough.Range / 1024;
if ((mobile.toCell - destination.Value).LengthSquared <= cellRange * cellRange)
if ((mobile.ToCell - destination.Value).LengthSquared <= cellRange * cellRange)
{
path.Clear();
return null;
@@ -249,9 +248,9 @@ namespace OpenRA.Mods.RA.Activities
if (--waitTicksRemaining >= 0)
return null;
if (mobile.ticksBeforePathing > 0)
if (mobile.TicksBeforePathing > 0)
{
--mobile.ticksBeforePathing;
--mobile.TicksBeforePathing;
return null;
}
@@ -291,42 +290,42 @@ namespace OpenRA.Mods.RA.Activities
abstract class MovePart : Activity
{
protected readonly Move move;
protected readonly WPos from, to;
protected readonly int fromFacing, toFacing;
protected readonly int moveFractionTotal;
protected readonly Move Move;
protected readonly WPos From, To;
protected readonly int FromFacing, ToFacing;
protected readonly int MoveFractionTotal;
protected int moveFraction;
public MovePart(Move move, WPos from, WPos to, int fromFacing, int toFacing, int startingFraction)
{
this.move = move;
this.from = from;
this.to = to;
this.fromFacing = fromFacing;
this.toFacing = toFacing;
this.moveFraction = startingFraction;
this.moveFractionTotal = (to - from).Length;
Move = move;
From = from;
To = to;
FromFacing = fromFacing;
ToFacing = toFacing;
moveFraction = startingFraction;
MoveFractionTotal = (to - from).Length;
}
public override void Cancel(Actor self)
{
move.Cancel(self);
Move.Cancel(self);
base.Cancel(self);
}
public override void Queue(Activity activity)
{
move.Queue(activity);
Move.Queue(activity);
}
public override Activity Tick(Actor self)
{
var mobile = self.Trait<Mobile>();
var ret = InnerTick(self, move.mobile);
var ret = InnerTick(self, Move.mobile);
mobile.IsMoving = ret is MovePart;
if (moveFraction > moveFractionTotal)
moveFraction = moveFractionTotal;
if (moveFraction > MoveFractionTotal)
moveFraction = MoveFractionTotal;
UpdateCenterLocation(self, mobile);
return ret;
@@ -334,36 +333,36 @@ namespace OpenRA.Mods.RA.Activities
Activity InnerTick(Actor self, Mobile mobile)
{
moveFraction += mobile.MovementSpeedForCell(self, mobile.toCell);
if (moveFraction <= moveFractionTotal)
moveFraction += mobile.MovementSpeedForCell(self, mobile.ToCell);
if (moveFraction <= MoveFractionTotal)
return this;
var next = OnComplete(self, mobile, move);
var next = OnComplete(self, mobile, Move);
if (next != null)
return next;
return move;
return Move;
}
void UpdateCenterLocation(Actor self, Mobile mobile)
{
// avoid division through zero
if (moveFractionTotal != 0)
mobile.SetVisualPosition(self, WPos.Lerp(from, to, moveFraction, moveFractionTotal));
if (MoveFractionTotal != 0)
mobile.SetVisualPosition(self, WPos.Lerp(From, To, moveFraction, MoveFractionTotal));
else
mobile.SetVisualPosition(self, to);
mobile.SetVisualPosition(self, To);
if (moveFraction >= moveFractionTotal)
mobile.Facing = toFacing & 0xFF;
if (moveFraction >= MoveFractionTotal)
mobile.Facing = ToFacing & 0xFF;
else
mobile.Facing = int2.Lerp(fromFacing, toFacing, moveFraction, moveFractionTotal) & 0xFF;
mobile.Facing = int2.Lerp(FromFacing, ToFacing, moveFraction, MoveFractionTotal) & 0xFF;
}
protected abstract MovePart OnComplete(Actor self, Mobile mobile, Move parent);
public override IEnumerable<Target> GetTargets(Actor self)
{
return move.GetTargets(self);
return Move.GetTargets(self);
}
}
@@ -374,14 +373,14 @@ namespace OpenRA.Mods.RA.Activities
static bool IsTurn(Mobile mobile, CPos nextCell)
{
return nextCell - mobile.toCell !=
mobile.toCell - mobile.fromCell;
return nextCell - mobile.ToCell !=
mobile.ToCell - mobile.FromCell;
}
protected override MovePart OnComplete(Actor self, Mobile mobile, Move parent)
{
var fromSubcellOffset = self.World.Map.OffsetOfSubCell(mobile.fromSubCell);
var toSubcellOffset = self.World.Map.OffsetOfSubCell(mobile.toSubCell);
var fromSubcellOffset = self.World.Map.OffsetOfSubCell(mobile.FromSubCell);
var toSubcellOffset = self.World.Map.OffsetOfSubCell(mobile.ToSubCell);
var nextCell = parent.PopPath(self, mobile);
if (nextCell != null)
@@ -390,15 +389,15 @@ namespace OpenRA.Mods.RA.Activities
{
var nextSubcellOffset = self.World.Map.OffsetOfSubCell(nextCell.Value.Second);
var ret = new MoveFirstHalf(
move,
Util.BetweenCells(self.World, mobile.fromCell, mobile.toCell) + (fromSubcellOffset + toSubcellOffset) / 2,
Util.BetweenCells(self.World, mobile.toCell, nextCell.Value.First) + (toSubcellOffset + nextSubcellOffset) / 2,
Move,
Util.BetweenCells(self.World, mobile.FromCell, mobile.ToCell) + (fromSubcellOffset + toSubcellOffset) / 2,
Util.BetweenCells(self.World, mobile.ToCell, nextCell.Value.First) + (toSubcellOffset + nextSubcellOffset) / 2,
mobile.Facing,
Util.GetNearestFacing(mobile.Facing, self.World.Map.FacingBetween(mobile.toCell, nextCell.Value.First, mobile.Facing)),
moveFraction - moveFractionTotal);
Util.GetNearestFacing(mobile.Facing, self.World.Map.FacingBetween(mobile.ToCell, nextCell.Value.First, mobile.Facing)),
moveFraction - MoveFractionTotal);
mobile.FinishedMoving(self);
mobile.SetLocation(mobile.toCell, mobile.toSubCell, nextCell.Value.First, nextCell.Value.Second);
mobile.SetLocation(mobile.ToCell, mobile.ToSubCell, nextCell.Value.First, nextCell.Value.Second);
return ret;
}
@@ -406,15 +405,15 @@ namespace OpenRA.Mods.RA.Activities
}
var ret2 = new MoveSecondHalf(
move,
Util.BetweenCells(self.World, mobile.fromCell, mobile.toCell) + (fromSubcellOffset + toSubcellOffset) / 2,
self.World.Map.CenterOfCell(mobile.toCell) + toSubcellOffset,
Move,
Util.BetweenCells(self.World, mobile.FromCell, mobile.ToCell) + (fromSubcellOffset + toSubcellOffset) / 2,
self.World.Map.CenterOfCell(mobile.ToCell) + toSubcellOffset,
mobile.Facing,
mobile.Facing,
moveFraction - moveFractionTotal);
moveFraction - MoveFractionTotal);
mobile.EnteringCell(self);
mobile.SetLocation(mobile.toCell, mobile.toSubCell, mobile.toCell, mobile.toSubCell);
mobile.SetLocation(mobile.ToCell, mobile.ToSubCell, mobile.ToCell, mobile.ToSubCell);
return ret2;
}
}
@@ -426,7 +425,7 @@ namespace OpenRA.Mods.RA.Activities
protected override MovePart OnComplete(Actor self, Mobile mobile, Move parent)
{
mobile.SetPosition(self, mobile.toCell);
mobile.SetPosition(self, mobile.ToCell);
return null;
}
}
@@ -443,7 +442,7 @@ namespace OpenRA.Mods.RA.Activities
// HACK: Dirty, but it suffices until we do something better:
if (a.GetType() == typeof(Move)) return true;
if (a.GetType() == typeof(MoveAdjacentTo)) return true;
if (a.GetType() == typeof(AttackMove)) return true;
if (a.GetType() == typeof(AttackMoveActivity)) return true;
// Not a move:
return false;

View File

@@ -12,10 +12,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class MoveAdjacentTo : Activity
{
@@ -26,14 +26,14 @@ namespace OpenRA.Mods.RA.Activities
readonly DomainIndex domainIndex;
readonly uint movementClass;
protected Target target { get; private set; }
protected Target Target { get; private set; }
protected CPos targetPosition;
Activity inner;
bool repath;
public MoveAdjacentTo(Actor self, Target target)
{
this.target = target;
Target = target;
mobile = self.Trait<Mobile>();
pathFinder = self.World.WorldActor.Trait<PathFinder>();
@@ -58,12 +58,12 @@ namespace OpenRA.Mods.RA.Activities
protected virtual IEnumerable<CPos> CandidateMovementCells(Actor self)
{
return Util.AdjacentCells(self.World, target);
return Util.AdjacentCells(self.World, Target);
}
public override Activity Tick(Actor self)
{
var targetIsValid = target.IsValidFor(self);
var targetIsValid = Target.IsValidFor(self);
// Inner move order has completed.
if (inner == null)
@@ -82,7 +82,7 @@ namespace OpenRA.Mods.RA.Activities
{
// Check if the target has moved
var oldTargetPosition = targetPosition;
targetPosition = self.World.Map.CellContaining(target.CenterPosition);
targetPosition = self.World.Map.CellContaining(Target.CenterPosition);
var shouldStop = ShouldStop(self, oldTargetPosition);
if (shouldStop || (!repath && ShouldRepath(self, oldTargetPosition)))
@@ -97,7 +97,7 @@ namespace OpenRA.Mods.RA.Activities
else
{
// Target became invalid. Move to its last known position.
target = Target.FromCell(self.World, targetPosition);
Target = Target.FromCell(self.World, targetPosition);
}
// Ticks the inner move activity to actually move the actor.

View File

@@ -11,10 +11,10 @@
using System.Collections.Generic;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class MoveWithinRange : MoveAdjacentTo
{
@@ -33,13 +33,13 @@ namespace OpenRA.Mods.RA.Activities
// We are now in range. Don't move any further!
// HACK: This works around the pathfinder not returning the shortest path
var cp = self.CenterPosition;
return target.IsInRange(cp, maxRange) && !target.IsInRange(cp, minRange);
return Target.IsInRange(cp, maxRange) && !Target.IsInRange(cp, minRange);
}
protected override bool ShouldRepath(Actor self, CPos oldTargetPosition)
{
var cp = self.CenterPosition;
return targetPosition != oldTargetPosition && (!target.IsInRange(cp, maxRange) || target.IsInRange(cp, minRange));
return targetPosition != oldTargetPosition && (!Target.IsInRange(cp, maxRange) || Target.IsInRange(cp, minRange));
}
protected override IEnumerable<CPos> CandidateMovementCells(Actor self)
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.RA.Activities
var outerSq = maxRange.Range * maxRange.Range;
var innerSq = minRange.Range * minRange.Range;
var center = target.CenterPosition;
var center = Target.CenterPosition;
return map.FindTilesInAnnulus(targetPosition, minCells + 1, maxCells).Where(c =>
{

View File

@@ -11,10 +11,9 @@
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class Rearm : Activity
{

View File

@@ -11,10 +11,9 @@
using System;
using OpenRA.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class Repair : Activity
{

View File

@@ -12,12 +12,11 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
namespace OpenRA.Mods.Common.Activities
{
public class UnloadCargo : Activity
{

View File

@@ -56,12 +56,38 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Activities\Air\FallToEarth.cs" />
<Compile Include="Activities\Air\Fly.cs" />
<Compile Include="Activities\Air\FlyAttack.cs" />
<Compile Include="Activities\Air\FlyCircle.cs" />
<Compile Include="Activities\Air\FlyFollow.cs" />
<Compile Include="Activities\Air\FlyTimed.cs" />
<Compile Include="Activities\Air\HeliAttack.cs" />
<Compile Include="Activities\Air\HeliFly.cs" />
<Compile Include="Activities\Air\HeliFlyCircle.cs" />
<Compile Include="Activities\Air\HeliLand.cs" />
<Compile Include="Activities\Air\HeliReturn.cs" />
<Compile Include="Activities\Air\Land.cs" />
<Compile Include="Activities\Air\ResupplyAircraft.cs" />
<Compile Include="Activities\Air\ReturnToBase.cs" />
<Compile Include="Activities\Air\TakeOff.cs" />
<Compile Include="Activities\Attack.cs" />
<Compile Include="Activities\Enter.cs" />
<Compile Include="Activities\EnterTransport.cs" />
<Compile Include="Activities\Heal.cs" />
<Compile Include="Activities\Move\AttackMoveActivity.cs" />
<Compile Include="Activities\Move\Drag.cs" />
<Compile Include="Activities\Move\Follow.cs" />
<Compile Include="Activities\Move\Move.cs" />
<Compile Include="Activities\Move\MoveAdjacentTo.cs" />
<Compile Include="Activities\Move\MoveWithinRange.cs" />
<Compile Include="Activities\Rearm.cs" />
<Compile Include="Activities\RemoveSelf.cs" />
<Compile Include="Activities\Repair.cs" />
<Compile Include="Activities\RepairBuilding.cs" />
<Compile Include="Activities\SimpleTeleport.cs" />
<Compile Include="Activities\Turn.cs" />
<Compile Include="Activities\UnloadCargo.cs" />
<Compile Include="Activities\Wait.cs" />
<Compile Include="ActorExts.cs" />
<Compile Include="Effects\Beacon.cs" />
@@ -121,7 +147,28 @@
<Compile Include="Scripting\Properties\ResourceProperties.cs" />
<Compile Include="Scripting\Properties\UpgradeProperties.cs" />
<Compile Include="TraitsInterfaces.cs" />
<Compile Include="Traits\Air\Aircraft.cs" />
<Compile Include="Traits\Air\AttackBomber.cs" />
<Compile Include="Traits\Air\AttackHeli.cs" />
<Compile Include="Traits\Air\AttackPlane.cs" />
<Compile Include="Traits\Air\FlyAwayOnIdle.cs" />
<Compile Include="Traits\Air\FallsToEarth.cs" />
<Compile Include="Traits\Air\Helicopter.cs" />
<Compile Include="Traits\Air\Plane.cs" />
<Compile Include="Traits\Air\ReturnOnIdle.cs" />
<Compile Include="Traits\AppearsOnRadar.cs" />
<Compile Include="Traits\Armament.cs" />
<Compile Include="Traits\AttackMove.cs" />
<Compile Include="Traits\Attack\AttackBase.cs" />
<Compile Include="Traits\Attack\AttackCharge.cs" />
<Compile Include="Traits\Attack\AttackFollow.cs" />
<Compile Include="Traits\Attack\AttackFrontal.cs" />
<Compile Include="Traits\Attack\AttackMedic.cs" />
<Compile Include="Traits\Attack\AttackOmni.cs" />
<Compile Include="Traits\Attack\AttackTurreted.cs" />
<Compile Include="Traits\Attack\AttackWander.cs" />
<Compile Include="Traits\AutoHeal.cs" />
<Compile Include="Traits\AutoTarget.cs" />
<Compile Include="Traits\BlocksBullets.cs" />
<Compile Include="Traits\Buildable.cs" />
<Compile Include="Traits\Buildings\BaseBuilding.cs" />
@@ -131,13 +178,17 @@
<Compile Include="Traits\Buildings\BuildingInfluence.cs" />
<Compile Include="Traits\Buildings\BuildingUtils.cs" />
<Compile Include="Traits\Buildings\DeadBuildingState.cs" />
<Compile Include="Traits\Buildings\Exit.cs" />
<Compile Include="Traits\Buildings\FreeActor.cs" />
<Compile Include="Traits\Buildings\LineBuild.cs" />
<Compile Include="Traits\Buildings\LineBuildNode.cs" />
<Compile Include="Traits\Buildings\RallyPoint.cs" />
<Compile Include="Traits\Buildings\RepairsUnits.cs" />
<Compile Include="Traits\Buildings\Reservable.cs" />
<Compile Include="Traits\Buildings\FootprintUtils.cs" />
<Compile Include="Traits\Burns.cs" />
<Compile Include="Traits\Cargo.cs" />
<Compile Include="Traits\Cloak.cs" />
<Compile Include="Traits\IgnoresDisguise.cs" />
<Compile Include="Traits\DetectCloaked.cs" />
<Compile Include="Traits\EngineerRepair.cs" />
@@ -153,11 +204,14 @@
<Compile Include="Traits\Immobile.cs" />
<Compile Include="Traits\JamsMissiles.cs" />
<Compile Include="Traits\KillsSelf.cs" />
<Compile Include="Traits\LimitedAmmo.cs" />
<Compile Include="Traits\Mobile.cs" />
<Compile Include="Traits\Modifiers\DisabledOverlay.cs" />
<Compile Include="Traits\Modifiers\FrozenUnderFog.cs" />
<Compile Include="Traits\Modifiers\HiddenUnderFog.cs" />
<Compile Include="Traits\Modifiers\UpgradeOverlay.cs" />
<Compile Include="Traits\MustBeDestroyed.cs" />
<Compile Include="Traits\Passenger.cs" />
<Compile Include="Traits\PaletteEffects\CloakPaletteEffect.cs" />
<Compile Include="Traits\PaletteEffects\LightPaletteRotator.cs" />
<Compile Include="Traits\PaletteEffects\MenuPaletteEffect.cs" />
@@ -181,7 +235,11 @@
<Compile Include="Traits\Power\ScalePowerWithHealth.cs" />
<Compile Include="Traits\ProvidesRadar.cs" />
<Compile Include="Traits\RadarColorFromTerrain.cs" />
<Compile Include="Traits\Reloads.cs" />
<Compile Include="Traits\Render\Hovers.cs" />
<Compile Include="Traits\Render\RenderBuilding.cs" />
<Compile Include="Traits\Render\RenderBuildingCharge.cs" />
<Compile Include="Traits\Render\RenderBuildingTurreted.cs" />
<Compile Include="Traits\Render\RenderEditorOnly.cs" />
<Compile Include="Traits\Render\RenderFlare.cs" />
<Compile Include="Traits\Render\RenderNameTag.cs" />
@@ -189,15 +247,18 @@
<Compile Include="Traits\Render\RenderSprites.cs" />
<Compile Include="Traits\Render\RenderUnit.cs" />
<Compile Include="Traits\Render\TimedUpgradeBar.cs" />
<Compile Include="Traits\Render\WithBarrel.cs" />
<Compile Include="Traits\Render\WithBuildingPlacedAnimation.cs" />
<Compile Include="Traits\Render\WithMakeAnimation.cs" />
<Compile Include="Traits\Render\WithCrateBody.cs" />
<Compile Include="Traits\Render\WithDeathAnimation.cs" />
<Compile Include="Traits\Render\WithHarvestAnimation.cs" />
<Compile Include="Traits\Render\WithMuzzleFlash.cs" />
<Compile Include="Traits\Render\WithResources.cs" />
<Compile Include="Traits\Render\WithRotor.cs" />
<Compile Include="Traits\Render\WithShadow.cs" />
<Compile Include="Traits\Render\WithSmoke.cs" />
<Compile Include="Traits\Render\WithTurret.cs" />
<Compile Include="Traits\ShakeOnDeath.cs" />
<Compile Include="Traits\SmokeTrailWhenDamaged.cs" />
<Compile Include="Traits\Sound\ActorLostNotification.cs" />
@@ -206,16 +267,22 @@
<Compile Include="Traits\Sound\DeathSounds.cs" />
<Compile Include="Traits\Sound\SoundOnDamageTransition.cs" />
<Compile Include="Traits\Tooltip.cs" />
<Compile Include="Traits\Turreted.cs" />
<Compile Include="Traits\Upgrades\UpgradableTrait.cs" />
<Compile Include="Traits\Upgrades\UpgradeManager.cs" />
<Compile Include="Traits\Valued.cs" />
<Compile Include="Traits\Wanders.cs" />
<Compile Include="Traits\World\CreateMPPlayers.cs" />
<Compile Include="Traits\World\DomainIndex.cs" />
<Compile Include="Traits\World\LoadWidgetAtGameStart.cs" />
<Compile Include="Traits\World\MPStartLocations.cs" />
<Compile Include="Traits\World\MPStartUnits.cs" />
<Compile Include="Traits\World\PaletteFromCurrentTileset.cs" />
<Compile Include="Traits\World\PaletteFromFile.cs" />
<Compile Include="Traits\World\PaletteFromRGBA.cs" />
<Compile Include="Traits\World\PathFinder.cs" />
<Compile Include="Traits\World\PathfinderDebugOverlay.cs" />
<Compile Include="Traits\World\PathSearch.cs" />
<Compile Include="Traits\World\PlayerPaletteFromCurrentTileset.cs" />
<Compile Include="Traits\World\PlayMusicOnMapLoad.cs" />
<Compile Include="Traits\World\RadarPings.cs" />

View File

@@ -12,14 +12,12 @@ using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Orders;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
public class AircraftInfo : ITraitInfo, IFacingInfo, IOccupySpaceInfo, ICruiseAltitudeInfo, UsesInit<LocationInit>, UsesInit<FacingInit>
{

View File

@@ -11,12 +11,11 @@
using System;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.RA;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
class AttackBomberInfo : AttackBaseInfo
public class AttackBomberInfo : AttackBaseInfo
{
[Desc("Armament name")]
public readonly string Bombs = "primary";
@@ -28,7 +27,7 @@ namespace OpenRA.Mods.RA.Traits
public override object Create(ActorInitializer init) { return new AttackBomber(init.self, this); }
}
class AttackBomber : AttackBase, ITick, ISync, INotifyRemovedFromWorld
public class AttackBomber : AttackBase, ITick, ISync, INotifyRemovedFromWorld
{
AttackBomberInfo info;
[Sync] Target target;

View File

@@ -9,18 +9,17 @@
#endregion
using OpenRA.Activities;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
class AttackHeliInfo : AttackFrontalInfo
public class AttackHeliInfo : AttackFrontalInfo
{
public override object Create(ActorInitializer init) { return new AttackHeli(init.self, this); }
}
class AttackHeli : AttackFrontal
public class AttackHeli : AttackFrontal
{
public AttackHeli(Actor self, AttackHeliInfo info)
: base(self, info) { }

View File

@@ -9,18 +9,17 @@
#endregion
using OpenRA.Activities;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
class AttackPlaneInfo : AttackFrontalInfo
public class AttackPlaneInfo : AttackFrontalInfo
{
public override object Create(ActorInitializer init) { return new AttackPlane(init.self, this); }
}
class AttackPlane : AttackFrontal
public class AttackPlane : AttackFrontal
{
public AttackPlane(Actor self, AttackPlaneInfo info)
: base(self, info) { }

View File

@@ -10,11 +10,10 @@
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Causes aircraft husks that are spawned in the air to crash to the ground.")]
public class FallsToEarthInfo : ITraitInfo

View File

@@ -9,11 +9,9 @@
#endregion
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Leave the map when idle.")]
class FlyAwayOnIdleInfo : TraitInfo<FlyAwayOnIdle> { }

View File

@@ -14,11 +14,9 @@ using System.Drawing;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
public class HelicopterInfo : AircraftInfo, IMoveInfo
{

View File

@@ -12,11 +12,9 @@ using System;
using System.Drawing;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
public class PlaneInfo : AircraftInfo, IMoveInfo
{

View File

@@ -10,11 +10,9 @@
using System.Linq;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Return to a player owned RearmBuildings. If none available, head back to base and circle over it.")]
class ReturnOnIdleInfo : TraitInfo<ReturnOnIdle> { }

View File

@@ -12,11 +12,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
public class Barrel
{
@@ -62,9 +61,9 @@ namespace OpenRA.Mods.RA.Traits
public readonly WeaponInfo Weapon;
public readonly Barrel[] Barrels;
public readonly Actor self;
Lazy<Turreted> Turret;
Lazy<IBodyOrientation> Coords;
readonly Actor self;
Lazy<Turreted> turret;
Lazy<IBodyOrientation> coords;
Lazy<LimitedAmmo> limitedAmmo;
List<Pair<int, Action>> delayedActions = new List<Pair<int, Action>>();
@@ -78,8 +77,8 @@ namespace OpenRA.Mods.RA.Traits
this.self = self;
// We can't resolve these until runtime
Turret = Exts.Lazy(() => self.TraitsImplementing<Turreted>().FirstOrDefault(t => t.Name == info.Turret));
Coords = Exts.Lazy(() => self.Trait<IBodyOrientation>());
turret = Exts.Lazy(() => self.TraitsImplementing<Turreted>().FirstOrDefault(t => t.Name == info.Turret));
coords = Exts.Lazy(() => self.Trait<IBodyOrientation>());
limitedAmmo = Exts.Lazy(() => self.TraitOrDefault<LimitedAmmo>());
Weapon = self.World.Map.Rules.Weapons[info.Weapon.ToLowerInvariant()];
@@ -206,23 +205,23 @@ namespace OpenRA.Mods.RA.Traits
public WVec MuzzleOffset(Actor self, Barrel b)
{
var bodyOrientation = Coords.Value.QuantizeOrientation(self, self.Orientation);
var bodyOrientation = coords.Value.QuantizeOrientation(self, self.Orientation);
var localOffset = b.Offset + new WVec(-Recoil, WRange.Zero, WRange.Zero);
if (Turret.Value != null)
if (turret.Value != null)
{
var turretOrientation = Coords.Value.QuantizeOrientation(self, Turret.Value.LocalOrientation(self));
var turretOrientation = coords.Value.QuantizeOrientation(self, turret.Value.LocalOrientation(self));
localOffset = localOffset.Rotate(turretOrientation);
localOffset += Turret.Value.Offset;
localOffset += turret.Value.Offset;
}
return Coords.Value.LocalToWorld(localOffset.Rotate(bodyOrientation));
return coords.Value.LocalToWorld(localOffset.Rotate(bodyOrientation));
}
public WRot MuzzleOrientation(Actor self, Barrel b)
{
var orientation = self.Orientation + WRot.FromYaw(b.Yaw);
if (Turret.Value != null)
orientation += Turret.Value.LocalOrientation(self);
if (turret.Value != null)
orientation += turret.Value.LocalOrientation(self);
return orientation;
}

View File

@@ -15,10 +15,9 @@ using System.Linq;
using OpenRA.Activities;
using OpenRA.GameRules;
using OpenRA.Mods.Common;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
public abstract class AttackBaseInfo : ITraitInfo
{

View File

@@ -12,7 +12,7 @@ using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Charges up before being able to attack.")]
class AttackChargeInfo : AttackOmniInfo

View File

@@ -12,7 +12,7 @@ using System;
using OpenRA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Actor will follow units until in range to attack them.")]
public class AttackFollowInfo : AttackBaseInfo

View File

@@ -12,7 +12,7 @@ using System;
using OpenRA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Unit got to face the target")]
public class AttackFrontalInfo : AttackBaseInfo, Requires<IFacingInfo>

View File

@@ -11,7 +11,7 @@
using OpenRA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Give the unit a \"heal-weapon\" that attacks friendly targets if they are damaged.",
"It conflicts with any other weapon or Attack*: trait because it will hurt friendlies during the",

View File

@@ -11,7 +11,7 @@
using OpenRA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
class AttackOmniInfo : AttackBaseInfo
{

View File

@@ -12,7 +12,7 @@ using System.Collections.Generic;
using OpenRA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Actor has a visual turret used to attack.")]
public class AttackTurretedInfo : AttackFollowInfo, Requires<TurretedInfo>

View File

@@ -10,7 +10,7 @@
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Will AttackMove to a random location within MoveRadius when idle.",
"This conflicts with player orders and should only be added to animal creeps.")]

View File

@@ -10,10 +10,10 @@
using System.Collections.Generic;
using System.Drawing;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Provides access to the attack-move command, which will make the actor automatically engage viable targets while moving to the destination.")]
class AttackMoveInfo : ITraitInfo

View File

@@ -9,10 +9,9 @@
#endregion
using System.Linq;
using OpenRA.Mods.Common;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Used together with AttackMedic: to make the healer do it's job automatically to nearby units.")]
class AutoHealInfo : TraitInfo<AutoHeal>, Requires<AttackBaseInfo> { }

View File

@@ -10,10 +10,9 @@
using System.Drawing;
using System.Linq;
using OpenRA.Mods.Common;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("The actor will automatically engage the enemy when it is in range.")]
public class AutoTargetInfo : ITraitInfo, Requires<AttackBaseInfo>

View File

@@ -0,0 +1,32 @@
#region Copyright & License Information
/*
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System.Collections.Generic;
using OpenRA.Mods.Common.Effects;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Where the unit should leave the building. Multiples are allowed if IDs are added: Exit@2, ...")]
public class ExitInfo : TraitInfo<Exit>
{
[Desc("Offset at which that the exiting actor is spawned")]
public readonly WVec SpawnOffset = WVec.Zero;
[Desc("Cell offset where the exiting actor enters the ActorMap")]
public readonly CVec ExitCell = CVec.Zero;
public readonly int Facing = -1;
[Desc("AttackMove to a RallyPoint or stay where you are spawned.")]
public readonly bool MoveIntoWorld = true;
}
public class Exit { }
}

View File

@@ -12,7 +12,7 @@ using System;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Reserve landing places for aircraft.")]
class ReservableInfo : TraitInfo<Reservable> { }

View File

@@ -11,14 +11,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Mods.Common.Activities;
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
namespace OpenRA.Mods.Common.Traits
{
[Desc("This actor can transport Passenger actors.")]
public class CargoInfo : ITraitInfo, Requires<IOccupySpaceInfo>

View File

@@ -13,10 +13,9 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("This unit can cloak and uncloak in specific situations.")]
public class CloakInfo : UpgradableTraitInfo, ITraitInfo

View File

@@ -12,7 +12,7 @@ using System.Collections.Generic;
using System.Linq;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Actor has a limited amount of ammo, after using it all the actor must reload in some way.")]
public class LimitedAmmoInfo : ITraitInfo
@@ -34,19 +34,19 @@ namespace OpenRA.Mods.RA.Traits
public class LimitedAmmo : INotifyAttack, IPips, ISync
{
[Sync] int ammo;
LimitedAmmoInfo Info;
LimitedAmmoInfo info;
public LimitedAmmo(LimitedAmmoInfo info)
{
ammo = info.Ammo;
Info = info;
this.info = info;
}
public bool FullAmmo() { return ammo == Info.Ammo; }
public bool FullAmmo() { return ammo == info.Ammo; }
public bool HasAmmo() { return ammo > 0; }
public bool GiveAmmo()
{
if (ammo >= Info.Ammo) return false;
if (ammo >= info.Ammo) return false;
++ammo;
return true;
}
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.RA.Traits
return true;
}
public int ReloadTimePerAmmo() { return Info.ReloadTicks; }
public int ReloadTimePerAmmo() { return info.ReloadTicks; }
public void Attacking(Actor self, Target target, Armament a, Barrel barrel) { TakeAmmo(); }
@@ -66,10 +66,10 @@ namespace OpenRA.Mods.RA.Traits
public IEnumerable<PipType> GetPips(Actor self)
{
var pips = Info.PipCount != 0 ? Info.PipCount : Info.Ammo;
var pips = info.PipCount != 0 ? info.PipCount : info.Ammo;
return Enumerable.Range(0, pips).Select(i =>
(ammo * pips) / Info.Ammo > i ?
Info.PipType : Info.PipTypeEmpty);
(ammo * pips) / info.Ammo > i ?
info.PipType : info.PipTypeEmpty);
}
}
}

View File

@@ -15,11 +15,10 @@ using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.RA.Activities;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Flags]
public enum CellConditions
@@ -160,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;
@@ -250,60 +249,60 @@ namespace OpenRA.Mods.RA.Traits
public class Mobile : IIssueOrder, IResolveOrder, IOrderVoice, IPositionable, IMove, IFacing, ISync, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyBlockingMove
{
public readonly Actor self;
const int AverageTicksBeforePathing = 5;
const int SpreadTicksBeforePathing = 5;
internal int TicksBeforePathing = 0;
readonly Actor self;
public readonly MobileInfo Info;
public bool IsMoving { get; set; }
int __facing;
CPos __fromCell, __toCell;
public SubCell fromSubCell, toSubCell;
int facing;
CPos fromCell, toCell;
public SubCell FromSubCell, ToSubCell;
[Sync] public int Facing
{
get { return __facing; }
set { __facing = value; }
get { return facing; }
set { facing = value; }
}
public int ROT { get { return Info.ROT; } }
[Sync] public WPos CenterPosition { get; private set; }
[Sync] public CPos fromCell { get { return __fromCell; } }
[Sync] public CPos toCell { get { return __toCell; } }
[Sync] public CPos FromCell { get { return fromCell; } }
[Sync] public CPos ToCell { get { return toCell; } }
[Sync] public int PathHash; // written by Move.EvalPath, to temporarily debug this crap.
public void SetLocation(CPos from, SubCell fromSub, CPos to, SubCell toSub)
{
if (fromCell == from && toCell == to && fromSubCell == fromSub && toSubCell == toSub)
if (FromCell == from && ToCell == to && FromSubCell == fromSub && ToSubCell == toSub)
return;
RemoveInfluence();
__fromCell = from;
__toCell = to;
fromSubCell = fromSub;
toSubCell = toSub;
fromCell = from;
toCell = to;
FromSubCell = fromSub;
ToSubCell = toSub;
AddInfluence();
}
const int avgTicksBeforePathing = 5;
const int spreadTicksBeforePathing = 5;
internal int ticksBeforePathing = 0;
public Mobile(ActorInitializer init, MobileInfo info)
{
this.self = init.self;
this.Info = info;
self = init.self;
Info = info;
toSubCell = fromSubCell = info.SharesCell ? init.world.Map.DefaultSubCell : SubCell.FullCell;
ToSubCell = FromSubCell = info.SharesCell ? init.world.Map.DefaultSubCell : SubCell.FullCell;
if (init.Contains<SubCellInit>())
{
this.fromSubCell = this.toSubCell = init.Get<SubCellInit, SubCell>();
this.FromSubCell = this.ToSubCell = init.Get<SubCellInit, SubCell>();
}
if (init.Contains<LocationInit>())
{
this.__fromCell = this.__toCell = init.Get<LocationInit, CPos>();
SetVisualPosition(self, init.world.Map.CenterOfSubCell(fromCell, fromSubCell));
this.fromCell = this.toCell = init.Get<LocationInit, CPos>();
SetVisualPosition(self, init.world.Map.CenterOfSubCell(FromCell, FromSubCell));
}
this.Facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : info.InitialFacing;
@@ -319,7 +318,7 @@ namespace OpenRA.Mods.RA.Traits
{
// Try same sub-cell
if (preferred == SubCell.Any)
preferred = fromSubCell;
preferred = FromSubCell;
// Fix sub-cell assignment
if (Info.SharesCell)
@@ -347,7 +346,7 @@ namespace OpenRA.Mods.RA.Traits
public void SetPosition(Actor self, WPos pos)
{
var cell = self.World.Map.CellContaining(pos);
SetLocation(cell, fromSubCell, cell, fromSubCell);
SetLocation(cell, FromSubCell, cell, FromSubCell);
SetVisualPosition(self, pos);
FinishedMoving(self);
}
@@ -436,7 +435,7 @@ namespace OpenRA.Mods.RA.Traits
if (!queued) self.CancelActivity();
ticksBeforePathing = avgTicksBeforePathing + self.World.SharedRandom.Next(-spreadTicksBeforePathing, spreadTicksBeforePathing);
TicksBeforePathing = AverageTicksBeforePathing + self.World.SharedRandom.Next(-SpreadTicksBeforePathing, SpreadTicksBeforePathing);
self.QueueActivity(new Move(self, currentLocation, 8));
@@ -482,21 +481,21 @@ namespace OpenRA.Mods.RA.Traits
}
}
public CPos TopLeft { get { return toCell; } }
public CPos TopLeft { get { return ToCell; } }
public IEnumerable<Pair<CPos, SubCell>> OccupiedCells()
{
if (fromCell == toCell)
return new[] { Pair.New(fromCell, fromSubCell) };
if (CanEnterCell(toCell))
return new[] { Pair.New(toCell, toSubCell) };
return new[] { Pair.New(fromCell, fromSubCell), Pair.New(toCell, toSubCell) };
if (FromCell == ToCell)
return new[] { Pair.New(FromCell, FromSubCell) };
if (CanEnterCell(ToCell))
return new[] { Pair.New(ToCell, ToSubCell) };
return new[] { Pair.New(FromCell, FromSubCell), Pair.New(ToCell, ToSubCell) };
}
public bool IsLeavingCell(CPos location, SubCell subCell = SubCell.Any)
{
return toCell != location && __fromCell == location
&& (subCell == SubCell.Any || fromSubCell == subCell || subCell == SubCell.FullCell || fromSubCell == SubCell.FullCell);
return ToCell != location && fromCell == location
&& (subCell == SubCell.Any || FromSubCell == subCell || subCell == SubCell.FullCell || FromSubCell == SubCell.FullCell);
}
public SubCell GetAvailableSubCell(CPos a, SubCell preferredSubCell = SubCell.Any, Actor ignoreActor = null, bool checkTransientActors = true)
@@ -511,7 +510,7 @@ namespace OpenRA.Mods.RA.Traits
public void EnteringCell(Actor self)
{
var crushables = self.World.ActorMap.GetUnitsAt(toCell).Where(a => a != self)
var crushables = self.World.ActorMap.GetUnitsAt(ToCell).Where(a => a != self)
.SelectMany(a => a.TraitsImplementing<ICrushable>().Where(b => b.CrushableBy(Info.Crushes, self.Owner)));
foreach (var crushable in crushables)
crushable.WarnCrush(self);
@@ -519,7 +518,7 @@ namespace OpenRA.Mods.RA.Traits
public void FinishedMoving(Actor self)
{
var crushables = self.World.ActorMap.GetUnitsAt(toCell).Where(a => a != self)
var crushables = self.World.ActorMap.GetUnitsAt(ToCell).Where(a => a != self)
.SelectMany(a => a.TraitsImplementing<ICrushable>().Where(c => c.CrushableBy(Info.Crushes, self.Owner)));
foreach (var crushable in crushables)
crushable.OnCrush(self);
@@ -572,11 +571,11 @@ namespace OpenRA.Mods.RA.Traits
for (var i = -1; i < 2; i++)
for (var j = -1; j < 2; j++)
{
var p = toCell + new CVec(i, j);
var p = ToCell + new CVec(i, j);
if (CanEnterCell(p))
availCells.Add(p);
else
if (p != nudger.Location && p != toCell)
if (p != nudger.Location && p != ToCell)
notStupidCells.Add(p);
}

View File

@@ -12,11 +12,11 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Orders;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
namespace OpenRA.Mods.Common.Traits
{
public enum AlternateTransportsMode { None, Force, Default, Always }

View File

@@ -10,7 +10,7 @@
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Unit will reload its limited ammo itself.")]
public class ReloadsInfo : ITraitInfo, Requires<LimitedAmmoInfo>
@@ -28,13 +28,13 @@ namespace OpenRA.Mods.RA.Traits
public class Reloads : ITick
{
[Sync] int remainingTicks;
ReloadsInfo Info;
ReloadsInfo info;
LimitedAmmo la;
int previousAmmo;
public Reloads(Actor self, ReloadsInfo info)
{
Info = info;
this.info = info;
remainingTicks = info.Period;
la = self.Trait<LimitedAmmo>();
previousAmmo = la.GetAmmoCount();
@@ -44,18 +44,18 @@ namespace OpenRA.Mods.RA.Traits
{
if (!la.FullAmmo() && --remainingTicks == 0)
{
remainingTicks = Info.Period;
remainingTicks = info.Period;
for (var i = 0; i < Info.Count; i++)
for (var i = 0; i < info.Count; i++)
la.GiveAmmo();
previousAmmo = la.GetAmmoCount();
}
// Resets the tick counter if ammo was fired.
if (Info.ResetOnFire && la.GetAmmoCount() < previousAmmo)
if (info.ResetOnFire && la.GetAmmoCount() < previousAmmo)
{
remainingTicks = Info.Period;
remainingTicks = info.Period;
previousAmmo = la.GetAmmoCount();
}
}

View File

@@ -12,10 +12,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Changes the visual Z position periodically.")]
class HoversInfo : ITraitInfo, Requires<IMoveInfo>

View File

@@ -8,9 +8,7 @@
*/
#endregion
using OpenRA.Mods.Common.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Used for tesla coil and obelisk.")]
public class RenderBuildingChargeInfo : RenderBuildingInfo

View File

@@ -13,10 +13,9 @@ using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
class RenderBuildingTurretedInfo : RenderBuildingInfo, Requires<TurretedInfo>
{

View File

@@ -12,10 +12,9 @@ using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Renders barrels for units with the Turreted trait.")]
class WithBarrelInfo : ITraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<IBodyOrientationInfo>

View File

@@ -12,10 +12,9 @@ using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Renders the MuzzleSequence from the Armament trait.")]
class WithMuzzleFlashInfo : ITraitInfo, Requires<RenderSpritesInfo>, Requires<AttackBaseInfo>, Requires<ArmamentInfo>

View File

@@ -12,13 +12,12 @@ using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Renders turrets for units with the Turreted trait.")]
class WithTurretInfo : ITraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<TurretedInfo>, Requires<IBodyOrientationInfo>
public class WithTurretInfo : ITraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<TurretedInfo>, Requires<IBodyOrientationInfo>
{
[Desc("Sequence name to use")]
public readonly string Sequence = "turret";
@@ -49,7 +48,7 @@ namespace OpenRA.Mods.RA.Traits
}
}
class WithTurret : ITick
public class WithTurret : ITick
{
WithTurretInfo info;
RenderSprites rs;

View File

@@ -11,7 +11,7 @@
using System;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
public class TurretedInfo : ITraitInfo, UsesInit<TurretFacingInit>
{

View File

@@ -11,7 +11,7 @@
using System;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Wanders around aimlessly while idle.")]
abstract class WandersInfo : ITraitInfo

View File

@@ -16,7 +16,7 @@ using OpenRA.Graphics;
using OpenRA.Support;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Identify untraversable regions of the map for faster pathfinding, especially with AI.",
"This trait is required. Every mod needs it attached to the world actor.")]

View File

@@ -17,7 +17,7 @@ using OpenRA.Primitives;
using OpenRA.Support;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Calculates routes for mobile units based on the A* search algorithm.", " Attach this to the world actor.")]
public class PathFinderInfo : ITraitInfo
@@ -28,33 +28,33 @@ namespace OpenRA.Mods.RA.Traits
public class PathFinder
{
const int MaxPathAge = 50; /* x 40ms ticks */
static readonly List<CPos> emptyPath = new List<CPos>(0);
static readonly List<CPos> EmptyPath = new List<CPos>(0);
readonly World world;
public PathFinder(World world) { this.world = world; }
class CachedPath
{
public CPos from;
public CPos to;
public List<CPos> result;
public int tick;
public Actor actor;
public CPos From;
public CPos To;
public List<CPos> Result;
public int Tick;
public Actor Actor;
}
List<CachedPath> CachedPaths = new List<CachedPath>();
List<CachedPath> cachedPaths = new List<CachedPath>();
public List<CPos> FindUnitPath(CPos from, CPos target, Actor self)
{
using (new PerfSample("Pathfinder"))
{
var cached = CachedPaths.FirstOrDefault(p => p.from == from && p.to == target && p.actor == self);
var cached = cachedPaths.FirstOrDefault(p => p.From == from && p.To == target && p.Actor == self);
if (cached != null)
{
Log.Write("debug", "Actor {0} asked for a path from {1} tick(s) ago", self.ActorID, world.WorldTick - cached.tick);
if (world.WorldTick - cached.tick > MaxPathAge)
CachedPaths.Remove(cached);
return new List<CPos>(cached.result);
Log.Write("debug", "Actor {0} asked for a path from {1} tick(s) ago", self.ActorID, world.WorldTick - cached.Tick);
if (world.WorldTick - cached.Tick > MaxPathAge)
cachedPaths.Remove(cached);
return new List<CPos>(cached.Result);
}
var mi = self.Info.Traits.Get<MobileInfo>();
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.RA.Traits
{
var passable = mi.GetMovementClass(world.TileSet);
if (!domainIndex.IsPassable(from, target, (uint)passable))
return emptyPath;
return EmptyPath;
}
var fromPoint = PathSearch.FromPoint(world, mi, self, target, from, true)
@@ -79,8 +79,8 @@ namespace OpenRA.Mods.RA.Traits
CheckSanePath2(pb, from, target);
CachedPaths.RemoveAll(p => world.WorldTick - p.tick > MaxPathAge);
CachedPaths.Add(new CachedPath { from = from, to = target, actor = self, result = pb, tick = world.WorldTick });
cachedPaths.RemoveAll(p => world.WorldTick - p.Tick > MaxPathAge);
cachedPaths.Add(new CachedPath { From = from, To = target, Actor = self, Result = pb, Tick = world.WorldTick });
return new List<CPos>(pb);
}
}
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.RA.Traits
var passable = mi.GetMovementClass(world.TileSet);
tilesInRange = new List<CPos>(tilesInRange.Where(t => domainIndex.IsPassable(src, t, (uint)passable)));
if (!tilesInRange.Any())
return emptyPath;
return EmptyPath;
}
var path = FindBidiPath(
@@ -148,7 +148,7 @@ namespace OpenRA.Mods.RA.Traits
}
// no path exists
return emptyPath;
return EmptyPath;
}
}
@@ -212,7 +212,7 @@ namespace OpenRA.Mods.RA.Traits
return path;
}
return emptyPath;
return EmptyPath;
}
}

View File

@@ -15,7 +15,7 @@ using System.Linq;
using OpenRA;
using OpenRA.Primitives;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
public sealed class PathSearch : IDisposable
{
@@ -143,7 +143,7 @@ namespace OpenRA.Mods.RA.Traits
// For horizontal/vertical directions, the set is the three cells 'ahead'. For diagonal directions, the set
// is the three cells ahead, plus the two cells to the side, which we cannot exclude without knowing if
// the cell directly between them and our parent is passable.
static CVec[][] DirectedNeighbors = {
static CVec[][] directedNeighbors = {
new CVec[] { new CVec(-1, -1), new CVec(0, -1), new CVec(1, -1), new CVec(-1, 0), new CVec(-1, 1) },
new CVec[] { new CVec(-1, -1), new CVec(0, -1), new CVec(1, -1) },
new CVec[] { new CVec(-1, -1), new CVec(0, -1), new CVec(1, -1), new CVec(1, 0), new CVec(1, 1) },
@@ -161,7 +161,7 @@ namespace OpenRA.Mods.RA.Traits
var dy = p.Y - prev.Y;
var index = dy * 3 + dx + 4;
return DirectedNeighbors[index];
return directedNeighbors[index];
}
public CPos Expand(World world)
@@ -285,7 +285,7 @@ namespace OpenRA.Mods.RA.Traits
}
static readonly Queue<CellLayer<CellInfo>> CellInfoPool = new Queue<CellLayer<CellInfo>>();
static readonly object defaultCellInfoLayerSync = new object();
static readonly object DefaultCellInfoLayerSync = new object();
static CellLayer<CellInfo> defaultCellInfoLayer;
static CellLayer<CellInfo> GetFromPool()
@@ -325,7 +325,7 @@ namespace OpenRA.Mods.RA.Traits
if (result == null)
result = new CellLayer<CellInfo>(map);
lock (defaultCellInfoLayerSync)
lock (DefaultCellInfoLayerSync)
{
if (defaultCellInfoLayer == null ||
defaultCellInfoLayer.Size != mapSize ||

View File

@@ -16,11 +16,11 @@ using OpenRA.Graphics;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits
namespace OpenRA.Mods.Common.Traits
{
[Desc("Required for the A* PathDebug from DeveloperMode. Attach this to the world actor.")]
class PathfinderDebugOverlayInfo : TraitInfo<PathfinderDebugOverlay> { }
class PathfinderDebugOverlay : IRenderOverlay, IWorldLoaded
public class PathfinderDebugOverlayInfo : TraitInfo<PathfinderDebugOverlay> { }
public class PathfinderDebugOverlay : IRenderOverlay, IWorldLoaded
{
Dictionary<Player, CellLayer<int>> layers;
int refreshTick;

View File

@@ -26,6 +26,7 @@ namespace OpenRA.Mods.Common.Traits
IEnumerable<IRenderable> Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition);
}
public interface INotifyAttack { void Attacking(Actor self, Target target, Armament a, Barrel barrel); }
public interface INotifyChat { bool OnChat(string from, string message); }
public interface INotifyParachuteLanded { void OnLanded(); }
public interface IRenderActorPreviewInfo { IEnumerable<IActorPreview> RenderPreview(ActorPreviewInitializer init); }

View File

@@ -10,9 +10,9 @@
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.D2k.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.D2k.Activities

View File

@@ -8,8 +8,8 @@
*/
#endregion
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.D2k.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.D2k.Traits

View File

@@ -11,10 +11,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.D2k.Activities;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Linq;
using AI.Fuzzy.Library;
using OpenRA.GameRules;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;

View File

@@ -10,6 +10,8 @@
using System.Collections.Generic;
using System.Linq;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;

View File

@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Traits;

View File

@@ -12,8 +12,9 @@ using System.Collections.Generic;
using System.Linq;
using OpenRA.Effects;
using OpenRA.Mods.Common.Activities;
using OpenRA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
{

View File

@@ -10,6 +10,8 @@
using OpenRA.Activities;
using OpenRA.Effects;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;
@@ -37,9 +39,9 @@ namespace OpenRA.Mods.RA.Activities
}
var mobile = self.Trait<Mobile>();
var nearest = target.Actor.OccupiesSpace.NearestCellTo(mobile.toCell);
var nearest = target.Actor.OccupiesSpace.NearestCellTo(mobile.ToCell);
if ((nearest - mobile.toCell).LengthSquared > 2)
if ((nearest - mobile.ToCell).LengthSquared > 2)
return Util.SequenceActivities(new MoveAdjacentTo(self, target), this);
if (!capturable.CaptureInProgress)

View File

@@ -11,6 +11,7 @@
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Primitives;
using OpenRA.Traits;

View File

@@ -12,6 +12,7 @@ using System;
using System.Linq;
using OpenRA.Activities;
using OpenRA.GameRules;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;
@@ -37,11 +38,11 @@ namespace OpenRA.Mods.RA.Activities
this.weapon = weapon;
this.angle = angle;
mobile = self.Trait<Mobile>();
mobile.SetLocation(mobile.fromCell, mobile.fromSubCell, targetMobile.fromCell, targetMobile.fromSubCell);
mobile.SetLocation(mobile.FromCell, mobile.FromSubCell, targetMobile.FromCell, targetMobile.FromSubCell);
mobile.IsMoving = true;
from = self.CenterPosition;
to = self.World.Map.CenterOfSubCell(targetMobile.fromCell, targetMobile.fromSubCell);
to = self.World.Map.CenterOfSubCell(targetMobile.FromCell, targetMobile.FromSubCell);
length = Math.Max((to - from).Length / speed.Range, 1);
self.Trait<RenderInfantry>().Attacking(self, Target.FromActor(target));
@@ -58,11 +59,11 @@ namespace OpenRA.Mods.RA.Activities
mobile.SetVisualPosition(self, WPos.LerpQuadratic(from, to, angle, ++ticks, length));
if (ticks >= length)
{
mobile.SetLocation(mobile.toCell, mobile.toSubCell, mobile.toCell, mobile.toSubCell);
mobile.SetLocation(mobile.ToCell, mobile.ToSubCell, mobile.ToCell, mobile.ToSubCell);
mobile.FinishedMoving(self);
mobile.IsMoving = false;
self.World.ActorMap.GetUnitsAt(mobile.toCell, mobile.toSubCell)
self.World.ActorMap.GetUnitsAt(mobile.ToCell, mobile.ToSubCell)
.Except(new[] { self }).Where(t => weapon.IsValidAgainst(t, self))
.Do(t => t.Kill(self));

View File

@@ -12,6 +12,7 @@ using System;
using System.Drawing;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Effects;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits;

View File

@@ -8,6 +8,7 @@
*/
#endregion
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Effects;
using OpenRA.Primitives;
using OpenRA.Traits;

View File

@@ -13,6 +13,7 @@ using System.Drawing;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.Common;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;

View File

@@ -79,51 +79,26 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Activities\CaptureActor.cs" />
<Compile Include="Traits\Wanders.cs" />
<Compile Include="Activities\Hunt.cs" />
<Compile Include="Activities\Air\FallToEarth.cs" />
<Compile Include="Activities\Air\Fly.cs" />
<Compile Include="Activities\Air\FlyAttack.cs" />
<Compile Include="Activities\Air\FlyCircle.cs" />
<Compile Include="Activities\Air\FlyFollow.cs" />
<Compile Include="Activities\Air\FlyTimed.cs" />
<Compile Include="Activities\Air\HeliAttack.cs" />
<Compile Include="Activities\Air\HeliFly.cs" />
<Compile Include="Activities\Air\HeliLand.cs" />
<Compile Include="Activities\Air\HeliReturn.cs" />
<Compile Include="Activities\Air\Land.cs" />
<Compile Include="Activities\Air\ResupplyAircraft.cs" />
<Compile Include="Activities\Air\ReturnToBase.cs" />
<Compile Include="Activities\Air\TakeOff.cs" />
<Compile Include="AI\AttackOrFleeFuzzy.cs" />
<Compile Include="AI\BaseBuilder.cs" />
<Compile Include="AI\HackyAI.cs" />
<Compile Include="Player\AllyRepair.cs" />
<Compile Include="Render\WithIdleOverlay.cs" />
<Compile Include="Traits\AcceptsSupplies.cs" />
<Compile Include="Activities\Attack.cs" />
<Compile Include="Activities\AttackMoveActivity.cs" />
<Compile Include="Activities\ExternalCaptureActor.cs" />
<Compile Include="Activities\DeliverResources.cs" />
<Compile Include="Activities\Demolish.cs" />
<Compile Include="Activities\DonateSupplies.cs" />
<Compile Include="Activities\EnterTransport.cs" />
<Compile Include="Activities\FindResources.cs" />
<Compile Include="Activities\Follow.cs" />
<Compile Include="Activities\Heal.cs" />
<Compile Include="Activities\Infiltrate.cs" />
<Compile Include="Activities\LayMines.cs" />
<Compile Include="Activities\Leap.cs" />
<Compile Include="Activities\MoveAdjacentTo.cs" />
<Compile Include="Activities\RAHarvesterDockSequence.cs" />
<Compile Include="Activities\Rearm.cs" />
<Compile Include="Activities\Repair.cs" />
<Compile Include="Activities\Sell.cs" />
<Compile Include="Activities\Teleport.cs" />
<Compile Include="Activities\Transform.cs" />
<Compile Include="Activities\UnloadCargo.cs" />
<Compile Include="AI\SupportPowerDecision.cs" />
<Compile Include="Attack\AttackTurreted.cs" />
<Compile Include="Crushable.cs" />
<Compile Include="Effects\GpsSatellite.cs" />
<Compile Include="Effects\SatelliteLaunch.cs" />
@@ -133,16 +108,7 @@
<Compile Include="EjectOnDeath.cs" />
<Compile Include="AI\RushFuzzy.cs" />
<Compile Include="AI\StateMachine.cs" />
<Compile Include="Traits\AttackMove.cs" />
<Compile Include="Attack\AttackBase.cs" />
<Compile Include="Attack\AttackFrontal.cs" />
<Compile Include="Traits\Attack\AttackLeap.cs" />
<Compile Include="Attack\AttackMedic.cs" />
<Compile Include="Attack\AttackOmni.cs" />
<Compile Include="Attack\AttackCharge.cs" />
<Compile Include="Attack\AttackWander.cs" />
<Compile Include="AutoHeal.cs" />
<Compile Include="AutoTarget.cs" />
<Compile Include="CaptureNotification.cs" />
<Compile Include="Scripting\Properties\RepairableBuildingProperties.cs" />
<Compile Include="C4Demolition.cs" />
@@ -150,7 +116,6 @@
<Compile Include="ExternalCapturableBar.cs" />
<Compile Include="Capturable.cs" />
<Compile Include="ExternalCaptures.cs" />
<Compile Include="Cargo.cs" />
<Compile Include="CashTrickler.cs" />
<Compile Include="Traits\PaletteEffects\ChronoshiftPaletteEffect.cs" />
<Compile Include="Traits\Chronoshiftable.cs" />
@@ -177,7 +142,6 @@
<Compile Include="Guard.cs" />
<Compile Include="Invulnerable.cs" />
<Compile Include="Captures.cs" />
<Compile Include="LimitedAmmo.cs" />
<Compile Include="Lint\CheckActorReferences.cs" />
<Compile Include="Lint\CheckSyncAnnotations.cs" />
<Compile Include="Lint\CheckTraitPrerequisites.cs" />
@@ -185,35 +149,25 @@
<Compile Include="Traits\MadTank.cs" />
<Compile Include="Traits\Mine.cs" />
<Compile Include="Traits\Minelayer.cs" />
<Compile Include="Traits\Mobile.cs" />
<Compile Include="Activities\Move.cs" />
<Compile Include="Traits\SeedsResource.cs" />
<Compile Include="Traits\World\PathFinder.cs" />
<Compile Include="Traits\World\PathSearch.cs" />
<Compile Include="Orders\PlaceBuildingOrderGenerator.cs" />
<Compile Include="Orders\GlobalButtonOrderGenerator.cs" />
<Compile Include="Orders\RepairOrderGenerator.cs" />
<Compile Include="ParaDrop.cs" />
<Compile Include="Passenger.cs" />
<Compile Include="Player\ClassicProductionQueue.cs" />
<Compile Include="Player\PlaceBuilding.cs" />
<Compile Include="Player\ProductionQueue.cs" />
<Compile Include="Traits\PortableChrono.cs" />
<Compile Include="Scripting\Properties\GuardProperties.cs" />
<Compile Include="Traits\World\DomainIndex.cs" />
<Compile Include="Turreted.cs" />
<Compile Include="Widgets\Logic\TabCompletionLogic.cs" />
<Compile Include="Production.cs" />
<Compile Include="ProductionBar.cs" />
<Compile Include="ProximityCaptor.cs" />
<Compile Include="ProximityCapturable.cs" />
<Compile Include="Reloads.cs" />
<Compile Include="RenderDetectionCircle.cs" />
<Compile Include="RenderJammerCircle.cs" />
<Compile Include="RenderRangeCircle.cs" />
<Compile Include="Render\RenderBuildingCharge.cs" />
<Compile Include="Render\RenderBuildingSilo.cs" />
<Compile Include="Render\RenderBuildingTurreted.cs" />
<Compile Include="Render\RenderBuildingWall.cs" />
<Compile Include="Render\RenderBuildingWarFactory.cs" />
<Compile Include="Render\RenderHarvester.cs" />
@@ -221,7 +175,6 @@
<Compile Include="Render\RenderDisguise.cs" />
<Compile Include="Render\RenderLandingCraft.cs" />
<Compile Include="Render\WithBuildingExplosion.cs" />
<Compile Include="Render\WithMuzzleFlash.cs" />
<Compile Include="Repairable.cs" />
<Compile Include="RepairableNear.cs" />
<Compile Include="ScaredyCat.cs" />
@@ -242,15 +195,6 @@
<Compile Include="TakeCover.cs" />
<Compile Include="ThrowsParticle.cs" />
<Compile Include="TraitsInterfaces.cs" />
<Compile Include="Traits\Air\Aircraft.cs" />
<Compile Include="Traits\Air\AttackBomber.cs" />
<Compile Include="Traits\Air\AttackHeli.cs" />
<Compile Include="Traits\Air\AttackPlane.cs" />
<Compile Include="Traits\Air\FlyAwayOnIdle.cs" />
<Compile Include="Traits\Air\FallsToEarth.cs" />
<Compile Include="Traits\Air\Helicopter.cs" />
<Compile Include="Traits\Air\Plane.cs" />
<Compile Include="Traits\Air\ReturnOnIdle.cs" />
<Compile Include="Traits\Air\TargetableAircraft.cs" />
<Compile Include="Traits\Buildings\Bridge.cs" />
<Compile Include="Traits\Buildings\BridgeHut.cs" />
@@ -258,9 +202,7 @@
<Compile Include="Traits\Buildings\OreRefinery.cs" />
<Compile Include="Traits\Buildings\PrimaryBuilding.cs" />
<Compile Include="Traits\Buildings\RepairableBuilding.cs" />
<Compile Include="Traits\Buildings\Reservable.cs" />
<Compile Include="Traits\Buildings\TargetableBuilding.cs" />
<Compile Include="Traits\Cloak.cs" />
<Compile Include="Traits\Harvester.cs" />
<Compile Include="Traits\HarvesterHuskModifier.cs" />
<Compile Include="Traits\LeavesHusk.cs" />
@@ -268,7 +210,6 @@
<Compile Include="Traits\TargetableSubmarine.cs" />
<Compile Include="Traits\TargetableUnit.cs" />
<Compile Include="Traits\World\BridgeLayer.cs" />
<Compile Include="Traits\World\PathfinderDebugOverlay.cs" />
<Compile Include="TransformOnCapture.cs" />
<Compile Include="TransformOnPassenger.cs" />
<Compile Include="Transforms.cs" />
@@ -309,14 +250,11 @@
<Compile Include="Traits\Infiltration\InfiltrateForPowerOutage.cs" />
<Compile Include="Traits\Infiltration\InfiltrateForSupportPower.cs" />
<Compile Include="Traits\Infiltration\Infiltrates.cs" />
<Compile Include="Armament.cs" />
<Compile Include="Widgets\Logic\ObserverShroudSelectorLogic.cs" />
<Compile Include="Activities\RepairBridge.cs" />
<Compile Include="Lint\CheckSequences.cs" />
<Compile Include="Widgets\Logic\SpawnSelectorTooltipLogic.cs" />
<Compile Include="Widgets\Logic\ClientTooltipLogic.cs" />
<Compile Include="Render\WithTurret.cs" />
<Compile Include="Render\WithBarrel.cs" />
<Compile Include="Widgets\Logic\CreditsLogic.cs" />
<Compile Include="Widgets\Logic\SimpleTooltipLogic.cs" />
<Compile Include="Widgets\Logic\WorldTooltipLogic.cs" />
@@ -329,8 +267,7 @@
<Compile Include="CombatDebugOverlay.cs" />
<Compile Include="Widgets\Logic\GameTimerLogic.cs" />
<Compile Include="Widgets\Logic\ReplayControlBarLogic.cs" />
<Compile Include="Attack\AttackFollow.cs" />
<Compile Include="Attack\AttackGarrisoned.cs" />
<Compile Include="Traits\Attack\AttackGarrisoned.cs" />
<Compile Include="Widgets\Logic\LobbyMapPreviewLogic.cs" />
<Compile Include="Orders\BeaconOrderGenerator.cs" />
<Compile Include="Widgets\Logic\ControlGroupLogic.cs" />
@@ -345,7 +282,6 @@
<Compile Include="Scripting\Properties\ChronosphereProperties.cs" />
<Compile Include="Render\WithRepairAnimation.cs" />
<Compile Include="Render\WithRepairOverlay.cs" />
<Compile Include="Activities\MoveWithinRange.cs" />
<Compile Include="Lint\CheckPlayers.cs" />
<Compile Include="Lint\CheckActors.cs" />
<Compile Include="Lint\CheckMapCordon.cs" />
@@ -387,8 +323,6 @@
<Compile Include="UtilityCommands\ExportCharacterSeparatedRules.cs" />
<Compile Include="UtilityCommands\Extensions.cs" />
<Compile Include="Lint\CheckMapRules.cs" />
<Compile Include="Activities\Air\HeliFlyCircle.cs" />
<Compile Include="Render\Hovers.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">

View File

@@ -10,6 +10,7 @@
using System;
using System.Collections.Generic;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Effects;
using OpenRA.Mods.RA.Traits;

View File

@@ -12,6 +12,7 @@ using System;
using System.Drawing;
using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Primitives;
@@ -28,22 +29,6 @@ namespace OpenRA.Mods.RA.Traits
public virtual object Create(ActorInitializer init) { return new Production(this, init.self); }
}
[Desc("Where the unit should leave the building. Multiples are allowed if IDs are added: Exit@2, ...")]
public class ExitInfo : TraitInfo<Exit>
{
[Desc("Offset at which that the exiting actor is spawned")]
public readonly WVec SpawnOffset = WVec.Zero;
[Desc("Cell offset where the exiting actor enters the ActorMap")]
public readonly CVec ExitCell = CVec.Zero;
public readonly int Facing = -1;
[Desc("AttackMove to a RallyPoint or stay where you are spawned.")]
public readonly bool MoveIntoWorld = true;
}
public class Exit { }
public class Production
{
Lazy<RallyPoint> rp;

View File

@@ -11,9 +11,9 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Orders;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits

View File

@@ -8,6 +8,7 @@
*/
#endregion
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits

View File

@@ -16,6 +16,7 @@ using OpenRA;
using OpenRA.Activities;
using OpenRA.Effects;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Primitives;

View File

@@ -13,8 +13,8 @@ using System.Linq;
using Eluant;
using OpenRA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Scripting;
using OpenRA.Traits;

View File

@@ -10,6 +10,7 @@
using Eluant;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Scripting;

View File

@@ -8,7 +8,8 @@
*/
#endregion
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Scripting;
using OpenRA.Traits;

View File

@@ -8,6 +8,8 @@
*/
#endregion
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Scripting;
@@ -45,7 +47,7 @@ namespace OpenRA.Mods.RA.Scripting
[Desc("Moves from outside the world into the cell grid")]
public void MoveIntoWorld(CPos cell)
{
self.QueueActivity(mobile.MoveIntoWorld(self, cell, mobile.toSubCell));
self.QueueActivity(mobile.MoveIntoWorld(self, cell, mobile.ToSubCell));
}
[ScriptActorPropertyActivity]

View File

@@ -8,7 +8,8 @@
*/
#endregion
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Scripting;
using OpenRA.Traits;

View File

@@ -11,6 +11,7 @@
using System;
using System.Linq;
using Eluant;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Scripting;

View File

@@ -10,8 +10,7 @@
using System.Linq;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.Common.Traits;
using OpenRA.Scripting;
using OpenRA.Traits;

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Linq;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Primitives;
using OpenRA.Traits;

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Linq;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities;
using OpenRA.Primitives;
using OpenRA.Traits;

View File

@@ -9,6 +9,7 @@
#endregion
using OpenRA.GameRules;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Traits

Some files were not shown because too many files have changed in this diff Show More