mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +01:00
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/modules/mob/living/living.dm Conflicts: code/__HELPERS/mobs.dm code/datums/mind.dm code/game/objects/items/weapons/implants/implanter.dm code/modules/mob/dead/observer/observer.dm code/modules/mob/living/carbon/human/human.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/ai/ai.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:
@@ -94,7 +94,6 @@ Works together with spawning an observer, noted above.
|
||||
for(var/image/hud in client.images)
|
||||
if(copytext(hud.icon_state,1,4) == "hud")
|
||||
client.images.Remove(hud)
|
||||
|
||||
if(antagHUD)
|
||||
var/list/target_list = list()
|
||||
for(var/mob/living/target in oview(src, 14))
|
||||
|
||||
@@ -90,7 +90,6 @@
|
||||
hud_list[SPECIALROLE_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[STATUS_HUD_OOC] = image('icons/mob/hud.dmi', src, "hudhealthy")
|
||||
|
||||
|
||||
..()
|
||||
|
||||
if(dna)
|
||||
|
||||
@@ -1263,7 +1263,6 @@
|
||||
if(hud_updateflag)
|
||||
handle_hud_list()
|
||||
|
||||
|
||||
for(var/image/hud in client.images)
|
||||
if(copytext(hud.icon_state,1,4) == "hud") //ugly, but icon comparison is worse, I believe
|
||||
client.images.Remove(hud)
|
||||
@@ -1734,6 +1733,9 @@
|
||||
makeSkeleton()
|
||||
return //No puking over skeletons, they don't smell at all!
|
||||
|
||||
// if(loc == /obj/structure/morgue)
|
||||
// return
|
||||
|
||||
for(var/mob/living/carbon/human/H in range(decaylevel, src))
|
||||
if(prob(5))
|
||||
if(airborne_can_reach(get_turf(src), get_turf(H)))
|
||||
@@ -1817,7 +1819,6 @@
|
||||
var/obj/item/weapon/card/id/I = wear_id.GetID()
|
||||
if(I)
|
||||
perpname = I.registered_name
|
||||
|
||||
for(var/datum/data/record/E in data_core.general)
|
||||
if(E.fields["name"] == perpname)
|
||||
for (var/datum/data/record/R in data_core.security)
|
||||
|
||||
@@ -273,7 +273,7 @@
|
||||
|
||||
/mob/living/proc/restore_all_organs()
|
||||
return
|
||||
|
||||
|
||||
/mob/living/proc/revive()
|
||||
rejuvenate()
|
||||
buckled = initial(src.buckled)
|
||||
@@ -318,12 +318,12 @@
|
||||
if(iscarbon(src))
|
||||
var/mob/living/carbon/C = src
|
||||
C.handcuffed = initial(C.handcuffed)
|
||||
|
||||
|
||||
// restore all of the human's blood
|
||||
if(ishuman(src))
|
||||
var/mob/living/carbon/human/human_mob = src
|
||||
human_mob.restore_blood()
|
||||
|
||||
|
||||
for(var/datum/disease/D in viruses)
|
||||
D.cure(0)
|
||||
restore_all_organs()
|
||||
@@ -335,7 +335,6 @@
|
||||
regenerate_icons()
|
||||
hud_updateflag |= 1 << HEALTH_HUD
|
||||
hud_updateflag |= 1 << STATUS_HUD
|
||||
..()
|
||||
return
|
||||
|
||||
/mob/living/proc/UpdateDamageIcon()
|
||||
|
||||
@@ -142,6 +142,18 @@
|
||||
var/datum/robot_component/cell_component = components["power cell"]
|
||||
cell_component.wrapped = cell
|
||||
cell_component.installed = 1
|
||||
|
||||
hud_list[HEALTH_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[STATUS_HUD] = image('icons/mob/hud.dmi', src, "hudhealth100")
|
||||
hud_list[ID_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[WANTED_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[IMPLOYAL_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[IMPCHEM_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[IMPTRACK_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[SPECIALROLE_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
|
||||
|
||||
|
||||
|
||||
hud_list[HEALTH_HUD] = image('icons/mob/hud.dmi', src, "hudblank")
|
||||
hud_list[STATUS_HUD] = image('icons/mob/hud.dmi', src, "hudhealth100")
|
||||
|
||||
@@ -220,3 +220,4 @@
|
||||
now_pushing = null
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -88,21 +88,25 @@ proc/airborne_can_reach(turf/source, turf/target, var/radius=5)
|
||||
D.minormutate()
|
||||
M.virus2["[D.uniqueID]"] = D
|
||||
M.hud_updateflag |= 1 << STATUS_HUD
|
||||
return 1
|
||||
return 0
|
||||
|
||||
//Infects mob M with random lesser disease, if he doesn't have one
|
||||
/proc/infect_mob_random_lesser(var/mob/living/carbon/M)
|
||||
var/datum/disease2/disease/D = new /datum/disease2/disease
|
||||
D.makerandom()
|
||||
D.infectionchance = 1
|
||||
infect_virus2(M,D,1)
|
||||
M.virus2["[D.uniqueID]"] = D
|
||||
M.hud_updateflag |= 1 << STATUS_HUD
|
||||
|
||||
//Infects mob M with random greated disease, if he doesn't have one
|
||||
/proc/infect_mob_random_greater(var/mob/living/carbon/M)
|
||||
var/datum/disease2/disease/D = new /datum/disease2/disease
|
||||
D.makerandom(1)
|
||||
infect_virus2(M,D,1)
|
||||
M.virus2["[D.uniqueID]"] = D
|
||||
M.hud_updateflag |= 1 << STATUS_HUD
|
||||
|
||||
//Fancy prob() function.
|
||||
/proc/dprob(var/p)
|
||||
return(prob(sqrt(p)) && prob(sqrt(p)))
|
||||
|
||||
/mob/living/carbon/proc/spread_disease_to(var/mob/living/carbon/victim, var/vector = "Airborne")
|
||||
if (src == victim)
|
||||
|
||||
Reference in New Issue
Block a user