mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-22 15:16:33 +01:00
requires #6644 Entirely replaces how (most) belts perform insertion checks. This pretty much allows belts to hold most things. Armor vests are next. Trashbags will also use the systems we use on main. Closes #7256 and #7435 --------- Co-authored-by: silicons <silicons@silicons.dev>
77 lines
2.1 KiB
Plaintext
77 lines
2.1 KiB
Plaintext
/obj/item/uv_light
|
|
name = "\improper UV light"
|
|
desc = "A small handheld black light."
|
|
icon = 'icons/obj/device.dmi'
|
|
icon_state = "uv_off"
|
|
slot_flags = SLOT_BELT
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
item_state = "electronic"
|
|
item_action_name = "Toggle UV light"
|
|
materials_base = list(MAT_STEEL = 150)
|
|
origin_tech = list(TECH_MAGNET = 1, TECH_ENGINEERING = 1)
|
|
suit_storage_class = SUIT_STORAGE_CLASS_SOFTWEAR | SUIT_STORAGE_CLASS_HARDWEAR
|
|
belt_storage_class = BELT_CLASS_SMALL
|
|
|
|
var/list/scanned = list()
|
|
var/list/stored_alpha = list()
|
|
var/list/reset_objects = list()
|
|
|
|
var/range = 3
|
|
var/on = 0
|
|
var/step_alpha = 50
|
|
|
|
/obj/item/uv_light/attack_self(mob/user, datum/event_args/actor/actor)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
on = !on
|
|
if(on)
|
|
set_light(range, 2, "#007fff")
|
|
START_PROCESSING(SSobj, src)
|
|
icon_state = "uv_on"
|
|
else
|
|
set_light(0)
|
|
clear_last_scan()
|
|
STOP_PROCESSING(SSobj, src)
|
|
icon_state = "uv_off"
|
|
|
|
/obj/item/uv_light/proc/clear_last_scan()
|
|
if(scanned.len)
|
|
for(var/atom/O in scanned)
|
|
O.invisibility = scanned[O]
|
|
if(O.fluorescent == 2) O.fluorescent = 1
|
|
scanned.Cut()
|
|
if(stored_alpha.len)
|
|
for(var/atom/O in stored_alpha)
|
|
O.alpha = stored_alpha[O]
|
|
if(O.fluorescent == 2) O.fluorescent = 1
|
|
stored_alpha.Cut()
|
|
if(reset_objects.len)
|
|
for(var/obj/item/I in reset_objects)
|
|
I.cut_overlay(I.blood_overlay)
|
|
if(I.fluorescent == 2) I.fluorescent = 1
|
|
reset_objects.Cut()
|
|
|
|
/obj/item/uv_light/process(delta_time)
|
|
clear_last_scan()
|
|
if(on)
|
|
step_alpha = round(255/range)
|
|
var/turf/origin = get_turf(src)
|
|
if(!origin)
|
|
return
|
|
for(var/turf/T in range(range, origin))
|
|
var/use_alpha = 255 - (step_alpha * get_dist(origin, T))
|
|
for(var/atom/A in T.contents)
|
|
if(A.fluorescent == 1)
|
|
A.fluorescent = 2 //To prevent light crosstalk.
|
|
if(A.invisibility)
|
|
scanned[A] = A.invisibility
|
|
A.invisibility = 0
|
|
stored_alpha[A] = A.alpha
|
|
A.alpha = use_alpha
|
|
if(istype(A, /obj/item))
|
|
var/obj/item/O = A
|
|
if(O.was_bloodied && !(O.blood_overlay in O.overlays))
|
|
O.add_overlay(O.blood_overlay)
|
|
reset_objects |= O
|