mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-28 07:20:09 +01:00
Move limb image updating from life ticks to signals. (#21372)
title,should fix a lot of lag --------- Co-authored-by: Matt Atlas <liermattia@gmail.com>
This commit is contained in:
@@ -43,6 +43,8 @@
|
||||
if(wearing_rig && wearing_rig.offline)
|
||||
wearing_rig = null
|
||||
|
||||
var/shock_value = get_shock()
|
||||
|
||||
..()
|
||||
|
||||
if(life_tick%30==5)//Makes huds update every 10 seconds instead of every 30 seconds
|
||||
@@ -62,14 +64,14 @@
|
||||
//Random events (vomiting etc)
|
||||
handle_random_events()
|
||||
|
||||
handle_shock()
|
||||
handle_shock(shock_value)
|
||||
|
||||
handle_pain()
|
||||
|
||||
handle_fever()
|
||||
|
||||
//Handles regenerating stamina if we have sufficient air and no oxyloss
|
||||
handle_stamina()
|
||||
handle_stamina(shock_value)
|
||||
|
||||
if (is_diona())
|
||||
diona_handle_light(DS)
|
||||
@@ -974,7 +976,6 @@
|
||||
var/image/burning_image = image('icons/mob/screen1_health.dmi', "burning", pixel_x = species.healths_overlay_x)
|
||||
var/midway_point = FIRE_MAX_STACKS / 2
|
||||
burning_image.color = color_rotation((midway_point - fire_stacks) * 3)
|
||||
health_images += burning_image
|
||||
|
||||
// Show a general pain/crit indicator if needed.
|
||||
if(is_asystole())
|
||||
@@ -1224,7 +1225,11 @@
|
||||
if(changeling)
|
||||
changeling.regenerate()
|
||||
|
||||
/mob/living/carbon/human/proc/handle_shock()
|
||||
/**
|
||||
* This proc assumes that if traumatic_shock = null, then a shock value was NOT passed in, and thus it calculates it itself.
|
||||
* If you for some reason need to call this alongside a lot of other shit that needs shock, make sure you cache that value, because calculating it is expensive.
|
||||
*/
|
||||
/mob/living/carbon/human/proc/handle_shock(traumatic_shock = null)
|
||||
if(status_flags & GODMODE)
|
||||
return 0
|
||||
var/is_asystole = is_asystole()
|
||||
@@ -1241,7 +1246,9 @@
|
||||
if(is_asystole)
|
||||
shock_stage = max(shock_stage + 1, 61)
|
||||
|
||||
var/traumatic_shock = get_shock()
|
||||
if(isnull(traumatic_shock))
|
||||
traumatic_shock = get_shock()
|
||||
|
||||
if(traumatic_shock >= max(30, 0.8*shock_stage))
|
||||
shock_stage += 1
|
||||
else if (!is_asystole)
|
||||
@@ -1484,15 +1491,20 @@
|
||||
if((mutations & XRAY))
|
||||
set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
|
||||
/mob/living/carbon/human/proc/handle_stamina()
|
||||
/**
|
||||
* This proc assumes that if shock_value = null, then a shock value was NOT passed in, and thus it calculates it itself.
|
||||
* If you for some reason need to call this alongside a lot of other shit that needs shock, make sure you cache that value, because calculating it is expensive.
|
||||
*/
|
||||
/mob/living/carbon/human/proc/handle_stamina(traumatic_shock = null)
|
||||
if (species.stamina == -1) //If species stamina is -1, it has special mechanics which will be handled elsewhere
|
||||
return //so quit this function
|
||||
|
||||
if (!exhaust_threshold) // Also quit if there's no exhaust threshold specified, because division by 0 is amazing.
|
||||
return
|
||||
|
||||
var/shock = get_shock() // used again later for stamina regeneration
|
||||
if (failed_last_breath || (getOxyLoss() + shock) > exhaust_threshold)//Can't catch our breath if we're suffocating
|
||||
if(isnull(traumatic_shock))
|
||||
traumatic_shock = get_shock() // used again later for stamina regeneration
|
||||
if (failed_last_breath || (getOxyLoss() + traumatic_shock) > exhaust_threshold)//Can't catch our breath if we're suffocating
|
||||
flash_pain(getOxyLoss()/2)
|
||||
return
|
||||
|
||||
@@ -1509,7 +1521,7 @@
|
||||
if (stamina != max_stamina)
|
||||
//Any suffocation damage slows stamina regen.
|
||||
//This includes oxyloss from low blood levels
|
||||
var/regen = stamina_recovery * (1 - min(((getOxyLoss()) / exhaust_threshold) + (shock / exhaust_threshold), 1))
|
||||
var/regen = stamina_recovery * (1 - min(((getOxyLoss()) / exhaust_threshold) + (traumatic_shock / exhaust_threshold), 1))
|
||||
if(is_drowsy())
|
||||
regen *= 0.85
|
||||
if (regen > 0)
|
||||
|
||||
Reference in New Issue
Block a user