21#define BUTTON_WIDTH 80
22#define BUTTON_HEIGHT 30
24#define GRAPHIC_WIDTH 256
25#define GRAPHIC_HEIGHT 256
30static int comm_open = 0;
76 if ( !pilot_isFlag( p, PILOT_HAILING ) &&
84 if ( pilot_isFlag( p, PILOT_HYPERSPACE ) ) {
85 player_message( _(
"#%c%s#r is jumping and can't respond" ),
c, p->name );
90 if ( !pilot_isFlag( p, PILOT_HAILING ) &&
91 pilot_isFlag( p, PILOT_DISABLED ) ) {
100 pilot_rmFlag( p, PILOT_HAILING );
107 HookParam hparam[] = { { .type = HOOK_PARAM_PILOT, .u = { .lp = p->id } },
108 { .type = HOOK_PARAM_SENTINEL } };
135 for (
int i = 0; i <
array_size( pltstk ); i++ )
152 char *buf =
ndata_read( COMM_PATH, &bufsize );
153 if ( nlua_dobufenv(
comm_env, buf, bufsize, COMM_PATH ) != 0 ) {
154 WARN( _(
"Error loading file: %s\n"
156 "Most likely Lua file has improper syntax, please check" ),
157 COMM_PATH, lua_tostring(
naevL, -1 ) );
170 if ( nlua_pcall(
comm_env, 1, 0 ) ) {
171 WARN( _(
"Comm: '%s'" ), lua_tostring(
naevL, -1 ) );
194 { .type = HOOK_PARAM_SPOB, .u = { .la =
spob_index( spob ) } },
195 { .type = HOOK_PARAM_SENTINEL } };
206 if ( spob->
lua_comm != LUA_NOREF ) {
210 if ( nlua_pcall( spob->
lua_env, 0, 1 ) ) {
211 WARN( _(
"Spob '%s' failed to run '%s':\n%s" ), spob->
name,
"comm",
212 lua_tostring(
naevL, -1 ) );
215 int commed = lua_toboolean(
naevL, -1 );
250 nlua_getenv(
naevL, p->ai->env,
"mem" );
253 lua_getfield(
naevL, -1, str );
254 if ( !lua_isstring(
naevL, -1 ) )
257 ret = lua_tostring(
naevL, -1 );
void ai_unsetPilot(AIMemory oldmem)
Finishes setting up a pilot.
AIMemory ai_setPilot(Pilot *p)
Sets the pilot for further AI calls.
void ai_hail(Pilot *recipient)
Triggers the hail() function in the pilot's AI.
Provides macros to work with dynamic arrays.
static ALWAYS_INLINE int array_size(const void *array)
Returns number of elements in the array.
int comm_openPilot(unsigned int pilot)
Opens the communication dialogue with a pilot.
static const char * comm_getString(const Pilot *p, const char *str)
Gets a string from the pilot's memory.
int comm_openSpob(Spob *spob)
Opens a communication dialogue with a spob.
int comm_isOpen(void)
Check to see if the comm window is open.
void comm_queueClose(void)
Queues a close command when possible.
static int comm_commClose
int escort_playerCommand(const Pilot *e)
Open a dialog for the player to issue a command to an escort.
void player_message(const char *fmt,...)
Adds a mesg to the queue to be displayed on screen.
int hooks_runParam(const char *stack, const HookParam *param)
Runs all the hooks of stack.
void * ndata_read(const char *path, size_t *filesize)
Reads a file from the ndata (will be NUL terminated).
int nlua_loadStandard(nlua_env env)
Loads the standard Naev Lua API.
LuaPilot * lua_pushpilot(lua_State *L, LuaPilot pilot)
Pushes a pilot on the stack.
char pilot_getFactionColourChar(const Pilot *p)
Gets the faction colour char, works like faction_reputationColourChar but for a pilot.
Pilot * pilot_get(unsigned int id)
Pulls a pilot out of the pilot_stack based on ID.
Pilot *const * pilot_getAll(void)
Gets the pilot stack.
int pilot_canTarget(const Pilot *p)
Same as pilot_validTarget but without the range check.
int pilot_inRangePilot(const Pilot *p, const Pilot *target, double *dist2)
Check to see if a pilot is in sensor range of another.
int pilot_runHook(Pilot *p, int hook_type)
Tries to run a pilot hook if he has it.
int spob_index(const Spob *p)
Gets the ID of a spob.
const char * spob_name(const Spob *p)
Gets the translated name of a spob.
void spob_luaInitMem(const Spob *spob)
Initializes the memory fo a spob.
Represents a temporary pilot memory. For use with ai_setPilot and ai_unsetPilot.
The actual hook parameter.
The representation of an in-game pilot.
Represents a Space Object (SPOB), including and not limited to planets, stations, wormholes,...