Skip to content

Commit

Permalink
admin: some admin buttons tweaks (#6398)
Browse files Browse the repository at this point in the history
* admin: some admin buttons tweaks

* fix

* some more interfaces
  • Loading branch information
dageavtobusnick authored Jan 22, 2025
1 parent 9ef604a commit 189eda1
Show file tree
Hide file tree
Showing 25 changed files with 418 additions and 255 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/span.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
//#define span_alertsyndie(str) ("<span class='alertsyndie'>" + str + "</span>")
//#define span_alertwarning(str) ("<span class='alertwarning'>" + str + "</span>")
#define span_alien(str) ("<span class='alien'>" + str + "</span>")
#define span_all_admin_ping(str) ("<span class='all_admin_ping'>" + str + "</span>")
#define span_announce(str) ("<span class='announce'>" + str + "</span>")
#define span_big(str) ("<span class='big'>" + str + "</span>")
#define span_blob(str) ("<span class='blob'>" + str + "</span>")
Expand Down
4 changes: 4 additions & 0 deletions code/__HELPERS/_logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ GLOBAL_PROTECT(log_end)
if(CONFIG_GET(flag/log_adminchat))
WRITE_LOG(GLOB.world_game_log, "ADMINPRIVATE: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")

/proc/log_ping_all_admins(text, mob/speaker)
if(CONFIG_GET(flag/log_adminchat))
WRITE_LOG(GLOB.world_game_log, "ALL ADMIN PING: [speaker.simple_info_line()]: [html_decode(text)][GLOB.log_end]")

/proc/log_qdel(text)
WRITE_LOG(GLOB.world_qdel_log, "QDEL: [text][GLOB.log_end]")

Expand Down
3 changes: 2 additions & 1 deletion code/_globalvars/lists/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ GLOBAL_LIST_EMPTY(all_superheroes)

GLOBAL_LIST_EMPTY(clients) //list of all clients
GLOBAL_LIST_EMPTY(admins) //list of all clients whom are admins
GLOBAL_LIST_EMPTY(deadmins) //list of all clients who have used the de-admin verb.
GLOBAL_LIST_EMPTY(de_admins) //list of all admins who have used the de-admin verb.
GLOBAL_LIST_EMPTY(de_mentors) //list of all mentors who have used the de-admin verb.
GLOBAL_LIST_EMPTY(directory) //list of all ckeys with associated client
GLOBAL_LIST_EMPTY(stealthminID) //reference list with IDs that store ckeys, for stealthmins

Expand Down
9 changes: 7 additions & 2 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@
alert("Not before round-start!", "Alert")
return

var/list/out = list("<html><meta charset='UTF-8'><head><title>[name]</title></head><body><b>[name]</b>[(current && (current.real_name != name))?" (as [current.real_name])" : ""]")
var/list/out = list("<body><b>[name]</b>[(current && (current.real_name != name))?" (as [current.real_name])" : ""]")
out.Add("Mind currently owned by key: [key] [active ? "(synced)" : "(not synced)"]")
out.Add("Assigned role: [assigned_role]. <a href='byond://?src=[UID()];role_edit=1'>Edit</a>")
out.Add("Special role: [special_role].") //better to change this through /datum/antagonist/, some code uses this var and can break if something goes wrong
Expand Down Expand Up @@ -844,7 +844,12 @@
out.Add("<a href='byond://?src=[UID()];obj_add=1'>Add objective</a><br>")
out.Add("<a href='byond://?src=[UID()];obj_announce=1'>Announce objectives</a><br>")
out.Add("</body></html>")
usr << browse(out.Join("<br>"), "window=edit_memory[src];size=500x500")

var/datum/browser/popup = new(usr, "edit_memory[src]", "<div align='center'>[name]</div>", 500, 500)
popup.set_content(out.Join("<br>"))
popup.set_window_options("can_close=1;can_minimize=0;can_maximize=0;can_resize=0;titlebar=1;")
popup.open()
onclose(usr, "edit_memory[src]")

/datum/mind/Topic(href, href_list)
//проверяем на амбиции, после чего прерываем выполнение, иначе он залезет в админский антаг-панель
Expand Down
22 changes: 20 additions & 2 deletions code/game/objects/structures/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,28 @@
anchored = TRUE
density = TRUE
var/use_old_mind = FALSE
/// An outfit for ghosts to spawn with
var/datum/outfit/selected_outfit

/obj/structure/respawner/attack_ghost(mob/dead/observer/user)
var/response = tgui_alert(user, "Are you sure you want to spawn here?\n(If you do this, you won't be able to be cloned!)", "Respawn?", list("Yes", "No"))
if(response == "Yes")
if(check_rights(R_EVENT))
var/outfit_pick = tgui_alert(user, "Хочешь выбрать снаряжение или возродиться?", "Выбрать снаряжение?", list("Выбрать снаряжение", "Возродиться", "Отмена"))
if(outfit_pick == "Отмена")
return
if(outfit_pick == "Выбрать снаряжение")
var/new_outfit = user.client.robust_dress_shop()
if(!new_outfit)
return
log_admin("[key_name(user)] changed a respawner machine's outfit to [new_outfit].")
message_admins("[key_name(user)] changed a respawner machine's outfit to [new_outfit].")
if(new_outfit == "Naked")
selected_outfit = null
return
selected_outfit = new_outfit
return

var/response = tgui_alert(user, "Вы уверены, что хотите появиться здесь?\n(Если вы сделаете это, вас нельзя будет клонировать!)", "Возродиться?", list("Да", "Нет"))
if(response == "Да")
user.forceMove(get_turf(src))
log_admin("[key_name_log(user)] was incarnated by a respawner machine.")
message_admins("[key_name_admin(user)] was incarnated by a respawner machine.")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/IsBanned.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
if (C && ckey == C.ckey && computer_id == C.computer_id && address == C.address)
return //don't recheck connected clients.

if((ckey in GLOB.admin_datums) || (ckey in GLOB.deadmins))
if((ckey in GLOB.admin_datums) || (ckey in GLOB.de_admins))
var/datum/admins/A = GLOB.admin_datums[ckey]
if(A && (A.rights & R_ADMIN))
admin = 1
Expand Down
72 changes: 44 additions & 28 deletions code/modules/admin/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ GLOBAL_VAR_INIT(nologevent, 0)
if(!check_rights(R_ADMIN|R_MOD))
return

var/body = {"<html><meta charset="UTF-8"><head><title>Options for [M.key]</title></head>"}
body += "<body>Options panel for <b>[M]</b>"
var/body = "<body>Options panel for <b>[M]</b>"
if(M.client)
body += " played by <b>[M.client]</b> "
if(check_rights(R_PERMISSIONS, 0))
Expand Down Expand Up @@ -292,11 +291,14 @@ GLOBAL_VAR_INIT(nologevent, 0)
<a href='byond://?_src_=holder;contractor_release=[M.UID()]'>Release now from Syndicate Jail</A> |
"}

body += {"<br>
</body></html>
body += {"<br></body>
"}

usr << browse(body, "window=adminplayeropts;size=550x615")
var/datum/browser/popup = new(usr, "adminplayeropts", "<div align='center'>Options for [M.key]</div>", 600, 615)
popup.set_content(body)
popup.set_window_options("can_close=1;can_minimize=0;can_maximize=0;can_resize=0;titlebar=1;")
popup.open()
onclose(usr, "adminplayeropts")
SSblackbox.record_feedback("tally", "admin_verb", 1, "Show Player Panel") //If you are copy-pasting this, ensure the 4th parameter is unique to the new proc!


Expand Down Expand Up @@ -345,29 +347,32 @@ GLOBAL_VAR_INIT(nologevent, 0)
dat += text("<tr><td>[t] (<a href='byond://?src=[UID()];removejobban=[r]'>unban</A>)</td></tr>")
dat += "</table>"
usr << browse(dat, "window=ban;size=400x400")


/datum/admins/proc/Game()
if(!check_rights(R_ADMIN))
return

var/dat = {"<!DOCTYPE html><meta charset="UTF-8">
<center><B>Game Panel</B></center><hr>\n
<a href='byond://?src=[UID()];c_mode=1'>Change Game Mode</A><br>
"}
var/list/dat = list()
var/cached_UID = UID()
dat += "<center>"
dat += "<p><a href='byond://?src=[cached_UID];c_mode=1'>Change Game Mode</a><br></p>"
if(GLOB.master_mode == "secret")
dat += "<a href='byond://?src=[UID()];f_secret=1'>(Force Secret Mode)</A><br>"
dat += "<p><a href='byond://?src=[cached_UID];f_secret=1'>(Force Secret Mode)</a><br></p>"
if(GLOB.master_mode == "antag-paradise" || GLOB.secret_force_mode == "antag-paradise")
dat += "<a href='byond://?src=[UID()];change_weights=1'>Change Antag Weights</A><br>"

dat += {"
<BR>
<a href='byond://?src=[UID()];create_object=1'>Create Object</A><br>
<a href='byond://?src=[UID()];quick_create_object=1'>Quick Create Object</A><br>
<a href='byond://?src=[UID()];create_turf=1'>Create Turf</A><br>
<a href='byond://?src=[UID()];create_mob=1'>Create Mob</A><br>
"}

usr << browse(dat, "window=admin2;size=210x280")
dat += "<p><a href='byond://?src=[cached_UID];change_weights=1'>Change Antag Weights</a><br></p>"

dat += "<hr><br>"
dat += "<p><a href='byond://?src=[cached_UID];create_object=1'>Create Object</a><br></p>"
dat += "<p><a href='byond://?src=[cached_UID];quick_create_object=1'>Quick Create Object</a><br></p>"
dat += "<p><a href='byond://?src=[cached_UID];create_turf=1'>Create Turf</a><br></p>"
dat += "<p><a href='byond://?src=[cached_UID];create_mob=1'>Create Mob</a></p>"

var/datum/browser/popup = new(usr, "game_panel", "<div align='center'>Game Panel</div>", 210, 280)
popup.set_content(dat.Join(""))
popup.set_window_options("can_close=1;can_minimize=0;can_maximize=0;can_resize=0;titlebar=1;")
popup.open()
onclose(usr, "game_panel")
return

/////////////////////////////////////////////////////////////////////////////////////////////////admins2.dm merge
Expand Down Expand Up @@ -766,9 +771,9 @@ GLOBAL_VAR_INIT(nologevent, 0)
return ""


/datum/admins/proc/spawn_atom(var/object as text)
/datum/admins/proc/spawn_atom(object as text)
set category = "Debug"
set desc = "(atom path) Spawn an atom"
set desc = "(путь атома) Создайте атом. Добавьте точку к тексту, чтобы исключить подтипы пути, соответствующего входным данным."
set name = "Spawn"

if(!check_rights(R_SPAWN))
Expand All @@ -777,9 +782,20 @@ GLOBAL_VAR_INIT(nologevent, 0)
var/list/types = typesof(/atom)
var/list/matches = new()

for(var/path in types)
if(findtext("[path]", object))
matches += path
var/include_subtypes = TRUE
if(copytext(object, -1) == ".")
include_subtypes = FALSE
object = copytext(object, 1, -1)

if(include_subtypes)
for(var/path in types)
if(findtext("[path]", object))
matches += path
else
var/needle_length = length(object)
for(var/path in types)
if(copytext("[path]", -needle_length) == object)
matches += path

if(matches.len==0)
return
Expand All @@ -788,8 +804,8 @@ GLOBAL_VAR_INIT(nologevent, 0)
if(matches.len==1)
chosen = matches[1]
else
chosen = input("Select an atom type", "Spawn Atom", matches[1]) as null|anything in matches
if(!chosen)
chosen = tgui_input_list(usr, "Выберите тип атома", "Спавн атома", matches, matches[1])
if(isnull(chosen))
return

if(ispath(chosen,/turf))
Expand Down
14 changes: 10 additions & 4 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ GLOBAL_LIST_INIT(admin_verbs_admin, list(
/client/proc/toggle_mentor_chat,
/client/proc/toggle_advanced_interaction, /*toggle admin ability to interact with not only machines, but also atoms such as buttons and doors*/
/client/proc/start_vote,
/client/proc/ping_all_admins,
/client/proc/list_ssds_afks,
/client/proc/ccbdb_lookup_ckey,
/client/proc/toggle_pacifism_gt,
Expand Down Expand Up @@ -956,14 +957,17 @@ GLOBAL_LIST_INIT(view_runtimes_verbs, list(
set name = "De-admin self"
set category = "Admin"

if(!check_rights(R_ADMIN|R_MOD|R_MENTOR))
if(!check_rights(R_ADMIN|R_MENTOR))
return

log_admin("[key_name(usr)] deadmined themself.")
message_admins("[key_name_admin(usr)] deadmined themself.")
deadmin()
add_verb(src, /client/proc/readmin)
GLOB.deadmins += ckey
if(check_rights(R_ADMIN, FALSE))
GLOB.de_admins += ckey
else
GLOB.de_mentors += ckey
update_active_keybindings()
to_chat(src, "<span class='interface'>You are now a normal player.</span>", confidential=TRUE)
SSblackbox.record_feedback("tally", "admin_verb", 1, "De-admin") //If you are copy-pasting this, ensure the 4th parameter is unique to the new proc!
Expand Down Expand Up @@ -1055,13 +1059,15 @@ GLOBAL_LIST_INIT(view_runtimes_verbs, list(
message_admins("[key_name_admin(usr)] re-adminned themselves.")
log_admin("[key_name(usr)] re-adminned themselves.")
update_active_keybindings()
GLOB.deadmins -= ckey
GLOB.de_admins -= ckey
GLOB.de_mentors -= ckey
SSblackbox.record_feedback("tally", "admin_verb", 1, "Re-admin")
return
else
to_chat(src, "You are already an admin.", confidential=TRUE)
remove_verb(src, /client/proc/readmin)
GLOB.deadmins -= ckey
GLOB.de_admins -= ckey
GLOB.de_mentors -= ckey
return

/client/proc/select_next_map()
Expand Down
9 changes: 8 additions & 1 deletion code/modules/admin/create_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ GLOBAL_VAR(create_mob_html)
GLOB.create_mob_html = replacetext(GLOB.create_mob_html, "null /* object types */", "\"[mobjs]\"")
GLOB.create_mob_html = replacetext(GLOB.create_mob_html, "Create Object", "Create Mob")

user << browse(replacetext(GLOB.create_mob_html, "/* ref src */", UID()), "window=create_mob;size=425x475")
var/datum/browser/popup = new(user, "create_mob", "<div align='center'>Create Mob</div>", 550, 600)
var/unique_content = GLOB.create_mob_html
unique_content = replacetext(unique_content, "/* ref src */", UID())
popup.set_content(unique_content)
popup.set_window_options("can_close=1;can_minimize=0;can_maximize=1;can_resize=1")
popup.add_stylesheet("dark_inputs", "html/dark_inputs.css")
popup.open()
onclose(user, "create_mob")
18 changes: 16 additions & 2 deletions code/modules/admin/create_object.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ GLOBAL_LIST_INIT(create_object_forms, list(/obj, /obj/structure, /obj/machinery,
GLOB.create_object_html = file2text('html/create_object.html')
GLOB.create_object_html = replacetext(GLOB.create_object_html, "null /* object types */", "\"[objectjs]\"")

user << browse(replacetext(GLOB.create_object_html, "/* ref src */", UID()), "window=create_object;size=425x475")
var/datum/browser/popup = new(user, "create_obj", "<div align='center'>Create Object</div>", 550, 600)
var/unique_content = GLOB.create_object_html
unique_content = replacetext(unique_content, "/* ref src */", UID())
popup.set_content(unique_content)
popup.set_window_options("can_close=1;can_minimize=0;can_maximize=1;can_resize=1")
popup.add_stylesheet("dark_inputs", "html/dark_inputs.css")
popup.open()
onclose(user, "create_obj")

/datum/admins/proc/quick_create_object(var/mob/user)
var/path = input("Select the path of the object you wish to create.", "Path", /obj) in GLOB.create_object_forms
Expand All @@ -21,4 +28,11 @@ GLOBAL_LIST_INIT(create_object_forms, list(/obj, /obj/structure, /obj/machinery,
html_form = replacetext(html_form, "Create Object", "Create Object [path]")
GLOB.create_object_forms[path] = html_form

user << browse(replacetext(html_form, "/* ref src */", UID()), "window=qco[path];size=425x475")
var/datum/browser/popup = new(user, "qco[path]", "<div align='center'>Quick Create [path]</div>", 550, 600)
var/unique_content = html_form
unique_content = replacetext(unique_content, "/* ref src */", UID())
popup.set_content(unique_content)
popup.set_window_options("can_close=1;can_minimize=0;can_maximize=1;can_resize=1")
popup.add_stylesheet("dark_inputs", "html/dark_inputs.css")
popup.open()
onclose(user, "qco[path]")
9 changes: 8 additions & 1 deletion code/modules/admin/create_turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ GLOBAL_VAR(create_turf_html)
GLOB.create_turf_html = replacetext(GLOB.create_turf_html, "null /* object types */", "\"[turfjs]\"")
GLOB.create_turf_html = replacetext(GLOB.create_turf_html, "Create Object", "Create Turf")

user << browse(replacetext(GLOB.create_turf_html, "/* ref src */", UID()), "window=create_turf;size=425x475")
var/datum/browser/popup = new(user, "create_turf", "<div align='center'>Create Turf</div>", 550, 600)
var/unique_content = GLOB.create_turf_html
unique_content = replacetext(unique_content, "/* ref src */", UID())
popup.set_content(unique_content)
popup.set_window_options("can_close=1;can_minimize=0;can_maximize=1;can_resize=1")
popup.add_stylesheet("dark_inputs", "html/dark_inputs.css")
popup.open()
onclose(user, "create_turf")
Loading

0 comments on commit 189eda1

Please sign in to comment.