ActorInitializer, in preparation for next change (bob)
This commit is contained in:
@@ -36,9 +36,9 @@ namespace OpenRA
|
|||||||
public readonly ActorInfo Info;
|
public readonly ActorInfo Info;
|
||||||
|
|
||||||
public readonly World World;
|
public readonly World World;
|
||||||
public readonly uint ActorID;
|
public readonly uint ActorID;
|
||||||
|
|
||||||
[Sync]
|
[Sync]
|
||||||
public int2 Location;
|
public int2 Location;
|
||||||
[Sync]
|
[Sync]
|
||||||
public Player Owner;
|
public Player Owner;
|
||||||
@@ -49,13 +49,15 @@ namespace OpenRA
|
|||||||
public Group Group;
|
public Group Group;
|
||||||
|
|
||||||
public Actor(World world, string name, int2 location, Player owner)
|
public Actor(World world, string name, int2 location, Player owner)
|
||||||
{
|
{
|
||||||
World = world;
|
World = world;
|
||||||
ActorID = world.NextAID();
|
ActorID = world.NextAID();
|
||||||
Location = location;
|
Location = location;
|
||||||
CenterLocation = Traits.Util.CenterOfCell(Location);
|
CenterLocation = Traits.Util.CenterOfCell(Location);
|
||||||
Owner = owner;
|
Owner = owner;
|
||||||
|
|
||||||
|
var init = new ActorInitializer( this );
|
||||||
|
|
||||||
if (name != null)
|
if (name != null)
|
||||||
{
|
{
|
||||||
if (!Rules.Info.ContainsKey(name.ToLowerInvariant()))
|
if (!Rules.Info.ContainsKey(name.ToLowerInvariant()))
|
||||||
@@ -65,9 +67,9 @@ namespace OpenRA
|
|||||||
Health = this.GetMaxHP();
|
Health = this.GetMaxHP();
|
||||||
|
|
||||||
foreach (var trait in Info.TraitsInConstructOrder())
|
foreach (var trait in Info.TraitsInConstructOrder())
|
||||||
traits.Add(trait.Create(this));
|
traits.Add(trait.Create(init));
|
||||||
}
|
}
|
||||||
|
|
||||||
Size = Lazy.New(() =>
|
Size = Lazy.New(() =>
|
||||||
{
|
{
|
||||||
var si = Info.Traits.GetOrDefault<SelectableInfo>();
|
var si = Info.Traits.GetOrDefault<SelectableInfo>();
|
||||||
@@ -254,5 +256,16 @@ namespace OpenRA
|
|||||||
var o = obj as Actor;
|
var o = obj as Actor;
|
||||||
return ( o != null && o.ActorID == ActorID );
|
return ( o != null && o.ActorID == ActorID );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ActorInitializer
|
||||||
|
{
|
||||||
|
public readonly Actor self;
|
||||||
|
public World world { get { return self.World; } }
|
||||||
|
|
||||||
|
public ActorInitializer( Actor actor )
|
||||||
|
{
|
||||||
|
this.self = actor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace OpenRA.Traits
|
|||||||
public readonly bool MuzzleFlash = false;
|
public readonly bool MuzzleFlash = false;
|
||||||
public readonly int FireDelay = 0;
|
public readonly int FireDelay = 0;
|
||||||
|
|
||||||
public virtual object Create(Actor self) { return new AttackBase(self); }
|
public virtual object Create(ActorInitializer init) { return new AttackBase(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AttackBase : IIssueOrder, IResolveOrder, ITick
|
public class AttackBase : IIssueOrder, IResolveOrder, ITick
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Traits
|
|||||||
public readonly string LongDesc = "";
|
public readonly string LongDesc = "";
|
||||||
public readonly string[] Owner = { };
|
public readonly string[] Owner = { };
|
||||||
|
|
||||||
public virtual object Create(Actor self) { return new Valued(); }
|
public virtual object Create(ActorInitializer init) { return new Valued(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class BuildableInfo : ValuedInfo
|
class BuildableInfo : ValuedInfo
|
||||||
@@ -40,7 +40,7 @@ namespace OpenRA.Traits
|
|||||||
public readonly int BuildPaletteOrder = 9999;
|
public readonly int BuildPaletteOrder = 9999;
|
||||||
public readonly string Hotkey = null;
|
public readonly string Hotkey = null;
|
||||||
|
|
||||||
public override object Create(Actor self) { return new Buildable(); }
|
public override object Create(ActorInitializer init) { return new Buildable(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Valued { } /* halfway to buildable */
|
class Valued { } /* halfway to buildable */
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace OpenRA.Traits
|
|||||||
public readonly string DamagedSound = "kaboom1.aud";
|
public readonly string DamagedSound = "kaboom1.aud";
|
||||||
public readonly string DestroyedSound = "kaboom22.aud";
|
public readonly string DestroyedSound = "kaboom22.aud";
|
||||||
|
|
||||||
public object Create(Actor self) { return new Building(self); }
|
public object Create(ActorInitializer init) { return new Building(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Building : INotifyDamage, IResolveOrder, ITick, IRenderModifier
|
public class Building : INotifyDamage, IResolveOrder, ITick, IRenderModifier
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ namespace OpenRA.Traits
|
|||||||
public readonly float CloakDelay = 1.2f; // Seconds
|
public readonly float CloakDelay = 1.2f; // Seconds
|
||||||
public readonly string CloakSound = "subshow1.aud";
|
public readonly string CloakSound = "subshow1.aud";
|
||||||
public readonly string UncloakSound = "subshow1.aud";
|
public readonly string UncloakSound = "subshow1.aud";
|
||||||
public object Create(Actor self) { return new Cloak(self); }
|
|
||||||
|
public object Create(ActorInitializer init) { return new Cloak(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Cloak : IRenderModifier, INotifyAttack, ITick, INotifyDamage
|
public class Cloak : IRenderModifier, INotifyAttack, ITick, INotifyDamage
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Traits
|
|||||||
public readonly int Ammo = 0;
|
public readonly int Ammo = 0;
|
||||||
public readonly int PipCount = 0;
|
public readonly int PipCount = 0;
|
||||||
|
|
||||||
public object Create(Actor self) { return new LimitedAmmo(self); }
|
public object Create(ActorInitializer init) { return new LimitedAmmo(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LimitedAmmo : INotifyAttack, IPips
|
public class LimitedAmmo : INotifyAttack, IPips
|
||||||
|
|||||||
@@ -24,13 +24,13 @@ using OpenRA.GameRules;
|
|||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
public class MobileInfo : ITraitInfo
|
public class MobileInfo : ITraitInfo, ITraitPrerequisite<Unit>
|
||||||
{
|
{
|
||||||
public readonly UnitMovementType MovementType = UnitMovementType.Wheel;
|
public readonly UnitMovementType MovementType = UnitMovementType.Wheel;
|
||||||
public readonly int WaitAverage = 60;
|
public readonly int WaitAverage = 60;
|
||||||
public readonly int WaitSpread = 20;
|
public readonly int WaitSpread = 20;
|
||||||
|
|
||||||
public object Create(Actor self) { return new Mobile(self); }
|
public object Create(ActorInitializer init) { return new Mobile(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Mobile : IIssueOrder, IResolveOrder, IOccupySpace, IMovement
|
public class Mobile : IIssueOrder, IResolveOrder, IOccupySpace, IMovement
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
class HiddenUnderFogInfo : ITraitInfo
|
class HiddenUnderFogInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public object Create(Actor self) { return new HiddenUnderFog(self); }
|
public object Create(ActorInitializer init) { return new HiddenUnderFog(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class HiddenUnderFog : IRenderModifier
|
class HiddenUnderFog : IRenderModifier
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ namespace OpenRA.Traits
|
|||||||
public readonly int InitialCash = 10000;
|
public readonly int InitialCash = 10000;
|
||||||
public readonly int InitialOre = 0;
|
public readonly int InitialOre = 0;
|
||||||
public readonly int AdviceInterval = 250;
|
public readonly int AdviceInterval = 250;
|
||||||
public object Create(Actor self) { return new PlayerResources(self); }
|
|
||||||
|
public object Create(ActorInitializer init) { return new PlayerResources(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PlayerResources : ITick
|
public class PlayerResources : ITick
|
||||||
@@ -19,8 +20,7 @@ namespace OpenRA.Traits
|
|||||||
int AdviceInterval;
|
int AdviceInterval;
|
||||||
public PlayerResources(Actor self)
|
public PlayerResources(Actor self)
|
||||||
{
|
{
|
||||||
var p = self.Owner;
|
Owner = self.Owner;
|
||||||
Owner = p;
|
|
||||||
Cash = self.Info.Traits.Get<PlayerResourcesInfo>().InitialCash;
|
Cash = self.Info.Traits.Get<PlayerResourcesInfo>().InitialCash;
|
||||||
Ore = self.Info.Traits.Get<PlayerResourcesInfo>().InitialOre;
|
Ore = self.Info.Traits.Get<PlayerResourcesInfo>().InitialOre;
|
||||||
AdviceInterval = self.Info.Traits.Get<PlayerResourcesInfo>().AdviceInterval;
|
AdviceInterval = self.Info.Traits.Get<PlayerResourcesInfo>().AdviceInterval;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
public readonly float BuildSpeed = 0.4f;
|
public readonly float BuildSpeed = 0.4f;
|
||||||
public readonly int LowPowerSlowdown = 3;
|
public readonly int LowPowerSlowdown = 3;
|
||||||
public object Create(Actor self) { return new ProductionQueue(self); }
|
public object Create(ActorInitializer init) { return new ProductionQueue(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProductionQueue : IResolveOrder, ITick
|
class ProductionQueue : IResolveOrder, ITick
|
||||||
|
|||||||
@@ -24,20 +24,16 @@ using OpenRA.GameRules;
|
|||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
public class ProductionInfo : ITraitInfo
|
public class ProductionInfo : TraitInfo<Production>
|
||||||
{
|
{
|
||||||
public readonly int[] SpawnOffset = null;
|
public readonly int[] SpawnOffset = null;
|
||||||
public readonly int[] ProductionOffset = null;
|
public readonly int[] ProductionOffset = null;
|
||||||
public readonly int[] ExitOffset = null;
|
public readonly int[] ExitOffset = null;
|
||||||
public readonly string[] Produces = { };
|
public readonly string[] Produces = { };
|
||||||
|
|
||||||
public virtual object Create(Actor self) { return new Production(self); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Production : IIssueOrder, IResolveOrder, ITags
|
public class Production : IIssueOrder, IResolveOrder, ITags
|
||||||
{
|
{
|
||||||
public Production( Actor self ) { }
|
|
||||||
|
|
||||||
public virtual int2? CreationLocation( Actor self, ActorInfo producee )
|
public virtual int2? CreationLocation( Actor self, ActorInfo producee )
|
||||||
{
|
{
|
||||||
var pos = (1 / 24f * self.CenterLocation).ToInt2();
|
var pos = (1 / 24f * self.CenterLocation).ToInt2();
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
public readonly int[] RallyPoint = { 1, 3 };
|
public readonly int[] RallyPoint = { 1, 3 };
|
||||||
|
|
||||||
public object Create(Actor self) { return new RallyPoint(self); }
|
public object Create(ActorInitializer init) { return new RallyPoint(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RallyPoint : IRender, IIssueOrder, IResolveOrder, ITick
|
public class RallyPoint : IRender, IIssueOrder, IResolveOrder, ITick
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Traits
|
|||||||
public class RenderBuildingInfo : RenderSimpleInfo
|
public class RenderBuildingInfo : RenderSimpleInfo
|
||||||
{
|
{
|
||||||
public readonly bool HasMakeAnimation = true;
|
public readonly bool HasMakeAnimation = true;
|
||||||
public override object Create(Actor self) { return new RenderBuilding(self);}
|
public override object Create(ActorInitializer init) { return new RenderBuilding(init.self);}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RenderBuilding : RenderSimple, INotifyDamage, INotifySold
|
public class RenderBuilding : RenderSimple, INotifyDamage, INotifySold
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
class RenderBuildingTurretedInfo : RenderBuildingInfo
|
class RenderBuildingTurretedInfo : RenderBuildingInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new RenderBuildingTurreted(self); }
|
public override object Create(ActorInitializer init) { return new RenderBuildingTurreted(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RenderBuildingTurreted : RenderBuilding, INotifyBuildComplete
|
class RenderBuildingTurreted : RenderBuilding, INotifyBuildComplete
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
public readonly string Image = null;
|
public readonly string Image = null;
|
||||||
public readonly string Palette = null;
|
public readonly string Palette = null;
|
||||||
public abstract object Create(Actor self);
|
public abstract object Create(ActorInitializer init);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class RenderSimple : IRender, ITick
|
public abstract class RenderSimple : IRender, ITick
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
public class RenderUnitInfo : RenderSimpleInfo
|
public class RenderUnitInfo : RenderSimpleInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new RenderUnit(self); }
|
public override object Create(ActorInitializer init) { return new RenderUnit(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RenderUnit : RenderSimple, INotifyDamage
|
public class RenderUnit : RenderSimple, INotifyDamage
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
class RenderUnitTurretedInfo : RenderUnitInfo
|
class RenderUnitTurretedInfo : RenderUnitInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new RenderUnitTurreted(self); }
|
public override object Create(ActorInitializer init) { return new RenderUnitTurreted(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RenderUnitTurreted : RenderUnit
|
class RenderUnitTurreted : RenderUnit
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Traits
|
|||||||
public readonly PipType PipColor = PipType.Yellow;
|
public readonly PipType PipColor = PipType.Yellow;
|
||||||
public readonly int Capacity = 0;
|
public readonly int Capacity = 0;
|
||||||
public readonly string DeathWeapon = null;
|
public readonly string DeathWeapon = null;
|
||||||
public object Create(Actor self) { return new StoresOre(self, this); }
|
public object Create(ActorInitializer init) { return new StoresOre(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class StoresOre : IPips, INotifyCapture, INotifyDamage
|
class StoresOre : IPips, INotifyCapture, INotifyDamage
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace OpenRA.Traits
|
|||||||
public readonly string SelectTargetSound = null;
|
public readonly string SelectTargetSound = null;
|
||||||
public readonly string LaunchSound = null;
|
public readonly string LaunchSound = null;
|
||||||
|
|
||||||
public abstract object Create(Actor self);
|
public abstract object Create(ActorInitializer init);
|
||||||
|
|
||||||
public SupportPowerInfo() { OrderName = GetType().Name + "Order"; }
|
public SupportPowerInfo() { OrderName = GetType().Name + "Order"; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,9 +108,9 @@ namespace OpenRA.Traits
|
|||||||
public Renderable WithPos(float2 newPos) { return new Renderable(Sprite, newPos, Palette, ZOffset); }
|
public Renderable WithPos(float2 newPos) { return new Renderable(Sprite, newPos, Palette, ZOffset); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ITraitInfo { object Create(Actor self); }
|
public interface ITraitInfo { object Create(ActorInitializer init); }
|
||||||
|
|
||||||
public class TraitInfo<T> : ITraitInfo where T : new() { public object Create(Actor self) { return new T(); } }
|
public class TraitInfo<T> : ITraitInfo where T : new() { public virtual object Create(ActorInitializer init) { return new T(); } }
|
||||||
|
|
||||||
public interface ITraitPrerequisite<T> { }
|
public interface ITraitPrerequisite<T> { }
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ using OpenRA.Traits.Activities;
|
|||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
class TransformsOnDeployInfo : ITraitInfo
|
class TransformsOnDeployInfo : TraitInfo<TransformsOnDeploy>
|
||||||
{
|
{
|
||||||
public readonly string TransformsInto = null;
|
public readonly string TransformsInto = null;
|
||||||
public readonly int[] Offset = null;
|
public readonly int[] Offset = null;
|
||||||
@@ -30,14 +30,10 @@ namespace OpenRA.Traits
|
|||||||
public readonly bool TransferHealthPercentage = true; // Set to false to transfer the absolute health
|
public readonly bool TransferHealthPercentage = true; // Set to false to transfer the absolute health
|
||||||
public readonly string[] TransformSounds = null;
|
public readonly string[] TransformSounds = null;
|
||||||
public readonly string[] NoTransformSounds = null;
|
public readonly string[] NoTransformSounds = null;
|
||||||
|
|
||||||
public object Create(Actor self) { return new TransformsOnDeploy(self); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TransformsOnDeploy : IIssueOrder, IResolveOrder
|
class TransformsOnDeploy : IIssueOrder, IResolveOrder
|
||||||
{
|
{
|
||||||
public TransformsOnDeploy(Actor self) { }
|
|
||||||
|
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
if (mi.Button == MouseButton.Right && self == underCursor)
|
if (mi.Button == MouseButton.Right && self == underCursor)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Traits
|
|||||||
public readonly int ROT = 255;
|
public readonly int ROT = 255;
|
||||||
public readonly int InitialFacing = 128;
|
public readonly int InitialFacing = 128;
|
||||||
|
|
||||||
public object Create(Actor self) { return new Turreted(self); }
|
public object Create(ActorInitializer init) { return new Turreted(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Turreted : ITick
|
public class Turreted : ITick
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Traits
|
|||||||
public readonly int ROT = 255;
|
public readonly int ROT = 255;
|
||||||
public readonly int Speed = 1;
|
public readonly int Speed = 1;
|
||||||
|
|
||||||
public object Create( Actor self ) { return new Unit( self ); }
|
public object Create( ActorInitializer init ) { return new Unit( init.self ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Unit : INotifyDamage
|
public class Unit : INotifyDamage
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
public readonly string[] BibTypes = {"bib3", "bib2", "bib1"};
|
public readonly string[] BibTypes = {"bib3", "bib2", "bib1"};
|
||||||
public readonly int[] BibWidths = {2,3,4};
|
public readonly int[] BibWidths = {2,3,4};
|
||||||
public object Create(Actor self) { return new BibLayer(self, this); }
|
public object Create(ActorInitializer init) { return new BibLayer(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class BibLayer: IRenderOverlay, ILoadWorldHook
|
class BibLayer: IRenderOverlay, ILoadWorldHook
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
public class BuildingInfluenceInfo : ITraitInfo
|
public class BuildingInfluenceInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public object Create( Actor self ) { return new BuildingInfluence( self ); }
|
public object Create( ActorInitializer init ) { return new BuildingInfluence( init.world ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BuildingInfluence
|
public class BuildingInfluence
|
||||||
@@ -34,17 +34,17 @@ namespace OpenRA.Traits
|
|||||||
Actor[,] influence;
|
Actor[,] influence;
|
||||||
Map map;
|
Map map;
|
||||||
|
|
||||||
public BuildingInfluence( Actor self )
|
public BuildingInfluence( World world )
|
||||||
{
|
{
|
||||||
map = self.World.Map;
|
map = world.Map;
|
||||||
|
|
||||||
blocked = new bool[map.MapSize.X, map.MapSize.Y];
|
blocked = new bool[map.MapSize.X, map.MapSize.Y];
|
||||||
influence = new Actor[map.MapSize.X, map.MapSize.Y];
|
influence = new Actor[map.MapSize.X, map.MapSize.Y];
|
||||||
|
|
||||||
self.World.ActorAdded +=
|
world.ActorAdded +=
|
||||||
a => { if (a.traits.Contains<Building>())
|
a => { if (a.traits.Contains<Building>())
|
||||||
ChangeInfluence(a, a.traits.Get<Building>(), true); };
|
ChangeInfluence(a, a.traits.Get<Building>(), true); };
|
||||||
self.World.ActorRemoved +=
|
world.ActorRemoved +=
|
||||||
a => { if (a.traits.Contains<Building>())
|
a => { if (a.traits.Contains<Building>())
|
||||||
ChangeInfluence(a, a.traits.Get<Building>(), false); };
|
ChangeInfluence(a, a.traits.Get<Building>(), false); };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,15 +20,13 @@
|
|||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
public class CountryInfo : ITraitInfo
|
public class CountryInfo : TraitInfo<Country>
|
||||||
{
|
{
|
||||||
public readonly string Name = null;
|
public readonly string Name = null;
|
||||||
public readonly string Race = null;
|
public readonly string Race = null;
|
||||||
|
|
||||||
/* todo: icon,... */
|
/* todo: icon,... */
|
||||||
|
|
||||||
public object Create(Actor self) { return new CountryInfo(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Country { /* we're only interested in the Info */ }
|
public class Country { /* we're only interested in the Info */ }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,16 +36,16 @@ namespace OpenRA.Traits
|
|||||||
public readonly int[] DisplayColor = null;
|
public readonly int[] DisplayColor = null;
|
||||||
public readonly bool Playable = true;
|
public readonly bool Playable = true;
|
||||||
|
|
||||||
public object Create(Actor self) { return new PlayerColorPalette(self, this); }
|
public object Create(ActorInitializer init) { return new PlayerColorPalette(init.world, this); }
|
||||||
|
|
||||||
public Color Color { get { return Util.ArrayToColor(DisplayColor); } }
|
public Color Color { get { return Util.ArrayToColor(DisplayColor); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PlayerColorPalette
|
public class PlayerColorPalette
|
||||||
{
|
{
|
||||||
public PlayerColorPalette(Actor self, PlayerColorPaletteInfo info)
|
public PlayerColorPalette(World world, PlayerColorPaletteInfo info)
|
||||||
{
|
{
|
||||||
var wr = self.World.WorldRenderer;
|
var wr = world.WorldRenderer;
|
||||||
var pal = wr.GetPalette(info.BasePalette);
|
var pal = wr.GetPalette(info.BasePalette);
|
||||||
var newpal = new Palette(pal, new PlayerColorRemap(
|
var newpal = new Palette(pal, new PlayerColorRemap(
|
||||||
Util.ArrayToColor(info.Color1),
|
Util.ArrayToColor(info.Color1),
|
||||||
|
|||||||
@@ -26,10 +26,7 @@ using System.Drawing;
|
|||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
public class ResourceLayerInfo : ITraitInfo
|
public class ResourceLayerInfo : TraitInfo<ResourceLayer> { }
|
||||||
{
|
|
||||||
public object Create(Actor self) { return new ResourceLayer(self); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ResourceLayer: IRenderOverlay, ILoadWorldHook, ICustomTerrain
|
public class ResourceLayer: IRenderOverlay, ILoadWorldHook, ICustomTerrain
|
||||||
{
|
{
|
||||||
@@ -39,7 +36,7 @@ namespace OpenRA.Traits
|
|||||||
public ResourceType[] resourceTypes;
|
public ResourceType[] resourceTypes;
|
||||||
CellContents[,] content;
|
CellContents[,] content;
|
||||||
|
|
||||||
public ResourceLayer(Actor self)
|
public ResourceLayer()
|
||||||
{
|
{
|
||||||
sr = Game.renderer.SpriteRenderer;
|
sr = Game.renderer.SpriteRenderer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public Sprite[][] Sprites;
|
public Sprite[][] Sprites;
|
||||||
|
|
||||||
public object Create(Actor self) { return new ResourceType(this); }
|
public object Create(ActorInitializer init) { return new ResourceType(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ResourceType
|
public class ResourceType
|
||||||
|
|||||||
@@ -24,10 +24,7 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
class ScreenShakerInfo : ITraitInfo
|
class ScreenShakerInfo : TraitInfo<ScreenShaker> {}
|
||||||
{
|
|
||||||
public object Create( Actor self ) { return new ScreenShaker(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ScreenShaker : ITick
|
public class ScreenShaker : ITick
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
public class ShroudInfo : ITraitInfo
|
public class ShroudInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public object Create(Actor self) { return new Shroud(self); }
|
public object Create(ActorInitializer init) { return new Shroud(init.world); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Shroud
|
public class Shroud
|
||||||
@@ -41,14 +41,14 @@ namespace OpenRA.Traits
|
|||||||
public Rectangle? exploredBounds;
|
public Rectangle? exploredBounds;
|
||||||
public event Action Dirty = () => { };
|
public event Action Dirty = () => { };
|
||||||
|
|
||||||
public Shroud(Actor self)
|
public Shroud(World world)
|
||||||
{
|
{
|
||||||
map = self.World.Map;
|
map = world.Map;
|
||||||
visibleCells = new int[map.MapSize.X, map.MapSize.Y];
|
visibleCells = new int[map.MapSize.X, map.MapSize.Y];
|
||||||
exploredCells = new bool[map.MapSize.X, map.MapSize.Y];
|
exploredCells = new bool[map.MapSize.X, map.MapSize.Y];
|
||||||
|
|
||||||
self.World.ActorAdded += AddActor;
|
world.ActorAdded += AddActor;
|
||||||
self.World.ActorRemoved += RemoveActor;
|
world.ActorRemoved += RemoveActor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cache of positions that were added, so no matter what crazy trait code does, it
|
// cache of positions that were added, so no matter what crazy trait code does, it
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Traits
|
|||||||
public readonly string Type = "Scorch";
|
public readonly string Type = "Scorch";
|
||||||
public readonly string[] Types = {"sc1", "sc2", "sc3", "sc4", "sc5", "sc6"};
|
public readonly string[] Types = {"sc1", "sc2", "sc3", "sc4", "sc5", "sc6"};
|
||||||
public readonly int[] Depths = {1,1,1,1,1,1};
|
public readonly int[] Depths = {1,1,1,1,1,1};
|
||||||
public object Create(Actor self) { return new SmudgeLayer(self, this); }
|
public object Create(ActorInitializer init) { return new SmudgeLayer(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class SmudgeLayer: IRenderOverlay, ILoadWorldHook
|
class SmudgeLayer: IRenderOverlay, ILoadWorldHook
|
||||||
@@ -42,7 +42,7 @@ namespace OpenRA.Traits
|
|||||||
Sprite[][] smudgeSprites;
|
Sprite[][] smudgeSprites;
|
||||||
World world;
|
World world;
|
||||||
|
|
||||||
public SmudgeLayer(Actor self, SmudgeLayerInfo info)
|
public SmudgeLayer(SmudgeLayerInfo info)
|
||||||
{
|
{
|
||||||
spriteRenderer = Game.renderer.SpriteRenderer;
|
spriteRenderer = Game.renderer.SpriteRenderer;
|
||||||
this.Info = info;
|
this.Info = info;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Traits
|
|||||||
class SpatialBinsInfo : ITraitInfo
|
class SpatialBinsInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly int BinSize = 8;
|
public readonly int BinSize = 8;
|
||||||
public object Create(Actor self) { return new SpatialBins( self, this ); }
|
public object Create(ActorInitializer init) { return new SpatialBins( init.self, this ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class SpatialBins : ITick
|
class SpatialBins : ITick
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
public class UnitInfluenceInfo : ITraitInfo
|
public class UnitInfluenceInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public object Create( Actor self ) { return new UnitInfluence( self ); }
|
public object Create( ActorInitializer init ) { return new UnitInfluence( init.world ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UnitInfluence : ITick
|
public class UnitInfluence : ITick
|
||||||
@@ -36,15 +36,15 @@ namespace OpenRA.Traits
|
|||||||
List<Actor>[,] influence;
|
List<Actor>[,] influence;
|
||||||
Map map;
|
Map map;
|
||||||
|
|
||||||
public UnitInfluence( Actor self )
|
public UnitInfluence( World world )
|
||||||
{
|
{
|
||||||
map = self.World.Map;
|
map = world.Map;
|
||||||
influence = new List<Actor>[self.World.Map.MapSize.X, self.World.Map.MapSize.Y];
|
influence = new List<Actor>[world.Map.MapSize.X, world.Map.MapSize.Y];
|
||||||
for (int i = 0; i < self.World.Map.MapSize.X; i++)
|
for (int i = 0; i < world.Map.MapSize.X; i++)
|
||||||
for (int j = 0; j < self.World.Map.MapSize.Y; j++)
|
for (int j = 0; j < world.Map.MapSize.Y; j++)
|
||||||
influence[ i, j ] = new List<Actor>();
|
influence[ i, j ] = new List<Actor>();
|
||||||
|
|
||||||
self.World.ActorRemoved += a => Remove( a, a.traits.GetOrDefault<IOccupySpace>() );
|
world.ActorRemoved += a => Remove( a, a.traits.GetOrDefault<IOccupySpace>() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick( Actor self )
|
public void Tick( Actor self )
|
||||||
|
|||||||
@@ -27,10 +27,9 @@ using OpenRA.Mods.RA;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Aftermath
|
namespace OpenRA.Mods.Aftermath
|
||||||
{
|
{
|
||||||
class ChronoshiftDeployInfo : ITraitInfo
|
class ChronoshiftDeployInfo : TraitInfo<ChronoshiftDeploy>
|
||||||
{
|
{
|
||||||
public readonly int ChargeTime = 120; // Seconds
|
public readonly int ChargeTime = 120; // Seconds
|
||||||
public object Create(Actor self) { return new ChronoshiftDeploy(self); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChronoshiftDeploy : IIssueOrder, IResolveOrder, ITick, IPips
|
class ChronoshiftDeploy : IIssueOrder, IResolveOrder, ITick, IPips
|
||||||
@@ -39,8 +38,6 @@ namespace OpenRA.Mods.Aftermath
|
|||||||
[Sync]
|
[Sync]
|
||||||
int chargeTick = 0; // How long until we can chronoshift again?
|
int chargeTick = 0; // How long until we can chronoshift again?
|
||||||
|
|
||||||
public ChronoshiftDeploy(Actor self) { }
|
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (chargeTick > 0)
|
if (chargeTick > 0)
|
||||||
|
|||||||
@@ -23,15 +23,10 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Aftermath
|
namespace OpenRA.Mods.Aftermath
|
||||||
{
|
{
|
||||||
class DemoTruckInfo : ITraitInfo
|
class DemoTruckInfo : TraitInfo<DemoTruck> { }
|
||||||
{
|
|
||||||
public object Create(Actor self) { return new DemoTruck(self); }
|
|
||||||
}
|
|
||||||
|
|
||||||
class DemoTruck : Chronoshiftable, INotifyDamage
|
class DemoTruck : Chronoshiftable, INotifyDamage
|
||||||
{
|
{
|
||||||
public DemoTruck(Actor self) : base(self) { }
|
|
||||||
|
|
||||||
// Explode on chronoshift
|
// Explode on chronoshift
|
||||||
public override bool Activate(Actor self, int2 targetLocation, int duration, bool killCargo, Actor chronosphere)
|
public override bool Activate(Actor self, int2 targetLocation, int duration, bool killCargo, Actor chronosphere)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
class CriticalBuildingStateInfo : ITraitInfo
|
class CriticalBuildingStateInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly int LingerTime = 20;
|
public readonly int LingerTime = 20;
|
||||||
public object Create(Actor self) { return new CriticalBuildingState(self, this); }
|
public object Create(ActorInitializer init) { return new CriticalBuildingState(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class CriticalBuildingState : INotifyDamage
|
class CriticalBuildingState : INotifyDamage
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
{
|
{
|
||||||
class IonCannonPowerInfo : SupportPowerInfo
|
class IonCannonPowerInfo : SupportPowerInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new IonCannonPower(self, this); }
|
public override object Create(ActorInitializer init) { return new IonCannonPower(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class IonCannonPower : SupportPower, IResolveOrder
|
class IonCannonPower : SupportPower, IResolveOrder
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
public readonly string Weapon = "Tiberium";
|
public readonly string Weapon = "Tiberium";
|
||||||
public readonly string[] Resources = { "Tiberium" };
|
public readonly string[] Resources = { "Tiberium" };
|
||||||
|
|
||||||
public object Create(Actor self) { return new PoisonedByTiberium(this); }
|
public object Create(ActorInitializer init) { return new PoisonedByTiberium(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class PoisonedByTiberium : ITick
|
class PoisonedByTiberium : ITick
|
||||||
|
|||||||
@@ -28,13 +28,11 @@ namespace OpenRA.Mods.Cnc
|
|||||||
{
|
{
|
||||||
public class ProductionAirdropInfo : ProductionInfo
|
public class ProductionAirdropInfo : ProductionInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new ProductionAirdrop(self); }
|
public override object Create(ActorInitializer init) { return new ProductionAirdrop(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProductionAirdrop : Production
|
class ProductionAirdrop : Production
|
||||||
{
|
{
|
||||||
public ProductionAirdrop(Actor self) : base(self) { }
|
|
||||||
|
|
||||||
public override bool Produce( Actor self, ActorInfo producee )
|
public override bool Produce( Actor self, ActorInfo producee )
|
||||||
{
|
{
|
||||||
var owner = self.Owner;
|
var owner = self.Owner;
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
public readonly string UnitType = "badr.bomber";
|
public readonly string UnitType = "badr.bomber";
|
||||||
public readonly string FlareType = null;
|
public readonly string FlareType = null;
|
||||||
public override object Create(Actor self) { return new AirstrikePower(self, this); }
|
|
||||||
|
public override object Create(ActorInitializer init) { return new AirstrikePower(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class AirstrikePower : SupportPower, IResolveOrder
|
class AirstrikePower : SupportPower, IResolveOrder
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class AttackHeliInfo : AttackBaseInfo
|
class AttackHeliInfo : AttackBaseInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new AttackHeli(self); }
|
public override object Create(ActorInitializer init) { return new AttackHeli(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class AttackHeli : AttackFrontal
|
class AttackHeli : AttackFrontal
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class AttackLeapInfo : AttackBaseInfo
|
class AttackLeapInfo : AttackBaseInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new AttackLeap(self); }
|
public override object Create(ActorInitializer init) { return new AttackLeap(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class AttackLeap : AttackBase
|
class AttackLeap : AttackBase
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class AttackOmniInfo : AttackBaseInfo
|
class AttackOmniInfo : AttackBaseInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new AttackOmni(self); }
|
public override object Create(ActorInitializer init) { return new AttackOmni(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class AttackOmni : AttackBase, INotifyBuildComplete
|
class AttackOmni : AttackBase, INotifyBuildComplete
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class AttackPlaneInfo : AttackBaseInfo
|
class AttackPlaneInfo : AttackBaseInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new AttackPlane(self); }
|
public override object Create(ActorInitializer init) { return new AttackPlane(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class AttackPlane : AttackFrontal
|
class AttackPlane : AttackFrontal
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class AttackTeslaInfo : AttackOmniInfo
|
class AttackTeslaInfo : AttackOmniInfo
|
||||||
{
|
{
|
||||||
public readonly int MaxCharges = 3;
|
public readonly int MaxCharges = 3;
|
||||||
public override object Create(Actor self) { return new AttackTesla(self); }
|
public override object Create(ActorInitializer init) { return new AttackTesla(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class AttackTesla : AttackOmni, ITick
|
class AttackTesla : AttackOmni, ITick
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class AttackTurretedInfo : AttackBaseInfo
|
class AttackTurretedInfo : AttackBaseInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new AttackTurreted( self ); }
|
public override object Create(ActorInitializer init) { return new AttackTurreted( init.self ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class AttackTurreted : AttackBase, INotifyBuildComplete
|
class AttackTurreted : AttackBase, INotifyBuildComplete
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly bool UseAlternateNames = false;
|
public readonly bool UseAlternateNames = false;
|
||||||
public readonly int[] NorthOffset = null;
|
public readonly int[] NorthOffset = null;
|
||||||
public readonly int[] SouthOffset = null;
|
public readonly int[] SouthOffset = null;
|
||||||
public object Create(Actor self) { return new Bridge(self); }
|
|
||||||
|
public object Create(ActorInitializer init) { return new Bridge(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Bridge: IRender, INotifyDamage
|
class Bridge: IRender, INotifyDamage
|
||||||
|
|||||||
@@ -24,16 +24,13 @@ using OpenRA.Traits.Activities;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class C4DemolitionInfo : ITraitInfo
|
class C4DemolitionInfo : TraitInfo<C4Demolition>
|
||||||
{
|
{
|
||||||
public readonly float C4Delay = 0;
|
public readonly float C4Delay = 0;
|
||||||
public object Create(Actor self) { return new C4Demolition(self); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class C4Demolition : IIssueOrder, IResolveOrder
|
class C4Demolition : IIssueOrder, IResolveOrder
|
||||||
{
|
{
|
||||||
public C4Demolition(Actor self) {}
|
|
||||||
|
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
if (mi.Button != MouseButton.Right) return null;
|
if (mi.Button != MouseButton.Right) return null;
|
||||||
|
|||||||
@@ -21,10 +21,7 @@
|
|||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
public class CanPowerDownInfo : ITraitInfo
|
public class CanPowerDownInfo : TraitInfo<CanPowerDown> { }
|
||||||
{
|
|
||||||
public object Create(Actor self) { return new CanPowerDown(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CanPowerDown : IDisable, IPowerModifier, IResolveOrder
|
public class CanPowerDown : IDisable, IPowerModifier, IResolveOrder
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,21 +25,17 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
public class CargoInfo : ITraitInfo
|
public class CargoInfo : TraitInfo<Cargo>
|
||||||
{
|
{
|
||||||
public readonly int Passengers = 0;
|
public readonly int Passengers = 0;
|
||||||
public readonly UnitMovementType[] PassengerTypes = { };
|
public readonly UnitMovementType[] PassengerTypes = { };
|
||||||
public readonly int UnloadFacing = 0;
|
public readonly int UnloadFacing = 0;
|
||||||
|
|
||||||
public object Create(Actor self) { return new Cargo(self); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Cargo : IPips, IIssueOrder, IResolveOrder
|
public class Cargo : IPips, IIssueOrder, IResolveOrder
|
||||||
{
|
{
|
||||||
List<Actor> cargo = new List<Actor>();
|
List<Actor> cargo = new List<Actor>();
|
||||||
|
|
||||||
public Cargo(Actor self) {}
|
|
||||||
|
|
||||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||||
{
|
{
|
||||||
// todo: check if there is an unoccupied `land` tile adjacent
|
// todo: check if there is an unoccupied `land` tile adjacent
|
||||||
|
|||||||
@@ -23,12 +23,10 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class CarpetBombInfo : ITraitInfo
|
class CarpetBombInfo : TraitInfo<CarpetBomb>
|
||||||
{
|
{
|
||||||
public readonly string Weapon = null;
|
public readonly string Weapon = null;
|
||||||
public readonly int Range = 0;
|
public readonly int Range = 0;
|
||||||
|
|
||||||
public object Create(Actor self) { return new CarpetBomb(self); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CarpetBomb : ITick // todo: maybe integrate this better with the normal weapons system?
|
class CarpetBomb : ITick // todo: maybe integrate this better with the normal weapons system?
|
||||||
@@ -36,8 +34,6 @@ namespace OpenRA.Mods.RA
|
|||||||
int2 Target;
|
int2 Target;
|
||||||
int dropDelay;
|
int dropDelay;
|
||||||
|
|
||||||
public CarpetBomb(Actor self) { }
|
|
||||||
|
|
||||||
public void SetTarget(int2 targetCell) { Target = targetCell; }
|
public void SetTarget(int2 targetCell) { Target = targetCell; }
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class RepairButtonInfo : ITraitInfo
|
class RepairButtonInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly bool RequiresConstructionYard = true;
|
public readonly bool RequiresConstructionYard = true;
|
||||||
public object Create(Actor self) { return new RepairButton(this); }
|
public object Create(ActorInitializer init) { return new RepairButton(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RepairButton : IChromeButton
|
class RepairButton : IChromeButton
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class ChronoshiftPowerInfo : SupportPowerInfo
|
class ChronoshiftPowerInfo : SupportPowerInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new ChronoshiftPower(self,this); }
|
public override object Create(ActorInitializer init) { return new ChronoshiftPower(init.self,this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChronoshiftPower : SupportPower, IResolveOrder
|
class ChronoshiftPower : SupportPower, IResolveOrder
|
||||||
@@ -163,7 +163,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
public readonly int Duration = 30;
|
public readonly int Duration = 30;
|
||||||
public readonly bool KillCargo = true;
|
public readonly bool KillCargo = true;
|
||||||
public object Create(Actor self) { return new Chronosphere(self); }
|
public object Create(ActorInitializer init) { return new Chronosphere(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Chronosphere
|
class Chronosphere
|
||||||
|
|||||||
@@ -23,10 +23,7 @@ using OpenRA.Mods.RA.Activities;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class ChronoshiftableInfo : ITraitInfo
|
class ChronoshiftableInfo : TraitInfo<Chronoshiftable> { }
|
||||||
{
|
|
||||||
public object Create(Actor self) { return new Chronoshiftable(self); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Chronoshiftable : ITick
|
public class Chronoshiftable : ITick
|
||||||
{
|
{
|
||||||
@@ -36,8 +33,6 @@ namespace OpenRA.Mods.RA
|
|||||||
[Sync]
|
[Sync]
|
||||||
int chronoshiftReturnTicks = 0;
|
int chronoshiftReturnTicks = 0;
|
||||||
|
|
||||||
public Chronoshiftable(Actor self) { }
|
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (chronoshiftReturnTicks <= 0)
|
if (chronoshiftReturnTicks <= 0)
|
||||||
|
|||||||
@@ -23,18 +23,13 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class ConquestVictoryConditionsInfo : ITraitInfo
|
class ConquestVictoryConditionsInfo : TraitInfo<ConquestVictoryConditions> { }
|
||||||
{
|
|
||||||
public object Create(Actor self) { return new ConquestVictoryConditions( self ); }
|
|
||||||
}
|
|
||||||
|
|
||||||
class ConquestVictoryConditions : ITick, IVictoryConditions, IResolveOrder
|
class ConquestVictoryConditions : ITick, IVictoryConditions, IResolveOrder
|
||||||
{
|
{
|
||||||
public bool HasLost { get; private set; }
|
public bool HasLost { get; private set; }
|
||||||
public bool HasWon { get; private set; }
|
public bool HasWon { get; private set; }
|
||||||
|
|
||||||
public ConquestVictoryConditions(Actor self) { }
|
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
var hasAnything = self.World.Queries.OwnedBy[self.Owner]
|
var hasAnything = self.World.Queries.OwnedBy[self.Owner]
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class CrateInfo : ITraitInfo, ITraitPrerequisite<RenderSimpleInfo>
|
class CrateInfo : ITraitInfo, ITraitPrerequisite<RenderSimpleInfo>
|
||||||
{
|
{
|
||||||
public readonly int Lifetime = 5; // Seconds
|
public readonly int Lifetime = 5; // Seconds
|
||||||
public object Create(Actor self) { return new Crate(self); }
|
public object Create(ActorInitializer init) { return new Crate(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Crate : ICrushable, IOccupySpace, ITick
|
class Crate : ICrushable, IOccupySpace, ITick
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ namespace OpenRA.Mods.RA
|
|||||||
public int SelectionShares = 10;
|
public int SelectionShares = 10;
|
||||||
public string Effect = null;
|
public string Effect = null;
|
||||||
public string Notification = null;
|
public string Notification = null;
|
||||||
public virtual object Create(Actor self) { return new CrateAction(self, this); }
|
|
||||||
|
public virtual object Create(ActorInitializer init) { return new CrateAction(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CrateAction
|
public class CrateAction
|
||||||
|
|||||||
@@ -24,14 +24,12 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class CrateSpawnerInfo : ITraitInfo
|
class CrateSpawnerInfo : TraitInfo<CrateSpawner>
|
||||||
{
|
{
|
||||||
public readonly int Minimum = 1; // Minumum number of crates
|
public readonly int Minimum = 1; // Minumum number of crates
|
||||||
public readonly int Maximum = 255; // Maximum number of crates
|
public readonly int Maximum = 255; // Maximum number of crates
|
||||||
public readonly int SpawnInterval = 180; // Average time (seconds) between crate spawn
|
public readonly int SpawnInterval = 180; // Average time (seconds) between crate spawn
|
||||||
public readonly float WaterChance = .2f; // Chance of generating a water crate instead of a land crate
|
public readonly float WaterChance = .2f; // Chance of generating a water crate instead of a land crate
|
||||||
|
|
||||||
public object Create(Actor self) { return new CrateSpawner(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// assumption: there is always at least one free water cell, and one free land cell.
|
// assumption: there is always at least one free water cell, and one free land cell.
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class ArmorUpgradeCrateActionInfo : CrateActionInfo
|
class ArmorUpgradeCrateActionInfo : CrateActionInfo
|
||||||
{
|
{
|
||||||
public float Multiplier = 2.0f;
|
public float Multiplier = 2.0f;
|
||||||
public override object Create(Actor self) { return new ArmorUpgradeCrateAction(self, this); }
|
public override object Create(ActorInitializer init) { return new ArmorUpgradeCrateAction(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class ArmorUpgradeCrateAction : CrateAction
|
class ArmorUpgradeCrateAction : CrateAction
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class ExplodeCrateActionInfo : CrateActionInfo
|
class ExplodeCrateActionInfo : CrateActionInfo
|
||||||
{
|
{
|
||||||
public string Weapon = null;
|
public string Weapon = null;
|
||||||
public override object Create(Actor self) { return new ExplodeCrateAction(self, this); }
|
public override object Create(ActorInitializer init) { return new ExplodeCrateAction(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class ExplodeCrateAction : CrateAction
|
class ExplodeCrateAction : CrateAction
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class FirepowerUpgradeCrateActionInfo : CrateActionInfo
|
class FirepowerUpgradeCrateActionInfo : CrateActionInfo
|
||||||
{
|
{
|
||||||
public float Multiplier = 2.0f;
|
public float Multiplier = 2.0f;
|
||||||
public override object Create(Actor self) { return new FirepowerUpgradeCrateAction(self, this); }
|
public override object Create(ActorInitializer init) { return new FirepowerUpgradeCrateAction(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class FirepowerUpgradeCrateAction : CrateAction
|
class FirepowerUpgradeCrateAction : CrateAction
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class GiveCashCrateActionInfo : CrateActionInfo
|
class GiveCashCrateActionInfo : CrateActionInfo
|
||||||
{
|
{
|
||||||
public int Amount = 2000;
|
public int Amount = 2000;
|
||||||
public override object Create(Actor self) { return new GiveCashCrateAction(self, this); }
|
public override object Create(ActorInitializer init) { return new GiveCashCrateAction(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class GiveCashCrateAction : CrateAction
|
class GiveCashCrateAction : CrateAction
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class HideMapCrateActionInfo : CrateActionInfo
|
class HideMapCrateActionInfo : CrateActionInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new HideMapCrateAction(self, this); }
|
public override object Create(ActorInitializer init) { return new HideMapCrateAction(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class HideMapCrateAction : CrateAction
|
class HideMapCrateAction : CrateAction
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class SpeedUpgradeCrateActionInfo : CrateActionInfo
|
class SpeedUpgradeCrateActionInfo : CrateActionInfo
|
||||||
{
|
{
|
||||||
public float Multiplier = 1.7f;
|
public float Multiplier = 1.7f;
|
||||||
public override object Create(Actor self) { return new SpeedUpgradeCrateAction(self, this); }
|
public override object Create(ActorInitializer init) { return new SpeedUpgradeCrateAction(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class SpeedUpgradeCrateAction : CrateAction
|
class SpeedUpgradeCrateAction : CrateAction
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Crates
|
|||||||
class SupportPowerCrateActionInfo : CrateActionInfo
|
class SupportPowerCrateActionInfo : CrateActionInfo
|
||||||
{
|
{
|
||||||
public string Power = null;
|
public string Power = null;
|
||||||
public override object Create(Actor self) { return new SupportPowerCrateAction(self, this); }
|
public override object Create(ActorInitializer init) { return new SupportPowerCrateAction(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class SupportPowerCrateAction : CrateAction
|
class SupportPowerCrateAction : CrateAction
|
||||||
|
|||||||
@@ -26,11 +26,8 @@ using System.Collections.Generic;
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class DefaultShellmapScriptInfo : ITraitInfo
|
class DefaultShellmapScriptInfo : TraitInfo<DefaultShellmapScript> { }
|
||||||
{
|
|
||||||
public object Create(Actor self) { return new DefaultShellmapScript(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
class DefaultShellmapScript: ILoadWorldHook, ITick
|
class DefaultShellmapScript: ILoadWorldHook, ITick
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly float[] FirepowerModifier = { 1.1f, 1.15f, 1.2f, 1.5f };
|
public readonly float[] FirepowerModifier = { 1.1f, 1.15f, 1.2f, 1.5f };
|
||||||
public readonly float[] ArmorModifier = { 1.1f, 1.2f, 1.3f, 1.5f };
|
public readonly float[] ArmorModifier = { 1.1f, 1.2f, 1.3f, 1.5f };
|
||||||
public readonly float[] SpeedModifier = { 1.1f, 1.15f, 1.2f, 1.5f };
|
public readonly float[] SpeedModifier = { 1.1f, 1.15f, 1.2f, 1.5f };
|
||||||
public object Create(Actor self) { return new GainsExperience(self, this); }
|
public object Create(ActorInitializer init) { return new GainsExperience(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GainsExperience : IFirepowerModifier, ISpeedModifier, IDamageModifier, IRenderModifier
|
public class GainsExperience : IFirepowerModifier, ISpeedModifier, IDamageModifier, IRenderModifier
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
public readonly int RevealDelay = 0;
|
public readonly int RevealDelay = 0;
|
||||||
|
|
||||||
public override object Create(Actor self) { return new GpsPower(self, this); }
|
public override object Create(ActorInitializer init) { return new GpsPower(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class GpsPower : SupportPower
|
class GpsPower : SupportPower
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly string[] Resources = { };
|
public readonly string[] Resources = { };
|
||||||
public readonly string DeathWeapon = null;
|
public readonly string DeathWeapon = null;
|
||||||
|
|
||||||
public object Create(Actor self) { return new Harvester(self, this); }
|
public object Create(ActorInitializer init) { return new Harvester(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Harvester : IIssueOrder, IResolveOrder, INotifyDamage, IPips, IRenderModifier
|
public class Harvester : IIssueOrder, IResolveOrder, INotifyDamage, IPips, IRenderModifier
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int2 SpawnOffset = int2.Zero;
|
public readonly int2 SpawnOffset = int2.Zero;
|
||||||
public readonly int Facing = 0;
|
public readonly int Facing = 0;
|
||||||
|
|
||||||
public object Create( Actor self ) { return new FreeActor(self, this); }
|
public object Create( ActorInitializer init ) { return new FreeActor(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FreeActor
|
public class FreeActor
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int CruiseAltitude = 20;
|
public readonly int CruiseAltitude = 20;
|
||||||
public readonly int IdealSeparation = 40;
|
public readonly int IdealSeparation = 40;
|
||||||
public readonly bool LandWhenIdle = true;
|
public readonly bool LandWhenIdle = true;
|
||||||
public object Create(Actor self) { return new Helicopter(self); }
|
|
||||||
|
public object Create(ActorInitializer init) { return new Helicopter(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Helicopter : ITick, IIssueOrder, IResolveOrder, IMovement
|
class Helicopter : ITick, IIssueOrder, IResolveOrder, IMovement
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class HuskInfo : ITraitInfo { public object Create(Actor self) { return new Husk(self); } }
|
class HuskInfo : ITraitInfo
|
||||||
|
{
|
||||||
|
public object Create( ActorInitializer init ) { return new Husk( init.self ); }
|
||||||
|
}
|
||||||
|
|
||||||
class Husk : IOccupySpace
|
class Husk : IOccupySpace
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class IronCurtainPowerInfo : SupportPowerInfo
|
class IronCurtainPowerInfo : SupportPowerInfo
|
||||||
{
|
{
|
||||||
public readonly float Duration = 0f;
|
public readonly float Duration = 0f;
|
||||||
public override object Create(Actor self) { return new IronCurtainPower(self, this); }
|
public override object Create(ActorInitializer init) { return new IronCurtainPower(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class IronCurtainPower : SupportPower, IResolveOrder
|
class IronCurtainPower : SupportPower, IResolveOrder
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class IronCurtainableInfo : TraitInfo<IronCurtainable> {}
|
class IronCurtainableInfo : TraitInfo<IronCurtainable> { }
|
||||||
|
|
||||||
class IronCurtainable : IDamageModifier, ITick
|
class IronCurtainable : IDamageModifier, ITick
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly string Weapon = "ATMine";
|
public readonly string Weapon = "ATMine";
|
||||||
public readonly bool AvoidFriendly = true;
|
public readonly bool AvoidFriendly = true;
|
||||||
|
|
||||||
public object Create(Actor self) { return new Mine(self); }
|
public object Create(ActorInitializer init) { return new Mine(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Mine : ICrushable, IOccupySpace
|
class Mine : ICrushable, IOccupySpace
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class NukePowerInfo : SupportPowerInfo
|
class NukePowerInfo : SupportPowerInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new NukePower(self, this); }
|
public override object Create(ActorInitializer init) { return new NukePower(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class NukePower : SupportPower, IResolveOrder
|
class NukePower : SupportPower, IResolveOrder
|
||||||
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class NukeSiloInfo : ITraitInfo
|
class NukeSiloInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly string MissileWeapon = "";
|
public readonly string MissileWeapon = "";
|
||||||
public object Create(Actor self) { return new NukeSilo(self); }
|
public object Create(ActorInitializer init) { return new NukeSilo(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class NukeSilo
|
class NukeSilo
|
||||||
|
|||||||
@@ -37,10 +37,8 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int ProcessTick = 25;
|
public readonly int ProcessTick = 25;
|
||||||
public readonly int ProcessAmount = 50;
|
public readonly int ProcessAmount = 50;
|
||||||
public readonly string DeathWeapon = null;
|
public readonly string DeathWeapon = null;
|
||||||
public object Create (Actor self)
|
|
||||||
{
|
public object Create(ActorInitializer init) { return new OreRefinery(init.self, this); }
|
||||||
return new OreRefinery (self, this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class OreRefinery : ITick, IAcceptOre, INotifyDamage, INotifySold, INotifyCapture, IPips, ITraitPrerequisite<IAcceptOreDockAction>
|
class OreRefinery : ITick, IAcceptOre, INotifyDamage, INotifySold, INotifyCapture, IPips, ITraitPrerequisite<IAcceptOreDockAction>
|
||||||
|
|||||||
@@ -29,17 +29,18 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly string Theater = null;
|
public readonly string Theater = null;
|
||||||
public readonly string Filename = null;
|
public readonly string Filename = null;
|
||||||
public readonly bool Transparent = true;
|
public readonly bool Transparent = true;
|
||||||
public object Create(Actor self) { return new PaletteFromFile(self, this); }
|
|
||||||
|
public object Create(ActorInitializer init) { return new PaletteFromFile(init.world, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class PaletteFromFile
|
class PaletteFromFile
|
||||||
{
|
{
|
||||||
public PaletteFromFile(Actor self, PaletteFromFileInfo info)
|
public PaletteFromFile(World world, PaletteFromFileInfo info)
|
||||||
{
|
{
|
||||||
if (info.Theater == null ||
|
if (info.Theater == null ||
|
||||||
info.Theater.ToLowerInvariant() == self.World.Map.Theater.ToLowerInvariant())
|
info.Theater.ToLowerInvariant() == world.Map.Theater.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
self.World.WorldRenderer.AddPalette(info.Name,
|
world.WorldRenderer.AddPalette(info.Name,
|
||||||
new Palette(FileSystem.Open(info.Filename), info.Transparent));
|
new Palette(FileSystem.Open(info.Filename), info.Transparent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,18 +32,19 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int G = 0;
|
public readonly int G = 0;
|
||||||
public readonly int B = 0;
|
public readonly int B = 0;
|
||||||
public readonly int A = 255;
|
public readonly int A = 255;
|
||||||
public object Create(Actor self) { return new PaletteFromRGBA(self, this); }
|
|
||||||
|
public object Create(ActorInitializer init) { return new PaletteFromRGBA(init.world, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class PaletteFromRGBA
|
class PaletteFromRGBA
|
||||||
{
|
{
|
||||||
public PaletteFromRGBA(Actor self, PaletteFromRGBAInfo info)
|
public PaletteFromRGBA(World world, PaletteFromRGBAInfo info)
|
||||||
{
|
{
|
||||||
if (info.Theatre == null ||
|
if (info.Theatre == null ||
|
||||||
info.Theatre.ToLowerInvariant() == self.World.Map.Theater.ToLowerInvariant())
|
info.Theatre.ToLowerInvariant() == world.Map.Theater.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
// TODO: This shouldn't rely on a base palette
|
// TODO: This shouldn't rely on a base palette
|
||||||
var wr = self.World.WorldRenderer;
|
var wr = world.WorldRenderer;
|
||||||
var pal = wr.GetPalette("player0");
|
var pal = wr.GetPalette("player0");
|
||||||
wr.AddPalette(info.Name, new Palette(pal, new SingleColorRemap(Color.FromArgb(info.A, info.R, info.G, info.B))));
|
wr.AddPalette(info.Name, new Palette(pal, new SingleColorRemap(Color.FromArgb(info.A, info.R, info.G, info.B))));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,10 +27,9 @@ using OpenRA.Traits.Activities;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
public class ParaDropInfo : ITraitInfo
|
public class ParaDropInfo : TraitInfo<ParaDrop>
|
||||||
{
|
{
|
||||||
public readonly int LZRange = 4;
|
public readonly int LZRange = 4;
|
||||||
public object Create(Actor self) { return new ParaDrop(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ParaDrop : ITick
|
public class ParaDrop : ITick
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public string UnitType = "badr";
|
public string UnitType = "badr";
|
||||||
public string FlareType = "flare";
|
public string FlareType = "flare";
|
||||||
|
|
||||||
public override object Create(Actor self) { return new ParatroopersPower(self,this); }
|
public override object Create(ActorInitializer init) { return new ParatroopersPower(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class ParatroopersPower : SupportPower, IResolveOrder
|
class ParatroopersPower : SupportPower, IResolveOrder
|
||||||
|
|||||||
@@ -27,21 +27,17 @@ using OpenRA.Mods.RA.Activities;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
public class PlaneInfo : ITraitInfo
|
public class PlaneInfo : TraitInfo<Plane>
|
||||||
{
|
{
|
||||||
public readonly int CruiseAltitude = 20;
|
public readonly int CruiseAltitude = 20;
|
||||||
public readonly string[] RearmBuildings = { "afld" };
|
public readonly string[] RearmBuildings = { "afld" };
|
||||||
public readonly string[] RepairBuildings = { "fix" };
|
public readonly string[] RepairBuildings = { "fix" };
|
||||||
|
|
||||||
public object Create(Actor self) { return new Plane(self); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Plane : IIssueOrder, IResolveOrder, IMovement
|
public class Plane : IIssueOrder, IResolveOrder, IMovement
|
||||||
{
|
{
|
||||||
public IDisposable reservation;
|
public IDisposable reservation;
|
||||||
|
|
||||||
public Plane(Actor self) {}
|
|
||||||
|
|
||||||
static bool PlaneCanEnter(Actor self, Actor a)
|
static bool PlaneCanEnter(Actor self, Actor a)
|
||||||
{
|
{
|
||||||
var plane = self.Info.Traits.Get<PlaneInfo>();
|
var plane = self.Info.Traits.Get<PlaneInfo>();
|
||||||
|
|||||||
@@ -26,13 +26,11 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class ProductionSurroundInfo : ProductionInfo
|
class ProductionSurroundInfo : ProductionInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new ProductionSurround(self); }
|
public override object Create(ActorInitializer init) { return new ProductionSurround(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProductionSurround : Production
|
class ProductionSurround : Production
|
||||||
{
|
{
|
||||||
public ProductionSurround(Actor self) : base(self) { }
|
|
||||||
|
|
||||||
static int2? FindAdjacentTile(Actor self, bool waterBound)
|
static int2? FindAdjacentTile(Actor self, bool waterBound)
|
||||||
{
|
{
|
||||||
var tiles = Footprint.Tiles(self);
|
var tiles = Footprint.Tiles(self);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class RenderBuildingChargeInfo : RenderBuildingInfo
|
class RenderBuildingChargeInfo : RenderBuildingInfo
|
||||||
{
|
{
|
||||||
public readonly string ChargeAudio = "tslachg2.aud";
|
public readonly string ChargeAudio = "tslachg2.aud";
|
||||||
public override object Create(Actor self) { return new RenderBuildingCharge(self); }
|
public override object Create(ActorInitializer init) { return new RenderBuildingCharge(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/* used for tesla */
|
/* used for tesla */
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class RenderBuildingOreInfo : RenderBuildingInfo
|
class RenderBuildingOreInfo : RenderBuildingInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new RenderBuildingOre(self); }
|
public override object Create(ActorInitializer init) { return new RenderBuildingOre(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RenderBuildingOre : RenderBuilding, INotifyBuildComplete
|
class RenderBuildingOre : RenderBuilding, INotifyBuildComplete
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class RenderBuildingWallInfo : RenderBuildingInfo
|
class RenderBuildingWallInfo : RenderBuildingInfo
|
||||||
{
|
{
|
||||||
public readonly int DamageStates = 2;
|
public readonly int DamageStates = 2;
|
||||||
public override object Create(Actor self) { return new RenderBuildingWall(self); }
|
public override object Create(ActorInitializer init) { return new RenderBuildingWall(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RenderBuildingWall : RenderBuilding
|
class RenderBuildingWall : RenderBuilding
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class RenderWarFactoryInfo : ITraitInfo, ITraitPrerequisite<RenderSimpleInfo>
|
class RenderWarFactoryInfo : ITraitInfo, ITraitPrerequisite<RenderSimpleInfo>
|
||||||
{
|
{
|
||||||
public object Create(Actor self) { return new RenderWarFactory(self); }
|
public object Create(ActorInitializer init) { return new RenderWarFactory(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RenderWarFactory : INotifyBuildComplete, INotifyDamage, ITick, INotifyProduction, INotifySold
|
class RenderWarFactory : INotifyBuildComplete, INotifyDamage, ITick, INotifyProduction, INotifySold
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class RenderFlareInfo : RenderSimpleInfo
|
class RenderFlareInfo : RenderSimpleInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new RenderFlare(self); }
|
public override object Create(ActorInitializer init) { return new RenderFlare(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RenderFlare : RenderSimple
|
class RenderFlare : RenderSimple
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
public class RenderInfantryInfo : RenderSimpleInfo
|
public class RenderInfantryInfo : RenderSimpleInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new RenderInfantry(self); }
|
public override object Create(ActorInitializer init) { return new RenderInfantry(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RenderInfantry : RenderSimple, INotifyAttack, INotifyDamage
|
public class RenderInfantry : RenderSimple, INotifyAttack, INotifyDamage
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class RenderSpyInfo : RenderInfantryInfo
|
class RenderSpyInfo : RenderInfantryInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new RenderSpy(self); }
|
public override object Create(ActorInitializer init) { return new RenderSpy(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RenderSpy : RenderInfantry, IRenderModifier
|
class RenderSpy : RenderInfantry, IRenderModifier
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class RenderUnitReloadInfo : RenderUnitInfo
|
class RenderUnitReloadInfo : RenderUnitInfo
|
||||||
{
|
{
|
||||||
public override object Create(Actor self) { return new RenderUnitReload(self); }
|
public override object Create(ActorInitializer init) { return new RenderUnitReload(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RenderUnitReload : RenderUnit
|
class RenderUnitReload : RenderUnit
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int[] PrimaryOffset = { 0, 0 };
|
public readonly int[] PrimaryOffset = { 0, 0 };
|
||||||
public readonly int[] SecondaryOffset = null;
|
public readonly int[] SecondaryOffset = null;
|
||||||
|
|
||||||
public override object Create(Actor self) { return new RenderUnitRotor(self); }
|
public override object Create(ActorInitializer init) { return new RenderUnitRotor(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RenderUnitRotor : RenderUnit
|
class RenderUnitRotor : RenderUnit
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class RenderUnitSpinnerInfo : RenderUnitInfo
|
class RenderUnitSpinnerInfo : RenderUnitInfo
|
||||||
{
|
{
|
||||||
public readonly int[] Offset = { 0, 0 };
|
public readonly int[] Offset = { 0, 0 };
|
||||||
public override object Create(Actor self) { return new RenderUnitSpinner(self); }
|
public override object Create(ActorInitializer init) { return new RenderUnitSpinner(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RenderUnitSpinner : RenderUnit
|
class RenderUnitSpinner : RenderUnit
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class ReplaceWithActorInfo : ITraitInfo
|
class ReplaceWithActorInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly string Actor = null;
|
public readonly string Actor = null;
|
||||||
public object Create(Actor self) { return new ReplaceWithActor(self, this); }
|
public object Create(ActorInitializer init) { return new ReplaceWithActor(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class ReplaceWithActor
|
class ReplaceWithActor
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
class RequiresPowerInfo : ITraitInfo
|
class RequiresPowerInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public object Create(Actor self) { return new RequiresPower(self); }
|
public object Create(ActorInitializer init) { return new RequiresPower(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RequiresPower : IDisable
|
class RequiresPower : IDisable
|
||||||
|
|||||||
@@ -23,14 +23,10 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class ReservableInfo : ITraitInfo
|
class ReservableInfo : TraitInfo<Reservable> { }
|
||||||
{
|
|
||||||
public object Create(Actor self) { return new Reservable(self); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Reservable : ITick
|
public class Reservable : ITick
|
||||||
{
|
{
|
||||||
public Reservable(Actor self) { }
|
|
||||||
Actor reservedFor;
|
Actor reservedFor;
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
|
|||||||
@@ -25,14 +25,12 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class SeedsResourceInfo : ITraitInfo
|
class SeedsResourceInfo : TraitInfo<SeedsResource>
|
||||||
{
|
{
|
||||||
public readonly int Interval = 75;
|
public readonly int Interval = 75;
|
||||||
public readonly string ResourceType = "Ore";
|
public readonly string ResourceType = "Ore";
|
||||||
public readonly int MaxRange = 100;
|
public readonly int MaxRange = 100;
|
||||||
public readonly int AnimationInterval = 750;
|
public readonly int AnimationInterval = 750;
|
||||||
|
|
||||||
public object Create(Actor self) { return new SeedsResource(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SeedsResource : ITick
|
class SeedsResource : ITick
|
||||||
|
|||||||
@@ -22,13 +22,11 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class SelfHealingInfo : ITraitInfo
|
class SelfHealingInfo : TraitInfo<SelfHealing>
|
||||||
{
|
{
|
||||||
public readonly int Step = 5;
|
public readonly int Step = 5;
|
||||||
public readonly int Ticks = 5;
|
public readonly int Ticks = 5;
|
||||||
public readonly float HealIfBelow = .5f;
|
public readonly float HealIfBelow = .5f;
|
||||||
|
|
||||||
public object Create(Actor self) { return new SelfHealing(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SelfHealing : ITick
|
class SelfHealing : ITick
|
||||||
|
|||||||
@@ -27,15 +27,15 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
public readonly string Name = "shroud";
|
public readonly string Name = "shroud";
|
||||||
public readonly bool IsFog = false;
|
public readonly bool IsFog = false;
|
||||||
public object Create(Actor self) { return new ShroudPalette(self, this); }
|
public object Create(ActorInitializer init) { return new ShroudPalette(init.world, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class ShroudPalette
|
class ShroudPalette
|
||||||
{
|
{
|
||||||
public ShroudPalette(Actor self, ShroudPaletteInfo info)
|
public ShroudPalette(World world, ShroudPaletteInfo info)
|
||||||
{
|
{
|
||||||
// TODO: This shouldn't rely on a base palette
|
// TODO: This shouldn't rely on a base palette
|
||||||
var wr = self.World.WorldRenderer;
|
var wr = world.WorldRenderer;
|
||||||
var pal = wr.GetPalette("terrain");
|
var pal = wr.GetPalette("terrain");
|
||||||
wr.AddPalette(info.Name, new Palette(pal, new ShroudPaletteRemap(info.IsFog)));
|
wr.AddPalette(info.Name, new Palette(pal, new ShroudPaletteRemap(info.IsFog)));
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user