From cd7017e1b3c5abf8a2e68d3a86027adebaaecab4 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Sat, 29 May 2021 21:19:05 +0100 Subject: [PATCH] Allows Maintenance Drones to see wire names (#16047) * drone buff * V2 (Item Trait) * Indentation Co-Authored-By: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com> Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com> --- code/__HELPERS/traits.dm | 6 +++++- code/_globalvars/traits.dm | 7 ++++++- code/datums/wires/wires.dm | 9 ++++----- code/game/objects/items/tools/multitool.dm | 17 ++++++++++++++--- code/game/objects/items/tools/wirecutters.dm | 10 ++++++++++ .../mob/living/silicon/robot/robot_modules.dm | 4 ++-- 6 files changed, 41 insertions(+), 12 deletions(-) diff --git a/code/__HELPERS/traits.dm b/code/__HELPERS/traits.dm index 74760fd22b4..7b49249690d 100644 --- a/code/__HELPERS/traits.dm +++ b/code/__HELPERS/traits.dm @@ -99,7 +99,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming traits. */ -//mob traits +//***** MOB TRAITS *****// #define TRAIT_BLIND "blind" #define TRAIT_MUTE "mute" #define TRAIT_DEAF "deaf" @@ -155,6 +155,10 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai /// Blowing kisses actually does damage to the victim #define TRAIT_KISS_OF_DEATH "kiss_of_death" +//***** ITEM TRAITS *****// +/// Show what machine/door wires do when held. +#define TRAIT_SHOW_WIRE_INFO "show_wire_info" + // // common trait sources #define TRAIT_GENERIC "generic" diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index 382303c1212..3d783ece42c 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -57,7 +57,12 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_NOGERMS" = TRAIT_NOGERMS, "TRAIT_NODECAY" = TRAIT_NODECAY, "TRAIT_NOEXAMINE" = TRAIT_NOEXAMINE, - "TRAIT_NOPAIN" = TRAIT_NOPAIN))) + "TRAIT_NOPAIN" = TRAIT_NOPAIN + ), + /obj/item = list( + "TRAIT_SHOW_WIRE_INFO" = TRAIT_SHOW_WIRE_INFO + ) +)) /// value -> trait name, generated on use from trait_by_type global GLOBAL_LIST(trait_name_map) diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm index 691018cd6fa..102b80f4359 100644 --- a/code/datums/wires/wires.dm +++ b/code/datums/wires/wires.dm @@ -209,7 +209,7 @@ /** * Proc called to determine if the user can see wire define information, such as "Contraband", "Door Bolts", etc. * - * If the user is an admin, or has a multitool which reveals wire information in their active hand, the proc returns TRUE. + * If the user is an admin, or has an item which reveals wire information in their active hand, the proc returns TRUE. * * Arguments: * * user - the mob who is interacting with the wires. @@ -217,10 +217,9 @@ /datum/wires/proc/can_see_wire_info(mob/user) if(user.can_admin_interact()) return TRUE - else if(istype(user.get_active_hand(), /obj/item/multitool)) - var/obj/item/multitool/M = user.get_active_hand() - if(M.shows_wire_information) - return TRUE + var/obj/item/held_item = user.get_active_hand() + if(istype(held_item) && HAS_TRAIT(held_item, TRAIT_SHOW_WIRE_INFO)) + return TRUE return FALSE /** diff --git a/code/game/objects/items/tools/multitool.dm b/code/game/objects/items/tools/multitool.dm index 7acee5352a3..61f512eff2e 100644 --- a/code/game/objects/items/tools/multitool.dm +++ b/code/game/objects/items/tools/multitool.dm @@ -24,7 +24,6 @@ toolspeed = 1 tool_behaviour = TOOL_MULTITOOL hitsound = 'sound/weapons/tap.ogg' - var/shows_wire_information = FALSE // shows what a wire does if set to TRUE var/obj/machinery/buffer // simple machine buffer for device linkage /obj/item/multitool/proc/IsBufferA(typepath) @@ -95,7 +94,10 @@ /obj/item/multitool/ai_detect/admin desc = "Used for pulsing wires to test which to cut. Not recommended by doctors. Has a strange tag that says 'Grief in Safety'" //What else should I say for a meme item? track_delay = 5 - shows_wire_information = TRUE + +/obj/item/multitool/ai_detect/admin/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_SHOW_WIRE_INFO, ROUNDSTART_TRAIT) /obj/item/multitool/ai_detect/admin/multitool_detect() var/turf/our_turf = get_turf(src) @@ -112,6 +114,12 @@ desc = "Optimised and stripped-down version of a regular multitool." toolspeed = 0.5 +/obj/item/multitool/cyborg/drone + +/obj/item/multitool/cyborg/drone/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_SHOW_WIRE_INFO, ROUNDSTART_TRAIT) // Drones are linked to the station + /obj/item/multitool/abductor name = "alien multitool" desc = "An omni-technological interface." @@ -119,4 +127,7 @@ icon_state = "multitool" toolspeed = 0.1 origin_tech = "magnets=5;engineering=5;abductor=3" - shows_wire_information = TRUE + +/obj/item/multitool/abductor/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_SHOW_WIRE_INFO, ROUNDSTART_TRAIT) diff --git a/code/game/objects/items/tools/wirecutters.dm b/code/game/objects/items/tools/wirecutters.dm index 12da212f4f3..17f4167868a 100644 --- a/code/game/objects/items/tools/wirecutters.dm +++ b/code/game/objects/items/tools/wirecutters.dm @@ -62,11 +62,21 @@ origin_tech = "materials=5;engineering=4;abductor=3" random_color = FALSE +/obj/item/wirecutters/abductor/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_SHOW_WIRE_INFO, ROUNDSTART_TRAIT) + /obj/item/wirecutters/cyborg name = "wirecutters" desc = "This cuts wires." toolspeed = 0.5 +/obj/item/wirecutters/cyborg/drone + +/obj/item/wirecutters/cyborg/drone/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_SHOW_WIRE_INFO, ROUNDSTART_TRAIT) // Drones are linked to the station + /obj/item/wirecutters/power name = "jaws of life" desc = "A set of jaws of life, the magic of science has managed to fit it down into a device small enough to fit in a tool belt. It's fitted with a cutting head." diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm index 71d8d5ef19b..26d15986d86 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -692,8 +692,8 @@ /obj/item/screwdriver/cyborg, /obj/item/wrench/cyborg, /obj/item/crowbar/cyborg, - /obj/item/wirecutters/cyborg, - /obj/item/multitool/cyborg, + /obj/item/wirecutters/cyborg/drone, + /obj/item/multitool/cyborg/drone, /obj/item/lightreplacer/cyborg, /obj/item/gripper, /obj/item/matter_decompiler,