Improved eyecheck()

Changes flash/welder protection eyecheck() proc from several hard coded
item checks to a /var check for eye covering items, reducing the number
of IF statements and allowing greater flexibility as child items can
have a different protection level to their parent.

Created a new proc tintcheck()
-Items have a separate tint var to allow for items to protect
but not impair, such as space helmets.

-tintcheck() adds these up for eye covering locations

-life.dm uses this new proc when checking to apply the welder overlay
instead of hardcoded if statements
This commit is contained in:
Malkevin
2015-04-13 17:57:38 -07:00
committed by Tigercat2000
parent dca6fac85f
commit 9deb16dcdb
6 changed files with 78 additions and 35 deletions
+8 -1
View File
@@ -133,6 +133,9 @@
var/vision_flags = 0
var/darkness_view = 0//Base human is 2
var/invisa_view = 0
var/flash_protect = 0 //Mal: What level of bright light protection item has. 1 = Flashers, Flashes, & Flashbangs | 2 = Welding | -1 = OH GOD WELDING BURNT OUT MY RETINAS
var/tint = 0 //Mal: Sets the item's level of visual impairment tint, normally set to the same as flash_protect
// but seperated to allow items to protect but not impair vision, like space helmets
species_restricted = list("exclude","Kidan")
/*
SEE_SELF // can see self, no matter what
@@ -236,7 +239,8 @@ BLIND // can't see anything
slot_flags = SLOT_HEAD
var/loose = 10 // probability (0..100) of coming off your head when you fall over or lay down
var/blockTracking // Do we block AI tracking?
var/flash_protect = 0
var/tint = 0
//Mask
/obj/item/clothing/mask
@@ -247,6 +251,8 @@ BLIND // can't see anything
var/mask_adjusted = 0
var/ignore_maskadjust = 1
var/adjusted_flags = null
var/flash_protect = 0
var/tint = 0
//Proc that moves gas/breath masks out of the way
/obj/item/clothing/mask/proc/adjustmask(var/mob/user)
@@ -324,6 +330,7 @@ BLIND // can't see anything
siemens_coefficient = 0.9
species_restricted = list("exclude","Diona","Vox")
loose = 0 // What kind of idiot designs a pressurized suit where the helmet can fall off?
flash_protect = 2
/obj/item/clothing/suit/space
name = "Space suit"
+19
View File
@@ -137,6 +137,8 @@
icon_state = "sun"
item_state = "sunglasses"
darkness_view = 1
flash_protect = 1
tint = 1
species_fit = list("Vox")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/eyes.dmi'
@@ -148,6 +150,8 @@
icon_state = "sun"
item_state = "sunglasses"
darkness_view = 1
flash_protect = 1
tint = 1
species_fit = list("Vox")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/eyes.dmi'
@@ -160,6 +164,8 @@
item_state = "welding-g"
icon_action_button = "action_welding_g"
var/up = 0
flash_protect = 2
tint = 2
species_fit = list("Vox")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/eyes.dmi'
@@ -184,12 +190,16 @@
flags_inv |= HIDEEYES
icon_state = initial(icon_state)
usr << "You flip the [src] down to protect your eyes."
flash_protect = 2
tint = initial(tint) //better than istype
else
src.up = !src.up
src.flags &= ~HEADCOVERSEYES
flags_inv &= ~HIDEEYES
icon_state = "[initial(icon_state)]up"
usr << "You push the [src] up out of your face."
flash_protect = 0
tint = 0
usr.update_inv_glasses()
@@ -198,6 +208,8 @@
desc = "Welding goggles made from more expensive materials, strangely smells like potatoes."
icon_state = "rwelding-g"
item_state = "rwelding-g"
flash_protect = 2
tint = 0
icon_action_button = "action_welding_g"
species_fit = list("Vox")
sprite_sheets = list(
@@ -213,6 +225,8 @@
icon_state = "blindfold"
item_state = "blindfold"
//vision_flags = BLIND
flash_protect = 2
tint = 3 //to make them blind
species_fit = list("Vox")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/eyes.dmi'
@@ -230,6 +244,8 @@
desc = "Strangely ancient technology used to help provide rudimentary eye cover. Larger than average enhanced shielding blocks many flashes."
icon_state = "bigsunglasses"
item_state = "bigsunglasses"
flash_protect = 1
tint = 1
species_fit = list("Vox")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/eyes.dmi'
@@ -240,6 +256,8 @@
desc = "Sunglasses with a HUD."
icon_state = "sunhud"
darkness_view = 1
flash_protect = 1
tint = 1
var/obj/item/clothing/glasses/hud/security/hud = null
species_fit = list("Vox")
sprite_sheets = list(
@@ -259,6 +277,7 @@
origin_tech = "magnets=3"
vision_flags = SEE_MOBS
invisa_view = 2
flash_protect = -1
emp_act(severity)
if(istype(src.loc, /mob/living/carbon/human))
@@ -20,6 +20,8 @@
m_amt = 1750
g_amt = 400
var/up = 0
flash_protect = 2
tint = 2
armor = list(melee = 10, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
flags_inv = (HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE)
icon_action_button = "action_welding"
@@ -44,12 +46,16 @@
flags_inv |= (HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE)
icon_state = initial(icon_state)
usr << "You flip the [src] down to protect your eyes."
flash_protect = 2
tint = 2
else
src.up = !src.up
src.flags &= ~(HEADCOVERSEYES | HEADCOVERSMOUTH)
flags_inv &= ~(HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE)
icon_state = "[initial(icon_state)]up"
usr << "You push the [src] up out of your face."
flash_protect = 0
tint = 0
usr.update_inv_head() //so our mob-overlays update