diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index ee6ccfb544d..00277b64986 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -342,6 +342,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_FISH_CASE_COMPATIBILE "fish_case_compatibile" //Stuff that can go inside fish cases /// Plants that were mutated as a result of passive instability, not a mutation threshold. #define TRAIT_PLANT_WILDMUTATE "wildmutation" +/// If you hit an APC with exposed internals with this item it will try to shock you +#define TRAIT_APC_SHOCKING "apc_shocking" //quirk traits #define TRAIT_ALCOHOL_TOLERANCE "alcohol_tolerance" diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index 482cece5c37..797dd10c004 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -170,7 +170,8 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_NODROP" = TRAIT_NODROP, "TRAIT_NO_STORAGE_INSERT" = TRAIT_NO_STORAGE_INSERT, "TRAIT_T_RAY_VISIBLE" = TRAIT_T_RAY_VISIBLE, - "TRAIT_NO_TELEPORT" = TRAIT_NO_TELEPORT + "TRAIT_NO_TELEPORT" = TRAIT_NO_TELEPORT, + "TRAIT_APC_SHOCKING" = TRAIT_APC_SHOCKING ), /atom = list( "TRAIT_KEEP_TOGETHER" = TRAIT_KEEP_TOGETHER diff --git a/code/game/objects/items/kitchen.dm b/code/game/objects/items/kitchen.dm index 5727fb7a16f..c02d68789a9 100644 --- a/code/game/objects/items/kitchen.dm +++ b/code/game/objects/items/kitchen.dm @@ -15,6 +15,10 @@ lefthand_file = 'icons/mob/inhands/equipment/kitchen_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/kitchen_righthand.dmi' +/obj/item/kitchen/Initialize() + . = ..() + ADD_TRAIT(src, TRAIT_APC_SHOCKING, INNATE_TRAIT) + /obj/item/kitchen/fork name = "fork" desc = "Pointy." diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index f07af00a513..6ec74ad2516 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -583,6 +583,24 @@ return TRUE /obj/machinery/power/apc/attackby(obj/item/W, mob/living/user, params) + if(HAS_TRAIT(W, TRAIT_APC_SHOCKING)) + var/metal = 0 + var/shock_source = null + metal += LAZYACCESS(W.custom_materials, GET_MATERIAL_REF(/datum/material/iron))//This prevents wooden rolling pins from shocking the user + + if(cell || terminal) //The mob gets shocked by whichever powersource has the most electricity + if(cell && terminal) + shock_source = cell.charge > terminal.powernet.avail ? cell : terminal.powernet + else + shock_source = terminal?.powernet || cell + + if(shock_source && metal && (panel_open || opened)) //Now you're cooking with electricity + if(electrocute_mob(user, shock_source, src, siemens_coeff = 1, dist_check = TRUE))//People with insulated gloves just attack the APC normally. They're just short of magical anyway + do_sparks(5, TRUE, src) + user.visible_message("[user.name] shoves [W] into the internal components of [src], erupting into a cascade of sparks!") + if(shock_source == cell)//If the shock is coming from the cell just fully discharge it, because it's funny + cell.use(cell.charge) + return if(issilicon(user) && get_dist(src,user)>1) return attack_hand(user)