Style fixes

This commit is contained in:
reaperrr
2014-12-26 22:10:52 +01:00
parent d074fb4471
commit 311e347ad2
9 changed files with 24 additions and 25 deletions

View File

@@ -17,13 +17,13 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Remove this trait to limit base-walking by cheap or defensive buildings.")]
public class GivesBuildableAreaInfo : TraitInfo<GivesBuildableArea> {}
public class GivesBuildableArea {}
public class GivesBuildableAreaInfo : TraitInfo<GivesBuildableArea> { }
public class GivesBuildableArea { }
public class BuildingInfo : ITraitInfo, IOccupySpaceInfo, UsesInit<LocationInit>
{
[Desc("Where you are allowed to place the building (Water, Clear, ...)")]
public readonly string[] TerrainTypes = {};
public readonly string[] TerrainTypes = { };
[Desc("The range to the next building it can be constructed. Set it higher for walls.")]
public readonly int Adjacent = 2;
[Desc("x means space it blocks, _ is a part that is passable by actors.")]
@@ -51,6 +51,7 @@ namespace OpenRA.Mods.Common.Traits
if (target.IsInRange(center, WRange.FromCells(bp.Trait.Info.Range)))
return bp.Actor;
}
return null;
}
@@ -64,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
var buildingMaxBounds = Dimensions;
var buildingTraits = world.Map.Rules.Actors[buildingName].Traits;
if (buildingTraits.Contains<BibInfo>() && !(buildingTraits.Get<BibInfo>().HasMinibib))
if (buildingTraits.Contains<BibInfo>() && !buildingTraits.Get<BibInfo>().HasMinibib)
buildingMaxBounds += new CVec(0, 1);
var scanStart = world.Map.Clamp(topLeft - new CVec(Adjacent, Adjacent));
@@ -130,7 +131,7 @@ namespace OpenRA.Mods.Common.Traits
this.topLeft = init.Get<LocationInit, CPos>();
this.Info = info;
occupiedCells = FootprintUtils.UnpathableTiles( self.Info.Name, Info, TopLeft )
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);
@@ -184,6 +185,7 @@ namespace OpenRA.Mods.Common.Traits
foreach (var s in Info.UndeploySounds)
Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
}
public void OnTransform(Actor self) { }
public void AfterTransform(Actor self) { }
}

View File

@@ -66,10 +66,9 @@ namespace OpenRA.Mods.Common.Traits
// Cell contains an actor. Is it the type we want?
if (world.ActorsWithTrait<LineBuildNode>().Any(a =>
(
a.Actor.Location == cell &&
a.Actor.Info.Traits.Get<LineBuildNodeInfo>().Types.Intersect(lbi.NodeTypes).Any()
)))
(a.Actor.Location == cell &&
a.Actor.Info.Traits.Get<LineBuildNodeInfo>()
.Types.Intersect(lbi.NodeTypes).Any())))
dirs[d] = i; // Cell contains actor of correct type
else
dirs[d] = -1; // Cell is blocked by another actor type

View File

@@ -28,14 +28,14 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Which direction the unit should face.")]
public readonly int Facing = 0;
public object Create( ActorInitializer init ) { return new FreeActor(init, this); }
public object Create(ActorInitializer init) { return new FreeActor(init, this); }
}
public class FreeActor
{
public FreeActor(ActorInitializer init, FreeActorInfo info)
{
if (init.Contains<FreeActorInit>() && !init.Get<FreeActorInit>().value)
if (init.Contains<FreeActorInit>() && !init.Get<FreeActorInit>().ActorValue)
return;
init.self.World.AddFrameEndTask(w =>
@@ -57,16 +57,16 @@ namespace OpenRA.Mods.Common.Traits
public class FreeActorInit : IActorInit<bool>
{
[FieldFromYamlKey]
public readonly bool value = true;
public readonly bool ActorValue = true;
public FreeActorInit() { }
public FreeActorInit(bool init) { value = init; }
public bool Value(World world) { return value; }
public FreeActorInit(bool init) { ActorValue = init; }
public bool Value(World world) { return ActorValue; }
}
public class ParentActorInit : IActorInit<Actor>
{
public readonly Actor value;
public ParentActorInit(Actor parent) { value = parent; }
public Actor Value(World world) { return value; }
public readonly Actor ActorValue;
public ParentActorInit(Actor parent) { ActorValue = parent; }
public Actor Value(World world) { return ActorValue; }
}
}

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
{
public readonly bool PauseOnLowPower = false;
public override object Create(ActorInitializer init) { return new RenderBuilding(init, this);}
public override object Create(ActorInitializer init) { return new RenderBuilding(init, this); }
public IEnumerable<IRenderable> Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
{

View File

@@ -8,8 +8,8 @@
*/
#endregion
using OpenRA.Graphics;
using OpenRA.Activities;
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Traits
public void MovingToRefinery(Actor self, CPos targetCell, Activity next) { }
public void MovementCancelled(Actor self) { }
static public int ZOffsetFromCenter(Actor self, WPos pos, int offset)
public static int ZOffsetFromCenter(Actor self, WPos pos, int offset)
{
var delta = self.CenterPosition - pos;
return delta.Y + delta.Z + offset;

View File

@@ -26,7 +26,6 @@ namespace OpenRA.Mods.Common.Warheads
public readonly string AddsResourceType = null;
// TODO: Allow maximum resource splatter to be defined. (Per tile, and in total).
public override void DoImpact(Target target, Actor firedBy, IEnumerable<int> damageModifiers)
{
if (string.IsNullOrEmpty(AddsResourceType))

View File

@@ -23,7 +23,6 @@ namespace OpenRA.Mods.Common.Warheads
public readonly int[] Size = { 0, 0 };
// TODO: Allow maximum resource removal to be defined. (Per tile, and in total).
public override void DoImpact(Target target, Actor firedBy, IEnumerable<int> damageModifiers)
{
var world = firedBy.World;

View File

@@ -15,8 +15,8 @@ using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Traits;
using OpenRA.Mods.RA.Orders;
using OpenRA.Mods.RA.Traits;
using OpenRA.Network;
using OpenRA.Primitives;
using OpenRA.Traits;

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Traits
public BridgeHut(ActorInitializer init)
{
Bridge = init.Get<ParentActorInit>().value.Trait<Bridge>();
Bridge = init.Get<ParentActorInit>().ActorValue.Trait<Bridge>();
Bridge.AddHut(this);
FirstBridge = Bridge.Enumerate(0, true).Last();
}