StyleCop clean OpenRA.Game

This commit is contained in:
Matthias Mailänder
2015-01-04 11:56:13 +01:00
parent d2d715765c
commit bc3acfeee7
345 changed files with 835 additions and 833 deletions

View File

@@ -179,7 +179,7 @@ namespace OpenRA.Mods.RA.AI
public HackyAI(HackyAIInfo info, ActorInitializer init)
{
Info = info;
world = init.world;
world = init.World;
foreach (var decision in info.PowerDecisions)
powerDecisions.Add(decision.OrderName, decision);

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Only used if Sabotage=true. Sabotage damage expressed as a percentage of enemy health removed.")]
public readonly float SabotageHPRemoval = 0.5f;
public object Create(ActorInitializer init) { return new Captures(init.self, this); }
public object Create(ActorInitializer init) { return new Captures(init.Self, this); }
}
class Captures : IIssueOrder, IResolveOrder, IOrderVoice

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA
[Desc("Displays fireports, muzzle offsets, and hit areas in developer mode.")]
public class CombatDebugOverlayInfo : ITraitInfo
{
public object Create(ActorInitializer init) { return new CombatDebugOverlay(init.self); }
public object Create(ActorInitializer init) { return new CombatDebugOverlay(init.Self); }
}
public class CombatDebugOverlay : IPostRender, INotifyDamage

View File

@@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Spawn and remove the plane this far outside the map.")]
public readonly WRange Cordon = new WRange(5120);
public object Create(ActorInitializer init) { return new CrateSpawner(this, init.self); }
public object Create(ActorInitializer init) { return new CrateSpawner(this, init.Self); }
}
public class CrateSpawner : ITick

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Will friendly units just crush me instead of pathing around.")]
public readonly bool CrushedByFriendlies = false;
public object Create(ActorInitializer init) { return new Crushable(init.self, this); }
public object Create(ActorInitializer init) { return new Crushable(init.Self, this); }
}
class Crushable : ICrushable

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Overrides the default ToolTip when this actor is disguised (aids in deceiving enemy players).")]
class DisguiseToolTipInfo : TooltipInfo, Requires<DisguiseInfo>
{
public override object Create(ActorInitializer init) { return new DisguiseToolTip(init.self, this); }
public override object Create(ActorInitializer init) { return new DisguiseToolTip(init.Self, this); }
}
class DisguiseToolTip : IToolTip

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Effects
public object Create(ActorInitializer init)
{
return new GpsDot(init.self, this);
return new GpsDot(init.Self, this);
}
}

2
OpenRA.Mods.RA/Effects/RepairIndicator.cs Executable file → Normal file
View File

@@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Effects
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (building.Destroyed || wr.world.FogObscures(building) || rb.Repairers.Count == 0)
if (building.Destroyed || wr.World.FogObscures(building) || rb.Repairers.Count == 0)
return SpriteRenderable.None;
var palette = wr.Palette(palettePrefix + rb.Repairers[shownPlayer % rb.Repairers.Count].InternalName);

View File

@@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Traits
return true;
}
public object Create(ActorInitializer init) { return new ExternalCapturable(init.self, this); }
public object Create(ActorInitializer init) { return new ExternalCapturable(init.Self, this); }
}
public class ExternalCapturable : ITick

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Visualize the remaining CaptureCompleteTime from ExternalCapturable: trait.")]
class ExternalCapturableBarInfo : ITraitInfo, Requires<ExternalCapturableInfo>
{
public object Create(ActorInitializer init) { return new ExternalCapturableBar(init.self); }
public object Create(ActorInitializer init) { return new ExternalCapturableBar(init.Self); }
}
class ExternalCapturableBar : ISelectionBar

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Destroy the unit after capturing.")]
public readonly bool ConsumeActor = false;
public object Create(ActorInitializer init) { return new ExternalCaptures(init.self, this); }
public object Create(ActorInitializer init) { return new ExternalCaptures(init.Self, this); }
}
class ExternalCaptures : IIssueOrder, IResolveOrder, IOrderVoice

View File

@@ -79,8 +79,8 @@ namespace OpenRA.Mods.RA.Graphics
public IEnumerable<IRenderable> GenerateRenderables(WorldRenderer wr)
{
var bright = wr.world.Map.SequenceProvider.GetSequence(image, "bright");
var dim = wr.world.Map.SequenceProvider.GetSequence(image, "dim");
var bright = wr.World.Map.SequenceProvider.GetSequence(image, "bright");
var dim = wr.World.Map.SequenceProvider.GetSequence(image, "dim");
var source = wr.ScreenPosition(pos);
var target = wr.ScreenPosition(pos + length);

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA
{
try
{
Game.modData.RulesetCache.LoadMapRules(map);
Game.ModData.RulesetCache.LoadMapRules(map);
}
catch (Exception e)
{

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA
{
public void Run(Action<string> emitError, Action<string> emitWarning, Map map)
{
var sequences = MiniYaml.MergeLiberal(map.SequenceDefinitions, Game.modData.Manifest.Sequences.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal));
var sequences = MiniYaml.MergeLiberal(map.SequenceDefinitions, Game.ModData.Manifest.Sequences.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal));
foreach (var actorInfo in map.Rules.Actors)
foreach (var renderInfo in actorInfo.Value.Traits.WithInterface<RenderSimpleInfo>())

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA
public void Run(Action<string> emitError, Action<string> emitWarning, Map map)
{
/* first, check all the types implementing ISync */
foreach (var t in Game.modData.ObjectCreator.GetTypesImplementing<ISync>())
foreach (var t in Game.ModData.ObjectCreator.GetTypesImplementing<ISync>())
if (!HasAnySyncFields(t))
emitWarning("{0} has ISync but nothing marked with [Sync]".F(t.Name));
}

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
[Desc("Sound to play when dropping.")]
public readonly string ChuteSound = "chute1.aud";
public object Create(ActorInitializer init) { return new ParaDrop(init.self, this); }
public object Create(ActorInitializer init) { return new ParaDrop(init.Self, this); }
}
public class ParaDrop : ITick, INotifyRemovedFromWorld

View File

@@ -59,7 +59,7 @@ namespace OpenRA.Mods.RA
public Parachutable(ActorInitializer init, ParachutableInfo info)
{
this.self = init.self;
this.self = init.Self;
this.info = info;
positionable = self.TraitOrDefault<IPositionable>();

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("The audio notification type to play.")]
public string Notification = "BaseAttack";
public object Create(ActorInitializer init) { return new BaseAttackNotifier(init.self, this); }
public object Create(ActorInitializer init) { return new BaseAttackNotifier(init.Self, this); }
}
public class BaseAttackNotifier : INotifyDamage

View File

@@ -40,9 +40,9 @@ namespace OpenRA.Mods.RA
readonly ClassicProductionQueueInfo info;
public ClassicProductionQueue(ActorInitializer init, ClassicProductionQueueInfo info)
: base(init, init.self, info)
: base(init, init.Self, info)
{
this.self = init.self;
this.self = init.Self;
this.info = info;
}

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("The audio notification type to play.")]
public string Notification = "HarvesterAttack";
public object Create(ActorInitializer init) { return new HarvesterAttackNotifier(init.self, this); }
public object Create(ActorInitializer init) { return new HarvesterAttackNotifier(init.Self, this); }
}
public class HarvesterAttackNotifier : INotifyDamage

View File

@@ -64,7 +64,7 @@ namespace OpenRA.Mods.RA
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string CancelledAudio = "Cancelled";
public virtual object Create(ActorInitializer init) { return new ProductionQueue(init, init.self.Owner.PlayerActor, this); }
public virtual object Create(ActorInitializer init) { return new ProductionQueue(init, init.Self.Owner.PlayerActor, this); }
}
public class ProductionQueue : IResolveOrder, ITick, ITechTreeElement, INotifyOwnerChanged, INotifyKilled, INotifySold, ISync, INotifyTransform
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.RA
public ProductionQueue(ActorInitializer init, Actor playerActor, ProductionQueueInfo info)
{
self = init.self;
self = init.Self;
Info = info;
playerResources = playerActor.Trait<PlayerResources>();
playerPower = playerActor.Trait<PowerManager>();

2
OpenRA.Mods.RA/Production.cs Executable file → Normal file
View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("e.g. Infantry, Vehicles, Aircraft, Buildings")]
public readonly string[] Produces = { };
public virtual object Create(ActorInitializer init) { return new Production(this, init.self); }
public virtual object Create(ActorInitializer init) { return new Production(this, init.Self); }
}
public class Production

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA
public readonly Color Color = Color.SkyBlue;
public object Create(ActorInitializer init) { return new ProductionBar(init.self, this); }
public object Create(ActorInitializer init) { return new ProductionBar(init.Self, this); }
}
class ProductionBar : ISelectionBar, ITick

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA
public string ProductionTabsWidget = null;
public string ProductionPaletteWidget = null;
public object Create(ActorInitializer init) { return new ProductionQueueFromSelection(init.world, this); }
public object Create(ActorInitializer init) { return new ProductionQueueFromSelection(init.World, this); }
}
class ProductionQueueFromSelection : INotifySelection

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA
public readonly bool MustBeClear = false;
public readonly string[] CaptorTypes = { "Vehicle", "Tank", "Infantry" };
public object Create(ActorInitializer init) { return new ProximityCapturable(init.self, this); }
public object Create(ActorInitializer init) { return new ProximityCapturable(init.Self, this); }
}
public class ProximityCapturable : ITick

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA.Traits
public RenderBuildingSilo(ActorInitializer init, RenderBuildingSiloInfo info)
: base(init, info)
{
playerResources = init.self.Owner.PlayerActor.Trait<PlayerResources>();
playerResources = init.Self.Owner.PlayerActor.Trait<PlayerResources>();
}
public override void BuildingComplete(Actor self)

6
OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs Executable file → Normal file
View File

@@ -46,11 +46,11 @@ namespace OpenRA.Mods.RA.Traits
public RenderBuildingWarFactory(ActorInitializer init, RenderBuildingInfo info)
: base(init, info)
{
roof = new Animation(init.world, GetImage(init.self));
var bi = init.self.Info.Traits.Get<BuildingInfo>();
roof = new Animation(init.World, GetImage(init.Self));
var bi = init.Self.Info.Traits.Get<BuildingInfo>();
// Additional 512 units move from center -> top of cell
var offset = FootprintUtils.CenterOffset(init.world, bi).Y + 512;
var offset = FootprintUtils.CenterOffset(init.World, bi).Y + 512;
Add("roof", new AnimationWithOffset(roof, null,
() => !buildComplete, offset));
}

View File

@@ -14,7 +14,7 @@ namespace OpenRA.Mods.RA.Traits
{
class RenderDisguiseInfo : RenderInfantryInfo, Requires<DisguiseInfo>
{
public override object Create(ActorInitializer init) { return new RenderDisguise(init.self, this); }
public override object Create(ActorInitializer init) { return new RenderDisguise(init.Self, this); }
}
class RenderDisguise : RenderInfantry

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA.Traits
class RenderHarvesterInfo : RenderUnitInfo, Requires<HarvesterInfo>
{
public readonly string[] ImagesByFullness = { "harv" };
public override object Create(ActorInitializer init) { return new RenderHarvester(init.self, this); }
public override object Create(ActorInitializer init) { return new RenderHarvester(init.Self, this); }
}
class RenderHarvester : RenderUnit, INotifyHarvesterAction

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly string[] IdleAnimations = { };
public readonly string[] StandAnimations = { "stand" };
public override object Create(ActorInitializer init) { return new RenderInfantry(init.self, this); }
public override object Create(ActorInitializer init) { return new RenderInfantry(init.Self, this); }
public override IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
{

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly string OpenAnim = "open";
public readonly string UnloadAnim = "unload";
public override object Create(ActorInitializer init) { return new RenderLandingCraft(init.self, this); }
public override object Create(ActorInitializer init) { return new RenderLandingCraft(init.Self, this); }
}
public class RenderLandingCraft : RenderUnit

2
OpenRA.Mods.RA/Render/RenderUnitReload.cs Executable file → Normal file
View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Armament name")]
public readonly string Armament = "primary";
public override object Create(ActorInitializer init) { return new RenderUnitReload(init.self, this); }
public override object Create(ActorInitializer init) { return new RenderUnitReload(init.Self, this); }
}
class RenderUnitReload : RenderUnit

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly bool PauseOnLowPower = false;
public object Create(ActorInitializer init) { return new WithActiveAnimation(init.self, this); }
public object Create(ActorInitializer init) { return new WithActiveAnimation(init.Self, this); }
}
public class WithActiveAnimation : ITick, INotifyBuildComplete, INotifySold

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly bool PauseOnLowPower = false;
public object Create(ActorInitializer init) { return new WithIdleOverlay(init.self, this); }
public object Create(ActorInitializer init) { return new WithIdleOverlay(init.Self, this); }
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
{

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly bool PauseOnLowPower = false;
public object Create(ActorInitializer init) { return new WithRepairAnimation(init.self, this); }
public object Create(ActorInitializer init) { return new WithRepairAnimation(init.Self, this); }
}
public class WithRepairAnimation : INotifyRepair

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly bool PauseOnLowPower = false;
public object Create(ActorInitializer init) { return new WithRepairOverlay(init.self, this); }
public object Create(ActorInitializer init) { return new WithRepairOverlay(init.Self, this); }
}
public class WithRepairOverlay : INotifyDamageStateChanged, INotifyBuildComplete, INotifySold, INotifyRepair

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA.Traits
{
class RenderDetectionCircleInfo : ITraitInfo
{
public object Create(ActorInitializer init) { return new RenderDetectionCircle(init.self); }
public object Create(ActorInitializer init) { return new RenderDetectionCircle(init.Self); }
}
class RenderDetectionCircle : IPostRenderSelection

View File

@@ -50,7 +50,7 @@ namespace OpenRA.Mods.RA.Traits
yield return r;
}
public object Create(ActorInitializer init) { return new RenderJammerCircle(init.self); }
public object Create(ActorInitializer init) { return new RenderJammerCircle(init.Self); }
}
class RenderJammerCircle : IPostRenderSelection

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA.Traits
yield return r;
}
public object Create(ActorInitializer init) { return new RenderRangeCircle(init.self); }
public object Create(ActorInitializer init) { return new RenderRangeCircle(init.Self); }
}
class RenderRangeCircle : IPostRenderSelection

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA.Traits
yield return r;
}
public object Create(ActorInitializer init) { return new RenderShroudCircle(init.self); }
public object Create(ActorInitializer init) { return new RenderShroudCircle(init.Self); }
}
class RenderShroudCircle : IPostRenderSelection

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Traits
class RepairableInfo : ITraitInfo, Requires<HealthInfo>
{
public readonly string[] RepairBuildings = { "fix" };
public virtual object Create(ActorInitializer init) { return new Repairable(init.self); }
public virtual object Create(ActorInitializer init) { return new Repairable(init.Self); }
}
class Repairable : IIssueOrder, IResolveOrder, IOrderVoice

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Traits
[ActorReference] public readonly string[] Buildings = { "spen", "syrd" };
public readonly int CloseEnough = 4; /* cells */
public object Create(ActorInitializer init) { return new RepairableNear(init.self, this); }
public object Create(ActorInitializer init) { return new RepairableNear(init.Self, this); }
}
class RepairableNear : IIssueOrder, IResolveOrder

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Chance (out of 100) the unit has to enter panic mode when attacked.")]
public readonly int AttackPanicChance = 20;
public object Create(ActorInitializer init) { return new ScaredyCat(init.self, this); }
public object Create(ActorInitializer init) { return new ScaredyCat(init.Self, this); }
}
class ScaredyCat : ITick, INotifyIdle, INotifyDamage, INotifyAttack, ISpeedModifier, ISync, IRenderInfantrySequenceModifier

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Scripting
Actor CreateActor(Player owner, string actorType, bool addToWorld, CPos? entryLocation = null, CPos? nextLocation = null)
{
ActorInfo ai;
if (!context.World.Map.Rules.Actors.TryGetValue(actorType, out ai))
if (!Context.World.Map.Rules.Actors.TryGetValue(actorType, out ai))
throw new LuaException("Unknown actor type '{0}'".F(actorType));
var initDict = new TypeDictionary();
@@ -48,9 +48,9 @@ namespace OpenRA.Mods.RA.Scripting
}
if (entryLocation.HasValue && nextLocation.HasValue)
initDict.Add(new FacingInit(context.World.Map.FacingBetween(CPos.Zero, CPos.Zero + (nextLocation.Value - entryLocation.Value), 0)));
initDict.Add(new FacingInit(Context.World.Map.FacingBetween(CPos.Zero, CPos.Zero + (nextLocation.Value - entryLocation.Value), 0)));
var actor = context.World.CreateActor(addToWorld, actorType, initDict);
var actor = Context.World.CreateActor(addToWorld, actorType, initDict);
return actor;
}
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.RA.Scripting
var actionDelay = i * interval;
Action actorAction = () =>
{
context.World.Add(actor);
Context.World.Add(actor);
for (var j = 1; j < entryPath.Length; j++)
Move(actor, entryPath[j]);
@@ -89,13 +89,13 @@ namespace OpenRA.Mods.RA.Scripting
{
actor.QueueActivity(new CallFunc(() =>
{
af.Call(actor.ToLuaValue(context));
af.Call(actor.ToLuaValue(Context));
af.Dispose();
}));
}
};
context.World.AddFrameEndTask(w => w.Add(new DelayedAction(actionDelay, actorAction)));
Context.World.AddFrameEndTask(w => w.Add(new DelayedAction(actionDelay, actorAction)));
}
return actors.ToArray();
@@ -134,7 +134,7 @@ namespace OpenRA.Mods.RA.Scripting
var af = actionFunc.CopyReference() as LuaFunction;
transport.QueueActivity(new CallFunc(() =>
{
af.Call(transport.ToLuaValue(context), passengers.ToArray().ToLuaValue(context));
af.Call(transport.ToLuaValue(Context), passengers.ToArray().ToLuaValue(Context));
af.Dispose();
}));
}
@@ -162,7 +162,7 @@ namespace OpenRA.Mods.RA.Scripting
var ef = exitFunc.CopyReference() as LuaFunction;
transport.QueueActivity(new CallFunc(() =>
{
ef.Call(transport.ToLuaValue(context));
ef.Call(transport.ToLuaValue(Context));
ef.Dispose();
}));
}
@@ -174,9 +174,9 @@ namespace OpenRA.Mods.RA.Scripting
transport.QueueActivity(new RemoveSelf());
}
var ret = context.CreateTable();
ret.Add(1, transport.ToLuaValue(context));
ret.Add(2, passengers.ToArray().ToLuaValue(context));
var ret = Context.CreateTable();
ret.Add(1, transport.ToLuaValue(Context));
ret.Add(2, passengers.ToArray().ToLuaValue(Context));
return ret;
}
}

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Scripting
var cs = actor.TraitOrDefault<Chronoshiftable>();
if (cs != null && cs.CanChronoshiftTo(actor, cell))
cs.Teleport(actor, cell, duration, killCargo, self);
cs.Teleport(actor, cell, duration, killCargo, Self);
}
}
}

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA.Scripting
[Desc("Seek out and attack nearby targets.")]
public void Hunt()
{
self.QueueActivity(new Hunt(self));
Self.QueueActivity(new Hunt(Self));
}
[ScriptActorPropertyActivity]
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.RA.Scripting
"close enough to complete the activity.")]
public void AttackMove(CPos cell, int closeEnough = 0)
{
self.QueueActivity(new AttackMoveActivity(self, move.MoveTo(cell, closeEnough)));
Self.QueueActivity(new AttackMoveActivity(Self, move.MoveTo(cell, closeEnough)));
}
[ScriptActorPropertyActivity]
@@ -54,12 +54,12 @@ namespace OpenRA.Mods.RA.Scripting
{
foreach (var wpt in waypoints)
{
self.QueueActivity(new AttackMoveActivity(self, move.MoveTo(wpt, 2)));
self.QueueActivity(new Wait(wait));
Self.QueueActivity(new AttackMoveActivity(Self, move.MoveTo(wpt, 2)));
Self.QueueActivity(new Wait(wait));
}
if (loop)
self.QueueActivity(new CallFunc(() => Patrol(waypoints, loop, wait)));
Self.QueueActivity(new CallFunc(() => Patrol(waypoints, loop, wait)));
}
[ScriptActorPropertyActivity]
@@ -69,10 +69,10 @@ namespace OpenRA.Mods.RA.Scripting
{
Patrol(waypoints, false, wait);
var repeat = func.Call(self.ToLuaValue(context)).First().ToBoolean();
var repeat = func.Call(Self.ToLuaValue(Context)).First().ToBoolean();
if (repeat)
using (var f = func.CopyReference() as LuaFunction)
self.QueueActivity(new CallFunc(() => PatrolUntil(waypoints, f, wait)));
Self.QueueActivity(new CallFunc(() => PatrolUntil(waypoints, f, wait)));
}
}
}

View File

@@ -32,46 +32,46 @@ namespace OpenRA.Mods.RA.Scripting
{
get
{
return self.IsInWorld;
return Self.IsInWorld;
}
set
{
if (value)
self.World.AddFrameEndTask(w => w.Add(self));
Self.World.AddFrameEndTask(w => w.Add(Self));
else
self.World.AddFrameEndTask(w => w.Remove(self));
Self.World.AddFrameEndTask(w => w.Remove(Self));
}
}
[Desc("Specifies whether the actor is alive or dead.")]
public bool IsDead { get { return self.IsDead; } }
public bool IsDead { get { return Self.IsDead; } }
[Desc("Specifies whether the actor is idle (not performing any activities).")]
public bool IsIdle { get { return self.IsIdle; } }
public bool IsIdle { get { return Self.IsIdle; } }
[Desc("The player that owns the actor.")]
public Player Owner
{
get
{
return self.Owner;
return Self.Owner;
}
set
{
if (self.Owner != value)
self.ChangeOwner(value);
if (Self.Owner != value)
Self.ChangeOwner(value);
}
}
[Desc("The type of the actor (e.g. \"e1\").")]
public string Type { get { return self.Info.Name; } }
public string Type { get { return Self.Info.Name; } }
[Desc("Test whether an actor has a specific property.")]
public bool HasProperty(string name)
{
return self.HasScriptProperty(name);
return Self.HasScriptProperty(name);
}
}
@@ -89,10 +89,10 @@ namespace OpenRA.Mods.RA.Scripting
}
[Desc("The actor position in cell coordinates.")]
public CPos Location { get { return self.Location; } }
public CPos Location { get { return Self.Location; } }
[Desc("The actor position in world coordinates.")]
public WPos CenterPosition { get { return self.CenterPosition; } }
public WPos CenterPosition { get { return Self.CenterPosition; } }
[Desc("The direction that the actor is facing.")]
public int Facing
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.RA.Scripting
get
{
if (facing == null)
throw new LuaException("Actor '{0}' doesn't define a facing".F(self));
throw new LuaException("Actor '{0}' doesn't define a facing".F(Self));
return facing.Facing;
}
@@ -110,34 +110,34 @@ namespace OpenRA.Mods.RA.Scripting
[Desc("Instantly moves the actor to the specified cell.")]
public void Teleport(CPos cell)
{
self.QueueActivity(new SimpleTeleport(cell));
Self.QueueActivity(new SimpleTeleport(cell));
}
[ScriptActorPropertyActivity]
[Desc("Run an arbitrary Lua function.")]
public void CallFunc(LuaFunction func)
{
self.QueueActivity(new CallLuaFunc(func, context));
Self.QueueActivity(new CallLuaFunc(func, Context));
}
[ScriptActorPropertyActivity]
[Desc("Wait for a specified number of game ticks (25 ticks = 1 second).")]
public void Wait(int ticks)
{
self.QueueActivity(new Wait(ticks));
Self.QueueActivity(new Wait(ticks));
}
[ScriptActorPropertyActivity]
[Desc("Remove the actor from the game, without triggering any death notification.")]
public void Destroy()
{
self.QueueActivity(new RemoveSelf());
Self.QueueActivity(new RemoveSelf());
}
[Desc("Attempt to cancel any active activities.")]
public void Stop()
{
self.CancelActivity();
Self.CancelActivity();
}
[Desc("Current actor stance. Returns nil if this actor doesn't support stances.")]

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Scripting
public void Guard(Actor targetActor)
{
if (targetActor.HasTrait<Guardable>())
guard.GuardTarget(self, Target.FromActor(targetActor));
guard.GuardTarget(Self, Target.FromActor(targetActor));
}
}
}

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Scripting
[Desc("Search for nearby resources and begin harvesting.")]
public void FindResources()
{
harvester.ContinueHarvesting(self);
harvester.ContinueHarvesting(Self);
}
}
}

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Scripting
[Desc("Fly within the cell grid.")]
public void Move(CPos cell)
{
self.QueueActivity(new HeliFly(self, Target.FromCell(self.World, cell)));
Self.QueueActivity(new HeliFly(Self, Target.FromCell(Self.World, cell)));
}
}
}

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Scripting
"ID of the newly created objective, so that it can be referred to later.")]
public int AddPrimaryObjective(string description)
{
return mo.Add(player, description, ObjectiveType.Primary);
return mo.Add(Player, description, ObjectiveType.Primary);
}
[ScriptActorPropertyActivity]
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA.Scripting
"ID of the newly created objective, so that it can be referred to later.")]
public int AddSecondaryObjective(string description)
{
return mo.Add(player, description, ObjectiveType.Secondary);
return mo.Add(Player, description, ObjectiveType.Secondary);
}
[ScriptActorPropertyActivity]
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA.Scripting
if (id < 0 || id >= mo.Objectives.Count)
throw new LuaException("Objective ID is out of range.");
mo.MarkCompleted(player, id);
mo.MarkCompleted(Player, id);
}
[ScriptActorPropertyActivity]
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.RA.Scripting
if (id < 0 || id >= mo.Objectives.Count)
throw new LuaException("Objective ID is out of range.");
mo.MarkFailed(player, id);
mo.MarkFailed(Player, id);
}
[ScriptActorPropertyActivity]
@@ -113,7 +113,7 @@ namespace OpenRA.Mods.RA.Scripting
"the MustBeDestroyed trait (according to the short game option).")]
public bool HasNoRequiredUnits()
{
return player.HasNoRequiredUnits();
return Player.HasNoRequiredUnits();
}
}
}

View File

@@ -33,28 +33,28 @@ namespace OpenRA.Mods.RA.Scripting
"(in cells) that will be considered close enough to complete the activity.")]
public void Move(CPos cell, int closeEnough = 0)
{
self.QueueActivity(new Move(self, cell, WRange.FromCells(closeEnough)));
Self.QueueActivity(new Move(Self, cell, WRange.FromCells(closeEnough)));
}
[ScriptActorPropertyActivity]
[Desc("Moves within the cell grid, ignoring lane biases.")]
public void ScriptedMove(CPos cell)
{
self.QueueActivity(new Move(self, cell));
Self.QueueActivity(new Move(Self, cell));
}
[ScriptActorPropertyActivity]
[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]
[Desc("Leave the current position in a random direction.")]
public void Scatter()
{
self.Trait<Mobile>().Nudge(self, self, true);
Self.Trait<Mobile>().Nudge(Self, Self, true);
}
}
}

View File

@@ -26,14 +26,14 @@ namespace OpenRA.Mods.RA.Scripting
[Desc("Fly within the cell grid.")]
public void Move(CPos cell)
{
self.QueueActivity(new Fly(self, Target.FromCell(self.World, cell)));
Self.QueueActivity(new Fly(Self, Target.FromCell(Self.World, cell)));
}
[ScriptActorPropertyActivity]
[Desc("Return to the base, which is either the airfield given, or an auto-selected one otherwise.")]
public void ReturnToBase(Actor airfield = null)
{
self.QueueActivity(new ReturnToBase(self, airfield));
Self.QueueActivity(new ReturnToBase(Self, airfield));
}
}
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.RA.Scripting
[Desc("Fly an attack against the target actor.")]
public void Attack(Actor target)
{
self.QueueActivity(new FlyAttack(Target.FromActor(target)));
Self.QueueActivity(new FlyAttack(Target.FromActor(target)));
}
}
}

View File

@@ -24,13 +24,13 @@ namespace OpenRA.Mods.RA.Scripting
: base(context, player) { }
[Desc("The player's name.")]
public string Name { get { return player.PlayerName; } }
public string Name { get { return Player.PlayerName; } }
[Desc("Returns an array of actors representing all ground attack units of this player.")]
public Actor[] GetGroundAttackers()
{
return player.World.ActorsWithTrait<AttackBase>().Select(a => a.Actor)
.Where(a => a.Owner == player && !a.IsDead && a.IsInWorld && a.HasTrait<Mobile>())
return Player.World.ActorsWithTrait<AttackBase>().Select(a => a.Actor)
.Where(a => a.Owner == Player && !a.IsDead && a.IsInWorld && a.HasTrait<Mobile>())
.ToArray();
}
}

View File

@@ -37,10 +37,10 @@ namespace OpenRA.Mods.RA.Scripting
public void Produce(string actorType, string raceVariant = null)
{
ActorInfo actorInfo;
if (!self.World.Map.Rules.Actors.TryGetValue(actorType, out actorInfo))
if (!Self.World.Map.Rules.Actors.TryGetValue(actorType, out actorInfo))
throw new LuaException("Unknown actor type '{0}'".F(actorType));
self.QueueActivity(new WaitFor(() => p.Produce(self, actorInfo, raceVariant)));
Self.QueueActivity(new WaitFor(() => p.Produce(Self, actorInfo, raceVariant)));
}
}
@@ -78,7 +78,7 @@ namespace OpenRA.Mods.RA.Scripting
public bool IsPrimaryBuilding
{
get { return pb.IsPrimary; }
set { pb.SetPrimaryProducer(self, value); }
set { pb.SetPrimaryProducer(Self, value); }
}
}
@@ -113,7 +113,7 @@ namespace OpenRA.Mods.RA.Scripting
if (actionFunc != null)
{
var playerIndex = self.Owner.ClientIndex;
var playerIndex = Self.Owner.ClientIndex;
var squadSize = actorTypes.Length;
var squad = new List<Actor>();
var func = actionFunc.CopyReference() as LuaFunction;
@@ -131,7 +131,7 @@ namespace OpenRA.Mods.RA.Scripting
if (squad.Count >= squadSize)
{
using (func)
using (var luaSquad = squad.Where(u => !u.IsDead).ToArray().ToLuaValue(context))
using (var luaSquad = squad.Where(u => !u.IsDead).ToArray().ToLuaValue(Context))
func.Call(luaSquad).Dispose();
triggers.OnProducedInternal -= productionHandler;
@@ -142,7 +142,7 @@ namespace OpenRA.Mods.RA.Scripting
}
foreach (var actorType in actorTypes)
queue.ResolveOrder(self, Order.StartProduction(self, actorType, 1));
queue.ResolveOrder(Self, Order.StartProduction(Self, actorType, 1));
return true;
}
@@ -160,7 +160,7 @@ namespace OpenRA.Mods.RA.Scripting
BuildableInfo GetBuildableInfo(string actorType)
{
var ri = self.World.Map.Rules.Actors[actorType];
var ri = Self.World.Map.Rules.Actors[actorType];
var bi = ri.Traits.GetOrDefault<BuildableInfo>();
if (bi == null)
@@ -232,7 +232,7 @@ namespace OpenRA.Mods.RA.Scripting
if (squad.Count >= squadSize)
{
using (func)
using (var luaSquad = squad.Where(u => !u.IsDead).ToArray().ToLuaValue(context))
using (var luaSquad = squad.Where(u => !u.IsDead).ToArray().ToLuaValue(Context))
func.Call(luaSquad).Dispose();
foreach (var q in queueTypes)
@@ -267,7 +267,7 @@ namespace OpenRA.Mods.RA.Scripting
BuildableInfo GetBuildableInfo(string actorType)
{
var ri = player.World.Map.Rules.Actors[actorType];
var ri = Player.World.Map.Rules.Actors[actorType];
var bi = ri.Traits.GetOrDefault<BuildableInfo>();
if (bi == null)

View File

@@ -28,19 +28,19 @@ namespace OpenRA.Mods.RA.Scripting
[Desc("Start repairs on this building. `repairer` can be an allied player.")]
public void StartBuildingRepairs(Player repairer = null)
{
repairer = repairer ?? self.Owner;
repairer = repairer ?? Self.Owner;
if (!rb.Repairers.Contains(repairer))
rb.RepairBuilding(self, repairer);
rb.RepairBuilding(Self, repairer);
}
[Desc("Stop repairs on this building. `repairer` can be an allied player.")]
public void StopBuildingRepairs(Player repairer = null)
{
repairer = repairer ?? self.Owner;
repairer = repairer ?? Self.Owner;
if (rb.RepairActive && rb.Repairers.Contains(repairer))
rb.RepairBuilding(self, repairer);
rb.RepairBuilding(Self, repairer);
}
}
}

View File

@@ -31,16 +31,16 @@ namespace OpenRA.Mods.RA.Scripting
public bool HasPassengers { get { return cargo.Passengers.Any(); } }
[Desc("Teleport an existing actor inside this transport.")]
public void LoadPassenger(Actor a) { cargo.Load(self, a); }
public void LoadPassenger(Actor a) { cargo.Load(Self, a); }
[Desc("Remove the first actor from the transport. This actor is not added to the world.")]
public Actor UnloadPassenger() { return cargo.Unload(self); }
public Actor UnloadPassenger() { return cargo.Unload(Self); }
[ScriptActorPropertyActivity]
[Desc("Command transport to unload passengers.")]
public void UnloadPassengers()
{
self.QueueActivity(new UnloadCargo(self, true));
Self.QueueActivity(new UnloadCargo(Self, true));
}
}
@@ -60,9 +60,9 @@ namespace OpenRA.Mods.RA.Scripting
public void Paradrop(CPos cell)
{
paradrop.SetLZ(cell, true);
self.QueueActivity(new Fly(self, Target.FromCell(self.World, cell)));
self.QueueActivity(new FlyOffMap());
self.QueueActivity(new RemoveSelf());
Self.QueueActivity(new Fly(Self, Target.FromCell(Self.World, cell)));
Self.QueueActivity(new FlyOffMap());
Self.QueueActivity(new RemoveSelf());
}
}
}

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA
public readonly float HealIfBelow = .5f;
public readonly int DamageCooldown = 0;
public virtual object Create(ActorInitializer init) { return new SelfHealing(init.self, this); }
public virtual object Create(ActorInitializer init) { return new SelfHealing(init.Self, this); }
}
class SelfHealing : UpgradableTrait<SelfHealingInfo>, ITick, INotifyDamage

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA
public readonly int PipCount = 0;
public readonly PipType PipColor = PipType.Yellow;
public readonly int Capacity = 0;
public object Create(ActorInitializer init) { return new StoresResources(init.self, this); }
public object Create(ActorInitializer init) { return new StoresResources(init.Self, this); }
}
class StoresResources : IPips, INotifyOwnerChanged, INotifyCapture, INotifyKilled, IExplodeModifier, IStoreResources, ISync

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Weapon range offset to apply during the beacon clock calculation")]
public readonly WRange BeaconDistanceOffset = WRange.FromCells(6);
public override object Create(ActorInitializer init) { return new AirstrikePower(init.self, this); }
public override object Create(ActorInitializer init) { return new AirstrikePower(init.Self, this); }
}
class AirstrikePower : SupportPower

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly int Range = 1;
public readonly string GrantUpgradeSound = "ironcur9.aud";
public override object Create(ActorInitializer init) { return new GrantUpgradePower(init.self, this); }
public override object Create(ActorInitializer init) { return new GrantUpgradePower(init.Self, this); }
}
class GrantUpgradePower : SupportPower
@@ -137,7 +137,7 @@ namespace OpenRA.Mods.RA.Traits
var pal = wr.Palette("terrain");
foreach (var t in world.Map.FindTilesInCircle(xy, range))
yield return new SpriteRenderable(tile, wr.world.Map.CenterOfCell(t), WVec.Zero, -511, pal, 1f, true);
yield return new SpriteRenderable(tile, wr.World.Map.CenterOfCell(t), WVec.Zero, -511, pal, 1f, true);
}
public string GetCursor(World world, CPos xy, MouseInput mi)

2
OpenRA.Mods.RA/SupportPowers/NukePower.cs Executable file → Normal file
View File

@@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Amount of time after detonation to remove the camera")]
public readonly int CameraRemoveDelay = 25;
public override object Create(ActorInitializer init) { return new NukePower(init.self, this); }
public override object Create(ActorInitializer init) { return new NukePower(init.Self, this); }
}
class NukePower : SupportPower

View File

@@ -50,7 +50,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Weapon range offset to apply during the beacon clock calculation.")]
public readonly WRange BeaconDistanceOffset = WRange.FromCells(4);
public override object Create(ActorInitializer init) { return new ParatroopersPower(init.self, this); }
public override object Create(ActorInitializer init) { return new ParatroopersPower(init.Self, this); }
}
public class ParatroopersPower : SupportPower

2
OpenRA.Mods.RA/SupportPowers/SpawnActorPower.cs Executable file → Normal file
View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly string EffectSequence = null;
public readonly string EffectPalette = null;
public override object Create(ActorInitializer init) { return new SpawnActorPower(init.self, this); }
public override object Create(ActorInitializer init) { return new SpawnActorPower(init.Self, this); }
}
public class SpawnActorPower : SupportPower

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA.Traits
{
public readonly Color Color = Color.Magenta;
public object Create(ActorInitializer init) { return new SupportPowerChargeBar(init.self, this); }
public object Create(ActorInitializer init) { return new SupportPowerChargeBar(init.Self, this); }
}
class SupportPowerChargeBar : ISelectionBar

View File

@@ -34,13 +34,13 @@ namespace OpenRA.Mods.RA.Traits
public SupportPowerManager(ActorInitializer init)
{
self = init.self;
self = init.Self;
DevMode = self.Trait<DeveloperMode>();
TechTree = self.Trait<TechTree>();
RadarPings = Exts.Lazy(() => init.world.WorldActor.TraitOrDefault<RadarPings>());
RadarPings = Exts.Lazy(() => init.World.WorldActor.TraitOrDefault<RadarPings>());
init.world.ActorAdded += ActorAdded;
init.world.ActorRemoved += ActorRemoved;
init.World.ActorAdded += ActorAdded;
init.World.ActorRemoved += ActorRemoved;
}
static string MakeKey(SupportPower sp)

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Mods.RA.Traits
public ThrowsParticle(ActorInitializer init, ThrowsParticleInfo info)
{
var self = init.self;
var self = init.Self;
var rs = self.Trait<RenderSimple>();
var body = self.Trait<IBodyOrientation>();
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.RA.Traits
// Facing rotation
rotation = WRange.FromPDF(Game.CosmeticRandom, 2).Range * info.ROT / 1024;
var anim = new Animation(init.world, rs.GetImage(self), () => (int)facing);
var anim = new Animation(init.World, rs.GetImage(self), () => (int)facing);
anim.PlayRepeating(info.Anim);
rs.Add(info.Anim, new AnimationWithOffset(anim, () => pos, null));
}

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA.Traits
public class TargetableAircraftInfo : TargetableUnitInfo
{
public readonly string[] GroundedTargetTypes = { };
public override object Create(ActorInitializer init) { return new TargetableAircraft(init.self, this); }
public override object Create(ActorInitializer init) { return new TargetableAircraft(init.Self, this); }
}
public class TargetableAircraft : TargetableUnit

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly string MuzzlePalette = "effect";
public override object Create(ActorInitializer init) { return new AttackGarrisoned(init.self, this); }
public override object Create(ActorInitializer init) { return new AttackGarrisoned(init.Self, this); }
}
public class AttackGarrisoned : AttackFollow, INotifyPassengerEntered, INotifyPassengerExited, IRender

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly WRange Speed = new WRange(426);
public readonly WAngle Angle = WAngle.FromDegrees(20);
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

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("The name of the weapon to use when demolishing the bridge")]
public readonly string DemolishWeapon = "Demolish";
public object Create(ActorInitializer init) { return new Bridge(init.self, this); }
public object Create(ActorInitializer init) { return new Bridge(init.Self, this); }
public IEnumerable<Pair<ushort, float>> Templates
{
@@ -179,7 +179,7 @@ namespace OpenRA.Mods.RA.Traits
return footprint.Select(c => (IRenderable)(new SpriteRenderable(
wr.Theater.TileSprite(new TerrainTile(template, c.Value)),
wr.world.Map.CenterOfCell(c.Key), WVec.Zero, -offset, palette, 1f, true))).ToArray();
wr.World.Map.CenterOfCell(c.Key), WVec.Zero, -offset, palette, 1f, true))).ToArray();
}
bool initialized;

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Uses the \"Cloneable\" trait to determine whether or not we should clone a produced unit.")]
public readonly string[] CloneableTypes = { };
public object Create(ActorInitializer init) { return new ClonesProducedUnits(init.self, this); }
public object Create(ActorInitializer init) { return new ClonesProducedUnits(init.Self, this); }
}
public class ClonesProducedUnits : INotifyOtherProduction

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Actually harvester facing when docking, 0-255 counter-clock-wise.")]
public readonly int DockAngle = 64;
public virtual object Create(ActorInitializer init) { return new OreRefinery(init.self, this); }
public virtual object Create(ActorInitializer init) { return new OreRefinery(init.Self, this); }
}
public class OreRefinery : ITick, IAcceptOre, INotifyKilled, INotifySold, INotifyCapture, INotifyOwnerChanged, IExplodeModifier, ISync

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly string IndicatorPalettePrefix = "player";
public object Create(ActorInitializer init) { return new RepairableBuilding(init.self, this); }
public object Create(ActorInitializer init) { return new RepairableBuilding(init.Self, this); }
}
public class RepairableBuilding : UpgradableTrait<RepairableBuildingInfo>, ITick

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA.Traits
public bool RequiresForceFire = false;
public object Create(ActorInitializer init) { return new TargetableBuilding(init.self, this); }
public object Create(ActorInitializer init) { return new TargetableBuilding(init.Self, this); }
}
public class TargetableBuilding : ITargetable

View File

@@ -42,7 +42,7 @@ namespace OpenRA.Mods.RA.Traits
public Crate(ActorInitializer init, CrateInfo info)
{
this.self = init.self;
this.self = init.Self;
this.info = info;
if (init.Contains<LocationInit>())

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Actor types that this crate action will not occur for.")]
[ActorReference] public string[] ExcludedActorTypes = { };
public virtual object Create(ActorInitializer init) { return new CrateAction(init.self, this); }
public virtual object Create(ActorInitializer init) { return new CrateAction(init.Self, this); }
}
public class CrateAction

View File

@@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Is the new duplicates given to a specific owner, regardless of whom collected it?")]
public readonly string Owner = null;
public override object Create(ActorInitializer init) { return new DuplicateUnitCrateAction(init.self, this); }
public override object Create(ActorInitializer init) { return new DuplicateUnitCrateAction(init.Self, this); }
}
class DuplicateUnitCrateAction : CrateAction

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("The weapon to fire upon collection.")]
[WeaponReference] public string Weapon = null;
public override object Create(ActorInitializer init) { return new ExplodeCrateAction(init.self, this); }
public override object Create(ActorInitializer init) { return new ExplodeCrateAction(init.Self, this); }
}
class ExplodeCrateAction : CrateAction

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Should the collected amount be displayed as a cash tick?")]
public bool UseCashTick = false;
public override object Create(ActorInitializer init) { return new GiveCashCrateAction(init.self, this); }
public override object Create(ActorInitializer init) { return new GiveCashCrateAction(init.Self, this); }
}
class GiveCashCrateAction : CrateAction

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("The selection shares to use if the collector has no base.")]
public int NoBaseSelectionShares = 1000;
public override object Create(ActorInitializer init) { return new GiveMcvCrateAction(init.self, this); }
public override object Create(ActorInitializer init) { return new GiveMcvCrateAction(init.Self, this); }
}
class GiveMcvCrateAction : GiveUnitCrateAction

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Override the owner of the newly spawned unit: e.g. Creeps or Neutral")]
public readonly string Owner = null;
public override object Create(ActorInitializer init) { return new GiveUnitCrateAction(init.self, this); }
public override object Create(ActorInitializer init) { return new GiveUnitCrateAction(init.Self, this); }
}
class GiveUnitCrateAction : CrateAction

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("The maximum number of extra collectors to grant the crate action to.", "-1 = no limit")]
public readonly int MaxExtraCollectors = 4;
public override object Create(ActorInitializer init) { return new GrantUpgradeCrateAction(init.self, this); }
public override object Create(ActorInitializer init) { return new GrantUpgradeCrateAction(init.Self, this); }
}
public class GrantUpgradeCrateAction : CrateAction

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Heals all actors that belong to the owner of the collector.")]
class HealUnitsCrateActionInfo : CrateActionInfo
{
public override object Create(ActorInitializer init) { return new HealUnitsCrateAction(init.self, this); }
public override object Create(ActorInitializer init) { return new HealUnitsCrateAction(init.Self, this); }
}
class HealUnitsCrateAction : CrateAction

View File

@@ -13,7 +13,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Hides the entire map in shroud.")]
class HideMapCrateActionInfo : CrateActionInfo
{
public override object Create(ActorInitializer init) { return new HideMapCrateAction(init.self, this); }
public override object Create(ActorInitializer init) { return new HideMapCrateAction(init.Self, this); }
}
class HideMapCrateAction : CrateAction

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("The maximum number of extra collectors to grant the crate action to.")]
public readonly int MaxExtraCollectors = 4;
public override object Create(ActorInitializer init) { return new LevelUpCrateAction(init.self, this); }
public override object Create(ActorInitializer init) { return new LevelUpCrateAction(init.Self, this); }
}
class LevelUpCrateAction : CrateAction

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Should the map also be revealed for the allies of the collector's owner.")]
public readonly bool IncludeAllies = false;
public override object Create(ActorInitializer init) { return new RevealMapCrateAction(init.self, this); }
public override object Create(ActorInitializer init) { return new RevealMapCrateAction(init.Self, this); }
}
class RevealMapCrateAction : CrateAction

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Which proxy actor, which grants the support power, to spawn.")]
[ActorReference] public readonly string Proxy = null;
public override object Create(ActorInitializer init) { return new SupportPowerCrateAction(init.self, this); }
public override object Create(ActorInitializer init) { return new SupportPowerCrateAction(init.Self, this); }
}
class SupportPowerCrateAction : CrateAction

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Search radius (in cells) from the last harvest order location to find more resources.")]
public readonly int SearchFromOrderRadius = 12;
public object Create(ActorInitializer init) { return new Harvester(init.self, this); }
public object Create(ActorInitializer init) { return new Harvester(init.Self, this); }
}
public class Harvester : IIssueOrder, IResolveOrder, IPips,

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA.Traits
{
public readonly int Duration = 25 * 30;
public object Create(ActorInitializer init) { return new InfiltrateForPowerOutage(init.self, this); }
public object Create(ActorInitializer init) { return new InfiltrateForPowerOutage(init.Self, this); }
}
class InfiltrateForPowerOutage : INotifyOwnerChanged, INotifyInfiltrated

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Traits
{
this.info = info;
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.self.Owner.Country.Race;
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.Race;
}
public void Killed(Actor self, AttackInfo e)

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.Traits
[ActorReference]
public readonly string DriverActor = "e1";
public object Create(ActorInitializer init) { return new MadTank(init.self, this); }
public object Create(ActorInitializer init) { return new MadTank(init.Self, this); }
}
class MadTank : IIssueOrder, IResolveOrder, IOrderVoice, ITick, IPreventsTeleport

View File

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

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly float MinefieldDepth = 1.5f;
public object Create(ActorInitializer init) { return new Minelayer(init.self); }
public object Create(ActorInitializer init) { return new Minelayer(init.Self); }
}
class Minelayer : IIssueOrder, IResolveOrder, IPostRenderSelection, ISync

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly string ResourceType = "Ore";
public readonly int MaxRange = 100;
public object Create(ActorInitializer init) { return new SeedsResource(init.self, this); }
public object Create(ActorInitializer init) { return new SeedsResource(init.Self, this); }
}
class SeedsResource : ITick, ISeedableResource

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly int Duration = 30;
public readonly bool KillCargo = true;
public override object Create(ActorInitializer init) { return new ChronoshiftPower(init.self, this); }
public override object Create(ActorInitializer init) { return new ChronoshiftPower(init.Self, this); }
}
class ChronoshiftPower : SupportPower
@@ -139,7 +139,7 @@ namespace OpenRA.Mods.RA.Traits
var tiles = world.Map.FindTilesInCircle(xy, range);
var pal = wr.Palette("terrain");
foreach (var t in tiles)
yield return new SpriteRenderable(tile, wr.world.Map.CenterOfCell(t), WVec.Zero, -511, pal, 1f, true);
yield return new SpriteRenderable(tile, wr.World.Map.CenterOfCell(t), WVec.Zero, -511, pal, 1f, true);
}
public string GetCursor(World world, CPos xy, MouseInput mi)
@@ -220,11 +220,11 @@ namespace OpenRA.Mods.RA.Traits
// Source tiles
foreach (var t in world.Map.FindTilesInCircle(sourceLocation, range))
yield return new SpriteRenderable(sourceTile, wr.world.Map.CenterOfCell(t), WVec.Zero, -511, pal, 1f, true);
yield return new SpriteRenderable(sourceTile, wr.World.Map.CenterOfCell(t), WVec.Zero, -511, pal, 1f, true);
// Destination tiles
foreach (var t in world.Map.FindTilesInCircle(xy, range))
yield return new SpriteRenderable(sourceTile, wr.world.Map.CenterOfCell(t), WVec.Zero, -511, pal, 1f, true);
yield return new SpriteRenderable(sourceTile, wr.World.Map.CenterOfCell(t), WVec.Zero, -511, pal, 1f, true);
// Unit previews
foreach (var unit in power.UnitsInRange(sourceLocation))
@@ -244,7 +244,7 @@ namespace OpenRA.Mods.RA.Traits
var canEnter = manager.self.Owner.Shroud.IsExplored(targetCell) &&
unit.Trait<Chronoshiftable>().CanChronoshiftTo(unit, targetCell);
var tile = canEnter ? validTile : invalidTile;
yield return new SpriteRenderable(tile, wr.world.Map.CenterOfCell(targetCell), WVec.Zero, -511, pal, 1f, true);
yield return new SpriteRenderable(tile, wr.World.Map.CenterOfCell(targetCell), WVec.Zero, -511, pal, 1f, true);
}
}
}

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA.Traits
[Desc("Required for GpsPower. Attach this to the player actor.")]
class GpsWatcherInfo : ITraitInfo
{
public object Create(ActorInitializer init) { return new GpsWatcher(init.self.Owner); }
public object Create(ActorInitializer init) { return new GpsWatcher(init.Self.Owner); }
}
class GpsWatcher : ISync, IFogVisibilityModifier
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.RA.Traits
{
public readonly int RevealDelay = 0;
public override object Create(ActorInitializer init) { return new GpsPower(init.self, this); }
public override object Create(ActorInitializer init) { return new GpsPower(init.Self, this); }
}
class GpsPower : SupportPower, INotifyKilled, INotifyStanceChanged, INotifySold, INotifyOwnerChanged

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA.Traits
{
public readonly string[] CloakedTargetTypes = { };
public override object Create(ActorInitializer init) { return new TargetableSubmarine(init.self, this); }
public override object Create(ActorInitializer init) { return new TargetableSubmarine(init.Self, this); }
}
public class TargetableSubmarine : TargetableUnit

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Traits
public bool RequiresForceFire = false;
public virtual object Create(ActorInitializer init) { return new TargetableUnit(init.self, this); }
public virtual object Create(ActorInitializer init) { return new TargetableUnit(init.Self, this); }
}
public class TargetableUnit : ITargetable

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Traits
[ActorReference]
public readonly string[] Bridges = { "bridge1", "bridge2" };
public object Create(ActorInitializer init) { return new BridgeLayer(init.self, this); }
public object Create(ActorInitializer init) { return new BridgeLayer(init.Self, this); }
}
class BridgeLayer : IWorldLoaded

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