Standardized damage overlay updates (#29730)

* standard damage overlay updates

* Update vgstation13.dme

* durp
This commit is contained in:
DeityLink
2021-06-12 07:35:39 +02:00
committed by GitHub
parent 6224f7dbe4
commit 108a9f7295
24 changed files with 165 additions and 159 deletions

View File

@@ -55,9 +55,10 @@
client.screen -= screen
qdel(screen)
/mob/proc/clear_fullscreens()
/mob/proc/clear_fullscreens(var/dead_mob = FALSE, var/animate = 10)
for(var/category in screens)
clear_fullscreen(category)
if (!dead_mob || ((category != "brute") && (category != "oxy")))
clear_fullscreen(category, animate)
/datum/hud/proc/reload_fullscreen()
if(mymob && mymob.client && mymob.stat != DEAD)

View File

@@ -424,16 +424,8 @@
clear_alert(SCREEN_ALARM_FIRE)
//NOTE: the alerts dont reset when youre out of danger. dont blame me,
//blame the person who coded them. Temporary fix added.
if(client)
clear_fullscreens()
if(src.eye_blind)
overlay_fullscreen("blind", /obj/abstract/screen/fullscreen/blind)
if (src.disabilities & NEARSIGHTED)
overlay_fullscreen("impaired", /obj/abstract/screen/fullscreen/impaired)
if (src.eye_blurry)
overlay_fullscreen("blurry", /obj/abstract/screen/fullscreen/blurry)
if (src.druggy)
overlay_fullscreen("high", /obj/abstract/screen/fullscreen/high)
standard_damage_overlay_updates()
if(!isDead())
if(machine)

View File

@@ -349,16 +349,7 @@
else
clear_alert(SCREEN_ALARM_FIRE)
if (client)
clear_fullscreens()
if(src.eye_blind || src.blinded)
overlay_fullscreen("blind", /obj/abstract/screen/fullscreen/blind)
if(src.disabilities & NEARSIGHTED)
overlay_fullscreen("impaired", /obj/abstract/screen/fullscreen/impaired)
if(src.eye_blurry)
overlay_fullscreen("blurry", /obj/abstract/screen/fullscreen/blurry)
if(src.druggy)
overlay_fullscreen("high", /obj/abstract/screen/fullscreen/high)
standard_damage_overlay_updates()
if(!isDead())
if(machine)

View File

@@ -2,7 +2,7 @@
// It functions almost identically (see code/datums/diseases/alien_embryo.dm)
/obj/item/alien_embryo
name = "alien embryo" //The alien embryo, not Alien Embryo
name = "alien embryo"
desc = "All slimy and yuck."
icon = 'icons/mob/alien.dmi'
icon_state = "larva0_dead"
@@ -24,6 +24,11 @@
spawn(0)
AddInfectionImages(affected_mob)
else
var/mob/living/carbon/alien/larva/larva_corpse = new(get_turf(src))
larva_corpse.bruteloss = 25
larva_corpse.oxyloss = 26
larva_corpse.death()
qdel(src)
/obj/item/alien_embryo/Topic(href,href_list)
@@ -148,7 +153,7 @@
spawn(6)
var/mob/living/carbon/alien/larva/new_xeno = new(get_turf(affected_mob))
new_xeno.key = picked
var/datum/role/new_role = new /datum/role/xenomorph
new_role.AssignToRole(new_xeno.mind, 1)
var/datum/faction/xeno_fac = find_active_faction_by_type(/datum/faction/xenomorph)

View File

@@ -134,6 +134,7 @@
if(ticker && ticker.mode)
sql_report_death(src)
species.handle_death(src)
if(become_zombie_after_death && isjusthuman(src))
spawn(30 SECONDS)
if(!gcDestroyed)

View File

@@ -10,82 +10,8 @@
update_action_buttons_icon()
if(stat == UNCONSCIOUS && health <= config.health_threshold_crit)
var/severity = 0
switch(health)
if(-20 to -10)
severity = 1
if(-30 to -20)
severity = 2
if(-40 to -30)
severity = 3
if(-50 to -40)
severity = 4
if(-60 to -50)
severity = 5
if(-70 to -60)
severity = 6
if(-80 to -70)
severity = 7
if(-90 to -80)
severity = 8
if(-95 to -90)
severity = 9
if(-INFINITY to -95)
severity = 10
overlay_fullscreen("crit", /obj/abstract/screen/fullscreen/crit, severity)
else
clear_fullscreen("crit")
if(oxyloss)
if(pain_numb)
oxyloss = max((oxyloss - 20) / 2, 0) //Make the damage appear smaller than it really is
var/severity = 0
switch(oxyloss)
if(10 to 20)
severity = 1
if(20 to 25)
severity = 2
if(25 to 30)
severity = 3
if(30 to 35)
severity = 4
if(35 to 40)
severity = 5
if(40 to 45)
severity = 6
if(45 to INFINITY)
severity = 7
overlay_fullscreen("oxy", /obj/abstract/screen/fullscreen/oxy, severity)
else
clear_fullscreen("oxy")
//Fire and Brute damage overlay (BSSR)
var/hurtdamage = src.getBruteLoss() + src.getFireLoss() + damageoverlaytemp
damageoverlaytemp = 0 // We do this so we can detect if someone hits us or not.
if(hurtdamage)
if(pain_numb)
hurtdamage = max((hurtdamage - 20) / 2, 0) //Make the damage appear smaller than it really is
var/severity = 0
switch(hurtdamage)
if(5 to 15)
severity = 1
if(15 to 30)
severity = 2
if(30 to 45)
severity = 3
if(45 to 70)
severity = 4
if(70 to 85)
severity = 5
if(85 to INFINITY)
severity = 6
overlay_fullscreen("brute", /obj/abstract/screen/fullscreen/brute, severity)
else
clear_fullscreen("brute")
//damageoverlay.overlays += I
if(pain_numb)
overlay_fullscreen("numb", /obj/abstract/screen/fullscreen/numb)
else
clear_fullscreen("numb")
standard_damage_overlay_updates()
if(stat == DEAD)
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
@@ -295,33 +221,6 @@
update_pull_icon()
if(disabilities & NEARSIGHTED) //This looks meh but saves a lot of memory by not requiring to add var/prescription
if(glasses) //To every /obj/item
var/obj/item/clothing/glasses/G = glasses
if(!G.prescription)
overlay_fullscreen("nearsighted", /obj/abstract/screen/fullscreen/impaired, 1)
else
clear_fullscreen("nearsighted")
else
overlay_fullscreen("nearsighted", /obj/abstract/screen/fullscreen/impaired, 1)
else
clear_fullscreen("nearsighted")
if(eye_blind || blinded)
overlay_fullscreen("blind", /obj/abstract/screen/fullscreen/blind)
else
clear_fullscreen("blind")
if(eye_blurry)
overlay_fullscreen("blurry", /obj/abstract/screen/fullscreen/blurry)
else
clear_fullscreen("blurry")
if(druggy)
overlay_fullscreen("high", /obj/abstract/screen/fullscreen/high)
else
clear_fullscreen("high")
if(has_reagent_in_blood(INCENSE_MOONFLOWERS))
overlay_fullscreen("high_red", /obj/abstract/screen/fullscreen/high/red)
else
clear_fullscreen("high_red")
if (istype(glasses, /obj/item/clothing/glasses/science))
var/obj/item/clothing/glasses/science/S = glasses
if (S.on)

View File

@@ -177,7 +177,7 @@
/mob/living/carbon/human/earprot()
return is_on_ears(/obj/item/clothing/ears/earmuffs) || is_on_ears(/obj/item/device/radio/headset/headset_earmuffs)
/mob/living/carbon/human/proc/has_reagent_in_blood(var/reagent_name,var/amount = -1)
/mob/living/proc/has_reagent_in_blood(var/reagent_name,var/amount = -1)
if(!reagents || !ticker)
return 0
return reagents.has_reagent(reagent_name,amount)

View File

@@ -72,6 +72,7 @@
if(client)
handle_regular_hud_updates()
standard_damage_overlay_updates()
// Grabbing
for(var/obj/item/weapon/grab/G in src)

View File

@@ -361,6 +361,11 @@
wear_id.emp_act(severity)
..()
/mob/living/carbon/monkey/adjustBruteLoss(damage)
..()
if (damage > 0)
damageoverlaytemp = 20
/mob/living/carbon/monkey/ex_act(severity)
if(flags & INVULNERABLE)
return

View File

@@ -1,6 +1,6 @@
/mob/living/carbon/var/pain_shock_stage = 0
/mob/living/carbon/var/pain_level = 0 //Gets overwritten every tick! If you want to add pain "resistance" or constain pain, see update_pain_level()
/mob/living/carbon/var/pain_numb = 0 // When this is set, the mob isn't affected by shock or pain, but can't see their health.
/mob/living/var/pain_shock_stage = 0
/mob/living/var/pain_level = 0 //Gets overwritten every tick! If you want to add pain "resistance" or constain pain, see update_pain_level()
/mob/living/var/pain_numb = 0 // When this is set, the mob isn't affected by shock or pain, but can't see their health.
// proc to find out in how much pain the mob is at the moment
/mob/living/carbon/proc/update_pain_level()

View File

@@ -40,6 +40,7 @@
// Basically just deletes any screen objects :<
regular_hud_updates()
standard_damage_overlay_updates()
//Handle temperature/pressure differences between body and environment
if(environment)
@@ -323,7 +324,7 @@
if(say_mute)
say_mute = 0
src.setDensity(!src.lying)
if (src.sdisabilities & BLIND)
@@ -568,8 +569,6 @@
if(client)
update_pull_icon()
var/severity = 0
var/healthpercent = (health/maxHealth) * 100
switch(healthpercent)
@@ -577,27 +576,16 @@
healths.icon_state = "slime_health0"
if(80 to 100)
healths.icon_state = "slime_health1"
severity = 1
if(60 to 80)
healths.icon_state = "slime_health2"
severity = 2
if(40 to 60)
healths.icon_state = "slime_health3"
severity = 3
if(20 to 40)
healths.icon_state = "slime_health4"
severity = 4
if(0 to 20)
healths.icon_state = "slime_health5"
severity = 5
if(-99 to 0)
healths.icon_state = "slime_health6"
severity = 6
else
healths.icon_state = "slime_health7"
severity = 6
if(severity > 0)
overlay_fullscreen("brute", /obj/abstract/screen/fullscreen/brute, severity)
else
clear_fullscreen("brute")

View File

@@ -6,10 +6,10 @@
//See code/datums/helper_datums/butchering.dm
init_butchering_list()
clear_fullscreens()
clear_fullscreens(TRUE)
handle_symptom_on_death()
..()
standard_damage_overlay_updates()
/mob/living/gib(animation = FALSE, meat = TRUE)
if(!isUnconscious())

View File

@@ -627,6 +627,8 @@ Thanks.
regenerate_icons()
update_canmove()
clear_fullscreens()
hud_updateflag |= 1 << HEALTH_HUD
hud_updateflag |= 1 << STATUS_HUD

View File

@@ -1,6 +1,8 @@
/mob/living/Login()
..()
standard_damage_overlay_updates()
//Mind updates
mind_initialize() //updates the mind (or creates and initializes one if one doesn't exist)
mind.active = 1 //indicates that the mind is currently synced with a client

View File

@@ -183,6 +183,7 @@ var/global/borer_unlock_types_leg = typesof(/datum/unlockable/borer/leg) - /datu
if(client)
regular_hud_updates()
standard_damage_overlay_updates()
/mob/living/simple_animal/borer/regular_hud_updates()
if(fire_alert)
@@ -190,8 +191,6 @@ var/global/borer_unlock_types_leg = typesof(/datum/unlockable/borer/leg) - /datu
else
clear_alert(SCREEN_ALARM_FIRE)
var/severity = 0
var/healthpercent = (health/maxHealth)*100
switch(healthpercent)
@@ -199,24 +198,14 @@ var/global/borer_unlock_types_leg = typesof(/datum/unlockable/borer/leg) - /datu
healths.icon_state = "borer_health0"
if(75 to 100)
healths.icon_state = "borer_health1"
severity = 2
if(50 to 75)
healths.icon_state = "borer_health2"
severity = 3
if(25 to 50)
healths.icon_state = "borer_health3"
severity = 4
if(1 to 25)
healths.icon_state = "borer_health4"
severity = 5
else
healths.icon_state = "borer_health5"
severity = 6
if(severity > 0)
overlay_fullscreen("damage", /obj/abstract/screen/fullscreen/brute, severity)
else
clear_fullscreen("damage")
/mob/living/simple_animal/borer/proc/update_verbs(var/mode)
if(verb_holders.len>0)

View File

@@ -536,6 +536,8 @@
if(.)
regular_hud_updates()
standard_damage_overlay_updates()
/mob/living/simple_animal/construct/regular_hud_updates()
if(fire_alert)

View File

@@ -61,6 +61,7 @@
. = ..()
if(.)
regular_hud_updates()
standard_damage_overlay_updates()
if(!stat && !resting && !locked_to && (ckey == null)) //Behavior mechanisms (om nom :3)
if(corgi_status == IDLE)
get_target()

View File

@@ -69,6 +69,7 @@
if(timestopped)
return 0 //under effects of time magick
..()
standard_damage_overlay_updates()
if(!stat && prob(speak_chance))
for(var/mob/M in view())
M << 'sound/effects/mousesqueek.ogg'

View File

@@ -168,6 +168,7 @@
a_51,a_52,a_53,a_54)
regular_hud_updates()
standard_damage_overlay_updates()
/mob/living/simple_animal/hostile/giant_spider/regular_hud_updates()
if (!client)

View File

@@ -80,6 +80,7 @@
return FALSE //under effects of time magick
..()
regular_hud_updates()
standard_damage_overlay_updates()
if(isDead())
for(var/i=0;i<3;i++)
new /obj/item/weapon/ectoplasm (src.loc)

View File

@@ -595,6 +595,8 @@ var/global/list/animal_count = list() //Stores types, and amount of animals of t
if(lazy_invoke_event(/lazy_event/on_damaged, list("kind" = BRUTE, "amount" = damage)))
return 0
if (damage > 0)
damageoverlaytemp = 20
if(skinned())
damage = damage * 2
if(purge)

View File

@@ -0,0 +1,119 @@
/mob/living/proc/standard_damage_overlay_updates()
if(!client)
return 0
var/health_percent = health * 100 / maxHealth
if(stat == UNCONSCIOUS && health_percent <= config.health_threshold_crit)
var/severity = 0
switch(health_percent)
if(-20 to -10)
severity = 1
if(-30 to -20)
severity = 2
if(-40 to -30)
severity = 3
if(-50 to -40)
severity = 4
if(-60 to -50)
severity = 5
if(-70 to -60)
severity = 6
if(-80 to -70)
severity = 7
if(-90 to -80)
severity = 8
if(-95 to -90)
severity = 9
if(-INFINITY to -95)
severity = 10
overlay_fullscreen("crit", /obj/abstract/screen/fullscreen/crit, severity)
else
clear_fullscreen("crit")
var/oxyloss_percent = oxyloss * 100 / maxHealth
if (istype(src,/mob/living/simple_animal) || istype(src,/mob/living/carbon/slime))
oxyloss_percent = (100 - health_percent)/2
if(oxyloss_percent)
if(pain_numb)
oxyloss_percent = max((oxyloss_percent - 20) / 2, 0) //Make the damage appear smaller than it really is
var/severity = 0
switch(oxyloss_percent)
if(10 to 20)
severity = 1
if(20 to 25)
severity = 2
if(25 to 30)
severity = 3
if(30 to 35)
severity = 4
if(35 to 40)
severity = 5
if(40 to 45)
severity = 6
if(45 to INFINITY)
severity = 7
overlay_fullscreen("oxy", /obj/abstract/screen/fullscreen/oxy, severity)
else
clear_fullscreen("oxy")
//Fire and Brute damage overlay (BSSR)
var/hurtdamage = (getBruteLoss()*100/maxHealth) + (getFireLoss()*100/maxHealth) + (damageoverlaytemp * 100 / maxHealth)
if (istype(src,/mob/living/simple_animal) || istype(src,/mob/living/carbon/slime))
hurtdamage = (100 - health_percent) + (damageoverlaytemp * 100 / maxHealth)
damageoverlaytemp = 0 // We do this so we can detect if someone hits us or not.
if(hurtdamage)
if(pain_numb)
hurtdamage = max((hurtdamage - 20) / 2, 0) //Make the damage appear smaller than it really is
var/severity = 0
switch(hurtdamage)
if(5 to 15)
severity = 1
if(15 to 30)
severity = 2
if(30 to 45)
severity = 3
if(45 to 70)
severity = 4
if(70 to 85)
severity = 5
if(85 to INFINITY)
severity = 6
overlay_fullscreen("brute", /obj/abstract/screen/fullscreen/brute, severity)
else
clear_fullscreen("brute")
//damageoverlay.overlays += I
if(pain_numb)
overlay_fullscreen("numb", /obj/abstract/screen/fullscreen/numb)
else
clear_fullscreen("numb")
if(stat != DEAD)
if(disabilities & NEARSIGHTED) //This looks meh but saves a lot of memory by not requiring to add var/prescription
if (ishuman(src))
var/mob/living/carbon/human/H = src
if(H.glasses) //To every /obj/item
var/obj/item/clothing/glasses/G = H.glasses
if(!G.prescription)
overlay_fullscreen("nearsighted", /obj/abstract/screen/fullscreen/impaired, 1)
else
clear_fullscreen("nearsighted")
else
overlay_fullscreen("nearsighted", /obj/abstract/screen/fullscreen/impaired, 1)
else
clear_fullscreen("nearsighted")
if(eye_blind || blinded)
overlay_fullscreen("blind", /obj/abstract/screen/fullscreen/blind)
else
clear_fullscreen("blind")
if(eye_blurry)
overlay_fullscreen("blurry", /obj/abstract/screen/fullscreen/blurry)
else
clear_fullscreen("blurry")
if(druggy)
overlay_fullscreen("high", /obj/abstract/screen/fullscreen/high)
else
clear_fullscreen("high")
if(has_reagent_in_blood(INCENSE_MOONFLOWERS))
overlay_fullscreen("high_red", /obj/abstract/screen/fullscreen/high/red)
else
clear_fullscreen("high_red")

View File

@@ -20,6 +20,8 @@
log_access("Logout: [key_name(src)] ([formatLocation(loc)])")
clear_fullscreens(FALSE, 0)
remove_screen_objs() //Used to remove hud elements
if (src in science_goggles_wearers)

View File

@@ -1753,6 +1753,7 @@
#include "code\modules\mob\living\login.dm"
#include "code\modules\mob\living\logout.dm"
#include "code\modules\mob\living\say.dm"
#include "code\modules\mob\living\standard_damage_overlay_updates.dm"
#include "code\modules\mob\living\carbon\carbon.dm"
#include "code\modules\mob\living\carbon\carbon_defines.dm"
#include "code\modules\mob\living\carbon\combat.dm"