Missions
PM.Missions patches mission definitions: the agency contracts and tutorial steps that drive exploration mode. Missions are the second-largest typed module because a mission is a small state machine, not a flat record.
A mission has content branches (what happens on submit, on completion, and so on), each branch holds actions that fire when the branch runs, and branches advance based on conditions. The typed module gives you builders for both.
Patching a mission
PM.Missions:Patch(name) registers a patch against missions, targeted with :Named(...) using the mission id (KSP2Mission_Main_Kerbin_03 and so on). A common edit is appending an action to a branch:
PM.Missions:Patch("MoonLandingActivation")
:Named("KSP2Mission_Main_Mun_01")
:Do(function(mission)
mission.ContentBranches.OnSubmit.actions:Append(
PM.Missions:Action("ActivateMissionAction", function(action)
action.TargetMissionID = "KSP2Mission_Secondary_Kerbin_KerbinTourSOI"
action.MissionOwner = "Agency"
end))
end)The pages
Conditions covers the
And,Or, andNotbuilders that compose the logic deciding when a branch advances.Actions covers
PM.Missions:Action, the content branches, and how actions are resolved from their registered type names.Stages covers building mission stages, the stage list, and rewards.
Type lookups
Missions reference C# types by name (action types, property watchers, messages). The module exposes PM.Missions:Action(type, callback) to build an action, and PM.Missions:GetPropertyWatcher(name) and PM.Missions:GetMessage(name) to resolve the other two. The available type names live in the pm-missions.d.lua stub and in autocomplete once your editor is set up.
Scope
Missions are quite intricate and involve a lot of self referencing and cross referencing outside of them, patching them is generally fine for smaller tuning edits/or getting your missions to follow them. However, it is not recommended to use patch manager to make new missions, that is best left to the Unity SDK.