From 378f66a1ff3c5a7b37a594b110130bc2bdd9ade2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Wed, 1 Mar 2023 10:40:46 +0100 Subject: [PATCH] Resolve Lua language server diagnosed problems. --- mods/cnc/maps/gdi04a/gdi04a.lua | 2 +- mods/cnc/maps/gdi07/gdi07.lua | 2 +- mods/cnc/maps/nod02a/nod02a.lua | 6 +- mods/cnc/maps/nod02b/nod02b.lua | 6 +- mods/cnc/maps/nod04b/nod04b.lua | 4 +- mods/cnc/maps/nod07b/nod07b.lua | 2 +- mods/d2k/maps/atreides-01a/atreides01a.lua | 50 ++-- mods/d2k/maps/atreides-01b/atreides01b.lua | 50 ++-- mods/d2k/maps/atreides-02a/atreides02a-AI.lua | 6 +- mods/d2k/maps/atreides-02a/atreides02a.lua | 22 +- mods/d2k/maps/atreides-02b/atreides02b-AI.lua | 6 +- mods/d2k/maps/atreides-02b/atreides02b.lua | 22 +- mods/d2k/maps/atreides-03a/atreides03a-AI.lua | 16 +- mods/d2k/maps/atreides-03a/atreides03a.lua | 62 ++--- mods/d2k/maps/atreides-03b/atreides03b-AI.lua | 8 +- mods/d2k/maps/atreides-03b/atreides03b.lua | 62 ++--- mods/d2k/maps/atreides-04/atreides04-AI.lua | 10 +- mods/d2k/maps/atreides-04/atreides04.lua | 76 +++--- mods/d2k/maps/atreides-05/atreides05-AI.lua | 32 +-- mods/d2k/maps/atreides-05/atreides05.lua | 128 +++++----- mods/d2k/maps/harkonnen-01a/harkonnen01a.lua | 50 ++-- mods/d2k/maps/harkonnen-01b/harkonnen01b.lua | 50 ++-- .../maps/harkonnen-02a/harkonnen02a-AI.lua | 6 +- mods/d2k/maps/harkonnen-02a/harkonnen02a.lua | 22 +- .../maps/harkonnen-02b/harkonnen02b-AI.lua | 8 +- mods/d2k/maps/harkonnen-02b/harkonnen02b.lua | 22 +- .../maps/harkonnen-03a/harkonnen03a-AI.lua | 10 +- mods/d2k/maps/harkonnen-03a/harkonnen03a.lua | 46 ++-- .../maps/harkonnen-03b/harkonnen03b-AI.lua | 10 +- mods/d2k/maps/harkonnen-03b/harkonnen03b.lua | 44 ++-- mods/d2k/maps/harkonnen-04/harkonnen04-AI.lua | 14 +- mods/d2k/maps/harkonnen-04/harkonnen04.lua | 62 ++--- mods/d2k/maps/harkonnen-05/harkonnen05-AI.lua | 22 +- mods/d2k/maps/harkonnen-05/harkonnen05.lua | 100 ++++---- .../maps/harkonnen-06a/harkonnen06a-AI.lua | 20 +- mods/d2k/maps/harkonnen-06a/harkonnen06a.lua | 106 ++++---- .../maps/harkonnen-06b/harkonnen06b-AI.lua | 20 +- mods/d2k/maps/harkonnen-06b/harkonnen06b.lua | 94 ++++---- mods/d2k/maps/harkonnen-07/harkonnen07-AI.lua | 24 +- mods/d2k/maps/harkonnen-07/harkonnen07.lua | 96 ++++---- mods/d2k/maps/harkonnen-08/harkonnen08-AI.lua | 34 +-- mods/d2k/maps/harkonnen-08/harkonnen08.lua | 132 +++++----- .../maps/harkonnen-09a/harkonnen09a-AI.lua | 50 ++-- mods/d2k/maps/harkonnen-09a/harkonnen09a.lua | 140 +++++------ .../maps/harkonnen-09b/harkonnen09b-AI.lua | 42 ++-- mods/d2k/maps/harkonnen-09b/harkonnen09b.lua | 174 ++++++------- mods/d2k/maps/ordos-01a/ordos01a.lua | 50 ++-- mods/d2k/maps/ordos-01b/ordos01b.lua | 50 ++-- mods/d2k/maps/ordos-02a/ordos02a-AI.lua | 6 +- mods/d2k/maps/ordos-02a/ordos02a.lua | 30 +-- mods/d2k/maps/ordos-02b/ordos02b-AI.lua | 6 +- mods/d2k/maps/ordos-02b/ordos02b.lua | 22 +- mods/d2k/maps/ordos-03a/ordos03a-AI.lua | 10 +- mods/d2k/maps/ordos-03a/ordos03a.lua | 38 +-- mods/d2k/maps/ordos-03b/ordos03b-AI.lua | 10 +- mods/d2k/maps/ordos-03b/ordos03b.lua | 44 ++-- mods/d2k/maps/ordos-04/ordos04-AI.lua | 16 +- mods/d2k/maps/ordos-04/ordos04.lua | 62 ++--- mods/d2k/maps/ordos-05/ordos05-AI.lua | 20 +- mods/d2k/maps/ordos-05/ordos05.lua | 94 ++++---- mods/d2k/maps/ordos-06a/ordos06a-AI.lua | 14 +- mods/d2k/maps/ordos-06a/ordos06a.lua | 70 +++--- mods/d2k/maps/shellmap/d2k-shellmap.lua | 66 ++--- mods/ra/maps/allies-01/allies01.lua | 38 +-- mods/ra/maps/allies-02/allies02.lua | 76 +++--- mods/ra/maps/allies-03a/allies03a.lua | 80 +++--- mods/ra/maps/allies-03b/allies03b.lua | 116 ++++----- mods/ra/maps/allies-04/allies04-AI.lua | 24 +- mods/ra/maps/allies-04/allies04.lua | 34 +-- mods/ra/maps/allies-05a/allies05a-AI.lua | 20 +- mods/ra/maps/allies-05a/allies05a.lua | 130 +++++----- mods/ra/maps/allies-06a/allies06a-AI.lua | 24 +- mods/ra/maps/allies-06a/allies06a.lua | 56 ++--- mods/ra/maps/allies-06b/allies06b-AI.lua | 24 +- mods/ra/maps/allies-06b/allies06b.lua | 64 ++--- mods/ra/maps/allies-07/allies07-AI.lua | 22 +- mods/ra/maps/allies-07/allies07.lua | 74 +++--- mods/ra/maps/allies-08a/allies08a-AI.lua | 28 +-- mods/ra/maps/allies-08a/allies08a.lua | 102 ++++---- mods/ra/maps/allies-08b/allies08b-AI.lua | 28 +-- mods/ra/maps/allies-08b/allies08b.lua | 102 ++++---- mods/ra/maps/allies-09a/allies09a.lua | 4 +- mods/ra/maps/allies-10a/allies10a.lua | 2 +- mods/ra/maps/ant-01/ant-01.lua | 24 +- .../maps/desert-shellmap/desert-shellmap.lua | 34 +-- mods/ra/maps/evacuation/evacuation.lua | 118 ++++----- mods/ra/maps/exodus/exodus.lua | 89 ++++--- .../personal-war.lua | 6 +- .../maps/fort-lonestar/fort-lonestar-AI.lua | 8 +- mods/ra/maps/fort-lonestar/fort-lonestar.lua | 20 +- .../in-the-nick-of-time.lua | 18 +- mods/ra/maps/infiltration/infiltration.lua | 152 ++++++------ mods/ra/maps/intervention/intervention.lua | 62 ++--- .../monster-tank-madness.lua | 190 +++++++-------- .../production-disruption.lua | 12 +- .../sarin-gas-1-crackdown/crackdown-AI.lua | 14 +- .../maps/sarin-gas-1-crackdown/crackdown.lua | 56 ++--- .../maps/sarin-gas-2-down-under/downunder.lua | 140 +++++------ mods/ra/maps/shock-therapy/shock-therapy.lua | 6 +- .../fresh-tracks.lua | 12 +- .../situation-critical/situation-critical.lua | 12 +- mods/ra/maps/soviet-01/soviet01.lua | 30 +-- mods/ra/maps/soviet-02a/soviet02a.lua | 56 ++--- mods/ra/maps/soviet-02b/soviet02b.lua | 100 ++++---- mods/ra/maps/soviet-03/soviet03.lua | 190 +++++++-------- mods/ra/maps/soviet-04a/soviet04a.lua | 32 +-- mods/ra/maps/soviet-04b/soviet04b.lua | 30 +-- .../soviet05-reinforcements_teams.lua | 4 +- mods/ra/maps/soviet-05/soviet05.lua | 56 ++--- mods/ra/maps/soviet-06a/soviet06a-AI.lua | 20 +- .../soviet06a-reinforcements_teams.lua | 14 +- mods/ra/maps/soviet-06a/soviet06a.lua | 80 +++--- mods/ra/maps/soviet-06b/soviet06b-AI.lua | 20 +- .../soviet06b-reinforcements_teams.lua | 14 +- mods/ra/maps/soviet-06b/soviet06b.lua | 62 ++--- mods/ra/maps/soviet-07/soviet07.lua | 228 +++++++++--------- mods/ra/maps/soviet-10/soviet10.lua | 28 +-- .../soviet-soldier-volkov-n-chitzkoi-AI.lua | 12 +- .../soviet-soldier-volkov-n-chitzkoi.lua | 106 ++++---- mods/ra/maps/survival01/survival01.lua | 146 +++++------ mods/ra/maps/survival02/survival02.lua | 109 +++++---- .../maps/top-o-the-world/top-o-the-world.lua | 82 +++---- 122 files changed, 3006 insertions(+), 3012 deletions(-) diff --git a/mods/cnc/maps/gdi04a/gdi04a.lua b/mods/cnc/maps/gdi04a/gdi04a.lua index 5231fcc5b4..7b60976fe5 100644 --- a/mods/cnc/maps/gdi04a/gdi04a.lua +++ b/mods/cnc/maps/gdi04a/gdi04a.lua @@ -95,7 +95,7 @@ Tick = function() end SetupWorld = function() - Utils.Do(Nod.GetGroundAttackers(Nod), function(unit) + Utils.Do(Nod.GetGroundAttackers(), function(unit) Trigger.OnKilled(unit, NodUnitKilled) end) diff --git a/mods/cnc/maps/gdi07/gdi07.lua b/mods/cnc/maps/gdi07/gdi07.lua index 7918c5b34d..946ef2e33c 100644 --- a/mods/cnc/maps/gdi07/gdi07.lua +++ b/mods/cnc/maps/gdi07/gdi07.lua @@ -103,7 +103,7 @@ AttackPlayer = function() Utils.Do(NodBase, function(actor) Trigger.OnRemovedFromWorld(actor, function() - Utils.Do(Nod.GetGroundAttackers(Nod), IdleHunt) + Utils.Do(Nod.GetGroundAttackers(), IdleHunt) end) end) diff --git a/mods/cnc/maps/nod02a/nod02a.lua b/mods/cnc/maps/nod02a/nod02a.lua index daac2f2858..ff48fbcdd6 100644 --- a/mods/cnc/maps/nod02a/nod02a.lua +++ b/mods/cnc/maps/nod02a/nod02a.lua @@ -32,7 +32,7 @@ WorldLoaded = function() InitObjectives(Nod) GDIObjective = AddPrimaryObjective(GDI, "") - BuildBase = AddPrimaryObjective(Nod, "build-base") + BuildBaseObjective = AddPrimaryObjective(Nod, "build-base") DestroyGDI = AddPrimaryObjective(Nod, "destroy-gdi-units") Utils.Do({ Refinery, Yard }, function(actor) @@ -97,7 +97,7 @@ Tick = function() Nod.MarkCompletedObjective(DestroyGDI) end - if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(BuildBase) and CheckForBase(Nod, NodBaseBuildings) then - Nod.MarkCompletedObjective(BuildBase) + if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(BuildBaseObjective) and CheckForBase(Nod, NodBaseBuildings) then + Nod.MarkCompletedObjective(BuildBaseObjective) end end diff --git a/mods/cnc/maps/nod02b/nod02b.lua b/mods/cnc/maps/nod02b/nod02b.lua index 1aca4fbb02..7c9e90be9a 100644 --- a/mods/cnc/maps/nod02b/nod02b.lua +++ b/mods/cnc/maps/nod02b/nod02b.lua @@ -38,7 +38,7 @@ WorldLoaded = function() InitObjectives(Nod) - BuildBase = AddPrimaryObjective(Nod, "build-base") + BuildBaseObjective = AddPrimaryObjective(Nod, "build-base") DestroyGDI = AddPrimaryObjective(Nod, "destroy-gdi-base") GDIObjective = AddPrimaryObjective(GDI, "") @@ -111,7 +111,7 @@ Tick = function() GDI.MarkCompletedObjective(GDIObjective) end - if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(BuildBase) and CheckForBase(Nod, NodBaseBuildings) then - Nod.MarkCompletedObjective(BuildBase) + if DateTime.GameTime % DateTime.Seconds(1) == 0 and not Nod.IsObjectiveCompleted(BuildBaseObjective) and CheckForBase(Nod, NodBaseBuildings) then + Nod.MarkCompletedObjective(BuildBaseObjective) end end diff --git a/mods/cnc/maps/nod04b/nod04b.lua b/mods/cnc/maps/nod04b/nod04b.lua index 8fc0ee3346..fbbf62f444 100644 --- a/mods/cnc/maps/nod04b/nod04b.lua +++ b/mods/cnc/maps/nod04b/nod04b.lua @@ -68,7 +68,7 @@ SendApcReinforcements = function() end end -CreateCivilians = function(actor, discoverer) +CreateCivilians = function() Utils.Do(NodCiviliansActors, function(actor) actor.Owner = Nod end) @@ -96,7 +96,7 @@ WorldLoaded = function() Trigger.OnAnyKilled(Atk6ActorTriggerActivator, function() Reinforcements.ReinforceWithTransport(GDI, "apc", Atk6Units, Atk6WaypointsPart1, Atk6WaypointsPart2, - function(transport, cargo) + function(_, cargo) Utils.Do(cargo, IdleHunt) end, IdleHunt) end) diff --git a/mods/cnc/maps/nod07b/nod07b.lua b/mods/cnc/maps/nod07b/nod07b.lua index a4c192c5f2..f28b77414c 100644 --- a/mods/cnc/maps/nod07b/nod07b.lua +++ b/mods/cnc/maps/nod07b/nod07b.lua @@ -47,7 +47,7 @@ SamSiteGoal = 3 CaptureStructures = function(actor) for i = 1, #WhitelistedStructures do - structures = Nod.GetActorsByType(WhitelistedStructures[i]) + local structures = Nod.GetActorsByType(WhitelistedStructures[i]) if #structures > 0 and not actor.IsDead and not structures[1].IsDead then actor.Capture(structures[1]) return diff --git a/mods/d2k/maps/atreides-01a/atreides01a.lua b/mods/d2k/maps/atreides-01a/atreides01a.lua index b1e67178d3..6d633115ff 100644 --- a/mods/d2k/maps/atreides-01a/atreides01a.lua +++ b/mods/d2k/maps/atreides-01a/atreides01a.lua @@ -61,16 +61,16 @@ Messages = CachedResources = -1 Tick = function() - if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then - player.MarkCompletedObjective(KillHarkonnen) + if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then + Atreides.MarkCompletedObjective(KillHarkonnen) end - if player.Resources > SpiceToHarvest - 1 then - player.MarkCompletedObjective(GatherSpice) + if Atreides.Resources > SpiceToHarvest - 1 then + Atreides.MarkCompletedObjective(GatherSpice) end -- player has no Wind Trap - if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if (Atreides.PowerProvided <= 20 or Atreides.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then HasPower = false Media.DisplayMessage(Messages[2], Mentat) else @@ -78,40 +78,40 @@ Tick = function() end -- player has no Refinery and no Silos - if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if HasPower and Atreides.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then Media.DisplayMessage(Messages[3], Mentat) end - if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if HasPower and Atreides.Resources > Atreides.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then Media.DisplayMessage(Messages[4], Mentat) end - if player.Resources ~= CachedResources then - local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } + if Atreides.Resources ~= CachedResources then + local parameters = { ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest } local harvestedResources = UserInterface.Translate("harvested-resources", parameters) UserInterface.SetMissionText(harvestedResources) - CachedResources = player.Resources + CachedResources = Atreides.Resources end end WorldLoaded = function() - player = Player.GetPlayer("Atreides") - harkonnen = Player.GetPlayer("Harkonnen") + Atreides = Player.GetPlayer("Atreides") + Harkonnen = Player.GetPlayer("Harkonnen") SpiceToHarvest = ToHarvest[Difficulty] - InitObjectives(player) - KillAtreides = AddPrimaryObjective(harkonnen, "") + InitObjectives(Atreides) + KillAtreides = AddPrimaryObjective(Harkonnen, "") local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) - GatherSpice = AddPrimaryObjective(player, harvestSpice) - KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements") + GatherSpice = AddPrimaryObjective(Atreides, harvestSpice) + KillHarkonnen = AddSecondaryObjective(Atreides, "eliminate-harkonnen-units-reinforcements") local checkResourceCapacity = function() Trigger.AfterDelay(0, function() - if player.ResourceCapacity < SpiceToHarvest then + if Atreides.ResourceCapacity < SpiceToHarvest then Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Trigger.AfterDelay(DateTime.Seconds(3), function() - harkonnen.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end) return true @@ -126,15 +126,15 @@ WorldLoaded = function() return end - local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) + local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Atreides end) if #refs == 0 then - harkonnen.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) else Trigger.OnAllRemovedFromWorld(refs, function() - harkonnen.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end) - local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) + local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Atreides end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) end @@ -143,8 +143,8 @@ WorldLoaded = function() Media.DisplayMessage(Messages[1], Mentat) Trigger.AfterDelay(DateTime.Seconds(25), function() - Media.PlaySpeechNotification(player, "Reinforce") - Reinforcements.Reinforce(player, AtreidesReinforcements, AtreidesEntryPath) + Media.PlaySpeechNotification(Atreides, "Reinforce") + Reinforcements.Reinforce(Atreides, AtreidesReinforcements, AtreidesEntryPath) end) WavesLeft = HarkonnenAttackWaves[Difficulty] @@ -158,7 +158,7 @@ SendReinforcements = function() if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end Trigger.AfterDelay(delay, function() - Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt) + Reinforcements.Reinforce(Harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt) WavesLeft = WavesLeft - 1 if WavesLeft == 0 then diff --git a/mods/d2k/maps/atreides-01b/atreides01b.lua b/mods/d2k/maps/atreides-01b/atreides01b.lua index ab7213fc3b..e7210d2a3b 100644 --- a/mods/d2k/maps/atreides-01b/atreides01b.lua +++ b/mods/d2k/maps/atreides-01b/atreides01b.lua @@ -61,16 +61,16 @@ Messages = CachedResources = -1 Tick = function() - if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then - player.MarkCompletedObjective(KillHarkonnen) + if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then + Atreides.MarkCompletedObjective(KillHarkonnen) end - if player.Resources > SpiceToHarvest - 1 then - player.MarkCompletedObjective(GatherSpice) + if Atreides.Resources > SpiceToHarvest - 1 then + Atreides.MarkCompletedObjective(GatherSpice) end -- player has no Wind Trap - if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if (Atreides.PowerProvided <= 20 or Atreides.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then HasPower = false Media.DisplayMessage(Messages[2], Mentat) else @@ -78,40 +78,40 @@ Tick = function() end -- player has no Refinery and no Silos - if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if HasPower and Atreides.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then Media.DisplayMessage(Messages[3], Mentat) end - if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if HasPower and Atreides.Resources > Atreides.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then Media.DisplayMessage(Messages[4], Mentat) end - if player.Resources ~= CachedResources then - local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } + if Atreides.Resources ~= CachedResources then + local parameters = { ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest } local harvestedResources = UserInterface.Translate("harvested-resources", parameters) UserInterface.SetMissionText(harvestedResources) - CachedResources = player.Resources + CachedResources = Atreides.Resources end end WorldLoaded = function() - player = Player.GetPlayer("Atreides") - harkonnen = Player.GetPlayer("Harkonnen") + Atreides = Player.GetPlayer("Atreides") + Harkonnen = Player.GetPlayer("Harkonnen") SpiceToHarvest = ToHarvest[Difficulty] - InitObjectives(player) - KillAtreides = AddPrimaryObjective(harkonnen, "") + InitObjectives(Atreides) + KillAtreides = AddPrimaryObjective(Harkonnen, "") local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) - GatherSpice = AddPrimaryObjective(player, harvestSpice) - KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements") + GatherSpice = AddPrimaryObjective(Atreides, harvestSpice) + KillHarkonnen = AddSecondaryObjective(Atreides, "eliminate-harkonnen-units-reinforcements") local checkResourceCapacity = function() Trigger.AfterDelay(0, function() - if player.ResourceCapacity < SpiceToHarvest then + if Atreides.ResourceCapacity < SpiceToHarvest then Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Trigger.AfterDelay(DateTime.Seconds(3), function() - harkonnen.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end) return true @@ -126,15 +126,15 @@ WorldLoaded = function() return end - local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) + local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Atreides end) if #refs == 0 then - harkonnen.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) else Trigger.OnAllRemovedFromWorld(refs, function() - harkonnen.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end) - local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) + local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Atreides end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) end @@ -143,8 +143,8 @@ WorldLoaded = function() Media.DisplayMessage(Messages[1], Mentat) Trigger.AfterDelay(DateTime.Seconds(25), function() - Media.PlaySpeechNotification(player, "Reinforce") - Reinforcements.Reinforce(player, AtreidesReinforcements, AtreidesEntryPath) + Media.PlaySpeechNotification(Atreides, "Reinforce") + Reinforcements.Reinforce(Atreides, AtreidesReinforcements, AtreidesEntryPath) end) WavesLeft = HarkonnenAttackWaves[Difficulty] @@ -158,7 +158,7 @@ SendReinforcements = function() if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end Trigger.AfterDelay(delay, function() - Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt) + Reinforcements.Reinforce(Harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt) WavesLeft = WavesLeft - 1 if WavesLeft == 0 then diff --git a/mods/d2k/maps/atreides-02a/atreides02a-AI.lua b/mods/d2k/maps/atreides-02a/atreides02a-AI.lua index dbabe3ad0b..5248c060db 100644 --- a/mods/d2k/maps/atreides-02a/atreides02a-AI.lua +++ b/mods/d2k/maps/atreides-02a/atreides02a-AI.lua @@ -24,11 +24,11 @@ AttackDelays = HarkonnenInfantryTypes = { "light_inf" } ActivateAI = function() - IdlingUnits[harkonnen] = { } - DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) + IdlingUnits[Harkonnen] = { } + DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local toBuild = function() return HarkonnenInfantryTypes end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 - ProduceUnits(harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/atreides-02a/atreides02a.lua b/mods/d2k/maps/atreides-02a/atreides02a.lua index 356fffa8d3..8e7fc90a40 100644 --- a/mods/d2k/maps/atreides-02a/atreides02a.lua +++ b/mods/d2k/maps/atreides-02a/atreides02a.lua @@ -65,31 +65,31 @@ HarkonnenAttackWaves = } Tick = function() - if player.HasNoRequiredUnits() then - harkonnen.MarkCompletedObjective(KillAtreides) + if Atreides.HasNoRequiredUnits() then + Harkonnen.MarkCompletedObjective(KillAtreides) end - if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then + if Harkonnen.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillHarkonnen) then Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) - player.MarkCompletedObjective(KillHarkonnen) + Atreides.MarkCompletedObjective(KillHarkonnen) end end WorldLoaded = function() - harkonnen = Player.GetPlayer("Harkonnen") - player = Player.GetPlayer("Atreides") + Harkonnen = Player.GetPlayer("Harkonnen") + Atreides = Player.GetPlayer("Atreides") - InitObjectives(player) - KillAtreides = AddPrimaryObjective(harkonnen, "") - KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces") + InitObjectives(Atreides) + KillAtreides = AddPrimaryObjective(Harkonnen, "") + KillHarkonnen = AddPrimaryObjective(Atreides, "destroy-harkonnen-forces") Camera.Position = AConyard.CenterPosition Trigger.OnAllKilled(HarkonnenBase, function() - Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) + Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt) end) local path = function() return Utils.Random(HarkonnenAttackPaths) end - SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty]) + SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty]) Trigger.AfterDelay(0, ActivateAI) end diff --git a/mods/d2k/maps/atreides-02b/atreides02b-AI.lua b/mods/d2k/maps/atreides-02b/atreides02b-AI.lua index dbabe3ad0b..5248c060db 100644 --- a/mods/d2k/maps/atreides-02b/atreides02b-AI.lua +++ b/mods/d2k/maps/atreides-02b/atreides02b-AI.lua @@ -24,11 +24,11 @@ AttackDelays = HarkonnenInfantryTypes = { "light_inf" } ActivateAI = function() - IdlingUnits[harkonnen] = { } - DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) + IdlingUnits[Harkonnen] = { } + DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local toBuild = function() return HarkonnenInfantryTypes end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 - ProduceUnits(harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/atreides-02b/atreides02b.lua b/mods/d2k/maps/atreides-02b/atreides02b.lua index d0fce61838..c92ad6331c 100644 --- a/mods/d2k/maps/atreides-02b/atreides02b.lua +++ b/mods/d2k/maps/atreides-02b/atreides02b.lua @@ -65,31 +65,31 @@ HarkonnenAttackWaves = } Tick = function() - if player.HasNoRequiredUnits() then - harkonnen.MarkCompletedObjective(KillAtreides) + if Atreides.HasNoRequiredUnits() then + Harkonnen.MarkCompletedObjective(KillAtreides) end - if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then + if Harkonnen.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillHarkonnen) then Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) - player.MarkCompletedObjective(KillHarkonnen) + Atreides.MarkCompletedObjective(KillHarkonnen) end end WorldLoaded = function() - harkonnen = Player.GetPlayer("Harkonnen") - player = Player.GetPlayer("Atreides") + Harkonnen = Player.GetPlayer("Harkonnen") + Atreides = Player.GetPlayer("Atreides") - InitObjectives(player) - KillAtreides = AddPrimaryObjective(harkonnen, "") - KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces") + InitObjectives(Atreides) + KillAtreides = AddPrimaryObjective(Harkonnen, "") + KillHarkonnen = AddPrimaryObjective(Atreides, "destroy-harkonnen-forces") Camera.Position = AConyard.CenterPosition Trigger.OnAllKilled(HarkonnenBase, function() - Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) + Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt) end) local path = function() return Utils.Random(HarkonnenAttackPaths) end - SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty]) + SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty]) Trigger.AfterDelay(0, ActivateAI) end diff --git a/mods/d2k/maps/atreides-03a/atreides03a-AI.lua b/mods/d2k/maps/atreides-03a/atreides03a-AI.lua index 3dc6330663..755fb66121 100644 --- a/mods/d2k/maps/atreides-03a/atreides03a-AI.lua +++ b/mods/d2k/maps/atreides-03a/atreides03a-AI.lua @@ -24,16 +24,16 @@ OrdosInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "troope OrdosVehicleTypes = { "raider", "raider", "quad" } InitAIUnits = function() - IdlingUnits[ordos] = Reinforcements.Reinforce(ordos, InitialOrdosReinforcements, OrdosPaths[2]) - IdlingUnits[ordos][#IdlingUnits + 1] = OTrooper1 - IdlingUnits[ordos][#IdlingUnits + 1] = OTrooper2 - IdlingUnits[ordos][#IdlingUnits + 1] = ORaider + IdlingUnits[Ordos] = Reinforcements.Reinforce(Ordos, InitialOrdosReinforcements, OrdosPaths[2]) + IdlingUnits[Ordos][#IdlingUnits + 1] = OTrooper1 + IdlingUnits[Ordos][#IdlingUnits + 1] = OTrooper2 + IdlingUnits[Ordos][#IdlingUnits + 1] = ORaider - DefendAndRepairBase(ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(Ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty]) end ActivateAI = function() - LastHarvesterEaten[ordos] = true + LastHarvesterEaten[Ordos] = true Trigger.AfterDelay(0, InitAIUnits) OConyard.Produce(AtreidesUpgrades[1]) @@ -46,7 +46,7 @@ ActivateAI = function() -- Finish the upgrades first before trying to build something Trigger.AfterDelay(DateTime.Seconds(14), function() - ProduceUnits(ordos, OBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos, OLightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Ordos, OBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Ordos, OLightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) end) end diff --git a/mods/d2k/maps/atreides-03a/atreides03a.lua b/mods/d2k/maps/atreides-03a/atreides03a.lua index b2f24dbf00..26748a198b 100644 --- a/mods/d2k/maps/atreides-03a/atreides03a.lua +++ b/mods/d2k/maps/atreides-03a/atreides03a.lua @@ -78,65 +78,65 @@ AtreidesBaseBuildings = { "barracks", "light_factory" } AtreidesUpgrades = { "upgrade.barracks", "upgrade.light" } MessageCheck = function(index) - return #player.GetActorsByType(AtreidesBaseBuildings[index]) > 0 and not player.HasPrerequisites({ AtreidesUpgrades[index] }) + return #Atreides.GetActorsByType(AtreidesBaseBuildings[index]) > 0 and not Atreides.HasPrerequisites({ AtreidesUpgrades[index] }) end CachedResources = -1 Tick = function() - if player.HasNoRequiredUnits() then - ordos.MarkCompletedObjective(KillAtreides) + if Atreides.HasNoRequiredUnits() then + Ordos.MarkCompletedObjective(KillAtreides) end - if ordos.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillOrdos) then + if Ordos.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillOrdos) then Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat) - player.MarkCompletedObjective(KillOrdos) + Atreides.MarkCompletedObjective(KillOrdos) end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos] then - local units = ordos.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Ordos] then + local units = Ordos.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[ordos] = false - ProtectHarvester(units[1], ordos, AttackGroupSize[Difficulty]) + LastHarvesterEaten[Ordos] = false + ProtectHarvester(units[1], Ordos, AttackGroupSize[Difficulty]) end end - if player.Resources > SpiceToHarvest - 1 then - player.MarkCompletedObjective(GatherSpice) + if Atreides.Resources > SpiceToHarvest - 1 then + Atreides.MarkCompletedObjective(GatherSpice) end if DateTime.GameTime % DateTime.Seconds(32) == 0 and (MessageCheck(1) or MessageCheck(2)) then Media.DisplayMessage(UserInterface.Translate("upgrade-barracks-light-factory"), Mentat) end - if player.Resources ~= CachedResources then - local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } + if Atreides.Resources ~= CachedResources then + local parameters = { ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest } local harvestedResources = UserInterface.Translate("harvested-resources", parameters) UserInterface.SetMissionText(harvestedResources) - CachedResources = player.Resources + CachedResources = Atreides.Resources end end WorldLoaded = function() - ordos = Player.GetPlayer("Ordos") - player = Player.GetPlayer("Atreides") + Ordos = Player.GetPlayer("Ordos") + Atreides = Player.GetPlayer("Atreides") SpiceToHarvest = ToHarvest[Difficulty] - InitObjectives(player) - KillAtreides = AddPrimaryObjective(ordos, "") + InitObjectives(Atreides) + KillAtreides = AddPrimaryObjective(Ordos, "") local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) - GatherSpice = AddPrimaryObjective(player, harvestSpice) - KillOrdos = AddSecondaryObjective(player, "eliminate-ordos-units-reinforcements") + GatherSpice = AddPrimaryObjective(Atreides, harvestSpice) + KillOrdos = AddSecondaryObjective(Atreides, "eliminate-ordos-units-reinforcements") Camera.Position = AConyard.CenterPosition local checkResourceCapacity = function() Trigger.AfterDelay(0, function() - if player.ResourceCapacity < SpiceToHarvest then + if Atreides.ResourceCapacity < SpiceToHarvest then Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Trigger.AfterDelay(DateTime.Seconds(3), function() - ordos.MarkCompletedObjective(KillAtreides) + Ordos.MarkCompletedObjective(KillAtreides) end) return true @@ -151,31 +151,31 @@ WorldLoaded = function() return end - local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) + local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Atreides end) if #refs == 0 then - ordos.MarkCompletedObjective(KillAtreides) + Ordos.MarkCompletedObjective(KillAtreides) else Trigger.OnAllRemovedFromWorld(refs, function() - ordos.MarkCompletedObjective(KillAtreides) + Ordos.MarkCompletedObjective(KillAtreides) end) - local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) + local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Atreides end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) end end) Trigger.OnAllKilled(OrdosBase, function() - Utils.Do(ordos.GetGroundAttackers(), IdleHunt) + Utils.Do(Ordos.GetGroundAttackers(), IdleHunt) end) local path = function() return OrdosPaths[1] end - local waveCondition = function() return player.IsObjectiveCompleted(KillOrdos) end - SendCarryallReinforcements(ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition) + local waveCondition = function() return Atreides.IsObjectiveCompleted(KillOrdos) end + SendCarryallReinforcements(Ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition) ActivateAI() Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function() - Media.PlaySpeechNotification(player, "Reinforce") - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] }) + Media.PlaySpeechNotification(Atreides, "Reinforce") + Reinforcements.ReinforceWithTransport(Atreides, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] }) end) end diff --git a/mods/d2k/maps/atreides-03b/atreides03b-AI.lua b/mods/d2k/maps/atreides-03b/atreides03b-AI.lua index bbcf27821b..174e9102df 100644 --- a/mods/d2k/maps/atreides-03b/atreides03b-AI.lua +++ b/mods/d2k/maps/atreides-03b/atreides03b-AI.lua @@ -24,12 +24,12 @@ AttackDelays = OrdosInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "trooper" } InitAIUnits = function() - IdlingUnits[ordos] = Reinforcements.Reinforce(ordos, InitialOrdosReinforcements, OrdosPaths[2]) - DefendAndRepairBase(ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty]) + IdlingUnits[Ordos] = Reinforcements.Reinforce(Ordos, InitialOrdosReinforcements, OrdosPaths[2]) + DefendAndRepairBase(Ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty]) end ActivateAI = function() - LastHarvesterEaten[ordos] = true + LastHarvesterEaten[Ordos] = true Trigger.AfterDelay(0, InitAIUnits) OConyard.Produce(AtreidesUpgrades[1]) @@ -40,6 +40,6 @@ ActivateAI = function() -- Finish the upgrades first before trying to build something Trigger.AfterDelay(DateTime.Seconds(14), function() - ProduceUnits(ordos, OBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Ordos, OBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) end) end diff --git a/mods/d2k/maps/atreides-03b/atreides03b.lua b/mods/d2k/maps/atreides-03b/atreides03b.lua index 2b5937520a..d012402615 100644 --- a/mods/d2k/maps/atreides-03b/atreides03b.lua +++ b/mods/d2k/maps/atreides-03b/atreides03b.lua @@ -78,65 +78,65 @@ AtreidesBaseBuildings = { "barracks", "light_factory" } AtreidesUpgrades = { "upgrade.barracks", "upgrade.light" } MessageCheck = function(index) - return #player.GetActorsByType(AtreidesBaseBuildings[index]) > 0 and not player.HasPrerequisites({ AtreidesUpgrades[index] }) + return #Atreides.GetActorsByType(AtreidesBaseBuildings[index]) > 0 and not Atreides.HasPrerequisites({ AtreidesUpgrades[index] }) end CachedResources = -1 Tick = function() - if player.HasNoRequiredUnits() then - ordos.MarkCompletedObjective(KillAtreides) + if Atreides.HasNoRequiredUnits() then + Ordos.MarkCompletedObjective(KillAtreides) end - if ordos.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillOrdos) then + if Ordos.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillOrdos) then Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat) - player.MarkCompletedObjective(KillOrdos) + Atreides.MarkCompletedObjective(KillOrdos) end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos] then - local units = ordos.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Ordos] then + local units = Ordos.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[ordos] = false - ProtectHarvester(units[1], ordos, AttackGroupSize[Difficulty]) + LastHarvesterEaten[Ordos] = false + ProtectHarvester(units[1], Ordos, AttackGroupSize[Difficulty]) end end - if player.Resources > SpiceToHarvest - 1 then - player.MarkCompletedObjective(GatherSpice) + if Atreides.Resources > SpiceToHarvest - 1 then + Atreides.MarkCompletedObjective(GatherSpice) end if DateTime.GameTime % DateTime.Seconds(32) == 0 and (MessageCheck(1) or MessageCheck(2)) then Media.DisplayMessage(UserInterface.Translate("upgrade-barracks-light-factory"), Mentat) end - if player.Resources ~= CachedResources then - local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } + if Atreides.Resources ~= CachedResources then + local parameters = { ["harvested"] = Atreides.Resources, ["goal"] = SpiceToHarvest } local harvestedResources = UserInterface.Translate("harvested-resources", parameters) UserInterface.SetMissionText(harvestedResources) - CachedResources = player.Resources + CachedResources = Atreides.Resources end end WorldLoaded = function() - ordos = Player.GetPlayer("Ordos") - player = Player.GetPlayer("Atreides") + Ordos = Player.GetPlayer("Ordos") + Atreides = Player.GetPlayer("Atreides") SpiceToHarvest = ToHarvest[Difficulty] - InitObjectives(player) - KillAtreides = AddPrimaryObjective(ordos, "") + InitObjectives(Atreides) + KillAtreides = AddPrimaryObjective(Ordos, "") local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) - GatherSpice = AddPrimaryObjective(player, harvestSpice) - KillOrdos = AddSecondaryObjective(player, "eliminate-ordos-units-reinforcements") + GatherSpice = AddPrimaryObjective(Atreides, harvestSpice) + KillOrdos = AddSecondaryObjective(Atreides, "eliminate-ordos-units-reinforcements") Camera.Position = AConyard.CenterPosition local checkResourceCapacity = function() Trigger.AfterDelay(0, function() - if player.ResourceCapacity < SpiceToHarvest then + if Atreides.ResourceCapacity < SpiceToHarvest then Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Trigger.AfterDelay(DateTime.Seconds(3), function() - ordos.MarkCompletedObjective(KillAtreides) + Ordos.MarkCompletedObjective(KillAtreides) end) return true @@ -151,31 +151,31 @@ WorldLoaded = function() return end - local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) + local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Atreides end) if #refs == 0 then - ordos.MarkCompletedObjective(KillAtreides) + Ordos.MarkCompletedObjective(KillAtreides) else Trigger.OnAllRemovedFromWorld(refs, function() - ordos.MarkCompletedObjective(KillAtreides) + Ordos.MarkCompletedObjective(KillAtreides) end) - local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) + local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Atreides end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) end end) Trigger.OnAllKilled(OrdosBase, function() - Utils.Do(ordos.GetGroundAttackers(), IdleHunt) + Utils.Do(Ordos.GetGroundAttackers(), IdleHunt) end) local path = function() return OrdosPaths[1] end - local waveCondition = function() return player.IsObjectiveCompleted(KillOrdos) end - SendCarryallReinforcements(ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition) + local waveCondition = function() return Atreides.IsObjectiveCompleted(KillOrdos) end + SendCarryallReinforcements(Ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition) ActivateAI() Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function() - Media.PlaySpeechNotification(player, "Reinforce") - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] }) + Media.PlaySpeechNotification(Atreides, "Reinforce") + Reinforcements.ReinforceWithTransport(Atreides, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] }) end) end diff --git a/mods/d2k/maps/atreides-04/atreides04-AI.lua b/mods/d2k/maps/atreides-04/atreides04-AI.lua index 949ca6ff9e..602442f8f6 100644 --- a/mods/d2k/maps/atreides-04/atreides04-AI.lua +++ b/mods/d2k/maps/atreides-04/atreides04-AI.lua @@ -46,13 +46,13 @@ SendAttack = function(owner, size) end InitAIUnits = function() - IdlingUnits[harkonnen] = Reinforcements.Reinforce(harkonnen, InitialHarkonnenReinforcements, HarkonnenPaths[1]) + IdlingUnits[Harkonnen] = Reinforcements.Reinforce(Harkonnen, InitialHarkonnenReinforcements, HarkonnenPaths[1]) - DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) end ActivateAI = function() - LastHarvesterEaten[harkonnen] = true + LastHarvesterEaten[Harkonnen] = true InitAIUnits() FremenProduction() @@ -61,6 +61,6 @@ ActivateAI = function() local tanksToBuild = function() return HarkonnenTankType end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 - ProduceUnits(harkonnen, HarkonnenBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(harkonnen, HarkonnenHeavyFact, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Harkonnen, HarkonnenBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Harkonnen, HarkonnenHeavyFact, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/atreides-04/atreides04.lua b/mods/d2k/maps/atreides-04/atreides04.lua index 9caa1f95dc..c265e84c41 100644 --- a/mods/d2k/maps/atreides-04/atreides04.lua +++ b/mods/d2k/maps/atreides-04/atreides04.lua @@ -96,30 +96,30 @@ FremenProduction = function() end local delay = Utils.RandomInteger(FremenInterval[Difficulty][1], FremenInterval[Difficulty][2] + 1) - fremen.Build({ "nsfremen" }, function() + Fremen.Build({ "nsfremen" }, function() Trigger.AfterDelay(delay, FremenProduction) end) end AttackNotifier = 0 Tick = function() - if player.HasNoRequiredUnits() then - harkonnen.MarkCompletedObjective(KillAtreides) + if Atreides.HasNoRequiredUnits() then + Harkonnen.MarkCompletedObjective(KillAtreides) end - if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then + if Harkonnen.HasNoRequiredUnits() and not Atreides.IsObjectiveCompleted(KillHarkonnen) then Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) - player.MarkCompletedObjective(KillHarkonnen) - player.MarkCompletedObjective(ProtectFremen) - player.MarkCompletedObjective(KeepIntegrity) + Atreides.MarkCompletedObjective(KillHarkonnen) + Atreides.MarkCompletedObjective(ProtectFremen) + Atreides.MarkCompletedObjective(KeepIntegrity) end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[harkonnen] then - local units = harkonnen.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Harkonnen] then + local units = Harkonnen.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[harkonnen] = false - ProtectHarvester(units[1], harkonnen, AttackGroupSize[Difficulty]) + LastHarvesterEaten[Harkonnen] = false + ProtectHarvester(units[1], Harkonnen, AttackGroupSize[Difficulty]) end end @@ -127,50 +127,50 @@ Tick = function() AttackNotifier = AttackNotifier - 1 local integrity = math.floor((Sietch.Health * 100) / Sietch.MaxHealth) SiegeIntegrity = UserInterface.Translate("sietch-integrity", { ["integrity"] = integrity }) - UserInterface.SetMissionText(SiegeIntegrity, player.Color) + UserInterface.SetMissionText(SiegeIntegrity, Atreides.Color) if integrity < IntegrityLevel[Difficulty] then - player.MarkFailedObjective(KeepIntegrity) + Atreides.MarkFailedObjective(KeepIntegrity) end end end WorldLoaded = function() - harkonnen = Player.GetPlayer("Harkonnen") - fremen = Player.GetPlayer("Fremen") - player = Player.GetPlayer("Atreides") + Harkonnen = Player.GetPlayer("Harkonnen") + Fremen = Player.GetPlayer("Fremen") + Atreides = Player.GetPlayer("Atreides") - InitObjectives(player) - KillAtreides = AddPrimaryObjective(harkonnen, "") - ProtectFremen = AddPrimaryObjective(player, "protect-fremen-sietch") - KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen") + InitObjectives(Atreides) + KillAtreides = AddPrimaryObjective(Harkonnen, "") + ProtectFremen = AddPrimaryObjective(Atreides, "protect-fremen-sietch") + KillHarkonnen = AddPrimaryObjective(Atreides, "destroy-harkonnen") local keepSietchIntact = UserInterface.Translate("keep-sietch-intact", { ["integrity"] = IntegrityLevel[Difficulty] }) - KeepIntegrity = AddPrimaryObjective(player, keepSietchIntact) + KeepIntegrity = AddPrimaryObjective(Atreides, keepSietchIntact) Camera.Position = AConyard.CenterPosition HarkonnenAttackLocation = AConyard.Location Trigger.AfterDelay(DateTime.Seconds(2), function() - Beacon.New(player, Sietch.CenterPosition + WVec.New(0, 1024, 0)) + Beacon.New(Atreides, Sietch.CenterPosition + WVec.New(0, 1024, 0)) Media.DisplayMessage(UserInterface.Translate("fremen-sietch-southeast"), Mentat) end) Trigger.OnAllKilledOrCaptured(HarkonnenBase, function() - Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) + Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt) end) Trigger.OnKilled(Sietch, function() - Actor.Create("invisibleBlocker", true, { Owner = fremen, Location = CPos.New(62, 59) }) - UserInterface.SetMissionText(UserInterface.Translate("sietch-destroyed"), player.Color) - player.MarkFailedObjective(ProtectFremen) + Actor.Create("invisibleBlocker", true, { Owner = Fremen, Location = CPos.New(62, 59) }) + UserInterface.SetMissionText(UserInterface.Translate("sietch-destroyed"), Atreides.Color) + Atreides.MarkFailedObjective(ProtectFremen) end) Trigger.OnDamaged(Sietch, function() if AttackNotifier <= 0 then AttackNotifier = DateTime.Seconds(10) - Beacon.New(player, Sietch.CenterPosition + WVec.New(0, 1024, 0), DateTime.Seconds(7)) + Beacon.New(Atreides, Sietch.CenterPosition + WVec.New(0, 1024, 0), DateTime.Seconds(7)) Media.DisplayMessage(UserInterface.Translate("fremen-sietch-under-attack"), Mentat) - local defenders = fremen.GetGroundAttackers() + local defenders = Fremen.GetGroundAttackers() if #defenders > 0 then Utils.Do(defenders, function(unit) unit.Guard(Sietch) @@ -180,35 +180,35 @@ WorldLoaded = function() end) local path = function() return Utils.Random(HarkonnenPaths) end - local waveCondition = function() return player.IsObjectiveCompleted(KillHarkonnen) end + local waveCondition = function() return Atreides.IsObjectiveCompleted(KillHarkonnen) end local huntFunction = function(unit) unit.AttackMove(HarkonnenAttackLocation) IdleHunt(unit) end - SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition, huntFunction) + SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition, huntFunction) - Actor.Create("upgrade.barracks", true, { Owner = harkonnen }) + Actor.Create("upgrade.barracks", true, { Owner = Harkonnen }) Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(DateTime.Seconds(50), function() - Media.PlaySpeechNotification(player, "Reinforce") - Reinforcements.Reinforce(player, AtreidesReinforcements[1], AtreidesPath) + Media.PlaySpeechNotification(Atreides, "Reinforce") + Reinforcements.Reinforce(Atreides, AtreidesReinforcements[1], AtreidesPath) end) Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(40), function() - Media.PlaySpeechNotification(player, "Reinforce") - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", AtreidesReinforcements[2], AtreidesPath, { AtreidesPath[1] }) + Media.PlaySpeechNotification(Atreides, "Reinforce") + Reinforcements.ReinforceWithTransport(Atreides, "carryall.reinforce", AtreidesReinforcements[2], AtreidesPath, { AtreidesPath[1] }) end) Trigger.OnEnteredProximityTrigger(HarkonnenRally1.CenterPosition, WDist.New(6 * 1024), function(a, id) - if a.Owner == player then + if a.Owner == Atreides then Trigger.RemoveProximityTrigger(id) - local units = Reinforcements.Reinforce(harkonnen, { "light_inf", "combat_tank_h", "trike" }, HarkonnenPaths[1]) + local units = Reinforcements.Reinforce(Harkonnen, { "light_inf", "combat_tank_h", "trike" }, HarkonnenPaths[1]) Utils.Do(units, IdleHunt) end end) Trigger.OnExitedProximityTrigger(Sietch.CenterPosition, WDist.New(10.5 * 1024), function(a, id) - if a.Owner == fremen and not a.IsDead then + if a.Owner == Fremen and not a.IsDead then a.AttackMove(FremenRally.Location) Trigger.OnIdle(a, function() if a.Location.X < 54 or a.Location.Y < 54 then diff --git a/mods/d2k/maps/atreides-05/atreides05-AI.lua b/mods/d2k/maps/atreides-05/atreides05-AI.lua index cb2de3f5a3..b969f02851 100644 --- a/mods/d2k/maps/atreides-05/atreides05-AI.lua +++ b/mods/d2k/maps/atreides-05/atreides05-AI.lua @@ -26,44 +26,44 @@ HarkonnenVehicleTypes = { "trike", "trike", "trike", "quad", "quad" } HarkonnenTankType = { "combat_tank_h" } InitAIUnits = function() - IdlingUnits[harkonnen] = Reinforcements.ReinforceWithTransport(harkonnen, "carryall.reinforce", InitialHarkonnenReinforcements, HarkonnenPaths[1], { HarkonnenPaths[1][1] })[2] + IdlingUnits[Harkonnen] = Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", InitialHarkonnenReinforcements, HarkonnenPaths[1], { HarkonnenPaths[1][1] })[2] - DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) - DefendActor(HarkonnenBarracks, harkonnen, AttackGroupSize[Difficulty]) - RepairBuilding(harkonnen, HarkonnenBarracks, 0.75) + DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) + DefendActor(HarkonnenBarracks, Harkonnen, AttackGroupSize[Difficulty]) + RepairBuilding(Harkonnen, HarkonnenBarracks, 0.75) Utils.Do(SmugglerBase, function(actor) - RepairBuilding(smuggler, actor, 0.75) + RepairBuilding(Smuggler, actor, 0.75) end) - RepairBuilding(smuggler, Starport, 0.75) + RepairBuilding(Smuggler, Starport, 0.75) end -- Not using ProduceUnits because of the custom StopInfantryProduction condition ProduceInfantry = function() - if StopInfantryProduction or HarkonnenBarracks.IsDead or HarkonnenBarracks.Owner ~= harkonnen then + if StopInfantryProduction or HarkonnenBarracks.IsDead or HarkonnenBarracks.Owner ~= Harkonnen then return end - if HoldProduction[harkonnen] then + if HoldProduction[Harkonnen] then Trigger.AfterDelay(DateTime.Seconds(30), ProduceInfantry) return end local delay = Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) local toBuild = { Utils.Random(HarkonnenInfantryTypes) } - harkonnen.Build(toBuild, function(unit) - IdlingUnits[harkonnen][#IdlingUnits[harkonnen] + 1] = unit[1] + Harkonnen.Build(toBuild, function(unit) + IdlingUnits[Harkonnen][#IdlingUnits[Harkonnen] + 1] = unit[1] Trigger.AfterDelay(delay, ProduceInfantry) - if #IdlingUnits[harkonnen] >= (AttackGroupSize[Difficulty] * 2.5) then - SendAttack(harkonnen, AttackGroupSize[Difficulty]) + if #IdlingUnits[Harkonnen] >= (AttackGroupSize[Difficulty] * 2.5) then + SendAttack(Harkonnen, AttackGroupSize[Difficulty]) end end) end ActivateAI = function() - harkonnen.Cash = 15000 - LastHarvesterEaten[harkonnen] = true + Harkonnen.Cash = 15000 + LastHarvesterEaten[Harkonnen] = true InitAIUnits() local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end @@ -72,6 +72,6 @@ ActivateAI = function() local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 ProduceInfantry() - ProduceUnits(harkonnen, HarkonnenLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(harkonnen, HarkonnenHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Harkonnen, HarkonnenLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Harkonnen, HarkonnenHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/atreides-05/atreides05.lua b/mods/d2k/maps/atreides-05/atreides05.lua index 4553fc0043..66d671b1da 100644 --- a/mods/d2k/maps/atreides-05/atreides05.lua +++ b/mods/d2k/maps/atreides-05/atreides05.lua @@ -148,17 +148,17 @@ ContrabandTimes = hard = DateTime.Minutes(2) + DateTime.Seconds(30) } -wave = 0 +Wave = 0 SendHarkonnen = function() Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty], function() - if player.IsObjectiveCompleted(KillHarkonnen) then + if Atreides.IsObjectiveCompleted(KillHarkonnen) then return end - wave = wave + 1 + Wave = Wave + 1 - if InfantryReinforcements and wave % 4 == 0 then - local inf = Reinforcements.Reinforce(harkonnen, HarkonnenInfantryReinforcements[Difficulty][wave/4], InfantryPath) + if InfantryReinforcements and Wave % 4 == 0 then + local inf = Reinforcements.Reinforce(Harkonnen, HarkonnenInfantryReinforcements[Difficulty][Wave/4], InfantryPath) Utils.Do(inf, function(unit) unit.AttackMove(HarkonnenAttackLocation) IdleHunt(unit) @@ -166,13 +166,13 @@ SendHarkonnen = function() end local entryPath = Utils.Random(HarkonnenPaths) - local units = Reinforcements.ReinforceWithTransport(harkonnen, "carryall.reinforce", HarkonnenReinforcements[Difficulty][wave], entryPath, { entryPath[1] })[2] + local units = Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements[Difficulty][Wave], entryPath, { entryPath[1] })[2] Utils.Do(units, function(unit) unit.AttackMove(HarkonnenAttackLocation) IdleHunt(unit) end) - if wave < HarkonnenAttackWaves[Difficulty] then + if Wave < HarkonnenAttackWaves[Difficulty] then SendHarkonnen() return end @@ -181,21 +181,21 @@ SendHarkonnen = function() end) end -mercWave = 0 +MercWave = 0 SendMercenaries = function() Trigger.AfterDelay(MercenaryAttackDelay[Difficulty], function() - mercWave = mercWave + 1 + MercWave = MercWave + 1 Media.DisplayMessage(UserInterface.Translate("incoming-mercenary-force"), Mentat) - local units = Reinforcements.Reinforce(mercenary, MercenaryReinforcements[Difficulty][mercWave], MercenarySpawn) + local units = Reinforcements.Reinforce(Mercenary, MercenaryReinforcements[Difficulty][MercWave], MercenarySpawn) Utils.Do(units, function(unit) unit.AttackMove(MercenaryAttackLocation1) unit.AttackMove(MercenaryAttackLocation2) IdleHunt(unit) end) - if mercWave < MercenaryAttackWaves[Difficulty] then + if MercWave < MercenaryAttackWaves[Difficulty] then SendMercenaries() return end @@ -206,21 +206,21 @@ end SendContraband = function(owner) ContrabandArrived = true - UserInterface.SetMissionText(UserInterface.Translate("contraband-has-arrived"), player.Color) + UserInterface.SetMissionText(UserInterface.Translate("contraband-has-arrived"), Atreides.Color) local units = SmugglerReinforcements - if owner == player then + if owner == Atreides then units = ContrabandReinforcements end Reinforcements.ReinforceWithTransport(owner, "frigate", units, { ContrabandEntry.Location, Starport.Location + CVec.New(1, 1) }, { ContrabandExit.Location }) Trigger.AfterDelay(DateTime.Seconds(3), function() - if owner == player then - player.MarkCompletedObjective(CaptureStarport) + if owner == Atreides then + Atreides.MarkCompletedObjective(CaptureStarport) Media.DisplayMessage(UserInterface.Translate("contraband-confiscated"), Mentat) else - player.MarkFailedObjective(CaptureStarport) + Atreides.MarkFailedObjective(CaptureStarport) Media.DisplayMessage(UserInterface.Translate("contraband-not-confiscated"), Mentat) end end) @@ -232,13 +232,13 @@ end SmugglersAttack = function() Utils.Do(SmugglerBase, function(building) - if not building.IsDead and building.Owner == smuggler then + if not building.IsDead and building.Owner == Smuggler then building.Sell() end end) Trigger.AfterDelay(DateTime.Seconds(1), function() - Utils.Do(smuggler.GetGroundAttackers(), function(unit) + Utils.Do(Smuggler.GetGroundAttackers(), function(unit) IdleHunt(unit) end) end) @@ -246,26 +246,26 @@ end AttackNotifier = 0 Tick = function() - if player.HasNoRequiredUnits() then - harkonnen.MarkCompletedObjective(KillAtreides) + if Atreides.HasNoRequiredUnits() then + Harkonnen.MarkCompletedObjective(KillAtreides) end - if LastHarkonnenArrived and not player.IsObjectiveCompleted(KillHarkonnen) and harkonnen.HasNoRequiredUnits() then + if LastHarkonnenArrived and not Atreides.IsObjectiveCompleted(KillHarkonnen) and Harkonnen.HasNoRequiredUnits() then Media.DisplayMessage(UserInterface.Translate("atreides-05"), Mentat) - player.MarkCompletedObjective(KillHarkonnen) + Atreides.MarkCompletedObjective(KillHarkonnen) end - if LastMercenariesArrived and not player.IsObjectiveCompleted(KillSmuggler) and smuggler.HasNoRequiredUnits() and mercenary.HasNoRequiredUnits() then + if LastMercenariesArrived and not Atreides.IsObjectiveCompleted(KillSmuggler) and Smuggler.HasNoRequiredUnits() and Mercenary.HasNoRequiredUnits() then Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat) - player.MarkCompletedObjective(KillSmuggler) + Atreides.MarkCompletedObjective(KillSmuggler) end - if LastHarvesterEaten[harkonnen] and DateTime.GameTime % DateTime.Seconds(10) == 0 then - local units = harkonnen.GetActorsByType("harvester") + if LastHarvesterEaten[Harkonnen] and DateTime.GameTime % DateTime.Seconds(10) == 0 then + local units = Harkonnen.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[harkonnen] = false - ProtectHarvester(units[1], harkonnen, AttackGroupSize[Difficulty]) + LastHarvesterEaten[Harkonnen] = false + ProtectHarvester(units[1], Harkonnen, AttackGroupSize[Difficulty]) end end @@ -275,28 +275,28 @@ Tick = function() TimerTicks = TimerTicks - 1 if (TimerTicks % DateTime.Seconds(1)) == 0 then local contrabandArrivesIn = UserInterface.Translate("contraband-arrives-in", { ["time"] = Utils.FormatTime(TimerTicks)}) - UserInterface.SetMissionText(contrabandArrivesIn, player.Color) + UserInterface.SetMissionText(contrabandArrivesIn, Atreides.Color) end if TimerTicks <= 0 then - SendContraband(smuggler) + SendContraband(Smuggler) end end end WorldLoaded = function() - harkonnen = Player.GetPlayer("Harkonnen") - smuggler = Player.GetPlayer("Smugglers") - mercenary = Player.GetPlayer("Mercenaries") - player = Player.GetPlayer("Atreides") + Harkonnen = Player.GetPlayer("Harkonnen") + Smuggler = Player.GetPlayer("Smugglers") + Mercenary = Player.GetPlayer("Mercenaries") + Atreides = Player.GetPlayer("Atreides") InfantryReinforcements = Difficulty ~= "easy" - InitObjectives(player) - KillAtreides = AddPrimaryObjective(harkonnen, "") - CaptureBarracks = AddPrimaryObjective(player, "capture-barracks-sietch-tabr") - KillHarkonnen = AddSecondaryObjective(player, "annihilate-harkonnen-units-reinforcements") - CaptureStarport = AddSecondaryObjective(player, "capture-smuggler-starport-confiscate-contraband") + InitObjectives(Atreides) + KillAtreides = AddPrimaryObjective(Harkonnen, "") + CaptureBarracks = AddPrimaryObjective(Atreides, "capture-barracks-sietch-tabr") + KillHarkonnen = AddSecondaryObjective(Atreides, "annihilate-harkonnen-units-reinforcements") + CaptureStarport = AddSecondaryObjective(Atreides, "capture-smuggler-starport-confiscate-contraband") Camera.Position = ARefinery.CenterPosition HarkonnenAttackLocation = AtreidesRally.Location @@ -311,14 +311,14 @@ WorldLoaded = function() end) Trigger.OnAllKilledOrCaptured(HarkonnenBase, function() - Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) + Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt) end) Trigger.OnKilled(Starport, function() - if not player.IsObjectiveCompleted(CaptureStarport) then + if not Atreides.IsObjectiveCompleted(CaptureStarport) then ContrabandArrived = true - UserInterface.SetMissionText(UserInterface.Translate("starport-destroyed-no-contraband"), player.Color) - player.MarkFailedObjective(CaptureStarport) + UserInterface.SetMissionText(UserInterface.Translate("starport-destroyed-no-contraband"), Atreides.Color) + Atreides.MarkFailedObjective(CaptureStarport) SmugglersAttack() Trigger.AfterDelay(DateTime.Seconds(15), function() @@ -327,11 +327,11 @@ WorldLoaded = function() end if DefendStarport then - player.MarkFailedObjective(DefendStarport) + Atreides.MarkFailedObjective(DefendStarport) end end) Trigger.OnDamaged(Starport, function() - if Starport.Owner ~= smuggler then + if Starport.Owner ~= Smuggler then return end @@ -339,7 +339,7 @@ WorldLoaded = function() AttackNotifier = DateTime.Seconds(10) Media.DisplayMessage(UserInterface.Translate("do-not-destroy-starport"), Mentat) - local defenders = smuggler.GetGroundAttackers() + local defenders = Smuggler.GetGroundAttackers() if #defenders > 0 then Utils.Do(defenders, function(unit) unit.Guard(Starport) @@ -348,23 +348,23 @@ WorldLoaded = function() end end) Trigger.OnCapture(Starport, function() - DefendStarport = AddSecondaryObjective(player, "defend-captured-starport") + DefendStarport = AddSecondaryObjective(Atreides, "defend-captured-starport") Trigger.ClearAll(Starport) Trigger.AfterDelay(0, function() Trigger.OnRemovedFromWorld(Starport, function() - player.MarkFailedObjective(DefendStarport) + Atreides.MarkFailedObjective(DefendStarport) end) end) if not ContrabandArrived then - SendContraband(player) + SendContraband(Atreides) end SmugglersAttack() end) Trigger.OnKilled(HarkonnenBarracks, function() - player.MarkFailedObjective(CaptureBarracks) + Atreides.MarkFailedObjective(CaptureBarracks) end) Trigger.OnDamaged(HarkonnenBarracks, function() if AttackNotifier <= 0 and HarkonnenBarracks.Health < HarkonnenBarracks.MaxHealth * 3/4 then @@ -376,52 +376,52 @@ WorldLoaded = function() Media.DisplayMessage(UserInterface.Translate("hostages-released"), Mentat) if DefendStarport then - player.MarkCompletedObjective(DefendStarport) + Atreides.MarkCompletedObjective(DefendStarport) end Trigger.AfterDelay(DateTime.Seconds(3), function() - player.MarkCompletedObjective(CaptureBarracks) + Atreides.MarkCompletedObjective(CaptureBarracks) end) end) SendHarkonnen() - Actor.Create("upgrade.barracks", true, { Owner = harkonnen }) - Actor.Create("upgrade.light", true, { Owner = harkonnen }) - Actor.Create("upgrade.heavy", true, { Owner = harkonnen }) + Actor.Create("upgrade.barracks", true, { Owner = Harkonnen }) + Actor.Create("upgrade.light", true, { Owner = Harkonnen }) + Actor.Create("upgrade.heavy", true, { Owner = Harkonnen }) Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(DateTime.Minutes(1), function() - Media.PlaySpeechNotification(player, "Reinforce") - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] }) + Media.PlaySpeechNotification(Atreides, "Reinforce") + Reinforcements.ReinforceWithTransport(Atreides, "carryall.reinforce", AtreidesReinforcements, AtreidesPath, { AtreidesPath[1] }) end) local smugglerWaypoint = SmugglerWaypoint1.Location Trigger.OnEnteredFootprint({ smugglerWaypoint + CVec.New(-2, 0), smugglerWaypoint + CVec.New(-1, 0), smugglerWaypoint, smugglerWaypoint + CVec.New(1, -1), smugglerWaypoint + CVec.New(2, -1), SmugglerWaypoint3.Location }, function(a, id) - if not warned and a.Owner == player and a.Type ~= "carryall" then - warned = true + if not Warned and a.Owner == Atreides and a.Type ~= "carryall" then + Warned = true Trigger.RemoveFootprintTrigger(id) Media.DisplayMessage(UserInterface.Translate("stay-away-from-starport"), UserInterface.Translate("smuggler-leader")) end end) Trigger.OnEnteredFootprint({ SmugglerWaypoint2.Location }, function(a, id) - if not paid and a.Owner == player and a.Type ~= "carryall" then - paid = true + if not Paid and a.Owner == Atreides and a.Type ~= "carryall" then + Paid = true Trigger.RemoveFootprintTrigger(id) Media.DisplayMessage(UserInterface.Translate("were-warned-will-pay"), UserInterface.Translate("smuggler-leader")) - Utils.Do(smuggler.GetGroundAttackers(), function(unit) + Utils.Do(Smuggler.GetGroundAttackers(), function(unit) unit.AttackMove(SmugglerWaypoint2.Location) end) Trigger.AfterDelay(DateTime.Seconds(3), function() - KillSmuggler = AddSecondaryObjective(player, "destroy-smugglers-mercenaries") + KillSmuggler = AddSecondaryObjective(Atreides, "destroy-smugglers-mercenaries") SendMercenaries() end) end end) Trigger.OnEnteredProximityTrigger(HarkonnenBarracks.CenterPosition, WDist.New(5 * 1024), function(a, id) - if a.Owner == player and a.Type ~= "carryall" then + if a.Owner == Atreides and a.Type ~= "carryall" then Trigger.RemoveProximityTrigger(id) Media.DisplayMessage(UserInterface.Translate("capture-harkonnen-barracks-release-hostages"), Mentat) StopInfantryProduction = true diff --git a/mods/d2k/maps/harkonnen-01a/harkonnen01a.lua b/mods/d2k/maps/harkonnen-01a/harkonnen01a.lua index d1c07cd373..e0e9daa883 100644 --- a/mods/d2k/maps/harkonnen-01a/harkonnen01a.lua +++ b/mods/d2k/maps/harkonnen-01a/harkonnen01a.lua @@ -61,16 +61,16 @@ Messages = CachedResources = -1 Tick = function() - if AtreidesArrived and atreides.HasNoRequiredUnits() then - player.MarkCompletedObjective(KillAtreides) + if AtreidesArrived and Atreides.HasNoRequiredUnits() then + Harkonnen.MarkCompletedObjective(KillAtreides) end - if player.Resources > SpiceToHarvest - 1 then - player.MarkCompletedObjective(GatherSpice) + if Harkonnen.Resources > SpiceToHarvest - 1 then + Harkonnen.MarkCompletedObjective(GatherSpice) end -- player has no Wind Trap - if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if (Harkonnen.PowerProvided <= 20 or Harkonnen.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then HasPower = false Media.DisplayMessage(Messages[2], Mentat) else @@ -78,40 +78,40 @@ Tick = function() end -- player has no Refinery and no Silos - if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if HasPower and Harkonnen.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then Media.DisplayMessage(Messages[3], Mentat) end - if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if HasPower and Harkonnen.Resources > Harkonnen.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then Media.DisplayMessage(Messages[4], Mentat) end - if player.Resources ~= CachedResources then - local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } + if Harkonnen.Resources ~= CachedResources then + local parameters = { ["harvested"] = Harkonnen.Resources, ["goal"] = SpiceToHarvest } local harvestedResources = UserInterface.Translate("harvested-resources", parameters) UserInterface.SetMissionText(harvestedResources) - CachedResources = player.Resources + CachedResources = Harkonnen.Resources end end WorldLoaded = function() - player = Player.GetPlayer("Harkonnen") - atreides = Player.GetPlayer("Atreides") + Harkonnen = Player.GetPlayer("Harkonnen") + Atreides = Player.GetPlayer("Atreides") SpiceToHarvest = ToHarvest[Difficulty] - InitObjectives(player) - KillHarkonnen = AddPrimaryObjective(atreides, "") + InitObjectives(Harkonnen) + KillHarkonnen = AddPrimaryObjective(Atreides, "") local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) - GatherSpice = AddPrimaryObjective(player, harvestSpice) - KillAtreides = AddSecondaryObjective(player, "eliminate-atreides-units-reinforcements") + GatherSpice = AddPrimaryObjective(Harkonnen, harvestSpice) + KillAtreides = AddSecondaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements") local checkResourceCapacity = function() Trigger.AfterDelay(0, function() - if player.ResourceCapacity < SpiceToHarvest then + if Harkonnen.ResourceCapacity < SpiceToHarvest then Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Trigger.AfterDelay(DateTime.Seconds(3), function() - harkonnen.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end) return true @@ -126,16 +126,16 @@ WorldLoaded = function() return end - local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) + local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Harkonnen end) if #refs == 0 then - atreides.MarkCompletedObjective(KillHarkonnen) + Atreides.MarkCompletedObjective(KillHarkonnen) else Trigger.OnAllRemovedFromWorld(refs, function() - atreides.MarkCompletedObjective(KillHarkonnen) + Atreides.MarkCompletedObjective(KillHarkonnen) end) - local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) + local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Harkonnen end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) end @@ -144,8 +144,8 @@ WorldLoaded = function() Media.DisplayMessage(Messages[1], Mentat) Trigger.AfterDelay(DateTime.Seconds(25), function() - Media.PlaySpeechNotification(player, "Reinforce") - Reinforcements.Reinforce(player, HarkonnenReinforcements, HarkonnenEntryPath) + Media.PlaySpeechNotification(Harkonnen, "Reinforce") + Reinforcements.Reinforce(Harkonnen, HarkonnenReinforcements, HarkonnenEntryPath) end) WavesLeft = AtreidesAttackWaves[Difficulty] @@ -159,7 +159,7 @@ SendReinforcements = function() if AtreidesAttackDelay < 0 then AtreidesAttackDelay = 0 end Trigger.AfterDelay(delay, function() - Reinforcements.Reinforce(atreides, Utils.Random(units), { Utils.Random(AtreidesEntryWaypoints) }, 10, IdleHunt) + Reinforcements.Reinforce(Atreides, Utils.Random(units), { Utils.Random(AtreidesEntryWaypoints) }, 10, IdleHunt) WavesLeft = WavesLeft - 1 if WavesLeft == 0 then diff --git a/mods/d2k/maps/harkonnen-01b/harkonnen01b.lua b/mods/d2k/maps/harkonnen-01b/harkonnen01b.lua index d1c07cd373..e0e9daa883 100644 --- a/mods/d2k/maps/harkonnen-01b/harkonnen01b.lua +++ b/mods/d2k/maps/harkonnen-01b/harkonnen01b.lua @@ -61,16 +61,16 @@ Messages = CachedResources = -1 Tick = function() - if AtreidesArrived and atreides.HasNoRequiredUnits() then - player.MarkCompletedObjective(KillAtreides) + if AtreidesArrived and Atreides.HasNoRequiredUnits() then + Harkonnen.MarkCompletedObjective(KillAtreides) end - if player.Resources > SpiceToHarvest - 1 then - player.MarkCompletedObjective(GatherSpice) + if Harkonnen.Resources > SpiceToHarvest - 1 then + Harkonnen.MarkCompletedObjective(GatherSpice) end -- player has no Wind Trap - if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if (Harkonnen.PowerProvided <= 20 or Harkonnen.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then HasPower = false Media.DisplayMessage(Messages[2], Mentat) else @@ -78,40 +78,40 @@ Tick = function() end -- player has no Refinery and no Silos - if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if HasPower and Harkonnen.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then Media.DisplayMessage(Messages[3], Mentat) end - if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if HasPower and Harkonnen.Resources > Harkonnen.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then Media.DisplayMessage(Messages[4], Mentat) end - if player.Resources ~= CachedResources then - local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } + if Harkonnen.Resources ~= CachedResources then + local parameters = { ["harvested"] = Harkonnen.Resources, ["goal"] = SpiceToHarvest } local harvestedResources = UserInterface.Translate("harvested-resources", parameters) UserInterface.SetMissionText(harvestedResources) - CachedResources = player.Resources + CachedResources = Harkonnen.Resources end end WorldLoaded = function() - player = Player.GetPlayer("Harkonnen") - atreides = Player.GetPlayer("Atreides") + Harkonnen = Player.GetPlayer("Harkonnen") + Atreides = Player.GetPlayer("Atreides") SpiceToHarvest = ToHarvest[Difficulty] - InitObjectives(player) - KillHarkonnen = AddPrimaryObjective(atreides, "") + InitObjectives(Harkonnen) + KillHarkonnen = AddPrimaryObjective(Atreides, "") local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) - GatherSpice = AddPrimaryObjective(player, harvestSpice) - KillAtreides = AddSecondaryObjective(player, "eliminate-atreides-units-reinforcements") + GatherSpice = AddPrimaryObjective(Harkonnen, harvestSpice) + KillAtreides = AddSecondaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements") local checkResourceCapacity = function() Trigger.AfterDelay(0, function() - if player.ResourceCapacity < SpiceToHarvest then + if Harkonnen.ResourceCapacity < SpiceToHarvest then Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Trigger.AfterDelay(DateTime.Seconds(3), function() - harkonnen.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end) return true @@ -126,16 +126,16 @@ WorldLoaded = function() return end - local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) + local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Harkonnen end) if #refs == 0 then - atreides.MarkCompletedObjective(KillHarkonnen) + Atreides.MarkCompletedObjective(KillHarkonnen) else Trigger.OnAllRemovedFromWorld(refs, function() - atreides.MarkCompletedObjective(KillHarkonnen) + Atreides.MarkCompletedObjective(KillHarkonnen) end) - local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) + local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Harkonnen end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) end @@ -144,8 +144,8 @@ WorldLoaded = function() Media.DisplayMessage(Messages[1], Mentat) Trigger.AfterDelay(DateTime.Seconds(25), function() - Media.PlaySpeechNotification(player, "Reinforce") - Reinforcements.Reinforce(player, HarkonnenReinforcements, HarkonnenEntryPath) + Media.PlaySpeechNotification(Harkonnen, "Reinforce") + Reinforcements.Reinforce(Harkonnen, HarkonnenReinforcements, HarkonnenEntryPath) end) WavesLeft = AtreidesAttackWaves[Difficulty] @@ -159,7 +159,7 @@ SendReinforcements = function() if AtreidesAttackDelay < 0 then AtreidesAttackDelay = 0 end Trigger.AfterDelay(delay, function() - Reinforcements.Reinforce(atreides, Utils.Random(units), { Utils.Random(AtreidesEntryWaypoints) }, 10, IdleHunt) + Reinforcements.Reinforce(Atreides, Utils.Random(units), { Utils.Random(AtreidesEntryWaypoints) }, 10, IdleHunt) WavesLeft = WavesLeft - 1 if WavesLeft == 0 then diff --git a/mods/d2k/maps/harkonnen-02a/harkonnen02a-AI.lua b/mods/d2k/maps/harkonnen-02a/harkonnen02a-AI.lua index d4334430b7..28629d01ba 100644 --- a/mods/d2k/maps/harkonnen-02a/harkonnen02a-AI.lua +++ b/mods/d2k/maps/harkonnen-02a/harkonnen02a-AI.lua @@ -24,11 +24,11 @@ AttackDelays = AtreidesInfantryTypes = { "light_inf" } ActivateAI = function() - IdlingUnits[atreides] = { } + IdlingUnits[Atreides] = { } local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local toBuild = function() return AtreidesInfantryTypes end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 - DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) - ProduceUnits(atreides, ABarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) + DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) + ProduceUnits(Atreides, ABarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/harkonnen-02a/harkonnen02a.lua b/mods/d2k/maps/harkonnen-02a/harkonnen02a.lua index 358116e7a6..1e51585764 100644 --- a/mods/d2k/maps/harkonnen-02a/harkonnen02a.lua +++ b/mods/d2k/maps/harkonnen-02a/harkonnen02a.lua @@ -65,31 +65,31 @@ AtreidesAttackWaves = } Tick = function() - if player.HasNoRequiredUnits() then - atreides.MarkCompletedObjective(KillHarkonnen) + if Harkonnen.HasNoRequiredUnits() then + Atreides.MarkCompletedObjective(KillHarkonnen) end - if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then + if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) - player.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end end WorldLoaded = function() - atreides = Player.GetPlayer("Atreides") - player = Player.GetPlayer("Harkonnen") + Atreides = Player.GetPlayer("Atreides") + Harkonnen = Player.GetPlayer("Harkonnen") - InitObjectives(player) - KillHarkonnen = AddPrimaryObjective(atreides, "") - KillAtreides = AddSecondaryObjective(player, "destroy-atreides-forces") + InitObjectives(Harkonnen) + KillHarkonnen = AddPrimaryObjective(Atreides, "") + KillAtreides = AddSecondaryObjective(Harkonnen, "destroy-atreides-forces") Camera.Position = HConyard.CenterPosition Trigger.OnAllKilled(AtreidesBase, function() - Utils.Do(atreides.GetGroundAttackers(), IdleHunt) + Utils.Do(Atreides.GetGroundAttackers(), IdleHunt) end) local path = function() return Utils.Random(AtreidesAttackPaths) end - SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty]) + SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty]) Trigger.AfterDelay(0, ActivateAI) end diff --git a/mods/d2k/maps/harkonnen-02b/harkonnen02b-AI.lua b/mods/d2k/maps/harkonnen-02b/harkonnen02b-AI.lua index df6d12cb88..347e66dbbd 100644 --- a/mods/d2k/maps/harkonnen-02b/harkonnen02b-AI.lua +++ b/mods/d2k/maps/harkonnen-02b/harkonnen02b-AI.lua @@ -25,13 +25,13 @@ AtreidesInfantryTypes = { "light_inf" } AtreidesVehicleTypes = { "trike" } ActivateAI = function() - IdlingUnits[atreides] = { } + IdlingUnits[Atreides] = { } local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local infantryToBuild = function() return AtreidesInfantryTypes end local vehilcesToBuild = function() return AtreidesVehicleTypes end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 - DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) - ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) + ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/harkonnen-02b/harkonnen02b.lua b/mods/d2k/maps/harkonnen-02b/harkonnen02b.lua index 4d2105da6c..05532a3484 100644 --- a/mods/d2k/maps/harkonnen-02b/harkonnen02b.lua +++ b/mods/d2k/maps/harkonnen-02b/harkonnen02b.lua @@ -65,31 +65,31 @@ AtreidesAttackWaves = } Tick = function() - if player.HasNoRequiredUnits() then - atreides.MarkCompletedObjective(KillHarkonnen) + if Harkonnen.HasNoRequiredUnits() then + Atreides.MarkCompletedObjective(KillHarkonnen) end - if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then + if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) - player.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end end WorldLoaded = function() - atreides = Player.GetPlayer("Atreides") - player = Player.GetPlayer("Harkonnen") + Atreides = Player.GetPlayer("Atreides") + Harkonnen = Player.GetPlayer("Harkonnen") - InitObjectives(player) - KillHarkonnen = AddPrimaryObjective(atreides, "") - KillAtreides = AddSecondaryObjective(player, "destroy-atreides-forces") + InitObjectives(Harkonnen) + KillHarkonnen = AddPrimaryObjective(Atreides, "") + KillAtreides = AddSecondaryObjective(Harkonnen, "destroy-atreides-forces") Camera.Position = HConyard.CenterPosition Trigger.OnAllKilled(AtreidesBase, function() - Utils.Do(atreides.GetGroundAttackers(), IdleHunt) + Utils.Do(Atreides.GetGroundAttackers(), IdleHunt) end) local path = function() return Utils.Random(AtreidesAttackPaths) end - SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty]) + SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty]) Trigger.AfterDelay(0, ActivateAI) end diff --git a/mods/d2k/maps/harkonnen-03a/harkonnen03a-AI.lua b/mods/d2k/maps/harkonnen-03a/harkonnen03a-AI.lua index 220ca589fb..93eb479543 100644 --- a/mods/d2k/maps/harkonnen-03a/harkonnen03a-AI.lua +++ b/mods/d2k/maps/harkonnen-03a/harkonnen03a-AI.lua @@ -25,9 +25,9 @@ AtreidesInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "tro AtreidesVehicleTypes = { "trike", "trike", "quad" } ActivateAI = function() - IdlingUnits[atreides] = { } - LastHarvesterEaten[atreides] = true - DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) + IdlingUnits[Atreides] = { } + LastHarvesterEaten[Atreides] = true + DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) AConyard.Produce(HarkonnenUpgrades[1]) AConyard.Produce(HarkonnenUpgrades[2]) @@ -39,7 +39,7 @@ ActivateAI = function() -- Finish the upgrades first before trying to build something Trigger.AfterDelay(DateTime.Seconds(14), function() - ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) end) end diff --git a/mods/d2k/maps/harkonnen-03a/harkonnen03a.lua b/mods/d2k/maps/harkonnen-03a/harkonnen03a.lua index b765cd7b48..755a19c506 100644 --- a/mods/d2k/maps/harkonnen-03a/harkonnen03a.lua +++ b/mods/d2k/maps/harkonnen-03a/harkonnen03a.lua @@ -94,25 +94,25 @@ HarkonnenBaseBuildings = { "barracks", "light_factory" } HarkonnenUpgrades = { "upgrade.barracks", "upgrade.light" } MessageCheck = function(index) - return #player.GetActorsByType(HarkonnenBaseBuildings[index]) > 0 and not player.HasPrerequisites({ HarkonnenUpgrades[index] }) + return #Harkonnen.GetActorsByType(HarkonnenBaseBuildings[index]) > 0 and not Harkonnen.HasPrerequisites({ HarkonnenUpgrades[index] }) end Tick = function() - if player.HasNoRequiredUnits() then - atreides.MarkCompletedObjective(KillHarkonnen) + if Harkonnen.HasNoRequiredUnits() then + Atreides.MarkCompletedObjective(KillHarkonnen) end - if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then + if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) - player.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides] then - local units = atreides.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Atreides] then + local units = Atreides.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[atreides] = false - ProtectHarvester(units[1], atreides, AttackGroupSize[Difficulty]) + LastHarvesterEaten[Atreides] = false + ProtectHarvester(units[1], Atreides, AttackGroupSize[Difficulty]) end end @@ -122,31 +122,31 @@ Tick = function() end WorldLoaded = function() - atreides = Player.GetPlayer("Atreides") - player = Player.GetPlayer("Harkonnen") + Atreides = Player.GetPlayer("Atreides") + Harkonnen = Player.GetPlayer("Harkonnen") - InitObjectives(player) - KillHarkonnen = AddPrimaryObjective(atreides, "") - KillAtreides = AddPrimaryObjective(player, "eliminate-atreides-units-reinforcements") + InitObjectives(Harkonnen) + KillHarkonnen = AddPrimaryObjective(Atreides, "") + KillAtreides = AddPrimaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements") Camera.Position = HConyard.CenterPosition Trigger.OnAllKilled(AtreidesBase, function() - Utils.Do(atreides.GetGroundAttackers(), IdleHunt) + Utils.Do(Atreides.GetGroundAttackers(), IdleHunt) end) local path = function() return Utils.Random(AtreidesPaths) end - local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end - SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition) + local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end + SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition) Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function() - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] }) + Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] }) end) - TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1]) - TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[2], AtreidesHunterPaths[2]) - TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[3], AtreidesHunterPaths[3]) - TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[4], AtreidesHunterPaths[4]) - TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[5], AtreidesHunterPaths[5]) + TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1]) + TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[2], AtreidesHunterPaths[2]) + TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[3], AtreidesHunterPaths[3]) + TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[4], AtreidesHunterPaths[4]) + TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[5], AtreidesHunterPaths[5]) end diff --git a/mods/d2k/maps/harkonnen-03b/harkonnen03b-AI.lua b/mods/d2k/maps/harkonnen-03b/harkonnen03b-AI.lua index db5d7cbbf6..1cf7a5a352 100644 --- a/mods/d2k/maps/harkonnen-03b/harkonnen03b-AI.lua +++ b/mods/d2k/maps/harkonnen-03b/harkonnen03b-AI.lua @@ -25,13 +25,13 @@ AtreidesInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "tro AtreidesVehicleTypes = { "trike", "trike", "quad" } InitAIUnits = function() - IdlingUnits[atreides] = Reinforcements.Reinforce(atreides, AtreidesInitialReinforcements, AtreidesInitialPath) + IdlingUnits[Atreides] = Reinforcements.Reinforce(Atreides, AtreidesInitialReinforcements, AtreidesInitialPath) - DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) end ActivateAI = function() - LastHarvesterEaten[atreides] = true + LastHarvesterEaten[Atreides] = true Trigger.AfterDelay(0, InitAIUnits) AConyard.Produce(HarkonnenUpgrades[1]) @@ -44,7 +44,7 @@ ActivateAI = function() -- Finish the upgrades first before trying to build something Trigger.AfterDelay(DateTime.Seconds(14), function() - ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) end) end diff --git a/mods/d2k/maps/harkonnen-03b/harkonnen03b.lua b/mods/d2k/maps/harkonnen-03b/harkonnen03b.lua index 61f4faa8ba..a6be90c691 100644 --- a/mods/d2k/maps/harkonnen-03b/harkonnen03b.lua +++ b/mods/d2k/maps/harkonnen-03b/harkonnen03b.lua @@ -96,25 +96,25 @@ HarkonnenBaseBuildings = { "barracks", "light_factory" } HarkonnenUpgrades = { "upgrade.barracks", "upgrade.light" } MessageCheck = function(index) - return #player.GetActorsByType(HarkonnenBaseBuildings[index]) > 0 and not player.HasPrerequisites({ HarkonnenUpgrades[index] }) + return #Harkonnen.GetActorsByType(HarkonnenBaseBuildings[index]) > 0 and not Harkonnen.HasPrerequisites({ HarkonnenUpgrades[index] }) end Tick = function() - if player.HasNoRequiredUnits() then - atreides.MarkCompletedObjective(KillHarkonnen) + if Harkonnen.HasNoRequiredUnits() then + Atreides.MarkCompletedObjective(KillHarkonnen) end - if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then + if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) - player.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides] then - local units = atreides.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Atreides] then + local units = Atreides.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[atreides] = false - ProtectHarvester(units[1], atreides, AttackGroupSize[Difficulty]) + LastHarvesterEaten[Atreides] = false + ProtectHarvester(units[1], Atreides, AttackGroupSize[Difficulty]) end end @@ -124,30 +124,30 @@ Tick = function() end WorldLoaded = function() - atreides = Player.GetPlayer("Atreides") - player = Player.GetPlayer("Harkonnen") + Atreides = Player.GetPlayer("Atreides") + Harkonnen = Player.GetPlayer("Harkonnen") - InitObjectives(player) - KillHarkonnen = AddPrimaryObjective(atreides, "") - KillAtreides = AddPrimaryObjective(player, "eliminate-atreides-units-reinforcements") + InitObjectives(Harkonnen) + KillHarkonnen = AddPrimaryObjective(Atreides, "") + KillAtreides = AddPrimaryObjective(Harkonnen, "eliminate-atreides-units-reinforcements") Camera.Position = HConyard.CenterPosition Trigger.OnAllKilled(AtreidesBase, function() - Utils.Do(atreides.GetGroundAttackers(), IdleHunt) + Utils.Do(Atreides.GetGroundAttackers(), IdleHunt) end) local path = function() return Utils.Random(AtreidesPaths) end - local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end - SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition) + local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end + SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition) ActivateAI() Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function() - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] }) + Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] }) end) - TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1]) - TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[2], AtreidesHunterPaths[2]) - TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[3], AtreidesHunterPaths[3]) - TriggerCarryallReinforcements(player, atreides, AtreidesBaseAreaTriggers[4], AtreidesHunters[4], AtreidesHunterPaths[4]) + TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[1], AtreidesHunters[1], AtreidesHunterPaths[1]) + TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[2], AtreidesHunters[2], AtreidesHunterPaths[2]) + TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[3], AtreidesHunters[3], AtreidesHunterPaths[3]) + TriggerCarryallReinforcements(Harkonnen, Atreides, AtreidesBaseAreaTriggers[4], AtreidesHunters[4], AtreidesHunterPaths[4]) end diff --git a/mods/d2k/maps/harkonnen-04/harkonnen04-AI.lua b/mods/d2k/maps/harkonnen-04/harkonnen04-AI.lua index b694231b5e..4e9c41e417 100644 --- a/mods/d2k/maps/harkonnen-04/harkonnen04-AI.lua +++ b/mods/d2k/maps/harkonnen-04/harkonnen04-AI.lua @@ -26,12 +26,12 @@ AtreidesVehicleTypes = { "trike", "trike", "quad" } AtreidesTankType = { "combat_tank_a" } ActivateAI = function() - IdlingUnits[fremen] = { } - IdlingUnits[atreides] = Reinforcements.Reinforce(atreides, InitialAtreidesReinforcements[1], AtreidesPaths[2]), Reinforcements.Reinforce(atreides, InitialAtreidesReinforcements[2], AtreidesPaths[3]) + IdlingUnits[Fremen] = { } + IdlingUnits[Atreides] = Reinforcements.Reinforce(Atreides, InitialAtreidesReinforcements[1], AtreidesPaths[2]), Reinforcements.Reinforce(Atreides, InitialAtreidesReinforcements[2], AtreidesPaths[3]) FremenProduction() - DefendAndRepairBase(atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(fremen, FremenBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(Atreides, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(Fremen, FremenBase, 0.75, AttackGroupSize[Difficulty]) local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local infantryToBuild = function() return { Utils.Random(AtreidesInfantryTypes) } end @@ -39,7 +39,7 @@ ActivateAI = function() local tanksToBuild = function() return AtreidesTankType end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 - ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides, AHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Atreides, ALightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Atreides, AHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/harkonnen-04/harkonnen04.lua b/mods/d2k/maps/harkonnen-04/harkonnen04.lua index 76613cb775..dab5f6b72e 100644 --- a/mods/d2k/maps/harkonnen-04/harkonnen04.lua +++ b/mods/d2k/maps/harkonnen-04/harkonnen04.lua @@ -122,51 +122,51 @@ FremenProduction = function() end local delay = Utils.RandomInteger(FremenInterval[Difficulty][1], FremenInterval[Difficulty][2] + 1) - fremen.Build({ "nsfremen" }, function() + Fremen.Build({ "nsfremen" }, function() Trigger.AfterDelay(delay, FremenProduction) end) end Tick = function() - if player.HasNoRequiredUnits() then - atreides.MarkCompletedObjective(KillHarkonnen) + if Harkonnen.HasNoRequiredUnits() then + Atreides.MarkCompletedObjective(KillHarkonnen) end - if atreides.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then + if Atreides.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) - player.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end - if fremen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillFremen) then + if Fremen.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillFremen) then Media.DisplayMessage(UserInterface.Translate("fremen-annihilated"), Mentat) - player.MarkCompletedObjective(KillFremen) + Harkonnen.MarkCompletedObjective(KillFremen) end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides] then - local units = atreides.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Atreides] then + local units = Atreides.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[atreides] = false - ProtectHarvester(units[1], atreides, AttackGroupSize[Difficulty]) + LastHarvesterEaten[Atreides] = false + ProtectHarvester(units[1], Atreides, AttackGroupSize[Difficulty]) end end end WorldLoaded = function() - atreides = Player.GetPlayer("Atreides") - fremen = Player.GetPlayer("Fremen") - player = Player.GetPlayer("Harkonnen") + Atreides = Player.GetPlayer("Atreides") + Fremen = Player.GetPlayer("Fremen") + Harkonnen = Player.GetPlayer("Harkonnen") - InitObjectives(player) - KillAtreides = AddPrimaryObjective(player, "destroy-atreides") - KillFremen = AddPrimaryObjective(player, "destroy-fremen") - KillHarkonnen = AddPrimaryObjective(atreides, "") + InitObjectives(Harkonnen) + KillAtreides = AddPrimaryObjective(Harkonnen, "destroy-atreides") + KillFremen = AddPrimaryObjective(Harkonnen, "destroy-fremen") + KillHarkonnen = AddPrimaryObjective(Atreides, "") Camera.Position = HConyard.CenterPosition FremenAttackLocation = HConyard.Location Trigger.OnAllKilledOrCaptured(AtreidesBase, function() - Utils.Do(atreides.GetGroundAttackers(), IdleHunt) + Utils.Do(Atreides.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilled(Sietches, function() @@ -174,31 +174,31 @@ WorldLoaded = function() end) local path = function() return Utils.Random(FremenPaths) end - local waveCondition = function() return player.IsObjectiveCompleted(KillFremen) end + local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillFremen) end local huntFunction = function(unit) unit.AttackMove(FremenAttackLocation) IdleHunt(unit) end - SendCarryallReinforcements(fremen, 0, FremenAttackWaves[Difficulty], FremenAttackDelay[Difficulty], path, FremenReinforcements[Difficulty], waveCondition, huntFunction) + SendCarryallReinforcements(Fremen, 0, FremenAttackWaves[Difficulty], FremenAttackDelay[Difficulty], path, FremenReinforcements[Difficulty], waveCondition, huntFunction) - Actor.Create("upgrade.barracks", true, { Owner = atreides }) - Actor.Create("upgrade.light", true, { Owner = atreides }) + Actor.Create("upgrade.barracks", true, { Owner = Atreides }) + Actor.Create("upgrade.light", true, { Owner = Atreides }) Trigger.AfterDelay(0, ActivateAI) Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(15), function() - Media.PlaySpeechNotification(player, "Reinforce") - Reinforcements.Reinforce(player, HarkonnenReinforcements, HarkonnenPath) + Media.PlaySpeechNotification(Harkonnen, "Reinforce") + Reinforcements.Reinforce(Harkonnen, HarkonnenReinforcements, HarkonnenPath) end) Trigger.AfterDelay(DateTime.Seconds(15), function() Media.DisplayMessage(UserInterface.Translate("fremen-spotted-north-southeast"), Mentat) end) - local atreidesCondition = function() return player.IsObjectiveCompleted(KillAtreides) end - TriggerCarryallReinforcements(player, atreides, BaseAreaTriggers[1], AtreidesHunters, AtreidesPaths[1], atreidesCondition) + local atreidesCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end + TriggerCarryallReinforcements(Harkonnen, Atreides, BaseAreaTriggers[1], AtreidesHunters, AtreidesPaths[1], atreidesCondition) - local fremenCondition = function() return player.IsObjectiveCompleted(KillFremen) end - TriggerCarryallReinforcements(player, fremen, BaseAreaTriggers[1], FremenHunters[1], FremenHunterPaths[3], fremenCondition) - TriggerCarryallReinforcements(player, fremen, BaseAreaTriggers[2], FremenHunters[2], FremenHunterPaths[2], fremenCondition) - TriggerCarryallReinforcements(player, fremen, BaseAreaTriggers[3], FremenHunters[3], FremenHunterPaths[1], fremenCondition) + local fremenCondition = function() return Harkonnen.IsObjectiveCompleted(KillFremen) end + TriggerCarryallReinforcements(Harkonnen, Fremen, BaseAreaTriggers[1], FremenHunters[1], FremenHunterPaths[3], fremenCondition) + TriggerCarryallReinforcements(Harkonnen, Fremen, BaseAreaTriggers[2], FremenHunters[2], FremenHunterPaths[2], fremenCondition) + TriggerCarryallReinforcements(Harkonnen, Fremen, BaseAreaTriggers[3], FremenHunters[3], FremenHunterPaths[1], fremenCondition) end diff --git a/mods/d2k/maps/harkonnen-05/harkonnen05-AI.lua b/mods/d2k/maps/harkonnen-05/harkonnen05-AI.lua index 6dedfc1c95..ff969b5cc8 100644 --- a/mods/d2k/maps/harkonnen-05/harkonnen05-AI.lua +++ b/mods/d2k/maps/harkonnen-05/harkonnen05-AI.lua @@ -26,13 +26,13 @@ OrdosVehicleTypes = { "raider", "raider", "quad" } OrdosTankType = { "combat_tank_o" } ActivateAI = function() - IdlingUnits[ordos_main] = Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[2], InitialOrdosPaths[2]) - IdlingUnits[ordos_small] = Reinforcements.Reinforce(ordos_small, InitialOrdosReinforcements[1], InitialOrdosPaths[3]) - IdlingUnits[corrino] = { CSaraukar1, CSaraukar2, CSaraukar3, CSaraukar4, CSaraukar5 } + IdlingUnits[OrdosMain] = Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[2], InitialOrdosPaths[2]) + IdlingUnits[OrdosSmall] = Reinforcements.Reinforce(OrdosSmall, InitialOrdosReinforcements[1], InitialOrdosPaths[3]) + IdlingUnits[Corrino] = { CSaraukar1, CSaraukar2, CSaraukar3, CSaraukar4, CSaraukar5 } - DefendAndRepairBase(ordos_main, OrdosMainBase, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(ordos_small, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(corrino, CorrinoBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(OrdosMain, OrdosMainBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(OrdosSmall, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(Corrino, CorrinoBase, 0.75, AttackGroupSize[Difficulty]) local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end @@ -40,10 +40,10 @@ ActivateAI = function() local tanksToBuild = function() return OrdosTankType end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 - ProduceUnits(ordos_main, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos_main, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos_main, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosMain, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosMain, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosMain, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos_small, OBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos_small, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosSmall, OBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosSmall, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/harkonnen-05/harkonnen05.lua b/mods/d2k/maps/harkonnen-05/harkonnen05.lua index a2df5890cb..262ae6facc 100644 --- a/mods/d2k/maps/harkonnen-05/harkonnen05.lua +++ b/mods/d2k/maps/harkonnen-05/harkonnen05.lua @@ -131,11 +131,11 @@ HarkonnenPaths = SendStarportReinforcements = function() Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function() - if CStarport.IsDead or CStarport.Owner ~= corrino then + if CStarport.IsDead or CStarport.Owner ~= Corrino then return end - local units = Reinforcements.ReinforceWithTransport(corrino, "frigate", CorrinoStarportReinforcements[Difficulty], { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2] + local units = Reinforcements.ReinforceWithTransport(Corrino, "frigate", CorrinoStarportReinforcements[Difficulty], { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2] Utils.Do(units, function(unit) unit.AttackMove(OrdosAttackLocation) IdleHunt(unit) @@ -143,7 +143,7 @@ SendStarportReinforcements = function() SendStarportReinforcements() - if player.IsObjectiveFailed(GuardOutpost) then + if Harkonnen.IsObjectiveFailed(GuardOutpost) then return end @@ -153,16 +153,16 @@ end SendHarkonnenReinforcements = function(delay, number) Trigger.AfterDelay(delay, function() - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements[number], HarkonnenPaths[number], { HarkonnenPaths[number][1] }) + Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements[number], HarkonnenPaths[number], { HarkonnenPaths[number][1] }) Trigger.AfterDelay(DateTime.Seconds(5), function() - Media.PlaySpeechNotification(player, "Reinforce") + Media.PlaySpeechNotification(Harkonnen, "Reinforce") end) end) end OrdosReinforcementNotification = function(currentWave, totalWaves) Trigger.AfterDelay(OrdosAttackDelay[Difficulty], function() - if player.IsObjectiveFailed(GuardOutpost) or player.IsObjectiveCompleted(KillOrdos) then + if Harkonnen.IsObjectiveFailed(GuardOutpost) or Harkonnen.IsObjectiveCompleted(KillOrdos) then return end @@ -179,62 +179,62 @@ end Tick = function() - if player.HasNoRequiredUnits() then - ordos_main.MarkCompletedObjective(KillHarkonnen1) - ordos_small.MarkCompletedObjective(KillHarkonnen2) - corrino.MarkCompletedObjective(KillHarkonnen3) + if Harkonnen.HasNoRequiredUnits() then + OrdosMain.MarkCompletedObjective(KillHarkonnen1) + OrdosSmall.MarkCompletedObjective(KillHarkonnen2) + Corrino.MarkCompletedObjective(KillHarkonnen3) end - if ordos_main.HasNoRequiredUnits() and ordos_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillOrdos) then + if OrdosMain.HasNoRequiredUnits() and OrdosSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillOrdos) then Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat) - player.MarkCompletedObjective(KillOrdos) + Harkonnen.MarkCompletedObjective(KillOrdos) end - if corrino.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillCorrino) then + if Corrino.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillCorrino) then Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat) - player.MarkCompletedObjective(KillCorrino) + Harkonnen.MarkCompletedObjective(KillCorrino) end - if player.IsObjectiveCompleted(KillOrdos) and player.IsObjectiveCompleted(KillCorrino) and not player.IsObjectiveCompleted(GuardOutpost) then - player.MarkCompletedObjective(GuardOutpost) + if Harkonnen.IsObjectiveCompleted(KillOrdos) and Harkonnen.IsObjectiveCompleted(KillCorrino) and not Harkonnen.IsObjectiveCompleted(GuardOutpost) then + Harkonnen.MarkCompletedObjective(GuardOutpost) end - if (HOutpost.IsDead or HOutpost.Owner ~= player) and not player.IsObjectiveFailed(GuardOutpost) then - player.MarkFailedObjective(GuardOutpost) + if (HOutpost.IsDead or HOutpost.Owner ~= Harkonnen) and not Harkonnen.IsObjectiveFailed(GuardOutpost) then + Harkonnen.MarkFailedObjective(GuardOutpost) end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then - local units = ordos_main.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosMain] then + local units = OrdosMain.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[ordos_main] = false - ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty]) + LastHarvesterEaten[OrdosMain] = false + ProtectHarvester(units[1], OrdosMain, AttackGroupSize[Difficulty]) end end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then - local units = ordos_small.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosSmall] then + local units = OrdosSmall.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[ordos_small] = false - ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty]) + LastHarvesterEaten[OrdosSmall] = false + ProtectHarvester(units[1], OrdosSmall, AttackGroupSize[Difficulty]) end end end WorldLoaded = function() - ordos_main = Player.GetPlayer("Ordos Main Base") - ordos_small = Player.GetPlayer("Ordos Small Base") - corrino = Player.GetPlayer("Corrino") - player = Player.GetPlayer("Harkonnen") + OrdosMain = Player.GetPlayer("Ordos Main Base") + OrdosSmall = Player.GetPlayer("Ordos Small Base") + Corrino = Player.GetPlayer("Corrino") + Harkonnen = Player.GetPlayer("Harkonnen") - InitObjectives(player) - KillOrdos = AddPrimaryObjective(player, "destroy-ordos") - KillCorrino = AddPrimaryObjective(player, "destroy-imperial-forces") - GuardOutpost = AddSecondaryObjective(player, "keep-modified-outpost-intact") - KillHarkonnen1 = AddPrimaryObjective(ordos_main, "") - KillHarkonnen2 = AddPrimaryObjective(ordos_small, "") - KillHarkonnen3 = AddPrimaryObjective(corrino, "") + InitObjectives(Harkonnen) + KillOrdos = AddPrimaryObjective(Harkonnen, "destroy-ordos") + KillCorrino = AddPrimaryObjective(Harkonnen, "destroy-imperial-forces") + GuardOutpost = AddSecondaryObjective(Harkonnen, "keep-modified-outpost-intact") + KillHarkonnen1 = AddPrimaryObjective(OrdosMain, "") + KillHarkonnen2 = AddPrimaryObjective(OrdosSmall, "") + KillHarkonnen3 = AddPrimaryObjective(Corrino, "") HOutpost.GrantCondition("modified") @@ -242,15 +242,15 @@ WorldLoaded = function() OrdosAttackLocation = HConYard.Location Trigger.OnAllKilledOrCaptured(OrdosMainBase, function() - Utils.Do(ordos_main.GetGroundAttackers(), IdleHunt) + Utils.Do(OrdosMain.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function() - Utils.Do(ordos_small.GetGroundAttackers(), IdleHunt) + Utils.Do(OrdosSmall.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(CorrinoBase, function() - Utils.Do(corrino.GetGroundAttackers(), IdleHunt) + Utils.Do(Corrino.GetGroundAttackers(), IdleHunt) end) Trigger.AfterDelay(DateTime.Seconds(5), function() @@ -258,28 +258,28 @@ WorldLoaded = function() end) local path = function() return Utils.Random(OrdosPaths) end - local waveCondition = function() return player.IsObjectiveCompleted(KillOrdos) end + local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillOrdos) end local huntFunction = function(unit) unit.AttackMove(OrdosAttackLocation) IdleHunt(unit) end - SendCarryallReinforcements(ordos_main, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction) + SendCarryallReinforcements(OrdosMain, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction) OrdosReinforcementNotification(0, OrdosAttackWaves[Difficulty]) SendStarportReinforcements() - Actor.Create("upgrade.barracks", true, { Owner = ordos_main }) - Actor.Create("upgrade.light", true, { Owner = ordos_main }) - Actor.Create("upgrade.heavy", true, { Owner = ordos_main }) - Actor.Create("upgrade.barracks", true, { Owner = ordos_small }) - Actor.Create("upgrade.light", true, { Owner = ordos_small }) + Actor.Create("upgrade.barracks", true, { Owner = OrdosMain }) + Actor.Create("upgrade.light", true, { Owner = OrdosMain }) + Actor.Create("upgrade.heavy", true, { Owner = OrdosMain }) + Actor.Create("upgrade.barracks", true, { Owner = OrdosSmall }) + Actor.Create("upgrade.light", true, { Owner = OrdosSmall }) Trigger.AfterDelay(0, ActivateAI) SendHarkonnenReinforcements(DateTime.Seconds(15), 1) SendHarkonnenReinforcements(DateTime.Seconds(30), 1) SendHarkonnenReinforcements(DateTime.Seconds(35), 2) - local ordosCondition = function() return player.IsObjectiveCompleted(KillOrdos) end - TriggerCarryallReinforcements(player, ordos_main, BaseAreaTriggers[1], OrdosHunters[1], OrdosHunterPaths[2], ordosCondition) - TriggerCarryallReinforcements(player, ordos_main, BaseAreaTriggers[2], OrdosHunters[2], OrdosHunterPaths[1], ordosCondition) + local ordosCondition = function() return Harkonnen.IsObjectiveCompleted(KillOrdos) end + TriggerCarryallReinforcements(Harkonnen, OrdosMain, BaseAreaTriggers[1], OrdosHunters[1], OrdosHunterPaths[2], ordosCondition) + TriggerCarryallReinforcements(Harkonnen, OrdosMain, BaseAreaTriggers[2], OrdosHunters[2], OrdosHunterPaths[1], ordosCondition) end diff --git a/mods/d2k/maps/harkonnen-06a/harkonnen06a-AI.lua b/mods/d2k/maps/harkonnen-06a/harkonnen06a-AI.lua index 101ff6119a..8b93d4b75c 100644 --- a/mods/d2k/maps/harkonnen-06a/harkonnen06a-AI.lua +++ b/mods/d2k/maps/harkonnen-06a/harkonnen06a-AI.lua @@ -27,11 +27,11 @@ OrdosTankTypes = { "combat_tank_o", "combat_tank_o", "siege_tank" } OrdosStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_o.starport", "combat_tank_o.starport", "siege_tank.starport", "missile_tank.starport" } ActivateAI = function() - IdlingUnits[ordos_main] = Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[2], InitialOrdosPaths[2]) - IdlingUnits[ordos_small] = Reinforcements.Reinforce(ordos_small, InitialOrdosReinforcements[1], InitialOrdosPaths[3]) + IdlingUnits[OrdosMain] = Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[2], InitialOrdosPaths[2]) + IdlingUnits[OrdosSmall] = Reinforcements.Reinforce(OrdosSmall, InitialOrdosReinforcements[1], InitialOrdosPaths[3]) - DefendAndRepairBase(ordos_main, OrdosMainBase, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(ordos_small, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(OrdosMain, OrdosMainBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(OrdosSmall, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty]) local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end @@ -40,11 +40,11 @@ ActivateAI = function() local unitsToBuy = function() return { Utils.Random(OrdosStarportTypes) } end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 - ProduceUnits(ordos_main, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos_main, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos_main, OHeavyFactory1, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos_main, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosMain, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosMain, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosMain, OHeavyFactory1, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosMain, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos_small, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos_small, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosSmall, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosSmall, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/harkonnen-06a/harkonnen06a.lua b/mods/d2k/maps/harkonnen-06a/harkonnen06a.lua index 371960be7d..5b9d9d55f0 100644 --- a/mods/d2k/maps/harkonnen-06a/harkonnen06a.lua +++ b/mods/d2k/maps/harkonnen-06a/harkonnen06a.lua @@ -115,11 +115,11 @@ HarkonnenPaths = SendStarportReinforcements = function() Trigger.AfterDelay(OrdosStarportDelay[Difficulty], function() - if OStarport.IsDead or OStarport.Owner ~= ordos_main then + if OStarport.IsDead or OStarport.Owner ~= OrdosMain then return end - local units = Reinforcements.ReinforceWithTransport(ordos_main, "frigate", OrdosStarportReinforcements[Difficulty], { OrdosStarportEntry.Location, OStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })[2] + local units = Reinforcements.ReinforceWithTransport(OrdosMain, "frigate", OrdosStarportReinforcements[Difficulty], { OrdosStarportEntry.Location, OStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })[2] Utils.Do(units, function(unit) unit.AttackMove(OrdosAttackLocation) IdleHunt(unit) @@ -133,9 +133,9 @@ end SendHarkonnenReinforcements = function(delay, number) Trigger.AfterDelay(delay, function() - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements[number], HarkonnenPaths[number], { HarkonnenPaths[number][1] }) + Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements[number], HarkonnenPaths[number], { HarkonnenPaths[number][1] }) Trigger.AfterDelay(DateTime.Seconds(5), function() - Media.PlaySpeechNotification(player, "Reinforce") + Media.PlaySpeechNotification(Harkonnen, "Reinforce") end) end) end @@ -152,45 +152,45 @@ end CheckSmugglerEnemies = function() Utils.Do(SmugglerUnits, function(unit) Trigger.OnDamaged(unit, function(self, attacker) - if unit.Owner == smuggler_neutral and attacker.Owner == player then - ChangeOwner(smuggler_neutral, smuggler_harkonnen) + if unit.Owner == SmugglerNeutral and attacker.Owner == Harkonnen then + ChangeOwner(SmugglerNeutral, SmugglerHarkonnen) -- Ensure that harvesters that was on a carryall switched sides. Trigger.AfterDelay(DateTime.Seconds(15), function() - ChangeOwner(smuggler_neutral, smuggler_harkonnen) + ChangeOwner(SmugglerNeutral, SmugglerHarkonnen) end) end - if unit.Owner == smuggler_ordos and attacker.Owner == player then - ChangeOwner(smuggler_ordos, smuggler_both) + if unit.Owner == SmugglerOrdos and attacker.Owner == Harkonnen then + ChangeOwner(SmugglerOrdos, SmugglerBoth) -- Ensure that harvesters that was on a carryall switched sides. Trigger.AfterDelay(DateTime.Seconds(15), function() - ChangeOwner(smuggler_ordos, smuggler_both) + ChangeOwner(SmugglerOrdos, SmugglerBoth) end) end - if unit.Owner == smuggler_neutral and (attacker.Owner == ordos_main or attacker.Owner == ordos_small) then - ChangeOwner(smuggler_neutral, smuggler_ordos) + if unit.Owner == SmugglerNeutral and (attacker.Owner == OrdosMain or attacker.Owner == OrdosSmall) then + ChangeOwner(SmugglerNeutral, SmugglerOrdos) -- Ensure that harvesters that was on a carryall switched sides. Trigger.AfterDelay(DateTime.Seconds(15), function() - ChangeOwner(smuggler_neutral, smuggler_ordos) + ChangeOwner(SmugglerNeutral, SmugglerOrdos) end) end - if unit.Owner == smuggler_harkonnen and (attacker.Owner == ordos_main or attacker.Owner == ordos_small) then - ChangeOwner(smuggler_harkonnen, smuggler_both) + if unit.Owner == SmugglerHarkonnen and (attacker.Owner == OrdosMain or attacker.Owner == OrdosSmall) then + ChangeOwner(SmugglerHarkonnen, SmugglerBoth) -- Ensure that harvesters that was on a carryall switched sides. Trigger.AfterDelay(DateTime.Seconds(15), function() - ChangeOwner(smuggler_harkonnen, smuggler_both) + ChangeOwner(SmugglerHarkonnen, SmugglerBoth) end) end - if attacker.Owner == player and not message_check then + if attacker.Owner == Harkonnen and not MessageCheck then - message_check = true + MessageCheck = true Media.DisplayMessage(UserInterface.Translate("smugglers-now-hostile"), Mentat) end end) @@ -198,61 +198,61 @@ CheckSmugglerEnemies = function() end Tick = function() - if player.HasNoRequiredUnits() then - ordos_main.MarkCompletedObjective(KillHarkonnen1) - ordos_small.MarkCompletedObjective(KillHarkonnen2) + if Harkonnen.HasNoRequiredUnits() then + OrdosMain.MarkCompletedObjective(KillHarkonnen1) + OrdosSmall.MarkCompletedObjective(KillHarkonnen2) end - if ordos_main.HasNoRequiredUnits() and ordos_small.HasNoRequiredUnits() and not OrdosKilled then + if OrdosMain.HasNoRequiredUnits() and OrdosSmall.HasNoRequiredUnits() and not OrdosKilled then Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat) OrdosKilled = true end - if smuggler_neutral.HasNoRequiredUnits() and smuggler_harkonnen.HasNoRequiredUnits() and smuggler_ordos.HasNoRequiredUnits() and smuggler_both.HasNoRequiredUnits() and not SmugglersKilled then + if SmugglerNeutral.HasNoRequiredUnits() and SmugglerHarkonnen.HasNoRequiredUnits() and SmugglerOrdos.HasNoRequiredUnits() and SmugglerBoth.HasNoRequiredUnits() and not SmugglersKilled then Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat) SmugglersKilled = true end - if (OStarport.IsDead or OStarport.Owner == player) and not player.IsObjectiveCompleted(DestroyStarport) then - player.MarkCompletedObjective(DestroyStarport) + if (OStarport.IsDead or OStarport.Owner == Harkonnen) and not Harkonnen.IsObjectiveCompleted(DestroyStarport) then + Harkonnen.MarkCompletedObjective(DestroyStarport) end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then - local units = ordos_main.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosMain] then + local units = OrdosMain.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[ordos_main] = false - ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty]) + LastHarvesterEaten[OrdosMain] = false + ProtectHarvester(units[1], OrdosMain, AttackGroupSize[Difficulty]) end end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then - local units = ordos_small.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosSmall] then + local units = OrdosSmall.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[ordos_small] = false - ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty]) + LastHarvesterEaten[OrdosSmall] = false + ProtectHarvester(units[1], OrdosSmall, AttackGroupSize[Difficulty]) end end end WorldLoaded = function() - ordos_main = Player.GetPlayer("Ordos Main Base") - ordos_small = Player.GetPlayer("Ordos Small Base") - smuggler_neutral = Player.GetPlayer("Smugglers - Neutral") - smuggler_harkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen") - smuggler_ordos = Player.GetPlayer("Smugglers - Enemy to Ordos") - smuggler_both = Player.GetPlayer("Smugglers - Enemy to Both") - player = Player.GetPlayer("Harkonnen") + OrdosMain = Player.GetPlayer("Ordos Main Base") + OrdosSmall = Player.GetPlayer("Ordos Small Base") + SmugglerNeutral = Player.GetPlayer("Smugglers - Neutral") + SmugglerHarkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen") + SmugglerOrdos = Player.GetPlayer("Smugglers - Enemy to Ordos") + SmugglerBoth = Player.GetPlayer("Smugglers - Enemy to Both") + Harkonnen = Player.GetPlayer("Harkonnen") - InitObjectives(player) - DestroyStarport = AddPrimaryObjective(player, "capture-destroy-ordos-starport") - KillHarkonnen1 = AddPrimaryObjective(ordos_main, "") - KillHarkonnen2 = AddPrimaryObjective(ordos_small, "") + InitObjectives(Harkonnen) + DestroyStarport = AddPrimaryObjective(Harkonnen, "capture-destroy-ordos-starport") + KillHarkonnen1 = AddPrimaryObjective(OrdosMain, "") + KillHarkonnen2 = AddPrimaryObjective(OrdosSmall, "") -- Wait for carryall drop Trigger.AfterDelay(DateTime.Seconds(10), function() - SmugglerUnits = smuggler_neutral.GetActors() + SmugglerUnits = SmugglerNeutral.GetActors() CheckSmugglerEnemies() end) @@ -260,11 +260,11 @@ WorldLoaded = function() OrdosAttackLocation = HMCV.Location Trigger.OnAllKilledOrCaptured(OrdosMainBase, function() - Utils.Do(ordos_main.GetGroundAttackers(), IdleHunt) + Utils.Do(OrdosMain.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function() - Utils.Do(ordos_small.GetGroundAttackers(), IdleHunt) + Utils.Do(OrdosSmall.GetGroundAttackers(), IdleHunt) end) local path = function() return Utils.Random(OrdosPaths) end @@ -273,15 +273,15 @@ WorldLoaded = function() unit.AttackMove(OrdosAttackLocation) IdleHunt(unit) end - SendCarryallReinforcements(ordos_main, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction) + SendCarryallReinforcements(OrdosMain, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction) SendStarportReinforcements() - Actor.Create("upgrade.barracks", true, { Owner = ordos_main }) - Actor.Create("upgrade.light", true, { Owner = ordos_main }) - Actor.Create("upgrade.heavy", true, { Owner = ordos_main }) - Actor.Create("upgrade.barracks", true, { Owner = ordos_small }) - Actor.Create("upgrade.light", true, { Owner = ordos_small }) + Actor.Create("upgrade.barracks", true, { Owner = OrdosMain }) + Actor.Create("upgrade.light", true, { Owner = OrdosMain }) + Actor.Create("upgrade.heavy", true, { Owner = OrdosMain }) + Actor.Create("upgrade.barracks", true, { Owner = OrdosSmall }) + Actor.Create("upgrade.light", true, { Owner = OrdosSmall }) Trigger.AfterDelay(0, ActivateAI) SendHarkonnenReinforcements(DateTime.Minutes(2) + DateTime.Seconds(15), 2) diff --git a/mods/d2k/maps/harkonnen-06b/harkonnen06b-AI.lua b/mods/d2k/maps/harkonnen-06b/harkonnen06b-AI.lua index 4cf19c5b84..99eafa92a8 100644 --- a/mods/d2k/maps/harkonnen-06b/harkonnen06b-AI.lua +++ b/mods/d2k/maps/harkonnen-06b/harkonnen06b-AI.lua @@ -27,11 +27,11 @@ OrdosTankTypes = { "combat_tank_o", "combat_tank_o", "siege_tank" } OrdosStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_o.starport", "combat_tank_o.starport", "siege_tank.starport", "missile_tank.starport" } ActivateAI = function() - IdlingUnits[ordos_main] = Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos_main, InitialOrdosReinforcements[2], InitialOrdosPaths[2]) - IdlingUnits[ordos_small] = Reinforcements.Reinforce(ordos_small, InitialOrdosReinforcements[1], InitialOrdosPaths[3]) + IdlingUnits[OrdosMain] = Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(OrdosMain, InitialOrdosReinforcements[2], InitialOrdosPaths[2]) + IdlingUnits[OrdosSmall] = Reinforcements.Reinforce(OrdosSmall, InitialOrdosReinforcements[1], InitialOrdosPaths[3]) - DefendAndRepairBase(ordos_main, OrdosMainBase, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(ordos_small, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(OrdosMain, OrdosMainBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(OrdosSmall, OrdosSmallBase, 0.75, AttackGroupSize[Difficulty]) local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local infantryToBuild = function() return { Utils.Random(OrdosInfantryTypes) } end @@ -40,11 +40,11 @@ ActivateAI = function() local unitsToBuy = function() return { Utils.Random(OrdosStarportTypes) } end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 - ProduceUnits(ordos_main, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos_main, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos_main, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos_main, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosMain, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosMain, OLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosMain, OHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosMain, OStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos_small, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos_small, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosSmall, OBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(OrdosSmall, OLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/harkonnen-06b/harkonnen06b.lua b/mods/d2k/maps/harkonnen-06b/harkonnen06b.lua index 6265acac75..9b77ee8f54 100644 --- a/mods/d2k/maps/harkonnen-06b/harkonnen06b.lua +++ b/mods/d2k/maps/harkonnen-06b/harkonnen06b.lua @@ -102,11 +102,11 @@ InitialOrdosPaths = SendStarportReinforcements = function() Trigger.AfterDelay(OrdosStarportDelay[Difficulty], function() - if OStarport.IsDead or OStarport.Owner ~= ordos_main then + if OStarport.IsDead or OStarport.Owner ~= OrdosMain then return end - local units = Reinforcements.ReinforceWithTransport(ordos_main, "frigate", OrdosStarportReinforcements[Difficulty], { OrdosStarportEntry.Location, OStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })[2] + local units = Reinforcements.ReinforceWithTransport(OrdosMain, "frigate", OrdosStarportReinforcements[Difficulty], { OrdosStarportEntry.Location, OStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location })[2] Utils.Do(units, function(unit) unit.AttackMove(OrdosAttackLocation) IdleHunt(unit) @@ -130,25 +130,25 @@ end CheckSmugglerEnemies = function() Utils.Do(SmugglerUnits, function(unit) Trigger.OnDamaged(unit, function(self, attacker) - if unit.Owner == smuggler_neutral and attacker.Owner == player then - ChangeOwner(smuggler_neutral, smuggler_harkonnen) + if unit.Owner == SmugglerNeutral and attacker.Owner == Harkonnen then + ChangeOwner(SmugglerNeutral, SmugglerHarkonnen) end - if unit.Owner == smuggler_ordos and attacker.Owner == player then - ChangeOwner(smuggler_ordos, smuggler_both) + if unit.Owner == SmugglerOrdos and attacker.Owner == Harkonnen then + ChangeOwner(SmugglerOrdos, SmugglerBoth) end - if unit.Owner == smuggler_neutral and (attacker.Owner == ordos_main or attacker.Owner == ordos_small) then - ChangeOwner(smuggler_neutral, smuggler_ordos) + if unit.Owner == SmugglerNeutral and (attacker.Owner == OrdosMain or attacker.Owner == OrdosSmall) then + ChangeOwner(SmugglerNeutral, SmugglerOrdos) end - if unit.Owner == smuggler_harkonnen and (attacker.Owner == ordos_main or attacker.Owner == ordos_small) then - ChangeOwner(smuggler_harkonnen, smuggler_both) + if unit.Owner == SmugglerHarkonnen and (attacker.Owner == OrdosMain or attacker.Owner == OrdosSmall) then + ChangeOwner(SmugglerHarkonnen, SmugglerBoth) end - if attacker.Owner == player and not message_check then + if attacker.Owner == Harkonnen and not MessageCheck then - message_check = true + MessageCheck = true Media.DisplayMessage(UserInterface.Translate("smugglers-now-hostile"), Mentat) end end) @@ -156,61 +156,61 @@ CheckSmugglerEnemies = function() end Tick = function() - if player.HasNoRequiredUnits() then - ordos_main.MarkCompletedObjective(KillHarkonnen1) - ordos_small.MarkCompletedObjective(KillHarkonnen2) + if Harkonnen.HasNoRequiredUnits() then + OrdosMain.MarkCompletedObjective(KillHarkonnen1) + OrdosSmall.MarkCompletedObjective(KillHarkonnen2) end - if ordos_main.HasNoRequiredUnits() and ordos_small.HasNoRequiredUnits() and not OrdosKilled then + if OrdosMain.HasNoRequiredUnits() and OrdosSmall.HasNoRequiredUnits() and not OrdosKilled then Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat) OrdosKilled = true end - if smuggler_neutral.HasNoRequiredUnits() and smuggler_harkonnen.HasNoRequiredUnits() and smuggler_ordos.HasNoRequiredUnits() and smuggler_both.HasNoRequiredUnits() and not SmugglersKilled then + if SmugglerNeutral.HasNoRequiredUnits() and SmugglerHarkonnen.HasNoRequiredUnits() and SmugglerOrdos.HasNoRequiredUnits() and SmugglerBoth.HasNoRequiredUnits() and not SmugglersKilled then Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat) SmugglersKilled = true end - if (OStarport.IsDead or OStarport.Owner == player) and not player.IsObjectiveCompleted(DestroyStarport) then - player.MarkCompletedObjective(DestroyStarport) + if (OStarport.IsDead or OStarport.Owner == Harkonnen) and not Harkonnen.IsObjectiveCompleted(DestroyStarport) then + Harkonnen.MarkCompletedObjective(DestroyStarport) end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then - local units = ordos_main.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosMain] then + local units = OrdosMain.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[ordos_main] = false - ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty]) + LastHarvesterEaten[OrdosMain] = false + ProtectHarvester(units[1], OrdosMain, AttackGroupSize[Difficulty]) end end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then - local units = ordos_small.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosSmall] then + local units = OrdosSmall.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[ordos_small] = false - ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty]) + LastHarvesterEaten[OrdosSmall] = false + ProtectHarvester(units[1], OrdosSmall, AttackGroupSize[Difficulty]) end end end WorldLoaded = function() - ordos_main = Player.GetPlayer("Ordos Main Base") - ordos_small = Player.GetPlayer("Ordos Small Base") - smuggler_neutral = Player.GetPlayer("Smugglers - Neutral") - smuggler_harkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen") - smuggler_ordos = Player.GetPlayer("Smugglers - Enemy to Ordos") - smuggler_both = Player.GetPlayer("Smugglers - Enemy to Both") - player = Player.GetPlayer("Harkonnen") + OrdosMain = Player.GetPlayer("Ordos Main Base") + OrdosSmall = Player.GetPlayer("Ordos Small Base") + SmugglerNeutral = Player.GetPlayer("Smugglers - Neutral") + SmugglerHarkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen") + SmugglerOrdos = Player.GetPlayer("Smugglers - Enemy to Ordos") + SmugglerBoth = Player.GetPlayer("Smugglers - Enemy to Both") + Harkonnen = Player.GetPlayer("Harkonnen") - InitObjectives(player) - DestroyStarport = AddPrimaryObjective(player, "capture-destroy-ordos-starport") - KillHarkonnen1 = AddPrimaryObjective(ordos_main, "") - KillHarkonnen2 = AddPrimaryObjective(ordos_small, "") + InitObjectives(Harkonnen) + DestroyStarport = AddPrimaryObjective(Harkonnen, "capture-destroy-ordos-starport") + KillHarkonnen1 = AddPrimaryObjective(OrdosMain, "") + KillHarkonnen2 = AddPrimaryObjective(OrdosSmall, "") -- Wait for carryall drop Trigger.AfterDelay(DateTime.Seconds(15), function() - SmugglerUnits = smuggler_neutral.GetActors() + SmugglerUnits = SmugglerNeutral.GetActors() CheckSmugglerEnemies() end) @@ -218,11 +218,11 @@ WorldLoaded = function() OrdosAttackLocation = HConYard.Location Trigger.OnAllKilledOrCaptured(OrdosMainBase, function() - Utils.Do(ordos_main.GetGroundAttackers(), IdleHunt) + Utils.Do(OrdosMain.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(OrdosSmallBase, function() - Utils.Do(ordos_small.GetGroundAttackers(), IdleHunt) + Utils.Do(OrdosSmall.GetGroundAttackers(), IdleHunt) end) local path = function() return Utils.Random(OrdosPaths) end @@ -231,14 +231,14 @@ WorldLoaded = function() unit.AttackMove(OrdosAttackLocation) IdleHunt(unit) end - SendCarryallReinforcements(ordos_main, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction) + SendCarryallReinforcements(OrdosMain, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction) SendStarportReinforcements() - Actor.Create("upgrade.barracks", true, { Owner = ordos_main }) - Actor.Create("upgrade.light", true, { Owner = ordos_main }) - Actor.Create("upgrade.heavy", true, { Owner = ordos_main }) - Actor.Create("upgrade.barracks", true, { Owner = ordos_small }) - Actor.Create("upgrade.light", true, { Owner = ordos_small }) + Actor.Create("upgrade.barracks", true, { Owner = OrdosMain }) + Actor.Create("upgrade.light", true, { Owner = OrdosMain }) + Actor.Create("upgrade.heavy", true, { Owner = OrdosMain }) + Actor.Create("upgrade.barracks", true, { Owner = OrdosSmall }) + Actor.Create("upgrade.light", true, { Owner = OrdosSmall }) Trigger.AfterDelay(0, ActivateAI) end diff --git a/mods/d2k/maps/harkonnen-07/harkonnen07-AI.lua b/mods/d2k/maps/harkonnen-07/harkonnen07-AI.lua index 52b7a0071a..8ac308d910 100644 --- a/mods/d2k/maps/harkonnen-07/harkonnen07-AI.lua +++ b/mods/d2k/maps/harkonnen-07/harkonnen07-AI.lua @@ -37,13 +37,13 @@ AtreidesStarportTypes = { "trike.starport", "trike.starport", "quad.starport", " CorrinoInfantryTypes = { "light_inf", "trooper", "sardaukar" } ActivateAI = function() - IdlingUnits[atreides_main] = Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[Difficulty][1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[Difficulty][2], InitialAtreidesPaths[2]) - IdlingUnits[atreides_small] = Reinforcements.Reinforce(atreides_small, InitialAtreidesReinforcements[Difficulty][1], InitialAtreidesPaths[3]) - IdlingUnits[corrino] = Reinforcements.Reinforce(corrino, InitialCorrinoReinforcements, InitialCorrinoPath) + IdlingUnits[AtreidesMain] = Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[Difficulty][1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[Difficulty][2], InitialAtreidesPaths[2]) + IdlingUnits[AtreidesSmall] = Reinforcements.Reinforce(AtreidesSmall, InitialAtreidesReinforcements[Difficulty][1], InitialAtreidesPaths[3]) + IdlingUnits[Corrino] = Reinforcements.Reinforce(Corrino, InitialCorrinoReinforcements, InitialCorrinoPath) - DefendAndRepairBase(atreides_main, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(atreides_small, AtreidesSmallBase, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(corrino, CorrinoBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(AtreidesMain, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(AtreidesSmall, AtreidesSmallBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(Corrino, CorrinoBase, 0.75, AttackGroupSize[Difficulty]) local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local infantryToBuildAtreides = function() return { Utils.Random(AtreidesInfantryTypes) } end @@ -55,13 +55,13 @@ ActivateAI = function() local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 Trigger.AfterDelay(InitialProductionDelay[Difficulty], function() - ProduceUnits(atreides_main, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_main, AHeavyFactory1, delay, tanksToBuildMain, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_main, AStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesMain, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesMain, AHeavyFactory1, delay, tanksToBuildMain, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesMain, AStarport, delay, unitsToBuy, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_small, ABarracks, delay, infantryToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_small, AHeavyFactory2, delay, tanksToBuildSmall, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesSmall, ABarracks, delay, infantryToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesSmall, AHeavyFactory2, delay, tanksToBuildSmall, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(corrino, CBarracks, delay, infantryToBuildCorrino, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Corrino, CBarracks, delay, infantryToBuildCorrino, AttackGroupSize[Difficulty], attackThresholdSize) end) end diff --git a/mods/d2k/maps/harkonnen-07/harkonnen07.lua b/mods/d2k/maps/harkonnen-07/harkonnen07.lua index 1beb105d40..1490435400 100644 --- a/mods/d2k/maps/harkonnen-07/harkonnen07.lua +++ b/mods/d2k/maps/harkonnen-07/harkonnen07.lua @@ -124,9 +124,9 @@ HarkonnenPaths = } SendHarkonnenReinforcements = function(number) - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements[Difficulty][number], HarkonnenPaths[number], { HarkonnenPaths[number][1] }) + Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements[Difficulty][number], HarkonnenPaths[number], { HarkonnenPaths[number][1] }) Trigger.AfterDelay(DateTime.Seconds(9), function() - Media.PlaySpeechNotification(player, "Reinforce") + Media.PlaySpeechNotification(Harkonnen, "Reinforce") end) end @@ -152,7 +152,7 @@ SendAirStrike = function() return end - local targets = Utils.Where(player.GetActors(), function(actor) + local targets = Utils.Where(Harkonnen.GetActors(), function(actor) return actor.HasProperty("Sell") and actor.Type ~= "wall" and @@ -170,63 +170,63 @@ SendAirStrike = function() end Tick = function() - if player.HasNoRequiredUnits() then - atreides_main.MarkCompletedObjective(KillHarkonnen1) - atreides_small.MarkCompletedObjective(KillHarkonnen2) - corrino.MarkCompletedObjective(KillHarkonnen3) + if Harkonnen.HasNoRequiredUnits() then + AtreidesMain.MarkCompletedObjective(KillHarkonnen1) + AtreidesSmall.MarkCompletedObjective(KillHarkonnen2) + Corrino.MarkCompletedObjective(KillHarkonnen3) end - if atreides_main.HasNoRequiredUnits() and atreides_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then + if AtreidesMain.HasNoRequiredUnits() and AtreidesSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) - player.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end - if corrino.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillCorrino) then + if Corrino.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillCorrino) then Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat) - player.MarkCompletedObjective(KillCorrino) + Harkonnen.MarkCompletedObjective(KillCorrino) end - if (HEngineer.IsDead or AConYard2.IsDead) and not player.IsObjectiveCompleted(CaptureAtreidesConYard) then - player.MarkFailedObjective(CaptureAtreidesConYard) + if (HEngineer.IsDead or AConYard2.IsDead) and not Harkonnen.IsObjectiveCompleted(CaptureAtreidesConYard) then + Harkonnen.MarkFailedObjective(CaptureAtreidesConYard) end - if (AHiTechFactory.IsDead or AHiTechFactory.Owner ~= atreides_main) and not HiTechIsDead then + if (AHiTechFactory.IsDead or AHiTechFactory.Owner ~= AtreidesMain) and not HiTechIsDead then Media.DisplayMessage(UserInterface.Translate("high-tech-factory-neutralized-imperial-reinforcements"), Mentat) HiTechIsDead = true end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_main] then - local units = ordos_main.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosMain] then + local units = OrdosMain.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[ordos_main] = false - ProtectHarvester(units[1], ordos_main, AttackGroupSize[Difficulty]) + LastHarvesterEaten[OrdosMain] = false + ProtectHarvester(units[1], OrdosMain, AttackGroupSize[Difficulty]) end end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos_small] then - local units = ordos_small.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[OrdosSmall] then + local units = OrdosSmall.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[ordos_small] = false - ProtectHarvester(units[1], ordos_small, AttackGroupSize[Difficulty]) + LastHarvesterEaten[OrdosSmall] = false + ProtectHarvester(units[1], OrdosSmall, AttackGroupSize[Difficulty]) end end end WorldLoaded = function() - atreides_main = Player.GetPlayer("Atreides Main Base") - atreides_small = Player.GetPlayer("Atreides Small Base") - corrino = Player.GetPlayer("Corrino") - player = Player.GetPlayer("Harkonnen") + AtreidesMain = Player.GetPlayer("Atreides Main Base") + AtreidesSmall = Player.GetPlayer("Atreides Small Base") + Corrino = Player.GetPlayer("Corrino") + Harkonnen = Player.GetPlayer("Harkonnen") - InitObjectives(player) - CaptureAtreidesConYard = AddPrimaryObjective(player, "capture-atreides-construction-yard-south") - KillAtreides = AddPrimaryObjective(player, "destroy-atreides") - KillCorrino = AddPrimaryObjective(player, "destroy-corrino") - KillHarkonnen1 = AddPrimaryObjective(atreides_main, "") - KillHarkonnen2 = AddPrimaryObjective(atreides_small, "") - KillHarkonnen3 = AddPrimaryObjective(corrino, "") + InitObjectives(Harkonnen) + CaptureAtreidesConYard = AddPrimaryObjective(Harkonnen, "capture-atreides-construction-yard-south") + KillAtreides = AddPrimaryObjective(Harkonnen, "destroy-atreides") + KillCorrino = AddPrimaryObjective(Harkonnen, "destroy-corrino") + KillHarkonnen1 = AddPrimaryObjective(AtreidesMain, "") + KillHarkonnen2 = AddPrimaryObjective(AtreidesSmall, "") + KillHarkonnen3 = AddPrimaryObjective(Corrino, "") Media.DisplayMessage(UserInterface.Translate("destroy-atreides-high-tech-factory-imperial-reinforcements"), Mentat) @@ -236,39 +236,39 @@ WorldLoaded = function() Trigger.AfterDelay(DateTime.Minutes(5), SendAirStrike) Trigger.OnCapture(AConYard2, function() - player.MarkCompletedObjective(CaptureAtreidesConYard) + Harkonnen.MarkCompletedObjective(CaptureAtreidesConYard) end) Trigger.OnAllKilledOrCaptured(AtreidesMainBase, function() - Utils.Do(atreides_main.GetGroundAttackers(), IdleHunt) + Utils.Do(AtreidesMain.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(AtreidesSmallBase, function() - Utils.Do(atreides_small.GetGroundAttackers(), IdleHunt) + Utils.Do(AtreidesSmall.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(CorrinoBase, function() - Utils.Do(corrino.GetGroundAttackers(), IdleHunt) + Utils.Do(Corrino.GetGroundAttackers(), IdleHunt) end) - local atreidesWaveCondition = function() return player.IsObjectiveCompleted(KillAtreides) or HiTechIsDead end - local corrinoWaveCondition = function() return player.IsObjectiveCompleted(KillCorrino) or HiTechIsDead end + local atreidesWaveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) or HiTechIsDead end + local corrinoWaveCondition = function() return Harkonnen.IsObjectiveCompleted(KillCorrino) or HiTechIsDead end local huntFunction = function(unit) unit.AttackMove(AtreidesAttackLocation) IdleHunt(unit) end - SendEnemyReinforcements(atreides_main, EnemyAttackDelay[Difficulty], AtreidesPath, AtreidesReinforcements[Difficulty], atreidesWaveCondition, huntFunction) + SendEnemyReinforcements(AtreidesMain, EnemyAttackDelay[Difficulty], AtreidesPath, AtreidesReinforcements[Difficulty], atreidesWaveCondition, huntFunction) Trigger.AfterDelay(CorrinoInitialAttackDelay[Difficulty], function() - SendEnemyReinforcements(corrino, EnemyAttackDelay[Difficulty], CorrinoPaths[1], CorrinoReinforcements[Difficulty][1], corrinoWaveCondition, huntFunction) - SendEnemyReinforcements(corrino, EnemyAttackDelay[Difficulty], CorrinoPaths[2], CorrinoReinforcements[Difficulty][2], corrinoWaveCondition, huntFunction) + SendEnemyReinforcements(Corrino, EnemyAttackDelay[Difficulty], CorrinoPaths[1], CorrinoReinforcements[Difficulty][1], corrinoWaveCondition, huntFunction) + SendEnemyReinforcements(Corrino, EnemyAttackDelay[Difficulty], CorrinoPaths[2], CorrinoReinforcements[Difficulty][2], corrinoWaveCondition, huntFunction) end) - Actor.Create("upgrade.light", true, { Owner = atreides_main }) - Actor.Create("upgrade.heavy", true, { Owner = atreides_main }) - Actor.Create("upgrade.hightech", true, { Owner = atreides_main }) - Actor.Create("upgrade.barracks", true, { Owner = atreides_small }) - Actor.Create("upgrade.heavy", true, { Owner = atreides_small }) - Actor.Create("upgrade.barracks", true, { Owner = corrino }) + Actor.Create("upgrade.light", true, { Owner = AtreidesMain }) + Actor.Create("upgrade.heavy", true, { Owner = AtreidesMain }) + Actor.Create("upgrade.hightech", true, { Owner = AtreidesMain }) + Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall }) + Actor.Create("upgrade.heavy", true, { Owner = AtreidesSmall }) + Actor.Create("upgrade.barracks", true, { Owner = Corrino }) Trigger.AfterDelay(0, ActivateAI) SendHarkonnenReinforcements(1) diff --git a/mods/d2k/maps/harkonnen-08/harkonnen08-AI.lua b/mods/d2k/maps/harkonnen-08/harkonnen08-AI.lua index effafc7d04..1ac23422ce 100644 --- a/mods/d2k/maps/harkonnen-08/harkonnen08-AI.lua +++ b/mods/d2k/maps/harkonnen-08/harkonnen08-AI.lua @@ -34,15 +34,15 @@ AtreidesStarportTypes = { "trike.starport", "trike.starport", "quad.starport", " MercenaryTankTypes = { "combat_tank_o", "combat_tank_o", "siege_tank" } ActivateAI = function() - IdlingUnits[ordos] = Reinforcements.Reinforce(ordos, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(ordos, InitialOrdosReinforcements[2], InitialOrdosPaths[2]) - IdlingUnits[atreides_enemy] = Reinforcements.Reinforce(atreides_enemy, InitialAtreidesReinforcements, InitialAtreidesPath) - IdlingUnits[atreides_neutral] = { } - IdlingUnits[mercenary_enemy] = Reinforcements.Reinforce(mercenary_enemy, InitialMercenaryReinforcements, InitialMercenaryPath) - IdlingUnits[mercenary_ally] = { } + IdlingUnits[Ordos] = Reinforcements.Reinforce(Ordos, InitialOrdosReinforcements[1], InitialOrdosPaths[1]), Reinforcements.Reinforce(Ordos, InitialOrdosReinforcements[2], InitialOrdosPaths[2]) + IdlingUnits[AtreidesEnemy] = Reinforcements.Reinforce(AtreidesEnemy, InitialAtreidesReinforcements, InitialAtreidesPath) + IdlingUnits[AtreidesNeutral] = { } + IdlingUnits[MercenaryEnemy] = Reinforcements.Reinforce(MercenaryEnemy, InitialMercenaryReinforcements, InitialMercenaryPath) + IdlingUnits[MercenaryAlly] = { } - DefendAndRepairBase(ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(atreides_enemy, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(mercenary_enemy, MercenaryBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(Ordos, OrdosBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(AtreidesEnemy, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(MercenaryEnemy, MercenaryBase, 0.75, AttackGroupSize[Difficulty]) local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end @@ -55,15 +55,15 @@ ActivateAI = function() local unitsToBuyAtreides = function() return { Utils.Random(AtreidesStarportTypes) } end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 - ProduceUnits(ordos, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos, OLightFactory, delay, vehilcesToBuildOrdos, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos, OHeavyFactory, delay, tanksToBuildOrdos, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(ordos, OStarport, delay, unitsToBuyOrdos, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Ordos, OBarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Ordos, OLightFactory, delay, vehilcesToBuildOrdos, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Ordos, OHeavyFactory, delay, tanksToBuildOrdos, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Ordos, OStarport, delay, unitsToBuyOrdos, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_enemy, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_enemy, ALightFactory, delay, vehilcesToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_enemy, AHeavyFactory, delay, tanksToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_enemy, AStarport, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesEnemy, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesEnemy, ALightFactory, delay, vehilcesToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesEnemy, AHeavyFactory, delay, tanksToBuildAtreides, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesEnemy, AStarport, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(mercenary_enemy, MHeavyFactory, delay, tanksToBuildMercenary, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(MercenaryEnemy, MHeavyFactory, delay, tanksToBuildMercenary, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/harkonnen-08/harkonnen08.lua b/mods/d2k/maps/harkonnen-08/harkonnen08.lua index c43c04b43a..916b48f8fa 100644 --- a/mods/d2k/maps/harkonnen-08/harkonnen08.lua +++ b/mods/d2k/maps/harkonnen-08/harkonnen08.lua @@ -105,7 +105,7 @@ SendStarportReinforcements = function(faction) return end - reinforcements = Utils.Random(MercenaryStarportReinforcements) + local reinforcements = Utils.Random(MercenaryStarportReinforcements) local units = Reinforcements.ReinforceWithTransport(faction, "frigate", reinforcements, { MercenaryStarportEntry.Location, MStarport.Location + CVec.New(1, 1) }, { MercenaryStarportExit.Location })[2] Utils.Do(units, function(unit) @@ -118,11 +118,11 @@ SendStarportReinforcements = function(faction) end SendAirStrike = function() - if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= atreides_enemy then + if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= AtreidesEnemy then return end - local targets = Utils.Where(player.GetActors(), function(actor) + local targets = Utils.Where(Harkonnen.GetActors(), function(actor) return actor.HasProperty("Sell") and actor.Type ~= "wall" and @@ -151,13 +151,13 @@ GetSaboteurTargets = function(player) end BuildSaboteur = function() - if OPalace.IsDead or OPalace.Owner ~= ordos then + if OPalace.IsDead or OPalace.Owner ~= Ordos then return end - local targets = GetSaboteurTargets(player) + local targets = GetSaboteurTargets(Harkonnen) if #targets > 0 then - local saboteur = Actor.Create("saboteur", true, { Owner = ordos, Location = OPalace.Location + CVec.New(0, 2) }) + local saboteur = Actor.Create("saboteur", true, { Owner = Ordos, Location = OPalace.Location + CVec.New(0, 2) }) saboteur.Move(saboteur.Location + CVec.New(0, 1)) saboteur.Wait(DateTime.Seconds(5)) @@ -173,7 +173,7 @@ BuildSaboteur = function() end SendSaboteur = function(saboteur) - local targets = GetSaboteurTargets(player) + local targets = GetSaboteurTargets(Harkonnen) if #targets < 1 then return end @@ -188,19 +188,19 @@ SendSaboteur = function(saboteur) end CheckAttackToAtreides = function() - AtreidesUnits = atreides_neutral.GetActors() + AtreidesUnits = AtreidesNeutral.GetActors() Utils.Do(AtreidesUnits, function(unit) Trigger.OnDamaged(unit, function(self, attacker) - if attacker.Owner == player and not check then - ChangeOwner(atreides_neutral, atreides_enemy) + if attacker.Owner == Harkonnen and not Check then + ChangeOwner(AtreidesNeutral, AtreidesEnemy) -- Ensure that harvesters that was on a carryall switched sides. Trigger.AfterDelay(DateTime.Seconds(15), function() - ChangeOwner(atreides_neutral, atreides_enemy) + ChangeOwner(AtreidesNeutral, AtreidesEnemy) end) - check = true + Check = true Media.DisplayMessage(UserInterface.Translate("atreides-hostile"), Mentat) end end) @@ -217,59 +217,59 @@ ChangeOwner = function(old_owner, new_owner) end Tick = function() - if player.HasNoRequiredUnits() then - ordos.MarkCompletedObjective(KillHarkonnen1) - atreides_enemy.MarkCompletedObjective(KillHarkonnen2) + if Harkonnen.HasNoRequiredUnits() then + Ordos.MarkCompletedObjective(KillHarkonnen1) + AtreidesEnemy.MarkCompletedObjective(KillHarkonnen2) end - if ordos.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillOrdos) then + if Ordos.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillOrdos) then Media.DisplayMessage(UserInterface.Translate("ordos-annihilated"), Mentat) - player.MarkCompletedObjective(KillOrdos) + Harkonnen.MarkCompletedObjective(KillOrdos) end - if atreides_enemy.HasNoRequiredUnits() and atreides_neutral.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then + if AtreidesEnemy.HasNoRequiredUnits() and AtreidesNeutral.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) - player.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end - if mercenary_enemy.HasNoRequiredUnits() and mercenary_ally.HasNoRequiredUnits() and not MercenariesDestroyed then + if MercenaryEnemy.HasNoRequiredUnits() and MercenaryAlly.HasNoRequiredUnits() and not MercenariesDestroyed then Media.DisplayMessage(UserInterface.Translate("mercenaries-annihilated"), Mentat) MercenariesDestroyed = true end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[ordos] then - local units = ordos.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Ordos] then + local units = Ordos.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[ordos] = false - ProtectHarvester(units[1], ordos, AttackGroupSize[Difficulty]) + LastHarvesterEaten[Ordos] = false + ProtectHarvester(units[1], Ordos, AttackGroupSize[Difficulty]) end end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_enemy] then - local units = atreides_enemy.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesEnemy] then + local units = AtreidesEnemy.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[atreides_enemy] = false - ProtectHarvester(units[1], atreides_enemy, AttackGroupSize[Difficulty]) + LastHarvesterEaten[AtreidesEnemy] = false + ProtectHarvester(units[1], AtreidesEnemy, AttackGroupSize[Difficulty]) end end end WorldLoaded = function() - ordos = Player.GetPlayer("Ordos") - atreides_enemy = Player.GetPlayer("Ordos Aligned Atreides") - atreides_neutral = Player.GetPlayer("Neutral Atreides") - mercenary_enemy = Player.GetPlayer("Ordos Aligned Mercenaries") - mercenary_ally = Player.GetPlayer("Harkonnen Aligned Mercenaries") - player = Player.GetPlayer("Harkonnen") + Ordos = Player.GetPlayer("Ordos") + AtreidesEnemy = Player.GetPlayer("Ordos Aligned Atreides") + AtreidesNeutral = Player.GetPlayer("Neutral Atreides") + MercenaryEnemy = Player.GetPlayer("Ordos Aligned Mercenaries") + MercenaryAlly = Player.GetPlayer("Harkonnen Aligned Mercenaries") + Harkonnen = Player.GetPlayer("Harkonnen") - InitObjectives(player) - KillOrdos = AddPrimaryObjective(player, "destroy-ordos") - KillAtreides = AddSecondaryObjective(player, "destroy-atreides") - AllyWithMercenaries = AddSecondaryObjective(player, "ally-mercenaries") - KillHarkonnen1 = AddPrimaryObjective(ordos, "") - KillHarkonnen2 = AddPrimaryObjective(atreides_enemy, "") + InitObjectives(Harkonnen) + KillOrdos = AddPrimaryObjective(Harkonnen, "destroy-ordos") + KillAtreides = AddSecondaryObjective(Harkonnen, "destroy-atreides") + AllyWithMercenaries = AddSecondaryObjective(Harkonnen, "ally-mercenaries") + KillHarkonnen1 = AddPrimaryObjective(Ordos, "") + KillHarkonnen2 = AddPrimaryObjective(AtreidesEnemy, "") Camera.Position = HMCV.CenterPosition OrdosAttackLocation = HMCV.Location @@ -279,66 +279,66 @@ WorldLoaded = function() Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(30), BuildSaboteur) Trigger.OnCapture(MHeavyFactory, function() - player.MarkCompletedObjective(AllyWithMercenaries) + Harkonnen.MarkCompletedObjective(AllyWithMercenaries) Media.DisplayMessage(UserInterface.Translate("mercenary-leader-captured-allied"), Mentat) MercenaryAttackLocation = MercenaryAttackPoint.Location - ChangeOwner(mercenary_enemy, mercenary_ally) - SendStarportReinforcements(mercenary_ally) - DefendAndRepairBase(mercenary_ally, MercenaryBase, 0.75, AttackGroupSize[Difficulty]) - IdlingUnits[mercenary_ally] = IdlingUnits[mercenary_enemy] + ChangeOwner(MercenaryEnemy, MercenaryAlly) + SendStarportReinforcements(MercenaryAlly) + DefendAndRepairBase(MercenaryAlly, MercenaryBase, 0.75, AttackGroupSize[Difficulty]) + IdlingUnits[MercenaryAlly] = IdlingUnits[MercenaryEnemy] end) Trigger.OnKilled(MHeavyFactory, function() - if not player.IsObjectiveCompleted(AllyWithMercenaries) then - player.MarkFailedObjective(AllyWithMercenaries) + if not Harkonnen.IsObjectiveCompleted(AllyWithMercenaries) then + Harkonnen.MarkFailedObjective(AllyWithMercenaries) end end) Trigger.OnKilledOrCaptured(OPalace, function() Media.DisplayMessage(UserInterface.Translate("can-not-stand-harkonnen-must-become-neutral"), UserInterface.Translate("atreides-commander")) - ChangeOwner(atreides_enemy, atreides_neutral) - DefendAndRepairBase(atreides_neutral, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) - IdlingUnits[atreides_neutral] = IdlingUnits[atreides_enemy] + ChangeOwner(AtreidesEnemy, AtreidesNeutral) + DefendAndRepairBase(AtreidesNeutral, AtreidesBase, 0.75, AttackGroupSize[Difficulty]) + IdlingUnits[AtreidesNeutral] = IdlingUnits[AtreidesEnemy] -- Ensure that harvesters that was on a carryall switched sides. Trigger.AfterDelay(DateTime.Seconds(15), function() - ChangeOwner(atreides_enemy, atreides_neutral) + ChangeOwner(AtreidesEnemy, AtreidesNeutral) CheckAttackToAtreides() end) end) Trigger.OnAllKilledOrCaptured(OrdosBase, function() - Utils.Do(ordos.GetGroundAttackers(), IdleHunt) + Utils.Do(Ordos.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(AtreidesBase, function() - Utils.Do(atreides_enemy.GetGroundAttackers(), IdleHunt) + Utils.Do(AtreidesEnemy.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(MercenaryBase, function() - Utils.Do(mercenary_enemy.GetGroundAttackers(), IdleHunt) - Utils.Do(mercenary_ally.GetGroundAttackers(), IdleHunt) + Utils.Do(MercenaryEnemy.GetGroundAttackers(), IdleHunt) + Utils.Do(MercenaryAlly.GetGroundAttackers(), IdleHunt) end) local path = function() return Utils.Random(OrdosPaths) end - local waveCondition = function() return player.IsObjectiveCompleted(KillOrdos) end + local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillOrdos) end local huntFunction = function(unit) unit.AttackMove(OrdosAttackLocation) IdleHunt(unit) end - SendCarryallReinforcements(ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction) + SendCarryallReinforcements(Ordos, 0, OrdosAttackWaves[Difficulty], OrdosAttackDelay[Difficulty], path, OrdosReinforcements[Difficulty], waveCondition, huntFunction) - SendStarportReinforcements(mercenary_enemy) + SendStarportReinforcements(MercenaryEnemy) - Actor.Create("upgrade.barracks", true, { Owner = ordos }) - Actor.Create("upgrade.light", true, { Owner = ordos }) - Actor.Create("upgrade.heavy", true, { Owner = ordos }) - Actor.Create("upgrade.barracks", true, { Owner = atreides_enemy }) - Actor.Create("upgrade.light", true, { Owner = atreides_enemy }) - Actor.Create("upgrade.heavy", true, { Owner = atreides_enemy }) - Actor.Create("upgrade.hightech", true, { Owner = atreides_enemy }) - Actor.Create("upgrade.heavy", true, { Owner = mercenary_enemy }) + Actor.Create("upgrade.barracks", true, { Owner = Ordos }) + Actor.Create("upgrade.light", true, { Owner = Ordos }) + Actor.Create("upgrade.heavy", true, { Owner = Ordos }) + Actor.Create("upgrade.barracks", true, { Owner = AtreidesEnemy }) + Actor.Create("upgrade.light", true, { Owner = AtreidesEnemy }) + Actor.Create("upgrade.heavy", true, { Owner = AtreidesEnemy }) + Actor.Create("upgrade.hightech", true, { Owner = AtreidesEnemy }) + Actor.Create("upgrade.heavy", true, { Owner = MercenaryEnemy }) Trigger.AfterDelay(0, ActivateAI) end diff --git a/mods/d2k/maps/harkonnen-09a/harkonnen09a-AI.lua b/mods/d2k/maps/harkonnen-09a/harkonnen09a-AI.lua index 94d119b712..dc04be83fb 100644 --- a/mods/d2k/maps/harkonnen-09a/harkonnen09a-AI.lua +++ b/mods/d2k/maps/harkonnen-09a/harkonnen09a-AI.lua @@ -34,17 +34,17 @@ CorrinoSmallTankTypes = { "combat_tank_h", "combat_tank_h", "siege_tank" } CorrinoStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_h.starport", "combat_tank_h.starport", "siege_tank.starport", "missile_tank.starport" } ActivateAI = function() - IdlingUnits[atreides_main] = Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2]), Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3]) - IdlingUnits[atreides_small_1] = Reinforcements.Reinforce(atreides_small_1, InitialAtreidesReinforcements[4], InitialAtreidesPaths[4]), Reinforcements.Reinforce(atreides_small_1, InitialAtreidesReinforcements[5], InitialAtreidesPaths[5]) - IdlingUnits[atreides_small_2] = Reinforcements.Reinforce(atreides_small_2, InitialAtreidesReinforcements[6], InitialAtreidesPaths[6]) - IdlingUnits[corrino_main] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements, InitialCorrinoPaths[1]) - IdlingUnits[corrino_small] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements, InitialCorrinoPaths[2]) + IdlingUnits[AtreidesMain] = Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3]) + IdlingUnits[AtreidesSmall1] = Reinforcements.Reinforce(AtreidesSmall1, InitialAtreidesReinforcements[4], InitialAtreidesPaths[4]), Reinforcements.Reinforce(AtreidesSmall1, InitialAtreidesReinforcements[5], InitialAtreidesPaths[5]) + IdlingUnits[AtreidesSmall2] = Reinforcements.Reinforce(AtreidesSmall2, InitialAtreidesReinforcements[6], InitialAtreidesPaths[6]) + IdlingUnits[CorrinoMain] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements, InitialCorrinoPaths[1]) + IdlingUnits[CorrinoSmall] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements, InitialCorrinoPaths[2]) - DefendAndRepairBase(atreides_main, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(atreides_small_1, AtreidesSmall1Base, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(atreides_small_2, AtreidesSmall2Base, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(corrino_main, CorrinoMainBase, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(corrino_small, CorrinoSmallBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(AtreidesMain, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(AtreidesSmall1, AtreidesSmall1Base, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(AtreidesSmall2, AtreidesSmall2Base, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(CorrinoMain, CorrinoMainBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(CorrinoSmall, CorrinoSmallBase, 0.75, AttackGroupSize[Difficulty]) local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end @@ -58,23 +58,23 @@ ActivateAI = function() local unitsToBuyCorrino = function() return { Utils.Random(CorrinoStarportTypes) } end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 - ProduceUnits(atreides_main, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_main, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_main, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_main, AStarport, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesMain, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesMain, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesMain, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesMain, AStarport, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_small_1, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_small_1, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_small_1, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesSmall1, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesSmall1, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesSmall1, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_small_2, ABarracks4, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesSmall2, ABarracks4, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(corrino_main, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(corrino_main, CLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(corrino_main, CHeavyFactory1, delay, tanksToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(corrino_main, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(CorrinoMain, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(CorrinoMain, CLightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(CorrinoMain, CHeavyFactory1, delay, tanksToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(CorrinoMain, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(corrino_small, CBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(corrino_small, CLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(corrino_small, CHeavyFactory2, delay, tanksToBuildCorrinoSmall, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(CorrinoSmall, CBarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(CorrinoSmall, CLightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(CorrinoSmall, CHeavyFactory2, delay, tanksToBuildCorrinoSmall, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/harkonnen-09a/harkonnen09a.lua b/mods/d2k/maps/harkonnen-09a/harkonnen09a.lua index f33e55a902..cda5e93112 100644 --- a/mods/d2k/maps/harkonnen-09a/harkonnen09a.lua +++ b/mods/d2k/maps/harkonnen-09a/harkonnen09a.lua @@ -137,13 +137,13 @@ HarkonnenPath = { HarkonnenEntry.Location, HarkonnenRally.Location } SendStarportReinforcements = function() Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function() - if CStarport.IsDead or CStarport.Owner ~= corrino_main then + if CStarport.IsDead or CStarport.Owner ~= CorrinoMain then return end - reinforcements = Utils.Random(CorrinoStarportReinforcements[Difficulty]) + local reinforcements = Utils.Random(CorrinoStarportReinforcements[Difficulty]) - local units = Reinforcements.ReinforceWithTransport(corrino_main, "frigate", reinforcements, { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2] + local units = Reinforcements.ReinforceWithTransport(CorrinoMain, "frigate", reinforcements, { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2] Utils.Do(units, function(unit) unit.AttackMove(AtreidesAttackLocation) IdleHunt(unit) @@ -155,19 +155,19 @@ end SendHarkonnenReinforcements = function(delay) Trigger.AfterDelay(delay, function() - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] }) + Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] }) Trigger.AfterDelay(DateTime.Seconds(5), function() - Media.PlaySpeechNotification(player, "Reinforce") + Media.PlaySpeechNotification(Harkonnen, "Reinforce") end) end) end SendAirStrike = function() - if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= atreides_main then + if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= AtreidesMain then return end - local targets = Utils.Where(player.GetActors(), function(actor) + local targets = Utils.Where(Harkonnen.GetActors(), function(actor) return actor.HasProperty("Sell") and actor.Type ~= "wall" and @@ -185,7 +185,7 @@ SendAirStrike = function() end BuildFremen = function() - if APalace.IsDead or APalace.Owner ~= atreides_main then + if APalace.IsDead or APalace.Owner ~= AtreidesMain then return end @@ -193,7 +193,7 @@ BuildFremen = function() APalace.Produce("fremen") Trigger.AfterDelay(DateTime.Seconds(5), function() - IdleFremen = Utils.Where(atreides_main.GetActorsByType('fremen'), function(actor) return actor.IsIdle end) + IdleFremen = Utils.Where(AtreidesMain.GetActorsByType('fremen'), function(actor) return actor.IsIdle end) if #IdleFremen >= FremenGroupSize[Difficulty] then SendFremen() @@ -211,77 +211,77 @@ SendFremen = function() end Tick = function() - if player.HasNoRequiredUnits() then - atreides_main.MarkCompletedObjective(KillHarkonnen1) - atreides_small_1.MarkCompletedObjective(KillHarkonnen2) - atreides_small_2.MarkCompletedObjective(KillHarkonnen3) - corrino_main.MarkCompletedObjective(KillHarkonnen4) - corrino_small.MarkCompletedObjective(KillHarkonnen5) + if Harkonnen.HasNoRequiredUnits() then + AtreidesMain.MarkCompletedObjective(KillHarkonnen1) + AtreidesSmall1.MarkCompletedObjective(KillHarkonnen2) + AtreidesSmall2.MarkCompletedObjective(KillHarkonnen3) + CorrinoMain.MarkCompletedObjective(KillHarkonnen4) + CorrinoSmall.MarkCompletedObjective(KillHarkonnen5) end - if atreides_main.HasNoRequiredUnits() and atreides_small_1.HasNoRequiredUnits() and atreides_small_2.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then + if AtreidesMain.HasNoRequiredUnits() and AtreidesSmall1.HasNoRequiredUnits() and AtreidesSmall2.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) - player.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end - if corrino_main.HasNoRequiredUnits() and corrino_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillCorrino) then + if CorrinoMain.HasNoRequiredUnits() and CorrinoSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillCorrino) then Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat) - player.MarkCompletedObjective(KillCorrino) + Harkonnen.MarkCompletedObjective(KillCorrino) end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_main] then - local units = atreides_main.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesMain] then + local units = AtreidesMain.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[atreides_main] = false - ProtectHarvester(units[1], atreides_main, AttackGroupSize[Difficulty]) + LastHarvesterEaten[AtreidesMain] = false + ProtectHarvester(units[1], AtreidesMain, AttackGroupSize[Difficulty]) end end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_small_1] then - local units = atreides_small_1.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesSmall1] then + local units = AtreidesSmall1.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[atreides_small_1] = false - ProtectHarvester(units[1], atreides_small_1, AttackGroupSize[Difficulty]) + LastHarvesterEaten[AtreidesSmall1] = false + ProtectHarvester(units[1], AtreidesSmall1, AttackGroupSize[Difficulty]) end end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[corrino_main] then - local units = corrino_main.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[CorrinoMain] then + local units = CorrinoMain.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[corrino_main] = false - ProtectHarvester(units[1], corrino_main, AttackGroupSize[Difficulty]) + LastHarvesterEaten[CorrinoMain] = false + ProtectHarvester(units[1], CorrinoMain, AttackGroupSize[Difficulty]) end end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[corrino_small] then - local units = corrino_small.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[CorrinoSmall] then + local units = CorrinoSmall.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[corrino_small] = false - ProtectHarvester(units[1], corrino_small, AttackGroupSize[Difficulty]) + LastHarvesterEaten[CorrinoSmall] = false + ProtectHarvester(units[1], CorrinoSmall, AttackGroupSize[Difficulty]) end end end WorldLoaded = function() - atreides_main = Player.GetPlayer("Atreides Main Base") - atreides_small_1 = Player.GetPlayer("Atreides Small Base 1") - atreides_small_2 = Player.GetPlayer("Atreides Small Base 2") - corrino_main = Player.GetPlayer("Corrino Main Base") - corrino_small = Player.GetPlayer("Corrino Small Base") - player = Player.GetPlayer("Harkonnen") + AtreidesMain = Player.GetPlayer("Atreides Main Base") + AtreidesSmall1 = Player.GetPlayer("Atreides Small Base 1") + AtreidesSmall2 = Player.GetPlayer("Atreides Small Base 2") + CorrinoMain = Player.GetPlayer("Corrino Main Base") + CorrinoSmall = Player.GetPlayer("Corrino Small Base") + Harkonnen = Player.GetPlayer("Harkonnen") - InitObjectives(player) - KillAtreides = AddPrimaryObjective(player, "destroy-atreides") - KillCorrino = AddPrimaryObjective(player, "destroy-imperial-forces") - KillHarkonnen1 = AddPrimaryObjective(atreides_main, "") - KillHarkonnen2 = AddPrimaryObjective(atreides_small_1, "") - KillHarkonnen3 = AddPrimaryObjective(atreides_small_2, "") - KillHarkonnen4 = AddPrimaryObjective(corrino_main, "") - KillHarkonnen5 = AddPrimaryObjective(corrino_small, "") + InitObjectives(Harkonnen) + KillAtreides = AddPrimaryObjective(Harkonnen, "destroy-atreides") + KillCorrino = AddPrimaryObjective(Harkonnen, "destroy-imperial-forces") + KillHarkonnen1 = AddPrimaryObjective(AtreidesMain, "") + KillHarkonnen2 = AddPrimaryObjective(AtreidesSmall1, "") + KillHarkonnen3 = AddPrimaryObjective(AtreidesSmall2, "") + KillHarkonnen4 = AddPrimaryObjective(CorrinoMain, "") + KillHarkonnen5 = AddPrimaryObjective(CorrinoSmall, "") Camera.Position = HMCV.CenterPosition AtreidesAttackLocation = HarkonnenRally.Location @@ -290,49 +290,49 @@ WorldLoaded = function() Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds (30), BuildFremen) Trigger.OnAllKilledOrCaptured(AtreidesMainBase, function() - Utils.Do(atreides_main.GetGroundAttackers(), IdleHunt) + Utils.Do(AtreidesMain.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(AtreidesSmall1Base, function() - Utils.Do(atreides_small_1.GetGroundAttackers(), IdleHunt) + Utils.Do(AtreidesSmall1.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(AtreidesSmall2Base, function() - Utils.Do(atreides_small_2.GetGroundAttackers(), IdleHunt) + Utils.Do(AtreidesSmall2.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(CorrinoMainBase, function() - Utils.Do(corrino_main.GetGroundAttackers(), IdleHunt) + Utils.Do(CorrinoMain.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(CorrinoSmallBase, function() - Utils.Do(corrino_small.GetGroundAttackers(), IdleHunt) + Utils.Do(CorrinoSmall.GetGroundAttackers(), IdleHunt) end) local path = function() return Utils.Random(AtreidesPaths) end - local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end + local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end local huntFunction = function(unit) unit.AttackMove(AtreidesAttackLocation) IdleHunt(unit) end - SendCarryallReinforcements(atreides_main, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction) + SendCarryallReinforcements(AtreidesMain, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction) SendStarportReinforcements() - Actor.Create("upgrade.barracks", true, { Owner = atreides_main }) - Actor.Create("upgrade.light", true, { Owner = atreides_main }) - Actor.Create("upgrade.heavy", true, { Owner = atreides_main }) - Actor.Create("upgrade.hightech", true, { Owner = atreides_main }) - Actor.Create("upgrade.barracks", true, { Owner = atreides_small_1 }) - Actor.Create("upgrade.light", true, { Owner = atreides_small_1 }) - Actor.Create("upgrade.heavy", true, { Owner = atreides_small_1 }) - Actor.Create("upgrade.barracks", true, { Owner = atreides_small_2 }) - Actor.Create("upgrade.barracks", true, { Owner = corrino_main }) - Actor.Create("upgrade.light", true, { Owner = corrino_main }) - Actor.Create("upgrade.heavy", true, { Owner = corrino_main }) - Actor.Create("upgrade.barracks", true, { Owner = corrino_small }) - Actor.Create("upgrade.light", true, { Owner = corrino_small }) - Actor.Create("upgrade.heavy", true, { Owner = corrino_small }) + Actor.Create("upgrade.barracks", true, { Owner = AtreidesMain }) + Actor.Create("upgrade.light", true, { Owner = AtreidesMain }) + Actor.Create("upgrade.heavy", true, { Owner = AtreidesMain }) + Actor.Create("upgrade.hightech", true, { Owner = AtreidesMain }) + Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall1 }) + Actor.Create("upgrade.light", true, { Owner = AtreidesSmall1 }) + Actor.Create("upgrade.heavy", true, { Owner = AtreidesSmall1 }) + Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall2 }) + Actor.Create("upgrade.barracks", true, { Owner = CorrinoMain }) + Actor.Create("upgrade.light", true, { Owner = CorrinoMain }) + Actor.Create("upgrade.heavy", true, { Owner = CorrinoMain }) + Actor.Create("upgrade.barracks", true, { Owner = CorrinoSmall }) + Actor.Create("upgrade.light", true, { Owner = CorrinoSmall }) + Actor.Create("upgrade.heavy", true, { Owner = CorrinoSmall }) Trigger.AfterDelay(0, ActivateAI) SendHarkonnenReinforcements(DateTime.Minutes(2) + DateTime.Seconds(30)) diff --git a/mods/d2k/maps/harkonnen-09b/harkonnen09b-AI.lua b/mods/d2k/maps/harkonnen-09b/harkonnen09b-AI.lua index 92b84acb2f..a70b49c230 100644 --- a/mods/d2k/maps/harkonnen-09b/harkonnen09b-AI.lua +++ b/mods/d2k/maps/harkonnen-09b/harkonnen09b-AI.lua @@ -33,15 +33,15 @@ CorrinoTankTypes = { "combat_tank_h", "combat_tank_h", "siege_tank", "missile_ta CorrinoStarportTypes = { "trike.starport", "trike.starport", "quad.starport", "combat_tank_h.starport", "combat_tank_h.starport", "siege_tank.starport", "missile_tank.starport" } ActivateAI = function() - IdlingUnits[atreides_main] = Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(atreides_main, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2]) - IdlingUnits[atreides_small] = Reinforcements.Reinforce(atreides_small, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3]) - IdlingUnits[corrino_main] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements[1], InitialCorrinoPaths[1]), Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements[2], InitialCorrinoPaths[2]) - IdlingUnits[corrino_small] = Reinforcements.Reinforce(corrino_main, InitialCorrinoReinforcements[3], InitialCorrinoPaths[3]) + IdlingUnits[AtreidesMain] = Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[1], InitialAtreidesPaths[1]), Reinforcements.Reinforce(AtreidesMain, InitialAtreidesReinforcements[2], InitialAtreidesPaths[2]) + IdlingUnits[AtreidesSmall] = Reinforcements.Reinforce(AtreidesSmall, InitialAtreidesReinforcements[3], InitialAtreidesPaths[3]) + IdlingUnits[CorrinoMain] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements[1], InitialCorrinoPaths[1]), Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements[2], InitialCorrinoPaths[2]) + IdlingUnits[CorrinoSmall] = Reinforcements.Reinforce(CorrinoMain, InitialCorrinoReinforcements[3], InitialCorrinoPaths[3]) - DefendAndRepairBase(atreides_main, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(atreides_small, AtreidesSmallBase, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(corrino_main, CorrinoMainBase, 0.75, AttackGroupSize[Difficulty]) - DefendAndRepairBase(corrino_small, CorrinoSmallBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(AtreidesMain, AtreidesMainBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(AtreidesSmall, AtreidesSmallBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(CorrinoMain, CorrinoMainBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(CorrinoSmall, CorrinoSmallBase, 0.75, AttackGroupSize[Difficulty]) local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end @@ -54,20 +54,20 @@ ActivateAI = function() local unitsToBuyCorrino = function() return { Utils.Random(CorrinoStarportTypes) } end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 - ProduceUnits(atreides_main, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_main, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_main, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_main, AStarport1, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesMain, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesMain, ALightFactory1, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesMain, AHeavyFactory1, delay, tanksToBuildAtreidesMain, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesMain, AStarport1, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_small, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_small, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_small, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(atreides_small, AStarport2, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesSmall, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesSmall, ALightFactory2, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesSmall, AHeavyFactory2, delay, tanksToBuildAtreidesSmall, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(AtreidesSmall, AStarport2, delay, unitsToBuyAtreides, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(corrino_main, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(corrino_main, CHeavyFactory, delay, tanksToBuildCorrino, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(CorrinoMain, CBarracks1, delay, infantryToBuildCorrinoMain, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(CorrinoMain, CHeavyFactory, delay, tanksToBuildCorrino, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(corrino_small, CBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(corrino_small, CLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(corrino_small, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(CorrinoSmall, CBarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(CorrinoSmall, CLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(CorrinoSmall, CStarport, delay, unitsToBuyCorrino, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/harkonnen-09b/harkonnen09b.lua b/mods/d2k/maps/harkonnen-09b/harkonnen09b.lua index dd47d42333..eaced5cb3e 100644 --- a/mods/d2k/maps/harkonnen-09b/harkonnen09b.lua +++ b/mods/d2k/maps/harkonnen-09b/harkonnen09b.lua @@ -143,13 +143,13 @@ HarkonnenPath = { HarkonnenEntry.Location, HarkonnenRally.Location } SendStarportReinforcements = function() Trigger.AfterDelay(CorrinoStarportDelay[Difficulty], function() - if CStarport.IsDead or CStarport.Owner ~= corrino_small then + if CStarport.IsDead or CStarport.Owner ~= CorrinoSmall then return end - reinforcements = Utils.Random(CorrinoStarportReinforcements[Difficulty]) + local reinforcements = Utils.Random(CorrinoStarportReinforcements[Difficulty]) - local units = Reinforcements.ReinforceWithTransport(corrino_small, "frigate", reinforcements, { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2] + local units = Reinforcements.ReinforceWithTransport(CorrinoSmall, "frigate", reinforcements, { CorrinoStarportEntry.Location, CStarport.Location + CVec.New(1, 1) }, { CorrinoStarportExit.Location })[2] Utils.Do(units, function(unit) unit.AttackMove(AtreidesAttackLocation) IdleHunt(unit) @@ -161,19 +161,19 @@ end SendHarkonnenReinforcements = function(delay) Trigger.AfterDelay(delay, function() - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] }) + Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenReinforcements, HarkonnenPath, { HarkonnenPath[1] }) Trigger.AfterDelay(DateTime.Seconds(5), function() - Media.PlaySpeechNotification(player, "Reinforce") + Media.PlaySpeechNotification(Harkonnen, "Reinforce") end) end) end SendAirStrike = function() - if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= atreides_main then + if AHiTechFactory.IsDead or AHiTechFactory.Owner ~= AtreidesMain then return end - local targets = Utils.Where(player.GetActors(), function(actor) + local targets = Utils.Where(Harkonnen.GetActors(), function(actor) return actor.HasProperty("Sell") and actor.Type ~= "wall" and @@ -191,7 +191,7 @@ SendAirStrike = function() end BuildFremen = function() - if APalace.IsDead or APalace.Owner ~= atreides_main then + if APalace.IsDead or APalace.Owner ~= AtreidesMain then return end @@ -199,7 +199,7 @@ BuildFremen = function() APalace.Produce("fremen") Trigger.AfterDelay(DateTime.Seconds(5), function() - IdleFremen = Utils.Where(atreides_main.GetActorsByType('fremen'), function(actor) return actor.IsIdle end) + IdleFremen = Utils.Where(AtreidesMain.GetActorsByType('fremen'), function(actor) return actor.IsIdle end) if #IdleFremen >= FremenGroupSize[Difficulty] then SendFremen() @@ -228,44 +228,44 @@ end CheckSmugglerEnemies = function() Utils.Do(SmugglerUnits, function(unit) Trigger.OnDamaged(unit, function(self, attacker) - if unit.Owner == smuggler_neutral and attacker.Owner == player then - ChangeOwner(smuggler_neutral, smuggler_harkonnen) + if unit.Owner == SmugglerNeutral and attacker.Owner == Harkonnen then + ChangeOwner(SmugglerNeutral, SmugglerHarkonnen) -- Ensure that harvesters that was on a carryall switched sides. Trigger.AfterDelay(DateTime.Seconds(15), function() - ChangeOwner(smuggler_neutral, smuggler_harkonnen) + ChangeOwner(SmugglerNeutral, SmugglerHarkonnen) end) end - if unit.Owner == smuggler_ai and attacker.Owner == player then - ChangeOwner(smuggler_ai, smuggler_both) + if unit.Owner == SmugglerAI and attacker.Owner == Harkonnen then + ChangeOwner(SmugglerAI, SmugglerBoth) -- Ensure that harvesters that was on a carryall switched sides. Trigger.AfterDelay(DateTime.Seconds(15), function() - ChangeOwner(smuggler_ai, smuggler_both) + ChangeOwner(SmugglerAI, SmugglerBoth) end) end - if unit.Owner == smuggler_neutral and (attacker.Owner == atreides_main or attacker.Owner == atreides_small or attacker.Owner == corrino_main or attacker.Owner == corrino_small) then - ChangeOwner(smuggler_neutral, smuggler_ai) + if unit.Owner == SmugglerNeutral and (attacker.Owner == AtreidesMain or attacker.Owner == AtreidesSmall or attacker.Owner == CorrinoMain or attacker.Owner == CorrinoSmall) then + ChangeOwner(SmugglerNeutral, SmugglerAI) -- Ensure that harvesters that was on a carryall switched sides. Trigger.AfterDelay(DateTime.Seconds(15), function() - ChangeOwner(smuggler_neutral, smuggler_ai) + ChangeOwner(SmugglerNeutral, SmugglerAI) end) end - if unit.Owner == smuggler_harkonnen and (attacker.Owner == atreides_main or attacker.Owner == atreides_small or attacker.Owner == corrino_main or attacker.Owner == corrino_small) then - ChangeOwner(smuggler_harkonnen, smuggler_both) + if unit.Owner == SmugglerHarkonnen and (attacker.Owner == AtreidesMain or attacker.Owner == AtreidesSmall or attacker.Owner == CorrinoMain or attacker.Owner == CorrinoSmall) then + ChangeOwner(SmugglerHarkonnen, SmugglerBoth) -- Ensure that harvesters that was on a carryall switched sides. Trigger.AfterDelay(DateTime.Seconds(15), function() - ChangeOwner(smuggler_harkonnen, smuggler_both) + ChangeOwner(SmugglerHarkonnen, SmugglerBoth) end) end - if attacker.Owner == player and not message_check then - message_check = true + if attacker.Owner == Harkonnen and not MessageCheck then + MessageCheck = true Media.DisplayMessage(UserInterface.Translate("smugglers-now-hostile"), Mentat) end end) @@ -273,93 +273,93 @@ CheckSmugglerEnemies = function() end Tick = function() - if player.HasNoRequiredUnits() then - atreides_main.MarkCompletedObjective(KillHarkonnen1) - atreides_small.MarkCompletedObjective(KillHarkonnen2) - corrino_main.MarkCompletedObjective(KillHarkonnen3) - corrino_small.MarkCompletedObjective(KillHarkonnen4) + if Harkonnen.HasNoRequiredUnits() then + AtreidesMain.MarkCompletedObjective(KillHarkonnen1) + AtreidesSmall.MarkCompletedObjective(KillHarkonnen2) + CorrinoMain.MarkCompletedObjective(KillHarkonnen3) + CorrinoSmall.MarkCompletedObjective(KillHarkonnen4) end - if atreides_main.HasNoRequiredUnits() and atreides_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then + if AtreidesMain.HasNoRequiredUnits() and AtreidesSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillAtreides) then Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) - player.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end - if corrino_main.HasNoRequiredUnits() and corrino_small.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillCorrino) then + if CorrinoMain.HasNoRequiredUnits() and CorrinoSmall.HasNoRequiredUnits() and not Harkonnen.IsObjectiveCompleted(KillCorrino) then Media.DisplayMessage(UserInterface.Translate("emperor-annihilated"), Mentat) - player.MarkCompletedObjective(KillCorrino) + Harkonnen.MarkCompletedObjective(KillCorrino) end - if smuggler_neutral.HasNoRequiredUnits() and smuggler_harkonnen.HasNoRequiredUnits() and smuggler_ai.HasNoRequiredUnits() and smuggler_both.HasNoRequiredUnits() and not SmugglersKilled then + if SmugglerNeutral.HasNoRequiredUnits() and SmugglerHarkonnen.HasNoRequiredUnits() and SmugglerAI.HasNoRequiredUnits() and SmugglerBoth.HasNoRequiredUnits() and not SmugglersKilled then Media.DisplayMessage(UserInterface.Translate("smugglers-annihilated"), Mentat) SmugglersKilled = true end - local playerConYards = player.GetActorsByType("construction_yard") - if #playerConYards > 0 and not player.IsObjectiveCompleted(DeployMCV) then - player.MarkCompletedObjective(DeployMCV) + local playerConYards = Harkonnen.GetActorsByType("construction_yard") + if #playerConYards > 0 and not Harkonnen.IsObjectiveCompleted(DeployMCV) then + Harkonnen.MarkCompletedObjective(DeployMCV) end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_main] then - local units = atreides_main.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesMain] then + local units = AtreidesMain.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[atreides_main] = false - ProtectHarvester(units[1], atreides_main, AttackGroupSize[Difficulty]) + LastHarvesterEaten[AtreidesMain] = false + ProtectHarvester(units[1], AtreidesMain, AttackGroupSize[Difficulty]) end end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[atreides_small] then - local units = atreides_small.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[AtreidesSmall] then + local units = AtreidesSmall.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[atreides_small] = false - ProtectHarvester(units[1], atreides_small, AttackGroupSize[Difficulty]) + LastHarvesterEaten[AtreidesSmall] = false + ProtectHarvester(units[1], AtreidesSmall, AttackGroupSize[Difficulty]) end end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[corrino_main] then - local units = corrino_main.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[CorrinoMain] then + local units = CorrinoMain.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[corrino_main] = false - ProtectHarvester(units[1], corrino_main, AttackGroupSize[Difficulty]) + LastHarvesterEaten[CorrinoMain] = false + ProtectHarvester(units[1], CorrinoMain, AttackGroupSize[Difficulty]) end end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[corrino_small] then - local units = corrino_small.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[CorrinoSmall] then + local units = CorrinoSmall.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[corrino_small] = false - ProtectHarvester(units[1], corrino_small, AttackGroupSize[Difficulty]) + LastHarvesterEaten[CorrinoSmall] = false + ProtectHarvester(units[1], CorrinoSmall, AttackGroupSize[Difficulty]) end end end WorldLoaded = function() - atreides_main = Player.GetPlayer("Atreides Main Base") - atreides_small = Player.GetPlayer("Atreides Small Base") - corrino_main = Player.GetPlayer("Corrino Main Base") - corrino_small = Player.GetPlayer("Corrino Small Base") - smuggler_neutral = Player.GetPlayer("Smugglers - Neutral") - smuggler_harkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen") - smuggler_ai = Player.GetPlayer("Smugglers - Enemy to AI") - smuggler_both = Player.GetPlayer("Smugglers - Enemy to Both") - player = Player.GetPlayer("Harkonnen") + AtreidesMain = Player.GetPlayer("Atreides Main Base") + AtreidesSmall = Player.GetPlayer("Atreides Small Base") + CorrinoMain = Player.GetPlayer("Corrino Main Base") + CorrinoSmall = Player.GetPlayer("Corrino Small Base") + SmugglerNeutral = Player.GetPlayer("Smugglers - Neutral") + SmugglerHarkonnen = Player.GetPlayer("Smugglers - Enemy to Harkonnen") + SmugglerAI = Player.GetPlayer("Smugglers - Enemy to AI") + SmugglerBoth = Player.GetPlayer("Smugglers - Enemy to Both") + Harkonnen = Player.GetPlayer("Harkonnen") - InitObjectives(player) - DeployMCV = AddSecondaryObjective(player, "build-deploy-mcv") - KillAtreides = AddPrimaryObjective(player, "destroy-atreides") - KillCorrino = AddPrimaryObjective(player, "destroy-imperial-forces") - KillHarkonnen1 = AddPrimaryObjective(atreides_main, "") - KillHarkonnen2 = AddPrimaryObjective(atreides_small, "") - KillHarkonnen3 = AddPrimaryObjective(corrino_main, "") - KillHarkonnen4 = AddPrimaryObjective(corrino_small, "") + InitObjectives(Harkonnen) + DeployMCV = AddSecondaryObjective(Harkonnen, "build-deploy-mcv") + KillAtreides = AddPrimaryObjective(Harkonnen, "destroy-atreides") + KillCorrino = AddPrimaryObjective(Harkonnen, "destroy-imperial-forces") + KillHarkonnen1 = AddPrimaryObjective(AtreidesMain, "") + KillHarkonnen2 = AddPrimaryObjective(AtreidesSmall, "") + KillHarkonnen3 = AddPrimaryObjective(CorrinoMain, "") + KillHarkonnen4 = AddPrimaryObjective(CorrinoSmall, "") -- Wait for carryall drop Trigger.AfterDelay(DateTime.Seconds(10), function() - SmugglerUnits = smuggler_neutral.GetActors() + SmugglerUnits = SmugglerNeutral.GetActors() CheckSmugglerEnemies() end) @@ -370,42 +370,42 @@ WorldLoaded = function() Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds (30), BuildFremen) Trigger.OnAllKilledOrCaptured(AtreidesMainBase, function() - Utils.Do(atreides_main.GetGroundAttackers(), IdleHunt) + Utils.Do(AtreidesMain.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(AtreidesSmallBase, function() - Utils.Do(atreides_small.GetGroundAttackers(), IdleHunt) + Utils.Do(AtreidesSmall.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(CorrinoMainBase, function() - Utils.Do(corrino_main.GetGroundAttackers(), IdleHunt) + Utils.Do(CorrinoMain.GetGroundAttackers(), IdleHunt) end) Trigger.OnAllKilledOrCaptured(CorrinoSmallBase, function() - Utils.Do(corrino_small.GetGroundAttackers(), IdleHunt) + Utils.Do(CorrinoSmall.GetGroundAttackers(), IdleHunt) end) local path = function() return Utils.Random(AtreidesPaths) end - local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end + local waveCondition = function() return Harkonnen.IsObjectiveCompleted(KillAtreides) end local huntFunction = function(unit) unit.AttackMove(AtreidesAttackLocation) IdleHunt(unit) end - SendCarryallReinforcements(atreides_main, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction) + SendCarryallReinforcements(AtreidesMain, 0, AtreidesAttackWaves[Difficulty], AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction) SendStarportReinforcements() - Actor.Create("upgrade.barracks", true, { Owner = atreides_main }) - Actor.Create("upgrade.light", true, { Owner = atreides_main }) - Actor.Create("upgrade.heavy", true, { Owner = atreides_main }) - Actor.Create("upgrade.hightech", true, { Owner = atreides_main }) - Actor.Create("upgrade.barracks", true, { Owner = atreides_small }) - Actor.Create("upgrade.light", true, { Owner = atreides_small }) - Actor.Create("upgrade.heavy", true, { Owner = atreides_small }) - Actor.Create("upgrade.barracks", true, { Owner = corrino_main }) - Actor.Create("upgrade.heavy", true, { Owner = corrino_main }) - Actor.Create("upgrade.barracks", true, { Owner = corrino_small }) - Actor.Create("upgrade.light", true, { Owner = corrino_small }) + Actor.Create("upgrade.barracks", true, { Owner = AtreidesMain }) + Actor.Create("upgrade.light", true, { Owner = AtreidesMain }) + Actor.Create("upgrade.heavy", true, { Owner = AtreidesMain }) + Actor.Create("upgrade.hightech", true, { Owner = AtreidesMain }) + Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall }) + Actor.Create("upgrade.light", true, { Owner = AtreidesSmall }) + Actor.Create("upgrade.heavy", true, { Owner = AtreidesSmall }) + Actor.Create("upgrade.barracks", true, { Owner = CorrinoMain }) + Actor.Create("upgrade.heavy", true, { Owner = CorrinoMain }) + Actor.Create("upgrade.barracks", true, { Owner = CorrinoSmall }) + Actor.Create("upgrade.light", true, { Owner = CorrinoSmall }) Trigger.AfterDelay(0, ActivateAI) SendHarkonnenReinforcements(DateTime.Minutes(2)) diff --git a/mods/d2k/maps/ordos-01a/ordos01a.lua b/mods/d2k/maps/ordos-01a/ordos01a.lua index 7b55eb6166..2431c880b0 100644 --- a/mods/d2k/maps/ordos-01a/ordos01a.lua +++ b/mods/d2k/maps/ordos-01a/ordos01a.lua @@ -61,16 +61,16 @@ Messages = CachedResources = -1 Tick = function() - if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then - player.MarkCompletedObjective(KillHarkonnen) + if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then + Ordos.MarkCompletedObjective(KillHarkonnen) end - if player.Resources > SpiceToHarvest - 1 then - player.MarkCompletedObjective(GatherSpice) + if Ordos.Resources > SpiceToHarvest - 1 then + Ordos.MarkCompletedObjective(GatherSpice) end -- player has no Wind Trap - if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if (Ordos.PowerProvided <= 20 or Ordos.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then HasPower = false Media.DisplayMessage(Messages[2], Mentat) else @@ -78,40 +78,40 @@ Tick = function() end -- player has no Refinery and no Silos - if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if HasPower and Ordos.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then Media.DisplayMessage(Messages[3], Mentat) end - if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if HasPower and Ordos.Resources > Ordos.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then Media.DisplayMessage(Messages[4], Mentat) end - if player.Resources ~= CachedResources then - local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } + if Ordos.Resources ~= CachedResources then + local parameters = { ["harvested"] = Ordos.Resources, ["goal"] = SpiceToHarvest } local harvestedResources = UserInterface.Translate("harvested-resources", parameters) UserInterface.SetMissionText(harvestedResources) - CachedResources = player.Resources + CachedResources = Ordos.Resources end end WorldLoaded = function() - player = Player.GetPlayer("Ordos") - harkonnen = Player.GetPlayer("Harkonnen") + Ordos = Player.GetPlayer("Ordos") + Harkonnen = Player.GetPlayer("Harkonnen") SpiceToHarvest = ToHarvest[Difficulty] - InitObjectives(player) - KillOrdos = AddPrimaryObjective(harkonnen, "") + InitObjectives(Ordos) + KillOrdos = AddPrimaryObjective(Harkonnen, "") local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) - GatherSpice = AddPrimaryObjective(player, harvestSpice) - KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements") + GatherSpice = AddPrimaryObjective(Ordos, harvestSpice) + KillHarkonnen = AddSecondaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements") local checkResourceCapacity = function() Trigger.AfterDelay(0, function() - if player.ResourceCapacity < SpiceToHarvest then + if Ordos.ResourceCapacity < SpiceToHarvest then Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Trigger.AfterDelay(DateTime.Seconds(3), function() - harkonnen.MarkCompletedObjective(KillAtreides) + Harkonnen.MarkCompletedObjective(KillAtreides) end) return true @@ -126,16 +126,16 @@ WorldLoaded = function() return end - local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) + local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Ordos end) if #refs == 0 then - harkonnen.MarkCompletedObjective(KillOrdos) + Harkonnen.MarkCompletedObjective(KillOrdos) else Trigger.OnAllRemovedFromWorld(refs, function() - harkonnen.MarkCompletedObjective(KillOrdos) + Harkonnen.MarkCompletedObjective(KillOrdos) end) - local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) + local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Ordos end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) end @@ -144,8 +144,8 @@ WorldLoaded = function() Media.DisplayMessage(Messages[1], Mentat) Trigger.AfterDelay(DateTime.Seconds(25), function() - Media.PlaySpeechNotification(player, "Reinforce") - Reinforcements.Reinforce(player, OrdosReinforcements, OrdosEntryPath) + Media.PlaySpeechNotification(Ordos, "Reinforce") + Reinforcements.Reinforce(Ordos, OrdosReinforcements, OrdosEntryPath) end) WavesLeft = HarkonnenAttackWaves[Difficulty] @@ -159,7 +159,7 @@ SendReinforcements = function() if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end Trigger.AfterDelay(delay, function() - Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt) + Reinforcements.Reinforce(Harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt) WavesLeft = WavesLeft - 1 if WavesLeft == 0 then diff --git a/mods/d2k/maps/ordos-01b/ordos01b.lua b/mods/d2k/maps/ordos-01b/ordos01b.lua index 77dbbaf6e7..da1525065f 100644 --- a/mods/d2k/maps/ordos-01b/ordos01b.lua +++ b/mods/d2k/maps/ordos-01b/ordos01b.lua @@ -61,16 +61,16 @@ Messages = CachedResources = -1 Tick = function() - if HarkonnenArrived and harkonnen.HasNoRequiredUnits() then - player.MarkCompletedObjective(KillHarkonnen) + if HarkonnenArrived and Harkonnen.HasNoRequiredUnits() then + Ordos.MarkCompletedObjective(KillHarkonnen) end - if player.Resources > SpiceToHarvest - 1 then - player.MarkCompletedObjective(GatherSpice) + if Ordos.Resources > SpiceToHarvest - 1 then + Ordos.MarkCompletedObjective(GatherSpice) end -- player has no Wind Trap - if (player.PowerProvided <= 20 or player.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if (Ordos.PowerProvided <= 20 or Ordos.PowerState ~= "Normal") and DateTime.GameTime % DateTime.Seconds(32) == 0 then HasPower = false Media.DisplayMessage(Messages[2], Mentat) else @@ -78,40 +78,40 @@ Tick = function() end -- player has no Refinery and no Silos - if HasPower and player.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if HasPower and Ordos.ResourceCapacity == 0 and DateTime.GameTime % DateTime.Seconds(32) == 0 then Media.DisplayMessage(Messages[3], Mentat) end - if HasPower and player.Resources > player.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then + if HasPower and Ordos.Resources > Ordos.ResourceCapacity * 0.8 and DateTime.GameTime % DateTime.Seconds(32) == 0 then Media.DisplayMessage(Messages[4], Mentat) end - if player.Resources ~= CachedResources then - local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } + if Ordos.Resources ~= CachedResources then + local parameters = { ["harvested"] = Ordos.Resources, ["goal"] = SpiceToHarvest } local harvestedResources = UserInterface.Translate("harvested-resources", parameters) UserInterface.SetMissionText(harvestedResources) - CachedResources = player.Resources + CachedResources = Ordos.Resources end end WorldLoaded = function() - player = Player.GetPlayer("Ordos") - harkonnen = Player.GetPlayer("Harkonnen") + Ordos = Player.GetPlayer("Ordos") + Harkonnen = Player.GetPlayer("Harkonnen") SpiceToHarvest = ToHarvest[Difficulty] - InitObjectives(player) - KillOrdos = AddPrimaryObjective(harkonnen, "") + InitObjectives(Ordos) + KillOrdos = AddPrimaryObjective(Harkonnen, "") local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) - GatherSpice = AddPrimaryObjective(player, harvestSpice) - KillHarkonnen = AddSecondaryObjective(player, "eliminate-harkonnen-units-reinforcements") + GatherSpice = AddPrimaryObjective(Ordos, harvestSpice) + KillHarkonnen = AddSecondaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements") local checkResourceCapacity = function() Trigger.AfterDelay(0, function() - if player.ResourceCapacity < SpiceToHarvest then + if Ordos.ResourceCapacity < SpiceToHarvest then Media.DisplayMessage(UserInterface.Translate("not-enough-silos"), Mentat) Trigger.AfterDelay(DateTime.Seconds(3), function() - harkonnen.MarkCompletedObjective(KillOrdos) + Harkonnen.MarkCompletedObjective(KillOrdos) end) return true @@ -126,16 +126,16 @@ WorldLoaded = function() return end - local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == player end) + local refs = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "refinery" and actor.Owner == Ordos end) if #refs == 0 then - harkonnen.MarkCompletedObjective(KillOrdos) + Harkonnen.MarkCompletedObjective(KillOrdos) else Trigger.OnAllRemovedFromWorld(refs, function() - harkonnen.MarkCompletedObjective(KillOrdos) + Harkonnen.MarkCompletedObjective(KillOrdos) end) - local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == player end) + local silos = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "silo" and actor.Owner == Ordos end) Utils.Do(refs, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) Utils.Do(silos, function(actor) Trigger.OnRemovedFromWorld(actor, checkResourceCapacity) end) end @@ -144,8 +144,8 @@ WorldLoaded = function() Media.DisplayMessage(Messages[1], Mentat) Trigger.AfterDelay(DateTime.Seconds(25), function() - Media.PlaySpeechNotification(player, "Reinforce") - Reinforcements.Reinforce(player, OrdosReinforcements, OrdosEntryPath) + Media.PlaySpeechNotification(Ordos, "Reinforce") + Reinforcements.Reinforce(Ordos, OrdosReinforcements, OrdosEntryPath) end) WavesLeft = HarkonnenAttackWaves[Difficulty] @@ -159,7 +159,7 @@ SendReinforcements = function() if HarkonnenAttackDelay < 0 then HarkonnenAttackDelay = 0 end Trigger.AfterDelay(delay, function() - Reinforcements.Reinforce(harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt) + Reinforcements.Reinforce(Harkonnen, Utils.Random(units), { Utils.Random(HarkonnenEntryWaypoints) }, 10, IdleHunt) WavesLeft = WavesLeft - 1 if WavesLeft == 0 then diff --git a/mods/d2k/maps/ordos-02a/ordos02a-AI.lua b/mods/d2k/maps/ordos-02a/ordos02a-AI.lua index 4170736948..075f001e2f 100644 --- a/mods/d2k/maps/ordos-02a/ordos02a-AI.lua +++ b/mods/d2k/maps/ordos-02a/ordos02a-AI.lua @@ -24,11 +24,11 @@ AttackDelays = HarkonnenInfantryTypes = { "light_inf" } ActivateAI = function() - IdlingUnits[harkonnen] = { } + IdlingUnits[Harkonnen] = { } local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local toBuild = function() return HarkonnenInfantryTypes end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 - DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) - ProduceUnits(harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) + DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) + ProduceUnits(Harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/ordos-02a/ordos02a.lua b/mods/d2k/maps/ordos-02a/ordos02a.lua index b930b74671..e688baaf0e 100644 --- a/mods/d2k/maps/ordos-02a/ordos02a.lua +++ b/mods/d2k/maps/ordos-02a/ordos02a.lua @@ -81,39 +81,39 @@ OrdosReinforcements = { "light_inf", "light_inf", "raider" } OrdosEntryPath = { OrdosEntry.Location, OrdosRally.Location } Tick = function() - if player.HasNoRequiredUnits() then - harkonnen.MarkCompletedObjective(KillOrdos) + if Ordos.HasNoRequiredUnits() then + Harkonnen.MarkCompletedObjective(KillOrdos) end - if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then + if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) - player.MarkCompletedObjective(KillHarkonnen) + Ordos.MarkCompletedObjective(KillHarkonnen) end end WorldLoaded = function() - harkonnen = Player.GetPlayer("Harkonnen") - player = Player.GetPlayer("Ordos") + Harkonnen = Player.GetPlayer("Harkonnen") + Ordos = Player.GetPlayer("Ordos") - InitObjectives(player) - KillOrdos = AddPrimaryObjective(harkonnen, "") - KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces") + InitObjectives(Ordos) + KillOrdos = AddPrimaryObjective(Harkonnen, "") + KillHarkonnen = AddPrimaryObjective(Ordos, "destroy-harkonnen-forces") Camera.Position = OConyard.CenterPosition Trigger.OnAllKilled(HarkonnenBase, function() - Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) + Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt) end) Trigger.AfterDelay(DateTime.Minutes(1), function() - Media.PlaySpeechNotification(player, "Reinforce") - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", OrdosReinforcements, OrdosEntryPath, { OrdosEntryPath[1] }) + Media.PlaySpeechNotification(Ordos, "Reinforce") + Reinforcements.ReinforceWithTransport(Ordos, "carryall.reinforce", OrdosReinforcements, OrdosEntryPath, { OrdosEntryPath[1] }) end) - TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[1], InitialHarkonnenReinforcementsPaths[1]) - TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[2], InitialHarkonnenReinforcementsPaths[2]) + TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[1], InitialHarkonnenReinforcementsPaths[1]) + TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, InitialHarkonnenReinforcements[2], InitialHarkonnenReinforcementsPaths[2]) local path = function() return Utils.Random(HarkonnenAttackPaths) end - SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty]) + SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty]) Trigger.AfterDelay(0, ActivateAI) end diff --git a/mods/d2k/maps/ordos-02b/ordos02b-AI.lua b/mods/d2k/maps/ordos-02b/ordos02b-AI.lua index 4170736948..075f001e2f 100644 --- a/mods/d2k/maps/ordos-02b/ordos02b-AI.lua +++ b/mods/d2k/maps/ordos-02b/ordos02b-AI.lua @@ -24,11 +24,11 @@ AttackDelays = HarkonnenInfantryTypes = { "light_inf" } ActivateAI = function() - IdlingUnits[harkonnen] = { } + IdlingUnits[Harkonnen] = { } local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local toBuild = function() return HarkonnenInfantryTypes end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 - DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) - ProduceUnits(harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) + DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) + ProduceUnits(Harkonnen, HBarracks, delay, toBuild, AttackGroupSize[Difficulty], attackThresholdSize) end diff --git a/mods/d2k/maps/ordos-02b/ordos02b.lua b/mods/d2k/maps/ordos-02b/ordos02b.lua index 29a5978ced..dbaf977578 100644 --- a/mods/d2k/maps/ordos-02b/ordos02b.lua +++ b/mods/d2k/maps/ordos-02b/ordos02b.lua @@ -65,31 +65,31 @@ HarkonnenAttackWaves = } Tick = function() - if player.HasNoRequiredUnits() then - harkonnen.MarkCompletedObjective(KillOrdos) + if Ordos.HasNoRequiredUnits() then + Harkonnen.MarkCompletedObjective(KillOrdos) end - if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then + if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) - player.MarkCompletedObjective(KillHarkonnen) + Ordos.MarkCompletedObjective(KillHarkonnen) end end WorldLoaded = function() - harkonnen = Player.GetPlayer("Harkonnen") - player = Player.GetPlayer("Ordos") + Harkonnen = Player.GetPlayer("Harkonnen") + Ordos = Player.GetPlayer("Ordos") - InitObjectives(player) - KillOrdos = AddPrimaryObjective(harkonnen, "") - KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen-forces") + InitObjectives(Ordos) + KillOrdos = AddPrimaryObjective(Harkonnen, "") + KillHarkonnen = AddPrimaryObjective(Ordos, "destroy-harkonnen-forces") Camera.Position = OConyard.CenterPosition Trigger.OnAllKilled(HarkonnenBase, function() - Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) + Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt) end) local path = function() return Utils.Random(HarkonnenAttackPaths) end - SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty]) + SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty]) Trigger.AfterDelay(0, ActivateAI) end diff --git a/mods/d2k/maps/ordos-03a/ordos03a-AI.lua b/mods/d2k/maps/ordos-03a/ordos03a-AI.lua index c10db8751b..cb83c4d80a 100644 --- a/mods/d2k/maps/ordos-03a/ordos03a-AI.lua +++ b/mods/d2k/maps/ordos-03a/ordos03a-AI.lua @@ -25,13 +25,13 @@ HarkonnenInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "tr HarkonnenVehicleTypes = { "trike", "trike", "quad" } InitAIUnits = function() - IdlingUnits[harkonnen] = Reinforcements.Reinforce(harkonnen, HarkonnenInitialReinforcements, HarkonnenInitialPath) + IdlingUnits[Harkonnen] = Reinforcements.Reinforce(Harkonnen, HarkonnenInitialReinforcements, HarkonnenInitialPath) - DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) end ActivateAI = function() - LastHarvesterEaten[harkonnen] = true + LastHarvesterEaten[Harkonnen] = true Trigger.AfterDelay(0, InitAIUnits) HConyard.Produce(OrdosUpgrades[1]) @@ -44,7 +44,7 @@ ActivateAI = function() -- Finish the upgrades first before trying to build something Trigger.AfterDelay(DateTime.Seconds(14), function() - ProduceUnits(harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(harkonnen, HLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Harkonnen, HLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) end) end diff --git a/mods/d2k/maps/ordos-03a/ordos03a.lua b/mods/d2k/maps/ordos-03a/ordos03a.lua index 5d111eeb77..2a119700ee 100644 --- a/mods/d2k/maps/ordos-03a/ordos03a.lua +++ b/mods/d2k/maps/ordos-03a/ordos03a.lua @@ -77,25 +77,25 @@ OrdosBaseBuildings = { "barracks", "light_factory" } OrdosUpgrades = { "upgrade.barracks", "upgrade.light" } MessageCheck = function(index) - return #player.GetActorsByType(OrdosBaseBuildings[index]) > 0 and not player.HasPrerequisites({ OrdosUpgrades[index] }) + return #Ordos.GetActorsByType(OrdosBaseBuildings[index]) > 0 and not Ordos.HasPrerequisites({ OrdosUpgrades[index] }) end Tick = function() - if player.HasNoRequiredUnits() then - harkonnen.MarkCompletedObjective(KillOrdos) + if Ordos.HasNoRequiredUnits() then + Harkonnen.MarkCompletedObjective(KillOrdos) end - if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then + if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) - player.MarkCompletedObjective(KillHarkonnen) + Ordos.MarkCompletedObjective(KillHarkonnen) end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[harkonnen] then - local units = harkonnen.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Harkonnen] then + local units = Harkonnen.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[harkonnen] = false - ProtectHarvester(units[1], harkonnen, AttackGroupSize[Difficulty]) + LastHarvesterEaten[Harkonnen] = false + ProtectHarvester(units[1], Harkonnen, AttackGroupSize[Difficulty]) end end @@ -105,27 +105,27 @@ Tick = function() end WorldLoaded = function() - harkonnen = Player.GetPlayer("Harkonnen") - player = Player.GetPlayer("Ordos") + Harkonnen = Player.GetPlayer("Harkonnen") + Ordos = Player.GetPlayer("Ordos") - InitObjectives(player) - KillOrdos = AddPrimaryObjective(harkonnen, "") - KillHarkonnen = AddPrimaryObjective(player, "eliminate-harkonnen-units-reinforcements") + InitObjectives(Ordos) + KillOrdos = AddPrimaryObjective(Harkonnen, "") + KillHarkonnen = AddPrimaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements") Camera.Position = OConyard.CenterPosition Trigger.OnAllKilled(HarkonnenBase, function() - Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) + Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt) end) local path = function() return Utils.Random(HarkonnenPaths) end - local waveCondition = function() return player.IsObjectiveCompleted(KillHarkonnen) end - SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition) + local waveCondition = function() return Ordos.IsObjectiveCompleted(KillHarkonnen) end + SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition) ActivateAI() Trigger.AfterDelay(DateTime.Minutes(2) + DateTime.Seconds(30), function() - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", OrdosReinforcements, OrdosPath, { OrdosPath[1] }) + Reinforcements.ReinforceWithTransport(Ordos, "carryall.reinforce", OrdosReinforcements, OrdosPath, { OrdosPath[1] }) end) - TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters, HarkonnenHunterPath) + TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters, HarkonnenHunterPath) end diff --git a/mods/d2k/maps/ordos-03b/ordos03b-AI.lua b/mods/d2k/maps/ordos-03b/ordos03b-AI.lua index c10db8751b..cb83c4d80a 100644 --- a/mods/d2k/maps/ordos-03b/ordos03b-AI.lua +++ b/mods/d2k/maps/ordos-03b/ordos03b-AI.lua @@ -25,13 +25,13 @@ HarkonnenInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "tr HarkonnenVehicleTypes = { "trike", "trike", "quad" } InitAIUnits = function() - IdlingUnits[harkonnen] = Reinforcements.Reinforce(harkonnen, HarkonnenInitialReinforcements, HarkonnenInitialPath) + IdlingUnits[Harkonnen] = Reinforcements.Reinforce(Harkonnen, HarkonnenInitialReinforcements, HarkonnenInitialPath) - DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) + DefendAndRepairBase(Harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) end ActivateAI = function() - LastHarvesterEaten[harkonnen] = true + LastHarvesterEaten[Harkonnen] = true Trigger.AfterDelay(0, InitAIUnits) HConyard.Produce(OrdosUpgrades[1]) @@ -44,7 +44,7 @@ ActivateAI = function() -- Finish the upgrades first before trying to build something Trigger.AfterDelay(DateTime.Seconds(14), function() - ProduceUnits(harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) - ProduceUnits(harkonnen, HLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) + ProduceUnits(Harkonnen, HLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) end) end diff --git a/mods/d2k/maps/ordos-03b/ordos03b.lua b/mods/d2k/maps/ordos-03b/ordos03b.lua index 309a3fba46..b526821eae 100644 --- a/mods/d2k/maps/ordos-03b/ordos03b.lua +++ b/mods/d2k/maps/ordos-03b/ordos03b.lua @@ -106,33 +106,33 @@ OrdosBaseBuildings = { "barracks", "light_factory" } OrdosUpgrades = { "upgrade.barracks", "upgrade.light" } MessageCheck = function(index) - return #player.GetActorsByType(OrdosBaseBuildings[index]) > 0 and not player.HasPrerequisites({ OrdosUpgrades[index] }) + return #Ordos.GetActorsByType(OrdosBaseBuildings[index]) > 0 and not Ordos.HasPrerequisites({ OrdosUpgrades[index] }) end SendOrdosReinforcements = function(timer, unit, path) Trigger.AfterDelay(timer, function() - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", unit, path, { path[1] }) + Reinforcements.ReinforceWithTransport(Ordos, "carryall.reinforce", unit, path, { path[1] }) SendOrdosReinforcements(timer, unit, path) end) end Tick = function() - if player.HasNoRequiredUnits() then - harkonnen.MarkCompletedObjective(KillOrdos) + if Ordos.HasNoRequiredUnits() then + Harkonnen.MarkCompletedObjective(KillOrdos) end - if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then + if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) - player.MarkCompletedObjective(KillHarkonnen) + Ordos.MarkCompletedObjective(KillHarkonnen) end - if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[harkonnen] then - local units = harkonnen.GetActorsByType("harvester") + if DateTime.GameTime % DateTime.Seconds(10) == 0 and LastHarvesterEaten[Harkonnen] then + local units = Harkonnen.GetActorsByType("harvester") if #units > 0 then - LastHarvesterEaten[harkonnen] = false - ProtectHarvester(units[1], harkonnen, AttackGroupSize[Difficulty]) + LastHarvesterEaten[Harkonnen] = false + ProtectHarvester(units[1], Harkonnen, AttackGroupSize[Difficulty]) end end @@ -142,32 +142,32 @@ Tick = function() end WorldLoaded = function() - harkonnen = Player.GetPlayer("Harkonnen") - player = Player.GetPlayer("Ordos") + Harkonnen = Player.GetPlayer("Harkonnen") + Ordos = Player.GetPlayer("Ordos") - InitObjectives(player) - KillOrdos = AddPrimaryObjective(harkonnen, "") - KillHarkonnen = AddPrimaryObjective(player, "eliminate-harkonnen-units-reinforcements") + InitObjectives(Ordos) + KillOrdos = AddPrimaryObjective(Harkonnen, "") + KillHarkonnen = AddPrimaryObjective(Ordos, "eliminate-harkonnen-units-reinforcements") Camera.Position = OConyard.CenterPosition Trigger.OnAllKilled(HarkonnenBase, function() - Utils.Do(harkonnen.GetGroundAttackers(), IdleHunt) + Utils.Do(Harkonnen.GetGroundAttackers(), IdleHunt) end) local path = function() return Utils.Random(HarkonnenPaths) end - local waveCondition = function() return player.IsObjectiveCompleted(KillHarkonnen) end - SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition) + local waveCondition = function() return Ordos.IsObjectiveCompleted(KillHarkonnen) end + SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], HarkonnenAttackDelay[Difficulty], path, HarkonnenReinforcements[Difficulty], waveCondition) ActivateAI() SendOrdosReinforcements(OrdosReinforcementDelays[1], OrdosReinforcements[1], OrdosPaths[1]) SendOrdosReinforcements(OrdosReinforcementDelays[3], OrdosReinforcements[3], OrdosPaths[3]) Trigger.AfterDelay(OrdosReinforcementDelays[2], function() - Reinforcements.ReinforceWithTransport(player, "carryall.reinforce", OrdosReinforcements[2], OrdosPaths[2], { OrdosPaths[2][1] }) + Reinforcements.ReinforceWithTransport(Ordos, "carryall.reinforce", OrdosReinforcements[2], OrdosPaths[2], { OrdosPaths[2][1] }) end) - TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[1], HarkonnenHunterPaths[1]) - TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[2], HarkonnenHunterPaths[2]) - TriggerCarryallReinforcements(player, harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[3], HarkonnenHunterPaths[3]) + TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[1], HarkonnenHunterPaths[1]) + TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[2], HarkonnenHunterPaths[2]) + TriggerCarryallReinforcements(Ordos, Harkonnen, HarkonnenBaseAreaTrigger, HarkonnenHunters[3], HarkonnenHunterPaths[3]) end diff --git a/mods/d2k/maps/ordos-04/ordos04-AI.lua b/mods/d2k/maps/ordos-04/ordos04-AI.lua index 7f81d34699..4d4ce8a618 100644 --- a/mods/d2k/maps/ordos-04/ordos04-AI.lua +++ b/mods/d2k/maps/ordos-04/ordos04-AI.lua @@ -37,8 +37,8 @@ InitAIUnits = function(house) end ActivateAI = function() - InitAIUnits(harkonnen) - InitAIUnits(smuggler) + InitAIUnits(Harkonnen) + InitAIUnits(Smuggler) local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end @@ -48,11 +48,11 @@ ActivateAI = function() local sTanksToBuild = function() return SmugglerTankType end local attackTresholdSize = AttackGroupSize[Difficulty] * 2.5 - ProduceUnits(harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) - ProduceUnits(harkonnen, HLightFactory, delay, hVehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize) - ProduceUnits(harkonnen, HHeavyFactory, delay, hTanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(Harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(Harkonnen, HLightFactory, delay, hVehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(Harkonnen, HHeavyFactory, delay, hTanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize) - ProduceUnits(smuggler, SBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) - ProduceUnits(smuggler, SLightFactory, delay, sVehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize) - ProduceUnits(smuggler, SHeavyFactory, delay, sTanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(Smuggler, SBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(Smuggler, SLightFactory, delay, sVehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(Smuggler, SHeavyFactory, delay, sTanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize) end diff --git a/mods/d2k/maps/ordos-04/ordos04.lua b/mods/d2k/maps/ordos-04/ordos04.lua index d6fa2a9b7c..bdece1b055 100644 --- a/mods/d2k/maps/ordos-04/ordos04.lua +++ b/mods/d2k/maps/ordos-04/ordos04.lua @@ -52,11 +52,11 @@ OrdosPath = { OrdosEntry.Location, OrdosRally.Location } SendHarkonnen = function(path) Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty], function() - if player.IsObjectiveCompleted(KillHarkonnen) then + if Ordos.IsObjectiveCompleted(KillHarkonnen) then return end - local units = Reinforcements.ReinforceWithTransport(harkonnen, "carryall.reinforce", HarkonnenLightInfantryRushers[Difficulty], path, { path[1] })[2] + local units = Reinforcements.ReinforceWithTransport(Harkonnen, "carryall.reinforce", HarkonnenLightInfantryRushers[Difficulty], path, { path[1] })[2] Utils.Do(units, function(unit) unit.AttackMove(HarkonnenAttackLocation) IdleHunt(unit) @@ -83,64 +83,64 @@ end AttackNotifier = 0 Tick = function() - if player.HasNoRequiredUnits() then - harkonnen.MarkCompletedObjective(KillOrdosH) - smuggler.MarkCompletedObjective(KillOrdosS) - smuggler.MarkCompletedObjective(DefendOutpost) + if Ordos.HasNoRequiredUnits() then + Harkonnen.MarkCompletedObjective(KillOrdosH) + Smuggler.MarkCompletedObjective(KillOrdosS) + Smuggler.MarkCompletedObjective(DefendOutpost) end - if harkonnen.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillHarkonnen) then + if Harkonnen.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillHarkonnen) then Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) - player.MarkCompletedObjective(KillHarkonnen) + Ordos.MarkCompletedObjective(KillHarkonnen) end - CheckHarvester(harkonnen) - CheckHarvester(smuggler) + CheckHarvester(Harkonnen) + CheckHarvester(Smuggler) AttackNotifier = AttackNotifier - 1 end WorldLoaded = function() - harkonnen = Player.GetPlayer("Harkonnen") - smuggler = Player.GetPlayer("Smugglers") - player = Player.GetPlayer("Ordos") + Harkonnen = Player.GetPlayer("Harkonnen") + Smuggler = Player.GetPlayer("Smugglers") + Ordos = Player.GetPlayer("Ordos") - InitObjectives(player) - KillOrdosH = AddPrimaryObjective(harkonnen, "") - KillOrdosS = AddSecondaryObjective(smuggler, "") - DefendOutpost = AddPrimaryObjective(smuggler, "outpost-not-captured-destroyed") - CaptureOutpost = AddPrimaryObjective(player, "capture-smuggler-outpost") - KillHarkonnen = AddSecondaryObjective(player, "destroy-harkonnen") + InitObjectives(Ordos) + KillOrdosH = AddPrimaryObjective(Harkonnen, "") + KillOrdosS = AddSecondaryObjective(Smuggler, "") + DefendOutpost = AddPrimaryObjective(Smuggler, "outpost-not-captured-destroyed") + CaptureOutpost = AddPrimaryObjective(Ordos, "capture-smuggler-outpost") + KillHarkonnen = AddSecondaryObjective(Ordos, "destroy-harkonnen") SOutpost.GrantCondition("modified") Camera.Position = OConyard.CenterPosition HarkonnenAttackLocation = OConyard.Location - Hunt(harkonnen) - Hunt(smuggler) + Hunt(Harkonnen) + Hunt(Smuggler) SendHarkonnen(LightInfantryRushersPaths[1]) SendHarkonnen(LightInfantryRushersPaths[2]) SendHarkonnen(LightInfantryRushersPaths[3]) - Actor.Create("upgrade.barracks", true, { Owner = harkonnen }) - Actor.Create("upgrade.light", true, { Owner = harkonnen }) - Actor.Create("upgrade.barracks", true, { Owner = smuggler }) - Actor.Create("upgrade.light", true, { Owner = smuggler }) + Actor.Create("upgrade.barracks", true, { Owner = Harkonnen }) + Actor.Create("upgrade.light", true, { Owner = Harkonnen }) + Actor.Create("upgrade.barracks", true, { Owner = Smuggler }) + Actor.Create("upgrade.light", true, { Owner = Smuggler }) Trigger.AfterDelay(0, ActivateAI) Trigger.OnKilled(SOutpost, function() - player.MarkFailedObjective(CaptureOutpost) + Ordos.MarkFailedObjective(CaptureOutpost) end) Trigger.OnCapture(SOutpost, function() Trigger.AfterDelay(DateTime.Seconds(2), function() - player.MarkCompletedObjective(CaptureOutpost) - smuggler.MarkFailedObjective(DefendOutpost) + Ordos.MarkCompletedObjective(CaptureOutpost) + Smuggler.MarkFailedObjective(DefendOutpost) end) end) Trigger.OnDamaged(SOutpost, function() - if SOutpost.Owner ~= smuggler then + if SOutpost.Owner ~= Smuggler then return end @@ -151,8 +151,8 @@ WorldLoaded = function() end) Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty] - DateTime.Seconds(5), function() - Media.PlaySpeechNotification(player, "Reinforce") - Reinforcements.Reinforce(player, OrdosReinforcements, OrdosPath) + Media.PlaySpeechNotification(Ordos, "Reinforce") + Reinforcements.Reinforce(Ordos, OrdosReinforcements, OrdosPath) end) Trigger.AfterDelay(HarkonnenAttackDelay[Difficulty], function() diff --git a/mods/d2k/maps/ordos-05/ordos05-AI.lua b/mods/d2k/maps/ordos-05/ordos05-AI.lua index cae75a9399..69d5025f48 100644 --- a/mods/d2k/maps/ordos-05/ordos05-AI.lua +++ b/mods/d2k/maps/ordos-05/ordos05-AI.lua @@ -27,7 +27,7 @@ EnemyTankType = { "combat_tank_a" } InitAIUnits = function(house) LastHarvesterEaten[house] = true - if house ~= atreides_small_3 then + if house ~= AtreidesSmall3 then IdlingUnits[house] = Reinforcements.Reinforce(house, InitialReinforcements[house.InternalName], InitialReinforcementsPaths[house.InternalName]) else IdlingUnits[house] = { } @@ -43,20 +43,20 @@ ActivateAIProduction = function() local tanksToBuild = function() return EnemyTankType end local attackTresholdSize = AttackGroupSize[Difficulty] * 2.5 - ProduceUnits(atreides_main, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) - ProduceUnits(atreides_main, ALightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize) - ProduceUnits(atreides_main, AHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(AtreidesMain, ABarracks1, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(AtreidesMain, ALightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(AtreidesMain, AHeavyFactory, delay, tanksToBuild, AttackGroupSize[Difficulty], attackTresholdSize) - ProduceUnits(atreides_small_1, ABarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(AtreidesSmall1, ABarracks2, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) - ProduceUnits(atreides_small_2, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(AtreidesSmall2, ABarracks3, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) AIProductionActivated = true end ActivateAI = function() - InitAIUnits(atreides_main) - InitAIUnits(atreides_small_1) - InitAIUnits(atreides_small_2) - InitAIUnits(atreides_small_3) + InitAIUnits(AtreidesMain) + InitAIUnits(AtreidesSmall1) + InitAIUnits(AtreidesSmall2) + InitAIUnits(AtreidesSmall3) end diff --git a/mods/d2k/maps/ordos-05/ordos05.lua b/mods/d2k/maps/ordos-05/ordos05.lua index cd4c5876af..ed91cfcb7d 100644 --- a/mods/d2k/maps/ordos-05/ordos05.lua +++ b/mods/d2k/maps/ordos-05/ordos05.lua @@ -110,57 +110,57 @@ end CachedResources = -1 Tick = function() - if player.Resources > SpiceToHarvest - 1 then - player.MarkCompletedObjective(GatherSpice) + if Ordos.Resources > SpiceToHarvest - 1 then + Ordos.MarkCompletedObjective(GatherSpice) end - if player.HasNoRequiredUnits() then - atreides_main.MarkCompletedObjective(KillOrdos1) - atreides_small_1.MarkCompletedObjective(KillOrdos2) - atreides_small_2.MarkCompletedObjective(KillOrdos3) - atreides_small_3.MarkCompletedObjective(KillOrdos4) + if Ordos.HasNoRequiredUnits() then + AtreidesMain.MarkCompletedObjective(KillOrdos1) + AtreidesSmall1.MarkCompletedObjective(KillOrdos2) + AtreidesSmall2.MarkCompletedObjective(KillOrdos3) + AtreidesSmall3.MarkCompletedObjective(KillOrdos4) end - if atreides_main.HasNoRequiredUnits() and atreides_small_1.HasNoRequiredUnits() and atreides_small_2.HasNoRequiredUnits() and atreides_small_3.HasNoRequiredUnits() and not player.IsObjectiveCompleted(KillAtreides) then + if AtreidesMain.HasNoRequiredUnits() and AtreidesSmall1.HasNoRequiredUnits() and AtreidesSmall2.HasNoRequiredUnits() and AtreidesSmall3.HasNoRequiredUnits() and not Ordos.IsObjectiveCompleted(KillAtreides) then Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) - player.MarkCompletedObjective(KillAtreides) + Ordos.MarkCompletedObjective(KillAtreides) end - if #player.GetActorsByType("engineer") == 0 and not player.IsObjectiveCompleted(CaptureStarport) then - player.MarkFailedObjective(CaptureStarport) + if #Ordos.GetActorsByType("engineer") == 0 and not Ordos.IsObjectiveCompleted(CaptureStarport) then + Ordos.MarkFailedObjective(CaptureStarport) end - if player.IsObjectiveCompleted(CaptureStarport) then - if player.Resources ~= CachedResources then - local parameters = { ["harvested"] = player.Resources, ["goal"] = SpiceToHarvest } + if Ordos.IsObjectiveCompleted(CaptureStarport) then + if Ordos.Resources ~= CachedResources then + local parameters = { ["harvested"] = Ordos.Resources, ["goal"] = SpiceToHarvest } local harvestedResources = UserInterface.Translate("harvested-resources", parameters) UserInterface.SetMissionText(harvestedResources) - CachedResources = player.Resources + CachedResources = Ordos.Resources end end - CheckHarvester(atreides_main) - CheckHarvester(atreides_small_1) + CheckHarvester(AtreidesMain) + CheckHarvester(AtreidesSmall1) end WorldLoaded = function() - atreides_main = Player.GetPlayer("AtreidesMainBase") - atreides_small_1 = Player.GetPlayer("AtreidesSmallBase1") - atreides_small_2 = Player.GetPlayer("AtreidesSmallBase2") - atreides_small_3 = Player.GetPlayer("AtreidesSmallBase3") - player = Player.GetPlayer("Ordos") + AtreidesMain = Player.GetPlayer("AtreidesMainBase") + AtreidesSmall1 = Player.GetPlayer("AtreidesSmallBase1") + AtreidesSmall2 = Player.GetPlayer("AtreidesSmallBase2") + AtreidesSmall3 = Player.GetPlayer("AtreidesSmallBase3") + Ordos = Player.GetPlayer("Ordos") SpiceToHarvest = ToHarvest[Difficulty] - InitObjectives(player) - KillOrdos1 = AddPrimaryObjective(atreides_main, "") - KillOrdos2 = AddPrimaryObjective(atreides_small_1, "") - KillOrdos3 = AddPrimaryObjective(atreides_small_2, "") - KillOrdos4 = AddPrimaryObjective(atreides_small_3, "") - CaptureStarport = AddPrimaryObjective(player, "capture-atreides-starport-establish-base") + InitObjectives(Ordos) + KillOrdos1 = AddPrimaryObjective(AtreidesMain, "") + KillOrdos2 = AddPrimaryObjective(AtreidesSmall1, "") + KillOrdos3 = AddPrimaryObjective(AtreidesSmall2, "") + KillOrdos4 = AddPrimaryObjective(AtreidesSmall3, "") + CaptureStarport = AddPrimaryObjective(Ordos, "capture-atreides-starport-establish-base") local harvestSpice = UserInterface.Translate("harvest-spice", { ["spice"] = SpiceToHarvest }) - GatherSpice = AddPrimaryObjective(player, harvestSpice) - KillAtreides = AddSecondaryObjective(player, "destroy-atreides") + GatherSpice = AddPrimaryObjective(Ordos, harvestSpice) + KillAtreides = AddSecondaryObjective(Ordos, "destroy-atreides") Camera.Position = OEngi1.CenterPosition AtreidesAttackLocation = OEngi1.Location @@ -173,45 +173,45 @@ WorldLoaded = function() OCombat2.Destroy() end - Hunt(atreides_main) - Hunt(atreides_small_1) - Hunt(atreides_small_2) - Hunt(atreides_small_3) + Hunt(AtreidesMain) + Hunt(AtreidesSmall1) + Hunt(AtreidesSmall2) + Hunt(AtreidesSmall3) local path = function() return Utils.Random(AtreidesPaths) end - local waveCondition = function() return player.IsObjectiveCompleted(KillAtreides) end + local waveCondition = function() return Ordos.IsObjectiveCompleted(KillAtreides) end local huntFunction = function(unit) unit.AttackMove(AtreidesAttackLocation) IdleHunt(unit) end - SendCarryallReinforcements(atreides_main, 0, 8, AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction) + SendCarryallReinforcements(AtreidesMain, 0, 8, AtreidesAttackDelay[Difficulty], path, AtreidesReinforcements[Difficulty], waveCondition, huntFunction) - Actor.Create("upgrade.barracks", true, { Owner = atreides_main }) - Actor.Create("upgrade.light", true, { Owner = atreides_main }) - Actor.Create("upgrade.heavy", true, { Owner = atreides_main }) - Actor.Create("upgrade.barracks", true, { Owner = atreides_small_1 }) - Actor.Create("upgrade.barracks", true, { Owner = atreides_small_2 }) + Actor.Create("upgrade.barracks", true, { Owner = AtreidesMain }) + Actor.Create("upgrade.light", true, { Owner = AtreidesMain }) + Actor.Create("upgrade.heavy", true, { Owner = AtreidesMain }) + Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall1 }) + Actor.Create("upgrade.barracks", true, { Owner = AtreidesSmall2 }) Trigger.AfterDelay(0, ActivateAI) Trigger.OnKilled(AStarport, function() - if not player.IsObjectiveCompleted(CaptureStarport) then - player.MarkFailedObjective(CaptureStarport) + if not Ordos.IsObjectiveCompleted(CaptureStarport) then + Ordos.MarkFailedObjective(CaptureStarport) end end) Trigger.OnCapture(AStarport, function() - player.MarkCompletedObjective(CaptureStarport) + Ordos.MarkCompletedObjective(CaptureStarport) if not AIProductionActivated then ActivateAIProduction() end - Reinforcements.ReinforceWithTransport(player, "frigate", { "mcv" }, { OrdosStarportEntry.Location, AStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location }) + Reinforcements.ReinforceWithTransport(Ordos, "frigate", { "mcv" }, { OrdosStarportEntry.Location, AStarport.Location + CVec.New(1, 1) }, { OrdosStarportExit.Location }) - if APower8.Owner ~= player and not APower8.IsDead then + if APower8.Owner ~= Ordos and not APower8.IsDead then APower8.Sell() end - if APower9.Owner ~= player and not APower9.IsDead then + if APower9.Owner ~= Ordos and not APower9.IsDead then APower9.Sell() end end) diff --git a/mods/d2k/maps/ordos-06a/ordos06a-AI.lua b/mods/d2k/maps/ordos-06a/ordos06a-AI.lua index c8a277e79a..1d16d31d45 100644 --- a/mods/d2k/maps/ordos-06a/ordos06a-AI.lua +++ b/mods/d2k/maps/ordos-06a/ordos06a-AI.lua @@ -35,8 +35,8 @@ InitAIUnits = function(house) end ActivateAI = function() - InitAIUnits(atreides) - InitAIUnits(harkonnen) + InitAIUnits(Atreides) + InitAIUnits(Harkonnen) local delay = function() return Utils.RandomInteger(ProductionDelays[Difficulty][1], ProductionDelays[Difficulty][2] + 1) end local infantryToBuild = function() return { Utils.Random(EnemyInfantryTypes) } end @@ -45,10 +45,10 @@ ActivateAI = function() local tanksToBuildHarkonnen = function() return { Utils.Random(HarkonnenTankTypes) } end local attackTresholdSize = AttackGroupSize[Difficulty] * 2.5 - ProduceUnits(atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) - ProduceUnits(atreides, ALightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize) - ProduceUnits(atreides, AHeavyFactory, delay, tanksToBuildAtreides, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(Atreides, ABarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(Atreides, ALightFactory, delay, vehiclesToBuild, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(Atreides, AHeavyFactory, delay, tanksToBuildAtreides, AttackGroupSize[Difficulty], attackTresholdSize) - ProduceUnits(harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) - ProduceUnits(harkonnen, HHeavyFactory, delay, tanksToBuildHarkonnen, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(Harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackTresholdSize) + ProduceUnits(Harkonnen, HHeavyFactory, delay, tanksToBuildHarkonnen, AttackGroupSize[Difficulty], attackTresholdSize) end diff --git a/mods/d2k/maps/ordos-06a/ordos06a.lua b/mods/d2k/maps/ordos-06a/ordos06a.lua index ddacb34a31..78db7e7279 100644 --- a/mods/d2k/maps/ordos-06a/ordos06a.lua +++ b/mods/d2k/maps/ordos-06a/ordos06a.lua @@ -143,10 +143,10 @@ ContrabandTimes = IxianReinforcementsHaveArrived = UserInterface.Translate("ixian-reinforcements-arrived") SendContraband = function() - Media.PlaySpeechNotification(player, "Reinforce") + Media.PlaySpeechNotification(Ordos, "Reinforce") for i = 0, 6 do - local c = player.Color + local c = Ordos.Color if i % 2 == 0 then c = HSLColor.White end @@ -159,7 +159,7 @@ SendContraband = function() local entryPath = { CPos.New(82, OStarport.Location.Y + 1), OStarport.Location + CVec.New(1, 1) } local exitPath = { CPos.New(2, OStarport.Location.Y + 1) } - Reinforcements.ReinforceWithTransport(player, "frigate", IxianReinforcements[Difficulty], entryPath, exitPath) + Reinforcements.ReinforceWithTransport(Ordos, "frigate", IxianReinforcements[Difficulty], entryPath, exitPath) end Hunt = function(house) @@ -180,23 +180,23 @@ CheckHarvester = function(house) end Tick = function() - if not player.IsObjectiveCompleted(KillAtreides) and atreides.HasNoRequiredUnits() then + if not Ordos.IsObjectiveCompleted(KillAtreides) and Atreides.HasNoRequiredUnits() then Media.DisplayMessage(UserInterface.Translate("atreides-annihilated"), Mentat) - player.MarkCompletedObjective(KillAtreides) - DestroyCarryalls(atreides) + Ordos.MarkCompletedObjective(KillAtreides) + DestroyCarryalls(Atreides) - if player.IsObjectiveCompleted(KillHarkonnen) then - player.MarkCompletedObjective(GuardStarport) + if Ordos.IsObjectiveCompleted(KillHarkonnen) then + Ordos.MarkCompletedObjective(GuardStarport) end end - if not player.IsObjectiveCompleted(KillHarkonnen) and harkonnen.HasNoRequiredUnits() then + if not Ordos.IsObjectiveCompleted(KillHarkonnen) and Harkonnen.HasNoRequiredUnits() then Media.DisplayMessage(UserInterface.Translate("harkonnen-annihilated"), Mentat) - player.MarkCompletedObjective(KillHarkonnen) - DestroyCarryalls(harkonnen) + Ordos.MarkCompletedObjective(KillHarkonnen) + DestroyCarryalls(Harkonnen) - if player.IsObjectiveCompleted(KillAtreides) then - player.MarkCompletedObjective(GuardStarport) + if Ordos.IsObjectiveCompleted(KillAtreides) then + Ordos.MarkCompletedObjective(GuardStarport) end end @@ -217,29 +217,29 @@ Tick = function() reinforcementsText = UserInterface.Translate("additional-reinforcements-arrive-in", time) end - UserInterface.SetMissionText(reinforcementsText, player.Color) + UserInterface.SetMissionText(reinforcementsText, Ordos.Color) end end - CheckHarvester(atreides) - CheckHarvester(harkonnen) + CheckHarvester(Atreides) + CheckHarvester(Harkonnen) end WorldLoaded = function() - atreides = Player.GetPlayer("Atreides") - harkonnen = Player.GetPlayer("Harkonnen") - player = Player.GetPlayer("Ordos") + Atreides = Player.GetPlayer("Atreides") + Harkonnen = Player.GetPlayer("Harkonnen") + Ordos = Player.GetPlayer("Ordos") - InitObjectives(player) - GuardStarport = AddPrimaryObjective(player, "defend-starport") - KillAtreides = AddPrimaryObjective(player, "destroy-atreides") - KillHarkonnen = AddPrimaryObjective(player, "destroy-harkonnen") + InitObjectives(Ordos) + GuardStarport = AddPrimaryObjective(Ordos, "defend-starport") + KillAtreides = AddPrimaryObjective(Ordos, "destroy-atreides") + KillHarkonnen = AddPrimaryObjective(Ordos, "destroy-harkonnen") Camera.Position = OConyard.CenterPosition EnemyAttackLocations = { OConyard.Location, OStarport.Location } Trigger.OnRemovedFromWorld(OStarport, function() - player.MarkFailedObjective(GuardStarport) + Ordos.MarkFailedObjective(GuardStarport) end) Trigger.AfterDelay(DateTime.Seconds(2), function() @@ -248,13 +248,13 @@ WorldLoaded = function() Media.DisplayMessage(UserInterface.Translate("ixian-reinforcements-in", time), Mentat) end) - Hunt(atreides) - Hunt(harkonnen) + Hunt(Atreides) + Hunt(Harkonnen) local atreidesPath = function() return Utils.Random(AtreidesPaths) end local harkonnenPath = function() return Utils.Random(HarkonnenPaths) end - local atreidesCondition = function() return player.IsObjectiveCompleted(KillAtreides) end - local harkonnenCondition = function() return player.IsObjectiveCompleted(KillHarkonnen) end + local atreidesCondition = function() return Ordos.IsObjectiveCompleted(KillAtreides) end + local harkonnenCondition = function() return Ordos.IsObjectiveCompleted(KillHarkonnen) end local huntFunction = function(unit) unit.AttackMove(Utils.Random(EnemyAttackLocations)) IdleHunt(unit) @@ -263,16 +263,16 @@ WorldLoaded = function() Media.DisplayMessage(UserInterface.Translate("enemy-reinforcements-arrived"), Mentat) end - SendCarryallReinforcements(atreides, 0, AtreidesAttackWaves[Difficulty], EnemyAttackDelay[Difficulty], atreidesPath, AtreidesReinforcements[Difficulty], atreidesCondition, huntFunction, announcementFunction) + SendCarryallReinforcements(Atreides, 0, AtreidesAttackWaves[Difficulty], EnemyAttackDelay[Difficulty], atreidesPath, AtreidesReinforcements[Difficulty], atreidesCondition, huntFunction, announcementFunction) Trigger.AfterDelay(Utils.RandomInteger(DateTime.Seconds(45), DateTime.Minutes(1) + DateTime.Seconds(15)), function() - SendCarryallReinforcements(harkonnen, 0, HarkonnenAttackWaves[Difficulty], EnemyAttackDelay[Difficulty], harkonnenPath, HarkonnenReinforcements[Difficulty], harkonnenCondition, huntFunction, announcementFunction) + SendCarryallReinforcements(Harkonnen, 0, HarkonnenAttackWaves[Difficulty], EnemyAttackDelay[Difficulty], harkonnenPath, HarkonnenReinforcements[Difficulty], harkonnenCondition, huntFunction, announcementFunction) end) - Actor.Create("upgrade.barracks", true, { Owner = atreides }) - Actor.Create("upgrade.light", true, { Owner = atreides }) - Actor.Create("upgrade.heavy", true, { Owner = atreides }) - Actor.Create("upgrade.barracks", true, { Owner = harkonnen }) - Actor.Create("upgrade.heavy", true, { Owner = harkonnen }) + Actor.Create("upgrade.barracks", true, { Owner = Atreides }) + Actor.Create("upgrade.light", true, { Owner = Atreides }) + Actor.Create("upgrade.heavy", true, { Owner = Atreides }) + Actor.Create("upgrade.barracks", true, { Owner = Harkonnen }) + Actor.Create("upgrade.heavy", true, { Owner = Harkonnen }) Trigger.AfterDelay(0, ActivateAI) end diff --git a/mods/d2k/maps/shellmap/d2k-shellmap.lua b/mods/d2k/maps/shellmap/d2k-shellmap.lua index 0b03c60dc6..542d964a2e 100644 --- a/mods/d2k/maps/shellmap/d2k-shellmap.lua +++ b/mods/d2k/maps/shellmap/d2k-shellmap.lua @@ -139,26 +139,26 @@ InitializeHarvester = function(harvester) harvester.FindResources() end -ticks = 0 -speed = 5 +Ticks = 0 +Speed = 5 Tick = function() - ticks = ticks + 1 + Ticks = Ticks + 1 - if ticks > 1 or not Map.IsPausedShellmap then - local t = (ticks + 45) % (360 * speed) * (math.pi / 180) / speed; - Camera.Position = viewportOrigin + WVec.New(19200 * math.sin(t), 28800 * math.cos(t), 0) + if Ticks > 1 or not Map.IsPausedShellmap then + local t = (Ticks + 45) % (360 * Speed) * (math.pi / 180) / Speed; + Camera.Position = ViewportOrigin + WVec.New(19200 * math.sin(t), 28800 * math.cos(t), 0) end end WorldLoaded = function() - atreides = Player.GetPlayer("Atreides") - harkonnen = Player.GetPlayer("Harkonnen") - ordos = Player.GetPlayer("Ordos") - corrino = Player.GetPlayer("Corrino") - smugglers = Player.GetPlayer("Smugglers") + Atreides = Player.GetPlayer("Atreides") + Harkonnen = Player.GetPlayer("Harkonnen") + Ordos = Player.GetPlayer("Ordos") + Corrino = Player.GetPlayer("Corrino") + Smugglers = Player.GetPlayer("Smugglers") - viewportOrigin = Camera.Position + ViewportOrigin = Camera.Position Utils.Do(Utils.Take(4, Upgrades), function(upgrade) atr_cyard.Produce(upgrade) @@ -169,32 +169,32 @@ WorldLoaded = function() atr_cyard.Produce(Upgrades[5]) Trigger.AfterDelay(DateTime.Seconds(45), function() - SendNewHarv(atreides, AtrCarryHarvWaypoints, 3) - SendNewHarv(harkonnen, HarCarryHarvWaypoints, 3) - SendNewHarv(ordos, OrdCarryHarvWaypoints, 3) - SendNewHarv(corrino, CorCarryHarvWaypoints, 3) - SendNewHarv(smugglers, SmgCarryHarvWaypoints, 1) + SendNewHarv(Atreides, AtrCarryHarvWaypoints, 3) + SendNewHarv(Harkonnen, HarCarryHarvWaypoints, 3) + SendNewHarv(Ordos, OrdCarryHarvWaypoints, 3) + SendNewHarv(Corrino, CorCarryHarvWaypoints, 3) + SendNewHarv(Smugglers, SmgCarryHarvWaypoints, 1) end) Trigger.AfterDelay(DateTime.Seconds(1), function() - Produce(atreides, AtreidesInfantryTypes) - Produce(atreides, AtreidesVehicleTypes) - Produce(atreides, AtreidesTankTypes) - Produce(atreides, AtreidesStarportTypes) + Produce(Atreides, AtreidesInfantryTypes) + Produce(Atreides, AtreidesVehicleTypes) + Produce(Atreides, AtreidesTankTypes) + Produce(Atreides, AtreidesStarportTypes) - Produce(harkonnen, HarkonnenInfantryTypes) - Produce(harkonnen, HarkonnenVehicleTypes) - Produce(harkonnen, HarkonnenTankTypes) - Produce(harkonnen, HarkonnenStarportTypes) + Produce(Harkonnen, HarkonnenInfantryTypes) + Produce(Harkonnen, HarkonnenVehicleTypes) + Produce(Harkonnen, HarkonnenTankTypes) + Produce(Harkonnen, HarkonnenStarportTypes) - Produce(ordos, OrdosInfantryTypes) - Produce(ordos, OrdosVehicleTypes) - Produce(ordos, OrdosTankTypes) - Produce(ordos, OrdosStarportTypes) + Produce(Ordos, OrdosInfantryTypes) + Produce(Ordos, OrdosVehicleTypes) + Produce(Ordos, OrdosTankTypes) + Produce(Ordos, OrdosStarportTypes) - Produce(corrino, CorrinoInfantryTypes) - Produce(corrino, CorrinoVehicleTypes) - Produce(corrino, CorrinoTankTypes) - Produce(corrino, CorrinoStarportTypes) + Produce(Corrino, CorrinoInfantryTypes) + Produce(Corrino, CorrinoVehicleTypes) + Produce(Corrino, CorrinoTankTypes) + Produce(Corrino, CorrinoStarportTypes) end) end diff --git a/mods/ra/maps/allies-01/allies01.lua b/mods/ra/maps/allies-01/allies01.lua index 704c44b745..54b288fcc2 100644 --- a/mods/ra/maps/allies-01/allies01.lua +++ b/mods/ra/maps/allies-01/allies01.lua @@ -80,7 +80,7 @@ LabGuardsKilled = function() Media.PlaySoundNotification(Greece, "AlertBuzzer") end) end - Utils.Do(sovietArmy, function(a) + Utils.Do(SovietArmy, function(a) if not a.IsDead and a.HasProperty("Hunt") then Trigger.OnIdle(a, a.Hunt) end @@ -89,18 +89,18 @@ LabGuardsKilled = function() end SendExtractionHelicopter = function() - heli = Reinforcements.ReinforceWithTransport(Greece, ExtractionHelicopterType, nil, ExtractionPath)[1] - if not einstein.IsDead then - Trigger.OnRemovedFromWorld(einstein, EvacuateHelicopter) + Heli = Reinforcements.ReinforceWithTransport(Greece, ExtractionHelicopterType, nil, ExtractionPath)[1] + if not Einstein.IsDead then + Trigger.OnRemovedFromWorld(Einstein, EvacuateHelicopter) end - Trigger.OnKilled(heli, RescueFailed) - Trigger.OnRemovedFromWorld(heli, HelicopterGone) + Trigger.OnKilled(Heli, RescueFailed) + Trigger.OnRemovedFromWorld(Heli, HelicopterGone) end EvacuateHelicopter = function() - if heli.HasPassengers then - heli.Move(ExtractionExitPoint.Location) - heli.Destroy() + if Heli.HasPassengers then + Heli.Move(ExtractionExitPoint.Location) + Heli.Destroy() end end @@ -114,7 +114,7 @@ SendCruisers = function() end LabDestroyed = function() - if not einstein then + if not Einstein then RescueFailed() end end @@ -136,7 +136,7 @@ end CiviliansKilled = function() Greece.MarkFailedObjective(CivilProtectionObjective) Media.PlaySpeechNotification(Greece, "ObjectiveNotMet") - collateralDamage = true + CollateralDamage = true end LostMate = function() @@ -148,15 +148,15 @@ end CreateEinstein = function() Greece.MarkCompletedObjective(FindEinsteinObjective) Media.PlaySpeechNotification(Greece, "ObjectiveMet") - einstein = Actor.Create(EinsteinType, true, { Location = EinsteinSpawnPoint.Location, Owner = Greece }) - einstein.Scatter() - Trigger.OnKilled(einstein, RescueFailed) + Einstein = Actor.Create(EinsteinType, true, { Location = EinsteinSpawnPoint.Location, Owner = Greece }) + Einstein.Scatter() + Trigger.OnKilled(Einstein, RescueFailed) ExtractObjective = AddPrimaryObjective(Greece, "extract-einstein-helicopter") Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(Greece, "TargetFreed") end) end HelicopterGone = function() - if not heli.IsDead then + if not Heli.IsDead then Media.PlaySpeechNotification(Greece, "TargetRescued") Trigger.AfterDelay(DateTime.Seconds(1), function() Greece.MarkCompletedObjective(ExtractObjective) @@ -164,7 +164,7 @@ HelicopterGone = function() if not Greece.IsObjectiveFailed(TanyaSurviveObjective) then Greece.MarkCompletedObjective(TanyaSurviveObjective) end - if not collateralDamage then + if not CollateralDamage then Greece.MarkCompletedObjective(CivilProtectionObjective) end end) @@ -200,12 +200,12 @@ WorldLoaded = function() Trigger.OnKilled(Lab, LabDestroyed) Trigger.OnKilled(OilPump, OilPumpDestroyed) - sovietArmy = USSR.GetGroundAttackers() + SovietArmy = USSR.GetGroundAttackers() Trigger.OnAllKilled(LabGuardsTeam, LabGuardsKilled) - collateralDamage = false - civilianTeam = { Civilian1, Civilian2 } + CollateralDamage = false + local civilianTeam = { Civilian1, Civilian2 } Trigger.OnAnyKilled(civilianTeam, CiviliansKilled) Trigger.OnKilled(Civilian1, LostMate) diff --git a/mods/ra/maps/allies-02/allies02.lua b/mods/ra/maps/allies-02/allies02.lua index adeef35b1d..d9860170f8 100644 --- a/mods/ra/maps/allies-02/allies02.lua +++ b/mods/ra/maps/allies-02/allies02.lua @@ -50,8 +50,8 @@ else end SendJeepReinforcements = function() - Media.PlaySpeechNotification(player, "ReinforcementsArrived") - Reinforcements.Reinforce(player, JeepReinforcements, JeepPath, DateTime.Seconds(1)) + Media.PlaySpeechNotification(Greece, "ReinforcementsArrived") + Reinforcements.Reinforce(Greece, JeepReinforcements, JeepPath, DateTime.Seconds(1)) end RunInitialActivities = function() @@ -59,12 +59,12 @@ RunInitialActivities = function() Trigger.OnKilled(Harvester, function() HarvesterKilled = true end) Trigger.OnAllKilled(PathGuards, function() - player.MarkCompletedObjective(SecureObjective) + Greece.MarkCompletedObjective(SecureObjective) SendTrucks() end) Trigger.OnAllKilled(SovietBase, function() - Utils.Do(ussr.GetGroundAttackers(), function(unit) + Utils.Do(USSR.GetGroundAttackers(), function(unit) if not Utils.Any(PathGuards, function(pg) return pg == unit end) then Trigger.OnIdle(unit, unit.Hunt) end @@ -72,15 +72,15 @@ RunInitialActivities = function() end) if InfantryTypes then - Trigger.AfterDelay(InfantryDelay, InfantryProduction) + Trigger.AfterDelay(InfantryDelay, ProduceInfantry) end if VehicleTypes then - Trigger.AfterDelay(VehicleDelay, VehicleProduction) + Trigger.AfterDelay(VehicleDelay, ProduceVehicles) end end -InfantryProduction = function() +ProduceInfantry = function() if SovietBarracks.IsDead then return end @@ -88,12 +88,12 @@ InfantryProduction = function() local toBuild = { Utils.Random(InfantryTypes) } if SovietKennel.IsDead and toBuild == "dog" then - toBuild = "e1" + toBuild = { "e1" } end - ussr.Build(toBuild, function(unit) + USSR.Build(toBuild, function(unit) IdlingUnits[#IdlingUnits + 1] = unit[1] - Trigger.AfterDelay(InfantryDelay, InfantryProduction) + Trigger.AfterDelay(InfantryDelay, ProduceInfantry) if #IdlingUnits >= (AttackGroupSize * 1.5) then SendAttack() @@ -101,26 +101,26 @@ InfantryProduction = function() end) end -VehicleProduction = function() +ProduceVehicles = function() if SovietWarfactory.IsDead then return end if HarvesterKilled then - ussr.Build({ "harv" }, function(harv) + USSR.Build({ "harv" }, function(harv) harv[1].FindResources() Trigger.OnKilled(harv[1], function() HarvesterKilled = true end) HarvesterKilled = false - VehicleProduction() + ProduceVehicles() end) return end local toBuild = { Utils.Random(VehicleTypes) } - ussr.Build(toBuild, function(unit) + USSR.Build(toBuild, function(unit) IdlingUnits[#IdlingUnits + 1] = unit[1] - Trigger.AfterDelay(VehicleDelay, VehicleProduction) + Trigger.AfterDelay(VehicleDelay, ProduceVehicles) if #IdlingUnits >= (AttackGroupSize * 1.5) then SendAttack() @@ -149,14 +149,14 @@ SendAttack = function() end Tick = function() - ussr.Resources = ussr.Resources - (0.01 * ussr.ResourceCapacity / 25) + USSR.Resources = USSR.Resources - (0.01 * USSR.ResourceCapacity / 25) - if ussr.HasNoRequiredUnits() then - player.MarkCompletedObjective(ConquestObjective) + if USSR.HasNoRequiredUnits() then + Greece.MarkCompletedObjective(ConquestObjective) end - if player.HasNoRequiredUnits() then - ussr.MarkCompletedObjective(ussrObj) + if Greece.HasNoRequiredUnits() then + USSR.MarkCompletedObjective(USSRobjective) end end @@ -182,22 +182,22 @@ SendTrucks = function() DateTime.TimeLimit = 0 UserInterface.SetMissionText("") - ConvoyObjective = AddPrimaryObjective(player, "escort-convoy") + ConvoyObjective = AddPrimaryObjective(Greece, "escort-convoy") - Media.PlaySpeechNotification(player, "ConvoyApproaching") + Media.PlaySpeechNotification(Greece, "ConvoyApproaching") Trigger.AfterDelay(DateTime.Seconds(3), function() ConvoyUnharmed = true - local trucks = Reinforcements.Reinforce(england, TruckReinforcements, TruckPath, DateTime.Seconds(1), + local trucks = Reinforcements.Reinforce(England, TruckReinforcements, TruckPath, DateTime.Seconds(1), function(truck) Trigger.OnIdle(truck, function() truck.Move(TruckExitPoint.Location) end) end) - count = 0 + local count = 0 Trigger.OnEnteredFootprint( { TruckExitPoint.Location }, function(a, id) - if a.Owner == england then + if a.Owner == England then count = count + 1 a.Destroy() if count == 3 then - player.MarkCompletedObjective(ConvoyObjective) + Greece.MarkCompletedObjective(ConvoyObjective) Trigger.RemoveFootprintTrigger(id) end end @@ -208,30 +208,30 @@ SendTrucks = function() end ConvoyCasualites = function() - Media.PlaySpeechNotification(player, "ConvoyUnitLost") + Media.PlaySpeechNotification(Greece, "ConvoyUnitLost") if ConvoyUnharmed then ConvoyUnharmed = false - Trigger.AfterDelay(DateTime.Seconds(1), function() player.MarkFailedObjective(ConvoyObjective) end) + Trigger.AfterDelay(DateTime.Seconds(1), function() Greece.MarkFailedObjective(ConvoyObjective) end) end end WorldLoaded = function() - player = Player.GetPlayer("Greece") - england = Player.GetPlayer("England") - ussr = Player.GetPlayer("USSR") + Greece = Player.GetPlayer("Greece") + England = Player.GetPlayer("England") + USSR = Player.GetPlayer("USSR") - InitObjectives(player) + InitObjectives(Greece) - ussrObj = AddPrimaryObjective(ussr, "") + USSRobjective = AddPrimaryObjective(USSR, "") - SecureObjective = AddPrimaryObjective(player, "secure-convoy") - ConquestObjective = AddPrimaryObjective(player, "eliminate-soviets") + SecureObjective = AddPrimaryObjective(Greece, "secure-convoy") + ConquestObjective = AddPrimaryObjective(Greece, "eliminate-soviets") - Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(allies, "MissionTimerInitialised") end) + Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(Allies, "MissionTimerInitialised") end) RunInitialActivities() - Reinforcements.Reinforce(player, ConstructionVehicleReinforcements, ConstructionVehiclePath) + Reinforcements.Reinforce(Greece, ConstructionVehicleReinforcements, ConstructionVehiclePath) Trigger.AfterDelay(DateTime.Seconds(5), SendJeepReinforcements) Trigger.AfterDelay(DateTime.Seconds(10), SendJeepReinforcements) @@ -241,5 +241,5 @@ WorldLoaded = function() end) Camera.Position = ReinforcementsEntryPoint.CenterPosition - TimerColor = player.Color + TimerColor = Greece.Color end diff --git a/mods/ra/maps/allies-03a/allies03a.lua b/mods/ra/maps/allies-03a/allies03a.lua index 9db90d8f16..e48fe0c4ec 100644 --- a/mods/ra/maps/allies-03a/allies03a.lua +++ b/mods/ra/maps/allies-03a/allies03a.lua @@ -24,7 +24,7 @@ else end ProduceUnits = function(factory, count) - if ussr.IsProducing("e1") then + if USSR.IsProducing("e1") then Trigger.AfterDelay(DateTime.Seconds(5), function() ProduceUnits(factory, count) end) return end @@ -37,7 +37,7 @@ ProduceUnits = function(factory, count) if not factory.IsDead then factory.IsPrimaryBuilding = true - ussr.Build(units, function(soldiers) + USSR.Build(units, function(soldiers) Utils.Do(soldiers, function(unit) IdleHunt(unit) end) end) end @@ -46,8 +46,8 @@ end SendAlliedUnits = function() Camera.Position = TanyaWaypoint.CenterPosition - local Artillery = Actor.Create("arty", true, { Owner = player, Location = AlliedUnitsEntry.Location }) - local Tanya = Actor.Create(TanyaType, true, { Owner = player, Location = AlliedUnitsEntry.Location }) + local Artillery = Actor.Create("arty", true, { Owner = Greece, Location = AlliedUnitsEntry.Location }) + local Tanya = Actor.Create(TanyaType, true, { Owner = Greece, Location = AlliedUnitsEntry.Location }) if TanyaType == "e7.noautotarget" then Trigger.AfterDelay(DateTime.Seconds(2), function() @@ -59,11 +59,11 @@ SendAlliedUnits = function() Tanya.Move(TanyaWaypoint.Location) Artillery.Move(ArtilleryWaypoint.Location) - Trigger.OnKilled(Tanya, function() player.MarkFailedObjective(TanyaSurvive) end) + Trigger.OnKilled(Tanya, function() Greece.MarkFailedObjective(TanyaSurvive) end) end SendUSSRParadrops = function() - local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) + local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR }) local aircraftA = powerproxy.TargetParatroopers(ParadropLZ.CenterPosition, Angle.SouthEast) Utils.Do(aircraftA, function(a) @@ -83,13 +83,13 @@ SendUSSRParadrops = function() end SendUSSRWaterTransport = function() - local units = Reinforcements.ReinforceWithTransport(ussr, "lst", TransportReinforcements, { WaterTransportEntry.Location, WaterTransportLoadout.Location }, { WaterTransportExit.Location })[2] + local units = Reinforcements.ReinforceWithTransport(USSR, "lst", TransportReinforcements, { WaterTransportEntry.Location, WaterTransportLoadout.Location }, { WaterTransportExit.Location })[2] Utils.Do(units, function(unit) IdleHunt(unit) end) end SendUSSRTankReinforcements = function() - local camera = Actor.Create("camera", true, { Owner = player, Location = USSRReinforcementsCameraWaypoint.Location }) - local ussrTank = Reinforcements.Reinforce(ussr, { "3tnk" }, { USSRReinforcementsEntryWaypoint.Location, USSRReinforcementsRallyWaypoint1.Location, USSRReinforcementsRallyWaypoint2.Location })[1] + local camera = Actor.Create("camera", true, { Owner = Greece, Location = USSRReinforcementsCameraWaypoint.Location }) + local ussrTank = Reinforcements.Reinforce(USSR, { "3tnk" }, { USSRReinforcementsEntryWaypoint.Location, USSRReinforcementsRallyWaypoint1.Location, USSRReinforcementsRallyWaypoint2.Location })[1] Trigger.OnRemovedFromWorld(ussrTank, function() Trigger.AfterDelay(DateTime.Seconds(3), function() if not camera.IsDead then @@ -100,28 +100,28 @@ SendUSSRTankReinforcements = function() end InitPlayers = function() - player = Player.GetPlayer("Greece") - ussr = Player.GetPlayer("USSR") + Greece = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") - ussr.Cash = 10000 + USSR.Cash = 10000 end AddObjectives = function() - KillBridges = AddPrimaryObjective(player, "destroy-bridges") - TanyaSurvive = AddPrimaryObjective(player, "tanya-survive") - KillUSSR = AddSecondaryObjective(player, "destroy-oilpumps") - FreePrisoners = AddSecondaryObjective(player, "free-prisoners") + KillBridges = AddPrimaryObjective(Greece, "destroy-bridges") + TanyaSurvive = AddPrimaryObjective(Greece, "tanya-survive") + KillUSSR = AddSecondaryObjective(Greece, "destroy-oilpumps") + FreePrisoners = AddSecondaryObjective(Greece, "free-prisoners") end InitTriggers = function() - Utils.Do(ussr.GetGroundAttackers(), function(unit) + Utils.Do(USSR.GetGroundAttackers(), function(unit) Trigger.OnDamaged(unit, function() IdleHunt(unit) end) end) - Trigger.OnAnyKilled(Prisoners, function() player.MarkFailedObjective(FreePrisoners) end) + Trigger.OnAnyKilled(Prisoners, function() Greece.MarkFailedObjective(FreePrisoners) end) Trigger.OnKilled(USSRTechCenter, function() - Actor.Create("moneycrate", true, { Owner = ussr, Location = USSRMoneyCrateSpawn.Location }) + Actor.Create("moneycrate", true, { Owner = USSR, Location = USSRMoneyCrateSpawn.Location }) end) Trigger.OnKilled(ExplosiveBarrel, function() @@ -135,9 +135,9 @@ InitTriggers = function() end) local baseTrigger = Trigger.OnEnteredFootprint(CameraTriggerArea, function(a, id) - if a.Owner == player and not baseCamera then + if a.Owner == Greece and not BaseCamera then Trigger.RemoveFootprintTrigger(id) - baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location }) + BaseCamera = Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraWaypoint.Location }) end end) @@ -145,8 +145,8 @@ InitTriggers = function() Trigger.OnDamaged(unit, function() if not FirstBaseAlert then FirstBaseAlert = true - if not baseCamera then - baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location }) + if not BaseCamera then + BaseCamera = Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraWaypoint.Location }) Trigger.RemoveFootprintTrigger(baseTrigger) end Utils.Do(FirstUSSRBase, function(unit) @@ -156,7 +156,7 @@ InitTriggers = function() end) for i = 0, 2 do Trigger.AfterDelay(DateTime.Seconds(i), function() - Media.PlaySoundNotification(player, "AlertBuzzer") + Media.PlaySoundNotification(Greece, "AlertBuzzer") end) end ProduceUnits(ProductionBuildings[1], Utils.RandomInteger(4, 8)) @@ -164,8 +164,8 @@ InitTriggers = function() end) end) Trigger.OnAllKilledOrCaptured(FirstUSSRBase, function() - if baseCamera and baseCamera.IsInWorld then - baseCamera.Destroy() + if BaseCamera and BaseCamera.IsInWorld then + BaseCamera.Destroy() end end) @@ -180,7 +180,7 @@ InitTriggers = function() end) for i = 0, 2 do Trigger.AfterDelay(DateTime.Seconds(i), function() - Media.PlaySoundNotification(player, "AlertBuzzer") + Media.PlaySoundNotification(Greece, "AlertBuzzer") end) end ProduceUnits(ProductionBuildings[2], Utils.RandomInteger(5, 7)) @@ -189,7 +189,7 @@ InitTriggers = function() end) Trigger.OnCapture(USSRRadarDome, function(self) - largeCamera = Actor.Create("camera.verylarge", true, { Owner = player, Location = LargeCameraWaypoint.Location }) + local largeCamera = Actor.Create("camera.verylarge", true, { Owner = Greece, Location = LargeCameraWaypoint.Location }) Trigger.ClearAll(self) Trigger.AfterDelay(DateTime.Seconds(1), function() Trigger.OnRemovedFromWorld(self, function() @@ -200,22 +200,22 @@ InitTriggers = function() end) Trigger.OnEnteredFootprint(WaterTransportTriggerArea, function(a, id) - if a.Owner == player and not waterTransportTriggered then - waterTransportTriggered = true + if a.Owner == Greece and not WaterTransportTriggered then + WaterTransportTriggered = true Trigger.RemoveFootprintTrigger(id) SendUSSRWaterTransport() end end) Trigger.OnEnteredFootprint(ParadropTriggerArea, function(a, id) - if a.Owner == player and not paradropsTriggered then - paradropsTriggered = true + if a.Owner == Greece and not ParadropsTriggered then + ParadropsTriggered = true Trigger.RemoveFootprintTrigger(id) SendUSSRParadrops() end end) Trigger.OnEnteredFootprint(ReinforcementsTriggerArea, function(a, id) - if a.Owner == player and not reinforcementsTriggered then - reinforcementsTriggered = true + if a.Owner == Greece and not ReinforcementsTriggered then + ReinforcementsTriggered = true Trigger.RemoveFootprintTrigger(id) Trigger.AfterDelay(DateTime.Seconds(1), function() SendUSSRTankReinforcements() end) end @@ -225,19 +225,19 @@ InitTriggers = function() local bridges = Utils.Where(Map.ActorsInWorld, function(actor) return actor.Type == "bridge1" end) Trigger.OnAllKilled(bridges, function() - player.MarkCompletedObjective(KillBridges) - player.MarkCompletedObjective(TanyaSurvive) + Greece.MarkCompletedObjective(KillBridges) + Greece.MarkCompletedObjective(TanyaSurvive) -- The prisoners are free once their guards are dead if PGuard1.IsDead and PGuard2.IsDead then - player.MarkCompletedObjective(FreePrisoners) + Greece.MarkCompletedObjective(FreePrisoners) end end) - local oilPumps = ussr.GetActorsByType("v19") + local oilPumps = USSR.GetActorsByType("v19") Trigger.OnAllKilled(oilPumps, function() - player.MarkCompletedObjective(KillUSSR) + Greece.MarkCompletedObjective(KillUSSR) end) end) @@ -253,7 +253,7 @@ WorldLoaded = function() InitPlayers() - InitObjectives(player) + InitObjectives(Greece) AddObjectives() InitTriggers() SendAlliedUnits() diff --git a/mods/ra/maps/allies-03b/allies03b.lua b/mods/ra/maps/allies-03b/allies03b.lua index 51fbb21ace..2a99d4ad86 100644 --- a/mods/ra/maps/allies-03b/allies03b.lua +++ b/mods/ra/maps/allies-03b/allies03b.lua @@ -41,7 +41,7 @@ Tick = function() end ProduceUnits = function(factory, count) - if ussr.IsProducing("e1") then + if USSR.IsProducing("e1") then Trigger.AfterDelay(DateTime.Seconds(5), function() ProduceUnits(factory, count) end) return end @@ -53,14 +53,14 @@ ProduceUnits = function(factory, count) if not factory.IsDead then factory.IsPrimaryBuilding = true - ussr.Build(units, function(soldiers) + USSR.Build(units, function(soldiers) Utils.Do(soldiers, function(unit) IdleHunt(unit) end) end) end end SetupAlliedUnits = function() - Tanya = Actor.Create(TanyaType, true, { Owner = player, Location = TanyaWaypoint.Location, Facing = Angle.South }) + Tanya = Actor.Create(TanyaType, true, { Owner = Greece, Location = TanyaWaypoint.Location, Facing = Angle.South }) if TanyaType == "e7.noautotarget" then Trigger.AfterDelay(DateTime.Seconds(2), function() @@ -74,18 +74,18 @@ SetupAlliedUnits = function() InsertionHeli.Move(InsertionHeliExit.Location) InsertionHeli.Destroy() - Trigger.OnKilled(Tanya, function() player.MarkFailedObjective(TanyaSurvive) end) + Trigger.OnKilled(Tanya, function() Greece.MarkFailedObjective(TanyaSurvive) end) end SetupTopRightIsland = function() - player.MarkCompletedObjective(FindAllies) - Media.PlaySpeechNotification(player, "AlliedReinforcementsArrived") - Reinforcements.Reinforce(player, AlliedIslandReinforcements, { AlliedIslandReinforcementsEntry.Location, IslandParadropReinforcementsDropzone.Location }) + Greece.MarkCompletedObjective(FindAllies) + Media.PlaySpeechNotification(Greece, "AlliedReinforcementsArrived") + Reinforcements.Reinforce(Greece, AlliedIslandReinforcements, { AlliedIslandReinforcementsEntry.Location, IslandParadropReinforcementsDropzone.Location }) SendUSSRParadrops(Angle.New(720), IslandParadropReinforcementsDropzone) end SendUSSRParadrops = function(facing, dropzone) - local paraproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) + local paraproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR }) local aircraft = paraproxy.TargetParatroopers(dropzone.CenterPosition, facing) Utils.Do(aircraft, function(a) @@ -98,8 +98,8 @@ SendUSSRParadrops = function(facing, dropzone) end SendUSSRTankReinforcements = function() - local camera = Actor.Create("camera", true, { Owner = player, Location = USSRReinforcementsCameraWaypoint.Location }) - local ussrTanks = Reinforcements.Reinforce(ussr, USSRTankReinforcements, USSRTankReinforcementsWaypoints) + local camera = Actor.Create("camera", true, { Owner = Greece, Location = USSRReinforcementsCameraWaypoint.Location }) + local ussrTanks = Reinforcements.Reinforce(USSR, USSRTankReinforcements, USSRTankReinforcementsWaypoints) Trigger.OnAllRemovedFromWorld(ussrTanks, function() Trigger.AfterDelay(DateTime.Seconds(3), function() if not camera.IsDead then @@ -110,7 +110,7 @@ SendUSSRTankReinforcements = function() end JeepCheckpointMove = function() - JeepCamera = Actor.Create("camera.jeep", true, { Owner = player }) + JeepCamera = Actor.Create("camera.jeep", true, { Owner = Greece }) TeleportJeepCamera = true Trigger.OnIdle(Jeep, function() @@ -129,7 +129,7 @@ end JeepSuicideMove = function() if not JeepCamera then - JeepCamera = Actor.Create("camera.jeep", true, { Owner = player }) + JeepCamera = Actor.Create("camera.jeep", true, { Owner = Greece }) TeleportJeepCamera = true end @@ -156,7 +156,7 @@ AlertFirstBase = function() end) for i = 0, 2 do Trigger.AfterDelay(DateTime.Seconds(i), function() - Media.PlaySoundNotification(player, "AlertBuzzer") + Media.PlaySoundNotification(Greece, "AlertBuzzer") end) end ProduceUnits(ProductionBuildings[1], Utils.RandomInteger(4, 8)) @@ -164,42 +164,42 @@ AlertFirstBase = function() end InitPlayers = function() - player = Player.GetPlayer("Greece") - ussr = Player.GetPlayer("USSR") + Greece = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") - ussr.Cash = 10000 + USSR.Cash = 10000 end AddObjectives = function() - InitObjectives(player) + InitObjectives(Greece) - KillBridges = AddPrimaryObjective(player, "destroy-bridges") - TanyaSurvive = AddPrimaryObjective(player, "tanya-survive") - FindAllies = AddSecondaryObjective(player, "find-lost-tanks") - FreePrisoners = AddSecondaryObjective(player, "free-prisoners") + KillBridges = AddPrimaryObjective(Greece, "destroy-bridges") + TanyaSurvive = AddPrimaryObjective(Greece, "tanya-survive") + FindAllies = AddSecondaryObjective(Greece, "find-lost-tanks") + FreePrisoners = AddSecondaryObjective(Greece, "free-prisoners") end InitTriggers = function() - Utils.Do(ussr.GetGroundAttackers(), function(unit) + Utils.Do(USSR.GetGroundAttackers(), function(unit) Trigger.OnDamaged(unit, function() IdleHunt(unit) end) end) - Trigger.OnAnyKilled(Prisoners, function() player.MarkFailedObjective(FreePrisoners) end) - Trigger.OnKilled(PrisonedMedi, function() player.MarkFailedObjective(FreePrisoners) end) + Trigger.OnAnyKilled(Prisoners, function() Greece.MarkFailedObjective(FreePrisoners) end) + Trigger.OnKilled(PrisonedMedi, function() Greece.MarkFailedObjective(FreePrisoners) end) Trigger.OnKilled(MediHideaway, function() if not MediFreed then MediFreed = true - player.MarkFailedObjective(FreePrisoners) + Greece.MarkFailedObjective(FreePrisoners) end end) Trigger.OnKilled(ExplosiveBarrel, function() - if reinforcementsTriggered then + if ReinforcementsTriggered then return end if not ExplodingBridge.IsDead then ExplodingBridge.Kill() end - reinforcementsTriggered = true + ReinforcementsTriggered = true Trigger.AfterDelay(DateTime.Seconds(1), SendUSSRTankReinforcements) end) @@ -215,19 +215,19 @@ InitTriggers = function() if not tank.IsDead then tank.Kill() end end) - jeepTriggered = true + JeepTriggered = true JeepSuicideMove() end) Utils.Do(FirstUSSRBase, function(unit) Trigger.OnDamaged(unit, function() - if not baseCamera then baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location }) end + if not BaseCamera then BaseCamera = Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraWaypoint.Location }) end AlertFirstBase() end) end) Trigger.OnAllKilledOrCaptured(FirstUSSRBase, function() - if baseCamera and baseCamera.IsInWorld then - baseCamera.Destroy() + if BaseCamera and BaseCamera.IsInWorld then + BaseCamera.Destroy() end end) @@ -239,19 +239,19 @@ InitTriggers = function() end) Trigger.OnCapture(USSRRadarDome, function() - largeCameraA = Actor.Create("camera.verylarge", true, { Owner = player, Location = LargeCameraWaypoint1.Location }) - largeCameraB = Actor.Create("camera.verylarge", true, { Owner = player, Location = LargeCameraWaypoint2.Location }) - largeCameraC = Actor.Create("camera.verylarge", true, { Owner = player, Location = LargeCameraWaypoint3.Location }) + LargeCameraA = Actor.Create("camera.verylarge", true, { Owner = Greece, Location = LargeCameraWaypoint1.Location }) + LargeCameraB = Actor.Create("camera.verylarge", true, { Owner = Greece, Location = LargeCameraWaypoint2.Location }) + LargeCameraC = Actor.Create("camera.verylarge", true, { Owner = Greece, Location = LargeCameraWaypoint3.Location }) end) Trigger.OnRemovedFromWorld(USSRRadarDome, function() - if largeCameraA and largeCameraA.IsInWorld then largeCameraA.Destroy() end - if largeCameraB and largeCameraB.IsInWorld then largeCameraB.Destroy() end - if largeCameraC and largeCameraC.IsInWorld then largeCameraC.Destroy() end + if LargeCameraA and LargeCameraA.IsInWorld then LargeCameraA.Destroy() end + if LargeCameraB and LargeCameraB.IsInWorld then LargeCameraB.Destroy() end + if LargeCameraC and LargeCameraC.IsInWorld then LargeCameraC.Destroy() end end) Trigger.OnEnteredFootprint(TrukTriggerArea, function(a, id) - if a.Owner == player and not trukTriggered then - trukTriggered = true + if a.Owner == Greece and not TrukTriggered then + TrukTriggered = true Trigger.RemoveFootprintTrigger(id) if USSRTruk.IsDead then @@ -262,7 +262,7 @@ InitTriggers = function() if USSRTruk.Location == BaseCameraWaypoint.Location then Trigger.ClearAll(USSRTruk) - local driver = Actor.Create("e1", true, { Owner = ussr, Location = USSRTruk.Location }) + local driver = Actor.Create("e1", true, { Owner = USSR, Location = USSRTruk.Location }) if not PGuard5.IsDead then driver.AttackMove(PGuard5.Location) else @@ -276,57 +276,57 @@ InitTriggers = function() end end) Trigger.OnEnteredProximityTrigger(BaseCameraWaypoint.CenterPosition, WDist.New(7 * 1024), function(a, id) - if a.Type == "truk" and not baseCamera then + if a.Type == "truk" and not BaseCamera then Trigger.RemoveProximityTrigger(id) - baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location }) + BaseCamera = Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraWaypoint.Location }) end end) end end) Trigger.OnEnteredFootprint(FreeMediTriggerArea, function(a, id) - if a.Owner == player and not MediFreed then + if a.Owner == Greece and not MediFreed then MediFreed = true Trigger.RemoveFootprintTrigger(id) - Reinforcements.Reinforce(player, { "medi" }, { MediSpawnpoint.Location, MediRallypoint.Location }) + Reinforcements.Reinforce(Greece, { "medi" }, { MediSpawnpoint.Location, MediRallypoint.Location }) end end) Trigger.OnEnteredFootprint(CameraTriggerArea, function(a, id) - if a.Owner == player and not baseCamera then + if a.Owner == Greece and not BaseCamera then Trigger.RemoveFootprintTrigger(id) - baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location }) + BaseCamera = Actor.Create("camera", true, { Owner = Greece, Location = BaseCameraWaypoint.Location }) end end) Trigger.OnEnteredFootprint(BeachTriggerArea, function(a, id) - if a.Owner == player and not beachTransportTriggered then - beachTransportTriggered = true + if a.Owner == Greece and not BeachTransportTriggered then + BeachTransportTriggered = true Trigger.RemoveFootprintTrigger(id) SetupTopRightIsland() end end) Trigger.OnEnteredFootprint(ParadropTriggerArea, function(a, id) - if a.Owner == player and a.Type ~= "jeep.mission" and not paradropsTriggered then - paradropsTriggered = true + if a.Owner == Greece and a.Type ~= "jeep.mission" and not ParadropsTriggered then + ParadropsTriggered = true Trigger.RemoveFootprintTrigger(id) SendUSSRParadrops(Angle.New(216), ParadropReinforcementsDropzone) end end) Trigger.OnEnteredFootprint(ReinforcementsTriggerArea, function(a, id) - if a.Owner == player and not reinforcementsTriggered then - reinforcementsTriggered = true + if a.Owner == Greece and not ReinforcementsTriggered then + ReinforcementsTriggered = true Trigger.RemoveFootprintTrigger(id) Trigger.AfterDelay(DateTime.Seconds(1), SendUSSRTankReinforcements) end end) Trigger.OnEnteredFootprint(Barracks3TriggerArea, function(a, id) - if a.Owner == player and not Barracks3Producing then + if a.Owner == Greece and not Barracks3Producing then Barracks3Producing = true Trigger.RemoveFootprintTrigger(id) ProduceUnits(ProductionBuildings[3], Utils.RandomInteger(2, 5)) end end) Trigger.OnEnteredFootprint(JeepTriggerArea, function(a, id) - if a.Owner == player and not jeepTriggered then - jeepTriggered = true + if a.Owner == Greece and not JeepTriggered then + JeepTriggered = true Trigger.RemoveFootprintTrigger(id) JeepCheckpointMove() end @@ -345,12 +345,12 @@ InitTriggers = function() ExplodingBridge = bridges[1] Trigger.OnAllKilled(bridges, function() - player.MarkCompletedObjective(KillBridges) - player.MarkCompletedObjective(TanyaSurvive) + Greece.MarkCompletedObjective(KillBridges) + Greece.MarkCompletedObjective(TanyaSurvive) -- The medic is freed once his guard is dead if MediFreed and MediGuard.IsDead and EngisFreed then - player.MarkCompletedObjective(FreePrisoners) + Greece.MarkCompletedObjective(FreePrisoners) end end) end) diff --git a/mods/ra/maps/allies-04/allies04-AI.lua b/mods/ra/maps/allies-04/allies04-AI.lua index 4390c8d3b4..8d807b18cf 100644 --- a/mods/ra/maps/allies-04/allies04-AI.lua +++ b/mods/ra/maps/allies-04/allies04-AI.lua @@ -59,9 +59,9 @@ BaseBuildings = { Powr1, Barr, Proc, Weap, Powr2, Powr3, Powr4, Ftur1, Ftur2, Ft InitialBase = { Barracks, Refinery, PowerPlant1, PowerPlant2, PowerPlant3, PowerPlant4, Warfactory, Flametur1, Flametur2, Flametur3, Airfield1, Airfield2 } BuildBase = function() - if Conyard.IsDead or Conyard.Owner ~= ussr then + if Conyard.IsDead or Conyard.Owner ~= USSR then return - elseif Harvester.IsDead and ussr.Resources <= 299 then + elseif Harvester.IsDead and USSR.Resources <= 299 then return end @@ -77,13 +77,13 @@ end BuildBuilding = function(building) Trigger.AfterDelay(Actor.BuildTime(building.name), function() - local actor = Actor.Create(building.name, true, { Owner = ussr, Location = building.pos }) - ussr.Cash = ussr.Cash - building.prize + local actor = Actor.Create(building.name, true, { Owner = USSR, Location = building.pos }) + USSR.Cash = USSR.Cash - building.prize building.exists = true Trigger.OnKilled(actor, function() building.exists = false end) Trigger.OnDamaged(actor, function(building) - if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then + if building.Owner == USSR and building.Health < building.MaxHealth * 3/4 then building.StartBuildingRepairs() DefendActor(actor) end @@ -163,13 +163,13 @@ DefendActor = function(unit) end InitAIUnits = function() - IdlingUnits = ussr.GetGroundAttackers() + IdlingUnits = USSR.GetGroundAttackers() DefendActor(Conyard) for i,v in ipairs(InitialBase) do DefendActor(v) Trigger.OnDamaged(v, function(building) - if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then + if building.Owner == USSR and building.Health < building.MaxHealth * 3/4 then building.StartBuildingRepairs() end end) @@ -189,7 +189,7 @@ ProduceInfantry = function() -- See AttackDelay in WorldLoaded local delay = Utils.RandomInteger(AttackDelay[1], AttackDelay[2]) local toBuild = { Utils.Random(SovietInfantryTypes) } - ussr.Build(toBuild, function(unit) + USSR.Build(toBuild, function(unit) IdlingUnits[#IdlingUnits + 1] = unit[1] Trigger.AfterDelay(delay, ProduceInfantry) @@ -209,14 +209,14 @@ ProduceVehicles = function() -- See AttackDelay in WorldLoaded local delay = Utils.RandomInteger(AttackDelay[1], AttackDelay[2]) if HarvesterKilled then - ussr.Build({ "harv" }, function(harv) + USSR.Build({ "harv" }, function(harv) ProtectHarvester(harv[1]) HarvesterKilled = false Trigger.AfterDelay(delay, ProduceVehicles) end) else local toBuild = { Utils.Random(SovietVehicleTypes) } - ussr.Build(toBuild, function(unit) + USSR.Build(toBuild, function(unit) IdlingUnits[#IdlingUnits + 1] = unit[1] Trigger.AfterDelay(delay, ProduceVehicles) @@ -229,7 +229,7 @@ ProduceVehicles = function() end ProduceAircraft = function() - ussr.Build(SovietAircraftType, function(units) + USSR.Build(SovietAircraftType, function(units) local yak = units[1] Yaks[#Yaks + 1] = yak @@ -238,7 +238,7 @@ ProduceAircraft = function() Trigger.AfterDelay(DateTime.Minutes(1), ProduceAircraft) end - InitializeAttackAircraft(yak, player) + InitializeAttackAircraft(yak, Greece) end) end diff --git a/mods/ra/maps/allies-04/allies04.lua b/mods/ra/maps/allies-04/allies04.lua index ef9f9d8400..9478e4ceb3 100644 --- a/mods/ra/maps/allies-04/allies04.lua +++ b/mods/ra/maps/allies-04/allies04.lua @@ -59,7 +59,7 @@ Paradrop = function() Trigger.AfterDelay(Utils.RandomInteger(ParadropDelay[1], ParadropDelay[2]), function() local aircraft = PowerProxy.TargetParatroopers(Utils.Random(ParadropLZs)) Utils.Do(aircraft, function(a) - Trigger.OnPassengerExited(a, function(t, p) + Trigger.OnPassengerExited(a, function(_, p) IdleHunt(p) end) end) @@ -75,7 +75,7 @@ ConvoysSent = 0 SendConvoys = function() Trigger.AfterDelay(Utils.RandomInteger(ConvoyDelay[1], ConvoyDelay[2]), function() local path = Utils.Random(ConvoyRallyPoints) - local units = Reinforcements.Reinforce(ussr, Utils.Random(ConvoyUnits), { path[1] }) + local units = Reinforcements.Reinforce(USSR, Utils.Random(ConvoyUnits), { path[1] }) local lastWaypoint = path[#path] Utils.Do(units, function(unit) @@ -98,14 +98,14 @@ SendConvoys = function() end) local id = Trigger.OnEnteredFootprint({ lastWaypoint }, function(a, id) - if a.Owner == ussr and Utils.Any(units, function(unit) return unit == a end) then + if a.Owner == USSR and Utils.Any(units, function(unit) return unit == a end) then -- We are at our destination and thus don't care about other queued actions anymore a.Stop() a.Destroy() if a.Type == "truk" then - player.MarkFailedObjective(DestroyConvoys) + Greece.MarkFailedObjective(DestroyConvoys) end end end) @@ -117,44 +117,44 @@ SendConvoys = function() if ConvoysSent <= Convoys[Difficulty] then SendConvoys() else - player.MarkCompletedObjective(DestroyConvoys) + Greece.MarkCompletedObjective(DestroyConvoys) end end) - Media.PlaySpeechNotification(player, "ConvoyApproaching") + Media.PlaySpeechNotification(Greece, "ConvoyApproaching") end) end Tick = function() - if player.HasNoRequiredUnits() then - player.MarkFailedObjective(KillUSSR) + if Greece.HasNoRequiredUnits() then + Greece.MarkFailedObjective(KillUSSR) end - if ussr.HasNoRequiredUnits() then - player.MarkCompletedObjective(KillUSSR) + if USSR.HasNoRequiredUnits() then + Greece.MarkCompletedObjective(KillUSSR) -- We don't care about future convoys anymore - player.MarkCompletedObjective(DestroyConvoys) + Greece.MarkCompletedObjective(DestroyConvoys) end end AddObjectives = function() - KillUSSR = AddPrimaryObjective(player, "destroy-soviet-units-buildings") - DestroyConvoys = AddSecondaryObjective(player, "destroy-convoys") + KillUSSR = AddPrimaryObjective(Greece, "destroy-soviet-units-buildings") + DestroyConvoys = AddSecondaryObjective(Greece, "destroy-convoys") end WorldLoaded = function() - player = Player.GetPlayer("Greece") - ussr = Player.GetPlayer("USSR") + Greece = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") Camera.Position = AlliedConyard.CenterPosition - InitObjectives(player) + InitObjectives(Greece) AddObjectives() ConvoyDelay = ConvoyDelays[Difficulty] ParadropDelay = ParadropDelays[Difficulty] - PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) + PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR }) Paradrop() SendConvoys() diff --git a/mods/ra/maps/allies-05a/allies05a-AI.lua b/mods/ra/maps/allies-05a/allies05a-AI.lua index 093e2ab494..fb4c21ae1e 100644 --- a/mods/ra/maps/allies-05a/allies05a-AI.lua +++ b/mods/ra/maps/allies-05a/allies05a-AI.lua @@ -84,7 +84,7 @@ WaterAttack = function() types[i] = Utils.Random(SovietInfantryTypes) end - return Reinforcements.ReinforceWithTransport(ussr, InsertionTransport, types, { WaterTransportSpawn.Location, Utils.Random(WaterLZs).Location }, { WaterTransportSpawn.Location })[2] + return Reinforcements.ReinforceWithTransport(USSR, InsertionTransport, types, { WaterTransportSpawn.Location, Utils.Random(WaterLZs).Location }, { WaterTransportSpawn.Location })[2] end ProtectHarvester = function(unit) @@ -111,12 +111,12 @@ ProtectHarvester = function(unit) end InitAIUnits = function() - IdlingUnits = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == ussr and self.HasProperty("Hunt") and self.Location.Y > MainBaseTopLeft.Location.Y end) + IdlingUnits = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == USSR and self.HasProperty("Hunt") and self.Location.Y > MainBaseTopLeft.Location.Y end) - local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == ussr and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == USSR and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) Trigger.OnDamaged(actor, function(building) - if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then + if building.Owner == USSR and building.Health < building.MaxHealth * 3/4 then building.StartBuildingRepairs() end end) @@ -124,7 +124,7 @@ InitAIUnits = function() end InitAIEconomy = function() - ussr.Cash = 6000 + USSR.Cash = 6000 if not Harvester.IsDead then Harvester.FindResources() @@ -200,7 +200,7 @@ ProduceInfantry = function() local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9)) local toBuild = { Utils.Random(SovietInfantryTypes) } - ussr.Build(toBuild, function(unit) + USSR.Build(toBuild, function(unit) IdlingUnits[#IdlingUnits + 1] = unit[1] Trigger.AfterDelay(delay, ProduceInfantry) @@ -223,7 +223,7 @@ ProduceVehicles = function() local delay = Utils.RandomInteger(DateTime.Seconds(5), DateTime.Seconds(9)) if HarvesterKilled then HarvesterKilled = false - ussr.Build({ "harv" }, function(harv) + USSR.Build({ "harv" }, function(harv) harv[1].FindResources() ProtectHarvester(harv[1]) Trigger.AfterDelay(delay, ProduceVehicles) @@ -233,7 +233,7 @@ ProduceVehicles = function() Warfactory2.RallyPoint = Utils.Random(Rallypoints).Location local toBuild = { Utils.Random(SovietVehicleTypes) } - ussr.Build(toBuild, function(unit) + USSR.Build(toBuild, function(unit) IdlingUnits[#IdlingUnits + 1] = unit[1] Trigger.AfterDelay(delay, ProduceVehicles) @@ -248,7 +248,7 @@ ProduceAircraft = function() return end - ussr.Build(SovietAircraftType, function(units) + USSR.Build(SovietAircraftType, function(units) local yak = units[1] Yaks[#Yaks + 1] = yak @@ -257,7 +257,7 @@ ProduceAircraft = function() Trigger.AfterDelay(DateTime.Minutes(1), ProduceAircraft) end - InitializeAttackAircraft(yak, greece) + InitializeAttackAircraft(yak, Greece) end) end diff --git a/mods/ra/maps/allies-05a/allies05a.lua b/mods/ra/maps/allies-05a/allies05a.lua index 1982e7b11b..5ea5d9152f 100644 --- a/mods/ra/maps/allies-05a/allies05a.lua +++ b/mods/ra/maps/allies-05a/allies05a.lua @@ -88,33 +88,33 @@ Tick = function() Camera.Position = Truk.CenterPosition end - if ussr.HasNoRequiredUnits() then - if not greece.IsObjectiveCompleted(KillAll) and Difficulty == "tough" then + if USSR.HasNoRequiredUnits() then + if not Greece.IsObjectiveCompleted(KillAll) and Difficulty == "tough" then SendWaterExtraction() end - greece.MarkCompletedObjective(KillAll) + Greece.MarkCompletedObjective(KillAll) end - if GreeceReinforcementsArrived and greece.HasNoRequiredUnits() then - ussr.MarkCompletedObjective(ussrObj) + if GreeceReinforcementsArrived and Greece.HasNoRequiredUnits() then + USSR.MarkCompletedObjective(USSRobjective) end - if ussr.Resources >= ussr.ResourceCapacity * 0.75 then - ussr.Cash = ussr.Cash + ussr.Resources - ussr.ResourceCapacity * 0.25 - ussr.Resources = ussr.ResourceCapacity * 0.25 + if USSR.Resources >= USSR.ResourceCapacity * 0.75 then + USSR.Cash = USSR.Cash + USSR.Resources - USSR.ResourceCapacity * 0.25 + USSR.Resources = USSR.ResourceCapacity * 0.25 end end SendReinforcements = function() GreeceReinforcementsArrived = true Camera.Position = ReinforceCamera.CenterPosition - greece.Cash = greece.Cash + ReinforceCash + Greece.Cash = Greece.Cash + ReinforceCash Utils.Do(GreeceReinforcements, function(reinforcements) - Reinforcements.ReinforceWithTransport(greece, InsertionTransport, reinforcements.types, reinforcements.entry, { SpyEntry.Location }) + Reinforcements.ReinforceWithTransport(Greece, InsertionTransport, reinforcements.types, reinforcements.entry, { SpyEntry.Location }) end) - Media.PlaySpeechNotification(greece, "AlliedReinforcementsArrived") + Media.PlaySpeechNotification(Greece, "AlliedReinforcementsArrived") ActivateAI() end @@ -131,19 +131,19 @@ ExtractUnits = function(extractionUnit, pos, after) end SendWaterExtraction = function() - local flare = Actor.Create("flare", true, { Owner = greece, Location = SpyEntryPath[2] + CVec.New(2, 0) }) + local flare = Actor.Create("flare", true, { Owner = Greece, Location = SpyEntryPath[2] + CVec.New(2, 0) }) Trigger.AfterDelay(DateTime.Seconds(5), flare.Destroy) - Media.PlaySpeechNotification(greece, "SignalFlareNorth") + Media.PlaySpeechNotification(Greece, "SignalFlareNorth") Camera.Position = flare.CenterPosition - WaterExtractionTran = Reinforcements.ReinforceWithTransport(greece, ExtractionTransport, nil, SpyEntryPath)[1] - ExtractObj = AddPrimaryObjective(greece, "extract-transport") + WaterExtractionTran = Reinforcements.ReinforceWithTransport(Greece, ExtractionTransport, nil, SpyEntryPath)[1] + ExtractObjective = AddPrimaryObjective(Greece, "extract-transport") - Trigger.OnKilled(WaterExtractionTran, function() ussr.MarkCompletedObjective(ussrObj) end) - Trigger.OnAllRemovedFromWorld(greece.GetGroundAttackers(), function() + Trigger.OnKilled(WaterExtractionTran, function() USSR.MarkCompletedObjective(USSRobjective) end) + Trigger.OnAllRemovedFromWorld(Greece.GetGroundAttackers(), function() ExtractUnits(WaterExtractionTran, SpyEntryPath[1], function() - greece.MarkCompletedObjective(ExtractObj) - greece.MarkCompletedObjective(surviveObj) + Greece.MarkCompletedObjective(ExtractObjective) + Greece.MarkCompletedObjective(TanyaSurviveObjective) end) end) end @@ -169,7 +169,7 @@ MissInfiltrated = function() for i = 0, 5, 1 do local sound = Utils.Random(TanyaVoices) Trigger.AfterDelay(DateTime.Seconds(i), function() - Media.PlaySoundNotification(greece, sound) + Media.PlaySoundNotification(Greece, sound) end) end Prison.Attack(Prison) @@ -179,7 +179,7 @@ end FreeTanya = function() Prison.Stop() - Tanya = Actor.Create(TanyaType, true, { Owner = greece, Location = Prison.Location + CVec.New(1, 1) }) + Tanya = Actor.Create(TanyaType, true, { Owner = Greece, Location = Prison.Location + CVec.New(1, 1) }) Tanya.Demolish(Prison) Tanya.Move(Tanya.Location + CVec.New(Utils.RandomInteger(-1, 2), 1)) @@ -189,18 +189,18 @@ FreeTanya = function() end) end - Trigger.OnKilled(Tanya, function() ussr.MarkCompletedObjective(ussrObj) end) + Trigger.OnKilled(Tanya, function() USSR.MarkCompletedObjective(USSRobjective) end) if Difficulty == "tough" then - KillSams = AddPrimaryObjective(greece, "destroy-sam-sites-blocker") + KillSams = AddPrimaryObjective(Greece, "destroy-sam-sites-blocker") - greece.MarkCompletedObjective(mainObj) - surviveObj = AddPrimaryObjective(greece, "tanya-survive") - Media.PlaySpeechNotification(greece, "TanyaRescued") + Greece.MarkCompletedObjective(RescueTanyaObjective) + TanyaSurviveObjective = AddPrimaryObjective(Greece, "tanya-survive") + Media.PlaySpeechNotification(Greece, "TanyaRescued") else - KillSams = AddPrimaryObjective(greece, "destroy-sam-sites-blocker") + KillSams = AddPrimaryObjective(Greece, "destroy-sam-sites-blocker") - Media.PlaySpeechNotification(greece, "TargetFreed") + Media.PlaySpeechNotification(Greece, "TargetFreed") end if not SpecialCameras and PrisonCamera and PrisonCamera.IsInWorld then @@ -210,13 +210,13 @@ end SendSpy = function() Camera.Position = SpyEntry.CenterPosition - Spy = Reinforcements.ReinforceWithTransport(greece, InsertionTransport, SpyType, SpyEntryPath, { SpyEntryPath[1] })[2][1] + Spy = Reinforcements.ReinforceWithTransport(Greece, InsertionTransport, SpyType, SpyEntryPath, { SpyEntryPath[1] })[2][1] - Trigger.OnKilled(Spy, function() ussr.MarkCompletedObjective(ussrObj) end) + Trigger.OnKilled(Spy, function() USSR.MarkCompletedObjective(USSRobjective) end) if SpecialCameras then - SpyCameraA = Actor.Create("camera", true, { Owner = greece, Location = SpyCamera1.Location }) - SpyCameraB = Actor.Create("camera", true, { Owner = greece, Location = SpyCamera2.Location }) + SpyCameraA = Actor.Create("camera", true, { Owner = Greece, Location = SpyCamera1.Location }) + SpyCameraB = Actor.Create("camera", true, { Owner = Greece, Location = SpyCamera2.Location }) end Trigger.AfterDelay(DateTime.Seconds(3), function() @@ -235,44 +235,44 @@ end InitTriggers = function() Trigger.OnInfiltrated(Warfactory, function() - if greece.IsObjectiveCompleted(infWarfactory) then + if Greece.IsObjectiveCompleted(InfiltrateWarfactoryObjective) then return elseif Truk.IsDead then - if not greece.IsObjectiveCompleted(mainObj) then - ussr.MarkCompletedObjective(ussrObj) + if not Greece.IsObjectiveCompleted(RescueTanyaObjective) then + USSR.MarkCompletedObjective(USSRobjective) end return end Trigger.ClearAll(Spy) - greece.MarkCompletedObjective(infWarfactory) + Greece.MarkCompletedObjective(InfiltrateWarfactoryObjective) WarfactoryInfiltrated() end) Trigger.OnKilled(Truk, function() - if not greece.IsObjectiveCompleted(infWarfactory) then - greece.MarkFailedObjective(infWarfactory) + if not Greece.IsObjectiveCompleted(InfiltrateWarfactoryObjective) then + Greece.MarkFailedObjective(InfiltrateWarfactoryObjective) elseif FollowTruk then - ussr.MarkCompletedObjective(ussrObj) + USSR.MarkCompletedObjective(USSRobjective) end end) Trigger.OnInfiltrated(Prison, function() - if greece.IsObjectiveCompleted(mainObj) then + if Greece.IsObjectiveCompleted(RescueTanyaObjective) then return end - if not greece.IsObjectiveCompleted(infWarfactory) then + if not Greece.IsObjectiveCompleted(InfiltrateWarfactoryObjective) then Media.DisplayMessage(UserInterface.Translate("skip-heroics"), UserInterface.Translate("battlefield-control")) - greece.MarkCompletedObjective(infWarfactory) + Greece.MarkCompletedObjective(InfiltrateWarfactoryObjective) end if not PrisonCamera then if SpecialCameras then - PrisonCamera = Actor.Create("camera", true, { Owner = greece, Location = TrukWaypoint5.Location }) + PrisonCamera = Actor.Create("camera", true, { Owner = Greece, Location = TrukWaypoint5.Location }) else - PrisonCamera = Actor.Create("camera.small", true, { Owner = greece, Location = Prison.Location + CVec.New(1, 1) }) + PrisonCamera = Actor.Create("camera.small", true, { Owner = Greece, Location = Prison.Location + CVec.New(1, 1) }) end end @@ -289,21 +289,21 @@ InitTriggers = function() if a == Truk then Trigger.RemoveFootprintTrigger(id) - Spy = Actor.Create("spy", true, { Owner = greece, Location = TrukWaypoint5.Location }) - Spy.DisguiseAsType("e1", ussr) + Spy = Actor.Create("spy", true, { Owner = Greece, Location = TrukWaypoint5.Location }) + Spy.DisguiseAsType("e1", USSR) Spy.Move(SpyWaypoint.Location) Spy.Infiltrate(Prison) - Media.PlaySoundNotification(greece, SpyVoice) + Media.PlaySoundNotification(Greece, SpyVoice) FollowTruk = false if SpecialCameras then - PrisonCamera = Actor.Create("camera", true, { Owner = greece, Location = TrukWaypoint5.Location }) + PrisonCamera = Actor.Create("camera", true, { Owner = Greece, Location = TrukWaypoint5.Location }) else - PrisonCamera = Actor.Create("camera.small", true, { Owner = greece, Location = Prison.Location + CVec.New(1, 1) }) + PrisonCamera = Actor.Create("camera.small", true, { Owner = Greece, Location = Prison.Location + CVec.New(1, 1) }) end - Trigger.OnKilled(Spy, function() ussr.MarkCompletedObjective(ussrObj) end) + Trigger.OnKilled(Spy, function() USSR.MarkCompletedObjective(USSRobjective) end) end end) @@ -336,28 +336,28 @@ InitTriggers = function() end) Trigger.OnAllKilled(SamSites, function() - greece.MarkCompletedObjective(KillSams) + Greece.MarkCompletedObjective(KillSams) - local flare = Actor.Create("flare", true, { Owner = greece, Location = ExtractionPath[2] + CVec.New(0, -1) }) + local flare = Actor.Create("flare", true, { Owner = Greece, Location = ExtractionPath[2] + CVec.New(0, -1) }) Trigger.AfterDelay(DateTime.Seconds(7), flare.Destroy) - Media.PlaySpeechNotification(greece, "SignalFlare") + Media.PlaySpeechNotification(Greece, "SignalFlare") if Difficulty == "tough" then - Reinforcements.ReinforceWithTransport(greece, InsertionHeliType, HeliReinforcements, ExtractionPath, { ExtractionPath[1] }) + Reinforcements.ReinforceWithTransport(Greece, InsertionHeliType, HeliReinforcements, ExtractionPath, { ExtractionPath[1] }) if not Harvester.IsDead then Harvester.FindResources() end else - ExtractionHeli = Reinforcements.ReinforceWithTransport(greece, ExtractionHeliType, nil, ExtractionPath)[1] + ExtractionHeli = Reinforcements.ReinforceWithTransport(Greece, ExtractionHeliType, nil, ExtractionPath)[1] local exitPos = CPos.New(ExtractionPath[1].X, ExtractionPath[2].Y) - Trigger.OnKilled(ExtractionHeli, function() ussr.MarkCompletedObjective(ussrObj) end) + Trigger.OnKilled(ExtractionHeli, function() USSR.MarkCompletedObjective(USSRobjective) end) Trigger.OnRemovedFromWorld(Tanya, function() ExtractUnits(ExtractionHeli, exitPos, function() - Media.PlaySpeechNotification(greece, "TanyaRescued") - greece.MarkCompletedObjective(mainObj) + Media.PlaySpeechNotification(Greece, "TanyaRescued") + Greece.MarkCompletedObjective(RescueTanyaObjective) Trigger.AfterDelay(DateTime.Seconds(2), function() SendReinforcements() end) @@ -372,17 +372,17 @@ InitTriggers = function() end AddObjectives = function() - ussrObj = AddPrimaryObjective(ussr, "") - mainObj = AddPrimaryObjective(greece, "rescue-tanya") - KillAll = AddPrimaryObjective(greece, "elminate-soviet-units") - infWarfactory = AddSecondaryObjective(greece, "infiltrate-warfactory") + USSRobjective = AddPrimaryObjective(USSR, "") + RescueTanyaObjective = AddPrimaryObjective(Greece, "rescue-tanya") + KillAll = AddPrimaryObjective(Greece, "elminate-soviet-units") + InfiltrateWarfactoryObjective = AddSecondaryObjective(Greece, "infiltrate-warfactory") end WorldLoaded = function() - greece = Player.GetPlayer("Greece") - ussr = Player.GetPlayer("USSR") + Greece = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") - InitObjectives(greece) + InitObjectives(Greece) AddObjectives() InitTriggers() SendSpy() diff --git a/mods/ra/maps/allies-06a/allies06a-AI.lua b/mods/ra/maps/allies-06a/allies06a-AI.lua index d9e1c9ca57..a6dcd38e99 100644 --- a/mods/ra/maps/allies-06a/allies06a-AI.lua +++ b/mods/ra/maps/allies-06a/allies06a-AI.lua @@ -83,13 +83,13 @@ end Attack = 0 ProduceInfantry = function() - if SovietBarracks.IsDead or SovietBarracks.Owner ~= ussr then + if SovietBarracks.IsDead or SovietBarracks.Owner ~= USSR then return end Attack = Attack + 1 local toBuild = Utils.Random(InfTypes) - ussr.Build(toBuild, function(units) + USSR.Build(toBuild, function(units) if Attack == 2 and not AttackTnk1.IsDead then units[#units + 1] = AttackTnk1 elseif Attack == 4 and not AttackTnk2.IsDead then @@ -102,10 +102,10 @@ ProduceInfantry = function() end ProduceVehicles = function() - if WeaponsFactory.IsDead or WeaponsFactory.Owner ~= ussr then + if WeaponsFactory.IsDead or WeaponsFactory.Owner ~= USSR then return end - ussr.Build(VehicleTypes, function(units) + USSR.Build(VehicleTypes, function(units) Utils.Do(units, function(unit) if unit.Type ~= "harv" then IdlingTanks[#IdlingTanks + 1] = unit @@ -115,18 +115,18 @@ ProduceVehicles = function() end ProduceNaval = function() - if not shouldProduce and #Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == player and self.Type == "syrd" end) < 1 then + if not ShouldProduce and #Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == Greece and self.Type == "syrd" end) < 1 then Trigger.AfterDelay(DateTime.Minutes(1), ProduceNaval) return end - shouldProduce = true + ShouldProduce = true - if SubPen.IsDead or SubPen.Owner ~= ussr then + if SubPen.IsDead or SubPen.Owner ~= USSR then return end - ussr.Build(WaterAttackTypes, function(units) + USSR.Build(WaterAttackTypes, function(units) Utils.Do(units, function(unit) IdlingNavalUnits[#IdlingNavalUnits + 1] = unit end) @@ -141,11 +141,11 @@ ProduceNaval = function() end ProduceAircraft = function() - if Airfield.IsDead or Airfield.Owner ~= ussr then + if Airfield.IsDead or Airfield.Owner ~= USSR then return end - ussr.Build(SovietAircraftType, function(units) + USSR.Build(SovietAircraftType, function(units) local yak = units[1] Yaks[#Yaks + 1] = yak @@ -154,7 +154,7 @@ ProduceAircraft = function() Trigger.AfterDelay(DateTime.Seconds(BuildDelays), ProduceAircraft) end - InitializeAttackAircraft(yak, player) + InitializeAttackAircraft(yak, Greece) end) end @@ -185,7 +185,7 @@ end WTransWaves = function() local way = Utils.Random(WTransWays) local units = Utils.Random(WTransUnits) - local attackUnits = Reinforcements.ReinforceWithTransport(ussr, "lst", units , way, { way[2], way[1] })[2] + local attackUnits = Reinforcements.ReinforceWithTransport(USSR, "lst", units , way, { way[2], way[1] })[2] Utils.Do(attackUnits, function(a) Trigger.OnAddedToWorld(a, function() a.AttackMove(UnitBStopLocation.Location) diff --git a/mods/ra/maps/allies-06a/allies06a.lua b/mods/ra/maps/allies-06a/allies06a.lua index d626592a0e..147a8c5c0a 100644 --- a/mods/ra/maps/allies-06a/allies06a.lua +++ b/mods/ra/maps/allies-06a/allies06a.lua @@ -95,41 +95,41 @@ InitialSovietPatrols = function() end InitialAlliedReinforcements = function() - local camera = Actor.Create("Camera", true, { Owner = player, Location = DefaultCameraPosition.Location }) + local camera = Actor.Create("Camera", true, { Owner = Greece, Location = DefaultCameraPosition.Location }) Trigger.AfterDelay(DateTime.Seconds(30), camera.Destroy) - Reinforcements.Reinforce(player, AlliedReinforcementsA, { AlliedEntry1.Location, UnitBStopLocation.Location }, 2) + Reinforcements.Reinforce(Greece, AlliedReinforcementsA, { AlliedEntry1.Location, UnitBStopLocation.Location }, 2) Trigger.AfterDelay(DateTime.Seconds(2), function() - Reinforcements.Reinforce(player, AlliedReinforcementsB, { AlliedEntry2.Location, UnitAStopLocation.Location }, 2) + Reinforcements.Reinforce(Greece, AlliedReinforcementsB, { AlliedEntry2.Location, UnitAStopLocation.Location }, 2) end) Trigger.AfterDelay(DateTime.Seconds(5), function() - Reinforcements.Reinforce(player, { "mcv" }, { AlliedEntry3.Location, MCVStopLocation.Location }) + Reinforcements.Reinforce(Greece, { "mcv" }, { AlliedEntry3.Location, MCVStopLocation.Location }) end) end CaptureRadarDome = function() Trigger.OnKilled(RadarDome, function() - player.MarkFailedObjective(CaptureRadarDomeObj) + Greece.MarkFailedObjective(CaptureRadarDomeObj) end) Trigger.OnCapture(RadarDome, function() - player.MarkCompletedObjective(CaptureRadarDomeObj) + Greece.MarkCompletedObjective(CaptureRadarDomeObj) Utils.Do(SovietTechLabs, function(a) if a.IsDead then return end - Beacon.New(player, a.CenterPosition) + Beacon.New(Greece, a.CenterPosition) if Difficulty ~= "hard" then - Actor.Create("TECH.CAM", true, { Owner = player, Location = a.Location + CVec.New(1, 1) }) + Actor.Create("TECH.CAM", true, { Owner = Greece, Location = a.Location + CVec.New(1, 1) }) end end) Media.DisplayMessage(UserInterface.Translate("soviet-tech-centers-discovered")) if Difficulty == "easy" then - Actor.Create("Camera", true, { Owner = player, Location = Weapcam.Location }) + Actor.Create("Camera", true, { Owner = Greece, Location = Weapcam.Location }) end end) end @@ -137,14 +137,14 @@ end InfiltrateTechCenter = function() Utils.Do(SovietTechLabs, function(a) Trigger.OnInfiltrated(a, function() - if infiltrated then + if Infiltrated then return end - infiltrated = true - DestroySovietsObj = AddPrimaryObjective(player, "destroy-soviet-buildings-units") - player.MarkCompletedObjective(InfiltrateTechCenterObj) + Infiltrated = true + DestroySovietsObj = AddPrimaryObjective(Greece, "destroy-soviet-buildings-units") + Greece.MarkCompletedObjective(InfiltrateTechCenterObj) - local Proxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) + local Proxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR }) Utils.Do(ParadropWaypoints[Difficulty], function(waypoint) Proxy.TargetParatroopers(waypoint.CenterPosition, Angle.South) end) @@ -152,37 +152,37 @@ InfiltrateTechCenter = function() end) Trigger.OnCapture(a, function() - if not infiltrated then + if not Infiltrated then Media.DisplayMessage(UserInterface.Translate("dont-capture-tech-centers")) end end) end) Trigger.OnAllKilledOrCaptured(SovietTechLabs, function() - if not player.IsObjectiveCompleted(InfiltrateTechCenterObj) then - player.MarkFailedObjective(InfiltrateTechCenterObj) + if not Greece.IsObjectiveCompleted(InfiltrateTechCenterObj) then + Greece.MarkFailedObjective(InfiltrateTechCenterObj) end end) end Tick = function() - if DateTime.GameTime > DateTime.Seconds(10) and player.HasNoRequiredUnits() then - player.MarkFailedObjective(InfiltrateTechCenterObj) + if DateTime.GameTime > DateTime.Seconds(10) and Greece.HasNoRequiredUnits() then + Greece.MarkFailedObjective(InfiltrateTechCenterObj) end - if DestroySovietsObj and ussr.HasNoRequiredUnits() then - player.MarkCompletedObjective(DestroySovietsObj) + if DestroySovietsObj and USSR.HasNoRequiredUnits() then + Greece.MarkCompletedObjective(DestroySovietsObj) end end WorldLoaded = function() - player = Player.GetPlayer("Greece") - ussr = Player.GetPlayer("USSR") + Greece = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") - InitObjectives(player) + InitObjectives(Greece) - InfiltrateTechCenterObj = AddPrimaryObjective(player, "infiltrate-tech-center-spy") - CaptureRadarDomeObj = AddSecondaryObjective(player, "capture-radar-shore") + InfiltrateTechCenterObj = AddPrimaryObjective(Greece, "infiltrate-tech-center-spy") + CaptureRadarDomeObj = AddSecondaryObjective(Greece, "capture-radar-shore") Camera.Position = DefaultCameraPosition.CenterPosition @@ -196,9 +196,9 @@ WorldLoaded = function() end) Trigger.OnEnteredProximityTrigger(SovietMiniBaseCam.CenterPosition, WDist.New(1024 * 6), function(a, id) - if a.Owner == player then + if a.Owner == Greece then Trigger.RemoveProximityTrigger(id) - local cam = Actor.Create("Camera", true, { Owner = player, Location = SovietMiniBaseCam.Location }) + local cam = Actor.Create("Camera", true, { Owner = Greece, Location = SovietMiniBaseCam.Location }) Trigger.AfterDelay(DateTime.Seconds(15), cam.Destroy) end end) diff --git a/mods/ra/maps/allies-06b/allies06b-AI.lua b/mods/ra/maps/allies-06b/allies06b-AI.lua index d0938f9add..56c637d2f4 100644 --- a/mods/ra/maps/allies-06b/allies06b-AI.lua +++ b/mods/ra/maps/allies-06b/allies06b-AI.lua @@ -93,13 +93,13 @@ end Attack = 0 ProduceInfantry = function() - if SovietBarracks.IsDead or SovietBarracks.Owner ~= ussr then + if SovietBarracks.IsDead or SovietBarracks.Owner ~= USSR then return end Attack = Attack + 1 local toBuild = Utils.Random(InfTypes) - ussr.Build(toBuild, function(units) + USSR.Build(toBuild, function(units) if Attack == 2 and not AttackTank1.IsDead then units[#units + 1] = AttackTank1 elseif Attack == 4 and not AttackTank2.IsDead then @@ -112,10 +112,10 @@ ProduceInfantry = function() end ProduceVehicles = function() - if WarFactory.IsDead or WarFactory.Owner ~= ussr then + if WarFactory.IsDead or WarFactory.Owner ~= USSR then return end - ussr.Build(VehicleTypes, function(units) + USSR.Build(VehicleTypes, function(units) Utils.Do(units, function(unit) if unit.Type ~= "harv" then IdlingTanks[#IdlingTanks + 1] = unit @@ -125,18 +125,18 @@ ProduceVehicles = function() end ProduceNaval = function() - if SubPen.IsDead or SubPen.Owner ~= ussr then + if SubPen.IsDead or SubPen.Owner ~= USSR then return end - if not shouldProduce and #Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == player and self.Type == "syrd" end) < 1 then + if not ShouldProduce and #Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == Greece and self.Type == "syrd" end) < 1 then Trigger.AfterDelay(DateTime.Minutes(1), ProduceNaval) return end - shouldProduce = true + ShouldProduce = true - ussr.Build(WaterAttackTypes, function(units) + USSR.Build(WaterAttackTypes, function(units) Utils.Do(units, function(unit) IdlingNavalUnits[#IdlingNavalUnits + 1] = unit end) @@ -151,11 +151,11 @@ ProduceNaval = function() end ProduceAircraft = function() - if (Airfield1.IsDead or Airfield1.Owner ~= ussr) and (Airfield2.IsDead or Airfield2.Owner ~= ussr) then + if (Airfield1.IsDead or Airfield1.Owner ~= USSR) and (Airfield2.IsDead or Airfield2.Owner ~= USSR) then return end - ussr.Build(SovietAircraftType, function(units) + USSR.Build(SovietAircraftType, function(units) local yak = units[1] Yaks[#Yaks + 1] = yak @@ -166,7 +166,7 @@ ProduceAircraft = function() Trigger.AfterDelay(DateTime.Seconds(BuildDelays / 2), ProduceAircraft) end - InitializeAttackAircraft(yak, player) + InitializeAttackAircraft(yak, Greece) end) end @@ -197,7 +197,7 @@ end WTransWaves = function() local way = Utils.Random(WTransWays) local units = Utils.Random(WTransUnits) - local attackUnits = Reinforcements.ReinforceWithTransport(ussr, "lst", units , way, { way[2], way[1] })[2] + local attackUnits = Reinforcements.ReinforceWithTransport(USSR, "lst", units , way, { way[2], way[1] })[2] Utils.Do(attackUnits, function(a) Trigger.OnAddedToWorld(a, function() a.AttackMove(SovietBaseAttack.Location) diff --git a/mods/ra/maps/allies-06b/allies06b.lua b/mods/ra/maps/allies-06b/allies06b.lua index eb4de17e60..42fb02d957 100644 --- a/mods/ra/maps/allies-06b/allies06b.lua +++ b/mods/ra/maps/allies-06b/allies06b.lua @@ -104,42 +104,42 @@ InitialSovietPatrols = function() end InitialAlliedReinforcements = function() - local camera = Actor.Create("Camera", true, { Owner = player, Location = DefaultCameraPosition.Location }) + local camera = Actor.Create("Camera", true, { Owner = Greece, Location = DefaultCameraPosition.Location }) Trigger.AfterDelay(DateTime.Seconds(30), camera.Destroy) Trigger.AfterDelay(DateTime.Seconds(1), function() - Reinforcements.Reinforce(player, AlliedReinforcementsA, { AlliedEntry3.Location, UnitCStopLocation.Location }, 2) - Reinforcements.Reinforce(player, AlliedReinforcementsB, { AlliedEntry2.Location, UnitAStopLocation.Location }, 2) + Reinforcements.Reinforce(Greece, AlliedReinforcementsA, { AlliedEntry3.Location, UnitCStopLocation.Location }, 2) + Reinforcements.Reinforce(Greece, AlliedReinforcementsB, { AlliedEntry2.Location, UnitAStopLocation.Location }, 2) end) Trigger.AfterDelay(DateTime.Seconds(3), function() - Reinforcements.Reinforce(player, { "mcv" }, { AlliedEntry1.Location, UnitBStopLocation.Location }) - Reinforcements.Reinforce(player, AlliedBoatReinforcements, { AlliedBoatEntry.Location, AlliedBoatStop.Location }) + Reinforcements.Reinforce(Greece, { "mcv" }, { AlliedEntry1.Location, UnitBStopLocation.Location }) + Reinforcements.Reinforce(Greece, AlliedBoatReinforcements, { AlliedBoatEntry.Location, AlliedBoatStop.Location }) end) end CaptureRadarDome = function() Trigger.OnKilled(RadarDome, function() - player.MarkFailedObjective(CaptureRadarDomeObj) + Greece.MarkFailedObjective(CaptureRadarDomeObj) end) Trigger.OnCapture(RadarDome, function() - player.MarkCompletedObjective(CaptureRadarDomeObj) + Greece.MarkCompletedObjective(CaptureRadarDomeObj) Utils.Do(SovietTechLabs, function(a) if a.IsDead then return end - Beacon.New(player, a.CenterPosition) + Beacon.New(Greece, a.CenterPosition) if Difficulty ~= "hard" then - Actor.Create("TECH.CAM", true, { Owner = player, Location = a.Location + CVec.New(1, 1) }) + Actor.Create("TECH.CAM", true, { Owner = Greece, Location = a.Location + CVec.New(1, 1) }) end end) Media.DisplayMessage(UserInterface.Translate("soviet-tech-centers-discovered")) if Difficulty == "easy" then - Actor.Create("Camera", true, { Owner = player, Location = Weapcam.Location }) + Actor.Create("Camera", true, { Owner = Greece, Location = Weapcam.Location }) end end) end @@ -147,61 +147,61 @@ end InfiltrateTechCenter = function() Utils.Do(SovietTechLabs, function(a) Trigger.OnInfiltrated(a, function() - if infiltrated then + if Infiltrated then return end - infiltrated = true - DestroySovietsObj = AddPrimaryObjective(player, "destroy-soviet-buildings-units") - player.MarkCompletedObjective(InfiltrateTechCenterObj) + Infiltrated = true + DestroySovietsObj = AddPrimaryObjective(Greece, "destroy-soviet-buildings-units") + Greece.MarkCompletedObjective(InfiltrateTechCenterObj) end) Trigger.OnCapture(a, function() - if not infiltrated then + if not Infiltrated then Media.DisplayMessage(UserInterface.Translate("dont-capture-tech-centers")) end end) end) Trigger.OnAllKilledOrCaptured(SovietTechLabs, function() - if not player.IsObjectiveCompleted(InfiltrateTechCenterObj) then - player.MarkFailedObjective(InfiltrateTechCenterObj) + if not Greece.IsObjectiveCompleted(InfiltrateTechCenterObj) then + Greece.MarkFailedObjective(InfiltrateTechCenterObj) end end) end Tick = function() - if player.HasNoRequiredUnits() then - player.MarkFailedObjective(InfiltrateTechCenterObj) + if Greece.HasNoRequiredUnits() then + Greece.MarkFailedObjective(InfiltrateTechCenterObj) end - if DestroySovietsObj and ussr.HasNoRequiredUnits() then - player.MarkCompletedObjective(DestroySovietsObj) + if DestroySovietsObj and USSR.HasNoRequiredUnits() then + Greece.MarkCompletedObjective(DestroySovietsObj) end end WorldLoaded = function() - player = Player.GetPlayer("Greece") - ussr = Player.GetPlayer("USSR") + Greece = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") - InitObjectives(player) + InitObjectives(Greece) - InfiltrateTechCenterObj = AddPrimaryObjective(player, "infiltrate-tech-center-spy") - CaptureRadarDomeObj = AddSecondaryObjective(player, "capture-radar-shore") + InfiltrateTechCenterObj = AddPrimaryObjective(Greece, "infiltrate-tech-center-spy") + CaptureRadarDomeObj = AddSecondaryObjective(Greece, "capture-radar-shore") Camera.Position = DefaultCameraPosition.CenterPosition if Difficulty == "easy" then Trigger.OnEnteredProximityTrigger(SovietDefenseCam.CenterPosition, WDist.New(1024 * 7), function(a, id) - if a.Owner == player then + if a.Owner == Greece then Trigger.RemoveProximityTrigger(id) - local cam1 = Actor.Create("TECH.CAM", true, { Owner = player, Location = SovietDefenseCam.Location }) + local cam1 = Actor.Create("TECH.CAM", true, { Owner = Greece, Location = SovietDefenseCam.Location }) Trigger.AfterDelay(DateTime.Seconds(15), cam1.Destroy) if not DefenseFlame1.IsDead then - local cam2 = Actor.Create("TECH.CAM", true, { Owner = player, Location = DefenseFlame1.Location }) + local cam2 = Actor.Create("TECH.CAM", true, { Owner = Greece, Location = DefenseFlame1.Location }) Trigger.AfterDelay(DateTime.Seconds(15), cam2.Destroy) end if not DefenseFlame2.IsDead then - local cam3 = Actor.Create("TECH.CAM", true, { Owner = player, Location = DefenseFlame2.Location }) + local cam3 = Actor.Create("TECH.CAM", true, { Owner = Greece, Location = DefenseFlame2.Location }) Trigger.AfterDelay(DateTime.Seconds(15), cam3.Destroy) end end @@ -231,9 +231,9 @@ WorldLoaded = function() end) Trigger.OnEnteredProximityTrigger(SovietMiniBaseCam.CenterPosition, WDist.New(1024 * 14), function(a, id) - if a.Owner == player then + if a.Owner == Greece then Trigger.RemoveProximityTrigger(id) - local cam = Actor.Create("Camera", true, { Owner = player, Location = SovietMiniBaseCam.Location }) + local cam = Actor.Create("Camera", true, { Owner = Greece, Location = SovietMiniBaseCam.Location }) Trigger.AfterDelay(DateTime.Seconds(15), cam.Destroy) end end) diff --git a/mods/ra/maps/allies-07/allies07-AI.lua b/mods/ra/maps/allies-07/allies07-AI.lua index d685b8979b..1162a8deba 100644 --- a/mods/ra/maps/allies-07/allies07-AI.lua +++ b/mods/ra/maps/allies-07/allies07-AI.lua @@ -64,11 +64,11 @@ SendBGAttackGroup = function() end ProduceBadGuyInfantry = function() - if BadGuyRax.IsDead or BadGuyRax.Owner ~= badguy then + if BadGuyRax.IsDead or BadGuyRax.Owner ~= BadGuy then return end - badguy.Build({ Utils.Random(SovietInfantry) }, function(units) + BadGuy.Build({ Utils.Random(SovietInfantry) }, function(units) table.insert(BGAttackGroup, units[1]) SendBGAttackGroup() Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceBadGuyInfantry) @@ -90,11 +90,11 @@ SendAttackGroup = function() end ProduceUSSRInfantry = function() - if USSRRax.IsDead or USSRRax.Owner ~= ussr then + if USSRRax.IsDead or USSRRax.Owner ~= USSR then return end - ussr.Build({ Utils.Random(SovietInfantry) }, function(units) + USSR.Build({ Utils.Random(SovietInfantry) }, function(units) table.insert(AttackGroup, units[1]) SendAttackGroup() Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceUSSRInfantry) @@ -102,11 +102,11 @@ ProduceUSSRInfantry = function() end ProduceVehicles = function() - if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= ussr then + if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= USSR then return end - ussr.Build({ Utils.Random(SovietVehicles) }, function(units) + USSR.Build({ Utils.Random(SovietVehicles) }, function(units) table.insert(AttackGroup, units[1]) SendAttackGroup() Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles) @@ -114,11 +114,11 @@ ProduceVehicles = function() end ProduceAircraft = function() - if (Airfield1.IsDead or Airfield1.Owner ~= ussr) and (Airfield2.IsDead or Airfield2.Owner ~= ussr) and (Airfield3.IsDead or Airfield3.Owner ~= ussr) and (Airfield4.IsDead or Airfield4.Owner ~= ussr) then + if (Airfield1.IsDead or Airfield1.Owner ~= USSR) and (Airfield2.IsDead or Airfield2.Owner ~= USSR) and (Airfield3.IsDead or Airfield3.Owner ~= USSR) and (Airfield4.IsDead or Airfield4.Owner ~= USSR) then return end - ussr.Build(SovietAircraftType, function(units) + USSR.Build(SovietAircraftType, function(units) local yak = units[1] Yaks[#Yaks + 1] = yak @@ -129,17 +129,17 @@ ProduceAircraft = function() Trigger.AfterDelay(DateTime.Seconds(ProductionInterval[Difficulty] / 2), ProduceAircraft) end - InitializeAttackAircraft(yak, greece) + InitializeAttackAircraft(yak, Greece) end) end ActivateAI = function() SovietVehicles = SovietVehicles[Difficulty] - local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == ussr and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == USSR and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) Trigger.OnDamaged(actor, function(building) - if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then + if building.Owner == USSR and building.Health < building.MaxHealth * 3/4 then building.StartBuildingRepairs() end end) diff --git a/mods/ra/maps/allies-07/allies07.lua b/mods/ra/maps/allies-07/allies07.lua index 7309d356e5..d3eb533e7a 100644 --- a/mods/ra/maps/allies-07/allies07.lua +++ b/mods/ra/maps/allies-07/allies07.lua @@ -11,7 +11,7 @@ ClearSubActivityTriggerActivator = { Sub1, Sub2, Sub3, Sub4, Sub5, Sub6, Sub7, S AlliedGunboats = { "pt", "pt", "pt" } BeachRifles = { BeachRifle1, BeachRifle2, BeachRifle3, BeachRifle4 } -lstReinforcements = +LstReinforcements = { first = { @@ -42,15 +42,15 @@ RaidTwoPath = { RaidTwoEntry.Location, RaidTwoLanding.Location } StartTimer = false TimerColor = Player.GetPlayer("USSR").Color TimerTicks = DateTime.Minutes(10) -ticked = TimerTicks +Ticked = TimerTicks StartTimerDelay = DateTime.Minutes(5) InitialAlliedReinforcements = function() Trigger.AfterDelay(DateTime.Seconds(1), function() - Reinforcements.Reinforce(greece, AlliedGunboats, { GunboatEntry.Location, waypoint42.Location }, 2) - Media.PlaySpeechNotification(greece, "ReinforcementsArrived") - local reinforcement = lstReinforcements.first - Reinforcements.ReinforceWithTransport(greece, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) + Reinforcements.Reinforce(Greece, AlliedGunboats, { GunboatEntry.Location, waypoint42.Location }, 2) + Media.PlaySpeechNotification(Greece, "ReinforcementsArrived") + local reinforcement = LstReinforcements.first + Reinforcements.ReinforceWithTransport(Greece, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) end) end @@ -64,19 +64,19 @@ end SecondAlliedLanding = function() Trigger.AfterDelay(DateTime.Minutes(1), function() - Media.PlaySpeechNotification(greece, "ReinforcementsArrived") - local reinforcement = lstReinforcements.second - Reinforcements.ReinforceWithTransport(greece, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) + Media.PlaySpeechNotification(Greece, "ReinforcementsArrived") + local reinforcement = LstReinforcements.second + Reinforcements.ReinforceWithTransport(Greece, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) end) end CaptureRadarDome = function() Trigger.OnKilled(RadarDome, function() - greece.MarkFailedObjective(CaptureRadarDomeObj) + Greece.MarkFailedObjective(CaptureRadarDomeObj) end) Trigger.OnCapture(RadarDome, function() - greece.MarkCompletedObjective(CaptureRadarDomeObj) + Greece.MarkCompletedObjective(CaptureRadarDomeObj) BaseRaids() end) end @@ -86,7 +86,7 @@ BaseRaids = function() return else Trigger.AfterDelay(Utils.RandomInteger(BaseRaidDelay1[1], BaseRaidDelay1[2]), function() - local raiders = Reinforcements.ReinforceWithTransport(ussr, "lst", RaidingParty, RaidOnePath, { RaidOneEntry.Location })[2] + local raiders = Reinforcements.ReinforceWithTransport(USSR, "lst", RaidingParty, RaidOnePath, { RaidOneEntry.Location })[2] Utils.Do(raiders, function(a) Trigger.OnAddedToWorld(a, function() a.AttackMove(PlayerBase.Location) @@ -96,7 +96,7 @@ BaseRaids = function() end) Trigger.AfterDelay(Utils.RandomInteger(BaseRaidDelay2[1], BaseRaidDelay2[2]), function() - local raiders = Reinforcements.ReinforceWithTransport(ussr, "lst", RaidingParty, RaidTwoPath, { RaidTwoEntry.Location })[2] + local raiders = Reinforcements.ReinforceWithTransport(USSR, "lst", RaidingParty, RaidTwoPath, { RaidTwoEntry.Location })[2] Utils.Do(raiders, function(a) Trigger.OnAddedToWorld(a, function() a.AttackMove(PlayerBase.Location) @@ -110,7 +110,7 @@ end StartTimerFunction = function() if Difficulty == "hard" then StartTimer = true - Media.PlaySpeechNotification(greece, "TimerStarted") + Media.PlaySpeechNotification(Greece, "TimerStarted") end end @@ -138,10 +138,10 @@ BattalionWays = } SendArmoredBattalion = function() - Media.PlaySpeechNotification(greece, "EnemyUnitsApproaching") + Media.PlaySpeechNotification(Greece, "EnemyUnitsApproaching") Utils.Do(BattalionWays, function(way) local units = { "3tnk", "3tnk", "3tnk", "4tnk", "4tnk" } - local armor = Reinforcements.ReinforceWithTransport(ussr, "lst", units , way, { way[2], way[1] })[2] + local armor = Reinforcements.ReinforceWithTransport(USSR, "lst", units , way, { way[2], way[1] })[2] Utils.Do(armor, function(a) Trigger.OnAddedToWorld(a, function() a.AttackMove(PlayerBase.Location) @@ -152,50 +152,50 @@ SendArmoredBattalion = function() end DestroySubPensCompleted = function() - greece.MarkCompletedObjective(DestroySubPens) + Greece.MarkCompletedObjective(DestroySubPens) end ClearSubActivityCompleted = function() - greece.MarkCompletedObjective(ClearSubActivity) + Greece.MarkCompletedObjective(ClearSubActivity) end Tick = function() - ussr.Cash = 5000 - badguy.Cash = 500 + USSR.Cash = 5000 + BadGuy.Cash = 500 if StartTimer then - if ticked > 0 then - if (ticked % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("soviet-armored-battalion-arrives-in", { ["time"] = Utils.FormatTime(ticked) }) + if Ticked > 0 then + if (Ticked % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("soviet-armored-battalion-arrives-in", { ["time"] = Utils.FormatTime(Ticked) }) UserInterface.SetMissionText(Timer, TimerColor) end - ticked = ticked - 1 - elseif ticked == 0 then + Ticked = Ticked - 1 + elseif Ticked == 0 then FinishTimer() SendArmoredBattalion() - ticked = ticked - 1 + Ticked = Ticked - 1 end end - if greece.HasNoRequiredUnits() then - ussr.MarkCompletedObjective(BeatAllies) + if Greece.HasNoRequiredUnits() then + USSR.MarkCompletedObjective(BeatAllies) end end WorldLoaded = function() - greece = Player.GetPlayer("Greece") - ussr = Player.GetPlayer("USSR") - badguy = Player.GetPlayer("BadGuy") + Greece = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") + BadGuy = Player.GetPlayer("BadGuy") Camera.Position = DefaultCameraPosition.CenterPosition - InitObjectives(greece) - CaptureRadarDomeObj = AddPrimaryObjective(greece, "capture-radar-dome") - DestroySubPens = AddPrimaryObjective(greece, "destroy-all-soviet-sub-pens") - ClearSubActivity = AddSecondaryObjective(greece, "clear-area-all-subs") - BeatAllies = AddPrimaryObjective(ussr, "") + InitObjectives(Greece) + CaptureRadarDomeObj = AddPrimaryObjective(Greece, "capture-radar-dome") + DestroySubPens = AddPrimaryObjective(Greece, "destroy-all-soviet-sub-pens") + ClearSubActivity = AddSecondaryObjective(Greece, "clear-area-all-subs") + BeatAllies = AddPrimaryObjective(USSR, "") - PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) + PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR }) InitialAlliedReinforcements() SecondAlliedLanding() diff --git a/mods/ra/maps/allies-08a/allies08a-AI.lua b/mods/ra/maps/allies-08a/allies08a-AI.lua index 930d37c135..e5bb5a0bfe 100644 --- a/mods/ra/maps/allies-08a/allies08a-AI.lua +++ b/mods/ra/maps/allies-08a/allies08a-AI.lua @@ -84,11 +84,11 @@ SendAttackGroup = function() end ProduceInfantry = function() - if USSRRax.IsDead or USSRRax.Owner ~= ussr then + if USSRRax.IsDead or USSRRax.Owner ~= USSR then return end - ussr.Build({ Utils.Random(SovietInfantry) }, function(units) + USSR.Build({ Utils.Random(SovietInfantry) }, function(units) table.insert(AttackGroup, units[1]) SendAttackGroup() Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceInfantry) @@ -96,11 +96,11 @@ ProduceInfantry = function() end ProduceVehicles = function() - if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= ussr then + if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= USSR then return end - ussr.Build({ Utils.Random(SovietVehicles) }, function(units) + USSR.Build({ Utils.Random(SovietVehicles) }, function(units) table.insert(AttackGroup, units[1]) SendAttackGroup() Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles) @@ -108,11 +108,11 @@ ProduceVehicles = function() end ProduceAircraft = function() - if (Airfield1.IsDead or Airfield1.Owner ~= ussr) and (Airfield2.IsDead or Airfield2.Owner ~= ussr) then + if (Airfield1.IsDead or Airfield1.Owner ~= USSR) and (Airfield2.IsDead or Airfield2.Owner ~= USSR) then return end - ussr.Build(SovietAircraftType, function(units) + USSR.Build(SovietAircraftType, function(units) local mig = units[1] Migs[#Migs + 1] = mig @@ -123,13 +123,13 @@ ProduceAircraft = function() Trigger.AfterDelay(DateTime.Seconds(ProductionInterval[Difficulty] / 2), ProduceAircraft) end - InitializeAttackAircraft(mig, greece) + InitializeAttackAircraft(mig, Greece) end) end GroundWaves = function() local path = Utils.Random(GroundAttackPaths) - local units = Reinforcements.Reinforce(ussr, Utils.Random(GroundAttackUnits[GroundAttackUnitType]), { path[1] }) + local units = Reinforcements.Reinforce(USSR, Utils.Random(GroundAttackUnits[GroundAttackUnitType]), { path[1] }) local lastWaypoint = path[#path] Utils.Do(units, function(unit) Trigger.OnAddedToWorld(unit, function() @@ -146,7 +146,7 @@ end WTransWaves = function() local way = Utils.Random(WTransWays) local units = Utils.Random(WTransUnits) - local attackUnits = Reinforcements.ReinforceWithTransport(ussr, "lst", units , way, { way[2], way[1] })[2] + local attackUnits = Reinforcements.ReinforceWithTransport(USSR, "lst", units , way, { way[2], way[1] })[2] Utils.Do(attackUnits, function(a) Trigger.OnAddedToWorld(a, function() a.AttackMove(AttackChrono.Location) @@ -169,15 +169,15 @@ end SendParabombs = function() local airfield = Airfield1 - if Airfield1.IsDead or Airfield1.Owner ~= ussr then - if Airfield2.IsDead or Airfield2.Owner ~= ussr then + if Airfield1.IsDead or Airfield1.Owner ~= USSR then + if Airfield2.IsDead or Airfield2.Owner ~= USSR then return end airfield = Airfield2 end - local targets = Utils.Where(greece.GetActors(), function(actor) + local targets = Utils.Where(Greece.GetActors(), function(actor) return actor.HasProperty("Sell") and actor.Type ~= "brik" and @@ -199,10 +199,10 @@ ActivateAI = function() ParadropDelays = ParadropDelays[Difficulty] BombDelays = BombDelays[Difficulty] - local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == ussr and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == USSR and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) Trigger.OnDamaged(actor, function(building) - if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then + if building.Owner == USSR and building.Health < building.MaxHealth * 3/4 then building.StartBuildingRepairs() end end) diff --git a/mods/ra/maps/allies-08a/allies08a.lua b/mods/ra/maps/allies-08a/allies08a.lua index 9d99c62089..d07c596ad8 100644 --- a/mods/ra/maps/allies-08a/allies08a.lua +++ b/mods/ra/maps/allies-08a/allies08a.lua @@ -15,33 +15,33 @@ ScientistEvacuationFootprint = { CPos.New(29, 60), CPos.New(29, 61), CPos.New(29 InitialAlliedReinforcements = function() Trigger.AfterDelay(DateTime.Seconds(2), function() - Media.PlaySpeechNotification(greece, "ReinforcementsArrived") - Reinforcements.Reinforce(greece, { "mcv" }, { MCVEntry.Location, MCVStop.Location }) - Reinforcements.Reinforce(greece, AlliedBoatReinforcements, { DDEntry.Location, DDStop.Location }) + Media.PlaySpeechNotification(Greece, "ReinforcementsArrived") + Reinforcements.Reinforce(Greece, { "mcv" }, { MCVEntry.Location, MCVStop.Location }) + Reinforcements.Reinforce(Greece, AlliedBoatReinforcements, { DDEntry.Location, DDStop.Location }) end) end CreateScientists = function() - scientists = Reinforcements.Reinforce(greece, ScientistTypes, { ScientistsExit.Location }) + local scientists = Reinforcements.Reinforce(Greece, ScientistTypes, { ScientistsExit.Location }) Utils.Do(scientists, function(s) s.Move(s.Location + CVec.New(0, 1)) s.Scatter() end) - local flare = Actor.Create("flare", true, { Owner = greece, Location = DefaultCameraPosition.Location + CVec.New(-1, 0) }) - Trigger.AfterDelay(DateTime.Seconds(2), function() Media.PlaySpeechNotification(player, "SignalFlareNorth") end) + local flare = Actor.Create("flare", true, { Owner = Greece, Location = DefaultCameraPosition.Location + CVec.New(-1, 0) }) + Trigger.AfterDelay(DateTime.Seconds(2), function() Media.PlaySpeechNotification(Greece, "SignalFlareNorth") end) Trigger.OnAnyKilled(scientists, function() - Media.PlaySpeechNotification(greece, "ObjectiveNotMet") - greece.MarkFailedObjective(EvacuateScientists) + Media.PlaySpeechNotification(Greece, "ObjectiveNotMet") + Greece.MarkFailedObjective(EvacuateScientists) end) -- Add the footprint trigger in a frame end task (delay 0) to avoid crashes local left = #scientists Trigger.AfterDelay(0, function() local changeOwnerTrigger = Trigger.OnEnteredFootprint(ScientistEvacuationFootprint, function(a, id) - if a.Owner == greece and a.Type == "chan" then - a.Owner = germany + if a.Owner == Greece and a.Type == "chan" then + a.Owner = Germany a.Stop() a.Move(MCVEntry.Location) @@ -54,7 +54,7 @@ CreateScientists = function() -- Use a cell trigger to destroy the scientists preventing the player from causing glitchs by blocking the path Trigger.OnEnteredFootprint({ MCVEntry.Location }, function(a, id) - if a.Owner == germany then + if a.Owner == Germany then a.Stop() a.Destroy() @@ -64,9 +64,9 @@ CreateScientists = function() Trigger.RemoveFootprintTrigger(changeOwnerTrigger) flare.Destroy() - if not greece.IsObjectiveCompleted(EvacuateScientists) and not greece.IsObjectiveFailed(EvacuateScientists) then - Media.PlaySpeechNotification(greece, "ObjectiveMet") - greece.MarkCompletedObjective(EvacuateScientists) + if not Greece.IsObjectiveCompleted(EvacuateScientists) and not Greece.IsObjectiveFailed(EvacuateScientists) then + Media.PlaySpeechNotification(Greece, "ObjectiveMet") + Greece.MarkCompletedObjective(EvacuateScientists) end end end @@ -78,84 +78,84 @@ DefendChronosphereCompleted = function() local cells = Utils.ExpandFootprint({ ChronoshiftLocation.Location }, false) local units = { } for i = 1, #cells do - local unit = Actor.Create("2tnk", true, { Owner = greece, Facing = Angle.North }) + local unit = Actor.Create("2tnk", true, { Owner = Greece, Facing = Angle.North }) units[unit] = cells[i] end Chronosphere.Chronoshift(units) - UserInterface.SetMissionText(UserInterface.Translate("experiment-successful"), greece.Color) + UserInterface.SetMissionText(UserInterface.Translate("experiment-successful"), Greece.Color) Trigger.AfterDelay(DateTime.Seconds(3), function() - greece.MarkCompletedObjective(DefendChronosphere) - greece.MarkCompletedObjective(KeepBasePowered) + Greece.MarkCompletedObjective(DefendChronosphere) + Greece.MarkCompletedObjective(KeepBasePowered) end) end -ticked = TimerTicks +Ticked = TimerTicks Tick = function() - ussr.Cash = 5000 + USSR.Cash = 5000 - if ussr.HasNoRequiredUnits() then - greece.MarkCompletedObjective(DefendChronosphere) - greece.MarkCompletedObjective(KeepBasePowered) + if USSR.HasNoRequiredUnits() then + Greece.MarkCompletedObjective(DefendChronosphere) + Greece.MarkCompletedObjective(KeepBasePowered) end - if greece.HasNoRequiredUnits() then - ussr.MarkCompletedObjective(BeatAllies) + if Greece.HasNoRequiredUnits() then + USSR.MarkCompletedObjective(BeatAllies) end - if ticked > 0 then - if (ticked % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("chronosphere-experiments-completes-in", { ["time"] = Utils.FormatTime(ticked) }) + if Ticked > 0 then + if (Ticked % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("chronosphere-experiments-completes-in", { ["time"] = Utils.FormatTime(Ticked) }) UserInterface.SetMissionText(Timer, TimerColor) end - ticked = ticked - 1 - elseif ticked == 0 and (greece.PowerState ~= "Normal") then - greece.MarkFailedObjective(KeepBasePowered) - elseif ticked == 0 then + Ticked = Ticked - 1 + elseif Ticked == 0 and (Greece.PowerState ~= "Normal") then + Greece.MarkFailedObjective(KeepBasePowered) + elseif Ticked == 0 then DefendChronosphereCompleted() - ticked = ticked - 1 + Ticked = Ticked - 1 end end WorldLoaded = function() - greece = Player.GetPlayer("Greece") - ussr = Player.GetPlayer("USSR") - germany = Player.GetPlayer("Germany") + Greece = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") + Germany = Player.GetPlayer("Germany") - InitObjectives(greece) - DefendChronosphere = AddPrimaryObjective(greece, "defend-chronosphere-tech-center") - KeepBasePowered = AddPrimaryObjective(greece, "chronosphere-needs-power") - EvacuateScientists = AddSecondaryObjective(greece, "evacuate-scientists-from-island") - BeatAllies = AddPrimaryObjective(ussr, "") + InitObjectives(Greece) + DefendChronosphere = AddPrimaryObjective(Greece, "defend-chronosphere-tech-center") + KeepBasePowered = AddPrimaryObjective(Greece, "chronosphere-needs-power") + EvacuateScientists = AddSecondaryObjective(Greece, "evacuate-scientists-from-island") + BeatAllies = AddPrimaryObjective(USSR, "") Trigger.AfterDelay(DateTime.Minutes(1), function() - Media.PlaySpeechNotification(greece, "TwentyMinutesRemaining") + Media.PlaySpeechNotification(Greece, "TwentyMinutesRemaining") end) Trigger.AfterDelay(DateTime.Minutes(11), function() - Media.PlaySpeechNotification(greece, "TenMinutesRemaining") + Media.PlaySpeechNotification(Greece, "TenMinutesRemaining") end) Trigger.AfterDelay(DateTime.Minutes(16), function() - Media.PlaySpeechNotification(greece, "WarningFiveMinutesRemaining") + Media.PlaySpeechNotification(Greece, "WarningFiveMinutesRemaining") end) Trigger.AfterDelay(DateTime.Minutes(18), function() - Media.PlaySpeechNotification(greece, "WarningThreeMinutesRemaining") + Media.PlaySpeechNotification(Greece, "WarningThreeMinutesRemaining") end) Trigger.AfterDelay(DateTime.Minutes(20), function() - Media.PlaySpeechNotification(greece, "WarningOneMinuteRemaining") + Media.PlaySpeechNotification(Greece, "WarningOneMinuteRemaining") end) - PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) + PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR }) Camera.Position = DefaultCameraPosition.CenterPosition - TimerColor = greece.Color + TimerColor = Greece.Color Trigger.OnAnyKilled(ObjectiveBuildings, function() - greece.MarkFailedObjective(DefendChronosphere) + Greece.MarkFailedObjective(DefendChronosphere) end) Trigger.OnEnteredFootprint(ScientistDiscoveryFootprint, function(a, id) - if a.Owner == greece and not scientistsTriggered then - scientistsTriggered = true + if a.Owner == Greece and not ScientistsTriggered then + ScientistsTriggered = true Trigger.RemoveFootprintTrigger(id) CreateScientists() end diff --git a/mods/ra/maps/allies-08b/allies08b-AI.lua b/mods/ra/maps/allies-08b/allies08b-AI.lua index bf2b104e28..a809821782 100644 --- a/mods/ra/maps/allies-08b/allies08b-AI.lua +++ b/mods/ra/maps/allies-08b/allies08b-AI.lua @@ -83,11 +83,11 @@ SendAttackGroup = function() end ProduceInfantry = function() - if USSRRax.IsDead or USSRRax.Owner ~= ussr then + if USSRRax.IsDead or USSRRax.Owner ~= USSR then return end - ussr.Build({ Utils.Random(SovietInfantry) }, function(units) + USSR.Build({ Utils.Random(SovietInfantry) }, function(units) table.insert(AttackGroup, units[1]) SendAttackGroup() Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceInfantry) @@ -95,11 +95,11 @@ ProduceInfantry = function() end ProduceVehicles = function() - if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= ussr then + if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= USSR then return end - ussr.Build({ Utils.Random(SovietVehicles) }, function(units) + USSR.Build({ Utils.Random(SovietVehicles) }, function(units) table.insert(AttackGroup, units[1]) SendAttackGroup() Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles) @@ -107,11 +107,11 @@ ProduceVehicles = function() end ProduceAircraft = function() - if (Airfield1.IsDead or Airfield1.Owner ~= ussr) and (Airfield2.IsDead or Airfield2.Owner ~= ussr) then + if (Airfield1.IsDead or Airfield1.Owner ~= USSR) and (Airfield2.IsDead or Airfield2.Owner ~= USSR) then return end - ussr.Build(SovietAircraftType, function(units) + USSR.Build(SovietAircraftType, function(units) local mig = units[1] Migs[#Migs + 1] = mig @@ -122,13 +122,13 @@ ProduceAircraft = function() Trigger.AfterDelay(DateTime.Seconds(ProductionInterval[Difficulty] / 2), ProduceAircraft) end - InitializeAttackAircraft(mig, greece) + InitializeAttackAircraft(mig, Greece) end) end GroundWaves = function() local path = Utils.Random(GroundAttackPaths) - local units = Reinforcements.Reinforce(ussr, Utils.Random(GroundAttackUnits[GroundAttackUnitType]), { path[1] }) + local units = Reinforcements.Reinforce(USSR, Utils.Random(GroundAttackUnits[GroundAttackUnitType]), { path[1] }) local lastWaypoint = path[#path] Utils.Do(units, function(unit) Trigger.OnAddedToWorld(unit, function() @@ -145,7 +145,7 @@ end WTransWaves = function() local way = Utils.Random(WTransWays) local units = Utils.Random(WTransUnits) - local attackUnits = Reinforcements.ReinforceWithTransport(ussr, "lst", units , way, { way[2], way[1] })[2] + local attackUnits = Reinforcements.ReinforceWithTransport(USSR, "lst", units , way, { way[2], way[1] })[2] Utils.Do(attackUnits, function(a) Trigger.OnAddedToWorld(a, function() a.AttackMove(AttackChrono.Location) @@ -169,15 +169,15 @@ end SendParabombs = function() local airfield = Airfield1 - if Airfield1.IsDead or Airfield1.Owner ~= ussr then - if Airfield2.IsDead or Airfield2.Owner ~= ussr then + if Airfield1.IsDead or Airfield1.Owner ~= USSR then + if Airfield2.IsDead or Airfield2.Owner ~= USSR then return end airfield = Airfield2 end - local targets = Utils.Where(greece.GetActors(), function(actor) + local targets = Utils.Where(Greece.GetActors(), function(actor) return actor.HasProperty("Sell") and actor.Type ~= "brik" and @@ -199,10 +199,10 @@ ActivateAI = function() ParadropDelays = ParadropDelays[Difficulty] BombDelays = BombDelays[Difficulty] - local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == ussr and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == USSR and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) Trigger.OnDamaged(actor, function(building) - if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then + if building.Owner == USSR and building.Health < building.MaxHealth * 3/4 then building.StartBuildingRepairs() end end) diff --git a/mods/ra/maps/allies-08b/allies08b.lua b/mods/ra/maps/allies-08b/allies08b.lua index 04cc1ab84d..36f5473598 100644 --- a/mods/ra/maps/allies-08b/allies08b.lua +++ b/mods/ra/maps/allies-08b/allies08b.lua @@ -15,33 +15,33 @@ ScientistEvacuationFootprint = { CPos.New(98, 88), CPos.New(98, 87), CPos.New(99 InitialAlliedReinforcements = function() Trigger.AfterDelay(DateTime.Seconds(2), function() - Media.PlaySpeechNotification(greece, "ReinforcementsArrived") - Reinforcements.Reinforce(greece, { "mcv" }, { MCVEntry.Location, MCVStop.Location }) - Reinforcements.Reinforce(greece, AlliedBoatReinforcements, { DDEntry.Location, DDStop.Location }) + Media.PlaySpeechNotification(Greece, "ReinforcementsArrived") + Reinforcements.Reinforce(Greece, { "mcv" }, { MCVEntry.Location, MCVStop.Location }) + Reinforcements.Reinforce(Greece, AlliedBoatReinforcements, { DDEntry.Location, DDStop.Location }) end) end CreateScientists = function() - scientists = Reinforcements.Reinforce(greece, ScientistTypes, { ScientistsExit.Location }) + local scientists = Reinforcements.Reinforce(Greece, ScientistTypes, { ScientistsExit.Location }) Utils.Do(scientists, function(s) s.Move(s.Location + CVec.New(0, 1)) s.Scatter() end) - local flare = Actor.Create("flare", true, { Owner = greece, Location = DefaultCameraPosition.Location + CVec.New(-1, 0) }) - Trigger.AfterDelay(DateTime.Seconds(2), function() Media.PlaySpeechNotification(player, "SignalFlareSouth") end) + local flare = Actor.Create("flare", true, { Owner = Greece, Location = DefaultCameraPosition.Location + CVec.New(-1, 0) }) + Trigger.AfterDelay(DateTime.Seconds(2), function() Media.PlaySpeechNotification(Greece, "SignalFlareSouth") end) Trigger.OnAnyKilled(scientists, function() - Media.PlaySpeechNotification(greece, "ObjectiveNotMet") - greece.MarkFailedObjective(EvacuateScientists) + Media.PlaySpeechNotification(Greece, "ObjectiveNotMet") + Greece.MarkFailedObjective(EvacuateScientists) end) -- Add the footprint trigger in a frame end task (delay 0) to avoid crashes local left = #scientists Trigger.AfterDelay(0, function() local changeOwnerTrigger = Trigger.OnEnteredFootprint(ScientistEvacuationFootprint, function(a, id) - if a.Owner == greece and a.Type == "chan" then - a.Owner = england + if a.Owner == Greece and a.Type == "chan" then + a.Owner = England a.Stop() a.Move(MCVEntry.Location) @@ -54,7 +54,7 @@ CreateScientists = function() -- Use a cell trigger to destroy the scientists preventing the player from causing glitchs by blocking the path Trigger.OnEnteredFootprint({ MCVEntry.Location }, function(a, id) - if a.Owner == england then + if a.Owner == England then a.Stop() a.Destroy() @@ -64,9 +64,9 @@ CreateScientists = function() Trigger.RemoveFootprintTrigger(changeOwnerTrigger) flare.Destroy() - if not greece.IsObjectiveCompleted(EvacuateScientists) and not greece.IsObjectiveFailed(EvacuateScientists) then - Media.PlaySpeechNotification(greece, "ObjectiveMet") - greece.MarkCompletedObjective(EvacuateScientists) + if not Greece.IsObjectiveCompleted(EvacuateScientists) and not Greece.IsObjectiveFailed(EvacuateScientists) then + Media.PlaySpeechNotification(Greece, "ObjectiveMet") + Greece.MarkCompletedObjective(EvacuateScientists) end end end @@ -78,84 +78,84 @@ DefendChronosphereCompleted = function() local cells = Utils.ExpandFootprint({ ChronoshiftLocation.Location }, false) local units = { } for i = 1, #cells do - local unit = Actor.Create("2tnk", true, { Owner = greece, Facing = Angle.North }) + local unit = Actor.Create("2tnk", true, { Owner = Greece, Facing = Angle.North }) units[unit] = cells[i] end Chronosphere.Chronoshift(units) - UserInterface.SetMissionText(UserInterface.Translate("experiment-successful"), greece.Color) + UserInterface.SetMissionText(UserInterface.Translate("experiment-successful"), Greece.Color) Trigger.AfterDelay(DateTime.Seconds(3), function() - greece.MarkCompletedObjective(DefendChronosphere) - greece.MarkCompletedObjective(KeepBasePowered) + Greece.MarkCompletedObjective(DefendChronosphere) + Greece.MarkCompletedObjective(KeepBasePowered) end) end -ticked = TimerTicks +Ticked = TimerTicks Tick = function() - ussr.Cash = 5000 + USSR.Cash = 5000 - if ussr.HasNoRequiredUnits() then - greece.MarkCompletedObjective(DefendChronosphere) - greece.MarkCompletedObjective(KeepBasePowered) + if USSR.HasNoRequiredUnits() then + Greece.MarkCompletedObjective(DefendChronosphere) + Greece.MarkCompletedObjective(KeepBasePowered) end - if greece.HasNoRequiredUnits() then - ussr.MarkCompletedObjective(BeatAllies) + if Greece.HasNoRequiredUnits() then + USSR.MarkCompletedObjective(BeatAllies) end - if ticked > 0 then - if (ticked % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("chronosphere-experiments-completes-in", { ["time"] = Utils.FormatTime(ticked) }) + if Ticked > 0 then + if (Ticked % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("chronosphere-experiments-completes-in", { ["time"] = Utils.FormatTime(Ticked) }) UserInterface.SetMissionText(Timer, TimerColor) end - ticked = ticked - 1 - elseif ticked == 0 and (greece.PowerState ~= "Normal") then - greece.MarkFailedObjective(KeepBasePowered) - elseif ticked == 0 then + Ticked = Ticked - 1 + elseif Ticked == 0 and (Greece.PowerState ~= "Normal") then + Greece.MarkFailedObjective(KeepBasePowered) + elseif Ticked == 0 then DefendChronosphereCompleted() - ticked = ticked - 1 + Ticked = Ticked - 1 end end WorldLoaded = function() - greece = Player.GetPlayer("Greece") - ussr = Player.GetPlayer("USSR") - england = Player.GetPlayer("England") + Greece = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") + England = Player.GetPlayer("England") - InitObjectives(greece) - DefendChronosphere = AddPrimaryObjective(greece, "defend-chronosphere-tech-center") - KeepBasePowered = AddPrimaryObjective(greece, "chronosphere-needs-power") - EvacuateScientists = AddSecondaryObjective(greece, "evacuate-scientists-from-island") - BeatAllies = AddPrimaryObjective(ussr, "") + InitObjectives(Greece) + DefendChronosphere = AddPrimaryObjective(Greece, "defend-chronosphere-tech-center") + KeepBasePowered = AddPrimaryObjective(Greece, "chronosphere-needs-power") + EvacuateScientists = AddSecondaryObjective(Greece, "evacuate-scientists-from-island") + BeatAllies = AddPrimaryObjective(USSR, "") Trigger.AfterDelay(DateTime.Minutes(1), function() - Media.PlaySpeechNotification(greece, "TwentyMinutesRemaining") + Media.PlaySpeechNotification(Greece, "TwentyMinutesRemaining") end) Trigger.AfterDelay(DateTime.Minutes(11), function() - Media.PlaySpeechNotification(greece, "TenMinutesRemaining") + Media.PlaySpeechNotification(Greece, "TenMinutesRemaining") end) Trigger.AfterDelay(DateTime.Minutes(16), function() - Media.PlaySpeechNotification(greece, "WarningFiveMinutesRemaining") + Media.PlaySpeechNotification(Greece, "WarningFiveMinutesRemaining") end) Trigger.AfterDelay(DateTime.Minutes(18), function() - Media.PlaySpeechNotification(greece, "WarningThreeMinutesRemaining") + Media.PlaySpeechNotification(Greece, "WarningThreeMinutesRemaining") end) Trigger.AfterDelay(DateTime.Minutes(20), function() - Media.PlaySpeechNotification(greece, "WarningOneMinuteRemaining") + Media.PlaySpeechNotification(Greece, "WarningOneMinuteRemaining") end) - PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) + PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR }) Camera.Position = DefaultCameraPosition.CenterPosition - TimerColor = greece.Color + TimerColor = Greece.Color Trigger.OnAnyKilled(ObjectiveBuildings, function() - greece.MarkFailedObjective(DefendChronosphere) + Greece.MarkFailedObjective(DefendChronosphere) end) Trigger.OnEnteredFootprint(ScientistDiscoveryFootprint, function(a, id) - if a.Owner == greece and not scientistsTriggered then - scientistsTriggered = true + if a.Owner == Greece and not ScientistsTriggered then + ScientistsTriggered = true Trigger.RemoveFootprintTrigger(id) CreateScientists() end diff --git a/mods/ra/maps/allies-09a/allies09a.lua b/mods/ra/maps/allies-09a/allies09a.lua index 1a679358a1..7eaa3e0846 100644 --- a/mods/ra/maps/allies-09a/allies09a.lua +++ b/mods/ra/maps/allies-09a/allies09a.lua @@ -7,7 +7,7 @@ information, see COPYING. ]] -lstReinforcements = +LstReinforcements = { actors = { "mcv" }, entryPath = { AlliedMCVEntry.Location, Unload1.Location }, @@ -28,7 +28,7 @@ KosyginContacted = false InitialAlliedReinforcements = function() Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(Greece, "ReinforcementsArrived") - Reinforcements.ReinforceWithTransport(Greece, "lst.reinforcement", lstReinforcements.actors, lstReinforcements.entryPath, lstReinforcements.exitPath) + Reinforcements.ReinforceWithTransport(Greece, "lst.reinforcement", LstReinforcements.actors, LstReinforcements.entryPath, LstReinforcements.exitPath) end) end diff --git a/mods/ra/maps/allies-10a/allies10a.lua b/mods/ra/maps/allies-10a/allies10a.lua index f4d4e25c0a..3734956ff9 100644 --- a/mods/ra/maps/allies-10a/allies10a.lua +++ b/mods/ra/maps/allies-10a/allies10a.lua @@ -93,7 +93,7 @@ end LaunchMissiles = function() MissilesLaunched = true - local missileCam = Actor.Create("camera", true, { Owner = Greece, Location = FCom.Location }) + Actor.Create("camera", true, { Owner = Greece, Location = FCom.Location }) Camera.Position = FCom.CenterPosition Media.PlaySpeechNotification(Greece, "AbombLaunchDetected") MissileSilo1.ActivateNukePower(CPos.New(127, 127)) diff --git a/mods/ra/maps/ant-01/ant-01.lua b/mods/ra/maps/ant-01/ant-01.lua index 367d4fd816..fcb2788980 100644 --- a/mods/ra/maps/ant-01/ant-01.lua +++ b/mods/ra/maps/ant-01/ant-01.lua @@ -15,7 +15,7 @@ AtEndGame = false TimerColor = Player.GetPlayer("Spain").Color InsertionHelicopterType = "tran.insertion" TimerTicks = DateTime.Minutes(18) -- 18 minutes is roughly 30 mins in the original game -ticks = TimerTicks +Ticks = TimerTicks --Table Vars TankPath = { waypoint12.Location, waypoint13.Location } @@ -104,27 +104,27 @@ SetupTimeNotifications = function() end GetTicks = function() - return ticks + return Ticks end Tick = function() if SurviveObjective ~= nil then - if ticks > 0 then - if ticks == DateTime.Minutes(17) then + if Ticks > 0 then + if Ticks == DateTime.Minutes(17) then StartAntAttack() - elseif ticks == DateTime.Minutes(15) then + elseif Ticks == DateTime.Minutes(15) then SendInsertionHelicopter() - elseif ticks == DateTime.Minutes(12) then + elseif Ticks == DateTime.Minutes(12) then StartAntAttack() - elseif ticks == DateTime.Minutes(6) then + elseif Ticks == DateTime.Minutes(6) then StartAntAttack() - elseif ticks == DateTime.Minutes(1) then + elseif Ticks == DateTime.Minutes(1) then EndAntAttack() end - ticks = ticks - 1; - if (ticks % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("reinforcements-arrive-in", { ["time"] = Utils.FormatTime(ticks) }) + Ticks = Ticks - 1; + if (Ticks % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("reinforcements-arrive-in", { ["time"] = Utils.FormatTime(Ticks) }) UserInterface.SetMissionText(Timer, TimerColor) end else @@ -136,7 +136,7 @@ Tick = function() SendTanks() Trigger.AfterDelay(DateTime.Seconds(2), function() TimerExpired() end) end - ticks = ticks - 1 + Ticks = Ticks - 1 end end end diff --git a/mods/ra/maps/desert-shellmap/desert-shellmap.lua b/mods/ra/maps/desert-shellmap/desert-shellmap.lua index 7c9fb452dc..86c21c65b8 100644 --- a/mods/ra/maps/desert-shellmap/desert-shellmap.lua +++ b/mods/ra/maps/desert-shellmap/desert-shellmap.lua @@ -46,7 +46,7 @@ Mig2Waypoints = { Mig21, Mig22, Mig23, Mig24 } BindActorTriggers = function(a) if a.HasProperty("Hunt") then - if a.Owner == allies then + if a.Owner == Allies then Trigger.OnIdle(a, function(a) if a.IsInWorld then a.Hunt() @@ -76,7 +76,7 @@ BindActorTriggers = function(a) end SendSovietUnits = function(entryCell, unitTypes, interval) - local units = Reinforcements.Reinforce(soviets, unitTypes, { entryCell }, interval) + local units = Reinforcements.Reinforce(Soviets, unitTypes, { entryCell }, interval) Utils.Do(units, function(unit) BindActorTriggers(unit) end) @@ -85,7 +85,7 @@ end SendMigs = function(waypoints) local migEntryPath = { waypoints[1].Location, waypoints[2].Location } - local migs = Reinforcements.Reinforce(soviets, { "mig" }, migEntryPath, 4) + local migs = Reinforcements.Reinforce(Soviets, { "mig" }, migEntryPath, 4) Utils.Do(migs, function(mig) mig.Move(waypoints[3].Location) mig.Move(waypoints[4].Location) @@ -96,7 +96,7 @@ SendMigs = function(waypoints) end ShipAlliedUnits = function() - local units = Reinforcements.ReinforceWithTransport(allies, "lst", + local units = Reinforcements.ReinforceWithTransport(Allies, "lst", ShipUnitTypes, { LstEntry.Location, LstUnload.Location }, { LstEntry.Location })[2] Utils.Do(units, function(unit) @@ -108,7 +108,7 @@ end --- @param hpad actor InsertAlliedChinookReinforcements = function(entry, hpad) - local units = Reinforcements.ReinforceWithTransport(allies, "tran", + local units = Reinforcements.ReinforceWithTransport(Allies, "tran", HelicopterUnitTypes, { entry.Location, hpad.Location + CVec.New(1, 2) }, { entry.Location })[2] Utils.Do(units, function(unit) @@ -120,7 +120,7 @@ end ParadropSovietUnits = function() local lz = Utils.Random(ParadropWaypoints) - local aircraft = powerproxy.TargetParatroopers(lz.CenterPosition) + local aircraft = PowerProxy.TargetParatroopers(lz.CenterPosition) Utils.Do(aircraft, function(a) Trigger.OnPassengerExited(a, function(t, p) @@ -143,7 +143,7 @@ end SetupAlliedUnits = function() Utils.Do(Map.NamedActors, function(a) - if a.Owner == allies and a.HasProperty("AcceptsCondition") and a.AcceptsCondition("unkillable") then + if a.Owner == Allies and a.HasProperty("AcceptsCondition") and a.AcceptsCondition("unkillable") then a.GrantCondition("unkillable") a.Stance = "Defend" end @@ -160,7 +160,7 @@ ChronoshiftAlliedUnits = function() local cells = Utils.ExpandFootprint({ ChronoshiftLocation.Location }, false) local units = { } for i = 1, #cells do - local unit = Actor.Create("2tnk", true, { Owner = allies, Facing = Angle.North }) + local unit = Actor.Create("2tnk", true, { Owner = Allies, Facing = Angle.North }) BindActorTriggers(unit) units[unit] = cells[i] end @@ -168,27 +168,27 @@ ChronoshiftAlliedUnits = function() Trigger.AfterDelay(DateTime.Seconds(60), ChronoshiftAlliedUnits) end -ticks = 0 -speed = 5 +Ticks = 0 +Speed = 5 Tick = function() - ticks = ticks + 1 + 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) + 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 WorldLoaded = function() - allies = Player.GetPlayer("Allies") - soviets = Player.GetPlayer("Soviets") - viewportOrigin = Camera.Position + Allies = Player.GetPlayer("Allies") + Soviets = Player.GetPlayer("Soviets") + ViewportOrigin = Camera.Position SetupAlliedUnits() SetupFactories() ShipAlliedUnits() InsertAlliedChinookReinforcements(Chinook1Entry, HeliPad1) InsertAlliedChinookReinforcements(Chinook2Entry, HeliPad2) - powerproxy = Actor.Create(ProxyType, false, { Owner = soviets }) + PowerProxy = Actor.Create(ProxyType, false, { Owner = Soviets }) ParadropSovietUnits() Trigger.AfterDelay(DateTime.Seconds(5), ChronoshiftAlliedUnits) Utils.Do(ProducedUnitTypes, ProduceUnits) diff --git a/mods/ra/maps/evacuation/evacuation.lua b/mods/ra/maps/evacuation/evacuation.lua index 39804d989c..df6cd77723 100644 --- a/mods/ra/maps/evacuation/evacuation.lua +++ b/mods/ra/maps/evacuation/evacuation.lua @@ -73,17 +73,17 @@ ReinforcementsUnits = { "2tnk", "2tnk", "2tnk", "2tnk", "2tnk", "2tnk", "1tnk", "e1", "e1", "e1", "e3", "e3", "mcv", "truk", "truk", "truk", "truk", "truk", "truk" } SpawnAlliedReinforcements = function() - if allies2.IsLocalPlayer then + if Allies2.IsLocalPlayer then UserInterface.SetMissionText("") - Media.PlaySpeechNotification(allies2, "AlliedReinforcementsArrived") + Media.PlaySpeechNotification(Allies2, "AlliedReinforcementsArrived") end - Reinforcements.Reinforce(allies2, ReinforcementsUnits, { ReinforcementsEntryPoint.Location, Allies2BasePoint.Location }) + Reinforcements.Reinforce(Allies2, ReinforcementsUnits, { ReinforcementsEntryPoint.Location, Allies2BasePoint.Location }) end Yak = nil YakAttack = function() local targets = Map.ActorsInCircle(YakAttackPoint.CenterPosition, WDist.FromCells(10), function(a) - return a.Owner == allies1 and not a.IsDead and a ~= Einstein and a ~= Tanya and a ~= Engineer and Yak.CanTarget(a) + return a.Owner == Allies1 and not a.IsDead and a ~= Einstein and a ~= Tanya and a ~= Engineer and Yak.CanTarget(a) end) if (#targets > 0) then @@ -106,7 +106,7 @@ SovietTownAttack = function() end SendParabombs = function() - local proxy = Actor.Create("powerproxy.parabombs", false, { Owner = soviets }) + local proxy = Actor.Create("powerproxy.parabombs", false, { Owner = Soviets }) proxy.TargetAirstrike(ParabombPoint1.CenterPosition, (BadgerEntryPoint2.CenterPosition - ParabombPoint1.CenterPosition).Facing) proxy.TargetAirstrike(ParabombPoint2.CenterPosition, (Map.CenterOfCell(BadgerEntryPoint2.Location + CVec.New(0, 3)) - ParabombPoint2.CenterPosition).Facing) proxy.Destroy() @@ -114,7 +114,7 @@ end SendParatroopers = function() Utils.Do(Paratroopers, function(para) - local proxy = Actor.Create(para.proxy, false, { Owner = soviets }) + local proxy = Actor.Create(para.proxy, false, { Owner = Soviets }) local target = Map.CenterOfCell(para.drop) local dir = target - Map.CenterOfCell(para.entry) @@ -143,11 +143,11 @@ SendAttackGroup = function() end ProduceInfantry = function() - if SovietBarracks.IsDead or SovietBarracks.Owner ~= soviets then + if SovietBarracks.IsDead or SovietBarracks.Owner ~= Soviets then return end - soviets.Build({ Utils.Random(SovietInfantry) }, function(units) + Soviets.Build({ Utils.Random(SovietInfantry) }, function(units) table.insert(AttackGroup, units[1]) SendAttackGroup() Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceInfantry) @@ -155,11 +155,11 @@ ProduceInfantry = function() end ProduceVehicles = function() - if SovietWarFactory.IsDead or SovietWarFactory.Owner ~= soviets then + if SovietWarFactory.IsDead or SovietWarFactory.Owner ~= Soviets then return end - soviets.Build({ Utils.Random(SovietVehicles[SovietVehicleType]) }, function(units) + Soviets.Build({ Utils.Random(SovietVehicles[SovietVehicleType]) }, function(units) table.insert(AttackGroup, units[1]) SendAttackGroup() Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles) @@ -168,7 +168,7 @@ end NumBaseBuildings = function() local buildings = Map.ActorsInBox(AlliedBaseTopLeft.CenterPosition, AlliedBaseBottomRight.CenterPosition, function(a) - return not a.IsDead and a.Owner == allies2 and a.HasProperty("StartBuildingRepairs") + return not a.IsDead and a.Owner == Allies2 and a.HasProperty("StartBuildingRepairs") end) return #buildings @@ -176,18 +176,18 @@ end Tick = function() if DateTime.GameTime > 1 and DateTime.GameTime % 25 == 0 and NumBaseBuildings() == 0 then - allies2.MarkFailedObjective(objHoldPosition) + Allies2.MarkFailedObjective(HoldPositionObjective) end - if not allies2.IsObjectiveCompleted(objCutSovietPower) and soviets.PowerState ~= "Normal" then - allies2.MarkCompletedObjective(objCutSovietPower) + if not Allies2.IsObjectiveCompleted(CutSovietPowerObjective) and Soviets.PowerState ~= "Normal" then + Allies2.MarkCompletedObjective(CutSovietPowerObjective) end - if not allies2.IsObjectiveCompleted(objLimitLosses) and allies2.UnitsLost > DeathThreshold[Difficulty] then - allies2.MarkFailedObjective(objLimitLosses) + if not Allies2.IsObjectiveCompleted(LimitLossesObjective) and Allies2.UnitsLost > DeathThreshold[Difficulty] then + Allies2.MarkFailedObjective(LimitLossesObjective) end - if allies2.IsLocalPlayer and DateTime.GameTime <= ReinforcementsDelay then + if Allies2.IsLocalPlayer and DateTime.GameTime <= ReinforcementsDelay then if DateTime.GameTime % DateTime.Seconds(1) == 0 then local time = Utils.FormatTime(ReinforcementsDelay - DateTime.GameTime) local timer = UserInterface.Translate("allied-reinforcements-arrive-in", { ["time"] = time }) @@ -199,21 +199,21 @@ Tick = function() end SetupSoviets = function() - soviets.Cash = 1000 + Soviets.Cash = 1000 if Difficulty == "easy" then Utils.Do(Sams, function(sam) - local camera = Actor.Create("Camera.SAM", true, { Owner = allies1, Location = sam.Location }) + local camera = Actor.Create("Camera.SAM", true, { Owner = Allies1, Location = sam.Location }) Trigger.OnKilledOrCaptured(sam, function() camera.Destroy() end) end) end - local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == soviets and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, 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 * RepairTriggerThreshold[Difficulty] / 100) then + if building.Owner == Soviets and building.Health < (building.MaxHealth * RepairTriggerThreshold[Difficulty] / 100) then building.StartBuildingRepairs() end end) @@ -233,43 +233,43 @@ end SetupTriggers = function() Trigger.OnKilled(Tanya, function() - allies1.MarkFailedObjective(objTanyaMustSurvive) + Allies1.MarkFailedObjective(TanyaMustSurviveObjective) end) Trigger.OnAllKilledOrCaptured(Sams, function() - allies1.MarkCompletedObjective(objDestroySamSites) - objExtractEinstein = AddPrimaryObjective(allies1, "wait-for-helicopter-extract-einstein") - Actor.Create("flare", true, { Owner = allies1, Location = ExtractionLZ.Location + CVec.New(1, -1) }) - Beacon.New(allies1, ExtractionLZ.CenterPosition) - Media.PlaySpeechNotification(allies1, "SignalFlareNorth") + Allies1.MarkCompletedObjective(DestroySamSitesObjective) + ExtractEinsteinObjective = AddPrimaryObjective(Allies1, "wait-for-helicopter-extract-einstein") + Actor.Create("flare", true, { Owner = Allies1, Location = ExtractionLZ.Location + CVec.New(1, -1) }) + Beacon.New(Allies1, ExtractionLZ.CenterPosition) + Media.PlaySpeechNotification(Allies1, "SignalFlareNorth") - ExtractionHeli = Reinforcements.ReinforceWithTransport(allies1, "tran", nil, { ExtractionLZEntryPoint.Location, ExtractionLZ.Location })[1] + ExtractionHeli = Reinforcements.ReinforceWithTransport(Allies1, "tran", nil, { ExtractionLZEntryPoint.Location, ExtractionLZ.Location })[1] Trigger.OnKilled(ExtractionHeli, function() - allies1.MarkFailedObjective(objExtractEinstein) + Allies1.MarkFailedObjective(ExtractEinsteinObjective) end) Trigger.OnPassengerEntered(ExtractionHeli, function(heli, passenger) if passenger == Einstein then heli.Move(ExtractionLZEntryPoint.Location) heli.Destroy() Trigger.OnRemovedFromWorld(heli, function() - allies2.MarkCompletedObjective(objLimitLosses) - allies2.MarkCompletedObjective(objHoldPosition) - allies1.MarkCompletedObjective(objTanyaMustSurvive) - allies1.MarkCompletedObjective(objEinsteinSurvival) - allies1.MarkCompletedObjective(objExtractEinstein) + Allies2.MarkCompletedObjective(LimitLossesObjective) + Allies2.MarkCompletedObjective(HoldPositionObjective) + Allies1.MarkCompletedObjective(TanyaMustSurviveObjective) + Allies1.MarkCompletedObjective(EinsteinSurvivalObjective) + Allies1.MarkCompletedObjective(ExtractEinsteinObjective) end) end end) end) Trigger.OnEnteredProximityTrigger(TownPoint.CenterPosition, WDist.FromCells(15), function(actor, trigger) - if actor.Owner == allies1 then - ReassignActors(TownUnits, neutral, allies1) + if actor.Owner == Allies1 then + ReassignActors(TownUnits, Neutral, Allies1) Utils.Do(TownUnits, function(a) a.Stance = "Defend" end) - allies1.MarkCompletedObjective(objFindEinstein) - objEinsteinSurvival = AddPrimaryObjective(allies1, "keep-einstein-alive-at-all-costs") + Allies1.MarkCompletedObjective(FindEinsteinObjective) + EinsteinSurvivalObjective = AddPrimaryObjective(Allies1, "keep-einstein-alive-at-all-costs") Trigger.OnKilled(Einstein, function() - allies1.MarkFailedObjective(objEinsteinSurvival) + Allies1.MarkFailedObjective(EinsteinSurvivalObjective) end) Trigger.RemoveProximityTrigger(trigger) SovietTownAttack() @@ -277,11 +277,11 @@ SetupTriggers = function() end) Trigger.OnEnteredProximityTrigger(YakAttackPoint.CenterPosition, WDist.FromCells(5), function(actor, trigger) - if not (Yak == nil or Yak.IsDead) or actor.Owner ~= allies1 then + if not (Yak == nil or Yak.IsDead) or actor.Owner ~= Allies1 then return end - Yak = Actor.Create("yak", true, { Owner = soviets, Location = YakEntryPoint.Location, CenterPosition = YakEntryPoint.CenterPosition + WVec.New(0, 0, Actor.CruiseAltitude("yak")) }) + Yak = Actor.Create("yak", true, { Owner = Soviets, Location = YakEntryPoint.Location, CenterPosition = YakEntryPoint.CenterPosition + WVec.New(0, 0, Actor.CruiseAltitude("yak")) }) Yak.Move(YakAttackPoint.Location + CVec.New(0, -10)) Yak.CallFunc(YakAttack) end) @@ -292,9 +292,9 @@ SetupTriggers = function() end SpawnTanya = function() - Tanya = Actor.Create(TanyaType, true, { Owner = allies1, Location = TanyaLocation.Location }) + Tanya = Actor.Create(TanyaType, true, { Owner = Allies1, Location = TanyaLocation.Location }) - if Difficulty ~= "easy" and allies1.IsLocalPlayer then + if Difficulty ~= "easy" and Allies1.IsLocalPlayer then Trigger.AfterDelay(DateTime.Seconds(2), function() Media.DisplayMessage(UserInterface.Translate("tanya-rules-of-engagement"), UserInterface.Translate("tanya")) end) @@ -311,46 +311,46 @@ ReassignActors = function(actors, from, to) end WorldLoaded = function() - neutral = Player.GetPlayer("Neutral") + Neutral = Player.GetPlayer("Neutral") -- Allies is the pre-set owner of units that get assigned to either the second player, if any, or the first player otherwise. - allies = Player.GetPlayer("Allies") + Allies = Player.GetPlayer("Allies") -- Allies1 is the player starting on the right, controlling Tanya - allies1 = Player.GetPlayer("Allies1") + Allies1 = Player.GetPlayer("Allies1") -- Allies2 is the player starting on the left, defending the base - allies2 = Player.GetPlayer("Allies2") + Allies2 = Player.GetPlayer("Allies2") - soviets = Player.GetPlayer("Soviets") + Soviets = Player.GetPlayer("Soviets") - Utils.Do({ allies1, allies2 }, function(player) + Utils.Do({ Allies1, Allies2 }, function(player) if player and player.IsLocalPlayer then InitObjectives(player) end end) - if not allies2 or allies2.IsLocalPlayer then + if not Allies2 or Allies2.IsLocalPlayer then Camera.Position = Allies2BasePoint.CenterPosition else Camera.Position = ChinookHusk.CenterPosition end - if not allies2 then - allies2 = allies1 + if not Allies2 then + Allies2 = Allies1 end - ReassignActors(Map.ActorsInWorld, allies, allies2) + ReassignActors(Map.ActorsInWorld, Allies, Allies2) SpawnTanya() - objTanyaMustSurvive = AddPrimaryObjective(allies1, "tanya-survive") - objFindEinstein = AddPrimaryObjective(allies1, "find-einstein-crashed-helicopter") - objDestroySamSites = AddPrimaryObjective(allies1, "destroy-sam-sites") + TanyaMustSurviveObjective = AddPrimaryObjective(Allies1, "tanya-survive") + FindEinsteinObjective = AddPrimaryObjective(Allies1, "find-einstein-crashed-helicopter") + DestroySamSitesObjective = AddPrimaryObjective(Allies1, "destroy-sam-sites") - objHoldPosition = AddPrimaryObjective(allies2, "hold-position-protect-base") + HoldPositionObjective = AddPrimaryObjective(Allies2, "hold-position-protect-base") local dontLoseMoreThan = UserInterface.Translate("keep-civilians-alive", { ["units"] = DeathThreshold[Difficulty] }) - objLimitLosses = AddSecondaryObjective(allies2, dontLoseMoreThan) - objCutSovietPower = AddSecondaryObjective(allies2, "take-out-the-soviet-power-grid") + LimitLossesObjective = AddSecondaryObjective(Allies2, dontLoseMoreThan) + CutSovietPowerObjective = AddSecondaryObjective(Allies2, "take-out-the-soviet-power-grid") SetupTriggers() SetupSoviets() diff --git a/mods/ra/maps/exodus/exodus.lua b/mods/ra/maps/exodus/exodus.lua index 6df955c2c8..b269c317ab 100644 --- a/mods/ra/maps/exodus/exodus.lua +++ b/mods/ra/maps/exodus/exodus.lua @@ -108,13 +108,13 @@ SovietUnits2 = CurrentReinforcement1 = 0 CurrentReinforcement2 = 0 SpawnAlliedUnit = function(units) - Reinforcements.Reinforce(allies1, units, { Allies1EntryPoint.Location, Allies1MovePoint.Location }) + Reinforcements.Reinforce(Allies1, units, { Allies1EntryPoint.Location, Allies1MovePoint.Location }) - if allies2 then - Reinforcements.Reinforce(allies2, units, { Allies2EntryPoint.Location, Allies2MovePoint.Location }) + if Allies2 then + Reinforcements.Reinforce(Allies2, units, { Allies2EntryPoint.Location, Allies2MovePoint.Location }) end - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) Trigger.AfterDelay(DateTime.Seconds(2), function() Media.PlaySpeechNotification(player, "AlliedReinforcementsNorth") end) @@ -148,11 +148,11 @@ SpawnSovietUnits = function() local unitType = Utils.Random(units) local spawnPoint = Utils.Random(SovietEntryPoints) local rallyPoint = Utils.Random(SovietRallyPoints) - local actor = Actor.Create(unitType, true, { Owner = soviets, Location = spawnPoint.Location }) + local actor = Actor.Create(unitType, true, { Owner = Soviets, Location = spawnPoint.Location }) actor.AttackMove(rallyPoint.Location) IdleHunt(actor) - local delay = math.max(attackAtFrame - 5, minAttackAtFrame) + local delay = math.max(AttackAtFrame[Difficulty] - 5, MinAttackAtFrame[Difficulty]) Trigger.AfterDelay(delay, SpawnSovietUnits) end @@ -166,7 +166,7 @@ SendSovietParadrop = function() SovietParadrop = SovietParadrop + 1 - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) Media.PlaySpeechNotification(player, "SovietForcesApproaching") end) @@ -176,16 +176,16 @@ SendSovietParadrop = function() local randomParadropCell = CPos.New(x, y) local lz = Map.CenterOfCell(randomParadropCell) - local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets }) + local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = Soviets }) powerproxy.TargetParatroopers(lz) powerproxy.Destroy() - Trigger.AfterDelay(sovietParadropTicks, SendSovietParadrop) + Trigger.AfterDelay(SovietParadropTicks[Difficulty], SendSovietParadrop) end AircraftTargets = function(yak) local targets = Utils.Where(Map.ActorsInWorld, function(a) - return (a.Owner == allies1 or a.Owner == allies2) and a.HasProperty("Health") and yak.CanTarget(a) + return (a.Owner == Allies1 or a.Owner == Allies2) and a.HasProperty("Health") and yak.CanTarget(a) end) -- Prefer mobile units @@ -215,14 +215,14 @@ YakAttack = function(yak, target) end ManageSovietAircraft = function() - if allies1.IsObjectiveCompleted(destroyAirbases) then + if Allies1.IsObjectiveCompleted(DestroyAirbases) then return end local maxSovietYaks = MaxSovietYaks[Difficulty] - local sovietYaks = soviets.GetActorsByType('yak') + local sovietYaks = Soviets.GetActorsByType('yak') if #sovietYaks < maxSovietYaks then - soviets.Build(Yak, function(units) + Soviets.Build(Yak, function(units) local yak = units[1] YakAttack(yak) end) @@ -230,21 +230,21 @@ ManageSovietAircraft = function() end SetEvacuateMissionText = function() - local attributes = { ["evacuated"] = UnitsEvacuated, ["threshold"] = unitsEvacuatedThreshold } + local attributes = { ["evacuated"] = UnitsEvacuated, ["threshold"] = UnitsEvacuatedThreshold[Difficulty] } local unitsEvacuated = UserInterface.Translate("units-evacuated", attributes) UserInterface.SetMissionText(unitsEvacuated, TextColor) end UnitsEvacuated = 0 EvacuateAlliedUnit = function(unit) - if (unit.Owner == allies1 or unit.Owner == allies2) and unit.HasProperty("Move") then + if (unit.Owner == Allies1 or unit.Owner == Allies2) and unit.HasProperty("Move") then unit.Stop() - unit.Owner = allies + unit.Owner = Allies if unit.Type == 'mgg' then - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) if player then - player.MarkCompletedObjective(evacuateMgg) + player.MarkCompletedObjective(EvacuateMgg) end end) end @@ -266,10 +266,10 @@ EvacuateAlliedUnit = function(unit) SetEvacuateMissionText() - if UnitsEvacuated >= unitsEvacuatedThreshold then - Utils.Do(humans, function(player) + if UnitsEvacuated >= UnitsEvacuatedThreshold[Difficulty] then + Utils.Do(Humans, function(player) if player then - player.MarkCompletedObjective(evacuateUnits) + player.MarkCompletedObjective(EvacuateUnits) end end) end @@ -280,9 +280,9 @@ Tick = function() if DateTime.GameTime % 100 == 0 then ManageSovietAircraft() - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) if player and player.HasNoRequiredUnits() then - soviets.MarkCompletedObjective(sovietObjective) + Soviets.MarkCompletedObjective(SovietObjective) end end) end @@ -290,61 +290,56 @@ end WorldLoaded = function() -- NPC - neutral = Player.GetPlayer("Neutral") - allies = Player.GetPlayer("Allies") - soviets = Player.GetPlayer("Soviets") + Neutral = Player.GetPlayer("Neutral") + Allies = Player.GetPlayer("Allies") + Soviets = Player.GetPlayer("Soviets") -- Player controlled - allies1 = Player.GetPlayer("Allies1") - allies2 = Player.GetPlayer("Allies2") + Allies1 = Player.GetPlayer("Allies1") + Allies2 = Player.GetPlayer("Allies2") - humans = { allies1, allies2 } - Utils.Do(humans, function(player) + Humans = { Allies1, Allies2 } + Utils.Do(Humans, function(player) if player and player.IsLocalPlayer then InitObjectives(player) TextColor = player.Color end end) - unitsEvacuatedThreshold = UnitsEvacuatedThreshold[Difficulty] SetEvacuateMissionText() - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) if player then - evacuateUnits = AddPrimaryObjective(player, UserInterface.Translate("evacuate-units", { ["threshold"] = unitsEvacuatedThreshold })) - destroyAirbases = AddSecondaryObjective(player, "destroy-nearby-soviet-airbases") - evacuateMgg = AddSecondaryObjective(player, "evacuate-at-least-one-gap-generator") + EvacuateUnits = AddPrimaryObjective(player, UserInterface.Translate("evacuate-units", { ["threshold"] = UnitsEvacuatedThreshold[Difficulty] })) + DestroyAirbases = AddSecondaryObjective(player, "destroy-nearby-soviet-airbases") + EvacuateMgg = AddSecondaryObjective(player, "evacuate-at-least-one-gap-generator") end end) Trigger.OnAllKilledOrCaptured(SovietAirfields, function() - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) if player then - player.MarkCompletedObjective(destroyAirbases) + player.MarkCompletedObjective(DestroyAirbases) end end) end) - sovietObjective = AddPrimaryObjective(soviets, "") + SovietObjective = AddPrimaryObjective(Soviets, "") - if not allies2 or allies1.IsLocalPlayer then + if not Allies2 or Allies1.IsLocalPlayer then Camera.Position = Allies1EntryPoint.CenterPosition else Camera.Position = Allies2EntryPoint.CenterPosition end - if not allies2 then - allies1.Cash = 10000 + if not Allies2 then + Allies1.Cash = 10000 Media.DisplayMessage(UserInterface.Translate("transferring-funds"), UserInterface.Translate("co-commander-missing")) end SpawnAlliedUnit(MobileConstructionVehicle) - minAttackAtFrame = MinAttackAtFrame[Difficulty] - attackAtFrame = AttackAtFrame[Difficulty] - Trigger.AfterDelay(attackAtFrame, SpawnSovietUnits) - - sovietParadropTicks = SovietParadropTicks[Difficulty] - Trigger.AfterDelay(sovietParadropTicks, SendSovietParadrop) + Trigger.AfterDelay(AttackAtFrame[Difficulty], SpawnSovietUnits) + Trigger.AfterDelay(SovietParadropTicks[Difficulty], SendSovietParadrop) Trigger.OnEnteredFootprint(MountainEntry, EvacuateAlliedUnit) Trigger.OnEnteredFootprint(BridgeEntry, EvacuateAlliedUnit) diff --git a/mods/ra/maps/fall-of-greece-1-personal-war/personal-war.lua b/mods/ra/maps/fall-of-greece-1-personal-war/personal-war.lua index c30ef45c64..7e299d838b 100644 --- a/mods/ra/maps/fall-of-greece-1-personal-war/personal-war.lua +++ b/mods/ra/maps/fall-of-greece-1-personal-war/personal-war.lua @@ -36,7 +36,7 @@ FootprintTrigger12 = { CPos.New(35, 39), CPos.New(35, 40), CPos.New(35, 41), CPo ExtractionHelicopterType = "tran" ExtractionPath = { ChinookEntry.Location, ExtractionPoint.Location } -lstReinforcements = +LstReinforcements = { first = { @@ -241,7 +241,7 @@ FootprintTriggers = function() Trigger.RemoveFootprintTrigger(id) foot6Triggered = true - local reinforcement = lstReinforcements.first + local reinforcement = LstReinforcements.first Media.PlaySpeechNotification(Allies, "ReinforcementsArrived") Reinforcements.ReinforceWithTransport(Allies, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) end @@ -349,7 +349,7 @@ FootprintTriggers = function() trig11camera.Destroy() end) - local reinforcement = lstReinforcements.second + local reinforcement = LstReinforcements.second Media.PlaySpeechNotification(Allies, "ReinforcementsArrived") Reinforcements.ReinforceWithTransport(Allies, "lst.reinforcement", reinforcement.actors, reinforcement.entryPath, reinforcement.exitPath) end diff --git a/mods/ra/maps/fort-lonestar/fort-lonestar-AI.lua b/mods/ra/maps/fort-lonestar/fort-lonestar-AI.lua index f22ac1a410..e6b61c6436 100644 --- a/mods/ra/maps/fort-lonestar/fort-lonestar-AI.lua +++ b/mods/ra/maps/fort-lonestar/fort-lonestar-AI.lua @@ -47,7 +47,7 @@ end InitialInfantryProduction = function(id, units) local productionComplete = AIPlayers[id].Build(units, function(actors) - InfantryProduction(id) + ProduceInfantry(id) end) Trigger.OnProduction(AIBarracks[id], function(producer, produced) @@ -55,13 +55,13 @@ InitialInfantryProduction = function(id, units) end) end -InfantryProduction = function(id) +ProduceInfantry = function(id) local productionComplete = AIPlayers[id].Build({ Utils.Random(UnitsToBuild) }, function(actors) - Trigger.AfterDelay(0, function() InfantryProduction(id) end) + Trigger.AfterDelay(0, function() ProduceInfantry(id) end) end) if not productionComplete then - Trigger.AfterDelay(0, function() InfantryProduction(id) end) + Trigger.AfterDelay(0, function() ProduceInfantry(id) end) end end diff --git a/mods/ra/maps/fort-lonestar/fort-lonestar.lua b/mods/ra/maps/fort-lonestar/fort-lonestar.lua index 668cf3511f..ce6ae7991f 100644 --- a/mods/ra/maps/fort-lonestar/fort-lonestar.lua +++ b/mods/ra/maps/fort-lonestar/fort-lonestar.lua @@ -100,7 +100,7 @@ IdleHunt = function(actor) end SendUnits = function(entryCell, unitTypes, targetCell, extraData) - Reinforcements.Reinforce(soviets, unitTypes, { entryCell }, 40, function(a) + Reinforcements.Reinforce(Soviets, unitTypes, { entryCell }, 40, function(a) if not a.HasProperty("AttackMove") then Trigger.OnIdle(a, function(a) a.Move(targetCell) @@ -140,7 +140,7 @@ SendWave = function() end) end - Utils.Do(players, function(player) + Utils.Do(Players, function(player) Media.PlaySpeechNotification(player, "EnemyUnitsApproaching") end) @@ -174,7 +174,7 @@ end SovietsRetreating = function() Utils.Do(Snipers, function(a) - if not a.IsDead and a.Owner == soviets then + if not a.IsDead and a.Owner == Soviets then a.Destroy() end end) @@ -201,7 +201,7 @@ Tick = function() end SetupWallOwners = function() - Utils.Do(players, function(player) + Utils.Do(Players, function(player) Utils.Do(Walls[player.Spawn], function(wall) wall.Owner = player end) @@ -209,14 +209,14 @@ SetupWallOwners = function() end WorldLoaded = function() - soviets = Player.GetPlayer("Soviets") - players = { } + Soviets = Player.GetPlayer("Soviets") + Players = { } for i = 0, 4 do local player = Player.GetPlayer("Multi" ..i) - players[i] = player + Players[i] = player - if players[i] and players[i].IsBot then - ActivateAI(players[i], i) + if Players[i] and Players[i].IsBot then + ActivateAI(Players[i], i) end end @@ -224,6 +224,6 @@ WorldLoaded = function() SetupWallOwners() - ParaProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets }) + ParaProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = Soviets }) SendWave() end diff --git a/mods/ra/maps/in-the-nick-of-time/in-the-nick-of-time.lua b/mods/ra/maps/in-the-nick-of-time/in-the-nick-of-time.lua index 2e242eddec..bb0393318c 100644 --- a/mods/ra/maps/in-the-nick-of-time/in-the-nick-of-time.lua +++ b/mods/ra/maps/in-the-nick-of-time/in-the-nick-of-time.lua @@ -129,7 +129,7 @@ AlliedReinforcements = function() Media.PlaySpeechNotification(Greece, "ReinforcementsArrived") local chinookChalk2 = Reinforcements.ReinforceWithTransport(Greece, "tran.reinforcement", NorthChinookChalk, NorthChinookPath, { NorthChinookPath[1] }) - InfantryProduction() + ProduceInfantry() TankProduction() end end) @@ -266,7 +266,7 @@ AttackGroupSize = 4 ProductionDelay = DateTime.Seconds(10) IdlingUnits = { } -InfantryProduction = function() +ProduceInfantry = function() if (Tent1.IsDead or Tent1.Owner ~= USSR) and (Tent2.IsDead or Tent2.Owner ~= USSR) then return end @@ -275,7 +275,7 @@ InfantryProduction = function() USSR.Build(toBuild, function(unit) IdlingUnits[#IdlingUnits + 1] = unit[1] - Trigger.AfterDelay(ProductionDelay, InfantryProduction) + Trigger.AfterDelay(ProductionDelay, ProduceInfantry) if #IdlingUnits >= (AttackGroupSize * 1.5) then SendAttack() @@ -336,19 +336,19 @@ LoseTriggers = function() end) end -ticked = TimerTicks +Ticked = TimerTicks Tick = function() if Greece.HasNoRequiredUnits() and UnitsArrived then USSR.MarkCompletedObjective(SovietObj) end - if ticked > 0 then - if (ticked % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("chronosphere-explodes-in", { ["time"] = Utils.FormatTime(ticked) }) + if Ticked > 0 then + if (Ticked % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("chronosphere-explodes-in", { ["time"] = Utils.FormatTime(Ticked) }) UserInterface.SetMissionText(Timer, TimerColor) end - ticked = ticked - 1 - elseif ticked == 0 then + Ticked = Ticked - 1 + elseif Ticked == 0 then UserInterface.SetMissionText(UserInterface.Translate("too-late"), USSR.Color) USSR.MarkCompletedObjective(SovietObj) end diff --git a/mods/ra/maps/infiltration/infiltration.lua b/mods/ra/maps/infiltration/infiltration.lua index e6bbf21b2c..763883896d 100644 --- a/mods/ra/maps/infiltration/infiltration.lua +++ b/mods/ra/maps/infiltration/infiltration.lua @@ -40,25 +40,25 @@ Patrol3 = { "e1", "e1", "dog.patrol" } TransportType = "lst.unselectable.unloadonly" SecureLabFailed = function() - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) if player then - player.MarkFailedObjective(secureLab) + player.MarkFailedObjective(SecureLab) end end) end -timerStarted = false +TimerStarted = false StartTimer = function() - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) if player.IsLocalPlayer then TimerColor = player.Color end end) CountDownTimerAnnouncements() - ticked = TimerTicks - timerStarted = true + Ticked = TimerTicks + TimerStarted = true Trigger.AfterDelay(DateTime.Seconds(3), function() - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) Media.PlaySpeechNotification(player, "TimerStarted") end) end) @@ -68,8 +68,8 @@ CountDownTimerAnnouncements = function() for i = #Announcements, 1, -1 do local delay = TimerTicks - Announcements[i].delay Trigger.AfterDelay(delay, function() - if not labSecured then - Utils.Do(humans, function(player) + if not LabSecured then + Utils.Do(Humans, function(player) Media.PlaySpeechNotification(player, Announcements[i].speech) end) end @@ -77,13 +77,13 @@ CountDownTimerAnnouncements = function() end end -reinforcementsHaveArrived = false +ReinforcementsHaveArrived = false LabInfiltrated = function() - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) if player then - secureLab = AddPrimaryObjective(player, "secure-laboratory-guards") - destroyBase = AddPrimaryObjective(player, "destroy-remaining-soviet-presence") - player.MarkCompletedObjective(infiltrateLab) + SecureLab = AddPrimaryObjective(player, "secure-laboratory-guards") + DestroyBase = AddPrimaryObjective(player, "destroy-remaining-soviet-presence") + player.MarkCompletedObjective(InfiltrateLab) Trigger.ClearAll(Lab) Trigger.AfterDelay(0, function() Trigger.OnKilled(Lab, SecureLabFailed) @@ -95,46 +95,46 @@ LabInfiltrated = function() local entryPath = { ReinforcementsEntryPoint.Location, ReinforcementsUnloadPoint.Location } local exit = { ReinforcementsEntryPoint.Location } - mcvActors = { "mcv" } - if player2 then + local mcvActors = { "mcv" } + if Allies2 then mcvActors = { "mcv", "mcv" } end - local reinforcements = Reinforcements.ReinforceWithTransport(allies, TransportType, mcvActors, entryPath, exit) + local reinforcements = Reinforcements.ReinforceWithTransport(Allies, TransportType, mcvActors, entryPath, exit) local mcvs = reinforcements[2] Trigger.OnAddedToWorld(mcvs[1], function(mcvUnloaded) -- Don't call this twice (because of the owner change) - if mcvUnloaded.Owner == player1 then + if mcvUnloaded.Owner == Allies1 then return end - mcvUnloaded.Owner = player1 - if not player2 then - player1.Cash = 5000 + mcvUnloaded.Owner = Allies1 + if not Allies2 then + Allies1.Cash = 5000 end - Media.PlaySpeechNotification(player, "AlliedReinforcementsSouth") + Media.PlaySpeechNotification(Allies1, "AlliedReinforcementsSouth") StartTimer() HijackTruck.Destroy() - reinforcementsHaveArrived = true + ReinforcementsHaveArrived = true end) - if player2 then + if Allies2 then Trigger.OnAddedToWorld(mcvs[2], function(mcvUnloaded) -- Don't call this twice (because of the owner change) - if mcvUnloaded.Owner == player2 then + if mcvUnloaded.Owner == Allies2 then return end - mcvUnloaded.Owner = player2 - player1.Cash = 2500 - player2.Cash = 2500 + mcvUnloaded.Owner = Allies2 + Allies1.Cash = 2500 + Allies2.Cash = 2500 end) end - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) for i = 0, 2 do Trigger.AfterDelay(DateTime.Seconds(i), function() Media.PlaySoundNotification(player, "AlertBuzzer") @@ -155,9 +155,9 @@ LabInfiltrated = function() end InfiltrateLabFailed = function() - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) if player then - player.MarkFailedObjective(infiltrateLab) + player.MarkFailedObjective(InfiltrateLab) end end) end @@ -170,14 +170,14 @@ ChangeOwnerOnAddedToWorld = function(actor, newOwner) end InsertSpies = function() - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) if player then - infiltrateLab = AddPrimaryObjective(player, "infiltrate-laboratory") + InfiltrateLab = AddPrimaryObjective(player, "infiltrate-laboratory") end end) Trigger.OnKilled(Lab, function() - if not player1.IsObjectiveCompleted(infiltrateLab) then + if not Allies1.IsObjectiveCompleted(InfiltrateLab) then InfiltrateLabFailed() end end) @@ -188,30 +188,30 @@ InsertSpies = function() Trigger.OnInfiltrated(Lab, function() infiltrationCount = infiltrationCount + 1 - if (player2 and infiltrationCount == 2) or not player2 then + if (Allies2 and infiltrationCount == 2) or not Allies2 then Trigger.AfterDelay(DateTime.Seconds(3), LabInfiltrated) end end) - spyActors = { "spy.strong" } - if player2 then + local spyActors = { "spy.strong" } + if Allies2 then spyActors = { "spy.strong", "spy.strong" } end local entryPath = { SpyReinforcementsEntryPoint.Location, SpyReinforcementsUnloadPoint.Location } local exit = { SpyReinforcementsExitPoint.Location } - local reinforcements = Reinforcements.ReinforceWithTransport(allies, TransportType, spyActors, entryPath, exit) + local reinforcements = Reinforcements.ReinforceWithTransport(Allies, TransportType, spyActors, entryPath, exit) local transport = reinforcements[1] Camera.Position = transport.CenterPosition - spies = reinforcements[2] + local spies = reinforcements[2] Trigger.OnAnyKilled(spies, InfiltrateLabFailed) - ChangeOwnerOnAddedToWorld(spies[1], player1) + ChangeOwnerOnAddedToWorld(spies[1], Allies1) - if player2 then - ChangeOwnerOnAddedToWorld(spies[2], player2) + if Allies2 then + ChangeOwnerOnAddedToWorld(spies[2], Allies2) end end @@ -237,7 +237,7 @@ CapOre = function(player) end NewPatrol = function(actorType, start, waypoints) - local guard = Actor.Create(actorType, true, { Owner = soviets, Location = start }) + local guard = Actor.Create(actorType, true, { Owner = Soviets, Location = start }) guard.Patrol(waypoints, true, Utils.RandomInteger(50, 75)) end @@ -260,20 +260,20 @@ SetupPatrols = function() end) end -ticked = 0 +Ticked = 0 SecureLabTimer = function() - if not timerStarted or labSecured then + if not TimerStarted or LabSecured then return end - if ticked > 0 then - if (ticked % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("secure-lab-in", { ["time"] = Utils.FormatTime(ticked) }) + if Ticked > 0 then + if (Ticked % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("secure-lab-in", { ["time"] = Utils.FormatTime(Ticked) }) UserInterface.SetMissionText(Timer, TimerColor) end - ticked = ticked - 1 - elseif ticked <= 0 then - TimerColor = soviets.Color + Ticked = Ticked - 1 + elseif Ticked <= 0 then + TimerColor = Soviets.Color UserInterface.SetMissionText(UserInterface.Translate("soviet-research-lab-not-secured-in-time"), TimerColor) SecureLabFailed() end @@ -281,18 +281,18 @@ end SovietBaseMaintenanceSetup = function() local sovietbuildings = Utils.Where(Map.NamedActors, function(a) - return a.Owner == soviets and a.HasProperty("StartBuildingRepairs") + return a.Owner == Soviets and a.HasProperty("StartBuildingRepairs") end) Trigger.OnAllKilledOrCaptured(sovietbuildings, function() - Utils.Do(humans, function(player) - player.MarkCompletedObjective(destroyBase) + Utils.Do(Humans, function(player) + player.MarkCompletedObjective(DestroyBase) end) end) Utils.Do(sovietbuildings, function(sovietbuilding) Trigger.OnDamaged(sovietbuilding, function(building) - if building.Owner == soviets and building.Health < building.MaxHealth * 3/4 then + if building.Owner == Soviets and building.Health < building.MaxHealth * 3/4 then building.StartBuildingRepairs() end end) @@ -300,61 +300,61 @@ SovietBaseMaintenanceSetup = function() end CheckPlayerDefeat = function() - if not reinforcementsHaveArrived then + if not ReinforcementsHaveArrived then return end - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) if player.HasNoRequiredUnits() then - player.MarkFailedObjective(destroyBase) + player.MarkFailedObjective(DestroyBase) end end) end -labSecured = false +LabSecured = false CheckLabSecured = function() - if not reinforcementsHaveArrived or labSecured then + if not ReinforcementsHaveArrived or LabSecured then return end - if player1.HasNoRequiredUnits() or (player2 and player2.HasNoRequiredUnits()) then - Utils.Do(humans, function(player) - player.MarkFailedObjective(secureLab) + if Allies1.HasNoRequiredUnits() or (Allies2 and Allies2.HasNoRequiredUnits()) then + Utils.Do(Humans, function(player) + player.MarkFailedObjective(SecureLab) end) end local radius = WDist.FromCells(10) local labGuards = Utils.Where(Map.ActorsInCircle(LabWaypoint.CenterPosition, radius), function(a) - return a.Owner == soviets and a.HasProperty("Move") + return a.Owner == Soviets and a.HasProperty("Move") end) if #labGuards < 1 then - labSecured = true - Utils.Do(humans, function(player) - player.MarkCompletedObjective(secureLab) + LabSecured = true + Utils.Do(Humans, function(player) + player.MarkCompletedObjective(SecureLab) end) UserInterface.SetMissionText("") end end Tick = function() - CapOre(soviets) + CapOre(Soviets) SecureLabTimer() CheckLabSecured() CheckPlayerDefeat() end WorldLoaded = function() - allies = Player.GetPlayer("Allies") - neutral = Player.GetPlayer("Neutral") - creeps = Player.GetPlayer("Creeps") - soviets = Player.GetPlayer("Soviets") + Allies = Player.GetPlayer("Allies") + Neutral = Player.GetPlayer("Neutral") + Creeps = Player.GetPlayer("Creeps") + Soviets = Player.GetPlayer("Soviets") - player1 = Player.GetPlayer("Allies1") - player2 = Player.GetPlayer("Allies2") - humans = { player1, player2 } + Allies1 = Player.GetPlayer("Allies1") + Allies2 = Player.GetPlayer("Allies2") + Humans = { Allies1, Allies2 } - Utils.Do(humans, function(player) + Utils.Do(Humans, function(player) if player and player.IsLocalPlayer then InitObjectives(player) end diff --git a/mods/ra/maps/intervention/intervention.lua b/mods/ra/maps/intervention/intervention.lua index 5456552c7d..574b5e99e5 100644 --- a/mods/ra/maps/intervention/intervention.lua +++ b/mods/ra/maps/intervention/intervention.lua @@ -62,7 +62,7 @@ GroundPatrolUnits = } ParadropSovietUnits = function() - local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets }) + local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = Soviets }) local aircraft = powerproxy.TargetParatroopers(MCVDeployLocation.CenterPosition, Angle.New(812)) Utils.Do(aircraft, function(a) Trigger.OnPassengerExited(a, function(t, p) @@ -81,7 +81,7 @@ AirRaid = function(planeTypes, ingress, target) for i = 1, #planeTypes do Trigger.AfterDelay((i - 1) * DateTime.Seconds(1), function() local start = Map.CenterOfCell(ingress[1]) + WVec.New(0, 0, Actor.CruiseAltitude(planeTypes[i])) - local plane = Actor.Create(planeTypes[i], true, { CenterPosition = start, Owner = soviets, Facing = (Map.CenterOfCell(ingress[2]) - start).Facing }) + local plane = Actor.Create(planeTypes[i], true, { CenterPosition = start, Owner = Soviets, Facing = (Map.CenterOfCell(ingress[2]) - start).Facing }) Utils.Do(ingress, function(wpt) plane.Move(wpt) end) plane.Attack(target) @@ -91,7 +91,7 @@ end BaseRaid = function() local targets = Map.ActorsInBox(AlliedAreaTopLeft.CenterPosition, AlliedAreaBottomRight.CenterPosition, function(actor) - return actor.Owner == player and actor.HasProperty("StartBuildingRepairs") + return actor.Owner == Allies and actor.HasProperty("StartBuildingRepairs") end) if #targets == 0 then @@ -163,7 +163,7 @@ BaseRearAttack = function(team) end Build = function(units, action) - if not soviets.Build(units, action) then + if not Soviets.Build(units, action) then Trigger.AfterDelay(DateTime.Seconds(15), function() Build(units, action) end) @@ -185,9 +185,9 @@ SetupWorld = function() end) Utils.Do(Map.NamedActors, function(actor) - if actor.Owner == soviets and actor.HasProperty("StartBuildingRepairs") then + if actor.Owner == Soviets and actor.HasProperty("StartBuildingRepairs") then Trigger.OnDamaged(actor, function(building) - if building.Owner == soviets then + if building.Owner == Soviets then building.StartBuildingRepairs() end end) @@ -227,12 +227,12 @@ end Tick = function() if DateTime.GameTime > 2 then - if soviets.Resources > soviets.ResourceCapacity * 0.75 then - soviets.Resources = soviets.Resources - ((soviets.ResourceCapacity * 0.01) / 25) + if Soviets.Resources > Soviets.ResourceCapacity * 0.75 then + Soviets.Resources = Soviets.Resources - ((Soviets.ResourceCapacity * 0.01) / 25) end - if player.HasNoRequiredUnits() then - player.MarkFailedObjective(villageObjective) + if Allies.HasNoRequiredUnits() then + Allies.MarkFailedObjective(VillageObjective) end if CachedVillagePercentage ~= VillagePercentage then @@ -244,43 +244,43 @@ Tick = function() end WorldLoaded = function() - player = Player.GetPlayer("Allies") - soviets = Player.GetPlayer("Soviets") + Allies = Player.GetPlayer("Allies") + Soviets = Player.GetPlayer("Soviets") - InitObjectives(player) + InitObjectives(Allies) - sovietObjective = AddPrimaryObjective(soviets, "") - villageObjective = AddPrimaryObjective(player, "save-village") - beachheadObjective = AddPrimaryObjective(player, "mcv-main-island") + SovietObjective = AddPrimaryObjective(Soviets, "") + VillageObjective = AddPrimaryObjective(Allies, "save-village") + BeachheadObjective = AddPrimaryObjective(Allies, "mcv-main-island") - beachheadTrigger = false + BeachheadTriggered = false Trigger.OnExitedFootprint(BeachheadTrigger, function(a, id) - if not beachheadTrigger and a.Owner == player and a.Type == "mcv" then - beachheadTrigger = true + if not BeachheadTriggered and a.Owner == Allies and a.Type == "mcv" then + BeachheadTriggered = true Trigger.RemoveFootprintTrigger(id) - player.MarkCompletedObjective(beachheadObjective) + Allies.MarkCompletedObjective(BeachheadObjective) - captureObjective = AddPrimaryObjective(player, "capture-air-force-hq") + CaptureObjective = AddPrimaryObjective(Allies, "capture-air-force-hq") if AirForceHQ.IsDead then - player.MarkFailedObjective(captureObjective) + Allies.MarkFailedObjective(CaptureObjective) return end - if AirForceHQ.Owner == player then - player.MarkCompletedObjective(captureObjective) - player.MarkCompletedObjective(villageObjective) + if AirForceHQ.Owner == Allies then + Allies.MarkCompletedObjective(CaptureObjective) + Allies.MarkCompletedObjective(VillageObjective) return end Trigger.OnCapture(AirForceHQ, function() Trigger.AfterDelay(DateTime.Seconds(3), function() - player.MarkCompletedObjective(captureObjective) - player.MarkCompletedObjective(villageObjective) + Allies.MarkCompletedObjective(CaptureObjective) + Allies.MarkCompletedObjective(VillageObjective) end) end) - Trigger.OnKilled(AirForceHQ, function() player.MarkFailedObjective(captureObjective) end) + Trigger.OnKilled(AirForceHQ, function() Allies.MarkFailedObjective(CaptureObjective) end) - Actor.Create("mainland", true, { Owner = player }) + Actor.Create("mainland", true, { Owner = Allies }) Trigger.AfterDelay(BaseFrontAttackInterval, function() Build(BaseFrontAttackUnits, BaseFrontAttack) @@ -301,7 +301,7 @@ WorldLoaded = function() end end) - Trigger.OnAllKilled(Village, function() player.MarkFailedObjective(villageObjective) end) + Trigger.OnAllKilled(Village, function() Allies.MarkFailedObjective(VillageObjective) end) SetupWorld() SetupMissionText() @@ -311,7 +311,7 @@ WorldLoaded = function() Trigger.AfterDelay(1, function() Build(UBoatPatrolUnits, SendUboatPatrol) end) Trigger.AfterDelay(1, function() Build(Utils.Random(GroundPatrolUnits), SendGroundPatrol) end) - Reinforcements.Reinforce(player, { "mcv" }, { MCVInsertLocation.Location, MCVDeployLocation.Location }, 0, function(mcv) + Reinforcements.Reinforce(Allies, { "mcv" }, { MCVInsertLocation.Location, MCVDeployLocation.Location }, 0, function(mcv) mcv.Deploy() end) diff --git a/mods/ra/maps/monster-tank-madness/monster-tank-madness.lua b/mods/ra/maps/monster-tank-madness/monster-tank-madness.lua index 6e675d6723..c2ee1cd34c 100644 --- a/mods/ra/maps/monster-tank-madness/monster-tank-madness.lua +++ b/mods/ra/maps/monster-tank-madness/monster-tank-madness.lua @@ -30,13 +30,13 @@ DemitriAreaTrigger = { CPos.New(32, 98), CPos.New(32, 99), CPos.New(33, 99), CPo HospitalAreaTrigger = { CPos.New(43, 41), CPos.New(44, 41), CPos.New(45, 41), CPos.New(46, 41), CPos.New(46, 42), CPos.New(46, 43), CPos.New(46, 44), CPos.New(46, 45), CPos.New(46, 46), CPos.New(45, 46), CPos.New(44, 46), CPos.New(43, 46) } EvacuateCivilians = function() - local evacuees = Reinforcements.Reinforce(neutral, CivilianEvacuees, { HospitalCivilianSpawnPoint.Location }, 0) + local evacuees = Reinforcements.Reinforce(Neutral, CivilianEvacuees, { HospitalCivilianSpawnPoint.Location }, 0) Trigger.OnAnyKilled(evacuees, function() - player.MarkFailedObjective(RescueCivilians) + Greece.MarkFailedObjective(RescueCivilians) end) Trigger.OnAllRemovedFromWorld(evacuees, function() - player.MarkCompletedObjective(RescueCivilians) + Greece.MarkCompletedObjective(RescueCivilians) end) Utils.Do(evacuees, function(civ) @@ -51,33 +51,33 @@ EvacuateCivilians = function() end SpawnAndMoveAlliedBaseUnits = function() - Media.PlaySpeechNotification(player, "ReinforcementsArrived") - Reinforcements.Reinforce(player, ReinforceBaseUnits, { AlliedBaseEntryPoint.Location, AlliedBaseMovePoint.Location }, 18) + Media.PlaySpeechNotification(Greece, "ReinforcementsArrived") + Reinforcements.Reinforce(Greece, ReinforceBaseUnits, { AlliedBaseEntryPoint.Location, AlliedBaseMovePoint.Location }, 18) end SetupAlliedBase = function() local alliedOutpost = Map.ActorsInBox(AlliedBaseTopLeft.CenterPosition, AlliedBaseBottomRight.CenterPosition, - function(self) return self.Owner == outpost end) + function(self) return self.Owner == Outpost end) - Media.PlaySoundNotification(player, "BaseSetup") + Media.PlaySoundNotification(Greece, "BaseSetup") Utils.Do(alliedOutpost, function(building) - building.Owner = player + building.Owner = Greece end) - AlliedBaseHarv.Owner = player + AlliedBaseHarv.Owner = Greece AlliedBaseHarv.FindResources() - FindDemitri = AddPrimaryObjective(player, "find-demitri") - InfiltrateRadarDome = AddPrimaryObjective(player, "reprogram-super-tanks") - DefendOutpost = AddSecondaryObjective(player, "defend-outpost") - player.MarkCompletedObjective(FindOutpost) + FindDemitri = AddPrimaryObjective(Greece, "find-demitri") + InfiltrateRadarDome = AddPrimaryObjective(Greece, "reprogram-super-tanks") + DefendOutpost = AddSecondaryObjective(Greece, "defend-outpost") + Greece.MarkCompletedObjective(FindOutpost) -- Don't fail the Objective instantly Trigger.AfterDelay(DateTime.Seconds(1), function() -- The actor might have been destroyed/crushed in this one second delay local actors = Utils.Where(alliedOutpost, function(actor) return actor.IsInWorld end) - Trigger.OnAllRemovedFromWorld(actors, function() player.MarkFailedObjective(DefendOutpost) end) + Trigger.OnAllRemovedFromWorld(actors, function() Greece.MarkFailedObjective(DefendOutpost) end) end) Trigger.AfterDelay(DateTime.Minutes(1) + DateTime.Seconds(40), function() @@ -111,10 +111,10 @@ SendAlliedUnits = function() Camera.Position = StartEntryPoint.CenterPosition - Media.PlaySpeechNotification(player, "ReinforcementsArrived") + Media.PlaySpeechNotification(Greece, "ReinforcementsArrived") Utils.Do(AlliedUnits, function(table) Trigger.AfterDelay(table.delay, function() - local units = Reinforcements.Reinforce(player, table.types, { StartEntryPoint.Location, StartMovePoint.Location }, 18) + local units = Reinforcements.Reinforce(Greece, table.types, { StartEntryPoint.Location, StartMovePoint.Location }, 18) Utils.Do(units, function(unit) if unit.Type == "e6" then @@ -122,7 +122,7 @@ SendAlliedUnits = function() Trigger.OnKilled(unit, LandingPossible) elseif unit.Type == "thf" then Trigger.OnKilled(unit, function() - player.MarkFailedObjective(StealMoney) + Greece.MarkFailedObjective(StealMoney) end) end end) @@ -133,15 +133,15 @@ SendAlliedUnits = function() end LandingPossible = function() - if not beachReached and (USSRSpen.IsDead or Engineer.IsDead) and LstProduced < 1 then - player.MarkFailedObjective(CrossRiver) + if not BeachReached and (USSRSpen.IsDead or Engineer.IsDead) and LstProduced < 1 then + Greece.MarkFailedObjective(CrossRiver) end end SuperTankDomeInfiltrated = function() SuperTankAttack = true Utils.Do(SuperTanks, function(tnk) - tnk.Owner = friendlyMadTanks + tnk.Owner = FriendlyMadTanks if not tnk.IsDead then tnk.GrantCondition("friendly") Trigger.ClearAll(tnk) @@ -169,29 +169,29 @@ SuperTankDomeInfiltrated = function() end end) - player.MarkCompletedObjective(InfiltrateRadarDome) + Greece.MarkCompletedObjective(InfiltrateRadarDome) Trigger.AfterDelay(DateTime.Minutes(3), SuperTanksDestruction) - ticked = DateTime.Minutes(3) + Ticked = DateTime.Minutes(3) Trigger.AfterDelay(DateTime.Seconds(2), function() - Media.PlaySpeechNotification(player, "ControlCenterDeactivated") + Media.PlaySpeechNotification(Greece, "ControlCenterDeactivated") Trigger.AfterDelay(DateTime.Seconds(4), function() Media.DisplayMessage(UserInterface.Translate("super-tank-self-destruct-t-minus-3")) - Media.PlaySpeechNotification(player, "WarningThreeMinutesRemaining") + Media.PlaySpeechNotification(Greece, "WarningThreeMinutesRemaining") end) end) end SuperTanksDestruction = function() - local badGuys = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == badguy and self.HasProperty("Health") end) + local badGuys = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == BadGuy and self.HasProperty("Health") end) Utils.Do(badGuys, function(unit) unit.Kill() end) Utils.Do(SuperTanks, function(tnk) if not tnk.IsDead then - local camera = Actor.Create("camera", true, { Owner = player, Location = tnk.Location }) + local camera = Actor.Create("camera", true, { Owner = Greece, Location = tnk.Location }) Trigger.AfterDelay(DateTime.Seconds(3), camera.Destroy) Trigger.ClearAll(tnk) @@ -199,31 +199,31 @@ SuperTanksDestruction = function() end end) - player.MarkCompletedObjective(DefendOutpost) + Greece.MarkCompletedObjective(DefendOutpost) end CreateDemitri = function() - local demitri = Actor.Create("demitri", true, { Owner = player, Location = DemitriChurchSpawnPoint.Location }) + local demitri = Actor.Create("demitri", true, { Owner = Greece, Location = DemitriChurchSpawnPoint.Location }) demitri.Move(DemitriTriggerAreaCenter.Location) - Media.PlaySpeechNotification(player, "TargetFreed") - EvacuateDemitri = AddPrimaryObjective(player, "evacuate-demitri") - player.MarkCompletedObjective(FindDemitri) + Media.PlaySpeechNotification(Greece, "TargetFreed") + EvacuateDemitri = AddPrimaryObjective(Greece, "evacuate-demitri") + Greece.MarkCompletedObjective(FindDemitri) local flarepos = CPos.New(DemitriLZ.Location.X, DemitriLZ.Location.Y - 1) - local demitriLZFlare = Actor.Create("flare", true, { Owner = player, Location = flarepos }) - Trigger.AfterDelay(DateTime.Seconds(3), function() Media.PlaySpeechNotification(player, "SignalFlareNorth") end) + local demitriLZFlare = Actor.Create("flare", true, { Owner = Greece, Location = flarepos }) + Trigger.AfterDelay(DateTime.Seconds(3), function() Media.PlaySpeechNotification(Greece, "SignalFlareNorth") end) - local demitriChinook = Reinforcements.ReinforceWithTransport(player, ExtractionHeli, nil, { ExtractionWaypoint, ExtractionLZ })[1] + local demitriChinook = Reinforcements.ReinforceWithTransport(Greece, ExtractionHeli, nil, { ExtractionWaypoint, ExtractionLZ })[1] Trigger.OnAnyKilled({ demitri, demitriChinook }, function() - player.MarkFailedObjective(EvacuateDemitri) + Greece.MarkFailedObjective(EvacuateDemitri) end) Trigger.OnRemovedFromWorld(demitriChinook, function() if not demitriChinook.IsDead then - Media.PlaySpeechNotification(player, "TargetRescued") - Trigger.AfterDelay(DateTime.Seconds(1), function() player.MarkCompletedObjective(EvacuateDemitri) end) + Media.PlaySpeechNotification(Greece, "TargetRescued") + Trigger.AfterDelay(DateTime.Seconds(1), function() Greece.MarkCompletedObjective(EvacuateDemitri) end) Trigger.AfterDelay(DateTime.Seconds(3), SpawnAndMoveAlliedBaseUnits) end end) @@ -236,27 +236,27 @@ CreateDemitri = function() end) end -ticked = -1 +Ticked = -1 Tick = function() - ussr.Resources = ussr.Resources - (0.01 * ussr.ResourceCapacity / 25) + USSR.Resources = USSR.Resources - (0.01 * USSR.ResourceCapacity / 25) if InitialUnitsArrived then -- don't fail the mission straight at the beginning if not DemitriFound or not SuperTankDomeIsInfiltrated then - if player.HasNoRequiredUnits() then - player.MarkFailedObjective(EliminateSuperTanks) + if Greece.HasNoRequiredUnits() then + Greece.MarkFailedObjective(EliminateSuperTanks) end end end - if ticked > 0 then - if (ticked % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("super-tank-self-destruct-in", { ["time"] = Utils.FormatTime(ticked) }) + if Ticked > 0 then + if (Ticked % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("super-tank-self-destruct-in", { ["time"] = Utils.FormatTime(Ticked) }) UserInterface.SetMissionText(Timer, TimerColor) end - ticked = ticked - 1 - elseif ticked == 0 then + Ticked = Ticked - 1 + elseif Ticked == 0 then FinishTimer() - ticked = ticked - 1 + Ticked = Ticked - 1 end end @@ -273,67 +273,67 @@ FinishTimer = function() end SetupMission = function() - TestCamera = Actor.Create("camera" ,true , { Owner = player, Location = ProvingGroundsCameraPoint.Location }) + TestCamera = Actor.Create("camera" ,true , { Owner = Greece, Location = ProvingGroundsCameraPoint.Location }) Camera.Position = ProvingGroundsCameraPoint.CenterPosition - TimerColor = player.Color + TimerColor = Greece.Color Trigger.AfterDelay(DateTime.Seconds(12), function() - Media.PlaySpeechNotification(player, "StartGame") + Media.PlaySpeechNotification(Greece, "StartGame") Trigger.AfterDelay(DateTime.Seconds(2), SendAlliedUnits) end) end InitPlayers = function() - player = Player.GetPlayer("Greece") - neutral = Player.GetPlayer("Neutral") - outpost = Player.GetPlayer("Outpost") - badguy = Player.GetPlayer("BadGuy") - ussr = Player.GetPlayer("USSR") - ukraine = Player.GetPlayer("Ukraine") - turkey = Player.GetPlayer("Turkey") - friendlyMadTanks = Player.GetPlayer("FriendlyMadTanks") + Greece = Player.GetPlayer("Greece") + Neutral = Player.GetPlayer("Neutral") + Outpost = Player.GetPlayer("Outpost") + BadGuy = Player.GetPlayer("BadGuy") + USSR = Player.GetPlayer("USSR") + Ukraine = Player.GetPlayer("Ukraine") + Turkey = Player.GetPlayer("Turkey") + FriendlyMadTanks = Player.GetPlayer("FriendlyMadTanks") - ussr.Cash = 2000 - Trigger.AfterDelay(0, function() badguy.Resources = badguy.ResourceCapacity * 0.75 end) + USSR.Cash = 2000 + Trigger.AfterDelay(0, function() BadGuy.Resources = BadGuy.ResourceCapacity * 0.75 end) end AddObjectives = function() - InitObjectives(player) + InitObjectives(Greece) - EliminateSuperTanks = AddPrimaryObjective(player, "eliminate-super-tanks") - StealMoney = AddPrimaryObjective(player, "steal-money-outpost") - CrossRiver = AddPrimaryObjective(player, "cross-river") - FindOutpost = AddPrimaryObjective(player, "find-outpost") - RescueCivilians = AddSecondaryObjective(player, "evacuate-civilian-hospital") - BadGuyObj = AddPrimaryObjective(badguy, "") - USSRObj = AddPrimaryObjective(ussr, "") - UkraineObj = AddPrimaryObjective(ukraine, "") - TurkeyObj = AddPrimaryObjective(turkey, "") + EliminateSuperTanks = AddPrimaryObjective(Greece, "eliminate-super-tanks") + StealMoney = AddPrimaryObjective(Greece, "steal-money-outpost") + CrossRiver = AddPrimaryObjective(Greece, "cross-river") + FindOutpost = AddPrimaryObjective(Greece, "find-outpost") + RescueCivilians = AddSecondaryObjective(Greece, "evacuate-civilian-hospital") + BadGuyObj = AddPrimaryObjective(BadGuy, "") + USSRObj = AddPrimaryObjective(USSR, "") + UkraineObj = AddPrimaryObjective(Ukraine, "") + TurkeyObj = AddPrimaryObjective(Turkey, "") - Trigger.OnPlayerLost(player, function() - ussr.MarkCompletedObjective(USSRObj) - badguy.MarkCompletedObjective(BadGuyObj) - ukraine.MarkCompletedObjective(UkraineObj) - turkey.MarkCompletedObjective(TurkeyObj) + Trigger.OnPlayerLost(Greece, function() + USSR.MarkCompletedObjective(USSRObj) + BadGuy.MarkCompletedObjective(BadGuyObj) + Ukraine.MarkCompletedObjective(UkraineObj) + Turkey.MarkCompletedObjective(TurkeyObj) end) - Trigger.OnPlayerWon(player, function() + Trigger.OnPlayerWon(Greece, function() Media.DisplayMessage(UserInterface.Translate("demitri-extracted-super-tanks-destroyed")) - ussr.MarkFailedObjective(USSRObj) - badguy.MarkFailedObjective(BadGuyObj) - ukraine.MarkFailedObjective(UkraineObj) - turkey.MarkFailedObjective(TurkeyObj) + USSR.MarkFailedObjective(USSRObj) + BadGuy.MarkFailedObjective(BadGuyObj) + Ukraine.MarkFailedObjective(UkraineObj) + Turkey.MarkFailedObjective(TurkeyObj) end) end InitTriggers = function() Trigger.OnAllKilled(SuperTanks, function() - Trigger.AfterDelay(DateTime.Seconds(3), function() player.MarkCompletedObjective(EliminateSuperTanks) end) + Trigger.AfterDelay(DateTime.Seconds(3), function() Greece.MarkCompletedObjective(EliminateSuperTanks) end) end) Trigger.OnKilled(SuperTankDome, function() if not SuperTankDomeIsInfiltrated then - player.MarkFailedObjective(InfiltrateRadarDome) + Greece.MarkFailedObjective(InfiltrateRadarDome) end end) Trigger.OnInfiltrated(SuperTankDome, function() @@ -361,46 +361,46 @@ InitTriggers = function() Trigger.OnKilled(DemitriChurch, function() if not DemitriFound then - player.MarkFailedObjective(FindDemitri) + Greece.MarkFailedObjective(FindDemitri) end end) Trigger.OnKilled(Hospital, function() if not HospitalEvacuated then HospitalEvacuated = true - player.MarkFailedObjective(RescueCivilians) + Greece.MarkFailedObjective(RescueCivilians) end end) Trigger.OnInfiltrated(USSROutpostSilo, function() MoneyStolen = true - player.MarkCompletedObjective(StealMoney) + Greece.MarkCompletedObjective(StealMoney) end) Trigger.OnKilledOrCaptured(USSROutpostSilo, function() if not MoneyStolen then - player.MarkFailedObjective(StealMoney) + Greece.MarkFailedObjective(StealMoney) end end) - beachReached = false + BeachReached = false Trigger.OnEnteredFootprint(BeachTrigger, function(a, id) - if not beachReached and a.Owner == player then - beachReached = true + if not BeachReached and a.Owner == Greece then + BeachReached = true Trigger.RemoveFootprintTrigger(id) - player.MarkCompletedObjective(CrossRiver) + Greece.MarkCompletedObjective(CrossRiver) end end) - Trigger.OnPlayerDiscovered(outpost, function(_, discoverer) - if not outpostReached and discoverer == player then - outpostReached = true + Trigger.OnPlayerDiscovered(Outpost, function(_, discoverer) + if not OutpostReached and discoverer == Greece then + OutpostReached = true SetupAlliedBase() end end) Trigger.OnEnteredFootprint(DemitriAreaTrigger, function(a, id) - if not DemitriFound and a.Owner == player then + if not DemitriFound and a.Owner == Greece then DemitriFound = true Trigger.RemoveFootprintTrigger(id) CreateDemitri() @@ -408,7 +408,7 @@ InitTriggers = function() end) Trigger.OnEnteredFootprint(HospitalAreaTrigger, function(a, id) - if not HospitalEvacuated and a.Owner == player then + if not HospitalEvacuated and a.Owner == Greece then HospitalEvacuated = true Trigger.RemoveFootprintTrigger(id) EvacuateCivilians() diff --git a/mods/ra/maps/production-disruption/production-disruption.lua b/mods/ra/maps/production-disruption/production-disruption.lua index 3500e93bd2..1498bd4527 100644 --- a/mods/ra/maps/production-disruption/production-disruption.lua +++ b/mods/ra/maps/production-disruption/production-disruption.lua @@ -200,7 +200,7 @@ end UnitsArrived = false TimerFinished = false -ticked = TimerTicks +Ticked = TimerTicks Tick = function() if BadGuy.PowerState ~= "Normal" then PowerDownTeslas() @@ -210,13 +210,13 @@ Tick = function() USSR.MarkCompletedObjective(EscapeWithSub) end - if ticked > 0 then - if (ticked % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("submarine-completes-in", { ["time"] = Utils.FormatTime(ticked) }) + if Ticked > 0 then + if (Ticked % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("submarine-completes-in", { ["time"] = Utils.FormatTime(Ticked) }) UserInterface.SetMissionText(Timer, TimerColor) end - ticked = ticked - 1 - elseif ticked == 0 and not TimerFinished then + Ticked = Ticked - 1 + elseif Ticked == 0 and not TimerFinished then MissileSubEscape() TimerFinished = true end diff --git a/mods/ra/maps/sarin-gas-1-crackdown/crackdown-AI.lua b/mods/ra/maps/sarin-gas-1-crackdown/crackdown-AI.lua index 3986d110a0..e3674b3c96 100644 --- a/mods/ra/maps/sarin-gas-1-crackdown/crackdown-AI.lua +++ b/mods/ra/maps/sarin-gas-1-crackdown/crackdown-AI.lua @@ -48,11 +48,11 @@ SendBGAttackGroup = function() end ProduceBadGuyInfantry = function() - if BadGuyRax.IsDead or BadGuyRax.Owner ~= badguy then + if BadGuyRax.IsDead or BadGuyRax.Owner ~= BadGuy then return end - badguy.Build({ Utils.Random(SovietInfantry) }, function(units) + BadGuy.Build({ Utils.Random(SovietInfantry) }, function(units) table.insert(BGAttackGroup, units[1]) SendBGAttackGroup() Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceBadGuyInfantry) @@ -74,11 +74,11 @@ SendAttackGroup = function() end ProduceUSSRInfantry = function() - if USSRRax.IsDead or USSRRax.Owner ~= ussr then + if USSRRax.IsDead or USSRRax.Owner ~= USSR then return end - ussr.Build({ Utils.Random(SovietInfantry) }, function(units) + USSR.Build({ Utils.Random(SovietInfantry) }, function(units) table.insert(AttackGroup, units[1]) SendAttackGroup() Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceUSSRInfantry) @@ -86,11 +86,11 @@ ProduceUSSRInfantry = function() end ProduceVehicles = function() - if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= ussr then + if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= USSR then return end - ussr.Build({ Utils.Random(SovietVehicles) }, function(units) + USSR.Build({ Utils.Random(SovietVehicles) }, function(units) table.insert(AttackGroup, units[1]) SendAttackGroup() Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles) @@ -98,7 +98,7 @@ ProduceVehicles = function() end GroundWaves = function() - Reinforcements.Reinforce(ussr, Utils.Random(GroundAttackUnits), Utils.Random(GroundAttackPaths), 0, function(unit) + Reinforcements.Reinforce(USSR, Utils.Random(GroundAttackUnits), Utils.Random(GroundAttackPaths), 0, function(unit) unit.Hunt() end) diff --git a/mods/ra/maps/sarin-gas-1-crackdown/crackdown.lua b/mods/ra/maps/sarin-gas-1-crackdown/crackdown.lua index 804719558a..54a3f7cb5e 100644 --- a/mods/ra/maps/sarin-gas-1-crackdown/crackdown.lua +++ b/mods/ra/maps/sarin-gas-1-crackdown/crackdown.lua @@ -25,28 +25,28 @@ CombatTeam2 = SetupTriggers = function() Trigger.OnInfiltrated(RadarDome, function() - greece.MarkCompletedObjective(objRadarSpy) - Actor.Create("camera", true, { Owner = greece, Location = Cam1.Location }) - Actor.Create("camera", true, { Owner = greece, Location = Cam2.Location }) - Actor.Create("camera", true, { Owner = greece, Location = Cam3.Location }) - Actor.Create("camera", true, { Owner = greece, Location = Cam4.Location }) + Greece.MarkCompletedObjective(RadarSpyObjective) + Actor.Create("camera", true, { Owner = Greece, Location = Cam1.Location }) + Actor.Create("camera", true, { Owner = Greece, Location = Cam2.Location }) + Actor.Create("camera", true, { Owner = Greece, Location = Cam3.Location }) + Actor.Create("camera", true, { Owner = Greece, Location = Cam4.Location }) end) Trigger.OnKilled(RadarDome, function() - if not greece.IsObjectiveCompleted(objRadarSpy) then - greece.MarkFailedObjective(objRadarSpy) + if not Greece.IsObjectiveCompleted(RadarSpyObjective) then + Greece.MarkFailedObjective(RadarSpyObjective) end end) Trigger.OnAllKilled(ConvoyTrucks, function() - greece.MarkCompletedObjective(objDestroyAllTrucks) + Greece.MarkCompletedObjective(DestroyAllTrucksObjective) end) end MissionStart = function() Trigger.AfterDelay(DateTime.Seconds(1), function() - Reinforcements.Reinforce(greece, CombatTeam1, { TruckEscapeCenter.Location, DefaultCameraPosition.Location }) - local StartCamera = Actor.Create("camera", true, { Owner = greece, Location = DefaultCameraPosition.Location }) + Reinforcements.Reinforce(Greece, CombatTeam1, { TruckEscapeCenter.Location, DefaultCameraPosition.Location }) + local StartCamera = Actor.Create("camera", true, { Owner = Greece, Location = DefaultCameraPosition.Location }) Trigger.AfterDelay(DateTime.Seconds(10), function() StartCamera.Destroy() end) @@ -87,8 +87,8 @@ MissionStart = function() Trigger.AfterDelay(DateTime.Minutes(1), function() CombatTeam2 = CombatTeam2[Difficulty] - Reinforcements.Reinforce(greece, CombatTeam2, { TruckEscapeCenter.Location, DefaultCameraPosition.Location }) - Media.PlaySpeechNotification(greece, "ReinforcementsArrived") + Reinforcements.Reinforce(Greece, CombatTeam2, { TruckEscapeCenter.Location, DefaultCameraPosition.Location }) + Media.PlaySpeechNotification(Greece, "ReinforcementsArrived") end) end @@ -103,7 +103,7 @@ MoveTruckEscapeRoute = function(truck, route) return else Media.DisplayMessage(UserInterface.Translate("convoy-truck-escaping")) - Media.PlaySoundNotification(greece, "AlertBleep") + Media.PlaySoundNotification(Greece, "AlertBleep") Utils.Do(route, function(waypoint) truck.Move(waypoint.Location) end) @@ -111,7 +111,7 @@ MoveTruckEscapeRoute = function(truck, route) Trigger.OnIdle(truck, function() if truck.Location == route[#route].Location then truck.Destroy() - greece.MarkFailedObjective(objDestroyAllTrucks) + Greece.MarkFailedObjective(DestroyAllTrucksObjective) else truck.Move(route[#route].Location) end @@ -120,29 +120,29 @@ MoveTruckEscapeRoute = function(truck, route) end Tick = function() - ussr.Cash = 5000 - badguy.Cash = 5000 + USSR.Cash = 5000 + BadGuy.Cash = 5000 - if ussr.HasNoRequiredUnits() and badguy.HasNoRequiredUnits() then - greece.MarkCompletedObjective(objKillAll) + if USSR.HasNoRequiredUnits() and BadGuy.HasNoRequiredUnits() then + Greece.MarkCompletedObjective(KillAllObjective) end - if greece.HasNoRequiredUnits() then - ussr.MarkCompletedObjective(ussrObj) + if Greece.HasNoRequiredUnits() then + USSR.MarkCompletedObjective(USSRobjective) end end WorldLoaded = function() - greece = Player.GetPlayer("Greece") - ussr = Player.GetPlayer("USSR") - badguy = Player.GetPlayer("BadGuy") + Greece = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") + BadGuy = Player.GetPlayer("BadGuy") - InitObjectives(greece) + InitObjectives(Greece) - objDestroyAllTrucks = AddPrimaryObjective(greece, "prevent-soviet-trucks-escaping") - objKillAll = AddPrimaryObjective(greece, "clear-sector-soviet-presence") - objRadarSpy = AddSecondaryObjective(greece, "infiltrate-radar-reveal-escape-routes") - ussrObj = ussr.AddObjective("") + DestroyAllTrucksObjective = AddPrimaryObjective(Greece, "prevent-soviet-trucks-escaping") + KillAllObjective = AddPrimaryObjective(Greece, "clear-sector-soviet-presence") + RadarSpyObjective = AddSecondaryObjective(Greece, "infiltrate-radar-reveal-escape-routes") + USSRobjective = USSR.AddObjective("") ActivateAI() SetupTriggers() diff --git a/mods/ra/maps/sarin-gas-2-down-under/downunder.lua b/mods/ra/maps/sarin-gas-2-down-under/downunder.lua index af851861fd..be1ba8f0e1 100644 --- a/mods/ra/maps/sarin-gas-2-down-under/downunder.lua +++ b/mods/ra/maps/sarin-gas-2-down-under/downunder.lua @@ -28,49 +28,49 @@ WinTriggerArea = { CPos.New(111, 59), CPos.New(111, 60), CPos.New(111, 61), CPos ObjectiveTriggers = function() Trigger.OnEnteredFootprint(WinTriggerArea, function(a, id) - if not EscapeGoalTrigger and a.Owner == greece then + if not EscapeGoalTrigger and a.Owner == Greece then EscapeGoalTrigger = true - greece.MarkCompletedObjective(ExitBase) + Greece.MarkCompletedObjective(ExitBase) if Difficulty == "hard" then - greece.MarkCompletedObjective(NoCasualties) + Greece.MarkCompletedObjective(NoCasualties) end if not TanyaFreed then - greece.MarkFailedObjective(FreeTanya) + Greece.MarkFailedObjective(FreeTanyaObjective) else - greece.MarkCompletedObjective(FreeTanya) + Greece.MarkCompletedObjective(FreeTanyaObjective) end end end) Trigger.OnKilled(Tanya, function() - greece.MarkFailedObjective(FreeTanya) + Greece.MarkFailedObjective(FreeTanyaObjective) end) Trigger.OnAllKilled(TanyaTowers, function() TanyaFreed = true if not Tanya.IsDead then - Media.PlaySpeechNotification(greece, "TanyaRescued") - Tanya.Owner = greece + Media.PlaySpeechNotification(Greece, "TanyaRescued") + Tanya.Owner = Greece end end) Trigger.OnAllKilled(SovietImportantGuys, function() - greece.MarkCompletedObjective(KillVIPs) + Greece.MarkCompletedObjective(KillVIPs) end) Trigger.OnInfiltrated(WarFactory2, function() - if not StealMammoth.IsDead or StealMammoth.Owner == ussr then - greece.MarkCompletedObjective(StealTank) - StealMammoth.Owner = greece + if not StealMammoth.IsDead or StealMammoth.Owner == USSR then + Greece.MarkCompletedObjective(StealTank) + StealMammoth.Owner = Greece end end) end ConsoleTriggers = function() Trigger.OnEnteredProximityTrigger(Terminal1.CenterPosition, WDist.FromCells(1), function(actor, id) - if actor.Owner == greece then + if actor.Owner == Greece then Trigger.RemoveProximityTrigger(id) if not FlameTower1.IsDead then Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console")) @@ -80,7 +80,7 @@ ConsoleTriggers = function() end) Trigger.OnEnteredProximityTrigger(Terminal2.CenterPosition, WDist.FromCells(1), function(actor, id) - if actor.Owner == greece then + if actor.Owner == Greece then Trigger.RemoveProximityTrigger(id) if not FlameTower2.IsDead then Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console")) @@ -90,7 +90,7 @@ ConsoleTriggers = function() end) Trigger.OnEnteredProximityTrigger(Terminal3.CenterPosition, WDist.FromCells(1), function(actor, id) - if actor.Owner == greece then + if actor.Owner == Greece then Trigger.RemoveProximityTrigger(id) if not FlameTower3.IsDead then Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console")) @@ -101,16 +101,16 @@ ConsoleTriggers = function() local gasActive Trigger.OnEnteredProximityTrigger(Terminal4.CenterPosition, WDist.FromCells(1), function(actor, id) - if actor.Owner == greece and not gasActive then + if actor.Owner == Greece and not gasActive then Trigger.RemoveProximityTrigger(id) gasActive = true Media.DisplayMessage(UserInterface.Translate("sarin-dispenser-activated"), UserInterface.Translate("console")) - local KillCamera = Actor.Create("camera", true, { Owner = greece, Location = Sarin2.Location }) - local flare1 = Actor.Create("flare", true, { Owner = england, Location = Sarin1.Location }) - local flare2 = Actor.Create("flare", true, { Owner = england, Location = Sarin2.Location }) - local flare3 = Actor.Create("flare", true, { Owner = england, Location = Sarin3.Location }) - local flare4 = Actor.Create("flare", true, { Owner = england, Location = Sarin4.Location }) + local KillCamera = Actor.Create("camera", true, { Owner = Greece, Location = Sarin2.Location }) + local flare1 = Actor.Create("flare", true, { Owner = England, Location = Sarin1.Location }) + local flare2 = Actor.Create("flare", true, { Owner = England, Location = Sarin2.Location }) + local flare3 = Actor.Create("flare", true, { Owner = England, Location = Sarin3.Location }) + local flare4 = Actor.Create("flare", true, { Owner = England, Location = Sarin4.Location }) Trigger.AfterDelay(DateTime.Seconds(4), function() Utils.Do(SarinVictims, function(actor) if not actor.IsDead then @@ -130,7 +130,7 @@ ConsoleTriggers = function() end) Trigger.OnEnteredProximityTrigger(Terminal5.CenterPosition, WDist.FromCells(1), function(actor, id) - if actor.Owner == greece then + if actor.Owner == Greece then Trigger.RemoveProximityTrigger(id) if not BadCoil.IsDead then Media.DisplayMessage(UserInterface.Translate("tesla-coil-deactivated"), UserInterface.Translate("console")) @@ -141,13 +141,13 @@ ConsoleTriggers = function() local teslaActive Trigger.OnEnteredProximityTrigger(Terminal6.CenterPosition, WDist.FromCells(1), function(actor, id) - if actor.Owner == greece and not teslaActive then + if actor.Owner == Greece and not teslaActive then Trigger.RemoveProximityTrigger(id) teslaActive = true Media.DisplayMessage(UserInterface.Translate("tesla-coil-activated"), UserInterface.Translate("console")) - local tesla1 = Actor.Create("tsla", true, { Owner = turkey, Location = TurkeyCoil1.Location }) - local tesla2 = Actor.Create("tsla", true, { Owner = turkey, Location = TurkeyCoil2.Location }) + local tesla1 = Actor.Create("tsla", true, { Owner = Turkey, Location = TurkeyCoil1.Location }) + local tesla2 = Actor.Create("tsla", true, { Owner = Turkey, Location = TurkeyCoil2.Location }) Trigger.AfterDelay(DateTime.Seconds(10), function() if not tesla1.IsDead then tesla1.Kill() @@ -160,7 +160,7 @@ ConsoleTriggers = function() end) Trigger.OnEnteredProximityTrigger(Terminal7.CenterPosition, WDist.FromCells(1), function(actor, id) - if actor.Owner == greece then + if actor.Owner == Greece then Trigger.RemoveProximityTrigger(id) if not FlameTowerTanya1.IsDead then Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console")) @@ -174,7 +174,7 @@ ConsoleTriggers = function() end) Trigger.OnEnteredProximityTrigger(Terminal8.CenterPosition, WDist.FromCells(1), function(actor, id) - if actor.Owner == greece then + if actor.Owner == Greece then Trigger.RemoveProximityTrigger(id) if not FlameTowerExit1.IsDead then Media.DisplayMessage(UserInterface.Translate("flame-turret-deactivated"), UserInterface.Translate("console")) @@ -190,7 +190,7 @@ end CameraTriggers = function() Trigger.AfterDelay(DateTime.Seconds(1), function() - local startCamera = Actor.Create("camera", true, { Owner = greece, Location = start.Location }) + local startCamera = Actor.Create("camera", true, { Owner = Greece, Location = start.Location }) Trigger.AfterDelay(DateTime.Seconds(10), function() startCamera.Destroy() end) @@ -198,11 +198,11 @@ CameraTriggers = function() local cam1Triggered Trigger.OnEnteredProximityTrigger(CameraTrigger1.CenterPosition, WDist.FromCells(8), function(actor, id) - if actor.Owner == greece and not cam1Triggered then + if actor.Owner == Greece and not cam1Triggered then Trigger.RemoveProximityTrigger(id) cam1Triggered = true - local camera1 = Actor.Create("camera", true, { Owner = greece, Location = CameraTrigger1.Location }) + local camera1 = Actor.Create("camera", true, { Owner = Greece, Location = CameraTrigger1.Location }) Trigger.OnAllKilled(Camera1Towers, function() camera1.Destroy() end) @@ -211,11 +211,11 @@ CameraTriggers = function() local cam2Triggered Trigger.OnEnteredProximityTrigger(CameraTrigger2.CenterPosition, WDist.FromCells(8), function(actor, id) - if actor.Owner == greece and not cam2Triggered then + if actor.Owner == Greece and not cam2Triggered then Trigger.RemoveProximityTrigger(id) cam2Triggered = true - local camera2 = Actor.Create("camera", true, { Owner = greece, Location = CameraTrigger2.Location }) + local camera2 = Actor.Create("camera", true, { Owner = Greece, Location = CameraTrigger2.Location }) Utils.Do(Camera2Team, function(actor) actor.AttackMove(CameraTrigger1.Location) end) @@ -227,13 +227,13 @@ CameraTriggers = function() local cam3Triggered Trigger.OnEnteredProximityTrigger(CameraTrigger3.CenterPosition, WDist.FromCells(8), function(actor, id) - if actor.Owner == greece and not cam3Triggered then + if actor.Owner == Greece and not cam3Triggered then Trigger.RemoveProximityTrigger(id) cam3Triggered = true - local camera3 = Actor.Create("camera", true, { Owner = greece, Location = CameraTrigger3.Location }) - Actor.Create("apwr", true, { Owner = france, Location = PowerPlantSpawn1.Location }) - Actor.Create("apwr", true, { Owner = germany, Location = PowerPlantSpawn2.Location }) + local camera3 = Actor.Create("camera", true, { Owner = Greece, Location = CameraTrigger3.Location }) + Actor.Create("apwr", true, { Owner = France, Location = PowerPlantSpawn1.Location }) + Actor.Create("apwr", true, { Owner = Germany, Location = PowerPlantSpawn2.Location }) if not Mammoth1.IsDead then Mammoth1.AttackMove(MammothGo.Location) end @@ -246,11 +246,11 @@ CameraTriggers = function() local cam4Triggered Trigger.OnEnteredProximityTrigger(CameraTrigger4.CenterPosition, WDist.FromCells(9), function(actor, id) - if actor.Owner == greece and not cam4Triggered then + if actor.Owner == Greece and not cam4Triggered then Trigger.RemoveProximityTrigger(id) cam4Triggered = true - local camera4 = Actor.Create("camera", true, { Owner = greece, Location = CameraTrigger4.Location }) + local camera4 = Actor.Create("camera", true, { Owner = Greece, Location = CameraTrigger4.Location }) Trigger.OnKilled(Mammoth2, function() camera4.Destroy() end) @@ -259,11 +259,11 @@ CameraTriggers = function() local cam5Triggered Trigger.OnEnteredProximityTrigger(CameraTrigger5.CenterPosition, WDist.FromCells(8), function(actor, id) - if actor.Owner == greece and not cam5Triggered then + if actor.Owner == Greece and not cam5Triggered then Trigger.RemoveProximityTrigger(id) cam5Triggered = true - local camera5 = Actor.Create("camera", true, { Owner = greece, Location = CameraTrigger5.Location }) + local camera5 = Actor.Create("camera", true, { Owner = Greece, Location = CameraTrigger5.Location }) Trigger.AfterDelay(DateTime.Seconds(10), function() camera5.Destroy() end) @@ -272,21 +272,21 @@ CameraTriggers = function() local cam6Triggered Trigger.OnEnteredProximityTrigger(CameraTrigger6.CenterPosition, WDist.FromCells(11), function(actor, id) - if actor.Owner == greece and not cam6Triggered then + if actor.Owner == Greece and not cam6Triggered then Trigger.RemoveProximityTrigger(id) cam6Triggered = true - Actor.Create("camera", true, { Owner = greece, Location = CameraTrigger6.Location }) + Actor.Create("camera", true, { Owner = Greece, Location = CameraTrigger6.Location }) end end) local executionTriggered Trigger.OnEnteredFootprint(ExecutionArea, function(actor, id) - if actor.Owner == greece and not executionTriggered then + if actor.Owner == Greece and not executionTriggered then Trigger.RemoveFootprintTrigger(id) executionTriggered = true - local camera7 = Actor.Create("camera", true, { Owner = greece, Location = CameraTrigger7.Location }) + local camera7 = Actor.Create("camera", true, { Owner = Greece, Location = CameraTrigger7.Location }) Trigger.AfterDelay(DateTime.Seconds(25), function() camera7.Destroy() end) @@ -301,7 +301,7 @@ TruckSteal = function() if not TruckStolen and not StealTruck.IsDead then TruckStolen = true - local truckSteal1 = Actor.Create("camera", true, { Owner = greece, Location = TruckDrive1.Location }) + local truckSteal1 = Actor.Create("camera", true, { Owner = Greece, Location = TruckDrive1.Location }) Trigger.AfterDelay(DateTime.Seconds(10), function() truckSteal1.Destroy() end) @@ -326,8 +326,8 @@ TruckSteal = function() end SpyTruckDrive = function() - StealTruck = Reinforcements.Reinforce(ussr, TruckType, TruckEntry) - local truckSteal2 = Actor.Create("camera", true, { Owner = greece, Location = TruckCamera.Location }) + StealTruck = Reinforcements.Reinforce(USSR, TruckType, TruckEntry) + local truckSteal2 = Actor.Create("camera", true, { Owner = Greece, Location = TruckCamera.Location }) Trigger.AfterDelay(DateTime.Seconds(10), function() truckSteal2.Destroy() end) @@ -338,11 +338,11 @@ SpyTruckDrive = function() Trigger.RemoveFootprintTrigger(id) spyCreated = true - Spy = Actor.Create("spy", true, { Owner = greece, Location = TruckDrive5.Location }) - Spy.DisguiseAsType("e1", ussr) + Spy = Actor.Create("spy", true, { Owner = Greece, Location = TruckDrive5.Location }) + Spy.DisguiseAsType("e1", USSR) Spy.Move(SpyMove.Location) - local dogCrewCamera = Actor.Create("camera", true, { Owner = greece, Location = DoggyCam.Location }) + local dogCrewCamera = Actor.Create("camera", true, { Owner = Greece, Location = DoggyCam.Location }) Trigger.AfterDelay(DateTime.Seconds(10), function() dogCrewCamera.Destroy() end) @@ -367,13 +367,13 @@ PrisonEscape = function() Trigger.RemoveFootprintTrigger(id) Media.DisplayMessage(UserInterface.Translate("prisoners-escaping"), UserInterface.Translate("intercom")) - Media.PlaySoundNotification(greece, "AlertBuzzer") + Media.PlaySoundNotification(Greece, "AlertBuzzer") Utils.Do(GuardDogs, IdleHunt) end) end ScientistExecution = function() - Media.PlaySoundNotification(greece, "AlertBleep") + Media.PlaySoundNotification(Greece, "AlertBleep") Media.DisplayMessage(UserInterface.Translate("hurry-base-compromised"), UserInterface.Translate("soviet-officer")) Utils.Do(DemoTeam, function(actor) actor.AttackMove(DemoDrive2.Location) @@ -440,35 +440,35 @@ end AcceptableLosses = 0 Tick = function() - if greece.HasNoRequiredUnits() then - greece.MarkFailedObjective(ExitBase) + if Greece.HasNoRequiredUnits() then + Greece.MarkFailedObjective(ExitBase) end - if Difficulty == "hard" and greece.UnitsLost > AcceptableLosses then - greece.MarkFailedObjective(NoCasualties) + if Difficulty == "hard" and Greece.UnitsLost > AcceptableLosses then + Greece.MarkFailedObjective(NoCasualties) end end WorldLoaded = function() - greece = Player.GetPlayer("Greece") - england = Player.GetPlayer("England") - turkey = Player.GetPlayer("Turkey") - ussr = Player.GetPlayer("USSR") - france = Player.GetPlayer("France") - germany = Player.GetPlayer("Germany") + Greece = Player.GetPlayer("Greece") + England = Player.GetPlayer("England") + Turkey = Player.GetPlayer("Turkey") + USSR = Player.GetPlayer("USSR") + France = Player.GetPlayer("France") + Germany = Player.GetPlayer("Germany") - InitObjectives(greece) + InitObjectives(Greece) - ussrObj = ussr.AddObjective("") - ExitBase = AddPrimaryObjective(greece, "reach-eastern-exit") - FreeTanya = AddPrimaryObjective(greece, "free-tanya-keep-alive") - KillVIPs = AddSecondaryObjective(greece, "kill-soviet-officers-scientists") - StealTank = AddSecondaryObjective(greece, "steal-soviet-mammoth-tank") + USSRobjective = USSR.AddObjective("") + ExitBase = AddPrimaryObjective(Greece, "reach-eastern-exit") + FreeTanyaObjective = AddPrimaryObjective(Greece, "free-tanya-keep-alive") + KillVIPs = AddSecondaryObjective(Greece, "kill-soviet-officers-scientists") + StealTank = AddSecondaryObjective(Greece, "steal-soviet-mammoth-tank") if Difficulty == "hard" then - NoCasualties = AddPrimaryObjective(greece, "no-casualties") + NoCasualties = AddPrimaryObjective(Greece, "no-casualties") end - StartSpy.DisguiseAsType("e1", ussr) + StartSpy.DisguiseAsType("e1", USSR) StartAttacker1.AttackMove(start.Location) StartAttacker2.AttackMove(start.Location) diff --git a/mods/ra/maps/shock-therapy/shock-therapy.lua b/mods/ra/maps/shock-therapy/shock-therapy.lua index 6bc0602704..47e15588ea 100644 --- a/mods/ra/maps/shock-therapy/shock-therapy.lua +++ b/mods/ra/maps/shock-therapy/shock-therapy.lua @@ -44,10 +44,10 @@ MissionStart = function() TroopsArrived = true end) - InfantryProduction() + ProduceInfantry() end -InfantryProduction = function() +ProduceInfantry = function() if (SETent1.IsDead or SETent1.Owner ~= Greece) and (SETent2.IsDead or SETent2.Owner ~= Greece) then return end @@ -56,7 +56,7 @@ InfantryProduction = function() Greece.Build(toBuild, function(unit) IdlingUnits[#IdlingUnits + 1] = unit[1] - Trigger.AfterDelay(InfantryDelay, InfantryProduction) + Trigger.AfterDelay(InfantryDelay, ProduceInfantry) if #IdlingUnits >= (AttackGroupSize * 1.5) then SendAttack() diff --git a/mods/ra/maps/siberian-conflict-1-fresh-tracks/fresh-tracks.lua b/mods/ra/maps/siberian-conflict-1-fresh-tracks/fresh-tracks.lua index ff6497f93c..8cb7354983 100644 --- a/mods/ra/maps/siberian-conflict-1-fresh-tracks/fresh-tracks.lua +++ b/mods/ra/maps/siberian-conflict-1-fresh-tracks/fresh-tracks.lua @@ -217,16 +217,16 @@ FinishTimer = function() Trigger.AfterDelay(DateTime.Seconds(6), function() UserInterface.SetMissionText("") end) end -ticked = TimerTicks +Ticked = TimerTicks ConvoysSent = false Tick = function() - if ticked > 0 then - if (ticked % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("first-trucks-arrive-in", { ["time"] = Utils.FormatTime(ticked) }) + if Ticked > 0 then + if (Ticked % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("first-trucks-arrive-in", { ["time"] = Utils.FormatTime(Ticked) }) UserInterface.SetMissionText(Timer, TimerColor) end - ticked = ticked - 1 - elseif ticked == 0 and not ConvoysSent then + Ticked = Ticked - 1 + elseif Ticked == 0 and not ConvoysSent then SendConvoys() FinishTimer() end diff --git a/mods/ra/maps/situation-critical/situation-critical.lua b/mods/ra/maps/situation-critical/situation-critical.lua index 002fbd772c..404471684b 100644 --- a/mods/ra/maps/situation-critical/situation-critical.lua +++ b/mods/ra/maps/situation-critical/situation-critical.lua @@ -150,19 +150,19 @@ SendInVolkov = function() end end -ticked = TimerTicks +Ticked = TimerTicks Tick = function() if Turkey.PowerState ~= "Normal" then SendInVolkov() end - if ticked > 0 then - if (ticked % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("missiles-launch-in", { ["time"] = Utils.FormatTime(ticked) }) + if Ticked > 0 then + if (Ticked % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("missiles-launch-in", { ["time"] = Utils.FormatTime(Ticked) }) UserInterface.SetMissionText(Timer, TimerColor) end - ticked = ticked - 1 - elseif ticked == 0 then + Ticked = Ticked - 1 + elseif Ticked == 0 then UserInterface.SetMissionText(UserInterface.Translate("too-late"), USSR.Color) Turkey.MarkCompletedObjective(LaunchMissles) end diff --git a/mods/ra/maps/soviet-01/soviet01.lua b/mods/ra/maps/soviet-01/soviet01.lua index 9376c9edc8..77561fc775 100644 --- a/mods/ra/maps/soviet-01/soviet01.lua +++ b/mods/ra/maps/soviet-01/soviet01.lua @@ -14,7 +14,7 @@ InsertYaks = function() Utils.Do(Yaks, function(yakType) local start = YakEntry.CenterPosition + WVec.New(0, (i - 1) * 1536, Actor.CruiseAltitude(yakType)) local dest = StartJeep.Location + CVec.New(0, 2 * i) - local yak = Actor.Create(yakType, true, { CenterPosition = start, Owner = player, Facing = (Map.CenterOfCell(dest) - start).Facing }) + local yak = Actor.Create(yakType, true, { CenterPosition = start, Owner = USSR, Facing = (Map.CenterOfCell(dest) - start).Facing }) yak.Move(dest) yak.ReturnToBase(Airfields[i]) i = i + 1 @@ -25,7 +25,7 @@ JeepDemolishingBridge = function() StartJeep.Move(StartJeepMovePoint.Location) Trigger.OnEnteredFootprint({ StartJeepMovePoint.Location }, function(actor, id) - if actor.Owner == france and not BridgeBarrel.IsDead then + if actor.Owner == France and not BridgeBarrel.IsDead then Trigger.RemoveFootprintTrigger(id) BridgeBarrel.Kill() end @@ -41,24 +41,24 @@ end Paratroopers = function() Trigger.OnKilled(StartJeep, function() - Media.PlaySpeechNotification(player, "ReinforcementsArrived") + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") Paradrop.TargetParatroopers(StartJeepMovePoint.CenterPosition, Angle.East) end) Trigger.OnKilled(Church, function() - Media.PlaySpeechNotification(player, "ReinforcementsArrived") + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") Paradrop.TargetParatroopers(StartJeepMovePoint.CenterPosition, Angle.East) end) Trigger.OnKilled(ParaHut, function() - Media.PlaySpeechNotification(player, "ReinforcementsArrived") + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") Paradrop.TargetParatroopers(StartJeepMovePoint.CenterPosition, Angle.East) end) end PanicAttack = function() if not HouseDamaged then - local panicTeam = Reinforcements.Reinforce(france, { "c3", "c6", "c9" }, { CivSpawn.Location }, 0) + local panicTeam = Reinforcements.Reinforce(France, { "c3", "c6", "c9" }, { CivSpawn.Location }, 0) Utils.Do(panicTeam, function(a) a.Move(a.Location + CVec.New(-1,-1)) a.Panic() @@ -68,21 +68,21 @@ PanicAttack = function() end WorldLoaded = function() - player = Player.GetPlayer("USSR") - france = Player.GetPlayer("France") - germany = Player.GetPlayer("Germany") + USSR = Player.GetPlayer("USSR") + France = Player.GetPlayer("France") + Germany = Player.GetPlayer("Germany") - InitObjectives(player) + InitObjectives(USSR) - VillageRaidObjective = AddPrimaryObjective(player, "raze-village") + VillageRaidObjective = AddPrimaryObjective(USSR, "raze-village") Trigger.OnAllRemovedFromWorld(Airfields, function() - player.MarkFailedObjective(VillageRaidObjective) + USSR.MarkFailedObjective(VillageRaidObjective) end) JeepDemolishingBridge() - Paradrop = Actor.Create("powerproxy.paratroopers", false, { Owner = player }) + Paradrop = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR }) Trigger.AfterDelay(DateTime.Seconds(2), InsertYaks) Paratroopers() Trigger.OnDamaged(HayHouse, PanicAttack) @@ -99,7 +99,7 @@ WorldLoaded = function() end Tick = function() - if france.HasNoRequiredUnits() and germany.HasNoRequiredUnits() then - player.MarkCompletedObjective(VillageRaidObjective) + if France.HasNoRequiredUnits() and Germany.HasNoRequiredUnits() then + USSR.MarkCompletedObjective(VillageRaidObjective) end end diff --git a/mods/ra/maps/soviet-02a/soviet02a.lua b/mods/ra/maps/soviet-02a/soviet02a.lua index e6597111ad..18c72d3762 100644 --- a/mods/ra/maps/soviet-02a/soviet02a.lua +++ b/mods/ra/maps/soviet-02a/soviet02a.lua @@ -39,7 +39,7 @@ ProduceInfantry = function() return end - greece.Build({ Utils.Random(AlliedInfantry) }, function(units) + Greece.Build({ Utils.Random(AlliedInfantry) }, function(units) table.insert(AttackGroup, units[1]) SendAttackGroup() Trigger.AfterDelay(DateTime.Seconds(10), ProduceInfantry) @@ -47,29 +47,29 @@ ProduceInfantry = function() end WorldLoaded = function() - player = Player.GetPlayer("USSR") - greece = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") + Greece = Player.GetPlayer("Greece") - InitObjectives(player) + InitObjectives(USSR) - CommandCenterIntact = AddPrimaryObjective(player, "protect-command-center") - DestroyAllAllied = AddPrimaryObjective(player, "destroy-allied-units-structures") + CommandCenterIntact = AddPrimaryObjective(USSR, "protect-command-center") + DestroyAllAllied = AddPrimaryObjective(USSR, "destroy-allied-units-structures") Camera.Position = CameraWaypoint.CenterPosition Trigger.OnKilled(CommandCenter, function() - player.MarkFailedObjective(CommandCenterIntact) + USSR.MarkFailedObjective(CommandCenterIntact) end) Trigger.AfterDelay(0, function() - local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == greece and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == Greece and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) Trigger.OnDamaged(actor, function(building, attacker) - if building.Owner == greece and building.Health < building.MaxHealth * 0.8 then + if building.Owner == Greece and building.Health < building.MaxHealth * 0.8 then building.StartBuildingRepairs() if attacker.Type ~= "yak" and not AlreadyHunting then AlreadyHunting = true - Utils.Do(greece.GetGroundAttackers(), function(unit) + Utils.Do(Greece.GetGroundAttackers(), function(unit) Trigger.OnIdle(unit, unit.Hunt) end) end @@ -78,15 +78,15 @@ WorldLoaded = function() end) -- Find the bridge actors - bridgepart1 = Map.ActorsInBox(Box1.CenterPosition, Box2.CenterPosition, function(self) return self.Type == "br1" end)[1] - bridgepart2 = Map.ActorsInBox(Box1.CenterPosition, Box2.CenterPosition, function(self) return self.Type == "br2" end)[1] + BridgePart1 = Map.ActorsInBox(Box1.CenterPosition, Box2.CenterPosition, function(self) return self.Type == "br1" end)[1] + BridgePart2 = Map.ActorsInBox(Box1.CenterPosition, Box2.CenterPosition, function(self) return self.Type == "br2" end)[1] end) -- Discover the area around the bridge exposing the two german soldiers -- When the two infantry near the bridge are discovered move them across the bridge to waypoint4 -- in the meanwhile one USSR soldier hunts them down Trigger.AfterDelay(DateTime.Seconds(1), function() - Actor.Create("camera", true, { Owner = player, Location = Box1.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = Box1.Location }) Utils.Do(FleeingUnits, function(unit) unit.Move(RifleRetreat.Location) @@ -97,21 +97,21 @@ WorldLoaded = function() -- To make it look more smooth we will blow up the bridge when the barrel closest to it blows up Trigger.OnAnyKilled({ BridgeBarrel1, BridgeBarrel2 }, function() -- Destroy the bridge - if not bridgepart1.IsDead then - bridgepart1.Kill() + if not BridgePart1.IsDead then + BridgePart1.Kill() end - if not bridgepart2.IsDead then - bridgepart2.Kill() + if not BridgePart2.IsDead then + BridgePart2.Kill() end end) -- If player passes over the bridge, blow up the barrel and destroy the bridge Trigger.OnEnteredFootprint(PassingBridgeLocation, function(unit, id) - if unit.Owner == player then + if unit.Owner == USSR then Trigger.RemoveFootprintTrigger(id) -- Also don't if the bridge is already dead - if bridgepart1.IsDead and bridgepart2.IsDead then + if BridgePart1.IsDead and BridgePart2.IsDead then return end @@ -140,27 +140,27 @@ WorldLoaded = function() -- When destroying the allied radar dome or the refinery drop 2 badgers with 5 grenadiers each Trigger.OnAnyKilled({ AlliedDome, AlliedProc }, function() - local powerproxy = Actor.Create("powerproxy.paratroopers", true, { Owner = player }) + local powerproxy = Actor.Create("powerproxy.paratroopers", true, { Owner = USSR }) powerproxy.TargetParatroopers(ParadropLZ.CenterPosition, Angle.South) powerproxy.TargetParatroopers(ParadropLZ.CenterPosition, Angle.SouthEast) powerproxy.Destroy() end) - greece.Resources = 2000 + Greece.Resources = 2000 Trigger.AfterDelay(DateTime.Seconds(30), ProduceInfantry) end Tick = function() - if greece.HasNoRequiredUnits() then - player.MarkCompletedObjective(CommandCenterIntact) - player.MarkCompletedObjective(DestroyAllAllied) + if Greece.HasNoRequiredUnits() then + USSR.MarkCompletedObjective(CommandCenterIntact) + USSR.MarkCompletedObjective(DestroyAllAllied) end - if player.HasNoRequiredUnits() then - player.MarkFailedObjective(DestroyAllAllied) + if USSR.HasNoRequiredUnits() then + USSR.MarkFailedObjective(DestroyAllAllied) end - if greece.Resources > greece.ResourceCapacity / 2 then - greece.Resources = greece.ResourceCapacity / 2 + if Greece.Resources > Greece.ResourceCapacity / 2 then + Greece.Resources = Greece.ResourceCapacity / 2 end end diff --git a/mods/ra/maps/soviet-02b/soviet02b.lua b/mods/ra/maps/soviet-02b/soviet02b.lua index 210bd8d129..776d2f90cb 100644 --- a/mods/ra/maps/soviet-02b/soviet02b.lua +++ b/mods/ra/maps/soviet-02b/soviet02b.lua @@ -41,7 +41,7 @@ ProduceInfantry = function() return end - enemy.Build({ Utils.Random(AlliedInfantry) }, function(units) + Greece.Build({ Utils.Random(AlliedInfantry) }, function(units) table.insert(AttackGroup, units[1]) SendAttackGroup() Trigger.AfterDelay(DateTime.Seconds(10), ProduceInfantry) @@ -49,54 +49,54 @@ ProduceInfantry = function() end SendUSSRParadrops = function() - paraproxy1 = Actor.Create("powerproxy.paratroopers", false, { Owner = player }) + local paraproxy1 = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR }) paraproxy1.TargetParatroopers(ParachuteBaseEntrance.CenterPosition, Angle.North) paraproxy1.Destroy() end SendUSSRParadropsBase = function() - paraproxy2 = Actor.Create("powerproxy.paratroopers2", false, { Owner = player }) + local paraproxy2 = Actor.Create("powerproxy.paratroopers2", false, { Owner = USSR }) paraproxy2.TargetParatroopers(ParachuteBase1.CenterPosition, Angle.East) paraproxy2.Destroy() - paraproxy3 = Actor.Create("powerproxy.paratroopers3", false, { Owner = player }) + local paraproxy3 = Actor.Create("powerproxy.paratroopers3", false, { Owner = USSR }) paraproxy3.TargetParatroopers(ParachuteBase2.CenterPosition, Angle.East) paraproxy3.Destroy() end -Trigger.OnEnteredFootprint(BridgeShroudTrigger, function(a, id) - if not bridgeShroudTrigger and a.Owner == player then - bridgeShroudTrigger = true - local cameraBridge = Actor.Create("camera", true, { Owner = player, Location = CameraBridge.Location }) +Trigger.OnEnteredFootprint(BridgeShroudTrigger, function(a) + if not BridgeShroudTriggered and a.Owner == USSR then + BridgeShroudTriggered = true + local cameraBridge = Actor.Create("camera", true, { Owner = USSR, Location = CameraBridge.Location }) Trigger.AfterDelay(DateTime.Seconds(15), function() cameraBridge.Destroy() end) end end) -Trigger.OnEnteredFootprint(BridgeExplosionTrigger, function(a, id) - if not bridgeExplosionTrigger and a.Owner == player then - bridgeExplosionTrigger = true +Trigger.OnEnteredFootprint(BridgeExplosionTrigger, function(a) + if not BridgeExplosionTriggered and a.Owner == USSR then + BridgeExplosionTriggered = true if not BarrelBridge.IsDead then BarrelBridge.Kill() end end end) -Trigger.OnEnteredFootprint(EnemyBaseEntranceShroudTrigger, function(a, id) - if not enemyBaseEntranceShroudTrigger and a.Owner == player then - enemyBaseEntranceShroudTrigger = true - local cameraBaseEntrance = Actor.Create("camera", true, { Owner = player, Location = CameraBaseEntrance.Location }) +Trigger.OnEnteredFootprint(EnemyBaseEntranceShroudTrigger, function(a) + if not EnemyBaseEntranceShroudTriggered and a.Owner == USSR then + EnemyBaseEntranceShroudTriggered = true + local cameraBaseEntrance = Actor.Create("camera", true, { Owner = USSR, Location = CameraBaseEntrance.Location }) Trigger.AfterDelay(DateTime.Seconds(15), function() cameraBaseEntrance.Destroy() end) end end) -Trigger.OnEnteredFootprint(EnemyBaseShroudTrigger, function(a, id) - if not enemyBaseShroudTrigger and a.Owner == player then - enemyBaseShroudTrigger = true - local cameraBase1 = Actor.Create("camera", true, { Owner = player, Location = CameraBase1.Location }) - local cameraBase2 = Actor.Create("camera", true, { Owner = player, Location = CameraBase2.Location }) +Trigger.OnEnteredFootprint(EnemyBaseShroudTrigger, function(a) + if not EnemyBaseShroudTriggered and a.Owner == USSR then + EnemyBaseShroudTriggered = true + local cameraBase1 = Actor.Create("camera", true, { Owner = USSR, Location = CameraBase1.Location }) + local cameraBase2 = Actor.Create("camera", true, { Owner = USSR, Location = CameraBase2.Location }) Trigger.AfterDelay(DateTime.Seconds(15), function() cameraBase1.Destroy() cameraBase2.Destroy() @@ -104,17 +104,17 @@ Trigger.OnEnteredFootprint(EnemyBaseShroudTrigger, function(a, id) end end) -Trigger.OnEnteredFootprint(ParachuteTrigger, function(a, id) - if not parachuteTrigger and a.Owner == player then - parachuteTrigger = true +Trigger.OnEnteredFootprint(ParachuteTrigger, function(a) + if not ParachuteTriggered and a.Owner == USSR then + ParachuteTriggered = true SendUSSRParadrops() - Media.PlaySpeechNotification(player, "ReinforcementsArrived") + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") end end) Trigger.OnEnteredFootprint(TransportTrigger, function(a, id) - if not transportTrigger and a.Type == "truk" then - transportTrigger = true + if not TransportTriggered and a.Type == "truk" then + TransportTriggered = true if not TransportTruck.IsDead then TransportTruck.Wait(DateTime.Seconds(5)) TransportTruck.Move(TransportWaypoint2.Location) @@ -124,14 +124,14 @@ Trigger.OnEnteredFootprint(TransportTrigger, function(a, id) TransportTruck.Move(TransportWaypoint1.Location) end Trigger.AfterDelay(DateTime.Seconds(10), function() - transportTrigger = false + TransportTriggered = false end) end end) Trigger.OnKilled(BarrelBase, function() SendUSSRParadropsBase() - Media.PlaySpeechNotification(player, "ReinforcementsArrived") + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") end) Trigger.OnKilled(BarrelBridge, function() @@ -142,64 +142,64 @@ Trigger.OnKilled(BarrelBridge, function() end) Trigger.OnKilled(Church1, function() - Actor.Create("moneycrate", true, { Owner = player, Location = TransportWaypoint3.Location }) + Actor.Create("moneycrate", true, { Owner = USSR, Location = TransportWaypoint3.Location }) end) Trigger.OnKilled(Church2, function() - Actor.Create("healcrate", true, { Owner = player, Location = Church2.Location }) + Actor.Create("healcrate", true, { Owner = USSR, Location = Church2.Location }) end) Trigger.OnKilled(ForwardCommand, function() - enemy.MarkCompletedObjective(alliedObjective) + Greece.MarkCompletedObjective(AlliedObjective) end) Trigger.OnKilled(IntroSoldier1, function() - local cameraIntro = Actor.Create("camera", true, { Owner = player, Location = CameraStart.Location }) + local cameraIntro = Actor.Create("camera", true, { Owner = USSR, Location = CameraStart.Location }) Trigger.AfterDelay(DateTime.Seconds(15), function() cameraIntro.Destroy() end) end) WorldLoaded = function() - player = Player.GetPlayer("USSR") - enemy = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") + Greece = Player.GetPlayer("Greece") Utils.Do(IntroAttackers, function(actor) if not actor.IsDead then Trigger.OnIdle(actor, actor.Hunt) end end) Trigger.AfterDelay(0, function() - local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == enemy and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == Greece and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) - Trigger.OnDamaged(actor, function(building, attacker) - if building.Owner == enemy and building.Health < building.MaxHealth * 0.8 then + Trigger.OnDamaged(actor, function(building) + if building.Owner == Greece and building.Health < building.MaxHealth * 0.8 then building.StartBuildingRepairs() end end) end) end) - InitObjectives(player) - alliedObjective = AddPrimaryObjective(enemy, "") - sovietObjective1 = AddPrimaryObjective(player, "protect-command-center") - sovietObjective2 = AddPrimaryObjective(player, "destroy-allied-units-structures") + InitObjectives(USSR) + AlliedObjective = AddPrimaryObjective(Greece, "") + SovietObjective1 = AddPrimaryObjective(USSR, "protect-command-center") + SovietObjective2 = AddPrimaryObjective(USSR, "destroy-allied-units-structures") - enemy.Resources = 2000 + Greece.Resources = 2000 Trigger.AfterDelay(DateTime.Seconds(30), ProduceInfantry) end Tick = function() - if player.HasNoRequiredUnits() then - enemy.MarkCompletedObjective(alliedObjective) + if USSR.HasNoRequiredUnits() then + Greece.MarkCompletedObjective(AlliedObjective) end - if enemy.HasNoRequiredUnits() then - player.MarkCompletedObjective(sovietObjective1) - player.MarkCompletedObjective(sovietObjective2) + if Greece.HasNoRequiredUnits() then + USSR.MarkCompletedObjective(SovietObjective1) + USSR.MarkCompletedObjective(SovietObjective2) end - if enemy.Resources >= enemy.ResourceCapacity * 0.75 then - enemy.Cash = enemy.Cash + enemy.Resources - enemy.ResourceCapacity * 0.25 - enemy.Resources = enemy.ResourceCapacity * 0.25 + if Greece.Resources >= Greece.ResourceCapacity * 0.75 then + Greece.Cash = Greece.Cash + Greece.Resources - Greece.ResourceCapacity * 0.25 + Greece.Resources = Greece.ResourceCapacity * 0.25 end end diff --git a/mods/ra/maps/soviet-03/soviet03.lua b/mods/ra/maps/soviet-03/soviet03.lua index 0c0ceb1cdb..44d973d647 100644 --- a/mods/ra/maps/soviet-03/soviet03.lua +++ b/mods/ra/maps/soviet-03/soviet03.lua @@ -7,11 +7,11 @@ information, see COPYING. ]] if Difficulty == "easy" then - remainingTime = DateTime.Minutes(7) + RemainingTime = DateTime.Minutes(7) elseif Difficulty == "normal" then - remainingTime = DateTime.Minutes(6) + RemainingTime = DateTime.Minutes(6) elseif Difficulty == "hard" then - remainingTime = DateTime.Minutes(5) + RemainingTime = DateTime.Minutes(5) end USSRReinforcements1 = { "dog", "dog", "dog", "dog", "dog" } @@ -39,19 +39,19 @@ RTrapTrigger = { CPos.New(46, 34), CPos.New(47, 35), CPos.New(48, 36), CPos.New( SpyHideout4Trigger = { CPos.New(41, 34), CPos.New(41, 35), CPos.New(41, 36), CPos.New(41, 37), CPos.New(41, 38) } IntroSequence = function() - TheSpy.DisguiseAsType("e1", player) - Actor.Create("camera", true, { Owner = player, Location = Playerbase.Location }) - Actor.Create("camera", true, { Owner = player, Location = IntroCamera.Location }) - Actor.Create("camera", true, { Owner = player, Location = FarmArea.Location }) + TheSpy.DisguiseAsType("e1", USSR) + Actor.Create("camera", true, { Owner = USSR, Location = Playerbase.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = IntroCamera.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = FarmArea.Location }) if not TheSpy.IsDead then TheSpy.Move(SpyWaypoint1.Location) TheSpy.Move(SpyWaypoint2.Location) end Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySoundNotification(player, "sking") + Media.PlaySoundNotification(USSR, "sking") end) Trigger.AfterDelay(DateTime.Seconds(2), function() - Media.PlaySpeechNotification(player, "ExplosiveChargePlaced") + Media.PlaySpeechNotification(USSR, "ExplosiveChargePlaced") end) Trigger.AfterDelay(DateTime.Seconds(4), function() if not RSoldier1.IsDead and not BaseBarrel1.IsDead then @@ -82,20 +82,20 @@ IntroSequence = function() end end) Trigger.AfterDelay(DateTime.Seconds(8), function() - Dogs = Reinforcements.Reinforce(player, USSRReinforcements1, { ReinforcementSpawn.Location, ReinforcementGoal.Location }, 0) - Media.PlaySpeechNotification(player, "ReinforcementsArrived") - timerstarted = true + Dogs = Reinforcements.Reinforce(USSR, USSRReinforcements1, { ReinforcementSpawn.Location, ReinforcementGoal.Location }, 0) + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") + TimerStarted = true end) Trigger.AfterDelay(DateTime.Seconds(9), function() - Media.PlaySoundNotification(player, "AlertBleep") + Media.PlaySoundNotification(USSR, "AlertBleep") end) Trigger.AfterDelay(DateTime.Seconds(10), function() - Media.PlaySpeechNotification(player, "TimerStarted") + Media.PlaySpeechNotification(USSR, "TimerStarted") end) end SendUSSRParadrops = function() - paraproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = player }) + local paraproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR }) paraproxy.TargetParatroopers(ReinforcementDropOff.CenterPosition, Angle.North) paraproxy.Destroy() end @@ -112,11 +112,11 @@ SpyFinalSequency = function() end SpyHelicopterEscape = function() - if not spyHelicopterEscape then - spyHelicopterEscape = true + if not SpyHelicopterEscaped then + SpyHelicopterEscaped = true SpyFinalSequency() - Actor.Create("camera", true, { Owner = player, Location = CameraFinalArea.Location }) - ExtractionHeli = Reinforcements.ReinforceWithTransport(greece, ExtractionHeliType, nil, ExtractionPath)[1] + Actor.Create("camera", true, { Owner = USSR, Location = CameraFinalArea.Location }) + ExtractionHeli = Reinforcements.ReinforceWithTransport(Greece, ExtractionHeliType, nil, ExtractionPath)[1] local exitPos = CPos.New(ExtractionPath[1].X, ExtractionPath[2].Y) Trigger.AfterDelay(DateTime.Seconds(5), function() if not TheSpy.IsDead and not ExtractionHeli.IsDead then @@ -129,22 +129,22 @@ SpyHelicopterEscape = function() end end) Trigger.AfterDelay(DateTime.Seconds(12), function() - enemy.MarkCompletedObjective(alliedObjective) + England.MarkCompletedObjective(AlliedObjective) end) end end Trigger.OnAllKilled(Farmers, function() - Reinforcements.Reinforce(player, USSRReinforcementsFarm, { FarmSpawn.Location, FarmArea.Location }, 0) - player.MarkCompletedObjective(sovietObjective2) + Reinforcements.Reinforce(USSR, USSRReinforcementsFarm, { FarmSpawn.Location, FarmArea.Location }, 0) + USSR.MarkCompletedObjective(SovietObjective2) end) Trigger.OnAllKilled(RedBuildings, function() - player.MarkCompletedObjective(sovietObjective3) + USSR.MarkCompletedObjective(SovietObjective3) end) Trigger.OnAnyKilled(BarrierSoldiers, function() - if barrier1Trigger then + if Barrier1Triggered then Utils.Do(BarrierSoldiers, function(actor) if not actor.IsDead then Trigger.OnIdle(actor, actor.Hunt) @@ -154,10 +154,10 @@ Trigger.OnAnyKilled(BarrierSoldiers, function() end) Trigger.OnEnteredFootprint(SpyHideout1Trigger, function(a, id) - if not spyHideout1Trigger and a.Owner == player then - spyHideout1Trigger = true + if not SpyHideout1Triggered and a.Owner == USSR then + SpyHideout1Triggered = true Trigger.RemoveFootprintTrigger(id) - Actor.Create("camera", true, { Owner = player, Location = SpyHideout1.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = SpyHideout1.Location }) if not TheSpy.IsDead and not SpyHideout1.IsDead then TheSpy.EnterTransport(SpyHideout1) end @@ -165,11 +165,11 @@ Trigger.OnEnteredFootprint(SpyHideout1Trigger, function(a, id) end) Trigger.OnEnteredFootprint(SpyHideout2PathTrigger, function(a, id) - if not spyHideout2PathTrigger and a.Owner == player then - spyHideout2PathTrigger = true + if not SpyHideout2PathTriggered and a.Owner == USSR then + SpyHideout2PathTriggered = true Trigger.RemoveFootprintTrigger(id) - Actor.Create("camera", true, { Owner = player, Location = CameraSpyVillage.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraVillage.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraSpyVillage.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraVillage.Location }) if not TheSpy.IsDead and not SpyHideout2.IsDead then TheSpy.EnterTransport(SpyHideout2) end @@ -177,10 +177,10 @@ Trigger.OnEnteredFootprint(SpyHideout2PathTrigger, function(a, id) end) Trigger.OnEnteredFootprint(SpyHideout2Trigger, function(a, id) - if not spyHideout2Trigger and a.Owner == player then - spyHideout2Trigger = true - SpyGuards1 = Reinforcements.Reinforce(greece, EnemyReinforcements1SpyHideout2, { EnemyReinforcements1.Location, EnemyReinforcements1Goal.Location }, 0) - SpyGuards2 = Reinforcements.Reinforce(greece, EnemyReinforcements2SpyHideout2, { EnemyReinforcements2.Location, EnemyReinforcements2Goal.Location }, 0) + if not SpyHideout2Triggered and a.Owner == USSR then + SpyHideout2Triggered = true + SpyGuards1 = Reinforcements.Reinforce(Greece, EnemyReinforcements1SpyHideout2, { EnemyReinforcements1.Location, EnemyReinforcements1Goal.Location }, 0) + SpyGuards2 = Reinforcements.Reinforce(Greece, EnemyReinforcements2SpyHideout2, { EnemyReinforcements2.Location, EnemyReinforcements2Goal.Location }, 0) Utils.Do(SpyGuards1, function(actor) if not actor.IsDead then Trigger.OnIdle(actor, actor.Hunt) @@ -203,22 +203,22 @@ Trigger.OnEnteredFootprint(SpyHideout2Trigger, function(a, id) end) Trigger.AfterDelay(DateTime.Seconds(7), function() SendUSSRParadrops() - Media.PlaySpeechNotification(player, "ReinforcementsArrived") + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") end) end end) Trigger.OnEnteredFootprint(SpyTransport1CheckpointTrigger, function(a, id) - if not spyTransport1CheckpointTrigger and a.Owner == enemy then - spyTransport1CheckpointTrigger = true + if not SpyTransport1CheckpointTriggered and a.Owner == England then + SpyTransport1CheckpointTriggered = true Trigger.AfterDelay(DateTime.Seconds(2), function() - Actor.Create("camera", true, { Owner = player, Location = CameraWater1.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraWater2.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraWater3.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraWater4.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraWater5.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraWater6.Location }) - Actor.Create("camera", true, { Owner = player, Location = TransportPath2.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraWater1.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraWater2.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraWater3.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraWater4.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraWater5.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraWater6.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = TransportPath2.Location }) if not Transport.IsDead then Transport.Wait(25) Transport.Move(TransportPath2Water.Location) @@ -228,8 +228,8 @@ Trigger.OnEnteredFootprint(SpyTransport1CheckpointTrigger, function(a, id) end) Trigger.OnEnteredFootprint(SpyTransport2CheckpointTrigger, function(a, id) - if not spyTransport2CheckpointTrigger and a.Owner == greece then - spyTransport2CheckpointTrigger = true + if not SpyTransport2CheckpointTriggered and a.Owner == Greece then + SpyTransport2CheckpointTriggered = true Transport.UnloadPassengers() Trigger.AfterDelay(DateTime.Seconds(1), function() if not TheSpy.IsDead then @@ -246,35 +246,35 @@ Trigger.OnEnteredFootprint(SpyTransport2CheckpointTrigger, function(a, id) end) Trigger.OnEnteredFootprint(Barrier1Trigger, function(a, id) - if not barrier1Trigger and a.Owner == player then - barrier1Trigger = true - Actor.Create("camera", true, { Owner = player, Location = CameraBarrier.Location }) + if not Barrier1Triggered and a.Owner == USSR then + Barrier1Triggered = true + Actor.Create("camera", true, { Owner = USSR, Location = CameraBarrier.Location }) end end) Trigger.OnEnteredFootprint(Barrier2Trigger, function(a, id) - if not barrier2Trigger and a.Owner == player then - barrier2Trigger = true - Actor.Create("camera", true, { Owner = player, Location = CameraSpyHideout31.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraSpyHideout32.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraSpyHideout33.Location }) + if not Barrier2Triggered and a.Owner == USSR then + Barrier2Triggered = true + Actor.Create("camera", true, { Owner = USSR, Location = CameraSpyHideout31.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraSpyHideout32.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraSpyHideout33.Location }) end end) Trigger.OnEnteredFootprint(SpyHideout3Trigger, function(a, id) - if not spyHideout3Trigger and a.Owner == player then - spyHideout3Trigger = true + if not SpyHideout3Triggered and a.Owner == USSR then + SpyHideout3Triggered = true if Difficulty ~= "hard" then - Reinforcements.Reinforce(player, USSRReinforcements2, { ReinforcementSpawn.Location, CameraSpyHideout33.Location }, 0) - Media.PlaySpeechNotification(player, "ReinforcementsArrived") + Reinforcements.Reinforce(USSR, USSRReinforcements2, { ReinforcementSpawn.Location, CameraSpyHideout33.Location }, 0) + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") end end end) Trigger.OnEnteredFootprint(RTrapTrigger, function(a, id) - if not rTrapTrigger and a.Owner == player then - rTrapTrigger = true - Actor.Create("camera", true, { Owner = player, Location = CameraFinalArea.Location }) + if not RTrapTriggered and a.Owner == USSR then + RTrapTriggered = true + Actor.Create("camera", true, { Owner = USSR, Location = CameraFinalArea.Location }) if not RSoldier3.IsDead and not RSoldierTrap.IsDead then RSoldier3.Attack(RSoldierTrap) end @@ -285,10 +285,10 @@ Trigger.OnEnteredFootprint(RTrapTrigger, function(a, id) end) Trigger.OnEnteredFootprint(SpyHideout4Trigger, function(a, id) - if not spyHideout4Trigger and a.Owner == player then - spyHideout4Trigger = true + if not SpyHideout4Triggered and a.Owner == USSR then + SpyHideout4Triggered = true SpyFinalSequency() - Actor.Create("camera", true, { Owner = player, Location = HelicopterGoal.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = HelicopterGoal.Location }) end end) @@ -332,54 +332,54 @@ Trigger.OnKilled(Hideout3Barrel, function() end) WorldLoaded = function() - player = Player.GetPlayer("USSR") - enemy = Player.GetPlayer("England") - greece = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") + England = Player.GetPlayer("England") + Greece = Player.GetPlayer("Greece") Camera.Position = Playerbase.CenterPosition IntroSequence() - InitObjectives(player) - alliedObjective = AddPrimaryObjective(enemy, "") - sovietObjective1 = AddPrimaryObjective(player, "kill-enemy-spy") - sovietObjective2 = AddSecondaryObjective(player, "clear-farm-reinforcements") - sovietObjective3 = AddSecondaryObjective(player, "scavenge-civilian-buildings") + InitObjectives(USSR) + AlliedObjective = AddPrimaryObjective(England, "") + SovietObjective1 = AddPrimaryObjective(USSR, "kill-enemy-spy") + SovietObjective2 = AddSecondaryObjective(USSR, "clear-farm-reinforcements") + SovietObjective3 = AddSecondaryObjective(USSR, "scavenge-civilian-buildings") end Trigger.OnKilled(TheSpy, function() - player.MarkCompletedObjective(sovietObjective1) + USSR.MarkCompletedObjective(SovietObjective1) end) Tick = function() Trigger.AfterDelay(DateTime.Seconds(12), function() - if player.HasNoRequiredUnits() then - enemy.MarkCompletedObjective(alliedObjective) + if USSR.HasNoRequiredUnits() then + England.MarkCompletedObjective(AlliedObjective) end end) if not SpyHideout4.IsDead and SpyHideout4.HasPassengers then - spyReachedHideout4 = true + SpyReachedHideout4 = true end - if remainingTime == DateTime.Minutes(5) and Difficulty ~= "hard" then - Media.PlaySpeechNotification(player, "WarningFiveMinutesRemaining") - elseif remainingTime == DateTime.Minutes(4) then - Media.PlaySpeechNotification(player, "WarningFourMinutesRemaining") - elseif remainingTime == DateTime.Minutes(3) then - Media.PlaySpeechNotification(player, "WarningThreeMinutesRemaining") - elseif remainingTime == DateTime.Minutes(2) then - Media.PlaySpeechNotification(player, "WarningTwoMinutesRemaining") - elseif remainingTime == DateTime.Minutes(1) then - Media.PlaySpeechNotification(player, "WarningOneMinuteRemaining") + if RemainingTime == DateTime.Minutes(5) and Difficulty ~= "hard" then + Media.PlaySpeechNotification(USSR, "WarningFiveMinutesRemaining") + elseif RemainingTime == DateTime.Minutes(4) then + Media.PlaySpeechNotification(USSR, "WarningFourMinutesRemaining") + elseif RemainingTime == DateTime.Minutes(3) then + Media.PlaySpeechNotification(USSR, "WarningThreeMinutesRemaining") + elseif RemainingTime == DateTime.Minutes(2) then + Media.PlaySpeechNotification(USSR, "WarningTwoMinutesRemaining") + elseif RemainingTime == DateTime.Minutes(1) then + Media.PlaySpeechNotification(USSR, "WarningOneMinuteRemaining") end - if remainingTime > 0 and timerstarted then - if (remainingTime % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("time-remaining", { ["time"] = Utils.FormatTime(remainingTime) }) - UserInterface.SetMissionText(Timer, player.Color) + if RemainingTime > 0 and TimerStarted then + if (RemainingTime % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("time-remaining", { ["time"] = Utils.FormatTime(RemainingTime) }) + UserInterface.SetMissionText(Timer, USSR.Color) end - remainingTime = remainingTime - 1 - elseif remainingTime == 0 and not spyReachedHideout4 then + RemainingTime = RemainingTime - 1 + elseif RemainingTime == 0 and not SpyReachedHideout4 then UserInterface.SetMissionText("") - enemy.MarkCompletedObjective(alliedObjective) - elseif remainingTime == 0 and spyReachedHideout4 then + England.MarkCompletedObjective(AlliedObjective) + elseif RemainingTime == 0 and SpyReachedHideout4 then UserInterface.SetMissionText("") SpyHelicopterEscape() end diff --git a/mods/ra/maps/soviet-04a/soviet04a.lua b/mods/ra/maps/soviet-04a/soviet04a.lua index 0362b94fbe..652ac1a483 100644 --- a/mods/ra/maps/soviet-04a/soviet04a.lua +++ b/mods/ra/maps/soviet-04a/soviet04a.lua @@ -26,29 +26,29 @@ RunInitialActivities = function() end end) - Reinforcements.Reinforce(player, SovietMCV, SovietStartToBasePath, 0, function(mcv) + Reinforcements.Reinforce(USSR, SovietMCV, SovietStartToBasePath, 0, function(mcv) mcv.Move(StartCamPoint.Location) end) - Media.PlaySpeechNotification(player, "ReinforcementsArrived") + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") - Trigger.OnKilled(Barr, function(building) + Trigger.OnKilled(Barr, function() BaseBarracks.exists = false end) - Trigger.OnKilled(Proc, function(building) + Trigger.OnKilled(Proc, function() BaseProc.exists = false end) - Trigger.OnKilled(Weap, function(building) + Trigger.OnKilled(Weap, function() BaseWeaponsFactory.exists = false end) Trigger.OnEnteredFootprint(VillageCamArea, function(actor, id) - if actor.Owner == player then + if actor.Owner == USSR then Trigger.RemoveFootprintTrigger(id) if not AllVillagersDead then - VillageCamera = Actor.Create("camera", true, { Owner = player, Location = VillagePoint.Location }) + VillageCamera = Actor.Create("camera", true, { Owner = USSR, Location = VillagePoint.Location }) end end end) @@ -101,11 +101,11 @@ end Tick = function() if Greece.HasNoRequiredUnits() then - player.MarkCompletedObjective(KillAll) - player.MarkCompletedObjective(KillRadar) + USSR.MarkCompletedObjective(KillAll) + USSR.MarkCompletedObjective(KillRadar) end - if player.HasNoRequiredUnits() then + if USSR.HasNoRequiredUnits() then Greece.MarkCompletedObjective(BeatUSSR) end @@ -127,20 +127,20 @@ Tick = function() end WorldLoaded = function() - player = Player.GetPlayer("USSR") + USSR = Player.GetPlayer("USSR") Greece = Player.GetPlayer("Greece") RunInitialActivities() - InitObjectives(player) + InitObjectives(USSR) - KillAll = AddPrimaryObjective(player, "defeat-allied-forces") + KillAll = AddPrimaryObjective(USSR, "defeat-allied-forces") BeatUSSR = AddPrimaryObjective(Greece, "") - KillRadar = AddSecondaryObjective(player, "destroy-radar-dome-reinforcements") + KillRadar = AddSecondaryObjective(USSR, "destroy-radar-dome-reinforcements") Trigger.OnKilled(RadarDome, function() - player.MarkCompletedObjective(KillRadar) - Media.PlaySpeechNotification(player, "ObjectiveMet") + USSR.MarkCompletedObjective(KillRadar) + Media.PlaySpeechNotification(USSR, "ObjectiveMet") end) Camera.Position = StartCamPoint.CenterPosition diff --git a/mods/ra/maps/soviet-04b/soviet04b.lua b/mods/ra/maps/soviet-04b/soviet04b.lua index 233a37937e..f16633e09e 100644 --- a/mods/ra/maps/soviet-04b/soviet04b.lua +++ b/mods/ra/maps/soviet-04b/soviet04b.lua @@ -29,28 +29,28 @@ RunInitialActivities = function() end end) - Trigger.OnKilled(Powr, function(building) + Trigger.OnKilled(Powr, function() BasePower.exists = false end) - Trigger.OnKilled(Barr, function(building) + Trigger.OnKilled(Barr, function() BaseBarracks.exists = false end) - Trigger.OnKilled(Proc, function(building) + Trigger.OnKilled(Proc, function() BaseProc.exists = false end) - Trigger.OnKilled(Weap, function(building) + Trigger.OnKilled(Weap, function() BaseWeaponsFactory.exists = false end) Trigger.OnEnteredFootprint(VillageCamArea, function(actor, id) - if actor.Owner == player then + if actor.Owner == USSR then Trigger.RemoveFootprintTrigger(id) if not AllVillagersDead then - VillageCamera = Actor.Create("camera", true, { Owner = player, Location = VillagePoint.Location }) + VillageCamera = Actor.Create("camera", true, { Owner = USSR, Location = VillagePoint.Location }) end end end) @@ -86,11 +86,11 @@ end Tick = function() if Greece.HasNoRequiredUnits() then - player.MarkCompletedObjective(KillAll) - player.MarkCompletedObjective(KillRadar) + USSR.MarkCompletedObjective(KillAll) + USSR.MarkCompletedObjective(KillRadar) end - if player.HasNoRequiredUnits() then + if USSR.HasNoRequiredUnits() then Greece.MarkCompletedObjective(BeatUSSR) end @@ -112,20 +112,20 @@ Tick = function() end WorldLoaded = function() - player = Player.GetPlayer("USSR") + USSR = Player.GetPlayer("USSR") Greece = Player.GetPlayer("Greece") RunInitialActivities() - InitObjectives(player) + InitObjectives(USSR) - KillAll = AddPrimaryObjective(player, "defeat-allied-forces") + KillAll = AddPrimaryObjective(USSR, "defeat-allied-forces") BeatUSSR = AddPrimaryObjective(Greece, "") - KillRadar = AddSecondaryObjective(player, "destroy-radar-dome-reinforcements") + KillRadar = AddSecondaryObjective(USSR, "destroy-radar-dome-reinforcements") Trigger.OnKilled(RadarDome, function() - player.MarkCompletedObjective(KillRadar) - Media.PlaySpeechNotification(player, "ObjectiveMet") + USSR.MarkCompletedObjective(KillRadar) + Media.PlaySpeechNotification(USSR, "ObjectiveMet") end) Trigger.OnDamaged(Harvester, function() diff --git a/mods/ra/maps/soviet-05/soviet05-reinforcements_teams.lua b/mods/ra/maps/soviet-05/soviet05-reinforcements_teams.lua index 749d4a328d..60c331e5f1 100644 --- a/mods/ra/maps/soviet-05/soviet05-reinforcements_teams.lua +++ b/mods/ra/maps/soviet-05/soviet05-reinforcements_teams.lua @@ -46,13 +46,13 @@ InfantryGGWaypoints = { PatrolPoint2, BetweenBasesPoint, PrepGGArmyPoint } TanksGGWaypoints = { PatrolPoint2, BetweenBasesPoint, PrepGGArmyPoint } Para = function() - local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = player }) + local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR }) powerproxy.TargetParatroopers(ParaPoint.CenterPosition, Angle.New(112)) powerproxy.Destroy() end Para2 = function() - local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = player }) + local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR }) powerproxy.TargetParatroopers(USSRExpansionPoint.CenterPosition, Angle.New(112)) powerproxy.Destroy() end diff --git a/mods/ra/maps/soviet-05/soviet05.lua b/mods/ra/maps/soviet-05/soviet05.lua index 74c1735658..3acf03ab5f 100644 --- a/mods/ra/maps/soviet-05/soviet05.lua +++ b/mods/ra/maps/soviet-05/soviet05.lua @@ -8,7 +8,7 @@ ]] CheckForBase = function() - baseBuildings = Map.ActorsInBox(Map.TopLeft, CFBPoint.CenterPosition, function(actor) + local baseBuildings = Map.ActorsInBox(Map.TopLeft, CFBPoint.CenterPosition, function(actor) return actor.Type == "fact" or actor.Type == "powr" end) @@ -38,7 +38,7 @@ RunInitialActivities = function() Trigger.AfterDelay(1, function() Harvester.FindResources() IdlingUnits() - Media.PlaySpeechNotification(player, "ReinforcementsArrived") + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == Greece and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) @@ -50,12 +50,12 @@ RunInitialActivities = function() end) end) - Reinforcements.Reinforce(player, SovietStartReinf, SovietStartToBasePath, 0, function(soldier) + Reinforcements.Reinforce(USSR, SovietStartReinf, SovietStartToBasePath, 0, function(soldier) soldier.AttackMove(SovietBasePoint.Location) end) - Actor.Create("camera", true, { Owner = player, Location = GreeceBasePoint.Location }) - Actor.Create("camera", true, { Owner = player, Location = SovietBasePoint.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = GreeceBasePoint.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = SovietBasePoint.Location }) startmcv.Move(MCVStartMovePoint.Location) Runner1.Move(RunnerPoint.Location) @@ -132,14 +132,14 @@ end Tick = function() if Greece.HasNoRequiredUnits() and GoodGuy.HasNoRequiredUnits() then - player.MarkCompletedObjective(KillAll) + USSR.MarkCompletedObjective(KillAll) if HoldObjective then - player.MarkCompletedObjective(HoldObjective) + USSR.MarkCompletedObjective(HoldObjective) end end - if player.HasNoRequiredUnits() then + if USSR.HasNoRequiredUnits() then GoodGuy.MarkCompletedObjective(BeatUSSR) end @@ -153,8 +153,8 @@ Tick = function() GoodGuy.Resources = GoodGuy.ResourceCapacity * 0.25 end - if not baseEstablished and CheckForBase() then - baseEstablished = true + if not BaseEstablished and CheckForBase() then + BaseEstablished = true Para() end @@ -182,14 +182,14 @@ Tick = function() end WorldLoaded = function() - player = Player.GetPlayer("USSR") + USSR = Player.GetPlayer("USSR") GoodGuy = Player.GetPlayer("GoodGuy") Greece = Player.GetPlayer("Greece") - InitObjectives(player) + InitObjectives(USSR) - CaptureObjective = AddPrimaryObjective(player, "capture-radar-dome") - KillAll = AddPrimaryObjective(player, "defeat-allied-forces") + CaptureObjective = AddPrimaryObjective(USSR, "capture-radar-dome") + KillAll = AddPrimaryObjective(USSR, "defeat-allied-forces") BeatUSSR = AddPrimaryObjective(Greece, "") RunInitialActivities() @@ -198,30 +198,30 @@ WorldLoaded = function() Trigger.OnDamaged(mcvtransport, Expand) Trigger.OnKilled(RadarDome, function() - if not player.IsObjectiveCompleted(CaptureObjective) then - player.MarkFailedObjective(CaptureObjective) + if not USSR.IsObjectiveCompleted(CaptureObjective) then + USSR.MarkFailedObjective(CaptureObjective) end if HoldObjective then - player.MarkFailedObjective(HoldObjective) + USSR.MarkFailedObjective(HoldObjective) end end) RadarDome.GrantCondition("french") Trigger.OnCapture(RadarDome, function() - if player.IsObjectiveCompleted(KillAll) then - player.MarkCompletedObjective(CaptureObjective) + if USSR.IsObjectiveCompleted(KillAll) then + USSR.MarkCompletedObjective(CaptureObjective) return end - HoldObjective = AddPrimaryObjective(player, "defend-radar-dome") - player.MarkCompletedObjective(CaptureObjective) - Beacon.New(player, MCVDeploy.CenterPosition) + HoldObjective = AddPrimaryObjective(USSR, "defend-radar-dome") + USSR.MarkCompletedObjective(CaptureObjective) + Beacon.New(USSR, MCVDeploy.CenterPosition) if Difficulty == "easy" then - Actor.Create("camera", true, { Owner = player, Location = MCVDeploy.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = MCVDeploy.Location }) Media.DisplayMessage(UserInterface.Translate("allied-expansion-movement-detected")) else - Actor.Create("MCV.CAM", true, { Owner = player, Location = MCVDeploy.Location }) + Actor.Create("MCV.CAM", true, { Owner = USSR, Location = MCVDeploy.Location }) Media.DisplayMessage(UserInterface.Translate("coordinates-allied-expansion-discovered")) end @@ -236,18 +236,18 @@ WorldLoaded = function() Trigger.ClearAll(RadarDome) Trigger.AfterDelay(0, function() Trigger.OnRemovedFromWorld(RadarDome, function() - player.MarkFailedObjective(HoldObjective) + USSR.MarkFailedObjective(HoldObjective) end) end) end) Trigger.OnEnteredProximityTrigger(USSRExpansionPoint.CenterPosition, WDist.New(4 * 1024), function(unit, id) - if unit.Owner == player and RadarDome.Owner == player then + if unit.Owner == USSR and RadarDome.Owner == USSR then Trigger.RemoveProximityTrigger(id) Para2() - local units = Reinforcements.ReinforceWithTransport(player, "lst", SovietMCVReinf, { ReinfSouthPoint.Location, USSRlstPoint.Location }, { ReinfSouthPoint.Location })[2] + local units = Reinforcements.ReinforceWithTransport(USSR, "lst", SovietMCVReinf, { ReinfSouthPoint.Location, USSRlstPoint.Location }, { ReinfSouthPoint.Location })[2] Utils.Do(units, function(unit) Trigger.OnAddedToWorld(unit, function() if unit.Type == "mcv" then @@ -258,7 +258,7 @@ WorldLoaded = function() end) end) - Media.PlaySpeechNotification(player, "ReinforcementsArrived") + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") end end) diff --git a/mods/ra/maps/soviet-06a/soviet06a-AI.lua b/mods/ra/maps/soviet-06a/soviet06a-AI.lua index 50f6080224..7cd4086f22 100644 --- a/mods/ra/maps/soviet-06a/soviet06a-AI.lua +++ b/mods/ra/maps/soviet-06a/soviet06a-AI.lua @@ -7,7 +7,7 @@ information, see COPYING. ]] IdlingUnits = function() - local lazyUnits = enemy.GetGroundAttackers() + local lazyUnits = Greece.GetGroundAttackers() Utils.Do(lazyUnits, function(unit) Trigger.OnDamaged(unit, function() @@ -38,19 +38,19 @@ end BuildBuilding = function(building) Trigger.AfterDelay(Actor.BuildTime(building.type), function() - if CYard.IsDead or CYard.Owner ~= enemy then + if CYard.IsDead or CYard.Owner ~= Greece then return - elseif Harvester.IsDead and enemy.Resources <= 299 then + elseif Harvester.IsDead and Greece.Resources <= 299 then return end - local actor = Actor.Create(building.type, true, { Owner = enemy, Location = CYardLocation.Location + building.pos }) - enemy.Cash = enemy.Cash - building.cost + local actor = Actor.Create(building.type, true, { Owner = Greece, Location = CYardLocation.Location + building.pos }) + Greece.Cash = Greece.Cash - building.cost building.exists = true Trigger.OnKilled(actor, function() building.exists = false end) Trigger.OnDamaged(actor, function(building) - if building.Owner == enemy and building.Health < building.MaxHealth * 3/4 then + if building.Owner == Greece and building.Health < building.MaxHealth * 3/4 then building.StartBuildingRepairs() end end) @@ -62,14 +62,14 @@ end ProduceInfantry = function() if not BaseTent.exists then return - elseif Harvester.IsDead and enemy.Resources <= 299 then + elseif Harvester.IsDead and Greece.Resources <= 299 then return end local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9)) local toBuild = { Utils.Random(AlliedInfantryTypes) } local Path = Utils.Random(AttackPaths) - enemy.Build(toBuild, function(unit) + Greece.Build(toBuild, function(unit) InfAttack[#InfAttack + 1] = unit[1] if #InfAttack >= 10 then @@ -85,14 +85,14 @@ end ProduceArmor = function() if not BaseWeap.exists then return - elseif Harvester.IsDead and enemy.Resources <= 599 then + elseif Harvester.IsDead and Greece.Resources <= 599 then return end local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(17)) local toBuild = { Utils.Random(AlliedArmorTypes) } local Path = Utils.Random(AttackPaths) - enemy.Build(toBuild, function(unit) + Greece.Build(toBuild, function(unit) ArmorAttack[#ArmorAttack + 1] = unit[1] if #ArmorAttack >= 6 then diff --git a/mods/ra/maps/soviet-06a/soviet06a-reinforcements_teams.lua b/mods/ra/maps/soviet-06a/soviet06a-reinforcements_teams.lua index 803724de25..6452540b4b 100644 --- a/mods/ra/maps/soviet-06a/soviet06a-reinforcements_teams.lua +++ b/mods/ra/maps/soviet-06a/soviet06a-reinforcements_teams.lua @@ -43,20 +43,20 @@ EnemyPaths = { EnemyEntry2.Location, EnemyRally2.Location } } -wave = 0 +Wave = 0 SendEnemies = function() Trigger.AfterDelay(EnemyAttackDelay[Difficulty], function() - wave = wave + 1 - if wave > 3 then - wave = 1 + Wave = Wave + 1 + if Wave > 3 then + Wave = 1 end - if wave == 1 then - local units = Reinforcements.ReinforceWithTransport(enemy, "tran", EnemyReinforcements[Difficulty][wave], EnemyPaths[1], { EnemyPaths[1][1] })[2] + if Wave == 1 then + local units = Reinforcements.ReinforceWithTransport(Greece, "tran", EnemyReinforcements[Difficulty][Wave], EnemyPaths[1], { EnemyPaths[1][1] })[2] Utils.Do(units, IdleHunt) else - local units = Reinforcements.ReinforceWithTransport(enemy, "lst", EnemyReinforcements[Difficulty][wave], EnemyPaths[2], { EnemyPaths[2][1] })[2] + local units = Reinforcements.ReinforceWithTransport(Greece, "lst", EnemyReinforcements[Difficulty][Wave], EnemyPaths[2], { EnemyPaths[2][1] })[2] Utils.Do(units, IdleHunt) end diff --git a/mods/ra/maps/soviet-06a/soviet06a.lua b/mods/ra/maps/soviet-06a/soviet06a.lua index e56daef4c6..722cb9301b 100644 --- a/mods/ra/maps/soviet-06a/soviet06a.lua +++ b/mods/ra/maps/soviet-06a/soviet06a.lua @@ -26,17 +26,17 @@ CameraBarrierTrigger = { CPos.New(65, 39), CPos.New(65, 40), CPos.New(66, 40), C CameraBaseTrigger = { CPos.New(53, 42), CPos.New(54, 42), CPos.New(54, 41), CPos.New(55, 41), CPos.New(56, 41), CPos.New(56, 40), CPos.New(57, 40), CPos.New(57, 39), CPos.New(58, 39), CPos.New(59, 39), CPos.New(59, 38), CPos.New(60, 38), CPos.New(61, 38) } Trigger.OnEnteredFootprint(TruckGoalTrigger, function(a, id) - if not truckGoalTrigger and a.Owner == player and a.Type == "truk" then - truckGoalTrigger = true - player.MarkCompletedObjective(sovietObjective) - player.MarkCompletedObjective(SaveAllTrucks) + if not TruckGoalTriggered and a.Owner == USSR and a.Type == "truk" then + TruckGoalTriggered = true + USSR.MarkCompletedObjective(SovietObjective) + USSR.MarkCompletedObjective(SaveAllTrucks) end end) Trigger.OnEnteredFootprint(CameraBarrierTrigger, function(a, id) - if not cameraBarrierTrigger and a.Owner == player then - cameraBarrierTrigger = true - local cameraBarrier = Actor.Create("camera", true, { Owner = player, Location = CameraBarrier.Location }) + if not CameraBarrierTriggered and a.Owner == USSR then + CameraBarrierTriggered = true + local cameraBarrier = Actor.Create("camera", true, { Owner = USSR, Location = CameraBarrier.Location }) Trigger.AfterDelay(DateTime.Seconds(15), function() cameraBarrier.Destroy() end) @@ -44,12 +44,12 @@ Trigger.OnEnteredFootprint(CameraBarrierTrigger, function(a, id) end) Trigger.OnEnteredFootprint(CameraBaseTrigger, function(a, id) - if not cameraBaseTrigger and a.Owner == player then - cameraBaseTrigger = true - local cameraBase1 = Actor.Create("camera", true, { Owner = player, Location = CameraBase1.Location }) - local cameraBase2 = Actor.Create("camera", true, { Owner = player, Location = CameraBase2.Location }) - local cameraBase3 = Actor.Create("camera", true, { Owner = player, Location = CameraBase3.Location }) - local cameraBase4 = Actor.Create("camera", true, { Owner = player, Location = CameraBase4.Location }) + if not CameraBaseTriggered and a.Owner == USSR then + CameraBaseTriggered = true + local cameraBase1 = Actor.Create("camera", true, { Owner = USSR, Location = CameraBase1.Location }) + local cameraBase2 = Actor.Create("camera", true, { Owner = USSR, Location = CameraBase2.Location }) + local cameraBase3 = Actor.Create("camera", true, { Owner = USSR, Location = CameraBase3.Location }) + local cameraBase4 = Actor.Create("camera", true, { Owner = USSR, Location = CameraBase4.Location }) Trigger.AfterDelay(DateTime.Minutes(1), function() cameraBase1.Destroy() cameraBase2.Destroy() @@ -60,44 +60,44 @@ Trigger.OnEnteredFootprint(CameraBaseTrigger, function(a, id) end) Trigger.OnAllKilled(Trucks, function() - enemy.MarkCompletedObjective(alliedObjective) + Greece.MarkCompletedObjective(AlliedObjective) end) Trigger.OnAnyKilled(Trucks, function() - player.MarkFailedObjective(SaveAllTrucks) + USSR.MarkFailedObjective(SaveAllTrucks) end) -Trigger.OnKilled(Apwr, function(building) +Trigger.OnKilled(Apwr, function() BaseApwr.exists = false end) -Trigger.OnKilled(Barr, function(building) +Trigger.OnKilled(Barr, function() BaseTent.exists = false end) -Trigger.OnKilled(Proc, function(building) +Trigger.OnKilled(Proc, function() BaseProc.exists = false end) -Trigger.OnKilled(Weap, function(building) +Trigger.OnKilled(Weap, function() BaseWeap.exists = false end) -Trigger.OnKilled(Apwr2, function(building) +Trigger.OnKilled(Apwr2, function() BaseApwr2.exists = false end) Trigger.OnKilledOrCaptured(Dome, function() Trigger.AfterDelay(DateTime.Seconds(2), function() - player.MarkCompletedObjective(sovietObjective2) - Media.PlaySpeechNotification(player, "ObjectiveMet") + USSR.MarkCompletedObjective(SovietObjective2) + Media.PlaySpeechNotification(USSR, "ObjectiveMet") end) end) -- Activate the AI once the player deployed the Mcv Trigger.OnRemovedFromWorld(Mcv, function() - if not mcvDeployed then - mcvDeployed = true + if not McvDeployed then + McvDeployed = true BuildBase() SendEnemies() Trigger.AfterDelay(DateTime.Minutes(1), ProduceInfantry) @@ -111,8 +111,8 @@ Trigger.OnRemovedFromWorld(Mcv, function() end) WorldLoaded = function() - player = Player.GetPlayer("USSR") - enemy = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") + Greece = Player.GetPlayer("Greece") Camera.Position = CameraStart.CenterPosition @@ -123,33 +123,33 @@ WorldLoaded = function() end) Utils.Do(Map.NamedActors, function(actor) - if actor.Owner == enemy and actor.HasProperty("StartBuildingRepairs") then + if actor.Owner == Greece and actor.HasProperty("StartBuildingRepairs") then Trigger.OnDamaged(actor, function(building) - if building.Owner == enemy and building.Health < 3/4 * building.MaxHealth then + if building.Owner == Greece and building.Health < 3/4 * building.MaxHealth then building.StartBuildingRepairs() end end) end end) - Reinforcements.ReinforceWithTransport(player, "apc", SovietReinforcements1, SovietReinforcements1Waypoints) - Reinforcements.ReinforceWithTransport(player, "apc", SovietReinforcements2, SovietReinforcements2Waypoints) + Reinforcements.ReinforceWithTransport(USSR, "apc", SovietReinforcements1, SovietReinforcements1Waypoints) + Reinforcements.ReinforceWithTransport(USSR, "apc", SovietReinforcements2, SovietReinforcements2Waypoints) - InitObjectives(player) + InitObjectives(USSR) - alliedObjective = AddPrimaryObjective(enemy, "") - sovietObjective = AddPrimaryObjective(player, "escort-convoy") - sovietObjective2 = AddSecondaryObjective(player, "destroy-capture-radar-dome-reinforcements") - SaveAllTrucks = AddSecondaryObjective(player, "Keep all trucks alive.") + AlliedObjective = AddPrimaryObjective(Greece, "") + SovietObjective = AddPrimaryObjective(USSR, "escort-convoy") + SovietObjective2 = AddSecondaryObjective(USSR, "destroy-capture-radar-dome-reinforcements") + SaveAllTrucks = AddSecondaryObjective(USSR, "Keep all trucks alive.") end Tick = function() - if player.HasNoRequiredUnits() then - enemy.MarkCompletedObjective(alliedObjective) + if USSR.HasNoRequiredUnits() then + Greece.MarkCompletedObjective(AlliedObjective) end - if enemy.Resources >= enemy.ResourceCapacity * 0.75 then - enemy.Cash = enemy.Cash + enemy.Resources - enemy.ResourceCapacity * 0.25 - enemy.Resources = enemy.ResourceCapacity * 0.25 + if Greece.Resources >= Greece.ResourceCapacity * 0.75 then + Greece.Cash = Greece.Cash + Greece.Resources - Greece.ResourceCapacity * 0.25 + Greece.Resources = Greece.ResourceCapacity * 0.25 end end diff --git a/mods/ra/maps/soviet-06b/soviet06b-AI.lua b/mods/ra/maps/soviet-06b/soviet06b-AI.lua index 146c075eca..66d9999387 100644 --- a/mods/ra/maps/soviet-06b/soviet06b-AI.lua +++ b/mods/ra/maps/soviet-06b/soviet06b-AI.lua @@ -7,7 +7,7 @@ information, see COPYING. ]] IdlingUnits = function() - local lazyUnits = enemy.GetGroundAttackers() + local lazyUnits = Greece.GetGroundAttackers() Utils.Do(lazyUnits, function(unit) Trigger.OnDamaged(unit, function() @@ -38,19 +38,19 @@ end BuildBuilding = function(building) Trigger.AfterDelay(Actor.BuildTime(building.type), function() - if CYard.IsDead or CYard.Owner ~= enemy then + if CYard.IsDead or CYard.Owner ~= Greece then return - elseif Harvester.IsDead and enemy.Resources <= 299 then + elseif Harvester.IsDead and Greece.Resources <= 299 then return end - local actor = Actor.Create(building.type, true, { Owner = enemy, Location = CYardLocation.Location + building.pos }) - enemy.Cash = enemy.Cash - building.cost + local actor = Actor.Create(building.type, true, { Owner = Greece, Location = CYardLocation.Location + building.pos }) + Greece.Cash = Greece.Cash - building.cost building.exists = true Trigger.OnKilled(actor, function() building.exists = false end) Trigger.OnDamaged(actor, function(building) - if building.Owner == enemy and building.Health < building.MaxHealth * 3/4 then + if building.Owner == Greece and building.Health < building.MaxHealth * 3/4 then building.StartBuildingRepairs() end end) @@ -62,14 +62,14 @@ end ProduceInfantry = function() if not BaseTent.exists then return - elseif Harvester.IsDead and enemy.Resources <= 299 then + elseif Harvester.IsDead and Greece.Resources <= 299 then return end local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9)) local toBuild = { Utils.Random(AlliedInfantryTypes) } local Path = Utils.Random(AttackPaths) - enemy.Build(toBuild, function(unit) + Greece.Build(toBuild, function(unit) InfAttack[#InfAttack + 1] = unit[1] if #InfAttack >= 10 then @@ -85,14 +85,14 @@ end ProduceArmor = function() if not BaseWeap.exists then return - elseif Harvester.IsDead and enemy.Resources <= 599 then + elseif Harvester.IsDead and Greece.Resources <= 599 then return end local delay = Utils.RandomInteger(DateTime.Seconds(12), DateTime.Seconds(17)) local toBuild = { Utils.Random(AlliedArmorTypes) } local Path = Utils.Random(AttackPaths) - enemy.Build(toBuild, function(unit) + Greece.Build(toBuild, function(unit) ArmorAttack[#ArmorAttack + 1] = unit[1] if #ArmorAttack >= 6 then diff --git a/mods/ra/maps/soviet-06b/soviet06b-reinforcements_teams.lua b/mods/ra/maps/soviet-06b/soviet06b-reinforcements_teams.lua index 803724de25..6452540b4b 100644 --- a/mods/ra/maps/soviet-06b/soviet06b-reinforcements_teams.lua +++ b/mods/ra/maps/soviet-06b/soviet06b-reinforcements_teams.lua @@ -43,20 +43,20 @@ EnemyPaths = { EnemyEntry2.Location, EnemyRally2.Location } } -wave = 0 +Wave = 0 SendEnemies = function() Trigger.AfterDelay(EnemyAttackDelay[Difficulty], function() - wave = wave + 1 - if wave > 3 then - wave = 1 + Wave = Wave + 1 + if Wave > 3 then + Wave = 1 end - if wave == 1 then - local units = Reinforcements.ReinforceWithTransport(enemy, "tran", EnemyReinforcements[Difficulty][wave], EnemyPaths[1], { EnemyPaths[1][1] })[2] + if Wave == 1 then + local units = Reinforcements.ReinforceWithTransport(Greece, "tran", EnemyReinforcements[Difficulty][Wave], EnemyPaths[1], { EnemyPaths[1][1] })[2] Utils.Do(units, IdleHunt) else - local units = Reinforcements.ReinforceWithTransport(enemy, "lst", EnemyReinforcements[Difficulty][wave], EnemyPaths[2], { EnemyPaths[2][1] })[2] + local units = Reinforcements.ReinforceWithTransport(Greece, "lst", EnemyReinforcements[Difficulty][Wave], EnemyPaths[2], { EnemyPaths[2][1] })[2] Utils.Do(units, IdleHunt) end diff --git a/mods/ra/maps/soviet-06b/soviet06b.lua b/mods/ra/maps/soviet-06b/soviet06b.lua index 3e0cd273c5..74e90cf218 100644 --- a/mods/ra/maps/soviet-06b/soviet06b.lua +++ b/mods/ra/maps/soviet-06b/soviet06b.lua @@ -23,51 +23,51 @@ SovietReinforcements2Waypoints = { McvWaypoint.Location, APCWaypoint2.Location } TruckGoalTrigger = { CPos.New(85, 10), CPos.New(85, 11), CPos.New(85, 12), CPos.New(86, 13), CPos.New(87, 13), CPos.New(88, 13), CPos.New(88, 14), CPos.New(89, 14), CPos.New(90, 14), CPos.New(90, 15), CPos.New(91, 15), CPos.New(91, 16), CPos.New(91, 17), CPos.New(92, 17), CPos.New(93, 17), CPos.New(94, 17), CPos.New(94, 18), CPos.New(95, 18), CPos.New(96, 18), CPos.New(96, 19), CPos.New(97, 19), CPos.New(98, 19)} Trigger.OnEnteredFootprint(TruckGoalTrigger, function(a, id) - if not truckGoalTrigger and a.Owner == player and a.Type == "truk" then - truckGoalTrigger = true - player.MarkCompletedObjective(sovietObjective) - player.MarkCompletedObjective(SaveAllTrucks) + if not TruckGoalTriggered and a.Owner == USSR and a.Type == "truk" then + TruckGoalTriggered = true + USSR.MarkCompletedObjective(SovietObjective) + USSR.MarkCompletedObjective(SaveAllTrucks) end end) Trigger.OnAllKilled(Trucks, function() - enemy.MarkCompletedObjective(alliedObjective) + Greece.MarkCompletedObjective(AlliedObjective) end) Trigger.OnAnyKilled(Trucks, function() - player.MarkFailedObjective(SaveAllTrucks) + USSR.MarkFailedObjective(SaveAllTrucks) end) -Trigger.OnKilled(Apwr, function(building) +Trigger.OnKilled(Apwr, function() BaseApwr.exists = false end) -Trigger.OnKilled(Barr, function(building) +Trigger.OnKilled(Barr, function() BaseTent.exists = false end) -Trigger.OnKilled(Proc, function(building) +Trigger.OnKilled(Proc, function() BaseProc.exists = false end) -Trigger.OnKilled(Weap, function(building) +Trigger.OnKilled(Weap, function() BaseWeap.exists = false end) -Trigger.OnKilled(Apwr2, function(building) +Trigger.OnKilled(Apwr2, function() BaseApwr2.exists = false end) Trigger.OnKilledOrCaptured(Dome, function() Trigger.AfterDelay(DateTime.Seconds(2), function() - player.MarkCompletedObjective(sovietObjective2) - Media.PlaySpeechNotification(player, "ObjectiveMet") + USSR.MarkCompletedObjective(SovietObjective2) + Media.PlaySpeechNotification(USSR, "ObjectiveMet") end) end) Trigger.OnRemovedFromWorld(Mcv, function() - if not mcvDeployed then - mcvDeployed = true + if not McvDeployed then + McvDeployed = true BuildBase() SendEnemies() Trigger.AfterDelay(DateTime.Minutes(1), ProduceInfantry) @@ -76,8 +76,8 @@ Trigger.OnRemovedFromWorld(Mcv, function() end) WorldLoaded = function() - player = Player.GetPlayer("USSR") - enemy = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") + Greece = Player.GetPlayer("Greece") Camera.Position = CameraStart.CenterPosition @@ -87,33 +87,33 @@ WorldLoaded = function() IdleHunt(actor) end) - Reinforcements.ReinforceWithTransport(player, "apc", SovietReinforcements1, SovietReinforcements1Waypoints) - Reinforcements.ReinforceWithTransport(player, "apc", SovietReinforcements2, SovietReinforcements2Waypoints) + Reinforcements.ReinforceWithTransport(USSR, "apc", SovietReinforcements1, SovietReinforcements1Waypoints) + Reinforcements.ReinforceWithTransport(USSR, "apc", SovietReinforcements2, SovietReinforcements2Waypoints) Utils.Do(Map.NamedActors, function(actor) - if actor.Owner == enemy and actor.HasProperty("StartBuildingRepairs") then + if actor.Owner == Greece and actor.HasProperty("StartBuildingRepairs") then Trigger.OnDamaged(actor, function(building) - if building.Owner == enemy and building.Health < 3/4 * building.MaxHealth then + if building.Owner == Greece and building.Health < 3/4 * building.MaxHealth then building.StartBuildingRepairs() end end) end end) - InitObjectives(player) - alliedObjective = AddPrimaryObjective(enemy, "") - sovietObjective = AddPrimaryObjective(player, "escort-convoy") - sovietObjective2 = AddSecondaryObjective(player, "destroy-capture-radar-dome-reinforcements") - SaveAllTrucks = AddSecondaryObjective(player, "Keep all trucks alive.") + InitObjectives(USSR) + AlliedObjective = AddPrimaryObjective(Greece, "") + SovietObjective = AddPrimaryObjective(USSR, "escort-convoy") + SovietObjective2 = AddSecondaryObjective(USSR, "destroy-capture-radar-dome-reinforcements") + SaveAllTrucks = AddSecondaryObjective(USSR, "Keep all trucks alive.") end Tick = function() - if player.HasNoRequiredUnits() then - enemy.MarkCompletedObjective(alliedObjective) + if USSR.HasNoRequiredUnits() then + Greece.MarkCompletedObjective(AlliedObjective) end - if enemy.Resources >= enemy.ResourceCapacity * 0.75 then - enemy.Cash = enemy.Cash + enemy.Resources - enemy.ResourceCapacity * 0.25 - enemy.Resources = enemy.ResourceCapacity * 0.25 + if Greece.Resources >= Greece.ResourceCapacity * 0.75 then + Greece.Cash = Greece.Cash + Greece.Resources - Greece.ResourceCapacity * 0.25 + Greece.Resources = Greece.ResourceCapacity * 0.25 end end diff --git a/mods/ra/maps/soviet-07/soviet07.lua b/mods/ra/maps/soviet-07/soviet07.lua index eb3b62a6cf..14356e2858 100644 --- a/mods/ra/maps/soviet-07/soviet07.lua +++ b/mods/ra/maps/soviet-07/soviet07.lua @@ -7,11 +7,11 @@ information, see COPYING. ]] if Difficulty == "easy" then - remainingTime = DateTime.Minutes(7) + RemainingTime = DateTime.Minutes(7) elseif Difficulty == "normal" then - remainingTime = DateTime.Minutes(6) + RemainingTime = DateTime.Minutes(6) elseif Difficulty == "hard" then - remainingTime = DateTime.Minutes(5) + RemainingTime = DateTime.Minutes(5) end Dogs = { Dog1, Dog2, Dog3, Dog4, Dog5, Dog6, Dog7, Dog8, Dog9, Dog10, Dog11, Dog12, Dog13, Dog14, Dog15, Dog16, Dog17, Dog18, Dog19 } @@ -40,61 +40,61 @@ RSoldierTrapTrigger = { CPos.New(72, 72), CPos.New(72,73), CPos.New(72,74) } SoldierTrap2Trigger = { CPos.New(51, 73), CPos.New(51, 74) } Trigger.OnEnteredFootprint(CameraCCTrigger, function(a, id) - if not cameraCCTrigger and a.Owner == player then - cameraCCTrigger = true - Actor.Create("camera", true, { Owner = player, Location = CameraCC.Location }) + if not CameraCCTriggered and a.Owner == USSR then + CameraCCTriggered = true + Actor.Create("camera", true, { Owner = USSR, Location = CameraCC.Location }) end end) Trigger.OnEnteredFootprint(CameraGoalCenterTrigger, function(a, id) - if not cameraGoalCenterTrigger and a.Owner == player then - cameraGoalCenterTrigger = true - if not controlCenterEngineerTrigger then - Actor.Create("camera", true, { Owner = player, Location = CameraGoalCenter1.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraGoalCenter2.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraGoalCenter3.Location }) + if not CameraGoalCenterTriggered and a.Owner == USSR then + CameraGoalCenterTriggered = true + if not ControlCenterEngineerTriggered then + Actor.Create("camera", true, { Owner = USSR, Location = CameraGoalCenter1.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraGoalCenter2.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraGoalCenter3.Location }) end end end) Trigger.OnEnteredFootprint(CameraGoalLeftTrigger, function(a, id) - if not cameraGoalLeftTrigger and a.Owner == player then - cameraGoalLeftTrigger = true - Actor.Create("camera", true, { Owner = player, Location = CameraGoalLeft1.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraGoalLeft2.Location }) + if not CameraGoalLeftTriggered and a.Owner == USSR then + CameraGoalLeftTriggered = true + Actor.Create("camera", true, { Owner = USSR, Location = CameraGoalLeft1.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraGoalLeft2.Location }) end end) Trigger.OnEnteredFootprint(CameraGoalRightTrigger, function(a, id) - if not cameraGoalRightTrigger and a.Owner == player then - cameraGoalRightTrigger = true - Actor.Create("camera", true, { Owner = player, Location = CameraGoalRight1.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraGoalRight2.Location }) + if not CameraGoalRightTriggered and a.Owner == USSR then + CameraGoalRightTriggered = true + Actor.Create("camera", true, { Owner = USSR, Location = CameraGoalRight1.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraGoalRight2.Location }) end end) Trigger.OnEnteredFootprint(ControlCenterTrigger, function(a, id) - if not controlCenterTrigger and a.Owner == player and a.Type == "e1" then - controlCenterTrigger = true + if not ControlCenterTriggered and a.Owner == USSR and a.Type == "e1" then + ControlCenterTriggered = true FTurPrisoners.Kill() FTurLeft.Kill() FTurRight.Kill() FTurBottom.Kill() - player.MarkCompletedObjective(sovietObjective1) + USSR.MarkCompletedObjective(SovietObjective1) end end) Trigger.OnEnteredFootprint(ControlCenterEngineerTrigger, function(a, id) - if not controlCenterEngineerTrigger and a.Owner == player and a.Type == "e6" then - controlCenterEngineerTrigger = true - local fturA = Actor.Create("ftur", true, { Owner = player, Location = FTur1Goal.Location}) - local fturB = Actor.Create("ftur", true, { Owner = player, Location = FTur2Goal.Location}) + if not ControlCenterEngineerTriggered and a.Owner == USSR and a.Type == "e6" then + ControlCenterEngineerTriggered = true + local fturA = Actor.Create("ftur", true, { Owner = USSR, Location = FTur1Goal.Location}) + local fturB = Actor.Create("ftur", true, { Owner = USSR, Location = FTur2Goal.Location}) Camera.Position = CameraGoalCenter1.CenterPosition - if not cameraGoalRightTrigger then - Actor.Create("camera", true, { Owner = player, Location = CameraGoalCenter1.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraGoalCenter2.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraGoalCenter3.Location }) + if not CameraGoalRightTriggered then + Actor.Create("camera", true, { Owner = USSR, Location = CameraGoalCenter1.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraGoalCenter2.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraGoalCenter3.Location }) end Utils.Do(GoalGuards, function(actor) @@ -108,75 +108,75 @@ Trigger.OnEnteredFootprint(ControlCenterEngineerTrigger, function(a, id) Tanya.Demolish(fturB) end - player.MarkCompletedObjective(sovietObjective4) + USSR.MarkCompletedObjective(SovietObjective4) end end) Trigger.OnEnteredFootprint(FTurBottomTrigger, function(a, id) - if not fTurBottomTrigger and a.Owner == player then - fTurBottomTrigger = true - if not rSoldierTrapTrigger then - Actor.Create("camera", true, { Owner = player, Location = CameraRSoldier.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraFTurBottom.Location }) + if not FTurBottomTriggered and a.Owner == USSR then + FTurBottomTriggered = true + if not RSoldierTrapTriggered then + Actor.Create("camera", true, { Owner = USSR, Location = CameraRSoldier.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraFTurBottom.Location }) end end end) Trigger.OnEnteredFootprint(FTurLeftTrigger, function(a, id) - if not fTurLeftTrigger and a.Owner == player then - fTurLeftTrigger = true - Actor.Create("camera", true, { Owner = player, Location = CameraFTurLeft.Location }) + if not FTurLeftTriggered and a.Owner == USSR then + FTurLeftTriggered = true + Actor.Create("camera", true, { Owner = USSR, Location = CameraFTurLeft.Location }) end end) Trigger.OnEnteredFootprint(FTurRightTrigger, function(a, id) - if not fTurRightTrigger and a.Owner == player then - fTurRightTrigger = true - Actor.Create("camera", true, { Owner = player, Location = CameraFTurRight.Location }) + if not FTurRightTriggered and a.Owner == USSR then + FTurRightTriggered = true + Actor.Create("camera", true, { Owner = USSR, Location = CameraFTurRight.Location }) end end) Trigger.OnEnteredFootprint(GoalCenterTrigger, function(a, id) - if not goalCenterTrigger and a.Owner == player and a.Type == "e6" then - goalCenterTrigger = true - player.MarkCompletedObjective(sovietObjective5) + if not GoalCenterTriggered and a.Owner == USSR and a.Type == "e6" then + GoalCenterTriggered = true + USSR.MarkCompletedObjective(SovietObjective5) end end) Trigger.OnEnteredFootprint(GoalLeft1Trigger, function(a, id) - if not goalLeft1Trigger and a.Owner == player and a.Type == "e6" then - goalLeft1Trigger = true - Media.PlaySpeechNotification(player, "ControlCenterDeactivated") + if not GoalLeft1Triggered and a.Owner == USSR and a.Type == "e6" then + GoalLeft1Triggered = true + Media.PlaySpeechNotification(USSR, "ControlCenterDeactivated") end end) Trigger.OnEnteredFootprint(GoalLeft2Trigger, function(a, id) - if not goalLeft2Trigger and a.Owner == player and a.Type == "e6" then - goalLeft2Trigger = true - Media.PlaySpeechNotification(player, "ControlCenterDeactivated") + if not GoalLeft2Triggered and a.Owner == USSR and a.Type == "e6" then + GoalLeft2Triggered = true + Media.PlaySpeechNotification(USSR, "ControlCenterDeactivated") end end) Trigger.OnEnteredFootprint(GoalRight1Trigger, function(a, id) - if not goalRight1Trigger and a.Owner == player and a.Type == "e6" then - goalRight1Trigger = true - Media.PlaySpeechNotification(player, "ControlCenterDeactivated") + if not GoalRight1Triggered and a.Owner == USSR and a.Type == "e6" then + GoalRight1Triggered = true + Media.PlaySpeechNotification(USSR, "ControlCenterDeactivated") end end) Trigger.OnEnteredFootprint(GoalRight2Trigger, function(a, id) - if not goalRight2Trigger and a.Owner == player and a.Type == "e6" then - goalRight2Trigger = true - Media.PlaySpeechNotification(player, "ControlCenterDeactivated") + if not GoalRight2Triggered and a.Owner == USSR and a.Type == "e6" then + GoalRight2Triggered = true + Media.PlaySpeechNotification(USSR, "ControlCenterDeactivated") end end) Trigger.OnEnteredFootprint(RSoldierTrapTrigger, function(a, id) - if not rSoldierTrapTrigger and a.Owner == player then - rSoldierTrapTrigger = true - if not fTurBottomTrigger then - Actor.Create("camera", true, { Owner = player, Location = CameraRSoldier.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraFTurBottom.Location }) + if not RSoldierTrapTriggered and a.Owner == USSR then + RSoldierTrapTriggered = true + if not FTurBottomTriggered then + Actor.Create("camera", true, { Owner = USSR, Location = CameraRSoldier.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraFTurBottom.Location }) end if not RSoldier1.IsDead and not RSoldierTrap1.IsDead then @@ -190,9 +190,9 @@ Trigger.OnEnteredFootprint(RSoldierTrapTrigger, function(a, id) end) Trigger.OnEnteredFootprint(SoldierTrap2Trigger, function(a, id) - if not soldierTrap2Trigger and a.Owner == player then - soldierTrap2Trigger = true - Actor.Create("camera", true, { Owner = player, Location = CameraSoldierTrap2.Location }) + if not SoldierTrap2Triggered and a.Owner == USSR then + SoldierTrap2Triggered = true + Actor.Create("camera", true, { Owner = USSR, Location = CameraSoldierTrap2.Location }) if not SoldierTrap2.IsDead then PrisonEntranceGuard.Attack(SoldierTrap2) end @@ -201,22 +201,22 @@ Trigger.OnEnteredFootprint(SoldierTrap2Trigger, function(a, id) end) Trigger.OnAllKilled(Engineers, function() - enemy.MarkCompletedObjective(alliedObjective) + Greece.MarkCompletedObjective(AlliedObjective) end) Trigger.OnAllKilled(PrisonerGuards, function() Utils.Do(Engineers, function(actor) - actor.Owner = player + actor.Owner = USSR end) - Prisoner6.Owner = player - player.MarkCompletedObjective(sovietObjective2) + Prisoner6.Owner = USSR + USSR.MarkCompletedObjective(SovietObjective2) end) Trigger.OnKilled(BarlCC, function() - if not cameraCCTrigger then - Actor.Create("camera", true, { Owner = player, Location = CameraCC.Location }) - cameraCCTrigger = true + if not CameraCCTriggered then + Actor.Create("camera", true, { Owner = USSR, Location = CameraCC.Location }) + CameraCCTriggered = true end Utils.Do(CCGuards, function(actor) @@ -229,13 +229,13 @@ end) Trigger.OnKilled(PBoxBrl, function() PBox.Kill() Utils.Do(Dogs, function(actor) - actor.Owner = player + actor.Owner = USSR end) - player.MarkCompletedObjective(sovietObjective6) + USSR.MarkCompletedObjective(SovietObjective6) end) Trigger.OnKilled(PrisonEntranceGuard, function() - if controlCenterTrigger then + if ControlCenterTriggered then Utils.Do(PrisonerGuards, function(actor) if not actor.IsDead then actor.Hunt() @@ -245,7 +245,7 @@ Trigger.OnKilled(PrisonEntranceGuard, function() end) IntroSequence = function() - StartingUnits = Reinforcements.Reinforce(player, StartingUnitsReinforcements, { StartingUnitsSpawn.Location, SoldierTrap1Waypoint1.Location }, 0) + StartingUnits = Reinforcements.Reinforce(USSR, StartingUnitsReinforcements, { StartingUnitsSpawn.Location, SoldierTrap1Waypoint1.Location }, 0) Trigger.AfterDelay(DateTime.Seconds(3), function() Utils.Do(EntranceGuards, function(actor) if not SoldierTrap1.IsDead then @@ -255,67 +255,67 @@ IntroSequence = function() actor.AttackMove(SoldierTrap1Waypoint2.Location) actor.AttackMove(SoldierTrap1Waypoint3.Location) end) - Media.PlaySpeechNotification(player, "TimerStarted") - timerStarted = true + Media.PlaySpeechNotification(USSR, "TimerStarted") + TimerStarted = true end) -- Trigger a game over if the player lost all human units before the security system has been deactivated Trigger.OnAllKilled(StartingUnits, function() - if not controlCenterTrigger then - enemy.MarkCompletedObjective(alliedObjective) + if not ControlCenterTriggered then + Greece.MarkCompletedObjective(AlliedObjective) end end) end WorldLoaded = function() - player = Player.GetPlayer("USSR") - enemy = Player.GetPlayer("Greece") + USSR = Player.GetPlayer("USSR") + Greece = Player.GetPlayer("Greece") Camera.Position = SoldierTrap1Waypoint1.CenterPosition - Actor.Create("camera", true, { Owner = player, Location = CameraStart1.Location }) - Actor.Create("camera", true, { Owner = player, Location = CameraStart2.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraStart1.Location }) + Actor.Create("camera", true, { Owner = USSR, Location = CameraStart2.Location }) IntroSequence() - InitObjectives(player) - alliedObjective = AddPrimaryObjective(enemy, "") - sovietObjective1 = AddPrimaryObjective(player, "deactivate-security-system") - sovietObjective2 = AddPrimaryObjective(player, "rescue-engineers") - sovietObjective3 = AddPrimaryObjective(player, "engineers-coolant-station") - sovietObjective4 = AddPrimaryObjective(player, "engineer-reprogram-security") - sovietObjective5 = AddPrimaryObjective(player, "engineer-reactor-core") - sovietObjective6 = AddSecondaryObjective(player, "free-dogs") + InitObjectives(USSR) + AlliedObjective = AddPrimaryObjective(Greece, "") + SovietObjective1 = AddPrimaryObjective(USSR, "deactivate-security-system") + SovietObjective2 = AddPrimaryObjective(USSR, "rescue-engineers") + SovietObjective3 = AddPrimaryObjective(USSR, "engineers-coolant-station") + SovietObjective4 = AddPrimaryObjective(USSR, "engineer-reprogram-security") + SovietObjective5 = AddPrimaryObjective(USSR, "engineer-reactor-core") + SovietObjective6 = AddSecondaryObjective(USSR, "free-dogs") end Tick = function() - if player.HasNoRequiredUnits() and timerStarted then - enemy.MarkCompletedObjective(alliedObjective) + if USSR.HasNoRequiredUnits() and TimerStarted then + Greece.MarkCompletedObjective(AlliedObjective) end - if remainingTime == DateTime.Minutes(5) and Difficulty ~= "hard" then - Media.PlaySpeechNotification(player, "WarningFiveMinutesRemaining") - elseif remainingTime == DateTime.Minutes(4) then - Media.PlaySpeechNotification(player, "WarningFourMinutesRemaining") - elseif remainingTime == DateTime.Minutes(3) then - Media.PlaySpeechNotification(player, "WarningThreeMinutesRemaining") - elseif remainingTime == DateTime.Minutes(2) then - Media.PlaySpeechNotification(player, "WarningTwoMinutesRemaining") - elseif remainingTime == DateTime.Minutes(1) then - Media.PlaySpeechNotification(player, "WarningOneMinuteRemaining") + if RemainingTime == DateTime.Minutes(5) and Difficulty ~= "hard" then + Media.PlaySpeechNotification(USSR, "WarningFiveMinutesRemaining") + elseif RemainingTime == DateTime.Minutes(4) then + Media.PlaySpeechNotification(USSR, "WarningFourMinutesRemaining") + elseif RemainingTime == DateTime.Minutes(3) then + Media.PlaySpeechNotification(USSR, "WarningThreeMinutesRemaining") + elseif RemainingTime == DateTime.Minutes(2) then + Media.PlaySpeechNotification(USSR, "WarningTwoMinutesRemaining") + elseif RemainingTime == DateTime.Minutes(1) then + Media.PlaySpeechNotification(USSR, "WarningOneMinuteRemaining") end - if goalLeft1Trigger and goalLeft2Trigger and goalRight1Trigger and goalRight2Trigger then - player.MarkCompletedObjective(sovietObjective3) + if GoalLeft1Triggered and GoalLeft2Triggered and GoalRight1Triggered and GoalRight2Triggered then + USSR.MarkCompletedObjective(SovietObjective3) end - if remainingTime > 0 and timerStarted then - if (remainingTime % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("time-until-meltdown", { ["time"] = Utils.FormatTime(remainingTime) }) - UserInterface.SetMissionText(Timer, player.Color) + if RemainingTime > 0 and TimerStarted then + if (RemainingTime % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("time-until-meltdown", { ["time"] = Utils.FormatTime(RemainingTime) }) + UserInterface.SetMissionText(Timer, USSR.Color) end - remainingTime = remainingTime - 1 - elseif remainingTime == 0 then + RemainingTime = RemainingTime - 1 + elseif RemainingTime == 0 then UserInterface.SetMissionText("") - enemy.MarkCompletedObjective(alliedObjective) + Greece.MarkCompletedObjective(AlliedObjective) end end diff --git a/mods/ra/maps/soviet-10/soviet10.lua b/mods/ra/maps/soviet-10/soviet10.lua index 0c579c1bc6..7efab0fd55 100644 --- a/mods/ra/maps/soviet-10/soviet10.lua +++ b/mods/ra/maps/soviet-10/soviet10.lua @@ -45,7 +45,7 @@ HunterTeam = { "1tnk", "1tnk", "1tnk", "1tnk", "2tnk", "2tnk", "arty" } StartTimer = false TimerColor = Player.GetPlayer("USSR").Color TimerTicks = DateTime.Minutes(9) -ticked = TimerTicks +Ticked = TimerTicks StartTimerDelay = { easy = DateTime.Minutes(5), @@ -144,9 +144,9 @@ MissionSetup = function() end) Trigger.OnEnteredFootprint(LightVehicleAttackTrigger, function(unit, id) - if not attackTriggered and unit.Type == "3tnk" then + if not AttackTriggered and unit.Type == "3tnk" then Trigger.RemoveFootprintTrigger(id) - attackTriggered = true + AttackTriggered = true Utils.Do(LightVehicleAttack, function(unit) if not unit.IsDead then @@ -157,9 +157,9 @@ MissionSetup = function() end) Trigger.OnEnteredFootprint(EngiDropTriggerArea, function(unit, id) - if unit.Owner == USSR and not dropTriggered then + if unit.Owner == USSR and not DropTriggered then Trigger.RemoveFootprintTrigger(id) - dropTriggered = true + DropTriggered = true Media.PlaySpeechNotification(USSR, "SignalFlare") local engiFlare = Actor.Create("flare", true, { Owner = USSR, Location = EngiDropLZ.Location }) @@ -174,9 +174,9 @@ MissionSetup = function() end) Trigger.OnEnteredFootprint(ChinookAmbushTrigger, function(unit, id) - if not chinookTriggered and unit.Owner == USSR then + if not ChinookTriggered and unit.Owner == USSR then Trigger.RemoveFootprintTrigger(id) - chinookTriggered = true + ChinookTriggered = true local chalk = Reinforcements.ReinforceWithTransport(Greece, "tran", ChinookChalk , ChinookPath, { ChinookPath[1] })[2] Utils.Do(chalk, function(unit) @@ -224,7 +224,7 @@ ClosestActorTo = function(actors, target) local closestActor = nil Utils.Do(actors, function(actor) local offset = actor.Location - target.Location - distSq = offset.X * offset.X + offset.Y * offset.Y + local distSq = offset.X * offset.X + offset.Y * offset.Y if closestActor == nil or distSq < closestDistSq then closestDistSq = distSq closestActor = actor @@ -289,16 +289,16 @@ end Tick = function() if StartTimer then - if ticked > 0 then - if (ticked % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("corridor-closes-in", { ["time"] = Utils.FormatTime(ticked) }) + if Ticked > 0 then + if (Ticked % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("corridor-closes-in", { ["time"] = Utils.FormatTime(Ticked) }) UserInterface.SetMissionText(Timer, TimerColor) end - ticked = ticked - 1 - elseif ticked == 0 then + Ticked = Ticked - 1 + elseif Ticked == 0 then FinishTimer() SendHunters() - ticked = ticked - 1 + Ticked = Ticked - 1 end end diff --git a/mods/ra/maps/soviet-soldier-volkov-n-chitzkoi/soviet-soldier-volkov-n-chitzkoi-AI.lua b/mods/ra/maps/soviet-soldier-volkov-n-chitzkoi/soviet-soldier-volkov-n-chitzkoi-AI.lua index 88c593e3cc..879d93be82 100644 --- a/mods/ra/maps/soviet-soldier-volkov-n-chitzkoi/soviet-soldier-volkov-n-chitzkoi-AI.lua +++ b/mods/ra/maps/soviet-soldier-volkov-n-chitzkoi/soviet-soldier-volkov-n-chitzkoi-AI.lua @@ -54,13 +54,13 @@ end ProduceInfantry = function() if AlliedBarracks01.IsDead then return - elseif (OreRefinery01.IsDead and OreRefinery02.IsDead or GreeceHarvestersAreDead) and greece.Resources <= 299 then + elseif (OreRefinery01.IsDead and OreRefinery02.IsDead or GreeceHarvestersAreDead) and Greece.Resources <= 299 then return end local delay = Utils.RandomInteger(DateTime.Seconds(1), DateTime.Seconds(2)) local toBuild = { Utils.Random(AlliedInfantryTypes) } - greece.Build(toBuild, function(unit) + Greece.Build(toBuild, function(unit) InfAttack[#InfAttack + 1] = unit[1] if #InfAttack >= 5 then @@ -76,7 +76,7 @@ end ProduceArmor = function() if AlliedWarFact01.IsDead and AlliedWarFact02.IsDead then return - elseif (OreRefinery01.IsDead and OreRefinery02.IsDead or GreeceHarvestersAreDead) and greece.Resources <= 699 then + elseif (OreRefinery01.IsDead and OreRefinery02.IsDead or GreeceHarvestersAreDead) and Greece.Resources <= 699 then return end @@ -84,7 +84,7 @@ ProduceArmor = function() local toBuild = { Utils.Random(AlliedArmorTypes) } local Rally = Utils.Random(AlliedWarFactRally) Utils.Do(AlliedWarFact, function(fact) fact.RallyPoint = Rally.Location end) - greece.Build(toBuild, function(unit) + Greece.Build(toBuild, function(unit) ArmorAttack[#ArmorAttack + 1] = unit[1] if #ArmorAttack >= ArmorAttackNumbers[Difficulty] then @@ -100,11 +100,11 @@ end ProduceNavyGuard = function() if NavalYard01.IsDead then return - elseif (OreRefinery01.IsDead and OreRefinery02.IsDead or GreeceHarvestersAreDead) and greece.Resources <= 2399 then + elseif (OreRefinery01.IsDead and OreRefinery02.IsDead or GreeceHarvestersAreDead) and Greece.Resources <= 2399 then return end NavalYard01.RallyPoint = waypoint26.Location - greece.Build(AlliedNavyGuard, function(nvgrd) + Greece.Build(AlliedNavyGuard, function(nvgrd) Utils.Do(nvgrd, function(unit) Trigger.OnKilled(unit, ProduceNavyGuard) end) diff --git a/mods/ra/maps/soviet-soldier-volkov-n-chitzkoi/soviet-soldier-volkov-n-chitzkoi.lua b/mods/ra/maps/soviet-soldier-volkov-n-chitzkoi/soviet-soldier-volkov-n-chitzkoi.lua index f87bc80835..d24eedc77e 100644 --- a/mods/ra/maps/soviet-soldier-volkov-n-chitzkoi/soviet-soldier-volkov-n-chitzkoi.lua +++ b/mods/ra/maps/soviet-soldier-volkov-n-chitzkoi/soviet-soldier-volkov-n-chitzkoi.lua @@ -40,13 +40,13 @@ AlloyFacilityDestroyed = false WorldLoaded = function() --Players Setup - player = Player.GetPlayer("USSR") - greece = Player.GetPlayer("Greece") - goodguy = Player.GetPlayer("GoodGuy") - spain = Player.GetPlayer("Spain") - france = Player.GetPlayer("France") + USSR = Player.GetPlayer("USSR") + Greece = Player.GetPlayer("Greece") + GoodGuy = Player.GetPlayer("GoodGuy") + Spain = Player.GetPlayer("Spain") + France = Player.GetPlayer("France") - greece.Cash = 20000 + Greece.Cash = 20000 Camera.Position = DefaultCameraPosition.CenterPosition @@ -62,45 +62,45 @@ WorldLoaded = function() end --Objectives Setup - InitObjectives(player) + InitObjectives(USSR) - DestroyControlCenter = AddPrimaryObjective(player, "destroy-control-center") - KeepTanksAlive = AddPrimaryObjective(player, "tank-division-must-not-be-destroyed") - KeepVolkovAlive = AddPrimaryObjective(player, "volkov-survive") - KeepChitzkoiAlive = AddSecondaryObjective(player, "keep-chitzkoi-alive") + DestroyControlCenter = AddPrimaryObjective(USSR, "destroy-control-center") + KeepTanksAlive = AddPrimaryObjective(USSR, "tank-division-must-not-be-destroyed") + KeepVolkovAlive = AddPrimaryObjective(USSR, "volkov-survive") + KeepChitzkoiAlive = AddSecondaryObjective(USSR, "keep-chitzkoi-alive") Trigger.OnKilled(ControlCenter, function() Utils.Do(HeavyTurrets, function(struc) if not struc.IsDead then struc.Kill() end end) - player.MarkCompletedObjective(DestroyControlCenter) - DestroyAlloyFacility = AddPrimaryObjective(player, "destroy-alloy-facility") - Media.PlaySpeechNotification(player, "FirstObjectiveMet") + USSR.MarkCompletedObjective(DestroyControlCenter) + DestroyAlloyFacility = AddPrimaryObjective(USSR, "destroy-alloy-facility") + Media.PlaySpeechNotification(USSR, "FirstObjectiveMet") Media.DisplayMessage(UserInterface.Translate("heavy-turret-control-destroyed")) end) Trigger.OnKilled(AlloyFacility, function() - if not player.IsObjectiveCompleted(DestroyControlCenter) then --Prevent a crash if the player somehow manage to cheese the mission and destroy - player.MarkCompletedObjective(DestroyControlCenter) --the Alloy Facility without destroying the Control Center. - DestroyAlloyFacility = AddPrimaryObjective(player, "destroy-alloy-facility") + if not USSR.IsObjectiveCompleted(DestroyControlCenter) then --Prevent a crash if the player somehow manage to cheese the mission and destroy + USSR.MarkCompletedObjective(DestroyControlCenter) --the Alloy Facility without destroying the Control Center. + DestroyAlloyFacility = AddPrimaryObjective(USSR, "destroy-alloy-facility") end Trigger.AfterDelay(DateTime.Seconds(2), function() - player.MarkCompletedObjective(DestroyAlloyFacility) - player.MarkCompletedObjective(KeepTanksAlive) - player.MarkCompletedObjective(KeepVolkovAlive) - player.MarkCompletedObjective(KeepChitzkoiAlive) + USSR.MarkCompletedObjective(DestroyAlloyFacility) + USSR.MarkCompletedObjective(KeepTanksAlive) + USSR.MarkCompletedObjective(KeepVolkovAlive) + USSR.MarkCompletedObjective(KeepChitzkoiAlive) end) AlloyFacilityDestroyed = true - Media.PlaySpeechNotification(player, "SecondObjectiveMet") + Media.PlaySpeechNotification(USSR, "SecondObjectiveMet") end) Trigger.OnAllKilled(PlayerTankDivision, function() - if not AlloyFacilityDestroyed then player.MarkFailedObjective(KeepTanksAlive) end + if not AlloyFacilityDestroyed then USSR.MarkFailedObjective(KeepTanksAlive) end end) Trigger.AfterDelay(0, function() - local AlliedBaseCamera = Actor.Create("camera", true, { Owner = player, Location = waypoint12.Location }) - local SuperTeamCamera = Actor.Create("camera", true, { Owner = player, Location = DefaultCameraPosition.Location }) + local AlliedBaseCamera = Actor.Create("camera", true, { Owner = USSR, Location = waypoint12.Location }) + local SuperTeamCamera = Actor.Create("camera", true, { Owner = USSR, Location = DefaultCameraPosition.Location }) Trigger.AfterDelay(1, function() if AlliedBaseCamera.IsInWorld then AlliedBaseCamera.Destroy() end end) @@ -112,9 +112,9 @@ WorldLoaded = function() --Super Team Setup Trigger.AfterDelay(DateTime.Seconds(2), function() local spawn = superteamspawn.CenterPosition + WVec.New(0, 0, Actor.CruiseAltitude("badr")) - local transport = Actor.Create("badr", true, { CenterPosition = spawn, Owner = player, Facing = (superteamdrop.CenterPosition - spawn).Facing, Health = 3 }) + local transport = Actor.Create("badr", true, { CenterPosition = spawn, Owner = USSR, Facing = (superteamdrop.CenterPosition - spawn).Facing, Health = 3 }) Utils.Do(SuperTeam, function(type) - local a = Actor.Create(type, false, { Owner = player }) + local a = Actor.Create(type, false, { Owner = USSR }) transport.LoadPassenger(a) if a.Type == "volk" then VolkovIsDead(a) @@ -123,12 +123,12 @@ WorldLoaded = function() ChitzkoiIsDead(a) end end) - Media.PlaySpeechNotification(player, "ReinforcementsArrived") + Media.PlaySpeechNotification(USSR, "ReinforcementsArrived") transport.Paradrop(CPos.New(21, 82)) end) Trigger.OnEnteredFootprint(SuperTeamLandCell, function(unit, id) - if unit.Owner == player then + if unit.Owner == USSR then Trigger.RemoveFootprintTrigger(id) Trigger.AfterDelay(DateTime.Seconds(2), function() if not BarrelsShooter[1].IsDead then @@ -147,14 +147,14 @@ WorldLoaded = function() --Guards Squads Setup -- I used proximity triggers to make them hunt you down in order to mimic their behavior from the original mission Trigger.OnEnteredProximityTrigger(RangerGuard01.CenterPosition, WDist.New(70 * 70), function(unit, id) - if not RangerGuard01.IsDead and unit.Owner == player then + if not RangerGuard01.IsDead and unit.Owner == USSR then Trigger.OnIdle(RangerGuard01, RangerGuard01.Hunt) Trigger.RemoveProximityTrigger(id) end end) Trigger.OnEnteredProximityTrigger(waypoint7.CenterPosition, WDist.FromCells(6), function(unit, id) - if unit.Owner == player then + if unit.Owner == USSR then Utils.Do(InfGuardSquad01, function(actor) if not actor.IsDead then Trigger.OnIdle(actor, actor.Hunt) @@ -165,7 +165,7 @@ WorldLoaded = function() end) Trigger.OnEnteredProximityTrigger(InfGuardSquad02Unit01.CenterPosition, WDist.FromCells(6), function(unit, id) - if unit.Owner == player and (unit.Type == "volk" or unit.Type == "zkoi") then + if unit.Owner == USSR and (unit.Type == "volk" or unit.Type == "zkoi") then Utils.Do(InfGuardSquad02, function(actor) if not actor.IsDead then Trigger.OnIdle(actor, actor.Hunt) @@ -176,8 +176,8 @@ WorldLoaded = function() end) Trigger.OnEnteredProximityTrigger(InfGuardSquad03Unit05.CenterPosition, WDist.FromCells(8), function(unit, id) - if unit.Owner == player then - local HospitalCamera = Actor.Create("camera", true, { Owner = player, Location = waypoint13.Location }) + if unit.Owner == USSR then + local HospitalCamera = Actor.Create("camera", true, { Owner = USSR, Location = waypoint13.Location }) Utils.Do(InfGuardSquad03, function(actor) if not actor.IsDead then Trigger.OnIdle(actor, actor.Hunt) @@ -199,7 +199,7 @@ WorldLoaded = function() end) Trigger.OnEnteredProximityTrigger(LightTankGuard02.CenterPosition, WDist.FromCells(8), function(unit, id) - if not LightTankGuard02.IsDead and unit.Owner == player and (unit.Type == "volk" or unit.Type == "zkoi") then + if not LightTankGuard02.IsDead and unit.Owner == USSR and (unit.Type == "volk" or unit.Type == "zkoi") then Trigger.OnIdle(LightTankGuard02, LightTankGuard02.Hunt) Trigger.RemoveProximityTrigger(id) end @@ -207,10 +207,10 @@ WorldLoaded = function() --Tanya Squad Setup Trigger.OnEnteredFootprint(TanyaTrigger, function(unit, id) - if unit.Owner == player then + if unit.Owner == USSR then if not TanyaSquadTanya.IsDead then - local TanyaSquadCamera = Actor.Create("camera", true, { Owner = player, Location = waypoint85.Location }) - Media.PlaySoundNotification(player, "rokroll") + local TanyaSquadCamera = Actor.Create("camera", true, { Owner = USSR, Location = waypoint85.Location }) + Media.PlaySoundNotification(USSR, "rokroll") Utils.Do(TanyaSquad, function(actor) if not actor.IsDead then Trigger.OnIdle(actor, actor.Hunt) @@ -239,9 +239,9 @@ WorldLoaded = function() end) Trigger.OnEnteredFootprint(CivTeam01Trigger, function(unit, id) - if unit.Owner == player then + if unit.Owner == USSR then if not TownHouse03.IsDead then - local civ01 = Reinforcements.Reinforce(spain, CivTeam01, { civteam01spawn.Location }, 0) + local civ01 = Reinforcements.Reinforce(Spain, CivTeam01, { civteam01spawn.Location }, 0) Utils.Do(civ01, function(actor) if not actor.IsDead then Trigger.OnIdle(actor, actor.Hunt) @@ -253,9 +253,9 @@ WorldLoaded = function() end) Trigger.OnEnteredFootprint(CivTeam02Trigger, function(unit, id) - if unit.Owner == player then + if unit.Owner == USSR then if not TownHouse04.IsDead then - local civ02 = Reinforcements.Reinforce(spain, CivTeam02, { civteam02spawn.Location }, 0) + local civ02 = Reinforcements.Reinforce(Spain, CivTeam02, { civteam02spawn.Location }, 0) Utils.Do(civ02, function(actor) if not actor.IsDead then Trigger.OnIdle(actor, actor.Hunt) @@ -268,8 +268,8 @@ WorldLoaded = function() --Minefield Setup Trigger.OnEnteredFootprint(MineSoldierTrigger, function(unit, id) - if unit.Owner == player then - local MineSoldierCamera1 = Actor.Create("camera", true, { Owner = player, Location = waypoint96.Location }) + if unit.Owner == USSR then + local MineSoldierCamera1 = Actor.Create("camera", true, { Owner = USSR, Location = waypoint96.Location }) Trigger.AfterDelay(DateTime.Seconds(10), function() if MineSoldierCamera1.IsInWorld then MineSoldierCamera1.Destroy() end end) @@ -296,8 +296,8 @@ WorldLoaded = function() end) Trigger.OnEnteredFootprint(MineRevealTrigger, function(unit, id) - if unit.Owner == goodguy then - local MineSoldierCamera2 = Actor.Create("camera", true, { Owner = player, Location = waypoint76.Location }) + if unit.Owner == GoodGuy then + local MineSoldierCamera2 = Actor.Create("camera", true, { Owner = USSR, Location = waypoint76.Location }) Trigger.AfterDelay(DateTime.Seconds(12), function() if MineSoldierCamera2.IsInWorld then MineSoldierCamera2.Destroy() end end) @@ -307,10 +307,10 @@ WorldLoaded = function() --Paradrop Rifle Team Setup Trigger.OnEnteredFootprint(ParaTrigger, function(unit, id) - if unit.Owner == player then - local powerproxy = Actor.Create("powerproxy.pararifles", true, { Owner = greece }) + if unit.Owner == USSR then + local powerproxy = Actor.Create("powerproxy.pararifles", true, { Owner = Greece }) local aircraft = powerproxy.TargetParatroopers(waypoint89.CenterPosition, Angle.South) - local prtcamera = Actor.Create("camera", true, { Owner = player, Location = waypoint89.Location }) + local prtcamera = Actor.Create("camera", true, { Owner = USSR, Location = waypoint89.Location }) Utils.Do(aircraft, function(a) Trigger.OnPassengerExited(a, function(t, p) IdleHunt(p) @@ -332,7 +332,7 @@ WorldLoaded = function() end) Trigger.AfterDelay(DateTime.Seconds(1), function() - local GreeceHarvesters = greece.GetActorsByType("harv") + local GreeceHarvesters = Greece.GetActorsByType("harv") Trigger.OnAllKilled(GreeceHarvesters, function() GreeceHarvestersAreDead = true end) @@ -342,16 +342,16 @@ end VolkovIsDead = function(a) Trigger.OnKilled(a, function() - player.MarkFailedObjective(KeepVolkovAlive) + USSR.MarkFailedObjective(KeepVolkovAlive) end) end ChitzkoiIsDead = function(a) Trigger.OnKilled(a, function() - player.MarkFailedObjective(KeepChitzkoiAlive) + USSR.MarkFailedObjective(KeepChitzkoiAlive) Media.DisplayMessage(UserInterface.Translate("rebuild-chitzkoy")) Trigger.AfterDelay(DateTime.Seconds(1), function() - Media.PlaySpeechNotification(player, "ObjectiveNotMet") + Media.PlaySpeechNotification(USSR, "ObjectiveNotMet") end) end) end diff --git a/mods/ra/maps/survival01/survival01.lua b/mods/ra/maps/survival01/survival01.lua index a41386ca28..1d0db6acb7 100644 --- a/mods/ra/maps/survival01/survival01.lua +++ b/mods/ra/maps/survival01/survival01.lua @@ -70,7 +70,7 @@ SovietGateRallyPoints = { AlliesBaseGate2, AlliesBaseGate2, AlliesBaseGate1, All Airfields = { SovietAirfield1, SovietAirfield2, SovietAirfield3 } SovietBuildings = { Barrack1, SubPen, RadarDome, AdvancedPowerPlant1, AdvancedPowerPlant2, AdvancedPowerPlant3, WarFactory, Refinery, Silo1, Silo2, FlameTower1, FlameTower2, FlameTower3, Sam1, Sam2, Sam3, Sam4, SovietAirfield1, SovietAirfield2, SovietAirfield3 } -IdleTrigger = function(units, dest) +IdleTrigger = function(units, _) Utils.Do(units, function(unit) if not unit.IsDead then @@ -108,32 +108,32 @@ SetupHuntTrigger = function(units) end) end -ticked = TimerTicks +Ticked = TimerTicks Tick = function() - if KillObj and soviets.HasNoRequiredUnits() then - allies.MarkCompletedObjective(KillObj) + if KillObj and Soviets.HasNoRequiredUnits() then + Allies.MarkCompletedObjective(KillObj) end - if allies.HasNoRequiredUnits() then - soviets.MarkCompletedObjective(SovietObj) + if Allies.HasNoRequiredUnits() then + Soviets.MarkCompletedObjective(SovietObj) end - if soviets.Resources > soviets.ResourceCapacity / 2 then - soviets.Resources = soviets.ResourceCapacity / 2 + if Soviets.Resources > Soviets.ResourceCapacity / 2 then + Soviets.Resources = Soviets.ResourceCapacity / 2 end - if ticked > 0 then - if DateTime.Minutes(20) == ticked then - Media.PlaySpeechNotification(allies, "TwentyMinutesRemaining") + if Ticked > 0 then + if DateTime.Minutes(20) == Ticked then + Media.PlaySpeechNotification(Allies, "TwentyMinutesRemaining") - elseif DateTime.Minutes(10) == ticked then - Media.PlaySpeechNotification(allies, "TenMinutesRemaining") + elseif DateTime.Minutes(10) == Ticked then + Media.PlaySpeechNotification(Allies, "TenMinutesRemaining") - elseif DateTime.Minutes(5) == ticked then - Media.PlaySpeechNotification(allies, "WarningFiveMinutesRemaining") + elseif DateTime.Minutes(5) == Ticked then + Media.PlaySpeechNotification(Allies, "WarningFiveMinutesRemaining") - elseif DateTime.Minutes(4) == ticked then - Media.PlaySpeechNotification(allies, "WarningFourMinutesRemaining") + elseif DateTime.Minutes(4) == Ticked then + Media.PlaySpeechNotification(Allies, "WarningFourMinutesRemaining") Trigger.AfterDelay(ParadropTicks, function() SendSovietParadrops(ParadropWaypoints[3]) @@ -144,31 +144,31 @@ Tick = function() SendSovietParadrops(ParadropWaypoints[1]) end) - elseif DateTime.Minutes(3) == ticked then - Media.PlaySpeechNotification(allies, "WarningThreeMinutesRemaining") + elseif DateTime.Minutes(3) == Ticked then + Media.PlaySpeechNotification(Allies, "WarningThreeMinutesRemaining") - elseif DateTime.Minutes(2) == ticked then - Media.PlaySpeechNotification(allies, "WarningTwoMinutesRemaining") + elseif DateTime.Minutes(2) == Ticked then + Media.PlaySpeechNotification(Allies, "WarningTwoMinutesRemaining") AttackAtFrameIncrement = DateTime.Seconds(4) AttackAtFrameIncrementInf = DateTime.Seconds(4) - elseif DateTime.Minutes(1) == ticked then - Media.PlaySpeechNotification(allies, "WarningOneMinuteRemaining") + elseif DateTime.Minutes(1) == Ticked then + Media.PlaySpeechNotification(Allies, "WarningOneMinuteRemaining") - elseif DateTime.Seconds(45) == ticked then - Media.PlaySpeechNotification(allies, "AlliedForcesApproaching") + elseif DateTime.Seconds(45) == Ticked then + Media.PlaySpeechNotification(Allies, "AlliedForcesApproaching") end - if (ticked % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("french-reinforcements-arrive-in", { ["time"] = Utils.FormatTime(ticked) }) + if (Ticked % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("french-reinforcements-arrive-in", { ["time"] = Utils.FormatTime(Ticked) }) UserInterface.SetMissionText(Timer, TimerColor) end - ticked = ticked - 1 - elseif ticked == 0 then + Ticked = Ticked - 1 + elseif Ticked == 0 then FinishTimer() TimerExpired() - ticked = ticked - 1 + Ticked = Ticked - 1 end end @@ -186,7 +186,7 @@ FinishTimer = function() end SendSovietParadrops = function(table) - local aircraft = powerproxy.TargetParatroopers(table[2].CenterPosition, table[1]) + local aircraft = ParaTroopersPowerProxy.TargetParatroopers(table[2].CenterPosition, table[1]) Utils.Do(aircraft, function(a) Trigger.OnPassengerExited(a, function(t, p) IdleHunt(p) @@ -197,7 +197,7 @@ end SendSovietNavalReinforcements = function() if SpawnNavalUnits then local entry = NavalEntryPoint.Location - local units = Reinforcements.ReinforceWithTransport(soviets, "lst", NavalTransportPassengers, { entry, Utils.Random(NavalReinforcementsWaypoints).Location }, { entry })[2] + local units = Reinforcements.ReinforceWithTransport(Soviets, "lst", NavalTransportPassengers, { entry, Utils.Random(NavalReinforcementsWaypoints).Location }, { entry })[2] Utils.Do(units, function(unit) Trigger.OnIdle(unit, unit.Hunt) end) @@ -215,7 +215,7 @@ SpawnSovietInfantry = function() units[i] = type end - soviets.Build(units, function(soldiers) + Soviets.Build(units, function(soldiers) Trigger.AfterDelay(25, function() IdleTrigger(soldiers) end) end) end @@ -228,7 +228,7 @@ SpawnSovietUnits = function() end local route = Utils.RandomInteger(1, #SovietEntryPoints + 1) - local attackers = Reinforcements.Reinforce(soviets, units, { SovietEntryPoints[route].Location, SovietRallyPoints[route].Location }) + local attackers = Reinforcements.Reinforce(Soviets, units, { SovietEntryPoints[route].Location, SovietRallyPoints[route].Location }) Trigger.AfterDelay(25, function() IdleTrigger(attackers, SovietGateRallyPoints[route].Location) end) @@ -267,32 +267,32 @@ TimerExpired = function() SpawningInfantry = false SpawnNavalUnits = false - Beacon.New(allies, SovietEntryPoint7.CenterPosition - WVec.New(3 * 1024, 0, 0)) - Media.PlaySpeechNotification(allies, "AlliedReinforcementsArrived") - Reinforcements.Reinforce(allies, FrenchReinforcements, { SovietEntryPoint7.Location, Alliesbase.Location }) + Beacon.New(Allies, SovietEntryPoint7.CenterPosition - WVec.New(3 * 1024, 0, 0)) + Media.PlaySpeechNotification(Allies, "AlliedReinforcementsArrived") + Reinforcements.Reinforce(Allies, FrenchReinforcements, { SovietEntryPoint7.Location, Alliesbase.Location }) if DestroyObj then - KillObj = AddPrimaryObjective(allies, "control-reinforcements-kill-remaining-soviet-forces") + KillObj = AddPrimaryObjective(Allies, "control-reinforcements-kill-remaining-soviet-forces") else - DestroyObj = AddPrimaryObjective(allies, "takeover-reinforcements-dismantle-soviet-base") + DestroyObj = AddPrimaryObjective(Allies, "takeover-reinforcements-dismantle-soviet-base") end - allies.MarkCompletedObjective(SurviveObj) - if not allies.IsObjectiveCompleted(KillSams) then - allies.MarkFailedObjective(KillSams) + Allies.MarkCompletedObjective(SurviveObj) + if not Allies.IsObjectiveCompleted(KillSams) then + Allies.MarkFailedObjective(KillSams) end end DropAlliedArtillery = function(facing, dropzone) - local proxy = Actor.Create("powerproxy.allied", true, { Owner = allies }) + local proxy = Actor.Create("powerproxy.allied", true, { Owner = Allies }) proxy.TargetParatroopers(dropzone, facing) proxy.Destroy() end SendLongBowReinforcements = function() - Media.PlaySpeechNotification(allies, "AlliedReinforcementsArrived") - Reinforcements.Reinforce(allies, LongBowReinforcements, AlliedAirReinforcementsWaypoints[1]) - Reinforcements.Reinforce(allies, LongBowReinforcements, AlliedAirReinforcementsWaypoints[2]) + Media.PlaySpeechNotification(Allies, "AlliedReinforcementsArrived") + Reinforcements.Reinforce(Allies, LongBowReinforcements, AlliedAirReinforcementsWaypoints[1]) + Reinforcements.Reinforce(Allies, LongBowReinforcements, AlliedAirReinforcementsWaypoints[2]) if ParadropArtillery then local facing = Angle.New(Utils.RandomInteger(128, 384)) @@ -301,23 +301,23 @@ SendLongBowReinforcements = function() end AddObjectives = function() - InitObjectives(allies) + InitObjectives(Allies) - SurviveObj = AddPrimaryObjective(allies, "enforce-position-hold-until-reinforcements") - KillSams = AddSecondaryObjective(allies, "destroy-two-sames-before-reinforcements") + SurviveObj = AddPrimaryObjective(Allies, "enforce-position-hold-until-reinforcements") + KillSams = AddSecondaryObjective(Allies, "destroy-two-sames-before-reinforcements") Media.DisplayMessage(UserInterface.Translate("soviets-blocking-gps")) - CaptureAirfields = AddSecondaryObjective(allies, "capture-hold-soviet-airbase-northeast") - SovietObj = AddPrimaryObjective(soviets, "") + CaptureAirfields = AddSecondaryObjective(Allies, "capture-hold-soviet-airbase-northeast") + SovietObj = AddPrimaryObjective(Soviets, "") - Trigger.OnPlayerWon(allies, function() + Trigger.OnPlayerWon(Allies, function() Media.DisplayMessage(UserInterface.Translate("french-survived-dismantled-soviet-presence")) end) end InitMission = function() Camera.Position = Alliesbase.CenterPosition - camera1 = Actor.Create("camera.sam", true, { Owner = allies, Location = Sam1.Location }) - camera2 = Actor.Create("camera.sam", true, { Owner = allies, Location = Sam2.Location }) + local camera1 = Actor.Create("camera.sam", true, { Owner = Allies, Location = Sam1.Location }) + local camera2 = Actor.Create("camera.sam", true, { Owner = Allies, Location = Sam2.Location }) Trigger.OnKilled(Sam1, function() if camera1.IsInWorld then camera1.Destroy() end end) @@ -325,8 +325,8 @@ InitMission = function() if camera2.IsInWorld then camera2.Destroy() end end) Trigger.OnAllKilledOrCaptured({ Sam1, Sam2 }, function() - if not allies.IsObjectiveFailed(KillSams) then - allies.MarkCompletedObjective(KillSams) + if not Allies.IsObjectiveFailed(KillSams) then + Allies.MarkCompletedObjective(KillSams) SendLongBowReinforcements() end end) @@ -336,30 +336,30 @@ InitMission = function() Trigger.OnCapture(field, function() count = count + 1 if count == #Airfields then - allies.MarkCompletedObjective(CaptureAirfields) - local atek = Actor.Create("atek.mission", true, { Owner = allies, Location = HiddenATEK.Location }) + Allies.MarkCompletedObjective(CaptureAirfields) + local atek = Actor.Create("atek.mission", true, { Owner = Allies, Location = HiddenATEK.Location }) Trigger.AfterDelay(DateTime.Seconds(5), atek.Destroy) end end) Trigger.OnKilled(field, function() - allies.MarkFailedObjective(CaptureAirfields) + Allies.MarkFailedObjective(CaptureAirfields) end) end) Trigger.OnAllKilledOrCaptured(SovietBuildings, function() if DestroyObj then - if not soviets.HasNoRequiredUnits() then - KillObj = AddPrimaryObjective(allies, "kill-remaining-soviet-forces") + if not Soviets.HasNoRequiredUnits() then + KillObj = AddPrimaryObjective(Allies, "kill-remaining-soviet-forces") end - allies.MarkCompletedObjective(DestroyObj) + Allies.MarkCompletedObjective(DestroyObj) else - DestroyObj = AddPrimaryObjective(allies, "dismantle-nearby-soviet-base") - allies.MarkCompletedObjective(DestroyObj) + DestroyObj = AddPrimaryObjective(Allies, "dismantle-nearby-soviet-base") + Allies.MarkCompletedObjective(DestroyObj) end end) - Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(allies, "MissionTimerInitialised") end) - TimerColor = allies.Color + Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(Allies, "MissionTimerInitialised") end) + TimerColor = Allies.Color end SetupSoviets = function() @@ -370,20 +370,20 @@ SetupSoviets = function() end) Trigger.AfterDelay(0, function() - local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == soviets and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, 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 * DamageModifier then + if building.Owner == Soviets and building.Health < building.MaxHealth * DamageModifier then building.StartBuildingRepairs() end end) end) end) - Reinforcements.Reinforce(soviets, Squad1, { AlliesBaseGate1.Location, Alliesbase1.Location }) - Reinforcements.Reinforce(soviets, Squad2, { AlliesBaseGate2.Location, Alliesbase2.Location }) + Reinforcements.Reinforce(Soviets, Squad1, { AlliesBaseGate1.Location, Alliesbase1.Location }) + Reinforcements.Reinforce(Soviets, Squad2, { AlliesBaseGate2.Location, Alliesbase2.Location }) - powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets }) + ParaTroopersPowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = Soviets }) Trigger.AfterDelay(ParadropTicks, function() SendSovietParadrops(ParadropWaypoints[1]) SendSovietParadrops(ParadropWaypoints[2]) @@ -410,8 +410,8 @@ end WorldLoaded = function() - allies = Player.GetPlayer("Allies") - soviets = Player.GetPlayer("Soviets") + Allies = Player.GetPlayer("Allies") + Soviets = Player.GetPlayer("Soviets") AddObjectives() InitMission() diff --git a/mods/ra/maps/survival02/survival02.lua b/mods/ra/maps/survival02/survival02.lua index 34873bc85b..a9dbefb2db 100644 --- a/mods/ra/maps/survival02/survival02.lua +++ b/mods/ra/maps/survival02/survival02.lua @@ -68,23 +68,23 @@ GuardHarvester = function(unit, harvester) end end -ticked = TimerTicks +Ticked = TimerTicks Tick = function() - if soviets.HasNoRequiredUnits() then + if Soviets.HasNoRequiredUnits() then if DestroyObj then - allies.MarkCompletedObjective(DestroyObj) + Allies.MarkCompletedObjective(DestroyObj) else - DestroyObj = AddPrimaryObjective(allies, "destroy-all-soviet-forces") - allies.MarkCompletedObjective(DestroyObj) + DestroyObj = AddPrimaryObjective(Allies, "destroy-all-soviet-forces") + Allies.MarkCompletedObjective(DestroyObj) end end - if allies.HasNoRequiredUnits() then - soviets.MarkCompletedObjective(SovietObj) + if Allies.HasNoRequiredUnits() then + Soviets.MarkCompletedObjective(SovietObj) end - if soviets.Resources > soviets.ResourceCapacity / 2 then - soviets.Resources = soviets.ResourceCapacity / 2 + if Soviets.Resources > Soviets.ResourceCapacity / 2 then + Soviets.Resources = Soviets.ResourceCapacity / 2 end if DateTime.GameTime == ProduceAtFrame then @@ -105,25 +105,25 @@ Tick = function() end end - if DateTime.Minutes(5) == ticked then - Media.PlaySpeechNotification(allies, "WarningFiveMinutesRemaining") + if DateTime.Minutes(5) == Ticked then + Media.PlaySpeechNotification(Allies, "WarningFiveMinutesRemaining") InitCountDown() end - if ticked > 0 then - if (ticked % DateTime.Seconds(1)) == 0 then - Timer = UserInterface.Translate("soviet-reinforcements-arrive-in", { ["time"] = Utils.FormatTime(ticked) }) + if Ticked > 0 then + if (Ticked % DateTime.Seconds(1)) == 0 then + Timer = UserInterface.Translate("soviet-reinforcements-arrive-in", { ["time"] = Utils.FormatTime(Ticked) }) UserInterface.SetMissionText(Timer, TimerColor) end - ticked = ticked - 1 - elseif ticked == 0 then + Ticked = Ticked - 1 + elseif Ticked == 0 then FinishTimer() - ticked = ticked - 1 + Ticked = Ticked - 1 end end SendSovietParadrops = function(table) - local paraproxy = Actor.Create(table.type, false, { Owner = soviets }) + local paraproxy = Actor.Create(table.type, false, { Owner = Soviets }) local aircraft = paraproxy.TargetParatroopers(table.target.CenterPosition) Utils.Do(aircraft, function(a) Trigger.OnPassengerExited(a, function(t, p) @@ -134,7 +134,7 @@ SendSovietParadrops = function(table) end SpawnSovietInfantry = function() - soviets.Build({ Utils.Random(SovietInfantry) }, function(units) + Soviets.Build({ Utils.Random(SovietInfantry) }, function(units) IdleHunt(units[1]) end) end @@ -142,7 +142,7 @@ 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 })[1] + local unit = Reinforcements.Reinforce(Soviets, { Utils.Random(SovietVehicles) }, { spawnpoints[route].Location })[1] unit.AttackMove(rallypoints[rally].Location) IdleHunt(unit) @@ -152,7 +152,7 @@ SpawnSovietVehicle = function(spawnpoints, rallypoints) end SpawnAndAttack = function(types, entry) - local units = Reinforcements.Reinforce(soviets, types, { entry }) + local units = Reinforcements.Reinforce(Soviets, types, { entry }) Utils.Do(units, function(unit) IdleHunt(unit) @@ -164,10 +164,10 @@ SpawnAndAttack = function(types, entry) end SendFrenchReinforcements = function() - local camera = Actor.Create("camera", true, { Owner = allies, Location = SovietRally1.Location }) - Beacon.New(allies, FranceEntry.CenterPosition - WVec.New(0, 3 * 1024, 0)) - Media.PlaySpeechNotification(allies, "AlliedReinforcementsArrived") - Reinforcements.Reinforce(allies, FrenchSquad, { FranceEntry.Location, FranceRally.Location }) + local camera = Actor.Create("camera", true, { Owner = Allies, Location = SovietRally1.Location }) + Beacon.New(Allies, FranceEntry.CenterPosition - WVec.New(0, 3 * 1024, 0)) + Media.PlaySpeechNotification(Allies, "AlliedReinforcementsArrived") + Reinforcements.Reinforce(Allies, FrenchSquad, { FranceEntry.Location, FranceRally.Location }) Trigger.AfterDelay(DateTime.Seconds(3), function() camera.Destroy() end) end @@ -179,7 +179,7 @@ FrenchReinforcements = function() return end - powerproxy = Actor.Create("powerproxy.parabombs", false, { Owner = allies }) + local powerproxy = Actor.Create("powerproxy.parabombs", false, { Owner = Allies }) powerproxy.TargetAirstrike(drum1.CenterPosition, Angle.NorthEast + Angle.New(16)) powerproxy.TargetAirstrike(drum2.CenterPosition, Angle.NorthEast) powerproxy.TargetAirstrike(drum3.CenterPosition, Angle.NorthEast - Angle.New(16)) @@ -215,9 +215,9 @@ FinalAttack = function() Trigger.OnAllKilledOrCaptured(units, function() if not DestroyObj then Media.DisplayMessage(UserInterface.Translate("reinforced-position-initiate-counter-attack"), UserInterface.Translate("incoming-report")) - DestroyObj = AddPrimaryObjective(allies, "destroy-remaining-soviet-forces-area") + DestroyObj = AddPrimaryObjective(Allies, "destroy-remaining-soviet-forces-area") end - allies.MarkCompletedObjective(SurviveObj) + Allies.MarkCompletedObjective(SurviveObj) end) end @@ -234,15 +234,15 @@ FinishTimer = function() Trigger.AfterDelay(DateTime.Seconds(10), function() UserInterface.SetMissionText("") end) end -wave = 1 +Wave = 1 SendParadrops = function() - SendSovietParadrops(ParaWaves[wave]) + SendSovietParadrops(ParaWaves[Wave]) - wave = wave + 1 - if wave > #ParaWaves then + Wave = Wave + 1 + if Wave > #ParaWaves then Trigger.AfterDelay(AttackTicks, FrenchReinforcements) else - Trigger.AfterDelay(ParaWaves[wave].delay, SendParadrops) + Trigger.AfterDelay(ParaWaves[Wave].delay, SendParadrops) end end @@ -251,12 +251,12 @@ SetupBridges = function() local counter = function() count = count + 1 if count == 2 then - allies.MarkCompletedObjective(RepairBridges) + Allies.MarkCompletedObjective(RepairBridges) end end Media.DisplayMessage(UserInterface.Translate("repair-bridges-for-reinforcement"), UserInterface.Translate("incoming-report")) - RepairBridges = AddSecondaryObjective(allies, "repair-two-southern-bridges") + RepairBridges = AddSecondaryObjective(Allies, "repair-two-southern-bridges") local bridgeA = Map.ActorsInCircle(BrokenBridge1.CenterPosition, WDist.FromCells(1), function(self) return self.Type == "bridge1" end) local bridgeB = Map.ActorsInCircle(BrokenBridge2.CenterPosition, WDist.FromCells(1), function(self) return self.Type == "bridge1" end) @@ -264,39 +264,39 @@ SetupBridges = function() 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 }) + 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 }) + 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) + 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 AddObjectives = function() - InitObjectives(allies) + InitObjectives(Allies) - SurviveObj = AddPrimaryObjective(allies, "enforce-position-hold-out-onslaught") - SovietObj = AddPrimaryObjective(soviets, "") + SurviveObj = AddPrimaryObjective(Allies, "enforce-position-hold-out-onslaught") + SovietObj = AddPrimaryObjective(Soviets, "") Trigger.AfterDelay(DateTime.Seconds(15), function() SetupBridges() end) - Trigger.OnPlayerWon(allies, function() + Trigger.OnPlayerWon(Allies, function() Media.DisplayMessage(UserInterface.Translate("remaining-soviet-presence-destroyed"), UserInterface.Translate("incoming-report")) end) end @@ -305,11 +305,11 @@ InitMission = function() Camera.Position = AlliesBase.CenterPosition TimerColor = HSLColor.Red - Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(allies, "MissionTimerInitialised") end) + Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(Allies, "MissionTimerInitialised") end) Trigger.AfterDelay(TimerTicks, function() Media.DisplayMessage(UserInterface.Translate("soviet-reinforcements-approaching"), UserInterface.Translate("incoming-report")) - Media.PlaySpeechNotification(allies, "SovietReinforcementsArrived") + Media.PlaySpeechNotification(Allies, "SovietReinforcementsArrived") SpawnSovietVehicle(NewSovietEntryPoints, NewSovietRallyPoints) FinalAttack() Producing = false @@ -361,7 +361,7 @@ SetupSoviets = function() toBuild[i] = Utils.Random(SovietInfantry) end - soviets.Build(toBuild, function(units) + Soviets.Build(toBuild, function(units) Utils.Do(units, function(unit) InfantryGuards[#InfantryGuards + 1] = unit GuardHarvester(unit, Harvester2) @@ -373,10 +373,10 @@ SetupSoviets = function() end) Trigger.AfterDelay(0, function() - local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == soviets and self.HasProperty("StartBuildingRepairs") end) + local buildings = Utils.Where(Map.ActorsInWorld, 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 + if building.Owner == Soviets and building.Health < building.MaxHealth * 3/4 then building.StartBuildingRepairs() end end) @@ -385,9 +385,8 @@ SetupSoviets = function() end WorldLoaded = function() - - allies = Player.GetPlayer("Allies") - soviets = Player.GetPlayer("Soviets") + Allies = Player.GetPlayer("Allies") + Soviets = Player.GetPlayer("Soviets") AddObjectives() InitMission() diff --git a/mods/ra/maps/top-o-the-world/top-o-the-world.lua b/mods/ra/maps/top-o-the-world/top-o-the-world.lua index f6a6a732b3..26f8575701 100644 --- a/mods/ra/maps/top-o-the-world/top-o-the-world.lua +++ b/mods/ra/maps/top-o-the-world/top-o-the-world.lua @@ -46,7 +46,7 @@ BridgeIsIntact = true --Mission Functions Setup HuntObjectiveTruck = function(a) if a.HasProperty("Hunt") then - if a.Owner == greece or a.Owner == goodguy then + if a.Owner == Greece or a.Owner == GoodGuy then Trigger.OnIdle(a, function(a) if a.IsInWorld and not ObjectiveTruck01.IsDead then a.AttackMove(ObjectiveTruck01.Location, 2) @@ -79,7 +79,7 @@ end SpawnAlliedHuntingParty = function() Trigger.AfterDelay(DateTime.Minutes(3), function() if BridgeIsIntact then - local tanks = Reinforcements.Reinforce(greece, AlliedHuntingParty, { AlliedHuntingPartySpawn.Location, AlliedHuntingPartyWP01.Location,AlliedHuntingPartyWP03.Location, AlliedHuntingPartyWP05.Location }, 0) + local tanks = Reinforcements.Reinforce(Greece, AlliedHuntingParty, { AlliedHuntingPartySpawn.Location, AlliedHuntingPartyWP01.Location,AlliedHuntingPartyWP03.Location, AlliedHuntingPartyWP05.Location }, 0) Utils.Do(tanks, function(units) HuntObjectiveTruck(units) end) @@ -90,45 +90,45 @@ end WorldLoaded = function() --Players Setup - player = Player.GetPlayer("USSR") - greece = Player.GetPlayer("Greece") - goodguy = Player.GetPlayer("GoodGuy") - badguy = Player.GetPlayer("BadGuy") - neutral = Player.GetPlayer("Neutral") - creeps = Player.GetPlayer("Creeps") + USSR = Player.GetPlayer("USSR") + Greece = Player.GetPlayer("Greece") + GoodGuy = Player.GetPlayer("GoodGuy") + BadGuy = Player.GetPlayer("BadGuy") + Neutral = Player.GetPlayer("Neutral") + Creeps = Player.GetPlayer("Creeps") Camera.Position = DefaultCameraPosition.CenterPosition --Objectives Setup - InitObjectives(player) + InitObjectives(USSR) - BringSupplyTruck = AddPrimaryObjective(player, "supply-truck-waystation") - ProtectWaystation = AddPrimaryObjective(player, "waystation-must-not-be-destroyed") - DestroyAAGuns = AddSecondaryObjective(player, "destory-aa-guns-enable-air-support") - PreventAlliedIncursions = AddSecondaryObjective(player, "find-destroy-bridge-stop-allied-reinforcements") + BringSupplyTruck = AddPrimaryObjective(USSR, "supply-truck-waystation") + ProtectWaystation = AddPrimaryObjective(USSR, "waystation-must-not-be-destroyed") + DestroyAAGuns = AddSecondaryObjective(USSR, "destory-aa-guns-enable-air-support") + PreventAlliedIncursions = AddSecondaryObjective(USSR, "find-destroy-bridge-stop-allied-reinforcements") Trigger.OnKilled(USSRTechCenter01, function() - player.MarkFailedObjective(ProtectWaystation) + USSR.MarkFailedObjective(ProtectWaystation) end) Trigger.OnKilled(ObjectiveTruck01, function() - player.MarkFailedObjective(BringSupplyTruck) + USSR.MarkFailedObjective(BringSupplyTruck) end) Trigger.OnEnteredFootprint(WaystationTrigger, function(unit, id) if unit == ObjectiveTruck01 then Trigger.RemoveFootprintTrigger(id) - player.MarkCompletedObjective(BringSupplyTruck) - player.MarkCompletedObjective(ProtectWaystation) + USSR.MarkCompletedObjective(BringSupplyTruck) + USSR.MarkCompletedObjective(ProtectWaystation) end end) Trigger.OnAllKilled(AlliedAAGuns, function() - player.MarkCompletedObjective(DestroyAAGuns) - Media.PlaySpeechNotification(player, "ObjectiveMet") + USSR.MarkCompletedObjective(DestroyAAGuns) + Media.PlaySpeechNotification(USSR, "ObjectiveMet") Trigger.AfterDelay(DateTime.Seconds(2), function() - Actor.Create("powerproxy.spyplane", true, { Owner = player }) - Actor.Create("powerproxy.parabombs", true, { Owner = player }) + Actor.Create("powerproxy.spyplane", true, { Owner = USSR }) + Actor.Create("powerproxy.parabombs", true, { Owner = USSR }) Media.DisplayMessage(UserInterface.Translate("air-support-t-minus-3")) end) end) @@ -137,21 +137,21 @@ WorldLoaded = function() SpawnAlliedHuntingParty() Trigger.AfterDelay(0, function() - local playerrevealcam = Actor.Create("camera", true, { Owner = player, Location = PlayerStartLocation.Location }) + local playerrevealcam = Actor.Create("camera", true, { Owner = USSR, Location = PlayerStartLocation.Location }) Trigger.AfterDelay(1, function() if playerrevealcam.IsInWorld then playerrevealcam.Destroy() end end) end) Trigger.OnEnteredFootprint(Inf01Trigger, function(unit, id) - if unit.Owner == player then + if unit.Owner == USSR then if not AlliedGNRLHouse.IsDead then - Reinforcements.Reinforce(greece, { "gnrl" }, { AlliedGNRLSpawn.Location, AlliedGNRLDestination.Location }, 0, function(unit) + Reinforcements.Reinforce(Greece, { "gnrl" }, { AlliedGNRLSpawn.Location, AlliedGNRLDestination.Location }, 0, function(unit) HuntEnemyUnits(unit) end) end Utils.Do(AlliedSquad01, HuntEnemyUnits) - local alliedgnrlcamera = Actor.Create("scamera", true, { Owner = player, Location = AlliedGNRLSpawn.Location }) + local alliedgnrlcamera = Actor.Create("scamera", true, { Owner = USSR, Location = AlliedGNRLSpawn.Location }) Trigger.AfterDelay(DateTime.Seconds(6), function() if alliedgnrlcamera.IsInWorld then alliedgnrlcamera.Destroy() end end) @@ -160,7 +160,7 @@ WorldLoaded = function() end) Trigger.OnEnteredFootprint(Inf02Trigger, function(unit, id) - if unit.Owner == player then + if unit.Owner == USSR then Utils.Do(AlliedSquad02, HuntEnemyUnits) Trigger.RemoveFootprintTrigger(id) end @@ -168,30 +168,30 @@ WorldLoaded = function() Utils.Do(AlliedSquad03, function(actor) Trigger.OnDamaged(actor, function(unit, attacker) - if attacker.Owner == player then + if attacker.Owner == USSR then Utils.Do(AlliedSquad03, HuntEnemyUnits) end end) end) Trigger.OnEnteredFootprint(RevealBridgeTrigger, function(unit, id) - if unit.Owner == player then - local bridgecamera01 = Actor.Create("camera", true, { Owner = player, Location = AlliedHuntingPartySpawn.Location }) - local bridgecamera02 = Actor.Create("camera", true, { Owner = player, Location = AlliedHuntingPartyWP01.Location }) + if unit.Owner == USSR then + local bridgecamera01 = Actor.Create("camera", true, { Owner = USSR, Location = AlliedHuntingPartySpawn.Location }) + local bridgecamera02 = Actor.Create("camera", true, { Owner = USSR, Location = AlliedHuntingPartyWP01.Location }) Trigger.AfterDelay(DateTime.Seconds(6), function() if bridgecamera01.IsInWorld then bridgecamera01.Destroy() end if bridgecamera02.IsInWorld then bridgecamera02.Destroy() end end) if Difficulty == "normal" then - Reinforcements.Reinforce(goodguy, { "dd" }, { AlliedDestroyer01Spawn.Location, AlliedDestroyer01WP01.Location, AlliedDestroyer01WP02.Location }, 0, function(unit) + Reinforcements.Reinforce(GoodGuy, { "dd" }, { AlliedDestroyer01Spawn.Location, AlliedDestroyer01WP01.Location, AlliedDestroyer01WP02.Location }, 0, function(unit) unit.Stance = "Defend" end) end if Difficulty == "hard" then - Reinforcements.Reinforce(goodguy, { "dd" }, { AlliedDestroyer01Spawn.Location, AlliedDestroyer01WP01.Location, AlliedDestroyer01WP02.Location }, 0, function(unit) + Reinforcements.Reinforce(GoodGuy, { "dd" }, { AlliedDestroyer01Spawn.Location, AlliedDestroyer01WP01.Location, AlliedDestroyer01WP02.Location }, 0, function(unit) unit.Stance = "Defend" end) - Reinforcements.Reinforce(goodguy, { "dd" }, { AlliedDestroyer02Spawn.Location, AlliedDestroyer02WP01.Location, AlliedDestroyer02WP02.Location }, 0, function(unit) + Reinforcements.Reinforce(GoodGuy, { "dd" }, { AlliedDestroyer02Spawn.Location, AlliedDestroyer02WP01.Location, AlliedDestroyer02WP02.Location }, 0, function(unit) unit.Stance = "Defend" end) end @@ -200,7 +200,7 @@ WorldLoaded = function() end) Trigger.AfterDelay(DateTime.Minutes(9), function() - local powerproxy01 = Actor.Create("powerproxy.paratroopers", true, { Owner = greece }) + local powerproxy01 = Actor.Create("powerproxy.paratroopers", true, { Owner = Greece }) local aircraft01 = powerproxy01.TargetParatroopers(AlliedParadropLZ01.CenterPosition, Angle.SouthWest) Utils.Do(aircraft01, function(a) Trigger.OnPassengerExited(a, function(t, p) @@ -208,7 +208,7 @@ WorldLoaded = function() end) end) - local powerproxy02 = Actor.Create("powerproxy.paratroopers", true, { Owner = goodguy }) + local powerproxy02 = Actor.Create("powerproxy.paratroopers", true, { Owner = GoodGuy }) local aircraft02 = powerproxy02.TargetParatroopers(AlliedParadropLZ02.CenterPosition, Angle.SouthWest) Utils.Do(aircraft02, function(a) Trigger.OnPassengerExited(a, function(t, p) @@ -223,8 +223,8 @@ WorldLoaded = function() BridgeIsIntact = false if not BridgeBarrel01.IsDead then BridgeBarrel01.Kill() end if not BridgeBarrel03.IsDead then BridgeBarrel03.Kill() end - player.MarkCompletedObjective(PreventAlliedIncursions) - Media.PlaySpeechNotification(player, "ObjectiveMet") + USSR.MarkCompletedObjective(PreventAlliedIncursions) + Media.PlaySpeechNotification(USSR, "ObjectiveMet") Trigger.AfterDelay(DateTime.Seconds(2), function() Media.DisplayMessage(UserInterface.Translate("allied-ground-reinforcements-stopped")) end) @@ -239,12 +239,12 @@ WorldLoaded = function() Trigger.OnAnyKilled(AlliedSquad04, function() if BridgeIsIntact then - local tanks = Reinforcements.Reinforce(greece, AlliedTanksReinforcement, { AlliedHuntingPartySpawn.Location, AlliedHuntingPartyWP01.Location }, 0, function(units) + local tanks = Reinforcements.Reinforce(Greece, AlliedTanksReinforcement, { AlliedHuntingPartySpawn.Location, AlliedHuntingPartyWP01.Location }, 0, function(units) AlliedGroundPatrols(units) end) Trigger.OnAllKilled(tanks, function() if BridgeIsIntact then - Reinforcements.Reinforce(greece, AlliedTanksReinforcement, { AlliedHuntingPartySpawn.Location, AlliedHuntingPartyWP01.Location }, 0, function(units) + Reinforcements.Reinforce(Greece, AlliedTanksReinforcement, { AlliedHuntingPartySpawn.Location, AlliedHuntingPartyWP01.Location }, 0, function(units) AlliedGroundPatrols(units) end) end @@ -254,12 +254,12 @@ WorldLoaded = function() Trigger.OnAllKilled(AlliedSquad04, function() if BridgeIsIntact then - local tanks = Reinforcements.Reinforce(greece, AlliedTanksReinforcement, { AlliedHuntingPartySpawn.Location, AlliedHuntingPartyWP01.Location }, 0, function(units) + local tanks = Reinforcements.Reinforce(Greece, AlliedTanksReinforcement, { AlliedHuntingPartySpawn.Location, AlliedHuntingPartyWP01.Location }, 0, function(units) AlliedGroundPatrols(units) end) Trigger.OnAllKilled(tanks, function() if BridgeIsIntact then - Reinforcements.Reinforce(greece, AlliedTanksReinforcement, { AlliedHuntingPartySpawn.Location, AlliedHuntingPartyWP01.Location }, 0, function(units) + Reinforcements.Reinforce(Greece, AlliedTanksReinforcement, { AlliedHuntingPartySpawn.Location, AlliedHuntingPartyWP01.Location }, 0, function(units) AlliedGroundPatrols(units) end) end