Mostly implemented Sonar Pulse

This commit is contained in:
Paul Chote
2010-01-25 00:28:43 +13:00
parent 8ffb000e2e
commit e6ded0e491
8 changed files with 158 additions and 98 deletions

View File

@@ -224,6 +224,7 @@
<Compile Include="Traits\NukePower.cs" />
<Compile Include="Traits\Passenger.cs" />
<Compile Include="Traits\PlaceBuilding.cs" />
<Compile Include="Traits\SonarPulsePower.cs" />
<Compile Include="Traits\SpyPlanePower.cs" />
<Compile Include="Traits\SupportPower.cs" />
<Compile Include="Traits\ProvidesRadar.cs" />

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRa.Orders;
namespace OpenRa.Traits
{
public class SonarPulsePowerInfo : SupportPowerInfo
{
public override object Create(Actor self) { return new SonarPulsePower(self, this); }
}
public class SonarPulsePower : SupportPower
{
public SonarPulsePower(Actor self, SonarPulsePowerInfo info) : base(self, info) { }
protected override void OnBeginCharging() { }
protected override void OnFinishCharging() { Sound.Play("pulse1.aud"); }
protected override void OnActivate()
{
// Question: Is this method synced? or does it have to go via an order?
// TODO: Reveal submarines
// Should this play for all players?
Sound.Play("sonpulse.aud");
FinishActivate();
}
}
}

View File

@@ -5,7 +5,7 @@ using System.Text;
namespace OpenRa.Traits
{
abstract class SupportPowerInfo : ITraitInfo
public abstract class SupportPowerInfo : ITraitInfo
{
public readonly bool RequiresPower = true;
public readonly bool OneShot = false;
@@ -20,7 +20,7 @@ namespace OpenRa.Traits
public abstract object Create(Actor self);
}
class SupportPower : ITick
public class SupportPower : ITick
{
public readonly SupportPowerInfo Info;
public int RemainingTime { get; private set; }
@@ -58,7 +58,8 @@ namespace OpenRa.Traits
}
// Do we have enough powered prerequisites?
var isPowered = effectivePrereq.Any() && effectivePrereq.All(a => buildings[a].Any(b => !b.traits.Get<Building>().Disabled));
// Hack in support for special powers without prereqs
var isPowered = (Info.Prerequisites.Count() == 0) ? self.Owner.GetPowerState() == PowerState.Normal : effectivePrereq.Any() && effectivePrereq.All(a => buildings[a].Any(b => !b.traits.Get<Building>().Disabled));
if (IsAvailable && (!Info.RequiresPower || isPowered))
{

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRa.Traits;
namespace OpenRa.Mods.RA
{
class InfiltrateForSonarPulseInfo : StatelessTraitInfo<InfiltrateForSonarPulse> { }
class InfiltrateForSonarPulse : IAcceptSpy
{
public void OnInfiltrate(Actor self, Actor spy)
{
Game.world.LocalPlayer.PlayerActor.traits.Get<SonarPulsePower>().Give(1.0f);
}
}
}

View File

@@ -52,6 +52,7 @@
<Compile Include="Activities\Steal.cs" />
<Compile Include="C4Demolition.cs" />
<Compile Include="EngineerCapture.cs" />
<Compile Include="InfiltrateForSonarPulse.cs" />
<Compile Include="Mine.cs" />
<Compile Include="MineImmune.cs" />
<Compile Include="Minelayer.cs" />

View File

@@ -38,9 +38,17 @@ Player:
Image: atomicon
ChargeTime: 13
Description: Atom Bomb
LongDesc: Launches a nuclear missile at your target.
LongDesc: Launches a nuclear missile at a target location.
Prerequisites: MSLO
TechLevel: 12
SonarPulsePower:
Image: sonricon
ChargeTime: 10
Description: Sonar Pulse
LongDesc: Reveals all submarines on the map for a \nshort time.
TechLevel: 5
GivenAuto: no
OneShot: yes
World:
WaterPaletteRotation:
@@ -93,6 +101,11 @@ BRIDGE2:
Bridge:
UseAlternateNames: yes
MSLO:
NukeSilo:
NukeSilo:
SPEN:
InfiltrateForSonarPulse:
SYRD:
InfiltrateForSonarPulse:

View File

@@ -34,6 +34,21 @@ Player:
LongDesc: Reveals an area of the map.
Prerequisites: AFLD
TechLevel: 5
NukePower:
Image: atomicon
ChargeTime: 13
Description: Atom Bomb
LongDesc: Launches a nuclear missile at a target location.
Prerequisites: MSLO
TechLevel: 12
SonarPulsePower:
Image: sonricon
ChargeTime: 10
Description: Sonar Pulse
LongDesc: Reveals all submarines on the map for a \nshort time.
TechLevel: 5
GivenAuto: no
OneShot: yes
World:
WaterPaletteRotation:
@@ -197,6 +212,79 @@ BRIDGE2:
Dimensions: 5,2
HP: 1000
MSLO:
NukeSilo:
Inherits: ^Building
Buildable:
TechLevel: 13
Prerequisites: @Tech Center
Owner: soviet,allies
Cost: 2500
Description: Missile Silo
LongDesc: Launches a devastating nuclear strike.\n Strong vs Infantry, Buildings\n Weak vs Tanks\n Special Ability: Nuclear Missile
Building:
Power: -100
Footprint: xx
Dimensions: 2,1
HP: 400
Armor: heavy
Crewed: yes
Sight: 5
RenderBuilding:
IronCurtainable:
SPEN:
InfiltrateForSonarPulse:
Inherits: ^Building
Buildable:
TechLevel: 3
Prerequisites: powr
Owner: soviet
Cost: 650
Description: Sub Pen
LongDesc: Produces and repairs submarines and \ntransports
Building:
Power: -30
Footprint: xxx xxx xxx
Dimensions: 3,3
Capturable: true
BaseNormal: no
Adjacent: 8
HP: 1000
Armor: light
WaterBound: yes
Sight: 4
RenderBuilding:
ProductionSurround:
Produces: Ship
IronCurtainable:
SYRD:
InfiltrateForSonarPulse:
Inherits: ^Building
Buildable:
TechLevel: 3
Prerequisites: powr
Owner: allies
Cost: 650
Description: Shipyard
LongDesc: Produces and repairs ships
Building:
Power: -30
Footprint: xxx xxx xxx
Dimensions: 3,3
Capturable: true
BaseNormal: no
Adjacent: 8
HP: 1000
Armor: light
WaterBound: yes
Sight: 4
RenderBuilding:
ProductionSurround:
Produces: Ship
IronCurtainable:
V2RL:
Inherits: ^Vehicle
Buildable:
@@ -1019,26 +1107,6 @@ SAM:
AutoTarget:
IronCurtainable:
MSLO:
Inherits: ^Building
Buildable:
TechLevel: 13
Prerequisites: @Tech Center
Owner: soviet,allies
Cost: 2500
Description: Missile Silo
LongDesc: Launches a devastating nuclear strike.\n Strong vs Infantry, Buildings\n Weak vs Tanks\n Special Ability: Nuclear Missile
Building:
Power: -100
Footprint: xx
Dimensions: 2,1
HP: 400
Armor: heavy
Crewed: yes
Sight: 5
RenderBuilding:
IronCurtainable:
ATEK:
Inherits: ^Building
Buildable:
@@ -1089,56 +1157,6 @@ WEAP:
Produces: Vehicle
IronCurtainable:
SYRD:
Inherits: ^Building
Buildable:
TechLevel: 3
Prerequisites: powr
Owner: allies
Cost: 650
Description: Shipyard
LongDesc: Produces and repairs ships
Building:
Power: -30
Footprint: xxx xxx xxx
Dimensions: 3,3
Capturable: true
BaseNormal: no
Adjacent: 8
HP: 1000
Armor: light
WaterBound: yes
Sight: 4
RenderBuilding:
ProductionSurround:
Produces: Ship
IronCurtainable:
SPEN:
Inherits: ^Building
Buildable:
TechLevel: 3
Prerequisites: powr
Owner: soviet
Cost: 650
Description: Sub Pen
LongDesc: Produces and repairs submarines and \ntransports
Building:
Power: -30
Footprint: xxx xxx xxx
Dimensions: 3,3
Capturable: true
BaseNormal: no
Adjacent: 8
HP: 1000
Armor: light
WaterBound: yes
Sight: 4
RenderBuilding:
ProductionSurround:
Produces: Ship
IronCurtainable:
FACT:
Inherits: ^Building
Building:

View File

@@ -869,25 +869,4 @@ Powered=no
Image=pbmbicon
TechLevel=8
GivenAuto=no
Impl=NullPower
[SonarPulsePower] ; picked up in a crate, or by spy -> spen/syrd
ChargeTime=10
Description=Sonar Pulse
LongDesc=Reveals all submarines on the map for a \nshort time.
OneShot=yes
Powered=no
Image=sonricon
TechLevel=5
GivenAuto=no
Impl=NullPower
[NukePower] ; the point of MSLO
ChargeTime=13
Description=Atom Bomb
LongDesc=Launches a nuclear missile at your target
Prerequisite=MSLO
Image=atomicon
TechLevel=12
Impl=NullPower
Impl=NullPower