Debian Codegraph @

dat/missions/soromid/comingout/srm_comingout5.lua

raw
1 --[[
2 <?xml version='1.0' encoding='utf8'?>
3 <mission name="Garbage Person">
4 <flags>
5 <unique />
6 </flags>
7 <avail>
8 <priority>2</priority>
9 <done>Visiting Family</done>
10 <chance>30</chance>
11 <location>Bar</location>
12 <faction>Soromid</faction>
13 </avail>
14 <notes>
15 <campaign>Coming Out</campaign>
16 </notes>
17 </mission>
18 --]]
19 --[[
20
21 Waste Collector
22
23 This program is free software: you can redistribute it and/or modify
24 it under the terms of the GNU General Public License as published by
25 the Free Software Foundation, either version 3 of the License, or
26 (at your option) any later version.
27
28 This program is distributed in the hope that it will be useful,
29 but WITHOUT ANY WARRANTY; without even the implied warranty of
30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 GNU General Public License for more details.
32
33 You should have received a copy of the GNU General Public License
34 along with this program. If not, see <http://www.gnu.org/licenses/>.
35
36 --]]
37
38 require "numstring.lua"
39 require "missions/soromid/comingout/srm_comingout3.lua"
40 require "missions/soromid/common.lua"
41
42
43 title = {}
44 text = {}
45
46 title[1] = _("The Dirty Job")
47 text[1] = _([[You walk over to Chelsea to greet them when you notice an unpleasant odor coming off of them. Chelsea notices you. "Ah! %s! Uh, sorry about the smell. I don't know why the hell I did this, but I took a job from some guy here and now I'm stuck with it." You ask what kind of job it is. "Erm, I kind of agreed to take their trash from them." You grimace. "Yeah," Chelsea says, "it's gross. And what's worse, I'm in over my head. I've already taken the garbage and my new ship is packed to the brim with the stuff, but there's thugs outside that seem to be waiting for me." A look of rage appears on their face as they turn to the side. "You can probably guess who's responsible for that." The thought had crossed your mind as well.
48 Chelsea turns back to you. "I know I ask a lot of you, but could you help me once again? I just need an escort to %s so I can drop off this garbage there. I'll give you %s for the trouble. What do you say?"]])
49
50 text[2] = _([["I appreciate it very much. I'll wait at the hangar until you're ready to take off. Get ready for a fight when we get out of the atmosphere; it's going to be a bumpy ride."]])
51
52 text[3] = _([["OK, I understand. I guess I'll have to find some other way to get rid of all this garbage..."]])
53
54 text[4] = _([["I'm not having any luck coming up with a plan to get rid of all of this garbage without getting jumped by those thugs. Is there any chance you could reconsider being my escort? It would be a big help."]])
55
56 title[6] = _("The Unbearable Smell Now Ends")
57 text[6] = _([[As you dock, you can't help but notice the foul smell of garbage all around you. The planet really does fit the name. You grimace as you watch workers unload what must be hundreds of tonnes of garbage from Chelsea's ship, some of which is leaking. Eventually Chelsea's ship is emptied and you and Chelsea are handed your credit chips for the job. You and Chelsea part ways, vowing to take a shower immediately while Chelsea vows to scrub the cargo hold of their ship clean.]])
58
59 misn_title = _("Waste Collector")
60 misn_desc = _("Chelsea needs an escort to %s so they can get rid of the garbage now filling their ship.")
61
62 npc_name = _("Chelsea")
63 npc_desc = _("Chelsea seems like they're stressed. Maybe you should see how they're doing?")
64
65 log_text = _([[You helped Chelsea get rid of a load of garbage they naively agreed to take to The Stinker as a mission, defending them from thugs along the way.]])
66
67
68 function create ()
69 misplanet, missys = planet.get( "The Stinker" )
70 if misplanet == nil or missys == nil or system.cur():jumpDist(missys) > 4 then
71 misn.finish( false )
72 end
73
74 credits = 500000
75 started = false
76
77 misn.setNPC( npc_name, "soromid/unique/chelsea" )
78 misn.setDesc( npc_desc )
79 end
80
81
82 function accept ()
83 local txt
84 if started then
85 txt = text[4]
86 else
87 txt = text[1]:format( player.name(), misplanet:name(), creditstring( credits ) )
88 end
89 started = true
90
91 if tk.yesno( title[1], txt ) then
92 tk.msg( title[1], text[2] )
93
94 misn.accept()
95
96 misn.setTitle( misn_title )
97 misn.setDesc( misn_desc:format( misplanet:name() ) )
98 misn.setReward( creditstring( credits ) )
99 marker = misn.markerAdd( missys, "low" )
100
101 osd_desc[1] = osd_desc[1]:format( misplanet:name(), missys:name() )
102 misn.osdCreate( misn_title, osd_desc )
103
104 startplanet = planet.cur()
105
106 hook.takeoff( "takeoff" )
107 hook.jumpout( "jumpout" )
108 hook.jumpin( "jumpin" )
109 hook.land( "land" )
110 else
111 tk.msg( title[1], text[3] )
112 misn.finish()
113 end
114 end
115
116
117 function spawnChelseaShip( param )
118 chelsea = pilot.addRaw( "Rhino", "mercenary", param, "Comingout_associates" )
119 chelsea:rmOutfit( "all" )
120 chelsea:rmOutfit( "cores" )
121 chelsea:addOutfit( "Unicorp PT-600 Core System" )
122 chelsea:addOutfit( "Melendez Buffalo XL Engine" )
123 chelsea:addOutfit( "S&K Medium Cargo Hull" )
124 chelsea:addOutfit( "Heavy Ripper Turret", 2 )
125 chelsea:addOutfit( "Enygma Systems Turreted Fury Launcher", 2 )
126 chelsea:addOutfit( "Fury Missile", 80 )
127 chelsea:addOutfit( "Droid Repair Crew" )
128 chelsea:addOutfit( "Milspec Scrambler" )
129 chelsea:addOutfit( "Boarding Androids MK1" )
130 chelsea:addOutfit( "Cargo Pod", 4 )
131
132 chelsea:setHealth( 100, 100 )
133 chelsea:setEnergy( 100 )
134 chelsea:setTemp( 0 )
135 chelsea:setFuel( true )
136
137 chelsea:cargoAdd( "Waste Containers", chelsea:cargoFree() )
138
139 chelsea:setFriendly()
140 chelsea:setHilight()
141 chelsea:setVisible()
142 chelsea:setInvincPlayer()
143 chelsea:rename( "Chelsea" )
144
145 hook.pilot( chelsea, "death", "chelsea_death" )
146 hook.pilot( chelsea, "jump", "chelsea_jump" )
147 hook.pilot( chelsea, "land", "chelsea_land" )
148 hook.pilot( chelsea, "attacked", "chelsea_attacked" )
149
150 chelsea_jumped = false
151 end
152
153
154 function spawnThug( param )
155 local shiptypes = { "Hyena", "Hyena", "Shark", "Lancelot", "Admonisher" }
156 local shiptype = shiptypes[ rnd.rnd( 1, #shiptypes ) ]
157 thug = pilot.addRaw( shiptype, "baddie", param, "Comingout_thugs" )
158
159 thug:setHostile()
160 thug:rename( "Thug " .. shiptype )
161
162 hook.pilot( thug, "death", "thug_removed" )
163 hook.pilot( thug, "jump", "thug_removed" )
164 hook.pilot( thug, "land", "thug_removed" )
165 end
166
167
168 function takeoff ()
169 spawnChelseaShip( startplanet )
170 jumpNext()
171 spawnThug()
172 spawnThug()
173 end
174
175
176 function land ()
177 if planet.cur() == misplanet then
178 tk.msg( title[6], text[6]:format( numstring( credits ) ) )
179 player.pay( credits )
180
181 local t = time.get():tonumber()
182 var.push( "comingout_time", t )
183
184 srm_addComingOutLog( log_text )
185
186 misn.finish( true )
187 else
188 tk.msg( title[5], text[5] )
189 misn.finish( false )
190 end
191 end
192
193
194 function thug_timer ()
195 spawnThug()
196 spawnThug()
197 if system.cur() == missys then
198 spawnThug( lastsys )
199 end
200 end