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()
local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr })
local unitsA = powerproxy.SendParatroopers(ParadropLZ.CenterPosition, false, 128 + 32)
local unitsB = powerproxy.SendParatroopers(ParadropLZ.CenterPosition, false, 128 - 32)
Utils.Do(unitsA, function(unit)
IdleHunt(unit)
local aircraftA = powerproxy.ActivateParatroopers(ParadropLZ.CenterPosition, 128 + 32)
Utils.Do(aircraftA, function(a)
Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
end)
end)
local aircraftB = powerproxy.ActivateParatroopers(ParadropLZ.CenterPosition, 128 - 32)
Utils.Do(aircraftB, function(a)
Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
end)
Utils.Do(unitsB, function(unit)
IdleHunt(unit)
end)
powerproxy.Destroy()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -119,10 +119,12 @@ end
ParadropSovietUnits = function()
local lz = Utils.Random(ParadropWaypoints)
local units = powerproxy.SendParatroopers(lz.CenterPosition)
local aircraft = powerproxy.ActivateParatroopers(lz.CenterPosition)
Utils.Do(units, function(a)
BindActorTriggers(a)
Utils.Do(aircraft, function(a)
Trigger.OnPassengerExited(a, function(t, p)
BindActorTriggers(p)
end)
end)
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",
"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()
if allies2.IsLocalPlayer then
UserInterface.SetMissionText("")
@@ -115,16 +123,16 @@ end
SendParatroopers = function()
Utils.Do(Paratroopers, function(para)
local proxy = Actor.Create(para.proxy, false, { Owner = soviets })
local units = proxy.SendParatroopersFrom(para.entry, para.drop)
proxy.Destroy()
local target = Map.CenterOfCell(para.drop)
local dir = target - Map.CenterOfCell(para.entry)
Utils.Do(units, function(unit)
Trigger.OnIdle(unit, function(a)
if a.IsInWorld then
a.Hunt()
end
local aircraft = proxy.ActivateParatroopers(target, dir.facing)
Utils.Do(aircraft, function(a)
Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
end)
end)
proxy.Destroy()
end)
end

View File

@@ -185,7 +185,7 @@ SendSovietParadrop = function()
local lz = Map.CenterOfCell(randomParadropCell)
local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets })
powerproxy.SendParatroopers(lz)
powerproxy.ActivateParatroopers(lz)
powerproxy.Destroy()
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 } }
end
IdleHunt = function(actor)
Trigger.OnIdle(actor, function(a)
if a.IsInWorld then
a.Hunt()
end
end)
end
SendUnits = function(entryCell, unitTypes, targetCell, extraData)
Reinforcements.Reinforce(soviets, unitTypes, { entryCell }, 40, function(a)
if not a.HasProperty("AttackMove") then
@@ -138,12 +146,10 @@ SendWave = function()
if (Wave < #Waves) then
if Utils.RandomInteger(1, 100) < ParaChance then
local units = ParaProxy.SendParatroopers(Utils.Random(ParadropWaypoints).CenterPosition)
Utils.Do(units, function(unit)
Trigger.OnIdle(unit, function(a)
if a.IsInWorld then
a.Hunt()
end
local aircraft = ParaProxy.ActivateParatroopers(Utils.Random(ParadropWaypoints).CenterPosition)
Utils.Do(aircraft, function(a)
Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
end)
end)

View File

@@ -62,15 +62,20 @@ GroundPatrolUnits =
{ "3tnk", "3tnk" }
}
IdleHunt = function(actor)
Trigger.OnIdle(actor, function(a)
if a.IsInWorld then
a.Hunt()
end
end)
end
ParadropSovietUnits = function()
local powerproxy = Actor.Create("powerproxy.paratroopers", false, { Owner = soviets })
local units = powerproxy.SendParatroopers(MCVDeployLocation.CenterPosition, false, 256 - 53)
Utils.Do(units, function(a)
Trigger.OnIdle(a, function(actor)
if actor.IsInWorld then
actor.Hunt()
end
local aircraft = powerproxy.ActivateParatroopers(MCVDeployLocation.CenterPosition, 256 - 53)
Utils.Do(aircraft, function(a)
Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
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
Trigger.OnAnyKilled({ AlliedDome, AlliedProc }, function()
local powerproxy = Actor.Create("powerproxy.paratroopers", true, { Owner = player })
powerproxy.SendParatroopers(ParadropLZ.CenterPosition, false, Facing.South)
powerproxy.SendParatroopers(ParadropLZ.CenterPosition, false, Facing.SouthEast)
powerproxy.ActivateParatroopers(ParadropLZ.CenterPosition, Facing.South)
powerproxy.ActivateParatroopers(ParadropLZ.CenterPosition, Facing.SouthEast)
powerproxy.Destroy()
end)
end

View File

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

View File

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

View File

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

View File

@@ -53,7 +53,7 @@ end
AddParadropReinforcementTrigger = function()
Trigger.AfterDelay(DateTime.Seconds(90), function()
Media.PlaySpeechNotification(ussr, "ReinforcementsArrived")
scripteddrop.SendParatroopers(ScriptedParadrop.CenterPosition, false, 10)
scripteddrop.ActivateParatroopers(ScriptedParadrop.CenterPosition, 10)
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
AlloyFacilityDestroyed = false
IdleHunt = function(actor)
Trigger.OnIdle(actor, function(a)
if a.IsInWorld then
a.Hunt()
end
end)
end
WorldLoaded = function()
--Players Setup
@@ -324,20 +332,16 @@ WorldLoaded = function()
Trigger.OnEnteredFootprint(ParaTrigger, function(unit, id)
if unit.Owner == player then
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 })
Utils.Do(aircraft, function(a)
Trigger.OnPassengerExited(a, function(t, p)
IdleHunt(p)
end)
end)
Trigger.AfterDelay(DateTime.Seconds(10), function()
if prtcamera.IsInWorld then prtcamera.Destroy() 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
Trigger.ClearAll(RiflemanGuard01)
ProduceInfantry() --Greece will start infantry production right away if the difficulty is set to hard

View File

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

View File

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

View File

@@ -216,11 +216,20 @@ WorldLoaded = function()
Trigger.AfterDelay(DateTime.Minutes(9), function()
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 paratroopers02 = powerproxy02.SendParatroopers(AlliedParadropLZ02.CenterPosition, false, Facing.SouthWest)
Utils.Do(paratroopers01, HuntObjectiveTruck)
Utils.Do(paratroopers02, HuntObjectiveTruck)
local aircraft02 = powerproxy02.ActivateParatroopers(AlliedParadropLZ02.CenterPosition, Facing.SouthWest)
Utils.Do(aircraft02, function(a)
Trigger.OnPassengerExited(a, function(t, p)
HuntObjectiveTruck(p)
end)
end)
end)
Trigger.AfterDelay(0, function()