Skip to content

Commit

Permalink
fixes relay cloaking being minorly fucked
Browse files Browse the repository at this point in the history
  • Loading branch information
Zonespace27 committed Sep 27, 2023
1 parent 542ba26 commit d07257d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
15 changes: 15 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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) (\
Expand Down
2 changes: 1 addition & 1 deletion code/game/turfs/open.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
17 changes: 7 additions & 10 deletions code/modules/cm_preds/yaut_bracers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -336,22 +335,22 @@

//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)

return ..()

/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)
. = ..()

Expand Down Expand Up @@ -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: <B>[max(round((cloak_timer - world.time) / 10), 1)]</b> seconds."))
return FALSE
Expand All @@ -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))
Expand Down Expand Up @@ -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."))
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions code/modules/cm_preds/yaut_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d07257d

Please sign in to comment.