mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-17 18:13:34 +01:00
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:
@@ -244,6 +244,9 @@
|
||||
/mob/living/carbon/proc/eyecheck()
|
||||
return 0
|
||||
|
||||
/mob/living/carbon/proc/tintcheck()
|
||||
return 0
|
||||
|
||||
/mob/living/carbon/proc/getDNA()
|
||||
return dna
|
||||
|
||||
|
||||
@@ -1027,27 +1027,32 @@
|
||||
///Returns a number between -1 to 2
|
||||
/mob/living/carbon/human/eyecheck()
|
||||
var/number = 0
|
||||
if(istype(src.head, /obj/item/clothing/head/welding))
|
||||
if(!src.head:up)
|
||||
number += 2
|
||||
if(istype(src.head, /obj/item/clothing/head/helmet/space))
|
||||
number += 2
|
||||
if(istype(src.head, /obj/item/clothing/head/helmet/space/eva))
|
||||
number -= 2
|
||||
if(istype(src.head, /obj/item/clothing/head/helmet/space/rig/medical))
|
||||
number -= 2
|
||||
if(istype(src.glasses, /obj/item/clothing/glasses/thermal))
|
||||
number -= 1
|
||||
if(istype(src.glasses, /obj/item/clothing/glasses/sunglasses))
|
||||
number += 1
|
||||
if(istype(src.glasses, /obj/item/clothing/glasses/hud/health_advanced)) // New blueshield / brig phys no flash medi hud
|
||||
number += 1
|
||||
if(istype(src.glasses, /obj/item/clothing/glasses/welding))
|
||||
var/obj/item/clothing/glasses/welding/W = src.glasses
|
||||
if(!W.up)
|
||||
number += 2
|
||||
if(istype(src.head, /obj/item/clothing/head)) //are they wearing something on their head
|
||||
var/obj/item/clothing/head/HFP = src.head //if yes gets the flash protection value from that item
|
||||
number += HFP.flash_protect
|
||||
if(istype(src.glasses, /obj/item/clothing/glasses)) //glasses
|
||||
var/obj/item/clothing/glasses/GFP = src.glasses
|
||||
number += GFP.flash_protect
|
||||
if(istype(src.wear_mask, /obj/item/clothing/mask)) //mask
|
||||
var/obj/item/clothing/mask/MFP = src.wear_mask
|
||||
number += MFP.flash_protect
|
||||
return number
|
||||
|
||||
///tintcheck()
|
||||
///Checks eye covering items for visually impairing tinting, such as welding masks
|
||||
///Checked in life.dm. 0 & 1 = no impairment, 2 = welding mask overlay, 3 = You can see jack, but you can't see shit.
|
||||
/mob/living/carbon/human/tintcheck()
|
||||
var/tinted = 0
|
||||
if(istype(src.head, /obj/item/clothing/head))
|
||||
var/obj/item/clothing/head/HT = src.head
|
||||
tinted += HT.tint
|
||||
if(istype(src.glasses, /obj/item/clothing/glasses))
|
||||
var/obj/item/clothing/glasses/GT = src.glasses
|
||||
tinted += GT.tint
|
||||
if(istype(src.wear_mask, /obj/item/clothing/mask))
|
||||
var/obj/item/clothing/mask/MT = src.wear_mask
|
||||
tinted += MT.tint
|
||||
return tinted
|
||||
|
||||
/mob/living/carbon/human/IsAdvancedToolUser()
|
||||
return 1//Humans can use guns and such
|
||||
|
||||
@@ -24,6 +24,10 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
|
||||
"4" = image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay4"),\
|
||||
"5" = image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay5"),\
|
||||
"6" = image("icon" = 'icons/mob/screen1_full.dmi', "icon_state" = "brutedamageoverlay6"))
|
||||
|
||||
#define TINT_IMPAIR 2 //Threshold of tint level to apply weld mask overlay
|
||||
#define TINT_BLIND 3 //Threshold of tint level to obscure vision fully
|
||||
|
||||
/mob/living/carbon/human
|
||||
var/oxygen_alert = 0
|
||||
var/toxins_alert = 0
|
||||
@@ -36,6 +40,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
|
||||
var/exposedtimenow = 0
|
||||
var/firstexposed = 0
|
||||
var/heartbeat = 0
|
||||
var/tinttotal = 0 // Total level of visually impairing items
|
||||
|
||||
/mob/living/carbon/human/Life()
|
||||
set invisibility = 0
|
||||
@@ -52,6 +57,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
|
||||
//to find it.
|
||||
blinded = null
|
||||
fire_alert = 0 //Reset this here, because both breathe() and handle_environment() have a chance to set it.
|
||||
tinttotal = tintcheck() //here as both hud updates and status updates call it
|
||||
|
||||
//TODO: seperate this out
|
||||
// update the current life tick, can be used to e.g. only do something every 4 ticks
|
||||
@@ -1008,9 +1014,9 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
|
||||
else if(eye_blind) //blindness, heals slowly over time
|
||||
eye_blind = max(eye_blind-1,0)
|
||||
blinded = 1
|
||||
else if(istype(glasses, /obj/item/clothing/glasses/sunglasses/blindfold)) //resting your eyes with a blindfold heals blurry eyes faster
|
||||
else if(tinttotal >= TINT_BLIND) //covering your eyes heals blurry eyes faster
|
||||
eye_blurry = max(eye_blurry-3, 0)
|
||||
blinded = 1
|
||||
// blinded = 1 //now handled under /handle_regular_hud_updates()
|
||||
else if(eye_blurry) //blurry eyes heal slowly
|
||||
eye_blurry = max(eye_blurry-1, 0)
|
||||
|
||||
@@ -1338,6 +1344,16 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
|
||||
bodytemp.icon_state = "temp-1"
|
||||
else
|
||||
bodytemp.icon_state = "temp0"
|
||||
|
||||
// This checks how much the mob's eyewear impairs their vision
|
||||
if(tinttotal >= TINT_IMPAIR)
|
||||
if(tinted_weldhelh)
|
||||
if(tinttotal >= TINT_BLIND)
|
||||
blinded = 1 // You get the sudden urge to learn to play keyboard
|
||||
client.screen += global_hud.darkMask
|
||||
else
|
||||
client.screen += global_hud.darkMask
|
||||
|
||||
if(blind)
|
||||
if(blinded) blind.layer = 18
|
||||
else blind.layer = 0
|
||||
@@ -1353,19 +1369,6 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
|
||||
if(eye_blurry) client.screen += global_hud.blurry
|
||||
if(druggy) client.screen += global_hud.druggy
|
||||
|
||||
var/masked = 0
|
||||
|
||||
if( istype(head, /obj/item/clothing/head/welding) || istype(head, /obj/item/clothing/head/helmet/space/unathi))
|
||||
var/obj/item/clothing/head/welding/O = head
|
||||
if(!O.up && tinted_weldhelh)
|
||||
client.screen += global_hud.darkMask
|
||||
masked = 1
|
||||
|
||||
if(!masked && istype(glasses, /obj/item/clothing/glasses/welding) )
|
||||
var/obj/item/clothing/glasses/welding/O = glasses
|
||||
if(!O.up && tinted_weldhelh)
|
||||
client.screen += global_hud.darkMask
|
||||
|
||||
if(machine)
|
||||
if(!machine.check_eye(src)) reset_view(null)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user