Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua access to Support Ship availability #5570

Merged
merged 1 commit into from
Oct 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading