Skip to content

Commit

Permalink
lua access to Support Ship availability (#5570)
Browse files Browse the repository at this point in the history
  • Loading branch information
MjnMixael authored Oct 14, 2023
1 parent 0def45b commit 08dfcc8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions code/scripting/api/libs/mission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,25 @@ ADE_FUNC(createBolt,
return ade_set_args(L, "b", nebl_bolt(boltclass, &origin, &dest, playSound));
}

ADE_FUNC(getSupportAllowed,
l_Mission,
"[boolean SimpleCheck = true]",
"Get whether or not the player's call for support will be successful. If simple check is false, the code will do a much more "
"expensive, but accurate check.",
"boolean",
"true if support can be called, false if not or not in a mission")
{
bool simple_check = true;
ade_get_args(L, "|b", &simple_check);

// we should be in a mission and the player object must exist
if (((Game_mode & GM_IN_MISSION) == 0) && (Player_obj != nullptr)) {
return ade_set_args(L, "b", (bool)is_support_allowed(Player_obj, simple_check));
}

return ADE_RETURN_FALSE;
}

ADE_FUNC(getMissionFilename, l_Mission, NULL, "Gets mission filename", "string", "Mission filename, or empty string if game is not in a mission")
{
char temp[MAX_FILENAME_LEN];
Expand Down

0 comments on commit 08dfcc8

Please sign in to comment.