Add TS mobile EMP
This commit is contained in:
committed by
Matthias Mailänder
parent
9d7feb176a
commit
4eb683ab46
89
OpenRA.Mods.Common/Traits/FireWarheads.cs
Normal file
89
OpenRA.Mods.Common/Traits/FireWarheads.cs
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
#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 System;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRA.GameRules;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.Traits
|
||||||
|
{
|
||||||
|
[Desc("Detonate defined warheads at the current location at a set interval.")]
|
||||||
|
public class FireWarheadsInfo : PausableConditionalTraitInfo, Requires<IMoveInfo>, IRulesetLoaded
|
||||||
|
{
|
||||||
|
[WeaponReference]
|
||||||
|
[FieldLoader.Require]
|
||||||
|
[Desc("Weapons to fire.")]
|
||||||
|
public readonly string[] Weapons = Array.Empty<string>();
|
||||||
|
|
||||||
|
[Desc("How long (in ticks) to wait before the first detonation.")]
|
||||||
|
public readonly int StartCooldown = 0;
|
||||||
|
|
||||||
|
[Desc("How long (in ticks) to wait after a detonation.")]
|
||||||
|
public readonly int Interval = 1;
|
||||||
|
|
||||||
|
public override object Create(ActorInitializer init) { return new FireWarheads(this); }
|
||||||
|
|
||||||
|
public WeaponInfo[] WeaponInfos { get; private set; }
|
||||||
|
|
||||||
|
public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||||
|
{
|
||||||
|
base.RulesetLoaded(rules, ai);
|
||||||
|
|
||||||
|
WeaponInfos = Weapons.Select(w =>
|
||||||
|
{
|
||||||
|
var weaponToLower = w.ToLowerInvariant();
|
||||||
|
if (!rules.Weapons.TryGetValue(weaponToLower, out var weapon))
|
||||||
|
throw new YamlException($"Weapons Ruleset does not contain an entry '{weaponToLower}'");
|
||||||
|
return weapon;
|
||||||
|
}).ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FireWarheads : PausableConditionalTrait<FireWarheadsInfo>, ITick
|
||||||
|
{
|
||||||
|
[Sync]
|
||||||
|
int cooldown = 0;
|
||||||
|
|
||||||
|
public FireWarheads(FireWarheadsInfo info)
|
||||||
|
: base(info)
|
||||||
|
{
|
||||||
|
cooldown = info.StartCooldown;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ITick.Tick(Actor self)
|
||||||
|
{
|
||||||
|
if (IsTraitDisabled || IsTraitPaused)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (cooldown > 0)
|
||||||
|
cooldown--;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cooldown = Info.Interval;
|
||||||
|
foreach (var wep in Info.WeaponInfos)
|
||||||
|
{
|
||||||
|
wep.Impact(Target.FromPos(self.CenterPosition), self);
|
||||||
|
self.World.AddFrameEndTask(world =>
|
||||||
|
{
|
||||||
|
if (wep.Report != null && wep.Report.Length > 0)
|
||||||
|
Game.Sound.Play(SoundType.World, wep.Report, world, self.CenterPosition);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void TraitDisabled(Actor self)
|
||||||
|
{
|
||||||
|
cooldown = Info.StartCooldown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -425,3 +425,37 @@ JUGG:
|
|||||||
ArmamentNames: deployed
|
ArmamentNames: deployed
|
||||||
Selectable:
|
Selectable:
|
||||||
DecorationBounds: 1448, 2413, 0, -482
|
DecorationBounds: 1448, 2413, 0, -482
|
||||||
|
|
||||||
|
MOBILEMP:
|
||||||
|
Inherits: ^Tank
|
||||||
|
Inherits@VOXELS: ^VoxelActor
|
||||||
|
Inherits@selection: ^SelectableSupportUnit
|
||||||
|
Buildable:
|
||||||
|
Queue: Vehicle
|
||||||
|
BuildPaletteOrder: 130
|
||||||
|
Prerequisites: ~gaweap, napuls, ~techlevel.superweapons
|
||||||
|
Description: Fires a pulse blast which disables\nall mechanical units in the area.
|
||||||
|
Valued:
|
||||||
|
Cost: 1000
|
||||||
|
Tooltip:
|
||||||
|
Name: Mobile EMP Cannon
|
||||||
|
Health:
|
||||||
|
HP: 80000
|
||||||
|
Armor:
|
||||||
|
Type: Heavy
|
||||||
|
Mobile:
|
||||||
|
Speed: 85
|
||||||
|
WithVoxelBody:
|
||||||
|
Offset: 0,0,-256
|
||||||
|
RevealsShroud:
|
||||||
|
RequiresCondition: !inside-tunnel
|
||||||
|
Range: 6c0
|
||||||
|
MaxHeightDelta: 3
|
||||||
|
GrantConditionOnDeployWithCharge:
|
||||||
|
Voice: Move
|
||||||
|
ChargeDuration: 750
|
||||||
|
DeployedCondition: deployed
|
||||||
|
PauseOnCondition: empdisable
|
||||||
|
FireWarheads:
|
||||||
|
Weapons: MEMPulse
|
||||||
|
RequiresCondition: deployed && !empdisable
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ NAPULS:
|
|||||||
nod: napuls.nod
|
nod: napuls.nod
|
||||||
ProvidesPrerequisite@gdi:
|
ProvidesPrerequisite@gdi:
|
||||||
ResetOnOwnerChange: true
|
ResetOnOwnerChange: true
|
||||||
|
ProvidesPrerequisite@gdi:
|
||||||
|
Factions: gdi
|
||||||
|
Prerequisite: napuls
|
||||||
AttackOrderPower:
|
AttackOrderPower:
|
||||||
PauseOnCondition: empdisable || disabled
|
PauseOnCondition: empdisable || disabled
|
||||||
Cursor: emp
|
Cursor: emp
|
||||||
|
|||||||
@@ -212,6 +212,11 @@ explosion:
|
|||||||
BlendMode: Additive
|
BlendMode: Additive
|
||||||
ZRamp: 1
|
ZRamp: 1
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
pulse_explosion_small:
|
||||||
|
Filename: mempfx.shp
|
||||||
|
BlendMode: Additive
|
||||||
|
ZRamp: 1
|
||||||
|
Tick: 11
|
||||||
small_watersplash:
|
small_watersplash:
|
||||||
Filename: h2o_exp2.shp
|
Filename: h2o_exp2.shp
|
||||||
IgnoreWorldTint: False
|
IgnoreWorldTint: False
|
||||||
|
|||||||
@@ -338,6 +338,11 @@ smech:
|
|||||||
icon:
|
icon:
|
||||||
Filename: smchicon.shp
|
Filename: smchicon.shp
|
||||||
|
|
||||||
|
mobilemp:
|
||||||
|
Inherits: ^VehicleOverlays
|
||||||
|
icon:
|
||||||
|
Filename: mempicon.shp
|
||||||
|
|
||||||
trucka:
|
trucka:
|
||||||
Inherits: ^VehicleOverlays
|
Inherits: ^VehicleOverlays
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,9 @@ sonic:
|
|||||||
idle:
|
idle:
|
||||||
turret: sonictur
|
turret: sonictur
|
||||||
|
|
||||||
|
mobilemp:
|
||||||
|
idle: m_emp
|
||||||
|
|
||||||
#truk: # TODO: unused
|
#truk: # TODO: unused
|
||||||
# idle:
|
# idle:
|
||||||
|
|
||||||
|
|||||||
@@ -127,3 +127,14 @@ EMPulseCannon:
|
|||||||
Duration: 250
|
Duration: 250
|
||||||
Condition: empdisable
|
Condition: empdisable
|
||||||
ValidTargets: Ground, Water, Air, Underground
|
ValidTargets: Ground, Water, Air, Underground
|
||||||
|
|
||||||
|
MEMPulse:
|
||||||
|
Report: mobemp1.aud
|
||||||
|
Warhead@1Eff: CreateEffect
|
||||||
|
Explosions: pulse_explosion_small
|
||||||
|
ImpactActors: false
|
||||||
|
Warhead@emp: GrantExternalCondition
|
||||||
|
Range: 6c0
|
||||||
|
Duration: 250
|
||||||
|
Condition: empdisable
|
||||||
|
ValidTargets: Ground, Water, Air, Underground
|
||||||
|
|||||||
Reference in New Issue
Block a user