Merge pull request #4525 from GunHog/HUDS_For_All

Silicon Medical and Security HUDs!
This commit is contained in:
Cheridan
2014-09-07 20:01:12 -05:00
18 changed files with 266 additions and 214 deletions

View File

@@ -13,3 +13,5 @@ var/global/list/chemical_reactions_list //list of all /datum/chemical_reactio
var/global/list/chemical_reagents_list //list of all /datum/reagent datums indexed by reagent id. Used by chemistry stuff
var/global/list/surgeries_list = list() //list of all surgeries by name, associated with their path.
var/global/list/table_recipes = list() //list of all table craft recipes
var/global/list/med_hud_users = list() //list of all entities using a medical HUD.
var/global/list/sec_hud_users = list() //list of all entities using a security HUD.

View File

@@ -44,6 +44,7 @@
#define ui_storage1 "CENTER+1:18,SOUTH:5"
#define ui_storage2 "CENTER+2:20,SOUTH:5"
#define ui_borg_sensor "CENTER-3:16, SOUTH:5" //borgs
#define ui_inv1 "CENTER-2:16,SOUTH:5" //borgs
#define ui_inv2 "CENTER-1 :16,SOUTH:5" //borgs
#define ui_inv3 "CENTER :16,SOUTH:5" //borgs
@@ -94,20 +95,21 @@
// AI
#define ui_ai_core "SOUTH:6,WEST:16"
#define ui_ai_camera_list "SOUTH:6,WEST+1:16"
#define ui_ai_track_with_camera "SOUTH:6,WEST+2:16"
#define ui_ai_camera_light "SOUTH:6,WEST+3:16"
#define ui_ai_crew_monitor "SOUTH:6,WEST+4:16"
#define ui_ai_crew_manifest "SOUTH:6,WEST+5:16"
#define ui_ai_alerts "SOUTH:6,WEST+6:16"
#define ui_ai_announcement "SOUTH:6,WEST+7:16"
#define ui_ai_shuttle "SOUTH:6,WEST+8:16"
#define ui_ai_state_laws "SOUTH:6,WEST+9:16"
#define ui_ai_pda_send "SOUTH:6,WEST+10:16"
#define ui_ai_pda_log "SOUTH:6,WEST+11:16"
#define ui_ai_take_picture "SOUTH:6,WEST+12:16"
#define ui_ai_view_images "SOUTH:6,WEST+13:16"
#define ui_ai_core "SOUTH:6,WEST"
#define ui_ai_camera_list "SOUTH:6,WEST+1"
#define ui_ai_track_with_camera "SOUTH:6,WEST+2"
#define ui_ai_camera_light "SOUTH:6,WEST+3"
#define ui_ai_crew_monitor "SOUTH:6,WEST+4"
#define ui_ai_crew_manifest "SOUTH:6,WEST+5"
#define ui_ai_alerts "SOUTH:6,WEST+6"
#define ui_ai_announcement "SOUTH:6,WEST+7"
#define ui_ai_shuttle "SOUTH:6,WEST+8"
#define ui_ai_state_laws "SOUTH:6,WEST+9"
#define ui_ai_pda_send "SOUTH:6,WEST+10"
#define ui_ai_pda_log "SOUTH:6,WEST+11"
#define ui_ai_take_picture "SOUTH:6,WEST+12"
#define ui_ai_view_images "SOUTH:6,WEST+13"
#define ui_ai_sensor "SOUTH:6,WEST+14"
//Pop-up inventory
#define ui_shoes "WEST+1:8,SOUTH:5"

View File

@@ -130,6 +130,15 @@
using.layer = 20
adding += using
mymob.client.screen += adding + other
//Medical/Security sensors
using = new /obj/screen()
using.name = "Sensor Augmentation"
using.icon = 'icons/mob/screen_ai.dmi'
using.icon_state = "ai_sensor"
using.screen_loc = ui_ai_sensor
using.layer = 20
adding += using
mymob.client.screen += adding + other
return

View File

@@ -63,6 +63,15 @@
using.layer = 20
adding += using
//Sec/Med HUDs
using = new /obj/screen()
using.name = "Sensor Augmentation"
using.icon = 'icons/mob/screen_ai.dmi'
using.icon_state = "ai_sensor"
using.screen_loc = ui_borg_sensor
using.layer = 20
adding += using
//Intent
using = new /obj/screen()
using.name = "act_intent"

View File

@@ -387,6 +387,10 @@
var/mob/living/silicon/robot/R = usr
R.aicamera.viewpictures()
if("Sensor Augmentation")
if(issilicon(usr))
var/mob/living/silicon/S = usr
S.sensor_mode()
else
return 0
return 1

181
code/game/data_huds.dm Normal file
View File

@@ -0,0 +1,181 @@
/* Using the HUD procs is simple. Call these procs in the life.dm of the intended mob.
Use the regular_hud_updates() proc before process_med_hud(mob) or process_sec_hud(mob) so
the HUD updates properly! */
//Deletes the current HUD images so they can be refreshed with new ones.
mob/proc/regular_hud_updates() //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")
client.images -= hud
med_hud_users -= src
sec_hud_users -= src
//Medical HUD procs
proc/RoundHealth(health)
switch(health)
if(100 to INFINITY)
return "health100"
if(70 to 100)
return "health80"
if(50 to 70)
return "health60"
if(30 to 50)
return "health40"
if(18 to 30)
return "health25"
if(5 to 18)
return "health10"
if(1 to 5)
return "health1"
if(-99 to 0)
return "health0"
else
return "health-100"
return "0"
/*Called by the Life() proc of the mob using it, usually. Items can call it as well.
Called with this syntax: (The user mob, the type of hud in use, the advanced or basic version of the hud,eye object in the case of an AI) */
proc/process_data_hud(var/mob/M, var/hud_type, var/hud_mode, var/mob/eye)
#define DATA_HUD_MEDICAL 1
#define DATA_HUD_SECURITY 2
#define DATA_HUD_BASIC 1
#define DATA_HUD_ADVANCED 2
if(!M)
return
if(!M.client)
return
var/turf/T
if(eye)
T = get_turf(eye)
else
T = get_turf(M)
for(var/mob/living/carbon/human/H in mob_list)
if(get_dist(H, T) > M.client.view) //Ignores any humans outside of the user's view distance.
continue
switch(hud_type)
if(DATA_HUD_MEDICAL)
med_hud_users |= M
process_med_hud(M,hud_mode,T,H)
if(DATA_HUD_SECURITY)
sec_hud_users |= M //Used for Security HUD alerts.
process_sec_hud(M,hud_mode,T,H)
/***********************************************
Medical HUD outputs! Advanced mode ignores suit sensors.
************************************************/
proc/process_med_hud(var/mob/M, var/mode, var/turf/T, var/mob/living/carbon/human/patient)
var/client/C = M.client
if(mode == DATA_HUD_BASIC && !med_hud_suit_sensors(patient)) //Used for the AI's MedHUD, only works if the patient has activated suit sensors.
return
var/foundVirus = med_hud_find_virus(patient) //Detects non-hidden diseases in a patient, returns as a binary value.
C.images += med_hud_get_health(patient) //Generates a patient's health bar.
C.images += med_hud_get_status(patient, foundVirus) //Determines the type of status icon to show.
proc/med_hud_suit_sensors(var/mob/living/carbon/human/patient)
if(istype(patient.w_uniform, /obj/item/clothing/under))
var/obj/item/clothing/under/U = patient.w_uniform
if(U.sensor_mode > 2)
return 1
else
return 0
proc/med_hud_find_virus(var/mob/living/carbon/human/patient)
for(var/datum/disease/D in patient.viruses)
if(!D.hidden[SCANNER])
return 1
proc/med_hud_get_health(var/mob/living/carbon/human/patient)
var/image/holder = patient.hud_list[HEALTH_HUD]
if(patient.stat == 2)
holder.icon_state = "hudhealth-100"
else
holder.icon_state = "hud[RoundHealth(patient.health)]"
return holder
proc/med_hud_get_status(var/mob/living/carbon/human/patient, var/foundVirus)
var/image/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
holder.icon_state = "hudhealthy"
return holder
/***********************************************
Security HUDs.
Pass a value for the second argument to enable implant viewing or other special features.
************************************************/
proc/process_sec_hud(var/mob/M, var/mode, var/turf/T, var/mob/living/carbon/human/perp)
var/client/C = M.client
sec_hud_get_ID(C, perp) //Provides the perp's job icon.
if(mode == DATA_HUD_ADVANCED) //If not set to "DATA_HUD_ADVANCED, the Sec HUD will only display the job.
sec_hud_get_implants(C, perp) //Returns the perp's implants, if any.
sec_hud_get_security_status(C, perp) //Gives the perp's arrest record, if there is one.
proc/sec_hud_get_ID(var/client/C, var/mob/living/carbon/human/perp)
var/image/holder
holder = perp.hud_list[ID_HUD]
holder.icon_state = "hudno_id"
if(perp.wear_id)
holder.icon_state = "hud[ckey(perp.wear_id.GetJobName())]"
C.images += holder
proc/sec_hud_get_implants(var/client/C, var/mob/living/carbon/human/perp)
var/image/holder
for(var/obj/item/weapon/implant/I in perp)
if(I.implanted)
if(istype(I,/obj/item/weapon/implant/tracking))
holder = perp.hud_list[IMPTRACK_HUD]
holder.icon_state = "hud_imp_tracking"
else if(istype(I,/obj/item/weapon/implant/loyalty))
holder = perp.hud_list[IMPLOYAL_HUD]
holder.icon_state = "hud_imp_loyal"
else if(istype(I,/obj/item/weapon/implant/chem))
holder = perp.hud_list[IMPCHEM_HUD]
holder.icon_state = "hud_imp_chem"
else
continue
C.images += holder
break
proc/sec_hud_get_security_status(var/client/C, var/mob/living/carbon/human/perp)
var/image/holder
var/perpname = perp.get_face_name(perp.get_id_name(""))
if(perpname)
var/datum/data/record/R = find_record("name", perpname, data_core.security)
if(R)
holder = perp.hud_list[WANTED_HUD]
switch(R.fields["criminal"])
if("*Arrest*") holder.icon_state = "hudwanted"
if("Incarcerated") holder.icon_state = "hudincarcerated"
if("Parolled") holder.icon_state = "hudparolled"
if("Discharged") holder.icon_state = "huddischarged"
else
return
C.images += holder

View File

@@ -25,63 +25,12 @@
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"
proc
RoundHealth(health)
RoundHealth(health)
switch(health)
if(100 to INFINITY)
return "health100"
if(70 to 100)
return "health80"
if(50 to 70)
return "health60"
if(30 to 50)
return "health40"
if(18 to 30)
return "health25"
if(5 to 18)
return "health10"
if(1 to 5)
return "health1"
if(-99 to 0)
return "health0"
else
return "health-100"
return "0"
/obj/item/clothing/glasses/hud/health/process_hud(var/mob/M)
process_data_hud(M,DATA_HUD_MEDICAL,DATA_HUD_ADVANCED)
process_hud(var/mob/M)
if(!M) return
if(!M.client) return
var/client/C = M.client
var/image/holder
for(var/mob/living/carbon/human/patient in view(M))
var/foundVirus = 0
for(var/datum/disease/D in patient.viruses)
if(!D.hidden[SCANNER])
foundVirus++
if(!C) continue
holder = patient.hud_list[HEALTH_HUD]
if(patient.stat == 2)
holder.icon_state = "hudhealth-100"
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
holder.icon_state = "hudhealthy"
C.images += holder
/obj/item/clothing/glasses/hud/health/night
name = "Night Vision Health Scanner HUD"
desc = "An advanced medical head-up display that allows doctors to find patients in complete darkness."
@@ -123,44 +72,4 @@
invis_view = 2
/obj/item/clothing/glasses/hud/security/process_hud(var/mob/M)
if(!M) return
if(!M.client) return
var/client/C = M.client
var/image/holder
for(var/mob/living/carbon/human/perp in view(M))
holder = perp.hud_list[ID_HUD]
holder.icon_state = "hudno_id"
if(perp.wear_id)
holder.icon_state = "hud[ckey(perp.wear_id.GetJobName())]"
C.images += holder
for(var/obj/item/weapon/implant/I in perp)
if(I.implanted)
if(istype(I,/obj/item/weapon/implant/tracking))
holder = perp.hud_list[IMPTRACK_HUD]
holder.icon_state = "hud_imp_tracking"
else if(istype(I,/obj/item/weapon/implant/loyalty))
holder = perp.hud_list[IMPLOYAL_HUD]
holder.icon_state = "hud_imp_loyal"
else if(istype(I,/obj/item/weapon/implant/chem))
holder = perp.hud_list[IMPCHEM_HUD]
holder.icon_state = "hud_imp_chem"
else
continue
C.images += holder
break
var/perpname = perp.get_face_name(perp.get_id_name(""))
if(perpname)
var/datum/data/record/R = find_record("name", perpname, data_core.security)
if(R)
holder = perp.hud_list[WANTED_HUD]
switch(R.fields["criminal"])
if("*Arrest*") holder.icon_state = "hudwanted"
if("Incarcerated") holder.icon_state = "hudincarcerated"
if("Parolled") holder.icon_state = "hudparolled"
if("Discharged") holder.icon_state = "huddischarged"
else
continue
C.images += holder
process_data_hud(M,DATA_HUD_SECURITY,DATA_HUD_ADVANCED)

View File

@@ -594,9 +594,7 @@
/mob/living/carbon/human/proc/handle_regular_hud_updates()
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)
regular_hud_updates() //For MED/SEC HUD icon deletion
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask)

View File

@@ -1,2 +1,2 @@
/mob/living/carbon/slime/proc/regular_hud_updates()
/mob/living/carbon/slime/regular_hud_updates()
return

View File

@@ -163,6 +163,11 @@
sleep(50)
theAPC = null
regular_hud_updates()
if(sensor_mode) //Data HUDs, such as Security or Medical HUDS. Passes the AI's eye since it seems from that instead of itself.
process_data_hud(src,sensor_mode,DATA_HUD_BASIC,src.eyeobj)
/mob/living/silicon/ai/updatehealth()
if(status_flags & GODMODE)
health = maxHealth

View File

@@ -1,82 +0,0 @@
/mob/living/silicon/pai/proc/regular_hud_updates()
if(client)
for(var/image/hud in client.images)
if(copytext(hud.icon_state,1,4) == "hud")
client.images -= hud
/mob/living/silicon/pai/proc/securityHUD()
if(client)
var/image/holder
var/turf/T = get_turf(src.loc)
for(var/mob/living/carbon/human/perp in view(T))
holder = perp.hud_list[ID_HUD]
holder.icon_state = "hudno_id"
if(perp.wear_id)
holder.icon_state = "hud[ckey(perp:wear_id:GetJobName())]"
client.images += holder
var/perpname = perp.get_face_name(perp.get_id_name(""))
if(perpname)
var/datum/data/record/R = find_record("name", perpname, data_core.security)
if(R)
holder = perp.hud_list[WANTED_HUD]
switch(R.fields["criminal"])
if("*Arrest*") holder.icon_state = "hudwanted"
if("Incarcerated") holder.icon_state = "hudincarcerated"
if("Parolled") holder.icon_state = "hudparolled"
if("Discharged") holder.icon_state = "huddischarged"
else
continue
client.images += holder
/mob/living/silicon/pai/proc/medicalHUD()
if(client)
var/image/holder
var/turf/T = get_turf(src.loc)
for(var/mob/living/carbon/human/patient in view(T))
var/foundVirus = 0
for(var/datum/disease/D in patient.viruses)
if(!D.hidden[SCANNER])
foundVirus = 1
holder = patient.hud_list[HEALTH_HUD]
if(patient.stat == 2)
holder.icon_state = "hudhealth-100"
client.images += holder
else
holder.icon_state = "hud[RoundHealth(patient.health)]"
client.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
holder.icon_state = "hudhealthy"
client.images += holder
/mob/living/silicon/pai/proc/RoundHealth(health)
switch(health)
if(100 to INFINITY)
return "health100"
if(70 to 100)
return "health80"
if(50 to 70)
return "health60"
if(30 to 50)
return "health40"
if(20 to 30)
return "health25"
if(5 to 15)
return "health10"
if(1 to 5)
return "health1"
if(-99 to 0)
return "health0"
else
return "health-100"
return "0"

View File

@@ -10,10 +10,10 @@
cable = null
regular_hud_updates()
if(src.secHUD == 1)
src.securityHUD()
if(src.medHUD == 1)
src.medicalHUD()
if(secHUD == 1)
process_data_hud(src, DATA_HUD_SECURITY,DATA_HUD_ADVANCED)
if(medHUD == 1)
process_data_hud(src, DATA_HUD_MEDICAL,DATA_HUD_ADVANCED)
if(silence_time)
if(world.timeofday >= silence_time)
silence_time = null

View File

@@ -165,12 +165,10 @@
if(see_override)
see_invisible = see_override
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)
regular_hud_updates() //Handles MED/SEC HUDs for borgs.
var/obj/item/borg/sight/hud/hud = (locate(/obj/item/borg/sight/hud) in src)
if(hud && hud.hud) hud.hud.process_hud(src)
if(sensor_mode)
process_data_hud(src,sensor_mode,DATA_HUD_ADVANCED)
if (src.healths)
if (src.stat != 2)

View File

@@ -76,7 +76,6 @@
/obj/item/weapon/robot_module/medical/New()
..()
modules += new /obj/item/borg/sight/hud/med(src)
modules += new /obj/item/device/healthanalyzer(src)
modules += new /obj/item/weapon/reagent_containers/borghypo(src)
modules += new /obj/item/weapon/reagent_containers/glass/beaker/large(src)
@@ -146,7 +145,6 @@
/obj/item/weapon/robot_module/security/New()
..()
modules += new /obj/item/borg/sight/hud/sec(src)
modules += new /obj/item/weapon/handcuffs/cyborg(src)
modules += new /obj/item/weapon/melee/baton/loaded(src)
modules += new /obj/item/weapon/gun/energy/taser/cyborg(src)

View File

@@ -15,6 +15,8 @@
var/lawcheck[1]
var/ioncheck[1]
var/sensor_mode = 0 //Determines the current HUD.
/mob/living/silicon/proc/cancelAlarm()
return
@@ -314,3 +316,17 @@
/mob/living/silicon/assess_threat() //Secbots won't hunt silicon units
return -10
/mob/living/silicon/verb/sensor_mode()
set name = "Set Sensor Augmentation"
var/sensor_type = input("Please select sensor type.", "Sensor Integration", null) in list("Security", "Medical","Disable")
switch(sensor_type)
if ("Security")
sensor_mode = DATA_HUD_SECURITY
src << "<span class='notice'>Security records overlay enabled.</span>"
if ("Medical")
sensor_mode = DATA_HUD_MEDICAL
src << "<span class='notice'>Life signs monitor overlay enabled.</span>"
if ("Disable")
sensor_mode = 0
src << "Sensor augmentations disabled."

View File

@@ -461,7 +461,9 @@ proc/is_special_character(mob/M) // returns 1 for special characters and 2 for h
/proc/broadcast_hud_message(var/message, var/broadcast_source)
var/turf/sourceturf = get_turf(broadcast_source)
for(var/mob/living/carbon/human/human in mob_list)
var/turf/humanturf = get_turf(human)
if((humanturf.z == sourceturf.z) && istype(human.glasses, /obj/item/clothing/glasses/hud/security))
human.show_message("<span class='info'>\icon[human.glasses] [message]</span>", 1)
var/user_list = sec_hud_users //A local var is used for easy addition of other HUD types.
var/hud_icon = /obj/item/weapon/handcuffs //Icon displayed when the HUD triggered. Handcuffs for Sec HUDs.
for(var/mob/hud_user in user_list)
var/turf/userturf = get_turf(hud_user)
if(userturf.z == sourceturf.z) //Must have same z-level.
hud_user.show_message("<span class='info'>\icon[hud_icon] [message]</span>", 1)

View File

@@ -7,6 +7,7 @@
# NOTE: if the rank-name cannot be found in admin_ranks.txt, they will not be adminned! ~Carn #
# NOTE: syntax was changed to allow hyphenation of ranknames, since spaces are stripped. #
###############################################################################################
Gun Hog = Game Master
razharas = Game Master
Niknakflak = Game Master
rolan7 = Game Master

View File

@@ -225,6 +225,7 @@
#include "code\game\atoms.dm"
#include "code\game\atoms_movable.dm"
#include "code\game\communications.dm"
#include "code\game\data_huds.dm"
#include "code\game\dna.dm"
#include "code\game\say.dm"
#include "code\game\shuttle_engines.dm"
@@ -1043,7 +1044,6 @@
#include "code\modules\mob\living\silicon\ai\freelook\update_triggers.dm"
#include "code\modules\mob\living\silicon\pai\death.dm"
#include "code\modules\mob\living\silicon\pai\examine.dm"
#include "code\modules\mob\living\silicon\pai\hud.dm"
#include "code\modules\mob\living\silicon\pai\life.dm"
#include "code\modules\mob\living\silicon\pai\pai.dm"
#include "code\modules\mob\living\silicon\pai\personality.dm"