47 lines
1.3 KiB
Lua
47 lines
1.3 KiB
Lua
-- 01: FIRST PRESSING
|
|
|
|
TARGET_RECORDS = 2000
|
|
PROBE_DELAY = DateTime.Minutes(4)
|
|
|
|
WorldLoaded = function()
|
|
-- do NOT shadow the `Player` global: Player.GetPlayer is still needed below
|
|
Mrp = Player.GetPlayer("Player")
|
|
Stream = Player.GetPlayer("Enemy")
|
|
InitObjectives(Mrp)
|
|
|
|
PressObjective = Mrp.AddPrimaryObjective("press-first-records")
|
|
VanObjective = Mrp.AddSecondaryObjective("keep-the-van-alive")
|
|
|
|
-- lose the HQ, lose the secondary
|
|
local hq = Utils.Where(Map.ActorsInWorld, function(a)
|
|
return a.Owner == Mrp and (a.Type == "popupvan" or a.Type == "popupshop")
|
|
end)
|
|
if #hq > 0 then
|
|
Trigger.OnAllKilled(hq, function()
|
|
Mrp.MarkFailedObjective(VanObjective)
|
|
end)
|
|
end
|
|
|
|
-- the probe
|
|
Trigger.AfterDelay(PROBE_DELAY, function()
|
|
Media.PlaySpeechNotification(Mrp, "BaseAttack")
|
|
Utils.Do(Map.ActorsInWorld, function(a)
|
|
if a.Owner == Stream and a.HasProperty("Hunt") then
|
|
a.Hunt()
|
|
end
|
|
end)
|
|
end)
|
|
end
|
|
|
|
Tick = function()
|
|
if PressObjective ~= nil and not Mrp.IsObjectiveCompleted(PressObjective) then
|
|
local banked = Mrp.Cash + Mrp.Resources
|
|
local plants = Utils.Where(Map.ActorsInWorld, function(a)
|
|
return a.Owner == Mrp and a.Type == "pressplant"
|
|
end)
|
|
if #plants > 0 and banked >= TARGET_RECORDS then
|
|
Mrp.MarkCompletedObjective(PressObjective)
|
|
end
|
|
end
|
|
end
|