Port missions to the new Paratroopers API.

This commit is contained in:
Paul Chote
2020-02-27 21:18:43 +00:00
committed by Matthias Mailänder
parent c0587cc568
commit d73ed7670a
21 changed files with 138 additions and 81 deletions

View File

@@ -72,14 +72,19 @@ end
SendUSSRParadrops = function() SendUSSRParadrops = function()
local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr })
local unitsA = powerproxy.SendParatroopers(ParadropLZ.CenterPosition, false, 128 + 32)
local unitsB = powerproxy.SendParatroopers(ParadropLZ.CenterPosition, false, 128 - 32)
Utils.Do(unitsA, function(unit) local aircraftA = powerproxy.ActivateParatroopers(ParadropLZ.CenterPosition, 128 + 32)
IdleHunt(unit) Utils.Do(aircraftA, function(a)
Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
end)
end) end)
Utils.Do(unitsB, function(unit)
IdleHunt(unit) local aircraftB = powerproxy.ActivateParatroopers(ParadropLZ.CenterPosition, 128 - 32)
Utils.Do(aircraftB, function(a)
Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
end)
end) end)
powerproxy.Destroy() powerproxy.Destroy()

View File

@@ -95,9 +95,11 @@ end
SendUSSRParadrops = function(facing, dropzone) SendUSSRParadrops = function(facing, dropzone)
local paraproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) local paraproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr })
local units = paraproxy.SendParatroopers(dropzone.CenterPosition, false, facing) local aircraft = paraproxy.ActivateParatroopers(dropzone.CenterPosition, facing)
Utils.Do(units, function(unit) Utils.Do(aircraft, function(a)
IdleHunt(unit) Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
end)
end) end)
paraproxy.Destroy() paraproxy.Destroy()

View File

@@ -57,9 +57,11 @@ ParadropLZs = { ParadropPoint1.CenterPosition, ParadropPoint2.CenterPosition, Pa
Paradropped = 0 Paradropped = 0
Paradrop = function() Paradrop = function()
Trigger.AfterDelay(Utils.RandomInteger(ParadropDelay[1], ParadropDelay[2]), function() Trigger.AfterDelay(Utils.RandomInteger(ParadropDelay[1], ParadropDelay[2]), function()
local units = PowerProxy.SendParatroopers(Utils.Random(ParadropLZs)) local aircraft = PowerProxy.ActivateParatroopers(Utils.Random(ParadropLZs))
Utils.Do(units, function(unit) Utils.Do(aircraft, function(a)
Trigger.OnAddedToWorld(unit, IdleHunt) Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
end)
end) end)
Paradropped = Paradropped + 1 Paradropped = Paradropped + 1

View File

@@ -143,7 +143,7 @@ InfiltrateTechCenter = function()
local Proxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) local Proxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr })
Utils.Do(ParadropWaypoints[Map.LobbyOption("difficulty")], function(waypoint) Utils.Do(ParadropWaypoints[Map.LobbyOption("difficulty")], function(waypoint)
Proxy.SendParatroopers(waypoint.CenterPosition, false, Facing.South) Proxy.ActivateParatroopers(waypoint.CenterPosition, Facing.South)
end) end)
Proxy.Destroy() Proxy.Destroy()
end) end)

View File

@@ -37,9 +37,11 @@ Paradropped = 0
Paradrop = function() Paradrop = function()
Trigger.AfterDelay(Utils.RandomInteger(ParadropDelay[1], ParadropDelay[2]), function() Trigger.AfterDelay(Utils.RandomInteger(ParadropDelay[1], ParadropDelay[2]), function()
local units = PowerProxy.SendParatroopers(Utils.Random(ParadropLZs)) local aircraft = PowerProxy.ActivateParatroopers(Utils.Random(ParadropLZs))
Utils.Do(units, function(unit) Utils.Do(aircraft, function(a)
Trigger.OnAddedToWorld(unit, IdleHunt) Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
end)
end) end)
Paradropped = Paradropped + 1 Paradropped = Paradropped + 1

View File

@@ -189,11 +189,12 @@ WTransWaves = function()
end end
Paradrop = function() Paradrop = function()
local units = PowerProxy.SendParatroopers(Utils.Random(ParadropLZs)) local aircraft = PowerProxy.ActivateParatroopers(Utils.Random(ParadropLZs))
Utils.Do(units, function(unit) Utils.Do(aircraft, function(a)
Trigger.OnAddedToWorld(unit, IdleHunt) Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
end)
end) end)
Trigger.AfterDelay(DateTime.Minutes(ParadropDelays), Paradrop) Trigger.AfterDelay(DateTime.Minutes(ParadropDelays), Paradrop)
end end

View File

@@ -188,9 +188,11 @@ WTransWaves = function()
end end
Paradrop = function() Paradrop = function()
local units = PowerProxy.SendParatroopers(Utils.Random(ParadropLZs)) local aircraft = PowerProxy.ActivateParatroopers(Utils.Random(ParadropLZs))
Utils.Do(units, function(unit) Utils.Do(aircraft, function(a)
Trigger.OnAddedToWorld(unit, IdleHunt) Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
end)
end) end)
Trigger.AfterDelay(DateTime.Minutes(ParadropDelays), Paradrop) Trigger.AfterDelay(DateTime.Minutes(ParadropDelays), Paradrop)

View File

@@ -119,10 +119,12 @@ end
ParadropSovietUnits = function() ParadropSovietUnits = function()
local lz = Utils.Random(ParadropWaypoints) local lz = Utils.Random(ParadropWaypoints)
local units = powerproxy.SendParatroopers(lz.CenterPosition) local aircraft = powerproxy.ActivateParatroopers(lz.CenterPosition)
Utils.Do(units, function(a) Utils.Do(aircraft, function(a)
BindActorTriggers(a) Trigger.OnPassengerExited(a, function(t, p)
BindActorTriggers(p)
end)
end) end)
Trigger.AfterDelay(DateTime.Seconds(35), ParadropSovietUnits) Trigger.AfterDelay(DateTime.Seconds(35), ParadropSovietUnits)

View File

@@ -72,6 +72,14 @@ ReinforcementsDelay = DateTime.Minutes(16)
ReinforcementsUnits = { "2tnk", "2tnk", "2tnk", "2tnk", "2tnk", "2tnk", "1tnk", "1tnk", "jeep", "e1", ReinforcementsUnits = { "2tnk", "2tnk", "2tnk", "2tnk", "2tnk", "2tnk", "1tnk", "1tnk", "jeep", "e1",
"e1", "e1", "e1", "e3", "e3", "mcv", "truk", "truk", "truk", "truk", "truk", "truk" } "e1", "e1", "e1", "e3", "e3", "mcv", "truk", "truk", "truk", "truk", "truk", "truk" }
IdleHunt = function(actor)
Trigger.OnIdle(actor, function(a)
if a.IsInWorld then
a.Hunt()
end
end)
end
SpawnAlliedReinforcements = function() SpawnAlliedReinforcements = function()
if allies2.IsLocalPlayer then if allies2.IsLocalPlayer then
UserInterface.SetMissionText("") UserInterface.SetMissionText("")
@@ -115,16 +123,16 @@ end
SendParatroopers = function() SendParatroopers = function()
Utils.Do(Paratroopers, function(para) Utils.Do(Paratroopers, function(para)
local proxy = Actor.Create(para.proxy, false, { Owner = soviets }) local proxy = Actor.Create(para.proxy, false, { Owner = soviets })
local units = proxy.SendParatroopersFrom(para.entry, para.drop) local target = Map.CenterOfCell(para.drop)
proxy.Destroy() local dir = target - Map.CenterOfCell(para.entry)
Utils.Do(units, function(unit) local aircraft = proxy.ActivateParatroopers(target, dir.facing)
Trigger.OnIdle(unit, function(a) Utils.Do(aircraft, function(a)
if a.IsInWorld then Trigger.OnPassengerExited(a, function(t, p)
a.Hunt() IdleHunt(p)
end
end) end)
end) end)
proxy.Destroy()
end) end)
end end

View File

@@ -185,7 +185,7 @@ SendSovietParadrop = function()
local lz = Map.CenterOfCell(randomParadropCell) local lz = Map.CenterOfCell(randomParadropCell)
local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets }) local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets })
powerproxy.SendParatroopers(lz) powerproxy.ActivateParatroopers(lz)
powerproxy.Destroy() powerproxy.Destroy()
Trigger.AfterDelay(sovietParadropTicks, SendSovietParadrop) Trigger.AfterDelay(sovietParadropTicks, SendSovietParadrop)

View File

@@ -91,6 +91,14 @@ if Map.LobbyOption("difficulty") == "tough" or Map.LobbyOption("difficulty") ==
Waves[11] = { delay = 1500, units = { Vehicles, Infantry, Patrol, Patrol, Patrol, Infantry, LongRange, Tank, Boss, Infantry, Infantry, Patrol } } Waves[11] = { delay = 1500, units = { Vehicles, Infantry, Patrol, Patrol, Patrol, Infantry, LongRange, Tank, Boss, Infantry, Infantry, Patrol } }
end end
IdleHunt = function(actor)
Trigger.OnIdle(actor, function(a)
if a.IsInWorld then
a.Hunt()
end
end)
end
SendUnits = function(entryCell, unitTypes, targetCell, extraData) 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 if not a.HasProperty("AttackMove") then
@@ -138,12 +146,10 @@ SendWave = function()
if (Wave < #Waves) then if (Wave < #Waves) then
if Utils.RandomInteger(1, 100) < ParaChance then if Utils.RandomInteger(1, 100) < ParaChance then
local units = ParaProxy.SendParatroopers(Utils.Random(ParadropWaypoints).CenterPosition) local aircraft = ParaProxy.ActivateParatroopers(Utils.Random(ParadropWaypoints).CenterPosition)
Utils.Do(units, function(unit) Utils.Do(aircraft, function(a)
Trigger.OnIdle(unit, function(a) Trigger.OnPassengerExited(a, function(t, p)
if a.IsInWorld then IdleHunt(p)
a.Hunt()
end
end) end)
end) end)

View File

@@ -62,15 +62,20 @@ GroundPatrolUnits =
{ "3tnk", "3tnk" } { "3tnk", "3tnk" }
} }
IdleHunt = function(actor)
Trigger.OnIdle(actor, function(a)
if a.IsInWorld then
a.Hunt()
end
end)
end
ParadropSovietUnits = function() ParadropSovietUnits = function()
local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets }) local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets })
local units = powerproxy.SendParatroopers(MCVDeployLocation.CenterPosition, false, 256 - 53) local aircraft = powerproxy.ActivateParatroopers(MCVDeployLocation.CenterPosition, 256 - 53)
Utils.Do(aircraft, function(a)
Utils.Do(units, function(a) Trigger.OnPassengerExited(a, function(t, p)
Trigger.OnIdle(a, function(actor) IdleHunt(p)
if actor.IsInWorld then
actor.Hunt()
end
end) end)
end) end)

View File

@@ -123,8 +123,8 @@ WorldLoaded = function()
-- When destroying the allied radar dome or the refinery drop 2 badgers with 5 grenadiers each -- When destroying the allied radar dome or the refinery drop 2 badgers with 5 grenadiers each
Trigger.OnAnyKilled({ AlliedDome, AlliedProc }, function() Trigger.OnAnyKilled({ AlliedDome, AlliedProc }, function()
local powerproxy = Actor.Create("powerproxy.paratroopers", true, { Owner = player }) local powerproxy = Actor.Create("powerproxy.paratroopers", true, { Owner = player })
powerproxy.SendParatroopers(ParadropLZ.CenterPosition, false, Facing.South) powerproxy.ActivateParatroopers(ParadropLZ.CenterPosition, Facing.South)
powerproxy.SendParatroopers(ParadropLZ.CenterPosition, false, Facing.SouthEast) powerproxy.ActivateParatroopers(ParadropLZ.CenterPosition, Facing.SouthEast)
powerproxy.Destroy() powerproxy.Destroy()
end) end)
end end

View File

@@ -17,16 +17,16 @@ EnemyBaseEntranceShroudTrigger = { CPos.New(80, 73), CPos.New(81, 73), CPos.New(
SendUSSRParadrops = function() SendUSSRParadrops = function()
paraproxy1 = Actor.Create("powerproxy.paratroopers", false, { Owner = player }) paraproxy1 = Actor.Create("powerproxy.paratroopers", false, { Owner = player })
paraproxy1.SendParatroopers(ParachuteBaseEntrance.CenterPosition, false, Facing.North) paraproxy1.ActivateParatroopers(ParachuteBaseEntrance.CenterPosition, Facing.North)
paraproxy1.Destroy() paraproxy1.Destroy()
end end
SendUSSRParadropsBase = function() SendUSSRParadropsBase = function()
paraproxy2 = Actor.Create("powerproxy.paratroopers2", false, { Owner = player }) paraproxy2 = Actor.Create("powerproxy.paratroopers2", false, { Owner = player })
paraproxy2.SendParatroopers(ParachuteBase1.CenterPosition, false, Facing.East) paraproxy2.ActivateParatroopers(ParachuteBase1.CenterPosition, Facing.East)
paraproxy2.Destroy() paraproxy2.Destroy()
paraproxy3 = Actor.Create("powerproxy.paratroopers3", false, { Owner = player }) paraproxy3 = Actor.Create("powerproxy.paratroopers3", false, { Owner = player })
paraproxy3.SendParatroopers(ParachuteBase2.CenterPosition, false, Facing.East) paraproxy3.ActivateParatroopers(ParachuteBase2.CenterPosition, Facing.East)
paraproxy3.Destroy() paraproxy3.Destroy()
end end

View File

@@ -96,7 +96,7 @@ end
SendUSSRParadrops = function() SendUSSRParadrops = function()
paraproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = player }) paraproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = player })
paraproxy.SendParatroopers(ReinforcementDropOff.CenterPosition, false, 0) paraproxy.ActivateParatroopers(ReinforcementDropOff.CenterPosition, 0)
paraproxy.Destroy() paraproxy.Destroy()
end end

View File

@@ -46,13 +46,13 @@ TanksGGWaypoints = { PatrolPoint2, BetweenBasesPoint, PrepGGArmyPoint }
Para = function() Para = function()
local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = player }) local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = player })
local units = powerproxy.SendParatroopers(ParaPoint.CenterPosition, false, 28) powerproxy.ActivateParatroopers(ParaPoint.CenterPosition, 28)
powerproxy.Destroy() powerproxy.Destroy()
end end
Para2 = function() Para2 = function()
local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = player }) local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = player })
local units = powerproxy.SendParatroopers(USSRExpansionPoint.CenterPosition, false, 28) powerproxy.ActivateParatroopers(USSRExpansionPoint.CenterPosition, 28)
powerproxy.Destroy() powerproxy.Destroy()
end end

View File

@@ -53,7 +53,7 @@ end
AddParadropReinforcementTrigger = function() AddParadropReinforcementTrigger = function()
Trigger.AfterDelay(DateTime.Seconds(90), function() Trigger.AfterDelay(DateTime.Seconds(90), function()
Media.PlaySpeechNotification(ussr, "ReinforcementsArrived") Media.PlaySpeechNotification(ussr, "ReinforcementsArrived")
scripteddrop.SendParatroopers(ScriptedParadrop.CenterPosition, false, 10) scripteddrop.ActivateParatroopers(ScriptedParadrop.CenterPosition, 10)
end) end)
end end

View File

@@ -37,6 +37,14 @@ TanyaTrigger = { CPos.New(59, 43), CPos.New(60, 43), CPos.New(61, 43), CPos.New(
GreeceHarvestersAreDead = false GreeceHarvestersAreDead = false
AlloyFacilityDestroyed = false AlloyFacilityDestroyed = false
IdleHunt = function(actor)
Trigger.OnIdle(actor, function(a)
if a.IsInWorld then
a.Hunt()
end
end)
end
WorldLoaded = function() WorldLoaded = function()
--Players Setup --Players Setup
@@ -324,20 +332,16 @@ WorldLoaded = function()
Trigger.OnEnteredFootprint(ParaTrigger, function(unit, id) Trigger.OnEnteredFootprint(ParaTrigger, function(unit, id)
if unit.Owner == player then if unit.Owner == player then
local powerproxy = Actor.Create("powerproxy.pararifles", true, { Owner = greece }) local powerproxy = Actor.Create("powerproxy.pararifles", true, { Owner = greece })
local paratroopers = powerproxy.SendParatroopers(waypoint89.CenterPosition, false, Facing.South) local aircraft = powerproxy.ActivateParatroopers(waypoint89.CenterPosition, Facing.South)
local prtcamera = Actor.Create("camera", true, { Owner = player, Location = waypoint89.Location }) local prtcamera = Actor.Create("camera", true, { Owner = player, Location = waypoint89.Location })
Utils.Do(aircraft, function(a)
Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
end)
end)
Trigger.AfterDelay(DateTime.Seconds(10), function() Trigger.AfterDelay(DateTime.Seconds(10), function()
if prtcamera.IsInWorld then prtcamera.Destroy() end if prtcamera.IsInWorld then prtcamera.Destroy() end
end) end)
Utils.Do(paratroopers, function(unit)
if not unit.IsDead then
Trigger.OnIdle(unit, function(unit)
if unit.IsInWorld then
unit.Hunt()
end
end)
end
end)
if Map.LobbyOption("difficulty") == "hard" and not RiflemanGuard01.IsDead then if Map.LobbyOption("difficulty") == "hard" and not RiflemanGuard01.IsDead then
Trigger.ClearAll(RiflemanGuard01) Trigger.ClearAll(RiflemanGuard01)
ProduceInfantry() --Greece will start infantry production right away if the difficulty is set to hard ProduceInfantry() --Greece will start infantry production right away if the difficulty is set to hard

View File

@@ -182,14 +182,19 @@ FinishTimer = function()
Trigger.AfterDelay(DateTime.Seconds(10), function() UserInterface.SetMissionText("") end) Trigger.AfterDelay(DateTime.Seconds(10), function() UserInterface.SetMissionText("") end)
end end
SendSovietParadrops = function(table) IdleHunt = function(unit)
local units = powerproxy.SendParatroopers(table[2].CenterPosition, false, table[1]) Trigger.OnIdle(unit, function(a)
if a.IsInWorld then
a.Hunt()
end
end)
end
Utils.Do(units, function(unit) SendSovietParadrops = function(table)
Trigger.OnIdle(unit, function(a) local aircraft = powerproxy.ActivateParatroopers(table[2].CenterPosition, table[1])
if a.IsInWorld then Utils.Do(aircraft, function(a)
a.Hunt() Trigger.OnPassengerExited(a, function(t, p)
end IdleHunt(p)
end) end)
end) end)
end end
@@ -285,7 +290,7 @@ end
DropAlliedArtillery = function(facing, dropzone) DropAlliedArtillery = function(facing, dropzone)
local proxy = Actor.Create("powerproxy.allied", true, { Owner = allies }) local proxy = Actor.Create("powerproxy.allied", true, { Owner = allies })
proxy.SendParatroopers(dropzone, false, facing) proxy.ActivateParatroopers(dropzone, facing)
proxy.Destroy() proxy.Destroy()
end end

View File

@@ -129,8 +129,12 @@ end
SendSovietParadrops = function(table) SendSovietParadrops = function(table)
local paraproxy = Actor.Create(table.type, false, { Owner = soviets }) local paraproxy = Actor.Create(table.type, false, { Owner = soviets })
units = paraproxy.SendParatroopers(table.target.CenterPosition) local aircraft = paraproxy.ActivateParatroopers(table.target.CenterPosition)
Utils.Do(units, function(unit) IdleHunt(unit) end) Utils.Do(aircraft, function(a)
Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
end)
end)
paraproxy.Destroy() paraproxy.Destroy()
end end

View File

@@ -216,11 +216,20 @@ WorldLoaded = function()
Trigger.AfterDelay(DateTime.Minutes(9), function() 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 paratroopers01 = powerproxy01.SendParatroopers(AlliedParadropLZ01.CenterPosition, false, Facing.SouthWest) local aircraft01 = powerproxy01.ActivateParatroopers(AlliedParadropLZ01.CenterPosition, Facing.SouthWest)
Utils.Do(aircraft01, function(a)
Trigger.OnPassengerExited(a, function(t, p)
HuntObjectiveTruck(p)
end)
end)
local powerproxy02 = Actor.Create("powerproxy.paratroopers", true, { Owner = goodguy }) local powerproxy02 = Actor.Create("powerproxy.paratroopers", true, { Owner = goodguy })
local paratroopers02 = powerproxy02.SendParatroopers(AlliedParadropLZ02.CenterPosition, false, Facing.SouthWest) local aircraft02 = powerproxy02.ActivateParatroopers(AlliedParadropLZ02.CenterPosition, Facing.SouthWest)
Utils.Do(paratroopers01, HuntObjectiveTruck) Utils.Do(aircraft02, function(a)
Utils.Do(paratroopers02, HuntObjectiveTruck) Trigger.OnPassengerExited(a, function(t, p)
HuntObjectiveTruck(p)
end)
end)
end) end)
Trigger.AfterDelay(0, function() Trigger.AfterDelay(0, function()