Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: Credits #424

Merged
merged 12 commits into from
Oct 14, 2023
Merged
2 changes: 2 additions & 0 deletions code/controllers/subsystem/SSticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ SUBSYSTEM_DEF(ticker)
ending_station_state.count()
var/station_integrity = min(round( 100.0 * GLOB.start_state.score(ending_station_state), 0.1), 100.0)

SScredits.roll_credits_for_all_clients()

to_chat(world, "<BR>[TAB]Shift Duration: <B>[round(ROUND_TIME / 36000)]:[add_zero("[ROUND_TIME / 600 % 60]", 2)]:[ROUND_TIME / 100 % 6][ROUND_TIME / 100 % 10]</B>")
to_chat(world, "<BR>[TAB]Station Integrity: <B>[mode.station_was_nuked ? "<font color='red'>Destroyed</font>" : "[station_integrity]%"]</B>")
to_chat(world, "<BR>")
Expand Down
9 changes: 9 additions & 0 deletions config/credits/jobs/staffjobs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Носильщик кофе
Оператор
Надоедливый крикун
Ответственный за лопату
Хореограф
Исторический консультант
Дизайнер костюмов
Главный редактор
Исполнительный директор
1 change: 1 addition & 0 deletions config/credits/sounds/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Чтобы добавить музыку к возможным вариантам - допишите путь к ogg файлу title_music.txt
Binary file added config/credits/sounds/space_asshole.ogg
Binary file not shown.
1 change: 1 addition & 0 deletions config/credits/sounds/title_music.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config/credits/sounds/space_asshole.ogg
11 changes: 11 additions & 0 deletions config/credits/titles/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
finished_titles:
Файл для готовых названий эпизода

random_titles_plural_2_X:
Файл для генерации названия эпизода из двух частей, обе части должны быть записаны в множественном числе

random_titles_neuter_2_X:
Файл для генерации названия эпизода из двух частей, обе части должны быть записаны в среднем роде

random_titles_crews_learns:
Файл для генерации названия эпизода в формате "ЭКИПАЖ УЗНАЕТ О [X]"
10 changes: 10 additions & 0 deletions config/credits/titles/finished_titles.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ПУШКИ! ПОВСЮДУ ПУШКИ!
МАЛЕНЬКИЙ ВОКСИК
ЧТО ПРОИСХОДИТ КОГДА БОХ ПОПАДАЕТ В ДРУГОЙ БОХ
БЕЙ! БЕЙ! БЕЙ!
СЕКС БОМБА
ЛЕГЕНДА О ДРЕВНЕМ АРТЕФАКТЕ: ЧАСТЬ I
ПОВОРОТ НЕ ТУДА
ОХОТА ЗА ЗЕЛЕНОЙ "КОЛБАСКОЙ"
ЧУЖОЙ ПРОТИВ ТОРГОВОГО АВТОМАТА
КОСМИЧЕСКИЕ ДАЛЬНОБОЙЩИКИ
12 changes: 12 additions & 0 deletions config/credits/titles/random_titles_crews_learns.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ЛЮБВИ
НАРКОТИКАХ
ОПАСНОСТИ УХОДА ОТ НАЛОГОВ
ЧУВСТВИТЕЛЬНОСТИ КСЕНОСОВ
МОШЕННИКАХ
КРУТЕНИИ
ЗАЩИТЕ ОТ РАДИЦИИ
САКРАЛЬНОЙ ГЕОМЕТРИИ
ТЕОРИИ СТРУН
АБСТРАКТНОЙ МАТЕМАТИКЕ
БРАЧНЫХ РИТУАЛАХ БИПСКИ
СИЛЕ ЗЕМЛИ
11 changes: 11 additions & 0 deletions config/credits/titles/random_titles_neuter_2_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
КОСМИЧЕСКОЕ
СЕКСУАЛЬНОЕ
ДРАКОНЬЕ
КОЛДУНСКОЕ
ПРАЧЕЧНОЕ
ОРУЖЕЙНОЕ
РЕКЛАМИРУЮЩЕЕ
СОБАЧЬЕ
УГАРНОЕ
ЧАРОДЕЙСКОЕ
ПОЛИТИЧЕСКОЕ
3 changes: 3 additions & 0 deletions config/credits/titles/random_titles_neuter_2_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ЗАДАНИЕ
ПРЕДЛОЖЕНИЕ
ПРИКЛЮЧЕНИЕ
8 changes: 8 additions & 0 deletions config/credits/titles/random_titles_plural_2_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ПАДЕНИЕ
ВОСТАНИЕ
ПРОБЛЕМЫ
ПОСЛЕДНЯЯ БИТВА
ТЕМНАЯ СТОРОНА
ОПУСТОШЕНИЕ
УНИЧТОЖЕНИЕ
КРИЗИС
14 changes: 14 additions & 0 deletions config/credits/titles/random_titles_plural_2_2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
КОСМОНАВТОВ
ЧЕЛОВЕЧЕСТВА
ДОСТОИНСТВА
РАЗУМА
ШИМПАНЗЕ
ТОРГОВЫХ АВТОМАТОВ
КРИСТАЛА СУПЕРМАТЕРИИ
МЕДБЕЯ
ИНЖЕНЕРНОГО ОТДЕЛА
СЛУЖБЫ БЕЗОПАСНОСТИ
ОТДЕЛА ИССЛЕДОВАНИЯ
ДЕПАРТАМЕНТА СЕРВИСА
КОМАНДНОГО ОТДЕЛА
ИССЛЕДОВАТЕЛЕЙ
4 changes: 4 additions & 0 deletions modular_ss220/credits/_credits.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/datum/modpack/credits
name = "Credits"
desc = "Добавление титров в конце раунда, основа кода была взята из данного репозитория https://github.com/Baystation12/Baystation12"
author = "Legendaxe"
3 changes: 3 additions & 0 deletions modular_ss220/credits/_credits.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "code\SScredits.dm"

#include "_credits.dm"
196 changes: 196 additions & 0 deletions modular_ss220/credits/code/SScredits.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
SUBSYSTEM_DEF(credits)
name = "Credits"
runlevels = RUNLEVEL_POSTGAME
flags = SS_NO_FIRE
var/list/end_titles = list()
var/title_music = ""

var/credit_roll_speed = 185
var/credit_spawn_speed = 20
var/credit_animate_height
var/credit_ease_duration = 22

/datum/controller/subsystem/credits/Initialize()
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)
SScredits.roll_credits(client)

/datum/controller/subsystem/credits/proc/roll_credits(client/client)
LAZYINITLIST(client.credits)

if(end_titles)
end_titles = generate_titles()

if(client.mob)
client.mob.overlay_fullscreen("black",/obj/screen/fullscreen/black)
SEND_SOUND(client, sound(title_music, repeat = 0, wait = 0, volume = 85 * client.prefs.get_channel_volume(CHANNEL_LOBBYMUSIC), channel = CHANNEL_LOBBYMUSIC))
Legendaxe marked this conversation as resolved.
Show resolved Hide resolved

addtimer(CALLBACK(src, PROC_REF(roll_credits_for_client), client), 5 SECONDS)

/datum/controller/subsystem/credits/proc/roll_credits_for_client(client/client)
var/list/_credits = client.credits

for(var/item in end_titles)
if(!client.credits)
return
var/obj/screen/credit/title = new(null, item, client)
_credits += title
title.rollem()
sleep(credit_spawn_speed)
Legendaxe marked this conversation as resolved.
Show resolved Hide resolved

addtimer(CALLBACK(src, PROC_REF(clear_credits), client), (credit_roll_speed))

/datum/controller/subsystem/credits/proc/clear_credits(client/client)
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)
var/list/titles = list()
var/list/cast = list()
var/list/chunk = list()
var/list/streamers = list()
var/chunksize = 0

var/episode_title = ""

switch(rand(1,100))

if(1 to 10)
episode_title += pick(file2list("config/credits/titles/finished_titles.txt"))
if(11 to 30)
episode_title += "ЭКИПАЖ УЗНАЕТ О " + pick(file2list("config/credits/titles/random_titles_crews_learns.txt"))
if(31 to 60)
episode_title += pick(file2list("config/credits/titles/random_titles_neuter_2_1.txt")) + " "
episode_title += pick(file2list("config/credits/titles/random_titles_neuter_2_2.txt"))
if(61 to 100)
episode_title += pick(file2list("config/credits/titles/random_titles_plural_2_1.txt")) + " "
episode_title += pick(file2list("config/credits/titles/random_titles_plural_2_2.txt"))

titles += "<center><h1>EPISODE [GLOB.round_id]<br>[episode_title]<h1></h1></h1></center>"

for(var/mob/living/carbon/human/human in GLOB.alive_mob_list | GLOB.dead_mob_list)
if(findtext(human.real_name,"(mannequin)"))
continue
if(ismonkeybasic(human))
continue
if(!human.last_known_ckey)
continue
if(human.client.holder.rank == "Банда")
streamers += "<center>[human.real_name]([human.ckey]) в роли [human.job]<br><center>"
continue
if(!length(cast) && !chunksize)
chunk += "В съемках участвовали:"
chunk += "[human.real_name] в роли [uppertext(human.job)]"
chunksize++
if(chunksize > 2)
cast += "<center>[jointext(chunk,"<br>")]</center>"
chunk.Cut()
chunksize = 0
if(length(chunk))
cast += "<center>[jointext(chunk,"<br>")]</center>"

if(length(streamers))
titles += "<center>Приглашенные звезды:</center><br>"
titles += streamers

titles += cast

var/list/corpses = list()

for(var/mob/living/carbon/human/human in GLOB.dead_mob_list)
if(!human.last_known_ckey)
continue
else if(human.real_name)
corpses += human.real_name

if(length(corpses))
titles += "<center>Основано на реальных событиях<br>В память о [english_list(corpses)].</center>"

var/list/staff = list("Съемочная группа:")
var/list/staffjobs = file2list("config/credits/jobs/staffjobs.txt")
var/list/goodboys = list()
for(var/client/client in GLOB.clients)
if(!client.holder)
continue

if(check_rights_client(R_DEBUG|R_ADMIN|R_MOD, FALSE, client))
staff += "[uppertext(pick(staffjobs))] - '[client.key]'"
else if(check_rights_client(R_MENTOR, FALSE, client))
goodboys += "[client.key]"

titles += "<center>[jointext(staff,"<br>")]</center>"
if(length(goodboys))
titles += "<center>Мальчики на побегушках:<br>[english_list(goodboys)]</center><br>"

var/disclaimer = "<br>Sponsored by WYCCSTATION.<br>All rights reserved.<br>\
This motion picture is protected under the copyright laws of the Sol Central Government<br> and other nations throughout the galaxy.<br>\
Colony of First Publication: [pick("Mars", "Luna", "Earth", "Venus", "Phobos", "Ceres", "Tiamat", "Ceti Epsilon", "Eos", "Pluto", "Ouere",\
"Tadmor", "Brahe", "Pirx", "Iolaus", "Saffar", "Gaia")].<br>"
disclaimer += pick("Use for parody prohibited. PROHIBITED.",
"All stunts were performed by underpaid interns. Do NOT try at home.",
"WYCCSTATION does not endorse behaviour depicted. Attempt at your own risk.",
"Any unauthorized exhibition, distribution, or copying of this film or any part thereof (including soundtrack)<br>\
may result in an ERT being called to storm your home and take it back by force.",
"The story, all names, characters, and incidents portrayed in this production are fictitious. No identification with actual<br>\
persons (living or deceased), places, buildings, and products is intended or should be inferred.<br>\
This film is based on a true story and all individuals depicted are based on real people, despite what we just said.",
"No person or entity associated with this film received payment or anything of value, or entered into any agreement, in connection<br>\
with the depiction of tobacco products, despite the copious amounts of smoking depicted within.<br>\
(This disclaimer sponsored by Carcinoma - Carcinogens are our Business!(TM)).",
"No animals were harmed in the making of this motion picture except for those listed previously as dead. Do not try this at home.")
titles += "<hr>"
titles += "<center><span style='font-size:6pt;'>[jointext(disclaimer, null)]</span></center>"

return titles


/obj/screen/fullscreen/black
icon = 'icons/mob/screen_gen.dmi'
icon_state = "black"
screen_loc = "WEST,SOUTH to EAST,NORTH"
layer = ABOVE_HUD_LAYER


/obj/screen/credit
icon_state = "blank"
mouse_opacity = 0
alpha = 0
screen_loc = "CENTER-7,CENTER-7"
plane = HUD_PLANE
layer = HUD_LAYER
var/client/parent
var/matrix/target

/obj/screen/credit/Initialize(mapload, credited, client/client)
. = ..()
parent = client
maptext = {"<div style="font:'Small Fonts'">[credited]</div>"}
maptext_height = world.icon_size * 2
maptext_width = world.icon_size * 14

/obj/screen/credit/proc/rollem()
var/matrix/M = matrix(transform)
M.Translate(0, SScredits.credit_animate_height)
animate(src, transform = M, time = SScredits.credit_roll_speed)
target = M
animate(src, alpha = 255, time = SScredits.credit_ease_duration, flags = ANIMATION_PARALLEL)
spawn(SScredits.credit_roll_speed - SScredits.credit_ease_duration)
if(!QDELETED(src))
animate(src, alpha = 0, transform = target, time = SScredits.credit_ease_duration)
sleep(SScredits.credit_ease_duration)
qdel(src)
parent.screen += src

/obj/screen/credit/Destroy()
if(parent)
parent.screen -= src
LAZYREMOVE(parent.credits, src)
parent = null
return ..()

/client/var/list/credits
10 changes: 10 additions & 0 deletions modular_ss220/modular_ss220.dme
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#include "text_to_speech/_tts.dme"
#include "title_screen/_title_screen.dme"
#include "whitelist/_whitelist.dme"
#include "credits/_credits.dme"

// --- PRIME --- //
// #define MODPACK_MAIN_ONLY
Expand All @@ -83,3 +84,12 @@
---------------------------------------------------------------------*/

// #include "crit_rework/_crit_rework.dme"
// BEGIN_INTERNALS
// END_INTERNALS
// BEGIN_FILE_DIR
#define FILE_DIR .
// END_FILE_DIR
// BEGIN_PREFERENCES
// END_PREFERENCES
// BEGIN_INCLUDE
// END_INCLUDE
Legendaxe marked this conversation as resolved.
Show resolved Hide resolved