-- 04: ONBOARDING — process a quota inside the review window. QUOTA = 3000 WINDOW = DateTime.Minutes(8) Deadline = nil Ticks = 0 WorldLoaded = function() Stream = Player.GetPlayer("Player") Party = Player.GetPlayer("Enemy") InitObjectives(Stream) QuotaObjective = Stream.AddPrimaryObjective("file-the-quota") PlantObjective = Stream.AddSecondaryObjective("retire-the-plant") Deadline = DateTime.GameTime + WINDOW Trigger.OnKilled(LegacyPlant, function() Stream.MarkCompletedObjective(PlantObjective) end) -- the legacy account eventually objects Trigger.AfterDelay(DateTime.Minutes(3), function() Utils.Do(Map.ActorsInWorld, function(a) if a.Owner == Party and a.HasProperty("Hunt") then a.Hunt() end end) end) Trigger.AfterDelay(WINDOW, function() if not Stream.IsObjectiveCompleted(QuotaObjective) then Stream.MarkFailedObjective(QuotaObjective) end end) end Tick = function() Ticks = Ticks + 1 if Ticks % 25 ~= 0 or QuotaObjective == nil then return end if Stream.IsObjectiveCompleted(QuotaObjective) or Stream.IsObjectiveFailed(QuotaObjective) then return end if Stream.Cash + Stream.Resources >= QUOTA then Stream.MarkCompletedObjective(QuotaObjective) UserInterface.SetMissionText("") return end local left = Deadline - DateTime.GameTime if left < 0 then left = 0 end UserInterface.SetMissionText("Review window " .. Utils.FormatTime(left)) end