forked from tgstation/tgstation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.dm
278 lines (236 loc) · 9.54 KB
/
admin.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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
// Admin Tab - Admin Verbs
/client/proc/show_tip()
set category = "Admin"
set name = "Show Tip"
set desc = "Sends a tip (that you specify) to all players. After all \
you're the experienced player here."
if(!check_rights(R_ADMIN))
return
var/input = input(usr, "Please specify your tip that you want to send to the players.", "Tip", "") as message|null
if(!input)
return
if(!SSticker)
return
// If we've already tipped, then send it straight away.
if(SSticker.tipped)
send_tip_of_the_round(world, input)
else
SSticker.selected_tip = input
message_admins("[key_name_admin(usr)] sent a tip of the round.")
log_admin("[key_name(usr)] sent \"[input]\" as the Tip of the Round.")
SSblackbox.record_feedback("tally", "admin_verb", 1, "Show Tip")
/datum/admins/proc/announce()
set category = "Admin"
set name = "Announce"
set desc="Announce your desires to the world"
if(!check_rights(0))
return
var/message = input("Global message to send:", "Admin Announce", null, null) as message|null
if(message)
if(!check_rights(R_SERVER,0))
message = adminscrub(message,500)
to_chat(world, "[span_adminnotice("<b>[usr.client.holder.fakekey ? "Administrator" : usr.key] Announces:</b>")]\n \t [message]", confidential = TRUE)
log_admin("Announce: [key_name(usr)] : [message]")
SSblackbox.record_feedback("tally", "admin_verb", 1, "Announce") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/datum/admins/proc/unprison(mob/M in GLOB.mob_list)
set category = "Admin"
set name = "Unprison"
if (is_centcom_level(M.z))
SSjob.SendToLateJoin(M)
message_admins("[key_name_admin(usr)] has unprisoned [key_name_admin(M)]")
log_admin("[key_name(usr)] has unprisoned [key_name(M)]")
else
tgui_alert(usr,"[M.name] is not prisoned.")
SSblackbox.record_feedback("tally", "admin_verb", 1, "Unprison") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/cmd_admin_check_player_exp() //Allows admins to determine who the newer players are.
set category = "Admin"
set name = "Player Playtime"
if(!check_rights(R_ADMIN))
return
if(!CONFIG_GET(flag/use_exp_tracking))
to_chat(usr, span_warning("Tracking is disabled in the server configuration file."), confidential = TRUE)
return
var/list/msg = list()
msg += "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><title>Playtime Report</title></head><body>Playtime:<BR><UL>"
var/list/clients_list_copy = GLOB.clients.Copy()
sortList(clients_list_copy)
for(var/client/C in clients_list_copy)
msg += "<LI> - [key_name_admin(C)]: <A href='?_src_=holder;[HrefToken()];getplaytimewindow=[REF(C.mob)]'>" + C.get_exp_living() + "</a></LI>"
msg += "</UL></BODY></HTML>"
src << browse(msg.Join(), "window=Player_playtime_check")
/client/proc/trigger_centcom_recall()
if(!check_rights(R_ADMIN))
return
var/message = pick(GLOB.admiral_messages)
message = input("Enter message from the on-call admiral to be put in the recall report.", "Admiral Message", message) as text|null
if(!message)
return
message_admins("[key_name_admin(usr)] triggered a CentCom recall, with the admiral message of: [message]")
log_game("[key_name(usr)] triggered a CentCom recall, with the message of: [message]")
SSshuttle.centcom_recall(SSshuttle.emergency.timer, message)
/datum/admins/proc/cmd_show_exp_panel(client/client_to_check)
if(!check_rights(R_ADMIN))
return
if(!client_to_check)
to_chat(usr, span_danger("ERROR: Client not found."), confidential = TRUE)
return
if(!CONFIG_GET(flag/use_exp_tracking))
to_chat(usr, span_warning("Tracking is disabled in the server configuration file."), confidential = TRUE)
return
new /datum/job_report_menu(client_to_check, usr)
/datum/admins/proc/toggle_exempt_status(client/C)
if(!check_rights(R_ADMIN))
return
if(!C)
to_chat(usr, span_danger("ERROR: Client not found."), confidential = TRUE)
return
if(!C.set_db_player_flags())
to_chat(usr, span_danger("ERROR: Unable read player flags from database. Please check logs."), confidential = TRUE)
var/dbflags = C.prefs.db_flags
var/newstate = FALSE
if(dbflags & DB_FLAG_EXEMPT)
newstate = FALSE
else
newstate = TRUE
if(C.update_flag_db(DB_FLAG_EXEMPT, newstate))
to_chat(usr, span_danger("ERROR: Unable to update player flags. Please check logs."), confidential = TRUE)
else
message_admins("[key_name_admin(usr)] has [newstate ? "activated" : "deactivated"] job exp exempt status on [key_name_admin(C)]")
log_admin("[key_name(usr)] has [newstate ? "activated" : "deactivated"] job exp exempt status on [key_name(C)]")
/// Allow admin to add or remove traits of datum
/datum/admins/proc/modify_traits(datum/D)
if(!D)
return
var/add_or_remove = input("Remove/Add?", "Trait Remove/Add") as null|anything in list("Add","Remove")
if(!add_or_remove)
return
var/list/available_traits = list()
switch(add_or_remove)
if("Add")
for(var/key in GLOB.traits_by_type)
if(istype(D,key))
available_traits += GLOB.traits_by_type[key]
if("Remove")
if(!GLOB.trait_name_map)
GLOB.trait_name_map = generate_trait_name_map()
for(var/trait in D.status_traits)
var/name = GLOB.trait_name_map[trait] || trait
available_traits[name] = trait
var/chosen_trait = input("Select trait to modify", "Trait") as null|anything in sortList(available_traits)
if(!chosen_trait)
return
chosen_trait = available_traits[chosen_trait]
var/source = "adminabuse"
switch(add_or_remove)
if("Add") //Not doing source choosing here intentionally to make this bit faster to use, you can always vv it.
if(GLOB.movement_type_trait_to_flag[chosen_trait]) //include the required element.
D.AddElement(/datum/element/movetype_handler)
ADD_TRAIT(D,chosen_trait,source)
if("Remove")
var/specific = input("All or specific source ?", "Trait Remove/Add") as null|anything in list("All","Specific")
if(!specific)
return
switch(specific)
if("All")
source = null
if("Specific")
source = input("Source to be removed","Trait Remove/Add") as null|anything in sortList(D.status_traits[chosen_trait])
if(!source)
return
REMOVE_TRAIT(D,chosen_trait,source)
///////////////////////////////////////////////////////////////////////////////////////////////
/client/proc/cmd_admin_drop_everything(mob/M in GLOB.mob_list)
set category = null
set name = "Drop Everything"
if(!check_rights(R_ADMIN))
return
var/confirm = tgui_alert(usr, "Make [M] drop everything?", "Message", list("Yes", "No"))
if(confirm != "Yes")
return
for(var/obj/item/W in M)
if(!M.dropItemToGround(W))
qdel(W)
M.regenerate_icons()
log_admin("[key_name(usr)] made [key_name(M)] drop everything!")
var/msg = "[key_name_admin(usr)] made [ADMIN_LOOKUPFLW(M)] drop everything!"
message_admins(msg)
admin_ticket_log(M, msg)
SSblackbox.record_feedback("tally", "admin_verb", 1, "Drop Everything") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/proc/cmd_admin_mute(whom, mute_type, automute = 0)
if(!whom)
return
var/muteunmute
var/mute_string
var/feedback_string
switch(mute_type)
if(MUTE_IC)
mute_string = "IC (say and emote)"
feedback_string = "IC"
if(MUTE_OOC)
mute_string = "OOC"
feedback_string = "OOC"
if(MUTE_PRAY)
mute_string = "pray"
feedback_string = "Pray"
if(MUTE_ADMINHELP)
mute_string = "adminhelp, admin PM and ASAY"
feedback_string = "Adminhelp"
if(MUTE_DEADCHAT)
mute_string = "deadchat and DSAY"
feedback_string = "Deadchat"
if(MUTE_ALL)
mute_string = "everything"
feedback_string = "Everything"
else
return
var/client/C
if(istype(whom, /client))
C = whom
else if(istext(whom))
C = GLOB.directory[whom]
else
return
var/datum/preferences/P
if(C)
P = C.prefs
else
P = GLOB.preferences_datums[whom]
if(!P)
return
if(automute)
if(!CONFIG_GET(flag/automute_on))
return
else
if(!check_rights())
return
if(automute)
muteunmute = "auto-muted"
P.muted |= mute_type
log_admin("SPAM AUTOMUTE: [muteunmute] [key_name(whom)] from [mute_string]")
message_admins("SPAM AUTOMUTE: [muteunmute] [key_name_admin(whom)] from [mute_string].")
if(C)
to_chat(C, "You have been [muteunmute] from [mute_string] by the SPAM AUTOMUTE system. Contact an admin.", confidential = TRUE)
SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Auto Mute [feedback_string]", "1")) //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
return
if(P.muted & mute_type)
muteunmute = "unmuted"
P.muted &= ~mute_type
else
muteunmute = "muted"
P.muted |= mute_type
log_admin("[key_name(usr)] has [muteunmute] [key_name(whom)] from [mute_string]")
message_admins("[key_name_admin(usr)] has [muteunmute] [key_name_admin(whom)] from [mute_string].")
if(C)
to_chat(C, "You have been [muteunmute] from [mute_string] by [key_name(usr, include_name = FALSE)].", confidential = TRUE)
SSblackbox.record_feedback("nested tally", "admin_toggle", 1, list("Mute [feedback_string]", "[P.muted & mute_type]")) //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/proc/immerse_player(mob/living/carbon/target, toggle=TRUE, remove=FALSE)
var/list/immersion_components = list(/datum/component/manual_breathing, /datum/component/manual_blinking)
for(var/immersies in immersion_components)
var/has_component = target.GetComponent(immersies)
if(has_component && (toggle || remove))
qdel(has_component)
else if(toggle || !remove)
target.AddComponent(immersies)
/proc/mass_immerse(remove=FALSE)
for(var/mob/living/carbon/M in GLOB.mob_list)
immerse_player(M, toggle=FALSE, remove=remove)