Scriptable MSLO and shellmap win
This commit is contained in:
@@ -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<string, Actor> 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<SpawnMapActors>().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<NukeSilo>().Attack(new int2(96,53));
|
||||
if (ticks == 110)
|
||||
MapActors["mslo2"].traits.Get<NukeSilo>().Attack(new int2(92,53));
|
||||
if (ticks == 120)
|
||||
MapActors["mslo3"].traits.Get<NukeSilo>().Attack(new int2(94,50));
|
||||
|
||||
ticks++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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,7 +48,22 @@ 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)
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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<RenderBuilding>().PlayCustomAnim(silo, "active");
|
||||
|
||||
Owner.World.AddFrameEndTask(w =>
|
||||
{
|
||||
// Play to everyone but the current player
|
||||
if (Owner != Owner.World.LocalPlayer)
|
||||
Sound.Play(Info.LaunchSound);
|
||||
// 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));
|
||||
});
|
||||
silo.traits.Get<NukeSilo>().Attack(order.TargetLocation);
|
||||
|
||||
Game.controller.CancelInputMode();
|
||||
FinishActivate();
|
||||
@@ -70,6 +65,29 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
|
||||
// tag trait for the building
|
||||
class NukeSiloInfo : TraitInfo<NukeSilo> { }
|
||||
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<RenderBuilding>().PlayCustomAnim(self, "active");
|
||||
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
//FIRE ZE MISSILES
|
||||
w.Add(new NukeLaunch(self, self.Info.Traits.Get<NukeSiloInfo>().MissileWeapon, targetLocation));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
a28a1988fcaca4de0c90a8cb9cd9a2b3aacb4582
|
||||
f78ab8d4d40ac3c263d1e404e5bf8233dce1f1a7
|
||||
@@ -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
|
||||
|
||||
@@ -53,4 +53,4 @@ Terrain:
|
||||
Music:
|
||||
mods/ra/music.yaml
|
||||
|
||||
ShellmapUid:a28a1988fcaca4de0c90a8cb9cd9a2b3aacb4582
|
||||
ShellmapUid:f78ab8d4d40ac3c263d1e404e5bf8233dce1f1a7
|
||||
|
||||
@@ -221,7 +221,7 @@
|
||||
<sequence name="idle" start="0" length="1" />
|
||||
<sequence name="damaged-idle" start="8" length="1" />
|
||||
<sequence name="make" start="0" length="15" src="mslomake" />
|
||||
<sequence name="active" start="1" length="7" />
|
||||
<sequence name="active" start="1" length="7" tick="80" />
|
||||
<sequence name="damaged-active" start="9" length="7" />
|
||||
</unit>
|
||||
<!-- mcv -->
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user