Port r9701 from zookeeper branch to trunk: Added a Lua function to check whether a ship is warp-capable.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@9775 387891d4-d844-0410-90c0-e4c51a9137d3
This commit is contained in:
zookeeper authored and niffiwan committed 2013-09-13 20:18:31 +10:00
1 parent d5f03daa6b
commit fd21b9054b
1 file changed
+17
+17
View File
@@ -8880,6 +8880,23 @@ ADE_FUNC(warpOut, l_Ship, NULL, "Warps ship out", "boolean", "True if successful
return ADE_RETURN_TRUE;
}
ADE_FUNC(canWarp, l_Ship, NULL, "Checks whether ship has a working subspace drive and is allowed to use it", "boolean", "True if successful, or nil if ship handle is invalid")
{
object_h *objh;
if(!ade_get_args(L, "o", l_Ship.GetPtr(&objh)))
return ADE_RETURN_NIL;
if(!objh->IsValid())
return ADE_RETURN_NIL;
ship *shipp = &Ships[objh->objp->instance];
if(shipp->flags & SF2_NO_SUBSPACE_DRIVE){
return ADE_RETURN_FALSE;
}
return ADE_RETURN_TRUE;
}
// Aardwolf's function for finding if a ship should be drawn as blue on the radar/minimap
ADE_FUNC(isWarpingIn, l_Ship, NULL, "Checks if ship is warping in", "boolean", "True if the ship is warping in, false or nil otherwise")
{