From 35a8769165419c21cee405f53731174f1496f736 Mon Sep 17 00:00:00 2001 From: Volodymir Ohorodnytskyi <102746941+Legendaxe@users.noreply.github.com> Date: Mon, 16 Oct 2023 12:16:49 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BE=D1=87=D0=B5=D1=80=D0=B5=D0=B4=D0=BD?= =?UTF-8?q?=D0=BE=D0=B9=20=D1=84=D0=B8=D0=BA=D1=81=20=D1=82=D0=B8=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=20(#447)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Что этот PR делает ## Почему это хорошо для игры ## Изображения изменений ## Тестирование ## Changelog :cl: fix: вы совершенно точно можете быть уверены что титры работают /:cl: --------- Co-authored-by: Gaxeer <44334376+Gaxeer@users.noreply.github.com> --- code/controllers/subsystem/SSticker.dm | 2 +- modular_ss220/cinematics/_cinematics.dme | 3 ++ modular_ss220/cinematics/code/_cinematics.dm | 2 + modular_ss220/cinematics/code/_defines.dm | 1 + .../cinematics/code/cinematics/credits.dm | 32 +++++++++++++++ modular_ss220/cinematics/code/~undefs.dm | 1 + modular_ss220/credits/code/SScredits.dm | 41 +++++++------------ 7 files changed, 54 insertions(+), 28 deletions(-) create mode 100644 modular_ss220/cinematics/code/_defines.dm create mode 100644 modular_ss220/cinematics/code/cinematics/credits.dm create mode 100644 modular_ss220/cinematics/code/~undefs.dm diff --git a/code/controllers/subsystem/SSticker.dm b/code/controllers/subsystem/SSticker.dm index c66fcc39c844..f9c0cb0e4eee 100644 --- a/code/controllers/subsystem/SSticker.dm +++ b/code/controllers/subsystem/SSticker.dm @@ -592,7 +592,7 @@ SUBSYSTEM_DEF(ticker) for(var/datum/team/team in GLOB.antagonist_teams) team.on_round_end() - SScredits.roll_credits_for_all_clients() // SS220 ADDITION + play_cinematic(/datum/cinematic/credits, world) // Display the scoreboard window score.scoreboard() diff --git a/modular_ss220/cinematics/_cinematics.dme b/modular_ss220/cinematics/_cinematics.dme index 25b8430f8eb6..c7d2ec47086b 100644 --- a/modular_ss220/cinematics/_cinematics.dme +++ b/modular_ss220/cinematics/_cinematics.dme @@ -1,5 +1,6 @@ #include "_cinematics.dm" +#include "code/_defines.dm" #include "code/_cinematics.dm" #include "code/cinematics_client_proc.dm" #include "code/cinematics_screen.dm" @@ -7,3 +8,5 @@ #include "code/cinematics/malf_doomsday.dm" #include "code/cinematics/narsie_summon.dm" #include "code/cinematics/nuke_cinematics.dm" +#include "code/cinematics/credits.dm" +#include "code/~undefs.dm" diff --git a/modular_ss220/cinematics/code/_cinematics.dm b/modular_ss220/cinematics/code/_cinematics.dm index 7ec233873dd8..4ce7d88f3486 100644 --- a/modular_ss220/cinematics/code/_cinematics.dm +++ b/modular_ss220/cinematics/code/_cinematics.dm @@ -149,6 +149,8 @@ qdel(src) + SEND_GLOBAL_SIGNAL(COMSIG_GLOB_CINEMATIC_STOPPED_PLAYING, null) + /// Locks a mob, preventing them from moving, being hurt, or acting /datum/cinematic/proc/lock_mob(mob/to_lock) locked += to_lock diff --git a/modular_ss220/cinematics/code/_defines.dm b/modular_ss220/cinematics/code/_defines.dm new file mode 100644 index 000000000000..757641375d88 --- /dev/null +++ b/modular_ss220/cinematics/code/_defines.dm @@ -0,0 +1 @@ +#define COMSIG_GLOB_CINEMATIC_STOPPED_PLAYING "!cinematic_waiting_to_play" diff --git a/modular_ss220/cinematics/code/cinematics/credits.dm b/modular_ss220/cinematics/code/cinematics/credits.dm new file mode 100644 index 000000000000..e9d82d684289 --- /dev/null +++ b/modular_ss220/cinematics/code/cinematics/credits.dm @@ -0,0 +1,32 @@ +/datum/cinematic/credits + cleanup_time = 20 SECONDS + is_global = TRUE + +/datum/cinematic/credits/New(watcher, datum/callback/special_callback) + . = ..() + screen = new/obj/screen/cinematic/credits(src) + +/datum/cinematic/credits/start_cinematic(list/watchers) + watching = watchers + if(SEND_GLOBAL_SIGNAL(COMSIG_GLOB_PLAY_CINEMATIC, src) & COMPONENT_GLOB_BLOCK_CINEMATIC) + RegisterSignal(SSdcs, COMSIG_GLOB_CINEMATIC_STOPPED_PLAYING, PROC_REF(queue_gone)) + return + . = ..() + +/datum/cinematic/credits/proc/queue_gone(datum/source, datum/cinematic/other) + SIGNAL_HANDLER + + start_cinematic(src.watching) + +/datum/cinematic/credits/play_cinematic() + play_cinematic_sound(sound(SScredits.title_music)) + SScredits.roll_credits_for_clients(watching) + + special_callback?.Invoke() + +/obj/screen/cinematic/credits + icon = 'icons/mob/screen_gen.dmi' + icon_state = "black" + screen_loc = "WEST,SOUTH to EAST,NORTH" + plane = SPLASHSCREEN_PLANE + diff --git a/modular_ss220/cinematics/code/~undefs.dm b/modular_ss220/cinematics/code/~undefs.dm new file mode 100644 index 000000000000..bd73789f9570 --- /dev/null +++ b/modular_ss220/cinematics/code/~undefs.dm @@ -0,0 +1 @@ +#undef COMSIG_GLOB_CINEMATIC_STOPPED_PLAYING diff --git a/modular_ss220/credits/code/SScredits.dm b/modular_ss220/credits/code/SScredits.dm index 89d06edf8084..17b9b2e9fb45 100644 --- a/modular_ss220/credits/code/SScredits.dm +++ b/modular_ss220/credits/code/SScredits.dm @@ -1,4 +1,3 @@ -#define CREDITS_BACKGROUND_PLANE 25 #define CREDITS_PLANE 26 SUBSYSTEM_DEF(credits) @@ -17,27 +16,20 @@ SUBSYSTEM_DEF(credits) credit_animate_height = 14 * world.icon_size title_music = pick(file2list("config/credits/sounds/title_music.txt")) -/datum/controller/subsystem/credits/proc/roll_credits_for_all_clients() - for(var/client/client in GLOB.clients) +/datum/controller/subsystem/credits/proc/roll_credits_for_clients(list/clients) + if(!length(end_titles)) + end_titles = generate_titles() + + for(var/client/client in clients) SScredits.roll_credits(client) /datum/controller/subsystem/credits/proc/roll_credits(client/client) LAZYINITLIST(client.credits) - if(end_titles) - end_titles = generate_titles() - - addtimer(CALLBACK(src, PROC_REF(roll_credits_for_client), client), 30 SECONDS, TIMER_CLIENT_TIME) - -/datum/controller/subsystem/credits/proc/roll_credits_for_client(client/client) var/list/_credits = client.credits - if(client.mob) - client.mob.overlay_fullscreen("black",/obj/screen/fullscreen/black) - SEND_SOUND(client, sound(title_music, repeat = FALSE, wait = FALSE, volume = 85 * client.prefs.get_channel_volume(CHANNEL_LOBBYMUSIC), channel = CHANNEL_LOBBYMUSIC)) - for(var/item in end_titles) - if(!client.credits) + if(!client?.credits) return var/obj/screen/credit/title = new(null, item, client) _credits += title @@ -47,9 +39,9 @@ SUBSYSTEM_DEF(credits) addtimer(CALLBACK(src, PROC_REF(clear_credits), client), (credit_roll_speed), TIMER_CLIENT_TIME) /datum/controller/subsystem/credits/proc/clear_credits(client/client) + if(!client) + return QDEL_NULL(client.credits) - client.mob.clear_fullscreen("black") - SEND_SOUND(client, sound(null, repeat = FALSE, wait = FALSE, volume = 85 * client.prefs.get_channel_volume(CHANNEL_LOBBYMUSIC), channel = CHANNEL_LOBBYMUSIC)) /datum/controller/subsystem/credits/proc/generate_titles() RETURN_TYPE(/list) @@ -151,26 +143,19 @@ SUBSYSTEM_DEF(credits) return titles - -/obj/screen/fullscreen/black - icon = 'icons/mob/screen_gen.dmi' - icon_state = "black" - screen_loc = "WEST,SOUTH to EAST,NORTH" - plane = CREDITS_BACKGROUND_PLANE - show_when_dead = TRUE - - /obj/screen/credit icon_state = "blank" mouse_opacity = 0 alpha = 0 screen_loc = "CENTER-7,CENTER-7" plane = CREDITS_PLANE - var/client/parent + var/matrix/target + var/client/parent /obj/screen/credit/Initialize(mapload, credited, client/client) . = ..() + parent = client maptext = {"
[credited]
"} maptext_height = world.icon_size * 2 @@ -196,7 +181,9 @@ SUBSYSTEM_DEF(credits) parent = null return ..() + + + /client/var/list/credits #undef CREDITS_PLANE -#undef CREDITS_BACKGROUND_PLANE