Files
VMSolidus d190233527 Various Incomplete Destroy Fixes (#22788)
I've had extended logging for Incomplete Destroys for about 2 weeks now,
so there's the promised PR that fixes each and every single poisoned
destroy that was recorded in the past 2 weeks by the sentry logs.
2026-07-07 14:13:46 +00:00

111 lines
3.3 KiB
Plaintext

#define SENSOR_TIME_DELAY 0.2 SECONDS
/datum/overmap_contact
var/name = "Unknown" // Contact name.
var/image/marker // Image overlay attached to the contact.
var/pinged_until = 0 // Used to animate overmap effects.
var/list/images = list() // Our list of images to cast to users.
var/image/radar // Radar image for sonar esque effect
// The sensor console holding this data.
var/obj/structure/machinery/computer/ship/sensors/owner
// The actual overmap effect associated with this.
var/obj/effect/overmap/effect
/datum/overmap_contact/New(var/obj/structure/machinery/computer/ship/sensors/creator, var/obj/effect/overmap/source)
// Update local tracking information.
owner = creator
effect = source
name = effect.name
owner.contact_datums[effect] = src
marker = new(loc = effect)
update_marker_icon()
marker.alpha = 0 // Marker fades in on detection.
marker.appearance_flags |= RESET_TRANSFORM
images += marker
radar = image(loc = effect, icon = 'icons/obj/overmap/overmap_effects.dmi', icon_state = "sensor_range")
radar.color = source.color
radar.tag = "radar"
radar.add_filter("blur", 1, list("blur", size = 1))
/datum/overmap_contact/proc/update_marker_icon()
marker.appearance = effect
marker.appearance_flags |= RESET_TRANSFORM
// Pixel offsets are included in appearance but since this marker's loc
// is the effect, it's already offset and we don't want to double it.
marker.pixel_x = 0
marker.pixel_y = 0
marker.transform = effect.transform
marker.dir = effect.dir
marker.overlays.Cut()
/datum/overmap_contact/proc/ping_radar(var/range = 0)
radar.transform = null
radar.alpha = 255
if(range > 1)
images |= radar
var/matrix/M = matrix()
M.Scale(range*2.6)
animate(radar, transform = M, alpha = 0, time = (SENSOR_TIME_DELAY*range), 1, SINE_EASING)
else
images -= radar
/datum/overmap_contact/proc/show()
if(!owner)
return
var/list/showing = owner.linked?.navigation_viewers || owner.viewers
if(length(showing))
for(var/datum/weakref/W in showing)
var/mob/M = W.resolve()
if(istype(M) && M.client)
M.client.images |= images
/datum/overmap_contact/proc/ping(time_delay = 0)
if(pinged_until > world.time)
return
pinged_until = world.time + time_delay + 1 SECOND
effect.opacity = initial(effect.opacity)
show()
animate(marker, alpha=75, time_delay, 1, flags = ANIMATION_END_NOW)
animate(alpha=255, 1 SECOND, 1)
animate(alpha=75, 2 SECOND, 1)
/datum/overmap_contact/Destroy()
if(owner)
// If we have a lock on what was lost, remove the lock from the targeting consoles
if(owner.connected && owner.connected.targeting == effect)
for(var/obj/structure/machinery/computer/ship/targeting/console in owner.connected.consoles)
owner.connected.detarget(effect, console)
// Removes the client images from the client of the mobs that are looking at this contact
var/list/showing = owner.linked?.navigation_viewers || owner.viewers
if(length(showing))
for(var/datum/weakref/W in showing)
var/mob/M = W.resolve()
if(istype(M) && M.client)
M.client.images -= images
// Removes the effect from the contact datums of the owner, and null the owner
if(effect)
owner.contact_datums -= effect
owner = null
// Remove the effect opacity, effect, marker and radar
effect.opacity = 0
effect = null
marker = null
radar = null
QDEL_LIST(images)
. = ..()