/* * Method: AIKamikaze * * Crash into the target ship. * * > ship:AIKamikaze(target) * * Parameters: * * target - the <Ship> to destroy * * Availability: * * alpha 26 * * Status: * * experimental */ static int l_ship_ai_kamikaze(lua_State *l) { Ship *s = LuaObject<Ship>::GetFromLua(1); if (s->GetFlightState() == Ship::HYPERSPACE) return luaL_error(l, "Ship:AIKamikaze() cannot be called on a ship in hyperspace"); Ship *target = LuaObject<Ship>::GetFromLua(2); s->AIKamikaze(target); return 0; }
/* * Method: AIKamikaze * * Crash into the target ship. * * > ship:AIKamikaze(target) * * Parameters: * * target - the <Ship> to destroy * * Returns: * true if the command could be enacted, false otherwise * * Availability: * * alpha 26 * * Status: * * experimental */ static int l_ship_ai_kamikaze(lua_State *l) { Ship *s = LuaObject<Ship>::GetFromLua(1); if (s->GetFlightState() == Ship::HYPERSPACE) return luaL_error(l, "Ship:AIKamikaze() cannot be called on a ship in hyperspace"); Ship *target = LuaObject<Ship>::GetFromLua(2); if (target != nullptr) { s->AIKamikaze(target); lua_pushboolean(l, true); } else { lua_pushboolean(l, false); } return 1; }