Don't play low power notifications in the beginning of twist-of-fate

This commit is contained in:
abcdefg30
2023-05-19 19:18:21 +02:00
committed by Gustas
parent 74ed202b29
commit ee02af3605

View File

@@ -22,6 +22,7 @@ GoDemolitionMan = function(rmbo)
if rmbo.IsDead then if rmbo.IsDead then
return return
end end
local structures = Utils.Where(Map.ActorsInCircle(rmbo.CenterPosition , WDist.FromCells(6)), function(u) return u.HasProperty("StartBuildingRepairs") and u.Owner == GDI end) local structures = Utils.Where(Map.ActorsInCircle(rmbo.CenterPosition , WDist.FromCells(6)), function(u) return u.HasProperty("StartBuildingRepairs") and u.Owner == GDI end)
if #structures > 0 then if #structures > 0 then
rmbo.Stop() rmbo.Stop()
@@ -53,6 +54,7 @@ CaptureStructures = function(actor)
captst = st captst = st
end end
end) end)
if captst then if captst then
actor.Capture(captst) actor.Capture(captst)
end end
@@ -62,14 +64,17 @@ LaunchNuke = function(loop)
if NukeDelay == 0 then if NukeDelay == 0 then
return return
end end
local targets = GDI.GetActorsByTypes({ "nuk2", "atwr", "weap", "proc" }) local targets = GDI.GetActorsByTypes({ "nuk2", "atwr", "weap", "proc" })
if #targets < 1 then if #targets < 1 then
targets = GDI.GetGroundAttackers() targets = GDI.GetGroundAttackers()
end end
if not NodTmpl.IsDead then if not NodTmpl.IsDead then
Media.PlaySpeechNotification(GDI, "NuclearWarheadApproaching") Media.PlaySpeechNotification(GDI, "NuclearWarheadApproaching")
NodTmpl.ActivateNukePower(Utils.Random(targets).Location) NodTmpl.ActivateNukePower(Utils.Random(targets).Location)
end end
if loop then if loop then
Trigger.AfterDelay(DateTime.Seconds(NukeDelay), function() LaunchNuke(true) end) Trigger.AfterDelay(DateTime.Seconds(NukeDelay), function() LaunchNuke(true) end)
end end
@@ -79,6 +84,7 @@ SendNodAirstrike = function(loop)
if AstkDelay == 0 then if AstkDelay == 0 then
return return
end end
local target = GetAirstrikeTarget(GDI) local target = GetAirstrikeTarget(GDI)
if target then if target then
NodAirSupport.TargetAirstrike(target, Angle.SouthEast) NodAirSupport.TargetAirstrike(target, Angle.SouthEast)
@@ -97,12 +103,14 @@ SendEasyReinforcements = function(i)
else else
team = ReinforceTeams[Utils.RandomInteger(1, 4)] team = ReinforceTeams[Utils.RandomInteger(1, 4)]
end end
Media.PlaySpeechNotification(GDI, "Reinforce") Media.PlaySpeechNotification(GDI, "Reinforce")
Reinforcements.Reinforce(GDI, team, { CPos.New(56,2), waypoint0.Location }, 25, function(a) Reinforcements.Reinforce(GDI, team, { CPos.New(56,2), waypoint0.Location }, 25, function(a)
a.Move(waypoint1.Location, 2) a.Move(waypoint1.Location, 2)
a.Move(waypoint2.Location, 2) a.Move(waypoint2.Location, 2)
a.Move(CPos.New(49,44), 2) a.Move(CPos.New(49,44), 2)
end) end)
Trigger.AfterDelay(DateTime.Seconds(ReinforceDelay), function() Trigger.AfterDelay(DateTime.Seconds(ReinforceDelay), function()
SendEasyReinforcements(i + 1) SendEasyReinforcements(i + 1)
end) end)
@@ -123,6 +131,7 @@ CompleteCaptureCommCenterObjective = function()
NodCYard.StartBuildingRepairs() NodCYard.StartBuildingRepairs()
end) end)
end end
Media.DisplayMessage(UserInterface.Translate("communications-center-captured-sams-located")) Media.DisplayMessage(UserInterface.Translate("communications-center-captured-sams-located"))
local activeSams = Nod.GetActorsByType("sam") local activeSams = Nod.GetActorsByType("sam")
local miniCams = { } local miniCams = { }
@@ -131,6 +140,7 @@ CompleteCaptureCommCenterObjective = function()
table.insert(miniCams, Actor.Create("camera.mini", true, { Owner = GDI, Location = s.Location })) table.insert(miniCams, Actor.Create("camera.mini", true, { Owner = GDI, Location = s.Location }))
table.insert(miniCams, Actor.Create("camera.mini", true, { Owner = GDI, Location = CPos.New(s.Location.X + 1, s.Location.Y) })) table.insert(miniCams, Actor.Create("camera.mini", true, { Owner = GDI, Location = CPos.New(s.Location.X + 1, s.Location.Y) }))
end) end)
Trigger.AfterDelay(1, function() Trigger.AfterDelay(1, function()
Utils.Do(miniCams, function(c) Utils.Do(miniCams, function(c)
c.Destroy() c.Destroy()
@@ -140,7 +150,6 @@ CompleteCaptureCommCenterObjective = function()
end end
WorldLoaded = function() WorldLoaded = function()
Camera.Position = DefaultCameraPosition.CenterPosition Camera.Position = DefaultCameraPosition.CenterPosition
GDI = Player.GetPlayer("GDI") GDI = Player.GetPlayer("GDI")
Nod = Player.GetPlayer("Nod") Nod = Player.GetPlayer("Nod")
@@ -190,6 +199,8 @@ WorldLoaded = function()
Actor203.Destroy() Actor203.Destroy()
end end
GDI.PlayLowPowerNotification = false
InitObjectives(GDI) InitObjectives(GDI)
ClearPath = AddPrimaryObjective(GDI, "clear-path") ClearPath = AddPrimaryObjective(GDI, "clear-path")
Trigger.AfterDelay(DateTime.Seconds(5), function() Trigger.AfterDelay(DateTime.Seconds(5), function()
@@ -201,14 +212,16 @@ WorldLoaded = function()
Flare = Actor.Create("flare", true, { Owner = GDI, Location = DefaultFlareLocation.Location }) Flare = Actor.Create("flare", true, { Owner = GDI, Location = DefaultFlareLocation.Location })
Trigger.AfterDelay(1,function() Trigger.AfterDelay(1, function()
AmbushTeam = Map.ActorsInBox(Map.CenterOfCell(CPos.New(46,5)), Map.CenterOfCell(CPos.New(60,53)), function(a) return a.Owner == Nod and a.Type ~= "stnk" end) AmbushTeam = Map.ActorsInBox(Map.CenterOfCell(CPos.New(46,5)), Map.CenterOfCell(CPos.New(60,53)), function(a) return a.Owner == Nod and a.Type ~= "stnk" end)
Trigger.OnAllKilled(AmbushTeam, function() Trigger.OnAllKilled(AmbushTeam, function()
GDI.MarkCompletedObjective(ClearPath) GDI.MarkCompletedObjective(ClearPath)
Trigger.AfterDelay(DateTime.Seconds(2), function() Trigger.AfterDelay(DateTime.Seconds(2), function()
Trigger.AfterDelay(DateTime.Seconds(30), function() Trigger.AfterDelay(DateTime.Seconds(30), function()
Flare.Destroy() Flare.Destroy()
end) end)
Media.PlaySpeechNotification(GDI, "Reinforce") Media.PlaySpeechNotification(GDI, "Reinforce")
Reinforcements.Reinforce(GDI, MCVReinf, { CPos.New(56,2), waypoint0.Location }, 25, function(a) Reinforcements.Reinforce(GDI, MCVReinf, { CPos.New(56,2), waypoint0.Location }, 25, function(a)
a.Move(waypoint1.Location, 2) a.Move(waypoint1.Location, 2)
@@ -217,11 +230,19 @@ WorldLoaded = function()
if a.HasProperty("Deploy") then if a.HasProperty("Deploy") then
a.Move(CPos.New(48,51)) a.Move(CPos.New(48,51))
a.Deploy() a.Deploy()
Trigger.OnRemovedFromWorld(a, function()
if not a.IsDead then
GDI.PlayLowPowerNotification = true
end
end)
end end
end) end)
Utils.Do(ClearPathCameras, function(c) Utils.Do(ClearPathCameras, function(c)
c.Destroy() c.Destroy()
end) end)
if Difficulty == "easy" then if Difficulty == "easy" then
Trigger.AfterDelay(DateTime.Seconds(ReinforceDelay), function() Trigger.AfterDelay(DateTime.Seconds(ReinforceDelay), function()
SendEasyReinforcements(1) SendEasyReinforcements(1)
@@ -246,6 +267,7 @@ WorldLoaded = function()
GDI.MarkFailedObjective(CaptureCommCenter) GDI.MarkFailedObjective(CaptureCommCenter)
return return
end end
if NodAstkHq.Owner == GDI then if NodAstkHq.Owner == GDI then
Trigger.AfterDelay(DateTime.Seconds(4), CompleteCaptureCommCenterObjective) Trigger.AfterDelay(DateTime.Seconds(4), CompleteCaptureCommCenterObjective)
end end
@@ -269,6 +291,7 @@ WorldLoaded = function()
building.Owner = GDI building.Owner = GDI
end end
end) end)
GDI.MarkCompletedObjective(RecoverOldBase) GDI.MarkCompletedObjective(RecoverOldBase)
table.insert(SneakPaths, SP2) table.insert(SneakPaths, SP2)
table.insert(SneakPaths, SP1) table.insert(SneakPaths, SP1)