update orbiting (#7469)

<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game

<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Please note that
maintainers freely reserve the right to remove and add tags should they
deem it appropriate. You can attempt to finagle the system all you want,
but it's best to shoot for clear communication right off the bat. -->

🆑
code: updated WrapAdminProcCall so it doesnt sleep (remove the waiting
feature)
tweak: you can now see how many people are orbiting something
/🆑

<!-- Both 🆑's are required for the changelog to work! You can put
your name to the right of the first 🆑 if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
This commit is contained in:
Letter N
2026-01-12 11:18:13 -05:00
committed by GitHub
parent f08f02e4c3
commit 05dc930edd
21 changed files with 432 additions and 135 deletions
+126 -47
View File
@@ -1,3 +1,78 @@
GLOBAL_DATUM_INIT(AdminProcCallHandler, /mob/proccall_handler, new())
GLOBAL_PROTECT(AdminProcCallHandler)
/// Used to handle proccalls called indirectly by an admin (e.g. tgs, circuits).
/// Has to be a mob because IsAdminAdvancedProcCall() checks usr, which is a mob variable.
/// So usr is set to this for any proccalls that don't have any usr mob/client to refer to.
/mob/proccall_handler
name = "ProcCall Handler"
desc = "If you are seeing this, tell a coder."
var/list/callers = list()
invisibility = INVISIBILITY_ABSTRACT
density = FALSE
/// Adds a caller.
/mob/proccall_handler/proc/add_caller(caller_name)
callers += caller_name
name = "[initial(name)] ([callers.Join(") (")])"
/// Removes a caller.
/mob/proccall_handler/proc/remove_caller(caller_name)
callers -= caller_name
name = "[initial(name)] ([callers.Join(") (")])"
/mob/proccall_handler/Initialize(mapload)
. = ..()
if(GLOB.AdminProcCallHandler && GLOB.AdminProcCallHandler != src)
return INITIALIZE_HINT_QDEL
GLOB.AdminProcCallHandler = src
/mob/proccall_handler/vv_edit_var(var_name, var_value)
if(GLOB.AdminProcCallHandler != src)
return ..()
return FALSE
/mob/proccall_handler/vv_do_topic(list/href_list)
if(GLOB.AdminProcCallHandler != src)
return ..()
return FALSE
/mob/proccall_handler/CanProcCall(procname)
if(GLOB.AdminProcCallHandler != src)
return ..()
return FALSE
// Shit will break if this is allowed to be deleted
/mob/proccall_handler/Destroy(force)
if(GLOB.AdminProcCallHandler != src)
return ..()
if(!force)
stack_trace("Attempted deletion on [type] - [name], aborting.")
return QDEL_HINT_LETMELIVE
return ..()
/**
* Handles a userless proccall, used by circuits.
*
* Arguments:
* * user - a string used to identify the user
* * target - the target to proccall on
* * proc - the proc to call
* * arguments - any arguments
*/
/proc/HandleUserlessProcCall(user, datum/target, procname, list/arguments)
if(IsAdminAdvancedProcCall())
return
var/mob/proccall_handler/handler = GLOB.AdminProcCallHandler
handler.add_caller(user)
var/lastusr = usr
usr = handler
. = WrapAdminProcCall(target, procname, arguments)
usr = lastusr
handler.remove_caller(user)
/client/proc/callproc()
set category = "Debug"
set name = "Advanced ProcCall"
@@ -12,18 +87,15 @@
var/targetselected = FALSE
var/returnval
switch(alert("Proc owned by something?",,"Yes","No"))
switch(tgui_alert(usr,"Proc owned by something?",,list("Yes","No")))
if("Yes")
targetselected = TRUE
var/list/value = vv_get_value(
default_class = VV_ATOM_REFERENCE,
classes = list(VV_ATOM_REFERENCE, VV_DATUM_REFERENCE, VV_MOB_REFERENCE, VV_CLIENT, VV_MARKED_DATUM, VV_TEXT_LOCATE, VV_PROCCALL_RETVAL),
)
var/list/value = vv_get_value(default_class = VV_ATOM_REFERENCE, classes = list(VV_ATOM_REFERENCE, VV_DATUM_REFERENCE, VV_MOB_REFERENCE, VV_CLIENT, VV_MARKED_DATUM, VV_TEXT_LOCATE, VV_PROCCALL_RETVAL))
if (!value["class"] || !value["value"])
return
target = value["value"]
if(!istype(target))
to_chat(usr, "<span class='danger'>Invalid target.</span>")
to_chat(usr, SPAN_DANGER("Invalid target."), confidential = TRUE)
return
if("No")
target = null
@@ -43,12 +115,12 @@
if(targetselected)
if(!hascall(target, procname))
to_chat(usr, "<span class='warning'>Error: callproc(): type [target.type] has no [proctype] named [procpath].</span>")
to_chat(usr, SPAN_WARNING("Error: callproc(): type [target.type] has no [proctype] named [procpath]."), confidential = TRUE)
return
else
procpath = "/[proctype]/[procname]"
if(!text2path(procpath))
to_chat(usr, "<span class='warning'>Error: callproc(): [procpath] does not exist.</span>")
to_chat(usr, SPAN_WARNING("Error: callproc(): [procpath] does not exist."), confidential = TRUE)
return
var/list/lst = get_callproc_args()
@@ -57,24 +129,27 @@
if(targetselected)
if(!target)
to_chat(usr, "<font color='red'>Error: callproc(): owner of proc no longer exists.</font>")
to_chat(usr, "<font color='red'>Error: callproc(): owner of proc no longer exists.</font>", confidential = TRUE)
return
var/msg = "[key_name(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]."
log_admin(msg)
message_admins(msg) //Proccall announce removed.
message_admins(msg) //Proccall announce removed.
admin_ticket_log(target, msg)
returnval = WrapAdminProcCall(target, procname, lst) // Pass the lst as an argument list to the proc
else
//this currently has no hascall protection. wasn't able to get it working.
log_admin("[key_name(src)] called [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].")
message_admins("[key_name(src)] called [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") //Proccall announce removed.
message_admins("[key_name(src)] called [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") //Proccall announce removed.
returnval = WrapAdminProcCall(GLOBAL_PROC, procname, lst) // Pass the lst as an argument list to the proc
//SSblackbox.record_feedback("tally", "admin_verb", 1, "Advanced ProcCall") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
// BLACKBOX_LOG_ADMIN_VERB("Advanced ProcCall")
if(get_retval)
get_retval["VALUE"] = returnval
if (islist(returnval))
get_retval += list(returnval) // Wrap to stop BYOND from concat-ing the lists
else
get_retval += returnval
. = get_callproc_returnval(returnval, procname)
if(.)
to_chat(usr, .)
to_chat(usr, ., confidential = TRUE)
GLOBAL_VAR(AdminProcCaller)
GLOBAL_PROTECT(AdminProcCaller)
@@ -86,43 +161,47 @@ GLOBAL_VAR(LastAdminCalledTarget)
GLOBAL_PROTECT(LastAdminCalledTarget)
GLOBAL_VAR(LastAdminCalledProc)
GLOBAL_PROTECT(LastAdminCalledProc)
GLOBAL_LIST_EMPTY(AdminProcCallSpamPrevention)
GLOBAL_PROTECT(AdminProcCallSpamPrevention)
/// Wrapper for proccalls where the datum is flagged as vareditted
/proc/WrapAdminProcCall(datum/target, procname, list/arguments)
if(target && procname == "Del")
to_chat(usr, "Calling Del() is not allowed")
to_chat(usr, "Calling Del() is not allowed", confidential = TRUE)
return
if(target != GLOBAL_PROC && !target.CanProcCall(procname))
to_chat(usr, "Proccall on [target.type]/proc/[procname] is disallowed!")
to_chat(usr, "Proccall on [target.type]/proc/[procname] is disallowed!", confidential = TRUE)
return
var/current_caller = GLOB.AdminProcCaller
var/ckey = usr ? usr.client.ckey : GLOB.AdminProcCaller
if(!ckey)
var/user_identifier = usr ? usr.client?.ckey : GLOB.AdminProcCaller
var/is_remote_handler = usr == GLOB.AdminProcCallHandler
if(is_remote_handler)
user_identifier = GLOB.AdminProcCallHandler.name
if(!user_identifier)
CRASH("WrapAdminProcCall with no ckey: [target] [procname] [english_list(arguments)]")
if(current_caller && current_caller != ckey)
if(!GLOB.AdminProcCallSpamPrevention[ckey])
to_chat(usr, "<span class='adminnotice'>Another set of admin called procs are still running, your proc will be run after theirs finish.</span>")
GLOB.AdminProcCallSpamPrevention[ckey] = TRUE
UNTIL(!GLOB.AdminProcCaller)
to_chat(usr, "<span class='adminnotice'>Running your proc</span>")
GLOB.AdminProcCallSpamPrevention -= ckey
else
UNTIL(!GLOB.AdminProcCaller)
if(!is_remote_handler && current_caller && current_caller != user_identifier)
to_chat(usr, SPAN_ADMINNOTICE("Another set of admin called procs are still running. Try again later."), confidential = TRUE)
return
GLOB.LastAdminCalledProc = procname
if(target != GLOBAL_PROC)
GLOB.LastAdminCalledTargetRef = REF(target)
GLOB.AdminProcCaller = ckey //if this runtimes, too bad for you
++GLOB.AdminProcCallCount
. = world.WrapAdminProcCall(target, procname, arguments)
if(--GLOB.AdminProcCallCount == 0)
GLOB.AdminProcCaller = null
if(!is_remote_handler)
GLOB.AdminProcCaller = user_identifier //if this runtimes, too bad for you
++GLOB.AdminProcCallCount
. = world.WrapAdminProcCall(target, procname, arguments)
GLOB.AdminProcCallCount--
if(GLOB.AdminProcCallCount == 0)
GLOB.AdminProcCaller = null
else
. = world.WrapAdminProcCall(target, procname, arguments)
//adv proc call this, ya nerds
/world/proc/WrapAdminProcCall(datum/target, procname, list/arguments)
if(target == GLOBAL_PROC)
return call(text2path("/proc/[procname]"))(arglist(arguments))
return call("/proc/[procname]")(arglist(arguments))
else if(target != world)
return call(target, procname)(arglist(arguments))
else
@@ -135,7 +214,7 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
return usr && usr.client && GLOB.AdminProcCaller == usr.client.ckey
#endif
/client/proc/callproc_datum(datum/A as null|area|mob|obj|turf)
/client/proc/callproc_datum(datum/thing as null|area|mob|obj|turf)
set category = "Debug"
set name = "Atom ProcCall"
set waitfor = 0
@@ -143,29 +222,29 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(!check_rights(R_DEBUG))
return
var/procname = input("Proc name, eg: fake_blood","Proc:", null) as text|null
var/procname = input(usr, "Proc name, eg: fake_blood","Proc:", null) as text|null
if(!procname)
return
if(!hascall(A,procname))
to_chat(usr, "<font color='red'>Error: callproc_datum(): type [A.type] has no proc named [procname].</font>")
if(!hascall(thing, procname))
to_chat(usr, "<font color='red'>Error: callproc_datum(): type [thing.type] has no proc named [procname].</font>", confidential = TRUE)
return
var/list/lst = get_callproc_args()
if(!lst)
return
if(!A || !is_valid_src(A))
to_chat(usr, "<span class='warning'>Error: callproc_datum(): owner of proc no longer exists.</span>")
if(!thing || !is_valid_src(thing))
to_chat(usr, SPAN_WARNING("Error: callproc_datum(): owner of proc no longer exists."), confidential = TRUE)
return
log_admin("[key_name(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].")
var/msg = "[key_name(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]."
log_admin("[key_name(usr)] called [thing]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].")
var/msg = "[key_name(usr)] called [thing]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]."
message_admins(msg)
admin_ticket_log(A, msg)
//SSblackbox.record_feedback("tally", "admin_verb", 1, "Atom ProcCall") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
admin_ticket_log(thing, msg)
// BLACKBOX_LOG_ADMIN_VERB("Atom ProcCall")
var/returnval = WrapAdminProcCall(A, procname, lst) // Pass the lst as an argument list to the proc
var/returnval = WrapAdminProcCall(thing, procname, lst) // Pass the lst as an argument list to the proc
. = get_callproc_returnval(returnval,procname)
if(.)
to_chat(usr, .)
to_chat(usr, ., confidential = TRUE)
/client/proc/get_callproc_args()
var/argnum = input("Number of arguments","Number:",0) as num|null