Ground of Aces Modding
Loading...
Searching...
No Matches
MissionScriptProxy Class Referencesealed

Owns the mission catalogue (every mission JSON found, plus every lone mission script) and routes mission events to Python. A mission's handlers live in the module named after its id when such a script exists; every other mission — built-in, user-authored or mod-supplied — shares DEFAULT_SCRIPT_MODULE, so a JSON file alone is a complete mission, and a script alone is one whose handlers supply what the JSON otherwise would. More...

Public Member Functions

void LoadMissions (IReadOnlyList< string > paths)
 Reads every mission in paths , in order, last-wins on a duplicate id. A mission is either a JSON file, or a lone script file whose handlers supply the mission instead — see FlightMissionFactory, which falls back to the script path when no data exists for an id. Data for ids that disappeared is deliberately kept so a mission already in flight keeps resolving.
 
void SetScriptedMissionData (string flightMissionId, MissionData missionData)
 Registers data a script authored for a mission that ships no JSON, so that every consumer - the outcome system, the skill roll, the detail window - sees it exactly as if it had been read from a file. Called from MissionScriptApi while the script sets its mission up.
 
void ResetScriptedOutcomeEffects (string flightMissionId)
 Empties what a script authored last time this mission was set up - outcome effects and appearance requirements.
 
bool HasDedicatedScript (string flightMissionId)
 True when a module named exactly like the mission exists, i.e. the mission brings handlers of its own rather than running on DEFAULT_SCRIPT_MODULE. A mission without JSON needs one, because the shared script supplies no values.
 
bool IsHistoricMission (string flightMissionId)
 Whether the mission behind this id is historic storyline content. Historic missions sit outside the weekly quota - they take no schedule slot, they are kept out of the HQ mission strip's planned slots, and a failed one is ignored by the weekly evaluation - so several callers need only this much of MissionData. An unknown id is not historic.
 
string ResolveMissionText (string termKey)
 Resolves a "missions/{missionId}/{suffix}" I2 term key against that mission's authored raw-text overrides (see MissionData.TryGetRawText), returning the literal text when one was authored. Any other key shape, or a slot with nothing authored, is returned unchanged so the caller falls back to the normal I2 term lookup.
 

Detailed Description

Owns the mission catalogue (every mission JSON found, plus every lone mission script) and routes mission events to Python. A mission's handlers live in the module named after its id when such a script exists; every other mission — built-in, user-authored or mod-supplied — shares DEFAULT_SCRIPT_MODULE, so a JSON file alone is a complete mission, and a script alone is one whose handlers supply what the JSON otherwise would.

Member Function Documentation

◆ ResetScriptedOutcomeEffects()

void ResetScriptedOutcomeEffects ( string flightMissionId)
inline

Empties what a script authored last time this mission was set up - outcome effects and appearance requirements.

MissionData is cached per mission id for the lifetime of the process, while initialize_mission runs again on every creation of that id. AddOutcomeEffect appends, so without this the same effects pile up on each re-creation and the outcome system applies every copy - victory points, damage and morale silently multiplying with no error and no log. Clearing here rather than in AddOutcomeEffect keeps a script free to attach several effects to one outcome, which is the normal case.

Only touches missions whose data a script authored: a JSON mission's effects are read from its file and must survive.