More things use trait huds over raw hud management (#93084)

This commit is contained in:
MrMelbert
2025-10-02 21:36:40 +02:00
committed by GitHub
parent 3d0cdfeac0
commit 44acefa73f
47 changed files with 249 additions and 236 deletions
+2 -3
View File
@@ -84,7 +84,7 @@ GLOBAL_LIST_INIT(command_strings, list(
var/list/current_pathed_turfs = list()
///The type of data HUD the bot uses. Diagnostic by default.
var/data_hud_type = DATA_HUD_DIAGNOSTIC
var/data_hud_type = TRAIT_DIAGNOSTIC_HUD
/// If true we will allow ghosts to control this mob
var/can_be_possessed = FALSE
/// Message to display upon possession
@@ -139,8 +139,7 @@ GLOBAL_LIST_INIT(command_strings, list(
//If a bot has its own HUD (for player bots), provide it.
if(!isnull(data_hud_type))
var/datum/atom_hud/datahud = GLOB.huds[data_hud_type]
datahud.show_to(src)
ADD_TRAIT(src, data_hud_type, INNATE_TRAIT)
if(mapload && is_station_level(z) && (bot_mode_flags & BOT_MODE_CAN_BE_SAPIENT) && (bot_mode_flags & BOT_MODE_ROUNDSTART_POSSESSION))
enable_possession(mapload = mapload)
@@ -12,7 +12,7 @@
bot_mode_flags = BOT_MODE_ON | BOT_MODE_REMOTE_ENABLED | BOT_MODE_CAN_BE_SAPIENT | BOT_MODE_AUTOPATROL | BOT_MODE_ROUNDSTART_POSSESSION
hackables = "sound control systems"
path_image_color = "#FF69B4"
data_hud_type = DATA_HUD_SECURITY_BASIC
data_hud_type = TRAIT_SECURITY_HUD_ID_ONLY
additional_access = /datum/id_trim/job/clown
possessed_message = "You are a honkbot! Make sure the crew are having a great time!"
///our voicelines
@@ -19,7 +19,7 @@
radio_key = /obj/item/encryptionkey/headset_med
radio_channel = RADIO_CHANNEL_MEDICAL
bot_type = MED_BOT
data_hud_type = DATA_HUD_MEDICAL_ADVANCED
data_hud_type = TRAIT_MEDICAL_HUD
hackables = "health processor circuits"
possessed_message = "You are a medbot! Ensure good health among the crew to the best of your ability!"
@@ -14,7 +14,7 @@
radio_key = /obj/item/encryptionkey/headset_service
radio_channel = RADIO_CHANNEL_SERVICE
bot_type = VIBE_BOT
data_hud_type = DATA_HUD_DIAGNOSTIC
data_hud_type = TRAIT_DIAGNOSTIC_HUD
path_image_color = "#2cac12"
possessed_message = "You are a vibebot! Maintain the station's vibes to the best of your ability!"
@@ -30,14 +30,11 @@
can_repair = TRUE
can_repair_self = TRUE
smashes_walls = TRUE
///The health HUD applied to this mob.
var/health_hud = DATA_HUD_MEDICAL_ADVANCED
/mob/living/basic/construct/artificer/Initialize(mapload)
. = ..()
AddElement(/datum/element/ai_retaliate)
var/datum/atom_hud/datahud = GLOB.huds[health_hud]
datahud.show_to(src)
ADD_TRAIT(src, TRAIT_MEDICAL_HUD, INNATE_TRAIT)
/// Hostile NPC version. Heals nearby constructs and cult structures, avoids targets that aren't extremely hurt.
/mob/living/basic/construct/artificer/hostile
@@ -27,8 +27,7 @@
after_healed = CALLBACK(src, PROC_REF(after_healed)),\
)
var/datum/atom_hud/medsensor = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
medsensor.show_to(src)
ADD_TRAIT(src, TRAIT_MEDICAL_HUD, INNATE_TRAIT)
var/datum/action/cooldown/mob_cooldown/guardian_bluespace_beacon/teleport = new(src)
teleport.Grant(src)
@@ -48,13 +48,11 @@
/mob/living/basic/lightgeist/Initialize(mapload)
. = ..()
ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT)
ADD_TRAIT(src, TRAIT_MEDICAL_HUD, INNATE_TRAIT)
remove_verb(src, /mob/living/verb/pulled)
remove_verb(src, /mob/verb/me_verb)
var/datum/atom_hud/medical_sensor = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
medical_sensor.show_to(src)
AddElement(/datum/element/simple_flying)
AddComponent(\
/datum/component/healing_touch,\
@@ -169,8 +169,6 @@
web_speed = 0.25
web_type = /datum/action/cooldown/mob_cooldown/lay_web/sealer
menu_description = "Avarage speed spider able to heal other spiders and itself together with a fast web laying capability, has low damage and health."
///The health HUD applied to the mob.
var/health_hud = DATA_HUD_MEDICAL_ADVANCED
///Used in the caves away mission.
/mob/living/basic/spider/giant/nurse/away_caves
@@ -179,8 +177,7 @@
/mob/living/basic/spider/giant/nurse/Initialize(mapload)
. = ..()
var/datum/atom_hud/datahud = GLOB.huds[health_hud]
datahud.show_to(src)
ADD_TRAIT(src, TRAIT_MEDICAL_HUD, INNATE_TRAIT)
AddComponent(/datum/component/healing_touch,\
heal_brute = 10,\
@@ -92,13 +92,10 @@
speed = 0.7
web_speed = 0.5
web_type = /datum/action/cooldown/mob_cooldown/lay_web/sealer
///The health HUD applied to the mob.
var/health_hud = DATA_HUD_MEDICAL_ADVANCED
/mob/living/basic/spider/growing/young/nurse/Initialize(mapload)
. = ..()
var/datum/atom_hud/datahud = GLOB.huds[health_hud]
datahud.show_to(src)
ADD_TRAIT(src, TRAIT_MEDICAL_HUD, INNATE_TRAIT)
AddComponent(/datum/component/healing_touch,\
heal_brute = 15,\
@@ -118,15 +118,11 @@ GLOBAL_LIST_INIT(strippable_human_items, create_strippable_list(list(
return
to_chat(source, span_notice("[user] is trying to adjust your [jumpsuit.name]'s sensor."))
if(!do_after(user, jumpsuit.strip_delay * 0.5, source)) // takes the same amount of time as adjusting it
if(!do_after(user, jumpsuit.strip_delay * 0.5, source) || !jumpsuit.set_sensor_mode(new_mode)) // takes the same amount of time as adjusting it
source.balloon_alert(user, "failed!")
return
source.balloon_alert(user, "changed sensors")
jumpsuit.sensor_mode = new_mode
to_chat(source, span_notice("[user] successfully adjusted your [jumpsuit.name]'s sensor."))
if(ishuman(source))
var/mob/living/carbon/human/humano = source
humano.update_suit_sensors()
/datum/strippable_item/mob_item_slot/jumpsuit/proc/do_strip_accessory(atom/source, mob/user, obj/item/clothing/under/jumpsuit)
var/list/accessory_choices = list()
@@ -185,7 +185,6 @@
if(w_uniform)
return
w_uniform = equipping
update_suit_sensors()
update_worn_undersuit()
if(ITEM_SLOT_LPOCKET)
l_store = equipping
@@ -227,7 +226,6 @@
update_worn_oversuit()
else if(item_dropping == w_uniform)
w_uniform = null
update_suit_sensors()
if(!QDELETED(src))
update_worn_undersuit()
if(invdrop)
@@ -3,6 +3,7 @@
id = SPECIES_ABDUCTOR
sexes = FALSE
inherent_traits = list(
TRAIT_ABDUCTOR_HUD,
TRAIT_CHUNKYFINGERS_IGNORE_BATON,
TRAIT_NEVER_WOUNDED,
TRAIT_NOBLOOD,
@@ -32,16 +33,6 @@
return "Abductors do not need to breathe, eat, do not have blood, a heart, stomach, or lungs and cannot be infected by human viruses. \
Their hardy physique prevents their skin from being wounded or dismembered, but their chunky tridactyl hands make it hard to operate human equipment."
/datum/species/abductor/on_species_gain(mob/living/carbon/C, datum/species/old_species, pref_load, regenerate_icons)
. = ..()
var/datum/atom_hud/abductor_hud = GLOB.huds[DATA_HUD_ABDUCTOR]
abductor_hud.show_to(C)
/datum/species/abductor/on_species_loss(mob/living/carbon/C)
. = ..()
var/datum/atom_hud/abductor_hud = GLOB.huds[DATA_HUD_ABDUCTOR]
abductor_hud.hide_from(C)
/datum/species/abductor/get_species_description()
return "Abductors, colloquially known as \"Greys\" (or \"Grays\"), \
are, three fingered, pale skinned inquisitive aliens who can't communicate well to the average crew-member."
+16
View File
@@ -70,6 +70,10 @@
RegisterSignal(src, COMSIG_MOVABLE_EDIT_UNIQUE_IMMERSE_OVERLAY, PROC_REF(edit_immerse_overlay))
RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_BASIC_HEALTH_HUD_VISIBLE), PROC_REF(add_to_basic_health_hud))
RegisterSignal(src, SIGNAL_REMOVETRAIT(TRAIT_BASIC_HEALTH_HUD_VISIBLE), PROC_REF(remove_from_basic_health_hud))
/// Called when [TRAIT_KNOCKEDOUT] is added to the mob.
/mob/living/proc/on_knockedout_trait_gain(datum/source)
SIGNAL_HANDLER
@@ -297,3 +301,15 @@
/mob/living/proc/on_hearing_regain()
SIGNAL_HANDLER
refresh_looping_ambience()
/// When gaining [TRAIT_BASIC_HEALTH_HUD_VISIBLE], add to the basic health hud
/mob/living/proc/add_to_basic_health_hud(datum/source)
SIGNAL_HANDLER
var/datum/atom_hud/data/human/medical/basic/hud = GLOB.huds[DATA_HUD_MEDICAL_BASIC]
hud.add_atom_to_hud(src)
/// When losing [TRAIT_BASIC_HEALTH_HUD_VISIBLE], remove from the basic health hud
/mob/living/proc/remove_from_basic_health_hud(datum/source)
SIGNAL_HANDLER
var/datum/atom_hud/data/human/medical/basic/hud = GLOB.huds[DATA_HUD_MEDICAL_BASIC]
hud.remove_atom_from_hud(src)
@@ -12,7 +12,7 @@
mob_size = MOB_SIZE_LARGE
can_buckle_to = FALSE
silicon_huds = list(DATA_HUD_MEDICAL_BASIC, DATA_HUD_SECURITY_BASIC, DATA_HUD_DIAGNOSTIC, DATA_HUD_BOT_PATH)
silicon_huds = list(TRAIT_MEDICAL_HUD_SENSOR_ONLY, TRAIT_SECURITY_HUD_ID_ONLY, TRAIT_DIAGNOSTIC_HUD, TRAIT_BOT_PATH_HUD)
radio = /obj/item/radio/headset/silicon/ai
radiomod = ";" //AIs will, by default, state their laws on the internal radio.
+8 -7
View File
@@ -38,7 +38,7 @@
///Are our siliconHUDs on? TRUE for yes, FALSE for no.
var/sensors_on = TRUE
var/list/silicon_huds = list(DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_SECURITY_ADVANCED, DATA_HUD_DIAGNOSTIC)
var/list/silicon_huds = list(TRAIT_MEDICAL_HUD, TRAIT_SECURITY_HUD, TRAIT_DIAGNOSTIC_HUD)
var/law_change_counter = 0
var/obj/machinery/camera/silicon/builtInCamera
@@ -417,15 +417,16 @@
/mob/living/silicon/assess_threat(judgement_criteria, lasercolor = "", datum/callback/weaponcheck=null) //Secbots won't hunt silicon units
return -10
/// Innate, toggleable silicon HUDs
#define SILICON_HUD_TRAIT "silicon_hud"
/mob/living/silicon/proc/remove_sensors()
for (var/hud_type in silicon_huds)
var/datum/atom_hud/silicon_hud = GLOB.huds[hud_type]
silicon_hud.hide_from(src)
remove_traits(silicon_huds, SILICON_HUD_TRAIT)
/mob/living/silicon/proc/add_sensors()
for (var/hud_type in silicon_huds)
var/datum/atom_hud/silicon_hud = GLOB.huds[hud_type]
silicon_hud.show_to(src)
add_traits(silicon_huds, SILICON_HUD_TRAIT)
#undef SILICON_HUD_TRAIT
/mob/living/silicon/proc/toggle_sensors()
if(incapacitated)
@@ -94,7 +94,7 @@
var/turf/nearest_beacon_loc
///The type of data HUD the bot uses. Diagnostic by default.
var/data_hud_type = DATA_HUD_DIAGNOSTIC
var/data_hud_type = TRAIT_DIAGNOSTIC_HUD
var/datum/atom_hud/data/bot_path/private/path_hud
var/path_image_icon = 'icons/mob/silicon/aibots.dmi'
var/path_image_icon_state = "path_indicator"
@@ -191,8 +191,7 @@
//If a bot has its own HUD (for player bots), provide it.
if(!isnull(data_hud_type))
var/datum/atom_hud/datahud = GLOB.huds[data_hud_type]
datahud.show_to(src)
ADD_TRAIT(src, data_hud_type, INNATE_TRAIT)
if(path_hud)
path_hud.add_atom_to_hud(src)
path_hud.show_to(src)
@@ -20,7 +20,7 @@
radio_channel = RADIO_CHANNEL_SECURITY //Security channel
bot_type = SEC_BOT
bot_mode_flags = ~BOT_MODE_CAN_BE_SAPIENT
data_hud_type = DATA_HUD_SECURITY_ADVANCED
data_hud_type = TRAIT_SECURITY_HUD
hackables = "target identification systems"
path_image_color = COLOR_RED
possessed_message = "You are a securitron! Guard the station to the best of your ability!"