Administration tool: Build mode offer tool to quickly offer large amount of mobs. (#26712)

* offer buildmode

* stops asking to show special role if already decided in build mode

* Update offer.dm

* minor oopsy

* linter crying

* Update code/modules/buildmode/submodes/offer.dm

Co-authored-by: chuga-git <98280110+chuga-git@users.noreply.github.com>
Signed-off-by: meow20 <62257265+meow20@users.noreply.github.com>

* Update mob_misc_procs.dm

* Update code/modules/mob/mob_misc_procs.dm

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

---------

Signed-off-by: meow20 <62257265+meow20@users.noreply.github.com>
Co-authored-by: chuga-git <98280110+chuga-git@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
This commit is contained in:
meow20
2024-09-19 12:46:53 +02:00
committed by GitHub
parent c1c1ef94f5
commit a091516181
6 changed files with 47 additions and 5 deletions
+1
View File
@@ -137,6 +137,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
//***** MOB TRAITS *****//
#define TRAIT_RESPAWNABLE "can_respawn_as_ghost_roles"
#define TRAIT_BEING_OFFERED "offered"
#define TRAIT_BLIND "blind"
#define TRAIT_MUTE "mute"
#define TRAIT_DEAF "deaf"
+1
View File
@@ -5,6 +5,7 @@
*/
GLOBAL_LIST_INIT(traits_by_type, list(
/mob = list(
"TRAIT_BEING_OFFERED" = TRAIT_BEING_OFFERED,
"TRAIT_BLIND" = TRAIT_BLIND,
"TRAIT_MUTE" = TRAIT_MUTE,
"TRAIT_DEAF" = TRAIT_DEAF,
+29
View File
@@ -0,0 +1,29 @@
// Speeds up the offering process and optionally allows the admin to set up playtime requirement and "Show role" only once.
// Default setting is 20H like the default recommendation for offering from drop down menu.
/datum/buildmode_mode/offer
key = "offer"
var/hours = 20
var/hide_role
/datum/buildmode_mode/offer/show_help(mob/user)
to_chat(user, "<span class='notice'>***********************************************************</span>")
to_chat(user, "<span class='notice'>Left click to offer a mob</span>")
to_chat(user, "<span class='notice'>Right click to change amount of playtime a player needs to be able to sign up and whether to display their special role</span>")
to_chat(user, "<span class='notice'>***********************************************************</span>")
/datum/buildmode_mode/offer/change_settings(mob/user)
hours = input(user, "Playtime required", "Input", 20) as num|null
if(alert("Do you want to show the mob's special role?", null, "Yes", "No") == "Yes")
hide_role = FALSE
else
hide_role = TRUE
/datum/buildmode_mode/offer/handle_click(mob/user, params, atom/A)
var/list/modifiers = params2list(params)
var/left_click = LAZYACCESS(modifiers, LEFT_CLICK)
var/selected_atom
if(left_click && ismob(A) && !isobserver(A))
selected_atom = A
offer_control(selected_atom, hours, hide_role)
+15 -5
View File
@@ -158,16 +158,26 @@
return U.sensor_mode
return SUIT_SENSOR_OFF
/proc/offer_control(mob/M)
to_chat(M, "Control of your mob has been offered to dead players.")
/proc/offer_control(mob/M, hours, hide_role)
if(HAS_TRAIT(M, TRAIT_BEING_OFFERED))
return
var/minhours
ADD_TRAIT(M, TRAIT_BEING_OFFERED, "admin_offer")
log_admin("[key_name(usr)] has offered control of ([key_name(M)]) to ghosts.")
var/minhours = input(usr, "Minimum hours required to play [M]?", "Set Min Hrs", 10) as num
message_admins("[key_name_admin(usr)] has offered control of ([key_name_admin(M)]) to ghosts with [minhours] hrs playtime")
var/question = "Do you want to play as [M.real_name ? M.real_name : M.name][M.job ? " ([M.job])" : ""]"
if(alert("Do you want to show the antag status?","Show antag status","Yes","No") == "Yes")
if(!hours)
minhours = input(usr, "Minimum hours required to play [M]?", "Set Min Hrs", 10) as num
else
minhours = hours
if(isnull(hide_role))
if(alert("Do you want to show the antag status?","Show antag status","Yes","No") == "Yes")
question += ", [M.mind?.special_role || "No special role"]"
else if(!hide_role)
question += ", [M.mind?.special_role ? M.mind?.special_role : "No special role"]"
message_admins("[key_name_admin(usr)] has offered control of ([key_name_admin(M)]) to ghosts with [minhours] hrs playtime")
var/list/mob/dead/observer/candidates = SSghost_spawns.poll_candidates("[question]?", poll_time = 10 SECONDS, min_hours = minhours, source = M)
var/mob/dead/observer/theghost = null
REMOVE_TRAIT(M, TRAIT_BEING_OFFERED, "admin_offer")
if(length(candidates))
if(QDELETED(M))