[MIRROR] Adds IS_TRAITOR macro [MDB IGNORE] (#20153)

* Adds IS_TRAITOR macro (#74293)

## About The Pull Request
i was making another PR and found that we have cultist, heretic, and
nuke op IS macros but not one for traitors
this adds one and then replaces it where applicable, mostly in checks
where a traitor device does something different if you are not a traitor

## Why It's Good For The Game

better for people making traitor only devices to have this macro, as it
is more clear and also cleaner in general i think

## Changelog

🆑
code: adds IS_TRAITOR macro
/🆑

* Adds IS_TRAITOR macro

---------

Co-authored-by: Sol N <116288367+flowercuco@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-03-29 23:30:56 +02:00
committed by GitHub
parent 601a7f53f0
commit 41396aab45
7 changed files with 9 additions and 6 deletions

View File

@@ -199,6 +199,9 @@ GLOBAL_LIST_INIT(ai_employers, list(
#define UPLINK_THEME_UNDERWORLD_MARKET "neutral"
/// Checks if the given mob is a traitor
#define IS_TRAITOR(mob) (mob?.mind?.has_antag_datum(/datum/antagonist/traitor))
/// Checks if the given mob is a blood cultist
#define IS_CULTIST(mob) (mob?.mind?.has_antag_datum(/datum/antagonist/cult))

View File

@@ -130,7 +130,7 @@ GLOBAL_VAR_INIT(cops_arrived, FALSE)
/obj/machinery/computer/communications/emag_act(mob/user, obj/item/card/emag/emag_card)
if(istype(emag_card, /obj/item/card/emag/battlecruiser))
if(!user.mind?.has_antag_datum(/datum/antagonist/traitor))
if(!IS_TRAITOR(user))
to_chat(user, span_danger("You get the feeling this is a bad idea."))
return
var/obj/item/card/emag/battlecruiser/caller_card = emag_card

View File

@@ -44,7 +44,7 @@
var/functional = TRUE
/obj/item/ai_module/malf/transmitInstructions(datum/ai_laws/law_datum, mob/sender, overflow)
if(!sender.mind?.has_antag_datum(/datum/antagonist/traitor))
if(!IS_TRAITOR(sender))
to_chat(sender, span_warning("You have no clue how to use this thing."))
return
if(!functional)

View File

@@ -86,7 +86,7 @@
/obj/item/dna_probe/carp_scanner/examine_more(mob/user)
. = ..()
if(user.mind.has_antag_datum(/datum/antagonist/traitor))
if(IS_TRAITOR(user))
. = list(span_notice("Using this on a Space Carp will harvest its DNA. Use it in-hand once complete to mutate it with yourself."))
/obj/item/dna_probe/carp_scanner/attack_self(mob/user, modifiers)

View File

@@ -245,7 +245,7 @@
if(!user.mind)
return
if(!user.mind.has_antag_datum(/datum/antagonist/traitor))
if(!IS_TRAITOR(user))
to_chat(user, span_warning("You can't seem to find a way to detonate the charge."))
return

View File

@@ -153,7 +153,7 @@ GLOBAL_DATUM_INIT(objective_machine_handler, /datum/objective_target_machine_han
/obj/item/traitor_machine_trapper/examine(mob/user)
. = ..()
if(!user.mind?.has_antag_datum(/datum/antagonist/traitor))
if(!IS_TRAITOR(user))
return
if(target_machine_path)
. += span_notice("This device must be placed by <b>clicking on a [initial(target_machine_path.name)]</b> with it. It can be removed with a screwdriver.")

View File

@@ -265,7 +265,7 @@ GLOBAL_DATUM_INIT(steal_item_handler, /datum/objective_item_handler, new())
if(planted_on)
return
if(user.mind?.has_antag_datum(/datum/antagonist/traitor))
if(IS_TRAITOR(user))
if(target_object_type)
. += span_notice("This device must be placed by <b>clicking on the [initial(target_object_type.name)]</b> with it.")
. += span_notice("Remember, you may leave behind fingerprints or fibers on the device. Use <b>soap</b> or similar to scrub it clean to be safe!")