[Add] Few additions to lua mission wrappers ready for a new type of mission.
This commit is contained in:
parent
f81016feed
commit
1bec93918e
@ -18,7 +18,7 @@
|
|||||||
</avail>
|
</avail>
|
||||||
</mission>
|
</mission>
|
||||||
<mission name = "Empire Recruitment">
|
<mission name = "Empire Recruitment">
|
||||||
<lua>empire00</lua>
|
<lua>emp_empire00</lua>
|
||||||
<flags>
|
<flags>
|
||||||
<unique>1</unique>
|
<unique>1</unique>
|
||||||
</flags>
|
</flags>
|
||||||
|
@ -22,7 +22,7 @@ else -- Default English.
|
|||||||
finish_msg = "The workers unload the %s at the docks."
|
finish_msg = "The workers unload the %s at the docks."
|
||||||
miss_title = "Cargo missing"
|
miss_title = "Cargo missing"
|
||||||
miss_msg = "You are missing the %d tons of %s!"
|
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
|
end
|
||||||
|
|
||||||
-- Create the mission.
|
-- Create the mission.
|
||||||
|
@ -17,7 +17,7 @@ else -- Default English.
|
|||||||
finish_msg = "The Empire workers unload the %s at the docks."
|
finish_msg = "The Empire workers unload the %s at the docks."
|
||||||
miss_title = "Cargo Missing"
|
miss_title = "Cargo Missing"
|
||||||
miss_msg = "You are missing the %d tons of %s!"
|
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
|
end
|
||||||
|
|
||||||
-- Empire shipping missions are always timed, but quite lax on the schedules.
|
-- Empire shipping missions are always timed, but quite lax on the schedules.
|
||||||
|
@ -1011,6 +1011,7 @@ void takeoff(void) {
|
|||||||
landed = 0;
|
landed = 0;
|
||||||
land_visited = 0;
|
land_visited = 0;
|
||||||
hooks_run("takeoff");
|
hooks_run("takeoff");
|
||||||
|
hooks_run("enter");
|
||||||
|
|
||||||
// Cleanup mission computer.
|
// Cleanup mission computer.
|
||||||
for(i = 0; i < mission_ncomputer; i++)
|
for(i = 0; i < mission_ncomputer; i++)
|
||||||
|
@ -91,11 +91,13 @@ static const luaL_reg var_methods[] = {
|
|||||||
static int space_getPlanet(lua_State* L);
|
static int space_getPlanet(lua_State* L);
|
||||||
static int space_getSystem(lua_State* L);
|
static int space_getSystem(lua_State* L);
|
||||||
static int space_landName(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 int space_jumpDist(lua_State* L);
|
||||||
static const luaL_reg space_methods[] = {
|
static const luaL_reg space_methods[] = {
|
||||||
{ "getPlanet", space_getPlanet },
|
{ "getPlanet", space_getPlanet },
|
||||||
{ "getSystem", space_getSystem },
|
{ "getSystem", space_getSystem },
|
||||||
{ "landName", space_landName },
|
{ "landName", space_landName },
|
||||||
|
{ "system", space_systemName },
|
||||||
{ "jumpDist", space_jumpDist },
|
{ "jumpDist", space_jumpDist },
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
@ -112,12 +114,16 @@ static const luaL_reg time_methods[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Player.
|
// 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_freeSpace(lua_State* L);
|
||||||
static int player_addCargo(lua_State* L);
|
static int player_addCargo(lua_State* L);
|
||||||
static int player_rmCargo(lua_State* L);
|
static int player_rmCargo(lua_State* L);
|
||||||
static int player_pay(lua_State* L);
|
static int player_pay(lua_State* L);
|
||||||
static int player_msg(lua_State* L);
|
static int player_msg(lua_State* L);
|
||||||
static const luaL_reg player_methods[] = {
|
static const luaL_reg player_methods[] = {
|
||||||
|
{ "name", player_getname },
|
||||||
|
{ "ship", player_shipname },
|
||||||
{ "freeCargo", player_freeSpace },
|
{ "freeCargo", player_freeSpace },
|
||||||
{ "addCargo", player_addCargo },
|
{ "addCargo", player_addCargo },
|
||||||
{ "rmCargo", player_rmCargo },
|
{ "rmCargo", player_rmCargo },
|
||||||
@ -148,11 +154,13 @@ static const luaL_reg tk_methods[] = {
|
|||||||
static int hook_land(lua_State* L);
|
static int hook_land(lua_State* L);
|
||||||
static int hook_takeoff(lua_State* L);
|
static int hook_takeoff(lua_State* L);
|
||||||
static int hook_time(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 int hook_pilotDeath(lua_State* L);
|
||||||
static const luaL_reg hook_methods[] = {
|
static const luaL_reg hook_methods[] = {
|
||||||
{ "land", hook_land },
|
{ "land", hook_land },
|
||||||
{ "takeoff", hook_takeoff },
|
{ "takeoff", hook_takeoff },
|
||||||
{ "time", hook_time },
|
{ "time", hook_time },
|
||||||
|
{ "enter", hook_enter },
|
||||||
{ "pilotDeath", hook_pilotDeath },
|
{ "pilotDeath", hook_pilotDeath },
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
@ -534,6 +542,11 @@ static int space_landName(lua_State* L) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int space_systemName(lua_State* L) {
|
||||||
|
lua_pushstring(L, cur_system->name);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int space_jumpDist(lua_State* L) {
|
static int space_jumpDist(lua_State* L) {
|
||||||
MIN_ARGS(1);
|
MIN_ARGS(1);
|
||||||
StarSystem** s;
|
StarSystem** s;
|
||||||
@ -585,6 +598,17 @@ static int time_units(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -- Player. --
|
// -- 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) {
|
static int player_freeSpace(lua_State* L) {
|
||||||
lua_pushnumber(L, pilot_freeCargo(player));
|
lua_pushnumber(L, pilot_freeCargo(player));
|
||||||
return 1;
|
return 1;
|
||||||
@ -762,6 +786,11 @@ static int hook_time(lua_State* L) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int hook_enter(lua_State* L) {
|
||||||
|
hook_generic(L, "enter");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int hook_pilotDeath(lua_State* L) {
|
static int hook_pilotDeath(lua_State* L) {
|
||||||
MIN_ARGS(2);
|
MIN_ARGS(2);
|
||||||
int h;
|
int h;
|
||||||
|
@ -1277,6 +1277,7 @@ void player_brokeHyperspace(void) {
|
|||||||
|
|
||||||
// Run the jump hooks.
|
// Run the jump hooks.
|
||||||
hooks_run("jump");
|
hooks_run("jump");
|
||||||
|
hooks_run("enter");
|
||||||
|
|
||||||
player_message("BANG!");
|
player_message("BANG!");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user