19#include "nlua_pilot.h"
20#include "nlua_system.h"
21#include "land_outfits.h"
22#include "map_overlay.h"
94 return (
LuaJump*) lua_touserdata(L,ind);
107 luaL_typerror(L, ind, JUMP_METATABLE);
138 else if (lua_gettop(L) > 1) {
139 if (lua_isstring(L, ind))
144 if (lua_isstring(L, ind+1))
153 luaL_typerror(L, ind, JUMP_METATABLE);
157 if ((b != NULL) && (a != NULL))
161 NLUA_ERROR(L, _(
"Jump is invalid"));
189 luaL_getmetatable(L, JUMP_METATABLE);
190 lua_setmetatable(L, -2);
205 if (lua_getmetatable(L,ind)==0)
207 lua_getfield(L, LUA_REGISTRYINDEX, JUMP_METATABLE);
210 if (lua_rawequal(L, -1, -2))
238 if ((a == NULL) || (b == NULL))
239 return NLUA_ERROR(L, _(
"No matching jump points found."));
271 lua_pushboolean(L,((a->srcid == b->srcid) && (a->destid == b->destid)));
283 char buf[STRMAX_SHORT];
287 snprintf( buf,
sizeof(buf), _(
"Jump( %s -> %s )"), _(src->name), _(dst->name) );
288 lua_pushstring( L, buf );
303 lua_pushnumber(L,jp->radius);
333 lua_pushnumber(L, jp->angle);
348 lua_pushboolean(L, jp_isFlag(jp, JP_HIDDEN) );
363 lua_pushboolean(L, jp_isFlag(jp, JP_EXITONLY) );
427 lua_pushboolean(L, jp_isKnown(jp));
443 int b, offset, changed;
450 if (lua_gettop(L) > offset)
451 b = lua_toboolean(L, 1 + offset);
455 changed = ((b != (int)jp_isKnown(jp)) || (b != (int)jp_isKnown(jp->returnJump)));
458 jp_setFlag( jp, JP_KNOWN );
459 jp_setFlag( jp->returnJump, JP_KNOWN );
462 jp_rmFlag( jp, JP_KNOWN );
463 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_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.