mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 15:08:02 +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:
@@ -98,6 +98,7 @@ proc/RoundHealth(health)
|
||||
return "health-100"
|
||||
return "0"
|
||||
|
||||
|
||||
/*
|
||||
Proc for attack log creation, because really why not
|
||||
1 argument is the actor
|
||||
@@ -116,3 +117,4 @@ proc/add_logs(mob/target, mob/user, what_done, var/object=null, var/addition=nul
|
||||
if(target.client)
|
||||
if(what_done != ("shaked" || "CPRed" || "grabbed"))
|
||||
message_admins("[user.name][ismob(user) ? "([user.ckey])" : ""] [what_done] [target.name][ismob(target) ? "([target.ckey])" : ""][object ? " with [object]" : " "][addition](<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[target.x];Y=[target.y];Z=[target.z]'>JMP</a>)")
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
src.imp = null
|
||||
update()
|
||||
|
||||
return
|
||||
|
||||
|
||||
/obj/item/weapon/implanter/traitor
|
||||
|
||||
@@ -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)
|
||||
|
||||
+5
-6
@@ -733,12 +733,12 @@ var/list/be_special_flags = list(
|
||||
#define RIGHT 2
|
||||
|
||||
// for secHUDs and medHUDs and variants. The number is the location of the image on the list hud_list of humans.
|
||||
#define HEALTH_HUD 1 // a simple line rounding the mob's number health
|
||||
#define STATUS_HUD 2 // alive, dead, diseased, etc.
|
||||
#define ID_HUD 3 // the job asigned to your ID
|
||||
#define WANTED_HUD 4 // wanted, released, parroled, security status
|
||||
#define HEALTH_HUD 1 // a simple line rounding the mob's number health
|
||||
#define STATUS_HUD 2 // alive, dead, diseased, etc.
|
||||
#define ID_HUD 3 // the job asigned to your ID
|
||||
#define WANTED_HUD 4 // wanted, released, parroled, security status
|
||||
#define IMPLOYAL_HUD 5 // loyality implant
|
||||
#define IMPCHEM_HUD 6 // chemical implant
|
||||
#define IMPCHEM_HUD 6 // chemical implant
|
||||
#define IMPTRACK_HUD 7 // tracking implant
|
||||
#define SPECIALROLE_HUD 8 // AntagHUD image
|
||||
#define STATUS_HUD_OOC 9 // STATUS_HUD without virus db check for someone being ill.
|
||||
@@ -844,4 +844,3 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse
|
||||
#define COLOR_YELLOW "#FFFF00"
|
||||
#define COLOR_ORANGE "#FF9900"
|
||||
#define COLOR_WHITE "#FFFFFF"
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Reference in New Issue
Block a user