-
Notifications
You must be signed in to change notification settings - Fork 224
/
Copy pathshuttle_specops.dm
194 lines (157 loc) · 6.38 KB
/
shuttle_specops.dm
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
/obj/machinery/computer/shuttle_control/specops
name = "special operations shuttle console"
shuttle_tag = "Special Operations"
initial_access = list(access_cent_specops)
/obj/machinery/computer/shuttle_control/specops/attack_ai(user)
to_chat(user, "<span class='warning'>Access Denied.</span>")
return 1
/datum/shuttle/autodock/ferry/specops
var/specops_return_delay = 6000 //After moving, the amount of time that must pass before the shuttle may move again
var/specops_countdown_time = 600 //Length of the countdown when moving the shuttle
var/reset_time = 0 //the world.time at which the shuttle will be ready to move again.
var/launch_prep = 0
var/cancel_countdown = 0
abstract_type = /datum/shuttle/autodock/ferry/specops
/datum/shuttle/autodock/ferry/specops/launch(var/user)
if (!can_launch())
return
if (istype(user, /obj/machinery/computer))
var/obj/machinery/computer/C = user
if(world.time <= reset_time)
C.visible_message("<span class='notice'>[global.using_map.boss_name] will not allow the Special Operations shuttle to launch yet.</span>")
if (((world.time - reset_time)/10) > 60)
C.visible_message("<span class='notice'>[-((world.time - reset_time)/10)/60] minutes remain!</span>")
else
C.visible_message("<span class='notice'>[-(world.time - reset_time)/10] seconds remain!</span>")
return
C.visible_message("<span class='notice'>The Special Operations shuttle will depart in [(specops_countdown_time/10)] seconds.</span>")
if (location) //returning
do_telecomms_announcement(current_location, "THE SPECIAL OPERATIONS SHUTTLE IS PREPARING TO RETURN", "A.L.I.C.E")
else
do_telecomms_announcement(current_location, "THE SPECIAL OPERATIONS SHUTTLE IS PREPARING FOR LAUNCH", "A.L.I.C.E")
sleep_until_launch()
if (location)
var/obj/machinery/light/small/readylight/light = locate() in shuttle_area
if(light) light.set_state(0)
//launch
do_telecomms_announcement(current_location, "ALERT: INITIATING LAUNCH SEQUENCE", "A.L.I.C.E")
reset_time = world.time + specops_return_delay
..(user)
/datum/shuttle/autodock/ferry/specops/shuttle_moved(obj/effect/shuttle_landmark/destination, list/turf_translation, angle = 0)
..()
spawn(2 SECONDS)
if (!location) //just arrived home
for(var/turf/T in get_area_turfs(shuttle_area))
var/mob/M = locate(/mob) in T
to_chat(M, "<span class='danger'>You have arrived at [global.using_map.boss_name]. Operation has ended!</span>")
else //just left for the station
launch_mauraders()
for(var/turf/T in get_area_turfs(shuttle_area))
var/mob/M = locate(/mob) in T
to_chat(M, "<span class='danger'>You have arrived at [global.using_map.station_name]. Commence operation!</span>")
var/obj/machinery/light/small/readylight/light = locate() in T
if(light) light.set_state(1)
/datum/shuttle/autodock/ferry/specops/cancel_launch()
if (!can_cancel())
return
cancel_countdown = 1
do_telecomms_announcement(current_location, "ALERT: LAUNCH SEQUENCE ABORTED", "A.L.I.C.E")
if (istype(in_use, /obj/machinery/computer))
var/obj/machinery/computer/C = in_use
C.visible_message("<span class='warning'>Launch sequence aborted.</span>")
..()
/datum/shuttle/autodock/ferry/specops/can_launch()
if(launch_prep)
return 0
return ..()
//should be fine to allow forcing. process_state only becomes WAIT_LAUNCH after the countdown is over.
///datum/shuttle/autodock/ferry/specops/can_force()
// return 0
/datum/shuttle/autodock/ferry/specops/can_cancel()
if(launch_prep)
return 1
return ..()
/datum/shuttle/autodock/ferry/specops/proc/sleep_until_launch()
var/message_tracker[] = list(0,1,2,3,5,10,30,45)//Create a list with potential time values.
var/launch_time = world.time + specops_countdown_time
var/time_until_launch
cancel_countdown = 0
launch_prep = 1
while(!cancel_countdown && (launch_time - world.time) > 0)
var/ticksleft = launch_time - world.time
//if(ticksleft > 1e5)
// launch_time = world.timeofday + 10 // midnight rollover
time_until_launch = (ticksleft / 10)
//All this does is announce the time before launch.
var/rounded_time_left = round(time_until_launch)//Round time so that it will report only once, not in fractions.
if(rounded_time_left in message_tracker)//If that time is in the list for message announce.
do_telecomms_announcement(current_location, "ALERT: [rounded_time_left] SECOND[(rounded_time_left!=1)?"S":""] REMAIN", "A.L.I.C.E")
message_tracker -= rounded_time_left//Remove the number from the list so it won't be called again next cycle.
//Should call all the numbers but lag could mean some issues. Oh well. Not much I can do about that.
sleep(5)
launch_prep = 0
/proc/launch_mauraders()
var/specops_area = global.using_map.get_specops_area()
if(!specops_area)
return
var/area/special_ops = locate(specops_area)//Where is the specops area located?
//Begin Marauder launchpad.
spawn(0)//So it parallel processes it.
for(var/obj/machinery/door/blast/M in special_ops)
switch(M.id_tag)
if("ASSAULT0")
spawn(10)//1 second delay between each.
M.open()
if("ASSAULT1")
spawn(20)
M.open()
if("ASSAULT2")
spawn(30)
M.open()
if("ASSAULT3")
spawn(40)
M.open()
sleep(10)
var/spawn_marauder[] = new()
for(var/obj/abstract/landmark/L in global.landmarks_list)
if(L.name == "Marauder Entry")
spawn_marauder.Add(L)
for(var/obj/abstract/landmark/L in global.landmarks_list)
if(L.name == "Marauder Exit")
var/obj/effect/portal/P = new(L.loc)
P.set_invisibility(INVISIBILITY_ABSTRACT)//So it is not seen by anyone.
P.failchance = 0//So it has no fail chance when teleporting.
P.target = pick(spawn_marauder)//Where the marauder will arrive.
spawn_marauder.Remove(P.target)
sleep(10)
for(var/obj/machinery/mass_driver/M in special_ops)
switch(M.id_tag)
if("ASSAULT0")
spawn(10)
M.drive()
if("ASSAULT1")
spawn(20)
M.drive()
if("ASSAULT2")
spawn(30)
M.drive()
if("ASSAULT3")
spawn(40)
M.drive()
sleep(50)//Doors remain open for 5 seconds.
for(var/obj/machinery/door/blast/M in special_ops)
switch(M.id_tag)//Doors close at the same time.
if("ASSAULT0")
spawn(0)
M.close()
if("ASSAULT1")
spawn(0)
M.close()
if("ASSAULT2")
spawn(0)
M.close()
if("ASSAULT3")
spawn(0)
M.close()
special_ops.readyreset()//Reset firealarm after the team launched.
//End Marauder launchpad.