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

Round End Credits #439

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
65403f1
First Commit
RengaN02 Jan 17, 2025
4e1b129
bişeyler
RengaN02 Jan 18, 2025
63e13f7
az kaldı sanırım
RengaN02 Jan 28, 2025
774b443
Deadminlerde gözüksün
RengaN02 Jan 29, 2025
645c5cf
Bitmedi daha
RengaN02 Jan 31, 2025
f8dba89
Rare olayına gerek yok, bi tek ui kaldı
RengaN02 Jan 31, 2025
c3bb2a7
uiye gerek yok bu yeterli
RengaN02 Jan 31, 2025
d93d765
recordsu varsa ordaki iş adını alsın yoksa idsindeki adı
RengaN02 Jan 31, 2025
0521ca9
Merge branch 'master' of https://github.com/RengaN02/PsychonautStatio…
RengaN02 Jan 31, 2025
0c19600
Merge branch 'master' of https://github.com/RengaN02/PsychonautStatio…
RengaN02 Jan 31, 2025
2630368
Böyle daha iyi gibi
RengaN02 Jan 31, 2025
1c6e515
Liste boşsa gerek yok
RengaN02 Jan 31, 2025
0f6f16a
Sadece deneme için kaldırıyorum
RengaN02 Jan 31, 2025
82a87fe
Merge branch 'master' into credits
RengaN02 Jan 31, 2025
f0edb3b
Alakasızmış
RengaN02 Jan 31, 2025
b37ddf9
Bu fixler umarım
RengaN02 Jan 31, 2025
775497d
Merge branch 'credits' of https://github.com/RengaN02/PsychonautStati…
RengaN02 Jan 31, 2025
9e1a1b2
bunları neden eklemişimki
RengaN02 Jan 31, 2025
88f098d
Apiden patronları çeker
RengaN02 Feb 2, 2025
42f3f3a
6 kişi gözükcek tek sırada, yazılar artık üst üste düşmüyor.
RengaN02 Feb 3, 2025
63c953e
Böyle daha iyi
RengaN02 Feb 3, 2025
0e86500
ckey(ckey) e gerek yok sanırım
RengaN02 Feb 3, 2025
02975e9
Merge branch 'master' into credits
RengaN02 Feb 3, 2025
3b3e146
adminler içinde ekledim localde guestten girince kaydetmesin diye
RengaN02 Feb 4, 2025
8414345
Merge branch 'credits' of https://github.com/RengaN02/PsychonautStati…
RengaN02 Feb 4, 2025
9977e61
Merge branch 'master' into credits
RengaN02 Feb 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
#define INIT_ORDER_MINOR_MAPPING -40
#define INIT_ORDER_PATH -50
#define INIT_ORDER_EXPLOSIONS -69
#define INIT_ORDER_CREDITS -93
#define INIT_ORDER_STATPANELS -97
#define INIT_ORDER_BAN_CACHE -98
#define INIT_ORDER_INIT_PROFILER -99 //Near the end, logs the costs of initialize
Expand Down
20 changes: 15 additions & 5 deletions code/__HELPERS/roundend.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#define POPCOUNT_SURVIVORS "survivors" //Not dead at roundend
#define POPCOUNT_ESCAPEES "escapees" //Not dead and on centcom/shuttles marked as escaped
#define POPCOUNT_ESCAPEES_HUMANONLY "human_escapees"
#define POPCOUNT_ESCAPEES_HUMANONLY_LIST "human_escapees_list"
#define POPCOUNT_SHUTTLE_ESCAPEES "shuttle_escapees" //Emergency shuttle only.
#define POPCOUNT_STATION_INTEGRITY "station_integrity"
#define PERSONAL_LAST_ROUND "personal last round"
#define SERVER_LAST_ROUND "server last round"

Expand All @@ -14,7 +17,9 @@ GLOBAL_LIST_INIT(achievements_unlocked, list())
var/list/file_data = list("escapees" = list("humans" = list(), "silicons" = list(), "others" = list(), "npcs" = list()), "abandoned" = list("humans" = list(), "silicons" = list(), "others" = list(), "npcs" = list()), "ghosts" = list(), "additional data" = list())
var/num_survivors = 0 //Count of non-brain non-eye mobs with mind that are alive
var/num_escapees = 0 //Above and on centcom z
var/num_shuttle_escapees = 0 //Above and on escape shuttle
var/num_human_escapees = 0 //Above but humans only
var/num_shuttle_escapees = 0 //Above's above and on escape shuttle
var/list/list_of_human_escapees = list() //References to all escaped humans
var/list/area/shuttle_areas
if(SSshuttle?.emergency)
shuttle_areas = SSshuttle.emergency.shuttle_areas
Expand All @@ -39,6 +44,9 @@ GLOBAL_LIST_INIT(achievements_unlocked, list())
escape_status = "escapees"
if(shuttle_areas[get_area(M)])
num_shuttle_escapees++
if(ishuman(M))
num_human_escapees++
list_of_human_escapees += M
if(isliving(M))
var/mob/living/L = M
mob_data["location"] = get_area(L)
Expand Down Expand Up @@ -91,8 +99,8 @@ GLOBAL_LIST_INIT(achievements_unlocked, list())

var/datum/station_state/end_state = new /datum/station_state()
end_state.count()
var/station_integrity = min(PERCENT(GLOB.start_state.score(end_state)), 100)
file_data["additional data"]["station integrity"] = station_integrity
var/roundend_station_integrity = min(PERCENT(GLOB.start_state.score(end_state)), 100)
file_data["additional data"]["station integrity"] = roundend_station_integrity
WRITE_FILE(json_file, json_encode(file_data))

SSblackbox.record_feedback("nested tally", "round_end_stats", num_survivors, list("survivors", "total"))
Expand All @@ -102,8 +110,10 @@ GLOBAL_LIST_INIT(achievements_unlocked, list())
. = list()
.[POPCOUNT_SURVIVORS] = num_survivors
.[POPCOUNT_ESCAPEES] = num_escapees
.[POPCOUNT_ESCAPEES_HUMANONLY] = num_human_escapees
.[POPCOUNT_SHUTTLE_ESCAPEES] = num_shuttle_escapees
.["station_integrity"] = station_integrity
.[POPCOUNT_ESCAPEES_HUMANONLY_LIST] = list_of_human_escapees
.[POPCOUNT_STATION_INTEGRITY] = roundend_station_integrity

/datum/controller/subsystem/ticker/proc/gather_antag_data()
var/team_gid = 1
Expand Down Expand Up @@ -220,6 +230,7 @@ GLOBAL_LIST_INIT(achievements_unlocked, list())
LAZYCLEARLIST(round_end_events)

var/speed_round = (STATION_TIME_PASSED() <= 10 MINUTES)
popcount = gather_roundend_feedback()

for(var/client/C in GLOB.clients)
if(!C?.credits)
Expand All @@ -229,7 +240,6 @@ GLOBAL_LIST_INIT(achievements_unlocked, list())
C?.give_award(/datum/award/achievement/misc/speed_round, C?.mob)
HandleRandomHardcoreScore(C)

var/popcount = gather_roundend_feedback()
display_report(popcount)

CHECK_TICK
Expand Down
145 changes: 125 additions & 20 deletions code/_onclick/hud/credits.dm
Original file line number Diff line number Diff line change
@@ -1,28 +1,96 @@
#define CREDIT_ROLL_SPEED 125
#define CREDIT_SPAWN_SPEED 10
#define CREDIT_ANIMATE_HEIGHT (14 * ICON_SIZE_Y)
#define CREDIT_EASE_DURATION 22
#define CREDIT_ROLL_SPEED 9 SECONDS
#define CREDIT_SPAWN_SPEED 1 SECONDS
#define CREDIT_ANIMATE_HEIGHT (16 * world.icon_size)
#define CREDIT_EASE_DURATION 2.2 SECONDS
#define CREDITS_PATH "[global.config.directory]/contributors.dmi"

RengaN02 marked this conversation as resolved.
Show resolved Hide resolved
/client/proc/RollCredits()
set waitfor = FALSE
if(!fexists(CREDITS_PATH))
if(!fexists(CREDITS_PATH) || !prefs?.read_preference(/datum/preference/toggle/show_roundend_credits))
return
var/icon/credits_icon = new(CREDITS_PATH)
LAZYINITLIST(credits)
var/list/_credits = credits
add_verb(src, /client/proc/ClearCredits)
var/static/list/credit_order_for_this_round
if(isnull(credit_order_for_this_round))
RengaN02 marked this conversation as resolved.
Show resolved Hide resolved
credit_order_for_this_round = list("Thanks for playing!") + (shuffle(icon_states(credits_icon)) - "Thanks for playing!")
SScredits.draft()
SScredits.finalize()
credit_order_for_this_round = list()
credit_order_for_this_round += SScredits.episode_string
credit_order_for_this_round += ""
credit_order_for_this_round += SScredits.disclaimers_string
credit_order_for_this_round += SScredits.cast_string
var/list/admins = shuffle(SScredits.admin_pref_icons)
var/admins_length = length(admins)
var/y_offset = 0
if(admins_length)
credit_order_for_this_round += "<center>The Admin Bus</center>"
for(var/i in 1 to admins_length)
var/x_offset = -16
for(var/b in 1 to 6)
var/atom/movable/screen/map_view/char_preview/picked = pick_n_take(admins)
if(!picked)
break
picked.pixel_x = x_offset
picked.pixel_y = y_offset
x_offset += 96
credit_order_for_this_round += picked

var/list/patrons = shuffle(SScredits.patrons_pref_icons)
var/patrons_length = length(patrons)
if(patrons_length)
credit_order_for_this_round += "<center>Our Lovely Patrons</center>"
for(var/i in 1 to patrons_length)
var/x_offset = -16
for(var/b in 1 to 6)
var/atom/movable/screen/map_view/char_preview/picked = pick_n_take(patrons)
if(!picked)
break
picked.pixel_x = x_offset
picked.pixel_y = y_offset
x_offset += 96
credit_order_for_this_round += picked

for(var/obj/effect/title_card_object/MA as anything in SScredits.major_event_icons)
credit_order_for_this_round += MA
var/list/antagonist_icons = SScredits.major_event_icons[MA]
for(var/i in 1 to length(antagonist_icons))
var/x_offset = -16
for(var/b in 1 to 6)
if(!length(antagonist_icons))
break
var/reference = pick(antagonist_icons)
var/atom/movable/screen/map_view/char_preview/picked = antagonist_icons[reference]
antagonist_icons -= reference
if(!picked)
break
picked.pixel_x = x_offset
picked.pixel_y = y_offset
x_offset += 96
credit_order_for_this_round += picked


var/count = 0
for(var/I in credit_order_for_this_round)
if(!credits)
return
_credits += new /atom/movable/screen/credit(null, null, I, src, credits_icon)
sleep(CREDIT_SPAWN_SPEED)
if(istype(I, /obj/effect/title_card_object)) //huge image sleep
sleep(CREDIT_SPAWN_SPEED * 3.3)
count = 0
if(count && !istype(I, /atom/movable/screen/map_view/char_preview))
sleep(CREDIT_SPAWN_SPEED)

_credits += new /atom/movable/screen/credit(null, null, I, src)
if(istype(I, /atom/movable/screen/map_view/char_preview))
count++
if(count >= 6)
count = 0
sleep(CREDIT_SPAWN_SPEED)
if(!istype(I, /atom/movable/screen/map_view/char_preview))
sleep(CREDIT_SPAWN_SPEED)
count = 0
sleep(CREDIT_ROLL_SPEED - CREDIT_SPAWN_SPEED)
remove_verb(src, /client/proc/ClearCredits)
qdel(credits_icon)

/client/proc/ClearCredits()
set name = "Hide Credits"
Expand All @@ -34,29 +102,66 @@
/atom/movable/screen/credit
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
alpha = 0
screen_loc = "12,1"
plane = SPLASHSCREEN_PLANE
screen_loc = "3,1"
var/client/parent
var/matrix/target

/atom/movable/screen/credit/Initialize(mapload, datum/hud/hud_owner, credited, client/P, icon/I)
/atom/movable/screen/credit/Initialize(mapload, datum/hud/hud_owner, credited, client/P)
. = ..()
icon = I
icon = CREDITS_PATH
parent = P
icon_state = credited
maptext = MAPTEXT_PIXELLARI(credited)
maptext_x = ICON_SIZE_X + 8
maptext_y = (ICON_SIZE_Y / 2) - 4
maptext_width = ICON_SIZE_X * 3
var/view = P?.view
var/list/offsets = screen_loc_to_offset("3,1", view)

if(istype(credited, /atom/movable/screen/map_view/char_preview))
var/atom/movable/screen/map_view/char_preview/choice = credited
choice.plane = plane
choice.screen_loc = screen_loc
choice.alpha = alpha
maptext_width = choice.maptext_width
maptext = choice.maptext
appearance = choice.appearance
screen_loc = offset_to_screen_loc(offsets[1] + choice.pixel_x, offsets[2] + choice.pixel_y)
add_overlay(choice)

if(istype(credited, /mutable_appearance))
var/mutable_appearance/choice = credited
choice.plane = plane
choice.screen_loc = screen_loc
choice.alpha = alpha
maptext_width = choice.maptext_width
maptext = choice.maptext
appearance = choice.appearance
screen_loc = offset_to_screen_loc(offsets[1] + choice.pixel_x, offsets[2] + choice.pixel_y)
add_overlay(choice)

if(istype(credited, /obj/effect/title_card_object))
var/obj/effect/title_card_object/choice = credited
choice.plane = plane
choice.screen_loc = screen_loc
choice.alpha = alpha
maptext_width = choice.maptext_width
maptext = choice.maptext
appearance = choice.appearance
screen_loc = offset_to_screen_loc(offsets[1] + choice.pixel_x, offsets[2] + choice.pixel_y)
add_overlay(choice)

if(istext(credited))
maptext = MAPTEXT_PIXELLARI(credited)
maptext_x = world.icon_size + 8
maptext_y = (world.icon_size / 2) - 4
maptext_width = world.icon_size * 12
maptext_height = world.icon_size * 2

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_REF(FadeOut)), CREDIT_ROLL_SPEED - CREDIT_EASE_DURATION)
QDEL_IN(src, CREDIT_ROLL_SPEED)
if(parent)
parent.screen += src
parent?.screen += src

/atom/movable/screen/credit/Destroy()
icon = null
Expand Down
Loading
Loading