Merge pull request #7194 from reaperrr/move-ra-common25
More Mods.RA reorganisation, more files moved to Mods.Common
This commit is contained in:
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ using System.Linq;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Support;
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.AI
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
#endregion
|
||||
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
@@ -13,6 +13,7 @@ using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
#endregion
|
||||
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
@@ -12,7 +12,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
using System.Drawing;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
public static class ActorExts
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
public class Barrel
|
||||
{
|
||||
|
||||
@@ -14,10 +14,10 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
public abstract class AttackBaseInfo : ITraitInfo
|
||||
{
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Charges up before being able to attack.")]
|
||||
class AttackChargeInfo : AttackOmniInfo
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
|
||||
using System;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Actor will follow units until in range to attack them.")]
|
||||
public class AttackFollowInfo : AttackBaseInfo
|
||||
|
||||
@@ -12,7 +12,7 @@ using System;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Unit got to face the target")]
|
||||
public class AttackFrontalInfo : AttackBaseInfo, Requires<IFacingInfo>
|
||||
|
||||
@@ -14,10 +14,9 @@ using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
public class FirePort
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Give the unit a \"heal-weapon\" that attacks friendly targets if they are damaged.",
|
||||
"It conflicts with any other weapon or Attack*: trait because it will hurt friendlies during the",
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class AttackOmniInfo : AttackBaseInfo
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Collections.Generic;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Actor has a visual turret used to attack.")]
|
||||
public class AttackTurretedInfo : AttackFollowInfo, Requires<TurretedInfo>
|
||||
|
||||
@@ -9,10 +9,9 @@
|
||||
#endregion
|
||||
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Will AttackMove to a random location within MoveRadius when idle.",
|
||||
"This conflicts with player orders and should only be added to animal creeps.")]
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Used together with AttackMedic: to make the healer do it's job automatically to nearby units.")]
|
||||
class AutoHealInfo : TraitInfo<AutoHeal>, Requires<AttackBaseInfo> { }
|
||||
|
||||
@@ -13,7 +13,7 @@ using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("The actor will automatically engage the enemy when it is in range.")]
|
||||
public class AutoTargetInfo : ITraitInfo, Requires<AttackBaseInfo>
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Buildings
|
||||
{
|
||||
public class BibInfo : ITraitInfo, Requires<BuildingInfo>, Requires<RenderSpritesInfo>
|
||||
{
|
||||
public readonly string Sequence = "bib";
|
||||
public readonly string Palette = "terrain";
|
||||
public readonly bool HasMinibib = false;
|
||||
|
||||
public object Create(ActorInitializer init) { return new Bib(init.self, this); }
|
||||
}
|
||||
|
||||
public class Bib : INotifyAddedToWorld, INotifyRemovedFromWorld
|
||||
{
|
||||
readonly BibInfo info;
|
||||
readonly RenderSprites rs;
|
||||
readonly BuildingInfo bi;
|
||||
|
||||
public Bib(Actor self, BibInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
rs = self.Trait<RenderSprites>();
|
||||
bi = self.Info.Traits.Get<BuildingInfo>();
|
||||
}
|
||||
|
||||
public void AddedToWorld(Actor self)
|
||||
{
|
||||
var width = bi.Dimensions.X;
|
||||
var bibOffset = bi.Dimensions.Y - 1;
|
||||
var centerOffset = FootprintUtils.CenterOffset(self.World, bi);
|
||||
var location = self.Location;
|
||||
var rows = info.HasMinibib ? 1 : 2;
|
||||
var map = self.World.Map;
|
||||
|
||||
for (var i = 0; i < rows * width; i++)
|
||||
{
|
||||
var index = i;
|
||||
var anim = new Animation(self.World, rs.GetImage(self));
|
||||
var cellOffset = new CVec(i % width, i / width + bibOffset);
|
||||
var cell = location + cellOffset;
|
||||
|
||||
// Some mods may define terrain-specific bibs
|
||||
var terrain = map.GetTerrainInfo(cell).Type;
|
||||
var testSequence = info.Sequence + "-" + terrain;
|
||||
var sequence = anim.HasSequence(testSequence) ? testSequence : info.Sequence;
|
||||
anim.PlayFetchIndex(sequence, () => index);
|
||||
anim.IsDecoration = true;
|
||||
|
||||
// Z-order is one set to the top of the footprint
|
||||
var offset = self.World.Map.CenterOfCell(cell) - self.World.Map.CenterOfCell(location) - centerOffset;
|
||||
var awo = new AnimationWithOffset(anim, () => offset, null, -(offset.Y + centerOffset.Y + 512));
|
||||
rs.Add("bib_{0}".F(i), awo, info.Palette);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemovedFromWorld(Actor self)
|
||||
{
|
||||
var width = bi.Dimensions.X;
|
||||
var rows = info.HasMinibib ? 1 : 2;
|
||||
|
||||
for (var i = 0; i < rows * width; i++)
|
||||
rs.Remove("bib_{0}".F(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Buildings
|
||||
{
|
||||
[Desc("Remove this trait to limit base-walking by cheap or defensive buildings.")]
|
||||
public class GivesBuildableAreaInfo : TraitInfo<GivesBuildableArea> {}
|
||||
public class GivesBuildableArea {}
|
||||
|
||||
public class BuildingInfo : ITraitInfo, IOccupySpaceInfo, UsesInit<LocationInit>
|
||||
{
|
||||
[Desc("Where you are allowed to place the building (Water, Clear, ...)")]
|
||||
public readonly string[] TerrainTypes = {};
|
||||
[Desc("The range to the next building it can be constructed. Set it higher for walls.")]
|
||||
public readonly int Adjacent = 2;
|
||||
[Desc("x means space it blocks, _ is a part that is passable by actors.")]
|
||||
public readonly string Footprint = "x";
|
||||
public readonly CVec Dimensions = new CVec(1, 1);
|
||||
public readonly bool RequiresBaseProvider = false;
|
||||
public readonly bool AllowInvalidPlacement = false;
|
||||
|
||||
public readonly string[] BuildSounds = { "placbldg.aud", "build5.aud" };
|
||||
public readonly string[] UndeploySounds = { "cashturn.aud" };
|
||||
|
||||
public object Create(ActorInitializer init) { return new Building(init, this); }
|
||||
|
||||
public Actor FindBaseProvider(World world, Player p, CPos topLeft)
|
||||
{
|
||||
var center = world.Map.CenterOfCell(topLeft) + FootprintUtils.CenterOffset(world, this);
|
||||
foreach (var bp in world.ActorsWithTrait<BaseProvider>())
|
||||
{
|
||||
var validOwner = bp.Actor.Owner == p || (world.LobbyInfo.GlobalSettings.AllyBuildRadius && bp.Actor.Owner.Stances[p] == Stance.Ally);
|
||||
if (!validOwner || !bp.Trait.Ready())
|
||||
continue;
|
||||
|
||||
// Range is counted from the center of the actor, not from each cell.
|
||||
var target = Target.FromPos(bp.Actor.CenterPosition);
|
||||
if (target.IsInRange(center, WRange.FromCells(bp.Trait.Info.Range)))
|
||||
return bp.Actor;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool IsCloseEnoughToBase(World world, Player p, string buildingName, CPos topLeft)
|
||||
{
|
||||
if (p.PlayerActor.Trait<DeveloperMode>().BuildAnywhere)
|
||||
return true;
|
||||
|
||||
if (RequiresBaseProvider && FindBaseProvider(world, p, topLeft) == null)
|
||||
return false;
|
||||
|
||||
var buildingMaxBounds = Dimensions;
|
||||
var buildingTraits = world.Map.Rules.Actors[buildingName].Traits;
|
||||
if (buildingTraits.Contains<BibInfo>() && !(buildingTraits.Get<BibInfo>().HasMinibib))
|
||||
buildingMaxBounds += new CVec(0, 1);
|
||||
|
||||
var scanStart = world.Map.Clamp(topLeft - new CVec(Adjacent, Adjacent));
|
||||
var scanEnd = world.Map.Clamp(topLeft + buildingMaxBounds + new CVec(Adjacent, Adjacent));
|
||||
|
||||
var nearnessCandidates = new List<CPos>();
|
||||
|
||||
var bi = world.WorldActor.Trait<BuildingInfluence>();
|
||||
var allyBuildRadius = world.LobbyInfo.GlobalSettings.AllyBuildRadius;
|
||||
|
||||
for (var y = scanStart.Y; y < scanEnd.Y; y++)
|
||||
{
|
||||
for (var x = scanStart.X; x < scanEnd.X; x++)
|
||||
{
|
||||
var pos = new CPos(x, y);
|
||||
var at = bi.GetBuildingAt(pos);
|
||||
if (at == null || !at.IsInWorld || !at.HasTrait<GivesBuildableArea>())
|
||||
continue;
|
||||
|
||||
if (at.Owner == p || (allyBuildRadius && at.Owner.Stances[p] == Stance.Ally))
|
||||
nearnessCandidates.Add(pos);
|
||||
}
|
||||
}
|
||||
|
||||
var buildingTiles = FootprintUtils.Tiles(world.Map.Rules, buildingName, this, topLeft).ToList();
|
||||
return nearnessCandidates
|
||||
.Any(a => buildingTiles
|
||||
.Any(b => Math.Abs(a.X - b.X) <= Adjacent
|
||||
&& Math.Abs(a.Y - b.Y) <= Adjacent));
|
||||
}
|
||||
}
|
||||
|
||||
public class Building : IOccupySpace, INotifySold, INotifyTransform, ISync, ITechTreePrerequisite, INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld
|
||||
{
|
||||
public readonly BuildingInfo Info;
|
||||
public bool BuildComplete { get; private set; }
|
||||
[Sync] readonly CPos topLeft;
|
||||
readonly Actor self;
|
||||
public readonly bool SkipMakeAnimation;
|
||||
|
||||
/* shared activity lock: undeploy, sell, capture, etc */
|
||||
[Sync] public bool Locked = true;
|
||||
|
||||
public bool Lock()
|
||||
{
|
||||
if (Locked)
|
||||
return false;
|
||||
|
||||
Locked = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Unlock() { Locked = false; }
|
||||
|
||||
public CPos TopLeft { get { return topLeft; } }
|
||||
public WPos CenterPosition { get; private set; }
|
||||
|
||||
public IEnumerable<string> ProvidesPrerequisites { get { yield return self.Info.Name; } }
|
||||
|
||||
public Building(ActorInitializer init, BuildingInfo info)
|
||||
{
|
||||
this.self = init.self;
|
||||
this.topLeft = init.Get<LocationInit, CPos>();
|
||||
this.Info = info;
|
||||
|
||||
occupiedCells = FootprintUtils.UnpathableTiles( self.Info.Name, Info, TopLeft )
|
||||
.Select(c => Pair.New(c, SubCell.FullCell)).ToArray();
|
||||
|
||||
CenterPosition = init.world.Map.CenterOfCell(topLeft) + FootprintUtils.CenterOffset(init.world, Info);
|
||||
SkipMakeAnimation = init.Contains<SkipMakeAnimsInit>();
|
||||
}
|
||||
|
||||
Pair<CPos, SubCell>[] occupiedCells;
|
||||
public IEnumerable<Pair<CPos, SubCell>> OccupiedCells() { return occupiedCells; }
|
||||
|
||||
public void Created(Actor self)
|
||||
{
|
||||
if (SkipMakeAnimation || !self.HasTrait<WithMakeAnimation>())
|
||||
NotifyBuildingComplete(self);
|
||||
}
|
||||
|
||||
public void AddedToWorld(Actor self)
|
||||
{
|
||||
self.World.ActorMap.AddInfluence(self, this);
|
||||
self.World.ActorMap.AddPosition(self, this);
|
||||
self.World.ScreenMap.Add(self);
|
||||
}
|
||||
|
||||
public void RemovedFromWorld(Actor self)
|
||||
{
|
||||
self.World.ActorMap.RemoveInfluence(self, this);
|
||||
self.World.ActorMap.RemovePosition(self, this);
|
||||
self.World.ScreenMap.Remove(self);
|
||||
}
|
||||
|
||||
public void NotifyBuildingComplete(Actor self)
|
||||
{
|
||||
if (BuildComplete)
|
||||
return;
|
||||
|
||||
BuildComplete = true;
|
||||
Locked = false;
|
||||
|
||||
foreach (var notify in self.TraitsImplementing<INotifyBuildComplete>())
|
||||
notify.BuildingComplete(self);
|
||||
}
|
||||
|
||||
public void Selling(Actor self)
|
||||
{
|
||||
BuildComplete = false;
|
||||
}
|
||||
|
||||
public void Sold(Actor self) { }
|
||||
|
||||
public void BeforeTransform(Actor self)
|
||||
{
|
||||
foreach (var s in Info.UndeploySounds)
|
||||
Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
|
||||
}
|
||||
public void OnTransform(Actor self) { }
|
||||
public void AfterTransform(Actor self) { }
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Buildings
|
||||
{
|
||||
[Desc("A dictionary of buildings placed on the map. Attach this to the world actor.")]
|
||||
public class BuildingInfluenceInfo : ITraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new BuildingInfluence(init.world); }
|
||||
}
|
||||
|
||||
public class BuildingInfluence
|
||||
{
|
||||
CellLayer<Actor> influence;
|
||||
Map map;
|
||||
|
||||
public BuildingInfluence(World world)
|
||||
{
|
||||
map = world.Map;
|
||||
|
||||
influence = new CellLayer<Actor>(map);
|
||||
|
||||
world.ActorAdded += a =>
|
||||
{
|
||||
var b = a.TraitOrDefault<Building>();
|
||||
if (b == null)
|
||||
return;
|
||||
|
||||
foreach (var u in FootprintUtils.Tiles(map.Rules, a.Info.Name, b.Info, a.Location))
|
||||
if (map.Contains(u) && influence[u] == null)
|
||||
influence[u] = a;
|
||||
};
|
||||
|
||||
world.ActorRemoved += a =>
|
||||
{
|
||||
var b = a.TraitOrDefault<Building>();
|
||||
if (b == null)
|
||||
return;
|
||||
|
||||
foreach (var u in FootprintUtils.Tiles(map.Rules, a.Info.Name, b.Info, a.Location))
|
||||
if (map.Contains(u) && influence[u] == a)
|
||||
influence[u] = null;
|
||||
};
|
||||
}
|
||||
|
||||
public Actor GetBuildingAt(CPos cell)
|
||||
{
|
||||
if (!map.Contains(cell))
|
||||
return null;
|
||||
|
||||
return influence[cell];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Buildings
|
||||
{
|
||||
public static class BuildingUtils
|
||||
{
|
||||
public static bool IsCellBuildable(this World world, CPos cell, BuildingInfo bi, Actor toIgnore = null)
|
||||
{
|
||||
if (!world.Map.Contains(cell))
|
||||
return false;
|
||||
|
||||
if (world.WorldActor.Trait<BuildingInfluence>().GetBuildingAt(cell) != null)
|
||||
return false;
|
||||
|
||||
if (!bi.AllowInvalidPlacement && world.ActorMap.GetUnitsAt(cell).Any(a => a != toIgnore))
|
||||
return false;
|
||||
|
||||
return bi.TerrainTypes.Contains(world.Map.GetTerrainInfo(cell).Type);
|
||||
}
|
||||
|
||||
public static bool CanPlaceBuilding(this World world, string name, BuildingInfo building, CPos topLeft, Actor toIgnore)
|
||||
{
|
||||
if (building.AllowInvalidPlacement)
|
||||
return true;
|
||||
|
||||
var res = world.WorldActor.Trait<ResourceLayer>();
|
||||
return FootprintUtils.Tiles(world.Map.Rules, name, building, topLeft).All(
|
||||
t => world.Map.Contains(t) && res.GetResource(t) == null &&
|
||||
world.IsCellBuildable(t, building, toIgnore));
|
||||
}
|
||||
|
||||
public static IEnumerable<CPos> GetLineBuildCells(World world, CPos location, string name, BuildingInfo bi)
|
||||
{
|
||||
var lbi = world.Map.Rules.Actors[name].Traits.Get<LineBuildInfo>();
|
||||
var topLeft = location; // 1x1 assumption!
|
||||
|
||||
if (world.IsCellBuildable(topLeft, bi))
|
||||
yield return topLeft;
|
||||
|
||||
// Start at place location, search outwards
|
||||
// TODO: First make it work, then make it nice
|
||||
var vecs = new[] { new CVec(1, 0), new CVec(0, 1), new CVec(-1, 0), new CVec(0, -1) };
|
||||
int[] dirs = { 0, 0, 0, 0 };
|
||||
for (var d = 0; d < 4; d++)
|
||||
{
|
||||
for (var i = 1; i < lbi.Range; i++)
|
||||
{
|
||||
if (dirs[d] != 0)
|
||||
continue;
|
||||
|
||||
var cell = topLeft + i * vecs[d];
|
||||
if (world.IsCellBuildable(cell, bi))
|
||||
continue; // Cell is empty; continue search
|
||||
|
||||
// Cell contains an actor. Is it the type we want?
|
||||
if (world.ActorsWithTrait<LineBuildNode>().Any(a =>
|
||||
(
|
||||
a.Actor.Location == cell &&
|
||||
a.Actor.Info.Traits.Get<LineBuildNodeInfo>().Types.Intersect(lbi.NodeTypes).Any()
|
||||
)))
|
||||
dirs[d] = i; // Cell contains actor of correct type
|
||||
else
|
||||
dirs[d] = -1; // Cell is blocked by another actor type
|
||||
}
|
||||
|
||||
// Place intermediate-line sections
|
||||
if (dirs[d] > 0)
|
||||
for (var i = 1; i < dirs[d]; i++)
|
||||
yield return topLeft + i * vecs[d];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.RA.Buildings
|
||||
{
|
||||
public static class FootprintUtils
|
||||
{
|
||||
public static IEnumerable<CPos> Tiles(Ruleset rules, string name, BuildingInfo buildingInfo, CPos topLeft)
|
||||
{
|
||||
var dim = (CVec)buildingInfo.Dimensions;
|
||||
|
||||
var footprint = buildingInfo.Footprint.Where(x => !char.IsWhiteSpace(x));
|
||||
|
||||
var buildingTraits = rules.Actors[name].Traits;
|
||||
if (buildingTraits.Contains<BibInfo>() && !buildingTraits.Get<BibInfo>().HasMinibib)
|
||||
{
|
||||
dim += new CVec(0, 1);
|
||||
footprint = footprint.Concat(new char[dim.X]);
|
||||
}
|
||||
|
||||
return TilesWhere(name, dim, footprint.ToArray(), a => a != '_').Select(t => t + topLeft);
|
||||
}
|
||||
|
||||
public static IEnumerable<CPos> Tiles(Actor a)
|
||||
{
|
||||
return Tiles(a.World.Map.Rules, a.Info.Name, a.Info.Traits.Get<BuildingInfo>(), a.Location);
|
||||
}
|
||||
|
||||
public static IEnumerable<CPos> UnpathableTiles(string name, BuildingInfo buildingInfo, CPos position)
|
||||
{
|
||||
var footprint = buildingInfo.Footprint.Where(x => !char.IsWhiteSpace(x)).ToArray();
|
||||
foreach (var tile in TilesWhere(name, (CVec)buildingInfo.Dimensions, footprint, a => a == 'x'))
|
||||
yield return tile + position;
|
||||
}
|
||||
|
||||
static IEnumerable<CVec> TilesWhere(string name, CVec dim, char[] footprint, Func<char, bool> cond)
|
||||
{
|
||||
if (footprint.Length != dim.X * dim.Y)
|
||||
throw new InvalidOperationException("Invalid footprint for " + name);
|
||||
var index = 0;
|
||||
|
||||
for (var y = 0; y < dim.Y; y++)
|
||||
for (var x = 0; x < dim.X; x++)
|
||||
if (cond(footprint[index++]))
|
||||
yield return new CVec(x, y);
|
||||
}
|
||||
|
||||
public static CVec AdjustForBuildingSize(BuildingInfo buildingInfo)
|
||||
{
|
||||
var dim = buildingInfo.Dimensions;
|
||||
return new CVec(dim.X / 2, dim.Y > 1 ? (dim.Y + 1) / 2 : 0);
|
||||
}
|
||||
|
||||
public static WVec CenterOffset(World w, BuildingInfo buildingInfo)
|
||||
{
|
||||
var dim = buildingInfo.Dimensions;
|
||||
return (w.Map.CenterOfCell(CPos.Zero + new CVec(dim.X, dim.Y)) - w.Map.CenterOfCell(new CPos(1, 1))) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ using OpenRA.Mods.Common.Orders;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class C4DemolitionInfo : ITraitInfo
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("This actor can be captured by a unit with Captures: trait.")]
|
||||
class CapturableInfo : ITraitInfo
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class CaptureNotificationInfo : ITraitInfo
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ using OpenRA.Mods.Common.Orders;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("This actor can capture other actors which have the Capturable: trait.")]
|
||||
class CapturesInfo : ITraitInfo
|
||||
|
||||
@@ -11,9 +11,10 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Mods.RA.Effects;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ using OpenRA.Mods.Common.Orders;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Overrides the default ToolTip when this actor is disguised (aids in deceiving enemy players).")]
|
||||
class DisguiseToolTipInfo : TooltipInfo, Requires<DisguiseInfo>
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Effects
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Effects
|
||||
{
|
||||
|
||||
@@ -10,11 +10,10 @@
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Spawn new actors when sold.")]
|
||||
class EmitInfantryOnSellInfo : TraitInfo<EmitInfantryOnSell>
|
||||
|
||||
@@ -14,7 +14,7 @@ using OpenRA.Mods.Common.Orders;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Can instantly repair other actors, but gets consumed afterwards.")]
|
||||
class EngineerRepairInfo : TraitInfo<EngineerRepair> { }
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("This actor can be captured by a unit with ExternalCaptures: trait.")]
|
||||
public class ExternalCapturableInfo : ITraitInfo
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
using System.Drawing;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Visualize the remaining CaptureCompleteTime from ExternalCapturable: trait.")]
|
||||
class ExternalCapturableBarInfo : ITraitInfo, Requires<ExternalCapturableInfo>
|
||||
|
||||
@@ -14,7 +14,7 @@ using OpenRA.Mods.Common.Orders;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("This actor can capture other actors which have the ExternalCapturable: trait.")]
|
||||
class ExternalCapturesInfo : ITraitInfo
|
||||
|
||||
@@ -15,7 +15,7 @@ using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("The player can give this unit the order to follow and protect friendly units with the Guardable trait.")]
|
||||
class GuardInfo : TraitInfo<Guard> { }
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Actor has a limited amount of ammo, after using it all the actor must reload in some way.")]
|
||||
public class LimitedAmmoInfo : ITraitInfo
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
|
||||
@@ -147,11 +147,6 @@
|
||||
<Compile Include="AutoHeal.cs" />
|
||||
<Compile Include="AutoTarget.cs" />
|
||||
<Compile Include="CaptureNotification.cs" />
|
||||
<Compile Include="Buildings\Building.cs" />
|
||||
<Compile Include="Buildings\BuildingInfluence.cs" />
|
||||
<Compile Include="Buildings\FootprintUtils.cs" />
|
||||
<Compile Include="Buildings\RepairableBuilding.cs" />
|
||||
<Compile Include="Buildings\BuildingUtils.cs" />
|
||||
<Compile Include="Scripting\Properties\RepairableBuildingProperties.cs" />
|
||||
<Compile Include="C4Demolition.cs" />
|
||||
<Compile Include="ExternalCapturable.cs" />
|
||||
@@ -225,7 +220,6 @@
|
||||
<Compile Include="RenderDetectionCircle.cs" />
|
||||
<Compile Include="RenderJammerCircle.cs" />
|
||||
<Compile Include="RenderRangeCircle.cs" />
|
||||
<Compile Include="Render\RenderBuilding.cs" />
|
||||
<Compile Include="Render\RenderBuildingCharge.cs" />
|
||||
<Compile Include="Render\RenderBuildingSilo.cs" />
|
||||
<Compile Include="Render\RenderBuildingTurreted.cs" />
|
||||
@@ -270,23 +264,20 @@
|
||||
<Compile Include="Traits\Buildings\Bridge.cs" />
|
||||
<Compile Include="Traits\Buildings\BridgeHut.cs" />
|
||||
<Compile Include="Traits\Buildings\Fake.cs" />
|
||||
<Compile Include="Traits\Buildings\FreeActor.cs" />
|
||||
<Compile Include="Traits\Buildings\OreRefinery.cs" />
|
||||
<Compile Include="Traits\Buildings\PrimaryBuilding.cs" />
|
||||
<Compile Include="Traits\Buildings\RepairsUnits.cs" />
|
||||
<Compile Include="Traits\Buildings\RepairableBuilding.cs" />
|
||||
<Compile Include="Traits\Buildings\Reservable.cs" />
|
||||
<Compile Include="Traits\Buildings\TargetableBuilding.cs" />
|
||||
<Compile Include="Traits\Cloak.cs" />
|
||||
<Compile Include="Traits\Harvester.cs" />
|
||||
<Compile Include="Traits\HarvesterHuskModifier.cs" />
|
||||
<Compile Include="Traits\LeavesHusk.cs" />
|
||||
<Compile Include="Traits\Modifiers\FrozenUnderFog.cs" />
|
||||
<Compile Include="Traits\RepairsBridges.cs" />
|
||||
<Compile Include="Traits\TargetableSubmarine.cs" />
|
||||
<Compile Include="Traits\TargetableUnit.cs" />
|
||||
<Compile Include="Traits\World\BridgeLayer.cs" />
|
||||
<Compile Include="Traits\World\PathfinderDebugOverlay.cs" />
|
||||
<Compile Include="Traits\World\ResourceLayer.cs" />
|
||||
<Compile Include="TransformOnCapture.cs" />
|
||||
<Compile Include="TransformOnPassenger.cs" />
|
||||
<Compile Include="Transforms.cs" />
|
||||
@@ -336,10 +327,8 @@
|
||||
<Compile Include="Render\WithTurret.cs" />
|
||||
<Compile Include="Render\WithBarrel.cs" />
|
||||
<Compile Include="Widgets\Logic\CreditsLogic.cs" />
|
||||
<Compile Include="Render\WithHarvestAnimation.cs" />
|
||||
<Compile Include="Widgets\Logic\SimpleTooltipLogic.cs" />
|
||||
<Compile Include="Widgets\Logic\WorldTooltipLogic.cs" />
|
||||
<Compile Include="Buildings\Bib.cs" />
|
||||
<Compile Include="AI\Squad.cs" />
|
||||
<Compile Include="AI\States\StateBase.cs" />
|
||||
<Compile Include="AI\States\GroundStates.cs" />
|
||||
@@ -347,7 +336,6 @@
|
||||
<Compile Include="AI\States\AirStates.cs" />
|
||||
<Compile Include="Widgets\Logic\InstallLogic.cs" />
|
||||
<Compile Include="CombatDebugOverlay.cs" />
|
||||
<Compile Include="Render\WithCrateBody.cs" />
|
||||
<Compile Include="Widgets\Logic\GameTimerLogic.cs" />
|
||||
<Compile Include="Widgets\Logic\ReplayControlBarLogic.cs" />
|
||||
<Compile Include="Attack\AttackFollow.cs" />
|
||||
@@ -371,12 +359,11 @@
|
||||
<Compile Include="Lint\CheckActors.cs" />
|
||||
<Compile Include="Lint\CheckMapCordon.cs" />
|
||||
<Compile Include="Parachutable.cs" />
|
||||
<Compile Include="Render\WithMakeAnimation.cs" />
|
||||
<Compile Include="Widgets\Logic\InstallFromCDLogic.cs" />
|
||||
<Compile Include="Widgets\Logic\InstallMusicLogic.cs" />
|
||||
<Compile Include="Render\WithActiveAnimation.cs" />
|
||||
<Compile Include="SupportPowers\SpawnActorPower.cs" />
|
||||
<Compile Include="Buildings\ClonesProducedUnits.cs" />
|
||||
<Compile Include="Traits\Buildings\ClonesProducedUnits.cs" />
|
||||
<Compile Include="Cloneable.cs" />
|
||||
<Compile Include="Widgets\ProductionPaletteWidget.cs" />
|
||||
<Compile Include="Widgets\ProductionTabsWidget.cs" />
|
||||
@@ -394,8 +381,6 @@
|
||||
<Compile Include="Widgets\Logic\DebugMenuLogic.cs" />
|
||||
<Compile Include="ProductionQueueFromSelection.cs" />
|
||||
<Compile Include="GainsStatUpgrades.cs" />
|
||||
<Compile Include="Warheads\CreateResourceWarhead.cs" />
|
||||
<Compile Include="Warheads\DestroyResourceWarhead.cs" />
|
||||
<Compile Include="Warheads\PerCellDamageWarhead.cs" />
|
||||
<Compile Include="Scripting\Properties\HarvesterProperties.cs" />
|
||||
<Compile Include="Scripting\Properties\HelicopterProperties.cs" />
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Orders
|
||||
|
||||
@@ -14,11 +14,9 @@ using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Orders
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Orders
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
#endregion
|
||||
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
{
|
||||
[Desc("Attach this to the player actor to allow building repair by team mates.")]
|
||||
|
||||
@@ -10,10 +10,9 @@
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Plays an audio notification and shows a radar ping when a building is attacked.",
|
||||
"Attach this to the player actor.")]
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
|
||||
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Unit will reload its limited ammo itself.")]
|
||||
public class ReloadsInfo : ITraitInfo, Requires<LimitedAmmoInfo>
|
||||
|
||||
@@ -13,10 +13,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Changes the visual Z position periodically.")]
|
||||
class HoversInfo : ITraitInfo, Requires<IMoveInfo>
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
public class RenderBuildingInfo : RenderSimpleInfo, Requires<BuildingInfo>, IPlaceBuildingDecoration
|
||||
{
|
||||
public readonly bool PauseOnLowPower = false;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new RenderBuilding(init, this);}
|
||||
|
||||
public IEnumerable<IRenderable> Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
|
||||
{
|
||||
if (!ai.Traits.Get<BuildingInfo>().RequiresBaseProvider)
|
||||
yield break;
|
||||
|
||||
foreach (var a in w.ActorsWithTrait<BaseProvider>())
|
||||
foreach (var r in a.Trait.RenderAfterWorld(wr))
|
||||
yield return r;
|
||||
}
|
||||
}
|
||||
|
||||
public class RenderBuilding : RenderSimple, INotifyDamageStateChanged, INotifyBuildComplete
|
||||
{
|
||||
RenderBuildingInfo info;
|
||||
|
||||
public RenderBuilding(ActorInitializer init, RenderBuildingInfo info)
|
||||
: this(init, info, () => 0) { }
|
||||
|
||||
public RenderBuilding(ActorInitializer init, RenderBuildingInfo info, Func<int> baseFacing)
|
||||
: base(init.self, baseFacing)
|
||||
{
|
||||
var self = init.self;
|
||||
this.info = info;
|
||||
|
||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle"));
|
||||
}
|
||||
|
||||
public virtual void BuildingComplete(Actor self)
|
||||
{
|
||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle"));
|
||||
|
||||
if (info.PauseOnLowPower)
|
||||
{
|
||||
var disabled = self.TraitsImplementing<IDisable>();
|
||||
DefaultAnimation.Paused = () => disabled.Any(d => d.Disabled)
|
||||
&& DefaultAnimation.CurrentSequence.Name == NormalizeSequence(self, "idle");
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayCustomAnimThen(Actor self, string name, Action a)
|
||||
{
|
||||
DefaultAnimation.PlayThen(NormalizeSequence(self, name),
|
||||
() => { DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle")); a(); });
|
||||
}
|
||||
|
||||
public void PlayCustomAnimRepeating(Actor self, string name)
|
||||
{
|
||||
DefaultAnimation.PlayThen(NormalizeSequence(self, name),
|
||||
() => PlayCustomAnimRepeating(self, name));
|
||||
}
|
||||
|
||||
public void PlayCustomAnimBackwards(Actor self, string name, Action a)
|
||||
{
|
||||
DefaultAnimation.PlayBackwardsThen(NormalizeSequence(self, name),
|
||||
() => { DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle")); a(); });
|
||||
}
|
||||
|
||||
public void CancelCustomAnim(Actor self)
|
||||
{
|
||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle"));
|
||||
}
|
||||
|
||||
public virtual void DamageStateChanged(Actor self, AttackInfo e)
|
||||
{
|
||||
if (DefaultAnimation.CurrentSequence != null)
|
||||
DefaultAnimation.ReplaceAnim(NormalizeSequence(self, DefaultAnimation.CurrentSequence.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,9 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Used for tesla coil and obelisk.")]
|
||||
public class RenderBuildingChargeInfo : RenderBuildingInfo
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class RenderBuildingSiloInfo : RenderBuildingInfo
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class RenderBuildingTurretedInfo : RenderBuildingInfo, Requires<TurretedInfo>
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class RenderBuildingWallInfo : RenderBuildingInfo
|
||||
{
|
||||
|
||||
@@ -11,12 +11,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class RenderBuildingWarFactoryInfo : RenderBuildingInfo
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class RenderDisguiseInfo : RenderInfantryInfo, Requires<DisguiseInfo>
|
||||
{
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class RenderHarvesterInfo : RenderUnitInfo, Requires<HarvesterInfo>
|
||||
{
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
public class RenderInfantryInfo : RenderSimpleInfo, Requires<IMoveInfo>
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
public class RenderLandingCraftInfo : RenderUnitInfo, Requires<IMoveInfo>, Requires<CargoInfo>
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class RenderUnitReloadInfo : RenderUnitInfo, Requires<ArmamentInfo>, Requires<AttackBaseInfo>
|
||||
{
|
||||
|
||||
@@ -11,9 +11,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Replaces the idle animation of a building.")]
|
||||
public class WithActiveAnimationInfo : ITraitInfo, Requires<RenderBuildingInfo>
|
||||
|
||||
@@ -15,7 +15,7 @@ using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Renders barrels for units with the Turreted trait.")]
|
||||
class WithBarrelInfo : ITraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<IBodyOrientationInfo>
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Display explosions over the building footprint when it is destroyed.")]
|
||||
class WithBuildingExplosionInfo : ITraitInfo, Requires<BuildingInfo>
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
[Desc("Renders crates with both water and land variants.")]
|
||||
class WithCrateBodyInfo : ITraitInfo, Requires<RenderSpritesInfo>
|
||||
{
|
||||
public readonly string[] Images = { "crate" };
|
||||
|
||||
[Desc("Easteregg sequences to use in december.")]
|
||||
public readonly string[] XmasImages = { };
|
||||
|
||||
public object Create(ActorInitializer init) { return new WithCrateBody(init.self, this); }
|
||||
}
|
||||
|
||||
class WithCrateBody : INotifyParachuteLanded
|
||||
{
|
||||
readonly Actor self;
|
||||
readonly Animation anim;
|
||||
|
||||
public WithCrateBody(Actor self, WithCrateBodyInfo info)
|
||||
{
|
||||
this.self = self;
|
||||
var rs = self.Trait<RenderSprites>();
|
||||
var images = info.XmasImages.Any() && DateTime.Today.Month == 12 ? info.XmasImages : info.Images;
|
||||
anim = new Animation(self.World, images.Random(Game.CosmeticRandom));
|
||||
anim.Play("idle");
|
||||
rs.Add("crate", anim);
|
||||
}
|
||||
|
||||
public void OnLanded()
|
||||
{
|
||||
var seq = self.World.Map.GetTerrainInfo(self.Location).IsWater ? "water" : "land";
|
||||
anim.PlayRepeating(seq);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
[Desc("Displays an overlay whenever resources are harvested by the actor.")]
|
||||
class WithHarvestAnimationInfo : ITraitInfo, Requires<RenderSpritesInfo>, Requires<IBodyOrientationInfo>
|
||||
{
|
||||
[Desc("Sequence name to use")]
|
||||
public readonly string Sequence = "harvest";
|
||||
|
||||
[Desc("Position relative to body")]
|
||||
public readonly WVec Offset = WVec.Zero;
|
||||
|
||||
public object Create(ActorInitializer init) { return new WithHarvestAnimation(init.self, this); }
|
||||
}
|
||||
|
||||
class WithHarvestAnimation : INotifyHarvesterAction
|
||||
{
|
||||
WithHarvestAnimationInfo info;
|
||||
Animation anim;
|
||||
bool visible;
|
||||
|
||||
public WithHarvestAnimation(Actor self, WithHarvestAnimationInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
var rs = self.Trait<RenderSprites>();
|
||||
var body = self.Trait<IBodyOrientation>();
|
||||
|
||||
anim = new Animation(self.World, rs.GetImage(self), RenderSimple.MakeFacingFunc(self));
|
||||
anim.Play(info.Sequence);
|
||||
rs.Add("harvest_{0}".F(info.Sequence), new AnimationWithOffset(anim,
|
||||
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
|
||||
() => !visible,
|
||||
() => false,
|
||||
p => WithTurret.ZOffsetFromCenter(self, p, 0)));
|
||||
}
|
||||
|
||||
public void Harvested(Actor self, ResourceType resource)
|
||||
{
|
||||
if (visible)
|
||||
return;
|
||||
|
||||
visible = true;
|
||||
anim.PlayThen(info.Sequence, () => visible = false);
|
||||
}
|
||||
|
||||
public void MovingToResources(Actor self, CPos targetCell, Activity next) { }
|
||||
public void MovingToRefinery(Actor self, CPos targetCell, Activity next) { }
|
||||
public void MovementCancelled(Actor self) { }
|
||||
}
|
||||
}
|
||||
@@ -11,12 +11,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Renders a decorative animation on units and buildings.")]
|
||||
public class WithIdleOverlayInfo : ITraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<IBodyOrientationInfo>
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Activities;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
public class WithMakeAnimationInfo : ITraitInfo, Requires<BuildingInfo>, Requires<RenderBuildingInfo>
|
||||
{
|
||||
[Desc("Sequence name to use")]
|
||||
public readonly string Sequence = "make";
|
||||
|
||||
public object Create(ActorInitializer init) { return new WithMakeAnimation(init, this); }
|
||||
}
|
||||
|
||||
public class WithMakeAnimation
|
||||
{
|
||||
readonly WithMakeAnimationInfo info;
|
||||
readonly RenderBuilding renderBuilding;
|
||||
|
||||
public WithMakeAnimation(ActorInitializer init, WithMakeAnimationInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
var self = init.self;
|
||||
renderBuilding = self.Trait<RenderBuilding>();
|
||||
|
||||
var building = self.Trait<Building>();
|
||||
if (!building.SkipMakeAnimation)
|
||||
{
|
||||
renderBuilding.PlayCustomAnimThen(self, info.Sequence, () =>
|
||||
{
|
||||
building.NotifyBuildingComplete(self);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void Reverse(Actor self, Activity activity)
|
||||
{
|
||||
renderBuilding.PlayCustomAnimBackwards(self, info.Sequence, () =>
|
||||
{
|
||||
// avoids visual glitches as we wait for the actor to get destroyed
|
||||
renderBuilding.DefaultAnimation.PlayFetchIndex(info.Sequence, () => 0);
|
||||
self.QueueActivity(activity);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,10 +13,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Renders the MuzzleSequence from the Armament trait.")]
|
||||
class WithMuzzleFlashInfo : ITraitInfo, Requires<RenderSpritesInfo>, Requires<AttackBaseInfo>, Requires<ArmamentInfo>
|
||||
|
||||
@@ -10,9 +10,10 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Replaces the building animation when it repairs a unit.")]
|
||||
public class WithRepairAnimationInfo : ITraitInfo, Requires<RenderBuildingInfo>
|
||||
|
||||
@@ -12,10 +12,9 @@ using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Displays an overlay when the building is being repaired by the player.")]
|
||||
public class WithRepairOverlayInfo : ITraitInfo, Requires<RenderSpritesInfo>, Requires<IBodyOrientationInfo>
|
||||
|
||||
@@ -15,7 +15,7 @@ using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Renders turrets for units with the Turreted trait.")]
|
||||
class WithTurretInfo : ITraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<TurretedInfo>, Requires<IBodyOrientationInfo>
|
||||
|
||||
@@ -14,7 +14,7 @@ using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class RenderDetectionCircleInfo : ITraitInfo
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
// TODO: remove all the Render*Circle duplication
|
||||
class RenderJammerCircleInfo : ITraitInfo, IPlaceBuildingDecoration
|
||||
|
||||
@@ -13,15 +13,11 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
public interface IPlaceBuildingDecoration
|
||||
{
|
||||
IEnumerable<IRenderable> Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition);
|
||||
}
|
||||
|
||||
[Desc("Draw a circle indicating my weapon's range.")]
|
||||
class RenderRangeCircleInfo : ITraitInfo, IPlaceBuildingDecoration, Requires<AttackBaseInfo>
|
||||
{
|
||||
|
||||
@@ -12,9 +12,10 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class RenderShroudCircleInfo : ITraitInfo, IPlaceBuildingDecoration
|
||||
{
|
||||
|
||||
@@ -16,10 +16,9 @@ using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.Common.Orders;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("This actor can be sent to a structure for repairs.")]
|
||||
class RepairableInfo : ITraitInfo, Requires<HealthInfo>
|
||||
|
||||
@@ -12,11 +12,11 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Orders;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class RepairableNearInfo : ITraitInfo, Requires<HealthInfo>
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
using Eluant;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
@@ -11,11 +11,9 @@
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
|
||||
[Desc("Actor can be sold")]
|
||||
|
||||
@@ -14,11 +14,10 @@ using System.Linq;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class AirstrikePowerInfo : SupportPowerInfo
|
||||
{
|
||||
|
||||
@@ -13,10 +13,9 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class GrantUpgradePowerInfo : SupportPowerInfo
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
class NukePowerInfo : SupportPowerInfo, Requires<IBodyOrientationInfo>
|
||||
{
|
||||
|
||||
@@ -14,11 +14,10 @@ using System.Linq;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
public class ParatroopersPowerInfo : SupportPowerInfo
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Effects;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Spawns an actor that stays for a limited amount of time.")]
|
||||
public class SpawnActorPowerInfo : SupportPowerInfo
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
public abstract class SupportPowerInfo : ITraitInfo
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
[Desc("Display the time remaining until the super weapon attached to the actor is ready to the player and his allies.")]
|
||||
class SupportPowerChargeBarInfo : ITraitInfo
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user