Skip to content

Commit 4c209f8

Browse files
authored
Add mission name as hook variable (#6699)
1 parent 84c8892 commit 4c209f8

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎code/mission/missioncampaign.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,9 @@ void mission_campaign_mission_over(bool do_next_mission)
11601160
}
11611161

11621162
// runs the new scripting conditional hook, "On Campaign Mission Accept" --wookieejedi
1163-
scripting::hooks::OnCampaignMissionAccept->run();
1163+
scripting::hooks::OnCampaignMissionAccept->run(
1164+
scripting::hook_param_list(scripting::hook_param("Mission", 's', mission_obj->name)
1165+
));
11641166

11651167
} else {
11661168
// free up the goals and events which were just malloced. It's kind of like erasing any fact

‎code/scripting/global_hooks.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ const std::shared_ptr<Hook<>> OnLoadComplete =
6767

6868
const std::shared_ptr<Hook<>> OnCampaignMissionAccept = Hook<>::Factory("On Campaign Mission Accept",
6969
"Invoked after a campaign mission once the player accepts the result and moves on to the next mission instead of replaying it.",
70-
{});
70+
{
71+
{"Mission", "string", "The filename of the mission that was just accepted."}
72+
});
7173

7274
const std::shared_ptr<Hook<>> OnBriefStage = Hook<>::Factory("On Briefing Stage",
7375
"Invoked for each briefing stage what it is shown.",

0 commit comments

Comments
 (0)