From 277dbe275c4ed5fee980924d6488c58af051076f Mon Sep 17 00:00:00 2001 From: MistakeNot4892 Date: Thu, 2 Nov 2023 19:11:43 +1100 Subject: [PATCH 1/2] Vitals sensors are now handled by an accessory. --- code/__defines/items_clothing.dm | 13 +- code/_global_vars/lists/clothing.dm | 4 + .../extensions/multitool/items/clothing.dm | 19 +-- code/datums/outfits/_defines.dm | 1 + code/datums/outfits/jobs/generic.dm | 2 +- code/datums/outfits/jobs/job.dm | 2 +- code/datums/outfits/misc.dm | 4 +- code/datums/outfits/outfit.dm | 37 +++++- code/datums/outfits/pirates.dm | 2 +- code/datums/outfits/spec_op.dm | 4 +- code/datums/outfits/wizardry.dm | 2 +- code/datums/repositories/crew/binary.dm | 8 +- code/datums/repositories/crew/crew.dm | 60 ++++----- .../repositories/crew/crew_sensor_modifier.dm | 6 +- code/datums/repositories/crew/general.dm | 22 ++-- code/datums/repositories/crew/tracking.dm | 10 +- code/datums/repositories/crew/vital.dm | 8 +- code/game/machinery/camera/tracking.dm | 2 +- code/game/objects/item.dm | 3 + .../items/devices/suit_sensor_jammer.dm | 2 +- code/modules/admin/quantum_mechanic.dm | 2 - code/modules/admin/verbs/debug.dm | 2 +- .../preference_setup/loadout/loadout.dm | 1 + code/modules/clothing/_clothing.dm | 50 ++++++++ code/modules/clothing/pants/_pants.dm | 1 + code/modules/clothing/under/_under.dm | 91 +------------- .../under/accessories/vitals_sensor.dm | 116 ++++++++++++++++++ code/modules/clothing/under/color.dm | 9 +- code/modules/clothing/under/syndicate.dm | 3 - code/modules/mob/living/carbon/human/npcs.dm | 14 +-- code/modules/mob/mob.dm | 13 +- code/modules/mob/mob_helpers.dm | 11 +- code/modules/mob/stripping.dm | 41 ++++--- .../programs/medical/suit_sensors.dm | 2 +- code/procs/hud.dm | 4 +- icons/clothing/accessories/vitals_sensor.dmi | Bin 0 -> 749 bytes maps/exodus/outfits/cargo.dm | 2 +- maps/exodus/outfits/engineering.dm | 2 +- maps/ministation/outfits/civilian.dm | 2 +- maps/ministation/outfits/engineering.dm | 2 +- maps/tradeship/outfits/engineering.dm | 4 +- mods/species/ascent/items/clothing.dm | 18 +-- mods/species/vox/gear/gear_under.dm | 1 - nebula.dme | 1 + 44 files changed, 363 insertions(+), 240 deletions(-) create mode 100644 code/modules/clothing/under/accessories/vitals_sensor.dm create mode 100644 icons/clothing/accessories/vitals_sensor.dmi diff --git a/code/__defines/items_clothing.dm b/code/__defines/items_clothing.dm index 6cb6f626c75..bbde90aa3bf 100644 --- a/code/__defines/items_clothing.dm +++ b/code/__defines/items_clothing.dm @@ -17,6 +17,7 @@ #define ACCESSORY_SLOT_ARMOR_M "Misc armor" #define ACCESSORY_SLOT_HELM_C "Helmet cover" #define ACCESSORY_SLOT_OVER "Over" +#define ACCESSORY_SLOT_SENSORS "Suit Sensors" // Bitmasks for the flags_inv variable. These determine when a piece of clothing hides another, i.e. a helmet hiding glasses. // WARNING: The following flags apply only to the external suit! @@ -155,14 +156,10 @@ #define THROWNOBJ_KNOCKBACK_DIVISOR 2 // Affects how much speed the mob is knocked back with. // Suit sensor levels -#define SUIT_SENSOR_OFF 0 -#define SUIT_SENSOR_BINARY 1 -#define SUIT_SENSOR_VITAL 2 -#define SUIT_SENSOR_TRACKING 3 - -#define SUIT_NO_SENSORS 0 -#define SUIT_HAS_SENSORS 1 -#define SUIT_LOCKED_SENSORS 2 +#define VITALS_SENSOR_OFF 0 +#define VITALS_SENSOR_BINARY 1 +#define VITALS_SENSOR_VITAL 2 +#define VITALS_SENSOR_TRACKING 3 // Hair Flags #define VERY_SHORT BITFLAG(0) diff --git a/code/_global_vars/lists/clothing.dm b/code/_global_vars/lists/clothing.dm index a65b597aefc..4ee24c9b08f 100644 --- a/code/_global_vars/lists/clothing.dm +++ b/code/_global_vars/lists/clothing.dm @@ -35,3 +35,7 @@ var/global/list/abstract_inventory_slots = list( slot_underpants_str, slot_socks_str ) + +var/global/list/vitals_sensor_equip_slots = list( + slot_w_uniform_str +) diff --git a/code/datums/extensions/multitool/items/clothing.dm b/code/datums/extensions/multitool/items/clothing.dm index c3c3ee6db28..1693e945351 100644 --- a/code/datums/extensions/multitool/items/clothing.dm +++ b/code/datums/extensions/multitool/items/clothing.dm @@ -1,13 +1,18 @@ -/obj/item/clothing/under/Initialize() +/obj/item/clothing/Initialize() . = ..() - set_extension(src, /datum/extension/interactive/multitool/items/clothing) + if(ACCESSORY_SLOT_SENSORS in valid_accessory_slots) + set_extension(src, /datum/extension/interactive/multitool/items/clothing) /datum/extension/interactive/multitool/items/clothing/interact(var/obj/item/multitool/M, var/mob/user) if(extension_status(user) != STATUS_INTERACTIVE) return - var/obj/item/clothing/under/u = holder - if(u.has_sensor == SUIT_NO_SENSORS) - to_chat(user, SPAN_WARNING("\The [u] doesn't have suit sensors.")) + var/obj/item/clothing/uniform = holder + if(!istype(uniform)) + to_chat(user, SPAN_WARNING("\The [user] is not wearing an appropriate uniform.")) return - u.has_sensor = u.has_sensor == SUIT_LOCKED_SENSORS ? SUIT_HAS_SENSORS : SUIT_LOCKED_SENSORS - user.visible_message(SPAN_NOTICE("\The [user] [u.has_sensor == SUIT_LOCKED_SENSORS ? "" : "un"]locks \the [u]'s suit sensor controls."), range = 2) + var/obj/item/clothing/accessory/vitals_sensor/sensor = locate() in uniform.accessories + if(!sensor) + to_chat(user, SPAN_WARNING("\The [uniform] doesn't have a vitals sensors attached.")) + return + sensor.sensors_locked = !sensor.sensors_locked + user.visible_message(SPAN_NOTICE("\The [user] [sensor.sensors_locked ? "" : "un"]locks \the [user]'s suit sensor controls."), range = 2) diff --git a/code/datums/outfits/_defines.dm b/code/datums/outfits/_defines.dm index 90defc13771..3f2c3d51ae9 100644 --- a/code/datums/outfits/_defines.dm +++ b/code/datums/outfits/_defines.dm @@ -3,6 +3,7 @@ #define OUTFIT_HAS_BACKPACK BITFLAG(1) #define OUTFIT_EXTENDED_SURVIVAL BITFLAG(2) #define OUTFIT_RESET_EQUIPMENT BITFLAG(3) +#define OUTFIT_HAS_VITALS_SENSOR BITFLAG(4) #define OUTFIT_ADJUSTMENT_SKIP_POST_EQUIP BITFLAG(0) #define OUTFIT_ADJUSTMENT_SKIP_SURVIVAL_GEAR BITFLAG(1) diff --git a/code/datums/outfits/jobs/generic.dm b/code/datums/outfits/jobs/generic.dm index f69de63ccf8..d18d8b514f5 100644 --- a/code/datums/outfits/jobs/generic.dm +++ b/code/datums/outfits/jobs/generic.dm @@ -23,7 +23,7 @@ shoes = /obj/item/clothing/shoes/workboots pda_type = /obj/item/modular_computer/pda/engineering pda_slot = slot_l_store_str - flags = OUTFIT_HAS_BACKPACK|OUTFIT_EXTENDED_SURVIVAL + outfit_flags = OUTFIT_HAS_BACKPACK | OUTFIT_EXTENDED_SURVIVAL | OUTFIT_HAS_VITALS_SENSOR /decl/hierarchy/outfit/job/generic/engineer/Initialize() . = ..() diff --git a/code/datums/outfits/jobs/job.dm b/code/datums/outfits/jobs/job.dm index 127a9655c20..80311b8a23a 100644 --- a/code/datums/outfits/jobs/job.dm +++ b/code/datums/outfits/jobs/job.dm @@ -11,4 +11,4 @@ pda_slot = slot_belt_str pda_type = /obj/item/modular_computer/pda - flags = OUTFIT_HAS_BACKPACK + outfit_flags = OUTFIT_HAS_BACKPACK | OUTFIT_HAS_VITALS_SENSOR diff --git a/code/datums/outfits/misc.dm b/code/datums/outfits/misc.dm index 1d81c10d1b0..476c5d7e16d 100644 --- a/code/datums/outfits/misc.dm +++ b/code/datums/outfits/misc.dm @@ -6,7 +6,7 @@ uniform = /obj/item/clothing/under/color/grey back = /obj/item/tank/jetpack/oxygen mask = /obj/item/clothing/mask/breath - flags = OUTFIT_HAS_JETPACK|OUTFIT_RESET_EQUIPMENT + outfit_flags = OUTFIT_HAS_JETPACK|OUTFIT_RESET_EQUIPMENT /decl/hierarchy/outfit/soviet_soldier name = "Soviet soldier" @@ -35,7 +35,7 @@ l_ear = /obj/item/radio/headset uniform = /obj/item/clothing/under/clown l_pocket = /obj/item/bikehorn - flags = OUTFIT_HAS_BACKPACK|OUTFIT_RESET_EQUIPMENT + outfit_flags = OUTFIT_HAS_BACKPACK | OUTFIT_RESET_EQUIPMENT | OUTFIT_HAS_VITALS_SENSOR /decl/hierarchy/outfit/clown/Initialize() . = ..() diff --git a/code/datums/outfits/outfit.dm b/code/datums/outfits/outfit.dm index 83f340d7415..59f2f8dc658 100644 --- a/code/datums/outfits/outfit.dm +++ b/code/datums/outfits/outfit.dm @@ -53,7 +53,7 @@ var/global/list/outfits_decls_by_type_ var/id_pda_assignment var/list/backpack_overrides - var/flags = OUTFIT_RESET_EQUIPMENT + var/outfit_flags = OUTFIT_RESET_EQUIPMENT /decl/hierarchy/outfit/Initialize() . = ..() @@ -62,12 +62,29 @@ var/global/list/outfits_decls_by_type_ outfits_decls_by_type_[type] = src dd_insertObjectList(outfits_decls_, src) +// This proc is structured slightly strangely because I will be adding pants to it. +/decl/hierarchy/outfit/validate() + . = ..() + if(uniform && (outfit_flags & OUTFIT_HAS_VITALS_SENSOR)) + if(!ispath(uniform, /obj/item/clothing)) + . += "outfit is flagged for sensors, but uniform cannot take accessories" + var/succeeded = FALSE + var/obj/item/sensor = new /obj/item/clothing/accessory/vitals_sensor + if(uniform) + var/obj/item/clothing/wear_uniform = new uniform // sadly we need to read a list + if(wear_uniform.can_attach_accessory(sensor)) + succeeded = TRUE + qdel(wear_uniform) + if(!succeeded) + . += "outfit is flagged for sensors, but uniform do not accept sensors" + qdel(sensor) + /decl/hierarchy/outfit/proc/pre_equip(mob/living/carbon/human/H) - if(flags & OUTFIT_RESET_EQUIPMENT) + if(outfit_flags & OUTFIT_RESET_EQUIPMENT) H.delete_inventory(TRUE) /decl/hierarchy/outfit/proc/post_equip(mob/living/carbon/human/H) - if(flags & OUTFIT_HAS_JETPACK) + if(outfit_flags & OUTFIT_HAS_JETPACK) var/obj/item/tank/jetpack/J = locate(/obj/item/tank/jetpack) in H if(!J) return @@ -85,6 +102,16 @@ var/global/list/outfits_decls_by_type_ if(!(OUTFIT_ADJUSTMENT_SKIP_POST_EQUIP & equip_adjustments)) post_equip(H) + if(outfit_flags & OUTFIT_HAS_VITALS_SENSOR) + var/obj/item/clothing/accessory/vitals_sensor/sensor = new(get_turf(H)) + for(var/check_slot in global.vitals_sensor_equip_slots) + var/obj/item/clothing/equipped = H.get_equipped_item(check_slot) + if(istype(equipped) && !(locate(/obj/item/clothing/accessory/vitals_sensor) in equipped.accessories) && equipped.can_attach_accessory(sensor)) + equipped.attach_accessory(null, sensor) + break + if(isturf(sensor)) + H.put_in_hands(sensor) + return 1 /decl/hierarchy/outfit/proc/equip_base(mob/living/carbon/human/H, var/equip_adjustments) @@ -137,7 +164,7 @@ var/global/list/outfits_decls_by_type_ for(var/hand in hands) H.put_in_hands(new hand(H)) - if((flags & OUTFIT_HAS_BACKPACK) && !(OUTFIT_ADJUSTMENT_SKIP_BACKPACK & equip_adjustments)) + if((outfit_flags & OUTFIT_HAS_BACKPACK) && !(OUTFIT_ADJUSTMENT_SKIP_BACKPACK & equip_adjustments)) var/decl/backpack_outfit/bo var/metadata @@ -158,7 +185,7 @@ var/global/list/outfits_decls_by_type_ H.equip_to_slot_or_del(backpack, slot_back_str) if(H.species && !(OUTFIT_ADJUSTMENT_SKIP_SURVIVAL_GEAR & equip_adjustments)) - if(flags & OUTFIT_EXTENDED_SURVIVAL) + if(outfit_flags & OUTFIT_EXTENDED_SURVIVAL) H.species.equip_survival_gear(H, /obj/item/storage/box/engineer) else if(H.client?.prefs?.survival_box_choice && global.survival_box_choices[H.client.prefs.survival_box_choice]) var/decl/survival_box_option/box = global.survival_box_choices[H.client.prefs.survival_box_choice] diff --git a/code/datums/outfits/pirates.dm b/code/datums/outfits/pirates.dm index 75b37553c2d..b30b4f95252 100644 --- a/code/datums/outfits/pirates.dm +++ b/code/datums/outfits/pirates.dm @@ -15,4 +15,4 @@ head = /obj/item/clothing/suit/armor/pirate suit = /obj/item/clothing/suit/pirate back = /obj/item/tank/jetpack/oxygen - flags = OUTFIT_HAS_JETPACK|OUTFIT_RESET_EQUIPMENT + outfit_flags = OUTFIT_HAS_JETPACK|OUTFIT_RESET_EQUIPMENT diff --git a/code/datums/outfits/spec_op.dm b/code/datums/outfits/spec_op.dm index 2578207ff3a..70eaf26bb9e 100644 --- a/code/datums/outfits/spec_op.dm +++ b/code/datums/outfits/spec_op.dm @@ -22,7 +22,7 @@ back = /obj/item/tank/jetpack/oxygen mask = /obj/item/clothing/mask/gas/swat - flags = OUTFIT_HAS_JETPACK|OUTFIT_RESET_EQUIPMENT + outfit_flags = OUTFIT_HAS_JETPACK|OUTFIT_RESET_EQUIPMENT /decl/hierarchy/outfit/ert name = "Spec Ops - Emergency response team" @@ -54,7 +54,7 @@ backpack_contents = list(/obj/item/clothing/suit/space/void/merc/prepared = 1, /obj/item/clothing/mask/gas/syndicate = 1) - flags = OUTFIT_HAS_BACKPACK|OUTFIT_RESET_EQUIPMENT + outfit_flags = OUTFIT_HAS_BACKPACK|OUTFIT_RESET_EQUIPMENT /decl/hierarchy/outfit/mercenary/syndicate name = "Spec Ops - Syndicate" diff --git a/code/datums/outfits/wizardry.dm b/code/datums/outfits/wizardry.dm index bdecc767616..bfce1c26c4a 100644 --- a/code/datums/outfits/wizardry.dm +++ b/code/datums/outfits/wizardry.dm @@ -10,7 +10,7 @@ back = /obj/item/storage/backpack backpack_contents = list(/obj/item/storage/box = 1) abstract_type = /decl/hierarchy/outfit/wizard - flags = OUTFIT_HAS_BACKPACK|OUTFIT_RESET_EQUIPMENT + outfit_flags = OUTFIT_HAS_BACKPACK|OUTFIT_RESET_EQUIPMENT /decl/hierarchy/outfit/wizard/blue name = "Wizard - Blue" diff --git a/code/datums/repositories/crew/binary.dm b/code/datums/repositories/crew/binary.dm index c4399ea37e0..847e3b0c982 100644 --- a/code/datums/repositories/crew/binary.dm +++ b/code/datums/repositories/crew/binary.dm @@ -1,5 +1,5 @@ /* Binary */ -/crew_sensor_modifier/binary/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/binary/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) crew_data["alert"] = FALSE if(!H.isSynthetic() && H.should_have_organ(BP_HEART)) var/obj/item/organ/internal/heart/O = H.get_organ(BP_HEART, /obj/item/organ/internal/heart) @@ -19,11 +19,11 @@ /crew_sensor_modifier/binary/jamming priority = 5 -/crew_sensor_modifier/binary/jamming/alive/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/binary/jamming/alive/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) crew_data["alert"] = FALSE return MOD_SUIT_SENSORS_HANDLED -/crew_sensor_modifier/binary/jamming/dead/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/binary/jamming/dead/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) crew_data["alert"] = TRUE return MOD_SUIT_SENSORS_HANDLED @@ -37,7 +37,7 @@ /crew_sensor_modifier/binary/jamming/random/major error_prob = 100 -/crew_sensor_modifier/binary/jamming/random/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/binary/jamming/random/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) . = ..() if(prob(error_prob)) crew_data["alert"] = pick(TRUE, FALSE) diff --git a/code/datums/repositories/crew/crew.dm b/code/datums/repositories/crew/crew.dm index e0becfd3f77..8fc83a2f712 100644 --- a/code/datums/repositories/crew/crew.dm +++ b/code/datums/repositories/crew/crew.dm @@ -21,10 +21,10 @@ var/global/datum/repository/crew/crew_repository = new() tracking_modifiers.Enqueue(new/crew_sensor_modifier/tracking()) modifier_queues = list() - modifier_queues[general_modifiers] = 0 - modifier_queues[binary_modifiers] = SUIT_SENSOR_BINARY - modifier_queues[vital_modifiers] = SUIT_SENSOR_VITAL - modifier_queues[tracking_modifiers] = SUIT_SENSOR_TRACKING + modifier_queues[general_modifiers] = VITALS_SENSOR_OFF + modifier_queues[binary_modifiers] = VITALS_SENSOR_BINARY + modifier_queues[vital_modifiers] = VITALS_SENSOR_VITAL + modifier_queues[tracking_modifiers] = VITALS_SENSOR_TRACKING modifier_queues_by_type = list() modifier_queues_by_type[/crew_sensor_modifier/general] = general_modifiers @@ -49,19 +49,21 @@ var/global/datum/repository/crew/crew_repository = new() cache_data_alert[num2text(z_level)] = FALSE var/tracked = scan() - for(var/obj/item/clothing/under/C in tracked) - var/turf/pos = get_turf(C) - if(C.has_sensor && pos && pos.z == z_level && C.sensor_mode != SUIT_SENSOR_OFF) - if(ishuman(C.loc)) - var/mob/living/carbon/human/H = C.loc - if(H.get_equipped_item(slot_w_uniform_str) != C) - continue - - var/list/crewmemberData = list("sensor_type"=C.sensor_mode, "stat"=H.stat, "area"="", "x"=-1, "y"=-1, "z"=-1, "ref"="\ref[H]") - if(!(run_queues(H, C, pos, crewmemberData) & MOD_SUIT_SENSORS_REJECTED)) - crewmembers[++crewmembers.len] = crewmemberData - if (crewmemberData["alert"]) - cache_data_alert[num2text(z_level)] = TRUE + for(var/obj/item/clothing/accessory/vitals_sensor/sensor as anything in tracked) + var/turf/pos = get_turf(sensor) + if(!pos || pos.z != z_level || sensor.sensor_mode == VITALS_SENSOR_OFF) + continue + var/mob/living/carbon/human/H = sensor.loc?.loc + if(!istype(H)) + continue + var/obj/item/clothing/uniform = H.get_equipped_item(slot_w_uniform_str) + if(!istype(uniform) || !(sensor in uniform.accessories)) + continue + var/list/crewmemberData = list("sensor_type" = sensor.sensor_mode, "stat"=H.stat, "area"="", "x"=-1, "y"=-1, "z"=-1, "ref"="\ref[H]") + if(!(run_queues(H, sensor, pos, crewmemberData) & MOD_SUIT_SENSORS_REJECTED)) + crewmembers[++crewmembers.len] = crewmemberData + if (crewmemberData["alert"]) + cache_data_alert[num2text(z_level)] = TRUE crewmembers = sortTim(crewmembers, /proc/cmp_list_name_key_asc) @@ -80,39 +82,37 @@ var/global/datum/repository/crew/crew_repository = new() . = cache_data_alert[num2text(z_level)] /datum/repository/crew/proc/scan() - var/list/tracked = list() for(var/mob/living/carbon/human/H in SSmobs.mob_list) - var/obj/item/clothing/under/C = H.get_equipped_item(slot_w_uniform_str) - if(istype(C) && C.has_sensor) - tracked |= C - return tracked + var/sensor = H.get_vitals_sensor() + if(sensor) + LAZYDISTINCTADD(., sensor) -/datum/repository/crew/proc/run_queues(H, C, pos, crewmemberData) +/datum/repository/crew/proc/run_queues(H, S, pos, crewmemberData) for(var/modifier_queue in modifier_queues) if(crewmemberData["sensor_type"] >= modifier_queues[modifier_queue]) - . = process_crew_data(modifier_queue, H, C, pos, crewmemberData) + . = process_crew_data(modifier_queue, H, S, pos, crewmemberData) if(. & MOD_SUIT_SENSORS_REJECTED) return -/datum/repository/crew/proc/process_crew_data(var/datum/priority_queue/modifiers, var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/datum/repository/crew/proc/process_crew_data(var/datum/priority_queue/modifiers, var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) var/current_priority = INFINITY var/list/modifiers_of_this_priority = list() for(var/crew_sensor_modifier/csm in modifiers.L) if(csm.priority < current_priority) - . = check_queue(modifiers_of_this_priority, H, C, pos, crew_data) + . = check_queue(modifiers_of_this_priority, H, S, pos, crew_data) if(. != MOD_SUIT_SENSORS_NONE) return current_priority = csm.priority modifiers_of_this_priority += csm - return check_queue(modifiers_of_this_priority, H, C, pos, crew_data) + return check_queue(modifiers_of_this_priority, H, S, pos, crew_data) -/datum/repository/crew/proc/check_queue(var/list/modifiers_of_this_priority, H, C, pos, crew_data) +/datum/repository/crew/proc/check_queue(var/list/modifiers_of_this_priority, H, S, pos, crew_data) while(modifiers_of_this_priority.len) var/crew_sensor_modifier/pcsm = pick(modifiers_of_this_priority) modifiers_of_this_priority -= pcsm - if(pcsm.may_process_crew_data(H, C, pos)) - . = pcsm.process_crew_data(H, C, pos, crew_data) + if(pcsm.may_process_crew_data(H, S, pos)) + . = pcsm.process_crew_data(H, S, pos, crew_data) if(. != MOD_SUIT_SENSORS_NONE) return return MOD_SUIT_SENSORS_NONE diff --git a/code/datums/repositories/crew/crew_sensor_modifier.dm b/code/datums/repositories/crew/crew_sensor_modifier.dm index 753e429e83d..3dec235a49b 100644 --- a/code/datums/repositories/crew/crew_sensor_modifier.dm +++ b/code/datums/repositories/crew/crew_sensor_modifier.dm @@ -13,8 +13,8 @@ may_process_proc = null . = ..() -/crew_sensor_modifier/proc/may_process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos) - return holder && may_process_proc ? call(holder, may_process_proc)(H, C, pos) : TRUE +/crew_sensor_modifier/proc/may_process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos) + return holder && may_process_proc ? call(holder, may_process_proc)(H, S, pos) : TRUE -/crew_sensor_modifier/proc/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/proc/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) return MOD_SUIT_SENSORS_HANDLED diff --git a/code/datums/repositories/crew/general.dm b/code/datums/repositories/crew/general.dm index a2c09ddab37..c66e670ff43 100644 --- a/code/datums/repositories/crew/general.dm +++ b/code/datums/repositories/crew/general.dm @@ -1,5 +1,5 @@ /* General */ -/crew_sensor_modifier/general/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/general/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) crew_data["name"] = H.get_authentification_name(if_no_id="Unknown") crew_data["rank"] = H.get_authentification_rank(if_no_id="Unknown", if_no_job="No Job") crew_data["assignment"] = H.get_assignment(if_no_id="Unknown", if_no_job="No Job") @@ -9,23 +9,23 @@ /crew_sensor_modifier/general/jamming priority = 5 -/crew_sensor_modifier/general/jamming/off/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/general/jamming/off/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) . = ..() // This works only because general is checked first and crew_data["sensor_type"] is used to check if whether any additional data should be included. - crew_data["sensor_type"] = SUIT_SENSOR_OFF + crew_data["sensor_type"] = VITALS_SENSOR_OFF return MOD_SUIT_SENSORS_REJECTED -/crew_sensor_modifier/general/jamming/binary/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/general/jamming/binary/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) . = ..() - crew_data["sensor_type"] = SUIT_SENSOR_BINARY + crew_data["sensor_type"] = VITALS_SENSOR_BINARY -/crew_sensor_modifier/general/jamming/vital/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/general/jamming/vital/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) . = ..() - crew_data["sensor_type"] = SUIT_SENSOR_VITAL + crew_data["sensor_type"] = VITALS_SENSOR_VITAL -/crew_sensor_modifier/general/jamming/tracking/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/general/jamming/tracking/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) . = ..() - crew_data["sensor_type"] = SUIT_SENSOR_TRACKING + crew_data["sensor_type"] = VITALS_SENSOR_TRACKING /* Random */ /crew_sensor_modifier/general/jamming/random @@ -40,9 +40,9 @@ random_sensor_type_prob = 60 random_assignment_prob = 40 -/crew_sensor_modifier/general/jamming/random/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/general/jamming/random/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) . = ..() if(prob(random_sensor_type_prob)) - crew_data["sensor_type"] = pick(SUIT_SENSOR_OFF, SUIT_SENSOR_BINARY, SUIT_SENSOR_VITAL, SUIT_SENSOR_TRACKING) + crew_data["sensor_type"] = pick(VITALS_SENSOR_OFF, VITALS_SENSOR_BINARY, VITALS_SENSOR_VITAL, VITALS_SENSOR_TRACKING) if(prob(random_assignment_prob)) crew_data["assignment"] = pick("Agent", "Infiltrator", "Passenger", "Crewman", "Unknown") diff --git a/code/datums/repositories/crew/tracking.dm b/code/datums/repositories/crew/tracking.dm index 76b1bca025e..7f509e91ab5 100644 --- a/code/datums/repositories/crew/tracking.dm +++ b/code/datums/repositories/crew/tracking.dm @@ -1,5 +1,5 @@ /* Tracking */ -/crew_sensor_modifier/tracking/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/tracking/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) if(pos) var/area/A = get_area(pos) crew_data["area"] = A.proper_name @@ -12,8 +12,8 @@ /crew_sensor_modifier/tracking/jamming priority = 5 -/crew_sensor_modifier/tracking/jamming/localize/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) - return ..(H, C, get_turf(holder), crew_data) +/crew_sensor_modifier/tracking/jamming/localize/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) + return ..(H, S, get_turf(holder), crew_data) /crew_sensor_modifier/tracking/jamming/random var/shift_range = 7 @@ -27,7 +27,7 @@ /crew_sensor_modifier/tracking/jamming/random/major shift_range = 21 -/crew_sensor_modifier/tracking/jamming/random/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/tracking/jamming/random/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) if(world.time > next_shift_change) next_shift_change = world.time + rand(30 SECONDS, 2 MINUTES) x_shift = rand(-shift_range, shift_range) @@ -36,4 +36,4 @@ var/new_x = clamp(pos.x + x_shift, 1, world.maxx) var/new_y = clamp(pos.y + y_shift, 1, world.maxy) pos = locate(new_x, new_y, pos.z) - return ..(H, C, pos, crew_data) + return ..(H, S, pos, crew_data) diff --git a/code/datums/repositories/crew/vital.dm b/code/datums/repositories/crew/vital.dm index 9e7aab0f869..3cc781486c1 100644 --- a/code/datums/repositories/crew/vital.dm +++ b/code/datums/repositories/crew/vital.dm @@ -1,5 +1,5 @@ /* Vital */ -/crew_sensor_modifier/vital/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/vital/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) crew_data["true_pulse"] = -1 crew_data["pulse"] = "N/A" crew_data["pulse_span"] = "neutral" @@ -100,12 +100,12 @@ /crew_sensor_modifier/vital/jamming priority = 5 -/crew_sensor_modifier/vital/jamming/healthy/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/vital/jamming/healthy/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) . = ..() set_healthy(crew_data) return MOD_SUIT_SENSORS_HANDLED -/crew_sensor_modifier/vital/jamming/dead/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/vital/jamming/dead/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) . = ..() set_dead(crew_data) return MOD_SUIT_SENSORS_HANDLED @@ -120,7 +120,7 @@ /crew_sensor_modifier/vital/jamming/random/major error_prob = 100 -/crew_sensor_modifier/vital/jamming/random/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) +/crew_sensor_modifier/vital/jamming/random/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos, var/list/crew_data) . = ..() if(prob(error_prob)) pick(set_healthy(crew_data), set_dead(crew_data)) diff --git a/code/game/machinery/camera/tracking.dm b/code/game/machinery/camera/tracking.dm index ea4513468bd..63a2bd834e9 100644 --- a/code/game/machinery/camera/tracking.dm +++ b/code/game/machinery/camera/tracking.dm @@ -232,7 +232,7 @@ if(. == TRACKING_NO_COVERAGE) var/turf/T = get_turf(src) - if(T && isStationLevel(T.z) && hassensorlevel(src, SUIT_SENSOR_TRACKING)) + if(T && isStationLevel(T.z) && hassensorlevel(src, VITALS_SENSOR_TRACKING)) return TRACKING_POSSIBLE /mob/living/proc/tracking_initiated() diff --git a/code/game/objects/item.dm b/code/game/objects/item.dm index 53c1208e531..b75e0928451 100644 --- a/code/game/objects/item.dm +++ b/code/game/objects/item.dm @@ -867,3 +867,6 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. /obj/item/check_mousedrop_adjacency(var/atom/over, var/mob/user) . = (loc == user && istype(over, /obj/screen)) || ..() + +/obj/item/proc/handle_loadout_equip_replacement(obj/item/old_item) + return diff --git a/code/game/objects/items/devices/suit_sensor_jammer.dm b/code/game/objects/items/devices/suit_sensor_jammer.dm index ab6b2b7c9fb..044996afadc 100644 --- a/code/game/objects/items/devices/suit_sensor_jammer.dm +++ b/code/game/objects/items/devices/suit_sensor_jammer.dm @@ -212,7 +212,7 @@ sjm.enable() jammer_method = sjm -/obj/item/suit_sensor_jammer/proc/may_process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos) +/obj/item/suit_sensor_jammer/proc/may_process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/accessory/vitals_sensor/S, var/turf/pos) if(!pos) return FALSE var/turf/T = get_turf(src) diff --git a/code/modules/admin/quantum_mechanic.dm b/code/modules/admin/quantum_mechanic.dm index 6be7741873a..67a1296ba62 100644 --- a/code/modules/admin/quantum_mechanic.dm +++ b/code/modules/admin/quantum_mechanic.dm @@ -191,8 +191,6 @@ icon = 'icons/clothing/under/uniform_quantum.dmi' cold_protection = SLOT_FULL_BODY heat_protection = SLOT_FULL_BODY - sensor_mode = SUIT_SENSOR_OFF - has_sensor = FALSE siemens_coefficient = 0 /obj/item/clothing/under/color/quantum/attack_hand(mob/user) diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 6eb26896ee9..fec16764582 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -287,7 +287,7 @@ if(!outfit) return - var/reset_equipment = (outfit.flags&OUTFIT_RESET_EQUIPMENT) + var/reset_equipment = (outfit.outfit_flags & OUTFIT_RESET_EQUIPMENT) if(!reset_equipment) reset_equipment = alert("Do you wish to delete all current equipment first?", "Delete Equipment?","Yes", "No") == "Yes" diff --git a/code/modules/client/preference_setup/loadout/loadout.dm b/code/modules/client/preference_setup/loadout/loadout.dm index d6f7f86999e..8ea1d2a625b 100644 --- a/code/modules/client/preference_setup/loadout/loadout.dm +++ b/code/modules/client/preference_setup/loadout/loadout.dm @@ -427,6 +427,7 @@ var/global/list/gear_datums = list() . = item if(!old_item) return + item.handle_loadout_equip_replacement(old_item) if(old_item.type != item.type) place_in_storage_or_drop(wearer, old_item) else diff --git a/code/modules/clothing/_clothing.dm b/code/modules/clothing/_clothing.dm index 2cb413e41d0..40d6ee4a273 100644 --- a/code/modules/clothing/_clothing.dm +++ b/code/modules/clothing/_clothing.dm @@ -202,6 +202,18 @@ if(rags) to_chat(user, SPAN_SUBTLE("With a sharp object, you could cut \the [src] up into [rags] rag\s.")) + var/obj/item/clothing/accessory/vitals_sensor/sensor = locate() in accessories + if(sensor) + switch(sensor.sensor_mode) + if(VITALS_SENSOR_OFF) + to_chat(user, "Its sensors appear to be disabled.") + if(VITALS_SENSOR_BINARY) + to_chat(user, "Its binary life sensors appear to be enabled.") + if(VITALS_SENSOR_VITAL) + to_chat(user, "Its vital tracker appears to be enabled.") + if(VITALS_SENSOR_TRACKING) + to_chat(user, "Its vital tracker and tracking beacon appear to be enabled.") + #undef RAG_COUNT /obj/item/clothing/Topic(href, href_list, datum/topic_state/state) @@ -233,3 +245,41 @@ /obj/item/clothing/proc/check_limb_support(var/mob/living/carbon/human/user) return FALSE + +/obj/item/clothing/verb/toggle_suit_sensors() + set name = "Toggle Suit Sensors" + set category = "Object" + set src in usr + set_sensors(usr) + +/obj/item/clothing/proc/set_sensors(mob/user) + if (isobserver(user) || user.incapacitated()) + return + var/obj/item/clothing/accessory/vitals_sensor/sensor = locate() in accessories + if(sensor) + sensor.user_set_sensors(user) + +/obj/item/clothing/handle_loadout_equip_replacement(obj/item/old_item) + . = ..() + if(!istype(old_item, /obj/item/clothing) || !(ACCESSORY_SLOT_SENSORS in valid_accessory_slots)) + return + var/obj/item/clothing/old_clothes = old_item + var/obj/item/clothing/accessory/vitals_sensor/sensor = locate() in old_clothes.accessories + if(!sensor) + return + old_clothes.remove_accessory(null, sensor) + attach_accessory(null, sensor) + if(!(sensor in accessories)) + qdel(sensor) + +/decl/interaction_handler/clothing_set_sensors + name = "Set Sensors Level" + expected_target_type = /obj/item/clothing/under + +/decl/interaction_handler/clothing_set_sensors/invoked(var/atom/target, var/mob/user) + var/obj/item/clothing/under/U = target + U.set_sensors(user) + +/obj/item/clothing/get_alt_interactions(var/mob/user) + . = ..() + LAZYADD(., /decl/interaction_handler/clothing_set_sensors) diff --git a/code/modules/clothing/pants/_pants.dm b/code/modules/clothing/pants/_pants.dm index 860c287e3b1..d2b2590cdba 100644 --- a/code/modules/clothing/pants/_pants.dm +++ b/code/modules/clothing/pants/_pants.dm @@ -9,6 +9,7 @@ w_class = ITEM_SIZE_NORMAL force = 0 valid_accessory_slots = list( + ACCESSORY_SLOT_SENSORS, ACCESSORY_SLOT_UTILITY, ACCESSORY_SLOT_HOLSTER, ACCESSORY_SLOT_ARMBAND, diff --git a/code/modules/clothing/under/_under.dm b/code/modules/clothing/under/_under.dm index 35f3bf665a0..d5f3763edcc 100644 --- a/code/modules/clothing/under/_under.dm +++ b/code/modules/clothing/under/_under.dm @@ -9,6 +9,7 @@ force = 0 valid_accessory_slots = list( + ACCESSORY_SLOT_SENSORS, ACCESSORY_SLOT_UTILITY, ACCESSORY_SLOT_HOLSTER, ACCESSORY_SLOT_ARMBAND, @@ -29,14 +30,11 @@ ACCESSORY_SLOT_OVER ) - var/has_sensor = SUIT_HAS_SENSORS - var/sensor_mode = SUIT_SENSOR_OFF var/displays_id = 1 var/rolled_down = FALSE var/rolled_sleeves = FALSE /obj/item/clothing/under/Initialize() - sensor_mode = pick(0,1,2,3) . = ..() if(check_state_in_icon("[BODYTYPE_HUMANOID]-[slot_w_uniform_str]-rolled", icon)) verbs |= /obj/item/clothing/under/proc/roll_down_clothes @@ -88,93 +86,6 @@ var/static/list/under_slots = list(slot_w_uniform_str, slot_wear_id_str) LAZYDISTINCTADD(., under_slots) -/obj/item/clothing/under/examine(mob/user) - . = ..() - switch(src.sensor_mode) - if(0) - to_chat(user, "Its sensors appear to be disabled.") - if(1) - to_chat(user, "Its binary life sensors appear to be enabled.") - if(2) - to_chat(user, "Its vital tracker appears to be enabled.") - if(3) - to_chat(user, "Its vital tracker and tracking beacon appear to be enabled.") - -/obj/item/clothing/under/proc/set_sensors(mob/user) - var/mob/M = user - if (isobserver(M)) return - if (user.incapacitated()) return - if(has_sensor >= SUIT_LOCKED_SENSORS) - to_chat(user, "The controls are locked.") - return 0 - if(has_sensor <= SUIT_NO_SENSORS) - to_chat(user, "This suit does not have any sensors.") - return 0 - - var/list/modes = list("Off", "Binary sensors", "Vitals tracker", "Tracking beacon") - var/switchMode = input("Select a sensor mode:", "Suit Sensor Mode", modes[sensor_mode + 1]) in modes - if(get_dist(user, src) > 1) - to_chat(user, "You have moved too far away.") - return - sensor_mode = modes.Find(switchMode) - 1 - - if (src.loc == user) - var/user_message - switch(sensor_mode) - if(0) - user_message = "You disable your suit's remote sensing equipment." - if(1) - user_message = "Your suit will now report whether you are live or dead." - if(2) - user_message = "Your suit will now report your vital lifesigns." - if(3) - user_message = "Your suit will now report your vital lifesigns as well as your coordinate position." - - if(user_message) - var/decl/pronouns/G = user.get_pronouns() - user.visible_message( \ - SPAN_NOTICE("\The [user] adjusts the tracking sensor on [G.his] [name]."), \ - SPAN_NOTICE(user_message)) - - else if (ismob(src.loc)) - if(sensor_mode == 0) - user.visible_message("[user] disables [src.loc]'s remote sensing equipment.", "You disable [src.loc]'s remote sensing equipment.") - else - user.visible_message("[user] adjusts the tracking sensor on [src.loc]'s [src.name].", "You adjust [src.loc]'s sensors.") - else - user.visible_message("[user] adjusts the tracking sensor on [src]", "You adjust the sensor on [src].") - -/obj/item/clothing/under/emp_act(var/severity) - ..() - var/new_mode - switch(severity) - if(1) - new_mode = pick(75;SUIT_SENSOR_OFF, 15;SUIT_SENSOR_BINARY, 10;SUIT_SENSOR_VITAL) - if(2) - new_mode = pick(50;SUIT_SENSOR_OFF, 25;SUIT_SENSOR_BINARY, 20;SUIT_SENSOR_VITAL, 5;SUIT_SENSOR_TRACKING) - else - new_mode = pick(25;SUIT_SENSOR_OFF, 35;SUIT_SENSOR_BINARY, 30;SUIT_SENSOR_VITAL, 10;SUIT_SENSOR_TRACKING) - - sensor_mode = new_mode - -/obj/item/clothing/under/verb/toggle() - set name = "Toggle Suit Sensors" - set category = "Object" - set src in usr - set_sensors(usr) - -/decl/interaction_handler/clothing_set_sensors - name = "Set Sensors Level" - expected_target_type = /obj/item/clothing/under - -/decl/interaction_handler/clothing_set_sensors/invoked(var/atom/target, var/mob/user) - var/obj/item/clothing/under/U = target - U.set_sensors(user) - -/obj/item/clothing/under/get_alt_interactions(var/mob/user) - . = ..() - LAZYADD(., /decl/interaction_handler/clothing_set_sensors) - // This stub is so the linter stops yelling about sleeping during Initialize() // due to corpse props equipping themselves, which calls equip_to_slot, which // calls attackby(), which sometimes sleeps due to input(). Yeah. diff --git a/code/modules/clothing/under/accessories/vitals_sensor.dm b/code/modules/clothing/under/accessories/vitals_sensor.dm new file mode 100644 index 00000000000..14fcd3a9eb1 --- /dev/null +++ b/code/modules/clothing/under/accessories/vitals_sensor.dm @@ -0,0 +1,116 @@ +/obj/item/clothing/accessory/vitals_sensor + name = "vitals sensor" + desc = "A small sensor used to read the biometrics and vital signs of the wearer." + slot_flags = SLOT_TIE + icon = 'icons/clothing/accessories/vitals_sensor.dmi' + icon_state = ICON_STATE_WORLD + slot = ACCESSORY_SLOT_SENSORS + var/sensors_locked = FALSE + var/sensor_mode + var/static/list/sensor_modes = list( + "Off", + "Binary sensors", + "Vitals tracker", + "Tracking beacon" + ) + +/obj/item/clothing/accessory/vitals_sensor/examine(mob/user) + . = ..() + switch(sensor_mode) + if(VITALS_SENSOR_OFF) + to_chat(user, "It appears to be disabled.") + if(VITALS_SENSOR_BINARY) + to_chat(user, "Its binary life tracker appear to be enabled.") + if(VITALS_SENSOR_VITAL) + to_chat(user, "Its vital tracker appears to be enabled.") + if(VITALS_SENSOR_TRACKING) + to_chat(user, "Its vital tracker and tracking beacon appear to be enabled.") + +/obj/item/clothing/accessory/vitals_sensor/Initialize() + . = ..() + if(isnull(sensor_mode) || sensor_mode < VITALS_SENSOR_OFF || sensor_mode > VITALS_SENSOR_TRACKING) + set_sensor_mode(rand(VITALS_SENSOR_OFF, VITALS_SENSOR_TRACKING)) + +/obj/item/clothing/accessory/vitals_sensor/proc/set_sensor_mode(var/new_sensor_mode) + if(sensor_mode != new_sensor_mode) + sensor_mode = new_sensor_mode + update_icon() + +/obj/item/clothing/accessory/vitals_sensor/on_update_icon() + . = ..() + cut_overlays() + var/image/I = image(icon, "[icon_state]-indicator") + I.appearance_flags |= RESET_COLOR + switch(sensor_mode) + if(VITALS_SENSOR_OFF) + I.color = COLOR_GRAY15 + if(VITALS_SENSOR_BINARY) + I.color = COLOR_AMBER + if(VITALS_SENSOR_VITAL) + I.color = COLOR_YELLOW + if(VITALS_SENSOR_TRACKING) + I.color = COLOR_LIME + else + I.color = COLOR_RED + add_overlay(I) + +/obj/item/clothing/accessory/vitals_sensor/attack_self(mob/user) + user_set_sensors(user) + return TRUE + +/obj/item/clothing/accessory/vitals_sensor/proc/user_set_sensors(mob/user) + if(sensors_locked) + to_chat(user, "The controls are locked.") + return FALSE + var/switchMode = input("Select a sensor mode:", "Suit Sensor Mode", sensor_modes[sensor_mode + 1]) in sensor_modes + if(user.incapacitated()) + return + if(loc != user && loc?.loc != user && !Adjacent(user)) + to_chat(user, "You have moved too far away.") + return + set_sensor_mode(sensor_modes.Find(switchMode) - 1) + var/mob/wearer = (ismob(loc) ? loc : (ismob(loc?.loc) ? loc.loc : null)) + if (wearer == user) // accessory or inhand + var/user_message + switch(sensor_mode) + if(VITALS_SENSOR_OFF) + user_message = "You disable your remote vitals sensor." + if(VITALS_SENSOR_BINARY) + user_message = "Your vitals sensor will now report whether you are live or dead." + if(VITALS_SENSOR_VITAL) + user_message = "Your vitals sensor will now report your vital lifesigns." + if(VITALS_SENSOR_TRACKING) + user_message = "Your vitals sensor will now report your vital lifesigns as well as your coordinate position." + if(user_message) + var/decl/pronouns/G = user.get_pronouns() + user.visible_message( \ + SPAN_NOTICE("\The [user] adjusts [G.his] vitals sensor."), + SPAN_NOTICE(user_message) + ) + return + if(wearer) + if(sensor_mode == 0) + user.visible_message( + SPAN_DANGER("\The [user] disables \the [wearer]'s vitals sensor."), + SPAN_DANGER("You disable \the [wearer]'s vitals sensor.") + ) + else + user.visible_message( + SPAN_NOTICE("\The [user] adjusts \the [wearer]'s vitals sensor."), + SPAN_NOTICE("You adjust \the [wearer]'s vitals sensor.") + ) + return + user.visible_message( + SPAN_NOTICE("\The [user] adjusts \the [src]"), + SPAN_NOTICE("You adjust \the [src].") + ) + +/obj/item/clothing/accessory/vitals_sensor/emp_act(var/severity) + ..() + switch(severity) + if(1) + set_sensor_mode(pick(75;VITALS_SENSOR_OFF, 15;VITALS_SENSOR_BINARY, 10;VITALS_SENSOR_VITAL)) + if(2) + set_sensor_mode(pick(50;VITALS_SENSOR_OFF, 25;VITALS_SENSOR_BINARY, 20;VITALS_SENSOR_VITAL, 5;VITALS_SENSOR_TRACKING)) + else + set_sensor_mode(pick(25;VITALS_SENSOR_OFF, 35;VITALS_SENSOR_BINARY, 30;VITALS_SENSOR_VITAL, 10;VITALS_SENSOR_TRACKING)) diff --git a/code/modules/clothing/under/color.dm b/code/modules/clothing/under/color.dm index abedb755a47..b3bbce8b135 100644 --- a/code/modules/clothing/under/color.dm +++ b/code/modules/clothing/under/color.dm @@ -9,8 +9,13 @@ name = "orange jumpsuit" desc = "It's standardised prisoner-wear. Its suit sensor controls are permanently set to the \"Fully On\" position." icon = 'icons/clothing/under/jumpsuits/jumpsuit_prisoner.dmi' - has_sensor = SUIT_LOCKED_SENSORS - sensor_mode = SUIT_SENSOR_TRACKING + +/obj/item/clothing/under/color/orange/Initialize() + . = ..() + var/obj/item/clothing/accessory/vitals_sensor/sensor = new(src) + sensor.sensors_locked = TRUE + sensor.set_sensor_mode(VITALS_SENSOR_TRACKING) + attach_accessory(null, sensor) /obj/item/clothing/under/color/blackjumpshorts name = "black jumpsuit shorts" diff --git a/code/modules/clothing/under/syndicate.dm b/code/modules/clothing/under/syndicate.dm index 8cf7aa379cc..f7f9d8fc033 100644 --- a/code/modules/clothing/under/syndicate.dm +++ b/code/modules/clothing/under/syndicate.dm @@ -2,7 +2,6 @@ name = "tactical turtleneck" desc = "It's some non-descript, slightly suspicious looking, civilian clothing." icon = 'icons/clothing/under/uniform_tacticool.dmi' - has_sensor = SUIT_NO_SENSORS armor = list( ARMOR_MELEE = ARMOR_MELEE_SMALL, ARMOR_BULLET = ARMOR_BALLISTIC_MINOR, @@ -15,7 +14,6 @@ name = "combat turtleneck" desc = "The height of fashion and tactical utility." icon = 'icons/clothing/under/uniform_combat.dmi' - has_sensor = SUIT_HAS_SENSORS /obj/item/clothing/under/syndicate/tacticool name = "\improper Tacticool turtleneck" @@ -23,5 +21,4 @@ icon = 'icons/clothing/under/uniform_tacticool.dmi' armor = null siemens_coefficient = 1 - has_sensor = SUIT_HAS_SENSORS matter = null \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/npcs.dm b/code/modules/mob/living/carbon/human/npcs.dm index b7a05a386b4..2bbb45fb447 100644 --- a/code/modules/mob/living/carbon/human/npcs.dm +++ b/code/modules/mob/living/carbon/human/npcs.dm @@ -18,18 +18,18 @@ /decl/hierarchy/outfit/blank_subject name = "Test Subject" - uniform = /obj/item/clothing/under/color/white + uniform = /obj/item/clothing/under/color/white/blank shoes = /obj/item/clothing/shoes/color/white head = /obj/item/clothing/head/helmet/facecover mask = /obj/item/clothing/mask/muzzle suit = /obj/item/clothing/suit/straight_jacket -/decl/hierarchy/outfit/blank_subject/post_equip(mob/living/carbon/human/H) - ..() - var/obj/item/clothing/under/color/white/C = locate() in H - if(C) - C.has_sensor = SUIT_LOCKED_SENSORS - C.sensor_mode = SUIT_SENSOR_OFF +/obj/item/clothing/under/color/white/blank/Initialize() + . = ..() + var/obj/item/clothing/accessory/vitals_sensor/sensor = new(src) + sensor.sensors_locked = TRUE + sensor.set_sensor_mode(VITALS_SENSOR_OFF) + attach_accessory(null, sensor) /mob/living/carbon/human/blank/Initialize(mapload) . = ..(mapload, SPECIES_HUMAN) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index dc258343e95..97ebb96b011 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -362,13 +362,16 @@ break // Other incidentals. - var/obj/item/clothing/under/suit = get_equipped_item(slot_w_uniform_str) + var/obj/item/clothing/suit = get_equipped_item(slot_w_uniform_str) if(istype(suit)) dat += "
Pockets: Empty or Place Item" - if(suit.has_sensor == SUIT_HAS_SENSORS) - dat += "
Set sensors" - if (suit.has_sensor && user.get_multitool()) - dat += "
[suit.has_sensor == SUIT_LOCKED_SENSORS ? "Unl" : "L"]ock sensors" + var/obj/item/clothing/accessory/vitals_sensor/sensor = get_vitals_sensor() + if(sensor) + if(sensor.sensors_locked) + dat += "
Unlock vitals sensors" + else if(user.get_multitool()) + dat += "
Lock vitals sensors" + dat += "
Set vitals sensors" if(get_equipped_item(slot_handcuffed_str)) dat += "
Handcuffed" diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index af0fac10217..6e5f3dea414 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -66,11 +66,12 @@ /proc/getsensorlevel(A) var/mob/M = A - if(istype(M)) - var/obj/item/clothing/under/U = M.get_equipped_item(slot_w_uniform_str) - if(istype(U)) - return U.sensor_mode - return SUIT_SENSOR_OFF + if(!istype(M)) + return VITALS_SENSOR_OFF + var/obj/item/clothing/accessory/vitals_sensor/sensor = M.get_vitals_sensor() + if(sensor) + return sensor.sensor_mode + return VITALS_SENSOR_OFF /proc/is_admin(var/mob/user) return check_rights(R_ADMIN, 0, user) != 0 diff --git a/code/modules/mob/stripping.dm b/code/modules/mob/stripping.dm index e677769e9ce..388cee8c34c 100644 --- a/code/modules/mob/stripping.dm +++ b/code/modules/mob/stripping.dm @@ -31,23 +31,20 @@ toggle_sensors(user) return if ("lock_sensors") - var/obj/item/clothing/under/subject_uniform = get_equipped_item(slot_w_uniform_str) - if (!istype(subject_uniform, /obj/item/clothing/under)) + var/obj/item/clothing/accessory/vitals_sensor/sensor = get_vitals_sensor() + if (!istype(sensor)) return - visible_message(SPAN_DANGER("\The [user] is trying to [subject_uniform.has_sensor == SUIT_LOCKED_SENSORS ? "un" : ""]lock \the [src]'s sensors!")) + visible_message(SPAN_DANGER("\The [user] is trying to [sensor.sensors_locked ? "un" : ""]lock \the [src]'s sensors!")) if (do_after(user, HUMAN_STRIP_DELAY, src, progress = 0)) - if (subject_uniform != get_equipped_item(slot_w_uniform_str)) - to_chat(user, SPAN_WARNING("\The [src] is not wearing \the [subject_uniform] anymore.")) - return - if (!subject_uniform.has_sensor) - to_chat(user, SPAN_WARNING("\The [subject_uniform] has no sensors to lock.")) + if(QDELETED(sensor) || sensor != get_vitals_sensor()) + to_chat(user, SPAN_WARNING("\The [src] is not wearing \the [sensor] anymore.")) return var/obj/item/multitool/user_multitool = user.get_multitool() if (!istype(user_multitool)) - to_chat(user, SPAN_WARNING("You need a multitool to lock \the [subject_uniform]'s sensors.")) + to_chat(user, SPAN_WARNING("You need a multitool to lock \the [src]'s sensors.")) return - subject_uniform.has_sensor = subject_uniform.has_sensor == SUIT_LOCKED_SENSORS ? SUIT_HAS_SENSORS : SUIT_LOCKED_SENSORS - visible_message(SPAN_NOTICE("\The [user] [subject_uniform.has_sensor == SUIT_LOCKED_SENSORS ? "" : "un"]locks \the [subject_uniform]'s suit sensor controls."), range = 2) + sensor.sensors_locked = !sensor.sensors_locked + visible_message(SPAN_NOTICE("\The [user] [sensor.sensors_locked ? "" : "un"]locks \the [src]'s vitals sensor controls."), range = 2) return if("internals") visible_message("\The [usr] is trying to set \the [src]'s internals!") @@ -137,13 +134,19 @@ // Modify the current target sensor level. /mob/proc/toggle_sensors(var/mob/living/user) - var/obj/item/clothing/under/suit = get_equipped_item(slot_w_uniform_str) - if(!istype(suit)) - to_chat(user, "\The [src] is not wearing a suit with sensors.") - return - if (suit.has_sensor >= 2) - to_chat(user, "\The [src]'s suit sensor controls are locked.") + var/obj/item/clothing/accessory/vitals_sensor/sensor = get_vitals_sensor() + if(!istype(sensor)) + to_chat(user, SPAN_WARNING("\The [src] is not wearing a vitals sensor.")) + if (sensor.sensors_locked) + to_chat(user, SPAN_WARNING("\The [src]'s suit sensor controls are locked.")) return - admin_attack_log(user, src, "Toggled their suit sensors.", "Toggled their suit sensors.", "toggled the suit sensors of") - suit.set_sensors(user) + sensor.user_set_sensors(user) + +/mob/proc/get_vitals_sensor() + for(var/check_slot in global.vitals_sensor_equip_slots) + var/obj/item/clothing/equipped = get_equipped_item(check_slot) + if(istype(equipped)) + var/sensor = locate(/obj/item/clothing/accessory/vitals_sensor) in equipped.accessories + if(sensor) + return sensor diff --git a/code/modules/modular_computers/file_system/programs/medical/suit_sensors.dm b/code/modules/modular_computers/file_system/programs/medical/suit_sensors.dm index 8e0824efa13..d5586fc52de 100644 --- a/code/modules/modular_computers/file_system/programs/medical/suit_sensors.dm +++ b/code/modules/modular_computers/file_system/programs/medical/suit_sensors.dm @@ -49,7 +49,7 @@ if(isAI(usr)) var/mob/living/silicon/ai/AI = usr var/mob/living/carbon/human/H = locate(href_list["track"]) in SSmobs.mob_list - if(hassensorlevel(H, SUIT_SENSOR_TRACKING)) + if(hassensorlevel(H, VITALS_SENSOR_TRACKING)) AI.ai_actual_track(H) return 1 diff --git a/code/procs/hud.dm b/code/procs/hud.dm index c42577190d2..760d1b2fb37 100644 --- a/code/procs/hud.dm +++ b/code/procs/hud.dm @@ -28,9 +28,9 @@ the HUD updates properly! */ P.Client.images += patient.hud_list[STATUS_HUD] else var/sensor_level = getsensorlevel(patient) - if(sensor_level >= SUIT_SENSOR_VITAL) + if(sensor_level >= VITALS_SENSOR_VITAL) P.Client.images += patient.hud_list[HEALTH_HUD] - if(sensor_level >= SUIT_SENSOR_BINARY) + if(sensor_level >= VITALS_SENSOR_BINARY) P.Client.images += patient.hud_list[LIFE_HUD] //Security HUDs. Pass a value for the second argument to enable implant viewing or other special features. diff --git a/icons/clothing/accessories/vitals_sensor.dmi b/icons/clothing/accessories/vitals_sensor.dmi new file mode 100644 index 0000000000000000000000000000000000000000..173a293306a15d25b59c3de6907a19c97d58b730 GIT binary patch literal 749 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=6RJWYN?cNllZ!G7N;32F7#J$% zw07_1I%FW?_WX&a-L0LE?$2@!QgQyxCFE-&ek;afo!I?*3nw@4n9KZpi^bP;^Fw@o z`;%54kz_l5Hf(iklZu4Qx2UBa{VJ|rH21|y8h8KJ;xIc)gC@E^FdbVWe-0l)ptJfT1JFmUa_`twc)UYV|=E9}k zOFR~x>id7AQeGiK`0wY-i|3ul+8XuHwD=g`0XLQn%o_w5-!SC3FjzCp{x9@kum8Q@ zUt$s^dc+>g@iuh3Qra6l$sp=L|1a(-K`(Z_TcTp4d7yg!w0s{Y<{InYB}GDVq7zR4 z%l*%o(GWc4LkjDYllP`GFdQ~eI9725D0g97u4wWf_d~z7H3e~%#vYFHo|w?H)8LrN zu^HX5$5tN8X`fr{so5%_?8I>)D!-obKveg-*9)c`sLKT*XH}2#}7QY`@mUu(;vTzm;UlIcCdJz63bkBH2pK*`~Bbb z>mJRVd!G4S_@S%EU)MgdlBl*6(2Ra!IHmUFIqwHICMp}2F_J^<4%gQu&X%Q~loCICs0O$7h| literal 0 HcmV?d00001 diff --git a/maps/exodus/outfits/cargo.dm b/maps/exodus/outfits/cargo.dm index 8bfc82c1b2b..ecc6b53da97 100644 --- a/maps/exodus/outfits/cargo.dm +++ b/maps/exodus/outfits/cargo.dm @@ -28,7 +28,7 @@ id_type = /obj/item/card/id/cargo pda_type = /obj/item/modular_computer/pda/science backpack_contents = list(/obj/item/crowbar = 1, /obj/item/storage/ore = 1) - flags = OUTFIT_HAS_BACKPACK|OUTFIT_EXTENDED_SURVIVAL + outfit_flags = OUTFIT_HAS_BACKPACK | OUTFIT_EXTENDED_SURVIVAL | OUTFIT_HAS_VITALS_SENSOR /decl/hierarchy/outfit/job/cargo/mining/Initialize() . = ..() diff --git a/maps/exodus/outfits/engineering.dm b/maps/exodus/outfits/engineering.dm index 2aee3512b41..02aefa0b167 100644 --- a/maps/exodus/outfits/engineering.dm +++ b/maps/exodus/outfits/engineering.dm @@ -4,7 +4,7 @@ l_ear = /obj/item/radio/headset/headset_eng shoes = /obj/item/clothing/shoes/workboots pda_slot = slot_l_store_str - flags = OUTFIT_HAS_BACKPACK|OUTFIT_EXTENDED_SURVIVAL + outfit_flags = OUTFIT_HAS_BACKPACK|OUTFIT_EXTENDED_SURVIVAL | OUTFIT_HAS_VITALS_SENSOR /decl/hierarchy/outfit/job/engineering/Initialize() . = ..() diff --git a/maps/ministation/outfits/civilian.dm b/maps/ministation/outfits/civilian.dm index f5695c67e75..181397cb3f4 100644 --- a/maps/ministation/outfits/civilian.dm +++ b/maps/ministation/outfits/civilian.dm @@ -5,7 +5,7 @@ id_type = /obj/item/card/id/ministation/cargo pda_type = /obj/item/modular_computer/pda/cargo backpack_contents = list(/obj/item/crowbar = 1, /obj/item/storage/ore = 1) - flags = OUTFIT_HAS_BACKPACK|OUTFIT_EXTENDED_SURVIVAL + outfit_flags = OUTFIT_HAS_BACKPACK | OUTFIT_EXTENDED_SURVIVAL | OUTFIT_HAS_VITALS_SENSOR /obj/item/encryptionkey/ministation_headset_cargo name = "cargo radio encryption key" diff --git a/maps/ministation/outfits/engineering.dm b/maps/ministation/outfits/engineering.dm index daeedf3c563..be08a3db06f 100644 --- a/maps/ministation/outfits/engineering.dm +++ b/maps/ministation/outfits/engineering.dm @@ -4,7 +4,7 @@ l_ear = /obj/item/radio/headset/headset_eng shoes = /obj/item/clothing/shoes/workboots pda_slot = slot_l_store_str - flags = OUTFIT_HAS_BACKPACK|OUTFIT_EXTENDED_SURVIVAL + outfit_flags = OUTFIT_HAS_BACKPACK | OUTFIT_EXTENDED_SURVIVAL | OUTFIT_HAS_VITALS_SENSOR head = /obj/item/clothing/head/hardhat uniform = /obj/item/clothing/under/engineer r_pocket = /obj/item/t_scanner diff --git a/maps/tradeship/outfits/engineering.dm b/maps/tradeship/outfits/engineering.dm index b67ff40b074..db7f074405b 100644 --- a/maps/tradeship/outfits/engineering.dm +++ b/maps/tradeship/outfits/engineering.dm @@ -1,13 +1,13 @@ /decl/hierarchy/outfit/job/tradeship/hand/engine name = "Tradeship - Job - Junior Engineer" head = /obj/item/clothing/head/hardhat - flags = OUTFIT_HAS_BACKPACK|OUTFIT_EXTENDED_SURVIVAL id_type = /obj/item/card/id/tradeship/engineering shoes = /obj/item/clothing/shoes/workboots hands = list(/obj/item/wrench) belt = /obj/item/storage/belt/utility/full r_pocket = /obj/item/radio l_ear = /obj/item/radio/headset/headset_eng + outfit_flags = OUTFIT_HAS_BACKPACK | OUTFIT_EXTENDED_SURVIVAL | OUTFIT_HAS_VITALS_SENSOR /obj/item/card/id/tradeship/engineering name = "identification card" @@ -26,7 +26,7 @@ belt = /obj/item/storage/belt/utility/full id_type = /obj/item/card/id/tradeship/engineering/head r_pocket = /obj/item/radio - flags = OUTFIT_HAS_BACKPACK|OUTFIT_EXTENDED_SURVIVAL + outfit_flags = OUTFIT_HAS_BACKPACK | OUTFIT_EXTENDED_SURVIVAL | OUTFIT_HAS_VITALS_SENSOR l_ear = /obj/item/radio/headset/heads/ce /obj/item/card/id/tradeship/engineering/head diff --git a/mods/species/ascent/items/clothing.dm b/mods/species/ascent/items/clothing.dm index 42f162c4829..44ab3515cb1 100644 --- a/mods/species/ascent/items/clothing.dm +++ b/mods/species/ascent/items/clothing.dm @@ -1,13 +1,13 @@ /decl/hierarchy/outfit/job/ascent - name = "Ascent - Gyne" - mask = /obj/item/clothing/mask/gas/ascent - uniform = /obj/item/clothing/under/ascent - id_type = /obj/item/card/id/ascent - shoes = /obj/item/clothing/shoes/magboots/ascent - l_ear = null - pda_type = null - pda_slot = 0 - flags = 0 + name = "Ascent - Gyne" + mask = /obj/item/clothing/mask/gas/ascent + uniform = /obj/item/clothing/under/ascent + id_type = /obj/item/card/id/ascent + shoes = /obj/item/clothing/shoes/magboots/ascent + l_ear = null + pda_type = null + pda_slot = 0 + outfit_flags = 0 /decl/hierarchy/outfit/job/ascent/attendant name = "Ascent - Attendant" diff --git a/mods/species/vox/gear/gear_under.dm b/mods/species/vox/gear/gear_under.dm index 9b8c01a7779..6e7dd0fbd02 100644 --- a/mods/species/vox/gear/gear_under.dm +++ b/mods/species/vox/gear/gear_under.dm @@ -1,5 +1,4 @@ /obj/item/clothing/under/vox - has_sensor = SUIT_NO_SENSORS bodytype_equip_flags = BODY_FLAG_VOX /obj/item/clothing/under/vox/vox_casual diff --git a/nebula.dme b/nebula.dme index 2b5f05e082a..93c4ad4743f 100644 --- a/nebula.dme +++ b/nebula.dme @@ -1816,6 +1816,7 @@ #include "code\modules\clothing\under\accessories\stethoscope.dm" #include "code\modules\clothing\under\accessories\storage.dm" #include "code\modules\clothing\under\accessories\ties.dm" +#include "code\modules\clothing\under\accessories\vitals_sensor.dm" #include "code\modules\clothing\under\jobs\civilian.dm" #include "code\modules\clothing\under\jobs\engineering.dm" #include "code\modules\clothing\under\jobs\medsci.dm" From c73e3618ce4b8312a791165a0ff2849c79b91393 Mon Sep 17 00:00:00 2001 From: MistakeNot4892 Date: Fri, 1 Dec 2023 22:07:53 +1100 Subject: [PATCH 2/2] Suit sensors with locked sensors cannot be removed from clothing. --- .../extensions/multitool/items/clothing.dm | 4 +-- code/datums/outfits/outfit.dm | 2 +- code/modules/clothing/_clothing.dm | 4 +-- code/modules/clothing/clothing_accessories.dm | 18 +++++++--- .../under/accessories/vitals_sensor.dm | 33 +++++++++++++++++-- code/modules/clothing/under/color.dm | 2 +- code/modules/mob/living/carbon/human/npcs.dm | 2 +- code/modules/mob/mob.dm | 2 +- code/modules/mob/stripping.dm | 12 +++---- 9 files changed, 57 insertions(+), 22 deletions(-) diff --git a/code/datums/extensions/multitool/items/clothing.dm b/code/datums/extensions/multitool/items/clothing.dm index 1693e945351..b82e6825dd7 100644 --- a/code/datums/extensions/multitool/items/clothing.dm +++ b/code/datums/extensions/multitool/items/clothing.dm @@ -14,5 +14,5 @@ if(!sensor) to_chat(user, SPAN_WARNING("\The [uniform] doesn't have a vitals sensors attached.")) return - sensor.sensors_locked = !sensor.sensors_locked - user.visible_message(SPAN_NOTICE("\The [user] [sensor.sensors_locked ? "" : "un"]locks \the [user]'s suit sensor controls."), range = 2) + sensor.toggle_sensors_locked() + user.visible_message(SPAN_NOTICE("\The [user] [sensor.get_sensors_locked() ? "" : "un"]locks \the [user]'s suit sensor controls."), range = 2) diff --git a/code/datums/outfits/outfit.dm b/code/datums/outfits/outfit.dm index 59f2f8dc658..072bf4b7656 100644 --- a/code/datums/outfits/outfit.dm +++ b/code/datums/outfits/outfit.dm @@ -76,7 +76,7 @@ var/global/list/outfits_decls_by_type_ succeeded = TRUE qdel(wear_uniform) if(!succeeded) - . += "outfit is flagged for sensors, but uniform do not accept sensors" + . += "outfit is flagged for sensors, but uniform does not accept sensors" qdel(sensor) /decl/hierarchy/outfit/proc/pre_equip(mob/living/carbon/human/H) diff --git a/code/modules/clothing/_clothing.dm b/code/modules/clothing/_clothing.dm index 40d6ee4a273..800c189ff98 100644 --- a/code/modules/clothing/_clothing.dm +++ b/code/modules/clothing/_clothing.dm @@ -267,10 +267,10 @@ var/obj/item/clothing/accessory/vitals_sensor/sensor = locate() in old_clothes.accessories if(!sensor) return + sensor.removable = TRUE // This will be refreshed by remove_accessory/attach_accessory old_clothes.remove_accessory(null, sensor) attach_accessory(null, sensor) - if(!(sensor in accessories)) - qdel(sensor) + /decl/interaction_handler/clothing_set_sensors name = "Set Sensors Level" diff --git a/code/modules/clothing/clothing_accessories.dm b/code/modules/clothing/clothing_accessories.dm index 1fd15a2fcd4..47ce6070e55 100644 --- a/code/modules/clothing/clothing_accessories.dm +++ b/code/modules/clothing/clothing_accessories.dm @@ -69,7 +69,7 @@ update_clothing_icon() /obj/item/clothing/proc/remove_accessory(mob/user, obj/item/clothing/accessory/A) - if(!A || !(A in accessories)) + if(!A || !(A in accessories) || !A.removable || !A.canremove) return A.on_removed(user) @@ -94,11 +94,21 @@ if(!LAZYLEN(accessories)) return + var/list/removable_accessories = list() + for(var/obj/item/clothing/accessory/accessory in accessories) + if(accessory.canremove && accessory.removable) + removable_accessories += accessory + + if(!length(removable_accessories)) + to_chat(usr, SPAN_WARNING("You have no removable accessories.")) + verbs -= /obj/item/clothing/proc/removetie_verb + return + var/obj/item/clothing/accessory/A - if(LAZYLEN(accessories) > 1) - A = show_radial_menu(M, M, make_item_radial_menu_choices(accessories), radius = 42, tooltips = TRUE) + if(LAZYLEN(removable_accessories) > 1) + A = show_radial_menu(M, M, make_item_radial_menu_choices(removable_accessories), radius = 42, tooltips = TRUE) else - A = accessories[1] + A = removable_accessories[1] remove_accessory(usr, A) diff --git a/code/modules/clothing/under/accessories/vitals_sensor.dm b/code/modules/clothing/under/accessories/vitals_sensor.dm index 14fcd3a9eb1..ef51b0b2d4f 100644 --- a/code/modules/clothing/under/accessories/vitals_sensor.dm +++ b/code/modules/clothing/under/accessories/vitals_sensor.dm @@ -14,6 +14,23 @@ "Tracking beacon" ) +/obj/item/clothing/accessory/vitals_sensor/Initialize() + . = ..() + if(isnull(sensor_mode) || sensor_mode < VITALS_SENSOR_OFF || sensor_mode > VITALS_SENSOR_TRACKING) + set_sensor_mode(rand(VITALS_SENSOR_OFF, VITALS_SENSOR_TRACKING)) + update_removable() + +/obj/item/clothing/accessory/vitals_sensor/proc/toggle_sensors_locked() + set_sensors_locked(!get_sensors_locked()) + +/obj/item/clothing/accessory/vitals_sensor/proc/get_sensors_locked() + return sensors_locked + +/obj/item/clothing/accessory/vitals_sensor/proc/set_sensors_locked(new_state) + if(get_sensors_locked() != new_state) + sensors_locked = new_state + update_removable() + /obj/item/clothing/accessory/vitals_sensor/examine(mob/user) . = ..() switch(sensor_mode) @@ -26,10 +43,20 @@ if(VITALS_SENSOR_TRACKING) to_chat(user, "Its vital tracker and tracking beacon appear to be enabled.") -/obj/item/clothing/accessory/vitals_sensor/Initialize() +/obj/item/clothing/accessory/vitals_sensor/on_attached(obj/item/clothing/S, mob/user) . = ..() - if(isnull(sensor_mode) || sensor_mode < VITALS_SENSOR_OFF || sensor_mode > VITALS_SENSOR_TRACKING) - set_sensor_mode(rand(VITALS_SENSOR_OFF, VITALS_SENSOR_TRACKING)) + update_removable() + +/obj/item/clothing/accessory/vitals_sensor/on_removed(mob/user) + . = ..() + update_removable() + +/obj/item/clothing/accessory/vitals_sensor/proc/update_removable() + var/obj/item/clothing/clothes = loc + if(istype(clothes) && (src in clothes.accessories)) + removable = !sensors_locked + else + removable = TRUE /obj/item/clothing/accessory/vitals_sensor/proc/set_sensor_mode(var/new_sensor_mode) if(sensor_mode != new_sensor_mode) diff --git a/code/modules/clothing/under/color.dm b/code/modules/clothing/under/color.dm index b3bbce8b135..d4205a6f449 100644 --- a/code/modules/clothing/under/color.dm +++ b/code/modules/clothing/under/color.dm @@ -13,7 +13,7 @@ /obj/item/clothing/under/color/orange/Initialize() . = ..() var/obj/item/clothing/accessory/vitals_sensor/sensor = new(src) - sensor.sensors_locked = TRUE + sensor.set_sensors_locked(TRUE) sensor.set_sensor_mode(VITALS_SENSOR_TRACKING) attach_accessory(null, sensor) diff --git a/code/modules/mob/living/carbon/human/npcs.dm b/code/modules/mob/living/carbon/human/npcs.dm index 2bbb45fb447..b4b54c973ad 100644 --- a/code/modules/mob/living/carbon/human/npcs.dm +++ b/code/modules/mob/living/carbon/human/npcs.dm @@ -27,7 +27,7 @@ /obj/item/clothing/under/color/white/blank/Initialize() . = ..() var/obj/item/clothing/accessory/vitals_sensor/sensor = new(src) - sensor.sensors_locked = TRUE + sensor.set_sensors_locked(TRUE) sensor.set_sensor_mode(VITALS_SENSOR_OFF) attach_accessory(null, sensor) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 97ebb96b011..03cae34caf3 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -367,7 +367,7 @@ dat += "
Pockets: Empty or Place Item" var/obj/item/clothing/accessory/vitals_sensor/sensor = get_vitals_sensor() if(sensor) - if(sensor.sensors_locked) + if(sensor.get_sensors_locked()) dat += "
Unlock vitals sensors" else if(user.get_multitool()) dat += "
Lock vitals sensors" diff --git a/code/modules/mob/stripping.dm b/code/modules/mob/stripping.dm index 388cee8c34c..0552345b391 100644 --- a/code/modules/mob/stripping.dm +++ b/code/modules/mob/stripping.dm @@ -34,7 +34,7 @@ var/obj/item/clothing/accessory/vitals_sensor/sensor = get_vitals_sensor() if (!istype(sensor)) return - visible_message(SPAN_DANGER("\The [user] is trying to [sensor.sensors_locked ? "un" : ""]lock \the [src]'s sensors!")) + visible_message(SPAN_DANGER("\The [user] is trying to [sensor.get_sensors_locked() ? "un" : ""]lock \the [src]'s sensors!")) if (do_after(user, HUMAN_STRIP_DELAY, src, progress = 0)) if(QDELETED(sensor) || sensor != get_vitals_sensor()) to_chat(user, SPAN_WARNING("\The [src] is not wearing \the [sensor] anymore.")) @@ -43,8 +43,8 @@ if (!istype(user_multitool)) to_chat(user, SPAN_WARNING("You need a multitool to lock \the [src]'s sensors.")) return - sensor.sensors_locked = !sensor.sensors_locked - visible_message(SPAN_NOTICE("\The [user] [sensor.sensors_locked ? "" : "un"]locks \the [src]'s vitals sensor controls."), range = 2) + sensor.toggle_sensors_locked() + visible_message(SPAN_NOTICE("\The [user] [sensor.get_sensors_locked() ? "" : "un"]locks \the [src]'s vitals sensor controls."), range = 2) return if("internals") visible_message("\The [usr] is trying to set \the [src]'s internals!") @@ -137,7 +137,7 @@ var/obj/item/clothing/accessory/vitals_sensor/sensor = get_vitals_sensor() if(!istype(sensor)) to_chat(user, SPAN_WARNING("\The [src] is not wearing a vitals sensor.")) - if (sensor.sensors_locked) + if (sensor.get_sensors_locked()) to_chat(user, SPAN_WARNING("\The [src]'s suit sensor controls are locked.")) return admin_attack_log(user, src, "Toggled their suit sensors.", "Toggled their suit sensors.", "toggled the suit sensors of") @@ -147,6 +147,4 @@ for(var/check_slot in global.vitals_sensor_equip_slots) var/obj/item/clothing/equipped = get_equipped_item(check_slot) if(istype(equipped)) - var/sensor = locate(/obj/item/clothing/accessory/vitals_sensor) in equipped.accessories - if(sensor) - return sensor + return (locate(/obj/item/clothing/accessory/vitals_sensor) in equipped.accessories)