17#include "land_outfits.h"
18#include "map_overlay.h"
19#include "nlua_pilot.h"
20#include "nlua_system.h"
97 return (
LuaJump *)lua_touserdata( L, ind );
110 luaL_typerror( L, ind, JUMP_METATABLE );
138 if ( offset != NULL )
140 }
else if ( lua_gettop( L ) > 1 ) {
141 if ( lua_isstring( L, ind ) )
146 if ( lua_isstring( L, ind + 1 ) )
151 if ( offset != NULL )
154 luaL_typerror( L, ind, JUMP_METATABLE );
158 if ( ( b != NULL ) && ( a != NULL ) )
162 NLUA_ERROR( L, _(
"Jump is invalid" ) );
190 luaL_getmetatable( L, JUMP_METATABLE );
191 lua_setmetatable( L, -2 );
206 if ( lua_getmetatable( L, ind ) == 0 )
208 lua_getfield( L, LUA_REGISTRYINDEX, JUMP_METATABLE );
211 if ( lua_rawequal( L, -1, -2 ) )
238 if ( ( a == NULL ) || ( b == NULL ) )
239 return NLUA_ERROR( L, _(
"No matching jump points found." ) );
271 L, ( ( a->srcid == b->srcid ) && ( a->destid == b->destid ) ) );
284 char buf[STRMAX_SHORT];
288 snprintf( buf,
sizeof( buf ), _(
"Jump( %s -> %s )" ), _( src->name ),
290 lua_pushstring( L, buf );
306 ret.destid = lj->
srcid;
322 lua_pushnumber( L, jp->radius );
352 lua_pushnumber( L, jp->hide );
367 lua_pushnumber( L, jp->angle );
382 lua_pushboolean( L, jp_isFlag( jp, JP_HIDDEN ) );
398 lua_pushboolean( L, jp_isFlag( jp, JP_EXITONLY ) );
461 lua_pushboolean( L, jp_isKnown( jp ) );
478 int b, offset, changed;
485 if ( lua_gettop( L ) > offset )
486 b = lua_toboolean( L, 1 + offset );
490 changed = ( ( b != (int)jp_isKnown( jp ) ) ||
491 ( b != (int)jp_isKnown( jp->returnJump ) ) );
494 jp_setFlag( jp, JP_KNOWN );
495 jp_setFlag( jp->returnJump, JP_KNOWN );
497 jp_rmFlag( jp, JP_KNOWN );
498 jp_rmFlag( jp->returnJump, JP_KNOWN );
void outfits_updateEquipmentOutfits(void)
Updates the outfitter and equipment outfit image arrays.
Header file with generic functions and naev-specifics.
static int jumpL_hide(lua_State *L)
Gets the hide value of a jump in radians.
static int jumpL_reverse(lua_State *L)
Gets the opposite jump.
static int jumpL_jumpDist(lua_State *L)
Gets the distance from the jump point at which the pilot can jump.
static int jumpL_tostring(lua_State *L)
Converts a jump to readable form. Mainly meant to be used for printing.
static int jumpL_exitonly(lua_State *L)
Checks whether a jump is exit-only.
static int jumpL_setKnown(lua_State *L)
Sets a jump's known state.
static int jumpL_system(lua_State *L)
Gets the system that a jump point exists in.
static RETURNS_NONNULL JumpPoint * luaL_validjumpSystem(lua_State *L, int ind, int *offset)
Back-end for luaL_validjump.
LuaJump * luaL_checkjump(lua_State *L, int ind)
Gets jump at index raising an error if isn't a jump.
static int jumpL_angle(lua_State *L)
Gets the angle of a jump in radians.
static int jumpL_radius(lua_State *L)
Gets the jump's radius.
static int jumpL_isKnown(lua_State *L)
Checks to see if a jump is known by the player.
static int jumpL_dest(lua_State *L)
Gets the system that a jump point exits into.
static int jumpL_eq(lua_State *L)
You can use the '==' operator within Lua to compare jumps with this.
static const luaL_Reg jump_methods[]
static int jumpL_get(lua_State *L)
Gets a jump.
static int jumpL_hidden(lua_State *L)
Checks whether a jump is hidden.
LuaJump * lua_pushjump(lua_State *L, LuaJump jump)
Pushes a jump on the stack.
int nlua_loadJump(nlua_env env)
Loads the jump library.
JumpPoint * luaL_validjump(lua_State *L, int ind)
Gets a jump directly.
int lua_isjump(lua_State *L, int ind)
Checks to see if ind is a jump.
LuaJump * lua_tojump(lua_State *L, int ind)
This module allows you to handle the jumps from Lua.
static int jumpL_position(lua_State *L)
Gets the position of the jump in the system.
Pilot * luaL_validpilot(lua_State *L, int ind)
Makes sure the pilot is valid or raises a Lua error.
LuaSystem * lua_pushsystem(lua_State *L, LuaSystem sys)
Pushes a system on the stack.
StarSystem * luaL_validsystem(lua_State *L, int ind)
Gets system (or system name) at index raising an error if type doesn't match.
LuaSystem lua_tosystem(lua_State *L, int ind)
Lua system module.
int lua_issystem(lua_State *L, int ind)
Checks to see if ind is a system.
vec2 * lua_pushvector(lua_State *L, vec2 vec)
Pushes a vector on the stack.
int space_jumpDistance(const Pilot *p, const JumpPoint *jp)
Distance at which a pilot can jump.
StarSystem * system_getIndex(int id)
Get the system by its index.
JumpPoint * jump_getTarget(const StarSystem *target, const StarSystem *sys)
Less safe version of jump_get that works with pointers.
StarSystem * system_get(const char *sysname)
Get the system from its name.
The representation of an in-game pilot.