Skip to content

Commit

Permalink
TGS Test Merge (#6767)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevinz authored and Kevinz committed Oct 5, 2024
2 parents d45de76 + b5bca3d commit 3032746
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 35 deletions.
1 change: 1 addition & 0 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/role_preferences.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define ROLE_GHOST "ghost"
1 change: 1 addition & 0 deletions code/__DEFINES/vv.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions code/__HELPERS/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -583,3 +583,4 @@
hear |= recursive_mob_check(A, hear, 3, 1, 0, 1)

return hear

3 changes: 3 additions & 0 deletions code/datums/ghost_query.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 23 additions & 0 deletions code/modules/mob/mob_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -648,3 +648,26 @@ 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)
return TRUE
else
message_admins("No ghosts were willing to take control of [ADMIN_LOOKUPFLW(M)])")
return FALSE
35 changes: 0 additions & 35 deletions code/modules/mob/physiology.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
39 changes: 39 additions & 0 deletions code/modules/mob/vv.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 3032746

Please sign in to comment.