Files
Bubberstation/code/game/data_huds.dm
XDTM d9e691f393 [Ready] [Reviewed] Nanites 2 (#37922)
* Adds programmable nanites to robotics

* Oh yeah i might want to actually PR the files

* nanite injectors, nanite printer, nanite analyzer

* We're back

* remove some reagent stuff

* more removal

* those too

* cool icons!

* might pass travis now

* lotsa code

* tgui fixes/misc fixes

* WE'RE FUNCTIONAL BOYS

* some ui stuff

* Misc fixes, cloud update, access nanites

* activation check

* stuff

* preparing for new chamber sprite

* Physical backups, sensor nanite programs

* techweb sensor nanites

* fix

* include

* fix again

* revert

* blinding nanites

* minor change

* minor tweaks

* makes minor shocks interfere with nanites

* fix

* split trigger file into the others, for consistency

* cleanup, added mindshield nanites to techwebs

* include n all

* how'd that even happen

* Fixed HUD, readded missing remote icon, added nanite scanner, health analyzers can now detect nanites, added stealth program

* cost tweaks

* better term

* new icon! by MrDoomBringer

* icons/tweaks

* tgui build

* boards

* fix

* fixes implants not updating mindshield status

* move implant hud to living

* new remote sprite

* scanner sprite

* biotype checks

* some nerfs

* new open chamber sprite

* Fixes mindshield implants not updating the HUD, fixes uninstalling always removing the first program, adds 25% and 75% health sensors

* correction

* nerfs antistun nanites

* fixes scanners and minor tweaks

* fixes revs with mindshield

* oh yeah haha

* Fixes wonky techweb

* Moves pyro program to weapon node

* Adds defib program and some investigate logging

* mistype

* fix

* fix2

* save your files before committing

* emps can desync from cloud

* pretty outdated

* Cloud backups are now tied to the cloud consoles; you can no longer build a new console to access existing backups.

* UI fix

* more fix

* okay fix for real

* tested and working

* Extra Settings rework, sensor nanites vastly better

* non-unique glitches

* Public chamber, extra settings rework, new sensors, speech program

* Mute and mind control nanites

* mind control into hazard

* better description

* fixes

* fixes relay nanites

* fixes TK access

* mind control costs less

* UI update

* removed pointless code bit

* tgui build

* compiles

* dammit

* paralysis keeps victim upright

* Adds sounds to consoles

* some feedback for some subtle effects

* new chem lore

* Viral nanite customization

* fix

* tgui build

* Added mitosis nanites

* removes glitched nanites from techwebs

* Added flesh eating nanites, poison nanites, hallucination nanites

* ,

* #traviscoding

* Adds memory leak, renames nanite roam node to nanite smart

* Voice sensor + some techweb desc tweaks

* hallucination and Hear() fix

* changes signal registering to the new method

* 75% done, i think

* should be all

* more fix

* more changes

* okay should be fine now

* ninja

* inheritance

* i don't care about originality!

* line endings

* line endings 2

* maybe

* fixes program installation

* new review

* line endings?

* line endings??

* line endings???

* wait do i even use this

* fixes public nanite chamber cloud id

* maint overlay for chambers

* args doesn't work well here

* antiabuse checks

* compile tho

* fixes locked remotes

* disk renaming

* skull echo nanites

* self scan program

* Condenses a lot of sensors into a few generic but customizable versions

* fixes machinery runtimes. Hacky, but a proper fix would likely require a refactor of machinery typing.

* forgot to save

* empty

* metastation nanite lab

* Removes duplicate APC

* fix for nanite chamber

* Raise max programs

* UI Tweaks, aggr. replication rebalance, minor fixes

* let's not do that again

* Fixes nanites meta merge conflict

* Merge conflict v2

* fuck this HDD is slow

* What the fuck did you just fucking say about me, you little leaf? I'll have you know I graduated top of my class in the Lawyer School, and I've been involved in numerous secret DMCA raids. I am trained in law violations warfare and you are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on BYOND, mark my fucking words. You think you can get away with changing the code? Think again, fucker. As we speak I am contacting my secret network of attorneys in the Fox and your IP is being traced right now so you better prepare for an outstanding warrant, maggot. The storm that wipes out the pathetic little thing you call your leaked code. You're fucking done, kid. I can file for an injunction anywhere, anytime, and I can take legal actions in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the Florida Statute and I will use it to its full extent to wipe your miserable ass off the face of Canada, you little shit. If only you could have known what unholy retribution your little "clever" action was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will send you to spend time in a Florida State Penitentiary if you ever decide to travel from Canada to the U.S. You're fucking done, kiddo.

* Adds virus symptoms that interact with nanites

* Fixes spreading nanites being more infective the more protection the victims have

* Review plus public chamber tweak

* . = ..()

* ball

* cloud

* . = ..()

* always press save all before committing

* missed a couple
2018-08-20 14:46:04 +03:00

503 lines
16 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 GLOB.huds)
hud.add_to_hud(src)
/atom/proc/remove_from_all_data_huds()
for(var/datum/atom_hud/data/hud in GLOB.huds)
hud.remove_from_hud(src)
/datum/atom_hud/data
/datum/atom_hud/data/human/medical
hud_icons = list(STATUS_HUD, HEALTH_HUD, NANITE_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 <= SENSOR_VITALS)
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, NANITE_HUD)
/datum/atom_hud/data/diagnostic
/datum/atom_hud/data/diagnostic/basic
hud_icons = list(DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD, DIAG_BOT_HUD, DIAG_CIRCUIT_HUD, DIAG_TRACK_HUD, DIAG_AIRLOCK_HUD, DIAG_NANITE_FULL_HUD)
/datum/atom_hud/data/diagnostic/advanced
hud_icons = list(DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD, DIAG_BOT_HUD, DIAG_CIRCUIT_HUD, DIAG_TRACK_HUD, DIAG_AIRLOCK_HUD, DIAG_NANITE_FULL_HUD, DIAG_PATH_HUD)
/datum/atom_hud/data/bot_path
hud_icons = list(DIAG_PATH_HUD)
/datum/atom_hud/abductor
hud_icons = list(GLAND_HUD)
/datum/atom_hud/sentient_disease
hud_icons = list(SENTIENT_DISEASE_HUD)
/datum/atom_hud/ai_detector
hud_icons = list(AI_DETECT_HUD)
/datum/atom_hud/ai_detector/add_hud_to(mob/M)
..()
if(M && (hudusers.len == 1))
for(var/V in GLOB.aiEyes)
var/mob/camera/aiEye/E = V
E.update_ai_detect_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()
var/threat
for(var/thing in diseases)
var/datum/disease/D = thing
if(!(D.visibility_flags & HIDDEN_SCANNER))
if(!threat || D.severity > threat) //a buffing virus gets an icon
threat = D.severity
return threat
//helper for getting the appropriate health status
/proc/RoundHealth(mob/living/M)
if(M.stat == DEAD || (M.has_trait(TRAIT_FAKEDEATH)))
return "health-100" //what's our health? it doesn't matter, we're dead, or faking
var/maxi_health = M.maxHealth
if(iscarbon(M) && M.health < 0)
maxi_health = 100 //so crit shows up right for aliens and other high-health carbon mobs; noncarbons don't have crit.
var/resulthealth = (M.health / maxi_health) * 100
switch(resulthealth)
if(100 to INFINITY)
return "health100"
if(90.625 to 100)
return "health93.75"
if(84.375 to 90.625)
return "health87.5"
if(78.125 to 84.375)
return "health81.25"
if(71.875 to 78.125)
return "health75"
if(65.625 to 71.875)
return "health68.75"
if(59.375 to 65.625)
return "health62.5"
if(53.125 to 59.375)
return "health56.25"
if(46.875 to 53.125)
return "health50"
if(40.625 to 46.875)
return "health43.75"
if(34.375 to 40.625)
return "health37.5"
if(28.125 to 34.375)
return "health31.25"
if(21.875 to 28.125)
return "health25"
if(15.625 to 21.875)
return "health18.75"
if(9.375 to 15.625)
return "health12.5"
if(1 to 9.375)
return "health6.25"
if(-50 to 1)
return "health0"
if(-85 to -50)
return "health-50"
if(-99 to -85)
return "health-85"
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 = GLOB.huds[DATA_HUD_MEDICAL_BASIC]
B.update_suit_sensors(src)
//called when a living mob changes health
/mob/living/proc/med_hud_set_health()
var/image/holder = hud_list[HEALTH_HUD]
holder.icon_state = "hud[RoundHealth(src)]"
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
//for carbon suit sensors
/mob/living/carbon/med_hud_set_health()
..()
//called when a carbon changes stat, virus or XENO_HOST
/mob/living/proc/med_hud_set_status()
var/image/holder = hud_list[STATUS_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
if(stat == DEAD || (has_trait(TRAIT_FAKEDEATH)))
holder.icon_state = "huddead"
else
holder.icon_state = "hudhealthy"
/mob/living/carbon/med_hud_set_status()
var/image/holder = hud_list[STATUS_HUD]
var/icon/I = icon(icon, icon_state, dir)
var/virus_threat = check_virus()
holder.pixel_y = I.Height() - world.icon_size
if(has_trait(TRAIT_XENO_HOST))
holder.icon_state = "hudxeno"
else if(stat == DEAD || (has_trait(TRAIT_FAKEDEATH)))
if(tod)
var/tdelta = round(world.time - timeofdeath)
if(tdelta < (DEFIB_TIME_LIMIT * 10))
holder.icon_state = "huddefib"
return
holder.icon_state = "huddead"
else
switch(virus_threat)
if(DISEASE_SEVERITY_BIOHAZARD)
holder.icon_state = "hudill5"
if(DISEASE_SEVERITY_DANGEROUS)
holder.icon_state = "hudill4"
if(DISEASE_SEVERITY_HARMFUL)
holder.icon_state = "hudill3"
if(DISEASE_SEVERITY_MEDIUM)
holder.icon_state = "hudill2"
if(DISEASE_SEVERITY_MINOR)
holder.icon_state = "hudill1"
if(DISEASE_SEVERITY_NONTHREAT)
holder.icon_state = "hudill0"
if(DISEASE_SEVERITY_POSITIVE)
holder.icon_state = "hudbuff"
if(null)
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]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
holder.icon_state = "hudno_id"
if(wear_id)
holder.icon_state = "hud[ckey(wear_id.GetJobName())]"
sec_hud_set_security_status()
/mob/living/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/implant/I in implants)
if(istype(I, /obj/item/implant/tracking))
holder = hud_list[IMPTRACK_HUD]
var/icon/IC = icon(icon, icon_state, dir)
holder.pixel_y = IC.Height() - world.icon_size
holder.icon_state = "hud_imp_tracking"
else if(istype(I, /obj/item/implant/chem))
holder = hud_list[IMPCHEM_HUD]
var/icon/IC = icon(icon, icon_state, dir)
holder.pixel_y = IC.Height() - world.icon_size
holder.icon_state = "hud_imp_chem"
if(has_trait(TRAIT_MINDSHIELD))
holder = hud_list[IMPLOYAL_HUD]
var/icon/IC = icon(icon, icon_state, dir)
holder.pixel_y = IC.Height() - world.icon_size
holder.icon_state = "hud_imp_loyal"
/mob/living/carbon/human/proc/sec_hud_set_security_status()
var/image/holder = hud_list[WANTED_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
var/perpname = get_face_name(get_id_name(""))
if(perpname && GLOB.data_core)
var/datum/data/record/R = find_record("name", perpname, GLOB.data_core.security)
if(R)
switch(R.fields["criminal"])
if("*Arrest*")
holder.icon_state = "hudwanted"
return
if("Incarcerated")
holder.icon_state = "hudincarcerated"
return
if("Paroled")
holder.icon_state = "hudparolled"
return
if("Discharged")
holder.icon_state = "huddischarged"
return
holder.icon_state = null
/***********************************************
Diagnostic HUDs!
************************************************/
/mob/living/proc/hud_set_nanite_indicator()
var/image/holder = hud_list[NANITE_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
holder.icon_state = null
if(src in SSnanites.nanite_monitored_mobs)
holder.icon_state = "nanite_ping"
//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]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
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]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
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]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
if(cell)
var/chargelvl = (cell.charge/cell.maxcharge)
holder.icon_state = "hudbatt[RoundDiagBar(chargelvl)]"
else
holder.icon_state = "hudnobatt"
//borg-AI shell tracking
/mob/living/silicon/robot/proc/diag_hud_set_aishell() //Shows tracking beacons on the mech
var/image/holder = hud_list[DIAG_TRACK_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
if(!shell) //Not an AI shell
holder.icon_state = null
else if(deployed) //AI shell in use by an AI
holder.icon_state = "hudtrackingai"
else //Empty AI shell
holder.icon_state = "hudtracking"
//AI side tracking of AI shell control
/mob/living/silicon/ai/proc/diag_hud_set_deployed() //Shows tracking beacons on the mech
var/image/holder = hud_list[DIAG_TRACK_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
if(!deployed_shell)
holder.icon_state = null
else //AI is currently controlling a shell
holder.icon_state = "hudtrackingai"
/*~~~~~~~~~~~~~~~~~~~~
BIG STOMPY MECHS
~~~~~~~~~~~~~~~~~~~~~*/
/obj/mecha/proc/diag_hud_set_mechhealth()
var/image/holder = hud_list[DIAG_MECH_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
holder.icon_state = "huddiag[RoundDiagBar(obj_integrity/max_integrity)]"
/obj/mecha/proc/diag_hud_set_mechcell()
var/image/holder = hud_list[DIAG_BATT_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
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]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
holder.icon_state = null
if(internal_damage)
holder.icon_state = "hudwarn"
/obj/mecha/proc/diag_hud_set_mechtracking() //Shows tracking beacons on the mech
var/image/holder = hud_list[DIAG_TRACK_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
var/new_icon_state //This var exists so that the holder's icon state is set only once in the event of multiple mech beacons.
for(var/obj/item/mecha_parts/mecha_tracking/T in trackers)
if(T.ai_beacon) //Beacon with AI uplink
new_icon_state = "hudtrackingai"
break //Immediately terminate upon finding an AI beacon to ensure it is always shown over the normal one, as mechs can have several trackers.
else
new_icon_state = "hudtracking"
holder.icon_state = new_icon_state
/*~~~~~~~~~
Bots!
~~~~~~~~~~*/
/mob/living/simple_animal/bot/proc/diag_hud_set_bothealth()
var/image/holder = hud_list[DIAG_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
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]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
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]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
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 = ""
/*~~~~~~~~~~~~
Circutry!
~~~~~~~~~~~~~*/
/obj/item/electronic_assembly/proc/diag_hud_set_circuithealth(hide = FALSE)
var/image/holder = hud_list[DIAG_CIRCUIT_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
if((!isturf(loc))||hide) //if not on the ground dont show overlay
holder.icon_state = null
else
holder.icon_state = "huddiag[RoundDiagBar(obj_integrity/max_integrity)]"
/obj/item/electronic_assembly/proc/diag_hud_set_circuitcell(hide = FALSE)
var/image/holder = hud_list[DIAG_BATT_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
if((!isturf(loc))||hide) //if not on the ground dont show overlay
holder.icon_state = null
else if(battery)
var/chargelvl = battery.charge/battery.maxcharge
holder.icon_state = "hudbatt[RoundDiagBar(chargelvl)]"
else
holder.icon_state = "hudnobatt"
/obj/item/electronic_assembly/proc/diag_hud_set_circuitstat(hide = FALSE) //On, On and dangerous, or Off
var/image/holder = hud_list[DIAG_STAT_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
if((!isturf(loc))||hide) //if not on the ground don't show overlay
holder.icon_state = null
else if(!battery)
holder.icon_state = "hudoffline"
else if(battery.charge == 0)
holder.icon_state = "hudoffline"
else if(combat_circuits) //has a circuit that can harm people
holder.icon_state = prefered_hud_icon + "-red"
else //Bot is on and not dangerous
holder.icon_state = prefered_hud_icon
/obj/item/electronic_assembly/proc/diag_hud_set_circuittracking(hide = FALSE)
var/image/holder = hud_list[DIAG_TRACK_HUD]
var/icon/I = icon(icon, icon_state, dir)
holder.pixel_y = I.Height() - world.icon_size
if((!isturf(loc))||hide) //if not on the ground dont show overlay
holder.icon_state = null
else if(long_range_circuits)
holder.icon_state = "hudtracking"
else
holder.icon_state = null
/*~~~~~~~~~~~~
Airlocks!
~~~~~~~~~~~~~*/
/obj/machinery/door/airlock/proc/diag_hud_set_electrified()
var/image/holder = hud_list[DIAG_AIRLOCK_HUD]
if(secondsElectrified != 0)
holder.icon_state = "electrified"
else
holder.icon_state = ""