Skip to content

Commit

Permalink
Oracle Credits
Browse files Browse the repository at this point in the history
  • Loading branch information
qwertyquerty authored and MarkSuckerberg committed Jan 9, 2020
1 parent 3de90a9 commit 04d9a80
Show file tree
Hide file tree
Showing 14 changed files with 326 additions and 26 deletions.
72 changes: 49 additions & 23 deletions code/_onclick/hud/credits.dm
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
#define CREDIT_ROLL_SPEED 125
#define CREDIT_SPAWN_SPEED 10
#define CREDIT_ANIMATE_HEIGHT (14 * world.icon_size)
#define CREDIT_EASE_DURATION 22
#define CREDITS_PATH "[global.config.directory]/contributors.dmi"
#define CREDIT_ROLL_SPEED 115
#define CREDIT_SPAWN_SPEED 8
#define CREDIT_ANIMATE_HEIGHT (13 * world.icon_size)
#define CREDIT_EASE_DURATION 20

GLOBAL_LIST(end_titles)

/client/proc/RollCredits()
set waitfor = FALSE
if(!fexists(CREDITS_PATH))
return
var/icon/credits_icon = new(CREDITS_PATH)
if(!GLOB.end_titles)
GLOB.end_titles = SSticker.mode.generate_credit_text()
GLOB.end_titles += "<center><h1>Thanks for playing!</h1>"
LAZYINITLIST(credits)
var/list/_credits = credits
verbs += /client/proc/ClearCredits
var/static/list/credit_order_for_this_round
if(isnull(credit_order_for_this_round))
credit_order_for_this_round = list("Thanks for playing!") + (shuffle(icon_states(credits_icon)) - "Thanks for playing!")
for(var/I in credit_order_for_this_round)
_credits += new /obj/screen/credit/title_card(null, null, src, SSticker.mode.title_icon)
sleep(CREDIT_SPAWN_SPEED * 3)
for(var/I in GLOB.end_titles)
if(!credits)
return
_credits += new /obj/screen/credit(null, I, src, credits_icon)
_credits += new /obj/screen/credit(null, I, src)
sleep(CREDIT_SPAWN_SPEED)
sleep(CREDIT_ROLL_SPEED - CREDIT_SPAWN_SPEED)
ClearCredits()
verbs -= /client/proc/ClearCredits
qdel(credits_icon)

/client/proc/ClearCredits()
set name = "Hide Credits"
set category = "OOC"
verbs -= /client/proc/ClearCredits
QDEL_LIST(credits)
credits = null

/obj/screen/credit
icon_state = "blank"
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
alpha = 0
screen_loc = "12,1"
screen_loc = "2,2"
layer = SPLASHSCREEN_LAYER
var/client/parent
var/matrix/target
Expand All @@ -43,27 +43,53 @@
. = ..()
icon = I
parent = P
icon_state = credited
maptext = credited
maptext_x = world.icon_size + 8
maptext_y = (world.icon_size / 2) - 4
maptext_width = world.icon_size * 3
maptext_height = world.icon_size * 2
maptext_width = world.icon_size * 13
var/matrix/M = matrix(transform)
M.Translate(0, CREDIT_ANIMATE_HEIGHT)
animate(src, transform = M, time = CREDIT_ROLL_SPEED)
target = M
animate(src, alpha = 255, time = CREDIT_EASE_DURATION, flags = ANIMATION_PARALLEL)
addtimer(CALLBACK(src, .proc/FadeOut), CREDIT_ROLL_SPEED - CREDIT_EASE_DURATION)
spawn(CREDIT_ROLL_SPEED - CREDIT_EASE_DURATION)//addtimer doesn't work for more time-critical operations
FadeOut()
QDEL_IN(src, CREDIT_ROLL_SPEED)
P.screen += src

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

/obj/screen/credit/proc/FadeOut()
animate(src, alpha = 0, transform = target, time = CREDIT_EASE_DURATION)

/obj/screen/credit/title_card
icon = 'icons/title_cards.dmi'
screen_loc = "4,1"

/obj/screen/credit/title_card/Initialize(mapload, credited, client/P, title_icon_state)
icon_state = title_icon_state
. = ..()
maptext = null

/* CURSE YOU BYOND, LET ME DO HTTPS REQUESTS
/proc/get_patrons()
var/list/patrons = list()
var/list/http[] = world.Export("https://www.patreon.com/api/campaigns/[]/pledges?include=patron.null")
if (http)
var/status = text2num(http["STATUS"])
if (status == 200)
var/response = json_decode(file2text(http["CONTENT"]))
if (response)
for(var/item in response["included"])
if(item["type"] == "user")
patrons |= user["attributes"]["full_name"]
return patrons.len ? patrons : null
*/
20 changes: 20 additions & 0 deletions code/game/gamemodes/changeling/changeling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ GLOBAL_VAR(changeling_team_objective_type) //If this is not null, we hand our th
<span class='green'>Changelings</span>: Accomplish the objectives assigned to you.\n\
<span class='notice'>Crew</span>: Root out and eliminate the changeling menace."

title_icon = "changeling"

var/const/changeling_amount = 4 //hard limit on changelings if scaling is turned off
var/list/changelings = list()

Expand Down Expand Up @@ -138,3 +140,21 @@ GLOBAL_VAR(changeling_team_objective_type) //If this is not null, we hand our th
user.equip_to_slot_or_del(C, GLOB.slot2slot[slot])

user.regenerate_icons()


/datum/game_mode/changeling/generate_credit_text()
var/list/round_credits = list()
var/len_before_addition

round_credits += "<center><h1>The Slippery Changelings:</h1>"
len_before_addition = round_credits.len
for(var/datum/mind/M in changelings)
var/datum/antagonist/changeling/cling = M.has_antag_datum(/datum/antagonist/changeling)
if(cling)
round_credits += "<center><h2>[cling.changelingID] in the body of [M.name]</h2>"
if(len_before_addition == round_credits.len)
round_credits += list("<center><h2>Uh oh, we lost track of the shape shifters!</h2>", "<center><h2>Nobody move!</h2>")
round_credits += "<br>"

round_credits += ..()
return round_credits
24 changes: 24 additions & 0 deletions code/game/gamemodes/cult/cult.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
<span class='cult'>Cultists</span>: Carry out Nar'Sie's will.\n\
<span class='notice'>Crew</span>: Prevent the cult from expanding and drive it out."

title_icon = "cult"

var/finished = 0

var/acolytes_needed = 10 //for the survive objective
Expand Down Expand Up @@ -157,4 +159,26 @@
devoted to stopping this cult. Note that holy water seems to weaken and eventually return the minds of cultists that ingest it, and mindshield implants will prevent conversion \
altogether."



/datum/game_mode/cult/generate_credit_text()
var/list/round_credits = list()
var/len_before_addition

round_credits += "<center><h1>The Cult of Nar'Sie:</h1>"
len_before_addition = round_credits.len
for(var/datum/mind/cultist in cult)
round_credits += "<center><h2>[cultist.name] as a cult fanatic</h2>"

var/datum/objective/eldergod/summon_objective = locate() in main_cult.objectives
if(summon_objective && summon_objective.summoned)
round_credits += "<center><h2>Nar'Sie as the eldritch abomination</h2>"

if(len_before_addition == round_credits.len)
round_credits += list("<center><h2>The cultists have learned the danger of eldritch magic!</h2>", "<center><h2>They all disappeared!</h2>")
round_credits += "<br>"

round_credits += ..()
return round_credits

#undef CULT_SCALING_COEFFICIENT
20 changes: 20 additions & 0 deletions code/game/gamemodes/devil/devil_game_mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
recommended_enemies = 4
reroll_friendly = 1
enemy_minimum_age = 0
title_icon = "devil"

var/traitors_possible = 4 //hard limit on devils if scaling is turned off
var/num_modifier = 0 // Used for gamemodes, that are a child of traitor, that need more than the usual.
Expand Down Expand Up @@ -84,3 +85,22 @@
var/datum/antagonist/devil_datum = L.mind.has_antag_datum(/datum/antagonist/devil)
devil_datum.on_removal()
return TRUE

/datum/game_mode/devil/generate_credit_text()
var/list/round_credits = list()
var/len_before_addition

round_credits += "<center><h1>The Tempting Devils:</h1>"
len_before_addition = round_credits.len
var/datum/antagonist/devil/devil_info
for(var/datum/mind/devil in devils)
devil_info = devil.has_antag_datum(/datum/antagonist/devil)
if(devil_info) // This should never fail, but better to be sure
round_credits += "<center><h2>[devil_info.truename] in the form of [devil.name]</h2>"
devil_info = null
if(len_before_addition == round_credits.len)
round_credits += list("<center><h2>The devils were all utterly destroyed!</h2>", "<center><h2>The love of Space Jesus shines through!</h2>")
round_credits += "<br>"

round_credits += ..()
return round_credits
2 changes: 2 additions & 0 deletions code/game/gamemodes/extended/extended.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
announce_span = "notice"
announce_text = "Just have fun and enjoy the game!"

title_icon = "extended_white"

/datum/game_mode/extended/pre_setup()
return 1

Expand Down
133 changes: 131 additions & 2 deletions code/game/gamemodes/game_mode.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


/*
* GAMEMODES (by Rastaf0)
*
Expand Down Expand Up @@ -41,6 +39,9 @@
var/announce_span = "warning" //The gamemode's name will be in this span during announcement.
var/announce_text = "This gamemode forgot to set a descriptive text! Uh oh!" //Used to describe a gamemode when it's announced.

// title_icon and title_icon_state are used for the credits that roll at the end
var/title_icon

var/const/waittime_l = 600
var/const/waittime_h = 1800 // started at 1800

Expand Down Expand Up @@ -421,6 +422,40 @@
if(P.ready == PLAYER_READY_TO_PLAY)
. ++

////////////////////////////
//Keeps track of all heads//
////////////////////////////

/datum/game_mode/proc/get_living_by_department(var/department)
. = list()
for(var/mob/living/carbon/human/player in GLOB.mob_list)
if(player.stat != DEAD && player.mind && (player.mind.assigned_role in department))
. |= player.mind

/datum/game_mode/proc/get_all_by_department(var/department)
. = list()
for(var/mob/player in GLOB.mob_list)
if(player.mind && (player.mind.assigned_role in department))
. |= player.mind

/////////////////////////////////////////////
//Keeps track of all living silicon members//
/////////////////////////////////////////////
/datum/game_mode/proc/get_living_silicon()
. = list()
for(var/mob/living/silicon/player in GLOB.mob_list)
if(player.stat != DEAD && player.mind && (player.mind.assigned_role in GLOB.nonhuman_positions))
. |= player.mind

///////////////////////////////////////
//Keeps track of all silicon members //
///////////////////////////////////////
/datum/game_mode/proc/get_all_silicon()
. = list()
for(var/mob/living/silicon/player in GLOB.mob_list)
if(player.mind && (player.mind.assigned_role in GLOB.nonhuman_positions))
. |= player.mind

/proc/reopen_roundstart_suicide_roles()
var/list/valid_positions = list()
valid_positions += GLOB.engineering_positions
Expand Down Expand Up @@ -468,6 +503,7 @@

print_command_report(suicide_command_report, "Central Command Personnel Update")


//////////////////////////
//Reports player logouts//
//////////////////////////
Expand Down Expand Up @@ -594,3 +630,96 @@
/// Mode specific admin panel.
/datum/game_mode/proc/admin_panel()
return


/datum/game_mode/proc/generate_credit_text()
var/list/round_credits = list()
var/len_before_addition

// HEADS OF STAFF
round_credits += "<center><h1>The Glorious Command Staff:</h1>"
len_before_addition = round_credits.len
for(var/datum/mind/current in SSticker.mode.get_all_by_department(GLOB.command_positions))
round_credits += "<center><h2>[current.name] as the [current.assigned_role]</h2>"
if(round_credits.len == len_before_addition)
round_credits += list("<center><h2>A serious bureaucratic error has occurred!</h2>", "<center><h2>No one was in charge of the crew!</h2>")
round_credits += "<br>"

// SILICONS
round_credits += "<center><h1>The Silicon \"Intelligences\":</h1>"
len_before_addition = round_credits.len
for(var/datum/mind/current in SSticker.mode.get_all_silicon())
round_credits += "<center><h2>[current.name] as the [current.assigned_role]</h2>"
if(round_credits.len == len_before_addition)
round_credits += list("<center><h2>[station_name()] had no silicon helpers!</h2>", "<center><h2>Not a single door was opened today!</h2>")
round_credits += "<br>"

// SECURITY
round_credits += "<center><h1>The Brave Security Officers:</h1>"
len_before_addition = round_credits.len
for(var/datum/mind/current in SSticker.mode.get_all_by_department(GLOB.security_positions))
round_credits += "<center><h2>[current.name] as the [current.assigned_role]</h2>"
if(round_credits.len == len_before_addition)
round_credits += list("<center><h2>[station_name()] has fallen to Communism!</h2>", "<center><h2>No one was there to protect the crew!</h2>")
round_credits += "<br>"

// MEDICAL
round_credits += "<center><h1>The Wise Medical Department:</h1>"
len_before_addition = round_credits.len
for(var/datum/mind/current in SSticker.mode.get_all_by_department(GLOB.medical_positions))
round_credits += "<center><h2>[current.name] as the [current.assigned_role]</h2>"
if(round_credits.len == len_before_addition)
round_credits += list("<center><h2>Healthcare was not included!</h2>", "<center><h2>There were no doctors today!</h2>")
round_credits += "<br>"

// ENGINEERING
round_credits += "<center><h1>The Industrious Engineers:</h1>"
len_before_addition = round_credits.len
for(var/datum/mind/current in SSticker.mode.get_all_by_department(GLOB.engineering_positions))
round_credits += "<center><h2>[current.name] as the [current.assigned_role]</h2>"
if(round_credits.len == len_before_addition)
round_credits += list("<center><h2>[station_name()] probably did not last long!</h2>", "<center><h2>No one was holding the station together!</h2>")
round_credits += "<br>"

// SCIENCE
round_credits += "<center><h1>The Inventive Science Employees:</h1>"
len_before_addition = round_credits.len
for(var/datum/mind/current in SSticker.mode.get_all_by_department(GLOB.science_positions))
round_credits += "<center><h2>[current.name] as the [current.assigned_role]</h2>"
if(round_credits.len == len_before_addition)
round_credits += list("<center><h2>No one was doing \"science\" today!</h2>", "<center><h2>Everyone probably made it out alright, then!</h2>")
round_credits += "<br>"

// CARGO
round_credits += "<center><h1>The Rugged Cargo Crew:</h1>"
len_before_addition = round_credits.len
for(var/datum/mind/current in SSticker.mode.get_all_by_department(GLOB.supply_positions))
round_credits += "<center><h2>[current.name] as the [current.assigned_role]</h2>"
if(round_credits.len == len_before_addition)
round_credits += list("<center><h2>The station was freed from paperwork!</h2>", "<center><h2>No one worked in cargo today!</h2>")
round_credits += "<br>"

// CIVILIANS
var/list/human_garbage = list()
round_credits += "<center><h1>The Hardy Civilians:</h1>"
len_before_addition = round_credits.len
for(var/datum/mind/current in SSticker.mode.get_all_by_department(GLOB.civilian_positions))
if(current.assigned_role == "Assistant")
human_garbage += current
else
round_credits += "<center><h2>[current.name] as the [current.assigned_role]</h2>"
if(round_credits.len == len_before_addition)
round_credits += list("<center><h2>Everyone was stuck in traffic this morning!</h2>", "<center><h2>No civilians made it to work!</h2>")
round_credits += "<br>"

round_credits += "<center><h1>The Helpful Assistants:</h1>"
len_before_addition = round_credits.len
for(var/datum/mind/current in human_garbage)
round_credits += "<center><h2>[current.name]</h2>"
if(round_credits.len == len_before_addition)
round_credits += list("<center><h2>The station was free of <s>greytide</s> assistance!</h2>", "<center><h2>Not a single Assistant showed up on the station today!</h2>")

round_credits += "<br>"
round_credits += "<br>"

return round_credits
1 change: 1 addition & 0 deletions code/game/gamemodes/meteor/meteor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
announce_span = "danger"
announce_text = "A major meteor shower is bombarding the station! The crew needs to evacuate or survive the onslaught."

title_icon = "meteor"

/datum/game_mode/meteor/process()
if(nometeors || meteordelay > world.time - SSticker.round_start_time)
Expand Down
Loading

0 comments on commit 04d9a80

Please sign in to comment.