From fb027f73ddfe697004627a48b6dec9ab2045e849 Mon Sep 17 00:00:00 2001 From: DGamerL <108773801+DGamerL@users.noreply.github.com> Date: Sun, 28 Apr 2024 22:57:26 +0200 Subject: [PATCH] Changes the `is_changeling` and `is_mindslave` procs into proper defines (#25212) * Changes these procs into proper defines * Henri review --- code/__DEFINES/antag_defines.dm | 9 +++------ code/datums/mind.dm | 4 ++-- code/datums/uplink_items/uplink_traitor.dm | 2 +- .../gamemodes/miniantags/abduction/abduction_gear.dm | 2 +- code/game/gamemodes/miniantags/guardian/guardian.dm | 2 +- code/game/gamemodes/objective.dm | 2 +- code/game/machinery/clonescanner.dm | 2 +- code/game/objects/items/devices/traitordevices.dm | 2 +- .../objects/items/weapons/bio_chips/bio_chip_traitor.dm | 2 +- code/game/objects/items/weapons/caution.dm | 2 +- code/game/objects/items/weapons/holy_weapons.dm | 2 +- code/game/verbs/suicide.dm | 2 +- code/modules/admin/misc_admin_procs.dm | 4 ++-- code/modules/antagonists/changeling/powers/mutations.dm | 2 +- code/modules/antagonists/changeling/powers/shriek.dm | 2 +- code/modules/antagonists/changeling/powers/swap_form.dm | 2 +- code/modules/antagonists/changeling/powers/tiny_prick.dm | 4 ++-- .../vampire/vampire_powers/dantalion_powers.dm | 2 +- code/modules/martial_arts/martial.dm | 4 ++-- code/modules/mob/living/carbon/human/human_damage.dm | 2 +- .../modules/mob/living/simple_animal/hostile/headslug.dm | 4 ++-- code/modules/reagents/chemistry/reagents/drugs.dm | 8 ++++---- code/modules/reagents/chemistry/reagents/medicine.dm | 2 +- code/modules/surgery/organs/brain.dm | 2 +- 24 files changed, 34 insertions(+), 37 deletions(-) diff --git a/code/__DEFINES/antag_defines.dm b/code/__DEFINES/antag_defines.dm index fe136abd200..24cfb19d97e 100644 --- a/code/__DEFINES/antag_defines.dm +++ b/code/__DEFINES/antag_defines.dm @@ -47,7 +47,7 @@ GLOBAL_LIST(contractors) /// Denotes that this power can not be obtained normally. Primarily used for base types such as [/datum/action/changeling/weapon]. #define CHANGELING_UNOBTAINABLE_POWER 3 -#define CHANGELING_FAKEDEATH_TIME 50 SECONDS +#define CHANGELING_FAKEDEATH_TIME 50 SECONDS #define CHANGELING_ABSORB_RECENT_SPEECH 8 //The amount of recent spoken lines to gain on absorbing a mob /** @@ -62,9 +62,6 @@ GLOBAL_LIST(contractors) */ #define PULSEDEMON_SOURCE_DRAIN_INVALID (-1) -/proc/ischangeling(mob/M) // TODO: Someone please convert these to proper defines some day. - return M.mind?.has_antag_datum(/datum/antagonist/changeling) +#define IS_CHANGELING(mob) (isliving(mob) && mob?:mind?:has_antag_datum(/datum/antagonist/changeling)) -// Helper proc that determines if a mob is a mindslave. -/proc/ismindslave(mob/living/carbon/human/H) - return istype(H) && H.mind.has_antag_datum(/datum/antagonist/mindslave, FALSE) +#define IS_MINDSLAVE(mob) (ishuman(mob) && mob?:mind?:has_antag_datum(/datum/antagonist/mindslave, FALSE)) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 73608ba323e..5bde8280239 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -962,12 +962,12 @@ else if(href_list["changeling"]) switch(href_list["changeling"]) if("clear") - if(ischangeling(current)) + if(IS_CHANGELING(current)) remove_antag_datum(/datum/antagonist/changeling) log_admin("[key_name(usr)] has de-changelinged [key_name(current)]") message_admins("[key_name_admin(usr)] has de-changelinged [key_name_admin(current)]") if("changeling") - if(!ischangeling(current)) + if(!IS_CHANGELING(current)) add_antag_datum(/datum/antagonist/changeling) to_chat(current, "Your powers have awoken. A flash of memory returns to us... we are a changeling!") log_admin("[key_name(usr)] has changelinged [key_name(current)]") diff --git a/code/datums/uplink_items/uplink_traitor.dm b/code/datums/uplink_items/uplink_traitor.dm index f3cbb83b9ab..545ec96e3bc 100644 --- a/code/datums/uplink_items/uplink_traitor.dm +++ b/code/datums/uplink_items/uplink_traitor.dm @@ -587,7 +587,7 @@ else if(!AT) to_chat(usr, "Error: Embedded Syndicate credentials not found.") return - else if(ischangeling(usr) || mind.has_antag_datum(/datum/antagonist/vampire)) + else if(IS_CHANGELING(usr) || mind.has_antag_datum(/datum/antagonist/vampire)) to_chat(usr, "Error: Embedded Syndicate credentials contain an abnormal signature. Aborting.") return diff --git a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm index 81e111ea154..9d85e02c738 100644 --- a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm +++ b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm @@ -532,7 +532,7 @@ Congratulations! You are now trained for invasive xenobiology research!"} if(ishuman(L)) var/mob/living/carbon/human/H = L species = "[H.dna.species.name]" - if(ischangeling(L)) + if(IS_CHANGELING(L)) species = "Changeling lifeform" var/obj/item/organ/internal/heart/gland/temp = locate() in H.internal_organs if(temp) diff --git a/code/game/gamemodes/miniantags/guardian/guardian.dm b/code/game/gamemodes/miniantags/guardian/guardian.dm index 0f2e2f4efaa..35bd921e8a2 100644 --- a/code/game/gamemodes/miniantags/guardian/guardian.dm +++ b/code/game/gamemodes/miniantags/guardian/guardian.dm @@ -276,7 +276,7 @@ if(has_guardian(user)) to_chat(user, "You already have a [mob_name]!") return - if(user.mind && (ischangeling(user) || user.mind.has_antag_datum(/datum/antagonist/vampire))) + if(user.mind && (IS_CHANGELING(user) || user.mind.has_antag_datum(/datum/antagonist/vampire))) to_chat(user, "[ling_failure]") return if(used) diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index 222ff61365b..b7f98ddc1ba 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -276,7 +276,7 @@ GLOBAL_LIST_INIT(potential_theft_objectives, (subtypesof(/datum/theft_objective) if(.) return // If the target is a changeling, then it's an invalid target. Since changelings can not be debrained. - if(ischangeling(possible_target.current)) + if(IS_CHANGELING(possible_target.current)) return TARGET_INVALID_CHANGELING /datum/objective/debrain/update_explanation_text() diff --git a/code/game/machinery/clonescanner.dm b/code/game/machinery/clonescanner.dm index 83105a45ba4..4ad65dd355c 100644 --- a/code/game/machinery/clonescanner.dm +++ b/code/game/machinery/clonescanner.dm @@ -109,7 +109,7 @@ return SCANNER_HUSKED if(NO_CLONESCAN in scanned.dna.species.species_traits) return SCANNER_UNCLONEABLE_SPECIES - if(!scanned.ckey || !scanned.client || ischangeling(scanned)) + if(!scanned.ckey || !scanned.client || IS_CHANGELING(scanned)) return SCANNER_NO_SOUL if(scanned.suiciding || !scanned.get_int_organ(/obj/item/organ/internal/brain)) return SCANNER_BRAIN_ISSUE diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm index 62c6af8cb8d..464886db05e 100644 --- a/code/game/objects/items/devices/traitordevices.dm +++ b/code/game/objects/items/devices/traitordevices.dm @@ -271,7 +271,7 @@ if(HAS_TRAIT(user, TRAIT_RESISTHEAT)) to_chat(user, "You are already fireproof!") return - if(user.mind && (ischangeling(user) || user.mind.has_antag_datum(/datum/antagonist/vampire)) || (user.dna && user.dna.species.name != "Plasmaman")) + if(user.mind && (IS_CHANGELING(user) || user.mind.has_antag_datum(/datum/antagonist/vampire)) || (user.dna && user.dna.species.name != "Plasmaman")) to_chat(user, "The injector is not compatable with your biology!") return if(used) diff --git a/code/game/objects/items/weapons/bio_chips/bio_chip_traitor.dm b/code/game/objects/items/weapons/bio_chips/bio_chip_traitor.dm index b937df4540a..656e82f74c2 100644 --- a/code/game/objects/items/weapons/bio_chips/bio_chip_traitor.dm +++ b/code/game/objects/items/weapons/bio_chips/bio_chip_traitor.dm @@ -20,7 +20,7 @@ return FALSE // Fails if they're already a mindslave of someone, or if they're mindshielded. - if(ismindslave(mindslave_target) || ismindshielded(mindslave_target)) + if(IS_MINDSLAVE(mindslave_target) || ismindshielded(mindslave_target)) mindslave_target.visible_message( "[mindslave_target] seems to resist the bio-chip!", \ "You feel a strange sensation in your head that quickly dissipates.") diff --git a/code/game/objects/items/weapons/caution.dm b/code/game/objects/items/weapons/caution.dm index a32c548d648..8c0a3ba13e3 100644 --- a/code/game/objects/items/weapons/caution.dm +++ b/code/game/objects/items/weapons/caution.dm @@ -24,7 +24,7 @@ /obj/item/caution/proximity_sign/attack_self(mob/user as mob) if(ishuman(user)) var/mob/living/carbon/human/H = user - if(!H.mind.has_antag_datum(/datum/antagonist/traitor) && !ismindslave(H)) + if(!H.mind.has_antag_datum(/datum/antagonist/traitor) && !IS_MINDSLAVE(H)) return if(armed) armed = FALSE diff --git a/code/game/objects/items/weapons/holy_weapons.dm b/code/game/objects/items/weapons/holy_weapons.dm index a117746c570..884989b976f 100644 --- a/code/game/objects/items/weapons/holy_weapons.dm +++ b/code/game/objects/items/weapons/holy_weapons.dm @@ -757,7 +757,7 @@ if(!target || !ishuman(target) || !missionary || !ishuman(missionary)) return - if(ismindslave(target) || target.mind.zealot_master) //mindslaves and zealots override the staff because the staff is just a temporary mindslave + if(IS_MINDSLAVE(target) || target.mind.zealot_master) //mindslaves and zealots override the staff because the staff is just a temporary mindslave to_chat(missionary, "Your faith is strong, but [target.p_their()] mind is already slaved to someone else's ideals. Perhaps an inquisition would reveal more...") faith -= 25 //same faith cost as losing sight of them mid-conversion, but did you just find someone who can lead you to a fellow traitor? return diff --git a/code/game/verbs/suicide.dm b/code/game/verbs/suicide.dm index 31a0992848a..4a88e697163 100644 --- a/code/game/verbs/suicide.dm +++ b/code/game/verbs/suicide.dm @@ -19,7 +19,7 @@ var/confirm = null if(!forced) - if(ischangeling(src)) + if(IS_CHANGELING(src)) // the alternative is to allow clings to commit suicide, but then you'd probably have them // killing themselves as soon as they're in cuffs to_chat(src, "We refuse to take the coward's way out.") diff --git a/code/modules/admin/misc_admin_procs.dm b/code/modules/admin/misc_admin_procs.dm index 03aa0b49fb0..b5e0ee8bc13 100644 --- a/code/modules/admin/misc_admin_procs.dm +++ b/code/modules/admin/misc_admin_procs.dm @@ -660,7 +660,7 @@ GLOBAL_VAR_INIT(nologevent, 0) antag_list += "Nuclear Operative" if(iswizard(M)) antag_list += "Wizard" - if(ischangeling(M)) + if(IS_CHANGELING(M)) antag_list += "Changeling" if(M.mind in SSticker.mode.abductors) antag_list += "Abductor" @@ -670,7 +670,7 @@ GLOBAL_VAR_INIT(nologevent, 0) antag_list += "Vampire Thrall" if(M.mind.has_antag_datum(/datum/antagonist/traitor)) antag_list += "Traitor" - if(M.mind.has_antag_datum(/datum/antagonist/mindslave, FALSE)) + if(IS_MINDSLAVE(M)) antag_list += "Mindslave" if(isrobot(M)) var/mob/living/silicon/robot/R = M diff --git a/code/modules/antagonists/changeling/powers/mutations.dm b/code/modules/antagonists/changeling/powers/mutations.dm index 67261202e52..f3e98d67d27 100644 --- a/code/modules/antagonists/changeling/powers/mutations.dm +++ b/code/modules/antagonists/changeling/powers/mutations.dm @@ -40,7 +40,7 @@ /datum/action/changeling/weapon/proc/retract(atom/target, any_hand = FALSE) SIGNAL_HANDLER - if(!ischangeling(owner)) + if(!IS_CHANGELING(owner)) return if(!any_hand && !istype(owner.get_active_hand(), weapon_type)) return diff --git a/code/modules/antagonists/changeling/powers/shriek.dm b/code/modules/antagonists/changeling/powers/shriek.dm index c7e629bd661..7fd6c4ec3a0 100644 --- a/code/modules/antagonists/changeling/powers/shriek.dm +++ b/code/modules/antagonists/changeling/powers/shriek.dm @@ -19,7 +19,7 @@ var/mob/living/carbon/human/H = M if(H.check_ear_prot() >= HEARING_PROTECTION_TOTAL) continue - if(!M.mind || !ischangeling(M)) + if(!M.mind || !IS_CHANGELING(M)) M.Deaf(30 SECONDS) M.AdjustConfused(40 SECONDS) M.Jitter(100 SECONDS) diff --git a/code/modules/antagonists/changeling/powers/swap_form.dm b/code/modules/antagonists/changeling/powers/swap_form.dm index 71a838c1fdc..168e6b850a0 100644 --- a/code/modules/antagonists/changeling/powers/swap_form.dm +++ b/code/modules/antagonists/changeling/powers/swap_form.dm @@ -23,7 +23,7 @@ if(!istype(target) || !target.mind || issmall(target) || HAS_TRAIT(target, TRAIT_GENELESS)) to_chat(user, "[target] is not compatible with this ability.") return FALSE - if(ischangeling(target)) + if(IS_CHANGELING(target)) to_chat(user, "We are unable to swap forms with another changeling!") return FALSE return TRUE diff --git a/code/modules/antagonists/changeling/powers/tiny_prick.dm b/code/modules/antagonists/changeling/powers/tiny_prick.dm index 39b34d94949..044805cfe39 100644 --- a/code/modules/antagonists/changeling/powers/tiny_prick.dm +++ b/code/modules/antagonists/changeling/powers/tiny_prick.dm @@ -57,7 +57,7 @@ if(ismachineperson(target)) to_chat(user, "This won't work on synthetics.") return FALSE - if(ischangeling(target)) + if(IS_CHANGELING(target)) sting_feedback(user, target) take_chemical_cost() return FALSE @@ -67,7 +67,7 @@ if(!target) return to_chat(user, "We stealthily sting [target.name].") - if(ischangeling(target)) + if(IS_CHANGELING(target)) to_chat(target, "You feel a tiny prick.") add_attack_logs(user, target, "Unsuccessful sting (changeling)") return TRUE diff --git a/code/modules/antagonists/vampire/vampire_powers/dantalion_powers.dm b/code/modules/antagonists/vampire/vampire_powers/dantalion_powers.dm index e078349bf7e..39b7869ec86 100644 --- a/code/modules/antagonists/vampire/vampire_powers/dantalion_powers.dm +++ b/code/modules/antagonists/vampire/vampire_powers/dantalion_powers.dm @@ -55,7 +55,7 @@ if(V.subclass.thrall_cap <= length(user.mind.som.serv)) to_chat(user, "You don't have enough power to enthrall any more people!") return - if(ismindshielded(C) || C.mind.has_antag_datum(/datum/antagonist/vampire) || C.mind.has_antag_datum(/datum/antagonist/mindslave)) + if(ismindshielded(C) || C.mind.has_antag_datum(/datum/antagonist/vampire) || IS_MINDSLAVE(C)) C.visible_message("[C] seems to resist the takeover!", "You feel a familiar sensation in your skull that quickly dissipates.") return if(HAS_MIND_TRAIT(C, TRAIT_HOLY)) diff --git a/code/modules/martial_arts/martial.dm b/code/modules/martial_arts/martial.dm index 36e99c67e57..8ab6c179008 100644 --- a/code/modules/martial_arts/martial.dm +++ b/code/modules/martial_arts/martial.dm @@ -316,7 +316,7 @@ if(!istype(user) || !user) return if(user.mind) //Prevents changelings and vampires from being able to learn it - if(ischangeling(user)) + if(IS_CHANGELING(user)) to_chat(user, "We try multiple times, but we are not able to comprehend the contents of the scroll!") return else if(user.mind.has_antag_datum(/datum/antagonist/vampire)) //Vampires @@ -340,7 +340,7 @@ if(!istype(user) || !user) return if(user.mind) //Prevents changelings and vampires from being able to learn it - if(ischangeling(user)) + if(IS_CHANGELING(user)) to_chat(user, "We try multiple times, but we simply cannot grasp the basics of CQC!") return else if(user.mind.has_antag_datum(/datum/antagonist/vampire)) //Vampires diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index 565d09412c5..caad6f0e60d 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -58,7 +58,7 @@ if(sponge) return min(sponge.damage,maxHealth*2) else - if(ischangeling(src)) + if(IS_CHANGELING(src)) // if a changeling has no brain, they have no brain damage. return 0 diff --git a/code/modules/mob/living/simple_animal/hostile/headslug.dm b/code/modules/mob/living/simple_animal/hostile/headslug.dm index 55c1d05008c..2a9066a6784 100644 --- a/code/modules/mob/living/simple_animal/hostile/headslug.dm +++ b/code/modules/mob/living/simple_animal/hostile/headslug.dm @@ -62,7 +62,7 @@ /mob/living/simple_animal/hostile/headslug/projectile_hit_check(obj/item/projectile/P) return (stat || FALSE) - + /obj/item/organ/internal/body_egg/changeling_egg name = "changeling egg" desc = "Twitching and disgusting." @@ -95,7 +95,7 @@ if(origin && origin.current && (origin.current.stat == DEAD)) origin.transfer_to(M) - var/datum/antagonist/changeling/cling = M.mind.has_antag_datum(/datum/antagonist/changeling) + var/datum/antagonist/changeling/cling = IS_CHANGELING(M) if(cling.can_absorb_dna(owner)) cling.absorb_dna(owner) diff --git a/code/modules/reagents/chemistry/reagents/drugs.dm b/code/modules/reagents/chemistry/reagents/drugs.dm index f2a1442f275..31d215c6a4a 100644 --- a/code/modules/reagents/chemistry/reagents/drugs.dm +++ b/code/modules/reagents/chemistry/reagents/drugs.dm @@ -883,7 +883,7 @@ game_plane_master_controller.add_filter(MEPHEDRONE_SCREEN_BLUR, 1, list("type" = "radial_blur", "size" = 0.02)) - if(!ischangeling(L) || HAS_TRAIT(L, TRAIT_MEPHEDRONE_ADAPTED)) + if(!IS_CHANGELING(L) || HAS_TRAIT(L, TRAIT_MEPHEDRONE_ADAPTED)) return var/datum/antagonist/changeling/cling = L.mind.has_antag_datum(/datum/antagonist/changeling) cling.chem_recharge_slowdown += 1 @@ -901,7 +901,7 @@ if(overdosed) UnregisterSignal(L, COMSIG_ATOM_PREHIT) - if(ischangeling(L)) + if(IS_CHANGELING(L)) var/datum/antagonist/changeling/cling = L.mind.has_antag_datum(/datum/antagonist/changeling) cling.chem_recharge_slowdown -= changeling_chemical_tracker changeling_chemical_tracker = 0 @@ -1014,7 +1014,7 @@ RegisterSignal(L, COMSIG_ATOM_PREHIT, PROC_REF(dodge_bullets)) L.next_move_modifier -= 0.2 // Overdosing makes you a liiitle faster but you know has some really bad consequences - if(ischangeling(L)) + if(IS_CHANGELING(L)) var/datum/antagonist/changeling/cling = L.mind.has_antag_datum(/datum/antagonist/changeling) cling.chem_recharge_slowdown += 1 changeling_chemical_tracker += 1 @@ -1036,7 +1036,7 @@ L.next_move_modifier += 0.2 - if(ischangeling(L)) + if(IS_CHANGELING(L)) var/datum/antagonist/changeling/cling = L.mind.has_antag_datum(/datum/antagonist/changeling) if(changeling_chemical_tracker > 0) //Just in case this gets called somehow after on_remove is done cling.chem_recharge_slowdown -= 1 diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index fbda929a599..9ed4d2a450c 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -905,7 +905,7 @@ if(method == REAGENT_INGEST || (method == REAGENT_TOUCH && prob(25))) if(M.stat == DEAD) if(M.getBruteLoss() + M.getFireLoss() + M.getCloneLoss() >= 150) - if(ischangeling(M)) + if(IS_CHANGELING(M)) return M.delayed_gib(TRUE) return diff --git a/code/modules/surgery/organs/brain.dm b/code/modules/surgery/organs/brain.dm index 833ee9ceca5..d6efa77a414 100644 --- a/code/modules/surgery/organs/brain.dm +++ b/code/modules/surgery/organs/brain.dm @@ -101,7 +101,7 @@ var/mob/living/carbon/human/H = target H.update_hair() - if(ischangeling(target)) + if(IS_CHANGELING(target)) decoy_brain = TRUE if(!brain_already_exists)