[MIRROR] Make the bodyscanner show an outline of the actual occupant (#11276)

Co-authored-by: ShadowLarkens <shadowlarkens@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-07-31 07:09:19 -07:00
committed by GitHub
parent 8b7c80605d
commit 225b3a2e04
2 changed files with 58 additions and 22 deletions

View File

@@ -29,31 +29,67 @@
return incoming
/obj/machinery/bodyscanner/update_icon()
cut_overlays()
if(!occupant)
icon_state = "scanner_open"
set_light(0)
return
// base image
icon_state = "new_scanner_off"
// Determine gradient state
var/state
var/scan = TRUE
var/h_ratio = occupant.health / occupant.getMaxHealth()
if(console)
console.update_icon(h_ratio)
if(stat & (NOPOWER|BROKEN))
icon_state = "scanner_off"
state = "gradient_gray"
scan = FALSE
set_light(0)
else
var/h_ratio
if(occupant)
h_ratio = occupant.health / occupant.getMaxHealth()
switch(h_ratio)
if(1.000)
icon_state = "scanner_green"
set_light(l_range = 1.5, l_power = 2, l_color = COLOR_LIME)
if(0.001 to 0.999)
icon_state = "scanner_yellow"
set_light(l_range = 1.5, l_power = 2, l_color = COLOR_YELLOW)
if(-0.999 to 0.000)
icon_state = "scanner_red"
set_light(l_range = 1.5, l_power = 2, l_color = COLOR_RED)
else
icon_state = "scanner_death"
set_light(l_range = 1.5, l_power = 2, l_color = COLOR_RED)
else
icon_state = "scanner_open"
set_light(0)
if(console)
console.update_icon(h_ratio)
switch(h_ratio)
if(1.000)
state = "gradient_green"
set_light(l_range = 1.5, l_power = 2, l_color = COLOR_LIME)
if(0.001 to 0.999)
state = "gradient_yellow"
set_light(l_range = 1.5, l_power = 2, l_color = COLOR_YELLOW)
else
state = "gradient_red"
set_light(l_range = 1.5, l_power = 2, l_color = COLOR_RED)
// First, we render the occupant
var/image/occ = image(occupant)
occ.dir = SOUTH
var/matrix/M = matrix()
M.Turn(dir == EAST ? 90 : -90)
occ.transform = M
occ.plane = plane
occ.layer = layer + 0.1
occ.filters = list(
filter("type" = "alpha", "icon" = icon(icon, "alpha_mask", dir = dir == EAST ? EAST : WEST)),
filter("type" = "color", "color" = "#000000")
)
add_overlay(occ)
if(scan)
// Second, we render the scan beam
var/image/scan_beam = image(icon(icon, "scan_beam"))
scan_beam.plane = plane
scan_beam.layer = layer + 0.2
add_overlay(scan_beam)
if(state)
// Third, we tint everything
var/image/gradient = image(icon(icon, state))
gradient.plane = plane
gradient.layer = layer + 0.3
add_overlay(gradient)
/obj/machinery/body_scanconsole/update_icon(var/h_ratio)
if(stat & (NOPOWER|BROKEN))