-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathantag_helpers.dm
48 lines (46 loc) · 1.72 KB
/
antag_helpers.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
//Returns MINDS of the assigned antags of given type/subtypes
/proc/get_antag_minds(antag_type,specific = FALSE)
RETURN_TYPE(/list/datum/mind)
. = list()
for(var/datum/antagonist/A in GLOB.antagonists)
if(!A.owner)
continue
if(!antag_type || !specific && istype(A,antag_type) || specific && A.type == antag_type)
. += A.owner
//Get all teams [of type team_type]
/proc/get_all_teams(team_type)
. = list()
for(var/V in GLOB.antagonists)
var/datum/antagonist/A = V
if(!A.owner)
continue
var/datum/team/T = A.get_team()
if(!team_type || istype(T,team_type))
. |= T
/// From a list of players (minds, mobs or clients), finds the one with the highest playtime (either from a specific role or overall living) and returns it.
/proc/get_most_experienced(list/players, specific_role)
if(!CONFIG_GET(flag/use_exp_tracking)) //woops
return
var/most_experienced
for(var/player in players)
if(!most_experienced)
most_experienced = player
continue
var/client/player_client = get_player_client(player)
if(!player_client?.prefs || !length(player_client.prefs.exp))
continue
var/client/most_played = get_player_client(most_experienced)
if(!most_played?.prefs || !length(most_played.prefs.exp))
most_experienced = player
continue
var/player_playtime
var/most_playtime
if(specific_role)
player_playtime = player_client.prefs.exp[specific_role] ? text2num(player_client.prefs.exp[specific_role]) : 0
most_playtime = most_played.prefs.exp[specific_role] ? text2num(most_played.prefs.exp[specific_role]) : 0
else
player_playtime = player_client.get_exp_living(TRUE)
most_playtime = most_played.get_exp_living(TRUE)
if(player_playtime > most_playtime)
most_experienced = player
return most_experienced