From b5802fb1854ccaa26ec13967b961e986931b337f Mon Sep 17 00:00:00 2001 From: Neerti Date: Thu, 1 Jun 2017 15:05:51 -0400 Subject: [PATCH] Makes Mechs Fall Mechs now will fall when crossing an open tile. Anything below that tile will have a bad day. Also makes lighting overlays unable to fall just incase. --- code/modules/multiz/movement.dm | 50 +++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/code/modules/multiz/movement.dm b/code/modules/multiz/movement.dm index 122e1aa4cd..b54fc3efc1 100644 --- a/code/modules/multiz/movement.dm +++ b/code/modules/multiz/movement.dm @@ -23,12 +23,12 @@ if(!istype(start)) to_chat(src, "You are unable to move from here.") return 0 - + var/turf/destination = (direction == UP) ? GetAbove(src) : GetBelow(src) if(!destination) to_chat(src, "There is nothing of interest in this direction.") return 0 - + if(!start.CanZPass(src, direction)) to_chat(src, "\The [start] is in the way.") return 0 @@ -154,6 +154,28 @@ /obj/effect/decal/cleanable/can_fall() return TRUE +// These didn't fall anyways but better to nip this now just incase. +/atom/movable/lighting_overlay/can_fall() + return FALSE + +// Mechas are anchored, so we need to override. +/obj/mecha/can_fall() + var/obj/structure/lattice/lattice = locate(/obj/structure/lattice, loc) + if(lattice) + var/area/area = get_area(src) + if(area.has_gravity()) + // Lattices seem a bit too flimsy to hold up a massive exosuit. + lattice.visible_message("\The [lattice] collapses under the weight of \the [src]!") + qdel(lattice) + + // See if something prevents us from falling. + var/turf/below = GetBelow(src) + for(var/atom/A in below) + if(!A.CanPass(src, src.loc)) + return FALSE + + return TRUE + /obj/item/pipe/can_fall() var/turf/simulated/open/below = loc below = below.below @@ -195,4 +217,26 @@ apply_damage(rand(0, damage), BRUTE, BP_L_ARM) apply_damage(rand(0, damage), BRUTE, BP_R_ARM) Weaken(4) - updatehealth() \ No newline at end of file + updatehealth() + +/obj/mecha/handle_fall(var/turf/landing) + if(..()) + return + + // Tell the pilot that they just dropped down with a superheavy mecha. + if(occupant) + to_chat(occupant, "\The [src] crashed down onto \the [landing]!") + + // Anything on the same tile as the landing tile is gonna have a bad day. + for(var/mob/living/L in landing.contents) + L.visible_message("\The [src] crushes \the [L] as it lands on them!") + L.adjustBruteLoss(rand(70, 100)) + L.Weaken(8) + + // Now to hurt the mech. + take_damage(rand(15, 30)) + + // And hurt the floor. + if(istype(landing, /turf/simulated/floor)) + var/turf/simulated/floor/ground = landing + ground.break_tile() \ No newline at end of file