Skip to content

Commit

Permalink
очередной фикс титров (#447)
Browse files Browse the repository at this point in the history
<!-- Пишите **НИЖЕ** заголовков и **ВЫШЕ** комментариев, иначе что то
может пойти не так. -->
<!-- Вы можете прочитать Contributing.MD, если хотите узнать больше. -->

## Что этот PR делает

<!-- Вкратце опишите изменения, которые вносите. -->
<!-- Опишите **все** изменения, так как противное может сказаться на
рассмотрении этого PR'а! -->
<!-- Если вы исправляете Issue, добавьте "Fixes #1234" (где 1234 - номер
Issue) где-нибудь в описании PR'а. Это автоматически закроет Issue после
принятия PR'а. -->

## Почему это хорошо для игры

<!-- Опишите, почему, по вашему, следует добавить эти изменения в игру.
-->

## Изображения изменений
<!-- Если вы не меняли карту или спрайты, можете опустить эту секцию.
Если хотите, можете вставить видео. -->

## Тестирование
<!-- Как вы тестировали свой PR, если делали это вовсе? -->

## Changelog

:cl:
fix: вы совершенно точно можете быть уверены что титры работают
/:cl:

<!-- Оба :cl:'а должны быть на месте, что-бы чейнджлог работал! Вы
можете написать свой ник справа от первого :cl:, если хотите. Иначе
будет использован ваш ник на ГитХабе. -->
<!-- Вы можете использовать несколько записей с одинаковым префиксом
(Они используются только для иконки в игре) и удалить ненужные. Помните,
что чейнджлог должен быть понятен обычным игроком. -->
<!-- Если чейнджлог не влияет на игроков(например, это рефактор), вы
можете исключить всю секцию. -->

---------

Co-authored-by: Gaxeer <[email protected]>
  • Loading branch information
Legendaxe and Gaxeer authored Oct 16, 2023
1 parent 5a84602 commit 35a8769
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 28 deletions.
2 changes: 1 addition & 1 deletion code/controllers/subsystem/SSticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions modular_ss220/cinematics/_cinematics.dme
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#include "_cinematics.dm"

#include "code/_defines.dm"
#include "code/_cinematics.dm"
#include "code/cinematics_client_proc.dm"
#include "code/cinematics_screen.dm"
#include "code/cinematics_ticker.dm"
#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"
2 changes: 2 additions & 0 deletions modular_ss220/cinematics/code/_cinematics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions modular_ss220/cinematics/code/_defines.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define COMSIG_GLOB_CINEMATIC_STOPPED_PLAYING "!cinematic_waiting_to_play"
32 changes: 32 additions & 0 deletions modular_ss220/cinematics/code/cinematics/credits.dm
Original file line number Diff line number Diff line change
@@ -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

1 change: 1 addition & 0 deletions modular_ss220/cinematics/code/~undefs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#undef COMSIG_GLOB_CINEMATIC_STOPPED_PLAYING
41 changes: 14 additions & 27 deletions modular_ss220/credits/code/SScredits.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define CREDITS_BACKGROUND_PLANE 25
#define CREDITS_PLANE 26

SUBSYSTEM_DEF(credits)
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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 = {"<div style="font:'Small Fonts'">[credited]</div>"}
maptext_height = world.icon_size * 2
Expand All @@ -196,7 +181,9 @@ SUBSYSTEM_DEF(credits)
parent = null
return ..()




/client/var/list/credits

#undef CREDITS_PLANE
#undef CREDITS_BACKGROUND_PLANE

0 comments on commit 35a8769

Please sign in to comment.