give Gap Generator to allies

This commit is contained in:
Curtis Shmyr
2012-03-24 09:09:22 -06:00
committed by Chris Forbes
parent beb6b01796
commit 891cba456b
4 changed files with 67 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -150,6 +150,7 @@
<Compile Include="TraitDictionary.cs" />
<Compile Include="Traits\Activity.cs" />
<Compile Include="Traits\Armor.cs" />
<Compile Include="Traits\CreatesShroud.cs" />
<Compile Include="Traits\DrawLineToTarget.cs" />
<Compile Include="Traits\EditorAppearance.cs" />
<Compile Include="Traits\EditorTilesetFilter.cs" />
@@ -240,4 +241,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

View File

@@ -0,0 +1,36 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 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.Linq;
namespace OpenRA.Traits
{
class CreatesShroudInfo : ITraitInfo
{
public readonly int Range = 0;
public object Create(ActorInitializer init) { return new CreatesShroud(this); }
}
class CreatesShroud : ITick
{
CreatesShroudInfo Info;
public CreatesShroud(CreatesShroudInfo info)
{
Info = info;
}
public void Tick(Actor self)
{
if (!self.TraitsImplementing<IDisable>().Any(d => d.Disabled))
self.World.WorldActor.Trait<Shroud>().HideActor(self, Info.Range);
}
}
}

View File

@@ -112,6 +112,24 @@ namespace OpenRA.Traits
Dirty();
}
public void HideActor(Actor a, int range)
{
if (a.Owner.World.LocalPlayer == null
|| a.Owner.Stances[a.Owner.World.LocalPlayer] == Stance.Ally) return;
var v = new ActorVisibility
{
vis = GetVisOrigins(a).ToArray()
};
foreach (var p in v.vis)
foreach (var q in FindVisibleTiles(a.World, p, range))
exploredCells[q.X, q.Y] = visibleCells[q.X, q.Y] > 0;
if (!Disabled)
Dirty();
}
public void UpdatePlayerStance(World w, Player player, Stance oldStance, Stance newStance)
{
if (oldStance == newStance)

View File

@@ -42,15 +42,15 @@ GAP:
RequiresPower:
CanPowerDown:
Valued:
Cost: 500
Cost: 1000
Tooltip:
Name: Gap Generator
Description: Regenerates the Fog of War nearby, \nobscuring the area.\n Unarmed
# Buildable:
# BuildPaletteOrder: 100
# Prerequisites: atek
# Owner: allies
# Cost: 500
Description: Regenerates the shroud nearby, \nobscuring the area.\n Unarmed
Buildable:
Queue: Defense
BuildPaletteOrder: 100
Prerequisites: atek
Owner: allies
Building:
Power: -60
Footprint: _ x
@@ -60,7 +60,9 @@ GAP:
Armor:
Type: Wood
RevealsShroud:
Range: 10
Range: 6
CreatesShroud:
Range: 6
IronCurtainable:
SPEN: