Mostly implemented Sonar Pulse
This commit is contained in:
@@ -224,6 +224,7 @@
|
|||||||
<Compile Include="Traits\NukePower.cs" />
|
<Compile Include="Traits\NukePower.cs" />
|
||||||
<Compile Include="Traits\Passenger.cs" />
|
<Compile Include="Traits\Passenger.cs" />
|
||||||
<Compile Include="Traits\PlaceBuilding.cs" />
|
<Compile Include="Traits\PlaceBuilding.cs" />
|
||||||
|
<Compile Include="Traits\SonarPulsePower.cs" />
|
||||||
<Compile Include="Traits\SpyPlanePower.cs" />
|
<Compile Include="Traits\SpyPlanePower.cs" />
|
||||||
<Compile Include="Traits\SupportPower.cs" />
|
<Compile Include="Traits\SupportPower.cs" />
|
||||||
<Compile Include="Traits\ProvidesRadar.cs" />
|
<Compile Include="Traits\ProvidesRadar.cs" />
|
||||||
|
|||||||
30
OpenRa.Game/Traits/SonarPulsePower.cs
Normal file
30
OpenRa.Game/Traits/SonarPulsePower.cs
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace OpenRa.Traits
|
namespace OpenRa.Traits
|
||||||
{
|
{
|
||||||
abstract class SupportPowerInfo : ITraitInfo
|
public abstract class SupportPowerInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly bool RequiresPower = true;
|
public readonly bool RequiresPower = true;
|
||||||
public readonly bool OneShot = false;
|
public readonly bool OneShot = false;
|
||||||
@@ -20,7 +20,7 @@ namespace OpenRa.Traits
|
|||||||
public abstract object Create(Actor self);
|
public abstract object Create(Actor self);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SupportPower : ITick
|
public class SupportPower : ITick
|
||||||
{
|
{
|
||||||
public readonly SupportPowerInfo Info;
|
public readonly SupportPowerInfo Info;
|
||||||
public int RemainingTime { get; private set; }
|
public int RemainingTime { get; private set; }
|
||||||
@@ -58,7 +58,8 @@ namespace OpenRa.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do we have enough powered prerequisites?
|
// 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))
|
if (IsAvailable && (!Info.RequiresPower || isPowered))
|
||||||
{
|
{
|
||||||
|
|||||||
17
OpenRa.Mods.RA/InfiltrateForSonarPulse.cs
Normal file
17
OpenRa.Mods.RA/InfiltrateForSonarPulse.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,6 +52,7 @@
|
|||||||
<Compile Include="Activities\Steal.cs" />
|
<Compile Include="Activities\Steal.cs" />
|
||||||
<Compile Include="C4Demolition.cs" />
|
<Compile Include="C4Demolition.cs" />
|
||||||
<Compile Include="EngineerCapture.cs" />
|
<Compile Include="EngineerCapture.cs" />
|
||||||
|
<Compile Include="InfiltrateForSonarPulse.cs" />
|
||||||
<Compile Include="Mine.cs" />
|
<Compile Include="Mine.cs" />
|
||||||
<Compile Include="MineImmune.cs" />
|
<Compile Include="MineImmune.cs" />
|
||||||
<Compile Include="Minelayer.cs" />
|
<Compile Include="Minelayer.cs" />
|
||||||
|
|||||||
@@ -38,9 +38,17 @@ Player:
|
|||||||
Image: atomicon
|
Image: atomicon
|
||||||
ChargeTime: 13
|
ChargeTime: 13
|
||||||
Description: Atom Bomb
|
Description: Atom Bomb
|
||||||
LongDesc: Launches a nuclear missile at your target.
|
LongDesc: Launches a nuclear missile at a target location.
|
||||||
Prerequisites: MSLO
|
Prerequisites: MSLO
|
||||||
TechLevel: 12
|
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:
|
World:
|
||||||
WaterPaletteRotation:
|
WaterPaletteRotation:
|
||||||
@@ -93,6 +101,11 @@ BRIDGE2:
|
|||||||
Bridge:
|
Bridge:
|
||||||
UseAlternateNames: yes
|
UseAlternateNames: yes
|
||||||
|
|
||||||
|
|
||||||
MSLO:
|
MSLO:
|
||||||
NukeSilo:
|
NukeSilo:
|
||||||
|
|
||||||
|
SPEN:
|
||||||
|
InfiltrateForSonarPulse:
|
||||||
|
|
||||||
|
SYRD:
|
||||||
|
InfiltrateForSonarPulse:
|
||||||
@@ -34,6 +34,21 @@ Player:
|
|||||||
LongDesc: Reveals an area of the map.
|
LongDesc: Reveals an area of the map.
|
||||||
Prerequisites: AFLD
|
Prerequisites: AFLD
|
||||||
TechLevel: 5
|
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:
|
World:
|
||||||
WaterPaletteRotation:
|
WaterPaletteRotation:
|
||||||
@@ -197,6 +212,79 @@ BRIDGE2:
|
|||||||
Dimensions: 5,2
|
Dimensions: 5,2
|
||||||
HP: 1000
|
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:
|
V2RL:
|
||||||
Inherits: ^Vehicle
|
Inherits: ^Vehicle
|
||||||
Buildable:
|
Buildable:
|
||||||
@@ -1019,26 +1107,6 @@ SAM:
|
|||||||
AutoTarget:
|
AutoTarget:
|
||||||
IronCurtainable:
|
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:
|
ATEK:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
Buildable:
|
Buildable:
|
||||||
@@ -1089,56 +1157,6 @@ WEAP:
|
|||||||
Produces: Vehicle
|
Produces: Vehicle
|
||||||
IronCurtainable:
|
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:
|
FACT:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
Building:
|
Building:
|
||||||
|
|||||||
@@ -870,24 +870,3 @@ Image=pbmbicon
|
|||||||
TechLevel=8
|
TechLevel=8
|
||||||
GivenAuto=no
|
GivenAuto=no
|
||||||
Impl=NullPower
|
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
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user