StyleCop clean OpenRA.Game
This commit is contained in:
@@ -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>());
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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),
|
||||
});
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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) };
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public GlobalUpgradeManager(ActorInitializer init)
|
||||
{
|
||||
self = init.self;
|
||||
self = init.Self;
|
||||
techTree = self.Trait<TechTree>();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string Sprite = "smokey";
|
||||
public readonly DamageState MinDamage = DamageState.Heavy;
|
||||
|
||||
public object Create(ActorInitializer init) { return new SmokeTrailWhenDamaged(init.self, this); }
|
||||
public object Create(ActorInitializer init) { return new SmokeTrailWhenDamaged(init.Self, this); }
|
||||
}
|
||||
|
||||
class SmokeTrailWhenDamaged : ITick
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Minimum duration (in seconds) between sound events.")]
|
||||
public readonly int Interval = 5;
|
||||
|
||||
public object Create(ActorInitializer init) { return new AnnounceOnKill(init.self, this); }
|
||||
public object Create(ActorInitializer init) { return new AnnounceOnKill(init.Self, this); }
|
||||
}
|
||||
|
||||
public class AnnounceOnKill : INotifyAppliedDamage
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Sequence of the actor that contains the cameo.")]
|
||||
public readonly string Icon = "icon";
|
||||
|
||||
public virtual object Create(ActorInitializer init) { return new Tooltip(init.self, this); }
|
||||
public virtual object Create(ActorInitializer init) { return new Tooltip(init.Self, this); }
|
||||
|
||||
public string TooltipForPlayerStance(Stance stance)
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
upgrades = Exts.Lazy(() =>
|
||||
{
|
||||
var ret = new Dictionary<string, UpgradeState>();
|
||||
foreach (var up in init.self.TraitsImplementing<IUpgradable>())
|
||||
foreach (var up in init.Self.TraitsImplementing<IUpgradable>())
|
||||
foreach (var t in up.UpgradeTypes)
|
||||
ret.GetOrAdd(t).Traits.Add(up);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly int[] ShadowIndex = { };
|
||||
public readonly bool AllowModifiers = true;
|
||||
|
||||
public object Create(ActorInitializer init) { return new PaletteFromCurrentTileset(init.world, this); }
|
||||
public object Create(ActorInitializer init) { return new PaletteFromCurrentTileset(init.World, this); }
|
||||
}
|
||||
|
||||
class PaletteFromCurrentTileset : ILoadsPalettes
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly int[] ShadowIndex = { };
|
||||
public readonly bool AllowModifiers = true;
|
||||
|
||||
public object Create(ActorInitializer init) { return new PaletteFromFile(init.world, this); }
|
||||
public object Create(ActorInitializer init) { return new PaletteFromFile(init.World, this); }
|
||||
}
|
||||
|
||||
class PaletteFromFile : ILoadsPalettes
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly int A = 255;
|
||||
public readonly bool AllowModifiers = true;
|
||||
|
||||
public object Create(ActorInitializer init) { return new PaletteFromRGBA(init.world, this); }
|
||||
public object Create(ActorInitializer init) { return new PaletteFromRGBA(init.World, this); }
|
||||
}
|
||||
|
||||
class PaletteFromRGBA : ILoadsPalettes
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Calculates routes for mobile units based on the A* search algorithm.", " Attach this to the world actor.")]
|
||||
public class PathFinderInfo : ITraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new PathFinder(init.world); }
|
||||
public object Create(ActorInitializer init) { return new PathFinder(init.World); }
|
||||
}
|
||||
|
||||
public class PathFinder
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
layer[cell] = layer[cell] * 5 / 6;
|
||||
|
||||
// TODO: This doesn't make sense for isometric terrain
|
||||
var pos = wr.world.Map.CenterOfCell(cell);
|
||||
var pos = wr.World.Map.CenterOfCell(cell);
|
||||
var tl = wr.ScreenPxPosition(pos - new WVec(512, 512, 0));
|
||||
var br = wr.ScreenPxPosition(pos + new WVec(511, 511, 0));
|
||||
qr.FillRect(RectangleF.FromLTRB(tl.X, tl.Y, br.X, br.Y), Color.FromArgb(w, c));
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string Music = null;
|
||||
public readonly bool Loop = false;
|
||||
|
||||
public object Create(ActorInitializer init) { return new PlayMusicOnMapLoad(init.world, this); }
|
||||
public object Create(ActorInitializer init) { return new PlayMusicOnMapLoad(init.World, this); }
|
||||
}
|
||||
|
||||
class PlayMusicOnMapLoad : IWorldLoaded
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Apply palette rotatotors or not.")]
|
||||
public readonly bool AllowModifiers = true;
|
||||
|
||||
public object Create(ActorInitializer init) { return new PlayerPaletteFromCurrentTileset(init.world, this); }
|
||||
public object Create(ActorInitializer init) { return new PlayerPaletteFromCurrentTileset(init.World, this); }
|
||||
}
|
||||
|
||||
class PlayerPaletteFromCurrentTileset : ILoadsPalettes
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var c = render[uv.X, uv.Y];
|
||||
if (c.Sprite != null)
|
||||
new SpriteRenderable(c.Sprite, wr.world.Map.CenterOfCell(Map.MapToCell(world.Map.TileShape, uv)),
|
||||
new SpriteRenderable(c.Sprite, wr.World.Map.CenterOfCell(Map.MapToCell(world.Map.TileShape, uv)),
|
||||
WVec.Zero, -511, c.Type.Palette, 1f, true).Render(wr); // TODO ZOffset is ignored
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly int OverrideFogIndex = 15;
|
||||
|
||||
public readonly BlendMode ShroudBlend = BlendMode.Alpha;
|
||||
public object Create(ActorInitializer init) { return new ShroudRenderer(init.world, this); }
|
||||
public object Create(ActorInitializer init) { return new ShroudRenderer(init.World, this); }
|
||||
}
|
||||
|
||||
public class ShroudRenderer : IRenderShroud, IWorldLoaded
|
||||
@@ -298,13 +298,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (t.Shroud != null)
|
||||
{
|
||||
var pos = t.ScreenPosition - 0.5f * t.Shroud.size;
|
||||
var pos = t.ScreenPosition - 0.5f * t.Shroud.Size;
|
||||
Game.Renderer.WorldSpriteRenderer.DrawSprite(t.Shroud, pos, shroudPalette);
|
||||
}
|
||||
|
||||
if (t.Fog != null)
|
||||
{
|
||||
var pos = t.ScreenPosition - 0.5f * t.Fog.size;
|
||||
var pos = t.ScreenPosition - 0.5f * t.Fog.Size;
|
||||
Game.Renderer.WorldSpriteRenderer.DrawSprite(t.Fog, pos, fogPalette);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Renders a debug overlay showing the terrain cells. Attach this to the world actor.")]
|
||||
public class TerrainGeometryOverlayInfo : ITraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new TerrainGeometryOverlay(init.self); }
|
||||
public object Create(ActorInitializer init) { return new TerrainGeometryOverlay(init.Self); }
|
||||
}
|
||||
|
||||
public class TerrainGeometryOverlay : IRenderOverlay
|
||||
@@ -73,8 +73,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (devMode.Value == null || !devMode.Value.ShowTerrainGeometry)
|
||||
return;
|
||||
|
||||
var ts = wr.world.Map.TileShape;
|
||||
var colors = wr.world.TileSet.HeightDebugColors;
|
||||
var ts = wr.World.Map.TileShape;
|
||||
var colors = wr.World.TileSet.HeightDebugColors;
|
||||
|
||||
var leftDelta = ts == TileShape.Diamond ? new WVec(-512, 0, 0) : new WVec(-512, -512, 0);
|
||||
var topDelta = ts == TileShape.Diamond ? new WVec(0, -512, 0) : new WVec(512, -512, 0);
|
||||
@@ -84,10 +84,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
foreach (var uv in wr.Viewport.VisibleCells.MapCoords)
|
||||
{
|
||||
var lr = Game.Renderer.WorldLineRenderer;
|
||||
var pos = wr.world.Map.CenterOfCell(Map.MapToCell(wr.world.Map.TileShape, uv));
|
||||
var pos = wr.World.Map.CenterOfCell(Map.MapToCell(wr.World.Map.TileShape, uv));
|
||||
|
||||
var height = (int)wr.world.Map.MapHeight.Value[uv.X, uv.Y];
|
||||
var tile = wr.world.Map.MapTiles.Value[uv.X, uv.Y];
|
||||
var height = (int)wr.World.Map.MapHeight.Value[uv.X, uv.Y];
|
||||
var tile = wr.World.Map.MapTiles.Value[uv.X, uv.Y];
|
||||
|
||||
TerrainTileInfo tileInfo = null;
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// (ra/td templates omit Clear tiles from templates)
|
||||
try
|
||||
{
|
||||
tileInfo = wr.world.TileSet.Templates[tile.Type][tile.Index];
|
||||
tileInfo = wr.World.TileSet.Templates[tile.Type][tile.Index];
|
||||
}
|
||||
catch (Exception) { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user