fix indents everywhere
This commit is contained in:
@@ -36,8 +36,8 @@ namespace OpenRA.Traits
|
||||
Info = info;
|
||||
MaxHP = info.HP;
|
||||
|
||||
hp = init.Contains<HealthInit>() ? (int)(init.Get<HealthInit, float>() * MaxHP) : MaxHP;
|
||||
DisplayHp = hp;
|
||||
hp = init.Contains<HealthInit>() ? (int)(init.Get<HealthInit, float>() * MaxHP) : MaxHP;
|
||||
DisplayHp = hp;
|
||||
}
|
||||
|
||||
public int HP { get { return hp; } }
|
||||
@@ -75,7 +75,7 @@ namespace OpenRA.Traits
|
||||
|
||||
var oldState = this.DamageState;
|
||||
/* apply the damage modifiers, if we have any. */
|
||||
var modifier = (float)self.TraitsImplementing<IDamageModifier>()
|
||||
var modifier = (float)self.TraitsImplementing<IDamageModifier>()
|
||||
.Concat(self.Owner.PlayerActor.TraitsImplementing<IDamageModifier>())
|
||||
.Select(t => t.GetDamageModifier(attacker, warhead)).Product();
|
||||
|
||||
@@ -93,8 +93,8 @@ namespace OpenRA.Traits
|
||||
Warhead = warhead,
|
||||
};
|
||||
|
||||
foreach (var nd in self.TraitsImplementing<INotifyDamage>()
|
||||
.Concat(self.Owner.PlayerActor.TraitsImplementing<INotifyDamage>()))
|
||||
foreach (var nd in self.TraitsImplementing<INotifyDamage>()
|
||||
.Concat(self.Owner.PlayerActor.TraitsImplementing<INotifyDamage>()))
|
||||
nd.Damaged(self, ai);
|
||||
|
||||
if (DamageState != oldState)
|
||||
@@ -103,7 +103,7 @@ namespace OpenRA.Traits
|
||||
|
||||
if (attacker != null && attacker.IsInWorld && !attacker.IsDead())
|
||||
foreach (var nd in attacker.TraitsImplementing<INotifyAppliedDamage>()
|
||||
.Concat(attacker.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
|
||||
.Concat(attacker.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
|
||||
nd.AppliedDamage(attacker, self, ai);
|
||||
|
||||
if (hp == 0)
|
||||
@@ -112,7 +112,7 @@ namespace OpenRA.Traits
|
||||
self.Owner.Deaths++;
|
||||
|
||||
foreach (var nd in self.TraitsImplementing<INotifyKilled>()
|
||||
.Concat(self.Owner.PlayerActor.TraitsImplementing<INotifyKilled>()))
|
||||
.Concat(self.Owner.PlayerActor.TraitsImplementing<INotifyKilled>()))
|
||||
nd.Killed(self, ai);
|
||||
|
||||
if( RemoveOnDeath )
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Traits
|
||||
public bool DisableShroud = false;
|
||||
public bool PathDebug = false;
|
||||
public bool UnlimitedPower;
|
||||
public bool BuildAnywhere;
|
||||
public bool BuildAnywhere;
|
||||
|
||||
public object Create (ActorInitializer init) { return new DeveloperMode(this); }
|
||||
}
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Traits
|
||||
[Sync] public bool DisableShroud;
|
||||
[Sync] public bool PathDebug;
|
||||
[Sync] public bool UnlimitedPower;
|
||||
[Sync] public bool BuildAnywhere;
|
||||
[Sync] public bool BuildAnywhere;
|
||||
|
||||
public DeveloperMode(DeveloperModeInfo info)
|
||||
{
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Traits
|
||||
DisableShroud = info.DisableShroud;
|
||||
PathDebug = info.PathDebug;
|
||||
UnlimitedPower = info.UnlimitedPower;
|
||||
BuildAnywhere = info.BuildAnywhere;
|
||||
BuildAnywhere = info.BuildAnywhere;
|
||||
}
|
||||
|
||||
public void ResolveOrder (Actor self, Order order)
|
||||
@@ -96,11 +96,11 @@ namespace OpenRA.Traits
|
||||
UnlimitedPower ^= true;
|
||||
break;
|
||||
}
|
||||
case "DevBuildAnywhere":
|
||||
{
|
||||
BuildAnywhere ^= true;
|
||||
break;
|
||||
}
|
||||
case "DevBuildAnywhere":
|
||||
{
|
||||
BuildAnywhere ^= true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace OpenRA.Traits
|
||||
var eva = self.World.WorldActor.Info.Traits.Get<EvaAlertsInfo>();
|
||||
|
||||
OreCapacity = self.World.ActorsWithTrait<IStoreOre>()
|
||||
.Where(a => a.Actor.Owner == Owner)
|
||||
.Where(a => a.Actor.Owner == Owner)
|
||||
.Sum(a => a.Trait.Capacity);
|
||||
|
||||
if (Ore > OreCapacity)
|
||||
|
||||
@@ -18,117 +18,117 @@ using OpenRA.Network;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
// depends on the order of pips in WorldRenderer.cs!
|
||||
public enum PipType { Transparent, Green, Yellow, Red, Gray, Blue };
|
||||
public enum TagType { None, Fake, Primary };
|
||||
public enum Stance { Enemy, Neutral, Ally };
|
||||
// depends on the order of pips in WorldRenderer.cs!
|
||||
public enum PipType { Transparent, Green, Yellow, Red, Gray, Blue };
|
||||
public enum TagType { None, Fake, Primary };
|
||||
public enum Stance { Enemy, Neutral, Ally };
|
||||
|
||||
public class AttackInfo
|
||||
{
|
||||
public Actor Attacker;
|
||||
public WarheadInfo Warhead;
|
||||
public int Damage;
|
||||
public DamageState DamageState;
|
||||
public DamageState PreviousDamageState;
|
||||
}
|
||||
public class AttackInfo
|
||||
{
|
||||
public Actor Attacker;
|
||||
public WarheadInfo Warhead;
|
||||
public int Damage;
|
||||
public DamageState DamageState;
|
||||
public DamageState PreviousDamageState;
|
||||
}
|
||||
|
||||
public interface ITick { void Tick(Actor self); }
|
||||
public interface IRender { IEnumerable<Renderable> Render(Actor self); }
|
||||
public interface ITick { void Tick(Actor self); }
|
||||
public interface IRender { IEnumerable<Renderable> Render(Actor self); }
|
||||
|
||||
public interface IIssueOrder
|
||||
{
|
||||
IEnumerable<IOrderTargeter> Orders { get; }
|
||||
Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued);
|
||||
}
|
||||
public interface IIssueOrder
|
||||
{
|
||||
IEnumerable<IOrderTargeter> Orders { get; }
|
||||
Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued);
|
||||
}
|
||||
|
||||
public interface IOrderTargeter
|
||||
{
|
||||
string OrderID { get; }
|
||||
int OrderPriority { get; }
|
||||
bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueue, ref string cursor);
|
||||
bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceQueue, ref string cursor);
|
||||
bool IsQueued { get; }
|
||||
}
|
||||
public interface IOrderTargeter
|
||||
{
|
||||
string OrderID { get; }
|
||||
int OrderPriority { get; }
|
||||
bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueue, ref string cursor);
|
||||
bool CanTargetLocation(Actor self, int2 location, List<Actor> actorsAtLocation, bool forceAttack, bool forceQueue, ref string cursor);
|
||||
bool IsQueued { get; }
|
||||
}
|
||||
|
||||
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
|
||||
public interface IValidateOrder { bool OrderValidation(OrderManager orderManager, World world, int clientId, Order order); }
|
||||
public interface IOrderVoice { string VoicePhraseForOrder(Actor self, Order order); }
|
||||
public interface INotifySold { void Selling(Actor self); void Sold(Actor self); }
|
||||
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
||||
public interface INotifyDamageStateChanged { void DamageStateChanged(Actor self, AttackInfo e); }
|
||||
public interface INotifyKilled { void Killed(Actor self, AttackInfo e); }
|
||||
public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); }
|
||||
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
|
||||
public interface INotifyProduction { void UnitProduced(Actor self, Actor other, int2 exit); }
|
||||
public interface INotifyCapture { void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner); }
|
||||
public interface INotifyOtherCaptured { void OnActorCaptured(Actor self, Actor captured, Actor captor, Player oldOwner, Player newOwner); }
|
||||
public interface IAcceptSpy { void OnInfiltrate(Actor self, Actor spy); }
|
||||
public interface IStoreOre { int Capacity { get; } }
|
||||
public interface IToolTip
|
||||
{
|
||||
string Name();
|
||||
Player Owner();
|
||||
Stance Stance();
|
||||
}
|
||||
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
|
||||
public interface IValidateOrder { bool OrderValidation(OrderManager orderManager, World world, int clientId, Order order); }
|
||||
public interface IOrderVoice { string VoicePhraseForOrder(Actor self, Order order); }
|
||||
public interface INotifySold { void Selling(Actor self); void Sold(Actor self); }
|
||||
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
||||
public interface INotifyDamageStateChanged { void DamageStateChanged(Actor self, AttackInfo e); }
|
||||
public interface INotifyKilled { void Killed(Actor self, AttackInfo e); }
|
||||
public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); }
|
||||
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
|
||||
public interface INotifyProduction { void UnitProduced(Actor self, Actor other, int2 exit); }
|
||||
public interface INotifyCapture { void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner); }
|
||||
public interface INotifyOtherCaptured { void OnActorCaptured(Actor self, Actor captured, Actor captor, Player oldOwner, Player newOwner); }
|
||||
public interface IAcceptSpy { void OnInfiltrate(Actor self, Actor spy); }
|
||||
public interface IStoreOre { int Capacity { get; } }
|
||||
public interface IToolTip
|
||||
{
|
||||
string Name();
|
||||
Player Owner();
|
||||
Stance Stance();
|
||||
}
|
||||
|
||||
public interface IDisable { bool Disabled { get; } }
|
||||
public interface IExplodeModifier { bool ShouldExplode(Actor self); }
|
||||
public interface IHuskModifier { string HuskActor(Actor self); }
|
||||
public interface INudge { void OnNudge(Actor self, Actor nudger, bool force); }
|
||||
public interface IDisable { bool Disabled { get; } }
|
||||
public interface IExplodeModifier { bool ShouldExplode(Actor self); }
|
||||
public interface IHuskModifier { string HuskActor(Actor self); }
|
||||
public interface INudge { void OnNudge(Actor self, Actor nudger, bool force); }
|
||||
|
||||
public interface IRadarSignature
|
||||
{
|
||||
IEnumerable<int2> RadarSignatureCells(Actor self);
|
||||
Color RadarSignatureColor(Actor self);
|
||||
}
|
||||
public interface IRadarSignature
|
||||
{
|
||||
IEnumerable<int2> RadarSignatureCells(Actor self);
|
||||
Color RadarSignatureColor(Actor self);
|
||||
}
|
||||
|
||||
public interface IVisibilityModifier { bool IsVisible(Actor self); }
|
||||
public interface IRadarColorModifier { Color RadarColorOverride(Actor self); }
|
||||
public interface IVisibilityModifier { bool IsVisible(Actor self); }
|
||||
public interface IRadarColorModifier { Color RadarColorOverride(Actor self); }
|
||||
public interface IHasLocation { int2 PxPosition { get; } }
|
||||
|
||||
public interface IOccupySpace : IHasLocation
|
||||
{
|
||||
int2 TopLeft { get; }
|
||||
IEnumerable<Pair<int2, SubCell>> OccupiedCells();
|
||||
}
|
||||
public interface IOccupySpace : IHasLocation
|
||||
{
|
||||
int2 TopLeft { get; }
|
||||
IEnumerable<Pair<int2, SubCell>> OccupiedCells();
|
||||
}
|
||||
|
||||
public static class IOccupySpaceExts
|
||||
{
|
||||
public static int2 NearestCellTo(this IOccupySpace ios, int2 other)
|
||||
{
|
||||
var nearest = ios.TopLeft;
|
||||
var nearestDistance = int.MaxValue;
|
||||
foreach (var cell in ios.OccupiedCells())
|
||||
{
|
||||
var dist = (other - cell.First).LengthSquared;
|
||||
if (dist < nearestDistance)
|
||||
{
|
||||
nearest = cell.First;
|
||||
nearestDistance = dist;
|
||||
}
|
||||
}
|
||||
return nearest;
|
||||
}
|
||||
}
|
||||
public static class IOccupySpaceExts
|
||||
{
|
||||
public static int2 NearestCellTo(this IOccupySpace ios, int2 other)
|
||||
{
|
||||
var nearest = ios.TopLeft;
|
||||
var nearestDistance = int.MaxValue;
|
||||
foreach (var cell in ios.OccupiedCells())
|
||||
{
|
||||
var dist = (other - cell.First).LengthSquared;
|
||||
if (dist < nearestDistance)
|
||||
{
|
||||
nearest = cell.First;
|
||||
nearestDistance = dist;
|
||||
}
|
||||
}
|
||||
return nearest;
|
||||
}
|
||||
}
|
||||
|
||||
public interface INotifyAttack { void Attacking(Actor self, Target target); }
|
||||
public interface IRenderModifier { IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r); }
|
||||
public interface IDamageModifier { float GetDamageModifier(Actor attacker, WarheadInfo warhead); }
|
||||
public interface ISpeedModifier { decimal GetSpeedModifier(); }
|
||||
public interface IFirepowerModifier { float GetFirepowerModifier(); }
|
||||
public interface IPalette { void InitPalette(WorldRenderer wr); }
|
||||
public interface IPaletteModifier { void AdjustPalette(Dictionary<string, Palette> b); }
|
||||
public interface IPips { IEnumerable<PipType> GetPips(Actor self); }
|
||||
public interface ITags { IEnumerable<TagType> GetTags(); }
|
||||
public interface ISelectionBar { float GetValue(); Color GetColor(); }
|
||||
public interface INotifyAttack { void Attacking(Actor self, Target target); }
|
||||
public interface IRenderModifier { IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r); }
|
||||
public interface IDamageModifier { float GetDamageModifier(Actor attacker, WarheadInfo warhead); }
|
||||
public interface ISpeedModifier { decimal GetSpeedModifier(); }
|
||||
public interface IFirepowerModifier { float GetFirepowerModifier(); }
|
||||
public interface IPalette { void InitPalette(WorldRenderer wr); }
|
||||
public interface IPaletteModifier { void AdjustPalette(Dictionary<string, Palette> b); }
|
||||
public interface IPips { IEnumerable<PipType> GetPips(Actor self); }
|
||||
public interface ITags { IEnumerable<TagType> GetTags(); }
|
||||
public interface ISelectionBar { float GetValue(); Color GetColor(); }
|
||||
|
||||
public interface ITeleportable : IHasLocation /* crap name! */
|
||||
{
|
||||
bool CanEnterCell(int2 location);
|
||||
void SetPosition(Actor self, int2 cell);
|
||||
void SetPxPosition(Actor self, int2 px);
|
||||
void AdjustPxPosition(Actor self, int2 px); /* works like SetPxPosition, but visual only */
|
||||
}
|
||||
public interface ITeleportable : IHasLocation /* crap name! */
|
||||
{
|
||||
bool CanEnterCell(int2 location);
|
||||
void SetPosition(Actor self, int2 cell);
|
||||
void SetPxPosition(Actor self, int2 px);
|
||||
void AdjustPxPosition(Actor self, int2 px); /* works like SetPxPosition, but visual only */
|
||||
}
|
||||
|
||||
public interface IMove : ITeleportable { int Altitude { get; set; } }
|
||||
|
||||
@@ -141,86 +141,86 @@ namespace OpenRA.Traits
|
||||
|
||||
public interface IFacingInfo {} /* tag interface for infoclasses whose corresponding trait has IFacing */
|
||||
|
||||
public interface ICrushable
|
||||
{
|
||||
void OnCrush(Actor crusher);
|
||||
public interface ICrushable
|
||||
{
|
||||
void OnCrush(Actor crusher);
|
||||
void WarnCrush(Actor crusher);
|
||||
bool CrushableBy(string[] crushClasses, Player owner);
|
||||
}
|
||||
}
|
||||
|
||||
public struct Renderable
|
||||
{
|
||||
public readonly Sprite Sprite;
|
||||
public readonly float2 Pos;
|
||||
public readonly string Palette;
|
||||
public readonly int Z;
|
||||
public readonly int ZOffset;
|
||||
public float Scale;
|
||||
public struct Renderable
|
||||
{
|
||||
public readonly Sprite Sprite;
|
||||
public readonly float2 Pos;
|
||||
public readonly string Palette;
|
||||
public readonly int Z;
|
||||
public readonly int ZOffset;
|
||||
public float Scale;
|
||||
|
||||
public Renderable(Sprite sprite, float2 pos, string palette, int z, int zOffset, float scale)
|
||||
{
|
||||
Sprite = sprite;
|
||||
Pos = pos;
|
||||
Palette = palette;
|
||||
Z = z;
|
||||
ZOffset = zOffset;
|
||||
Scale = scale; /* default */
|
||||
}
|
||||
public Renderable(Sprite sprite, float2 pos, string palette, int z, int zOffset, float scale)
|
||||
{
|
||||
Sprite = sprite;
|
||||
Pos = pos;
|
||||
Palette = palette;
|
||||
Z = z;
|
||||
ZOffset = zOffset;
|
||||
Scale = scale; /* default */
|
||||
}
|
||||
|
||||
public Renderable(Sprite sprite, float2 pos, string palette, int z)
|
||||
: this(sprite, pos, palette, z, 0, 1f) { }
|
||||
public Renderable(Sprite sprite, float2 pos, string palette, int z)
|
||||
: this(sprite, pos, palette, z, 0, 1f) { }
|
||||
|
||||
public Renderable(Sprite sprite, float2 pos, string palette, int z, float scale)
|
||||
: this(sprite, pos, palette, z, 0, scale) { }
|
||||
public Renderable(Sprite sprite, float2 pos, string palette, int z, float scale)
|
||||
: this(sprite, pos, palette, z, 0, scale) { }
|
||||
|
||||
public Renderable WithScale(float newScale) { return new Renderable(Sprite, Pos, Palette, Z, ZOffset, newScale); }
|
||||
public Renderable WithPalette(string newPalette) { return new Renderable(Sprite, Pos, newPalette, Z, ZOffset, Scale); }
|
||||
public Renderable WithZOffset(int newOffset) { return new Renderable(Sprite, Pos, Palette, Z, newOffset, Scale); }
|
||||
public Renderable WithPos(float2 newPos) { return new Renderable(Sprite, newPos, Palette, Z, ZOffset, Scale); }
|
||||
}
|
||||
public Renderable WithScale(float newScale) { return new Renderable(Sprite, Pos, Palette, Z, ZOffset, newScale); }
|
||||
public Renderable WithPalette(string newPalette) { return new Renderable(Sprite, Pos, newPalette, Z, ZOffset, Scale); }
|
||||
public Renderable WithZOffset(int newOffset) { return new Renderable(Sprite, Pos, Palette, Z, newOffset, Scale); }
|
||||
public Renderable WithPos(float2 newPos) { return new Renderable(Sprite, newPos, Palette, Z, ZOffset, Scale); }
|
||||
}
|
||||
|
||||
public interface ITraitInfo { object Create(ActorInitializer init); }
|
||||
public interface ITraitInfo { object Create(ActorInitializer init); }
|
||||
|
||||
public class TraitInfo<T> : ITraitInfo where T : new() { public virtual object Create(ActorInitializer init) { return new T(); } }
|
||||
public class TraitInfo<T> : ITraitInfo where T : new() { public virtual object Create(ActorInitializer init) { return new T(); } }
|
||||
|
||||
public interface Requires<T> where T : class { }
|
||||
public interface Requires<T> where T : class { }
|
||||
|
||||
public interface INotifySelection { void SelectionChanged(); }
|
||||
public interface IWorldLoaded { void WorldLoaded(World w); }
|
||||
public interface ICreatePlayers { void CreatePlayers(World w); }
|
||||
public interface INotifySelection { void SelectionChanged(); }
|
||||
public interface IWorldLoaded { void WorldLoaded(World w); }
|
||||
public interface ICreatePlayers { void CreatePlayers(World w); }
|
||||
|
||||
public interface IBotInfo { string Name { get; } }
|
||||
public interface IBot
|
||||
{
|
||||
void Activate(Player p);
|
||||
IBotInfo Info { get; }
|
||||
}
|
||||
public interface IBotInfo { string Name { get; } }
|
||||
public interface IBot
|
||||
{
|
||||
void Activate(Player p);
|
||||
IBotInfo Info { get; }
|
||||
}
|
||||
|
||||
public interface IRenderOverlay { void Render(WorldRenderer wr); }
|
||||
public interface INotifyIdle { void TickIdle(Actor self); }
|
||||
public interface IRenderOverlay { void Render(WorldRenderer wr); }
|
||||
public interface INotifyIdle { void TickIdle(Actor self); }
|
||||
|
||||
public interface IBlocksBullets { }
|
||||
public interface IBlocksBullets { }
|
||||
|
||||
public interface IPostRender { void RenderAfterWorld(WorldRenderer wr, Actor self); }
|
||||
public interface IPostRender { void RenderAfterWorld(WorldRenderer wr, Actor self); }
|
||||
|
||||
public interface IPostRenderSelection { void RenderAfterWorld(WorldRenderer wr, Actor self); }
|
||||
public interface IPreRenderSelection { void RenderBeforeWorld(WorldRenderer wr, Actor self); }
|
||||
public interface IRenderAsTerrain { IEnumerable<Renderable> RenderAsTerrain(Actor self); }
|
||||
public interface IPostRenderSelection { void RenderAfterWorld(WorldRenderer wr, Actor self); }
|
||||
public interface IPreRenderSelection { void RenderBeforeWorld(WorldRenderer wr, Actor self); }
|
||||
public interface IRenderAsTerrain { IEnumerable<Renderable> RenderAsTerrain(Actor self); }
|
||||
|
||||
public interface ITargetable
|
||||
{
|
||||
string[] TargetTypes { get; }
|
||||
IEnumerable<int2> TargetableCells(Actor self);
|
||||
bool TargetableBy(Actor self, Actor byActor);
|
||||
}
|
||||
public interface ITargetable
|
||||
{
|
||||
string[] TargetTypes { get; }
|
||||
IEnumerable<int2> TargetableCells(Actor self);
|
||||
bool TargetableBy(Actor self, Actor byActor);
|
||||
}
|
||||
|
||||
public interface INotifyStanceChanged
|
||||
{
|
||||
void StanceChanged(Actor self, Player a, Player b,
|
||||
Stance oldStance, Stance newStance);
|
||||
}
|
||||
public interface INotifyStanceChanged
|
||||
{
|
||||
void StanceChanged(Actor self, Player a, Player b,
|
||||
Stance oldStance, Stance newStance);
|
||||
}
|
||||
|
||||
public interface ILintPass { void Run(Action<string> emitError, Action<string> emitWarning); }
|
||||
public interface ILintPass { void Run(Action<string> emitError, Action<string> emitWarning); }
|
||||
|
||||
public interface IObjectivesPanel { string ObjectivesPanel { get; } }
|
||||
}
|
||||
|
||||
@@ -122,17 +122,17 @@ namespace OpenRA.Traits
|
||||
|
||||
public static int2 CellContaining(float2 pos) { return (1f / Game.CellSize * pos).ToInt2(); }
|
||||
|
||||
/* pretty crap */
|
||||
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> ts, Thirdparty.Random random)
|
||||
{
|
||||
var items = ts.ToList();
|
||||
while (items.Count > 0)
|
||||
{
|
||||
var t = items.Random(random);
|
||||
yield return t;
|
||||
items.Remove(t);
|
||||
}
|
||||
}
|
||||
/* pretty crap */
|
||||
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> ts, Thirdparty.Random random)
|
||||
{
|
||||
var items = ts.ToList();
|
||||
while (items.Count > 0)
|
||||
{
|
||||
var t = items.Random(random);
|
||||
yield return t;
|
||||
items.Remove(t);
|
||||
}
|
||||
}
|
||||
|
||||
static IEnumerable<int2> Neighbours(int2 c, bool allowDiagonal)
|
||||
{
|
||||
|
||||
@@ -15,10 +15,10 @@ namespace OpenRA.Traits
|
||||
{
|
||||
public class ValidateOrderInfo : TraitInfo<ValidateOrder> { }
|
||||
|
||||
public class ValidateOrder : IValidateOrder
|
||||
{
|
||||
public bool OrderValidation(OrderManager orderManager, World world, int clientId, Order order)
|
||||
{
|
||||
public class ValidateOrder : IValidateOrder
|
||||
{
|
||||
public bool OrderValidation(OrderManager orderManager, World world, int clientId, Order order)
|
||||
{
|
||||
if (order.Subject == null || order.Subject.Owner == null)
|
||||
return true;
|
||||
|
||||
@@ -36,12 +36,12 @@ namespace OpenRA.Traits
|
||||
|
||||
// Drop exploiting orders
|
||||
if (subjectClientId != clientId && !isBotOrder)
|
||||
{
|
||||
Game.Debug("Detected exploit order from client {0}: {1}", clientId, order.OrderString);
|
||||
return false;
|
||||
}
|
||||
{
|
||||
Game.Debug("Detected exploit order from client {0}: {1}", clientId, order.OrderString);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace OpenRA.Traits
|
||||
{
|
||||
var paletteName = "{0}{1}".F( info.BaseName, owner.InternalName );
|
||||
var newpal = new Palette(wr.GetPalette(info.BasePalette),
|
||||
new PlayerColorRemap(owner.ColorRamp, info.PaletteFormat));
|
||||
new PlayerColorRemap(owner.ColorRamp, info.PaletteFormat));
|
||||
wr.AddPalette(paletteName, newpal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,16 +64,16 @@ namespace OpenRA.Traits
|
||||
for (int x = map.Bounds.Left; x < map.Bounds.Right; x++)
|
||||
for (int y = map.Bounds.Top; y < map.Bounds.Bottom; y++)
|
||||
{
|
||||
var type = resourceTypes.FirstOrDefault(
|
||||
var type = resourceTypes.FirstOrDefault(
|
||||
r => r.info.ResourceType == w.Map.MapResources.Value[x, y].type);
|
||||
|
||||
if (type == null)
|
||||
continue;
|
||||
if (type == null)
|
||||
continue;
|
||||
|
||||
if (!AllowResourceAt(type, new int2(x,y)))
|
||||
continue;
|
||||
|
||||
content[x, y].type = type;
|
||||
content[x, y].type = type;
|
||||
content[x, y].image = ChooseContent(type);
|
||||
}
|
||||
|
||||
@@ -86,13 +86,13 @@ namespace OpenRA.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public bool AllowResourceAt(ResourceType rt, int2 a)
|
||||
{
|
||||
if (!world.Map.IsInMap(a.X, a.Y)) return false;
|
||||
if (!rt.info.AllowedTerrainTypes.Contains(world.GetTerrainInfo(a).Type)) return false;
|
||||
if (!rt.info.AllowUnderActors && world.ActorMap.AnyUnitsAt(a)) return false;
|
||||
return true;
|
||||
}
|
||||
public bool AllowResourceAt(ResourceType rt, int2 a)
|
||||
{
|
||||
if (!world.Map.IsInMap(a.X, a.Y)) return false;
|
||||
if (!rt.info.AllowedTerrainTypes.Contains(world.GetTerrainInfo(a).Type)) return false;
|
||||
if (!rt.info.AllowUnderActors && world.ActorMap.AnyUnitsAt(a)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Sprite[] ChooseContent(ResourceType t)
|
||||
{
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace OpenRA.Traits
|
||||
public readonly string Name = null;
|
||||
public readonly string TerrainType = "Ore";
|
||||
|
||||
public readonly string[] AllowedTerrainTypes = { };
|
||||
public readonly bool AllowUnderActors = false;
|
||||
public readonly string[] AllowedTerrainTypes = { };
|
||||
public readonly bool AllowUnderActors = false;
|
||||
|
||||
public Sprite[][] Sprites;
|
||||
public int PaletteIndex;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.Traits
|
||||
public class ScreenShaker : ITick
|
||||
{
|
||||
int ticks = 0;
|
||||
List<ShakeEffect> shakeEffects = new List<ShakeEffect>();
|
||||
List<ShakeEffect> shakeEffects = new List<ShakeEffect>();
|
||||
|
||||
public void Tick (Actor self)
|
||||
{
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace OpenRA.Traits
|
||||
return;
|
||||
|
||||
if (a.Owner == null || a.Owner.World.LocalPlayer == null
|
||||
|| a.Owner.Stances[a.Owner.World.LocalPlayer] != Stance.Ally) return;
|
||||
|| a.Owner.Stances[a.Owner.World.LocalPlayer] != Stance.Ally) return;
|
||||
|
||||
if (vis.ContainsKey(a))
|
||||
{
|
||||
@@ -160,7 +160,7 @@ namespace OpenRA.Traits
|
||||
public void UpdateActor(Actor a)
|
||||
{
|
||||
if (a.Owner == null || a.Owner.World.LocalPlayer == null
|
||||
|| a.Owner.Stances[a.Owner.World.LocalPlayer] != Stance.Ally) return;
|
||||
|| a.Owner.Stances[a.Owner.World.LocalPlayer] != Stance.Ally) return;
|
||||
|
||||
RemoveActor(a); AddActor(a);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user