Code effeciency project: HUD items rewrite

Before: Every tick each HUD item would recalculate and redo images for every mob in view. For items like the secHUD where we're transversing implants and the various records this gets very expensive.

After: Mobs use their hud_list variable to store varius huditem images, when conditions change for those specific huditem images it updates the specific ones on demand. As a backup every 30 ticks or so the mob will update all of their hud_list.

Also: moved proc/RoundHealth() from 2 seperate locations into __HELPERS/mobs.dm

Conflicts:
	code/__HELPERS/mobs.dm
	code/game/objects/items/weapons/implants/implanter.dm
	code/modules/mob/dead/observer/observer.dm
	code/modules/mob/living/carbon/human/human_damage.dm
	code/modules/mob/living/carbon/human/life.dm
	code/modules/mob/living/living.dm
	code/modules/mob/living/living_defines.dm
	code/modules/mob/living/silicon/silicon.dm
	code/modules/virus2/helpers.dm
	code/setup.dm
	icons/mob/hud.dmi
This commit is contained in:
Ccomp5950
2014-03-10 08:07:29 -04:00
committed by ZomgPonies
parent 999318156e
commit 1e5514e27e
25 changed files with 318 additions and 220 deletions
+15 -1
View File
@@ -538,6 +538,9 @@ datum/mind
else if(href_list["implant"])
var/mob/living/carbon/human/H = current
H.hud_updateflag |= (1 << IMPLOYAL_HUD) // updates that players HUD images so secHUD's pick up they are implanted or not.
switch(href_list["implant"])
if("remove")
for(var/obj/item/weapon/implant/loyalty/I in H.contents)
@@ -578,6 +581,8 @@ datum/mind
log_admin("[key_name_admin(usr)] has de-traitor'ed [current].")
else if (href_list["revolution"])
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["revolution"])
if("clear")
if(src in ticker.mode.revolutionaries)
@@ -667,6 +672,7 @@ datum/mind
usr << "\red Reequipping revolutionary goes wrong!"
else if (href_list["cult"])
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["cult"])
if("clear")
if(src in ticker.mode.cult)
@@ -713,6 +719,8 @@ datum/mind
usr << "\red Spawning amulet failed!"
else if (href_list["wizard"])
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["wizard"])
if("clear")
if(src in ticker.mode.wizards)
@@ -739,6 +747,7 @@ datum/mind
usr << "\blue The objectives for wizard [key] have been generated. You can edit them and anounce manually."
else if (href_list["changeling"])
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["changeling"])
if("clear")
if(src in ticker.mode.changelings)
@@ -792,6 +801,10 @@ datum/mind
else if (href_list["nuclear"])
var/mob/living/carbon/human/H = current
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["nuclear"])
if("clear")
if(src in ticker.mode.syndicates)
@@ -818,7 +831,6 @@ datum/mind
if("lair")
current.loc = get_turf(locate("landmark*Syndicate-Spawn"))
if("dressup")
var/mob/living/carbon/human/H = current
del(H.belt)
del(H.back)
del(H.l_ear)
@@ -846,6 +858,7 @@ datum/mind
usr << "\red No valid nuke found!"
else if (href_list["traitor"])
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["traitor"])
if("clear")
if(src in ticker.mode.traitors)
@@ -925,6 +938,7 @@ datum/mind
current.radiation -= 50
else if (href_list["silicon"])
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["silicon"])
if("unmalf")
if(src in ticker.mode.malf_ai)