update_appearance (#55468)

Creates update_name and update_desc
Creates the wrapper proc update_appearance to batch update_name, update_desc, and update_icon together
Less non-icon handling code in update_icon and friends
Signal hooks for things that want to change names and descriptions
99%+ of the changes in this are just from switching everything over to update_appearance from update_icon
This commit is contained in:
TemporalOroboros
2021-02-19 12:06:18 -03:00
committed by GitHub
parent dc4b7226d0
commit e4079c87b8
585 changed files with 4689 additions and 4133 deletions
+25 -27
View File
@@ -312,28 +312,26 @@
//This proc is used to update the icons of nearby windows.
/obj/structure/window/proc/update_nearby_icons()
update_icon()
update_appearance()
if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))
QUEUE_SMOOTH_NEIGHBORS(src)
//merges adjacent full-tile windows into one
/obj/structure/window/update_overlays()
. = ..()
if(!QDELETED(src))
if(!fulltile)
return
if(QDELETED(src) || !fulltile)
return
var/ratio = obj_integrity / max_integrity
ratio = CEILING(ratio*4, 1) * 25
if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))
QUEUE_SMOOTH(src)
if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))
QUEUE_SMOOTH(src)
cut_overlay(crack_overlay)
if(ratio > 75)
return
crack_overlay = mutable_appearance('icons/obj/structures.dmi', "damage[ratio]", -(layer+0.1))
. += crack_overlay
var/ratio = obj_integrity / max_integrity
ratio = CEILING(ratio*4, 1) * 25
cut_overlay(crack_overlay)
if(ratio > 75)
return
crack_overlay = mutable_appearance('icons/obj/structures.dmi', "damage[ratio]", -(layer+0.1))
. += crack_overlay
/obj/structure/window/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
return exposed_temperature > T0C + heat_resistance
@@ -765,7 +763,7 @@
/obj/structure/window/paperframe/Initialize()
. = ..()
update_icon()
update_appearance()
/obj/structure/window/paperframe/examine(mob/user)
. = ..()
@@ -782,22 +780,22 @@
if(.)
return
if(user.combat_mode)
take_damage(4,BRUTE,MELEE, 0)
take_damage(4, BRUTE, MELEE, 0)
if(!QDELETED(src))
update_icon()
update_appearance()
/obj/structure/window/paperframe/update_appearance(updates)
. = ..()
set_opacity(obj_integrity >= max_integrity)
/obj/structure/window/paperframe/update_icon()
if(obj_integrity < max_integrity)
cut_overlay(paper)
add_overlay(torn)
set_opacity(FALSE)
else
cut_overlay(torn)
add_overlay(paper)
set_opacity(TRUE)
. = ..()
if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))
QUEUE_SMOOTH(src)
/obj/structure/window/paperframe/update_overlays()
. = ..()
. += (obj_integrity < max_integrity) ? torn : paper
/obj/structure/window/paperframe/attackby(obj/item/W, mob/living/user)
if(W.get_temperature())
@@ -812,10 +810,10 @@
qdel(W)
user.visible_message("<span class='notice'>[user] patches some of the holes in \the [src].</span>")
if(obj_integrity == max_integrity)
update_icon()
update_appearance()
return
..()
update_icon()
update_appearance()
/obj/structure/window/bronze
name = "brass window"