From 2892a3710df9eb4814edd2822a0c85e786b02ab1 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Thu, 13 Jul 2017 08:38:07 -0500 Subject: [PATCH] [MIRROR] Adds collapsing stone tiles (#1933) * Adds collapsing stone tiles * Update necropolis_gate.dm * Update necropolis_gate.dm.rej * Delete necropolis_gate.dm.rej --- code/game/turfs/simulated/chasm.dm | 7 ++- .../turfs/simulated/floor/plating/lava.dm | 3 + .../ruins/objects_and_mobs/necropolis_gate.dm | 61 ++++++++++++++++++- 3 files changed, 69 insertions(+), 2 deletions(-) diff --git a/code/game/turfs/simulated/chasm.dm b/code/game/turfs/simulated/chasm.dm index 325644bce7..33083f582a 100644 --- a/code/game/turfs/simulated/chasm.dm +++ b/code/game/turfs/simulated/chasm.dm @@ -65,6 +65,9 @@ //if anything matching this typecache is found in the chasm, we don't drop things var/static/list/chasm_safeties_typecache = typecacheof(list(/obj/structure/lattice/catwalk, /obj/structure/stone_tile)) var/list/found_safeties = typecache_filter_list(contents, chasm_safeties_typecache) + for(var/obj/structure/stone_tile/S in found_safeties) + if(S.fallen) + LAZYREMOVE(found_safeties, S) return LAZYLEN(found_safeties) /turf/open/chasm/proc/drop_stuff(AM) @@ -89,6 +92,8 @@ if(istype(AM, /obj/effect/portal)) //Portals aren't affected by gravity. Probably. return FALSE + if(istype(AM, /obj/structure/stone_tile)) + return FALSE //Flies right over the chasm if(isliving(AM)) var/mob/M = AM @@ -204,4 +209,4 @@ /turf/open/chasm/straight_down/jungle icon = 'icons/turf/floors/junglechasm.dmi' planetary_atmos = TRUE - initial_gas_mix = LAVALAND_DEFAULT_ATMOS \ No newline at end of file + initial_gas_mix = LAVALAND_DEFAULT_ATMOS diff --git a/code/game/turfs/simulated/floor/plating/lava.dm b/code/game/turfs/simulated/floor/plating/lava.dm index 978bedac3b..ea2fd8d139 100644 --- a/code/game/turfs/simulated/floor/plating/lava.dm +++ b/code/game/turfs/simulated/floor/plating/lava.dm @@ -62,6 +62,9 @@ //if anything matching this typecache is found in the lava, we don't burn things var/static/list/lava_safeties_typecache = typecacheof(list(/obj/structure/lattice/catwalk, /obj/structure/stone_tile)) var/list/found_safeties = typecache_filter_list(contents, lava_safeties_typecache) + for(var/obj/structure/stone_tile/S in found_safeties) + if(S.fallen) + LAZYREMOVE(found_safeties, S) return LAZYLEN(found_safeties) diff --git a/code/modules/ruins/objects_and_mobs/necropolis_gate.dm b/code/modules/ruins/objects_and_mobs/necropolis_gate.dm index 932d7b06f2..cf21217601 100644 --- a/code/modules/ruins/objects_and_mobs/necropolis_gate.dm +++ b/code/modules/ruins/objects_and_mobs/necropolis_gate.dm @@ -226,6 +226,10 @@ GLOBAL_DATUM(necropolis_gate, /obj/structure/necropolis_gate/legion_gate) else return QDEL_HINT_LETMELIVE +#define STABLE 0 //The tile is stable and won't collapse/sink when crossed. +#define COLLAPSE_ON_CROSS 1 //The tile is unstable and will temporary become unusable when crossed. +#define DESTROY_ON_CROSS 2 //The tile is nearly broken and will permanently become unusable when crossed. +#define UNIQUE_EFFECT 3 //The tile has some sort of unique effect when crossed. //stone tiles for boss arenas /obj/structure/stone_tile name = "stone tile" @@ -236,17 +240,67 @@ GLOBAL_DATUM(necropolis_gate, /obj/structure/necropolis_gate/legion_gate) resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF var/tile_key = "pristine_tile" var/tile_random_sprite_max = 24 + var/fall_on_cross = STABLE //If the tile has some sort of effect when crossed + var/fallen = FALSE //If the tile is unusable + var/falling = FALSE //If the tile is falling /obj/structure/stone_tile/Initialize(mapload) . = ..() icon_state = "[tile_key][rand(1, tile_random_sprite_max)]" /obj/structure/stone_tile/Destroy(force) - if(force) + if(force || fallen) . = ..() else return QDEL_HINT_LETMELIVE +/obj/structure/stone_tile/Crossed(atom/movable/AM) + if(falling || fallen) + return + var/turf/T = get_turf(src) + if(!istype(T, /turf/open/floor/plating/lava) && !istype(T, /turf/open/chasm)) //nothing to sink or fall into + return + var/obj/item/I + if(istype(AM, /obj/item)) + I = AM + var/mob/living/L + if(isliving(AM)) + L = AM + switch(fall_on_cross) + if(COLLAPSE_ON_CROSS, DESTROY_ON_CROSS) + if((I && I.w_class >= WEIGHT_CLASS_BULKY) || (L && !(L.movement_type & FLYING) && L.mob_size >= MOB_SIZE_HUMAN)) //too heavy! too big! aaah! + collapse() + if(UNIQUE_EFFECT) + crossed_effect(AM) + +/obj/structure/stone_tile/proc/collapse() + falling = TRUE + var/break_that_sucker = fall_on_cross == DESTROY_ON_CROSS + playsound(src, 'sound/effects/pressureplate.ogg', 50, TRUE) + Shake(-1, -1, 25) + sleep(5) + if(break_that_sucker) + playsound(src, 'sound/effects/break_stone.ogg', 50, TRUE) + else + playsound(src, 'sound/mecha/mechmove04.ogg', 50, TRUE) + animate(src, alpha = 0, pixel_y = pixel_y - 3, time = 5) + fallen = TRUE + if(break_that_sucker) + QDEL_IN(src, 10) + else + addtimer(CALLBACK(src, .proc/rebuild), 55) + +/obj/structure/stone_tile/proc/rebuild() + pixel_x = initial(pixel_x) + pixel_y = initial(pixel_y) - 5 + animate(src, alpha = initial(alpha), pixel_x = initial(pixel_x), pixel_y = initial(pixel_y), time = 30) + sleep(30) + falling = FALSE + fallen = FALSE + +/obj/structure/stone_tile/proc/crossed_effect(atom/movable/AM) + return + /obj/structure/stone_tile/block name = "stone block" icon_state = "pristine_block1" @@ -340,3 +394,8 @@ GLOBAL_DATUM(necropolis_gate, /obj/structure/necropolis_gate/legion_gate) name = "burnt stone surrounding tile" icon_state = "burnt_surrounding_tile1" tile_key = "burnt_surrounding_tile" + +#undef STABLE +#undef COLLAPSE_ON_CROSS +#undef DESTROY_ON_CROSS +#undef UNIQUE_EFFECT