Merge pull request #7164 from abcdefg30/survival02
Ported survival02 to lua
This commit is contained in:
@@ -215,6 +215,7 @@
|
||||
<Compile Include="Widgets\Logic\LobbyMapPreviewLogic.cs" />
|
||||
<Compile Include="Widgets\Logic\ControlGroupLogic.cs" />
|
||||
<Compile Include="Scripting\Global\ReinforcementsGlobal.cs" />
|
||||
<Compile Include="Scripting\Properties\AirstrikeProperties.cs" />
|
||||
<Compile Include="Scripting\Properties\ProductionProperties.cs" />
|
||||
<Compile Include="Scripting\Properties\MissionObjectiveProperties.cs" />
|
||||
<Compile Include="Scripting\Properties\MobileProperties.cs" />
|
||||
|
||||
36
OpenRA.Mods.RA/Scripting/Properties/AirstrikeProperties.cs
Normal file
36
OpenRA.Mods.RA/Scripting/Properties/AirstrikeProperties.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2015 The OpenRA Developers (see AUTHORS)
|
||||
* 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. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using Eluant;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Scripting
|
||||
{
|
||||
[ScriptGlobal("Air Support Powers")]
|
||||
public class AirstrikeProperties : ScriptActorProperties, Requires<AirstrikePowerInfo>
|
||||
{
|
||||
readonly AirstrikePower ap;
|
||||
|
||||
public AirstrikeProperties(ScriptContext context, Actor self)
|
||||
: base(context, self)
|
||||
{
|
||||
ap = self.TraitsImplementing<AirstrikePower>().First();
|
||||
}
|
||||
|
||||
[Desc("Activate the actor's Airstrike Power.")]
|
||||
public void SendAirstrike(WPos target, bool randomize = true, int facing = 0)
|
||||
{
|
||||
ap.SendAirstrike(Self, target, randomize, facing);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Mods.RA.Traits;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -65,4 +66,22 @@ namespace OpenRA.Mods.RA.Scripting
|
||||
Self.QueueActivity(new RemoveSelf());
|
||||
}
|
||||
}
|
||||
|
||||
[ScriptGlobal("Air Support Powers")]
|
||||
public class ParatroopersProperties : ScriptActorProperties, Requires<ParatroopersPowerInfo>
|
||||
{
|
||||
readonly ParatroopersPower pp;
|
||||
|
||||
public ParatroopersProperties(ScriptContext context, Actor self)
|
||||
: base(context, self)
|
||||
{
|
||||
pp = self.TraitsImplementing<ParatroopersPower>().First();
|
||||
}
|
||||
|
||||
[Desc("Activate the actor's Paratroopers Power. Returns the dropped units.")]
|
||||
public Actor[] SendParatroopers(WPos target, bool randomize = true, int facing = 0)
|
||||
{
|
||||
return pp.SendParatroopers(Self, target, randomize, facing);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,13 +52,20 @@ namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
base.Activate(self, order, manager);
|
||||
|
||||
SendAirstrike(self, self.World.Map.CenterOfCell(order.TargetLocation));
|
||||
}
|
||||
|
||||
public void SendAirstrike(Actor self, WPos target, bool randomize = true, int attackFacing = 0)
|
||||
{
|
||||
var info = Info as AirstrikePowerInfo;
|
||||
var attackFacing = Util.QuantizeFacing(self.World.SharedRandom.Next(256), info.QuantizedFacings) * (256 / info.QuantizedFacings);
|
||||
var attackRotation = WRot.FromFacing(attackFacing);
|
||||
var delta = new WVec(0, -1024, 0).Rotate(attackRotation);
|
||||
|
||||
if (randomize)
|
||||
attackFacing = Util.QuantizeFacing(self.World.SharedRandom.Next(256), info.QuantizedFacings) * (256 / info.QuantizedFacings);
|
||||
|
||||
var altitude = self.World.Map.Rules.Actors[info.UnitType].Traits.Get<PlaneInfo>().CruiseAltitude.Range;
|
||||
var target = self.World.Map.CenterOfCell(order.TargetLocation) + new WVec(0, 0, altitude);
|
||||
var attackRotation = WRot.FromFacing(attackFacing);
|
||||
var delta = new WVec(0, -1024, 0).Rotate(attackRotation);
|
||||
target = target + new WVec(0, 0, altitude);
|
||||
var startEdge = target - (self.World.Map.DistanceToEdge(target, -delta) + info.Cordon).Range * delta / 1024;
|
||||
var finishEdge = target + (self.World.Map.DistanceToEdge(target, delta) + info.Cordon).Range * delta / 1024;
|
||||
|
||||
@@ -75,7 +82,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
camera = w.CreateActor(info.CameraActor, new TypeDictionary
|
||||
{
|
||||
new LocationInit(order.TargetLocation),
|
||||
new LocationInit(self.World.Map.CellContaining(target)),
|
||||
new OwnerInit(self.Owner),
|
||||
});
|
||||
});
|
||||
@@ -149,6 +156,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
attack.OnExitedAttackRange += onExitRange;
|
||||
attack.OnRemovedFromWorld += onExitRange;
|
||||
|
||||
a.QueueActivity(new Fly(a, Target.FromPos(target + spawnOffset)));
|
||||
a.QueueActivity(new Fly(a, Target.FromPos(finishEdge + spawnOffset)));
|
||||
a.QueueActivity(new RemoveSelf());
|
||||
aircraftInRange.Add(a, false);
|
||||
@@ -160,8 +168,8 @@ namespace OpenRA.Mods.RA.Traits
|
||||
var distance = (target - startEdge).HorizontalLength;
|
||||
|
||||
beacon = new Beacon(
|
||||
order.Player,
|
||||
self.World.Map.CenterOfCell(order.TargetLocation),
|
||||
self.Owner,
|
||||
target,
|
||||
Info.BeaconPalettePrefix,
|
||||
Info.BeaconPoster,
|
||||
Info.BeaconPosterPalette,
|
||||
|
||||
@@ -61,13 +61,22 @@ namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
base.Activate(self, order, manager);
|
||||
|
||||
SendParatroopers(self, self.World.Map.CenterOfCell(order.TargetLocation));
|
||||
}
|
||||
|
||||
public Actor[] SendParatroopers(Actor self, WPos target, bool randomize = true, int dropFacing = 0)
|
||||
{
|
||||
var units = new List<Actor>();
|
||||
|
||||
var info = Info as ParatroopersPowerInfo;
|
||||
var dropFacing = Util.QuantizeFacing(self.World.SharedRandom.Next(256), info.QuantizedFacings) * (256 / info.QuantizedFacings);
|
||||
var dropRotation = WRot.FromFacing(dropFacing);
|
||||
var delta = new WVec(0, -1024, 0).Rotate(dropRotation);
|
||||
|
||||
if (randomize)
|
||||
dropFacing = Util.QuantizeFacing(self.World.SharedRandom.Next(256), info.QuantizedFacings) * (256 / info.QuantizedFacings);
|
||||
|
||||
var altitude = self.World.Map.Rules.Actors[info.UnitType].Traits.Get<PlaneInfo>().CruiseAltitude.Range;
|
||||
var target = self.World.Map.CenterOfCell(order.TargetLocation) + new WVec(0, 0, altitude);
|
||||
var dropRotation = WRot.FromFacing(dropFacing);
|
||||
var delta = new WVec(0, -1024, 0).Rotate(dropRotation);
|
||||
target = target + new WVec(0, 0, altitude);
|
||||
var startEdge = target - (self.World.Map.DistanceToEdge(target, -delta) + info.Cordon).Range * delta / 1024;
|
||||
var finishEdge = target + (self.World.Map.DistanceToEdge(target, delta) + info.Cordon).Range * delta / 1024;
|
||||
|
||||
@@ -84,7 +93,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
{
|
||||
camera = w.CreateActor(info.CameraActor, new TypeDictionary
|
||||
{
|
||||
new LocationInit(order.TargetLocation),
|
||||
new LocationInit(self.World.Map.CellContaining(target)),
|
||||
new OwnerInit(self.Owner),
|
||||
});
|
||||
});
|
||||
@@ -128,6 +137,14 @@ namespace OpenRA.Mods.RA.Traits
|
||||
}
|
||||
};
|
||||
|
||||
foreach (var p in info.DropItems)
|
||||
{
|
||||
var unit = self.World.CreateActor(false, p.ToLowerInvariant(),
|
||||
new TypeDictionary { new OwnerInit(self.Owner) });
|
||||
|
||||
units.Add(unit);
|
||||
}
|
||||
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
var notification = self.Owner.IsAlliedWith(self.World.RenderPlayer) ? Info.LaunchSound : Info.IncomingSound;
|
||||
@@ -162,13 +179,13 @@ namespace OpenRA.Mods.RA.Traits
|
||||
drop.OnRemovedFromWorld += onExitRange;
|
||||
|
||||
var cargo = a.Trait<Cargo>();
|
||||
var passengers = info.DropItems.Skip(added).Take(passengersPerPlane);
|
||||
var passengers = units.Skip(added).Take(passengersPerPlane);
|
||||
added += passengersPerPlane;
|
||||
|
||||
foreach (var p in passengers)
|
||||
cargo.Load(a, self.World.CreateActor(false, p.ToLowerInvariant(),
|
||||
new TypeDictionary { new OwnerInit(a.Owner) }));
|
||||
cargo.Load(a, p);
|
||||
|
||||
a.QueueActivity(new Fly(a, Target.FromPos(target + spawnOffset)));
|
||||
a.QueueActivity(new Fly(a, Target.FromPos(finishEdge + spawnOffset)));
|
||||
a.QueueActivity(new RemoveSelf());
|
||||
aircraftInRange.Add(a, false);
|
||||
@@ -180,8 +197,8 @@ namespace OpenRA.Mods.RA.Traits
|
||||
var distance = (target - startEdge).HorizontalLength;
|
||||
|
||||
beacon = new Beacon(
|
||||
order.Player,
|
||||
self.World.Map.CenterOfCell(order.TargetLocation),
|
||||
self.Owner,
|
||||
target,
|
||||
Info.BeaconPalettePrefix,
|
||||
Info.BeaconPoster,
|
||||
Info.BeaconPosterPalette,
|
||||
@@ -190,6 +207,8 @@ namespace OpenRA.Mods.RA.Traits
|
||||
w.Add(beacon);
|
||||
}
|
||||
});
|
||||
|
||||
return units.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
ProductionUnits = { "e1", "e1", "e2" }
|
||||
ProductionBuildings = { USSRBarracks1, USSRBarracks2 }
|
||||
ParatroopersReinforcements = { "e1", "e1", "e1", "e2", "e2" }
|
||||
TransportReinforcements = { "e1", "e1", "e1", "e2", "e2" }
|
||||
FirstUSSRBase = { USSRFlameTower1, USSRBarracks1, USSRPowerPlant1, USSRPowerPlant2, USSRConstructionYard1, USSRTechCenter, USSRBaseGuard1, USSRBaseGuard2, USSRBaseGuard3, USSRBaseGuard4, USSRBaseGuard5, USSRBaseGuard6, USSRBaseGuard7, USSRBaseGuard8 }
|
||||
SecondUSSRBase = { USSRBarracks2, USSRKennel, USSRRadarDome, USSRBaseGuard10, USSRBaseGuard11, USSRBaseGuard12, USSRBaseGuard13, USSRBaseGuard14 }
|
||||
@@ -59,14 +58,19 @@ SendAlliedUnits = function()
|
||||
Trigger.OnKilled(Tanya, function() player.MarkFailedObjective(TanyaSurvive) end)
|
||||
end
|
||||
|
||||
SendUSSRParadrops = function(units, entry, dropzone)
|
||||
local plane = Actor.Create("badr", true, { Owner = ussr, Location = entry })
|
||||
Utils.Do(units, function(type)
|
||||
local unit = Actor.Create(type, false, { Owner = ussr })
|
||||
plane.LoadPassenger(unit)
|
||||
SendUSSRParadrops = function()
|
||||
local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr })
|
||||
local unitsA = powerproxy.SendParatroopers(ParadropLZ.CenterPosition, false, 128 + 32)
|
||||
local unitsB = powerproxy.SendParatroopers(ParadropLZ.CenterPosition, false, 128 - 32)
|
||||
|
||||
Utils.Do(unitsA, function(unit)
|
||||
IdleHunt(unit)
|
||||
end)
|
||||
plane.Paradrop(dropzone)
|
||||
Utils.Do(unitsB, function(unit)
|
||||
IdleHunt(unit)
|
||||
end)
|
||||
|
||||
powerproxy.Destroy()
|
||||
end
|
||||
|
||||
SendUSSRWaterTransport = function()
|
||||
@@ -215,8 +219,7 @@ InitTriggers = function()
|
||||
if a.Owner == player and not paradropsTriggered then
|
||||
paradropsTriggered = true
|
||||
Trigger.RemoveFootprintTrigger(id)
|
||||
SendUSSRParadrops(ParatroopersReinforcements, ParadropTransportEntry1.Location, ParadropLZ.Location)
|
||||
SendUSSRParadrops(ParatroopersReinforcements, ParadropTransportEntry2.Location, ParadropLZ.Location)
|
||||
SendUSSRParadrops()
|
||||
end
|
||||
end)
|
||||
Trigger.OnEnteredFootprint(ReinforcementsTriggerArea, function(a, id)
|
||||
|
||||
@@ -1304,12 +1304,6 @@ Actors:
|
||||
LargeCameraWaypoint: waypoint
|
||||
Location: 71,65
|
||||
Owner: Neutral
|
||||
ParadropTransportEntry1: waypoint
|
||||
Location: 66,38
|
||||
Owner: Neutral
|
||||
ParadropTransportEntry2: waypoint
|
||||
Location: 85,38
|
||||
Owner: Neutral
|
||||
ParadropLZ: waypoint
|
||||
Location: 73,57
|
||||
Owner: Neutral
|
||||
@@ -1378,6 +1372,9 @@ Rules:
|
||||
^Crate:
|
||||
Tooltip:
|
||||
ShowOwnerRow: false
|
||||
powerproxy.paratroopers:
|
||||
ParatroopersPower:
|
||||
DropItems: E1,E1,E1,E2,E2
|
||||
HACKE6:
|
||||
Inherits: E6
|
||||
-RepairsBridges:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
if DateTime.IsHalloween then
|
||||
UnitTypes = { "ant", "ant", "ant" }
|
||||
BeachUnitTypes = { "ant", "ant" }
|
||||
ParadropUnitTypes = { "zombie", "zombie", "zombie", "zombie", "zombie" }
|
||||
ProxyType = "powerproxy.parazombies"
|
||||
ProducedUnitTypes =
|
||||
{
|
||||
{ AlliedBarracks1, { "e1", "e3" } },
|
||||
@@ -15,7 +15,7 @@ if DateTime.IsHalloween then
|
||||
else
|
||||
UnitTypes = { "3tnk", "ftrk", "ttnk", "apc" }
|
||||
BeachUnitTypes = { "e1", "e2", "e3", "e4", "e1", "e2", "e3", "e4", "e1", "e2", "e3", "e4", "e1", "e2", "e3", "e4" }
|
||||
ParadropUnitTypes = { "e1", "e1", "e2", "e3", "e4" }
|
||||
ProxyType = "powerproxy.paratroopers"
|
||||
ProducedUnitTypes =
|
||||
{
|
||||
{ AlliedBarracks1, { "e1", "e3" } },
|
||||
@@ -83,17 +83,13 @@ InsertAlliedChinookReinforcements = function(entry, hpad)
|
||||
end
|
||||
|
||||
ParadropSovietUnits = function()
|
||||
local lz = Utils.Random(ParadropWaypoints).Location
|
||||
local start = Map.CenterOfCell(Map.RandomEdgeCell()) + WVec.New(0, 0, Actor.CruiseAltitude("badr"))
|
||||
local transport = Actor.Create("badr", true, { CenterPosition = start, Owner = soviets, Facing = (Map.CenterOfCell(lz) - start).Facing })
|
||||
local lz = Utils.Random(ParadropWaypoints)
|
||||
local units = powerproxy.SendParatroopers(lz.CenterPosition)
|
||||
|
||||
Utils.Do(ParadropUnitTypes, function(type)
|
||||
local a = Actor.Create(type, false, { Owner = soviets })
|
||||
Utils.Do(units, function(a)
|
||||
BindActorTriggers(a)
|
||||
transport.LoadPassenger(a)
|
||||
end)
|
||||
|
||||
transport.Paradrop(lz)
|
||||
Trigger.AfterDelay(DateTime.Seconds(35), ParadropSovietUnits)
|
||||
end
|
||||
|
||||
@@ -139,7 +135,7 @@ speed = 5
|
||||
|
||||
Tick = function()
|
||||
ticks = ticks + 1
|
||||
|
||||
|
||||
local t = (ticks + 45) % (360 * speed) * (math.pi / 180) / speed;
|
||||
Camera.Position = viewportOrigin + WVec.New(19200 * math.sin(t), 20480 * math.cos(t), 0)
|
||||
end
|
||||
@@ -154,6 +150,7 @@ WorldLoaded = function()
|
||||
ShipAlliedUnits()
|
||||
InsertAlliedChinookReinforcements(Chinook1Entry, HeliPad1)
|
||||
InsertAlliedChinookReinforcements(Chinook2Entry, HeliPad2)
|
||||
powerproxy = Actor.Create(ProxyType, false, { Owner = soviets })
|
||||
ParadropSovietUnits()
|
||||
Trigger.AfterDelay(DateTime.Seconds(5), ChronoshiftAlliedUnits)
|
||||
Utils.Do(ProducedUnitTypes, ProduceUnits)
|
||||
|
||||
@@ -1331,6 +1331,15 @@ Rules:
|
||||
HP: 200
|
||||
E7:
|
||||
-Selectable:
|
||||
powerproxy.paratroopers:
|
||||
ParatroopersPower:
|
||||
DisplayBeacon: false
|
||||
DropItems: E1,E1,E2,E3,E4
|
||||
powerproxy.parazombies:
|
||||
ParatroopersPower:
|
||||
DropItems: ZOMBIE,ZOMBIE,ZOMBIE,ZOMBIE,ZOMBIE
|
||||
QuantizedFacings: 8
|
||||
DisplayBeacon: false
|
||||
|
||||
Sequences:
|
||||
|
||||
|
||||
@@ -54,19 +54,16 @@ GroundPatrolUnits =
|
||||
{ "apc", "apc", "ftrk" },
|
||||
{ "3tnk", "3tnk" }
|
||||
}
|
||||
Paratroopers = { "e1", "e1", "e1", "e3", "e3" }
|
||||
|
||||
ParadropSovietUnits = function()
|
||||
local start = BaseRaidEntrypoint.CenterPosition + WVec.New(0, 0, Actor.CruiseAltitude("badr"))
|
||||
local transport = Actor.Create("badr", true, { CenterPosition = start, Owner = soviets, Facing = (Map.CenterOfCell(MCVDeployLocation.Location) - start).Facing })
|
||||
local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets })
|
||||
local units = powerproxy.SendParatroopers(MCVDeployLocation.CenterPosition, false, 256 - 53)
|
||||
|
||||
Utils.Do(Paratroopers, function(type)
|
||||
local a = Actor.Create(type, false, { Owner = soviets })
|
||||
transport.LoadPassenger(a)
|
||||
Trigger.OnIdle(a, function(b) b.Hunt() end)
|
||||
Utils.Do(units, function(a)
|
||||
Trigger.OnIdle(a, a.Hunt)
|
||||
end)
|
||||
|
||||
transport.Paradrop(MCVDeployLocation.Location)
|
||||
powerproxy.Destroy()
|
||||
end
|
||||
|
||||
AirRaid = function(planeTypes, ingress, egress, target)
|
||||
|
||||
@@ -1248,6 +1248,9 @@ Rules:
|
||||
GenericVisibility: Enemy, Ally, Neutral
|
||||
GenericStancePrefix: false
|
||||
ShowOwnerRow: false
|
||||
powerproxy.paratroopers:
|
||||
ParatroopersPower:
|
||||
DropItems: E1,E1,E1,E2,E2
|
||||
CAMERA.sam:
|
||||
Inherits: CAMERA
|
||||
RevealsShroud:
|
||||
|
||||
@@ -44,13 +44,12 @@ SovietAttackGroupSize = 5
|
||||
SovietInfantryGroupSize = 7
|
||||
FactoryClearRange = 10
|
||||
ParadropTicks = DateTime.Seconds(30)
|
||||
BadgerPassengers = { "e1", "e1", "e1", "e2", "e2" }
|
||||
ParadropWaypoints =
|
||||
{
|
||||
{ BadgerEntryPoint1.Location, ParaDrop1.Location },
|
||||
{ BadgerEntryPoint2.Location, ParaDrop2.Location },
|
||||
{ BadgerEntryPoint1.Location, Alliesbase2.Location },
|
||||
{ BadgerEntryPoint2.Location, Alliesbase1.Location }
|
||||
{ 192 + 4, ParaDrop1},
|
||||
{ 192 - 4, ParaDrop2},
|
||||
{ 192 + 4, Alliesbase2},
|
||||
{ 192 - 4, Alliesbase1}
|
||||
}
|
||||
NavalTransportPassengers = { "e1", "e1", "e2", "e4", "e4" }
|
||||
NavalReinforcementsWaypoints = { NavalWaypoint1, NavalWaypoint2, NavalWaypoint2, NavalWaypoint3 }
|
||||
@@ -120,13 +119,11 @@ Tick = function()
|
||||
end
|
||||
|
||||
SendSovietParadrops = function(table)
|
||||
local plane = Actor.Create("badr", true, { Owner = soviets, Location = table[1] })
|
||||
Utils.Do(BadgerPassengers, function(type)
|
||||
local unit = Actor.Create(type, false, { Owner = soviets })
|
||||
plane.LoadPassenger(unit)
|
||||
local units = powerproxy.SendParatroopers(table[2].CenterPosition, false, table[1])
|
||||
|
||||
Utils.Do(units, function(unit)
|
||||
Trigger.OnIdle(unit, unit.Hunt)
|
||||
end)
|
||||
plane.Paradrop(table[2])
|
||||
end
|
||||
|
||||
SendSovietNavalReinforcements = function()
|
||||
@@ -357,6 +354,7 @@ SetupSoviets = function()
|
||||
Reinforcements.Reinforce(soviets, Squad1, { AlliesBaseGate1.Location, Alliesbase1.Location })
|
||||
Reinforcements.Reinforce(soviets, Squad2, { AlliesBaseGate2.Location, Alliesbase2.Location })
|
||||
|
||||
powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets })
|
||||
Trigger.AfterDelay(ParadropTicks, function()
|
||||
SendSovietParadrops(ParadropWaypoints[1])
|
||||
SendSovietParadrops(ParadropWaypoints[2])
|
||||
|
||||
BIN
mods/ra/maps/survival02/map.bin
Normal file
BIN
mods/ra/maps/survival02/map.bin
Normal file
Binary file not shown.
BIN
mods/ra/maps/survival02/map.png
Normal file
BIN
mods/ra/maps/survival02/map.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
1190
mods/ra/maps/survival02/map.yaml
Normal file
1190
mods/ra/maps/survival02/map.yaml
Normal file
File diff suppressed because it is too large
Load Diff
356
mods/ra/maps/survival02/survival02.lua
Normal file
356
mods/ra/maps/survival02/survival02.lua
Normal file
@@ -0,0 +1,356 @@
|
||||
FrenchSquad = { "2tnk", "2tnk", "mcv" }
|
||||
|
||||
TimerTicks = DateTime.Minutes(10)
|
||||
AttackTicks = DateTime.Seconds(52)
|
||||
AttackAtFrame = DateTime.Seconds(18)
|
||||
AttackAtFrameIncrement = DateTime.Seconds(18)
|
||||
Producing = true
|
||||
SpawningInfantry = true
|
||||
ProduceAtFrame = DateTime.Seconds(12)
|
||||
ProduceAtFrameIncrement = DateTime.Seconds(12)
|
||||
SovietGroupSize = 4
|
||||
SovietAttackGroupSize = 7
|
||||
|
||||
InfantryGuards = { }
|
||||
HarvGuards = { HarvGuard1, HarvGuard2, HarvGuard3 }
|
||||
SovietPlatoonUnits = { "e1", "e1", "e2", "e4", "e4", "e1", "e1", "e2", "e4", "e4" }
|
||||
SovietTanks = { "3tnk", "3tnk", "3tnk" }
|
||||
SovietVehicles = { "3tnk", "3tnk", "v2rl" }
|
||||
SovietInfantry = { "e1", "e4", "e2" }
|
||||
SovietEntryPoints = { SovietEntry1, SovietEntry2, SovietEntry3 }
|
||||
SovietRallyPoints = { SovietRally2, SovietRally4, SovietRally5, SovietRally6 }
|
||||
NewSovietEntryPoints = { SovietParaDropEntry, SovietEntry3 }
|
||||
NewSovietRallyPoints = { SovietRally3, SovietRally4, SovietRally8 }
|
||||
|
||||
ParaWaves =
|
||||
{
|
||||
{ AttackTicks, { "SovietSquad", SovietRally5 } },
|
||||
{ 0, { "SovietSquad", SovietRally6 } },
|
||||
{ AttackTicks * 2, { "SovietSquad", SovietParaDrop3 } },
|
||||
{ 0, { "SovietPlatoonUnits", SovietRally5 } },
|
||||
{ 0, { "SovietPlatoonUnits", SovietRally6 } },
|
||||
{ 0, { "SovietSquad", SovietRally2 } },
|
||||
{ AttackTicks * 2, { "SovietSquad", SovietParaDrop2 } },
|
||||
{ AttackTicks * 2, { "SovietSquad", SovietParaDrop1 } },
|
||||
{ AttackTicks * 3, { "SovietSquad", SovietParaDrop1 } }
|
||||
}
|
||||
|
||||
IdleHunt = function(unit) Trigger.OnIdle(unit, unit.Hunt) end
|
||||
|
||||
GuardHarvester = function(unit, attacker)
|
||||
if not unit.IsDead then
|
||||
unit.Stop()
|
||||
|
||||
local start = unit.Location
|
||||
if attacker.Location then
|
||||
unit.AttackMove(attacker.Location)
|
||||
else
|
||||
unit.Hunt()
|
||||
end
|
||||
|
||||
Trigger.OnIdle(unit, function()
|
||||
if unit.Location == start then
|
||||
Trigger.ClearAll(unit)
|
||||
else
|
||||
unit.AttackMove(start)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
Tick = function()
|
||||
if soviets.HasNoRequiredUnits() then
|
||||
if DestroyObj then
|
||||
allies.MarkCompletedObjective(DestroyObj)
|
||||
else
|
||||
DestroyObj = allies.AddPrimaryObjective("Destroy all Soviet forces in the area!")
|
||||
allies.MarkCompletedObjective(DestroyObj)
|
||||
end
|
||||
end
|
||||
|
||||
if allies.HasNoRequiredUnits() then
|
||||
soviets.MarkCompletedObjective(SovietObj)
|
||||
end
|
||||
|
||||
if soviets.Resources > soviets.ResourceCapacity / 2 then
|
||||
soviets.Resources = soviets.ResourceCapacity / 2
|
||||
end
|
||||
|
||||
if DateTime.GameTime == ProduceAtFrame then
|
||||
if SpawningInfantry then
|
||||
ProduceAtFrame = ProduceAtFrame + ProduceAtFrameIncrement
|
||||
ProduceAtFrameIncrement = ProduceAtFrameIncrement * 2 - 5
|
||||
SpawnSovietInfantry()
|
||||
end
|
||||
end
|
||||
|
||||
if DateTime.GameTime == AttackAtFrame then
|
||||
AttackAtFrame = AttackAtFrame + AttackAtFrameIncrement
|
||||
AttackAtFrameIncrement = AttackAtFrameIncrement * 2 - 5
|
||||
if Producing then
|
||||
SpawnSovietVehicle(SovietEntryPoints, SovietRallyPoints)
|
||||
else
|
||||
SpawnSovietVehicle(NewSovietEntryPoints, NewSovietRallyPoints)
|
||||
end
|
||||
end
|
||||
|
||||
if DateTime.Minutes(5) == TimerTicks - DateTime.GameTime then
|
||||
Media.PlaySpeechNotification(allies, "WarningFiveMinutesRemaining")
|
||||
InitCountDown()
|
||||
end
|
||||
end
|
||||
|
||||
SendSovietParadrops = function(table)
|
||||
local paraproxy = Actor.Create(table[1], false, { Owner = soviets })
|
||||
units = paraproxy.SendParatroopers(table[2].CenterPosition)
|
||||
Utils.Do(units, function(unit) IdleHunt(unit) end)
|
||||
paraproxy.Destroy()
|
||||
end
|
||||
|
||||
SpawnSovietInfantry = function()
|
||||
soviets.Build({ Utils.Random(SovietInfantry) }, function(units)
|
||||
IdleHunt(units[1])
|
||||
end)
|
||||
end
|
||||
|
||||
SpawnSovietVehicle = function(spawnpoints, rallypoints)
|
||||
local route = Utils.RandomInteger(1, #spawnpoints + 1)
|
||||
local rally = Utils.RandomInteger(1, #rallypoints + 1)
|
||||
local unit = Reinforcements.Reinforce(soviets, { Utils.Random(SovietVehicles) }, { spawnpoints[route].Location, rallypoints[rally].Location })[1]
|
||||
IdleHunt(unit)
|
||||
end
|
||||
|
||||
SpawnAndAttack = function(types, entry)
|
||||
local units = Reinforcements.Reinforce(soviets, types, { entry })
|
||||
Utils.Do(units, function(unit)
|
||||
IdleHunt(unit)
|
||||
end)
|
||||
return units
|
||||
end
|
||||
|
||||
FrenchReinforcements = function()
|
||||
Camera.Position = SovietRally1.CenterPosition
|
||||
local camera = Actor.Create("camera", true, { Owner = allies, Location = SovietRally1.Location })
|
||||
|
||||
if drum1.IsDead or drum2.IsDead or drum3.IsDead then
|
||||
Media.PlaySpeechNotification(allies, "AlliedReinforcementsArrived")
|
||||
Reinforcements.Reinforce(allies, FrenchSquad, { FranceEntry.Location, FranceRally.Location })
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function() camera.Destroy() end)
|
||||
return
|
||||
end
|
||||
|
||||
powerproxy = Actor.Create("powerproxy.parabombs", false, { Owner = allies })
|
||||
powerproxy.SendAirstrike(drum1.CenterPosition, false, 256 - 28)
|
||||
powerproxy.SendAirstrike(drum2.CenterPosition, false, 256 - 32)
|
||||
powerproxy.SendAirstrike(drum3.CenterPosition, false, 256 - 36)
|
||||
powerproxy.Destroy()
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function()
|
||||
Media.PlaySpeechNotification(allies, "AlliedReinforcementsArrived")
|
||||
Reinforcements.Reinforce(allies, FrenchSquad, { FranceEntry.Location, FranceRally.Location })
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function() camera.Destroy() end)
|
||||
end)
|
||||
end
|
||||
|
||||
FinalAttack = function()
|
||||
local units1 = SpawnAndAttack(SovietTanks, SovietEntry1.Location)
|
||||
local units2 = SpawnAndAttack(SovietTanks, SovietEntry1.Location)
|
||||
local units3 = SpawnAndAttack(SovietTanks, SovietEntry2.Location)
|
||||
local units4 = SpawnAndAttack(SovietPlatoonUnits, SovietEntry1.Location)
|
||||
local units5 = SpawnAndAttack(SovietPlatoonUnits, SovietEntry2.Location)
|
||||
|
||||
local units = { }
|
||||
local insert = function(table)
|
||||
local count = #units
|
||||
Utils.Do(table, function(unit)
|
||||
units[count] = unit
|
||||
count = count + 1
|
||||
end)
|
||||
end
|
||||
|
||||
insert(units1)
|
||||
insert(units2)
|
||||
insert(units3)
|
||||
insert(units4)
|
||||
insert(units5)
|
||||
|
||||
Trigger.OnAllKilled(units, function()
|
||||
if not DestroyObj then
|
||||
Media.DisplayMessage("Excellent work Commander! We have reinforced our position enough to initiate a counter-attack.", "Incoming Report")
|
||||
DestroyObj = allies.AddPrimaryObjective("Destroy the remaining Soviet forces in the area!")
|
||||
end
|
||||
allies.MarkCompletedObjective(SurviveObj)
|
||||
end)
|
||||
end
|
||||
|
||||
wave = 1
|
||||
SendParadrops = function()
|
||||
SendSovietParadrops(ParaWaves[wave][2])
|
||||
|
||||
wave = wave + 1
|
||||
if wave > #ParaWaves then
|
||||
Trigger.AfterDelay(AttackTicks, FrenchReinforcements)
|
||||
else
|
||||
Trigger.AfterDelay(ParaWaves[wave][1], SendParadrops)
|
||||
end
|
||||
end
|
||||
|
||||
SetupBridges = function()
|
||||
local count = 0
|
||||
local counter = function()
|
||||
count = count + 1
|
||||
if count == 2 then
|
||||
allies.MarkCompletedObjective(RepairBridges)
|
||||
end
|
||||
end
|
||||
|
||||
Media.DisplayMessage("Commander! The Soviets destroyed the brigdes to disable our reinforcements. Repair them for additional reinforcements.", "Incoming Report")
|
||||
RepairBridges = allies.AddSecondaryObjective("Repair the two southern brigdes.")
|
||||
|
||||
local bridgeA = Map.ActorsInCircle(BrokenBridge1.CenterPosition, WRange.FromCells(1), function(self) return self.Type == "bridge1" end)
|
||||
local bridgeB = Map.ActorsInCircle(BrokenBridge2.CenterPosition, WRange.FromCells(1), function(self) return self.Type == "bridge1" end)
|
||||
|
||||
Utils.Do(bridgeA, function(bridge)
|
||||
Trigger.OnDamaged(bridge, function()
|
||||
Utils.Do(bridgeA, function(self) Trigger.ClearAll(self) end)
|
||||
Media.PlaySpeechNotification(allies, "AlliedReinforcementsArrived")
|
||||
Reinforcements.Reinforce(allies, { "1tnk", "2tnk", "2tnk" }, { ReinforcementsEntry1.Location, ReinforcementsRally1.Location })
|
||||
counter()
|
||||
end)
|
||||
end)
|
||||
Utils.Do(bridgeB, function(bridge)
|
||||
Trigger.OnDamaged(bridge, function()
|
||||
Utils.Do(bridgeB, function(self) Trigger.ClearAll(self) end)
|
||||
Media.PlaySpeechNotification(allies, "AlliedReinforcementsArrived")
|
||||
Reinforcements.Reinforce(allies, { "jeep", "1tnk", "1tnk" }, { ReinforcementsEntry2.Location, ReinforcementsRally2.Location })
|
||||
counter()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
InitCountDown = function()
|
||||
Trigger.AfterDelay(DateTime.Minutes(1), function() Media.PlaySpeechNotification(allies, "WarningFourMinutesRemaining") end)
|
||||
Trigger.AfterDelay(DateTime.Minutes(2), function() Media.PlaySpeechNotification(allies, "WarningThreeMinutesRemaining") end)
|
||||
Trigger.AfterDelay(DateTime.Minutes(3), function() Media.PlaySpeechNotification(allies, "WarningTwoMinutesRemaining") end)
|
||||
Trigger.AfterDelay(DateTime.Minutes(4), function() Media.PlaySpeechNotification(allies, "WarningOneMinuteRemaining") end)
|
||||
end
|
||||
|
||||
InitObjectives = function()
|
||||
Trigger.OnObjectiveAdded(allies, function(p, id)
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "New " .. string.lower(p.GetObjectiveType(id)) .. " objective")
|
||||
end)
|
||||
|
||||
SurviveObj = allies.AddPrimaryObjective("Enforce your position and hold-out the onslaught.")
|
||||
SovietObj = soviets.AddPrimaryObjective("Eliminate all Allied forces.")
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(15), function()
|
||||
SetupBridges()
|
||||
end)
|
||||
|
||||
Trigger.OnObjectiveCompleted(allies, function(p, id)
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed")
|
||||
end)
|
||||
Trigger.OnObjectiveFailed(allies, function(p, id)
|
||||
Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed")
|
||||
end)
|
||||
|
||||
Trigger.OnPlayerLost(allies, function()
|
||||
Media.PlaySpeechNotification(allies, "Lose")
|
||||
end)
|
||||
Trigger.OnPlayerWon(allies, function()
|
||||
Media.PlaySpeechNotification(allies, "Win")
|
||||
Media.DisplayMessage("We have destroyed the remaining Soviet presence!", "Incoming Report")
|
||||
end)
|
||||
end
|
||||
|
||||
InitMission = function()
|
||||
Camera.Position = AlliesBase.CenterPosition
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(allies, "MissionTimerInitialised") end)
|
||||
|
||||
Trigger.AfterDelay(TimerTicks, function()
|
||||
Media.DisplayMessage("The Soviet reinforcements are approaching!", "Incoming Report")
|
||||
Media.PlaySpeechNotification(allies, "SovietReinforcementsArrived")
|
||||
SpawnSovietVehicle(NewSovietEntryPoints, NewSovietRallyPoints)
|
||||
FinalAttack()
|
||||
Producing = false
|
||||
Timer.Destroy()
|
||||
end)
|
||||
|
||||
Trigger.AfterDelay(AttackTicks, SendParadrops)
|
||||
|
||||
Trigger.OnKilled(drum1, function() --Kill the remaining stuff from FrenchReinforcements
|
||||
if not boom2.IsDead then boom2.Kill() end
|
||||
if not boom4.IsDead then boom4.Kill() end
|
||||
if not drum2.IsDead then drum2.Kill() end
|
||||
if not drum3.IsDead then drum3.Kill() end
|
||||
end)
|
||||
Trigger.OnKilled(drum2, function()
|
||||
if not boom1.IsDead then boom1.Kill() end
|
||||
if not boom5.IsDead then boom5.Kill() end
|
||||
Trigger.AfterDelay(DateTime.Seconds(1), function() if not drum1.IsDead then drum1.Kill() end end)
|
||||
end)
|
||||
Trigger.OnKilled(drum3, function()
|
||||
if not boom1.IsDead then boom1.Kill() end
|
||||
if not boom3.IsDead then boom3.Kill() end
|
||||
Trigger.AfterDelay(DateTime.Seconds(1), function() if not drum1.IsDead then drum1.Kill() end end)
|
||||
end)
|
||||
end
|
||||
|
||||
SetupSoviets = function()
|
||||
Barrack1.IsPrimaryBuilding = true
|
||||
Barrack1.RallyPoint = SovietRally.Location
|
||||
Trigger.OnKilledOrCaptured(Barrack1, function()
|
||||
SpawningInfantry = false
|
||||
end)
|
||||
|
||||
Harvester1.FindResources()
|
||||
Trigger.OnDamaged(Harvester1, function(self, attacker)
|
||||
Utils.Do(HarvGuards, function(unit)
|
||||
GuardHarvester(unit, attacker)
|
||||
end)
|
||||
end)
|
||||
|
||||
Harvester2.FindResources()
|
||||
Trigger.OnDamaged(Harvester2, function(self, attacker)
|
||||
Utils.Do(InfantryGuards, function(unit) GuardHarvester(unit, attacker) end)
|
||||
|
||||
local toBuild = { }
|
||||
for i = 1, 6, 1 do
|
||||
toBuild[i] = Utils.Random(SovietInfantry)
|
||||
end
|
||||
|
||||
soviets.Build(toBuild, function(units)
|
||||
Utils.Do(units, function(unit)
|
||||
InfantryGuards[#InfantryGuards + 1] = unit
|
||||
GuardHarvester(unit, attacker)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
Trigger.AfterDelay(0, function()
|
||||
local buildings = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Owner == soviets and self.HasProperty("StartBuildingRepairs") end)
|
||||
Utils.Do(buildings, function(actor)
|
||||
Trigger.OnDamaged(actor, function(building)
|
||||
if building.Owner == soviets and building.Health < building.MaxHealth * 3/4 then
|
||||
building.StartBuildingRepairs()
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
local units = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Owner == soviets and self.HasProperty("AutoTarget") end)
|
||||
Utils.Do(units, function(unit)
|
||||
unit.Stance = "Defend"
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
|
||||
allies = Player.GetPlayer("Allies")
|
||||
soviets = Player.GetPlayer("Soviets")
|
||||
|
||||
InitObjectives()
|
||||
InitMission()
|
||||
SetupSoviets()
|
||||
end
|
||||
@@ -329,6 +329,19 @@ powerproxy.sonarpulse:
|
||||
EffectSequence: moveflsh
|
||||
EffectPalette: moveflash
|
||||
|
||||
powerproxy.paratroopers:
|
||||
ParatroopersPower:
|
||||
Icon: paratroopers
|
||||
Description: Paratroopers
|
||||
LongDesc: A Badger drops a squad of infantry\nanywhere on the map.
|
||||
DropItems: E1,E1,E1,E3,E3
|
||||
SelectTargetSound: slcttgt1.aud
|
||||
AllowImpassableCells: false
|
||||
QuantizedFacings: 8
|
||||
CameraActor: camera.paradrop
|
||||
DisplayBeacon: true
|
||||
BeaconPoster: pinficon
|
||||
|
||||
mpspawn:
|
||||
Immobile:
|
||||
OccupiesSpace: false
|
||||
|
||||
@@ -1678,6 +1678,8 @@ BRIK:
|
||||
|
||||
CYCL:
|
||||
Inherits: ^Wall
|
||||
Tooltip:
|
||||
Name: Chain-Link Barrier
|
||||
Health:
|
||||
HP: 100
|
||||
Armor:
|
||||
@@ -1691,6 +1693,8 @@ CYCL:
|
||||
|
||||
BARB:
|
||||
Inherits: ^Wall
|
||||
Tooltip:
|
||||
Name: Barbed-Wire Fence
|
||||
Health:
|
||||
HP: 100
|
||||
Armor:
|
||||
@@ -1704,6 +1708,8 @@ BARB:
|
||||
|
||||
WOOD:
|
||||
Inherits: ^Wall
|
||||
Tooltip:
|
||||
Name: Wooden Fence
|
||||
Health:
|
||||
HP: 100
|
||||
Armor:
|
||||
|
||||
Reference in New Issue
Block a user