[Add] New mission - Help out some scientists deploy a probe.

This commit is contained in:
Allanis 2014-05-18 16:22:25 +01:00
parent d0d02502ea
commit cbe4680de8
4 changed files with 160 additions and 11 deletions

View File

@ -24,4 +24,6 @@
<commodity name="Colonists" />
<commodity name="Tourists" />
<commodity name="Pilgrims" />
<commodity name="Datapad" />
<commodity name="Satellite" />
</Commodities>

View File

@ -132,4 +132,19 @@
<planet>Omega Station</planet>
</avail>
</mission>
<mission name = "Nebulae Satellite">
<lua>nebu_satellite</lua>
<flags>
<unique>1</unique>
</flags>
<avail>
<chance>15</chance>
<location>Bar</location>
<faction>Independent</faction>
<faction>Empire</faction>
<faction>Soromid</faction>
<faction>Draktharr</faction>
<faction>Frontier</faction>
</avail>
</mission>
</Missions>

View File

@ -0,0 +1,120 @@
--[[
-- Nebulae Satellite.
--
-- One-shot mission.
--
-- Help some independent scientists put a satellite in the nebulae.
--]]
-- Localization stuff, translators would work here.
lang = lephisto.lang()
if lang == "es" then
else -- Default to English.
mtitle = {}
mtitle[1] = "Nebulae Satellite"
mreward = {}
mreward[1] = "%d credits"
mdesc = {}
mdesc[1] = "Go to the %s system to launch the probe."
mdesc[2] = "Drop off the scientists at %s in the %s system."
title = {}
title[1] = "Bar"
title[2] = "Scientific Exploration"
title[3] = "Mission Success"
text = {}
text[1] = [[You are sitting at the bar when you are approached by a couple of short guys. They seem a bit nervous and one mutters something about whether it's a good idea or not. Eventually one of them comes up to you.
"Hello Captain, We're looking for a ship to take us into the Sol Nebulae. Would you be willing to take us there?]]
text[2] = [["We had a trip scheduled with some Space Trader ship, but they backed out at the last minute. So we were stuck here until you came. We've got a probe satellite that we have to release in the %s system to monitor the nebulae's growth rate. The probe launch procedure is pretty straightforward and shouldn't have any complications."
He takes a deep breath, "We hope to be able to find out more secrets of the Sol Nebulae so man can once again regain it's lost patrimony. So far the radiation and volatility of the deeper area haven't been very kind to our instruments. That's why we designed this Satellite we're going to launch."]]
text[3] = [["The plan is for you to take us to %s so we can launch the probe, then back to our home at %s in the %s system. The probe will automatically send us the data we need if all goes well. You'll be paid %d credits when we arrive."]]
text[4] = [[The scientists thank you for your help before going back to their home to continue their nebulae research.]]
text[9] = [["You do ot have enough free cargo space to accept this mission!"]]
launch = {}
launch[1] = "Preparing to launch the satellite probe..."
launch[2] = "Launch in 5..."
launch[3] = "Satellite launch successful!"
end
function create()
if tk.yesno(title[1], text[1]) then
-- Check for cargo space.
if player.freeCargo() < 3 then
tk.msg(title[1], text[9])
return
end
misn.accept()
-- Set up mission variables.
misn_stage = 0
homeworld, homeworld_sys = space.getPlanet(misn.factions())
satellite_sys = space.getSystem("Arandon") -- Not too unstable.
credits = 75000
cargo = player.addCargo("Satellite", 3)
-- Set up mission information.
misn.setTitle(mtitle[1])
misn.setReward(string.format(mreward[1], credits))
misn.setDesc(string.format(mdesc[1], satellite_sys:name()))
misn.setMarker(satellite_sys)
-- More flavour text.
tk.msg(title[2], string.format(text[2], satellite_sys:name()))
tk.msg(title[2], string.format(text[3], satellite_sys:name(),
homeworld:name(), homeworld_sys:name(), credits))
-- Set up hooks.
hook.land("land")
hook.enter("jump")
end
end
function land()
landed = space.getPlanet()
-- Mission success.
if misn_stage == 1 and landed == homeworld then
tk.msg(title[3], text[4])
player.pay(credits)
misn.finish(true)
end
end
function jump()
sys = space.getSystem()
-- Launch satellite.
if misn_stage == 0 and sys == satellite_sys then
misn.timerStart("beginLaunch", 3000)
end
end
--[[
-- Launch process.
--]]
function beginLaunch()
player.msg(launch[1])
misn.timerStart("beginCountdown", 3000)
end
function beginCountdown()
countdown = 5
player.msg(launch[2])
misn.timerStart("countLaunch", 1000)
end
function countLaunch()
countdown = countdown - 1
if countdown <= 0 then
launchSatellite()
else
player.msg(string.format("%d..." countdown))
misn.timerStart("countLaunch", 1000)
end
end
function launchSatellite()
misn_stage = 1
player.msg(launch[3])
player.jetCargo(cargo)
misn.setDesc(string.format(mdesc[2], homeworld:name(), homeworld_sys:name()))
misn.setMarker(homeworld_sys)
end

View File

@ -219,10 +219,10 @@ static Msg* msg_stack; /**< Stack of messages, will be of mesg_max size. */
/* External. */
extern void pilot_render(const Pilot* pilot); /* Extern is in Pilot.* */
extern void weapon_minimap(const double res,
const double w, const double h, const RadarShape shape); /* weapon.c */
extern void planets_minimap(const double res,
const double w, const double h, const RadarShape shape); /* space.c */
extern void weapon_minimap(const double res, const double w, const double h,
const RadarShape shape, double alpha); /* weapon.c */
extern void planets_minimap(const double res, const double w, const double h,
const RadarShape shape, double alpha); /* space.c */
/* Internal. */
/* Creation. */
@ -924,10 +924,12 @@ void player_renderGUI(double dt) {
gui.radar.y - SCREEN_H/2., 0.);
/* Planets. */
planets_minimap(gui.radar.res, gui.radar.w, gui.radar.h, gui.radar.shape);
planets_minimap(gui.radar.res, gui.radar.w, gui.radar.h,
gui.radar.shape, 1.-interference_alpha);
/* Weapons. */
weapon_minimap(gui.radar.res, gui.radar.w, gui.radar.h, gui.radar.shape);
weapon_minimap(gui.radar.res, gui.radar.w, gui.radar.h,
gui.radar.shape, 1.-interference_alpha);
/* Render the pilot_nstack. */
j = 0;
@ -940,6 +942,19 @@ void player_renderGUI(double dt) {
/* Render the targetted pilot. */
if(j != 0) gui_renderPilot(pilot_stack[j]);
glPopMatrix();
/* Interference. */
gui_renderInterference(dt);
glPushMatrix();
if(gui.radar.shape == RADAR_RECT)
glTranslated(gui.radar.x - SCREEN_W/2. + gui.radar.w/2.,
gui.radar.y - SCREEN_H/2. - gui.radar.h/2., 0.);
else if(gui.radar.shape == RADAR_CIRCLE)
glTranslated(gui.radar.x - SCREEN_W/2.,
gui.radar.y - SCREEN_H/2., 0.);
/* The + sign in the middle of the radar represents the player. */
glBegin(GL_LINES);
COLOUR(cRadar_player);
@ -951,9 +966,6 @@ void player_renderGUI(double dt) {
glPopMatrix(); /* GL_PROJECTION. */
/* Interference. */
gui_renderInterference(dt);
/* Nav. */
if(planet_target >= 0) {
/* Planet landing target. */
@ -1264,7 +1276,7 @@ static void gui_renderPilot(const Pilot* p) {
else if(pilot_isFlag(p, PILOT_BRIBED)) col = &cNeutral;
else if(pilot_isFlag(p, PILOT_HOSTILE)) col = &cHostile;
else col = faction_getColour(p->faction);
COLOUR(*col);
ACOLOUR(*col, 1-interference_alpha); /**< Makes it much harder to see. */
/* Image. */
glVertex2d(MAX(x-sx, -w), MIN(y+sy, h)); /* Top left. */