|
13 | 13 | var/result = 0
|
14 | 14 | var/checkwin_counter = 0
|
15 | 15 | var/xenos_list = list()
|
| 16 | + var/gammacalled = 0 |
16 | 17 |
|
17 | 18 | var/const/waittime_l = 600 //lower bound on time before intercept arrives (in tenths of seconds)
|
18 | 19 | var/const/waittime_h = 1800 //upper bound on time before intercept arrives (in tenths of seconds)
|
19 | 20 |
|
20 | 21 | var/xenoai = 0 //Should the Xenos have their own AI?
|
21 | 22 | var/xenoborg = 0 //Should the Xenos have their own borg?
|
| 23 | + var/gammaratio = 3 //At what alien to human ratio will the Gamma security level be called and the nuke be made available? |
22 | 24 |
|
23 | 25 | /datum/game_mode/xenos/announce()
|
24 | 26 | world << "<B>The current game mode is - Xenos!</B>"
|
|
87 | 89 | O.mind.original = O
|
88 | 90 | else
|
89 | 91 | O.key = xeno_mind.current.key
|
| 92 | + |
90 | 93 | //del(xeno_mind)
|
91 | 94 | var/obj/loc_landmark
|
92 | 95 | for(var/obj/effect/landmark/start/sloc in landmarks_list)
|
|
101 | 104 | O.laws = new /datum/ai_laws/alienmov
|
102 | 105 | O.name = "Alien AI"
|
103 | 106 | O.real_name = name
|
| 107 | + xeno_mind.name = O.name |
104 | 108 | O.alienAI = 1
|
105 | 109 | O.network = list("SS13","Xeno")
|
106 | 110 | O.holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holo3"))
|
|
115 | 119 | xeno_mind.transfer_to(O)
|
116 | 120 | else
|
117 | 121 | O.key = xeno_mind.current.key
|
| 122 | + xeno_mind.name = O.name |
118 | 123 | //del(xeno_mind)
|
119 | 124 | xenoqueen_selected = 1
|
120 | 125 | spawnpos++
|
|
135 | 140 | O.job = "Alien Cyborg"
|
136 | 141 | O.name = "Alien Cyborg"
|
137 | 142 | O.real_name = name
|
| 143 | + xeno_mind.name = O.name |
138 | 144 | O.module = new /obj/item/weapon/robot_module/alien/hunter(src)
|
139 | 145 | O.hands.icon_state = "standard"
|
140 | 146 | O.icon = 'icons/mob/alien.dmi'
|
|
156 | 162 | xeno_mind.transfer_to(O)
|
157 | 163 | else
|
158 | 164 | O.key = xeno_mind.current.key
|
| 165 | + xeno_mind.name = O.name |
159 | 166 | //del(xeno_mind)
|
160 | 167 | spawnpos++
|
161 | 168 |
|
|
171 | 178 | ticker.mode.check_win()
|
172 | 179 | checkwin_counter = 0
|
173 | 180 | return 0
|
| 181 | + |
174 | 182 |
|
175 | 183 | /datum/game_mode/xenos/check_win()
|
176 | 184 | var/xenosalive = xenos_alive()
|
177 | 185 | var/playersalive = players_alive()
|
178 |
| - if(emergency_shuttle && (emergency_shuttle.returned() || emergency_shuttle.departed)) |
| 186 | + var/playeralienratio = player_alien_ratio() |
| 187 | + if(emergency_shuttle && emergency_shuttle.returned()) |
179 | 188 | return ..()
|
180 | 189 | if(!xenosalive)
|
181 | 190 | result = 1
|
182 | 191 | return 1
|
183 | 192 | else if(!playersalive)
|
184 | 193 | result = 2
|
185 | 194 | return 1
|
| 195 | + else if(station_was_nuked) |
| 196 | + result = 3 |
| 197 | + return 1 |
186 | 198 | else
|
| 199 | + if(playeralienratio >= gammaratio && !gammacalled) |
| 200 | + gammacalled = 1 |
| 201 | + command_alert("The aliens have nearly succeeded in capturing the station and exterminating the crew. Activate the nuclear failsafe to stop the alien threat once and for all. The Nuclear Authentication Code is [get_nuke_code()] ", "Alien Lifeform Alert") |
| 202 | + set_security_level("gamma") |
| 203 | + var/obj/machinery/door/airlock/vault/V = locate(/obj/machinery/door/airlock/vault) in world |
| 204 | + if(V && V.z == 1) |
| 205 | + V.locked = 0 |
| 206 | + V.update_icon() |
187 | 207 | return ..()
|
188 | 208 |
|
189 | 209 | /datum/game_mode/xenos/check_finished()
|
190 | 210 | if(config.continous_rounds)
|
191 | 211 | if(result)
|
192 | 212 | return ..()
|
193 |
| - if(emergency_shuttle && (emergency_shuttle.returned() || emergency_shuttle.departed)) |
| 213 | + if(emergency_shuttle && emergency_shuttle.returned()) |
194 | 214 | return ..()
|
195 |
| - if(result) |
| 215 | + if(result || station_was_nuked) |
196 | 216 | return 1
|
197 | 217 | else
|
198 | 218 | return 0
|
199 | 219 |
|
| 220 | +/datum/game_mode/xenos/proc/get_nuke_code() |
| 221 | + var/nukecode = "ERROR" |
| 222 | + for(var/obj/machinery/nuclearbomb/bomb in world) |
| 223 | + if(bomb && bomb.r_code && bomb.z == 1) |
| 224 | + nukecode = bomb.r_code |
| 225 | + return nukecode |
| 226 | + |
200 | 227 | /datum/game_mode/xenos/proc/xenos_alive()
|
201 | 228 | var/list/livingxenos = list()
|
202 | 229 | for(var/datum/mind/xeno in xenos)
|
|
209 | 236 | var/list/livingplayers = list()
|
210 | 237 | for(var/mob/M in player_list)
|
211 | 238 | var/turf/T = get_turf(M)
|
212 |
| - if((M) && (M.stat != 2) && M.client && T && (T.z == 1)) |
| 239 | + if((M) && (M.stat != 2) && M.client && T && (T.z == 1 || emergency_shuttle.departed && (T.z == 1 || T.z == 2))) |
213 | 240 | if(ishuman(M))
|
214 | 241 | livingplayers += 1
|
215 | 242 | return livingplayers.len
|
| 243 | + |
| 244 | +/datum/game_mode/xenos/proc/player_alien_ratio() |
| 245 | + var/list/livingplayers = list() |
| 246 | + var/list/livingxenos = list() |
| 247 | + for(var/mob/M in player_list) |
| 248 | + if((M) && (M.stat != 2) && M.client) |
| 249 | + if(ishuman(M)) |
| 250 | + livingplayers += 1 |
| 251 | + for(var/datum/mind/xeno in xenos) |
| 252 | + if((xeno) && (xeno.current) && (xeno.current.stat != 2) && (xeno.current.client)) |
| 253 | + if(istype(xeno.current,/mob/living/carbon/alien) || (xenoborg && isrobot(xeno.current)) || (xenoai && isAI(xeno.current))) |
| 254 | + livingxenos += xeno |
216 | 255 |
|
217 |
| -/datum/game_mode/xenos/declare_completion() |
| 256 | + if(!livingxenos.len || !livingplayers.len) |
| 257 | + return 0 |
| 258 | + |
| 259 | + var/ratio = livingxenos.len / livingplayers.len |
| 260 | + return ratio |
| 261 | + |
| 262 | +/datum/game_mode/xenos/declare_completion() |
218 | 263 | if(result == 1)
|
219 | 264 | feedback_set_details("round_end_result","win - xenos killed")
|
220 | 265 | world << "<FONT size = 3><B>Crew Victory</B></FONT>"
|
|
223 | 268 | feedback_set_details("round_end_result","win - crew killed")
|
224 | 269 | world << "<FONT size = 3><B>Alien Victory</B></FONT>"
|
225 | 270 | world << "<B>The aliens were successful and slaughtered the crew!</B>"
|
| 271 | + else if(station_was_nuked) |
| 272 | + feedback_set_details("round_end_result","win - xenos nuked") |
| 273 | + world << "<FONT size = 3><B>Crew Victory</B></FONT>" |
| 274 | + world << "<B>The station was destroyed in a nuclear explosion, preventing the aliens from overrunning it!</B>" |
226 | 275 | else
|
227 | 276 | feedback_set_details("round_end_result","win - crew escaped")
|
228 | 277 | world << "<FONT size = 3><B>Draw</B></FONT>"
|
|
231 | 280 | var/text = "<br><FONT size=3><B>There were [xenos.len] aliens.</B></FONT>"
|
232 | 281 | text += "<br><FONT size=3><B>The aliens were:</B></FONT>"
|
233 | 282 | for(var/datum/mind/xeno in xenos)
|
234 |
| - text += "<br><b>[xeno.key]</b> was <b>[xeno.current.name]</b> (" |
| 283 | + text += "<br><b>[xeno.key]</b> was <b>[xeno.name]</b> (" |
235 | 284 | if(xeno.current)
|
236 | 285 | if(xeno.current.stat == DEAD)
|
237 | 286 | text += "died"
|
|
0 commit comments