mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-29 19:11:51 +00:00
Makes the code compatible with 515.1594+
Few simple changes and one very painful one.
Let's start with the easy:
* puts call behind `LIBCALL` define, so call_ext is properly used in 515
* Adds `NAMEOF_STATIC(_,X)` macro for nameof in static definitions since
src is now invalid there.
* Fixes tgui and devserver. From 515 onward the tmp3333{procid} cache
directory is not appened to base path in browser controls so we don't
check for it in base js and put the dev server dummy window file in
actual directory not the byond root.
* Renames the few things that had /final/ in typepath to ultimate since
final is a new keyword
And the very painful change:
`.proc/whatever` format is no longer valid, so we're replacing it with
new nameof() function. All this wrapped in three new macros.
`PROC_REF(X)`,`TYPE_PROC_REF(TYPE,X)`,`GLOBAL_PROC_REF(X)`. Global is
not actually necessary but if we get nameof that does not allow globals
it would be nice validation.
This is pretty unwieldy but there's no real alternative.
If you notice anything weird in the commits let me know because majority
was done with regex replace.
@tgstation/commit-access Since the .proc/stuff is pretty big change.
Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
277 lines
9.5 KiB
Plaintext
277 lines
9.5 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 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>"
|
|
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(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)
|