Skip to content

Commit

Permalink
Add Fake SCUD Storm ability.
Browse files Browse the repository at this point in the history
It'll show a timer to the enemy with the real name. Will play SCUD Storm launched notification when activated, but won't do anything else otherwise.
  • Loading branch information
MustaphaTR committed Aug 11, 2024
1 parent 72ad483 commit bbb849e
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 2 deletions.
60 changes: 60 additions & 0 deletions OpenRA.Mods.GenSDK/Traits/SupportPowers/FakePower.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* 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, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion

using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;

namespace OpenRA.Mods.GenSDK.Traits
{
[Desc("Fake power that does nothing but play activation voices/sounds when activated.")]
public class FakePowerInfo : SupportPowerInfo
{
public override object Create(ActorInitializer init) { return new FakePower(init.Self, this); }
}

public class FakePower : SupportPower, IResolveOrder
{
public readonly FakePowerInfo FakePowerInfo;

public FakePower(Actor self, FakePowerInfo info)
: base(self, info)
{
FakePowerInfo = info;
}

public override void SelectTarget(Actor self, string order, SupportPowerManager manager)
{
self.World.IssueOrder(new Order(order, manager.Self, false));
}

public override void Activate(Actor self, Order order, SupportPowerManager manager)
{
base.Activate(self, order, manager);

Activation(self);
}

void IResolveOrder.ResolveOrder(Actor self, Order order)
{
if (order.OrderString.Contains(Info.OrderName))
Activation(self);
}

void Activation(Actor self)
{
PlayLaunchSounds();
if (self.Owner.IsAlliedWith(self.World.RenderPlayer))
Game.Sound.Play(SoundType.World, FakePowerInfo.LaunchSound);
else
Game.Sound.Play(SoundType.World, FakePowerInfo.IncomingSound);
}
}
}
2 changes: 1 addition & 1 deletion mod.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
MOD_ID="gen"

# The OpenRA engine version to use for this project.
ENGINE_VERSION="64c529d601001d4af12ef98f3fb21819af9082e9"
ENGINE_VERSION="12a16abe8e3a7fc61b3ebacceb31e45acca81f01"

##############################################################################
# Packaging
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions mods/gen/rules/fakes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,27 @@ fake.scud_storm:
IntoActor: building.scud_storm
Valued:
Cost: 1000
FakePower:
PauseOnCondition: emp || hacked
Prerequisites:
1: fake.scud_storm
Icons:
1: fake_scud_storm
Cursor: nuke
ChargeInterval: 7500
Names:
1: Fake SCUD Storm
GenericNames:
1: SCUD Storm
GenericVisibility: Enemy
Descriptions:
1: Pretends to be charging a SCUD Storm for the enemies.
IncomingSpeechNotification: ScudLaunchDetected
AllowMultiple: True
DisplayTimerRelationships: Enemy, Neutral, Ally
OrderName: FakeSCUDStormPowerInfoOrder
ProvidesPrerequisite@buildingname:
Prerequisite: fake.scud_storm
RevealsShroud@SW:
Range: 2c0
ValidRelationships: Enemy
Expand Down
4 changes: 4 additions & 0 deletions mods/gen/rules/player/ai.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,10 @@ Player:
Attractiveness: -10
TargetMetric: Value
CheckRadius: 6c0
fake_scud_storm:
OrderName: FakeSCUDStormPowerInfoOrder
Consideration@1:
Against: Ally
nukepower:
OrderName: NukePowerInfoOrder
Against: Enemy
Expand Down
2 changes: 1 addition & 1 deletion mods/gen/rules/structures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4721,7 +4721,7 @@ building.scud_storm:
Names:
1: SCUD Storm
Descriptions:
1: Fires 4 SCUD Missiles anywhere on the map.
1: Fires 8 SCUD Missiles anywhere on the map.
SelectTargetSpeechNotification: SelectTarget
IncomingSpeechNotification: ScudLaunchDetected
AllowMultiple: True
Expand Down
2 changes: 2 additions & 0 deletions mods/gen/sequences/misc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,8 @@ icon:
Filename: particle_cannon_ability_icon.png
scud_storm:
Filename: scud_storm_ability_icon.png
fake_scud_storm:
Filename: fake_scud_storm_ability_icon.png
atom_bomb:
Filename: atom_bomb_icon.png
xxicon:
Expand Down

0 comments on commit bbb849e

Please sign in to comment.