mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 12:07:27 +01:00
Merge pull request #5324 from Krausus/HumanOverlayCache
Human Overlay Caching and Minor Overlay Fixes
This commit is contained in:
@@ -21,7 +21,7 @@ var/global/list/frozen_mob_list = list()
|
||||
|
||||
///mob freeze procs
|
||||
|
||||
/mob/living/var/frozen = 0 //used for preventing attacks on admin-frozen mobs
|
||||
/mob/living/var/frozen = null //used for preventing attacks on admin-frozen mobs
|
||||
/mob/living/var/admin_prev_sleeping = 0 //used for keeping track of previous sleeping value with admin freeze
|
||||
|
||||
/mob/living/proc/admin_Freeze(var/client/admin)
|
||||
@@ -34,7 +34,7 @@ var/global/list/frozen_mob_list = list()
|
||||
src.overlays += AO
|
||||
|
||||
anchored = 1
|
||||
frozen = 1
|
||||
frozen = AO
|
||||
admin_prev_sleeping = sleeping
|
||||
sleeping += 20000
|
||||
if(!(src in frozen_mob_list))
|
||||
@@ -46,15 +46,16 @@ var/global/list/frozen_mob_list = list()
|
||||
message_admins("\blue [key_name_admin(admin)] unfroze [key_name_admin(src)]")
|
||||
log_admin("[key_name(admin)] unfroze [key_name(src)]")
|
||||
|
||||
update_icons()
|
||||
|
||||
anchored = 0
|
||||
frozen = 0
|
||||
overlays -= frozen
|
||||
frozen = null
|
||||
sleeping = admin_prev_sleeping
|
||||
admin_prev_sleeping = null
|
||||
if(src in frozen_mob_list)
|
||||
frozen_mob_list -= src
|
||||
|
||||
update_icons()
|
||||
|
||||
|
||||
/mob/living/carbon/slime/admin_Freeze(admin)
|
||||
..(admin)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
var/obj/item/organ/internal/eyes/eyes = get_int_organ(/obj/item/organ/internal/eyes)
|
||||
if(eyes)
|
||||
eyes.update_colour()
|
||||
regenerate_icons()
|
||||
update_body()
|
||||
|
||||
/mob/living/carbon/human/var/list/organs = list()
|
||||
/mob/living/carbon/human/var/list/organs_by_name = list() // map organ names to organs
|
||||
|
||||
@@ -107,17 +107,7 @@ Please contact me on #coderbus IRC. ~Carn x
|
||||
var/list/overlays_standing[TOTAL_LAYERS]
|
||||
var/previous_damage_appearance // store what the body last looked like, so we only have to update it if something changed
|
||||
var/icon/skeleton
|
||||
|
||||
|
||||
/mob/living/carbon/human/proc/apply_overlay(cache_index)
|
||||
var/image/I = overlays_standing[cache_index]
|
||||
if(I)
|
||||
overlays += I
|
||||
|
||||
/mob/living/carbon/human/proc/remove_overlay(cache_index)
|
||||
if(overlays_standing[cache_index])
|
||||
overlays -= overlays_standing[cache_index]
|
||||
overlays_standing[cache_index] = null
|
||||
var/list/cached_standing_overlays = list() // List of everything currently in a human's actual overlays
|
||||
|
||||
//UPDATES OVERLAYS FROM OVERLAYS_LYING/OVERLAYS_STANDING
|
||||
//this proc is messy as I was forced to include some old laggy cloaking code to it so that I don't break cloakers
|
||||
@@ -125,6 +115,7 @@ Please contact me on #coderbus IRC. ~Carn x
|
||||
/mob/living/carbon/human/update_icons()
|
||||
var/stealth = 0
|
||||
var/obj/item/clothing/suit/armor/abductor/vest/V // Begin the most snowflakey bullshit code I've ever written. I'm so sorry, but there was no other way.
|
||||
|
||||
for(V in list(wear_suit))
|
||||
if(V.stealth_active)
|
||||
stealth = 1
|
||||
@@ -133,6 +124,7 @@ Please contact me on #coderbus IRC. ~Carn x
|
||||
if(stealth)
|
||||
icon = V.disguise.icon //if the suit is active, reference the suit's current loaded icon and overlays; this does not include hand overlays
|
||||
overlays.Cut()
|
||||
cached_standing_overlays.Cut() // Make sure the cache gets rebuilt once the disguise is gone
|
||||
|
||||
for(var/thing in V.disguise.overlays)
|
||||
if(thing)
|
||||
@@ -146,10 +138,28 @@ Please contact me on #coderbus IRC. ~Carn x
|
||||
overlays += I
|
||||
else
|
||||
icon = stand_icon
|
||||
overlays.Cut()
|
||||
var/list/new_overlays = list()
|
||||
var/list/old_overlays = cached_standing_overlays
|
||||
|
||||
for(var/thing in overlays_standing)
|
||||
if(thing) overlays += thing
|
||||
// Totally regenerate if something touched our overlays
|
||||
if(overlays.len != old_overlays.len)
|
||||
overlays.Cut()
|
||||
old_overlays.Cut()
|
||||
|
||||
for(var/i in 1 to TOTAL_LAYERS)
|
||||
var/image/I = overlays_standing[i]
|
||||
if(I)
|
||||
if(istype(I))
|
||||
// Since we avoid full overlay rebuilds, we have to reorganize the layers manually
|
||||
I.layer = (-2 - (TOTAL_LAYERS - i)) // Highest layer gets -2, each prior layer is 1 lower
|
||||
new_overlays += I
|
||||
|
||||
if(frozen) // Admin freeze overlay
|
||||
new_overlays += frozen
|
||||
|
||||
overlays += (new_overlays - old_overlays)
|
||||
overlays -= (old_overlays - new_overlays)
|
||||
cached_standing_overlays = new_overlays
|
||||
|
||||
update_transform()
|
||||
|
||||
@@ -538,12 +548,13 @@ var/global/list/damage_icon_parts = list()
|
||||
|
||||
|
||||
/mob/living/carbon/human/update_fire()
|
||||
remove_overlay(FIRE_LAYER)
|
||||
if(on_fire)
|
||||
overlays_standing[FIRE_LAYER] = image("icon"=fire_dmi, "icon_state"=fire_sprite, "layer"=-FIRE_LAYER)
|
||||
if(!overlays_standing[FIRE_LAYER])
|
||||
overlays_standing[FIRE_LAYER] = image("icon"=fire_dmi, "icon_state"=fire_sprite)
|
||||
update_icons()
|
||||
else
|
||||
overlays_standing[FIRE_LAYER] = null
|
||||
apply_overlay(FIRE_LAYER)
|
||||
update_icons()
|
||||
|
||||
/* --------------------------------------- */
|
||||
//For legacy support.
|
||||
@@ -574,11 +585,12 @@ var/global/list/damage_icon_parts = list()
|
||||
update_inv_legcuffed(0)
|
||||
update_inv_pockets(0)
|
||||
update_inv_wear_pda(0)
|
||||
UpdateDamageIcon()
|
||||
update_icons()
|
||||
update_fire()
|
||||
UpdateDamageIcon(0)
|
||||
force_update_limbs()
|
||||
update_tail_layer(0)
|
||||
overlays.Cut() // Force all overlays to regenerate
|
||||
update_fire()
|
||||
update_icons()
|
||||
/* --------------------------------------- */
|
||||
//vvvvvv UPDATE_INV PROCS vvvvvv
|
||||
|
||||
|
||||
Reference in New Issue
Block a user