Files
Bubberstation/code/modules/admin/verbs/admin.dm
SkyratBot c4a58bb0c6 [MIRROR] Cleans up/renames as private some internal var definitions, removes some fucked uses of internal list vars [MDB IGNORE] (#21679)
* Cleans up/renames as private some internal var definitions, removes some fucked uses of internal list vars (#75769)

## About The Pull Request

[Improves the documentation of DCS lists, removes old list of callback
docs that no longer
apply](c3821d9f5f)

[Adds a second signal register to decal rotating, adds a trait to
objects under a tile. STOP DIRECTLY READING HIDDEN LISTS I SWEAR TO
GOD](6b3f97a76a)

[Removes direct reads of the timer list, they were redundant
mostly](14fcd9f8a6)

[Please stop directly reading/modifying the traits list to ensure your
dna rot follows the
brain](ec0e5237ec)

[Marks internal datum lists as well internal with
_](57c6577ff6)

[57c6577](57c6577ff6)

Does the same to _clear_signal_refs() in hopes of keeping people from
touching it

## Why It's Good For The Game

They pissed me off.

Users should not be touching these lists, especially in ways that make
assumptions about their structure and are thus prone to breaking if that
ever changes.
Most of these are close to zero cost changes, using a wrapper to solve
the problem, or just yeeting it

Two aren't, Decals with a direction have gained a second signal register
on init, and things that sit underfloor (cables/pipes) now get a trait
when inserted there.

This should have a minimal impact on memory/init time, bugging
@ Mothblocks about it just in case

* Cleans up/renames as private some internal var definitions, removes some fucked uses of internal list vars

* fix

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: ghost sheep <sheepwiththemask@gmail.com>
2023-06-07 15:10:42 +00:00

285 lines
9.8 KiB
Plaintext

// 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 4th 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 4th 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>"
for(var/client/client in sort_list(GLOB.clients, GLOBAL_PROC_REF(cmp_playtime_asc)))
msg += "<LI> [ADMIN_PP(client.mob)] [key_name_admin(client)]: <A href='?_src_=holder;[HrefToken()];getplaytimewindow=[REF(client.mob)]'>" + client.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]")
usr.log_message("triggered a CentCom recall, with the message of: [message]", LOG_GAME)
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 sort_list(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 sort_list(GET_TRAIT_SOURCES(D, 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 4th 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"
//Skyrat Addition Begin - LOOC muting again.
if(MUTE_LOOC)
mute_string = "LOOC"
feedback_string = "LOOC"
//Skyrat Addition End - LOOC muting again.
if(MUTE_INTERNET_REQUEST)
mute_string = "internet sound requests"
feedback_string = "Internet Sound Requests"
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 4th 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 4th 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)