Files
Bubberstation/code/game/data_huds.dm
phil235 81ce777ec2 - you now only see turfs when inside gas pipes.
- I renamed some vars of datum/hud to be more selfexplanatory
- Moved all datum/hud mob code into the hud folder.
- fixed alien's zone selection button not using the correct sprites.
- I removed the update_hud() proc (that needed to be removed).
- Fixed a typo in /mob/living/carbon/ContractDisease , using "internals" instead of "internal" (very different things)
- Fixed doTeleport() calling Entered() twice on the destination area.
- To reference a mob's selected zone, you now use a direct mob var ("H.zone_selected" instead of "H.zone_sel.selecting")
- mobs lose certain screen objects var ("healths", "zone_sel", "internals", etc) which are now vars of the mob's datum/hud instead.
- the Blind spell is now done via the blind mutation instead of the blind disabilities.
- Give to mobs a version of forceMove(), so the mob is always properly unbuckled, his pull stopped, his vision updated, etc.
- The "user" var of mob/camera/aiEye/remote is renamed to "eye_user" to avoid confusion.
- reset_view() is replaced by reset_perspective(). Now all changes to client.eye and client.perspective are done with this proc.
- I reworked /obj/machinery/computer/security code, changing camera is instantaneous now, as well as cancelling.
- I reworked /obj/machinery/computer/camera_advanced code as well.
- I changed /obj/item/mecha_parts/mecha_equipment/mining_scanner's meson view to be constant instead of by intermittent.
- Fixes not being able to use /obj/item/device/camera_bug while buckled.
- removed admin_forcemove() proc, admin force moving now uses forceMove() simply.
- Removed the client var "adminobs"
- Added var/vision_correction to glasses.
- Added a thermal_overload() proc for glasses, to remove copypasta in emp_act code.
- Remove the hal_crit mob var
- We no longer delete the mob's hud everytime he logs in.
- Added a stat == dead check in mob's metabolize() so we immediately stop metabolizing if one of the chem kills the mob.
- Being inside disposal bin lowers your vision, like wearing a welding helmet.
- removed the remote_view mob var.
- I changed advanced camera EYE, some fixes, removed unnecessary code when the eye moves, now the mob client eye properly follows the camera mob.
- fixes mob var "machine" not being nullified on logout.
- larva/death() was calling two "living_mob_list -= src"
- I made the Blind screen objects into a global_hud instead of giving one to each mob (like damage overlay).
- I untied tint and eye_blind, TINT_BLIND doesn't give you eye_blind=1.
- gave a visual overlay when inside locker (vimpaired)
- when inside disposal/gas pipes you get sight |= (BLIND|SEE_TURFS)
- glasses toggling updates (atmos meson toggle): DONE
- The new adjust procs serve to properly change eye_blind etc and call vision update procs when needed.
- I added an on_unset_machine() proc to handle perspective reset for camera consoles.
- I moved consequences of eye_check fail inside eye_check() procs themselves.
- I fixed vision updates being fucked by forceMove, especially pipe vision.
- I decided that damage overlay not appearing when dead.
- mob's hud_used is no longer deleted on each login()
- I refactored mob huds a bit, creating subtypes for each mob (/datum/hud/human)
- f12's hud toggling is now available to all mobs
- gave borgs a low_power_mode var so unpowered borg do not use stat= UNCONSCIOUS (which made things weird since you were unconscious but not blind)
- Fixed double Area entering when forced teleporting.
- I fixed larva pulling not being broken when cuffing them, and larva not seeing handcuff alert (and they can resist by clicking it)
- I removed pull updates from life() since it onyl checked for puller's incapacitation.
- I renamed camera/deactivate() to toggle_cam() to be more accurate.
- I fixed mmi brain being immortal (by removing the brain and putting it back)
- I simplified mmi brain emp damage.
2016-02-04 00:33:16 +01:00

288 lines
8.1 KiB
Plaintext

/*
* Data HUDs have been rewritten in a more generic way.
* In short, they now use an observer-listener pattern.
* See code/datum/hud.dm for the generic hud datum.
* Update the HUD icons when needed with the appropriate hook. (see below)
*/
/* DATA HUD DATUMS */
/atom/proc/add_to_all_human_data_huds()
for(var/datum/atom_hud/data/human/hud in huds) hud.add_to_hud(src)
/atom/proc/remove_from_all_data_huds()
for(var/datum/atom_hud/data/hud in huds) hud.remove_from_hud(src)
/datum/atom_hud/data
/datum/atom_hud/data/human/medical
hud_icons = list(HEALTH_HUD, STATUS_HUD)
/datum/atom_hud/data/human/medical/basic
/datum/atom_hud/data/human/medical/basic/proc/check_sensors(mob/living/carbon/human/H)
if(!istype(H)) return 0
var/obj/item/clothing/under/U = H.w_uniform
if(!istype(U)) return 0
if(U.sensor_mode <= 2) return 0
return 1
/datum/atom_hud/data/human/medical/basic/add_to_single_hud(mob/M, mob/living/carbon/H)
if(check_sensors(H))
..()
/datum/atom_hud/data/human/medical/basic/proc/update_suit_sensors(mob/living/carbon/H)
check_sensors(H) ? add_to_hud(H) : remove_from_hud(H)
/datum/atom_hud/data/human/medical/advanced
/datum/atom_hud/data/human/security
/datum/atom_hud/data/human/security/basic
hud_icons = list(ID_HUD)
/datum/atom_hud/data/human/security/advanced
hud_icons = list(ID_HUD, IMPTRACK_HUD, IMPLOYAL_HUD, IMPCHEM_HUD, WANTED_HUD)
/datum/atom_hud/data/diagnostic
hud_icons = list (DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD, DIAG_BOT_HUD)
/* MED/SEC/DIAG HUD HOOKS */
/*
* THESE HOOKS SHOULD BE CALLED BY THE MOB SHOWING THE HUD
*/
/***********************************************
Medical HUD! Basic mode needs suit sensors on.
************************************************/
//HELPERS
//called when a carbon changes virus
/mob/living/carbon/proc/check_virus()
for(var/datum/disease/D in viruses)
if((!(D.visibility_flags & HIDDEN_SCANNER)) && (D.severity != NONTHREAT))
return 1
return 0
//helper for getting the appropriate health status
/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"
//HOOKS
//called when a human changes suit sensors
/mob/living/carbon/proc/update_suit_sensors()
var/datum/atom_hud/data/human/medical/basic/B = huds[DATA_HUD_MEDICAL_BASIC]
B.update_suit_sensors(src)
var/turf/T = get_turf(src)
if (T) crewmonitor.queueUpdate(T.z)
//called when a carbon changes health
/mob/living/carbon/proc/med_hud_set_health()
var/image/holder = hud_list[HEALTH_HUD]
if(stat == DEAD)
holder.icon_state = "hudhealth-100"
else
holder.icon_state = "hud[RoundHealth(health)]"
var/turf/T = get_turf(src)
if (T)
crewmonitor.queueUpdate(T.z)
//called when a carbon changes stat, virus or XENO_HOST
/mob/living/carbon/proc/med_hud_set_status()
var/image/holder = hud_list[STATUS_HUD]
if(stat == DEAD)
holder.icon_state = "huddead"
else if(status_flags & XENO_HOST)
holder.icon_state = "hudxeno"
else if(check_virus())
holder.icon_state = "hudill"
else
holder.icon_state = "hudhealthy"
/***********************************************
Security HUDs! Basic mode shows only the job.
************************************************/
//HOOKS
/mob/living/carbon/human/proc/sec_hud_set_ID()
var/image/holder = hud_list[ID_HUD]
holder.icon_state = "hudno_id"
if(wear_id)
holder.icon_state = "hud[ckey(wear_id.GetJobName())]"
sec_hud_set_security_status()
var/turf/T = get_turf(src)
if (T) crewmonitor.queueUpdate(T.z)
/mob/living/carbon/human/proc/sec_hud_set_implants()
var/image/holder
for(var/i in list(IMPTRACK_HUD, IMPLOYAL_HUD, IMPCHEM_HUD))
holder = hud_list[i]
holder.icon_state = null
for(var/obj/item/weapon/implant/I in src)
if(I.implanted)
if(istype(I,/obj/item/weapon/implant/tracking))
holder = hud_list[IMPTRACK_HUD]
holder.icon_state = "hud_imp_tracking"
else if(istype(I,/obj/item/weapon/implant/loyalty))
holder = hud_list[IMPLOYAL_HUD]
holder.icon_state = "hud_imp_loyal"
else if(istype(I,/obj/item/weapon/implant/chem))
holder = hud_list[IMPCHEM_HUD]
holder.icon_state = "hud_imp_chem"
/mob/living/carbon/human/proc/sec_hud_set_security_status()
var/image/holder = hud_list[WANTED_HUD]
var/perpname = get_face_name(get_id_name(""))
if(perpname)
var/datum/data/record/R = find_record("name", perpname, data_core.security)
if(R)
switch(R.fields["criminal"])
if("*Arrest*")
holder.icon_state = "hudwanted"
return
if("Incarcerated")
holder.icon_state = "hudincarcerated"
return
if("Parolled")
holder.icon_state = "hudparolled"
return
if("Discharged")
holder.icon_state = "huddischarged"
return
holder.icon_state = null
/***********************************************
Diagnostic HUDs!
************************************************/
//For Diag health and cell bars!
/proc/RoundDiagBar(value)
switch(value * 100)
if(95 to INFINITY)
return "max"
if(80 to 100)
return "good"
if(60 to 80)
return "high"
if(40 to 60)
return "med"
if(20 to 40)
return "low"
if(1 to 20)
return "crit"
else
return "dead"
return "dead"
//Sillycone hooks
/mob/living/silicon/proc/diag_hud_set_health()
var/image/holder = hud_list[DIAG_HUD]
if(stat == DEAD)
holder.icon_state = "huddiagdead"
else
holder.icon_state = "huddiag[RoundDiagBar(health/maxHealth)]"
/mob/living/silicon/proc/diag_hud_set_status()
var/image/holder = hud_list[DIAG_STAT_HUD]
switch(stat)
if(CONSCIOUS)
holder.icon_state = "hudstat"
if(UNCONSCIOUS)
holder.icon_state = "hudoffline"
else
holder.icon_state = "huddead2"
//Borgie battery tracking!
/mob/living/silicon/robot/proc/diag_hud_set_borgcell()
var/image/holder = hud_list[DIAG_BATT_HUD]
if (cell)
var/chargelvl = (cell.charge/cell.maxcharge)
holder.icon_state = "hudbatt[RoundDiagBar(chargelvl)]"
else
holder.icon_state = "hudnobatt"
/*~~~~~~~~~~~~~~~~~~~~
BIG STOMPY MECHS
~~~~~~~~~~~~~~~~~~~~~*/
/obj/mecha/proc/diag_hud_set_mechhealth()
var/image/holder = hud_list[DIAG_MECH_HUD]
holder.icon_state = "huddiag[RoundDiagBar(health/initial(health))]"
/obj/mecha/proc/diag_hud_set_mechcell()
var/image/holder = hud_list[DIAG_BATT_HUD]
if (cell)
var/chargelvl = cell.charge/cell.maxcharge
holder.icon_state = "hudbatt[RoundDiagBar(chargelvl)]"
else
holder.icon_state = "hudnobatt"
/obj/mecha/proc/diag_hud_set_mechstat()
var/image/holder = hud_list[DIAG_STAT_HUD]
holder.icon_state = null
if(internal_damage)
holder.icon_state = "hudwarn"
/*~~~~~~~~~
Bots!
~~~~~~~~~~*/
/mob/living/simple_animal/bot/proc/diag_hud_set_bothealth()
var/image/holder = hud_list[DIAG_HUD]
holder.icon_state = "huddiag[RoundDiagBar(health/maxHealth)]"
/mob/living/simple_animal/bot/proc/diag_hud_set_botstat() //On (With wireless on or off), Off, EMP'ed
var/image/holder = hud_list[DIAG_STAT_HUD]
if(on)
holder.icon_state = "hudstat"
else if(stat) //Generally EMP causes this
holder.icon_state = "hudoffline"
else //Bot is off
holder.icon_state = "huddead2"
/mob/living/simple_animal/bot/proc/diag_hud_set_botmode() //Shows a bot's current operation
var/image/holder = hud_list[DIAG_BOT_HUD]
if(client) //If the bot is player controlled, it will not be following mode logic!
holder.icon_state = "hudsentient"
return
switch(mode)
if(BOT_SUMMON, BOT_RESPONDING) //Responding to PDA or AI summons
holder.icon_state = "hudcalled"
if(BOT_CLEANING, BOT_REPAIRING, BOT_HEALING) //Cleanbot cleaning, Floorbot fixing, or Medibot Healing
holder.icon_state = "hudworking"
if(BOT_PATROL, BOT_START_PATROL) //Patrol mode
holder.icon_state = "hudpatrol"
if(BOT_PREP_ARREST, BOT_ARREST, BOT_HUNT) //STOP RIGHT THERE, CRIMINAL SCUM!
holder.icon_state = "hudalert"
if(BOT_MOVING, BOT_DELIVER, BOT_GO_HOME, BOT_NAV) //Moving to target for normal bots, moving to deliver or go home for MULES.
holder.icon_state = "hudmove"
else
holder.icon_state = ""