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

@@ -150,7 +150,7 @@ namespace OpenRA.Mods.Common.Effects
if (anim == null || ticks >= length)
yield break;
var cell = wr.world.Map.CellContaining(pos);
var cell = wr.World.Map.CellContaining(pos);
if (!args.SourceActor.World.FogObscures(cell))
{
if (info.Shadow)

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Effects
[Desc("Use player remap color instead of a custom color?")]
public readonly bool UsePlayerColor = true;
public object Create(ActorInitializer init) { return new Contrail(init.self, this); }
public object Create(ActorInitializer init) { return new Contrail(init.Self, this); }
}
class Contrail : ITick, IRender

View File

@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Effects
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (wr.world.FogObscures(wr.world.Map.CellContaining(pos)))
if (wr.World.FogObscures(wr.World.Map.CellContaining(pos)))
yield break;
yield return new TextRenderable(font, pos, 0, color, text);

View File

@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Effects
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
var cell = wr.world.Map.CellContaining(pos);
var cell = wr.World.Map.CellContaining(pos);
if (!args.SourceActor.World.FogObscures(cell))
{
if (info.Shadow)

View File

@@ -83,8 +83,8 @@ namespace OpenRA.Mods.Common.Effects
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (wr.world.FogObscures(wr.world.Map.CellContaining(target)) &&
wr.world.FogObscures(wr.world.Map.CellContaining(args.Source)))
if (wr.World.FogObscures(wr.World.Map.CellContaining(target)) &&
wr.World.FogObscures(wr.World.Map.CellContaining(args.Source)))
yield break;
if (ticks < info.BeamDuration)

View File

@@ -202,7 +202,7 @@ namespace OpenRA.Mods.Common.Effects
if (info.ContrailLength > 0)
yield return trail;
if (!args.SourceActor.World.FogObscures(wr.world.Map.CellContaining(pos)))
if (!args.SourceActor.World.FogObscures(wr.World.Map.CellContaining(pos)))
{
if (info.Shadow)
{

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Effects
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (a.Destroyed || wr.world.FogObscures(a))
if (a.Destroyed || wr.World.FogObscures(a))
return SpriteRenderable.None;
return anim.Render(a.CenterPosition, wr.Palette("chrome"));

View File

@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Effects
if (!building.IsInWorld || !building.World.Selection.Actors.Contains(building))
return SpriteRenderable.None;
var pos = wr.world.Map.CenterOfCell(cachedLocation);
var pos = wr.World.Map.CenterOfCell(cachedLocation);
var palette = wr.Palette(palettePrefix + building.Owner.InternalName);
return circles.Render(pos, palette).Concat(flag.Render(pos, palette));
}

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Effects
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
yield break;
if (wr.world.FogObscures(self))
if (wr.World.FogObscures(self))
yield break;
var pos = wr.ScreenPxPosition(self.CenterPosition);

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Graphics
public readonly ActorInfo Actor;
public readonly Player Owner;
public readonly WorldRenderer WorldRenderer;
public World World { get { return WorldRenderer.world; } }
public World World { get { return WorldRenderer.World; } }
readonly TypeDictionary dict;

View File

@@ -67,13 +67,13 @@ namespace OpenRA.Mods.Common.Graphics
// Start of the first line segment is the tail of the list - don't smooth it.
var curPos = trail[Index(next - skip - 1)];
var curCell = wr.world.Map.CellContaining(curPos);
var curCell = wr.World.Map.CellContaining(curPos);
var curColor = color;
for (var i = 0; i < length - skip - 4; i++)
{
var j = next - skip - i - 2;
var nextPos = Average(trail[Index(j)], trail[Index(j - 1)], trail[Index(j - 2)], trail[Index(j - 3)]);
var nextCell = wr.world.Map.CellContaining(nextPos);
var nextCell = wr.World.Map.CellContaining(nextPos);
var nextColor = Exts.ColorLerp(i * 1f / (length - 4), color, Color.Transparent);
if (!world.FogObscures(curCell) && !world.FogObscures(nextCell))

View File

@@ -101,9 +101,9 @@ namespace OpenRA.Mods.Common.Graphics
public void Render(WorldRenderer wr)
{
// TODO: This is a temporary workaround until we have a proper ramp-aware height calculation
var groundPos = wr.world.Map.CenterOfCell(wr.world.Map.CellContaining(pos));
var groundPos = wr.World.Map.CenterOfCell(wr.World.Map.CellContaining(pos));
var ts = Game.modData.Manifest.TileSize;
var ts = Game.ModData.Manifest.TileSize;
var groundZ = ts.Height * (groundPos.Z - pos.Z) / 1024f;
var pxOrigin = wr.ScreenPosition(pos);
@@ -115,7 +115,7 @@ namespace OpenRA.Mods.Common.Graphics
var sc = shadowOrigin + psb[1];
var sd = shadowOrigin + psb[3];
Game.Renderer.WorldRgbaSpriteRenderer.DrawSprite(renderProxy.ShadowSprite, sa, sb, sc, sd);
Game.Renderer.WorldRgbaSpriteRenderer.DrawSprite(renderProxy.Sprite, pxOrigin - 0.5f * renderProxy.Sprite.size);
Game.Renderer.WorldRgbaSpriteRenderer.DrawSprite(renderProxy.Sprite, pxOrigin - 0.5f * renderProxy.Sprite.Size);
}
public void RenderDebugGeometry(WorldRenderer wr)
@@ -125,8 +125,8 @@ namespace OpenRA.Mods.Common.Graphics
var shadowOrigin = pxOrigin - groundZ * (new float2(renderProxy.ShadowDirection, 1));
// Draw sprite rect
var offset = pxOrigin + renderProxy.Sprite.offset - 0.5f * renderProxy.Sprite.size;
Game.Renderer.WorldLineRenderer.DrawRect(offset, offset + renderProxy.Sprite.size, Color.Red);
var offset = pxOrigin + renderProxy.Sprite.Offset - 0.5f * renderProxy.Sprite.Size;
Game.Renderer.WorldLineRenderer.DrawRect(offset, offset + renderProxy.Sprite.Size, Color.Red);
// Draw transformed shadow sprite rect
var c = Color.Purple;

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.LoadScreens
// Check whether the mod content is installed
// TODO: The installation code has finally been beaten into shape, so we can
// finally move it all into the planned "Manage Content" panel in the modchooser mod.
var installData = Game.modData.Manifest.ContentInstaller;
var installData = Game.ModData.Manifest.ContentInstaller;
var installModContent = !installData.TestFiles.All(f => GlobalFileSystem.Exists(f));
var installModMusic = args != null && args.Contains("Install.Music");

View File

@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.LoadScreens
public void Dispose()
{
if (sprite != null)
sprite.sheet.Dispose();
sprite.Sheet.Dispose();
}
}
}

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Scripting
{
// Find the requested type
var typeName = kv.Key.ToString();
var initType = Game.modData.ObjectCreator.FindType(typeName + "Init");
var initType = Game.ModData.ObjectCreator.FindType(typeName + "Init");
if (initType == null)
throw new LuaException("Unknown initializer type '{0}'".F(typeName));
@@ -52,9 +52,9 @@ namespace OpenRA.Mods.Common.Scripting
}
// The actor must be added to the world at the end of the tick
var a = context.World.CreateActor(false, type, initDict);
var a = Context.World.CreateActor(false, type, initDict);
if (addToWorld)
context.World.AddFrameEndTask(w => w.Add(a));
Context.World.AddFrameEndTask(w => w.Add(a));
return a;
}
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Scripting
public int BuildTime(string type)
{
ActorInfo ai;
if (!context.World.Map.Rules.Actors.TryGetValue(type, out ai))
if (!Context.World.Map.Rules.Actors.TryGetValue(type, out ai))
throw new LuaException("Unknown actor type '{0}'".F(type));
return ai.GetBuildTime();
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Scripting
public int CruiseAltitude(string type)
{
ActorInfo ai;
if (!context.World.Map.Rules.Actors.TryGetValue(type, out ai))
if (!Context.World.Map.Rules.Actors.TryGetValue(type, out ai))
throw new LuaException("Unknown actor type '{0}'".F(type));
var pi = ai.Traits.GetOrDefault<ICruiseAltitudeInfo>();

View File

@@ -21,8 +21,8 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("The center of the visible viewport.")]
public WPos Position
{
get { return context.WorldRenderer.Viewport.CenterPosition; }
set { context.WorldRenderer.Viewport.Center(value); }
get { return Context.WorldRenderer.Viewport.CenterPosition; }
set { Context.WorldRenderer.Viewport.Center(value); }
}
}
}

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Get the current game time (in ticks)")]
public int GameTime
{
get { return context.World.WorldTick; }
get { return Context.World.WorldTick; }
}
[Desc("Converts the number of seconds into game time (ticks).")]

View File

@@ -32,13 +32,13 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Returns a table of all actors within the requested region, filtered using the specified function.")]
public Actor[] ActorsInCircle(WPos location, WRange radius, LuaFunction filter = null)
{
var actors = context.World.FindActorsInCircle(location, radius);
var actors = Context.World.FindActorsInCircle(location, radius);
if (filter != null)
{
actors = actors.Where(a =>
{
using (var f = filter.Call(a.ToLuaValue(context)))
using (var f = filter.Call(a.ToLuaValue(Context)))
return f.First().ToBoolean();
});
}
@@ -49,13 +49,13 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Returns a table of all actors within the requested rectangle, filtered using the specified function.")]
public Actor[] ActorsInBox(WPos topLeft, WPos bottomRight, LuaFunction filter = null)
{
var actors = context.World.ActorMap.ActorsInBox(topLeft, bottomRight);
var actors = Context.World.ActorMap.ActorsInBox(topLeft, bottomRight);
if (filter != null)
{
actors = actors.Where(a =>
{
using (var f = filter.Call(a.ToLuaValue(context)))
using (var f = filter.Call(a.ToLuaValue(Context)))
return f.First().ToBoolean();
});
}
@@ -66,38 +66,38 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Returns the location of the top-left corner of the map.")]
public WPos TopLeft
{
get { return new WPos(context.World.Map.Bounds.Left * 1024, context.World.Map.Bounds.Top * 1024, 0); }
get { return new WPos(Context.World.Map.Bounds.Left * 1024, Context.World.Map.Bounds.Top * 1024, 0); }
}
[Desc("Returns the location of the bottom-right corner of the map.")]
public WPos BottomRight
{
get { return new WPos(context.World.Map.Bounds.Right * 1024, context.World.Map.Bounds.Bottom * 1024, 0); }
get { return new WPos(Context.World.Map.Bounds.Right * 1024, Context.World.Map.Bounds.Bottom * 1024, 0); }
}
[Desc("Returns a random cell inside the visible region of the map.")]
public CPos RandomCell()
{
return context.World.Map.ChooseRandomCell(context.World.SharedRandom);
return Context.World.Map.ChooseRandomCell(Context.World.SharedRandom);
}
[Desc("Returns a random cell on the visible border of the map.")]
public CPos RandomEdgeCell()
{
return context.World.Map.ChooseRandomEdgeCell(context.World.SharedRandom);
return Context.World.Map.ChooseRandomEdgeCell(Context.World.SharedRandom);
}
[Desc("Returns the center of a cell in world coordinates.")]
public WPos CenterOfCell(CPos cell)
{
return context.World.Map.CenterOfCell(cell);
return Context.World.Map.CenterOfCell(cell);
}
[Desc("Returns true if there is only one human player.")]
public bool IsSinglePlayer { get { return context.World.LobbyInfo.IsSinglePlayer; } }
public bool IsSinglePlayer { get { return Context.World.LobbyInfo.IsSinglePlayer; } }
[Desc("Returns the difficulty selected by the player before starting the mission.")]
public string Difficulty { get { return context.World.LobbyInfo.GlobalSettings.Difficulty; } }
public string Difficulty { get { return Context.World.LobbyInfo.GlobalSettings.Difficulty; } }
[Desc("Returns a table of all the actors that were specified in the map file.")]
public Actor[] NamedActors { get { return sma.Actors.Values.ToArray(); } }

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Scripting
}
catch (LuaException e)
{
context.FatalError(e.Message);
Context.FatalError(e.Message);
}
};
}

View File

@@ -22,16 +22,16 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Returns the player with the specified internal name, or nil if a match is not found.")]
public Player GetPlayer(string name)
{
return context.World.Players.FirstOrDefault(p => p.InternalName == name);
return Context.World.Players.FirstOrDefault(p => p.InternalName == name);
}
[Desc("Returns a table of players filtered by the specified function.")]
public Player[] GetPlayers(LuaFunction filter)
{
return context.World.Players
return Context.World.Players
.Where(p =>
{
using (var f = filter.Call(p.ToLuaValue(context)))
using (var f = filter.Call(p.ToLuaValue(Context)))
return f.First().ToBoolean();
}).ToArray();
}

View File

@@ -45,32 +45,32 @@ namespace OpenRA.Mods.Common.Scripting
}
catch (Exception e)
{
context.FatalError(e.Message);
Context.FatalError(e.Message);
}
};
context.World.AddFrameEndTask(w => w.Add(new DelayedAction(delay, doCall)));
Context.World.AddFrameEndTask(w => w.Add(new DelayedAction(delay, doCall)));
}
[Desc("Call a function each tick that the actor is idle. " +
"The callback function will be called as func(Actor self).")]
public void OnIdle(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnIdle, func, context);
GetScriptTriggers(a).RegisterCallback(Trigger.OnIdle, func, Context);
}
[Desc("Call a function when the actor is damaged. The callback " +
"function will be called as func(Actor self, Actor attacker).")]
public void OnDamaged(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnDamaged, func, context);
GetScriptTriggers(a).RegisterCallback(Trigger.OnDamaged, func, Context);
}
[Desc("Call a function when the actor is killed. The callback " +
"function will be called as func(Actor self, Actor killer).")]
public void OnKilled(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnKilled, func, context);
GetScriptTriggers(a).RegisterCallback(Trigger.OnKilled, func, Context);
}
[Desc("Call a function when all of the actors in a group are killed. The callback " +
@@ -92,7 +92,7 @@ namespace OpenRA.Mods.Common.Scripting
}
catch (Exception e)
{
context.FatalError(e.Message);
Context.FatalError(e.Message);
}
};
@@ -113,7 +113,7 @@ namespace OpenRA.Mods.Common.Scripting
if (called)
return;
using (var killed = m.ToLuaValue(context))
using (var killed = m.ToLuaValue(Context))
copy.Call(killed).Dispose();
copy.Dispose();
@@ -121,7 +121,7 @@ namespace OpenRA.Mods.Common.Scripting
}
catch (Exception e)
{
context.FatalError(e.Message);
Context.FatalError(e.Message);
}
};
@@ -133,56 +133,56 @@ namespace OpenRA.Mods.Common.Scripting
"The callback function will be called as func(Actor producer, Actor produced).")]
public void OnProduction(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnProduction, func, context);
GetScriptTriggers(a).RegisterCallback(Trigger.OnProduction, func, Context);
}
[Desc("Call a function when this player completes all primary objectives. " +
"The callback function will be called as func(Player player).")]
public void OnPlayerWon(Player player, LuaFunction func)
{
GetScriptTriggers(player.PlayerActor).RegisterCallback(Trigger.OnPlayerWon, func, context);
GetScriptTriggers(player.PlayerActor).RegisterCallback(Trigger.OnPlayerWon, func, Context);
}
[Desc("Call a function when this player fails any primary objective. " +
"The callback function will be called as func(Player player).")]
public void OnPlayerLost(Player player, LuaFunction func)
{
GetScriptTriggers(player.PlayerActor).RegisterCallback(Trigger.OnPlayerLost, func, context);
GetScriptTriggers(player.PlayerActor).RegisterCallback(Trigger.OnPlayerLost, func, Context);
}
[Desc("Call a function when this player is assigned a new objective. " +
"The callback function will be called as func(Player player, int objectiveID).")]
public void OnObjectiveAdded(Player player, LuaFunction func)
{
GetScriptTriggers(player.PlayerActor).RegisterCallback(Trigger.OnObjectiveAdded, func, context);
GetScriptTriggers(player.PlayerActor).RegisterCallback(Trigger.OnObjectiveAdded, func, Context);
}
[Desc("Call a function when this player completes an objective. " +
"The callback function will be called as func(Player player, int objectiveID).")]
public void OnObjectiveCompleted(Player player, LuaFunction func)
{
GetScriptTriggers(player.PlayerActor).RegisterCallback(Trigger.OnObjectiveCompleted, func, context);
GetScriptTriggers(player.PlayerActor).RegisterCallback(Trigger.OnObjectiveCompleted, func, Context);
}
[Desc("Call a function when this player fails an objective. " +
"The callback function will be called as func(Player player, int objectiveID).")]
public void OnObjectiveFailed(Player player, LuaFunction func)
{
GetScriptTriggers(player.PlayerActor).RegisterCallback(Trigger.OnObjectiveFailed, func, context);
GetScriptTriggers(player.PlayerActor).RegisterCallback(Trigger.OnObjectiveFailed, func, Context);
}
[Desc("Call a function when this actor is added to the world. " +
"The callback function will be called as func(Actor self).")]
public void OnAddedToWorld(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnAddedToWorld, func, context);
GetScriptTriggers(a).RegisterCallback(Trigger.OnAddedToWorld, func, Context);
}
[Desc("Call a function when this actor is removed from the world. " +
"The callback function will be called as func(Actor self).")]
public void OnRemovedFromWorld(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnRemovedFromWorld, func, context);
GetScriptTriggers(a).RegisterCallback(Trigger.OnRemovedFromWorld, func, Context);
}
[Desc("Call a function when all of the actors in a group have been removed from the world. " +
@@ -205,7 +205,7 @@ namespace OpenRA.Mods.Common.Scripting
}
catch (Exception e)
{
context.FatalError(e.Message);
Context.FatalError(e.Message);
}
};
@@ -217,7 +217,7 @@ namespace OpenRA.Mods.Common.Scripting
"will be called as func(Actor self, Actor captor, Player oldOwner, Player newOwner).")]
public void OnCapture(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnCapture, func, context);
GetScriptTriggers(a).RegisterCallback(Trigger.OnCapture, func, Context);
}
[Desc("Call a function when this actor is killed or captured. " +
@@ -240,7 +240,7 @@ namespace OpenRA.Mods.Common.Scripting
}
catch (Exception e)
{
context.FatalError(e.Message);
Context.FatalError(e.Message);
}
};
@@ -271,7 +271,7 @@ namespace OpenRA.Mods.Common.Scripting
}
catch (Exception e)
{
context.FatalError(e.Message);
Context.FatalError(e.Message);
}
};
@@ -293,17 +293,17 @@ namespace OpenRA.Mods.Common.Scripting
{
try
{
using (var luaActor = a.ToLuaValue(context))
using (var id = triggerId.ToLuaValue(context))
using (var luaActor = a.ToLuaValue(Context))
using (var id = triggerId.ToLuaValue(Context))
onEntry.Call(luaActor, id).Dispose();
}
catch (Exception e)
{
context.FatalError(e.Message);
Context.FatalError(e.Message);
}
};
triggerId = context.World.ActorMap.AddCellTrigger(cells, invokeEntry, null);
triggerId = Context.World.ActorMap.AddCellTrigger(cells, invokeEntry, null);
return triggerId;
}
@@ -319,17 +319,17 @@ namespace OpenRA.Mods.Common.Scripting
{
try
{
using (var luaActor = a.ToLuaValue(context))
using (var id = triggerId.ToLuaValue(context))
using (var luaActor = a.ToLuaValue(Context))
using (var id = triggerId.ToLuaValue(Context))
onExit.Call(luaActor, id).Dispose();
}
catch (Exception e)
{
context.FatalError(e.Message);
Context.FatalError(e.Message);
}
};
triggerId = context.World.ActorMap.AddCellTrigger(cells, null, invokeExit);
triggerId = Context.World.ActorMap.AddCellTrigger(cells, null, invokeExit);
return triggerId;
}
@@ -337,7 +337,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Removes a previously created footprint trigger.")]
public void RemoveFootprintTrigger(int id)
{
context.World.ActorMap.RemoveCellTrigger(id);
Context.World.ActorMap.RemoveCellTrigger(id);
}
[Desc("Call a function when an actor enters this range." +
@@ -351,17 +351,17 @@ namespace OpenRA.Mods.Common.Scripting
{
try
{
using (var luaActor = a.ToLuaValue(context))
using (var id = triggerId.ToLuaValue(context))
using (var luaActor = a.ToLuaValue(Context))
using (var id = triggerId.ToLuaValue(Context))
onEntry.Call(luaActor, id).Dispose();
}
catch (Exception e)
{
context.FatalError(e.Message);
Context.FatalError(e.Message);
}
};
triggerId = context.World.ActorMap.AddProximityTrigger(pos, range, invokeEntry, null);
triggerId = Context.World.ActorMap.AddProximityTrigger(pos, range, invokeEntry, null);
return triggerId;
}
@@ -377,17 +377,17 @@ namespace OpenRA.Mods.Common.Scripting
{
try
{
using (var luaActor = a.ToLuaValue(context))
using (var id = triggerId.ToLuaValue(context))
using (var luaActor = a.ToLuaValue(Context))
using (var id = triggerId.ToLuaValue(Context))
onExit.Call(luaActor, id).Dispose();
}
catch (Exception e)
{
context.FatalError(e.Message);
Context.FatalError(e.Message);
}
};
triggerId = context.World.ActorMap.AddProximityTrigger(pos, range, null, invokeExit);
triggerId = Context.World.ActorMap.AddProximityTrigger(pos, range, null, invokeExit);
return triggerId;
}
@@ -395,14 +395,14 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Removes a previously created proximitry trigger.")]
public void RemoveProximityTrigger(int id)
{
context.World.ActorMap.RemoveProximityTrigger(id);
Context.World.ActorMap.RemoveProximityTrigger(id);
}
[Desc("Call a function when this actor is infiltrated. The callback function " +
"will be called as func(Actor self, Actor infiltrator).")]
public void OnInfiltrated(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnInfiltrated, func, context);
GetScriptTriggers(a).RegisterCallback(Trigger.OnInfiltrated, func, Context);
}
[Desc("Removes all triggers from this actor." +

View File

@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Skips over the first numElements members of a table and return the rest.")]
public LuaTable Skip(LuaTable table, int numElements)
{
var t = context.CreateTable();
var t = Context.CreateTable();
for (var i = numElements; i <= table.Count; i++)
t.Add(t.Count + 1, table[i]);
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Returns a random value from a collection.")]
public LuaValue Random(LuaValue[] collection)
{
return collection.Random(context.World.SharedRandom);
return collection.Random(Context.World.SharedRandom);
}
[Desc("Expands the given footprint one step along the coordinate axes, and (if requested) diagonals.")]
@@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Scripting
if (high <= low)
return low;
return context.World.SharedRandom.Next(low, high);
return Context.World.SharedRandom.Next(low, high);
}
}
}

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Returns true if the player is allied with the other player.")]
public bool IsAlliedWith(Player targetPlayer)
{
return player.IsAlliedWith(targetPlayer);
return Player.IsAlliedWith(targetPlayer);
}
[Desc("Changes the current stance of the player against the target player. " +
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Scripting
public void SetStance(Player targetPlayer, string newStance)
{
var emergingStance = Enum<Stance>.Parse(newStance);
player.SetStance(targetPlayer, emergingStance);
Player.SetStance(targetPlayer, emergingStance);
}
}
}

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Scripting
public int Health
{
get { return health.HP; }
set { health.InflictDamage(self, self, health.HP - value, null, true); }
set { health.InflictDamage(Self, Self, health.HP - value, null, true); }
}
[Desc("Maximum health of the actor.")]
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Kill the actor.")]
public void Kill()
{
health.InflictDamage(self, self, health.MaxHP, null, true);
health.InflictDamage(Self, Self, health.MaxHP, null, true);
}
}
}

View File

@@ -27,25 +27,25 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Grant an upgrade to this actor.")]
public void GrantUpgrade(string upgrade)
{
um.GrantUpgrade(self, upgrade, this);
um.GrantUpgrade(Self, upgrade, this);
}
[Desc("Revoke an upgrade that was previously granted using GrantUpgrade.")]
public void RevokeUpgrade(string upgrade)
{
um.RevokeUpgrade(self, upgrade, this);
um.RevokeUpgrade(Self, upgrade, this);
}
[Desc("Grant a limited-time upgrade to this actor.")]
public void GrantTimedUpgrade(string upgrade, int duration)
{
um.GrantTimedUpgrade(self, upgrade, duration);
um.GrantTimedUpgrade(Self, upgrade, duration);
}
[Desc("Check whether this actor accepts a specific upgrade.")]
public bool AcceptsUpgrade(string upgrade)
{
return um.AcceptsUpgrade(self, upgrade);
return um.AcceptsUpgrade(Self, upgrade);
}
}
}

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Allows map scripts to attach triggers to this actor via the Triggers global.")]
public class ScriptTriggersInfo : ITraitInfo
{
public object Create(ActorInitializer init) { return new ScriptTriggers(init.world); }
public object Create(ActorInitializer init) { return new ScriptTriggers(init.World); }
}
public sealed class ScriptTriggers : INotifyIdle, INotifyDamage, INotifyKilled, INotifyProduction, INotifyOtherProduction, INotifyObjectivesUpdated, INotifyCapture, INotifyInfiltrated, INotifyAddedToWorld, INotifyRemovedFromWorld, IDisposable

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Server
return;
var defaults = new Session.Global();
FieldLoader.Load(defaults, Game.modData.Manifest.LobbyDefaults);
FieldLoader.Load(defaults, Game.ModData.Manifest.LobbyDefaults);
if (server.LobbyInfo.GlobalSettings.FragileAlliances != defaults.FragileAlliances)
server.SendOrderTo(conn, "Message", "Diplomacy Changes: {0}".F(server.LobbyInfo.GlobalSettings.FragileAlliances));

View File

@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits
public Aircraft(ActorInitializer init, AircraftInfo info)
{
this.info = info;
this.self = init.self;
this.self = init.Self;
if (init.Contains<LocationInit>())
SetPosition(self, init.Get<LocationInit, CPos>());

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Guns = "secondary";
public readonly int FacingTolerance = 2;
public override object Create(ActorInitializer init) { return new AttackBomber(init.self, this); }
public override object Create(ActorInitializer init) { return new AttackBomber(init.Self, this); }
}
public class AttackBomber : AttackBase, ITick, ISync, INotifyRemovedFromWorld

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits
{
public class AttackHeliInfo : AttackFrontalInfo
{
public override object Create(ActorInitializer init) { return new AttackHeli(init.self, this); }
public override object Create(ActorInitializer init) { return new AttackHeli(init.Self, this); }
}
public class AttackHeli : AttackFrontal

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits
{
public class AttackPlaneInfo : AttackFrontalInfo
{
public override object Create(ActorInitializer init) { return new AttackPlane(init.self, this); }
public override object Create(ActorInitializer init) { return new AttackPlane(init.Self, this); }
}
public class AttackPlane : AttackFrontal

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly bool Moves = false;
public readonly WRange Velocity = new WRange(43);
public object Create(ActorInitializer init) { return new FallsToEarth(init.self, this); }
public object Create(ActorInitializer init) { return new FallsToEarth(init.Self, this); }
}
public class FallsToEarth

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits
public Helicopter(ActorInitializer init, HelicopterInfo info)
: base(init, info)
{
self = init.self;
self = init.Self;
Info = info;
}

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
public Plane(ActorInitializer init, PlaneInfo info)
: base(init, info)
{
self = init.self;
self = init.Self;
Info = info;
}

View File

@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Use multiple muzzle images if non-zero")]
public readonly int MuzzleSplitFacings = 0;
public object Create(ActorInitializer init) { return new Armament(init.self, this); }
public object Create(ActorInitializer init) { return new Armament(init.Self, this); }
}
public class Armament : UpgradableTrait<ArmamentInfo>, ITick, IExplodeModifier

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Delay between charge attacks (in ticks).")]
public readonly int ChargeDelay = 3;
public override object Create(ActorInitializer init) { return new AttackCharge(init.self, this); }
public override object Create(ActorInitializer init) { return new AttackCharge(init.Self, this); }
}
class AttackCharge : AttackOmni, ITick, INotifyAttack, ISync

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Actor will follow units until in range to attack them.")]
public class AttackFollowInfo : AttackBaseInfo
{
public override object Create(ActorInitializer init) { return new AttackFollow(init.self, this); }
public override object Create(ActorInitializer init) { return new AttackFollow(init.Self, this); }
}
public class AttackFollow : AttackBase, ITick, ISync

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
{
public readonly int FacingTolerance = 1;
public override object Create(ActorInitializer init) { return new AttackFrontal(init.self, this); }
public override object Create(ActorInitializer init) { return new AttackFrontal(init.Self, this); }
}
public class AttackFrontal : AttackBase

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
"heal process then. It also won't work with buildings (use RepairsUnits: for them)")]
public class AttackMedicInfo : AttackFrontalInfo
{
public override object Create(ActorInitializer init) { return new AttackMedic(init.self, this); }
public override object Create(ActorInitializer init) { return new AttackMedic(init.Self, this); }
}
public class AttackMedic : AttackFrontal

View File

@@ -15,7 +15,7 @@ namespace OpenRA.Mods.Common.Traits
{
class AttackOmniInfo : AttackBaseInfo
{
public override object Create(ActorInitializer init) { return new AttackOmni(init.self, this); }
public override object Create(ActorInitializer init) { return new AttackOmni(init.Self, this); }
}
class AttackOmni : AttackBase, ISync

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Actor has a visual turret used to attack.")]
public class AttackTurretedInfo : AttackFollowInfo, Requires<TurretedInfo>
{
public override object Create(ActorInitializer init) { return new AttackTurreted(init.self, this); }
public override object Create(ActorInitializer init) { return new AttackTurreted(init.Self, this); }
}
public class AttackTurreted : AttackFollow, ITick, ISync

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits
"This conflicts with player orders and should only be added to animal creeps.")]
class AttackWanderInfo : WandersInfo, Requires<AttackMoveInfo>
{
public override object Create(ActorInitializer init) { return new AttackWander(init.self, this); }
public override object Create(ActorInitializer init) { return new AttackWander(init.Self, this); }
}
class AttackWander : Wanders

View File

@@ -18,7 +18,7 @@ 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
{
public object Create(ActorInitializer init) { return new AttackMove(init.self, this); }
public object Create(ActorInitializer init) { return new AttackMove(init.Self, this); }
}
class AttackMove : IResolveOrder, IOrderVoice, INotifyIdle, ISync

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly bool TargetWhenIdle = true;
public readonly bool TargetWhenDamaged = true;
public object Create(ActorInitializer init) { return new AutoTarget(init.self, this); }
public object Create(ActorInitializer init) { return new AutoTarget(init.Self, this); }
}
public enum UnitStance { HoldFire, ReturnFire, Defend, AttackAnything }

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int Cooldown = 0;
public readonly int InitialDelay = 0;
public object Create(ActorInitializer init) { return new BaseProvider(init.self, this); }
public object Create(ActorInitializer init) { return new BaseProvider(init.Self, this); }
}
public class BaseProvider : ITick, IPostRenderSelection, ISelectionBar

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Palette = "terrain";
public readonly bool HasMinibib = false;
public object Create(ActorInitializer init) { return new Bib(init.self, this); }
public object Create(ActorInitializer init) { return new Bib(init.Self, this); }
}
public class Bib : INotifyAddedToWorld, INotifyRemovedFromWorld

View File

@@ -127,14 +127,14 @@ namespace OpenRA.Mods.Common.Traits
public Building(ActorInitializer init, BuildingInfo info)
{
this.self = init.self;
this.self = init.Self;
this.topLeft = init.Get<LocationInit, CPos>();
this.Info = info;
occupiedCells = FootprintUtils.UnpathableTiles(self.Info.Name, Info, TopLeft)
.Select(c => Pair.New(c, SubCell.FullCell)).ToArray();
CenterPosition = init.world.Map.CenterOfCell(topLeft) + FootprintUtils.CenterOffset(init.world, Info);
CenterPosition = init.World.Map.CenterOfCell(topLeft) + FootprintUtils.CenterOffset(init.World, Info);
SkipMakeAnimation = init.Contains<SkipMakeAnimsInit>();
}

View File

@@ -15,7 +15,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("A dictionary of buildings placed on the map. Attach this to the world actor.")]
public class BuildingInfluenceInfo : ITraitInfo
{
public object Create(ActorInitializer init) { return new BuildingInfluence(init.world); }
public object Create(ActorInitializer init) { return new BuildingInfluence(init.World); }
}
public class BuildingInfluence

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits
{
public readonly int LingerTime = 20;
public object Create(ActorInitializer init) { return new DeadBuildingState(init.self, this); }
public object Create(ActorInitializer init) { return new DeadBuildingState(init.Self, this); }
}
class DeadBuildingState : INotifyKilled

View File

@@ -38,13 +38,13 @@ namespace OpenRA.Mods.Common.Traits
if (init.Contains<FreeActorInit>() && !init.Get<FreeActorInit>().ActorValue)
return;
init.self.World.AddFrameEndTask(w =>
init.Self.World.AddFrameEndTask(w =>
{
var a = w.CreateActor(info.Actor, new TypeDictionary
{
new ParentActorInit(init.self),
new LocationInit(init.self.Location + info.SpawnOffset),
new OwnerInit(init.self.Owner),
new ParentActorInit(init.Self),
new LocationInit(init.Self.Location + info.SpawnOffset),
new OwnerInit(init.Self.Owner),
new FacingInit(info.Facing),
});

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly CVec RallyPoint = new CVec(1, 3);
public readonly string IndicatorPalettePrefix = "player";
public object Create(ActorInitializer init) { return new RallyPoint(init.self, this); }
public object Create(ActorInitializer init) { return new RallyPoint(init.Self, this); }
}
public class RallyPoint : IIssueOrder, IResolveOrder, ISync

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int Damage = 1;
public readonly int Interval = 8;
public object Create(ActorInitializer init) { return new Burns(init.self, this); }
public object Create(ActorInitializer init) { return new Burns(init.Self, this); }
}
class Burns : ITick, ISync

View File

@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits
public Cargo(ActorInitializer init, CargoInfo info)
{
self = init.self;
self = init.Self;
Info = info;
Unloading = false;

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string[] CloakTypes = { "Cloak" };
public object Create(ActorInitializer init) { return new Cloak(init.self, this); }
public object Create(ActorInitializer init) { return new Cloak(init.Self, this); }
}
public class Cloak : UpgradableTrait<CloakInfo>, IRenderModifier, INotifyDamageStateChanged, INotifyAttack, ITick, IVisibilityModifier, IRadarColorModifier

View File

@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
public GainsExperience(ActorInitializer init, GainsExperienceInfo info)
{
self = init.self;
self = init.Self;
this.info = info;
MaxLevel = info.Upgrades.Count;

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Grant experience for team-kills.")]
public readonly bool FriendlyFire = false;
public object Create(ActorInitializer init) { return new GivesExperience(init.self, this); }
public object Create(ActorInitializer init) { return new GivesExperience(init.Self, this); }
}
class GivesExperience : INotifyKilled

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string[] Upgrades = { };
public readonly string[] Prerequisites = { };
public object Create(ActorInitializer init) { return new GlobalUpgradable(init.self, this); }
public object Create(ActorInitializer init) { return new GlobalUpgradable(init.Self, this); }
}
public class GlobalUpgradable : INotifyAddedToWorld, INotifyRemovedFromWorld

View File

@@ -43,14 +43,14 @@ namespace OpenRA.Mods.Common.Traits
public Husk(ActorInitializer init, HuskInfo info)
{
this.info = info;
this.self = init.self;
this.self = init.Self;
TopLeft = init.Get<LocationInit, CPos>();
CenterPosition = init.Contains<CenterPositionInit>() ? init.Get<CenterPositionInit, WPos>() : init.world.Map.CenterOfCell(TopLeft);
CenterPosition = init.Contains<CenterPositionInit>() ? init.Get<CenterPositionInit, WPos>() : init.World.Map.CenterOfCell(TopLeft);
Facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : 128;
dragSpeed = init.Contains<HuskSpeedInit>() ? init.Get<HuskSpeedInit, int>() : 0;
finalPosition = init.world.Map.CenterOfCell(TopLeft);
finalPosition = init.World.Map.CenterOfCell(TopLeft);
}
public void Created(Actor self)

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
public Immobile(ActorInitializer init, ImmobileInfo info)
{
location = init.Get<LocationInit, CPos>();
position = init.world.Map.CenterOfCell(location);
position = init.World.Map.CenterOfCell(location);
if (info.OccupiesSpace)
occupied = new[] { Pair.New(TopLeft, SubCell.FullCell) };

View File

@@ -290,19 +290,19 @@ namespace OpenRA.Mods.Common.Traits
public Mobile(ActorInitializer init, MobileInfo info)
{
self = init.self;
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>();
FromSubCell = 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));
fromCell = toCell = init.Get<LocationInit, CPos>();
SetVisualPosition(self, init.World.Map.CenterOfSubCell(FromCell, FromSubCell));
}
this.Facing = init.Contains<FacingInit>() ? init.Get<FacingInit, int>() : info.InitialFacing;

View File

@@ -44,15 +44,15 @@ namespace OpenRA.Mods.Common.Traits
{
// Spawned actors (e.g. building husks) shouldn't be revealed
startsRevealed = info.StartsRevealed && !init.Contains<ParentActorInit>();
var footprint = FootprintUtils.Tiles(init.self).ToList();
footprintInMapsCoords = footprint.Select(cell => Map.CellToMap(init.world.Map.TileShape, cell)).ToArray();
footprintRegion = CellRegion.BoundingRegion(init.world.Map.TileShape, footprint);
tooltip = Exts.Lazy(() => init.self.TraitsImplementing<IToolTip>().FirstOrDefault());
tooltip = Exts.Lazy(() => init.self.TraitsImplementing<IToolTip>().FirstOrDefault());
health = Exts.Lazy(() => init.self.TraitOrDefault<Health>());
var footprint = FootprintUtils.Tiles(init.Self).ToList();
footprintInMapsCoords = footprint.Select(cell => Map.CellToMap(init.World.Map.TileShape, cell)).ToArray();
footprintRegion = CellRegion.BoundingRegion(init.World.Map.TileShape, footprint);
tooltip = Exts.Lazy(() => init.Self.TraitsImplementing<IToolTip>().FirstOrDefault());
tooltip = Exts.Lazy(() => init.Self.TraitsImplementing<IToolTip>().FirstOrDefault());
health = Exts.Lazy(() => init.Self.TraitOrDefault<Health>());
frozen = new Dictionary<Player, FrozenActor>();
visible = init.world.Players.ToDictionary(p => p, p => false);
visible = init.World.Players.ToDictionary(p => p, p => false);
}
public bool IsVisible(Actor self, Player byPlayer)

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
{
public readonly string[] ExcludePalettes = { };
public object Create(ActorInitializer init) { return new WaterPaletteRotation(init.world, this); }
public object Create(ActorInitializer init) { return new WaterPaletteRotation(init.World, this); }
}
class WaterPaletteRotation : ITick, IPaletteModifier

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Delay for the end game notification in milliseconds.")]
public int NotificationDelay = 1500;
public object Create(ActorInitializer init) { return new ConquestVictoryConditions(init.self, this); }
public object Create(ActorInitializer init) { return new ConquestVictoryConditions(init.Self, this); }
}
public class ConquestVictoryConditions : ITick, INotifyObjectivesUpdated

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
public GlobalUpgradeManager(ActorInitializer init)
{
self = init.self;
self = init.Self;
techTree = self.Trait<TechTree>();
}

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Delay between the game over condition being met, and the game actually ending, in milliseconds.")]
public readonly int GameOverDelay = 1500;
public object Create(ActorInitializer init) { return new MissionObjectives(init.world, this); }
public object Create(ActorInitializer init) { return new MissionObjectives(init.World, this); }
}
public class MissionObjectives : INotifyObjectivesUpdated, ISync, IResolveOrder

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Notification = "Beacon";
public readonly string PalettePrefix = "player";
public object Create(ActorInitializer init) { return new PlaceBeacon(init.self, this); }
public object Create(ActorInitializer init) { return new PlaceBeacon(init.Self, this); }
}
public class PlaceBeacon : IResolveOrder

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Attach this to the player actor to collect observer stats.")]
public class PlayerStatisticsInfo : ITraitInfo
{
public object Create(ActorInitializer init) { return new PlayerStatistics(init.self); }
public object Create(ActorInitializer init) { return new PlayerStatistics(init.Self); }
}
public class PlayerStatistics : ITick, IResolveOrder

View File

@@ -41,9 +41,9 @@ namespace OpenRA.Mods.Common.Traits
{
this.info = info;
var race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.self.Owner.Country.Race;
var race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.Race;
Update(init.self.Owner, race);
Update(init.Self.Owner, race);
}
public IEnumerable<string> ProvidesPrerequisites

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
public ProvidesTechPrerequisite(ProvidesTechPrerequisiteInfo info, ActorInitializer init)
{
this.info = info;
var tech = init.world.Map.Options.TechLevel ?? init.world.LobbyInfo.GlobalSettings.TechLevel;
var tech = init.World.Map.Options.TechLevel ?? init.World.LobbyInfo.GlobalSettings.TechLevel;
this.enabled = info.Name == tech;
}
}

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Delay for the end game notification in milliseconds.")]
public int NotificationDelay = 1500;
public object Create(ActorInitializer init) { return new StrategicVictoryConditions(init.self, this); }
public object Create(ActorInitializer init) { return new StrategicVictoryConditions(init.Self, this); }
}
public class StrategicVictoryConditions : ITick, ISync, INotifyObjectivesUpdated

View File

@@ -28,9 +28,9 @@ namespace OpenRA.Mods.Common.Traits
public TechTree(ActorInitializer init)
{
player = init.self.Owner;
init.world.ActorAdded += ActorChanged;
init.world.ActorRemoved += ActorChanged;
player = init.Self.Owner;
init.World.ActorAdded += ActorChanged;
init.World.ActorRemoved += ActorChanged;
}
public void ActorChanged(Actor a)

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Disables the actor when a power outage is triggered (see `InfiltrateForPowerOutage` for more information).")]
public class AffectedByPowerOutageInfo : ITraitInfo
{
public object Create(ActorInitializer init) { return new AffectedByPowerOutage(init.self); }
public object Create(ActorInitializer init) { return new AffectedByPowerOutage(init.Self); }
}
public class AffectedByPowerOutage : INotifyOwnerChanged, ISelectionBar, IPowerModifier, IDisable

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Restore power when this trait is disabled.")]
public readonly bool CancelWhenDisabled = false;
public object Create(ActorInitializer init) { return new CanPowerDown(init.self, this); }
public object Create(ActorInitializer init) { return new CanPowerDown(init.Self, this); }
}
public class CanPowerDown : UpgradableTrait<CanPowerDownInfo>, IPowerModifier, IResolveOrder, IDisable, INotifyOwnerChanged

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int AdviceInterval = 250;
public readonly string SpeechNotification = "LowPower";
public object Create(ActorInitializer init) { return new PowerManager(init.self, this); }
public object Create(ActorInitializer init) { return new PowerManager(init.Self, this); }
}
public class PowerManager : ITick, ISync

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("If negative, it will drain power. If positive, it will provide power.")]
public readonly int Amount = 0;
public object Create(ActorInitializer init) { return new Power(init.self, this); }
public object Create(ActorInitializer init) { return new Power(init.Self, this); }
}
public class Power : UpgradableTrait<PowerInfo>, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyOwnerChanged

View File

@@ -15,7 +15,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Needs power to operate.")]
class RequiresPowerInfo : ITraitInfo
{
public object Create(ActorInitializer init) { return new RequiresPower(init.self); }
public object Create(ActorInitializer init) { return new RequiresPower(init.Self); }
}
class RequiresPower : IDisable, INotifyOwnerChanged

View File

@@ -15,7 +15,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Scale power amount with the current health.")]
public class ScalePowerWithHealthInfo : ITraitInfo, Requires<PowerInfo>, Requires<HealthInfo>
{
public object Create(ActorInitializer init) { return new ScalePowerWithHealth(init.self); }
public object Create(ActorInitializer init) { return new ScalePowerWithHealth(init.Self); }
}
public class ScalePowerWithHealth : IPowerModifier, INotifyDamage, INotifyOwnerChanged

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits
public class RadarColorFromTerrainInfo : ITraitInfo
{
public readonly string Terrain;
public object Create(ActorInitializer init) { return new RadarColorFromTerrain(init.self, Terrain); }
public object Create(ActorInitializer init) { return new RadarColorFromTerrain(init.Self, Terrain); }
}
public class RadarColorFromTerrain : IRadarColorModifier

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Whether or not reload counter should be reset when ammo has been fired.")]
public readonly bool ResetOnFire = false;
public object Create(ActorInitializer init) { return new Reloads(init.self, this); }
public object Create(ActorInitializer init) { return new Reloads(init.Self, this); }
}
public class Reloads : ITick

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Amount of Z axis changes in world units.")]
public readonly int OffsetModifier = -43;
public object Create(ActorInitializer init) { return new Hovers(this, init.self); }
public object Create(ActorInitializer init) { return new Hovers(this, init.Self); }
}
class Hovers : IRenderModifier

View File

@@ -41,9 +41,9 @@ namespace OpenRA.Mods.Common.Traits
: this(init, info, () => 0) { }
public RenderBuilding(ActorInitializer init, RenderBuildingInfo info, Func<int> baseFacing)
: base(init.self, baseFacing)
: base(init.Self, baseFacing)
{
var self = init.self;
var self = init.Self;
this.info = info;
DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle"));

View File

@@ -46,9 +46,9 @@ namespace OpenRA.Mods.Common.Traits
}
public RenderBuildingTurreted(ActorInitializer init, RenderBuildingInfo info)
: base(init, info, MakeTurretFacingFunc(init.self))
: base(init, info, MakeTurretFacingFunc(init.Self))
{
t = init.self.TraitsImplementing<Turreted>().FirstOrDefault();
t = init.Self.TraitsImplementing<Turreted>().FirstOrDefault();
t.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings;
}

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Invisible during games.")]
class RenderEditorOnlyInfo : RenderSimpleInfo
{
public override object Create(ActorInitializer init) { return new RenderEditorOnly(init.self); }
public override object Create(ActorInitializer init) { return new RenderEditorOnly(init.Self); }
}
class RenderEditorOnly : RenderSimple

View File

@@ -12,7 +12,7 @@ namespace OpenRA.Mods.Common.Traits
{
class RenderFlareInfo : RenderSimpleInfo
{
public override object Create(ActorInitializer init) { return new RenderFlare(init.self); }
public override object Create(ActorInitializer init) { return new RenderFlare(init.Self); }
}
class RenderFlare : RenderSimple

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Font = "TinyBold";
public object Create(ActorInitializer init) { return new RenderNameTag(init.self, this); }
public object Create(ActorInitializer init) { return new RenderNameTag(init.Self, this); }
}
class RenderNameTag : IRender

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
{
public class RenderSimpleInfo : RenderSpritesInfo, IRenderActorPreviewSpritesInfo, IQuantizeBodyOrientationInfo, ILegacyEditorRenderInfo, Requires<IBodyOrientationInfo>
{
public override object Create(ActorInitializer init) { return new RenderSimple(init.self); }
public override object Create(ActorInitializer init) { return new RenderSimple(init.Self); }
public virtual IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
{

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Change the sprite image size.")]
public readonly float Scale = 1f;
public virtual object Create(ActorInitializer init) { return new RenderSprites(init.self); }
public virtual object Create(ActorInitializer init) { return new RenderSprites(init.Self); }
public IEnumerable<IActorPreview> RenderPreview(ActorPreviewInitializer init)
{
@@ -200,7 +200,7 @@ namespace OpenRA.Mods.Common.Traits
{
return anims.Values.Where(b => b.IsVisible
&& b.Animation.Animation.CurrentSequence != null)
.Select(a => (a.Animation.Animation.Image.size * info.Scale).ToInt2())
.Select(a => (a.Animation.Animation.Image.Size * info.Scale).ToInt2())
.FirstOrDefault();
}
}

View File

@@ -15,7 +15,7 @@ namespace OpenRA.Mods.Common.Traits
{
public class RenderUnitInfo : RenderSimpleInfo, Requires<IFacingInfo>
{
public override object Create(ActorInitializer init) { return new RenderUnit(init.self); }
public override object Create(ActorInitializer init) { return new RenderUnit(init.Self); }
}
public class RenderUnit : RenderSimple

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly Color Color = Color.Red;
public object Create(ActorInitializer init) { return new TimedUpgradeBar(init.self, this); }
public object Create(ActorInitializer init) { return new TimedUpgradeBar(init.Self, this); }
}
class TimedUpgradeBar : ISelectionBar

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Visual offset")]
public readonly WVec LocalOffset = WVec.Zero;
public object Create(ActorInitializer init) { return new WithBarrel(init.self, this); }
public object Create(ActorInitializer init) { return new WithBarrel(init.Self, this); }
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
{

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Sequence name to use")]
public readonly string Sequence = "build";
public object Create(ActorInitializer init) { return new WithBuildingPlacedAnimation(init.self, this); }
public object Create(ActorInitializer init) { return new WithBuildingPlacedAnimation(init.Self, this); }
}
public class WithBuildingPlacedAnimation : INotifyBuildingPlaced

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Easteregg sequences to use in december.")]
public readonly string[] XmasImages = { };
public object Create(ActorInitializer init) { return new WithCrateBody(init.self, this); }
public object Create(ActorInitializer init) { return new WithCrateBody(init.Self, this); }
}
class WithCrateBody : INotifyParachuteLanded

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Custom crushed animation palette is a player palette BaseName")]
public readonly bool CrushedPaletteIsPlayerPalette = false;
public object Create(ActorInitializer init) { return new WithDeathAnimation(init.self, this); }
public object Create(ActorInitializer init) { return new WithDeathAnimation(init.Self, this); }
}
public class WithDeathAnimation : INotifyKilled

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Position relative to body")]
public readonly WVec Offset = WVec.Zero;
public object Create(ActorInitializer init) { return new WithHarvestAnimation(init.self, this); }
public object Create(ActorInitializer init) { return new WithHarvestAnimation(init.Self, this); }
}
class WithHarvestAnimation : INotifyHarvesterAction

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
public WithMakeAnimation(ActorInitializer init, WithMakeAnimationInfo info)
{
this.info = info;
var self = init.self;
var self = init.Self;
renderBuilding = self.Trait<RenderBuilding>();
var building = self.Trait<Building>();

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Ignore the weapon position, and always draw relative to the center of the actor")]
public readonly bool IgnoreOffset = false;
public object Create(ActorInitializer init) { return new WithMuzzleFlash(init.self, this); }
public object Create(ActorInitializer init) { return new WithMuzzleFlash(init.Self, this); }
}
class WithMuzzleFlash : INotifyAttack, IRender, ITick

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Sequence name to use")]
public readonly string Sequence = "resources";
public object Create(ActorInitializer init) { return new WithResources(init.self, this); }
public object Create(ActorInitializer init) { return new WithResources(init.Self, this); }
}
class WithResources : INotifyBuildComplete, INotifySold, INotifyOwnerChanged, INotifyDamageStateChanged

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Change this when using this trait multiple times on the same actor.")]
public readonly string Id = "rotor";
public object Create(ActorInitializer init) { return new WithRotor(init.self, this); }
public object Create(ActorInitializer init) { return new WithRotor(init.Self, this); }
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
{

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Needs to define \"idle\", \"loop\" and \"end\" sub-sequences.")]
public readonly string Sequence = "smoke_m";
public object Create(ActorInitializer init) { return new WithSmoke(init.self, this); }
public object Create(ActorInitializer init) { return new WithSmoke(init.Self, this); }
}
public class WithSmoke : INotifyDamage

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Render recoil")]
public readonly bool Recoils = true;
public object Create(ActorInitializer init) { return new WithTurret(init.self, this); }
public object Create(ActorInitializer init) { return new WithTurret(init.Self, this); }
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
{

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