From 10dbc4b91892af079ebd5fd65dc89304e7befa5c Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 7 Sep 2014 10:42:20 -0500 Subject: [PATCH] Tasty tasty bot features --- baystation12.dme | 1 + code/__HELPERS/global_lists.dm | 5 + code/__HELPERS/lists.dm | 7 +- code/game/jobs/access.dm | 8 +- code/game/jobs/job/captain.dm | 4 +- code/game/jobs/job/civilian.dm | 4 +- code/game/jobs/job/security.dm | 16 +-- code/game/machinery/bots/bots.dm | 20 ++- code/game/machinery/bots/ed209bot.dm | 49 +++++-- code/game/machinery/bots/medbot.dm | 23 +++- code/game/machinery/bots/secbot.dm | 51 ++++++-- code/modules/clothing/glasses/hud.dm | 123 +----------------- code/modules/mob/living/carbon/human/human.dm | 90 +++++++++++-- code/modules/mob/living/carbon/human/life.dm | 11 +- code/modules/mob/living/carbon/metroid/hud.dm | 2 +- .../mob/living/carbon/monkey/monkey.dm | 33 ++++- code/modules/mob/living/silicon/pai/hud.dm | 2 +- code/modules/mob/living/silicon/pai/life.dm | 8 +- code/modules/mob/living/silicon/robot/life.dm | 11 +- .../modules/mob/living/silicon/robot/robot.dm | 4 + .../mob/living/silicon/robot/robot_modules.dm | 4 +- code/modules/mob/living/silicon/silicon.dm | 23 ++++ code/modules/mob/mob.dm | 3 + 23 files changed, 312 insertions(+), 190 deletions(-) diff --git a/baystation12.dme b/baystation12.dme index 0edb4b64f22..dbef54af075 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -206,6 +206,7 @@ #include "code\game\atoms_movable.dm" #include "code\game\centcomm_orders.dm" #include "code\game\communications.dm" +#include "code\game\data_huds.dm" #include "code\game\response_team.dm" #include "code\game\shuttle_engines.dm" #include "code\game\skincmd.dm" diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index e34897fd93d..c7c4196d194 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -43,6 +43,11 @@ var/global/list/backbaglist = list("Nothing", "Backpack", "Satchel", "Satchel Al // This is stupid as fuck. var/list/hit_appends = list("-OOF", "-ACK", "-UGH", "-HRNK", "-HURGH", "-GLORF") +//*-hud user lists +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. + ////////////////////////// /////Initial Building///// ////////////////////////// diff --git a/code/__HELPERS/lists.dm b/code/__HELPERS/lists.dm index 9ff68daa9cf..c22f9b5a3af 100644 --- a/code/__HELPERS/lists.dm +++ b/code/__HELPERS/lists.dm @@ -395,4 +395,9 @@ proc/listclearnulls(list/list) while(start < end) L.Swap(start++,end--) - return L \ No newline at end of file + return L + +/proc/find_record(field, value, list/L) + for(var/datum/data/record/R in L) + if(R.fields[field] == value) + return R \ No newline at end of file diff --git a/code/game/jobs/access.dm b/code/game/jobs/access.dm index 99506a1501e..ae9de35bcb4 100644 --- a/code/game/jobs/access.dm +++ b/code/game/jobs/access.dm @@ -65,7 +65,7 @@ /var/const/access_sec_doors = 63 // Security front doors /var/const/access_psychiatrist = 64 // Psychiatrist's office /var/const/access_salvage_captain = 65 // Salvage ship captain's quarters - +/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. /var/const/Mostly for admin fun times.*/ @@ -214,7 +214,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_psychiatrist, access_cmo, access_qm, access_clown, access_mime, 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, /*vg paramedic*/, access_paramedic) @@ -229,7 +229,7 @@ if(0) return get_all_accesses() if(1) //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(2) //medbay return list(access_medical, access_genetics, access_morgue, access_chemistry, access_paramedic, access_virology, access_surgery, access_cmo) if(3) //research @@ -396,6 +396,8 @@ // /vg/ shit if(access_paramedic) return "Paramedic Station" + if(access_weapons) + return "Weapon Permit" /proc/get_centcom_access_desc(A) switch(A) diff --git a/code/game/jobs/job/captain.dm b/code/game/jobs/job/captain.dm index a42a44c8b57..05ecfeb406b 100644 --- a/code/game/jobs/job/captain.dm +++ b/code/game/jobs/job/captain.dm @@ -61,13 +61,13 @@ idtype = /obj/item/weapon/card/id/silver req_admin_notify = 1 minimal_player_age = 10 - 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_weapons, access_forensics_lockers, 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_clown, access_mime, access_hop, access_RC_announce, access_keycard_auth, access_gateway) - minimal_access = list(access_security, access_sec_doors, access_brig, access_court, access_forensics_lockers, + minimal_access = list(access_security, access_sec_doors, access_brig, access_court, access_weapons, access_forensics_lockers, 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, diff --git a/code/game/jobs/job/civilian.dm b/code/game/jobs/job/civilian.dm index 3f185186dbe..790250357be 100644 --- a/code/game/jobs/job/civilian.dm +++ b/code/game/jobs/job/civilian.dm @@ -8,8 +8,8 @@ spawn_positions = 1 supervisors = "the head of personnel" selection_color = "#dddddd" - access = list(access_hydroponics, access_bar, access_kitchen, access_morgue) - minimal_access = list(access_bar) + access = list(access_hydroponics, access_bar, access_kitchen, access_morgue, access_weapons) + minimal_access = list(access_bar,access_weapons) pdaslot=slot_belt pdatype=/obj/item/device/pda/bar diff --git a/code/game/jobs/job/security.dm b/code/game/jobs/job/security.dm index 10d3d950fd8..b6a60004eeb 100644 --- a/code/game/jobs/job/security.dm +++ b/code/game/jobs/job/security.dm @@ -9,11 +9,11 @@ selection_color = "#ffdddd" idtype = /obj/item/weapon/card/id/hos req_admin_notify = 1 - access = list(access_security, access_sec_doors, access_brig, access_armory, access_court, + access = list(access_weapons, access_security, access_sec_doors, access_brig, access_armory, access_court, 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_weapons, access_security, access_sec_doors, access_brig, access_armory, access_court, 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) @@ -62,8 +62,8 @@ supervisors = "the head of security" selection_color = "#ffeeee" idtype = /obj/item/weapon/card/id/security - 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, access_maint_tunnels) + access = list(access_weapons, access_security, access_sec_doors, access_brig, access_armory, access_court, access_maint_tunnels, access_morgue) + minimal_access = list(access_weapons, access_security, access_sec_doors, access_brig, access_armory, access_court, access_maint_tunnels) minimal_player_age = 7 pdaslot=slot_belt @@ -110,8 +110,8 @@ selection_color = "#ffeeee" idtype = /obj/item/weapon/card/id/security - access = list(access_security, access_sec_doors, access_forensics_lockers, access_morgue, access_maint_tunnels, access_court) - minimal_access = list(access_security, access_sec_doors, access_forensics_lockers, access_morgue, access_maint_tunnels, access_court) + access = list(access_weapons, access_security, access_sec_doors, access_forensics_lockers, access_morgue, access_maint_tunnels, access_court) + minimal_access = list(access_weapons, access_security, access_sec_doors, access_forensics_lockers, access_morgue, access_maint_tunnels, access_court) alt_titles = list("Forensic Technician") minimal_player_age = 7 @@ -172,8 +172,8 @@ supervisors = "the head of security" selection_color = "#ffeeee" idtype = /obj/item/weapon/card/id/security - 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, access_maint_tunnels) + access = list(access_weapons, access_security, access_sec_doors, access_brig, access_court, access_maint_tunnels, access_morgue) + minimal_access = list(access_weapons, access_security, access_sec_doors, access_brig, access_court, access_maint_tunnels) minimal_player_age = 7 pdaslot=slot_belt diff --git a/code/game/machinery/bots/bots.dm b/code/game/machinery/bots/bots.dm index bb69c70146b..bba5a16f981 100644 --- a/code/game/machinery/bots/bots.dm +++ b/code/game/machinery/bots/bots.dm @@ -13,6 +13,13 @@ var/brute_dam_coeff = 1.0 var/open = 0//Maint panel var/locked = 1 + var/bot_type + var/declare_message = "" //What the bot will display to the HUD user. + #define SEC_BOT 1 // Secutritrons (Beepsky) and ED-209s + #define MULE_BOT 2 // MULEbots + #define FLOOR_BOT 3 // Floorbots + #define CLEAN_BOT 4 // Cleanbots + #define MED_BOT 5 // Medibots //var/emagged = 0 //Urist: Moving that var to the general /bot tree as it's used by most bots @@ -69,7 +76,18 @@ new /obj/effect/decal/cleanable/blood/oil(src.loc) healthcheck() - +/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/attackby(obj/item/weapon/W as obj, mob/user as mob) diff --git a/code/game/machinery/bots/ed209bot.dm b/code/game/machinery/bots/ed209bot.dm index 406b178cd0c..81f9b8d5dbf 100644 --- a/code/game/machinery/bots/ed209bot.dm +++ b/code/game/machinery/bots/ed209bot.dm @@ -27,13 +27,13 @@ var/last_found //There's a delay var/frustration = 0 //var/emagged = 0 //Emagged Secbots view everyone as a criminal - var/idcheck = 1 //If false, all station IDs are authorized for weapons. var/check_records = 1 //Does it check security records? var/arrest_type = 0 //If true, don't handcuff - var/declare_arrests = 0 //When making an arrest, should it notify everyone wearing sechuds? + var/projectile = null//Holder for projectile type, to avoid so many else if chains var/mode = 0 + bot_type = SEC_BOT #define SECBOT_IDLE 0 // idle #define SECBOT_HUNT 1 // found target, hunting #define SECBOT_PREP_ARREST 2 // at target, preparing to arrest @@ -59,6 +59,14 @@ var/nearest_beacon // the nearest beacon's tag var/turf/nearest_beacon_loc // the nearest beacon's location + var/declare_arrests = 1 //When making an arrest, should it notify everyone wearing sechuds? + var/idcheck = 1 //If true, arrest people with no IDs + var/weaponscheck = 1 //If true, arrest people for weapons if they don't have access + //List of weapons that secbots will not arrest for + var/safe_weapons = list(\ + /obj/item/weapon/gun/energy/laser/bluetag,\ + /obj/item/weapon/gun/energy/laser/redtag,\ + /obj/item/weapon/gun/energy/laser/practice) /obj/item/weapon/ed209_assembly @@ -129,13 +137,16 @@ Maintenance panel panel is [src.open ? "opened" : "closed"]"}, if(!src.locked || issilicon(user)) if(!lasercolor) dat += text({"
-Check for Weapon Authorization: []
-Check Security Records: []
+Arrest for No ID: []
+Arrest for Unauthorized Weapons: []
+Arrest for Warrant: []
+
Operating Mode: []
Report Arrests: []
Auto Patrol: []"}, "[src.idcheck ? "Yes" : "No"]", +"[weaponscheck ? "Yes" : "No"]", "[src.check_records ? "Yes" : "No"]", "[src.arrest_type ? "Detain" : "Arrest"]", "[src.declare_arrests ? "Yes" : "No"]", @@ -173,6 +184,9 @@ Auto Patrol: []"}, if ("idcheck") src.idcheck = !src.idcheck src.updateUsrDialog() + if("weaponscheck") + weaponscheck = !weaponscheck + updateUsrDialog() if ("ignorerec") src.check_records = !src.check_records src.updateUsrDialog() @@ -203,10 +217,13 @@ Auto Patrol: []"}, ..() if (!istype(W, /obj/item/weapon/screwdriver) && (!src.target)) if(hasvar(W,"force") && W.force)//If force is defined and non-zero - src.target = user - if(lasercolor)//To make up for the fact that lasertag bots don't hunt - src.shootAt(user) - src.mode = SECBOT_HUNT + threatlevel = user.assess_threat(src) + threatlevel +=6 + if(threatlevel > 0) + src.target = user + if(lasercolor)//To make up for the fact that lasertag bots don't hunt + src.shootAt(user) + src.mode = SECBOT_HUNT /obj/machinery/bot/ed209/Emag(mob/user as mob) ..() @@ -224,6 +241,7 @@ Auto Patrol: []"}, src.icon_state = "[lasercolor]ed209[src.on]" src.projectile = null mode = SECBOT_IDLE + declare_arrests = 0 /obj/machinery/bot/ed209/process() //set background = 1 @@ -236,7 +254,7 @@ Auto Patrol: []"}, if ((C.stat) || (C.lying)) continue if (istype(C, /mob/living/carbon/human)) - threatlevel = src.assess_perp(C) + threatlevel = C.assess_threat(src,lasercolor) else if ((istype(C, /mob/living/carbon/monkey)) && (C.client) && (ticker.mode.name == "monkey")) threatlevel = 4 //src.speak(C.real_name + text(": threat: []", threatlevel)) @@ -1055,4 +1073,15 @@ Auto Patrol: []"}, /obj/machinery/bot/ed209/redtag/New() new /obj/machinery/bot/ed209(get_turf(src),null,"r") - del(src) \ No newline at end of file + del(src) + +/obj/machinery/bot/ed209/proc/check_for_weapons(var/obj/item/slot_item) + if(istype(slot_item, /obj/item/weapon/gun) || istype(slot_item, /obj/item/weapon/melee)) + if(!(slot_item.type in safe_weapons)) + return 1 + return 0 + +/obj/machinery/bot/ed209/declare() + var/area/location = get_area(src) + declare_message = "\icon[src] [name] is [arrest_type ? "detaining" : "arresting"] level [threatlevel] scumbag [target] in [location]" + ..() \ No newline at end of file diff --git a/code/game/machinery/bots/medbot.dm b/code/game/machinery/bots/medbot.dm index 23e56068775..603599799a0 100644 --- a/code/game/machinery/bots/medbot.dm +++ b/code/game/machinery/bots/medbot.dm @@ -38,6 +38,9 @@ var/treatment_virus = "spaceacillin" var/declare_treatment = 0 //When attempting to treat a patient, should it notify everyone wearing medhuds? var/shut_up = 0 //self explanatory :) + var/declare_crit = 1 //If active, the bot will transmit a critical patient alert to MedHUD users. + var/declare_cooldown = 0 //Prevents spam of critical patient alerts. + bot_type = MED_BOT /obj/machinery/bot/medbot/mysterious name = "Mysterious Medibot" @@ -68,7 +71,6 @@ /obj/machinery/bot/medbot/New() ..() src.icon_state = "medibot[src.on]" - spawn(4) if(src.skin) src.overlays += image('icons/obj/aibots.dmi', "medskin_[src.skin]") @@ -135,6 +137,8 @@ dat += "The speaker switch is [src.shut_up ? "off" : "on"]. Toggle
" + dat += "Critical Patient Alerts: [declare_crit ? "Yes" : "No"]
" + user << browse("Medibot v1.0 controls[dat]", "window=automed") onclose(user, "automed") return @@ -182,6 +186,9 @@ else if ((href_list["declaretreatment"]) && (!src.locked || issilicon(usr))) src.declare_treatment = !src.declare_treatment + else if ((href_list["critalerts"]) && (!locked || issilicon(usr))) + declare_crit = !declare_crit + src.updateUsrDialog() return @@ -222,6 +229,7 @@ /obj/machinery/bot/medbot/Emag(mob/user as mob) ..() if(open && !locked) + declare_crit = 0 if(user) user << "You short out [src]'s reagent synthesis circuits." spawn(0) for(var/mob/O in hearers(src, null)) @@ -341,6 +349,9 @@ if(src.emagged == 2) //Everyone needs our medicine. (Our medicine is toxins) return 1 + if(declare_crit && C.health <= 0) //Critical condition! Call for help! + declare() + //If they're injured, we're using a beaker, and don't have one of our WONDERCHEMS. if((src.reagent_glass) && (src.use_beaker) && ((C.getBruteLoss() >= heal_threshold) || (C.getToxLoss() >= heal_threshold) || (C.getToxLoss() >= heal_threshold) || (C.getOxyLoss() >= (heal_threshold + 15)))) for(var/datum/reagent/R in src.reagent_glass.reagents.reagent_list) @@ -599,3 +610,13 @@ user.drop_from_inventory(src) del(src) + +/obj/machinery/bot/medbot/declare() + if(declare_cooldown) + return + var/area/location = get_area(src) + declare_message = "\icon[src] Medical emergency! A patient is in critical condition at [location]!" + ..() + declare_cooldown = 1 + spawn(100) //Ten seconds + declare_cooldown = 0 \ No newline at end of file diff --git a/code/game/machinery/bots/secbot.dm b/code/game/machinery/bots/secbot.dm index bee432aa5c2..ce1cce948ed 100644 --- a/code/game/machinery/bots/secbot.dm +++ b/code/game/machinery/bots/secbot.dm @@ -18,9 +18,11 @@ var/target_lastloc //Loc of target when arrested. var/last_found //There's a delay var/frustration = 0 + var/check_records = 1 // var/emagged = 0 //Emagged Secbots view everyone as a criminal - var/idcheck = 0 //If false, all station IDs are authorized for weapons. - var/check_records = 1 //Does it check security records? + + var/idcheck = 0 //If true, arrest people with no IDs + var/weaponscheck = 0 //If true, arrest people for weapons if they lack access var/check_records = 1 //Does it check security records? var/arrest_type = 0 //If true, don't handcuff var/declare_arrests = 0 //When making an arrest, should it notify everyone wearing sechuds? var/next_harm_time = 0 @@ -51,7 +53,11 @@ var/nearest_beacon // the nearest beacon's tag var/turf/nearest_beacon_loc // the nearest beacon's location - + var/weapons_check = 0 + var/safe_weapons = list(\ + /obj/item/weapon/gun/energy/laser/bluetag,\ + /obj/item/weapon/gun/energy/laser/redtag,\ + /obj/item/weapon/gun/energy/laser/practice) l_color = "#B40000" power_change() ..() @@ -66,6 +72,7 @@ desc = "It's Officer Beep O'sky! Powered by a potato and a shot of whiskey." idcheck = 0 auto_patrol = 1 + weapons_check = 0 /obj/item/weapon/secbot_assembly name = "helmet/signaler assembly" @@ -124,13 +131,16 @@ Maintenance panel panel is [src.open ? "opened" : "closed"]"}, if(!src.locked || issilicon(user)) dat += text({"
-Check for Weapon Authorization: []
-Check Security Records: []
+Arrest for No ID: []
+Arrest for Unauthorized Weapons: []
+Arrest for Warrant: []
+
Operating Mode: []
Report Arrests: []
Auto Patrol: []"}, "[src.idcheck ? "Yes" : "No"]", +"[weaponscheck ? "Yes" : "No"]", "[src.check_records ? "Yes" : "No"]", "[src.arrest_type ? "Detain" : "Arrest"]", "[src.declare_arrests ? "Yes" : "No"]", @@ -155,6 +165,9 @@ Auto Patrol: []"}, if("idcheck") src.idcheck = !src.idcheck src.updateUsrDialog() + if("weaponscheck") + weaponscheck = !weaponscheck + updateUsrDialog() if("ignorerec") src.check_records = !src.check_records src.updateUsrDialog() @@ -183,9 +196,14 @@ Auto Patrol: []"}, user << "\red Access denied." else ..() - if(!istype(W, /obj/item/weapon/screwdriver) && (W.force) && (!src.target)) - src.target = user - src.mode = SECBOT_HUNT + if(istype(W, /obj/item/weapon/weldingtool) && user.a_intent != "harm") // Any intent but harm will heal, so we shouldn't get angry. + return + if(!istype(W, /obj/item/weapon/screwdriver) && (W.force) && (!target) ) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass. + threatlevel = user.assess_threat(src) + threatlevel += 6 + if(threatlevel > 0) + target = user + mode = SECBOT_HUNT /obj/machinery/bot/secbot/Emag(mob/user as mob) ..() @@ -250,6 +268,10 @@ Auto Patrol: []"}, M.Weaken(10) M.stuttering = 10 M.Stun(10) + if(declare_arrests) + declare() + target.visible_message("[target] has been stunned by [src]!",\ + "[target] has been stunned by [src]!") maxstuns-- if(maxstuns <= 0) target = null @@ -257,7 +279,7 @@ Auto Patrol: []"}, if(declare_arrests) var/area/location = get_area(src) broadcast_security_hud_message("[src.name] is [arrest_type ? "detaining" : "arresting"] level [threatlevel] suspect [target] in [location]", src) - visible_message("\red [src.target] has been stunned by [src]!") + //visible_message("\red [src.target] has been stunned by [src]!") mode = SECBOT_PREP_ARREST src.anchored = 1 @@ -823,3 +845,14 @@ Auto Patrol: []"}, if(!in_range(src, usr) && src.loc != usr) return src.created_name = t + +/obj/machinery/bot/secbot/declare() + var/area/location = get_area(src) + declare_message = "\icon[src] [name] is [arrest_type ? "detaining" : "arresting"] level [threatlevel] scumbag [target] in [location]" + ..() + +/obj/machinery/bot/secbot/proc/check_for_weapons(var/obj/item/slot_item) + if(istype(slot_item, /obj/item/weapon/gun) || istype(slot_item, /obj/item/weapon/melee)) + if(!(slot_item.type in safe_weapons)) + return 1 + return 0 \ No newline at end of file diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index e3fff70f366..be765aea8be 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -14,68 +14,9 @@ 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" - - - 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(get_turf(M))) - if(M.see_invisible < patient.invisibility) - continue - var/foundVirus = 0 - for(var/datum/disease/D in patient.viruses) - if(!D.hidden[SCANNER]) - foundVirus++ - for (var/ID in patient.virus2) - if (ID in virusDB) - foundVirus = 1 - break - 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/process_hud(var/mob/M) + process_med_hud(M) /obj/item/clothing/glasses/hud/security @@ -92,62 +33,4 @@ invisa_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(get_turf(M))) - if(M.see_invisible < perp.invisibility) - continue - if(!C) continue - var/perpname = perp.name - holder = perp.hud_list[ID_HUD] - if(perp.wear_id) - var/obj/item/weapon/card/id/I = perp.wear_id.GetID() - if(I) - perpname = I.registered_name - holder.icon_state = "hud[ckey(I.GetJobName())]" - C.images += holder - else - perpname = perp.name - holder.icon_state = "hudunknown" - C.images += holder - else - perpname = perp.name - holder.icon_state = "hudunknown" - C.images += holder - - for(var/datum/data/record/E in data_core.general) - if(E.fields["name"] == perpname) - holder = perp.hud_list[WANTED_HUD] - for (var/datum/data/record/R in data_core.security) - if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*")) - holder.icon_state = "hudwanted" - C.images += holder - break - else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Incarcerated")) - holder.icon_state = "hudprisoner" - C.images += holder - break - else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Parolled")) - holder.icon_state = "hudparolled" - C.images += holder - break - else if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "Released")) - holder.icon_state = "hudreleased" - C.images += holder - break - 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" - C.images += holder - if(istype(I,/obj/item/weapon/implant/loyalty)) - holder = perp.hud_list[IMPLOYAL_HUD] - holder.icon_state = "hud_imp_loyal" - C.images += holder - if(istype(I,/obj/item/weapon/implant/chem)) - holder = perp.hud_list[IMPCHEM_HUD] - holder.icon_state = "hud_imp_chem" - C.images += holder \ No newline at end of file + process_sec_hud(M,1) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index e491a027230..ab206204e8b 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -689,7 +689,8 @@ /mob/living/carbon/human/Topic(href, href_list) var/pickpocket = 0 var/list/ourlist = list() - if(!usr.stat && usr.canmove && !usr.restrained() && in_range(src, usr) && Adjacent(usr)) + var/able = (!usr.stat && usr.canmove && !usr.restrained() && in_range(src, usr) && Adjacent(usr)) + /* if(!usr.stat && usr.canmove && !usr.restrained() && in_range(src, usr) && Adjacent(usr)) @@ -702,7 +703,7 @@ */ - if(href_list["item"]) + if(href_list["item"] && able) var/slot = href_list["item"] var/obj/item/place_item = usr.get_active_hand() var/obj/item/id_item = src.wear_id @@ -756,7 +757,7 @@ return - if(href_list["pockets"]) + if(href_list["pockets"] && able) var/pocket_side = href_list["pockets"] var/pocket_id = (pocket_side == "right" ? slot_r_store : slot_l_store) var/obj/item/pocket_item = (pocket_id == slot_r_store ? src.r_store : src.l_store) @@ -789,9 +790,6 @@ // Display a warning if the user mocks up src << "You feel your [pocket_side] pocket being fumbled with!" - ..() - return - if (href_list["refresh"]) if((machine)&&(in_range(src, usr))) @@ -821,10 +819,11 @@ return */ if (href_list["criminal"]) + var/sechud = hasHUD(usr,"security") if(hasHUD(usr,"security")) - - var/modified = 0 var/perpname = "wot" + var/modified + if(wear_id) var/obj/item/weapon/card/id/I = wear_id.GetID() if(I) @@ -836,6 +835,7 @@ if(perpname) for (var/datum/data/record/E in data_core.general) + usr << E.fields["name"] if (E.fields["name"] == perpname) for (var/datum/data/record/R in data_core.security) if (R.fields["id"] == E.fields["id"]) @@ -1770,4 +1770,76 @@ mob/living/carbon/human/yank_out_object() ACL |= I.GetAccess() if(wear_id) ACL |= wear_id.GetAccess() - return ACL \ No newline at end of file + return ACL + +/mob/living/carbon/human/assess_threat(var/obj/machinery/bot/secbot/judgebot, var/lasercolor) + if(judgebot.emagged == 2) + return 10 //Everyone is a criminal! + + var/threatcount = 0 + + //Lasertag + if(lasercolor) + if(lasercolor == "b")//Lasertag turrets target the opposing team. + if(istype(wear_suit, /obj/item/clothing/suit/redtag)) + threatcount += 4 + if((istype(r_hand,/obj/item/weapon/gun/energy/laser/redtag)) || (istype(l_hand,/obj/item/weapon/gun/energy/laser/redtag))) + threatcount += 4 + if(istype(belt, /obj/item/weapon/gun/energy/laser/redtag)) + threatcount += 2 + + if(lasercolor == "r") + if(istype(wear_suit, /obj/item/clothing/suit/bluetag)) + threatcount += 4 + if((istype(r_hand,/obj/item/weapon/gun/energy/laser/bluetag)) || (istype(l_hand,/obj/item/weapon/gun/energy/laser/bluetag))) + threatcount += 4 + if(istype(belt, /obj/item/weapon/gun/energy/laser/bluetag)) + threatcount += 2 + + return threatcount + + //Check for ID + var/obj/item/weapon/card/id/idcard = get_idcard() + if(judgebot.idcheck && !idcard) + threatcount += 4 + + //Check for weapons + if(judgebot.weaponscheck) + if(!idcard || !(access_weapons in idcard.access)) + if(judgebot.check_for_weapons(l_hand)) + threatcount += 4 + if(judgebot.check_for_weapons(r_hand)) + threatcount += 4 + if(judgebot.check_for_weapons(belt)) + threatcount += 2 + + //Check for arrest warrant + if(judgebot.check_records) + var/perpname = get_face_name(get_id_name()) + var/datum/data/record/R = find_record("name", perpname, data_core.security) + if(R && R.fields["criminal"]) + switch(R.fields["criminal"]) + if("*Arrest*") + threatcount += 5 + if("Incarcerated") + threatcount += 2 + if("Parolled") + threatcount += 2 + + //Check for dresscode violations + if(istype(head, /obj/item/clothing/head/wizard) || istype(head, /obj/item/clothing/head/helmet/space/rig/wizard)) + threatcount += 2 + + //Loyalty implants imply trustworthyness + if(isloyal(src)) + threatcount -= 1 + + //Secbots are racist! + if(dna && dna.mutantrace && dna.mutantrace != "none") + threatcount += 2 + + //Agent cards lower threatlevel. + if(istype(idcard, /obj/item/weapon/card/id/syndicate)) + threatcount -= 2 + + return threatcount \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 39dbe94273e..8f5afa21f41 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1093,20 +1093,11 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc return 1 proc/handle_regular_hud_updates() - if(hud_updateflag) - handle_hud_list() - - if(!client) return 0 - if(hud_updateflag) - handle_hud_list() + regular_hud_updates() - 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) - client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask/*, global_hud.nvg*/) update_action_buttons() diff --git a/code/modules/mob/living/carbon/metroid/hud.dm b/code/modules/mob/living/carbon/metroid/hud.dm index c7700839067..77a78f7c579 100644 --- a/code/modules/mob/living/carbon/metroid/hud.dm +++ b/code/modules/mob/living/carbon/metroid/hud.dm @@ -1,4 +1,4 @@ -/mob/living/carbon/slime/proc/regular_hud_updates() +/mob/living/carbon/slime/regular_hud_updates() return diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index e7a1d510291..79b6248d3b7 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -522,4 +522,35 @@ var/obj/item/I = get_active_hand() if(istype(I)) ACL |= I.GetAccess() - return ACL \ No newline at end of file + return ACL + + +/mob/living/carbon/monkey/assess_threat(var/obj/machinery/bot/secbot/judgebot, var/lasercolor) + if(judgebot.emagged == 2) + return 10 //Everyone is a criminal! + var/threatcount = 0 + + //Lasertag bullshit + if(lasercolor) + if(lasercolor == "b")//Lasertag turrets target the opposing team, how great is that? -Sieve + if((istype(r_hand,/obj/item/weapon/gun/energy/laser/redtag)) || (istype(l_hand,/obj/item/weapon/gun/energy/laser/redtag))) + threatcount += 4 + + if(lasercolor == "r") + if((istype(r_hand,/obj/item/weapon/gun/energy/laser/bluetag)) || (istype(l_hand,/obj/item/weapon/gun/energy/laser/bluetag))) + threatcount += 4 + + return threatcount + + //Check for weapons + if(judgebot.weaponscheck) + if(judgebot.check_for_weapons(l_hand)) + threatcount += 4 + if(judgebot.check_for_weapons(r_hand)) + threatcount += 4 + + //Loyalty implants imply trustworthyness + if(isloyal(src)) + threatcount -= 1 + + return threatcount \ No newline at end of file diff --git a/code/modules/mob/living/silicon/pai/hud.dm b/code/modules/mob/living/silicon/pai/hud.dm index 07df7cd9ead..1ecb510146b 100644 --- a/code/modules/mob/living/silicon/pai/hud.dm +++ b/code/modules/mob/living/silicon/pai/hud.dm @@ -1,4 +1,4 @@ -/mob/living/silicon/pai/proc/regular_hud_updates() +/mob/living/silicon/pai/regular_hud_updates() if(client) for(var/image/hud in client.images) if(copytext(hud.icon_state,1,4) == "hud") diff --git a/code/modules/mob/living/silicon/pai/life.dm b/code/modules/mob/living/silicon/pai/life.dm index dde8e4494fe..bebbb82dc43 100644 --- a/code/modules/mob/living/silicon/pai/life.dm +++ b/code/modules/mob/living/silicon/pai/life.dm @@ -9,10 +9,10 @@ del(src.cable) regular_hud_updates() - if(src.secHUD == 1) - src.securityHUD() - if(src.medHUD == 1) - src.medicalHUD() + if(src.secHUD) + process_sec_hud(src) + if(src.medHUD) + process_med_hud(src) if(silence_time) if(world.timeofday >= silence_time) silence_time = null diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index a2c17c8bf3c..f84fb648260 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -168,12 +168,13 @@ src.see_in_dark = 8 src.see_invisible = SEE_INVISIBLE_LEVEL_TWO - for(var/image/hud in client.images) //COPIED FROM the human handle_regular_hud_updates() proc - 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) + switch(sensor_mode) + if (SEC_HUD) + process_sec_hud(src, 1) + if (MED_HUD) + process_med_hud(src) if (src.healths) if (src.stat != 2) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 4259135aa11..5b284bfd5f5 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -1268,6 +1268,10 @@ statelaws() return +/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/radio_menu() radio.interact(src)//Just use the radio's Topic() instead of bullshit special-snowflake code diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm index d679f0cb329..c3357502fb9 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -67,7 +67,7 @@ New() ..() - src.modules += new /obj/item/borg/sight/hud/med(src) + //src.modules += new /obj/item/borg/sight/hud/med(src) src.modules += new /obj/item/device/healthanalyzer(src) src.modules += new /obj/item/weapon/reagent_containers/borghypo(src) src.modules += new /obj/item/weapon/reagent_containers/glass/beaker/large(src) @@ -191,7 +191,7 @@ New() ..() - src.modules += new /obj/item/borg/sight/hud/sec(src) + //src.modules += new /obj/item/borg/sight/hud/sec(src) src.modules += new /obj/item/weapon/handcuffs/cyborg(src) src.modules += new /obj/item/weapon/melee/baton/loaded(src) src.modules += new /obj/item/weapon/gun/energy/taser/cyborg(src) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 4239efeed98..054b8b7167e 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -8,6 +8,9 @@ var/list/alarms_to_clear = list() immune_to_ssd = 1 + var/sensor_mode = 0 //Determines the current HUD. + #define SEC_HUD 1 //Security HUD mode + #define MED_HUD 2 //Medical HUD mode var/list/alarm_types_show = list("Motion" = 0, "Fire" = 0, "Atmosphere" = 0, "Power" = 0, "Camera" = 0) var/list/alarm_types_clear = list("Motion" = 0, "Fire" = 0, "Atmosphere" = 0, "Power" = 0, "Camera" = 0) @@ -225,3 +228,23 @@ return damage return 0 + +/mob/living/silicon/assess_threat() //Secbots will not target silicons! + 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"/*,"Light Amplification"*/,"Disable") + switch(sensor_type) + if ("Security") + sensor_mode = SEC_HUD + src << "Security records overlay enabled." + if ("Medical") + sensor_mode = MED_HUD + src << "Life signs monitor overlay enabled."/* + if ("Light Amplification") + src.sensor_mode = NIGHT + src << "Light amplification mode enabled."*/ + if ("Disable") + sensor_mode = 0 + src << "Sensor augmentations disabled." \ No newline at end of file diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index aa16f49600d..c4512ed9296 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1455,4 +1455,7 @@ mob/verb/yank_out_object() // Skip over all the complex list checks. /mob/proc/hasFullAccess() + return 0 + +mob/proc/assess_threat() return 0 \ No newline at end of file