[Add] Mark enemies as hostile in patrol missions.
This commit is contained in:
parent
57dc9832fa
commit
a867e1184e
@ -114,6 +114,7 @@ function setNextGoal()
|
||||
|
||||
-- Set hooks.
|
||||
for k,v in ipairs(enemies) do
|
||||
v:setHostile() -- Should be hostile to player.
|
||||
hook.pilot(v, "disable", "death")
|
||||
hook.pilot(v, "jump", "death")
|
||||
end
|
||||
|
@ -47,6 +47,7 @@ static int pilotL_velocity(lua_State* L);
|
||||
static int pilotL_warp(lua_State* L);
|
||||
static int pilotL_broadcast(lua_State* L);
|
||||
static int pilotL_setFaction(lua_State* L);
|
||||
static int pilotL_setHostile(lua_State* L);
|
||||
static const luaL_reg pilotL_methods[] = {
|
||||
{ "__eq", pilotL_eq },
|
||||
{ "name", pilotL_name },
|
||||
@ -57,6 +58,7 @@ static const luaL_reg pilotL_methods[] = {
|
||||
{ "warp", pilotL_warp },
|
||||
{ "broadcast", pilotL_broadcast },
|
||||
{ "setFaction", pilotL_setFaction },
|
||||
{ "setHostile", pilotL_setHosile },
|
||||
{ 0, 0 }
|
||||
}; /**< Pilot metatable methods. */
|
||||
|
||||
@ -634,3 +636,24 @@ static int pilotL_setFaction(lua_State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup META_PILOT
|
||||
*
|
||||
* @brief Set the pilot as hostile to player.
|
||||
* @luafunc setHostile()
|
||||
*/
|
||||
static int pilotL_setHostile() {
|
||||
LuaPilot* lp;
|
||||
Pilot* p;
|
||||
|
||||
/* Get the pilot. */
|
||||
lp = lua_topilot(L, 1);
|
||||
p = pilot_get(lp->pilot);
|
||||
if(p == NULL) return 0;
|
||||
|
||||
/* Set as hostile. */
|
||||
pilot_setHostile(p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user