mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 23:27:34 +01:00
[MIRROR] Ensures cinematics really go away when they're done. [MDB IGNORE] (#14101)
* Ensures cinematics really go away when they're done. (#67332) * Ensures cinematics really go away in all scenarios * Ensures cinematics really go away when they're done. Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
This commit is contained in:
@@ -71,21 +71,22 @@
|
||||
ooc_toggled = TRUE
|
||||
toggle_ooc(FALSE)
|
||||
|
||||
// Place the /atom/movable/screen/cinematic into everyone's screens, prevent them from moving
|
||||
// Place the /atom/movable/screen/cinematic into everyone's screens, and prevent movement.
|
||||
for(var/mob/watching_mob in watchers)
|
||||
show_to(watching_mob, GET_CLIENT(watching_mob))
|
||||
RegisterSignal(watching_mob, COMSIG_MOB_CLIENT_LOGIN, .proc/show_to)
|
||||
//Close watcher ui's
|
||||
// Close watcher ui's, too, so they can watch it.
|
||||
SStgui.close_user_uis(watching_mob)
|
||||
|
||||
//Actually play it
|
||||
// Actually plays the animation. This will sleep, likely.
|
||||
play_cinematic()
|
||||
|
||||
//Cleanup
|
||||
sleep(cleanup_time)
|
||||
// Cleans up after it's done playing.
|
||||
addtimer(CALLBACK(src, .proc/clean_up_cinematic, ooc_toggled), cleanup_time)
|
||||
|
||||
//Restore OOC
|
||||
if(ooc_toggled)
|
||||
/// Cleans up the cinematic after a set timer of it sticking on the end screen.
|
||||
/datum/cinematic/proc/clean_up_cinematic(was_ooc_toggled = FALSE)
|
||||
if(was_ooc_toggled)
|
||||
toggle_ooc(TRUE)
|
||||
|
||||
stop_cinematic()
|
||||
@@ -105,16 +106,22 @@
|
||||
/datum/cinematic/proc/show_to(mob/watching_mob, client/watching_client)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
// We could technically rip people out of notransform who shouldn't be,
|
||||
// so we'll only lock down all viewing mobs who don't have it already set.
|
||||
// This does potentially mean some mobs could lose their notrasnform and
|
||||
// not be locked down by cinematics, but that should be very unlikely.
|
||||
if(!watching_mob.notransform)
|
||||
locked += WEAKREF(watching_mob)
|
||||
watching_mob.notransform = TRUE
|
||||
|
||||
if(!watching_client)
|
||||
// Only show the actual cinematic to cliented mobs.
|
||||
if(!watching_client || (watching_client in watching))
|
||||
return
|
||||
|
||||
watching += watching_client
|
||||
watching_mob.overlay_fullscreen("cinematic", /atom/movable/screen/fullscreen/cinematic_backdrop)
|
||||
watching_client.screen += screen
|
||||
RegisterSignal(watching_client, COMSIG_PARENT_QDELETING, .proc/remove_watcher)
|
||||
|
||||
/// Simple helper for playing sounds from the cinematic.
|
||||
/datum/cinematic/proc/play_cinematic_sound(sound_to_play)
|
||||
@@ -136,13 +143,28 @@
|
||||
/// Stops the cinematic and removes it from all the viewers.
|
||||
/datum/cinematic/proc/stop_cinematic()
|
||||
for(var/client/viewing_client as anything in watching)
|
||||
viewing_client.mob.clear_fullscreen("cinematic")
|
||||
viewing_client.screen -= screen
|
||||
remove_watcher(viewing_client)
|
||||
|
||||
for(var/datum/weakref/locked_ref as anything in locked)
|
||||
var/mob/locked_mob = locked_ref.resolve()
|
||||
if(QDELETED(locked_mob))
|
||||
continue
|
||||
locked_mob.notransform = FALSE
|
||||
UnregisterSignal(locked_mob, COMSIG_MOB_CLIENT_LOGIN)
|
||||
|
||||
qdel(src)
|
||||
|
||||
/// Removes the passed client from our watching list.
|
||||
/datum/cinematic/proc/remove_watcher(client/no_longer_watching)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(!(no_longer_watching in watching))
|
||||
CRASH("cinematic remove_watcher was passed a client which wasn't watching.")
|
||||
|
||||
UnregisterSignal(no_longer_watching, COMSIG_PARENT_QDELETING)
|
||||
// We'll clear the cinematic if they have a mob which has one,
|
||||
// but we won't remove notransform. Wait for the cinematic end to do that.
|
||||
no_longer_watching.mob?.clear_fullscreen("cinematic")
|
||||
no_longer_watching.screen -= screen
|
||||
|
||||
watching -= no_longer_watching
|
||||
|
||||
@@ -560,12 +560,6 @@ GLOBAL_VAR(station_nuke_source)
|
||||
else
|
||||
detonation_status = DETONATION_MISSED_STATION
|
||||
|
||||
/*
|
||||
if(detonation_status < NUKE_MISS_STATION)
|
||||
SSshuttle.registerHostileEnvironment(src)
|
||||
SSshuttle.lockdown = TRUE
|
||||
*/
|
||||
|
||||
// Missing the station will register a hostile environment, until it actually explodes
|
||||
if(detonation_status == DETONATION_MISSED_STATION)
|
||||
SSshuttle.registerHostileEnvironment(src)
|
||||
|
||||
Reference in New Issue
Block a user