diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 3486988d4d60..b40ae85c3f5f 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -102,6 +102,21 @@ }\ } while (0) +/// Will 100% nuke a trait regardless of source. Preferably use this as little as possible +#define REMOVE_TRAIT_ALLSOURCES(target, trait) \ + do { \ + var/list/_L = target.status_traits; \ + if (_L?[trait]) { \ + if (length(_L)) { \ + _L -= trait; \ + SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(trait), trait); \ + }; \ + else { \ + target.status_traits = null \ + }; \ + } \ + } while (0) + #define HAS_TRAIT(target, trait) (target.status_traits ? (target.status_traits[trait] ? TRUE : FALSE) : FALSE) #define HAS_TRAIT_FROM(target, trait, source) (target.status_traits ? (target.status_traits[trait] ? (source in target.status_traits[trait]) : FALSE) : FALSE) #define HAS_TRAIT_FROM_ONLY(target, trait, source) (\ diff --git a/code/game/turfs/open.dm b/code/game/turfs/open.dm index c88f79b43293..a4781e1a6609 100644 --- a/code/game/turfs/open.dm +++ b/code/game/turfs/open.dm @@ -515,7 +515,7 @@ if(H.gloves && rand(0,100) < 60) if(istype(H.gloves,/obj/item/clothing/gloves/yautja/hunter)) var/obj/item/clothing/gloves/yautja/hunter/Y = H.gloves - if(Y && istype(Y) && Y.cloaked) + if(Y && istype(Y) && HAS_TRAIT(H, TRAIT_CLOAKED)) to_chat(H, SPAN_WARNING(" Your bracers hiss and spark as they short out!")) Y.decloak(H, TRUE, DECLOAK_SUBMERGED) diff --git a/code/modules/cm_preds/yaut_bracers.dm b/code/modules/cm_preds/yaut_bracers.dm index 4e5dcb8c6386..f2a5261e1cc7 100644 --- a/code/modules/cm_preds/yaut_bracers.dm +++ b/code/modules/cm_preds/yaut_bracers.dm @@ -35,7 +35,6 @@ var/charge_rate = 30 /// Cooldown on draining power from APC var/charge_cooldown = COOLDOWN_BRACER_CHARGE - var/cloaked = 0 var/cloak_timer = 0 var/cloak_malfunction = 0 /// Determines the alpha level of the cloaking device. @@ -96,7 +95,7 @@ human_holder.update_power_display(perc_charge) //Non-Yautja have a chance to get stunned with each power drain - if(!cloaked) + if(!HAS_TRAIT(human_holder, TRAIT_CLOAKED)) return if(human_holder.stat == DEAD) decloak(human_holder, TRUE) @@ -293,7 +292,7 @@ var/mob/living/carbon/human/wearer = loc if(wearer.gloves == src) wearer.visible_message(SPAN_DANGER("You hear a hiss and crackle!"), SPAN_DANGER("Your bracers hiss and spark!"), SPAN_DANGER("You hear a hiss and crackle!")) - if(cloaked) + if(HAS_TRAIT(wearer, TRAIT_CLOAKED)) decloak(wearer, TRUE, DECLOAK_EMP) else var/turf/our_turf = get_turf(src) @@ -336,7 +335,7 @@ //Non-Yautja have a chance to get stunned with each power drain if((!HAS_TRAIT(human, TRAIT_YAUTJA_TECH) && !human.hunter_data.thralled) && prob(4)) - if(cloaked) + if(HAS_TRAIT(human, TRAIT_CLOAKED)) decloak(human, TRUE, DECLOAK_SPECIES) shock_user(human) @@ -344,14 +343,14 @@ /obj/item/clothing/gloves/yautja/hunter/dropped(mob/user) move_chip_to_bracer() - if(cloaked) + if(HAS_TRAIT(user, TRAIT_CLOAKED)) decloak(user, TRUE) ..() /obj/item/clothing/gloves/yautja/hunter/on_enter_storage(obj/item/storage/S) if(ishuman(loc)) var/mob/living/carbon/human/human = loc - if(cloaked) + if(HAS_TRAIT(human, TRAIT_CLOAKED)) decloak(human, TRUE) . = ..() @@ -549,7 +548,7 @@ if(!istype(M) || M.is_mob_incapacitated()) return FALSE - if(cloaked) //Turn it off. + if(HAS_TRAIT(caller, TRAIT_CLOAKED)) //Turn it off. if(cloak_timer > world.time) to_chat(M, SPAN_WARNING("Your cloaking device is busy! Time left: [max(round((cloak_timer - world.time) / 10), 1)] seconds.")) return FALSE @@ -570,7 +569,6 @@ if(!drain_power(M, 50)) return FALSE - cloaked = TRUE ADD_TRAIT(M, TRAIT_CLOAKED, TRAIT_SOURCE_EQUIPMENT(WEAR_HANDS)) RegisterSignal(M, COMSIG_HUMAN_EXTINGUISH, PROC_REF(wrapper_fizzle_camouflage)) @@ -617,7 +615,6 @@ if(forced) cloak_malfunction = world.time + decloak_timer - cloaked = FALSE REMOVE_TRAIT(user, TRAIT_CLOAKED, TRAIT_SOURCE_EQUIPMENT(WEAR_HANDS)) log_game("[key_name_admin(user)] has disabled their cloaking device.") user.visible_message(SPAN_WARNING("[user] shimmers into existence!"), SPAN_WARNING("Your cloaking device deactivates.")) @@ -734,7 +731,7 @@ var/mob/living/carbon/human/M = caller - if(cloaked) + if(HAS_TRAIT(M, TRAIT_CLOAKED)) to_chat(M, SPAN_WARNING("Not while you're cloaked. It might disrupt the sequence.")) return if(M.stat == DEAD) diff --git a/code/modules/cm_preds/yaut_items.dm b/code/modules/cm_preds/yaut_items.dm index 9e56d0da7098..c86a3fdd23e2 100644 --- a/code/modules/cm_preds/yaut_items.dm +++ b/code/modules/cm_preds/yaut_items.dm @@ -430,10 +430,12 @@ if(do_after(user, 10 SECONDS, INTERRUPT_ALL, BUSY_ICON_GENERIC)) // Display fancy animation for you and the person you might be pulling (Legacy) + REMOVE_TRAIT_ALLSOURCES(user, TRAIT_CLOAKED) user.visible_message(SPAN_WARNING("[icon2html(user, viewers(src))][user] disappears!")) var/tele_time = animation_teleport_quick_out(user) var/mob/living/M = user.pulling if(istype(M)) // Pulled person + REMOVE_TRAIT_ALLSOURCES(M, TRAIT_CLOAKED) M.visible_message(SPAN_WARNING("[icon2html(M, viewers(src))][M] disappears!")) animation_teleport_quick_out(M) diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/predalien/predalien_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/predalien/predalien_powers.dm index 5c1584c565c6..3b52a60419df 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/predalien/predalien_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/predalien/predalien_powers.dm @@ -24,7 +24,7 @@ var/obj/item/clothing/gloves/yautja/hunter/YG = locate(/obj/item/clothing/gloves/yautja/hunter) in human if(isyautja(human) && YG) - if(YG.cloaked) + if(HAS_TRAIT(human, TRAIT_CLOAKED)) YG.decloak(human, TRUE, DECLOAK_PREDALIEN) YG.cloak_timer = xeno_cooldown * 0.1