Rewrites HUD Handling for Glasses

This commit is contained in:
SamCroswell
2015-06-11 21:42:15 -04:00
parent 1fbaae6deb
commit b6cd6b4384
8 changed files with 39 additions and 106 deletions
+4
View File
@@ -29,3 +29,7 @@
#define BORGMESON 1
#define BORGTHERM 2
#define BORGXRAY 4
#define SECHUD 1
#define MEDHUD 2
#define ANTAGHUD 3
+1
View File
@@ -50,6 +50,7 @@ var/global/list/blocked_mobs = list(/mob/living/simple_animal/hostile,
var/global/list/med_hud_users = list()
var/global/list/sec_hud_users = list()
var/global/list/antag_hud_users = list()
//items that ask to be called every cycle
var/global/list/active_diseases = list() //Diseases are mob-based, so they get to go here
+14 -2
View File
@@ -9,7 +9,7 @@ proc/process_med_hud(var/mob/M, var/local_scanner, var/mob/Alt)
var/datum/arranged_hud_process/P = arrange_hud_process(M, Alt, med_hud_users)
for(var/mob/living/carbon/human/patient in P.Mob.in_view(P.Turf))
if(P.Mob.see_invisible < patient.invisibility)
if(P.Mob.see_invisible < patient.invisibility || patient.alpha < 127)
continue
if(!local_scanner)
@@ -30,7 +30,7 @@ proc/process_sec_hud(var/mob/M, var/advanced_mode, var/mob/Alt)
return
var/datum/arranged_hud_process/P = arrange_hud_process(M, Alt, sec_hud_users)
for(var/mob/living/carbon/human/perp in P.Mob.in_view(P.Turf))
if(P.Mob.see_invisible < perp.invisibility)
if(P.Mob.see_invisible < perp.invisibility || perp.alpha < 127)
continue
P.Client.images += perp.hud_list[ID_HUD]
@@ -40,6 +40,17 @@ proc/process_sec_hud(var/mob/M, var/advanced_mode, var/mob/Alt)
P.Client.images += perp.hud_list[IMPLOYAL_HUD]
P.Client.images += perp.hud_list[IMPCHEM_HUD]
proc/process_antag_hud(var/mob/M, var/mob/Alt)
if(!can_process_hud(M))
return
var/datum/arranged_hud_process/P = arrange_hud_process(M, Alt, antag_hud_users)
for(var/mob/living/carbon/human/target in P.Mob.in_view(P.Turf))
if(P.Mob.see_invisible < target.invisibility || target.alpha < 127)
continue
P.Client.images += target.hud_list[SPECIALROLE_HUD]
datum/arranged_hud_process
var/client/Client
var/mob/Mob
@@ -70,6 +81,7 @@ mob/proc/regular_hud_updates() //Used in the life.dm of mobs that can use HUDs.
client.images -= hud
med_hud_users -= src
sec_hud_users -= src
antag_hud_users -= src
mob/proc/in_view(var/turf/T)
return view(T)
+1 -53
View File
@@ -61,56 +61,4 @@
//TODO - Check documentation for client.eye and client.perspective...
/obj/item/clothing/glasses/hud/health/mech
name = "Integrated Medical Hud"
process_hud(var/mob/M)
/*
world<< "view(M)"
for(var/mob/mob in view(M))
world << "[mob]"
world<< "view(M.client)"
for(var/mob/mob in view(M.client))
world << "[mob]"
world<< "view(M.loc)"
for(var/mob/mob in view(M.loc))
world << "[mob]"
*/
if(!M || M.stat || !(M in view(M))) return
if(!M.client) return
var/client/C = M.client
var/image/holder
for(var/mob/living/carbon/human/patient in view(M.loc))
if(M.see_invisible < patient.invisibility)
continue
var/foundVirus = 0
for (var/ID in patient.virus2)
if (ID in virusDB)
foundVirus = 1
break
holder = patient.hud_list[HEALTH_HUD]
if(patient.stat == 2)
holder.icon_state = "hudhealth-100"
C.images += holder
else
holder.icon_state = "hud[RoundHealth(patient.health)]"
C.images += holder
holder = patient.hud_list[STATUS_HUD]
if(patient.stat == 2)
holder.icon_state = "huddead"
else if(patient.status_flags & XENO_HOST)
holder.icon_state = "hudxeno"
else if(foundVirus)
holder.icon_state = "hudill"
else if(patient.has_brain_worms())
var/mob/living/simple_animal/borer/B = patient.has_brain_worms()
if(B.controlling)
holder.icon_state = "hudbrainworm"
else
holder.icon_state = "hudhealthy"
else
holder.icon_state = "hudhealthy"
C.images += holder
HUDType = MEDHUD
+2 -6
View File
@@ -9,6 +9,7 @@
//var/invisa_view = 0
var/prescription = 0
var/see_darkness = 1
var/HUDType = 0
/obj/item/clothing/glasses/meson
name = "Optical Meson Scanner"
@@ -258,17 +259,12 @@
darkness_view = 1
flash_protect = 1
tint = 1
var/obj/item/clothing/glasses/hud/security/hud = null
HUDType = SECHUD
species_fit = list("Vox")
sprite_sheets = list(
"Vox" = 'icons/mob/species/vox/eyes.dmi'
)
New()
..()
src.hud = new/obj/item/clothing/glasses/hud/security(src)
return
/obj/item/clothing/glasses/thermal
name = "Optical Thermal Scanner"
desc = "Thermals in the shape of glasses."
+3 -25
View File
@@ -3,23 +3,22 @@
desc = "A heads-up display that provides important info in (almost) real time."
flags = null //doesn't protect eyes because it's a monocle, duh
origin_tech = "magnets=3;biotech=2"
HUDType = SECHUD
var/list/icon/current = list() //the current hud icons
proc
process_hud(var/mob/M) return
/obj/item/clothing/glasses/hud/health
name = "Health Scanner HUD"
desc = "A heads-up display that scans the humans in view and provides accurate data about their health status."
icon_state = "healthhud"
HUDType = MEDHUD
/obj/item/clothing/glasses/hud/health_advanced
name = "Advanced Health Scanner HUD"
desc = "A heads-up display that scans the humans in view and provides accurate data about their health status. Includes anti-flash filter."
icon_state = "advmedhud"
flash_protect = 1
HUDType = MEDHUD
/obj/item/clothing/glasses/hud/health/night
name = "Night Vision Health Scanner HUD"
@@ -29,12 +28,6 @@
darkness_view = 8
see_darkness = 0
/obj/item/clothing/glasses/hud/health/process_hud(var/mob/M)
process_med_hud(M,1)
/obj/item/clothing/glasses/hud/health_advanced/process_hud(var/mob/M)
process_med_hud(M,1)
/obj/item/clothing/glasses/hud/security
name = "Security HUD"
@@ -57,18 +50,3 @@
icon_state = "securityhudnight"
darkness_view = 8
see_darkness = 0
/obj/item/clothing/glasses/hud/security/process_hud(var/mob/M)
if(!M) return
if(!M.client) return
var/client/C = M.client
for(var/mob/living/carbon/human/perp in view(get_turf(M)))
if(M.see_invisible < perp.invisibility)
continue
if(!C) continue
C.images += perp.hud_list[ID_HUD]
C.images += perp.hud_list[WANTED_HUD]
C.images += perp.hud_list[IMPTRACK_HUD]
C.images += perp.hud_list[IMPLOYAL_HUD]
C.images += perp.hud_list[IMPCHEM_HUD]
+9 -11
View File
@@ -1192,18 +1192,16 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
/* 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
if(istype(glasses, /obj/item/clothing/glasses/sunglasses))
see_in_dark = 1
if(istype(glasses, /obj/item/clothing/glasses/sunglasses/sechud))
var/obj/item/clothing/glasses/sunglasses/sechud/O = glasses
if(O.hud) O.hud.process_hud(src)
if(!druggy) see_invisible = (!O.see_darkness || O.vision_flags ? SEE_INVISIBLE_MINIMUM : SEE_INVISIBLE_LIVING) // So we can have meson/thermal/material sunglasses
switch(G.HUDType)
if(SECHUD)
process_sec_hud(src,1)
if(MEDHUD)
process_med_hud(src,1)
if(ANTAGHUD)
process_antag_hud(src)
if(istype(glasses, /obj/item/clothing/glasses/hud))
var/obj/item/clothing/glasses/hud/O = glasses
O.process_hud(src)
if(!druggy)
see_invisible = (!O.see_darkness || O.vision_flags ? SEE_INVISIBLE_MINIMUM : SEE_INVISIBLE_LIVING)
else if(!seer)
see_in_dark = species.darksight
see_invisible = SEE_INVISIBLE_LIVING
@@ -195,15 +195,11 @@
regular_hud_updates()
var/obj/item/borg/sight/hud/hud = (locate(/obj/item/borg/sight/hud) in src)
if(hud && hud.hud)
hud.hud.process_hud(src)
else
switch(src.sensor_mode)
if (SEC_HUD)
process_sec_hud(src,1)
if (MED_HUD)
process_med_hud(src,1)
switch(src.sensor_mode)
if (SEC_HUD)
process_sec_hud(src,1)
if (MED_HUD)
process_med_hud(src,1)
if (src.healths)
if (src.stat != 2)