[Add] Few additions to lua mission wrappers ready for a new type of mission.

This commit is contained in:
Allanis 2013-05-06 23:18:36 +01:00
parent f81016feed
commit 1bec93918e
7 changed files with 38 additions and 7 deletions

View File

@ -18,7 +18,7 @@
</avail>
</mission>
<mission name = "Empire Recruitment">
<lua>empire00</lua>
<lua>emp_empire00</lua>
<flags>
<unique>1</unique>
</flags>

View File

@ -22,7 +22,7 @@ else -- Default English.
finish_msg = "The workers unload the %s at the docks."
miss_title = "Cargo missing"
miss_msg = "You are missing the %d tons of %s!"
misn_time_msg = "You have failed to deliver the goods on time!"
misn_time_msg = "MISSION FAILED: You have failed to deliver the goods on time!"
end
-- Create the mission.

View File

@ -17,7 +17,7 @@ else -- Default English.
finish_msg = "The Empire workers unload the %s at the docks."
miss_title = "Cargo Missing"
miss_msg = "You are missing the %d tons of %s!"
miss_timeup = "You have failed to deliver the goods to the empire on time!"
miss_timeup = "MISSION FAILED: You have failed to deliver the goods to the empire on time!"
end
-- Empire shipping missions are always timed, but quite lax on the schedules.

View File

@ -1011,6 +1011,7 @@ void takeoff(void) {
landed = 0;
land_visited = 0;
hooks_run("takeoff");
hooks_run("enter");
// Cleanup mission computer.
for(i = 0; i < mission_ncomputer; i++)

View File

@ -91,11 +91,13 @@ static const luaL_reg var_methods[] = {
static int space_getPlanet(lua_State* L);
static int space_getSystem(lua_State* L);
static int space_landName(lua_State* L);
static int space_systemName(lua_State* L);
static int space_jumpDist(lua_State* L);
static const luaL_reg space_methods[] = {
{ "getPlanet", space_getPlanet },
{ "getSystem", space_getSystem },
{ "landName", space_landName },
{ "system", space_systemName },
{ "jumpDist", space_jumpDist },
{ 0, 0 }
};
@ -112,12 +114,16 @@ static const luaL_reg time_methods[] = {
};
// Player.
static int player_getname(lua_State* L);
static int player_shipname(lua_State* L);
static int player_freeSpace(lua_State* L);
static int player_addCargo(lua_State* L);
static int player_rmCargo(lua_State* L);
static int player_pay(lua_State* L);
static int player_msg(lua_State* L);
static const luaL_reg player_methods[] = {
{ "name", player_getname },
{ "ship", player_shipname },
{ "freeCargo", player_freeSpace },
{ "addCargo", player_addCargo },
{ "rmCargo", player_rmCargo },
@ -148,11 +154,13 @@ static const luaL_reg tk_methods[] = {
static int hook_land(lua_State* L);
static int hook_takeoff(lua_State* L);
static int hook_time(lua_State* L);
static int hook_enter(lua_State* L);
static int hook_pilotDeath(lua_State* L);
static const luaL_reg hook_methods[] = {
{ "land", hook_land },
{ "takeoff", hook_takeoff },
{ "time", hook_time },
{ "enter", hook_enter },
{ "pilotDeath", hook_pilotDeath },
{ 0, 0 }
};
@ -534,6 +542,11 @@ static int space_landName(lua_State* L) {
return 0;
}
static int space_systemName(lua_State* L) {
lua_pushstring(L, cur_system->name);
return 1;
}
static int space_jumpDist(lua_State* L) {
MIN_ARGS(1);
StarSystem** s;
@ -585,6 +598,17 @@ static int time_units(lua_State* L) {
}
// -- Player. --
static int player_getname(lua_State* L) {
lua_pushstring(L, player_name);
return 1;
}
static int player_shipname(lua_State* L) {
lua_pushstring(L, player->name);
return 1;
}
static int player_freeSpace(lua_State* L) {
lua_pushnumber(L, pilot_freeCargo(player));
return 1;
@ -762,6 +786,11 @@ static int hook_time(lua_State* L) {
return 0;
}
static int hook_enter(lua_State* L) {
hook_generic(L, "enter");
return 0;
}
static int hook_pilotDeath(lua_State* L) {
MIN_ARGS(2);
int h;

View File

@ -1277,6 +1277,7 @@ void player_brokeHyperspace(void) {
// Run the jump hooks.
hooks_run("jump");
hooks_run("enter");
player_message("BANG!");
}