-
Notifications
You must be signed in to change notification settings - Fork 906
Expand file tree
/
Copy pathzombie_crash.dm
More file actions
206 lines (179 loc) · 9.23 KB
/
Copy pathzombie_crash.dm
File metadata and controls
206 lines (179 loc) · 9.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/datum/game_mode/infestation/crash/zombie
name = "Zombie Crash"
config_tag = "Zombie Crash"
round_type_flags = MODE_ALLOW_MARINE_QUICKBUILD
xeno_abilities_flags = ABILITY_CRASH
required_players = 1
valid_job_types = list(
/datum/job/terragov/squad/standard = -1,
/datum/job/terragov/squad/engineer = 3,
/datum/job/terragov/squad/corpsman = 1,
/datum/job/terragov/squad/smartgunner = 1,
/datum/job/terragov/squad/leader = 1,
/datum/job/terragov/medical/professor = 1,
/datum/job/terragov/silicon/synthetic = 1,
/datum/job/terragov/command/fieldcommander = 1,
)
job_points_needed_by_job_type = list(
/datum/job/terragov/squad/smartgunner = 20,
/datum/job/terragov/squad/corpsman = 5,
/datum/job/terragov/squad/engineer = 5,
)
blacklist_ground_maps = list(MAP_BIG_RED, MAP_DELTA_STATION, MAP_LV_624, MAP_WHISKEY_OUTPOST, MAP_OSCAR_OUTPOST, MAP_FORT_PHOBOS, MAP_CHIGUSA, MAP_LAVA_OUTPOST, MAP_CORSAT, MAP_KUTJEVO_REFINERY, MAP_BLUESUMMERS)
/datum/game_mode/infestation/crash/zombie/can_start(bypass_checks = FALSE)
if(!(config_tag in SSmapping.configs[GROUND_MAP].gamemodes) && !bypass_checks)
log_world("attempted to start [name] on "+SSmapping.configs[GROUND_MAP].map_name+" which doesn't support it.")
// start a gamemode vote, in theory this should never happen.
addtimer(CALLBACK(SSvote, TYPE_PROC_REF(/datum/controller/subsystem/vote, initiate_vote), "gamemode", "SERVER"), 10 SECONDS)
return FALSE
if(length(GLOB.ready_players) < required_players && !bypass_checks)
to_chat(world, "<b>Unable to start [name].</b> Not enough players, [required_players] players needed.")
return FALSE
if(!set_valid_job_types() && !bypass_checks)
return FALSE
if(!set_valid_squads() && !bypass_checks)
return FALSE
return TRUE
/datum/game_mode/infestation/crash/zombie/post_setup()
. = ..()
for(var/obj/effect/landmark/corpsespawner/corpse AS in GLOB.corpse_landmarks_list)
corpse.create_zombie()
for(var/i in (GLOB.zombie_spawner_turfs + GLOB.xeno_resin_silo_turfs))
new /obj/effect/ai_node/spawner/zombie(i)
for(var/i in GLOB.zombie_crash_vendor_landmarks)
new /obj/machinery/marine_selector/zombie_crash(get_turf(i))
addtimer(CALLBACK(src, PROC_REF(balance_scales)), 1 SECONDS)
RegisterSignal(SSdcs, COMSIG_GLOB_ZOMBIE_TUNNEL_DESTROYED, PROC_REF(on_tunnel_destroyed))
/datum/game_mode/infestation/crash/zombie/on_nuke_started(datum/source, obj/machinery/nuclearbomb/nuke)
return
/// When any zombie tunnel is destroyed, check if the round should end & grant vendor points.
/datum/game_mode/infestation/crash/zombie/proc/on_tunnel_destroyed(datum/source)
SIGNAL_HANDLER
check_finished()
give_all_humans_points(ZOMBIE_CRASH_POINTS_PER_TUNNEL_MIN, ZOMBIE_CRASH_POINTS_PER_TUNNEL_MIN, ZOMBIE_CRASH_POINTS_PER_TUNNEL_MAX)
/datum/game_mode/infestation/crash/zombie/on_disk_segment_completed(datum/source, obj/machinery/computer/code_generator/nuke/generating_computer)
. = ..()
global_rally_zombies(generating_computer, TRUE)
give_all_humans_points(ZOMBIE_CRASH_POINTS_PER_CYCLE_MIN, ZOMBIE_CRASH_POINTS_PER_CYCLE_MIN, ZOMBIE_CRASH_POINTS_PER_CYCLE_MAX)
/// Evenly distributes an amount of points to all alive humans who are actively playing. Minimum/maximum points scales on population.
/datum/game_mode/infestation/crash/zombie/proc/give_all_humans_points(flat, minimum, maximum)
if(!length(GLOB.zombie_crash_vendors))
return
var/list/mob/living/carbon/human/human_list = list()
for(var/mob/living/carbon/human/possible_active_human in GLOB.alive_human_list_faction[FACTION_TERRAGOV])
if(!possible_active_human.client && possible_active_human.afk_status == MOB_DISCONNECTED)
continue
human_list += possible_active_human
var/num_humans = length(human_list)
if(!num_humans)
return
var/vendor_points_to_reward = flat + ((maximum - minimum) * (num_humans / HIGH_MARINE_POP_ZOMBIE_CRASH))
var/vendor_points_per_alive_marine = ROUND_UP(vendor_points_to_reward / num_humans)
var/obj/machinery/marine_selector/zombie_crash/zcrash_vendor = GLOB.zombie_crash_vendors[1]
for(var/mob/living/carbon/human/human AS in human_list)
if(!human.job)
continue
zcrash_vendor.add_personal_points(human, vendor_points_per_alive_marine)
///Counts humans and zombies not in valhalla
/datum/game_mode/infestation/crash/zombie/proc/count_humans_and_zombies(list/z_levels = SSmapping.levels_by_any_trait(list(ZTRAIT_MARINE_MAIN_SHIP, ZTRAIT_GROUND, ZTRAIT_RESERVED)), count_flags)
var/num_humans = 0
var/num_zombies = 0
for(var/z in z_levels)
for(var/mob/living/carbon/human/H in GLOB.humans_by_zlevel["[z]"])
if(!istype(H)) // Small fix?
continue
if(H.faction == FACTION_ZOMBIE)
num_zombies++
continue
if(count_flags & COUNT_IGNORE_HUMAN_SSD && !H.client && H.afk_status == MOB_DISCONNECTED)
continue
if(H.status_flags & XENO_HOST)
continue
if(isspaceturf(H.loc))
continue
num_humans++
return list(num_humans, num_zombies)
/datum/game_mode/infestation/crash/zombie/balance_scales()
if(GLOB.zombie_spawners == 0)
return
var/list/living_player_list = count_humans_and_zombies(count_flags = COUNT_IGNORE_HUMAN_SSD)
var/num_humans = living_player_list[1]
var/num_zombies = living_player_list[2]
GLOB.maximum_allowed_possessed_zombies = floor(num_humans / ZOMBIE_SENTIENT_TO_HUMAN_RATIO)
if(num_zombies * 0.125 >= num_humans) // if there's too much zombies, don't spawn even more
for(var/obj/effect/ai_node/spawner/zombie/spawner AS in GLOB.zombie_spawners)
if(!spawner.threat_warning)
SSspawning.spawnerdata[spawner].max_allowed_mobs = 0
spawner.maxamount = 0
return
for(var/obj/effect/ai_node/spawner/zombie/spawner AS in GLOB.zombie_spawners)
if(!spawner.threat_warning)
var/new_spawn_cap = round(num_humans * 8 / length(GLOB.zombie_spawners))
SSspawning.spawnerdata[spawner].max_allowed_mobs = new_spawn_cap
spawner.maxamount = new_spawn_cap
/datum/game_mode/infestation/crash/zombie/get_adjusted_jobworth_list(list/jobworth_list)
return jobworth_list
/datum/game_mode/infestation/crash/zombie/check_finished(force_end)
if(round_finished)
return TRUE
if(!shuttle_landed && !force_end)
return FALSE
if(!length(GLOB.zombie_spawners))
message_admins("Round finished: [MODE_INFESTATION_M_MAJOR]") //marines destroyed all zombie spawners
round_finished = MODE_INFESTATION_M_MAJOR
return TRUE
var/list/living_player_list = count_humans_and_xenos(count_flags = COUNT_IGNORE_HUMAN_SSD)
var/num_humans = living_player_list[1]
if(num_humans && planet_nuked == INFESTATION_NUKE_NONE && marines_evac == CRASH_EVAC_NONE && !force_end)
return FALSE
switch(planet_nuked)
if(INFESTATION_NUKE_NONE)
if(!num_humans)
message_admins("Round finished: [MODE_ZOMBIE_Z_MAJOR]") //zombies wiped out ALL the marines
round_finished = MODE_ZOMBIE_Z_MAJOR
return TRUE
if(marines_evac == CRASH_EVAC_COMPLETED || (!length(GLOB.active_nuke_list) && marines_evac != CRASH_EVAC_NONE))
message_admins("Round finished: [MODE_ZOMBIE_Z_MINOR]") //marines evaced without a nuke
round_finished = MODE_ZOMBIE_Z_MINOR
return TRUE
if(INFESTATION_NUKE_COMPLETED)
if(marines_evac == CRASH_EVAC_NONE)
message_admins("Round finished: [MODE_INFESTATION_M_MINOR]") //marines nuked the planet but didn't evac
round_finished = MODE_INFESTATION_M_MINOR
return TRUE
message_admins("Round finished: [MODE_INFESTATION_M_MAJOR]") //marines nuked the planet and managed to evac
round_finished = MODE_INFESTATION_M_MAJOR
return TRUE
if(INFESTATION_NUKE_COMPLETED_SHIPSIDE, INFESTATION_NUKE_COMPLETED_OTHER)
message_admins("Round finished: [MODE_GENERIC_DRAW_NUKE]") //marines nuked themselves somehow
round_finished = MODE_GENERIC_DRAW_NUKE
return TRUE
return FALSE
/datum/game_mode/infestation/crash/zombie/announce()
to_chat(world, span_round_header("The current map is - [SSmapping.configs[GROUND_MAP].map_name]!"))
priority_announce("Scheduled for landing in T-10 Minutes. Prepare for landing. Phrenetic reports about an unidentified disease rapidly spreading throughout the site were received before it went silent. Your mission is to contain and destroy the source of the contagion by any means necessary, including use of the on-site nuclear device. Bio-warfare protocols active. Detonation Protocol Active, planet disposable. Marines disposable.",
title = "Mission classification: TOP SECRET",
type = ANNOUNCEMENT_PRIORITY,
color_override = "red")
playsound(shuttle, 'sound/machines/warning-buzzer.ogg', 75, 0, 30)
balance_scales()
/datum/game_mode/infestation/crash/zombie/end_round_fluff()
. = ..()
if(round_finished == MODE_INFESTATION_M_MAJOR || round_finished == MODE_INFESTATION_M_MINOR || round_finished == MODE_INFESTATION_DRAW_DEATH)
return
var/sound/human_track = sound(pick('sound/theme/zombies_loss.ogg', 'sound/theme/sad_loss2.ogg'))
var/sound/zombie_track = sound(pick('sound/theme/neutral_melancholy1.ogg', 'sound/theme/neutral_melancholy2.ogg'))
var/sound/ghost_track = zombie_track
zombie_track.channel = CHANNEL_CINEMATIC
human_track.channel = CHANNEL_CINEMATIC
ghost_track.channel = CHANNEL_CINEMATIC
for(var/mob/hearer AS in GLOB.player_list)
if(hearer.client?.prefs?.toggles_sound & SOUND_NOENDOFROUND)
continue
switch(hearer.faction)
if(FACTION_ZOMBIE)
SEND_SOUND(hearer, zombie_track)
if(FACTION_TERRAGOV)
SEND_SOUND(hearer, human_track)
else
SEND_SOUND(hearer, ghost_track)