Files
Aurora.3/code/__DEFINES/is_helpers.dm
T
BatrachophrenoandGitHub 4ecb0bc21c Repath obj/machinery to obj/structure/machinery [MDB Ignore] (#22500)
Repaths obj/machinery to obj/structure/machinery. **Note for
reviewers:** the only meaningful changed code exists within
**code/game/objects/structures.dm** and
**code/game/objects/structures/_machinery.dm**, largely concerning
damage procs. With the exception of moving airlock defines to their own
file, ALL OTHER CHANGES ARE STRICTLY PATH CHANGES.

Objects, _categorically_, are largely divided between those you can hold
in your hand/inventory and those you can't. Machinery objects are
already subtypes of Structures behaviorally, this PR just makes their
pathing reflect that, and allows for future work (tool actions, more
health/destruction functionality) to be developed without unnecessary
code duplication.

I have tested this PR by loading up the Horizon and dismantling various
machines and structures with tools, shooting guns of various types
throughout the ship, and detonating a bunch of explosions throughout the
ship.
2026-05-26 19:35:48 +00:00

103 lines
3.6 KiB
Plaintext

#define is_multi_tile_object(atom) (atom.bound_width > world.icon_size || atom.bound_height > world.icon_size)
#define isAI(A) istype(A, /mob/living/silicon/ai)
#define isDrone(A) istype(A, /mob/living/silicon/robot/drone)
#define isMatriarchDrone(A) istype(A, /mob/living/silicon/robot/drone/construction/matriarch)
#define isalien(A) istype(A, /mob/living/carbon/alien)
#define isanimal(A) istype(A, /mob/living/simple_animal)
#define isairlock(A) istype(A, /obj/structure/machinery/door/airlock)
#define isbrain(A) istype(A, /mob/living/carbon/brain)
#define isvirtualmob(A) istype(A, /mob/abstract/ghost/observer/virtual)
#define iscarbon(A) istype(A, /mob/living/carbon)
#define iscorgi(A) istype(A, /mob/living/simple_animal/corgi)
#define isEye(A) istype(A, /mob/abstract/eye)
#define ishuman(A) istype(A, /mob/living/carbon/human)
/**
* Astype() variant of ishuman(), for use in inlining the check when you only need it once.
* This is equal to null if the target is not of the type /mob/living/carbon/human.
* And is automatically typecast as a /mob/living/carbon/human if the check passes.
*/
#define ashuman(A) astype(A, /mob/living/carbon/human)
#define ismech(A) istype(A, /mob/living/heavy_vehicle)
#define isliving(A) istype(A, /mob/living)
#define israt(A) istype(A, /mob/living/simple_animal/rat)
#define isnewplayer(A) istype(A, /mob/abstract/new_player)
#define isobj(A) istype(A, /obj)
#define isspace(A) istype(A, /area/space)
#define isspaceturf(A) istype(A, /turf/space)
#define ischasm(A) (istype(A, /turf/simulated/floor/exoplanet/abyss) || istype(A, /turf/simulated/abyss))
#define isghost(A) istype(A, /mob/abstract/ghost)
#define isobserver(A) istype(A, /mob/abstract/ghost/observer)
#define isstoryteller(A) istype(A, /mob/abstract/ghost/storyteller)
#define isabstractmob(A) istype(A, /mob/abstract)
#define isorgan(A) istype(A, /obj/item/organ/external)
#define ispAI(A) istype(A, /mob/living/silicon/pai)
#define isbot(A) istype(A, /mob/living/bot)
#define isrobot(A) istype(A, /mob/living/silicon/robot)
#define issilicon(A) istype(A, /mob/living/silicon)
#define isslime(A) istype(A, /mob/living/carbon/slime)
#define iscapacitor(A) istype(A, /obj/item/stock_parts/capacitor)
#define ismicrolaser(A) istype(A, /obj/item/stock_parts/micro_laser)
#define ismatterbin(A) istype(A, /obj/item/stock_parts/matter_bin)
#define isscanner(A) istype(A, /obj/item/stock_parts/scanning_module)
#define ismanipulator(A) istype(A, /obj/item/stock_parts/manipulator)
#define isclient(A) istype(A, /client)
#define isclothing(A) istype(A, /obj/item/clothing)
#define isaccessory(A) istype(A, /obj/item/clothing/accessory)
/// Projectile helpers
#define isprojectile(A) istype(A, /obj/projectile)
#define isbeam(A) istype(A, /obj/projectile/beam)
#define isenergy(A) istype(A, /obj/projectile/energy)
#define istransparentturf(A) (HAS_TRAIT(A, TURF_Z_TRANSPARENT_TRAIT))
/**
* A common layered filter pattern for psionics. Helps with reducing the size of guard clauses.
* Includes every psionic check for RECEIVING starting with the Zona Bovina, and ending with Psi-sensitivity.
* Set the sensitivity_threshold for your desired minimum Psi-sensitivity to pass.
* The most common ones you might want are:
* 2 for "Antag-like".
* 1 for "Skrell-like".
* 0 for "Human-like".
*
* This one is a define instead of a proc, which gives better code performance.
* This define is only usable if user is at least an /atom/movable/, such as /mob/
*/
#define IS_TELEPATHY_BLOCKED(user, sensitivity_threshold) (!user.has_zona_bovinae() || user.is_psi_blocked() || user.check_psi_sensitivity() < sensitivity_threshold)