FAForever / NomadMissions

Repository containing the missions for Nomads Coop.
3 stars 3 forks source link

M1 - Secondary objective completion #3

Open speed2CZ opened 5 years ago

speed2CZ commented 5 years ago

When I wont the missin even unfinished secondary objectives were marked as completed Cause of this: https://github.com/FAForever/NomadMissions/blob/master/NMCA_001/NMCA_001_script.lua#L183 It just markes all the objectives as completed

and this https://github.com/FAForever/NomadMissions/blob/master/NMCA_001/NMCA_001_script.lua#L227 which says that all are done with no condition testing if its actually true

Proper way of doing it is like this:

function KillGame()
    local secondary = Objectives.IsComplete(ScenarioInfo.M1S1) and
                      Objectives.IsComplete(ScenarioInfo.M2S1) and
                      Objectives.IsComplete(ScenarioInfo.M3S1) and
                      Objectives.IsComplete(ScenarioInfo.M4S1)
    local bonus = Objectives.IsComplete(ScenarioInfo.M1B1) and
                  Objectives.IsComplete(ScenarioInfo.M1B2) and
                  Objectives.IsComplete(ScenarioInfo.M1B3) and
                  Objectives.IsComplete(ScenarioInfo.M2B1) and
                  Objectives.IsComplete(ScenarioInfo.M2B2) and
                  Objectives.IsComplete(ScenarioInfo.M4B1)
    ScenarioFramework.EndOperation(ScenarioInfo.OpComplete, ScenarioInfo.OpComplete, secondary, bonus)
end