mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Merge pull request #11219 from PsiOmegaDelta/150929-HumanoidVision
Overhauls humanoid vision handling.
This commit is contained in:
@@ -1285,6 +1285,7 @@
|
||||
#include "code\modules\mob\living\carbon\human\human_damage.dm"
|
||||
#include "code\modules\mob\living\carbon\human\human_defense.dm"
|
||||
#include "code\modules\mob\living\carbon\human\human_defines.dm"
|
||||
#include "code\modules\mob\living\carbon\human\human_helpers.dm"
|
||||
#include "code\modules\mob\living\carbon\human\human_movement.dm"
|
||||
#include "code\modules\mob\living\carbon\human\human_organs.dm"
|
||||
#include "code\modules\mob\living\carbon\human\human_powers.dm"
|
||||
|
||||
@@ -114,3 +114,13 @@
|
||||
#define MOB_SMALL 10
|
||||
#define MOB_TINY 5
|
||||
#define MOB_MINISCULE 1
|
||||
|
||||
#define TINT_NONE 0
|
||||
#define TINT_MODERATE 1
|
||||
#define TINT_HEAVY 2
|
||||
#define TINT_BLIND 3
|
||||
|
||||
#define FLASH_PROTECTION_REDUCED -1
|
||||
#define FLASH_PROTECTION_NONE 0
|
||||
#define FLASH_PROTECTION_MODERATE 1
|
||||
#define FLASH_PROTECTION_MAJOR 2
|
||||
|
||||
@@ -61,7 +61,7 @@ proc/can_process_hud(var/mob/M)
|
||||
return 1
|
||||
|
||||
//Deletes the current HUD images so they can be refreshed with new ones.
|
||||
mob/proc/handle_regular_hud_updates() //Used in the life.dm of mobs that can use HUDs.
|
||||
mob/proc/handle_hud_glasses() //Used in the life.dm of mobs that can use HUDs.
|
||||
if(client)
|
||||
for(var/image/hud in client.images)
|
||||
if(copytext(hud.icon_state,1,4) == "hud")
|
||||
|
||||
@@ -65,8 +65,9 @@
|
||||
|
||||
if(iscarbon(M))
|
||||
if(M.stat!=DEAD)
|
||||
var/safety = M:eyecheck()
|
||||
if(safety <= 0)
|
||||
var/mob/living/carbon/C = M
|
||||
var/safety = C.eyecheck()
|
||||
if(safety < FLASH_PROTECTION_MODERATE)
|
||||
var/flash_strength = 10
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = M
|
||||
@@ -150,8 +151,8 @@
|
||||
for(var/obj/item/weapon/cloaking_device/S in M)
|
||||
S.active = 0
|
||||
S.icon_state = "shield0"
|
||||
var/safety = M:eyecheck()
|
||||
if(!safety)
|
||||
var/safety = M.eyecheck()
|
||||
if(safety < FLASH_PROTECTION_MODERATE)
|
||||
if(!M.blinded)
|
||||
flick("flash", M.flash)
|
||||
|
||||
@@ -170,7 +171,7 @@
|
||||
if(istype(loc, /mob/living/carbon))
|
||||
var/mob/living/carbon/M = loc
|
||||
var/safety = M.eyecheck()
|
||||
if(safety <= 0)
|
||||
if(safety < FLASH_PROTECTION_MODERATE)
|
||||
M.Weaken(10)
|
||||
flick("e_flash", M.flash)
|
||||
for(var/mob/O in viewers(M, null))
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
ear_safety += 1
|
||||
|
||||
//Flashing everyone
|
||||
if(eye_safety < 1)
|
||||
if(eye_safety < FLASH_PROTECTION_MODERATE)
|
||||
flick("e_flash", M.flash)
|
||||
M.Stun(2)
|
||||
M.Weaken(10)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
var/turf/T = get_turf(src)
|
||||
playsound(T, 'sound/effects/phasein.ogg', 100, 1)
|
||||
for(var/mob/living/carbon/human/M in viewers(T, null))
|
||||
if(M:eyecheck() <= 0)
|
||||
if(M.eyecheck() < FLASH_PROTECTION_MODERATE)
|
||||
flick("e_flash", M.flash)
|
||||
|
||||
for(var/i=1, i<=deliveryamt, i++)
|
||||
|
||||
@@ -337,18 +337,18 @@
|
||||
if(!E)
|
||||
return
|
||||
switch(safety)
|
||||
if(1)
|
||||
if(FLASH_PROTECTION_MODERATE)
|
||||
usr << "<span class='warning'>Your eyes sting a little.</span>"
|
||||
E.damage += rand(1, 2)
|
||||
if(E.damage > 12)
|
||||
user.eye_blurry += rand(3,6)
|
||||
if(0)
|
||||
if(FLASH_PROTECTION_NONE)
|
||||
usr << "<span class='warning'>Your eyes burn.</span>"
|
||||
E.damage += rand(2, 4)
|
||||
if(E.damage > 10)
|
||||
E.damage += rand(4,10)
|
||||
if(-1)
|
||||
usr << "<span class='danger'>Your thermals intensify the welder's glow. Your eyes itch and burn severely.</span>"
|
||||
if(FLASH_PROTECTION_REDUCED)
|
||||
usr << "<span class='danger'>Your equipment intensify the welder's glow. Your eyes itch and burn severely.</span>"
|
||||
user.eye_blurry += rand(12,20)
|
||||
E.damage += rand(12, 16)
|
||||
if(safety<2)
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/obj/item/clothing
|
||||
name = "clothing"
|
||||
siemens_coefficient = 0.9
|
||||
var/list/species_restricted = null //Only these species can wear this kit.
|
||||
var/flash_protection = FLASH_PROTECTION_NONE // Sets the item's level of flash protection.
|
||||
var/tint = TINT_NONE // Sets the item's level of visual impairment tint.
|
||||
var/list/species_restricted = null //Only these species can wear this kit.
|
||||
|
||||
/*
|
||||
Sprites used when the clothing item is refit. This is done by setting icon_override.
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
var/active = 1
|
||||
var/activation_sound = 'sound/items/goggles_charge.ogg'
|
||||
var/obj/screen/overlay = null
|
||||
var/obj/item/clothing/glasses/hud/hud = null // Hud glasses, if any
|
||||
|
||||
/obj/item/clothing/glasses/attack_self(mob/user)
|
||||
if(toggleable)
|
||||
@@ -19,6 +20,8 @@
|
||||
active = 0
|
||||
icon_state = off_state
|
||||
user.update_inv_glasses()
|
||||
flash_protection = FLASH_PROTECTION_NONE
|
||||
tint = TINT_NONE
|
||||
usr << "You deactivate the optical matrix on the [src]."
|
||||
else
|
||||
active = 1
|
||||
@@ -26,6 +29,8 @@
|
||||
user.update_inv_glasses()
|
||||
if(activation_sound)
|
||||
usr << activation_sound
|
||||
flash_protection = initial(flash_protection)
|
||||
tint = initial(tint)
|
||||
usr << "You activate the optical matrix on the [src]."
|
||||
user.update_action_buttons()
|
||||
|
||||
@@ -104,7 +109,7 @@
|
||||
item_state = "glasses"
|
||||
prescription = 1
|
||||
body_parts_covered = 0
|
||||
|
||||
|
||||
/obj/item/clothing/glasses/regular/scanners
|
||||
name = "Scanning Goggles"
|
||||
desc = "A very oddly shaped pair of goggles with bits of wire poking out the sides. A soft humming sound emanates from it."
|
||||
@@ -136,6 +141,7 @@
|
||||
icon_state = "sun"
|
||||
item_state = "sunglasses"
|
||||
darkness_view = -1
|
||||
flash_protection = FLASH_PROTECTION_MODERATE
|
||||
|
||||
/obj/item/clothing/glasses/welding
|
||||
name = "welding goggles"
|
||||
@@ -144,6 +150,8 @@
|
||||
item_state = "welding-g"
|
||||
action_button_name = "Flip Welding Goggles"
|
||||
var/up = 0
|
||||
flash_protection = FLASH_PROTECTION_MAJOR
|
||||
tint = TINT_HEAVY
|
||||
|
||||
/obj/item/clothing/glasses/welding/attack_self()
|
||||
toggle()
|
||||
@@ -160,12 +168,16 @@
|
||||
flags_inv |= HIDEEYES
|
||||
body_parts_covered |= EYES
|
||||
icon_state = initial(icon_state)
|
||||
flash_protection = initial(flash_protection)
|
||||
tint = initial(tint)
|
||||
usr << "You flip \the [src] down to protect your eyes."
|
||||
else
|
||||
src.up = !src.up
|
||||
flags_inv &= ~HIDEEYES
|
||||
body_parts_covered &= ~EYES
|
||||
icon_state = "[initial(icon_state)]up"
|
||||
flash_protection = FLASH_PROTECTION_NONE
|
||||
tint = TINT_NONE
|
||||
usr << "You push \the [src] up out of your face."
|
||||
update_clothing_icon()
|
||||
usr.update_action_buttons()
|
||||
@@ -175,13 +187,14 @@
|
||||
desc = "Welding goggles made from more expensive materials, strangely smells like potatoes."
|
||||
icon_state = "rwelding-g"
|
||||
item_state = "rwelding-g"
|
||||
tint = TINT_MODERATE
|
||||
|
||||
/obj/item/clothing/glasses/sunglasses/blindfold
|
||||
name = "blindfold"
|
||||
desc = "Covers the eyes, preventing sight."
|
||||
icon_state = "blindfold"
|
||||
item_state = "blindfold"
|
||||
//vision_flags = BLIND // This flag is only supposed to be used if it causes permanent blindness, not temporary because of glasses
|
||||
tint = TINT_BLIND
|
||||
|
||||
/obj/item/clothing/glasses/sunglasses/prescription
|
||||
name = "prescription sunglasses"
|
||||
@@ -196,7 +209,6 @@
|
||||
name = "HUDSunglasses"
|
||||
desc = "Sunglasses with a HUD."
|
||||
icon_state = "sunhud"
|
||||
var/obj/item/clothing/glasses/hud/security/hud = null
|
||||
|
||||
New()
|
||||
..()
|
||||
@@ -216,6 +228,8 @@
|
||||
origin_tech = list(TECH_MAGNET = 3)
|
||||
toggleable = 1
|
||||
vision_flags = SEE_MOBS
|
||||
see_invisible = SEE_INVISIBLE_NOLIGHTING
|
||||
flash_protection = FLASH_PROTECTION_REDUCED
|
||||
|
||||
emp_act(severity)
|
||||
if(istype(src.loc, /mob/living/carbon/human))
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
origin_tech = list(TECH_MAGNET = 3, TECH_BIO = 2)
|
||||
var/list/icon/current = list() //the current hud icons
|
||||
|
||||
proc
|
||||
process_hud(var/mob/M) return
|
||||
|
||||
/obj/item/clothing/glasses/proc/process_hud(var/mob/M)
|
||||
if(hud)
|
||||
hud.process_hud(M)
|
||||
|
||||
/obj/item/clothing/glasses/hud/process_hud(var/mob/M)
|
||||
return
|
||||
|
||||
/obj/item/clothing/glasses/hud/health
|
||||
name = "Health Scanner HUD"
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
siemens_coefficient = 0.9
|
||||
w_class = 3
|
||||
var/base_state
|
||||
flash_protection = FLASH_PROTECTION_MAJOR
|
||||
tint = TINT_HEAVY
|
||||
|
||||
/obj/item/clothing/head/welding/attack_self()
|
||||
if(!base_state)
|
||||
@@ -45,11 +47,15 @@
|
||||
src.up = !src.up
|
||||
body_parts_covered |= (EYES|FACE)
|
||||
flags_inv |= (HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE)
|
||||
flash_protection = initial(flash_protection)
|
||||
tint = initial(tint)
|
||||
icon_state = base_state
|
||||
usr << "You flip the [src] down to protect your eyes."
|
||||
else
|
||||
src.up = !src.up
|
||||
body_parts_covered &= ~(EYES|FACE)
|
||||
flash_protection = FLASH_PROTECTION_NONE
|
||||
tint = TINT_NONE
|
||||
flags_inv &= ~(HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE)
|
||||
icon_state = "[base_state]up"
|
||||
usr << "You push the [src] up out of your face."
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
icon_state = "emergencyhelm"
|
||||
item_state = "emergencyhelm"
|
||||
desc = "A simple helmet with a built in light, smells like mothballs."
|
||||
|
||||
flash_protection = FLASH_PROTECTION_NONE
|
||||
|
||||
/obj/item/clothing/suit/space/emergency
|
||||
name = "Emergency Softsuit"
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
airtight = 0
|
||||
seal_delay = 5 //not being vaccum-proof has an upside I guess
|
||||
|
||||
|
||||
helm_type = /obj/item/clothing/head/lightrig/hacker
|
||||
chest_type = /obj/item/clothing/suit/lightrig/hacker
|
||||
glove_type = /obj/item/clothing/gloves/lightrig/hacker
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
min_cold_protection_temperature = SPACE_HELMET_MIN_COLD_PROTECTION_TEMPERATURE
|
||||
siemens_coefficient = 0.9
|
||||
species_restricted = list("exclude","Diona", "Xenomorph")
|
||||
flash_protection = FLASH_PROTECTION_MAJOR
|
||||
|
||||
var/obj/machinery/camera/camera
|
||||
var/list/camera_networks
|
||||
|
||||
@@ -654,38 +654,17 @@
|
||||
///eyecheck()
|
||||
///Returns a number between -1 to 2
|
||||
/mob/living/carbon/human/eyecheck()
|
||||
var/number = 0
|
||||
|
||||
if(!species.has_organ["eyes"]) //No eyes, can't hurt them.
|
||||
return 2
|
||||
return FLASH_PROTECTION_MAJOR
|
||||
|
||||
if(internal_organs_by_name["eyes"]) // Eyes are fucked, not a 'weak point'.
|
||||
var/obj/item/organ/I = internal_organs_by_name["eyes"]
|
||||
if(I.status & ORGAN_CUT_AWAY)
|
||||
return 2
|
||||
return FLASH_PROTECTION_MAJOR
|
||||
else
|
||||
return 2
|
||||
return
|
||||
|
||||
if(istype(src.head, /obj/item/clothing/head/welding))
|
||||
if(!src.head:up)
|
||||
number += 2
|
||||
if(istype(back, /obj/item/weapon/rig))
|
||||
var/obj/item/weapon/rig/O = back
|
||||
if(O.helmet && O.helmet == head && (O.helmet.body_parts_covered & EYES))
|
||||
number += 2
|
||||
if(istype(src.head, /obj/item/clothing/head/helmet/space))
|
||||
number += 2
|
||||
if(istype(src.head, /obj/item/clothing/head/helmet/space/emergency))
|
||||
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/welding))
|
||||
var/obj/item/clothing/glasses/welding/W = src.glasses
|
||||
if(!W.up)
|
||||
number += 2
|
||||
return number
|
||||
return flash_protection
|
||||
|
||||
//Used by various things that knock people out by applying blunt trauma to the head.
|
||||
//Checks that the species has a "head" (brain containing organ) and that hit_zone refers to it.
|
||||
|
||||
@@ -84,3 +84,11 @@
|
||||
mob_bump_flag = HUMAN
|
||||
mob_push_flags = ~HEAVY
|
||||
mob_swap_flags = ~HEAVY
|
||||
|
||||
var/flash_protection = 0 // Total level of flash protection
|
||||
var/equipment_tint_total = 0 // Total level of visualy impairing items
|
||||
var/equipment_darkness_modifier // Darkvision modifier from equipped items
|
||||
var/equipment_vision_flags // Extra vision flags from equipped items
|
||||
var/equipment_see_invis // Max see invibility level granted by equipped items
|
||||
var/equipment_prescription // Eye prescription granted by equipped items
|
||||
var/list/equipment_overlays = list() // Extra overlays from equipped items
|
||||
|
||||
45
code/modules/mob/living/carbon/human/human_helpers.dm
Normal file
45
code/modules/mob/living/carbon/human/human_helpers.dm
Normal file
@@ -0,0 +1,45 @@
|
||||
#define add_clothing_protection(A) \
|
||||
var/obj/item/clothing/C = A; \
|
||||
flash_protection += C.flash_protection; \
|
||||
equipment_tint_total += C.tint;
|
||||
|
||||
/mob/living/carbon/human/proc/update_equipment_vision()
|
||||
flash_protection = 0
|
||||
equipment_tint_total = 0
|
||||
equipment_see_invis = 0
|
||||
equipment_vision_flags = 0
|
||||
equipment_prescription = 0
|
||||
equipment_darkness_modifier = 0
|
||||
equipment_overlays.Cut()
|
||||
|
||||
if(istype(src.head, /obj/item/clothing/head))
|
||||
add_clothing_protection(head)
|
||||
if(istype(src.glasses, /obj/item/clothing/glasses))
|
||||
process_glasses(glasses)
|
||||
if(istype(src.wear_mask, /obj/item/clothing/mask))
|
||||
add_clothing_protection(head)
|
||||
if(istype(back,/obj/item/weapon/rig))
|
||||
process_rig(back)
|
||||
|
||||
/mob/living/carbon/human/proc/process_glasses(var/obj/item/clothing/glasses/G)
|
||||
if(G && G.active)
|
||||
equipment_darkness_modifier += G.darkness_view
|
||||
equipment_vision_flags |= G.vision_flags
|
||||
equipment_prescription = equipment_prescription || G.prescription
|
||||
if(G.overlay)
|
||||
equipment_overlays |= G.overlay
|
||||
if(G.see_invisible >= 0)
|
||||
if(equipment_see_invis)
|
||||
equipment_see_invis = min(equipment_see_invis, G.see_invisible)
|
||||
else
|
||||
equipment_see_invis = G.see_invisible
|
||||
|
||||
add_clothing_protection(G)
|
||||
G.process_hud(src)
|
||||
|
||||
/mob/living/carbon/human/proc/process_rig(var/obj/item/weapon/rig/O)
|
||||
if(O.helmet && O.helmet == head && (O.helmet.body_parts_covered & EYES))
|
||||
if((O.offline && O.offline_vision_restriction == 2) || (!O.offline && O.vision_restriction == 2))
|
||||
equipment_tint_total += TINT_BLIND
|
||||
if(O.visor && O.visor.active && O.visor.vision && O.visor.vision.glasses && (!O.helmet || (head && O.helmet == head)))
|
||||
process_glasses(O.visor.vision.glasses)
|
||||
@@ -41,11 +41,6 @@
|
||||
if (transforming)
|
||||
return
|
||||
|
||||
//Apparently, the person who wrote this code designed it so that
|
||||
//blinded get reset each cycle and then get activated later in the
|
||||
//code. Very ugly. I dont care. Moving this stuff here so its easy
|
||||
//to find it.
|
||||
blinded = null
|
||||
fire_alert = 0 //Reset this here, because both breathe() and handle_environment() have a chance to set it.
|
||||
|
||||
//TODO: seperate this out
|
||||
@@ -153,6 +148,26 @@
|
||||
return ONE_ATMOSPHERE + pressure_difference
|
||||
|
||||
/mob/living/carbon/human/handle_disabilities()
|
||||
..()
|
||||
//Vision
|
||||
var/obj/item/organ/vision
|
||||
if(species.vision_organ)
|
||||
vision = internal_organs_by_name[species.vision_organ]
|
||||
|
||||
if(!vision) // Presumably if a species has no vision organs, they see via some other means.
|
||||
eye_blind = 0
|
||||
blinded = 0
|
||||
eye_blurry = 0
|
||||
else if(vision.is_broken()) // Vision organs cut out or broken? Permablind.
|
||||
eye_blind = 1
|
||||
blinded = 1
|
||||
eye_blurry = 1
|
||||
else
|
||||
//blindness
|
||||
if(!(sdisabilities & BLIND))
|
||||
if(equipment_tint_total >= TINT_BLIND) // Covered eyes, heal faster
|
||||
eye_blurry = max(eye_blurry-2, 0)
|
||||
|
||||
if (disabilities & EPILEPSY)
|
||||
if ((prob(1) && paralysis < 1))
|
||||
src << "\red You have a seizure!"
|
||||
@@ -202,7 +217,7 @@
|
||||
emote("drool")
|
||||
*/
|
||||
|
||||
if(stat != 2)
|
||||
if(stat != DEAD)
|
||||
var/rn = rand(0, 200)
|
||||
if(getBrainLoss() >= 5)
|
||||
if(0 <= rn && rn <= 3)
|
||||
@@ -995,49 +1010,12 @@
|
||||
if(!E.len)
|
||||
embedded_flag = 0
|
||||
|
||||
//Eyes
|
||||
//Check rig first because it's two-check and other checks will override it.
|
||||
if(istype(back,/obj/item/weapon/rig))
|
||||
var/obj/item/weapon/rig/O = back
|
||||
if(O.helmet && O.helmet == head && (O.helmet.body_parts_covered & EYES))
|
||||
if((O.offline && O.offline_vision_restriction == 2) || (!O.offline && O.vision_restriction == 2))
|
||||
blinded = 1
|
||||
|
||||
// Check everything else.
|
||||
|
||||
//Periodically double-check embedded_flag
|
||||
if(embedded_flag && !(life_tick % 10))
|
||||
if(!embedded_needs_process())
|
||||
embedded_flag = 0
|
||||
//Vision
|
||||
var/obj/item/organ/vision
|
||||
if(species.vision_organ)
|
||||
vision = internal_organs_by_name[species.vision_organ]
|
||||
|
||||
if(!vision) // Presumably if a species has no vision organs, they see via some other means.
|
||||
eye_blind = 0
|
||||
blinded = 0
|
||||
eye_blurry = 0
|
||||
else if(vision.is_broken()) // Vision organs cut out or broken? Permablind.
|
||||
eye_blind = 1
|
||||
blinded = 1
|
||||
eye_blurry = 1
|
||||
else
|
||||
//blindness
|
||||
if(sdisabilities & BLIND) // Disabled-blind, doesn't get better on its own
|
||||
blinded = 1
|
||||
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
|
||||
eye_blurry = max(eye_blurry-3, 0)
|
||||
blinded = 1
|
||||
|
||||
//blurry sight
|
||||
if(vision.is_bruised()) // Vision organs impaired? Permablurry.
|
||||
eye_blurry = 1
|
||||
if(eye_blurry) // Blurry eyes heal slowly
|
||||
eye_blurry = max(eye_blurry-1, 0)
|
||||
|
||||
//Ears
|
||||
if(sdisabilities & DEAF) //disabled-deaf, doesn't get better on its own
|
||||
@@ -1111,14 +1089,8 @@
|
||||
|
||||
// now handle what we see on our screen
|
||||
|
||||
if(!client)
|
||||
return 0
|
||||
|
||||
for(var/image/hud in client.images)
|
||||
if(copytext(hud.icon_state,1,4) == "hud") //ugly, but icon comparison is worse, I believe
|
||||
client.images.Remove(hud)
|
||||
|
||||
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask, global_hud.nvg, global_hud.thermal, global_hud.meson, global_hud.science)
|
||||
if(!..())
|
||||
return
|
||||
|
||||
if(damageoverlay.overlays)
|
||||
damageoverlay.overlays = list()
|
||||
@@ -1190,60 +1162,6 @@
|
||||
I = overlays_cache[23]
|
||||
damageoverlay.overlays += I
|
||||
|
||||
if( stat == DEAD )
|
||||
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS|SEE_SELF
|
||||
see_in_dark = 8
|
||||
if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
if(healths) healths.icon_state = "health7" //DEAD healthmeter
|
||||
if(client)
|
||||
if(client.view != world.view) // If mob dies while zoomed in with device, unzoom them.
|
||||
for(var/obj/item/item in contents)
|
||||
if(item.zoom)
|
||||
item.zoom()
|
||||
break
|
||||
|
||||
else
|
||||
sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
see_invisible = see_in_dark>2 ? SEE_INVISIBLE_LEVEL_ONE : SEE_INVISIBLE_LIVING
|
||||
|
||||
if(XRAY in mutations)
|
||||
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
|
||||
see_in_dark = 8
|
||||
if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
|
||||
if(seer==1)
|
||||
var/obj/effect/rune/R = locate() in loc
|
||||
if(R && R.word1 == cultwords["see"] && R.word2 == cultwords["hell"] && R.word3 == cultwords["join"])
|
||||
see_invisible = SEE_INVISIBLE_CULT
|
||||
else
|
||||
see_invisible = SEE_INVISIBLE_LIVING
|
||||
seer = 0
|
||||
|
||||
else
|
||||
sight = species.get_vision_flags(src)
|
||||
see_in_dark = species.darksight
|
||||
see_invisible = see_in_dark>2 ? SEE_INVISIBLE_LEVEL_ONE : SEE_INVISIBLE_LIVING
|
||||
var/tmp/glasses_processed = 0
|
||||
var/obj/item/weapon/rig/rig = back
|
||||
if(istype(rig) && rig.visor)
|
||||
if(!rig.helmet || (head && rig.helmet == head))
|
||||
if(rig.visor && rig.visor.vision && rig.visor.active && rig.visor.vision.glasses)
|
||||
glasses_processed = 1
|
||||
process_glasses(rig.visor.vision.glasses)
|
||||
|
||||
if(glasses && !glasses_processed)
|
||||
glasses_processed = 1
|
||||
process_glasses(glasses)
|
||||
if(XRAY in mutations)
|
||||
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
|
||||
see_in_dark = 8
|
||||
if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
|
||||
if(!glasses_processed && (species.get_vision_flags(src) > 0))
|
||||
sight |= species.get_vision_flags(src)
|
||||
if(!seer && !glasses_processed)
|
||||
see_invisible = SEE_INVISIBLE_LIVING
|
||||
|
||||
if(healths)
|
||||
if (analgesic > 100)
|
||||
healths.icon_state = "health_health_numb"
|
||||
@@ -1262,8 +1180,6 @@
|
||||
if(0 to 20) healths.icon_state = "health5"
|
||||
else healths.icon_state = "health6"
|
||||
|
||||
if(!seer)
|
||||
see_invisible = SEE_INVISIBLE_LIVING
|
||||
if(nutrition_icon)
|
||||
switch(nutrition)
|
||||
if(450 to INFINITY) nutrition_icon.icon_state = "nutrition0"
|
||||
@@ -1329,85 +1245,8 @@
|
||||
bodytemp.icon_state = "temp-1"
|
||||
else
|
||||
bodytemp.icon_state = "temp0"
|
||||
if(blind)
|
||||
if(blinded) blind.layer = 18
|
||||
else blind.layer = 0
|
||||
|
||||
if(disabilities & NEARSIGHTED) //this looks meh but saves a lot of memory by not requiring to add var/prescription
|
||||
if(glasses) //to every /obj/item
|
||||
var/obj/item/clothing/glasses/G = glasses
|
||||
if(!G.prescription)
|
||||
client.screen += global_hud.vimpaired
|
||||
else
|
||||
client.screen += global_hud.vimpaired
|
||||
|
||||
if(eye_blurry) client.screen += global_hud.blurry
|
||||
if(druggy) client.screen += global_hud.druggy
|
||||
|
||||
if(config.welder_vision)
|
||||
var/found_welder
|
||||
if(species.short_sighted)
|
||||
found_welder = 1
|
||||
else
|
||||
if(istype(glasses, /obj/item/clothing/glasses/welding))
|
||||
var/obj/item/clothing/glasses/welding/O = glasses
|
||||
if(!O.up)
|
||||
found_welder = 1
|
||||
if(!found_welder && istype(head, /obj/item/clothing/head/welding))
|
||||
var/obj/item/clothing/head/welding/O = head
|
||||
if(!O.up)
|
||||
found_welder = 1
|
||||
if(!found_welder && istype(back, /obj/item/weapon/rig))
|
||||
var/obj/item/weapon/rig/O = back
|
||||
if(O.helmet && O.helmet == head && (O.helmet.body_parts_covered & EYES))
|
||||
if((O.offline && O.offline_vision_restriction == 1) || (!O.offline && O.vision_restriction == 1))
|
||||
found_welder = 1
|
||||
if(found_welder)
|
||||
client.screen |= global_hud.darkMask
|
||||
|
||||
if(machine)
|
||||
var/viewflags = machine.check_eye(src)
|
||||
if(viewflags < 0)
|
||||
reset_view(null, 0)
|
||||
else if(viewflags)
|
||||
sight |= viewflags
|
||||
else if(eyeobj)
|
||||
if(eyeobj.owner != src)
|
||||
|
||||
reset_view(null)
|
||||
else
|
||||
var/isRemoteObserve = 0
|
||||
if((mRemote in mutations) && remoteview_target)
|
||||
if(remoteview_target.stat==CONSCIOUS)
|
||||
isRemoteObserve = 1
|
||||
if(!isRemoteObserve && client && !client.adminobs)
|
||||
remoteview_target = null
|
||||
reset_view(null, 0)
|
||||
return 1
|
||||
|
||||
/mob/living/carbon/human/proc/process_glasses(var/obj/item/clothing/glasses/G)
|
||||
if(G && G.active)
|
||||
see_in_dark += G.darkness_view
|
||||
if(G.overlay)
|
||||
client.screen |= G.overlay
|
||||
if(G.vision_flags)
|
||||
sight |= G.vision_flags
|
||||
if(!druggy && !seer)
|
||||
see_invisible = SEE_INVISIBLE_MINIMUM
|
||||
if(G.see_invisible >= 0)
|
||||
see_invisible = G.see_invisible
|
||||
if(istype(G,/obj/item/clothing/glasses/night) && !seer)
|
||||
see_invisible = SEE_INVISIBLE_MINIMUM
|
||||
/* HUD shit goes here, as long as it doesn't modify sight flags */
|
||||
// The purpose of this is to stop xray and w/e from preventing you from using huds -- Love, Doohl
|
||||
var/obj/item/clothing/glasses/hud/O = G
|
||||
if(istype(G, /obj/item/clothing/glasses/sunglasses/sechud))
|
||||
var/obj/item/clothing/glasses/sunglasses/sechud/S = G
|
||||
O = S.hud
|
||||
if(istype(O))
|
||||
O.process_hud(src)
|
||||
if(!druggy && !seer) see_invisible = SEE_INVISIBLE_LIVING
|
||||
|
||||
/mob/living/carbon/human/handle_random_events()
|
||||
if(in_stasis)
|
||||
return
|
||||
@@ -1724,5 +1563,37 @@
|
||||
restore_blood()
|
||||
..()
|
||||
|
||||
/mob/living/carbon/human/handle_vision()
|
||||
if(client)
|
||||
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask, global_hud.nvg, global_hud.thermal, global_hud.meson, global_hud.science)
|
||||
if(machine)
|
||||
var/viewflags = machine.check_eye(src)
|
||||
if(viewflags < 0)
|
||||
reset_view(null, 0)
|
||||
else if(viewflags)
|
||||
sight |= viewflags
|
||||
else if(eyeobj)
|
||||
if(eyeobj.owner != src)
|
||||
|
||||
reset_view(null)
|
||||
else
|
||||
var/isRemoteObserve = 0
|
||||
if((mRemote in mutations) && remoteview_target)
|
||||
if(remoteview_target.stat==CONSCIOUS)
|
||||
isRemoteObserve = 1
|
||||
if(!isRemoteObserve && client && !client.adminobs)
|
||||
remoteview_target = null
|
||||
reset_view(null, 0)
|
||||
|
||||
update_equipment_vision()
|
||||
species.handle_vision(src)
|
||||
|
||||
/mob/living/carbon/human/update_sight()
|
||||
..()
|
||||
if(stat == DEAD)
|
||||
return
|
||||
if(XRAY in mutations)
|
||||
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
|
||||
|
||||
#undef HUMAN_MAX_OXYLOSS
|
||||
#undef HUMAN_CRIT_MAX_OXYLOSS
|
||||
|
||||
@@ -334,3 +334,42 @@
|
||||
|
||||
/datum/species/proc/get_vision_flags(var/mob/living/carbon/human/H)
|
||||
return vision_flags
|
||||
|
||||
/datum/species/proc/handle_vision(var/mob/living/carbon/human/H)
|
||||
H.update_sight()
|
||||
H.sight |= get_vision_flags(H)
|
||||
H.sight |= H.equipment_vision_flags
|
||||
|
||||
if(H.stat == DEAD)
|
||||
return 1
|
||||
|
||||
if(!H.druggy)
|
||||
H.see_in_dark = (H.sight == SEE_TURFS|SEE_MOBS|SEE_OBJS) ? 8 : min(darksight + H.equipment_darkness_modifier, 8)
|
||||
if(H.seer)
|
||||
var/obj/effect/rune/R = locate() in H.loc
|
||||
if(R && R.word1 == cultwords["see"] && R.word2 == cultwords["hell"] && R.word3 == cultwords["join"])
|
||||
H.see_invisible = SEE_INVISIBLE_CULT
|
||||
if(H.see_invisible != SEE_INVISIBLE_CULT && H.equipment_see_invis)
|
||||
H.see_invisible = min(H.see_invisible, H.equipment_see_invis)
|
||||
|
||||
if(H.equipment_tint_total >= TINT_BLIND)
|
||||
H.eye_blind = max(H.eye_blind, 1)
|
||||
|
||||
if(H.blind)
|
||||
H.blind.layer = (H.eye_blind ? 18 : 0)
|
||||
|
||||
if(!H.client)//no client, no screen to update
|
||||
return 1
|
||||
|
||||
if(config.welder_vision)
|
||||
if(short_sighted || (H.equipment_tint_total >= TINT_HEAVY))
|
||||
H.client.screen += global_hud.darkMask
|
||||
else if((!H.equipment_prescription && (H.disabilities & NEARSIGHTED)) || H.equipment_tint_total == TINT_MODERATE)
|
||||
H.client.screen += global_hud.vimpaired
|
||||
if(H.eye_blurry) H.client.screen += global_hud.blurry
|
||||
if(H.druggy) H.client.screen += global_hud.druggy
|
||||
|
||||
for(var/overlay in H.equipment_overlays)
|
||||
H.client.screen |= overlay
|
||||
|
||||
return 1
|
||||
|
||||
@@ -126,24 +126,60 @@
|
||||
adjustEarDamage(-0.05,-1)
|
||||
|
||||
//this handles hud updates. Calls update_vision() and handle_hud_icons()
|
||||
/mob/living/handle_regular_hud_updates()
|
||||
if(!client)
|
||||
return 0
|
||||
..()
|
||||
/mob/living/proc/handle_regular_hud_updates()
|
||||
if(!client) return 0
|
||||
|
||||
handle_vision()
|
||||
handle_hud_icons()
|
||||
handle_vision()
|
||||
|
||||
return 1
|
||||
|
||||
/mob/living/proc/handle_vision()
|
||||
return
|
||||
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask, global_hud.nvg, global_hud.thermal, global_hud.meson, global_hud.science)
|
||||
|
||||
update_sight()
|
||||
|
||||
if(stat == DEAD)
|
||||
return
|
||||
|
||||
if(blind)
|
||||
if(eye_blind)
|
||||
blind.layer = 18
|
||||
else
|
||||
blind.layer = 0
|
||||
if (disabilities & NEARSIGHTED)
|
||||
client.screen += global_hud.vimpaired
|
||||
if (eye_blurry)
|
||||
client.screen += global_hud.blurry
|
||||
if (druggy)
|
||||
client.screen += global_hud.druggy
|
||||
if(machine)
|
||||
var/viewflags = machine.check_eye(src)
|
||||
if(viewflags < 0)
|
||||
reset_view(null, 0)
|
||||
else if(viewflags)
|
||||
sight |= viewflags
|
||||
else if(eyeobj && eyeobj.owner != src)
|
||||
reset_view(null)
|
||||
else
|
||||
if(!client.adminobs)
|
||||
reset_view(null)
|
||||
|
||||
/mob/living/proc/update_sight()
|
||||
return
|
||||
if(stat == DEAD)
|
||||
sight |= SEE_TURFS
|
||||
sight |= SEE_MOBS
|
||||
sight |= SEE_OBJS
|
||||
see_in_dark = 8
|
||||
see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
else
|
||||
sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
see_in_dark = 2
|
||||
see_invisible = SEE_INVISIBLE_LIVING
|
||||
|
||||
/mob/living/proc/handle_hud_icons()
|
||||
handle_hud_icons_health()
|
||||
handle_hud_glasses()
|
||||
return
|
||||
|
||||
/mob/living/proc/handle_hud_icons_health()
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
|
||||
//blind adjacent people
|
||||
for (var/mob/living/carbon/M in viewers(T, flash_range))
|
||||
if(M.eyecheck() < 1)
|
||||
if(M.eyecheck() < FLASH_PROTECTION_MODERATE)
|
||||
flick("e_flash", M.flash)
|
||||
|
||||
//snap pop
|
||||
playsound(src, 'sound/effects/snap.ogg', 50, 1)
|
||||
src.visible_message("<span class='warning'>\The [src] explodes in a bright flash!</span>")
|
||||
|
||||
|
||||
new /obj/effect/decal/cleanable/ash(src.loc) //always use src.loc so that ash doesn't end up inside windows
|
||||
new /obj/effect/effect/sparks(T)
|
||||
new /obj/effect/effect/smoke/illumination(T, brightness=max(flash_range*2, brightness), lifetime=light_duration)
|
||||
|
||||
@@ -1080,7 +1080,7 @@
|
||||
var/list/borks = typesof(/obj/item/weapon/reagent_containers/food/snacks) - /obj/item/weapon/reagent_containers/food/snacks
|
||||
playsound(get_turf(holder.my_atom), 'sound/effects/phasein.ogg', 100, 1)
|
||||
for(var/mob/living/carbon/human/M in viewers(get_turf(holder.my_atom), null))
|
||||
if(M.eyecheck() <= 0)
|
||||
if(M.eyecheck() < FLASH_PROTECTION_MODERATE)
|
||||
flick("e_flash", M.flash)
|
||||
|
||||
for(var/i = 1, i <= 4 + rand(1,2), i++)
|
||||
|
||||
Reference in New Issue
Block a user