Debian Codegraph @

dat/missions/zalek/neburesearch/neburesearch_02.lua

raw
1 --[[
2 <?xml version='1.0' encoding='utf8'?>
3 <mission name="Emergency of Immediate Inspiration">
4 <flags>
5 <unique />
6 </flags>
7 <avail>
8 <priority>4</priority>
9 <done>Advanced Nebula Research</done>
10 <chance>30</chance>
11 <location>Bar</location>
12 <faction>Empire</faction>
13 <cond>system.get("Gamma Polaris"):jumpDist() &lt; 3 and planet.cur():class() ~= "1" and planet.cur():class() ~= "2" and planet.cur():class() ~= "3"</cond>
14 </avail>
15 </mission>
16 --]]
17 --[[
18
19 Mission: Emergency of Immediate Inspiration
20
21 Description: Take Dr. Mensing to Jorla as fast as possible!
22
23 Difficulty: Easy
24
25 --]]
26
27 require "scripts/cargo_common.lua"
28 require "scripts/numstring.lua"
29 require "missions/zalek/common.lua"
30
31
32 bar_desc = _("It appears she wants to talk with you.")
33 mtitle = _("Emergency of Immediate Inspiration")
34 misn_reward = _("%s")
35 mdesc = _("Take Dr. Mensing to %s in the %s system as fast as possible!")
36 bar_title = _("Bar")
37 landing_title = _("Mission accomplished")
38 bar_text = _([["Well met, %s! In fact, it's a lucky coincidence that we meet. You see, I'm in dire need of your service. I'm here on a... conference of sorts, not a real one. We are obligated to present the newest results of our research to scientists of the Empire once per period - even though these jokers lack the skills to understand our works! It's just a pointless ritual anyway. But I just got an ingenious idea on how to prevent the volatile Sol nebula from disrupting ship shields! I will spare you with the details - to ensure my idea is not going to be stolen, nothing personal. You can never be sure who is listening."
39 "Anyway, you have to take me back to my lab on %s in the %s system immediately! I'd also pay %s if necessary."]])
40 accept_text = _([["Splendid! I'd like to start with my work as soon as possible, so please hurry! Off to %s we go!"
41 With that being said she drags you out of the bar. When realizing that she actually does not know on which landing pad your ship is parked she lets you loose and orders you to lead the way.]])
42 arrival_text = _([["Finally! I can't await getting started. Before I forget -" She hands you over a credit chip worth %s.
43 %s]])
44 late_arrival_text = _([["That took long enough! I can't await getting started. I doubt you deserve full payment. I'll rather give you a reduced payment of %s for educational reasons." She hands you over a credit chip.
45 %s]])
46 request_text = _([["There's actually another thing I've almost forgotten. I also have to attend another conference very soon on behalf of professor Voges who obviously is very busy with some project he would not tell me about. But I don't want to go there - my research is far too important! So could you instead bring Robert there? You remember the student you helped out recently? I'm sure he will do the presentation just fine! I'll tell him to meet you in the bar as soon as possible!"
47 With that being said Dr. Mensing leaves you immediately without waiting for your answer. It appears you should head to the bar to meet up with the student.]])
48
49 -- Mission info stuff
50 osd_msg = {}
51 osd_title = _("Emergency of Immediate Inspiration")
52 osd_msg[1] = _("Fly to %s in the %s system.")
53
54 log_text = _([[You brought Dr. Mensing back from a Empire scientific conference.]])
55
56
57 function create()
58 -- mission variables
59 credits = 400000 -- 400K
60 homeworld, homeworld_sys = planet.get("Jorla")
61 origin = planet.cur()
62 origin_sys = system.cur()
63
64 local numjumps = origin_sys:jumpDist(homeworld_sys, false)
65 local traveldist = cargo_calculateDistance(origin_sys, origin:pos(), homeworld_sys, homeworld)
66 local stuperpx = 0.15
67 local stuperjump = 10000
68 local stupertakeoff = 10000
69 local allowance = traveldist * stuperpx + numjumps * stuperjump + stupertakeoff + 240 * numjumps
70 timelimit = time.get() + time.create(0, 0, allowance)
71
72 -- Spaceport bar stuff
73 misn.setNPC(_("Dr. Mensing"), "zalek/unique/mensing")
74 misn.setDesc(bar_desc)
75 end
76
77 function accept()
78 if not tk.yesno(bar_title, bar_text:format(player:name(), homeworld:name(), homeworld_sys:name(), creditstring(credits))) then
79 misn.finish()
80 end
81 tk.msg(bar_title, accept_text:format(homeworld:name()))
82
83 -- Set up mission information
84 misn.setTitle(mtitle)
85 misn.setReward(misn_reward:format(creditstring(credits)))
86 misn.setDesc(mdesc:format(homeworld:name(), homeworld_sys:name()))
87 misn_marker = misn.markerAdd(homeworld_sys, "low")
88
89 misn.accept()
90 osd_msg[1] = osd_msg[1]:format(homeworld:name(), homeworld_sys:name())
91 misn.osdCreate(osd_title, osd_msg)
92
93 hook.land("land")
94 end
95
96 function land()
97 landed = planet.cur()
98 if landed == homeworld then
99 if timelimit < time.get() then
100 tk.msg(landing_title, late_arrival_text:format(creditstring(credits / 2), request_text))
101 player.pay(credits / 2)
102 else
103 tk.msg(landing_title, arrival_text:format(creditstring(credits), request_text))
104 player.pay(credits)
105 end
106 misn.markerRm(misn_marker)
107 zlk_addNebuResearchLog(log_text)
108 misn.finish(true)
109 end
110 end
111