Skip to content

Commit

Permalink
Grant access to shipclass shield hitpoints value (scp-fs2open#6308)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Nelson authored Aug 19, 2024
1 parent db13168 commit 397a1c8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions code/scripting/api/objs/shipclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,22 @@ ADE_VIRTVAR(HitpointsMax, l_Shipclass, "number", "Ship class hitpoints", "number
return ade_set_args(L, "f", Ship_info[idx].max_hull_strength);
}

ADE_VIRTVAR(ShieldHitpointsMax, l_Shipclass, nullptr, "Ship class shield hitpoints", "number", "Shield hitpoints, or 0 if handle is invalid")
{
int idx;
if(!ade_get_args(L, "o", l_Shipclass.Get(&idx)))
return ade_set_error(L, "f", 0.0f);

if(idx < 0 || idx >= ship_info_size())
return ade_set_error(L, "f", 0.0f);

if(ADE_SETTING_VAR) {
LuaError(L, "Setting Shield Max Hitpoints is not supported");
}

return ade_set_args(L, "f", Ship_info[idx].max_shield_strength);
}

ADE_VIRTVAR(Species, l_Shipclass, "species", "Ship class species", "species", "Ship class species, or invalid species handle if shipclass handle is invalid")
{
int idx;
Expand Down

0 comments on commit 397a1c8

Please sign in to comment.