Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hud icon for AI mobs #17238

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion code/__DEFINES/dcs/signals/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,9 @@
#define MOB_GET_DO_AFTER_COEFFICIENT "mob_get_do_after_coefficient"
///From get_zone_with_miss_chance
#define MOB_GET_MISS_CHANCE_MOD "mob_get_miss_chance_mod"

///From mob/living/carbon/human/has_ai()
#define COMSIG_HUMAN_HAS_AI "human_has_ai"
#define MOB_HAS_AI (1<<0)
///AI mob wants to jump
#define COMSIG_AI_JUMP "ai_jump"
///AI mob equipped a melee weapon
Expand Down
9 changes: 7 additions & 2 deletions code/datums/components/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ The main purpose of this is to handle cleanup and setting up the initial ai beha
SIGNAL_HANDLER
GLOB.ai_instances_active -= src
if(!QDELETED(parent))
UnregisterSignal(parent, COMSIG_MOB_LOGIN)
UnregisterSignal(parent, COMSIG_MOB_DEATH)
UnregisterSignal(parent, list(COMSIG_MOB_LOGIN, COMSIG_MOB_DEATH, COMSIG_HUMAN_HAS_AI))
if(ai_behavior)
STOP_PROCESSING(SSprocessing, ai_behavior)
ai_behavior.cleanup_signals()
Expand Down Expand Up @@ -68,10 +67,16 @@ The main purpose of this is to handle cleanup and setting up the initial ai beha
ai_behavior.start_ai()
RegisterSignals(parent, list(COMSIG_MOB_DEATH, COMSIG_QDELETING), PROC_REF(RemoveComponent))
RegisterSignal(parent, COMSIG_MOB_LOGIN, PROC_REF(clean_up))
RegisterSignal(parent, COMSIG_HUMAN_HAS_AI, PROC_REF(parent_has_ai))
UnregisterSignal(parent, COMSIG_MOB_LOGOUT)
GLOB.ai_instances_active += src

/datum/component/ai_controller/Destroy()
clean_up(FALSE)
QDEL_NULL(ai_behavior)
return ..()

///Confirms we are active
/datum/component/ai_controller/proc/parent_has_ai(mob/living/source)
SIGNAL_HANDLER
return MOB_HAS_AI
17 changes: 13 additions & 4 deletions code/game/data_huds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
simple_status_hud.icon_state = ""
infection_hud.icon_state = "robot"

var/is_bot = has_ai()
switch(stat)
if(DEAD)
simple_status_hud.icon_state = ""
Expand Down Expand Up @@ -333,8 +334,12 @@
return TRUE
if(UNCONSCIOUS)
if(!client) //Nobody home.
simple_status_hud.icon_state = "afk"
status_hud.icon_state = "afk"
if(is_bot)
simple_status_hud.icon_state = "ai_mob"
status_hud.icon_state = "ai_mob"
else
simple_status_hud.icon_state = "afk"
status_hud.icon_state = "afk"
return TRUE
if(IsUnconscious()) //Should hopefully get out of it soon.
simple_status_hud.icon_state = "knockout"
Expand All @@ -345,8 +350,12 @@
return TRUE
if(CONSCIOUS)
if(!key) //Nobody home. Shouldn't affect aghosting.
simple_status_hud.icon_state = "afk"
status_hud.icon_state = "afk"
if(is_bot)
simple_status_hud.icon_state = "ai_mob"
status_hud.icon_state = "ai_mob"
else
simple_status_hud.icon_state = "afk"
status_hud.icon_state = "afk"
return TRUE
if(IsParalyzed()) //I've fallen and I can't get up.
simple_status_hud.icon_state = "knockdown"
Expand Down
3 changes: 2 additions & 1 deletion code/modules/mob/living/carbon/human/examine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@

if((!species.has_organ["brain"] || has_brain()) && stat != DEAD)
if(!key)
msg += "[span_deadsay("[t_He] [t_is] totally catatonic. The stresses of life in deep-space must have been too much for [t_him]. Any recovery is unlikely.")]\n"
if(!has_ai())
msg += "[span_deadsay("[t_He] [t_is] totally catatonic. The stresses of life in deep-space must have been too much for [t_him]. Any recovery is unlikely.")]\n"
else if(!client)
if(isxeno(user))
msg += "[span_xenowarning("[t_He] [p_do()]n't seem responsive.")]\n"
Expand Down
4 changes: 4 additions & 0 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1129,3 +1129,7 @@
return FALSE
user.health_analyzer.analyze_vitals(src, user)
return TRUE

///Checks if we have an AI behavior active
/mob/living/carbon/human/proc/has_ai()
return SEND_SIGNAL(src, COMSIG_HUMAN_HAS_AI) & MOB_HAS_AI
Binary file modified icons/mob/hud/human.dmi
Binary file not shown.
Loading