Improves admin interaction with AIs (#22769)

* admin-ai improvements

* Update code/modules/admin/misc_admin_procs.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>

* brug

---------

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
This commit is contained in:
Contrabang
2023-10-22 12:49:59 -04:00
committed by GitHub
co-authored by Luc
parent 0e455176b2
commit 12b73a4d45
4 changed files with 47 additions and 8 deletions
+35 -8
View File
@@ -889,27 +889,27 @@ GLOBAL_VAR_INIT(gamma_ship_location, 1) // 0 = station , 1 = space
//returns 1 to let the dragdrop code know we are trapping this event
//returns 0 if we don't plan to trap the event
/datum/admins/proc/cmd_ghost_drag(mob/dead/observer/frommob, tothing)
/datum/admins/proc/cmd_ghost_drag(mob/dead/observer/frommob, atom/tothing)
if(!istype(frommob))
return //extra sanity check to make sure only observers are shoved into things
//same as assume-direct-control perm requirements.
if(!check_rights(R_VAREDIT,0)) //no varedit, check if they have r_admin and r_debug
if(!check_rights(R_ADMIN|R_DEBUG,0)) //if they don't have r_admin and r_debug, return
return 0 //otherwise, if they have no varedit, but do have r_admin and r_debug, execute the rest of the code
return FALSE //otherwise, if they have no varedit, but do have r_admin and r_debug, execute the rest of the code
if(!frommob.ckey)
return 0
return FALSE
if(isitem(tothing))
var/mob/living/toitem = tothing
var/ask = alert("Are you sure you want to allow [frommob.name]([frommob.key]) to possess [toitem.name]?", "Place ghost in control of item?", "Yes", "No")
if(ask != "Yes")
return 1
return TRUE
if(!frommob || !toitem) //make sure the mobs don't go away while we waited for a response
return 1
return TRUE
var/mob/living/simple_animal/possessed_object/tomob = new(toitem)
@@ -931,10 +931,10 @@ GLOBAL_VAR_INIT(gamma_ship_location, 1) // 0 = station , 1 = space
var/ask = alert(question, "Place ghost in control of mob?", "Yes", "No")
if(ask != "Yes")
return 1
return TRUE
if(!frommob || !tomob) //make sure the mobs don't go away while we waited for a response
return 1
return TRUE
if(tomob.client) //no need to ghostize if there is no client
tomob.ghostize(0)
@@ -946,7 +946,34 @@ GLOBAL_VAR_INIT(gamma_ship_location, 1) // 0 = station , 1 = space
tomob.ckey = frommob.ckey
qdel(frommob)
return 1
return TRUE
if(istype(tothing, /obj/structure/AIcore/deactivated))
var/question = "Are you sure you want to place [frommob.name]([frommob.key]) in control of an empty AI core?"
var/ask = alert(question, "Place ghost in control of an empty AI core?", "Yes", "No")
if(ask != "Yes")
return TRUE
if(QDELETED(frommob) || QDELETED(tothing)) //make sure the mobs don't go away while we waited for a response
return TRUE
message_admins("<span class='adminnotice'>[key_name_admin(usr)] has put [frommob.ckey] in control of an empty AI core.</span>")
log_admin("[key_name(usr)] stuffed [frommob.ckey] into an empty AI core.")
SSblackbox.record_feedback("tally", "admin_verb", 1, "Ghost Drag")
var/transfer_key = frommob.key // frommob is qdel'd in frommob.AIize()
var/mob/living/silicon/ai/ai_character = frommob.AIize()
ai_character.key = transfer_key // this wont occur in mind transferring if the mind is not active, which causes some weird stuff. This fixes it.
GLOB.empty_playable_ai_cores -= tothing
ai_character.forceMove(get_turf(tothing))
ai_character.view_core()
qdel(tothing)
return TRUE
// Returns a list of the number of admins in various categories
// result[1] is the number of staff that match the rank mask and are active