Simplify return statements.

Remove redundant ‘this’.
Remove unused using directives.
Simplify LINQ chains.
Add some trait property descriptions.
Add readonly where viable.
Add fullstops to some yaml descriptions.
This commit is contained in:
Taryn Hill
2015-04-01 11:16:04 -05:00
parent 14e9cfd433
commit 4ed53c5952
54 changed files with 59 additions and 109 deletions

View File

@@ -15,8 +15,8 @@ namespace OpenRA
{ {
public class Group public class Group
{ {
Actor[] actors; readonly Actor[] actors;
int id; readonly int id;
static int nextGroup; static int nextGroup;

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Traits
public class CreatesShroud : ITick, ISync public class CreatesShroud : ITick, ISync
{ {
CreatesShroudInfo info; readonly CreatesShroudInfo info;
[Sync] CPos cachedLocation; [Sync] CPos cachedLocation;
[Sync] bool cachedDisabled; [Sync] bool cachedDisabled;

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Traits
public class DebugPauseState : ISync public class DebugPauseState : ISync
{ {
World world; readonly World world;
[Sync] public bool Paused { get { return world.Paused; } } [Sync] public bool Paused { get { return world.Paused; } }
public DebugPauseState(World world) { this.world = world; } public DebugPauseState(World world) { this.world = world; }
} }

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Traits
public void SetTarget(Actor self, Target target, Color c, bool display) public void SetTarget(Actor self, Target target, Color c, bool display)
{ {
this.targets = new List<Target> { target }; targets = new List<Target> { target };
this.c = c; this.c = c;
if (display) if (display)

View File

@@ -110,7 +110,7 @@ namespace OpenRA.Traits
if (IsDead) if (IsDead)
return; return;
var oldState = this.DamageState; var oldState = DamageState;
// Apply any damage modifiers // Apply any damage modifiers
if (!ignoreModifiers && damage > 0) if (!ignoreModifiers && damage > 0)
@@ -128,7 +128,7 @@ namespace OpenRA.Traits
{ {
Attacker = attacker, Attacker = attacker,
Damage = damage, Damage = damage,
DamageState = this.DamageState, DamageState = DamageState,
PreviousDamageState = oldState, PreviousDamageState = oldState,
Warhead = warhead, Warhead = warhead,
}; };

View File

@@ -12,7 +12,7 @@ using System;
namespace OpenRA.Traits namespace OpenRA.Traits
{ {
/* attributes used by RALint to understand the rules */ /* attributes used by OpenRA.Lint to understand the rules */
[AttributeUsage(AttributeTargets.Field)] [AttributeUsage(AttributeTargets.Field)]
public sealed class ActorReferenceAttribute : Attribute { } public sealed class ActorReferenceAttribute : Attribute { }

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Traits
public class RevealsShroud : ITick, ISync public class RevealsShroud : ITick, ISync
{ {
RevealsShroudInfo info; readonly RevealsShroudInfo info;
[Sync] CPos cachedLocation; [Sync] CPos cachedLocation;
public RevealsShroud(RevealsShroudInfo info) public RevealsShroud(RevealsShroudInfo info)

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Traits
public class Selectable : IPostRenderSelection public class Selectable : IPostRenderSelection
{ {
public SelectableInfo Info; public SelectableInfo Info;
Actor self; readonly Actor self;
public Selectable(Actor self, SelectableInfo info) public Selectable(Actor self, SelectableInfo info)
{ {

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Traits
static readonly string[] TagStrings = { "", "tag-fake", "tag-primary" }; static readonly string[] TagStrings = { "", "tag-fake", "tag-primary" };
public SelectionDecorationsInfo Info; public SelectionDecorationsInfo Info;
Actor self; readonly Actor self;
public SelectionDecorations(Actor self, SelectionDecorationsInfo info) public SelectionDecorations(Actor self, SelectionDecorationsInfo info)
{ {

View File

@@ -13,7 +13,6 @@ using System.Linq;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.RA;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Effects namespace OpenRA.Mods.Cnc.Effects

View File

@@ -9,11 +9,8 @@
#endregion #endregion
using System.Linq; using System.Linq;
using OpenRA.Activities;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits namespace OpenRA.Mods.Cnc.Traits
@@ -35,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Traits
{ {
enum PopupState { Open, Rotating, Transitioning, Closed } enum PopupState { Open, Rotating, Transitioning, Closed }
AttackPopupTurretedInfo info; readonly AttackPopupTurretedInfo info;
RenderBuilding rb; RenderBuilding rb;
int idleTicks = 0; int idleTicks = 0;
@@ -72,10 +69,7 @@ namespace OpenRA.Mods.Cnc.Traits
return false; return false;
} }
if (!turret.FaceTarget(self, target)) return turret.FaceTarget(self, target);
return false;
return true;
} }
public void TickIdle(Actor self) public void TickIdle(Actor self)

View File

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

View File

@@ -11,8 +11,6 @@
using System.Linq; using System.Linq;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits namespace OpenRA.Mods.Cnc.Traits

View File

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

View File

@@ -9,7 +9,6 @@
#endregion #endregion
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits namespace OpenRA.Mods.Cnc.Traits
@@ -26,8 +25,8 @@ namespace OpenRA.Mods.Cnc.Traits
public class WithDeliveryAnimation : INotifyDelivery public class WithDeliveryAnimation : INotifyDelivery
{ {
WithDeliveryAnimationInfo info; readonly WithDeliveryAnimationInfo info;
RenderBuilding building; readonly RenderBuilding building;
public WithDeliveryAnimation(Actor self, WithDeliveryAnimationInfo info) public WithDeliveryAnimation(Actor self, WithDeliveryAnimationInfo info)
{ {

View File

@@ -15,6 +15,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("This unit can be guarded (followed and protected) by a Guard unit.")] [Desc("This unit can be guarded (followed and protected) by a Guard unit.")]
public class GuardableInfo : TraitInfo<Guardable> public class GuardableInfo : TraitInfo<Guardable>
{ {
[Desc("Maximum range that guarding actors will maintain. Measured in cells.")]
public readonly int Range = 2; public readonly int Range = 2;
} }

View File

@@ -74,9 +74,8 @@ namespace OpenRA.Mods.Common.Traits
if (!checkTransientActors) if (!checkTransientActors)
return SubCell.FullCell; return SubCell.FullCell;
return !self.World.ActorMap.GetUnitsAt(cell) return self.World.ActorMap.GetUnitsAt(cell)
.Where(x => x != ignoreActor) .All(x => x == ignoreActor) ? SubCell.FullCell : SubCell.Invalid;
.Any() ? SubCell.FullCell : SubCell.Invalid;
} }
public bool CanEnterCell(CPos a, Actor ignoreActor = null, bool checkTransientActors = true) public bool CanEnterCell(CPos a, Actor ignoreActor = null, bool checkTransientActors = true)

View File

@@ -8,12 +8,6 @@
*/ */
#endregion #endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenRA.Effects;
using OpenRA.Primitives;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits

View File

@@ -168,9 +168,8 @@ namespace OpenRA.Mods.Common.Traits
// Sign of dot-product indicates (roughly) if vectors are facing in same or opposite directions: // 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; return dp > 0;
} }
public int TileSetMovementHash(TileSet tileSet) public int TileSetMovementHash(TileSet tileSet)
@@ -688,7 +687,7 @@ namespace OpenRA.Mods.Common.Traits
public MoveOrderTargeter(Actor self, MobileInfo unitType) public MoveOrderTargeter(Actor self, MobileInfo unitType)
{ {
this.unitType = unitType; this.unitType = unitType;
this.rejectMove = !self.AcceptsOrder("Move"); rejectMove = !self.AcceptsOrder("Move");
} }
public string OrderID { get { return "Move"; } } public string OrderID { get { return "Move"; } }

View File

@@ -12,7 +12,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq;
using OpenRA.Graphics; using OpenRA.Graphics;
namespace OpenRA.Mods.D2k.SpriteLoaders namespace OpenRA.Mods.D2k.SpriteLoaders

View File

@@ -10,7 +10,6 @@
using System.Linq; using System.Linq;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.D2k.Traits namespace OpenRA.Mods.D2k.Traits

View File

@@ -101,7 +101,7 @@ namespace OpenRA.Mods.D2k.Traits
.Where(p => p.Actor.Owner == self.Owner && !p.Trait.IsBusy && p.Actor.IsInWorld) .Where(p => p.Actor.Owner == self.Owner && !p.Trait.IsBusy && p.Actor.IsInWorld)
.Select(h => h.Actor); .Select(h => h.Actor);
return WorldUtils.ClosestTo(carriers, self); return carriers.ClosestTo(self);
} }
// This gets called by carrier after we touched down // This gets called by carrier after we touched down

View File

@@ -10,8 +10,6 @@
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.D2k.Traits namespace OpenRA.Mods.D2k.Traits

View File

@@ -10,7 +10,6 @@
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.D2k.Traits namespace OpenRA.Mods.D2k.Traits

View File

@@ -11,7 +11,6 @@
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.D2k.Traits namespace OpenRA.Mods.D2k.Traits

View File

@@ -11,7 +11,6 @@
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.D2k.Traits namespace OpenRA.Mods.D2k.Traits

View File

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

View File

@@ -61,9 +61,9 @@ namespace OpenRA.Mods.D2k.Traits
public Color GetRemappedColor(Color original, int index) public Color GetRemappedColor(Color original, int index)
{ {
return Color.FromArgb(original.A, return Color.FromArgb(original.A,
(int)Exts.Clamp((int)(scale * original.R + offset), 0, 255), (int)(scale * original.R + offset).Clamp(0, 255),
(int)Exts.Clamp((int)(scale * original.G + offset), 0, 255), (int)(scale * original.G + offset).Clamp(0, 255),
(int)Exts.Clamp((int)(scale * original.B + offset), 0, 255)); (int)(scale * original.B + offset).Clamp(0, 255));
} }
} }
} }

View File

@@ -10,9 +10,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives; using OpenRA.Primitives;
using OpenRA.Traits; using OpenRA.Traits;

View File

@@ -10,7 +10,6 @@
using System; using System;
using System.IO; using System.IO;
using System.Linq;
namespace OpenRA.Mods.D2k.UtilityCommands namespace OpenRA.Mods.D2k.UtilityCommands
{ {

View File

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

View File

@@ -85,7 +85,7 @@ namespace OpenRA.Mods.RA.Activities
static bool ShouldLayMine(Actor self, CPos p) static bool ShouldLayMine(Actor self, CPos p)
{ {
// If there is no unit (other than me) here, we want to place a mine here // If there is no unit (other than me) here, we want to place a mine here
return !self.World.ActorMap.GetUnitsAt(p).Any(a => a != self); return self.World.ActorMap.GetUnitsAt(p).All(a => a == self);
} }
void LayMine(Actor self) void LayMine(Actor self)

View File

@@ -13,20 +13,19 @@ using System.Linq;
using OpenRA.Activities; using OpenRA.Activities;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities namespace OpenRA.Mods.RA.Activities
{ {
class Leap : Activity class Leap : Activity
{ {
Mobile mobile; readonly Mobile mobile;
WeaponInfo weapon; readonly WeaponInfo weapon;
readonly int length;
WPos from; WPos from;
WPos to; WPos to;
int ticks; int ticks;
int length;
WAngle angle; WAngle angle;
public Leap(Actor self, Actor target, WeaponInfo weapon, WRange speed, WAngle angle) public Leap(Actor self, Actor target, WeaponInfo weapon, WRange speed, WAngle angle)

View File

@@ -23,9 +23,9 @@ namespace OpenRA.Mods.RA.Activities
public class Teleport : Activity public class Teleport : Activity
{ {
const int MaxCellSearchRange = Map.MaxTilesInCircleRange; const int MaxCellSearchRange = Map.MaxTilesInCircleRange;
Actor teleporter; readonly Actor teleporter;
readonly int? maximumDistance;
CPos destination; CPos destination;
int? maximumDistance;
bool killCargo; bool killCargo;
bool screenFlash; bool screenFlash;
string sound; string sound;

View File

@@ -32,9 +32,9 @@ namespace OpenRA.Mods.RA.Effects
class GpsDot : IEffect class GpsDot : IEffect
{ {
Actor self; readonly Actor self;
GpsDotInfo info; readonly GpsDotInfo info;
Animation anim; readonly Animation anim;
Lazy<HiddenUnderFog> huf; Lazy<HiddenUnderFog> huf;
Lazy<FrozenUnderFog> fuf; Lazy<FrozenUnderFog> fuf;

View File

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

View File

@@ -9,8 +9,6 @@
#endregion #endregion
using System.Linq; using System.Linq;
using OpenRA.Mods.Common.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Traits; using OpenRA.Mods.RA.Traits;
using OpenRA.Scripting; using OpenRA.Scripting;
using OpenRA.Traits; using OpenRA.Traits;

View File

@@ -8,7 +8,6 @@
*/ */
#endregion #endregion
using OpenRA.Activities;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Traits; using OpenRA.Traits;
@@ -25,9 +24,9 @@ namespace OpenRA.Mods.RA.Traits
public override object Create(ActorInitializer init) { return new AttackLeap(init.Self, this); } public override object Create(ActorInitializer init) { return new AttackLeap(init.Self, this); }
} }
class AttackLeap : AttackFrontal, ISync class AttackLeap : AttackFrontal
{ {
AttackLeapInfo info; readonly AttackLeapInfo info;
public AttackLeap(Actor self, AttackLeapInfo info) public AttackLeap(Actor self, AttackLeapInfo info)
: base(self, info) : base(self, info)

View File

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

View File

@@ -79,7 +79,7 @@ namespace OpenRA.Mods.RA.Traits
return true; return true;
} }
/// Set up return-to-sender info // Set up return-to-sender info
Origin = self.Location; Origin = self.Location;
ReturnTicks = duration; ReturnTicks = duration;
this.duration = duration; this.duration = duration;

View File

@@ -25,9 +25,9 @@ namespace OpenRA.Mods.RA.Traits
class DisguiseToolTip : IToolTip class DisguiseToolTip : IToolTip
{ {
Actor self; readonly Actor self;
readonly Disguise disguise;
TooltipInfo info; TooltipInfo info;
Disguise disguise;
public DisguiseToolTip(Actor self, TooltipInfo info) public DisguiseToolTip(Actor self, TooltipInfo info)
{ {
@@ -49,12 +49,7 @@ namespace OpenRA.Mods.RA.Traits
get get
{ {
if (disguise.Disguised) if (disguise.Disguised)
{ return self.Owner == self.World.LocalPlayer ? self.Owner : disguise.AsPlayer;
if (self.Owner == self.World.LocalPlayer)
return self.Owner;
return disguise.AsPlayer;
}
return self.Owner; return self.Owner;
} }

View File

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

View File

@@ -8,8 +8,6 @@
*/ */
#endregion #endregion
using System;
using System.Collections.Generic;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
using OpenRA.Traits; using OpenRA.Traits;

View File

@@ -32,9 +32,11 @@ namespace OpenRA.Mods.RA.Traits
public readonly float2 ThumpShakeMultiplier = new float2(1, 0); public readonly float2 ThumpShakeMultiplier = new float2(1, 0);
public readonly int ThumpShakeTime = 10; public readonly int ThumpShakeTime = 10;
[Desc("Measured in ticks.")]
public readonly int ChargeDelay = 96; public readonly int ChargeDelay = 96;
public readonly string ChargeSound = "madchrg2.aud"; public readonly string ChargeSound = "madchrg2.aud";
[Desc("Measured in ticks.")]
public readonly int DetonationDelay = 42; public readonly int DetonationDelay = 42;
public readonly string DetonationSound = "madexplo.aud"; public readonly string DetonationSound = "madexplo.aud";
[WeaponReference] [WeaponReference]

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA.Traits
public Mine(ActorInitializer init, MineInfo info) public Mine(ActorInitializer init, MineInfo info)
{ {
this.self = init.Self; self = init.Self;
this.info = info; this.info = info;
} }

View File

@@ -34,9 +34,9 @@ namespace OpenRA.Mods.RA.Traits
{ {
/* TODO: [Sync] when sync can cope with arrays! */ /* TODO: [Sync] when sync can cope with arrays! */
public CPos[] Minefield = null; public CPos[] Minefield = null;
readonly Actor self;
readonly Sprite tile;
[Sync] CPos minefieldStart; [Sync] CPos minefieldStart;
Actor self;
Sprite tile;
public Minelayer(Actor self) public Minelayer(Actor self)
{ {

View File

@@ -18,6 +18,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Apply palette full screen rotations during chronoshifts. Add this to the world actor.")] [Desc("Apply palette full screen rotations during chronoshifts. Add this to the world actor.")]
public class ChronoshiftPaletteEffectInfo : ITraitInfo public class ChronoshiftPaletteEffectInfo : ITraitInfo
{ {
[Desc("Measured in ticks.")]
public readonly int ChronoEffectLength = 60; public readonly int ChronoEffectLength = 60;
public object Create(ActorInitializer init) { return new ChronoshiftPaletteEffect(this); } public object Create(ActorInitializer init) { return new ChronoshiftPaletteEffect(this); }
@@ -25,8 +26,8 @@ namespace OpenRA.Mods.RA.Traits
public class ChronoshiftPaletteEffect : IPaletteModifier, ITick public class ChronoshiftPaletteEffect : IPaletteModifier, ITick
{ {
readonly ChronoshiftPaletteEffectInfo info;
int remainingFrames; int remainingFrames;
ChronoshiftPaletteEffectInfo info;
public ChronoshiftPaletteEffect(ChronoshiftPaletteEffectInfo info) public ChronoshiftPaletteEffect(ChronoshiftPaletteEffectInfo info)
{ {

View File

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

View File

@@ -9,11 +9,8 @@
#endregion #endregion
using System; using System;
using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Graphics; using OpenRA.Graphics;
namespace OpenRA.Mods.TS.SpriteLoaders namespace OpenRA.Mods.TS.SpriteLoaders

View File

@@ -41,8 +41,8 @@ namespace OpenRA.Mods.TS.Traits
public readonly WAngle LightPitch = WAngle.FromDegrees(50); public readonly WAngle LightPitch = WAngle.FromDegrees(50);
public readonly WAngle LightYaw = WAngle.FromDegrees(240); public readonly WAngle LightYaw = WAngle.FromDegrees(240);
public readonly float[] LightAmbientColor = new float[] { 0.6f, 0.6f, 0.6f }; public readonly float[] LightAmbientColor = { 0.6f, 0.6f, 0.6f };
public readonly float[] LightDiffuseColor = new float[] { 0.4f, 0.4f, 0.4f }; public readonly float[] LightDiffuseColor = { 0.4f, 0.4f, 0.4f };
public virtual object Create(ActorInitializer init) { return new RenderVoxels(init.Self, this); } public virtual object Create(ActorInitializer init) { return new RenderVoxels(init.Self, this); }
@@ -63,17 +63,17 @@ namespace OpenRA.Mods.TS.Traits
.SelectMany(rvpi => rvpi.RenderPreviewVoxels(init, this, image, orientation, facings, palette)) .SelectMany(rvpi => rvpi.RenderPreviewVoxels(init, this, image, orientation, facings, palette))
.ToArray(); .ToArray();
yield return new VoxelPreview(components, WVec.Zero, 0, this.Scale, this.LightPitch, yield return new VoxelPreview(components, WVec.Zero, 0, Scale, LightPitch,
this.LightYaw, this.LightAmbientColor, this.LightDiffuseColor, body.CameraPitch, LightYaw, LightAmbientColor, LightDiffuseColor, body.CameraPitch,
palette, init.WorldRenderer.Palette(NormalsPalette), init.WorldRenderer.Palette(ShadowPalette)); palette, init.WorldRenderer.Palette(NormalsPalette), init.WorldRenderer.Palette(ShadowPalette));
} }
} }
public class RenderVoxels : IRender, INotifyOwnerChanged public class RenderVoxels : IRender, INotifyOwnerChanged
{ {
readonly List<VoxelAnimation> components = new List<VoxelAnimation>();
Actor self; Actor self;
RenderVoxelsInfo info; RenderVoxelsInfo info;
List<VoxelAnimation> components = new List<VoxelAnimation>();
IBodyOrientation body; IBodyOrientation body;
WRot camera; WRot camera;
WRot lightSource; WRot lightSource;

View File

@@ -67,7 +67,7 @@ namespace OpenRA.Mods.TS.Traits
var rv = self.Trait<RenderVoxels>(); var rv = self.Trait<RenderVoxels>();
rv.Add(new VoxelAnimation(VoxelProvider.GetVoxel(rv.Image, info.Sequence), rv.Add(new VoxelAnimation(VoxelProvider.GetVoxel(rv.Image, info.Sequence),
() => BarrelOffset(), () => BarrelRotation(), BarrelOffset, BarrelRotation,
() => false, () => 0)); () => false, () => 0));
} }

View File

@@ -45,9 +45,9 @@ namespace OpenRA.Mods.TS.Traits
public class WithVoxelTurret public class WithVoxelTurret
{ {
Actor self; readonly Actor self;
Turreted turreted; readonly Turreted turreted;
IBodyOrientation body; readonly IBodyOrientation body;
public WithVoxelTurret(Actor self, WithVoxelTurretInfo info) public WithVoxelTurret(Actor self, WithVoxelTurretInfo info)
{ {
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.TS.Traits
var rv = self.Trait<RenderVoxels>(); var rv = self.Trait<RenderVoxels>();
rv.Add(new VoxelAnimation(VoxelProvider.GetVoxel(rv.Image, info.Sequence), rv.Add(new VoxelAnimation(VoxelProvider.GetVoxel(rv.Image, info.Sequence),
() => turreted.Position(self), () => TurretRotation(), () => turreted.Position(self), TurretRotation,
() => false, () => 0)); () => false, () => 0));
} }

View File

@@ -10,7 +10,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.FileSystem; using OpenRA.FileSystem;

View File

@@ -117,7 +117,7 @@ GAPOWRUP:
Cost: 150 Cost: 150
Tooltip: Tooltip:
Name: Power Turbine Name: Power Turbine
Description: Provides extra power generation Description: Provides extra power generation.
Buildable: Buildable:
Queue: Defense Queue: Defense
BuildPaletteOrder: 10 BuildPaletteOrder: 10
@@ -1328,7 +1328,7 @@ GAPLUG:
Cost: 1000 Cost: 1000
Tooltip: Tooltip:
Name: GDI Upgrade Center Name: GDI Upgrade Center
Description: Can be upgraded for additional technology Description: Can be upgraded for additional technology.
Selectable: Selectable:
Bounds: 115,120,0,-20 Bounds: 115,120,0,-20
Buildable: Buildable:
@@ -1399,7 +1399,7 @@ GAPLUG3:
Cost: 1500 Cost: 1500
Tooltip: Tooltip:
Name: Ion Cannon Uplink Name: Ion Cannon Uplink
Description: Enables use of the Ion Cannon Description: Enables use of the Ion Cannon.
Buildable: Buildable:
Queue: Defense Queue: Defense
BuildPaletteOrder: 1000 BuildPaletteOrder: 1000