31#define BUTTON_WIDTH 80
32#define BUTTON_HEIGHT 30
34#define GRAPHIC_WIDTH 256
35#define GRAPHIC_HEIGHT 256
40static int comm_open = 0;
87 if (!pilot_isFlag(p, PILOT_HAILING) &&
94 if (pilot_isFlag(p, PILOT_HYPERSPACE)) {
100 if (pilot_isFlag(p, PILOT_DISABLED)) {
106 if (p->faction == FACTION_PLAYER) {
115 pilot_rmFlag( p, PILOT_HAILING );
123 { .type = HOOK_PARAM_PILOT,
124 .u = { .lp = p->id } },
125 { .type = HOOK_PARAM_SENTINEL } };
158 char *buf =
ndata_read( COMM_PATH, &bufsize );
159 if (nlua_dobufenv(
comm_env, buf, bufsize, COMM_PATH) != 0) {
160 WARN( _(
"Error loading file: %s\n"
162 "Most likely Lua file has improper syntax, please check"),
163 COMM_PATH, lua_tostring(naevL,-1));
174 nlua_getenv(naevL,
comm_env,
"comm");
177 WARN( _(
"Comm: '%s'"), lua_tostring(naevL,-1));
200 { .type = HOOK_PARAM_SPOB,
202 { .type = HOOK_PARAM_SENTINEL } };
216 lua_rawgeti(naevL, LUA_REGISTRYINDEX, spob->
lua_comm);
217 if (nlua_pcall( spob->
lua_env, 0, 1 )) {
218 WARN(_(
"Spob '%s' failed to run '%s':\n%s"), spob->
name,
"comm", lua_tostring(naevL,-1));
222 int commed = lua_toboolean(naevL,-1);
257 nlua_getenv(naevL, p->ai->env,
"mem");
260 lua_getfield(naevL, -1, str );
261 if (!lua_isstring(naevL, -1))
264 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_messageRaw(const char *str)
Adds a mesg to the queue to be displayed on screen.
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.
Header file with generic functions and naev-specifics.
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_getColourChar 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,...