diff --git a/code/__HELPERS/trait_helpers.dm b/code/__HELPERS/trait_helpers.dm index af8040177b82..ecaa149c21e2 100644 --- a/code/__HELPERS/trait_helpers.dm +++ b/code/__HELPERS/trait_helpers.dm @@ -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" diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index f276bcc25abd..43bb64040753 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -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, diff --git a/code/modules/buildmode/submodes/offer.dm b/code/modules/buildmode/submodes/offer.dm new file mode 100644 index 000000000000..e3a57d02c453 --- /dev/null +++ b/code/modules/buildmode/submodes/offer.dm @@ -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, "***********************************************************") + to_chat(user, "Left click to offer a mob") + to_chat(user, "Right click to change amount of playtime a player needs to be able to sign up and whether to display their special role") + to_chat(user, "***********************************************************") + +/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) + diff --git a/code/modules/mob/mob_misc_procs.dm b/code/modules/mob/mob_misc_procs.dm index b01207220e52..82c6b28156e7 100644 --- a/code/modules/mob/mob_misc_procs.dm +++ b/code/modules/mob/mob_misc_procs.dm @@ -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)) diff --git a/icons/misc/buildmode.dmi b/icons/misc/buildmode.dmi index 025cf3350a25..80c9d404a10b 100644 Binary files a/icons/misc/buildmode.dmi and b/icons/misc/buildmode.dmi differ diff --git a/paradise.dme b/paradise.dme index 9c247ecfd6a4..abf93abd27f3 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1658,6 +1658,7 @@ #include "code\modules\buildmode\submodes\forcemove.dm" #include "code\modules\buildmode\submodes\link.dm" #include "code\modules\buildmode\submodes\mapgen.dm" +#include "code\modules\buildmode\submodes\offer.dm" #include "code\modules\buildmode\submodes\save.dm" #include "code\modules\buildmode\submodes\throwing.dm" #include "code\modules\buildmode\submodes\tilt.dm"