Skip to content

Commit

Permalink
Buff dimensional tears. (ParadiseSS13#21937)
Browse files Browse the repository at this point in the history
* Buff dimensional tears.

* Keep leaders. Pick random turf. Clean up implementation.

* Update code/modules/events/tear.dm

Co-authored-by: S34N <[email protected]>

* use log_debug

---------

Co-authored-by: S34N <[email protected]>
  • Loading branch information
warriorstar-orion and S34NW committed Aug 21, 2023
1 parent b5613d2 commit c203fe0
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 30 deletions.
69 changes: 46 additions & 23 deletions code/modules/events/tear.dm
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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)
Expand All @@ -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)

Expand All @@ -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."
Expand All @@ -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()
Expand All @@ -88,3 +95,19 @@
var/mob/M = new leader(get_turf(src))
playsound(M, 'sound/goonstation/voice/growl2.ogg', 100)
visible_message("<span class='danger'>With a terrifying growl, \a [M] steps out of the portal!</span>")

/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("<span class='danger'>[M] steps out of the portal!</span>")
12 changes: 5 additions & 7 deletions code/modules/events/tear_honk.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

0 comments on commit c203fe0

Please sign in to comment.