diff --git a/citadel.dme b/citadel.dme index 66a5e029114..029578463cd 100644 --- a/citadel.dme +++ b/citadel.dme @@ -74,6 +74,7 @@ #include "code\__DEFINES\recipes.dm" #include "code\__DEFINES\robots.dm" #include "code\__DEFINES\roguemining_vr.dm" +#include "code\__DEFINES\role_preferences.dm" #include "code\__DEFINES\rust_g.dm" #include "code\__DEFINES\screen.dm" #include "code\__DEFINES\shields.dm" diff --git a/code/__DEFINES/role_preferences.dm b/code/__DEFINES/role_preferences.dm new file mode 100644 index 00000000000..ba7189cd963 --- /dev/null +++ b/code/__DEFINES/role_preferences.dm @@ -0,0 +1 @@ +#define ROLE_GHOST "ghost" diff --git a/code/__DEFINES/vv.dm b/code/__DEFINES/vv.dm index 0c812d4b04d..a3f0a9dee7e 100644 --- a/code/__DEFINES/vv.dm +++ b/code/__DEFINES/vv.dm @@ -97,6 +97,7 @@ #define VV_HK_EDIT_ARMOR "edit_armor" // /mob +#define VV_HK_TRIGGER_OFFER_MOB_TO_GHOSTS "offer_mob_to_ghosts" /// used on /mob as well as /obj/item/organ #define VV_HK_ADD_PHYSIOLOGY_MODIFIER "add_physiology_mod" /// used on /mob as well as /obj/item/organ diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 4dcc1910152..4e9ca9fe362 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -583,3 +583,4 @@ hear |= recursive_mob_check(A, hear, 3, 1, 0, 1) return hear + diff --git a/code/datums/ghost_query.dm b/code/datums/ghost_query.dm index 8fd34456a1b..bd5b0485a8c 100644 --- a/code/datums/ghost_query.dm +++ b/code/datums/ghost_query.dm @@ -158,3 +158,6 @@ question = "A cursed blade has been discovered by a curious explorer. \ Would you like to play as the soul imprisoned within?" cutoff_number = 1 + +/datum/ghost_query/admin + wait_time = 10 SECONDS diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 2696567e57e..b81b51c2bd5 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -648,3 +648,24 @@ GLOBAL_VAR_INIT(organ_combined_size, 25 + 70 + 30 + 25 + 25 + 25 + 25 + 10 + 10 return TRUE else return FALSE + +// asks ghosts to take control of a mob, ported from cit main +/proc/offer_control(mob/M,ignore_category=null) + if(usr) + log_admin("[key_name(usr)] has offered control of ([key_name(M)]) to ghosts.") + message_admins("[key_name_admin(usr)] has offered control of ([ADMIN_LOOKUPFLW(M)]) to ghosts") + + var/datum/ghost_query/admin/query = new() + query.wait_time = 15 SECONDS + var/mob_name = M.real_name ? M.real_name : M.name + query.role_name = mob_name + query.question = "Do you want to play as [mob_name]?" + spawn(0) + query.query() + if(LAZYLEN(query.candidates)) + var/mob/C = pick(query.candidates) + message_admins("[key_name_admin(C)] has taken control of ([key_name_admin(M)])") + M.ghostize(FALSE, TRUE) + C.transfer_client_to(M, FALSE) + else + message_admins("No ghosts were willing to take control of [ADMIN_LOOKUPFLW(M)])") diff --git a/code/modules/mob/physiology.dm b/code/modules/mob/physiology.dm index 9fa1b0dbf09..d8f62a1bd31 100644 --- a/code/modules/mob/physiology.dm +++ b/code/modules/mob/physiology.dm @@ -195,41 +195,6 @@ GLOBAL_LIST_EMPTY(cached_physiology_modifiers) continue physiology.apply(modifier) -/mob/vv_get_dropdown() - . = ..() - VV_DROPDOWN_OPTION(null, "-----") - VV_DROPDOWN_OPTION(VV_HK_ADD_PHYSIOLOGY_MODIFIER, "Add Physiology Modifier") - VV_DROPDOWN_OPTION(VV_HK_REMOVE_PHYSIOLOGY_MODIFIER, "Remove Physiology Modifier") - -/mob/vv_do_topic(list/href_list) - . = ..() - if(href_list[VV_HK_ADD_PHYSIOLOGY_MODIFIER]) - // todo: this should be able to be done globally via admin panel and then added to mobs - - var/datum/physiology_modifier/modifier = ask_admin_for_a_physiology_modifier(usr) - - if(isnull(modifier)) - return - if(QDELETED(src)) - return - - log_admin("[key_name(usr)] --> [key_name(src)] - added physiology modifier [json_encode(modifier.serialize())]") - add_physiology_modifier(modifier) - return TRUE - - if(href_list[VV_HK_REMOVE_PHYSIOLOGY_MODIFIER]) - var/list/assembled = list() - var/i = 0 - for(var/datum/physiology_modifier/modifier as anything in physiology_modifiers) - assembled["[modifier.name] (#[++i])"] = modifier - var/picked = input(usr, "Which modifier to remove? Please do not do this unless you know what you are doing.", "Remove Physiology Modifier") as null|anything in assembled - var/datum/physiology_modifier/removing = assembled[picked] - if(!(removing in physiology_modifiers)) - return TRUE - log_admin("[key_name(usr)] --> [key_name(src)] - removed physiology modifier [json_encode(removing.serialize())]") - remove_physiology_modifier(removing) - return TRUE - // i'm not going to fucking support vv without automated backreferences and macros, holy shit. // /mob/proc/get_varedit_physiology_modifier() // RETURN_TYPE(/datum/physiology_modifier) diff --git a/code/modules/mob/vv.dm b/code/modules/mob/vv.dm index 3cccec624c2..1c7e33cbaf2 100644 --- a/code/modules/mob/vv.dm +++ b/code/modules/mob/vv.dm @@ -9,3 +9,42 @@ set_pixel_shift_y(var_value) return TRUE return ..() + +/mob/vv_get_dropdown() + . = ..() + VV_DROPDOWN_OPTION(null, "-----") + VV_DROPDOWN_OPTION(VV_HK_ADD_PHYSIOLOGY_MODIFIER, "Add Physiology Modifier") + VV_DROPDOWN_OPTION(VV_HK_REMOVE_PHYSIOLOGY_MODIFIER, "Remove Physiology Modifier") + VV_DROPDOWN_OPTION(VV_HK_TRIGGER_OFFER_MOB_TO_GHOSTS, "Offer Mob To Ghosts") + +/mob/vv_do_topic(list/href_list) + . = ..() + if(href_list[VV_HK_ADD_PHYSIOLOGY_MODIFIER]) + // todo: this should be able to be done globally via admin panel and then added to mobs + + var/datum/physiology_modifier/modifier = ask_admin_for_a_physiology_modifier(usr) + + if(isnull(modifier)) + return + if(QDELETED(src)) + return + + log_admin("[key_name(usr)] --> [key_name(src)] - added physiology modifier [json_encode(modifier.serialize())]") + add_physiology_modifier(modifier) + return TRUE + + if(href_list[VV_HK_REMOVE_PHYSIOLOGY_MODIFIER]) + var/list/assembled = list() + var/i = 0 + for(var/datum/physiology_modifier/modifier as anything in physiology_modifiers) + assembled["[modifier.name] (#[++i])"] = modifier + var/picked = input(usr, "Which modifier to remove? Please do not do this unless you know what you are doing.", "Remove Physiology Modifier") as null|anything in assembled + var/datum/physiology_modifier/removing = assembled[picked] + if(!(removing in physiology_modifiers)) + return TRUE + log_admin("[key_name(usr)] --> [key_name(src)] - removed physiology modifier [json_encode(removing.serialize())]") + remove_physiology_modifier(removing) + return TRUE + + if(href_list[VV_HK_TRIGGER_OFFER_MOB_TO_GHOSTS]) + offer_control(src)