This repository was archived by the owner on May 22, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 458
Expand file tree
/
Copy pathcinematic.dm
More file actions
283 lines (237 loc) · 7.47 KB
/
cinematic.dm
File metadata and controls
283 lines (237 loc) · 7.47 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
// Use to play cinematics.
// Watcher can be world,mob, or a list of mobs
// Blocks until sequence is done.
/proc/Cinematic(id,watcher,datum/callback/special_callback)
var/datum/cinematic/playing
for(var/V in subtypesof(/datum/cinematic))
var/datum/cinematic/C = V
if(initial(C.id) == id)
playing = new V()
break
if(!playing)
CRASH("Cinematic type not found")
if(special_callback)
playing.special_callback = special_callback
if(watcher == world)
playing.is_global = TRUE
watcher = GLOB.mob_list
playing.play(watcher)
qdel(playing)
/atom/movable/screen/cinematic
icon = 'icons/effects/station_explosion.dmi'
icon_state = "station_intact"
plane = SPLASHSCREEN_PLANE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
screen_loc = "BOTTOM,LEFT+50%"
appearance_flags = APPEARANCE_UI | TILE_BOUND
/datum/cinematic
var/id = CINEMATIC_DEFAULT
var/list/watching = list() //List of clients watching this
var/list/locked = list() //Who had notransform set during the cinematic
var/is_global = FALSE //Global cinematics will override mob-specific ones
var/atom/movable/screen/cinematic/screen
var/datum/callback/special_callback //For special effects synced with animation (explosions after the countdown etc)
var/cleanup_time = 30 SECONDS //How long for the final screen to remain
var/stop_ooc = TRUE //Turns off ooc when played globally.
/datum/cinematic/New()
screen = new(src)
/datum/cinematic/Destroy()
for(var/CC in watching)
if(!CC)
continue
var/client/C = CC
C.mob.clear_fullscreen("cinematic")
C.screen -= screen
watching = null
QDEL_NULL(screen)
QDEL_NULL(special_callback)
for(var/MM in locked)
if(!MM)
continue
var/mob/M = MM
M.notransform = FALSE
locked = null
return ..()
/datum/cinematic/proc/play(watchers)
//Check if cinematic can actually play (stop mob cinematics for global ones)
if(SEND_GLOBAL_SIGNAL(COMSIG_GLOB_PLAY_CINEMATIC, src) & COMPONENT_GLOB_BLOCK_CINEMATIC)
return
//We are now playing this cinematic
//Handle what happens when a different cinematic tries to play over us
RegisterSignal(SSdcs, COMSIG_GLOB_PLAY_CINEMATIC, PROC_REF(replacement_cinematic))
//Pause OOC
var/ooc_toggled = FALSE
if(is_global && stop_ooc && GLOB.ooc_allowed)
ooc_toggled = TRUE
toggle_ooc(FALSE)
//Place /atom/movable/screen/cinematic into everyone's screens, prevent them from moving
for(var/MM in watchers)
var/mob/M = MM
show_to(M, M.client)
RegisterSignal(M, COMSIG_MOB_CLIENT_LOGIN, PROC_REF(show_to))
//Close watcher ui's
SStgui.close_user_uis(M)
//Actually play it
content()
//Cleanup
sleep(cleanup_time)
//Restore OOC
if(ooc_toggled)
toggle_ooc(TRUE)
/datum/cinematic/proc/show_to(mob/M, client/C)
if(!M.notransform)
locked += M
M.notransform = TRUE //Should this be done for non-global cinematics or even at all ?
if(!C)
return
watching += C
M.overlay_fullscreen("cinematic",/atom/movable/screen/fullscreen/cinematic_backdrop)
C.screen += screen
//Sound helper
/datum/cinematic/proc/cinematic_sound(s)
if(is_global)
SEND_SOUND(world,s)
else
for(var/C in watching)
SEND_SOUND(C,s)
//Fire up special callback for actual effects synchronized with animation (eg real nuke explosion happens midway)
/datum/cinematic/proc/special()
if(special_callback)
special_callback.Invoke()
//Actual cinematic goes in here
/datum/cinematic/proc/content()
sleep(5 SECONDS)
/datum/cinematic/proc/replacement_cinematic(datum/source, datum/cinematic/other)
if(!is_global && other.is_global) //Allow it to play if we're local and it's global
return NONE
return COMPONENT_GLOB_BLOCK_CINEMATIC
/datum/cinematic/nuke_win
id = CINEMATIC_NUKE_WIN
/datum/cinematic/nuke_win/content()
flick("intro_nuke",screen)
sleep(3.5 SECONDS)
flick("station_explode_fade_red",screen)
cinematic_sound(sound('sound/effects/explosion_distant.ogg'))
special()
screen.icon_state = "summary_nukewin"
/datum/cinematic/nuke_miss
id = CINEMATIC_NUKE_MISS
/datum/cinematic/nuke_miss/content()
flick("intro_nuke",screen)
sleep(3.5 SECONDS)
cinematic_sound(sound('sound/effects/explosion_distant.ogg'))
special()
flick("station_intact_fade_red",screen)
screen.icon_state = "summary_nukefail"
//Also used for blob
/datum/cinematic/nuke_selfdestruct
id = CINEMATIC_SELFDESTRUCT
/datum/cinematic/nuke_selfdestruct/content()
flick("intro_nuke",screen)
sleep(3.5 SECONDS)
flick("station_explode_fade_red", screen)
cinematic_sound(sound('sound/effects/explosion_distant.ogg'))
special()
screen.icon_state = "summary_selfdes"
/datum/cinematic/nuke_selfdestruct_miss
id = CINEMATIC_SELFDESTRUCT_MISS
/datum/cinematic/nuke_selfdestruct_miss/content()
flick("intro_nuke",screen)
sleep(3.5 SECONDS)
cinematic_sound(sound('sound/effects/explosion_distant.ogg'))
special()
screen.icon_state = "station_intact"
/datum/cinematic/malf
id = CINEMATIC_MALF
/datum/cinematic/malf/content()
flick("intro_malf",screen)
sleep(7.6 SECONDS)
flick("station_explode_fade_red",screen)
cinematic_sound(sound('sound/effects/explosion_distant.ogg'))
special()
screen.icon_state = "summary_malf"
/datum/cinematic/cult
id = CINEMATIC_CULT
/datum/cinematic/cult/content()
screen.icon_state = null
flick("intro_cult",screen)
sleep(2.5 SECONDS)
cinematic_sound(sound('sound/magic/enter_blood.ogg'))
sleep(2.8 SECONDS)
cinematic_sound(sound('sound/machines/terminal_off.ogg'))
sleep(2 SECONDS)
flick("station_corrupted",screen)
cinematic_sound(sound('sound/effects/ghost.ogg'))
sleep(7 SECONDS)
special()
/datum/cinematic/cult_nuke
id = CINEMATIC_CULT_NUKE
/datum/cinematic/cult_nuke/content()
flick("intro_nuke",screen)
sleep(3.5 SECONDS)
flick("station_explode_fade_red",screen)
cinematic_sound(sound('sound/effects/explosion_distant.ogg'))
special()
screen.icon_state = "summary_cult"
/datum/cinematic/cult_fail
id = CINEMATIC_CULT_FAIL
/datum/cinematic/cult_fail/content()
screen.icon_state = "station_intact"
sleep(2 SECONDS)
cinematic_sound(sound('sound/creatures/narsie_rises.ogg'))
sleep(6 SECONDS)
cinematic_sound(sound('sound/effects/explosion_distant.ogg'))
sleep(1 SECONDS)
cinematic_sound(sound('sound/magic/demon_dies.ogg'))
sleep(3 SECONDS)
special()
/datum/cinematic/nuke_annihilation
id = CINEMATIC_ANNIHILATION
/datum/cinematic/nuke_annihilation/content()
flick("intro_nuke",screen)
sleep(3.5 SECONDS)
flick("station_explode_fade_red",screen)
cinematic_sound(sound('sound/effects/explosion_distant.ogg'))
special()
screen.icon_state = "summary_totala"
/datum/cinematic/fake
id = CINEMATIC_NUKE_FAKE
cleanup_time = 10 SECONDS
/datum/cinematic/fake/content()
flick("intro_nuke",screen)
sleep(3.5 SECONDS)
cinematic_sound(sound('sound/items/bikehorn.ogg'))
flick("summary_selfdes",screen) //???
special()
/datum/cinematic/no_core
id = CINEMATIC_NUKE_NO_CORE
cleanup_time = 10 SECONDS
/datum/cinematic/no_core/content()
flick("intro_nuke",screen)
sleep(3.5 SECONDS)
flick("station_intact",screen)
cinematic_sound(sound('sound/ambience/signal.ogg'))
sleep(10 SECONDS)
/datum/cinematic/nuke_far
id = CINEMATIC_NUKE_FAR
cleanup_time = 0 SECONDS
/datum/cinematic/nuke_far/content()
cinematic_sound(sound('sound/effects/explosion_distant.ogg'))
special()
/datum/cinematic/clownop
id = CINEMATIC_NUKE_CLOWNOP
cleanup_time = 10 SECONDS
/datum/cinematic/clownop/content()
flick("intro_nuke",screen)
sleep(3.5 SECONDS)
cinematic_sound(sound('sound/items/airhorn.ogg'))
flick("summary_selfdes",screen) //???
special()
/* Intended usage.
Nuke.Explosion()
-> Cinematic(NUKE_BOOM,world)
-> ActualExplosion()
-> Mode.OnExplosion()
Narsie()
-> Cinematic(CULT,world)
*/