diff --git a/code/__DEFINES/atom_hud.dm b/code/__DEFINES/atom_hud.dm index 3c3350d6ab..2decc918f2 100644 --- a/code/__DEFINES/atom_hud.dm +++ b/code/__DEFINES/atom_hud.dm @@ -16,31 +16,37 @@ #define DIAG_BOT_HUD "12"// Bot HUDs #define DIAG_TRACK_HUD "13"// Mech tracking beacon #define DIAG_AIRLOCK_HUD "14"//Airlock shock overlay +#define DIAG_PATH_HUD "15"//Bot path indicators //for antag huds. these are used at the /mob level -#define ANTAG_HUD "15" +#define ANTAG_HUD "16" + +//by default everything in the hud_list of an atom is an image +//a value in hud_list with one of these will change that behavior +#define HUD_LIST_LIST 1 //data HUD (medhud, sechud) defines //Don't forget to update human/New() if you change these! -#define DATA_HUD_SECURITY_BASIC 1 -#define DATA_HUD_SECURITY_ADVANCED 2 -#define DATA_HUD_MEDICAL_BASIC 3 -#define DATA_HUD_MEDICAL_ADVANCED 4 -#define DATA_HUD_DIAGNOSTIC 5 +#define DATA_HUD_SECURITY_BASIC 1 +#define DATA_HUD_SECURITY_ADVANCED 2 +#define DATA_HUD_MEDICAL_BASIC 3 +#define DATA_HUD_MEDICAL_ADVANCED 4 +#define DATA_HUD_DIAGNOSTIC_BASIC 5 +#define DATA_HUD_DIAGNOSTIC_ADVANCED 6 //antag HUD defines -#define ANTAG_HUD_CULT 6 -#define ANTAG_HUD_REV 7 -#define ANTAG_HUD_OPS 8 -#define ANTAG_HUD_WIZ 9 -#define ANTAG_HUD_SHADOW 10 -#define ANTAG_HUD_TRAITOR 11 -#define ANTAG_HUD_NINJA 12 -#define ANTAG_HUD_CHANGELING 13 -#define ANTAG_HUD_ABDUCTOR 14 -#define ANTAG_HUD_DEVIL 15 -#define ANTAG_HUD_SINTOUCHED 16 -#define ANTAG_HUD_SOULLESS 17 -#define ANTAG_HUD_CLOCKWORK 18 -#define ANTAG_HUD_BROTHER 19 +#define ANTAG_HUD_CULT 7 +#define ANTAG_HUD_REV 8 +#define ANTAG_HUD_OPS 9 +#define ANTAG_HUD_WIZ 10 +#define ANTAG_HUD_SHADOW 11 +#define ANTAG_HUD_TRAITOR 12 +#define ANTAG_HUD_NINJA 13 +#define ANTAG_HUD_CHANGELING 14 +#define ANTAG_HUD_ABDUCTOR 15 +#define ANTAG_HUD_DEVIL 16 +#define ANTAG_HUD_SINTOUCHED 17 +#define ANTAG_HUD_SOULLESS 18 +#define ANTAG_HUD_CLOCKWORK 19 +#define ANTAG_HUD_BROTHER 20 // Notification action types #define NOTIFY_JUMP "jump" diff --git a/code/_globalvars/lists/mobs.dm b/code/_globalvars/lists/mobs.dm index a9ffde59e3..89e4481284 100644 --- a/code/_globalvars/lists/mobs.dm +++ b/code/_globalvars/lists/mobs.dm @@ -24,6 +24,7 @@ GLOBAL_LIST_EMPTY(pai_list) GLOBAL_LIST_EMPTY(available_ai_shells) GLOBAL_LIST_INIT(simple_animals, list(list(),list(),list())) // One for each AI_* status define GLOBAL_LIST_EMPTY(spidermobs) //all sentient spider mobs +GLOBAL_LIST_EMPTY(bots_list) GLOBAL_LIST_EMPTY(language_datum_instances) GLOBAL_LIST_EMPTY(all_languages) diff --git a/code/datums/hud.dm b/code/datums/hud.dm index be2b5c620c..837e7a6a95 100644 --- a/code/datums/hud.dm +++ b/code/datums/hud.dm @@ -1,12 +1,15 @@ /* HUD DATUMS */ +GLOBAL_LIST_EMPTY(all_huds) + //GLOBAL HUD LIST GLOBAL_LIST_INIT(huds, list( DATA_HUD_SECURITY_BASIC = new/datum/atom_hud/data/human/security/basic(), DATA_HUD_SECURITY_ADVANCED = new/datum/atom_hud/data/human/security/advanced(), DATA_HUD_MEDICAL_BASIC = new/datum/atom_hud/data/human/medical/basic(), DATA_HUD_MEDICAL_ADVANCED = new/datum/atom_hud/data/human/medical/advanced(), - DATA_HUD_DIAGNOSTIC = new/datum/atom_hud/data/diagnostic(), + DATA_HUD_DIAGNOSTIC_BASIC = new/datum/atom_hud/data/diagnostic/basic(), + DATA_HUD_DIAGNOSTIC_ADVANCED = new/datum/atom_hud/data/diagnostic/advanced(), ANTAG_HUD_CULT = new/datum/atom_hud/antag(), ANTAG_HUD_REV = new/datum/atom_hud/antag(), ANTAG_HUD_OPS = new/datum/atom_hud/antag(), @@ -28,6 +31,17 @@ GLOBAL_LIST_INIT(huds, list( var/list/mob/hudusers = list() //list with all mobs who can see the hud var/list/hud_icons = list() //these will be the indexes for the atom's hud_list +/datum/atom_hud/New() + GLOB.all_huds += src + +/datum/atom_hud/Destroy() + for(var/v in hudusers) + remove_hud_from(v) + for(var/v in hudatoms) + remove_from_hud(v) + GLOB.all_huds -= src + return ..() + /datum/atom_hud/proc/remove_hud_from(mob/M) if(!M || !hudusers[M]) return @@ -77,7 +91,7 @@ GLOBAL_LIST_INIT(huds, list( //MOB PROCS /mob/proc/reload_huds() - for(var/datum/atom_hud/hud in (GLOB.huds|GLOB.active_alternate_appearances)) + for(var/datum/atom_hud/hud in GLOB.all_huds) if(hud && hud.hudusers[src]) for(var/atom/A in hud.hudatoms) hud.add_to_single_hud(src, A) diff --git a/code/game/alternate_appearance.dm b/code/game/alternate_appearance.dm index 9b74020488..b83204119d 100644 --- a/code/game/alternate_appearance.dm +++ b/code/game/alternate_appearance.dm @@ -30,10 +30,6 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances) appearance_key = key /datum/atom_hud/alternate_appearance/Destroy() - for(var/v in hudusers) - remove_hud_from(v) - for(var/v in hudatoms) - remove_from_hud(v) GLOB.active_alternate_appearances -= src return ..() diff --git a/code/game/data_huds.dm b/code/game/data_huds.dm index 10ff185fd6..1afd2953a0 100644 --- a/code/game/data_huds.dm +++ b/code/game/data_huds.dm @@ -50,8 +50,16 @@ hud_icons = list(ID_HUD, IMPTRACK_HUD, IMPLOYAL_HUD, IMPCHEM_HUD, WANTED_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_TRACK_HUD, DIAG_AIRLOCK_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_TRACK_HUD, DIAG_AIRLOCK_HUD, DIAG_PATH_HUD) + +/datum/atom_hud/data/bot_path + hud_icons = list(DIAG_PATH_HUD) + /* MED/SEC/DIAG HUD HOOKS */ /* diff --git a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm index e4e4205db8..7005b26b12 100644 --- a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm +++ b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm @@ -101,8 +101,8 @@ /mob/living/simple_animal/hostile/swarmer/Initialize() . = ..() verbs -= /mob/living/verb/pulled - var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] - diag_hud.add_to_hud(src) + for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) + diag_hud.add_to_hud(src) /mob/living/simple_animal/hostile/swarmer/med_hud_set_health() var/image/holder = hud_list[DIAG_HUD] diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 449b9ea8a4..58f37e5945 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -119,8 +119,8 @@ if(damage_deflection == AIRLOCK_DAMAGE_DEFLECTION_N && security_level > AIRLOCK_SECURITY_METAL) damage_deflection = AIRLOCK_DAMAGE_DEFLECTION_R prepare_huds() - var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] - diag_hud.add_to_hud(src) + for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) + diag_hud.add_to_hud(src) diag_hud_set_electrified() return INITIALIZE_HINT_LATELOAD @@ -242,8 +242,8 @@ for(var/obj/machinery/doorButtons/D in GLOB.machines) D.removeMe(src) qdel(note) - var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] - diag_hud.remove_from_hud(src) + for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) + diag_hud.remove_from_hud(src) return ..() /obj/machinery/door/airlock/handle_atom_del(atom/A) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 2f98b2cc4c..34b1eed312 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -137,8 +137,8 @@ log_message("[src.name] created.") GLOB.mechas_list += src //global mech list prepare_huds() - var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] - diag_hud.add_to_hud(src) + for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) + diag_hud.add_to_hud(src) diag_hud_set_mechhealth() diag_hud_set_mechcell() diag_hud_set_mechstat() diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index 0fac1eff79..762f1e53b0 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -63,7 +63,7 @@ desc = "A heads-up display capable of analyzing the integrity and status of robotics and exosuits." icon_state = "diagnostichud" origin_tech = "magnets=2;engineering=2" - hud_type = DATA_HUD_DIAGNOSTIC + hud_type = DATA_HUD_DIAGNOSTIC_BASIC glass_colour_type = /datum/client_colour/glass_colour/lightorange /obj/item/clothing/glasses/hud/diagnostic/night diff --git a/code/modules/clothing/spacesuits/flightsuit.dm b/code/modules/clothing/spacesuits/flightsuit.dm index 30afa31f60..79886b1446 100644 --- a/code/modules/clothing/spacesuits/flightsuit.dm +++ b/code/modules/clothing/spacesuits/flightsuit.dm @@ -1079,7 +1079,7 @@ light_color = "#30ffff" armor = list(melee = 20, bullet = 20, laser = 20, energy = 10, bomb = 30, bio = 100, rad = 75, fire = 100, acid = 100) max_heat_protection_temperature = FIRE_HELM_MAX_TEMP_PROTECT - var/list/datahuds = list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC) + var/list/datahuds = list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_BASIC) var/zoom_range = 12 var/zoom = FALSE actions_types = list(/datum/action/item_action/toggle_helmet_light, /datum/action/item_action/flightpack/zoom) diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index c371973506..202e2db5eb 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -457,13 +457,13 @@ /obj/item/clothing/head/helmet/space/hardsuit/rd/equipped(mob/living/carbon/human/user, slot) ..() if (slot == slot_head) - var/datum/atom_hud/DHUD = GLOB.huds[DATA_HUD_DIAGNOSTIC] + var/datum/atom_hud/DHUD = GLOB.huds[DATA_HUD_DIAGNOSTIC_BASIC] DHUD.add_hud_to(user) /obj/item/clothing/head/helmet/space/hardsuit/rd/dropped(mob/living/carbon/human/user) ..() if (user.head == src) - var/datum/atom_hud/DHUD = GLOB.huds[DATA_HUD_DIAGNOSTIC] + var/datum/atom_hud/DHUD = GLOB.huds[DATA_HUD_DIAGNOSTIC_BASIC] DHUD.remove_hud_from(user) /obj/item/clothing/suit/space/hardsuit/rd diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index ca6b504294..bb4c0f559b 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -32,7 +32,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) var/ghost_hud_enabled = 1 //did this ghost disable the on-screen HUD? var/data_huds_on = 0 //Are data HUDs currently enabled? var/health_scan = FALSE //Are health scans currently enabled? - var/list/datahuds = list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC) //list of data HUDs shown to ghosts. + var/list/datahuds = list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED) //list of data HUDs shown to ghosts. var/ghost_orbit = GHOST_ORBIT_CIRCLE //These variables store hair data if the ghost originates from a species with head and/or facial hair. diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 0fb044429c..ed36e62492 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -25,6 +25,7 @@ see_in_dark = 8 med_hud = DATA_HUD_MEDICAL_BASIC sec_hud = DATA_HUD_SECURITY_BASIC + d_hud = DATA_HUD_DIAGNOSTIC_ADVANCED mob_size = MOB_SIZE_LARGE var/list/network = list("SS13") var/obj/machinery/camera/current = null diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index fa8447885d..5de09011ea 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -33,7 +33,7 @@ var/med_hud = DATA_HUD_MEDICAL_ADVANCED //Determines the med hud to use var/sec_hud = DATA_HUD_SECURITY_ADVANCED //Determines the sec hud to use - var/d_hud = DATA_HUD_DIAGNOSTIC //There is only one kind of diag hud + var/d_hud = DATA_HUD_DIAGNOSTIC_BASIC //Determines the diag hud to use var/law_change_counter = 0 var/obj/machinery/camera/builtInCamera = null @@ -42,8 +42,8 @@ /mob/living/silicon/Initialize() . = ..() GLOB.silicon_mobs += src - var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] - diag_hud.add_to_hud(src) + for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) + diag_hud.add_to_hud(src) diag_hud_set_status() diag_hud_set_health() diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index d5c839ffe6..b19bc401e3 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -48,7 +48,7 @@ var/frustration = 0 //Used by some bots for tracking failures to reach their target. var/base_speed = 2 //The speed at which the bot moves, or the number of times it moves per process() tick. var/turf/ai_waypoint //The end point of a bot's path, or the target location. - var/list/path = list() //List of turfs through which a bot 'steps' to reach the waypoint. + var/list/path = list() //List of turfs through which a bot 'steps' to reach the waypoint, associated with the path image, if there is one. var/pathset = 0 var/list/ignore_list = list() //List of unreachable targets for an ignore-list enabled bot to ignore. var/mode = BOT_IDLE //Standardizes the vars that indicate the bot is busy with its function. @@ -75,17 +75,21 @@ var/beacon_freq = 1445 // navigation beacon frequency var/model = "" //The type of bot it is. var/bot_type = 0 //The type of bot it is, for radio control. - var/data_hud_type = DATA_HUD_DIAGNOSTIC //The type of data HUD the bot uses. Diagnostic by default. + var/data_hud_type = DATA_HUD_DIAGNOSTIC_BASIC //The type of data HUD the bot uses. Diagnostic by default. + //This holds text for what the bot is mode doing, reported on the remote bot control interface. var/list/mode_name = list("In Pursuit","Preparing to Arrest", "Arresting", \ "Beginning Patrol", "Patrolling", "Summoned by PDA", \ "Cleaning", "Repairing", "Proceeding to work site", "Healing", \ "Proceeding to AI waypoint", "Navigating to Delivery Location", "Navigating to Home", \ "Waiting for clear path", "Calculating navigation path", "Pinging beacon network", "Unable to reach destination") - //This holds text for what the bot is mode doing, reported on the remote bot control interface. - + var/datum/atom_hud/data/bot_path/path_hud = new /datum/atom_hud/data/bot_path() + var/path_image_icon = 'icons/mob/aibots.dmi' + var/path_image_icon_state = "path_indicator" + var/path_image_color = "#FFFFFF" + var/reset_access_timer_id var/ignorelistcleanuptimer = 1 // This ticks up every automated action, at 300 we clean the ignore list - hud_possible = list(DIAG_STAT_HUD, DIAG_BOT_HUD, DIAG_HUD) //Diagnostic HUD views + hud_possible = list(DIAG_STAT_HUD, DIAG_BOT_HUD, DIAG_HUD, DIAG_PATH_HUD = HUD_LIST_LIST) //Diagnostic HUD views /mob/living/simple_animal/bot/proc/get_mode() if(client) //Player bots do not have modes, thus the override. Also an easy way for PDA users/AI to know when a bot is a player. @@ -117,6 +121,7 @@ /mob/living/simple_animal/bot/Initialize() . = ..() + GLOB.bots_list += src access_card = new /obj/item/card/id(src) //This access is so bots can be immediately set to patrol and leave Robotics, instead of having to be let out first. access_card.access += ACCESS_ROBOTICS @@ -132,15 +137,19 @@ //Adds bot to the diagnostic HUD system prepare_huds() - var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] - diag_hud.add_to_hud(src) + for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) + diag_hud.add_to_hud(src) diag_hud_set_bothealth() diag_hud_set_botstat() diag_hud_set_botmode() - //Gives a HUD view to player bots that use a HUD. - activate_data_hud() - + //If a bot has its own HUD (for player bots), provide it. + if(data_hud_type) + var/datum/atom_hud/datahud = GLOB.huds[data_hud_type] + datahud.add_hud_to(src) + if(path_hud) + path_hud.add_to_hud(src) + path_hud.add_hud_to(src) /mob/living/simple_animal/bot/update_canmove() . = ..() @@ -149,6 +158,10 @@ canmove = . /mob/living/simple_animal/bot/Destroy() + if(path_hud) + QDEL_NULL(path_hud) + path_hud = null + GLOB.bots_list -= src if(paicard) ejectpai() qdel(Radio) @@ -430,14 +443,14 @@ Pass a positive integer as an argument to override a bot's default speed. */ /mob/living/simple_animal/bot/proc/bot_move(dest, move_speed) if(!dest || !path || path.len == 0) //A-star failed or a path/destination was not set. - path = list() + set_path(null) return FALSE dest = get_turf(dest) //We must always compare turfs, so get the turf of the dest var if dest was originally something else. var/turf/last_node = get_turf(path[path.len]) //This is the turf at the end of the path, it should be equal to dest. if(get_turf(src) == dest) //We have arrived, no need to move again. return TRUE else if(dest != last_node) //The path should lead us to our given destination. If this is not true, we must stop. - path = list() + set_path(null) return FALSE var/step_count = move_speed ? move_speed : base_speed //If a value is passed into move_speed, use that instead of the default speed var. @@ -456,14 +469,14 @@ Pass a positive integer as an argument to override a bot's default speed. if(path.len > 1) step_towards(src, path[1]) if(get_turf(src) == path[1]) //Successful move - path.Cut(1,2) + increment_path() tries = 0 else tries++ return FALSE else if(path.len == 1) step_to(src, dest) - path = list() + set_path(null) return TRUE @@ -475,15 +488,12 @@ Pass a positive integer as an argument to override a bot's default speed. bot_reset() //Reset a bot before setting it to call mode. var/area/end_area = get_area(waypoint) - if(client) //Player bots instead get a location command from the AI - to_chat(src, "Priority waypoint set by [icon2html(caller, src)] [caller]. Proceed to [end_area.name]<\b>.") - //For giving the bot temporary all-access. var/obj/item/card/id/all_access = new /obj/item/card/id var/datum/job/captain/All = new/datum/job/captain all_access.access = All.get_access() - path = get_path_to(src, waypoint, /turf/proc/Distance_cardinal, 0, 200, id=all_access) + set_path(get_path_to(src, waypoint, /turf/proc/Distance_cardinal, 0, 200, id=all_access)) calling_ai = caller //Link the AI to the bot! ai_waypoint = waypoint @@ -491,6 +501,9 @@ Pass a positive integer as an argument to override a bot's default speed. if(!on) turn_on() //Saves the AI the hassle of having to activate a bot manually. access_card = all_access //Give the bot all-access while under the AI's command. + if(client) + reset_access_timer_id = addtimer(CALLBACK (src, .proc/bot_reset), 600, TIMER_OVERRIDE|TIMER_STOPPABLE) //if the bot is player controlled, they get the extra access for a limited time + to_chat(src, "Priority waypoint set by [icon2html(calling_ai, src)] [caller]. Proceed to [end_area.name].
[path.len-1] meters to destination. You have been granted additional door access for 60 seconds.
") if(message) to_chat(calling_ai, "[icon2html(src, calling_ai)] [name] called to [end_area.name]. [path.len-1] meters to destination.") pathset = 1 @@ -500,7 +513,7 @@ Pass a positive integer as an argument to override a bot's default speed. if(message) to_chat(calling_ai, "Failed to calculate a valid route. Ensure destination is clear of obstructions and within range.") calling_ai = null - path = list() + set_path(null) /mob/living/simple_animal/bot/proc/call_mode() //Handles preparing a bot for a call, as well as calling the move proc. //Handles the bot's movement during a call. @@ -515,7 +528,10 @@ Pass a positive integer as an argument to override a bot's default speed. if(calling_ai) //Simple notification to the AI if it called a bot. It will not know the cause or identity of the bot. to_chat(calling_ai, "Call command to a bot has been reset.") calling_ai = null - path = list() + if(reset_access_timer_id) + deltimer(reset_access_timer_id) + reset_access_timer_id = null + set_path(null) summon_target = null pathset = 0 access_card.access = prev_access @@ -579,7 +595,7 @@ Pass a positive integer as an argument to override a bot's default speed. else if(path.len > 0 && patrol_target) // valid path if(path[1] == loc) - path.Cut(1,2) + increment_path() return @@ -691,12 +707,12 @@ Pass a positive integer as an argument to override a bot's default speed. // given an optional turf to avoid /mob/living/simple_animal/bot/proc/calc_path(turf/avoid) check_bot_access() - path = get_path_to(src, patrol_target, /turf/proc/Distance_cardinal, 0, 120, id=access_card, exclude=avoid) + set_path(get_path_to(src, patrol_target, /turf/proc/Distance_cardinal, 0, 120, id=access_card, exclude=avoid)) /mob/living/simple_animal/bot/proc/calc_summon_path(turf/avoid) check_bot_access() spawn() - path = get_path_to(src, summon_target, /turf/proc/Distance_cardinal, 0, 150, id=access_card, exclude=avoid) + set_path(get_path_to(src, summon_target, /turf/proc/Distance_cardinal, 0, 150, id=access_card, exclude=avoid)) if(!path.len) //Cannot reach target. Give up and announce the issue. speak("Summon command failed, destination unreachable.",radio_channel) bot_reset() @@ -712,7 +728,7 @@ Pass a positive integer as an argument to override a bot's default speed. else if(path.len > 0 && summon_target) //Proper path acquired! if(path[1] == loc) - path.Cut(1,2) + increment_path() return var/moved = bot_move(summon_target, 3) // Move attempt @@ -899,7 +915,6 @@ Pass a positive integer as an argument to override a bot's default speed. . = ..() access_card.access += player_access diag_hud_set_botmode() - activate_data_hud() /mob/living/simple_animal/bot/Logout() . = ..() @@ -919,9 +934,63 @@ Pass a positive integer as an argument to override a bot's default speed. /mob/living/simple_animal/bot/sentience_act() faction -= "silicon" -/mob/living/simple_animal/bot/proc/activate_data_hud() -//If a bot has its own HUD (for player bots), provide it. - if(!data_hud_type) +/mob/living/simple_animal/bot/proc/set_path(list/newpath) + path = newpath ? newpath : list() + if(!path_hud) return - var/datum/atom_hud/datahud = GLOB.huds[data_hud_type] - datahud.add_hud_to(src) + var/list/path_huds_watching_me = list(GLOB.huds[DATA_HUD_DIAGNOSTIC_ADVANCED]) + if(path_hud) + path_huds_watching_me += path_hud + for(var/V in path_huds_watching_me) + var/datum/atom_hud/H = V + H.remove_from_hud(src) + + var/list/path_images = hud_list[DIAG_PATH_HUD] + QDEL_LIST(path_images) + if(newpath) + for(var/i in 1 to newpath.len) + var/turf/T = newpath[i] + var/direction = NORTH + if(i > 1) + var/turf/prevT = path[i - 1] + var/image/prevI = path[prevT] + direction = get_dir(prevT, T) + if(i > 2) + var/turf/prevprevT = path[i - 2] + var/prevDir = get_dir(prevprevT, prevT) + var/mixDir = direction|prevDir + if(mixDir in GLOB.diagonals) + prevI.dir = mixDir + if(prevDir & (NORTH|SOUTH)) + var/matrix/ntransform = matrix() + ntransform.Turn(90) + if((mixDir == NORTHWEST) || (mixDir == SOUTHEAST)) + ntransform.Scale(-1, 1) + else + ntransform.Scale(1, -1) + prevI.transform = ntransform + var/mutable_appearance/MA = new /mutable_appearance() + MA.icon = path_image_icon + MA.icon_state = path_image_icon_state + MA.layer = ABOVE_OPEN_TURF_LAYER + MA.plane = 0 + MA.appearance_flags = RESET_COLOR|RESET_TRANSFORM + MA.color = path_image_color + MA.dir = direction + var/image/I = image(loc = T) + I.appearance = MA + path[T] = I + path_images += I + + for(var/V in path_huds_watching_me) + var/datum/atom_hud/H = V + H.add_to_hud(src) + + +/mob/living/simple_animal/bot/proc/increment_path() + if(!path || !path.len) + return + var/image/I = path[path[1]] + if(I) + I.icon = null + path.Cut(1, 2) diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm index 4eb225360a..efe289b222 100644 --- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm +++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm @@ -16,6 +16,7 @@ window_id = "autoclean" window_name = "Automatic Station Cleaner v1.2" pass_flags = PASSMOB + path_image_color = "#993299" var/blood = 1 var/trash = 0 diff --git a/code/modules/mob/living/simple_animal/bot/ed209bot.dm b/code/modules/mob/living/simple_animal/bot/ed209bot.dm index 62fb2e772c..463082adda 100644 --- a/code/modules/mob/living/simple_animal/bot/ed209bot.dm +++ b/code/modules/mob/living/simple_animal/bot/ed209bot.dm @@ -21,6 +21,7 @@ window_name = "Automatic Security Unit v2.6" allow_pai = 0 data_hud_type = DATA_HUD_SECURITY_ADVANCED + path_image_color = "#FF0000" var/lastfired = 0 var/shot_delay = 15 diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm index 28a64838f7..707d77e2ac 100644 --- a/code/modules/mob/living/simple_animal/bot/floorbot.dm +++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm @@ -17,6 +17,7 @@ bot_core = /obj/machinery/bot_core/floorbot window_id = "autofloor" window_name = "Automatic Station Floor Repairer v1.1" + path_image_color = "#FFA500" var/process_type //Determines what to do when process_scan() recieves a target. See process_scan() for details. var/targetdirection diff --git a/code/modules/mob/living/simple_animal/bot/honkbot.dm b/code/modules/mob/living/simple_animal/bot/honkbot.dm index 3e15adbfe0..1052542f5a 100644 --- a/code/modules/mob/living/simple_animal/bot/honkbot.dm +++ b/code/modules/mob/living/simple_animal/bot/honkbot.dm @@ -18,6 +18,7 @@ window_id = "autohonk" window_name = "Honkomatic Bike Horn Unit v1.0.7" data_hud_type = DATA_HUD_SECURITY_BASIC // show jobs + path_image_color = "#FF69B4" var/honksound = 'sound/items/bikehorn.ogg' //customizable sound var/spam_flag = FALSE diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index 57cad4570f..03dbc240ec 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -25,6 +25,7 @@ window_id = "automed" window_name = "Automatic Medical Unit v1.1" data_hud_type = DATA_HUD_MEDICAL_ADVANCED + path_image_color = "#DDDDFF" var/obj/item/reagent_containers/glass/reagent_glass = null //Can be set to draw from this for reagents. var/skin = null //Set to "tox", "ointment" or "o2" for the other two firstaid kits. @@ -342,7 +343,7 @@ //Time to see if they need medical help! if(C.stat == DEAD || (C.status_flags & FAKEDEATH)) return FALSE //welp too late for them! - + if(!(loc == C.loc) && !(isturf(C.loc) && isturf(loc))) return FALSE diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index 170659ef29..0cba76edf5 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -31,6 +31,8 @@ suffix = "" + path_image_color = "#7F5200" + var/atom/movable/load = null var/mob/living/passenger = null var/turf/target // this is turf to navigate to (location of beacon) diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm index 82eae37f82..b8b2621875 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -20,6 +20,7 @@ window_name = "Automatic Security Unit v1.6" allow_pai = 0 data_hud_type = DATA_HUD_SECURITY_ADVANCED + path_image_color = "#FF0000" var/mob/living/carbon/target var/oldtarget_name diff --git a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm index f7ee4ac29a..e4de4387be 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm @@ -102,8 +102,8 @@ else verbs -= /mob/living/simple_animal/drone/verb/toggle_statics - var/datum/atom_hud/data/diagnostic/diag_hud = GLOB.huds[DATA_HUD_DIAGNOSTIC] - diag_hud.add_to_hud(src) + for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds) + diag_hud.add_to_hud(src) /mob/living/simple_animal/drone/med_hud_set_health() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 9a9b161e51..dd32042849 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -42,9 +42,14 @@ /atom/proc/prepare_huds() hud_list = list() for(var/hud in hud_possible) - var/image/I = image('icons/mob/hud.dmi', src, "") - I.appearance_flags = RESET_COLOR|RESET_TRANSFORM - hud_list[hud] = I + var/hint = hud_possible[hud] + switch(hint) + if(HUD_LIST_LIST) + hud_list[hud] = list() + else + var/image/I = image('icons/mob/hud.dmi', src, "") + I.appearance_flags = RESET_COLOR|RESET_TRANSFORM + hud_list[hud] = I /mob/proc/Cell() set category = "Admin" diff --git a/icons/mob/aibots.dmi b/icons/mob/aibots.dmi index c6ee573913..873147c91c 100644 Binary files a/icons/mob/aibots.dmi and b/icons/mob/aibots.dmi differ