From 52a79c8bdd07a429f1e64be7cf278c097a2a066b Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Fri, 23 Apr 2021 02:47:07 -0700 Subject: [PATCH] icon2html optimization stuff (#58607) --- code/__DEFINES/flags.dm | 2 ++ code/__HELPERS/icon_smoothing.dm | 1 + code/__HELPERS/icons.dm | 5 +++-- code/game/machinery/doors/airlock.dm | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index b6b63fbb7e2..c583ed48ade 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -62,6 +62,8 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 #define SUPERMATTER_IGNORES_1 (1 << 19) /// If a turf can be made dirty at roundstart. This is also used in areas. #define CAN_BE_DIRTY_1 (1<<20) +/// Should we use the initial icon for display? Mostly used by overlay only objects +#define HTML_USE_INITAL_ICON_1 (1<<21) // Update flags for [/atom/proc/update_appearance] /// Update the atom's name diff --git a/code/__HELPERS/icon_smoothing.dm b/code/__HELPERS/icon_smoothing.dm index 760d0baa290..f1cdeadb6e9 100644 --- a/code/__HELPERS/icon_smoothing.dm +++ b/code/__HELPERS/icon_smoothing.dm @@ -152,6 +152,7 @@ DEFINE_BITFIELD(smoothing_junction, list( //do not use, use QUEUE_SMOOTH(atom) /atom/proc/smooth_icon() smoothing_flags &= ~SMOOTH_QUEUED + flags_1 |= HTML_USE_INITAL_ICON_1 if (!z) CRASH("[type] called smooth_icon() without being on a z-level") if(smoothing_flags & SMOOTH_CORNERS) diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 278a807053c..457bacfae7c 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -1104,7 +1104,6 @@ GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0 /proc/generate_asset_name(file) return "asset.[md5(fcopy_rsc(file))]" - /** * Converts an icon to base64. Operates by putting the icon in the iconCache savefile, * exporting it as text, and then parsing the base64 from that. @@ -1141,6 +1140,7 @@ GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0 targets = target if (!targets.len) return + if (!isicon(I)) if (isfile(thing)) //special snowflake var/name = sanitize_filename("[generate_asset_name(thing)].png") @@ -1154,9 +1154,10 @@ GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0 var/atom/A = thing I = A.icon + if (isnull(icon_state)) icon_state = A.icon_state - if (!(icon_state in icon_states(I, 1))) + if (isnull(icon_state) || A.flags_1 & HTML_USE_INITAL_ICON_1) icon_state = initial(A.icon_state) if (isnull(dir)) dir = initial(A.dir) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 1d7f548912f..357559b1d3f 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -114,7 +114,7 @@ var/air_tight = FALSE //TRUE means density will be set as soon as the door begins to close var/prying_so_hard = FALSE - flags_1 = RAD_PROTECT_CONTENTS_1 | RAD_NO_CONTAMINATE_1 + flags_1 = RAD_PROTECT_CONTENTS_1 | RAD_NO_CONTAMINATE_1 | HTML_USE_INITAL_ICON_1 rad_insulation = RAD_MEDIUM_INSULATION network_id = NETWORK_DOOR_AIRLOCKS