[Add] Added pilot_rmHostile.
This commit is contained in:
parent
e933ce3b8d
commit
26e966c1dd
@ -30,9 +30,9 @@
|
||||
<cap_cargo>600000</cap_cargo>
|
||||
</characteristics>
|
||||
<outfits>
|
||||
<outfit quantity="2">Ripper MK2</outfit>
|
||||
<outfit quantity="1">Lancelot Fighter Bay</outfit>
|
||||
<outfit quantity="100">Lancelot Fighter</outfit>
|
||||
<outfit quantity="20">Lancelot Fighter</outfit>
|
||||
<outfit quantity="4">Ripper MK2</outfit>
|
||||
<outfit quantity="1">Banshee Launcher</outfit>
|
||||
<outfit quantity="50">Banshee Rocket</outfit>
|
||||
<outfit quantity="1">Headhunter Launcher</outfit>
|
||||
|
@ -166,6 +166,7 @@ static void comm_bribe(unsigned int wid, char* unused) {
|
||||
|
||||
/* Mark as bribed and don't allow bribing again. */
|
||||
pilot_setFlag(comm_pilot, PILOT_BRIBED);
|
||||
pilot_rmHostile(comm_pilot);
|
||||
L = comm_pilot->ai->L;
|
||||
lua_getglobal(L, "mem");
|
||||
lua_pushnil(L);
|
||||
|
@ -98,7 +98,10 @@ static int music_runLua(char* situation) {
|
||||
if(music_disabled) return 0;
|
||||
/* Run the choose function in Lua. */
|
||||
lua_getglobal(music_lua, "choose");
|
||||
if(situation != NULL)
|
||||
lua_pushstring(music_lua, situation);
|
||||
else
|
||||
lua_pushnil(music_lua);
|
||||
if(lua_pcall(music_lua, 1, 0, 0)) /* Error has occured. */
|
||||
WARN("Error while choosing music: %s", (char*)lua_tostring(music_lua, -1));
|
||||
|
||||
|
21
src/pilot.c
21
src/pilot.c
@ -228,6 +228,17 @@ void pilot_setHostile(Pilot* p) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Unmark a pilot as neutral to player.
|
||||
* @param p Pilot to mark as neutral.
|
||||
*/
|
||||
void pilot_rmHostile(Pilot* p) {
|
||||
if(pilot_isFlag(p, PILOT_HOSTILE)) {
|
||||
player_enemies--;
|
||||
pilot_rmFlag(p, PILOT_HOSTILE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the amount of jumps the pilot has left. */
|
||||
int pilot_getJumps(const Pilot* p) {
|
||||
return (int)(p->fuel) / HYPERSPACE_FUEL;
|
||||
@ -833,10 +844,7 @@ static void pilot_update(Pilot* pilot, const double dt) {
|
||||
/* First time pilot is disabled. */
|
||||
if(!pilot_isFlag(pilot, PILOT_DISABLED)) {
|
||||
/* If hostile, must remove counter. */
|
||||
if(pilot_isFlag(pilot, PILOT_HOSTILE)) {
|
||||
player_enemies--;
|
||||
pilot_rmFlag(pilot, PILOT_HOSTILE);
|
||||
}
|
||||
pilot_rmHostile(pilot);
|
||||
|
||||
pilot_setFlag(pilot, PILOT_DISABLED); /* Set as disabled. */
|
||||
/* Run hook. */
|
||||
@ -1752,10 +1760,7 @@ void pilot_free(Pilot* p) {
|
||||
hook_rm(p->hook[i]);
|
||||
|
||||
/* If hostile, must remove counter. */
|
||||
if(pilot_isFlag(p, PILOT_HOSTILE)) {
|
||||
player_enemies--;
|
||||
pilot_rmFlag(p, PILOT_HOSTILE);
|
||||
}
|
||||
pilot_rmHostile(p);
|
||||
|
||||
/* Remove outfits. */
|
||||
while(p->outfits != NULL)
|
||||
|
@ -236,6 +236,7 @@ int pilot_getJumps(const Pilot* p);
|
||||
|
||||
/* Misc. */
|
||||
void pilot_setHostile(Pilot* p);
|
||||
void pilot_rmHostile(Pilot* p);
|
||||
void pilot_shoot(Pilot* p, const int secondary);
|
||||
void pilot_shootStop(Pilot* p, const int secondary);
|
||||
void pilot_hit(Pilot* p, const Solid* w, const unsigned int shooter,
|
||||
|
Loading…
Reference in New Issue
Block a user