-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathcredits.dm
70 lines (64 loc) · 2.12 KB
/
credits.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#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"
/client/proc/RollCredits()
set waitfor = FALSE
if(!fexists(CREDITS_PATH))
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))
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)
if(!credits)
return
_credits += new /atom/movable/screen/credit(null, I, src, credits_icon)
sleep(CREDIT_SPAWN_SPEED)
sleep(CREDIT_ROLL_SPEED - CREDIT_SPAWN_SPEED)
remove_verb(src, /client/proc/ClearCredits)
qdel(credits_icon)
/client/proc/ClearCredits()
set name = "Hide Credits"
set category = "OOC"
remove_verb(src, /client/proc/ClearCredits)
QDEL_LIST(credits)
credits = null
/atom/movable/screen/credit
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
alpha = 0
screen_loc = "12,1"
plane = SPLASHSCREEN_PLANE
var/client/parent
var/matrix/target
/atom/movable/screen/credit/Initialize(mapload, credited, client/P, icon/I)
. = ..()
icon = I
parent = P
icon_state = credited
maptext = MAPTEXT(credited)
maptext_x = world.icon_size + 8
maptext_y = (world.icon_size / 2) - 4
maptext_width = world.icon_size * 3
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
/atom/movable/screen/credit/Destroy()
icon = null
if(parent)
parent.screen -= src
LAZYREMOVE(parent.credits, src)
parent = null
return ..()
/atom/movable/screen/credit/proc/FadeOut()
animate(src, alpha = 0, transform = target, time = CREDIT_EASE_DURATION)