Permalink
Browse files

Med/Sec bot Notifications, HUD updates, and tweaks!

  • Loading branch information...
1 parent 4551773 commit fd66ae86006673c87abe4a7d69f8e11e29db09ac @GunHog GunHog committed Aug 13, 2014
View
@@ -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\shuttle_engines.dm"
#include "code\game\skincmd.dm"
@@ -1025,7 +1026,6 @@
#include "code\modules\mob\living\silicon\decoy\life.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"
@@ -11,4 +11,6 @@ var/global/list/active_diseases = list()
var/global/list/chemical_reactions_list //list of all /datum/chemical_reaction datums. Used during chemical reactions
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/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
@@ -0,0 +1,134 @@
+/* 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
+ if(src in med_hud_users)
+ med_hud_users -= src
+ if(src in sec_hud_users)
+ 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"
+
+//Medical HUD outputs. Called by the Life() proc of the mob using it, usually.
+proc/process_med_hud(var/mob/M, var/mob/eye)
+ 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))
+ 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
+ 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 set, the SecHUD will display the implants a person has.
+ 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
@@ -63,6 +63,7 @@
/var/const/access_sec_doors = 63 // Security front doors
/var/const/access_mineral_storeroom = 64
/var/const/access_minisat = 65
+/var/const/access_weapons = 66 //Weapon authorization for secbots
//BEGIN CENTCOM ACCESS
/*Should leave plenty of room if we need to add more access levels.
@@ -201,7 +202,7 @@
access_tech_storage, access_chapel_office, access_atmospherics, access_kitchen,
access_bar, access_janitor, access_crematorium, access_robotics, access_cargo, access_construction,
access_hydroponics, access_library, access_lawyer, access_virology, access_cmo, access_qm, access_surgery,
- access_theatre, access_research, access_mining, access_mailsorting,
+ access_theatre, access_research, access_mining, access_mailsorting, access_weapons,
access_heads_vault, access_mining_station, access_xenobiology, access_ce, access_hop, access_hos, access_RC_announce,
access_keycard_auth, access_tcomsat, access_gateway, access_mineral_storeroom)
@@ -218,7 +219,7 @@
if(1) //station general
return list(access_kitchen,access_bar, access_hydroponics, access_janitor, access_chapel_office, access_crematorium, access_library, access_theatre, access_lawyer)
if(2) //security
- return list(access_sec_doors, access_security, access_brig, access_armory, access_forensics_lockers, access_court, access_hos)
+ return list(access_sec_doors, access_weapons, access_security, access_brig, access_armory, access_forensics_lockers, access_court, access_hos)
if(3) //medbay
return list(access_medical, access_genetics, access_morgue, access_chemistry, access_virology, access_surgery, access_cmo)
if(4) //research
@@ -376,6 +377,8 @@
return "Brig"
if(access_mineral_storeroom)
return "Mineral Storage"
+ if(access_weapons)
+ return "Weapon Permit"
/proc/get_centcom_access_desc(A) //Changing this to reflect the new sprites
switch(A)
@@ -73,13 +73,13 @@ Head of Personnel
assistant_access = list(access_heads)
assistant_title = "HoP's Assistant"
- access = list(access_security, access_sec_doors, access_brig, access_court, access_forensics_lockers,
+ access = list(access_security, access_sec_doors, access_brig, access_court, access_forensics_lockers, access_weapons,
access_medical, access_engine, access_change_ids, access_ai_upload, access_eva, access_heads,
access_all_personal_lockers, access_maint_tunnels, access_bar, access_janitor, access_construction, access_morgue,
access_crematorium, access_kitchen, access_cargo, access_cargo_bot, access_mailsorting, access_qm, access_hydroponics, access_lawyer,
access_theatre, access_chapel_office, access_library, access_research, access_mining, access_heads_vault, access_mining_station,
access_hop, access_RC_announce, access_keycard_auth, access_gateway, access_mineral_storeroom)
- minimal_access = list(access_security, access_sec_doors, access_court,
+ minimal_access = list(access_security, access_sec_doors, access_court, access_weapons,
access_medical, access_engine, access_change_ids, access_ai_upload, access_eva, access_heads,
access_all_personal_lockers, access_maint_tunnels, access_bar, access_janitor, access_construction, access_morgue,
access_crematorium, access_kitchen, access_cargo, access_cargo_bot, access_mailsorting, access_qm, access_hydroponics, access_lawyer,
@@ -15,7 +15,7 @@ Bartender
default_pda = /obj/item/device/pda/bar
default_headset = /obj/item/device/radio/headset/headset_srv
- access = list(access_hydroponics, access_bar, access_kitchen, access_morgue, access_mineral_storeroom)
+ access = list(access_hydroponics, access_bar, access_kitchen, access_morgue, access_mineral_storeroom, access_weapons)
minimal_access = list(access_bar, access_mineral_storeroom)
assistant_access = list(access_bar)
assistant_title = "Barista"
@@ -26,15 +26,15 @@ Head of Shitcurity
default_backpack = /obj/item/weapon/storage/backpack/security
default_satchel = /obj/item/weapon/storage/backpack/satchel_sec
- access = list(access_security, access_sec_doors, access_brig, access_armory, access_court,
+ access = list(access_security, access_sec_doors, access_brig, access_armory, access_court, access_weapons,
access_forensics_lockers, access_morgue, access_maint_tunnels, access_all_personal_lockers,
access_research, access_engine, access_mining, access_medical, access_construction, access_mailsorting,
access_heads, access_hos, access_RC_announce, access_keycard_auth, access_gateway)
- minimal_access = list(access_security, access_sec_doors, access_brig, access_armory, access_court,
+ minimal_access = list(access_security, access_sec_doors, access_brig, access_armory, access_court, access_weapons,
access_forensics_lockers, access_morgue, access_maint_tunnels, access_all_personal_lockers,
access_research, access_engine, access_mining, access_medical, access_construction, access_mailsorting,
access_heads, access_hos, access_RC_announce, access_keycard_auth, access_gateway)
- assistant_access = list(access_sec_doors, access_brig)
+ assistant_access = list(access_sec_doors, access_brig,access_weapons)
assistant_title = "HoS' Assistant"
/datum/job/hos/equip_items(var/mob/living/carbon/human/H)
@@ -77,8 +77,8 @@ Warden
default_satchel = /obj/item/weapon/storage/backpack/satchel_sec
access = list(access_security, access_sec_doors, access_brig, access_armory, access_court, access_maint_tunnels, access_morgue)
- minimal_access = list(access_security, access_sec_doors, access_brig, access_armory, access_court) //See /datum/job/warden/get_access()
- assistant_access = list(access_sec_doors, access_brig)
+ minimal_access = list(access_security, access_sec_doors, access_brig, access_armory, access_court, access_weapons) //See /datum/job/warden/get_access()
+ assistant_access = list(access_sec_doors, access_brig,access_weapons)
assistant_title = "Warden's Assistant"
/datum/job/warden/equip_items(var/mob/living/carbon/human/H)
@@ -122,9 +122,9 @@ Detective
default_pda = /obj/item/device/pda/detective
default_headset = /obj/item/device/radio/headset/headset_sec
- access = list(access_sec_doors, access_forensics_lockers, access_morgue, access_maint_tunnels, access_court)
- minimal_access = list(access_sec_doors, access_forensics_lockers, access_morgue, access_maint_tunnels, access_court)
- assistant_access = list(access_sec_doors, access_morgue)
+ access = list(access_sec_doors, access_forensics_lockers, access_morgue, access_maint_tunnels, access_court, access_weapons)
+ minimal_access = list(access_sec_doors, access_forensics_lockers, access_morgue, access_maint_tunnels, access_court, access_weapons)
+ assistant_access = list(access_sec_doors, access_morgue,access_weapons)
assistant_title = "Private Investigator"
/datum/job/detective/equip_items(var/mob/living/carbon/human/H)
@@ -173,9 +173,9 @@ Security Officer
default_backpack = /obj/item/weapon/storage/backpack/security
default_satchel = /obj/item/weapon/storage/backpack/satchel_sec
- access = list(access_security, access_sec_doors, access_brig, access_court, access_maint_tunnels, access_morgue)
- minimal_access = list(access_security, access_sec_doors, access_brig, access_court) //But see /datum/job/warden/get_access()
- assistant_access = list(access_sec_doors)
+ access = list(access_security, access_sec_doors, access_brig, access_court, access_maint_tunnels, access_morgue, access_weapons)
+ minimal_access = list(access_security, access_sec_doors, access_brig, access_court, access_weapons) //But see /datum/job/warden/get_access()
+ assistant_access = list(access_sec_doors,access_weapons)
assistant_title = "Security Cadet"
/datum/job/officer/equip_items(var/mob/living/carbon/human/H)
@@ -18,8 +18,9 @@
var/text_hack = "" //Custom text returned to a silicon upon hacking a bot.
var/text_dehack = "" //Text shown when resetting a bots hacked status to normal.
var/text_dehack_fail = "" //Shown when a silicon tries to reset a bot emagged with the emag item, which cannot be reset.
+ var/declare_message = "" //What the bot will display to the HUD user.
var/frustration = 0 //Used by some bots for tracking failures to reach their target.
- var/list/call_path = list() //Path calculated by the AI and given to the bot to follow.
+ var/list/call_path //Path calculated by the AI and given to the bot to follow.
var/list/path = new() //Every bot has this, so it is best to put it here.
var/list/patrol_path = list() //The path a bot has while on patrol.
var/list/summon_path = list() //Path bot has while summoned.
@@ -300,6 +301,20 @@
O.show_message("<span class='game say'><span class='name'>[src]</span> beeps, \"[message]\"</span>",2)
return
+/obj/machinery/bot/proc/declare() //Signals a medical or security HUD user to a relevant bot's activity.
+ var/hud_user_list = list() //Determines which userlist to use.
+ switch(bot_type) //Made into a switch so more HUDs can be added easily.
+ if(SEC_BOT) //Securitrons and ED-209
+ hud_user_list = sec_hud_users
+ if(MED_BOT) //Medibots
+ hud_user_list = med_hud_users
+ var/area/myturf = get_turf(src)
+ for(var/mob/huduser in hud_user_list)
+ var/turf/mobturf = get_turf(huduser)
+ if(mobturf.z == myturf.z)
+ huduser.show_message(declare_message,1)
+
+
/obj/machinery/bot/proc/check_bot_access()
if(mode != BOT_SUMMON && mode != BOT_RESPONDING)
botcard.access = prev_access
Oops, something went wrong.

0 comments on commit fd66ae8

Please sign in to comment.