Files
Will 60202429a7 Customizable Announcer (#19387)
* starting work

* most generic

* more alerts

* remaining alerts

* many fixes

* fix

* properly set

* virgo doesn't use those lines?

* actually they are used

* smallfixes

* oops

* silence of the bots

* docs
2026-04-14 16:32:50 -04:00

118 lines
3.6 KiB
Plaintext

/obj/effect/anomaly/dimensional
name = "dimensional anomaly"
icon_state = "dimensional"
anomaly_core = /obj/item/assembly/signaler/anomaly/dimensional
lifespan = ANOMALY_COUNTDOWN_TIMER * 20
move_chance = 0
danger_mult = 0.8
/// Range of effect, if left alone anomaly will convert a 2(range)+1 squared area.
var/range = 3
/// List of turfs this anomaly will try to transform before relocating
var/list/turf/target_turfs = list()
/// Current anomaly 'theme', dictates what tiles to create.
var/datum/dimension_theme/theme
/// Effect displaying on the anomaly to represent the theme.
var/mutable_appearance/theme_icon
/// How many times we can still teleport. Delete self if it hits 0 and we try to teleport. If immortal, will simply stay where it is
var/teleports_left
/// Minimum teleports it will do before going away permanently
var/minimum_teleports = 1
/// Maximum teleports it will do before going away permanently
var/maximum_teleports = 4
/obj/effect/anomaly/dimensional/Initialize(mapload, new_lifespan, drops_core)
. = ..()
overlays += mutable_appearance('icons/effects/effects.dmi', "dimensional_overlay")
animate(src, transform = matrix()*0.85, time = 3, loop = -1)
animate(transform = matrix(), time = 3, loop = -1)
teleports_left = rand(minimum_teleports, maximum_teleports)
/obj/effect/anomaly/dimensional/Destroy()
theme = null
target_turfs = null
return ..()
/obj/effect/anomaly/dimensional/anomalyEffect(seconds_per_tick)
. = ..()
transmute_area()
/obj/effect/anomaly/dimensional/proc/transmute_area()
if(!theme)
prepare_area()
if(stats)
return
if(!target_turfs.len)
if(teleports_left <= 0 && !immortal)
detonate()
return
teleports_left--
relocate()
return
var/turf/affected_turf = target_turfs[1]
theme.apply_theme(affected_turf, show_effect = TRUE)
target_turfs -= affected_turf
/obj/effect/anomaly/dimensional/proc/prepare_area(new_theme_path)
if(!new_theme_path)
new_theme_path = pick(subtypesof(/datum/dimension_theme))
theme = new new_theme_path
apply_theme_icon()
target_turfs = list()
for(var/turf/turf in spiral_range_turfs(range, src))
if(theme.can_convert(turf))
target_turfs += turf
/obj/effect/anomaly/dimensional/proc/apply_theme_icon()
overlays -= theme_icon
theme_icon = mutable_appearance(theme.icon, theme.icon_state, FLOAT_LAYER -1, appearance_flags = appearance_flags | RESET_TRANSFORM)
theme_icon.blend_mode = BLEND_INSET_OVERLAY
overlays += theme_icon
/obj/effect/anomaly/dimensional/proc/relocate()
var/datum/anomaly_placer/placer = new()
var/area/new_area = placer.find_valid_area()
var/turf/new_turf = placer.find_valid_turf(new_area)
var/datum/announcement/priority/announcement = new/datum/announcement/priority()
announcement.Announce("Dimensional instability relocated. Expected location: [new_area.name].", "Anomaly Alert", ANNOUNCER_MSG_DIMENSIONAL_ANOM)
src.forceMove(new_turf)
prepare_area()
/obj/effect/anomaly/dimensional/detonate()
qdel(src)
/obj/effect/temp_visual/transmute_tile_flash
icon = 'icons/effects/effects.dmi'
icon_state = "shieldsparkles"
duration = 3
/obj/effect/anomaly/dimensional/anomalyPulse()
if(!..())
return
switch(stats.severity)
if(0 to 15)
var/datum/effect/effect/system/spark_spread/sparks = new /datum/effect/effect/system/spark_spread
sparks.set_up(3, 1, src)
sparks.start()
if(16 to 33)
pulse_change(2)
if(34 to 65)
pulse_change(4)
else
pulse_change(8)
/obj/effect/anomaly/dimensional/proc/pulse_change(count)
var/turf/turf
for(var/i in 1 to count)
turf = pick(target_turfs)
if(theme.can_convert(turf))
theme.apply_theme(turf, show_effect = TRUE)