Converts Nutrition alert to hud element (#25616)

* hud

* convert nutrition from alert to hud

* return alert5 and remove some unused ui defines

* reorganize top-to-bottom
This commit is contained in:
larentoun
2024-06-12 21:03:16 +03:00
committed by GitHub
parent 7cf569aa8c
commit 2fb2084108
9 changed files with 26 additions and 41 deletions
@@ -84,7 +84,6 @@ RESTRICT_TYPE(/datum/antagonist/vampire)
var/datum/hud/hud = mob_override.hud_used
if(hud?.vampire_blood_display)
hud.remove_vampire_hud()
mob_override.dna?.species.hunger_type = initial(mob_override.dna.species.hunger_type)
mob_override.dna?.species.hunger_icon = initial(mob_override.dna.species.hunger_icon)
owner.current.alpha = 255
REMOVE_TRAITS_IN(owner.current, "vampire")
@@ -354,7 +353,6 @@ RESTRICT_TYPE(/datum/antagonist/vampire)
owner.som = new()
owner.som.masters += owner
mob_override.dna?.species.hunger_type = "vampire"
mob_override.dna?.species.hunger_icon = 'icons/mob/screen_hunger_vampire.dmi'
check_vampire_upgrade(FALSE)
@@ -668,28 +668,26 @@
#undef BODYPART_PAIN_REDUCTION
/mob/living/carbon/human/proc/handle_nutrition_alerts() //This is a terrible abuse of the alert system; something like this should be a HUD element
if(HAS_TRAIT(src, TRAIT_NOHUNGER))
/mob/living/carbon/human/proc/handle_nutrition_alerts()
if(!nutrition_display)
return
var/new_hunger
if(HAS_TRAIT(src, TRAIT_NOHUNGER))
nutrition_display.icon_state = null
return
nutrition_display.icon = dna.species.hunger_icon
switch(nutrition)
if(NUTRITION_LEVEL_FULL to INFINITY)
new_hunger = "fat"
nutrition_display.icon_state = "fat"
if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL)
new_hunger = "full"
nutrition_display.icon_state = "full"
if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED)
new_hunger = "well_fed"
nutrition_display.icon_state = "well_fed"
if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED)
new_hunger = "fed"
nutrition_display.icon_state = "fed"
if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
new_hunger = "hungry"
nutrition_display.icon_state = "hungry"
else
new_hunger = "starving"
if(dna.species.hunger_type)
new_hunger += "/[dna.species.hunger_type]"
if(dna.species.hunger_level != new_hunger)
dna.species.hunger_level = new_hunger
throw_alert("nutrition", "/atom/movable/screen/alert/hunger/[new_hunger]", icon_override = dna.species.hunger_icon)
nutrition_display.icon_state = "starving"
/mob/living/carbon/human/handle_random_events()
// Puke if toxloss is too high
@@ -48,8 +48,6 @@
var/hunger_drain = HUNGER_FACTOR
var/taste_sensitivity = TASTE_SENSITIVITY_NORMAL //the most widely used factor; humans use a different one
var/hunger_icon = 'icons/mob/screen_hunger.dmi'
var/hunger_type
var/hunger_level
var/siemens_coeff = 1 //base electrocution coefficient
@@ -44,7 +44,6 @@
butt_sprite = "machine"
hunger_icon = 'icons/mob/screen_hunger_machine.dmi'
hunger_type = "machine"
has_organ = list(
"brain" = /obj/item/organ/internal/brain/mmi_holder/posibrain,
+1
View File
@@ -27,6 +27,7 @@
*/
var/atom/movable/screen/leap_icon = null
var/atom/movable/screen/healthdoll/healthdoll = null
var/atom/movable/screen/nutrition/nutrition_display = null
var/use_me = TRUE //Allows all mobs to use the me verb by default, will have to manually specify they cannot
var/damageoverlaytemp = 0