Giacom's suggestions + Borg HUD tweak

- Both HUD procs broken in to several smaller procs.
- Added defines so the arguments to process_data_hud() are clear.
- Several other tweaks to data_huds.dm
- Made the sensor mode defines match the data hud ones.
- Gave borgies a HUD button for sensor modes instead a verb, to be in
line with the AI.
This commit is contained in:
GunHog
2014-09-02 18:32:06 -05:00
parent 965f4feb9a
commit b1fefb6bb1
9 changed files with 153 additions and 117 deletions

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

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

@@ -8,10 +8,8 @@ mob/proc/regular_hud_updates() //Used in the life.dm of mobs that can use HUDs.
for(var/image/hud in client.images)
if(copytext(hud.icon_state,1,4) == "hud")
client.images -= hud
if(src in med_hud_users)
med_hud_users -= src
if(src in sec_hud_users)
sec_hud_users -= src
med_hud_users -= src
sec_hud_users -= src
//Medical HUD procs
@@ -39,105 +37,145 @@ proc/RoundHealth(health)
return "health-100"
return "0"
//Medical HUD outputs. Called by the Life() proc of the mob using it, usually.
proc/process_med_hud(var/mob/M,var/local_scanner,var/mob/eye)
/*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
if(!(M in med_hud_users))
med_hud_users += M
var/client/C = M.client
var/image/holder
var/turf/T
if(eye)
T = get_turf(eye)
else
T = get_turf(M)
for(var/mob/living/carbon/human/patient in range(T))
if(!local_scanner) //Used for the AI's MedHUD, only works if the patient has activated suit sensors.
if(istype(patient.w_uniform, /obj/item/clothing/under))
var/obj/item/clothing/under/U = patient.w_uniform
if(U.sensor_mode < 2)
continue
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
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
//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/advanced_mode,var/mob/eye)
if(!M)
return
if(!M.client)
return
if(!(M in sec_hud_users))
sec_hud_users += M
var/client/C = M.client
proc/sec_hud_get_security_status(var/client/C, var/mob/living/carbon/human/perp)
var/image/holder
var/turf/T
if(eye)
T = get_turf(eye)
else
T = get_turf(M)
for(var/mob/living/carbon/human/perp in range(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())]"
C.images += holder
if(advanced_mode) //If not set, the Sec HUD will only display the job.
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("Released") holder.icon_state = "hudreleased"
else
continue
C.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
return
C.images += holder

View File

@@ -28,7 +28,7 @@
/obj/item/clothing/glasses/hud/health/process_hud(var/mob/M)
process_med_hud(M, 1)
process_data_hud(M,DATA_HUD_MEDICAL,DATA_HUD_ADVANCED)
/obj/item/clothing/glasses/hud/health/night
@@ -72,4 +72,4 @@
invis_view = 2
/obj/item/clothing/glasses/hud/security/process_hud(var/mob/M)
process_sec_hud(M,1)
process_data_hud(M,DATA_HUD_SECURITY,DATA_HUD_ADVANCED)

View File

@@ -164,11 +164,9 @@
theAPC = null
regular_hud_updates()
switch(src.sensor_mode)
if (SEC_HUD)
process_sec_hud(src,0,src.eyeobj)
if (MED_HUD)
process_med_hud(src,0,src.eyeobj)
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)

View File

@@ -10,10 +10,10 @@
cable = null
regular_hud_updates()
if(src.secHUD == 1)
process_sec_hud(src, 1)
if(src.medHUD == 1)
process_med_hud(src, 1)
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

@@ -167,11 +167,8 @@
regular_hud_updates() //Handles MED/SEC HUDs for borgs.
switch(sensor_mode)
if (SEC_HUD)
process_sec_hud(src, 1)
if (MED_HUD)
process_med_hud(src, 1)
if(sensor_mode)
process_data_hud(src,sensor_mode,DATA_HUD_ADVANCED)
if (src.healths)
if (src.stat != 2)

View File

@@ -1038,11 +1038,6 @@
checklaws()
/mob/living/silicon/robot/sensor_mode() //Medical/Security HUD controller for borgs
set category = "Robot Commands"
set desc = "Augment visual feed with internal sensor overlays."
..()
/mob/living/silicon/robot/proc/deconstruct()
var/turf/T = get_turf(src)
if (robot_suit)

View File

@@ -16,8 +16,6 @@
var/ioncheck[1]
var/sensor_mode = 0 //Determines the current HUD.
#define SEC_HUD 1 //Security HUD mode
#define MED_HUD 2 //Medical HUD mode
/mob/living/silicon/proc/cancelAlarm()
return
@@ -321,10 +319,10 @@
var/sensor_type = input("Please select sensor type.", "Sensor Integration", null) in list("Security", "Medical","Disable")
switch(sensor_type)
if ("Security")
sensor_mode = SEC_HUD
sensor_mode = DATA_HUD_SECURITY
src << "<span class='notice'>Security records overlay enabled.</span>"
if ("Medical")
sensor_mode = MED_HUD
sensor_mode = DATA_HUD_MEDICAL
src << "<span class='notice'>Life signs monitor overlay enabled.</span>"
if ("Disable")
sensor_mode = 0