diff --git a/code/modules/events/tear.dm b/code/modules/events/tear.dm index 409e54239d86..e1428de6558a 100644 --- a/code/modules/events/tear.dm +++ b/code/modules/events/tear.dm @@ -1,14 +1,14 @@ -// Dimensional Tear - A rift appears randomly on the station, does the following: -// Flickers nearby machines as an early warning. -// After a few seconds, it breaks nearby computers and mirrors. -// A portal appears, then it spawns a few hostile mobs, and a leader one. -// Then the portal deletes itself. - -// Event setup +/** + * Dimensional tear event. + * + * On triggering, nearby machines and lights flicker. After a few seconds, + * nearby machines and lights break. A [/obj/effect/tear] appears, spawning up + * to 10 random hell mobs including a guaranteed tear hellhound, then disappears. + */ /datum/event/tear name = "dimensional tear" announceWhen = 6 - endWhen = 10 + endWhen = 14 var/notify_title = "Dimensional Rift" var/notify_image = "hellhound" @@ -18,8 +18,12 @@ impact_area = findEventArea() /datum/event/tear/start() - var/turf/T = pick(get_area_turfs(impact_area)) - if(T) + var/list/area_turfs = get_area_turfs(impact_area) + while(length(area_turfs)) + var/turf/T = pick_n_take(area_turfs) + if(is_blocked_turf(T)) + continue + // Give ghosts some time to jump there before it begins. var/image/alert_overlay = image('icons/mob/animal.dmi', notify_image) notify_ghosts("\A [src] is about to open in [get_area(T)].", title = notify_title, source = T, alert_overlay = alert_overlay, action = NOTIFY_FOLLOW) @@ -29,6 +33,10 @@ for(var/obj/machinery/M in range(8, T)) INVOKE_ASYNC(M, TYPE_PROC_REF(/atom, get_spooked)) + return + + log_debug("dimensional tear failed to find a valid turf in [impact_area]") + /datum/event/tear/proc/spawn_tear(location) TE = new /obj/effect/tear(location) @@ -39,7 +47,7 @@ if(TE) qdel(TE) -// The portal +/// The portal used in the [/datum/event/tear] midround. /obj/effect/tear name = "dimensional tear" desc = "A tear in the dimensional fabric of space and time." @@ -52,34 +60,33 @@ pixel_y = -96 /// What the leader of the dimensional tear will be var/leader = /mob/living/simple_animal/hostile/hellhound/tear + var/spawn_max = 0 + var/spawn_total = 0 var/list/possible_mobs = list( + /mob/living/simple_animal/hostile/hellhound, + /mob/living/simple_animal/hostile/skeleton, /mob/living/simple_animal/hostile/netherworld, /mob/living/simple_animal/hostile/netherworld/migo, /mob/living/simple_animal/hostile/faithless) /obj/effect/tear/Initialize(mapload) . = ..() + spawn_max = roll(6) + 3 + warn_environment() + addtimer(CALLBACK(src, PROC_REF(spawn_next_mob)), 2 SECONDS) + +/obj/effect/tear/proc/warn_environment() // Sound cue to warn people nearby. playsound(get_turf(src), 'sound/magic/drum_heartbeat.ogg', 100) - // We spawn the minions first, then the boss. - addtimer(CALLBACK(src, PROC_REF(spawn_mobs)), 2 SECONDS) - addtimer(CALLBACK(src, PROC_REF(spawn_leader)), 5 SECONDS) - -/obj/effect/tear/proc/spawn_mobs() // We break some of those flickering consoles from earlier. // Mirrors as well, for the extra bad luck. for(var/obj/machinery/computer/C in range(6, src)) C.obj_break() for(var/obj/structure/mirror/M in range(6, src)) M.obj_break() - - // Spawning mobs. - for(var/i in 1 to 5) - var/chosen_mob = pick(possible_mobs) - var/mob/M = new chosen_mob(loc) - M.faction = list("rift") - step(M, pick(GLOB.cardinal)) + for(var/obj/machinery/light/L in range(4, src)) + L.break_light_tube() // We spawn a leader mob to make the portal actually dangerous. /obj/effect/tear/proc/spawn_leader() @@ -88,3 +95,19 @@ var/mob/M = new leader(get_turf(src)) playsound(M, 'sound/goonstation/voice/growl2.ogg', 100) visible_message("With a terrifying growl, \a [M] steps out of the portal!") + +/obj/effect/tear/proc/spawn_next_mob() + spawn_total++ + + if(spawn_total < spawn_max) + make_mob(pick(possible_mobs)) + addtimer(CALLBACK(src, PROC_REF(spawn_next_mob)), 2 SECONDS) + else + spawn_leader() + +/obj/effect/tear/proc/make_mob(mob_type) + var/mob/M = new mob_type(get_turf(src)) + M.faction = list("rift") + step(M, pick(GLOB.cardinal)) + if(prob(30)) + visible_message("[M] steps out of the portal!") diff --git a/code/modules/events/tear_honk.dm b/code/modules/events/tear_honk.dm index f6c374d3115a..b6d402412209 100644 --- a/code/modules/events/tear_honk.dm +++ b/code/modules/events/tear_honk.dm @@ -17,10 +17,8 @@ /obj/effect/tear/honk name = "honkmensional tear" desc = "A tear in the dimensional fabric of sanity." - possible_mobs = list(/mob/living/simple_animal/hostile/retaliate/clown/goblin) - leader = null // Doesn't spawn with a leader always - -/obj/effect/tear/honk/Initialize(mapload) - . = ..() - if(prob(5)) - leader = /mob/living/simple_animal/hostile/retaliate/clown/goblin/cluwne + leader = /mob/living/simple_animal/hostile/retaliate/clown/goblin/cluwne + possible_mobs = list( + /mob/living/simple_animal/hostile/retaliate/clown, + /mob/living/simple_animal/hostile/retaliate/clown/goblin + )