This repository was archived by the owner on May 22, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 458
Expand file tree
/
Copy pathcheck_antagonists.dm
More file actions
204 lines (183 loc) · 7.64 KB
/
check_antagonists.dm
File metadata and controls
204 lines (183 loc) · 7.64 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
//I wish we had interfaces sigh, and i'm not sure giving team and antag common root is a better solution here
//Name shown on antag list
/datum/antagonist/proc/antag_listing_name()
if(!owner)
return "Unassigned"
if(owner.current)
return "<a href='byond://?_src_=holder;[HrefToken()];adminplayeropts=[REF(owner.current)]'>[owner.current.real_name]</a> "
else
return "<a href='byond://?_src_=vars;[HrefToken()];Vars=[REF(owner)]'>[owner.name]</a> "
//Whatever interesting things happened to the antag admins should know about
//Include additional information about antag in this part
/datum/antagonist/proc/antag_listing_status()
if(!owner)
return "(Unassigned)"
if(!owner.current)
return "<font color=red>(Body destroyed)</font>"
else
if(owner.current.stat == DEAD)
return "<font color=red>(DEAD)</font>"
else if(!owner.current.client && !owner.current.oobe_client) //yogs - oobe_client
return "(No client)"
//Builds the common FLW PM TP commands part
//Probably not going to be overwritten by anything but you never know
/datum/antagonist/proc/antag_listing_commands()
if(!owner)
return
var/list/parts = list()
parts += "<a href='byond://?priv_msg=[ckey(owner.key)]'>PM</a>"
if(owner.current) //There's body to follow
parts += "<a href='byond://?_src_=holder;[HrefToken()];adminplayerobservefollow=[REF(owner.current)]'>FLW</a>"
else
parts += ""
parts += "<a href='byond://?_src_=holder;[HrefToken()];traitor=[REF(owner)]'>Show Objective</a>"
return parts //Better as one cell or two/three
//Builds table row for the antag
// Jim (Status) FLW PM TP
/datum/antagonist/proc/antag_listing_entry()
var/list/parts = list()
if(show_name_in_check_antagonists)
parts += "[antag_listing_name()]([name])"
else
parts += antag_listing_name()
parts += antag_listing_status()
parts += antag_listing_commands()
return "<tr><td>[parts.Join("</td><td>")]</td></tr>"
/datum/team/proc/get_team_antags(antag_type,specific = FALSE)
. = list()
for(var/datum/antagonist/A in GLOB.antagonists)
if(A.get_team() == src && (!antag_type || !specific && istype(A,antag_type) || specific && A.type == antag_type))
. += A
//Builds section for the team
/datum/team/proc/antag_listing_entry()
//NukeOps:
// Jim (Status) FLW PM TP
// Joe (Status) FLW PM TP
//Disk:
// Deep Space FLW
var/list/parts = list()
parts += "<b>[antag_listing_name()]</b><br>"
parts += "<table cellspacing=5>"
for(var/datum/antagonist/A in get_team_antags())
parts += A.antag_listing_entry()
parts += "</table>"
parts += antag_listing_footer()
return parts.Join()
/datum/team/proc/antag_listing_name()
return name
/datum/team/proc/antag_listing_footer()
return
//Moves them to the top of the list if TRUE
/datum/antagonist/proc/is_gamemode_hero()
return FALSE
/datum/team/proc/is_gamemode_hero()
return FALSE
/datum/admins/proc/build_antag_listing()
var/list/sections = list()
var/list/priority_sections = list()
var/list/all_teams = list()
var/list/all_antagonists = list()
for(var/datum/antagonist/A in GLOB.antagonists)
if(!A.owner)
continue
all_teams |= A.get_team()
all_antagonists += A
for(var/datum/team/T in all_teams)
for(var/datum/antagonist/X in all_antagonists)
if(X.get_team() == T)
all_antagonists -= X
if(T.is_gamemode_hero())
priority_sections += T.antag_listing_entry()
else
sections += T.antag_listing_entry()
sortTim(all_antagonists, /proc/cmp_antag_category)
var/current_category
var/list/current_section = list()
for(var/i in 1 to all_antagonists.len)
var/datum/antagonist/current_antag = all_antagonists[i]
var/datum/antagonist/next_antag
if(i < all_antagonists.len)
next_antag = all_antagonists[i+1]
if(!current_category)
current_category = current_antag.roundend_category
current_section += "<b>[capitalize(current_category)]</b><br>"
current_section += "<table cellspacing=5>"
current_section += current_antag.antag_listing_entry() // Name - (Traitor) - FLW | PM | TP
if(!next_antag || next_antag.roundend_category != current_antag.roundend_category) //End of section
current_section += "</table>"
if(current_antag.is_gamemode_hero())
priority_sections += current_section.Join()
else
sections += current_section.Join()
current_section.Cut()
current_category = null
var/list/all_sections = priority_sections + sections
return all_sections.Join("<br>")
/datum/admins/proc/check_antagonists()
if(!SSticker.HasRoundStarted())
tgui_alert(usr, "The game hasn't started yet!")
return
var/list/dat = list("<html><head><meta charset='UTF-8'><title>Round Status</title></head><body><h1><B>Round Status</B></h1>")
dat += "Round Duration: <B>[DisplayTimeText(world.time - SSticker.round_start_time)]</B><BR>"
dat += "<B>Emergency shuttle</B><BR>"
if(EMERGENCY_IDLE_OR_RECALLED)
dat += "<a href='byond://?_src_=holder;[HrefToken()];call_shuttle=1'>Call Shuttle</a><br>"
else
var/timeleft = SSshuttle.emergency.timeLeft()
if(SSshuttle.emergency.mode == SHUTTLE_CALL)
dat += "ETA: <a href='byond://?_src_=holder;[HrefToken()];edit_shuttle_time=1'>[(timeleft / 60) % 60]:[add_leading(num2text(timeleft % 60), 2, "0")]</a><BR>"
dat += "<a href='byond://?_src_=holder;[HrefToken()];call_shuttle=2'>Send Back</a><br>"
else
dat += "ETA: <a href='byond://?_src_=holder;[HrefToken()];edit_shuttle_time=1'>[(timeleft / 60) % 60]:[add_leading(num2text(timeleft % 60), 2, "0")]</a><BR>"
dat += "<a href='byond://?_src_=holder;[HrefToken()];end_round=[REF(usr)]'>End Round Now</a><br>"
dat += "<a href='byond://?_src_=holder;[HrefToken()];delay_round_end=1'>[SSticker.delay_end ? "End Round Normally" : "Delay Round End"]</a><br>"
dat += "<a href='byond://?_src_=holder;[HrefToken()];ctf_toggle=1'>Enable/Disable CTF</a><br>"
dat += "<a href='byond://?_src_=holder;[HrefToken()];rebootworld=1'>Reboot World</a><br>"
dat += "<a href='byond://?_src_=holder;[HrefToken()];check_teams=1'>Check Teams</a>"
var/connected_players = GLOB.clients.len
var/lobby_players = 0
var/observers = 0
var/observers_connected = 0
var/living_players = 0
var/living_players_connected = 0
var/living_players_antagonist = 0
var/brains = 0
var/other_players = 0
var/living_skipped = 0
var/drones = 0
for(var/mob/M in GLOB.mob_list)
if(M.ckey)
if(isnewplayer(M))
lobby_players++
continue
else if(M.stat != DEAD && M.mind && !isbrain(M))
if(isdrone(M))
drones++
continue
if(is_centcom_level(M.z))
living_skipped++
continue
living_players++
if(M.mind.special_role)
living_players_antagonist++
if(M.client)
living_players_connected++
else if(M.stat == DEAD || isobserver(M))
observers++
if(M.client)
observers_connected++
else if(isbrain(M))
brains++
else
message_admins("Player [ADMIN_LOOKUPFLW(M)] is in an invalid state! Please investigate!")
other_players++
dat += "<BR><b><font color='blue' size='3'>Players:|[connected_players - lobby_players] ingame|[connected_players] connected|[lobby_players] lobby|</font></b>"
dat += "<BR><b><font color='green'>Living Players:|[living_players_connected] active|[living_players - living_players_connected] disconnected|[living_players_antagonist] antagonists|</font></b>"
dat += "<BR><b><font color='#bf42f4'>SKIPPED \[On centcom Z-level\]: [living_skipped] living players|[drones] living drones|</font></b>"
dat += "<BR><b><font color='red'>Dead/Observing players:|[observers_connected] active|[observers - observers_connected] disconnected|[brains] brains|</font></b>"
if(other_players)
dat += "<BR>[span_userdanger("[other_players] players in invalid state or the statistics code is bugged!")]"
dat += "<br><br>"
dat += build_antag_listing()
dat += "</body></html>"
usr << browse(dat.Join(), "window=roundstatus;size=500x500")