diff --git a/code/__DEFINES/bots.dm b/code/__DEFINES/bots.dm
new file mode 100644
index 00000000000..d6da76b02e4
--- /dev/null
+++ b/code/__DEFINES/bots.dm
@@ -0,0 +1,25 @@
+//Bot defines, placed here so they can be read by other things!
+
+#define BOT_STEP_DELAY 4 //Delay between movemements
+
+#define DEFAULT_SCAN_RANGE 7 //default view range for finding targets.
+
+//Mode defines
+#define BOT_IDLE 0 // idle
+#define BOT_HUNT 1 // found target, hunting
+#define BOT_PREP_ARREST 2 // at target, preparing to arrest
+#define BOT_ARREST 3 // arresting target
+#define BOT_START_PATROL 4 // start patrol
+#define BOT_PATROL 5 // patrolling
+#define BOT_SUMMON 6 // summoned by PDA
+#define BOT_CLEANING 7 // cleaning (cleanbots)
+#define BOT_REPAIRING 8 // repairing hull breaches (floorbots)
+#define BOT_MOVING 9 // for clean/floor/med bots, when moving.
+#define BOT_HEALING 10 // healing people (medbots)
+#define BOT_RESPONDING 11 // responding to a call from the AI
+#define BOT_DELIVER 12 // moving to deliver
+#define BOT_GO_HOME 13 // returning to home
+#define BOT_BLOCKED 14 // blocked
+#define BOT_NAV 15 // computing navigation
+#define BOT_WAIT_FOR_NAV 16 // waiting for nav computation
+#define BOT_NO_ROUTE 17 // no destination beacon found (or no route)
\ No newline at end of file
diff --git a/code/__DEFINES/hud.dm b/code/__DEFINES/hud.dm
index c10e56598de..0ac66f3092d 100644
--- a/code/__DEFINES/hud.dm
+++ b/code/__DEFINES/hud.dm
@@ -13,6 +13,7 @@
#define DIAG_HUD "9" // Silicon health bar
#define DIAG_BATT_HUD "10"// Borg/Mech power meter
#define DIAG_MECH_HUD "11"// Mech health bar
+#define DIAG_BOT_HUD "12"// Bot HUDs
//for antag huds. these are used at the /mob level
#define ANTAG_HUD "12"
diff --git a/code/game/data_huds.dm b/code/game/data_huds.dm
index 7e25943ea11..3ae2e05f76d 100644
--- a/code/game/data_huds.dm
+++ b/code/game/data_huds.dm
@@ -45,7 +45,7 @@
hud_icons = list(ID_HUD, IMPTRACK_HUD, IMPLOYAL_HUD, IMPCHEM_HUD, WANTED_HUD)
/datum/atom_hud/data/diagnostic
- hud_icons = list (DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD)
+ hud_icons = list (DIAG_HUD, DIAG_STAT_HUD, DIAG_BATT_HUD, DIAG_MECH_HUD, DIAG_BOT_HUD)
/* MED/SEC/DIAG HUD HOOKS */
@@ -248,4 +248,40 @@
var/image/holder = hud_list[DIAG_STAT_HUD]
holder.icon_state = null
if(internal_damage)
- holder.icon_state = "hudwarn"
\ No newline at end of file
+ holder.icon_state = "hudwarn"
+
+/*~~~~~~~~~
+ Bots!
+~~~~~~~~~~*/
+/mob/living/simple_animal/bot/proc/diag_hud_set_bothealth()
+ var/image/holder = hud_list[DIAG_HUD]
+ holder.icon_state = "huddiag[RoundDiagBar(health/maxHealth)]"
+
+/mob/living/simple_animal/bot/proc/diag_hud_set_botstat() //On (With wireless on or off), Off, EMP'ed
+ var/image/holder = hud_list[DIAG_STAT_HUD]
+ if(on)
+ holder.icon_state = "hudstat"
+ else if(stat) //Generally EMP causes this
+ holder.icon_state = "hudoffline"
+ else //Bot is off
+ holder.icon_state = "huddead2"
+
+/mob/living/simple_animal/bot/proc/diag_hud_set_botmode() //Shows a bot's current operation
+ var/image/holder = hud_list[DIAG_BOT_HUD]
+ if(client) //If the bot is player controlled, it will not be following mode logic!
+ holder.icon_state = "hudsentient"
+ return
+
+ switch(mode)
+ if(BOT_SUMMON, BOT_RESPONDING) //Responding to PDA or AI summons
+ holder.icon_state = "hudcalled"
+ if(BOT_CLEANING, BOT_REPAIRING, BOT_HEALING) //Cleanbot cleaning, Floorbot fixing, or Medibot Healing
+ holder.icon_state = "hudworking"
+ if(BOT_PATROL, BOT_START_PATROL) //Patrol mode
+ holder.icon_state = "hudpatrol"
+ if(BOT_PREP_ARREST, BOT_ARREST, BOT_HUNT) //STOP RIGHT THERE, CRIMINAL SCUM!
+ holder.icon_state = "hudalert"
+ if(BOT_MOVING, BOT_DELIVER, BOT_GO_HOME, BOT_NAV) //Moving to target for normal bots, moving to deliver or go home for MULES.
+ holder.icon_state = "hudmove"
+ else
+ holder.icon_state = ""
\ No newline at end of file
diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm
index 1115cb8aeb8..642634e0032 100644
--- a/code/modules/mob/living/silicon/ai/ai.dm
+++ b/code/modules/mob/living/silicon/ai/ai.dm
@@ -517,15 +517,16 @@ var/list/ai_list = list()
var/ai_Zlevel = ai_current_turf.z
var/d
var/area/bot_area
- d += "Query network status
"
+ d += "Query network status
"
d += "
Name | Status | Location | Control | ||
| [Bot.hacked ? "(!)" : ""] [Bot.name] ([Bot.model]) | " + var/bot_mode = Bot.get_mode() + d += "|||||
| [Bot.hacked ? "(!)" : ""] [Bot.name] ([Bot.model]) | " //If the bot is on, it will display the bot's current mode status. If the bot is not mode, it will just report "Idle". "Inactive if it is not on at all. - d += "[Bot.on ? "[Bot.mode ? "[ Bot.get_mode() ]": "Idle"]" : "Inactive"] | " + d += "[bot_mode] | " d += "[bot_area.name] | " d += "Interface | " d += "Call | " diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 6b6f4f34240..63f9d4a5969 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -1,26 +1,4 @@ -#define BOT_STEP_DELAY 4 //Delay between movemements - -#define DEFAULT_SCAN_RANGE 7 //default view range for finding targets. - -//Mode defines -#define BOT_IDLE 0 // idle -#define BOT_HUNT 1 // found target, hunting -#define BOT_PREP_ARREST 2 // at target, preparing to arrest -#define BOT_ARREST 3 // arresting target -#define BOT_START_PATROL 4 // start patrol -#define BOT_PATROL 5 // patrolling -#define BOT_SUMMON 6 // summoned by PDA -#define BOT_CLEANING 7 // cleaning (cleanbots) -#define BOT_REPAIRING 8 // repairing hull breaches (floorbots) -#define BOT_MOVING 9 // for clean/floor/med bots, when moving. -#define BOT_HEALING 10 // healing people (medbots) -#define BOT_RESPONDING 11 // responding to a call from the AI -#define BOT_DELIVER 12 // moving to deliver -#define BOT_GO_HOME 13 // returning to home -#define BOT_BLOCKED 14 // blocked -#define BOT_NAV 15 // computing navigation -#define BOT_WAIT_FOR_NAV 16 // waiting for nav computation -#define BOT_NO_ROUTE 17 // no destination beacon found (or no route) +//Defines for bots are now found in code\__DEFINES\bots.dm // AI (i.e. game AI, not the AI player) controlled bots /mob/living/simple_animal/bot @@ -92,17 +70,24 @@ "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. + hud_possible = list(DIAG_STAT_HUD, DIAG_BOT_HUD, DIAG_HUD) //Diagnostic HUD views + /mob/living/simple_animal/bot/proc/get_mode() - if(!mode) - return "Idle" + 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. + return "Sentient" + else if(!on) + return "Inactive" + else if(!mode) + return "Idle" else - return mode_name[mode] + return "[mode_name[mode]]" /mob/living/simple_animal/bot/proc/turn_on() if(stat) return 0 on = 1 SetLuminosity(initial(luminosity)) update_icon() + diag_hud_set_botstat() return 1 /mob/living/simple_animal/bot/proc/turn_off() @@ -125,6 +110,13 @@ bot_core = new bot_core_type(src) + prepare_huds() + var/datum/atom_hud/data/diagnostic/diag_hud = huds[DATA_HUD_DIAGNOSTIC] + diag_hud.add_to_hud(src) + diag_hud_set_bothealth() + diag_hud_set_botstat() + diag_hud_set_botmode() + /mob/living/simple_animal/bot/update_canmove() . = ..() if(!on) @@ -181,8 +173,13 @@ new /obj/effect/decal/cleanable/oil(loc) return ..(amount) +/mob/living/simple_animal/bot/updatehealth() + ..() + diag_hud_set_bothealth() + /mob/living/simple_animal/bot/handle_automated_action() //Master process which handles code common across most bots. set background = BACKGROUND_ENABLED + diag_hud_set_botmode() if(!on || client) return @@ -376,7 +373,7 @@ Pass a positive integer as an argument to override a bot's default speed. path = list() 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. - + if(step_count >= 1 && tries < 4) for(var/step_number = 0, step_number < step_count,step_number++) spawn(BOT_STEP_DELAY*step_number) @@ -453,6 +450,8 @@ Pass a positive integer as an argument to override a bot's default speed. access_card.access = prev_access tries = 0 mode = BOT_IDLE + diag_hud_set_botstat() + diag_hud_set_botmode() @@ -778,6 +777,7 @@ Pass a positive integer as an argument to override a bot's default speed. /mob/living/simple_animal/bot/Login() . = ..() access_card.access += player_access + diag_hud_set_botmode() /mob/living/simple_animal/bot/Logout() . = ..() diff --git a/icons/mob/hud.dmi b/icons/mob/hud.dmi index 90afe2db200..81d7d489e48 100644 Binary files a/icons/mob/hud.dmi and b/icons/mob/hud.dmi differ diff --git a/tgstation.dme b/tgstation.dme index 56c074acee9..45ec129db87 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -24,6 +24,7 @@ #include "code\__DATASTRUCTURES\stacks.dm" #include "code\__DEFINES\admin.dm" #include "code\__DEFINES\atmospherics.dm" +#include "code\__DEFINES\bots.dm" #include "code\__DEFINES\clothing.dm" #include "code\__DEFINES\combat.dm" #include "code\__DEFINES\flags.dm"