Update gdi04c to use cell triggers

This commit is contained in:
Oliver Brakmann
2014-09-29 21:26:21 +02:00
committed by Paul Chote
parent a61fdba44d
commit 154ebc5857
2 changed files with 16 additions and 30 deletions

View File

@@ -1,4 +1,6 @@
LoseTriggerHouses = { TrigLos2Farm1, TrigLos2Farm2, TrigLos2Farm3, TrigLos2Farm4 } LoseTriggerHouses = { TrigLos2Farm1, TrigLos2Farm2, TrigLos2Farm3, TrigLos2Farm4 }
TownAttackTrigger = { CPos.New(54, 38), CPos.New(55, 38), CPos.New(56, 38), CPos.New(57, 38) }
GDIReinforcementsTrigger = { CPos.New(32, 51), CPos.New(32, 52), CPos.New(33, 52) }
GDIReinforcementsPart1 = { "jeep", "jeep" } GDIReinforcementsPart1 = { "jeep", "jeep" }
GDIReinforcementsPart2 = { "e2", "e2", "e2", "e2", "e2" } GDIReinforcementsPart2 = { "e2", "e2", "e2", "e2", "e2" }
@@ -34,8 +36,6 @@ TownAttackAction = function(actor)
end end
AttackTown = function() AttackTown = function()
TownAttackTriggered = true
Reinforcements.Reinforce(nod, TownAttackWave1, { NodReinfEntry.Location, waypoint0.Location }, Utils.Seconds(0.25), TownAttackAction) Reinforcements.Reinforce(nod, TownAttackWave1, { NodReinfEntry.Location, waypoint0.Location }, Utils.Seconds(0.25), TownAttackAction)
Trigger.AfterDelay(Utils.Seconds(2), function() Trigger.AfterDelay(Utils.Seconds(2), function()
Reinforcements.Reinforce(nod, TownAttackWave2, { NodReinfEntry.Location, waypoint0.Location }, Utils.Seconds(1), TownAttackAction) Reinforcements.Reinforce(nod, TownAttackWave2, { NodReinfEntry.Location, waypoint0.Location }, Utils.Seconds(1), TownAttackAction)
@@ -46,8 +46,6 @@ AttackTown = function()
end end
SendGDIReinforcements = function() SendGDIReinforcements = function()
GDIReinforcementsTriggered = true
Reinforcements.Reinforce(player, GDIReinforcementsPart1, { GDIReinfEntry1.Location, waypoint12.Location }, Utils.Seconds(1), function(actor) Reinforcements.Reinforce(player, GDIReinforcementsPart1, { GDIReinfEntry1.Location, waypoint12.Location }, Utils.Seconds(1), function(actor)
Media.PlaySpeechNotification(player, "Reinforce") Media.PlaySpeechNotification(player, "Reinforce")
actor.Move(waypoint10.Location) actor.Move(waypoint10.Location)
@@ -63,17 +61,6 @@ SendGDIReinforcements = function()
end) end)
end end
-- FIXME: replace with real cell trigger when available
CellTrigger = function(player, trigger, radius, func)
local units = Map.ActorsInCircle(trigger.CenterPosition, WRange.FromCells(radius), function(actor)
return actor.Owner == player and actor.HasProperty("Move")
end)
if #units > 0 then
func()
end
end
WorldLoaded = function() WorldLoaded = function()
player = Player.GetPlayer("GDI") player = Player.GetPlayer("GDI")
nod = Player.GetPlayer("Nod") nod = Player.GetPlayer("Nod")
@@ -107,6 +94,20 @@ WorldLoaded = function()
end) end)
end) end)
Trigger.OnExitedFootprint(TownAttackTrigger, function(a, id)
if a.Owner == player then
Trigger.RemoveFootprintTrigger(id)
AttackTown()
end
end)
Trigger.OnEnteredFootprint(GDIReinforcementsTrigger, function(a, id)
if a.Owner == player then
Trigger.RemoveFootprintTrigger(id)
SendGDIReinforcements()
end
end)
Utils.Do(player.GetGroundAttackers(), function(unit) Utils.Do(player.GetGroundAttackers(), function(unit)
unit.Stance = "Defend" unit.Stance = "Defend"
end) end)
@@ -121,8 +122,6 @@ WorldLoaded = function()
Media.PlayMovieFullscreen("bkground.vqa", function() Media.PlayMovieFullscreen("gdi4a.vqa", function() Media.PlayMovieFullscreen("nodsweep.vqa") end) end) Media.PlayMovieFullscreen("bkground.vqa", function() Media.PlayMovieFullscreen("gdi4a.vqa", function() Media.PlayMovieFullscreen("nodsweep.vqa") end) end)
end end
TownAttackTriggered = false
GDIReinforcementsTriggered = false
Tick = function() Tick = function()
if player.HasNoRequiredUnits() then if player.HasNoRequiredUnits() then
nod.MarkCompletedObjective(nodObjective) nod.MarkCompletedObjective(nodObjective)
@@ -131,10 +130,4 @@ Tick = function()
player.MarkCompletedObjective(gdiObjective1) player.MarkCompletedObjective(gdiObjective1)
player.MarkCompletedObjective(gdiObjective2) player.MarkCompletedObjective(gdiObjective2)
end end
if not TownAttackTriggered then
CellTrigger(player, TownAttackTrigger, 2, AttackTown)
elseif not GDIReinforcementsTriggered then
CellTrigger(player, GDIReinfTrigger, 2, SendGDIReinforcements)
end
end end

View File

@@ -860,19 +860,12 @@ Actors:
waypoint0: waypoint waypoint0: waypoint
Location: 55,54 Location: 55,54
Owner: Neutral Owner: Neutral
TownAttackTrigger: waypoint
# Location: 46,44
Location: 56,38
Owner: Neutral
TownAttackWpt: waypoint TownAttackWpt: waypoint
Location: 24,48 Location: 24,48
Owner: Neutral Owner: Neutral
NodReinfEntry: waypoint NodReinfEntry: waypoint
Location: 61,55 Location: 61,55
Owner: Neutral Owner: Neutral
GDIReinfTrigger: waypoint
Location: 32,52
Owner: Neutral
GDIReinfEntry1: waypoint GDIReinfEntry1: waypoint
Location: 14,51 Location: 14,51
Owner: Neutral Owner: Neutral