diff --git a/code/__DEFINES/hud.dm b/code/__DEFINES/hud.dm index 4126fe1725f..29392997893 100644 --- a/code/__DEFINES/hud.dm +++ b/code/__DEFINES/hud.dm @@ -26,6 +26,11 @@ #define PLANT_PEST_HUD "21"// Pest level #define PLANT_WEED_HUD "22"// Weed level #define DIAG_TRACK_HUD "23"// Mech tracking beacon +#define DIAG_PATH_HUD "24"//Bot path indicators + +//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! @@ -34,20 +39,21 @@ #define DATA_HUD_MEDICAL_BASIC 3 #define DATA_HUD_MEDICAL_ADVANCED 4 #define DATA_HUD_DIAGNOSTIC 5 -#define DATA_HUD_HYDROPONIC 6 +#define DATA_HUD_DIAGNOSTIC_ADVANCED 6 +#define DATA_HUD_HYDROPONIC 7 //NATIONS -#define GAME_HUD_NATIONS 7 +#define GAME_HUD_NATIONS 8 //antag HUD defines -#define ANTAG_HUD_CULT 8 -#define ANTAG_HUD_REV 9 -#define ANTAG_HUD_OPS 10 -#define ANTAG_HUD_WIZ 11 -#define ANTAG_HUD_SHADOW 12 -#define ANTAG_HUD_TRAITOR 13 -#define ANTAG_HUD_NINJA 14 //For Daves Rework -#define ANTAG_HUD_CHANGELING 15 -#define ANTAG_HUD_VAMPIRE 16 -#define ANTAG_HUD_ABDUCTOR 17 //For Fox +#define ANTAG_HUD_CULT 9 +#define ANTAG_HUD_REV 10 +#define ANTAG_HUD_OPS 11 +#define ANTAG_HUD_WIZ 12 +#define ANTAG_HUD_SHADOW 13 +#define ANTAG_HUD_TRAITOR 14 +#define ANTAG_HUD_NINJA 15 +#define ANTAG_HUD_CHANGELING 16 +#define ANTAG_HUD_VAMPIRE 17 +#define ANTAG_HUD_ABDUCTOR 18 // Notification action types #define NOTIFY_JUMP "jump" diff --git a/code/_globalvars/lists/mobs.dm b/code/_globalvars/lists/mobs.dm index 644740c9e20..28ebfca6b1b 100644 --- a/code/_globalvars/lists/mobs.dm +++ b/code/_globalvars/lists/mobs.dm @@ -25,6 +25,7 @@ var/global/list/respawnable_list = list() //List of all mobs, dead or in mindl var/global/list/non_respawnable_keys = list() //List of ckeys that are excluded from respawning for remainder of round. var/global/list/simple_animal_list = list() //List of all simple animals, including clientless var/global/list/snpc_list = list() //List of all snpc's, including clientless +var/global/list/bots_list = list() //List of all bots(beepsky, medibots,etc) var/global/list/med_hud_users = list() var/global/list/sec_hud_users = list() diff --git a/code/datums/hud.dm b/code/datums/hud.dm index c29b5daf5b3..04ebcc68ed5 100644 --- a/code/datums/hud.dm +++ b/code/datums/hud.dm @@ -1,4 +1,5 @@ /* HUD DATUMS */ +var/global/list/all_huds = list() ///GLOBAL HUD LIST var/datum/atom_hud/huds = list( \ @@ -7,6 +8,7 @@ var/datum/atom_hud/huds = list( \ 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_ADVANCED = new/datum/atom_hud/data/diagnostic/advanced(), \ DATA_HUD_HYDROPONIC = new/datum/atom_hud/data/hydroponic(), \ GAME_HUD_NATIONS = new/datum/atom_hud/antag(), \ ANTAG_HUD_CULT = new/datum/atom_hud/antag(), \ @@ -26,6 +28,18 @@ var/datum/atom_hud/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() + 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) + all_huds -= src + return ..() + /datum/atom_hud/proc/remove_hud_from(mob/M) if(!M) return @@ -82,7 +96,7 @@ var/datum/atom_hud/huds = list( \ serv_huds += serv.thrallhud - for(var/datum/atom_hud/hud in (huds|serv_huds))//|gang_huds)) + for(var/datum/atom_hud/hud in (all_huds|serv_huds))//|gang_huds)) if(src in hud.hudusers) hud.add_hud_to(src) diff --git a/code/game/data_huds.dm b/code/game/data_huds.dm index 604e92a47e0..23bd63a58f7 100644 --- a/code/game/data_huds.dm +++ b/code/game/data_huds.dm @@ -46,6 +46,12 @@ /datum/atom_hud/data/diagnostic hud_icons = list (DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD, DIAG_BOT_HUD, DIAG_TRACK_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_PATH_HUD) + +/datum/atom_hud/data/bot_path + hud_icons = list(DIAG_PATH_HUD) + /datum/atom_hud/data/hydroponic hud_icons = list (PLANT_NUTRIENT_HUD, PLANT_WATER_HUD, PLANT_STATUS_HUD, PLANT_HEALTH_HUD, PLANT_TOXIN_HUD, PLANT_PEST_HUD, PLANT_WEED_HUD) @@ -120,6 +126,7 @@ return "health-100" //doc u had 1 job return "0" + ///HOOKS //called when a human changes suit sensors @@ -128,22 +135,26 @@ B.update_suit_sensors(src) -//called when a carbon changes health -/mob/living/carbon/proc/med_hud_set_health() +//called when a living mob changes health +/mob/living/proc/med_hud_set_health() var/image/holder = hud_list[HEALTH_HUD] - if(stat == 2) - holder.icon_state = "hudhealth-100" - else - holder.icon_state = "hud[RoundHealth(health)]" + holder.icon_state = "hud[RoundHealth(src)]" + //called when a carbon changes stat, virus or XENO_HOST -/mob/living/carbon/proc/med_hud_set_status() +/mob/living/proc/med_hud_set_status() var/image/holder = hud_list[STATUS_HUD] - //var/image/holder2 = hud_list[STATUS_HUD_OOC] - var/mob/living/simple_animal/borer/B = has_brain_worms() - if(stat == 2) + if(stat == DEAD) + holder.icon_state = "huddead" + else + holder.icon_state = "hudhealthy" + +//called when a carbon changes stat, virus or XENO_HOST +/mob/living/carbon/med_hud_set_status() + var/image/holder = hud_list[STATUS_HUD] + var/mob/living/simple_animal/borer/B = has_brain_worms() + if(stat == DEAD) holder.icon_state = "huddead" - //holder2.icon_state = "huddead" else if(status_flags & XENO_HOST) holder.icon_state = "hudxeno" else if(check_virus()) @@ -152,7 +163,6 @@ holder.icon_state = "hudbrainworm" else holder.icon_state = "hudhealthy" - //holder2.icon_state = "hudhealthy" diff --git a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm index d052939cb14..e80ba05eccb 100644 --- a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm +++ b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm @@ -112,6 +112,7 @@ loot = list(/obj/effect/decal/cleanable/blood/gibs/robot, /obj/item/weapon/ore/bluespace_crystal/artificial) deathmessage = "The swarmer explodes with a sharp pop!" del_on_death = 1 + hud_possible = list(SPECIALROLE_HUD, DIAG_STAT_HUD, DIAG_HUD) /mob/living/simple_animal/hostile/swarmer/Login() ..() @@ -127,8 +128,22 @@ ..() add_language("Swarmer", 1) verbs -= /mob/living/verb/pulled + for(var/datum/atom_hud/data/diagnostic/diag_hud in huds) + diag_hud.add_to_hud(src) updatename() +/mob/living/simple_animal/hostile/swarmer/med_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 + holder.icon_state = "huddiag[RoundDiagBar(health / maxHealth)]" + +/mob/living/simple_animal/hostile/swarmer/med_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 + holder.icon_state = "hudstat" + /mob/living/simple_animal/hostile/swarmer/Stat() ..() if(statpanel("Status")) diff --git a/code/game/gamemodes/miniantags/guardian/guardian.dm b/code/game/gamemodes/miniantags/guardian/guardian.dm index 42003013441..89be0391463 100644 --- a/code/game/gamemodes/miniantags/guardian/guardian.dm +++ b/code/game/gamemodes/miniantags/guardian/guardian.dm @@ -41,6 +41,21 @@ var/adminseal = FALSE var/name_color = "white"//only used with protector shields for the time being +/mob/living/simple_animal/hostile/guardian/med_hud_set_health() + if(summoner) + var/image/holder = hud_list[HEALTH_HUD] + holder.icon_state = "hud[RoundHealth(summoner)]" + +/mob/living/simple_animal/hostile/guardian/med_hud_set_status() + if(summoner) + var/image/holder = hud_list[STATUS_HUD] + var/icon/I = icon(icon, icon_state, dir) + holder.pixel_y = I.Height() - world.icon_size + if(summoner.stat == DEAD) + holder.icon_state = "huddead" + else + holder.icon_state = "hudhealthy" + /mob/living/simple_animal/hostile/guardian/Life() //Dies if the summoner dies ..() if(summoner) @@ -88,7 +103,8 @@ resulthealth = round((summoner.health / summoner.maxHealth) * 100) if(hud_used) hud_used.guardianhealthdisplay.maptext = "
[resulthealth]%
" - + med_hud_set_health() + med_hud_set_status() /mob/living/simple_animal/hostile/guardian/adjustHealth(amount) //The spirit is invincible, but passes on damage to the summoner var/damage = amount * damage_transfer diff --git a/code/game/gamemodes/miniantags/guardian/types/healer.dm b/code/game/gamemodes/miniantags/guardian/types/healer.dm index c8001050ad1..d51e4cefd45 100644 --- a/code/game/gamemodes/miniantags/guardian/types/healer.dm +++ b/code/game/gamemodes/miniantags/guardian/types/healer.dm @@ -52,6 +52,9 @@ C.adjustOxyLoss(-5) C.adjustToxLoss(-5) heal_cooldown = world.time + 20 + if(C == summoner) + med_hud_set_health() + med_hud_set_status() /mob/living/simple_animal/hostile/guardian/healer/ToggleMode() if(loc == summoner) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 3ab3d0e154b..63fc5a47168 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -98,8 +98,8 @@ log_message("[src] created.") mechas_list += src //global mech list prepare_huds() - var/datum/atom_hud/data/diagnostic/diag_hud = huds[DATA_HUD_DIAGNOSTIC] - diag_hud.add_to_hud(src) + for(var/datum/atom_hud/data/diagnostic/diag_hud in huds) + diag_hud.add_to_hud(src) diag_hud_set_mechhealth() diag_hud_set_mechcell() diag_hud_set_mechstat() diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index a743e779687..1fa4b57356f 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -2,20 +2,6 @@ var/canEnterVentWith = "/obj/item/weapon/implant=0&/obj/item/clothing/mask/facehugger=0&/obj/item/device/radio/borg=0&/obj/machinery/camera=0" var/datum/middleClickOverride/middleClickOverride = null -/mob/living/carbon/prepare_huds() - ..() - prepare_data_huds() - -/mob/living/carbon/proc/prepare_data_huds() - ..() - med_hud_set_health() - med_hud_set_status() - -/mob/living/carbon/updatehealth() - ..() - med_hud_set_health() - med_hud_set_status() - /mob/living/carbon/Destroy() QDEL_LIST(internal_organs) QDEL_LIST(stomach_contents) @@ -23,7 +9,6 @@ if(B) B.leave_host() qdel(B) - remove_from_all_data_huds() return ..() /mob/living/carbon/blob_act() diff --git a/code/modules/mob/living/carbon/carbon_defines.dm b/code/modules/mob/living/carbon/carbon_defines.dm index 7ed39d78382..49589477718 100644 --- a/code/modules/mob/living/carbon/carbon_defines.dm +++ b/code/modules/mob/living/carbon/carbon_defines.dm @@ -1,6 +1,5 @@ /mob/living/carbon gender = MALE - hud_possible = list(HEALTH_HUD,STATUS_HUD,SPECIALROLE_HUD) var/list/stomach_contents = list() var/list/internal_organs = list() var/list/internal_organs_slot = list() //Same as above, but stores "slot ID" - "organ" pairs for easy access. diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index 2221455c5a5..9056a078791 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -14,4 +14,7 @@ var/datum/soullink/S = s S.sharerDies(gibbed, src) + med_hud_set_health() + med_hud_set_status() + ..(gibbed) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 42e461b6e03..1bc65a863ae 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1,7 +1,22 @@ +/mob/living/New() + . = ..() + var/datum/atom_hud/data/human/medical/advanced/medhud = huds[DATA_HUD_MEDICAL_ADVANCED] + medhud.add_to_hud(src) + +/mob/living/prepare_huds() + ..() + prepare_data_huds() + +/mob/living/proc/prepare_data_huds() + ..() + med_hud_set_health() + med_hud_set_status() + /mob/living/Destroy() if(ranged_ability) ranged_ability.remove_ranged_ability(src) + remove_from_all_data_huds() return ..() /mob/living/ghostize(can_reenter_corpse = 1) @@ -214,6 +229,7 @@ stat = CONSCIOUS return health = maxHealth - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - getCloneLoss() + med_hud_set_health() //This proc is used for mobs which are affected by pressure to calculate the amount of pressure that actually diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 5aaf02688d3..d5c1480a3b7 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -64,3 +64,4 @@ var/list/recent_tastes = list() var/blood_volume = 0 //how much blood the mob has + hud_possible = list(HEALTH_HUD,STATUS_HUD,SPECIALROLE_HUD) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 74daf90fa4e..7469c2cca73 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -30,7 +30,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_ADVANCED //There is only one kind of diag hud var/obj/item/device/radio/common_radio @@ -44,6 +44,12 @@ add_language("Galactic Common") init_subsystems() +/mob/living/silicon/med_hud_set_health() + return //we use a different hud + +/mob/living/silicon/med_hud_set_status() + return //we use a different hud + /mob/living/silicon/Destroy() silicon_mob_list -= src for(var/datum/alarm_handler/AH in alarm_handlers) @@ -232,8 +238,8 @@ medsensor.add_hud_to(src) /mob/living/silicon/proc/add_diag_hud() - var/datum/atom_hud/diagsensor = huds[d_hud] - diagsensor.add_hud_to(src) + for(var/datum/atom_hud/data/diagnostic/diagsensor in huds) + diagsensor.add_hud_to(src) /mob/living/silicon/proc/toggle_sensor_mode() diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 09a7a124783..bbf591ee453 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -47,7 +47,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,6 +75,7 @@ var/control_freq = BOT_FREQ // bot control frequency var/bot_filter // The radio filter the bot uses to identify itself on the network. 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. //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", \ @@ -82,7 +83,13 @@ "Responding", "Navigating to Delivery Location", "Navigating to Home", \ "Waiting for clear path", "Calculating navigation path", "Pinging beacon network", "Unable to reach destination") - hud_possible = list(DIAG_STAT_HUD, DIAG_BOT_HUD, DIAG_HUD) //Diagnostic HUD views + var/datum/atom_hud/data/bot_path/path_hud = new /datum/atom_hud/data/bot_path() + var/path_image_icon = 'icons/obj/aibots.dmi' + var/path_image_icon_state = "path_indicator" + var/path_image_color = "#FFFFFF" + var/reset_access_timer_id + + hud_possible = list(DIAG_STAT_HUD, DIAG_BOT_HUD, DIAG_HUD, DIAG_PATH_HUD = HUD_LIST_LIST)//Diagnostic HUD views /obj/item/device/radio/headset/bot subspace_transmission = 1 @@ -130,6 +137,7 @@ /mob/living/simple_animal/bot/New() ..() + bots_list += src icon_living = icon_state icon_dead = icon_state access_card = new /obj/item/weapon/card/id(src) @@ -151,14 +159,24 @@ radio_controller.add_object(bot_core, control_freq, bot_filter) prepare_huds() - var/datum/atom_hud/data/diagnostic/diag_hud = huds[DATA_HUD_DIAGNOSTIC] - diag_hud.add_to_hud(src) + for(var/datum/atom_hud/data/diagnostic/diag_hud in huds) + diag_hud.add_to_hud(src) + diag_hud.add_hud_to(src) + permanent_huds |= diag_hud diag_hud_set_bothealth() diag_hud_set_botstat() diag_hud_set_botmode() // give us the hud too! - diag_hud.add_hud_to(src) - permanent_huds |= diag_hud + if(path_hud) + path_hud.add_to_hud(src) + path_hud.add_hud_to(src) + + +/mob/living/simple_animal/bot/med_hud_set_health() + return //we use a different hud + +/mob/living/simple_animal/bot/med_hud_set_status() + return //we use a different hud /mob/living/simple_animal/bot/update_canmove(delay_action_updates = 0) . = ..() @@ -169,6 +187,10 @@ /mob/living/simple_animal/bot/Destroy() if(paicard) ejectpai() + if(path_hud) + QDEL_NULL(path_hud) + path_hud = null + bots_list -= src QDEL_NULL(Radio) QDEL_NULL(access_card) if(radio_controller && bot_filter) @@ -446,14 +468,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 0 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 1 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 0 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. @@ -472,14 +494,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 -= path[1] + increment_path() tries = 0 else tries++ return 0 else if(path.len == 1) step_to(src, dest) - path = list() + set_path(null) return 1 @@ -496,7 +518,7 @@ Pass a positive integer as an argument to override a bot's default speed. 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 @@ -504,6 +526,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(src, "bot_reset", 600) //if the bot is player controlled, they get the extra access for a limited time + to_chat(src, "Priority waypoint set by [calling_ai] [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, "[bicon(src)] [name] called to [end_area.name]. [path.len-1] meters to destination.") pathset = 1 @@ -513,7 +538,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. @@ -528,7 +553,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 @@ -593,7 +621,7 @@ Pass a positive integer as an argument to override a bot's default speed. else if(path.len > 0 && patrol_target) // valid path var/turf/next = path[1] if(next == loc) - path -= next + increment_path() return @@ -749,12 +777,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() @@ -771,7 +799,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! var/turf/next = path[1] if(next == loc) - path -= next + increment_path() return var/moved = bot_move(summon_target, 3) // Move attempt @@ -1015,3 +1043,64 @@ Pass a positive integer as an argument to override a bot's default speed. /mob/living/simple_animal/bot/is_mechanical() return 1 + +/mob/living/simple_animal/bot/proc/set_path(list/newpath) + path = newpath ? newpath : list() + if(!path_hud) + return + var/list/path_huds_watching_me = list(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 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) \ No newline at end of file diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm index 58911c4316b..9cfc4da18eb 100644 --- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm +++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm @@ -17,6 +17,8 @@ window_id = "autoclean" window_name = "Automatic Station Cleaner v1.1" pass_flags = PASSMOB + path_image_color = "#993299" + var/blood = 1 var/list/target_types = list() diff --git a/code/modules/mob/living/simple_animal/bot/ed209bot.dm b/code/modules/mob/living/simple_animal/bot/ed209bot.dm index c577722fe43..3cf6e92d5f1 100644 --- a/code/modules/mob/living/simple_animal/bot/ed209bot.dm +++ b/code/modules/mob/living/simple_animal/bot/ed209bot.dm @@ -20,6 +20,8 @@ bot_core = /obj/machinery/bot_core/secbot window_id = "autoed209" window_name = "Automatic Security Unit v2.6" + path_image_color = "#FF0000" + data_hud_type = DATA_HUD_SECURITY_ADVANCED var/lastfired = 0 var/shot_delay = 3 //.3 seconds between shots diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm index 40a2b1f1631..8144cd84bd6 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/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index c4952b09a34..d1fbd235efc 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -19,6 +19,8 @@ bot_core_type = /obj/machinery/bot_core/medbot window_id = "automed" window_name = "Automatic Medical Unit v1.1" + path_image_color = "#DDDDFF" + data_hud_type = DATA_HUD_MEDICAL_ADVANCED var/obj/item/weapon/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. diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index 6130213df27..380b301861e 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -26,6 +26,8 @@ model = "MULE" bot_purpose = "deliver crates and other packages between departments, as requested" bot_core_type = /obj/machinery/bot_core/mulebot + path_image_color = "#7F5200" + suffix = "" @@ -502,7 +504,7 @@ var/turf/next = path[1] reached_target = 0 if(next == loc) - path -= next + increment_path() return if(istype(next, /turf/simulated)) // to_chat(world, "at ([x],[y]) moving to ([next.x],[next.y])") @@ -513,7 +515,7 @@ if(moved && oldloc!=loc) // successful move // to_chat(world, "Successful move.") blockcount = 0 - path -= loc + increment_path() if(destination == home_destination) mode = BOT_GO_HOME @@ -570,7 +572,7 @@ // given an optional turf to avoid /mob/living/simple_animal/bot/mulebot/calc_path(turf/avoid = null) check_bot_access() - path = get_path_to(src, target, /turf/proc/Distance_cardinal, 0, 250, id=access_card, exclude=avoid) + set_path(get_path_to(src, target, /turf/proc/Distance_cardinal, 0, 250, id=access_card, exclude=avoid)) // sets the current destination // signals all beacons matching the delivery code diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm index 9c04e47521a..0d1cbe27cb5 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -18,6 +18,8 @@ bot_core_type = /obj/machinery/bot_core/secbot window_id = "autosec" window_name = "Automatic Security Unit v1.6" + path_image_color = "#FF0000" + data_hud_type = DATA_HUD_SECURITY_ADVANCED var/base_icon = "secbot" var/mob/living/carbon/target diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 0b0c44868ab..9d9f0ed0c11 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -106,6 +106,7 @@ /mob/living/simple_animal/updatehealth() ..() health = Clamp(health, 0, maxHealth) + med_hud_set_status() /mob/living/simple_animal/handle_hud_icons_health() ..() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index aa4fb41ca08..a98540b0a2d 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -34,8 +34,15 @@ ..() /atom/proc/prepare_huds() + hud_list = list() for(var/hud in hud_possible) - hud_list[hud] = image('icons/mob/hud.dmi', src, "") + 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, "") + hud_list[hud] = I /mob/proc/generate_name() return name diff --git a/icons/mob/hud.dmi b/icons/mob/hud.dmi index c56439d56f4..760e82458d8 100644 Binary files a/icons/mob/hud.dmi and b/icons/mob/hud.dmi differ diff --git a/icons/obj/aibots.dmi b/icons/obj/aibots.dmi index b6e60dab2dc..b564c3a59e1 100644 Binary files a/icons/obj/aibots.dmi and b/icons/obj/aibots.dmi differ