[MISSED MIRROR] Implements a macro for checking mind traits (#76548) (#22447)

* Implements a macro for checking mind traits (#76548)

![image](https://github.com/tgstation/tgstation/assets/82850673/f85d0556-1806-40bf-92b8-597e46ccb4af)
Seeing this pattern repeated over various sections of code was starting
to piss me off

Lessens chance to cause errors with mind traits, ensures consistent
behavior, makes it easier to change how mind traits work if necessary.

hopefully not player facing

---------

Co-authored-by: san7890 <the@san7890.com>

* modular stuff

---------

Co-authored-by: ChungusGamer666 <82850673+ChungusGamer666@users.noreply.github.com>
Co-authored-by: san7890 <the@san7890.com>
This commit is contained in:
Bloop
2023-07-18 21:32:47 -04:00
committed by GitHub
co-authored by san7890 ChungusGamer666
parent 4d2dac45c5
commit a9c80a29a3
48 changed files with 62 additions and 60 deletions
+1 -1
View File
@@ -657,7 +657,7 @@
H.set_jitter_if_lower(200 SECONDS)
to_chat(H, "<span class='userdanger'>[CONFIG_GET(string/blackoutpolicy)]</span>") //SKYRAT EDIT ADDITION
SEND_SIGNAL(H, COMSIG_LIVING_MINOR_SHOCK)
if(user.mind && HAS_TRAIT(user.mind, TRAIT_MORBID))
if(HAS_MIND_TRAIT(user, TRAIT_MORBID))
user.add_mood_event("morbid_saved_life", /datum/mood_event/morbid_saved_life)
else
user.add_mood_event("saved_life", /datum/mood_event/saved_life)
+3 -3
View File
@@ -343,18 +343,18 @@
/obj/item/food/baguette/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
if (HAS_TRAIT(user, TRAIT_MIMING) && held_item == src)
if(HAS_MIND_TRAIT(user, TRAIT_MIMING) && held_item == src)
context[SCREENTIP_CONTEXT_LMB] = "Toggle Swordplay"
return CONTEXTUAL_SCREENTIP_SET
/obj/item/food/baguette/examine(mob/user)
. = ..()
if(HAS_TRAIT(user, TRAIT_MIMING))
if(HAS_MIND_TRAIT(user, TRAIT_MIMING))
. += span_notice("You can wield this like a sword by using it in your hand.")
/obj/item/food/baguette/attack_self(mob/user, modifiers)
. = ..()
if(!HAS_TRAIT(user, TRAIT_MIMING))
if(!HAS_MIND_TRAIT(user, TRAIT_MIMING))
return
if(fake_swordplay)
end_swordplay(user)
+2 -2
View File
@@ -34,11 +34,11 @@ GLOBAL_LIST_EMPTY(possible_gifts)
/obj/item/a_gift/examine(mob/M)
. = ..()
if((M.mind && HAS_TRAIT(M.mind, TRAIT_PRESENT_VISION)) || isobserver(M))
if(HAS_MIND_TRAIT(M, TRAIT_PRESENT_VISION) || isobserver(M))
. += span_notice("It contains \a [initial(contains_type.name)].")
/obj/item/a_gift/attack_self(mob/M)
if(M.mind && HAS_TRAIT(M.mind, TRAIT_CANNOT_OPEN_PRESENTS))
if(HAS_MIND_TRAIT(M, TRAIT_CANNOT_OPEN_PRESENTS))
to_chat(M, span_warning("You're supposed to be spreading gifts, not opening them yourself!"))
return
+1 -1
View File
@@ -127,7 +127,7 @@
if(!chunky_finger_usable && ishuman(user))
var/mob/living/carbon/human/potential_chunky_finger_human = user
if(potential_chunky_finger_human.check_chunky_fingers() && user.is_holding(src) && !HAS_TRAIT(user, TRAIT_CHUNKYFINGERS_IGNORE_BATON) && (user.mind && !HAS_TRAIT(user.mind, TRAIT_CHUNKYFINGERS_IGNORE_BATON)))
if(potential_chunky_finger_human.check_chunky_fingers() && user.is_holding(src) && !HAS_MIND_TRAIT(user, TRAIT_CHUNKYFINGERS_IGNORE_BATON))
balloon_alert(potential_chunky_finger_human, "fingers are too big!")
return BATON_ATTACK_DONE
+1 -1
View File
@@ -103,7 +103,7 @@
var/mob/user = get(loc, /mob)
if(!istype(user))
return
if(user.mind && HAS_TRAIT(user.mind, TRAIT_CANNOT_OPEN_PRESENTS))
if(HAS_MIND_TRAIT(user, TRAIT_CANNOT_OPEN_PRESENTS))
var/turf/floor = get_turf(src)
var/obj/item/thing = new /obj/item/a_gift/anything(floor)
if(!atom_storage.attempt_insert(thing, user, override = TRUE))
@@ -161,7 +161,7 @@
/obj/item/storage/box/mime/attack_hand(mob/user, list/modifiers)
..()
if(HAS_TRAIT(user, TRAIT_MIMING))
if(HAS_MIND_TRAIT(user, TRAIT_MIMING))
alpha = 255
/obj/item/storage/box/mime/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE)