invuln moved to mod

This commit is contained in:
Chris Forbes
2010-01-29 19:48:51 +13:00
parent 84d2a01a69
commit d043f6690d
8 changed files with 23 additions and 17 deletions

View File

@@ -81,7 +81,6 @@
<Compile Include="Effects\DelayedAction.cs" /> <Compile Include="Effects\DelayedAction.cs" />
<Compile Include="Effects\FlashTarget.cs" /> <Compile Include="Effects\FlashTarget.cs" />
<Compile Include="Effects\GpsSatellite.cs" /> <Compile Include="Effects\GpsSatellite.cs" />
<Compile Include="Effects\InvulnEffect.cs" />
<Compile Include="Effects\MoveFlash.cs" /> <Compile Include="Effects\MoveFlash.cs" />
<Compile Include="Effects\RepairIndicator.cs" /> <Compile Include="Effects\RepairIndicator.cs" />
<Compile Include="Effects\SatelliteLaunch.cs" /> <Compile Include="Effects\SatelliteLaunch.cs" />
@@ -218,8 +217,6 @@
<Compile Include="Traits\Helicopter.cs" /> <Compile Include="Traits\Helicopter.cs" />
<Compile Include="Traits\InvisibleToOthers.cs" /> <Compile Include="Traits\InvisibleToOthers.cs" />
<Compile Include="Traits\ConstructionYard.cs" /> <Compile Include="Traits\ConstructionYard.cs" />
<Compile Include="Traits\IronCurtainable.cs" />
<Compile Include="Traits\IronCurtainPower.cs" />
<Compile Include="Traits\JamsRadar.cs" /> <Compile Include="Traits\JamsRadar.cs" />
<Compile Include="Traits\LightPaletteRotator.cs" /> <Compile Include="Traits\LightPaletteRotator.cs" />
<Compile Include="Traits\LimitedAmmo.cs" /> <Compile Include="Traits\LimitedAmmo.cs" />

View File

@@ -3,12 +3,12 @@ using OpenRa.Effects;
namespace OpenRa.Traits namespace OpenRa.Traits
{ {
class RenderBuildingInfo : RenderSimpleInfo public class RenderBuildingInfo : RenderSimpleInfo
{ {
public override object Create(Actor self) { return new RenderBuilding(self); } public override object Create(Actor self) { return new RenderBuilding(self); }
} }
class RenderBuilding : RenderSimple, INotifyDamage, INotifySold public class RenderBuilding : RenderSimple, INotifyDamage, INotifySold
{ {
const int SmallBibStart = 1; const int SmallBibStart = 1;
const int LargeBibStart = 5; const int LargeBibStart = 5;

View File

@@ -5,12 +5,12 @@ using System.Text;
namespace OpenRa.Traits namespace OpenRa.Traits
{ {
class SelectableInfo : StatelessTraitInfo<Selectable> public class SelectableInfo : StatelessTraitInfo<Selectable>
{ {
public readonly int Priority = 10; public readonly int Priority = 10;
public readonly int[] Bounds = null; public readonly int[] Bounds = null;
public readonly string Voice = "GenericVoice"; public readonly string Voice = "GenericVoice";
} }
class Selectable {} public class Selectable {}
} }

View File

@@ -52,6 +52,12 @@ namespace OpenRa
world.TileSet.GetWalkability(world.Map.MapTiles[a.X, a.Y])) < double.PositiveInfinity; world.TileSet.GetWalkability(world.Map.MapTiles[a.X, a.Y])) < double.PositiveInfinity;
} }
public static IEnumerable<Actor> FindUnitsAtMouse(this World world, int2 mouseLocation)
{
var loc = mouseLocation + Game.viewport.Location;
return FindUnits(world, loc, loc);
}
public static IEnumerable<Actor> FindUnits(this World world, float2 a, float2 b) public static IEnumerable<Actor> FindUnits(this World world, float2 a, float2 b)
{ {
var min = float2.Min(a, b); var min = float2.Min(a, b);

View File

@@ -1,8 +1,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using OpenRa.Graphics; using OpenRa.Graphics;
using OpenRa.Traits; using OpenRa.Traits;
using OpenRa.Effects;
namespace OpenRa.Effects namespace OpenRa.Mods.RA.Effects
{ {
class InvulnEffect : IEffect class InvulnEffect : IEffect
{ {

View File

@@ -1,10 +1,8 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using OpenRa.Traits;
using OpenRa.Orders;
namespace OpenRa.Traits namespace OpenRa.Mods.RA
{ {
class IronCurtainPowerInfo : SupportPowerInfo class IronCurtainPowerInfo : SupportPowerInfo
{ {
@@ -61,9 +59,8 @@ namespace OpenRa.Traits
{ {
if (mi.Button == MouseButton.Left) if (mi.Button == MouseButton.Left)
{ {
var loc = mi.Location + Game.viewport.Location; var underCursor = world.FindUnitsAtMouse(mi.Location)
var underCursor = world.FindUnits(loc, loc) .Where(a => a.Owner != null
.Where(a => a.Owner == world.LocalPlayer
&& a.traits.Contains<IronCurtainable>() && a.traits.Contains<IronCurtainable>()
&& a.traits.Contains<Selectable>()).FirstOrDefault(); && a.traits.Contains<Selectable>()).FirstOrDefault();

View File

@@ -1,7 +1,9 @@
using System.Linq; using System.Linq;
using OpenRa.Effects; using OpenRa.Effects;
using OpenRa.Traits;
using OpenRa.Mods.RA.Effects;
namespace OpenRa.Traits namespace OpenRa.Mods.RA
{ {
class IronCurtainableInfo : ITraitInfo class IronCurtainableInfo : ITraitInfo
{ {

View File

@@ -53,9 +53,12 @@
<Compile Include="Activities\Steal.cs" /> <Compile Include="Activities\Steal.cs" />
<Compile Include="C4Demolition.cs" /> <Compile Include="C4Demolition.cs" />
<Compile Include="Effects\CrateEffect.cs" /> <Compile Include="Effects\CrateEffect.cs" />
<Compile Include="Effects\InvulnEffect.cs" />
<Compile Include="Effects\Parachute.cs" /> <Compile Include="Effects\Parachute.cs" />
<Compile Include="EngineerCapture.cs" /> <Compile Include="EngineerCapture.cs" />
<Compile Include="InfiltrateForSonarPulse.cs" /> <Compile Include="InfiltrateForSonarPulse.cs" />
<Compile Include="IronCurtainable.cs" />
<Compile Include="IronCurtainPower.cs" />
<Compile Include="ParaDrop.cs" /> <Compile Include="ParaDrop.cs" />
<Compile Include="ParatroopersPower.cs" /> <Compile Include="ParatroopersPower.cs" />
<Compile Include="RequiresPower.cs" /> <Compile Include="RequiresPower.cs" />