From 154f6ba2970056233574d773eb2d1a59a652c3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 31 Aug 2014 14:29:14 +0200 Subject: [PATCH 1/8] remove bogus space tabs --- .../maps/desert-shellmap/desert-shellmap.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mods/ra/maps/desert-shellmap/desert-shellmap.lua b/mods/ra/maps/desert-shellmap/desert-shellmap.lua index 22d182c27a..4b37480015 100644 --- a/mods/ra/maps/desert-shellmap/desert-shellmap.lua +++ b/mods/ra/maps/desert-shellmap/desert-shellmap.lua @@ -80,11 +80,11 @@ ShipAlliedUnits = function() transport.Wait(50) transport.Move(LstEntry.Location) transport.Destroy() - Trigger.AfterDelay(60 * 25, ShipAlliedUnits) + Trigger.AfterDelay(60 * 25, ShipAlliedUnits) end ParadropSovietUnits = function() - local lz = Utils.Random(ParadropWaypoints).Location + local lz = Utils.Random(ParadropWaypoints).Location local start = Utils.CenterOfCell(Map.RandomEdgeCell()) + WVec.New(0, 0, Actor.CruiseAltitude("badr")) local transport = Actor.Create("badr", true, { CenterPosition = start, Owner = soviets, Facing = (Utils.CenterOfCell(lz) - start).Facing }) @@ -95,7 +95,7 @@ ParadropSovietUnits = function() end) transport.Paradrop(lz) - Trigger.AfterDelay(35 * 25, ParadropSovietUnits) + Trigger.AfterDelay(35 * 25, ParadropSovietUnits) end ProduceUnits = function(t) @@ -118,9 +118,9 @@ SetupAlliedUnits = function() end SetupFactories = function() - Utils.Do(ProducedUnitTypes, function(pair) + Utils.Do(ProducedUnitTypes, function(pair) Trigger.OnProduction(pair[1], function(_, a) BindActorTriggers(a) end) - end) + end) end ChronoshiftAlliedUnits = function() @@ -129,9 +129,9 @@ ChronoshiftAlliedUnits = function() for i = 1, #cells do local unit = Actor.Create("2tnk", true, { Owner = allies, Facing = 0 }) BindActorTriggers(unit) - units[unit] = cells[i] - end - Chronosphere.Chronoshift(units) + units[unit] = cells[i] + end + Chronosphere.Chronoshift(units) Trigger.AfterDelay(60 * 25, ChronoshiftAlliedUnits) end @@ -155,7 +155,7 @@ WorldLoaded = function() ShipAlliedUnits() ParadropSovietUnits() Trigger.AfterDelay(5 * 25, ChronoshiftAlliedUnits) - Utils.Do(ProducedUnitTypes, ProduceUnits) + Utils.Do(ProducedUnitTypes, ProduceUnits) SendSovietUnits(Entry1.Location, UnitTypes, 50) SendSovietUnits(Entry2.Location, UnitTypes, 50) From 5b12ba1c21611bb826405cd38b91b29784fdc57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 31 Aug 2014 14:45:04 +0200 Subject: [PATCH 2/8] refactor and move ShipUnitTypes to the top --- mods/ra/maps/desert-shellmap/desert-shellmap.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mods/ra/maps/desert-shellmap/desert-shellmap.lua b/mods/ra/maps/desert-shellmap/desert-shellmap.lua index 4b37480015..9255aaff4a 100644 --- a/mods/ra/maps/desert-shellmap/desert-shellmap.lua +++ b/mods/ra/maps/desert-shellmap/desert-shellmap.lua @@ -30,6 +30,8 @@ else } end +ShipUnitTypes = { "1tnk", "1tnk", "jeep", "2tnk", "2tnk" } + ParadropWaypoints = { Paradrop1, Paradrop2, Paradrop3, Paradrop4, Paradrop5, Paradrop6, Paradrop7, Paradrop8 } BindActorTriggers = function(a) @@ -69,7 +71,7 @@ end ShipAlliedUnits = function() local transport = Actor.Create("lst", true, { Location = LstEntry.Location, Owner = allies }) - Utils.Do({ "1tnk", "1tnk", "jeep", "2tnk", "2tnk" }, function(type) + Utils.Do(ShipUnitTypes, function(type) local a = Actor.Create(type, false, { Owner = allies }) BindActorTriggers(a) transport.LoadPassenger(a) From a7389a0e454fb05f54197a11f323b54130396dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 31 Aug 2014 14:45:39 +0200 Subject: [PATCH 3/8] make this a seasonal easter egg --- OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 1 + OpenRA.Mods.RA/Scripting/Global/DateGlobal.cs | 28 +++++++++++++++++++ .../maps/desert-shellmap/desert-shellmap.lua | 4 +-- 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 OpenRA.Mods.RA/Scripting/Global/DateGlobal.cs diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index aaf689a4dc..59592984e5 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -570,6 +570,7 @@ + diff --git a/OpenRA.Mods.RA/Scripting/Global/DateGlobal.cs b/OpenRA.Mods.RA/Scripting/Global/DateGlobal.cs new file mode 100644 index 0000000000..a36c39a11c --- /dev/null +++ b/OpenRA.Mods.RA/Scripting/Global/DateGlobal.cs @@ -0,0 +1,28 @@ +#region Copyright & License Information +/* + * Copyright 2007-2014 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; +using Eluant; +using OpenRA.Scripting; + +namespace OpenRA.Mods.RA.Scripting +{ + [ScriptGlobal("Date")] + public class DateGlobal : ScriptGlobal + { + public DateGlobal(ScriptContext context) : base(context) { } + + [Desc("True on the 31st of October.")] + public bool Halloween + { + get { return DateTime.Today.Month == 10 && DateTime.Today.Day == 31; } + } + } +} diff --git a/mods/ra/maps/desert-shellmap/desert-shellmap.lua b/mods/ra/maps/desert-shellmap/desert-shellmap.lua index 9255aaff4a..64e24a5489 100644 --- a/mods/ra/maps/desert-shellmap/desert-shellmap.lua +++ b/mods/ra/maps/desert-shellmap/desert-shellmap.lua @@ -1,6 +1,4 @@ -local ants = Utils.RandomInteger(0, 51) == 0 - -if ants then +if Date.Halloween then UnitTypes = { "ant", "ant", "ant" } BeachUnitTypes = { "ant", "ant" } ParadropUnitTypes = { "ant", "ant", "ant", "ant", "ant" } From 03afd1db5d557de40f2c4920385fafc564d8a484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 31 Aug 2014 14:50:09 +0200 Subject: [PATCH 4/8] avoid magic numbers --- mods/ra/maps/desert-shellmap/desert-shellmap.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mods/ra/maps/desert-shellmap/desert-shellmap.lua b/mods/ra/maps/desert-shellmap/desert-shellmap.lua index 64e24a5489..1ab1c78f8d 100644 --- a/mods/ra/maps/desert-shellmap/desert-shellmap.lua +++ b/mods/ra/maps/desert-shellmap/desert-shellmap.lua @@ -77,10 +77,10 @@ ShipAlliedUnits = function() transport.Move(LstUnload.Location) transport.UnloadPassengers() - transport.Wait(50) + transport.Wait(Utils.Seconds(2)) transport.Move(LstEntry.Location) transport.Destroy() - Trigger.AfterDelay(60 * 25, ShipAlliedUnits) + Trigger.AfterDelay(Utils.Seconds(60), ShipAlliedUnits) end ParadropSovietUnits = function() @@ -95,7 +95,7 @@ ParadropSovietUnits = function() end) transport.Paradrop(lz) - Trigger.AfterDelay(35 * 25, ParadropSovietUnits) + Trigger.AfterDelay(Utils.Seconds(35), ParadropSovietUnits) end ProduceUnits = function(t) @@ -132,7 +132,7 @@ ChronoshiftAlliedUnits = function() units[unit] = cells[i] end Chronosphere.Chronoshift(units) - Trigger.AfterDelay(60 * 25, ChronoshiftAlliedUnits) + Trigger.AfterDelay(Utils.Seconds(60), ChronoshiftAlliedUnits) end ticks = 0 @@ -154,7 +154,7 @@ WorldLoaded = function() SetupFactories() ShipAlliedUnits() ParadropSovietUnits() - Trigger.AfterDelay(5 * 25, ChronoshiftAlliedUnits) + Trigger.AfterDelay(Utils.Seconds(5), ChronoshiftAlliedUnits) Utils.Do(ProducedUnitTypes, ProduceUnits) SendSovietUnits(Entry1.Location, UnitTypes, 50) From 0b8ae4088e36e68b7d57236a93598f9a7a2fdd44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 31 Aug 2014 15:07:36 +0200 Subject: [PATCH 5/8] use the new reinforcements methods --- .../maps/desert-shellmap/desert-shellmap.lua | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/mods/ra/maps/desert-shellmap/desert-shellmap.lua b/mods/ra/maps/desert-shellmap/desert-shellmap.lua index 1ab1c78f8d..987f594846 100644 --- a/mods/ra/maps/desert-shellmap/desert-shellmap.lua +++ b/mods/ra/maps/desert-shellmap/desert-shellmap.lua @@ -52,34 +52,21 @@ BindActorTriggers = function(a) end SendSovietUnits = function(entryCell, unitTypes, interval) - local i = 0 - team = {} - - Utils.Do(unitTypes, function(type) - local a = Actor.Create(type, false, { Owner = soviets, Location = entryCell }) - BindActorTriggers(a) - Trigger.AfterDelay(i * interval, function() a.IsInWorld = true end) - table.insert(team, a) - i = i + 1 + local units = Reinforcements.Reinforce(soviets, unitTypes, { entryCell }, interval) + Utils.Do(units, function(unit) + BindActorTriggers(unit) end) - - Trigger.OnAllKilled(team, function() SendSovietUnits(entryCell, unitTypes, interval) end) + Trigger.OnAllKilled(units, function() SendSovietUnits(entryCell, unitTypes, interval) end) end ShipAlliedUnits = function() - local transport = Actor.Create("lst", true, { Location = LstEntry.Location, Owner = allies }) + local units = Reinforcements.ReinforceWithTransport(allies, "lst", + ShipUnitTypes, { LstEntry.Location, LstUnload.Location }, { LstEntry.Location })[2] - Utils.Do(ShipUnitTypes, function(type) - local a = Actor.Create(type, false, { Owner = allies }) - BindActorTriggers(a) - transport.LoadPassenger(a) + Utils.Do(units, function(unit) + BindActorTriggers(unit) end) - transport.Move(LstUnload.Location) - transport.UnloadPassengers() - transport.Wait(Utils.Seconds(2)) - transport.Move(LstEntry.Location) - transport.Destroy() Trigger.AfterDelay(Utils.Seconds(60), ShipAlliedUnits) end From 99156451c09f679870684f061b290c402aabdec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 31 Aug 2014 15:36:35 +0200 Subject: [PATCH 6/8] bring back Chinook infantry insertion --- mods/ra/maps/desert-shellmap/desert-shellmap.lua | 14 ++++++++++++++ mods/ra/maps/desert-shellmap/map.yaml | 12 +++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/mods/ra/maps/desert-shellmap/desert-shellmap.lua b/mods/ra/maps/desert-shellmap/desert-shellmap.lua index 987f594846..83cba4477e 100644 --- a/mods/ra/maps/desert-shellmap/desert-shellmap.lua +++ b/mods/ra/maps/desert-shellmap/desert-shellmap.lua @@ -29,6 +29,7 @@ else end ShipUnitTypes = { "1tnk", "1tnk", "jeep", "2tnk", "2tnk" } +HelicopterUnitTypes = { "e1", "e1", "e1", "e1", "e3", "e3" }; ParadropWaypoints = { Paradrop1, Paradrop2, Paradrop3, Paradrop4, Paradrop5, Paradrop6, Paradrop7, Paradrop8 } @@ -70,6 +71,17 @@ ShipAlliedUnits = function() Trigger.AfterDelay(Utils.Seconds(60), ShipAlliedUnits) end +InsertAlliedChinookReinforcements = function(entry, hpad) + local units = Reinforcements.ReinforceWithTransport(allies, "tran", + HelicopterUnitTypes, { entry.Location, hpad.Location + CVec.New(1, 2) }, { entry.Location })[2] + + Utils.Do(units, function(unit) + BindActorTriggers(unit) + end) + + Trigger.AfterDelay(Utils.Seconds(60), function() InsertAlliedChinookReinforcements(entry, hpad) end) +end + ParadropSovietUnits = function() local lz = Utils.Random(ParadropWaypoints).Location local start = Utils.CenterOfCell(Map.RandomEdgeCell()) + WVec.New(0, 0, Actor.CruiseAltitude("badr")) @@ -140,6 +152,8 @@ WorldLoaded = function() SetupAlliedUnits() SetupFactories() ShipAlliedUnits() + InsertAlliedChinookReinforcements(Chinook1Entry, HeliPad1) + InsertAlliedChinookReinforcements(Chinook2Entry, HeliPad2) ParadropSovietUnits() Trigger.AfterDelay(Utils.Seconds(5), ChronoshiftAlliedUnits) Utils.Do(ProducedUnitTypes, ProduceUnits) diff --git a/mods/ra/maps/desert-shellmap/map.yaml b/mods/ra/maps/desert-shellmap/map.yaml index 9fc0a2cdfe..9410038d01 100644 --- a/mods/ra/maps/desert-shellmap/map.yaml +++ b/mods/ra/maps/desert-shellmap/map.yaml @@ -947,8 +947,8 @@ Actors: Actor329: mine Location: 90,21 Owner: Neutral - Actor195: hpad - Location: 70,75 + HeliPad1: hpad + Location: 70,76 Owner: Allies Actor341: dome Location: 63,73 @@ -1004,7 +1004,7 @@ Actors: Actor361: pbox Location: 71,96 Owner: Allies - Actor365: hpad + HeliPad2: hpad Location: 64,78 Owner: Allies Actor221: fenc @@ -1217,6 +1217,12 @@ Actors: LstUnload: waypoint Location: 60,93 Owner: Neutral + Chinook1Entry: waypoint + Location: 44,126 + Owner: Neutral + Chinook2Entry: waypoint + Location: 47,126 + Owner: Neutral Actor184: pbox Location: 96,79 Owner: Allies From 128b2b8b67212a0ca327376e5d84911a458ac4fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Fri, 5 Sep 2014 15:42:38 +0200 Subject: [PATCH 7/8] rename the boolean --- OpenRA.Mods.RA/Scripting/Global/DateGlobal.cs | 2 +- mods/ra/maps/desert-shellmap/desert-shellmap.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.RA/Scripting/Global/DateGlobal.cs b/OpenRA.Mods.RA/Scripting/Global/DateGlobal.cs index a36c39a11c..e93919bcf6 100644 --- a/OpenRA.Mods.RA/Scripting/Global/DateGlobal.cs +++ b/OpenRA.Mods.RA/Scripting/Global/DateGlobal.cs @@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Scripting public DateGlobal(ScriptContext context) : base(context) { } [Desc("True on the 31st of October.")] - public bool Halloween + public bool IsHalloween { get { return DateTime.Today.Month == 10 && DateTime.Today.Day == 31; } } diff --git a/mods/ra/maps/desert-shellmap/desert-shellmap.lua b/mods/ra/maps/desert-shellmap/desert-shellmap.lua index 83cba4477e..119fdb959e 100644 --- a/mods/ra/maps/desert-shellmap/desert-shellmap.lua +++ b/mods/ra/maps/desert-shellmap/desert-shellmap.lua @@ -1,4 +1,4 @@ -if Date.Halloween then +if Date.IsHalloween then UnitTypes = { "ant", "ant", "ant" } BeachUnitTypes = { "ant", "ant" } ParadropUnitTypes = { "ant", "ant", "ant", "ant", "ant" } From 9b6a5320a4db34b72441cfe397592163914a8394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Fri, 5 Sep 2014 15:42:54 +0200 Subject: [PATCH 8/8] paradrop zombies instead of ants --- mods/ra/maps/desert-shellmap/desert-shellmap.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ra/maps/desert-shellmap/desert-shellmap.lua b/mods/ra/maps/desert-shellmap/desert-shellmap.lua index 119fdb959e..cc8b82f733 100644 --- a/mods/ra/maps/desert-shellmap/desert-shellmap.lua +++ b/mods/ra/maps/desert-shellmap/desert-shellmap.lua @@ -1,7 +1,7 @@ if Date.IsHalloween then UnitTypes = { "ant", "ant", "ant" } BeachUnitTypes = { "ant", "ant" } - ParadropUnitTypes = { "ant", "ant", "ant", "ant", "ant" } + ParadropUnitTypes = { "zombie", "zombie", "zombie", "zombie", "zombie" } ProducedUnitTypes = { { AlliedBarracks1, { "e1", "e3" } },