Files
Polaris/code/modules/detectivework/tools/uvlight.dm
Neerti 828dacf485 Centralizes weight class definitions
A lot of new defines are now in inventory_sizes.dm, which contains;
All the size identifiers (the thing that tells the game if something is bulky, or w/e).
Storage costs for all the sizes, which are exponents of two, as previously.
A few constants for inventory size.

Also changes all storage item's capacity definitions by basing it off of how many 'normal slots' exist for it.  This allows one to change the definition for all of the defines in the file, and everything will follow along without needing to change 500 files.  In testing, I made all ITEMSIZE_COST_* defines doubled, and nothing had broke.

The benefit of doing all of this is that it makes adding new weight classes in the future much simpler, and makes knowing how much space a container has easier, as seeing ITEMSIZE_COST_NORMAL * 7 means it can hold seven normal items.
2016-09-22 00:51:51 -04:00

70 lines
1.9 KiB
Plaintext

/obj/item/device/uv_light
name = "\improper UV light"
desc = "A small handheld black light."
icon_state = "uv_off"
slot_flags = SLOT_BELT
w_class = ITEMSIZE_SMALL
item_state = "electronic"
action_button_name = "Toggle UV light"
matter = list(DEFAULT_WALL_MATERIAL = 150)
origin_tech = list(TECH_MAGNET = 1, TECH_ENGINEERING = 1)
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/device/uv_light/attack_self(var/mob/user)
on = !on
if(on)
set_light(range, 2, "#007fff")
processing_objects |= src
icon_state = "uv_on"
else
set_light(0)
clear_last_scan()
processing_objects -= src
icon_state = "uv_off"
/obj/item/device/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.overlays -= I.blood_overlay
if(I.fluorescent == 2) I.fluorescent = 1
reset_objects.Cut()
/obj/item/device/uv_light/process()
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.overlays |= O.blood_overlay
reset_objects |= O