From cc309236d9bdd1d9df9944961940dcb1658e13ae Mon Sep 17 00:00:00 2001 From: KorPhaeron Date: Mon, 2 Oct 2017 01:03:40 -0500 Subject: [PATCH] ismecha define (#31192) --- code/__DEFINES/is_helpers.dm | 2 ++ code/_onclick/click.dm | 2 +- code/_onclick/hud/human.dm | 2 +- code/_onclick/hud/screen_objects.dm | 6 +++--- code/datums/weather/weather_types/ash_storm.dm | 2 +- .../clock_cult/clock_structures/ocular_warden.dm | 4 ++-- code/game/machinery/doors/door.dm | 2 +- code/game/machinery/doors/windowdoor.dm | 2 +- code/game/machinery/mass_driver.dm | 2 +- code/game/machinery/porta_turret/portable_turret.dm | 2 +- code/game/mecha/mecha_control_console.dm | 8 ++++---- code/game/objects/effects/portals.dm | 2 +- code/game/objects/items/storage/storage.dm | 2 +- code/game/objects/structures/mineral_doors.dm | 2 +- code/game/objects/structures/plasticflaps.dm | 2 +- code/game/turfs/simulated/minerals.dm | 6 ------ code/modules/clothing/clothing.dm | 2 +- code/modules/events/wormholes.dm | 2 +- code/modules/mining/equipment/wormhole_jaunter.dm | 2 +- code/modules/mining/lavaland/necropolis_chests.dm | 2 +- code/modules/mob/living/carbon/human/death.dm | 2 +- code/modules/mob/living/simple_animal/hostile/hostile.dm | 4 ++-- .../mob/living/simple_animal/hostile/mecha_pilot.dm | 4 ++-- .../living/simple_animal/hostile/retaliate/retaliate.dm | 4 ++-- code/modules/mob/living/simple_animal/simple_animal.dm | 2 +- code/modules/mob/mob.dm | 2 +- code/modules/power/power.dm | 2 +- code/modules/power/singularity/containment_field.dm | 6 +++--- code/modules/projectiles/projectile.dm | 2 +- code/modules/projectiles/projectile/special.dm | 2 +- 30 files changed, 41 insertions(+), 45 deletions(-) diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index 234efa73790..2dad9291f2a 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -138,6 +138,8 @@ #define isstructure(A) (istype(A, /obj/structure)) +#define ismecha(A) (istype(A, /obj/mecha)) + #define is_cleanable(A) (istype(A, /obj/effect/decal/cleanable) || istype(A, /obj/effect/rune)) //if something is cleanable #define isorgan(A) (istype(A, /obj/item/organ)) diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index aa43592c647..2bd1d014310 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -96,7 +96,7 @@ if(!modifiers["catcher"] && A.IsObscured()) return - if(istype(loc, /obj/mecha)) + if(ismecha(loc)) var/obj/mecha/M = loc return M.click_action(A,src,params) diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 2922a4e0366..9c41f414986 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -28,7 +28,7 @@ icon_state = "act_equip" /obj/screen/human/equip/Click() - if(istype(usr.loc, /obj/mecha)) // stops inventory actions in a mech + if(ismecha(usr.loc)) // stops inventory actions in a mech return 1 var/mob/living/carbon/human/H = usr H.quick_equip() diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 94799437868..5e2260bee2c 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -110,7 +110,7 @@ if(usr.incapacitated()) return 1 - if(istype(usr.loc, /obj/mecha)) // stops inventory actions in a mech + if(ismecha(usr.loc)) // stops inventory actions in a mech return 1 if(hud && hud.mymob && slot_id) @@ -167,7 +167,7 @@ return 1 if(usr.incapacitated() || isobserver(usr)) return 1 - if (istype(usr.loc, /obj/mecha)) // stops inventory actions in a mech + if (ismecha(usr.loc)) // stops inventory actions in a mech return 1 if(hud.mymob.active_hand_index == held_index) @@ -350,7 +350,7 @@ return 1 if(usr.stat || usr.IsUnconscious() || usr.IsKnockdown() || usr.IsStun()) return 1 - if (istype(usr.loc, /obj/mecha)) // stops inventory actions in a mech + if (ismecha(usr.loc)) // stops inventory actions in a mech return 1 if(master) var/obj/item/I = usr.get_active_held_item() diff --git a/code/datums/weather/weather_types/ash_storm.dm b/code/datums/weather/weather_types/ash_storm.dm index 2c2212fde56..a1dc9ece69e 100644 --- a/code/datums/weather/weather_types/ash_storm.dm +++ b/code/datums/weather/weather_types/ash_storm.dm @@ -27,7 +27,7 @@ probability = 90 /datum/weather/ash_storm/proc/is_ash_immune(mob/living/L) - if(istype(L.loc, /obj/mecha)) //Mechs are immune + if(ismecha(L.loc)) //Mechs are immune return TRUE if(ishuman(L)) //Are you immune? var/mob/living/carbon/human/H = L diff --git a/code/game/gamemodes/clock_cult/clock_structures/ocular_warden.dm b/code/game/gamemodes/clock_cult/clock_structures/ocular_warden.dm index 0a7a1b53b05..cdff486eeaf 100644 --- a/code/game/gamemodes/clock_cult/clock_structures/ocular_warden.dm +++ b/code/game/gamemodes/clock_cult/clock_structures/ocular_warden.dm @@ -75,7 +75,7 @@ if(GLOB.ratvar_awakens && L) L.adjust_fire_stacks(damage_per_tick) L.IgniteMob() - else if(istype(target, /obj/mecha)) + else if(ismecha(target)) var/obj/mecha/M = target M.take_damage(damage_per_tick * get_efficiency_mod(), BURN, "melee", 1, get_dir(src, M)) @@ -90,7 +90,7 @@ if(isliving(target)) var/mob/living/L = target to_chat(L, "\"I SEE YOU!\"\n[src]'s gaze [GLOB.ratvar_awakens ? "melts you alive" : "burns you"]!") - else if(istype(target, /obj/mecha)) + else if(ismecha(target)) var/obj/mecha/M = target to_chat(M.occupant, "\"I SEE YOU!\"" ) else if(prob(0.5)) //Extremely low chance because of how fast the subsystem it uses processes diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 25bbe1bc1da..883cc3986f1 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -83,7 +83,7 @@ bumpopen(M) return - if(istype(AM, /obj/mecha)) + if(ismecha(AM)) var/obj/mecha/mecha = AM if(density) if(mecha.occupant) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index f76412199c4..4809f3ff49f 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -62,7 +62,7 @@ if( operating || !src.density ) return if (!( ismob(AM) )) - if(istype(AM, /obj/mecha)) + if(ismecha(AM)) var/obj/mecha/mecha = AM if(mecha.occupant && src.allowed(mecha.occupant)) open_and_close() diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm index 17f573fe6d4..9acd4730d87 100644 --- a/code/game/machinery/mass_driver.dm +++ b/code/game/machinery/mass_driver.dm @@ -20,7 +20,7 @@ var/O_limit var/atom/target = get_edge_target_turf(src, dir) for(var/atom/movable/O in loc) - if(!O.anchored || istype(O, /obj/mecha)) //Mechs need their launch platforms. + if(!O.anchored || ismecha(O)) //Mechs need their launch platforms. O_limit++ if(O_limit >= 20) audible_message("[src] lets out a screech, it doesn't seem to be able to handle the load.") diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index e9f0f76bc90..8f8202fe199 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -390,7 +390,7 @@ if(!in_faction(C)) targets += C - if(istype(A, /obj/mecha)) + if(ismecha(A)) var/obj/mecha/M = A //If there is a user and they're not in our faction if(M.occupant && !in_faction(M.occupant)) diff --git a/code/game/mecha/mecha_control_console.dm b/code/game/mecha/mecha_control_console.dm index 5b9aa28174c..431768500e6 100644 --- a/code/game/mecha/mecha_control_console.dm +++ b/code/game/mecha/mecha_control_console.dm @@ -92,15 +92,15 @@ qdel(src) /obj/item/mecha_parts/mecha_tracking/Destroy() - if(istype(loc, /obj/mecha)) + if(ismecha(loc)) var/obj/mecha/M = loc if(src in M.trackers) M.trackers -= src return ..() /obj/item/mecha_parts/mecha_tracking/proc/in_mecha() - if(istype(src.loc, /obj/mecha)) - return src.loc + if(ismecha(loc)) + return loc return 0 /obj/item/mecha_parts/mecha_tracking/proc/shock() @@ -110,7 +110,7 @@ qdel(src) /obj/item/mecha_parts/mecha_tracking/proc/get_mecha_log() - if(!istype(loc, /obj/mecha)) + if(!ismecha(loc)) return 0 var/obj/mecha/M = src.loc return M.get_log_html() diff --git a/code/game/objects/effects/portals.dm b/code/game/objects/effects/portals.dm index f4155cfc926..2aa78601d4d 100644 --- a/code/game/objects/effects/portals.dm +++ b/code/game/objects/effects/portals.dm @@ -125,7 +125,7 @@ return ..() /obj/effect/portal/proc/teleport(atom/movable/M) - if(!istype(M) || istype(M, /obj/effect) || (istype(M, /obj/mecha) && !mech_sized) || (!isobj(M) && !ismob(M))) //Things that shouldn't teleport. + if(!istype(M) || istype(M, /obj/effect) || (ismecha(M) && !mech_sized) || (!isobj(M) && !ismob(M))) //Things that shouldn't teleport. return var/turf/real_target = get_link_target_turf() if(!istype(real_target)) diff --git a/code/game/objects/items/storage/storage.dm b/code/game/objects/items/storage/storage.dm index 470f3837f56..b42a8fb8135 100644 --- a/code/game/objects/items/storage/storage.dm +++ b/code/game/objects/items/storage/storage.dm @@ -34,7 +34,7 @@ if(!over_object) return - if (istype(usr.loc, /obj/mecha)) // stops inventory actions in a mech + if (ismecha(M.loc)) // stops inventory actions in a mech return // this must come before the screen objects only block, dunno why it wasn't before diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index fcd78f44f8c..c767dd1c68a 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -74,7 +74,7 @@ SwitchState() else SwitchState() - else if(istype(user, /obj/mecha)) + else if(ismecha(user)) SwitchState() /obj/structure/mineral_door/proc/SwitchState() diff --git a/code/game/objects/structures/plasticflaps.dm b/code/game/objects/structures/plasticflaps.dm index aa9e8364c41..16e77c11410 100644 --- a/code/game/objects/structures/plasticflaps.dm +++ b/code/game/objects/structures/plasticflaps.dm @@ -76,7 +76,7 @@ if(C.move_delay) return 0 - if(istype(A, /obj/mecha)) + if(ismecha(A)) return 0 diff --git a/code/game/turfs/simulated/minerals.dm b/code/game/turfs/simulated/minerals.dm index 630ded7daa0..a597022448e 100644 --- a/code/game/turfs/simulated/minerals.dm +++ b/code/game/turfs/simulated/minerals.dm @@ -111,12 +111,6 @@ if(istype(R.module_active, /obj/item/pickaxe)) src.attackby(R.module_active,R) return -/* else if(istype(AM, /obj/mecha)) - var/obj/mecha/M = AM - if(istype(M.selected, /obj/item/mecha_parts/mecha_equipment/drill)) - src.attackby(M.selected,M) - return*/ -//Aparantly mechs are just TOO COOL to call Collide()) else return diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 9d8b25cebfd..237714eb8ec 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -48,7 +48,7 @@ if(pockets && over_object == M) return pockets.MouseDrop(over_object) - if(istype(usr.loc, /obj/mecha)) // stops inventory actions in a mech + if(ismecha(M.loc)) // stops inventory actions in a mech return if(!M.incapacitated() && loc == M && istype(over_object, /obj/screen/inventory/hand)) diff --git a/code/modules/events/wormholes.dm b/code/modules/events/wormholes.dm index 6404307d34c..00b4ce4e988 100644 --- a/code/modules/events/wormholes.dm +++ b/code/modules/events/wormholes.dm @@ -58,7 +58,7 @@ if(istype(M, /obj/effect)) //sparks don't teleport return if(M.anchored) - if(!(istype(M, /obj/mecha) && mech_sized)) + if(!(ismecha(M) && mech_sized)) return if(ismovableatom(M)) diff --git a/code/modules/mining/equipment/wormhole_jaunter.dm b/code/modules/mining/equipment/wormhole_jaunter.dm index e0197cc4e3c..d72d0e5f73c 100644 --- a/code/modules/mining/equipment/wormhole_jaunter.dm +++ b/code/modules/mining/equipment/wormhole_jaunter.dm @@ -94,7 +94,7 @@ if(!ismob(M) && !isobj(M)) //No don't teleport lighting and effects! return - if(M.anchored && (!ismob(M) || (istype(M, /obj/mecha) && !mech_sized))) + if(M.anchored && (!ismob(M) || (ismecha(M) && !mech_sized))) return if(do_teleport(M, hard_target, 6)) diff --git a/code/modules/mining/lavaland/necropolis_chests.dm b/code/modules/mining/lavaland/necropolis_chests.dm index 58c971024f2..e16077fec1a 100644 --- a/code/modules/mining/lavaland/necropolis_chests.dm +++ b/code/modules/mining/lavaland/necropolis_chests.dm @@ -435,7 +435,7 @@ if(!over_object) return - if (istype(usr.loc, /obj/mecha)) + if(ismecha(usr.loc)) return if(!M.incapacitated()) diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index a1b67fbee18..282de04ede3 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -29,7 +29,7 @@ dizziness = 0 jitteriness = 0 - if(istype(loc, /obj/mecha)) + if(ismecha(loc)) var/obj/mecha/M = loc if(M.occupant == src) M.go_out() diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 7898bb3eda5..ca63c50cc31 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -162,7 +162,7 @@ return chosen_target // Please do not add one-off mob AIs here, but override this function for your mob -/mob/living/simple_animal/hostile/CanAttack(atom/the_target)//Can we actually attack a possible target? +/mob/living/simple_animal/hostile/CanAttack(atom/the_target)//Can we actually attack a possible target? if(isturf(the_target) || !the_target || the_target.type == /atom/movable/lighting_object) // bail out on invalids return FALSE @@ -184,7 +184,7 @@ return FALSE return TRUE - if(istype(the_target, /obj/mecha)) + if(ismecha(the_target)) var/obj/mecha/M = the_target if(M.occupant)//Just so we don't attack empty mechs if(CanAttack(M.occupant)) diff --git a/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm b/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm index b84f3c8682e..378b5d9b8ea 100644 --- a/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm +++ b/code/modules/mob/living/simple_animal/hostile/mecha_pilot.dm @@ -184,7 +184,7 @@ mecha_face_target(target) target.mech_melee_attack(mecha) else - if(istype(target, /obj/mecha)) + if(ismecha(target)) var/obj/mecha/M = target if(is_valid_mecha(M)) enter_mecha(M) @@ -259,7 +259,7 @@ //Yes they actually try and pull this shit //~simple animals~ /mob/living/simple_animal/hostile/syndicate/mecha_pilot/CanAttack(atom/the_target) - if(istype(the_target, /obj/mecha)) + if(ismecha(the_target)) var/obj/mecha/M = the_target if(mecha) if(M == mecha || !CanAttack(M.occupant)) diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm index 248d0a60b08..57df489d4ef 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm @@ -8,7 +8,7 @@ return L else enemies -= L - else if(istype(A, /obj/mecha)) + else if(ismecha(A)) var/obj/mecha/M = A if(M.occupant) return A @@ -30,7 +30,7 @@ var/mob/living/M = A if(faction_check_mob(M) && attack_same || !faction_check_mob(M)) enemies |= M - else if(istype(A, /obj/mecha)) + else if(ismecha(A)) var/obj/mecha/M = A if(M.occupant) enemies |= M diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 3c329682f65..c2a27ec7613 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -312,7 +312,7 @@ var/mob/living/L = the_target if(L.stat != CONSCIOUS) return 0 - if (istype(the_target, /obj/mecha)) + if (ismecha(the_target)) var/obj/mecha/M = the_target if (M.occupant) return 0 diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 372e2b4290e..64cb4b5af5a 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -385,7 +385,7 @@ set category = "Object" set src = usr - if(istype(loc, /obj/mecha)) + if(ismecha(loc)) return if(incapacitated()) diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index c64cb4f4ef7..3d87de4e620 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -278,7 +278,7 @@ //dist_check - set to only shock mobs within 1 of source (vendors, airlocks, etc.) //No animations will be performed by this proc. /proc/electrocute_mob(mob/living/carbon/M, power_source, obj/source, siemens_coeff = 1, dist_check = FALSE) - if(istype(M.loc, /obj/mecha)) + if(ismecha(M.loc)) return 0 //feckin mechs are dumb if(dist_check) if(!in_range(source,M)) diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm index 32967e25374..f2610f97b0e 100644 --- a/code/modules/power/singularity/containment_field.dm +++ b/code/modules/power/singularity/containment_field.dm @@ -58,7 +58,7 @@ if(isliving(mover)) shock(mover) - if(istype(mover, /obj/machinery) || isstructure(mover) || istype(mover, /obj/mecha)) + if(istype(mover, /obj/machinery) || isstructure(mover) || ismecha(mover)) bump_field(mover) /obj/machinery/field/containment/proc/set_master(master1,master2) @@ -90,13 +90,13 @@ if(isliving(mover)) shock(mover) return - if(istype(mover, /obj/machinery) || isstructure(mover) || istype(mover, /obj/mecha)) + if(istype(mover, /obj/machinery) || isstructure(mover) || ismecha(mover)) bump_field(mover) return /obj/machinery/field/CanPass(atom/movable/mover, turf/target) - if(hasShocked || isliving(mover) || istype(mover, /obj/machinery) || isstructure(mover) || istype(mover, /obj/mecha)) + if(hasShocked || isliving(mover) || istype(mover, /obj/machinery) || isstructure(mover) || ismecha(mover)) return FALSE return ..() diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 84db5832829..3aba80fe646 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -144,7 +144,7 @@ ignore_source_check = TRUE return FALSE if(firer && !ignore_source_check) - if(A == firer || (A == firer.loc && istype(A, /obj/mecha))) //cannot shoot yourself or your mech + if(A == firer || (A == firer.loc && ismecha(A))) //cannot shoot yourself or your mech loc = A.loc return FALSE diff --git a/code/modules/projectiles/projectile/special.dm b/code/modules/projectiles/projectile/special.dm index 79a3d51eece..a5ba7c15a4b 100644 --- a/code/modules/projectiles/projectile/special.dm +++ b/code/modules/projectiles/projectile/special.dm @@ -45,7 +45,7 @@ ..() explosion(target, -1, 1, 3, 1, 0, flame_range = 4) - if(istype(target, /obj/mecha)) + if(ismecha(target)) var/obj/mecha/M = target M.take_damage(anti_armour_damage) if(issilicon(target))