Files
Paradise/code/modules/events/tear.dm
PollardTheDragon 05791861b7 New PVE Major Midround: Demonic Incursion (#29053)
* Initial commit. Event.

* Started converting mobs to basic mobs. Migo and Creature. Needs aggressiveness AI

* Makes CI happy

* Fixes some file names

* Ticks files

* Fixes file again

* Update code/modules/events/demon_incursion.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>

* Announcement sound, spawn adjustments

* Reduced spread when portals multiply

* Elite spawns when portal count gets high

* Fixes missing comma

* Converted migo, blank, and most of hellhounds to basic mobs. Added new controllers and behaviors

* Fixes

* Linters!

* Faithless moved to basic mob

* LINTERS

* Makes skeletons basic mobs

* Fixes, Ranged Attacks, Ranged variants of nether mobs

* Handles portal expansion chance

* Linters

* Fixes mobs not breaking shit

* Fixes ranged attacks

* Fixes ranged attacks

* oops

* Another oops. No config changes are needed here

* Twenty percent chance that a nether mob is a grappler

* Dimensional tear fixes

* Adjusts awaken distance for hostile mobs, makes variable melee attack rate for basic mobs

* Variable initial spawns, variable spread rates.

* Whole lot of fixes from merge, hellhound completion

* Updated lavaland winter biodome

* Makes basic mobs able to hurt other mobs

* Makes spawners properly rally basic mobs to beat up the attacker

* Extra line

* Removed comment

* Makes hellhounds stop resting when attacked or when they find a new target

* Fixed initial portal spawn amounts

* Borgs now affected by basic mobs

* Nerfs portal spawn rate, nerfs portal integrity, nerfs portal max mobs

* Grapplers now teleport to missed turfs

* Removes duplicate notices

* Buff portals a small bit

* Makes nether portals no longer RR - the body is now recoverable from the blank it became

* Makes portals layer above mobs

* Removed excess ranged attack var

* Changes list for determining start count to rely on mobs with client instead of all clients

* Nerfs portal max mobs

* Portals can no longer spread to within 3 tiles of another portal except on initial event start

* Adjusts target portal count for big mobs

* Spawners now properly remove nest values of basic mobs

* Portals now glow an evil red. When portals are destroyed, 50% chance per mob to slay the mob

* add prowling and return to home behaviors

* cut this down

* be a tiny bit smarter

* Some code cleanup

* Removes hostile base type, removing excess code

* Gives /obj/ a basic mob attack handler. Fixes turrets

* Gives basic mobs a HUD

* Fixes skeleton death flag

* Adjusted initial spawns

* Incursion portals now slowly convert turfs, up to range 3 of them, to hellish flooring

* Increases reward per destroyed portal

* Makes the final portal of an incursion play a sound on destruction, couple portal fixes

* Fixes basic mob xenobiology interactions

* Non-shit portal sprites

* Adds hostile machine element, mobs now actively target turrets and emitters

* Properly gibs things when they should gib

* Linter fix

* Portals now layer under living mobs but over dead ones

* Adds blackbox checking for demon incursion portal counts

* Increases mob sight range slightly to account for widescreen, adds alt-color for grappler, delays incursion announcement a bit more

* Portals now are more likely to spread the less there are

* Incursion portals now repair themselves after not being damaged for some time

* Grilles now shock basic mobs

* Portals will now clean up basic mob corpses near them by gibbing them

* Portal spread chance is now exponential regression

* Portal mob spawns now linearly scale in time

* Fixes some skeleton oversights in ruin mapping

* Demon incursions no longer can spread to tiles in a space area, such as near brig plating

* Moves corpse cleanup to mobs via component

* Portals now drop bodies that are being eaten when they're destroyed.

* Addresses code review

* Docs some vars

---------

Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: warriorstar-orion <orion@snowfrost.garden>
2025-07-16 00:19:23 +00:00

129 lines
4.0 KiB
Plaintext

/**
* 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 = 14
var/notify_title = "Dimensional Rift"
var/notify_image = "hellhound"
var/obj/effect/tear/TE
/datum/event/tear/setup()
impact_area = findEventArea()
/datum/event/tear/start()
if(isnull(impact_area))
log_debug("No valid event areas could be generated for dimensional tear.")
var/list/area_turfs = get_area_turfs(impact_area)
while(length(area_turfs))
var/turf/T = pick_n_take(area_turfs)
if(T.is_blocked_turf())
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, flashwindow = FALSE, action = NOTIFY_FOLLOW)
addtimer(CALLBACK(src, PROC_REF(spawn_tear), T), 4 SECONDS)
// Energy overload; we mess with machines as an early warning and for extra spookiness.
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)
/datum/event/tear/announce(false_alarm)
var/area/target_area = impact_area
if(!target_area)
if(false_alarm)
target_area = findEventArea()
if(isnull(target_area))
log_debug("Tried to announce a false-alarm tear without a valid area!")
kill()
else
log_debug("Tried to announce a tear without a valid area!")
kill()
return
GLOB.minor_announcement.Announce("A tear in the fabric of space and time has opened. Expected location: [target_area.name].", "Anomaly Alert", 'sound/AI/anomaly.ogg')
/datum/event/tear/end()
if(TE)
qdel(TE)
/// 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."
icon = 'icons/effects/tear.dmi'
icon_state = "tear"
light_range = 3
// Huge sprite, we shift it to make it look more natural.
pixel_x = -106
pixel_y = -96
/// What the leader of the dimensional tear will be
var/leader = /mob/living/basic/hellhound/tear
var/spawn_max = 0
var/spawn_total = 0
var/list/possible_mobs = list(
/mob/living/basic/hellhound,
/mob/living/basic/skeleton,
/mob/living/basic/netherworld/,
/mob/living/basic/netherworld/migo,
/mob/living/basic/netherworld/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 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()
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()
if(!leader)
return
var/mob/M = new leader(get_turf(src))
M.faction = list("rift")
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>")