Use mutable_appearance for HUD health overlays.

This improves the issue of player mobs using excessive CPU every Life() tick.
* Testing determined the worst performance was actually the manipulation of the "healths" HUD doll's overlays.
* Switching to using a mutable_appearance helps quite a bit for little effort.
This commit is contained in:
Leshana
2017-12-26 16:10:25 -05:00
parent 4540f770d4
commit 00a00bb1c8

View File

@@ -1211,8 +1211,9 @@
healths.icon_state = "health_numb" healths.icon_state = "health_numb"
else else
// Generate a by-limb health display. // Generate a by-limb health display.
healths.icon_state = "blank" var/mutable_appearance/healths_ma = new(healths)
healths.overlays = null healths_ma.icon_state = "blank"
healths_ma.overlays = null
var/no_damage = 1 var/no_damage = 1
var/trauma_val = 0 // Used in calculating softcrit/hardcrit indicators. var/trauma_val = 0 // Used in calculating softcrit/hardcrit indicators.
@@ -1240,7 +1241,8 @@
else if(no_damage) else if(no_damage)
health_images += image('icons/mob/screen1_health.dmi',"fullhealth") health_images += image('icons/mob/screen1_health.dmi',"fullhealth")
healths.overlays += health_images healths_ma.overlays += health_images
healths.appearance = healths_ma
if(nutrition_icon) if(nutrition_icon)
switch(nutrition) switch(nutrition)