Files
kiwistation/code/modules/clothing/glasses/engine_goggles.dm
T
phil235 0ec876d9fe Refactored the item's action system. Items can now hold multiple actions.
The "set internals" button of tank items now turn green when it's used as internals.
Removed research scanner from drones (since cyborgs don't have it, it's more consistent)
Removed the ignore_madkadjust mask var.
The sechailer mask now has an adjust mask action button, so I removed the adjust verb that it was using.
The item's action are now created on item/New() instead of trying to create it every time someone picks the item up.
I split hud/action.dm, the datum/action stuff is now in the datum folder (/datum/action.dm), whereas the code for action buttons is kept in the hud folder under action_button.dm. Also I moved some /datum/action code that was in some files back into datum/action.dm where it belongs.
2016-02-23 19:37:42 +01:00

135 lines
3.6 KiB
Plaintext

//Engineering Mesons
/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, regardless of lighting condition. The T-ray Scanner mode lets you see underfloor objects such as cables and pipes."
icon_state = "trayson-meson"
actions_types = list(/datum/action/item_action/toggle_mode)
var/mode = 0 //0 - regular mesons mode 1 - t-ray mode
var/invis_objects = list()
var/range = 1
/obj/item/clothing/glasses/meson/engine/attack_self(mob/user)
mode = !mode
if(mode)
SSobj.processing |= src
vision_flags = 0
darkness_view = 2
invis_view = SEE_INVISIBLE_LIVING
user << "<span class='notice'>You toggle the goggles' scanning mode to \[T-Ray].</span>"
else
SSobj.processing.Remove(src)
vision_flags = SEE_TURFS
darkness_view = 1
invis_view = SEE_INVISIBLE_MINIMUM
loc << "<span class='notice'>You toggle the goggles' scanning mode to \[Meson].</span>"
invis_update()
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/process()
if(!mode)
return
if(!istype(loc,/mob/living/carbon/human))
invis_update()
return
var/mob/living/carbon/human/user = loc
if(user.glasses != src)
invis_update()
return
scan()
/obj/item/clothing/glasses/meson/engine/proc/scan()
for(var/turf/T in range(range, loc))
if(!T.intact)
continue
for(var/obj/O in T.contents)
if(O.level != 1)
continue
if(O.invisibility == 101)
O.invisibility = 0
invis_objects += O
spawn(5)
invis_update()
/obj/item/clothing/glasses/meson/engine/proc/invis_update()
for(var/obj/O in invis_objects)
if(!t_ray_on() || !(O in range(range, loc)))
invis_objects -= O
var/turf/T = O.loc
if(T && T.intact)
O.invisibility = 101
/obj/item/clothing/glasses/meson/engine/proc/t_ray_on()
if(!istype(loc,/mob/living/carbon/human))
return 0
var/mob/living/carbon/human/user = loc
return mode & (user.glasses == src)
/obj/item/clothing/glasses/meson/engine/update_icon()
icon_state = mode ? "trayson-tray" : "trayson-meson"
if(istype(loc,/mob/living/carbon/human/))
var/mob/living/carbon/human/user = loc
if(user.glasses == src)
user.update_inv_glasses()
/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"
desc = "Used by engineering staff to see underfloor objects such as cables and pipes."
icon_state = "trayson-tray_off"
mode = 1
var/on = 0
vision_flags = 0
darkness_view = 2
invis_view = SEE_INVISIBLE_LIVING
range = 2
/obj/item/clothing/glasses/meson/engine/tray/process()
if(!on)
return
..()
/obj/item/clothing/glasses/meson/engine/tray/update_icon()
icon_state = "trayson-tray[on ? "" : "_off"]"
if(istype(loc,/mob/living/carbon/human/))
var/mob/living/carbon/human/user = loc
if(user.glasses == src)
user.update_inv_glasses()
/obj/item/clothing/glasses/meson/engine/tray/attack_self(mob/user)
on = !on
if(on)
SSobj.processing |= src
user << "<span class='notice'>You turn the goggles on.</span>"
else
SSobj.processing.Remove(src)
user << "<span class='notice'>You turn the goggles off.</span>"
invis_update()
update_icon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/clothing/glasses/meson/engine/tray/t_ray_on()
return on && ..()