Merge pull request #5066 from pchote/weapon-cameras

Superweapon tweaks
This commit is contained in:
Matthias Mailänder
2014-04-18 09:00:49 +02:00
14 changed files with 161 additions and 39 deletions

View File

@@ -34,6 +34,7 @@ NEW:
Added a warning dialog when force starting a match. Added a warning dialog when force starting a match.
Added a new mod selection window, which now appears on the first game start. Added a new mod selection window, which now appears on the first game start.
Fixed walls not updating when neighboring sections were sold or destroyed. Fixed walls not updating when neighboring sections were sold or destroyed.
Nuclear missile delay is now independent of map size, and reveals the target area immediately before detonation.
Dune 2000: Dune 2000:
Engineers can now regain control over husks. Engineers can now regain control over husks.
Added the Atreides grenadier from the 1.06 patch. Added the Atreides grenadier from the 1.06 patch.
@@ -46,6 +47,7 @@ NEW:
Turrets now integrate with walls (visually, and as line building targets). Turrets now integrate with walls (visually, and as line building targets).
Fixed unclickable area on the right edge of the production palette. Fixed unclickable area on the right edge of the production palette.
Buildings now throw damaging shrapnel when they explode. Buildings now throw damaging shrapnel when they explode.
Airstrike will now reveal (only) the target area when it strikes.
Red Alert: Red Alert:
Mechanics can now regain control over husks. Mechanics can now regain control over husks.
Engineers are now remapped to team colors. Engineers are now remapped to team colors.
@@ -109,7 +111,7 @@ NEW:
Removed health bars and selection boxes from walls. Removed health bars and selection boxes from walls.
Changed Nod Obelisk HP to 600 from 400, same as Advanced Guard Tower Changed Nod Obelisk HP to 600 from 400, same as Advanced Guard Tower
Fixed dinosaurs not being able to collect crates. Fixed dinosaurs not being able to collect crates.
A10 air strike will only reveal the target area. A10 air strike and the ion cannon will now reveal (only) the target area when they strike.
Reduced Guard Tower vision from 7 to 6. Reduced Guard Tower vision from 7 to 6.
Increased Guard Tower build time from 12 seconds to 24 seconds. Increased Guard Tower build time from 12 seconds to 24 seconds.
Reduced Gun Turret vision from 7 to 6. Reduced Gun Turret vision from 7 to 6.

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * 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 * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -10,11 +10,21 @@
using OpenRA.Mods.Cnc.Effects; using OpenRA.Mods.Cnc.Effects;
using OpenRA.Mods.RA; using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.Cnc namespace OpenRA.Mods.Cnc
{ {
class IonCannonPowerInfo : SupportPowerInfo class IonCannonPowerInfo : SupportPowerInfo
{ {
[ActorReference]
[Desc("Actor to spawn when the attack starts")]
public readonly string CameraActor = null;
[Desc("Amount of time to keep the camera alive")]
public readonly int CameraRemoveDelay = 25;
public override object Create(ActorInitializer init) { return new IonCannonPower(init.self, this); } public override object Create(ActorInitializer init) { return new IonCannonPower(init.self, this); }
} }
@@ -34,8 +44,21 @@ namespace OpenRA.Mods.Cnc
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {
var info = Info as IonCannonPowerInfo;
Sound.Play(Info.LaunchSound, order.TargetLocation.CenterPosition); Sound.Play(Info.LaunchSound, order.TargetLocation.CenterPosition);
w.Add(new IonCannon(self, w, order.TargetLocation)); w.Add(new IonCannon(self, w, order.TargetLocation));
if (info.CameraActor == null)
return;
var camera = w.CreateActor(info.CameraActor, new TypeDictionary
{
new LocationInit(order.TargetLocation),
new OwnerInit(self.Owner),
});
camera.QueueActivity(new Wait(info.CameraRemoveDelay));
camera.QueueActivity(new RemoveSelf());
}); });
} }
} }

View File

@@ -44,7 +44,8 @@ namespace OpenRA.Mods.RA.Effects
poster.Play(posterType); poster.Play(posterType);
} }
owner.World.Add(new DelayedAction(duration, () => owner.World.Remove(this))); if (duration > 0)
owner.World.Add(new DelayedAction(duration, () => owner.World.Remove(this)));
} }
public void Tick(World world) public void Tick(World world)

View File

@@ -18,18 +18,33 @@ namespace OpenRA.Mods.RA.Effects
{ {
public class NukeLaunch : IEffect public class NukeLaunch : IEffect
{ {
readonly Player firedBy; readonly Actor firedBy;
Animation anim; readonly Animation anim;
WPos pos; readonly string weapon;
CPos targetLocation;
bool goingUp = true;
string weapon;
public NukeLaunch(Player firedBy, Actor silo, string weapon, WPos launchPos, CPos targetLocation) readonly WPos ascendSource;
readonly WPos ascendTarget;
readonly WPos descendSource;
readonly WPos descendTarget;
readonly int delay;
readonly int turn;
WPos pos;
int ticks;
public NukeLaunch(Actor firedBy, string weapon, WPos launchPos, WPos targetPos, WRange velocity, int delay, bool skipAscent)
{ {
this.firedBy = firedBy; this.firedBy = firedBy;
this.targetLocation = targetLocation;
this.weapon = weapon; this.weapon = weapon;
this.delay = delay;
this.turn = delay / 2;
var offset = new WVec(WRange.Zero, WRange.Zero, velocity * turn);
ascendSource = launchPos;
ascendTarget = launchPos + offset;
descendSource = targetPos + offset;
descendTarget = targetPos;
anim = new Animation(weapon); anim = new Animation(weapon);
anim.PlayRepeating("up"); anim.PlayRepeating("up");
@@ -37,40 +52,34 @@ namespace OpenRA.Mods.RA.Effects
var weaponRules = Rules.Weapons[weapon.ToLowerInvariant()]; var weaponRules = Rules.Weapons[weapon.ToLowerInvariant()];
if (weaponRules.Report != null && weaponRules.Report.Any()) if (weaponRules.Report != null && weaponRules.Report.Any())
Sound.Play(weaponRules.Report.Random(firedBy.World.SharedRandom), pos); Sound.Play(weaponRules.Report.Random(firedBy.World.SharedRandom), pos);
if (silo == null)
StartDescent(firedBy.World); if (skipAscent)
ticks = turn;
} }
void StartDescent(World world)
{
pos = targetLocation.CenterPosition + new WVec(0, 0, 1024*firedBy.World.Map.Bounds.Height);
anim.PlayRepeating("down");
goingUp = false;
}
public void Tick(World world) public void Tick(World world)
{ {
anim.Tick(); anim.Tick();
var delta = new WVec(0,0,427); if (ticks == turn)
if (goingUp) anim.PlayRepeating("down");
{
pos += delta; if (ticks <= turn)
if (pos.Z >= world.Map.Bounds.Height*1024) pos = WPos.LerpQuadratic(ascendSource, ascendTarget, WAngle.Zero, ticks, turn);
StartDescent(world);
}
else else
{ pos = WPos.LerpQuadratic(descendSource, descendTarget, WAngle.Zero, ticks - turn, delay - turn);
pos -= delta;
if (pos.Z <= 0) if (ticks == delay)
Explode(world); Explode(world);
}
ticks++;
} }
void Explode(World world) void Explode(World world)
{ {
world.AddFrameEndTask(w => w.Remove(this)); world.AddFrameEndTask(w => w.Remove(this));
Combat.DoExplosion(firedBy.PlayerActor, weapon, pos); Combat.DoExplosion(firedBy, weapon, pos);
world.WorldActor.Trait<ScreenShaker>().AddEffect(20, pos, 5); world.WorldActor.Trait<ScreenShaker>().AddEffect(20, pos, 5);
foreach (var a in world.ActorsWithTrait<NukePaletteEffect>()) foreach (var a in world.ActorsWithTrait<NukePaletteEffect>())

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #region Copyright & License Information
/* /*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS) * Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made * 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 * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -8,7 +8,11 @@
*/ */
#endregion #endregion
using System;
using OpenRA.Effects;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Effects; using OpenRA.Mods.RA.Effects;
using OpenRA.Primitives;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
@@ -19,6 +23,28 @@ namespace OpenRA.Mods.RA
public readonly string MissileWeapon = ""; public readonly string MissileWeapon = "";
public readonly WVec SpawnOffset = WVec.Zero; public readonly WVec SpawnOffset = WVec.Zero;
[Desc("Travel time - split equally between ascent and descent")]
public readonly int FlightDelay = 400;
[Desc("Visual ascent velocity in WRange / tick")]
public readonly WRange FlightVelocity = new WRange(512);
[Desc("Descend immediately on the target, with half the FlightDelay")]
public readonly bool SkipAscent = false;
[Desc("Amount of time before detonation to remove the beacon")]
public readonly int BeaconRemoveAdvance = 25;
[ActorReference]
[Desc("Actor to spawn before detonation")]
public readonly string CameraActor = null;
[Desc("Amount of time before detonation to spawn the camera")]
public readonly int CameraSpawnAdvance = 25;
[Desc("Amount of time after detonation to remove the camera")]
public readonly int CameraRemoveDelay = 25;
public override object Create(ActorInitializer init) { return new NukePower(init.self, this); } public override object Create(ActorInitializer init) { return new NukePower(init.self, this); }
} }
@@ -50,8 +76,37 @@ namespace OpenRA.Mods.RA
var npi = Info as NukePowerInfo; var npi = Info as NukePowerInfo;
var rb = self.Trait<RenderSimple>(); var rb = self.Trait<RenderSimple>();
rb.PlayCustomAnim(self, "active"); rb.PlayCustomAnim(self, "active");
self.World.AddFrameEndTask(w => w.Add(
new NukeLaunch(self.Owner, self, npi.MissileWeapon, self.CenterPosition + body.LocalToWorld(npi.SpawnOffset), order.TargetLocation))); self.World.AddFrameEndTask(w => w.Add(new NukeLaunch(self, npi.MissileWeapon,
self.CenterPosition + body.LocalToWorld(npi.SpawnOffset),
order.TargetLocation.CenterPosition,
npi.FlightVelocity, npi.FlightDelay, npi.SkipAscent)));
if (npi.CameraActor != null)
{
var camera = self.World.CreateActor(false, npi.CameraActor, new TypeDictionary
{
new LocationInit(order.TargetLocation),
new OwnerInit(self.Owner),
});
camera.QueueActivity(new Wait(npi.CameraSpawnAdvance + npi.CameraRemoveDelay));
camera.QueueActivity(new RemoveSelf());
Action addCamera = () => self.World.AddFrameEndTask(w => w.Add(camera));
self.World.AddFrameEndTask(w => w.Add(new DelayedAction(npi.FlightDelay - npi.CameraSpawnAdvance, addCamera)));
}
if (beacon != null)
{
Action removeBeacon = () => self.World.AddFrameEndTask(w =>
{
w.Remove(beacon);
beacon = null;
});
self.World.AddFrameEndTask(w => w.Add(new DelayedAction(npi.FlightDelay - npi.BeaconRemoveAdvance, removeBeacon)));
}
} }
} }
} }

View File

@@ -972,6 +972,11 @@ Rules:
SelectTargetSound: select1.aud SelectTargetSound: select1.aud
IncomingSound: enemya.aud IncomingSound: enemya.aud
UnitType: a10 UnitType: a10
DisplayBeacon: True
BeaconDuration: -1
BeaconPoster: airstrike
DisplayRadarPing: True
CameraActor: camera
Sequences: Sequences:

View File

@@ -49,7 +49,14 @@ CAMERA:
HP: 1000 HP: 1000
RevealsShroud: RevealsShroud:
Range: 10c0 Range: 10c0
ProximityCaptor: BodyOrientation:
Types: Camera
CAMERA.small:
Immobile:
OccupiesSpace: false
Health:
HP: 1000
RevealsShroud:
Range: 6c0
BodyOrientation: BodyOrientation:

View File

@@ -386,6 +386,7 @@ HQ:
IncomingSound: enemya.aud IncomingSound: enemya.aud
UnitType: a10 UnitType: a10
DisplayBeacon: True DisplayBeacon: True
BeaconDuration: -1
BeaconPoster: airstrike BeaconPoster: airstrike
DisplayRadarPing: True DisplayRadarPing: True
CameraActor: camera CameraActor: camera
@@ -456,6 +457,7 @@ EYE:
SelectTargetSound: select1.aud SelectTargetSound: select1.aud
InsufficientPowerSound: nopower1.aud InsufficientPowerSound: nopower1.aud
DisplayRadarPing: True DisplayRadarPing: True
CameraActor: camera.small
SupportPowerChargeBar: SupportPowerChargeBar:
TMPL: TMPL:
@@ -496,8 +498,10 @@ TMPL:
IncomingSound: nuke1.aud IncomingSound: nuke1.aud
MissileWeapon: atomic MissileWeapon: atomic
DisplayBeacon: True DisplayBeacon: True
BeaconDuration: -1
BeaconPoster: atomic BeaconPoster: atomic
DisplayRadarPing: True DisplayRadarPing: True
CameraActor: camera
SupportPowerChargeBar: SupportPowerChargeBar:
GUN: GUN:

View File

@@ -101,8 +101,6 @@ ORNI.bomber:
HP: 100 HP: 100
Armor: Armor:
Type: Light Type: Light
RevealsShroud:
Range: 10c0
Plane: Plane:
ROT: 5 ROT: 5
Speed: 350 Speed: 350

View File

@@ -59,6 +59,9 @@ PALACEA:
LongDesc: Ornithopter drops a load of parachuted\nbombs on your target LongDesc: Ornithopter drops a load of parachuted\nbombs on your target
UnitType: orni.bomber UnitType: orni.bomber
SelectTargetSound: SelectTargetSound:
DisplayBeacon: True
BeaconDuration: -1
CameraActor: camera
CanPowerDown: CanPowerDown:
DisabledOverlay: DisabledOverlay:
RequiresPower: RequiresPower:

View File

@@ -98,6 +98,8 @@ PALACEH:
SpawnOffset: -512,1c171,0 SpawnOffset: -512,1c171,0
DisplayBeacon: True DisplayBeacon: True
DisplayRadarPing: True DisplayRadarPing: True
BeaconDuration: -1
CameraActor: camera
CanPowerDown: CanPowerDown:
DisabledOverlay: DisabledOverlay:
RequiresPower: RequiresPower:

View File

@@ -115,3 +115,11 @@ SPICEBLOOM:
Terrain: Spice Terrain: Spice
BodyOrientation: BodyOrientation:
CAMERA:
Immobile:
OccupiesSpace: false
Health:
HP: 1000
RevealsShroud:
Range: 8c0
BodyOrientation:

View File

@@ -88,6 +88,9 @@ PALACEO:
LongDesc: Ornithopter drops a load of parachuted\nbombs on your target LongDesc: Ornithopter drops a load of parachuted\nbombs on your target
UnitType: orni.bomber UnitType: orni.bomber
SelectTargetSound: SelectTargetSound:
DisplayBeacon: True
BeaconDuration: -1
CameraActor: camera
CanPowerDown: CanPowerDown:
DisabledOverlay: DisabledOverlay:
RequiresPower: RequiresPower:

View File

@@ -38,8 +38,10 @@ MSLO:
SpawnOffset: 0,427,0 SpawnOffset: 0,427,0
DisplayTimer: True DisplayTimer: True
DisplayBeacon: True DisplayBeacon: True
BeaconDuration: -1
DisplayRadarPing: True DisplayRadarPing: True
BeaconPoster: atomicon BeaconPoster: atomicon
CameraActor: camera
CanPowerDown: CanPowerDown:
RequiresPower: RequiresPower:
DisabledOverlay: DisabledOverlay: