diff --git a/OpenRA.Mods.RA/DefaultShellmapScript.cs b/OpenRA.Mods.RA/DefaultShellmapScript.cs index 409293286f..c9ce0ba372 100644 --- a/OpenRA.Mods.RA/DefaultShellmapScript.cs +++ b/OpenRA.Mods.RA/DefaultShellmapScript.cs @@ -22,6 +22,8 @@ using OpenRA.Mods.RA.Effects; using OpenRA.Traits; using OpenRA; using System.Linq; +using System.Collections.Generic; +using System; namespace OpenRA.Mods.RA { @@ -30,17 +32,38 @@ namespace OpenRA.Mods.RA public object Create(Actor self) { return new DefaultShellmapScript(); } } - class DefaultShellmapScript: ILoadWorldHook + class DefaultShellmapScript: ILoadWorldHook, ITick { + Player goodguy; + Player greece; + Dictionary MapActors; + public void WorldLoaded(World w) { Game.MoveViewport((.5f * (w.Map.TopLeft + w.Map.BottomRight).ToFloat2()).ToInt2()); // Sound.PlayMusic("hell226m.aud"); - var goodguy = w.players.Values.Where(x => x.InternalName == "GoodGuy").FirstOrDefault(); - var greece = w.players.Values.Where(x => x.InternalName == "Greece").FirstOrDefault(); + goodguy = w.players.Values.Where(x => x.InternalName == "GoodGuy").FirstOrDefault(); + greece = w.players.Values.Where(x => x.InternalName == "Greece").FirstOrDefault(); + MapActors = w.WorldActor.traits.Get().MapActors; + + goodguy.Stances[greece] = Stance.Enemy; greece.Stances[goodguy] = Stance.Enemy; - + } + + int ticks = 0; + public void Tick(Actor self) + { + if (ticks == 100) + MapActors["mslo1"].traits.Get().Attack(new int2(96,53)); + if (ticks == 110) + MapActors["mslo2"].traits.Get().Attack(new int2(92,53)); + if (ticks == 120) + MapActors["mslo3"].traits.Get().Attack(new int2(94,50)); + + ticks++; } } + + } diff --git a/OpenRA.Mods.RA/Effects/NukeLaunch.cs b/OpenRA.Mods.RA/Effects/NukeLaunch.cs index 0eaee59d5e..96873998b4 100755 --- a/OpenRA.Mods.RA/Effects/NukeLaunch.cs +++ b/OpenRA.Mods.RA/Effects/NukeLaunch.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -48,9 +48,24 @@ namespace OpenRA.Mods.RA.Effects this.targetLocation = targetLocation; anim = new Animation("nuke"); anim.PlayRepeating("up"); - pos = silo.CenterLocation; + + if (silo == null) + { + altitude = Game.world.Map.Height*Game.CellSize; + StartDescent(Game.world); + } + else + pos = silo.CenterLocation; } + void StartDescent(World world) + { + pos = OpenRA.Traits.Util.CenterOfCell(targetLocation); + anim = new Animation("nuke"); + anim.PlayRepeating("down"); + goingUp = false; + } + public void Tick(World world) { anim.Tick(); @@ -58,13 +73,8 @@ namespace OpenRA.Mods.RA.Effects if (goingUp) { altitude += 10; - if (altitude >= targetAltitude) - { - pos = OpenRA.Traits.Util.CenterOfCell(targetLocation); - anim = new Animation("nuke"); - anim.PlayRepeating("down"); - goingUp = false; - } + if (altitude >= world.Map.Height*Game.CellSize) + StartDescent(world); } else { diff --git a/OpenRA.Mods.RA/NukePower.cs b/OpenRA.Mods.RA/NukePower.cs index 877ee30f59..90e11214c3 100644 --- a/OpenRA.Mods.RA/NukePower.cs +++ b/OpenRA.Mods.RA/NukePower.cs @@ -27,7 +27,6 @@ namespace OpenRA.Mods.RA { class NukePowerInfo : SupportPowerInfo { - public readonly string MissileWeapon = ""; public override object Create(Actor self) { return new NukePower(self, this); } } @@ -53,15 +52,11 @@ namespace OpenRA.Mods.RA if (silo != null) silo.traits.Get().PlayCustomAnim(silo, "active"); - Owner.World.AddFrameEndTask(w => - { - // Play to everyone but the current player - if (Owner != Owner.World.LocalPlayer) - Sound.Play(Info.LaunchSound); - - //FIRE ZE MISSILES - w.Add(new NukeLaunch(silo, (Info as NukePowerInfo).MissileWeapon, order.TargetLocation)); - }); + // Play to everyone but the current player + if (Owner != Owner.World.LocalPlayer) + Sound.Play(Info.LaunchSound); + + silo.traits.Get().Attack(order.TargetLocation); Game.controller.CancelInputMode(); FinishActivate(); @@ -70,6 +65,29 @@ namespace OpenRA.Mods.RA } // tag trait for the building - class NukeSiloInfo : TraitInfo { } - class NukeSilo { } + class NukeSiloInfo : ITraitInfo + { + public readonly string MissileWeapon = ""; + public object Create(Actor self) { return new NukeSilo(self); } + } + + class NukeSilo + { + Actor self; + public NukeSilo(Actor self) + { + this.self = self; + } + + public void Attack(int2 targetLocation) + { + self.traits.Get().PlayCustomAnim(self, "active"); + + self.World.AddFrameEndTask(w => + { + //FIRE ZE MISSILES + w.Add(new NukeLaunch(self, self.Info.Traits.Get().MissileWeapon, targetLocation)); + }); + } + } } diff --git a/mods/ra/maps/shellmap/map.uid b/mods/ra/maps/shellmap/map.uid index 00b94a5298..a8273981ec 100644 --- a/mods/ra/maps/shellmap/map.uid +++ b/mods/ra/maps/shellmap/map.uid @@ -1 +1 @@ -a28a1988fcaca4de0c90a8cb9cd9a2b3aacb4582 \ No newline at end of file +f78ab8d4d40ac3c263d1e404e5bf8233dce1f1a7 \ No newline at end of file diff --git a/mods/ra/maps/shellmap/map.yaml b/mods/ra/maps/shellmap/map.yaml index 1703eb1b07..a3acc3d90d 100644 --- a/mods/ra/maps/shellmap/map.yaml +++ b/mods/ra/maps/shellmap/map.yaml @@ -1203,7 +1203,7 @@ Actors: Location: 92,46 Owner: GoodGuy ActorReference@Actor233: - Id: Actor233 + Id: pdox Type: pdox Location: 94,52 Owner: GoodGuy @@ -1958,10 +1958,30 @@ Actors: Location: 84,56 Owner: GoodGuy ActorReference@Actor384: - Id: Actor384 - Type: miss - Location: 95,78 - Owner: Neutral + Id: mslo1 + Type: mslo + Location: 89,84 + Owner: Greece + ActorReference@Actor385: + Id: Actor385 + Type: ca + Location: 119,66 + Owner: GoodGuy + ActorReference@Actor386: + Id: Actor386 + Type: ca + Location: 120,66 + Owner: GoodGuy + ActorReference@Actor387: + Id: mslo2 + Type: mslo + Location: 89,83 + Owner: Greece + ActorReference@Actor388: + Id: mslo3 + Type: mslo + Location: 89,82 + Owner: Greece Waypoints: spawn0: 36,36 diff --git a/mods/ra/mod.yaml b/mods/ra/mod.yaml index e6f161687c..42d8837e05 100644 --- a/mods/ra/mod.yaml +++ b/mods/ra/mod.yaml @@ -53,4 +53,4 @@ Terrain: Music: mods/ra/music.yaml -ShellmapUid:a28a1988fcaca4de0c90a8cb9cd9a2b3aacb4582 +ShellmapUid:f78ab8d4d40ac3c263d1e404e5bf8233dce1f1a7 diff --git a/mods/ra/sequences.xml b/mods/ra/sequences.xml index 9c3c9521a7..64d1591aa0 100644 --- a/mods/ra/sequences.xml +++ b/mods/ra/sequences.xml @@ -221,7 +221,7 @@ - + diff --git a/mods/ra/structures.yaml b/mods/ra/structures.yaml index e2c14d4344..661db1826f 100644 --- a/mods/ra/structures.yaml +++ b/mods/ra/structures.yaml @@ -1,6 +1,7 @@ MSLO: Category: Defense NukeSilo: + MissileWeapon: atomic Inherits: ^Building Buildable: BuildPaletteOrder: 130 @@ -25,6 +26,9 @@ GAP: RequiresPower: CanPowerDown: Inherits: ^Building + Valued: + Cost: 500 + Description: Gap Generator # Buildable: # BuildPaletteOrder: 100 # Prerequisites: atek diff --git a/mods/ra/system.yaml b/mods/ra/system.yaml index 5700944ae9..dc4688f3b2 100644 --- a/mods/ra/system.yaml +++ b/mods/ra/system.yaml @@ -57,7 +57,6 @@ Player: LongDesc: Launches a nuclear missile at a target location. Prerequisites: MSLO TechLevel: 12 - MissileWeapon: atomic BeginChargeSound: aprep1.aud EndChargeSound: aready1.aud SelectTargetSound: slcttgt1.aud