[Add] pilot.clear() and pilot.togglespawn() to Lua API.
This commit is contained in:
parent
c5cab45910
commit
2f0d0384c1
@ -149,9 +149,14 @@ static const luaL_reg hook_methods[] = {
|
|||||||
/* Pilots. */
|
/* Pilots. */
|
||||||
static int pilot_addFleet(lua_State* L);
|
static int pilot_addFleet(lua_State* L);
|
||||||
static int pilot_rename(lua_State* L);
|
static int pilot_rename(lua_State* L);
|
||||||
|
static int pilot_clear(lua_State* L);
|
||||||
|
static int pilot_toggleSpawn(lua_State* L);
|
||||||
static const luaL_reg pilot_methods[] = {
|
static const luaL_reg pilot_methods[] = {
|
||||||
{ "add", pilot_addFleet },
|
{ "add", pilot_addFleet },
|
||||||
{ "rename", pilot_rename },
|
{ "rename", pilot_rename },
|
||||||
|
{ "clear", pilot_clear },
|
||||||
|
{ "togglespawn", pilot_toggleSpawn },
|
||||||
|
{ "clear", pilot_toggleSpawn },
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -895,3 +900,37 @@ static int pilot_rename(lua_State* L) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn static int pilot_clear(lua_State* L)
|
||||||
|
*
|
||||||
|
* @brief clear(nil)
|
||||||
|
*
|
||||||
|
* Clears the current system of pilots. Used for epic battles etc.
|
||||||
|
*/
|
||||||
|
static int pilot_clear(lua_State* L) {
|
||||||
|
(void) L;
|
||||||
|
pilots_clean();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @fn static int pilot_toggleSpawn(lua_State* L)
|
||||||
|
*
|
||||||
|
* @brief bool togglespawn( [bool enable] )
|
||||||
|
*
|
||||||
|
* Disable or enable pilot spawning in the current system. If player jumps
|
||||||
|
* the spawn is enabled again automagically.
|
||||||
|
* @param enable true Enables spawn, false disables it.
|
||||||
|
* @return The current spawn state.
|
||||||
|
*/
|
||||||
|
static int pilot_toggleSpawn(lua_State* L) {
|
||||||
|
if((lua_gettop(L) > 0) && lua_isboolean(L, 1))
|
||||||
|
space_spawn = lua_toboolean(L, 1);
|
||||||
|
/* Toggling. */
|
||||||
|
else
|
||||||
|
space_spawn = !space_spawn;
|
||||||
|
|
||||||
|
lua_pushboolean(L, space_spawn);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user