Files
GS13NG/code/modules/clothing/glasses/engine_goggles.dm
T
CitadelStationBotandPoojawa 7c8c8f3a0a [MIRROR] Engie goggles in Meson mode now respect light levels (#6028)
* Engie goggles in Meson mode now respect light levels (#36504)

* Engie goggles in Meson mode now respect light levels

Meson glasses show the surrounding terrain, but darken areas beyond line of sight and that are not lit. Engineer goggles set to Meson mode currently show all terrain at max brightness. As a result, it can be hard to even know an area is unlit until objects (or mobs) suddenly start popping in one tile away.

This change makes the Engineer goggles respect light levels like Meson glasses do.

An image for visual aid;
https://i.imgur.com/KdYmkZb.png
Left shows the current Engineer goggles. Right shows the current Meson glasses, and how the Engineer goggles will look with this change.

* Update engine_goggles.dm

* Engie goggles in Meson mode now respect light levels
2018-03-19 21:44:30 -05:00

128 lines
3.8 KiB
Plaintext

//Engineering Mesons
#define MODE_NONE ""
#define MODE_MESON "meson"
#define MODE_TRAY "t-ray"
#define MODE_RAD "radiation"
/obj/item/clothing/glasses/meson/engine
name = "engineering scanner goggles"
desc = "Goggles used by engineers. The Meson Scanner mode lets you see basic structural and terrain layouts through walls, the T-ray Scanner mode lets you see underfloor objects such as cables and pipes, and the Radiation Scanner mode let's you see objects contaminated by radiation."
icon_state = "trayson-meson"
item_state = "trayson-meson"
actions_types = list(/datum/action/item_action/toggle_mode)
vision_flags = NONE
darkness_view = 2
invis_view = SEE_INVISIBLE_LIVING
var/list/modes = list(MODE_NONE = MODE_MESON, MODE_MESON = MODE_TRAY, MODE_TRAY = MODE_RAD, MODE_RAD = MODE_NONE)
var/mode = MODE_NONE
var/range = 1
/obj/item/clothing/glasses/meson/engine/Initialize()
. = ..()
START_PROCESSING(SSobj, src)
update_icon()
/obj/item/clothing/glasses/meson/engine/Destroy()
STOP_PROCESSING(SSobj, src)
return ..()
/obj/item/clothing/glasses/meson/engine/proc/toggle_mode(mob/user, voluntary)
mode = modes[mode]
to_chat(user, "<span class='[voluntary ? "notice":"warning"]'>[voluntary ? "You turn the goggles":"The goggles turn"] [mode ? "to [mode] mode":"off"][voluntary ? ".":"!"]</span>")
switch(mode)
if(MODE_MESON)
vision_flags = SEE_TURFS
darkness_view = 1
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE
if(MODE_TRAY) //undoes the last mode, meson
vision_flags = NONE
darkness_view = 2
lighting_alpha = null
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.glasses == src)
H.update_sight()
update_icon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/clothing/glasses/meson/engine/attack_self(mob/user)
toggle_mode(user, TRUE)
/obj/item/clothing/glasses/meson/engine/process()
if(mode == MODE_MESON)
var/turf/T = get_turf(src)
if(T && is_mining_level(T.z))
toggle_mode(loc)
return
if(!ishuman(loc))
return
var/mob/living/carbon/human/user = loc
if(user.glasses != src || !user.client)
return
if(mode == MODE_TRAY)
t_ray_scan(user, 8, range)
else if(mode == MODE_RAD)
show_rads()
/obj/item/clothing/glasses/meson/engine/proc/show_rads()
var/mob/living/carbon/human/user = loc
var/list/rad_places = list()
for(var/datum/component/radioactive/thing in SSradiation.processing)
var/atom/owner = thing.parent
var/turf/place = get_turf(owner)
if(rad_places[place])
rad_places[place] += thing.strength
else
rad_places[place] = thing.strength
for(var/i in rad_places)
var/turf/place = i
if(get_dist(user, place) >= range*2) //Rads are easier to see than wires under the floor
continue
var/strength = round(rad_places[i] / 1000, 0.1)
var/image/pic = new(loc = place)
var/mutable_appearance/MA = new()
MA.alpha = 128
MA.maptext = "[strength]k"
MA.color = "#64C864"
MA.layer = AREA_LAYER
pic.appearance = MA
flick_overlay(pic, list(user.client), 8)
/obj/item/clothing/glasses/meson/engine/update_icon()
icon_state = "trayson-[mode]"
update_mob()
/obj/item/clothing/glasses/meson/engine/proc/update_mob()
item_state = icon_state
if(isliving(loc))
var/mob/living/user = loc
if(user.get_item_by_slot(slot_glasses) == src)
user.update_inv_glasses()
else
user.update_inv_hands()
/obj/item/clothing/glasses/meson/engine/tray //atmos techs have lived far too long without tray goggles while those damned engineers get their dual-purpose gogles all to themselves
name = "optical t-ray scanner"
icon_state = "trayson-t-ray"
item_state = "trayson-t-ray"
desc = "Used by engineering staff to see underfloor objects such as cables and pipes."
range = 2
modes = list(MODE_NONE = MODE_TRAY, MODE_TRAY = MODE_NONE)
#undef MODE_NONE
#undef MODE_MESON
#undef MODE_TRAY
#undef MODE_RAD