hide-map crate

This commit is contained in:
Paul Chote
2010-03-21 21:14:09 +13:00
parent 061f43bdf6
commit cce0c8f228
4 changed files with 51 additions and 1 deletions

View File

@@ -98,7 +98,12 @@ namespace OpenRA
return IsExplored(x,y);
}
public void ResetExplored()
{
explored = new bool[map.MapSize, map.MapSize];
}
Rectangle MakeRect(int2 center, int range)
{
return new Rectangle(center.X - range, center.Y - range, 2 * range + 1, 2 * range + 1);

View File

@@ -0,0 +1,41 @@
#region Copyright & License Information
/*
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
* This file is part of OpenRA.
*
* OpenRA is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenRA is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
*/
#endregion
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class HideMapCrateActionInfo : CrateActionInfo
{
public override object Create(Actor self) { return new HideMapCrateAction(self, this); }
}
class HideMapCrateAction : CrateAction
{
public HideMapCrateAction(Actor self, HideMapCrateActionInfo info)
: base(self, info) {}
public override void Activate(Actor collector)
{
collector.Owner.Shroud.ResetExplored();
base.Activate(collector);
}
}
}

View File

@@ -78,6 +78,7 @@
<Compile Include="Spy.cs" />
<Compile Include="SpyPlanePower.cs" />
<Compile Include="Thief.cs" />
<Compile Include="Crates\ResetRadarCrateAction.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -659,6 +659,9 @@ CRATE:
ExplodeCrateAction@boom:
Weapon: CrateExplosion
SelectionShares: 5
HideMapCrateAction:
SelectionShares: 10
Effect: hide-map
Unit:
HP: 1
RenderUnit: