From 66c7b07f6f73fbe8979825aa4125c45780c7bfe8 Mon Sep 17 00:00:00 2001 From: EgorDinamit <53223414+EgorDinamit@users.noreply.github.com> Date: Fri, 29 Dec 2023 21:52:51 +0300 Subject: [PATCH] Fixes & Updates cinematics (#495) * Fixes & Updates cinematics * Reduces time cinematic is on the screen From 30 seconds to 22. --- code/datums/cinematic.dm | 55 ++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/code/datums/cinematic.dm b/code/datums/cinematic.dm index cb56dffb805..0d0838c4a85 100644 --- a/code/datums/cinematic.dm +++ b/code/datums/cinematic.dm @@ -5,13 +5,15 @@ GLOBAL_DATUM_INIT(cinematic, /datum/cinematic, new) //station_explosion used to be a variable for every mob's hud. Which was a waste! //Now we have a general cinematic centrally held within the gameticker....far more efficient! var/obj/screen/cinematic_screen = null + /// List of clients currently watching a cinematic + var/list/watching_clients = list() //Plus it provides an easy way to make cinematics for other events. Just use this as a template :) -/datum/cinematic/proc/station_explosion_cinematic(var/station_missed=0, var/datum/game_mode/override) +/datum/cinematic/proc/station_explosion_cinematic(station_missed = FALSE, datum/game_mode/override) set waitfor = FALSE - if(cinematic_screen) - return //already a cinematic in progress! + if(cinematic_screen) + return //already a cinematic in progress! if(!override) override = SSticker.mode @@ -20,30 +22,39 @@ GLOBAL_DATUM_INIT(cinematic, /datum/cinematic, new) if(!override) return - //initialise our cinematic screen object + watching_clients = list() + + // Initialise our cinematic screen object cinematic_screen = new(src) cinematic_screen.icon = 'icons/effects/station_explosion.dmi' cinematic_screen.icon_state = "station_intact" cinematic_screen.plane = HUD_PLANE cinematic_screen.layer = HUD_ABOVE_ITEM_LAYER cinematic_screen.mouse_opacity = 0 - cinematic_screen.screen_loc = "1,0" - - //Let's not discuss how this worked previously. - var/list/viewers = list() - for(var/mob/living/M in GLOB.living_mob_list_) - if(M.client) - M.client.screen += cinematic_screen //show every client the cinematic - viewers[M.client] = M.stunned - M.stunned = 8000 - - override.nuke_act(cinematic_screen, station_missed) //cinematic happens here, as does mob death. - //If its actually the end of the round, wait for it to end. - //Otherwise if its a verb it will continue on afterwards. - sleep(30 SECONDS) - - for(var/client/C in viewers) + cinematic_screen.screen_loc = "BOTTOM,LEFT+50%" + cinematic_screen.appearance_flags = APPEARANCE_UI | TILE_BOUND + + for(var/client/C in GLOB.clients) + // Show every client the cinematic + C.screen += cinematic_screen + watching_clients += C if(C.mob) - C.mob.stunned = viewers[C] + C.mob.stunned += 8000 + + // Cinematic happens here, as does mob death. + override.nuke_act(cinematic_screen, station_missed) + // If its actually the end of the round, wait for it to end. + // Otherwise if its a verb it will continue on afterwards. + sleep(20 SECONDS) + + animate(cinematic_screen, alpha = 0, time = (2 SECONDS)) + + sleep(2 SECONDS) + + for(var/client/C in watching_clients) C.screen -= cinematic_screen - QDEL_NULL(cinematic_screen) \ No newline at end of file + if(C.mob) + C.mob.stunned = max(0, C.mob.stunned - 8000) + + watching_clients = list() + QDEL_NULL(cinematic_screen)