From 56a6eaa8e6eb05903575ba6d7b44b3b573ff1174 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 22 Feb 2017 03:44:55 -0500 Subject: [PATCH] Overlay queuing (#23922) * Overlay queuing * Fix SS flags * Don't copy on assignment * Flags processing * Fix icon_smoothing * MSO's helper proc * Legacy detection * Make it work * Fixes shitcode * Fix the flag * |= -> += * OK, how did I fuck that up? * shitcode * Conditional assoc queue while initializing * Cleanup everything * Orange meme * This isn't perfect, but its the best byond will give us. * forgot about dir * oh ya * This was litterally the last thing i did last night before heading to bed You can tell can't you? * Fixes various shit * Let's not ever pause * Fix the flag * Cleaned up some missing shit. Added image dummys * Remove the one usage of FPRINT * Jesus get rid of this --- code/__DEFINES/flags.dm | 2 +- code/__HELPERS/{lists.dm => _lists.dm} | 0 code/__HELPERS/icon_smoothing.dm | 31 ++- code/__HELPERS/icons.dm | 21 -- code/__HELPERS/unsorted.dm | 2 +- code/_onclick/hud/alert.dm | 3 +- code/_onclick/hud/parallax.dm | 6 +- code/_onclick/hud/plane_master.dm | 2 +- code/controllers/subsystem/acid.dm | 3 +- .../subsystem/processing/overlays.dm | 182 ++++++++++++++++++ code/datums/action.dm | 3 +- code/datums/status_effects/gas.dm | 4 +- code/game/atoms.dm | 10 +- code/game/gamemodes/blob/blobs/blob_mobs.dm | 12 +- .../gamemodes/devil/true_devil/inventory.dm | 5 +- .../miniantags/abduction/abduction_gear.dm | 2 +- .../miniantags/abduction/machinery/console.dm | 2 +- code/game/gamemodes/nuclear/nuclearbomb.dm | 4 +- code/game/machinery/announcement_system.dm | 6 - code/game/machinery/doors/airlock.dm | 45 +---- code/game/machinery/iv_drip.dm | 2 +- code/game/machinery/robot_fabricator.dm | 4 +- code/game/machinery/status_display.dm | 6 +- .../game/mecha/equipment/tools/other_tools.dm | 8 +- code/game/mecha/mech_fabricator.dm | 4 +- code/game/mecha/mecha_construction_paths.dm | 2 +- code/game/mecha/working/ripley.dm | 2 +- code/game/objects/items.dm | 2 +- code/game/objects/items/devices/megaphone.dm | 1 - .../objects/items/devices/taperecorder.dm | 2 +- code/game/objects/items/weapons/explosives.dm | 3 +- .../items/weapons/grenades/ghettobomb.dm | 2 +- .../objects/items/weapons/grenades/plastic.dm | 6 +- .../objects/items/weapons/storage/secure.dm | 4 +- code/game/objects/obj_defense.dm | 6 +- .../structures/beds_chairs/alien_nest.dm | 2 +- .../objects/structures/beds_chairs/chair.dm | 2 +- .../crates_lockers/closets/statue.dm | 2 +- code/game/objects/structures/window.dm | 2 +- code/game/turfs/open.dm | 4 +- code/game/turfs/simulated/minerals.dm | 2 +- code/game/turfs/simulated/walls.dm | 2 +- code/game/turfs/turf.dm | 4 +- code/modules/assembly/bomb.dm | 2 +- .../environmental/LINDA_turf_tile.dm | 2 +- code/modules/clothing/clothing.dm | 3 +- code/modules/clothing/suits/miscellaneous.dm | 2 +- .../food_and_drinks/drinks/drinks/bottle.dm | 2 +- .../food_and_drinks/food/customizables.dm | 4 +- .../food_and_drinks/food/snacks_other.dm | 3 +- code/modules/games/cards.dm | 6 +- code/modules/hydroponics/hydroponics.dm | 2 +- code/modules/mining/fulton.dm | 12 +- code/modules/mining/lavaland/ruins/gym.dm | 2 +- code/modules/mob/dead/observer/observer.dm | 12 +- code/modules/mob/living/blood.dm | 2 +- .../living/carbon/alien/larva/update_icons.dm | 2 +- .../carbon/alien/special/alien_embryo.dm | 2 +- code/modules/mob/living/carbon/human/human.dm | 6 +- .../modules/mob/living/carbon/update_icons.dm | 11 +- code/modules/mob/living/silicon/robot/life.dm | 6 +- .../living/simple_animal/bot/construction.dm | 6 +- .../friendly/drone/visuals_icons.dm | 7 +- .../living/simple_animal/guardian/guardian.dm | 7 +- .../mob/living/simple_animal/hostile/mimic.dm | 2 +- .../mob/living/simple_animal/slime/death.dm | 2 +- .../computers/machinery/modular_computer.dm | 2 +- code/modules/paperwork/photography.dm | 10 +- code/modules/power/apc.dm | 6 +- .../projectiles/guns/ballistic/automatic.dm | 12 +- code/modules/projectiles/projectile/magic.dm | 2 +- .../reagents/reagent_containers/bottle.dm | 2 +- code/modules/research/protolathe.dm | 4 +- code/modules/spells/spell_types/lightning.dm | 4 +- code/modules/telesci/gps.dm | 6 +- code/modules/vehicles/atv.dm | 2 +- tgstation.dme | 3 +- 77 files changed, 349 insertions(+), 228 deletions(-) rename code/__HELPERS/{lists.dm => _lists.dm} (100%) create mode 100644 code/controllers/subsystem/processing/overlays.dm diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index 3d844fb84d9..05b5fdca68c 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -16,7 +16,7 @@ #define CONDUCT 64 // conducts electricity (metal etc.) #define ABSTRACT 128 // for all things that are technically items but used for various different stuff, made it 128 because it could conflict with other flags other way #define NODECONSTRUCT 128 // For machines and structures that should not break into parts, eg, holodeck stuff -#define FPRINT 256 // takes a fingerprint +#define OVERLAY_QUEUED 256 //atom queued to SSoverlay #define ON_BORDER 512 // item has priority to check when entering or leaving #define EARBANGPROTECT 1024 diff --git a/code/__HELPERS/lists.dm b/code/__HELPERS/_lists.dm similarity index 100% rename from code/__HELPERS/lists.dm rename to code/__HELPERS/_lists.dm diff --git a/code/__HELPERS/icon_smoothing.dm b/code/__HELPERS/icon_smoothing.dm index ee0f069c924..108c2f1c54b 100644 --- a/code/__HELPERS/icon_smoothing.dm +++ b/code/__HELPERS/icon_smoothing.dm @@ -238,32 +238,31 @@ else if(adjacencies & N_EAST) se = "4-e" - var/list/New = list() + var/list/New if(A.top_left_corner != nw) - A.overlays -= A.top_left_corner + A.cut_overlay(A.top_left_corner) A.top_left_corner = nw - New += nw + LAZYADD(New, nw) if(A.top_right_corner != ne) - A.overlays -= A.top_right_corner + A.cut_overlay(A.top_right_corner) A.top_right_corner = ne - New += ne + LAZYADD(New, ne) if(A.bottom_right_corner != sw) - A.overlays -= A.bottom_right_corner + A.cut_overlay(A.bottom_right_corner) A.bottom_right_corner = sw - New += sw + LAZYADD(New, sw) if(A.bottom_left_corner != se) - A.overlays -= A.bottom_left_corner + A.cut_overlay(A.bottom_left_corner) A.bottom_left_corner = se - New += se - - if(New.len) + LAZYADD(New, se) + + if(New) A.add_overlay(New) - /proc/find_type_in_direction(atom/source, direction) var/turf/target_turf = get_step(source, direction) if(!target_turf) @@ -312,13 +311,13 @@ queue_smooth(A) /atom/proc/clear_smooth_overlays() - overlays -= top_left_corner + cut_overlay(top_left_corner) top_left_corner = null - overlays -= top_right_corner + cut_overlay(top_right_corner) top_right_corner = null - overlays -= bottom_right_corner + cut_overlay(bottom_right_corner) bottom_right_corner = null - overlays -= bottom_left_corner + cut_overlay(bottom_left_corner) bottom_left_corner = null /atom/proc/replace_smooth_overlays(nw, ne, sw, se) diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 34f3817acf2..586d2d502be 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -943,27 +943,6 @@ var/global/list/friendly_animal_types = list() return J return 0 -/atom/proc/cut_overlays() - overlays.Cut() - overlays += priority_overlays - -/atom/proc/add_overlay(image, priority = 0) - var/list/new_overlays = overlays.Copy() - new_overlays -= image - if(priority) - if(!priority_overlays) - priority_overlays = list() - priority_overlays += image - new_overlays += image - else - if(priority_overlays) - new_overlays -= priority_overlays - new_overlays += image - new_overlays += priority_overlays - else - new_overlays += image - overlays = new_overlays - var/global/list/humanoid_icon_cache = list() //For creating consistent icons for human looking simple animals /proc/get_flat_human_icon(var/icon_id,var/outfit,var/datum/preferences/prefs) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 33b966e3335..9dd1fd5ac5f 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1191,7 +1191,7 @@ B --><-- A return A.add_overlay(I) sleep(duration) - A.overlays -= I + A.cut_overlay(I) /proc/get_areas_in_z(zlevel) . = list() diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm index 16e20e9c355..d120c7ad899 100644 --- a/code/_onclick/hud/alert.dm +++ b/code/_onclick/hud/alert.dm @@ -40,7 +40,8 @@ var/old_plane = new_master.plane new_master.layer = FLOAT_LAYER new_master.plane = FLOAT_PLANE - alert.overlays += new_master + var/atom/yes_this_is_a_bloody_atom = alert + yes_this_is_a_bloody_atom.add_overlay(new_master) // B Y O N D new_master.layer = old_layer new_master.plane = old_plane alert.icon_state = "template" // We'll set the icon to the client's ui pref in reorganize_alerts() diff --git a/code/_onclick/hud/parallax.dm b/code/_onclick/hud/parallax.dm index 30cbc094abc..7505ba3830c 100644 --- a/code/_onclick/hud/parallax.dm +++ b/code/_onclick/hud/parallax.dm @@ -220,8 +220,9 @@ /obj/screen/parallax_layer/proc/update_o(view) if (!view) view = world.view - var/list/new_overlays = list() + var/count = Ceiling(view/(480/world.icon_size))+1 + var/list/new_overlays = new for(var/x in -count to count) for(var/y in -count to count) if(x == 0 && y == 0) @@ -229,8 +230,7 @@ var/image/I = image(icon, null, icon_state) I.transform = matrix(1, 0, x*480, 0, 1, y*480) new_overlays += I - - overlays = new_overlays + add_overlay(new_overlays) view_sized = view /obj/screen/parallax_layer/layer_1 diff --git a/code/_onclick/hud/plane_master.dm b/code/_onclick/hud/plane_master.dm index eda44bda065..5ba5a734e13 100644 --- a/code/_onclick/hud/plane_master.dm +++ b/code/_onclick/hud/plane_master.dm @@ -11,7 +11,7 @@ backdrop.transform = matrix(200, 0, 0, 0, 200, 0) backdrop.layer = BACKGROUND_LAYER backdrop.blend_mode = BLEND_OVERLAY - overlays += backdrop + add_overlay(backdrop) ..() /obj/screen/plane_master/game_world diff --git a/code/controllers/subsystem/acid.dm b/code/controllers/subsystem/acid.dm index 254ca8003f5..853174a7814 100644 --- a/code/controllers/subsystem/acid.dm +++ b/code/controllers/subsystem/acid.dm @@ -34,8 +34,7 @@ var/datum/subsystem/acid/SSacid if(O.acid_level && O.acid_processing()) else - O.overlays -= acid_overlay - O.priority_overlays -= acid_overlay + O.cut_overlay(acid_overlay, TRUE) processing -= O if (MC_TICK_CHECK) diff --git a/code/controllers/subsystem/processing/overlays.dm b/code/controllers/subsystem/processing/overlays.dm new file mode 100644 index 00000000000..1408bd1c25e --- /dev/null +++ b/code/controllers/subsystem/processing/overlays.dm @@ -0,0 +1,182 @@ +var/datum/subsystem/processing/overlays/SSoverlays + +/datum/subsystem/processing/overlays + name = "Overlay" + flags = SS_TICKER|SS_FIRE_IN_LOBBY + wait = 1 + priority = 500 + init_order = -6 + + stat_tag = "Ov" + currentrun = null + var/list/overlay_icon_state_caches + var/initialized = FALSE + +/datum/subsystem/processing/overlays/New() + NEW_SS_GLOBAL(SSoverlays) + LAZYINITLIST(overlay_icon_state_caches) + +/datum/subsystem/processing/overlays/Initialize() + initialized = TRUE + for(var/I in processing) + var/atom/A = I + A.compile_overlays() + CHECK_TICK + ..() + +/datum/subsystem/processing/overlays/Recover() + overlay_icon_state_caches = SSoverlays.overlay_icon_state_caches + processing = SSoverlays.processing + +/datum/subsystem/processing/overlays/fire() + while(processing.len) + var/atom/thing = processing[processing.len] + processing.len-- + if(thing) + thing.compile_overlays(FALSE) + if(MC_TICK_CHECK) + break + +/atom/proc/compile_overlays() + if(LAZYLEN(priority_overlays) && LAZYLEN(our_overlays)) + overlays = our_overlays + priority_overlays + else if(LAZYLEN(our_overlays)) + overlays = our_overlays + else if(LAZYLEN(priority_overlays)) + overlays = priority_overlays + else + overlays.Cut() + flags &= ~OVERLAY_QUEUED + +/atom/proc/iconstate2appearance(iconstate) + var/static/image/stringbro = new() + var/list/icon_states_cache = SSoverlays.overlay_icon_state_caches + var/list/cached_icon = icon_states_cache[icon] + if (cached_icon) + var/cached_appearance = cached_icon["[iconstate]"] + if (cached_appearance) + return cached_appearance + stringbro.icon = icon + stringbro.icon_state = iconstate + if (!cached_icon) //not using the macro to save an associated lookup + cached_icon = list() + icon_states_cache[icon] = cached_icon + var/cached_appearance = stringbro.appearance + cached_icon["[iconstate]"] = cached_appearance + return cached_appearance + +#define NOT_QUEUED_ALREADY (!(flags & OVERLAY_QUEUED)) +#define QUEUE_FOR_COMPILE flags |= OVERLAY_QUEUED; SSoverlays.processing += src; +/atom/proc/cut_overlays(priority = FALSE) + var/list/cached_overlays = our_overlays + var/list/cached_priority = priority_overlays + + var/need_compile = FALSE + + if(LAZYLEN(cached_overlays)) //don't queue empty lists, don't cut priority overlays + cached_overlays.Cut() //clear regular overlays + need_compile = TRUE + + if(priority && LAZYLEN(cached_priority)) + cached_priority.Cut() + need_compile = TRUE + + if(NOT_QUEUED_ALREADY && need_compile) + QUEUE_FOR_COMPILE + +/atom/proc/cut_overlay(list/overlays, priority) + var/static/image/appearance_bro = new() + if(!overlays) + return + + if (!islist(overlays)) + overlays = list(overlays) + else + listclearnulls(overlays) + for (var/i in 1 to length(overlays)) + if (istext(overlays[i])) + overlays[i] = iconstate2appearance(overlays[i]) + else + var/image/I = overlays[i] + appearance_bro.appearance = overlays[i] + appearance_bro.dir = I.dir + overlays[i] = appearance_bro.appearance + + var/list/cached_overlays = our_overlays //sanic + var/list/cached_priority = priority_overlays + var/init_o_len = LAZYLEN(cached_overlays) + var/init_p_len = LAZYLEN(cached_priority) //starter pokemon + + LAZYREMOVE(cached_overlays, overlays) + if(priority) + LAZYREMOVE(cached_priority, overlays) + + if(NOT_QUEUED_ALREADY && ((init_o_len != LAZYLEN(cached_priority)) || (init_p_len != LAZYLEN(cached_overlays)))) + QUEUE_FOR_COMPILE + +/atom/proc/add_overlay(list/overlays, priority = FALSE) + var/static/image/appearance_bro = new() + if(!overlays) + return + + if (!islist(overlays)) + overlays = list(overlays) + else + listclearnulls(overlays) + for (var/i in 1 to length(overlays)) + if (istext(overlays[i])) + overlays[i] = iconstate2appearance(overlays[i]) + else + var/image/I = overlays[i] + appearance_bro.appearance = overlays[i] + appearance_bro.dir = I.dir + overlays[i] = appearance_bro.appearance + + LAZYINITLIST(our_overlays) //always initialized after this point + LAZYINITLIST(priority_overlays) + + var/list/cached_overlays = our_overlays //sanic + var/list/cached_priority = priority_overlays + var/init_o_len = cached_overlays.len + var/init_p_len = cached_priority.len //starter pokemon + var/need_compile + + if(priority) + cached_priority += overlays //or in the image. Can we use [image] = image? + need_compile = init_p_len != cached_priority.len + else + cached_overlays += overlays + need_compile = init_o_len != cached_overlays.len + + if(NOT_QUEUED_ALREADY && need_compile) //have we caught more pokemon? + QUEUE_FOR_COMPILE + +/atom/proc/copy_overlays(atom/other, cut_old = FALSE) //copys our_overlays from another atom + if(!other) + if(cut_old) + cut_overlays() + return + + var/list/cached_other = other.our_overlays + if(cached_other) + if(cut_old) + our_overlays = cached_other.Copy() + else + our_overlays |= cached_other + if(NOT_QUEUED_ALREADY) + QUEUE_FOR_COMPILE + else if(cut_old) + cut_overlays() + +#undef NOT_QUEUED_ALREADY +#undef QUEUE_FOR_COMPILE + +//TODO: Better solution for these? +/image/proc/add_overlay(x) + overlays += x + +/image/proc/cut_overlay(x) + overlays -= x + +/image/proc/cut_overlays(x) + overlays.Cut() \ No newline at end of file diff --git a/code/datums/action.dm b/code/datums/action.dm index 265de32b070..7c17b11fd45 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -113,7 +113,8 @@ img = image(icon_icon, current_button, button_icon_state) img.pixel_x = 0 img.pixel_y = 0 - current_button.overlays = list(img) + current_button.cut_overlays(TRUE) + current_button.add_overlay(img) current_button.button_icon_state = button_icon_state diff --git a/code/datums/status_effects/gas.dm b/code/datums/status_effects/gas.dm index c87b24ab358..1ed1848f1b4 100644 --- a/code/datums/status_effects/gas.dm +++ b/code/datums/status_effects/gas.dm @@ -14,7 +14,7 @@ if(!owner.stat) owner << "You become frozen in a cube!" cube = icon('icons/effects/freeze.dmi', "ice_cube") - owner.overlays += cube + owner.add_overlay(cube) owner.update_canmove() /datum/status_effect/freon/tick() @@ -25,6 +25,6 @@ /datum/status_effect/freon/on_remove() if(!owner.stat) owner << "The cube melts!" - owner.overlays -= cube + owner.cut_overlay(cube) owner.bodytemperature += 100 owner.update_canmove() diff --git a/code/game/atoms.dm b/code/game/atoms.dm index b8bcafe2ddd..07754b0866c 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -18,13 +18,12 @@ //Value used to increment ex_act() if reactionary_explosions is on var/explosion_block = 0 - //overlays that should remain on top and not normally be removed, like c4. - var/list/priority_overlays - var/list/atom_colours //used to store the different colors on an atom //its inherent color, the colored paint applied on it, special color effect etc... var/initialized = FALSE + var/list/our_overlays //our local copy of (non-priority) overlays without byond magic. Use procs in SSoverlays to manipulate + var/list/priority_overlays //overlays that should remain on top and not normally removed when using cut_overlay functions, like c4. /atom/New() //atom creation method that preloads variables at creation @@ -74,6 +73,11 @@ AA.hide(list(src)) if(reagents) qdel(reagents) + + LAZYCLEARLIST(overlays) + LAZYCLEARLIST(priority_overlays) + //SSoverlays.processing -= src //we COULD do this, but it's better to just let it fall out of the processing queue + return ..() /atom/proc/CanPass(atom/movable/mover, turf/target, height=1.5) diff --git a/code/game/gamemodes/blob/blobs/blob_mobs.dm b/code/game/gamemodes/blob/blobs/blob_mobs.dm index 4159cd7ba87..6075f2614d7 100644 --- a/code/game/gamemodes/blob/blobs/blob_mobs.dm +++ b/code/game/gamemodes/blob/blobs/blob_mobs.dm @@ -98,7 +98,7 @@ del_on_death = 1 deathmessage = "explodes into a cloud of gas!" var/death_cloud_size = 1 //size of cloud produced from a dying spore - var/list/human_overlays = list() + var/mob/living/carbon/human/oldguy var/is_zombie = 0 gold_core_spawnable = 1 @@ -136,9 +136,9 @@ icon_state = "zombie" H.hair_style = null H.update_hair() - human_overlays = H.overlays update_icons() H.forceMove(src) + oldguy = H visible_message("The corpse of [H.name] suddenly rises!") /mob/living/simple_animal/hostile/blob/blobspore/death(gibbed) @@ -167,9 +167,8 @@ if(factory) factory.spores -= src factory = null - if(contents) - for(var/mob/M in contents) - M.loc = src.loc + oldguy.forceMove(loc) + oldguy = null return ..() /mob/living/simple_animal/hostile/blob/blobspore/update_icons() @@ -178,8 +177,7 @@ else remove_atom_colour(FIXED_COLOUR_PRIORITY) if(is_zombie) - cut_overlays() - overlays = human_overlays + copy_overlays(oldguy, TRUE) var/image/I = image('icons/mob/blob.dmi', icon_state = "blob_head") if(overmind) I.color = overmind.blob_reagent_datum.complementary_color diff --git a/code/game/gamemodes/devil/true_devil/inventory.dm b/code/game/gamemodes/devil/true_devil/inventory.dm index a4af9484973..c474eaf1161 100644 --- a/code/game/gamemodes/devil/true_devil/inventory.dm +++ b/code/game/gamemodes/devil/true_devil/inventory.dm @@ -47,8 +47,9 @@ apply_overlay(DEVIL_HANDS_LAYER) /mob/living/carbon/true_devil/remove_overlay(cache_index) - if(devil_overlays[cache_index]) - overlays -= devil_overlays[cache_index] + var/I = devil_overlays[cache_index] + if(I) + cut_overlay(I) devil_overlays[cache_index] = null diff --git a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm index 91e4bcda519..3abbfc4c3bc 100644 --- a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm +++ b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm @@ -56,7 +56,7 @@ M.name_override = disguise.name M.icon = disguise.icon M.icon_state = disguise.icon_state - M.overlays = disguise.overlays + M.copy_overlays(disguise, TRUE) M.update_inv_hands() /obj/item/clothing/suit/armor/abductor/vest/proc/DeactivateStealth() diff --git a/code/game/gamemodes/miniantags/abduction/machinery/console.dm b/code/game/gamemodes/miniantags/abduction/machinery/console.dm index e7d830e8926..c4ee16d36fe 100644 --- a/code/game/gamemodes/miniantags/abduction/machinery/console.dm +++ b/code/game/gamemodes/miniantags/abduction/machinery/console.dm @@ -176,7 +176,7 @@ entry.name = target.name entry.icon = target.icon entry.icon_state = target.icon_state - entry.overlays = target.get_overlays_copy(list(HANDS_LAYER)) + entry.overlays = target.get_overlays_copy(list(HANDS_LAYER)) //ugh for(var/i=1,i<=disguises.len,i++) var/datum/icon_snapshot/temp = disguises[i] if(temp.name == entry.name) diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm index b66caf44027..24b837c7f27 100644 --- a/code/game/gamemodes/nuclear/nuclearbomb.dm +++ b/code/game/gamemodes/nuclear/nuclearbomb.dm @@ -196,7 +196,7 @@ var/bomb_set update_icon_lights() /obj/machinery/nuclearbomb/proc/update_icon_interior() - overlays -= interior + cut_overlay(interior) switch(deconstruction_state) if(NUKESTATE_UNSCREWED) interior = image(icon,"panel-unscrewed") @@ -213,7 +213,7 @@ var/bomb_set add_overlay(interior) /obj/machinery/nuclearbomb/proc/update_icon_lights() - overlays -= lights + cut_overlay(lights) switch(get_nuke_state()) if(NUKE_OFF_LOCKED) lights = null diff --git a/code/game/machinery/announcement_system.dm b/code/game/machinery/announcement_system.dm index 7b37661a427..3e8bfa1cc5a 100644 --- a/code/game/machinery/announcement_system.dm +++ b/code/game/machinery/announcement_system.dm @@ -53,18 +53,12 @@ var/list/announcement_systems = list() cut_overlays() if(arrivalToggle) add_overlay(greenlight) - else - overlays -= greenlight if(newheadToggle) add_overlay(pinklight) - else - overlays -= pinklight if(stat & BROKEN) add_overlay(errorlight) - else - overlays -= errorlight /obj/machinery/announcement_system/Destroy() qdel(radio) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index b2e45588333..0886c0a6fd8 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -81,14 +81,6 @@ var/list/airlock_overlays = list() var/airlock_material = null //material of inner filling; if its an airlock with glass, this should be set to "glass" var/overlays_file = 'icons/obj/doors/airlocks/station/overlays.dmi' - var/image/old_frame_overlay //keep those in order to prevent unnecessary updating - var/image/old_filling_overlay - var/image/old_lights_overlay - var/image/old_panel_overlay - var/image/old_weld_overlay - var/image/old_sparks_overlay - var/image/old_dam_overlay - var/cyclelinkeddir = 0 var/obj/machinery/door/airlock/cyclelinkedairlock var/shuttledocked = 0 @@ -452,35 +444,14 @@ var/list/airlock_overlays = list() else panel_overlay = get_airlock_overlay("panel_opening", overlays_file) - //doesn't use cut_overlays() for performance reasons - if(frame_overlay != old_frame_overlay) - overlays -= old_frame_overlay - add_overlay(frame_overlay) - old_frame_overlay = frame_overlay - if(filling_overlay != old_filling_overlay) - overlays -= old_filling_overlay - add_overlay(filling_overlay) - old_filling_overlay = filling_overlay - if(lights_overlay != old_lights_overlay) - overlays -= old_lights_overlay - add_overlay(lights_overlay) - old_lights_overlay = lights_overlay - if(panel_overlay != old_panel_overlay) - overlays -= old_panel_overlay - add_overlay(panel_overlay) - old_panel_overlay = panel_overlay - if(weld_overlay != old_weld_overlay) - overlays -= old_weld_overlay - add_overlay(weld_overlay) - old_weld_overlay = weld_overlay - if(sparks_overlay != old_sparks_overlay) - overlays -= old_sparks_overlay - add_overlay(sparks_overlay) - old_sparks_overlay = sparks_overlay - if(damag_overlay != old_dam_overlay) - overlays -= old_dam_overlay - add_overlay(damag_overlay) - old_dam_overlay = damag_overlay + cut_overlays() + add_overlay(frame_overlay) + add_overlay(filling_overlay) + add_overlay(lights_overlay) + add_overlay(panel_overlay) + add_overlay(weld_overlay) + add_overlay(sparks_overlay) + add_overlay(damag_overlay) /proc/get_airlock_overlay(icon_state, icon_file) var/iconkey = "[icon_state][icon_file]" diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index d0ebad0d3c5..1df559b7496 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -24,7 +24,7 @@ else icon_state = "donateidle" - overlays = null + cut_overlays() if(beaker) if(attached) diff --git a/code/game/machinery/robot_fabricator.dm b/code/game/machinery/robot_fabricator.dm index 47f7fe8a043..a967aa9168d 100644 --- a/code/game/machinery/robot_fabricator.dm +++ b/code/game/machinery/robot_fabricator.dm @@ -29,7 +29,7 @@ qdel(O) user << "You insert [count] metal sheet\s into \the [src]." - src.overlays -= "fab-load-metal" + cut_overlay("fab-load-metal") updateDialog() else user << "\The [src] is full." @@ -143,7 +143,7 @@ Please wait until completion...
src.being_built = null src.use_power = 1 src.operating = 0 - src.overlays -= "fab-active" + cut_overlay("fab-active") return updateUsrDialog() diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 6f79d7ba09d..9255f6651de 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -153,8 +153,7 @@ maptext = new_text /obj/machinery/status_display/proc/remove_display() - if(overlays.len) - cut_overlays() + cut_overlays() if(maptext) maptext = "" @@ -277,8 +276,7 @@ /obj/machinery/ai_status_display/proc/set_picture(state) picture_state = state - if(overlays.len) - cut_overlays() + cut_overlays() add_overlay(image('icons/obj/status_display.dmi', icon_state=picture_state)) #undef CHARS_PER_LINE diff --git a/code/game/mecha/equipment/tools/other_tools.dm b/code/game/mecha/equipment/tools/other_tools.dm index b0bc320624f..c182d9dceb1 100644 --- a/code/game/mecha/equipment/tools/other_tools.dm +++ b/code/game/mecha/equipment/tools/other_tools.dm @@ -198,7 +198,7 @@ /obj/item/mecha_parts/mecha_equipment/repair_droid/Destroy() STOP_PROCESSING(SSobj, src) if(chassis) - chassis.overlays -= droid_overlay + chassis.cut_overlay(droid_overlay) return ..() /obj/item/mecha_parts/mecha_equipment/repair_droid/attach(obj/mecha/M as obj) @@ -207,7 +207,7 @@ M.add_overlay(droid_overlay) /obj/item/mecha_parts/mecha_equipment/repair_droid/detach() - chassis.overlays -= droid_overlay + chassis.cut_overlay(droid_overlay) STOP_PROCESSING(SSobj, src) ..() @@ -219,7 +219,7 @@ /obj/item/mecha_parts/mecha_equipment/repair_droid/Topic(href, href_list) ..() if(href_list["toggle_repairs"]) - chassis.overlays -= droid_overlay + chassis.cut_overlay(droid_overlay) if(equip_ready) START_PROCESSING(SSobj, src) droid_overlay = new(src.icon, icon_state = "repair_droid_a") @@ -259,7 +259,7 @@ else //no repair needed, we turn off STOP_PROCESSING(SSobj, src) set_ready_state(1) - chassis.overlays -= droid_overlay + chassis.cut_overlay(droid_overlay) droid_overlay = new(src.icon, icon_state = "repair_droid") chassis.add_overlay(droid_overlay) diff --git a/code/game/mecha/mech_fabricator.dm b/code/game/mecha/mech_fabricator.dm index 2bee06e9b38..e767038b17e 100644 --- a/code/game/mecha/mech_fabricator.dm +++ b/code/game/mecha/mech_fabricator.dm @@ -160,7 +160,7 @@ updateUsrDialog() sleep(get_construction_time_w_coeff(D)) use_power = 1 - overlays -= "fab-active" + cut_overlay("fab-active") desc = initial(desc) var/location = get_step(src,(dir)) @@ -457,7 +457,7 @@ var/mat_overlay = "fab-load-[material2name(W.materials[1])]" add_overlay(mat_overlay) sleep(10) - overlays -= mat_overlay //No matter what the overlay shall still be deleted + cut_overlay(mat_overlay) //No matter what the overlay shall still be deleted updateUsrDialog() diff --git a/code/game/mecha/mecha_construction_paths.dm b/code/game/mecha/mecha_construction_paths.dm index 4a0e3012492..90c7716b622 100644 --- a/code/game/mecha/mecha_construction_paths.dm +++ b/code/game/mecha/mecha_construction_paths.dm @@ -96,7 +96,7 @@ const_holder.icon = 'icons/mecha/mech_construction.dmi' const_holder.icon_state = "ripley0" const_holder.density = 1 - const_holder.overlays.len = 0 + const_holder.cut_overlays(TRUE) qdel(src) return diff --git a/code/game/mecha/working/ripley.dm b/code/game/mecha/working/ripley.dm index a58ed11afea..1b599421093 100644 --- a/code/game/mecha/working/ripley.dm +++ b/code/game/mecha/working/ripley.dm @@ -46,7 +46,7 @@ /obj/mecha/working/ripley/update_icon() ..() if (hides) - overlays = null + cut_overlays() if(hides < 3) add_overlay(image("icon" = "mecha.dmi", "icon_state" = occupant ? "ripley-g" : "ripley-g-open")) else diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 4a99a78723c..567a1ce96cd 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -492,7 +492,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s var/index = blood_splatter_index() var/icon/blood_splatter_icon = blood_splatter_icons[index] if(blood_splatter_icon) - overlays -= blood_splatter_icon + cut_overlay(blood_splatter_icon) /obj/item/clothing/gloves/clean_blood() . = ..() diff --git a/code/game/objects/items/devices/megaphone.dm b/code/game/objects/items/devices/megaphone.dm index 6fb6401106b..2f77861a6a4 100644 --- a/code/game/objects/items/devices/megaphone.dm +++ b/code/game/objects/items/devices/megaphone.dm @@ -4,7 +4,6 @@ icon_state = "megaphone" item_state = "radio" w_class = WEIGHT_CLASS_SMALL - flags = FPRINT siemens_coefficient = 1 var/spamcheck = 0 var/emagged = 0 diff --git a/code/game/objects/items/devices/taperecorder.dm b/code/game/objects/items/devices/taperecorder.dm index 379a1341537..7dea9c63529 100644 --- a/code/game/objects/items/devices/taperecorder.dm +++ b/code/game/objects/items/devices/taperecorder.dm @@ -267,7 +267,7 @@ /obj/item/device/tape/proc/fix() - overlays -= "ribbonoverlay" + cut_overlay("ribbonoverlay") ruined = 0 diff --git a/code/game/objects/items/weapons/explosives.dm b/code/game/objects/items/weapons/explosives.dm index 507962ebfca..7b9ea2a30f3 100644 --- a/code/game/objects/items/weapons/explosives.dm +++ b/code/game/objects/items/weapons/explosives.dm @@ -103,8 +103,7 @@ if(target) if(!QDELETED(target)) location = get_turf(target) - target.overlays -= image_overlay - target.priority_overlays -= image_overlay + target.cut_overlay(image_overlay, TRUE) else location = get_turf(src) if(location) diff --git a/code/game/objects/items/weapons/grenades/ghettobomb.dm b/code/game/objects/items/weapons/grenades/ghettobomb.dm index 4ccd31be24f..945cf03d166 100644 --- a/code/game/objects/items/weapons/grenades/ghettobomb.dm +++ b/code/game/objects/items/weapons/grenades/ghettobomb.dm @@ -47,7 +47,7 @@ if(clown_check(user)) user << "You light the [name]!" active = 1 - overlays -= image('icons/obj/grenade.dmi', icon_state = "improvised_grenade_filled") + cut_overlay(image('icons/obj/grenade.dmi', icon_state = "improvised_grenade_filled"), TRUE) //this line make no sense icon_state = initial(icon_state) + "_active" add_fingerprint(user) var/turf/bombturf = get_turf(src) diff --git a/code/game/objects/items/weapons/grenades/plastic.dm b/code/game/objects/items/weapons/grenades/plastic.dm index eecbaa88d2a..7c186f3126b 100644 --- a/code/game/objects/items/weapons/grenades/plastic.dm +++ b/code/game/objects/items/weapons/grenades/plastic.dm @@ -130,8 +130,7 @@ if(target) if(!QDELETED(target)) location = get_turf(target) - target.overlays -= image_overlay - target.priority_overlays -= image_overlay + target.cut_overlay(image_overlay, TRUE) else location = get_turf(src) if(location) @@ -158,8 +157,7 @@ if(target) if(!QDELETED(target)) location = get_turf(target) - target.overlays -= image_overlay - target.priority_overlays -= image_overlay + target.cut_overlay(image_overlay, TRUE) else location = get_turf(src) if(location) diff --git a/code/game/objects/items/weapons/storage/secure.dm b/code/game/objects/items/weapons/storage/secure.dm index c4b5ee1a799..4be269b4712 100644 --- a/code/game/objects/items/weapons/storage/secure.dm +++ b/code/game/objects/items/weapons/storage/secure.dm @@ -93,7 +93,7 @@ src.l_set = 1 else if ((src.code == src.l_code) && (src.l_set == 1)) src.locked = 0 - src.overlays = null + cut_overlays() add_overlay(image('icons/obj/storage.dmi', icon_opened)) src.code = null else @@ -101,7 +101,7 @@ else if ((href_list["type"] == "R") && (!src.l_setshort)) src.locked = 1 - src.overlays = null + cut_overlays() src.code = null src.close(usr) else diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm index 272571563f7..a4928474346 100644 --- a/code/game/objects/obj_defense.dm +++ b/code/game/objects/obj_defense.dm @@ -156,7 +156,7 @@ var/global/image/acid_overlay = image("icon" = 'icons/effects/effects.dmi', "ico if(!acid_level) SSacid.processing[src] = src - add_overlay(acid_overlay, 1) + add_overlay(acid_overlay, TRUE) var/acid_cap = acidpwr * 300 //so we cannot use huge amounts of weak acids to do as well as strong acids. if(acid_level < acid_cap) acid_level = min(acid_level + acidpwr * acid_volume, acid_cap) @@ -194,7 +194,7 @@ var/global/image/acid_overlay = image("icon" = 'icons/effects/effects.dmi', "ico if(!(resistance_flags & ON_FIRE) && (resistance_flags & FLAMMABLE)) resistance_flags |= ON_FIRE SSfire_burning.processing[src] = src - add_overlay(fire_overlay) + add_overlay(fire_overlay, TRUE) return 1 //called when the obj is destroyed by fire @@ -206,7 +206,7 @@ var/global/image/acid_overlay = image("icon" = 'icons/effects/effects.dmi', "ico /obj/proc/extinguish() if(resistance_flags & ON_FIRE) resistance_flags &= ~ON_FIRE - overlays -= fire_overlay + cut_overlay(fire_overlay) SSfire_burning.processing -= src diff --git a/code/game/objects/structures/beds_chairs/alien_nest.dm b/code/game/objects/structures/beds_chairs/alien_nest.dm index 0b768660c2d..3010919048d 100644 --- a/code/game/objects/structures/beds_chairs/alien_nest.dm +++ b/code/game/objects/structures/beds_chairs/alien_nest.dm @@ -80,7 +80,7 @@ M.pixel_x = M.get_standard_pixel_x_offset(M.lying) M.pixel_y = M.get_standard_pixel_y_offset(M.lying) M.layer = initial(M.layer) - overlays -= nest_overlay + cut_overlay(nest_overlay) /obj/structure/bed/nest/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0) switch(damage_type) diff --git a/code/game/objects/structures/beds_chairs/chair.dm b/code/game/objects/structures/beds_chairs/chair.dm index 778a78525d6..7d16603cf16 100644 --- a/code/game/objects/structures/beds_chairs/chair.dm +++ b/code/game/objects/structures/beds_chairs/chair.dm @@ -146,7 +146,7 @@ if(has_buckled_mobs()) add_overlay(armrest) else - overlays -= armrest + cut_overlay(armrest) /obj/structure/chair/comfy/brown diff --git a/code/game/objects/structures/crates_lockers/closets/statue.dm b/code/game/objects/structures/crates_lockers/closets/statue.dm index 99f271bb251..0b7859691a5 100644 --- a/code/game/objects/structures/crates_lockers/closets/statue.dm +++ b/code/game/objects/structures/crates_lockers/closets/statue.dm @@ -84,7 +84,7 @@ bleedsuppress = 1 S.icon = icon S.icon_state = icon_state - S.overlays = overlays + S.copy_overlays(overlays) var/newcolor = list(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0)) S.add_atom_colour(newcolor, FIXED_COLOUR_PRIORITY) return 1 diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 7ea8a5ceaf6..508f7e881b3 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -345,7 +345,7 @@ if(smooth) queue_smooth(src) - overlays -= crack_overlay + cut_overlay(crack_overlay) if(ratio > 75) return crack_overlay = image('icons/obj/structures.dmi',"damage[ratio]",-(layer+0.1)) diff --git a/code/game/turfs/open.dm b/code/game/turfs/open.dm index c30df6d1e05..795acbc7c16 100644 --- a/code/game/turfs/open.dm +++ b/code/game/turfs/open.dm @@ -186,7 +186,7 @@ wet = wet_setting if(wet_setting != TURF_DRY) if(wet_overlay) - overlays -= wet_overlay + cut_overlay(wet_overlay) wet_overlay = null var/turf/open/floor/F = src if(istype(F)) @@ -212,7 +212,7 @@ else wet = TURF_DRY if(wet_overlay) - overlays -= wet_overlay + cut_overlay(wet_overlay) /turf/open/proc/HandleWet() if(!wet) diff --git a/code/game/turfs/simulated/minerals.dm b/code/game/turfs/simulated/minerals.dm index 0883c19491a..175564a72d8 100644 --- a/code/game/turfs/simulated/minerals.dm +++ b/code/game/turfs/simulated/minerals.dm @@ -436,7 +436,7 @@ /turf/closed/mineral/gibtonite/proc/defuse() if(stage == 1) - overlays -= activated_image + cut_overlay(activated_image) var/image/I = image('icons/turf/smoothrocks.dmi', loc = src, icon_state = "rock_Gibtonite_inactive", layer = ON_EDGED_TURF_LAYER) add_overlay(I) desc = "An inactive gibtonite reserve. The ore can be extracted." diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 674b7342b4f..ff071b0599c 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -206,7 +206,7 @@ /turf/closed/wall/proc/thermitemelt(mob/user) - overlays = list() + cut_overlays() var/obj/effect/overlay/O = new/obj/effect/overlay( src ) O.name = "thermite" O.desc = "Looks hot." diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 2a94057aa65..dbceade8d21 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -457,5 +457,5 @@ /turf/proc/remove_decal(group) LAZYINITLIST(decals) - overlays -= decals[group] - decals[group] = null + cut_overlay(decals[group]) + decals[group] = null \ No newline at end of file diff --git a/code/modules/assembly/bomb.dm b/code/modules/assembly/bomb.dm index f5ce8bb9b88..1017b5af82a 100644 --- a/code/modules/assembly/bomb.dm +++ b/code/modules/assembly/bomb.dm @@ -21,7 +21,7 @@ icon_state = bombtank.icon_state if(bombassembly) add_overlay(bombassembly.icon_state) - add_overlay(bombassembly.overlays) + copy_overlays(bombassembly) add_overlay("bomb_assembly") /obj/item/device/onetankbomb/attackby(obj/item/weapon/W, mob/user, params) diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm index 47fa5299128..62169c40abd 100644 --- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm +++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm @@ -100,7 +100,7 @@ if (atmos_overlay_types) for(var/overlay in atmos_overlay_types-new_overlay_types) //doesn't remove overlays that would only be added - overlays -= overlay + cut_overlay(overlay) if (new_overlay_types.len) if (atmos_overlay_types) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 052ef5ac029..a272db541ef 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -155,8 +155,7 @@ var/list/damaged_clothes_icons = list() add_overlay(damaged_clothes_icon, 1) else damaged_clothes = 0 - overlays -= damaged_clothes_icons[index] - priority_overlays -= damaged_clothes_icons[index] + cut_overlay(damaged_clothes_icons[index], TRUE) //Ears: currently only used for headsets and earmuffs diff --git a/code/modules/clothing/suits/miscellaneous.dm b/code/modules/clothing/suits/miscellaneous.dm index 40945dd8478..00785ad35c4 100644 --- a/code/modules/clothing/suits/miscellaneous.dm +++ b/code/modules/clothing/suits/miscellaneous.dm @@ -178,7 +178,7 @@ if(istype(borghead, /obj/item/clothing/head/cardborg)) //why is this done this way? because equipped() is called BEFORE THE ITEM IS IN THE SLOT WHYYYY var/image/I = image(icon = 'icons/mob/robots.dmi' , icon_state = "robot", loc = H) I.override = 1 - I.overlays += image(icon = 'icons/mob/robots.dmi' , icon_state = "robot_e") //gotta look realistic + I.add_overlay(image(icon = 'icons/mob/robots.dmi' , icon_state = "robot_e")) //gotta look realistic H.add_alt_appearance("standard_borg_disguise", I, silicon_mobs+H) //you look like a robot to robots! (including yourself because you're totally a robot) diff --git a/code/modules/food_and_drinks/drinks/drinks/bottle.dm b/code/modules/food_and_drinks/drinks/drinks/bottle.dm index d8b2a50e3ec..baafb8fdb1b 100644 --- a/code/modules/food_and_drinks/drinks/drinks/bottle.dm +++ b/code/modules/food_and_drinks/drinks/drinks/bottle.dm @@ -399,5 +399,5 @@ user << "The flame's spread too far on it!" return user << "You snuff out the flame on [src]." - overlays -= fire_overlay + cut_overlay(fire_overlay) active = 0 diff --git a/code/modules/food_and_drinks/food/customizables.dm b/code/modules/food_and_drinks/food/customizables.dm index 492a95831be..e5f3d99bd0d 100644 --- a/code/modules/food_and_drinks/food/customizables.dm +++ b/code/modules/food_and_drinks/food/customizables.dm @@ -117,7 +117,9 @@ if(INGREDIENTS_STACKPLUSTOP) I.pixel_x = rand(-1,1) I.pixel_y = 2 * ingredients.len - 1 - overlays.Cut(ingredients.len) + our_overlays.Cut(ingredients.len) //??? + //force an update here just in case + SSoverlays.processing[src] = src var/image/TOP = new(icon, "[icon_state]_top") TOP.pixel_y = 2 * ingredients.len + 3 add_overlay(I) diff --git a/code/modules/food_and_drinks/food/snacks_other.dm b/code/modules/food_and_drinks/food/snacks_other.dm index 2da567e1504..b9cfedccf7f 100644 --- a/code/modules/food_and_drinks/food/snacks_other.dm +++ b/code/modules/food_and_drinks/food/snacks_other.dm @@ -354,8 +354,7 @@ /obj/item/weapon/reagent_containers/food/snacks/lollipop/proc/change_head_color(C) headcolor = C - if(head in overlays) - overlays -= head + cut_overlay(head) head.color = C add_overlay(head) diff --git a/code/modules/games/cards.dm b/code/modules/games/cards.dm index cdd4b669c01..db502b751ca 100644 --- a/code/modules/games/cards.dm +++ b/code/modules/games/cards.dm @@ -230,7 +230,7 @@ name = "a playing card" desc = "A playing card." - overlays.len = 0 + cut_overlays() if (cards.len == 1) var/datum/playingcard/P = cards[1] @@ -239,7 +239,7 @@ I.pixel_x = I.pixel_x + (-5 + rand(10)) I.pixel_y = I.pixel_y + (-5 + rand(10)) - overlays.Add(I) + add_overlay(I) else var/origin = -12 var/offset = round(32 / cards.len) @@ -251,7 +251,7 @@ I = new(src.icon, (concealed ? "card_back" : "[P.card_icon]") ) I.pixel_x = origin + (offset * i) - overlays.Add(I) + add_overlay(I) i = i + 1 diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 92c3a67bb26..6dee21aaced 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -259,7 +259,7 @@ if(istype(src, /obj/machinery/hydroponics/soil)) add_atom_colour(rgb(255, 175, 0), FIXED_COLOUR_PRIORITY) else - overlays += image('icons/obj/hydroponics/equipment.dmi', icon_state = "gaia_blessing") + add_overlay(image('icons/obj/hydroponics/equipment.dmi', icon_state = "gaia_blessing")) SetLuminosity(3) update_icon_hoses() diff --git a/code/modules/mining/fulton.dm b/code/modules/mining/fulton.dm index 3073c3bd085..2ea3d74d506 100644 --- a/code/modules/mining/fulton.dm +++ b/code/modules/mining/fulton.dm @@ -84,13 +84,13 @@ var/list/total_extraction_beacons = list() balloon2 = image('icons/obj/fulton_balloon.dmi',"fulton_expand") balloon2.pixel_y = 10 balloon2.appearance_flags = RESET_COLOR | RESET_ALPHA | RESET_TRANSFORM - holder_obj.overlays += balloon2 + holder_obj.add_overlay(balloon2) sleep(4) balloon = image('icons/obj/fulton_balloon.dmi',"fulton_balloon") balloon.pixel_y = 10 balloon.appearance_flags = RESET_COLOR | RESET_ALPHA | RESET_TRANSFORM - holder_obj.overlays -= balloon2 - holder_obj.overlays += balloon + holder_obj.cut_overlay(balloon2) + holder_obj.add_overlay(balloon) playsound(holder_obj.loc, 'sound/items/fulext_deploy.wav', 50, 1, -3) animate(holder_obj, pixel_z = 10, time = 20) sleep(20) @@ -123,10 +123,10 @@ var/list/total_extraction_beacons = list() balloon3 = image('icons/obj/fulton_balloon.dmi',"fulton_retract") balloon3.pixel_y = 10 balloon3.appearance_flags = RESET_COLOR | RESET_ALPHA | RESET_TRANSFORM - holder_obj.overlays -= balloon - holder_obj.overlays += balloon3 + holder_obj.cut_overlay(balloon) + holder_obj.add_overlay(balloon3) sleep(4) - holder_obj.overlays -= balloon3 + holder_obj.cut_overlay(balloon3) A.anchored = 0 // An item has to be unanchored to be extracted in the first place. A.density = initial(A.density) animate(holder_obj, pixel_z = 0, time = 5) diff --git a/code/modules/mining/lavaland/ruins/gym.dm b/code/modules/mining/lavaland/ruins/gym.dm index 3c8832ffee6..21ccb9344ca 100644 --- a/code/modules/mining/lavaland/ruins/gym.dm +++ b/code/modules/mining/lavaland/ruins/gym.dm @@ -93,5 +93,5 @@ animate(user, pixel_y = 0, time = 3) var/finishmessage = pick("You feel stronger!","You feel like you can take on the world!","You feel robust!","You feel indestructible!") icon_state = "fitnessweight" - overlays -= W + cut_overlay(W) user << "[finishmessage]" \ No newline at end of file diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 9bf2fa06ac3..ecb7afba91e 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -158,13 +158,13 @@ var/list/image/ghost_images_simple = list() //this is a list of all ghost images ghost_others = client.prefs.ghost_others if(hair_image) - overlays -= hair_image - ghostimage.overlays -= hair_image + cut_overlay(hair_image) + ghostimage.add_overlay(hair_image) hair_image = null if(facial_hair_image) - overlays -= facial_hair_image - ghostimage.overlays -= facial_hair_image + cut_overlay(facial_hair_image) + ghostimage.add_overlay(facial_hair_image) facial_hair_image = null @@ -192,7 +192,7 @@ var/list/image/ghost_images_simple = list() //this is a list of all ghost images facial_hair_image.color = "#" + facial_hair_color facial_hair_image.alpha = 200 add_overlay(facial_hair_image) - ghostimage.overlays += facial_hair_image + ghostimage.add_overlay(facial_hair_image) if(hair_style) S = hair_styles_list[hair_style] if(S) @@ -201,7 +201,7 @@ var/list/image/ghost_images_simple = list() //this is a list of all ghost images hair_image.color = "#" + hair_color hair_image.alpha = 200 add_overlay(hair_image) - ghostimage.overlays += hair_image + ghostimage.add_overlay(hair_image) /* * Increase the brightness of a color by calculating the average distance between the R, G and B values, diff --git a/code/modules/mob/living/blood.dm b/code/modules/mob/living/blood.dm index 4a0e072a06f..5a3a53768e1 100644 --- a/code/modules/mob/living/blood.dm +++ b/code/modules/mob/living/blood.dm @@ -238,7 +238,7 @@ if(drop) if(drop.drips < 3) drop.drips++ - drop.overlays |= pick(drop.random_icon_states) + drop.add_overlay(pick(drop.random_icon_states)) drop.transfer_mob_blood_dna(src) return else diff --git a/code/modules/mob/living/carbon/alien/larva/update_icons.dm b/code/modules/mob/living/carbon/alien/larva/update_icons.dm index d386f5577d3..7d41c87dfe7 100644 --- a/code/modules/mob/living/carbon/alien/larva/update_icons.dm +++ b/code/modules/mob/living/carbon/alien/larva/update_icons.dm @@ -1,6 +1,6 @@ /mob/living/carbon/alien/larva/regenerate_icons() - overlays = list() + cut_overlays() update_icons() /mob/living/carbon/alien/larva/update_icons() diff --git a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm index b0601df5c5f..d95ab3cfb65 100644 --- a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm +++ b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm @@ -102,7 +102,7 @@ var/const/ALIEN_AFK_BRACKET = 450 // 45 seconds owner.gib(TRUE) else owner.adjustBruteLoss(40) - owner.overlays -= overlay + owner.cut_overlay(overlay) qdel(src) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 9ebefb9dc9b..a5e64dcde8f 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -720,8 +720,8 @@ /mob/living/carbon/human/wash_cream() //clean both to prevent a rare bug - overlays -=image('icons/effects/creampie.dmi', "creampie_lizard") - overlays -=image('icons/effects/creampie.dmi', "creampie_human") + cut_overlay(image('icons/effects/creampie.dmi', "creampie_lizard")) + cut_overlay(image('icons/effects/creampie.dmi', "creampie_human")) //Turns a mob black, flashes a skeleton overlay @@ -740,7 +740,7 @@ /mob/living/carbon/human/proc/end_electrocution_animation(image/I) remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, "#000000") - overlays -= I + cut_overlay(I) /mob/living/carbon/human/canUseTopic(atom/movable/M, be_close = 0) if(incapacitated() || lying ) diff --git a/code/modules/mob/living/carbon/update_icons.dm b/code/modules/mob/living/carbon/update_icons.dm index 9db868c0f85..6247dc2d5e9 100644 --- a/code/modules/mob/living/carbon/update_icons.dm +++ b/code/modules/mob/living/carbon/update_icons.dm @@ -30,13 +30,14 @@ var/list/overlays_standing[TOTAL_LAYERS] /mob/living/carbon/proc/apply_overlay(cache_index) - var/image/I = overlays_standing[cache_index] + var/I = overlays_standing[cache_index] if(I) add_overlay(I) /mob/living/carbon/proc/remove_overlay(cache_index) - if(overlays_standing[cache_index]) - overlays -= overlays_standing[cache_index] + var/I = overlays_standing[cache_index] + if(I) + cut_overlay(I) overlays_standing[cache_index] = null /mob/living/carbon/regenerate_icons() @@ -106,9 +107,9 @@ var/obj/item/bodypart/BP = X if(BP.dmg_overlay_type) if(BP.brutestate) - standing.overlays += "[BP.dmg_overlay_type]_[BP.body_zone]_[BP.brutestate]0" //we're adding icon_states of the base image as overlays + standing.add_overlay("[BP.dmg_overlay_type]_[BP.body_zone]_[BP.brutestate]0") //we're adding icon_states of the base image as overlays if(BP.burnstate) - standing.overlays += "[BP.dmg_overlay_type]_[BP.body_zone]_0[BP.burnstate]" + standing.add_overlay("[BP.dmg_overlay_type]_[BP.body_zone]_0[BP.burnstate]") apply_overlay(DAMAGE_LAYER) diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index d0350a7a267..2fd831fd1e3 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -102,9 +102,11 @@ return /mob/living/silicon/robot/update_fire() - overlays -= image("icon"='icons/mob/OnFire.dmi', "icon_state"="Generic_mob_burning") + var/I = image("icon"='icons/mob/OnFire.dmi', "icon_state"="Generic_mob_burning") if(on_fire) - add_overlay(image("icon"='icons/mob/OnFire.dmi', "icon_state"="Generic_mob_burning")) + add_overlay(I) + else + cut_overlay(I) /mob/living/silicon/robot/update_canmove() if(stat || buckled || lockcharge) diff --git a/code/modules/mob/living/simple_animal/bot/construction.dm b/code/modules/mob/living/simple_animal/bot/construction.dm index 98f055c476e..b3dc771ef11 100644 --- a/code/modules/mob/living/simple_animal/bot/construction.dm +++ b/code/modules/mob/living/simple_animal/bot/construction.dm @@ -393,7 +393,7 @@ var/obj/item/weapon/weldingtool/WT = I if(WT.remove_fuel(0, user)) build_step-- - overlays -= "hs_hole" + cut_overlay("hs_hole") user << "You weld the hole in [src] shut!" else if(isprox(I) && (build_step == 1)) @@ -442,13 +442,13 @@ qdel(src) else if(build_step == 2) - overlays -= "hs_eye" + cut_overlay("hs_eye") new /obj/item/device/assembly/prox_sensor(get_turf(src)) user << "You detach the proximity sensor from [src]." build_step-- else if(build_step == 3) - overlays -= "hs_arm" + cut_overlay("hs_arm") new /obj/item/bodypart/l_arm/robot(get_turf(src)) user << "You remove the robot arm from [src]." build_step-- diff --git a/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm b/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm index 95c18b53f40..5d634d938ea 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/visuals_icons.dm @@ -7,14 +7,15 @@ /mob/living/simple_animal/drone/proc/apply_overlay(cache_index) - var/image/I = drone_overlays[cache_index] + var/I = drone_overlays[cache_index] if(I) add_overlay(I) /mob/living/simple_animal/drone/proc/remove_overlay(cache_index) - if(drone_overlays[cache_index]) - overlays -= drone_overlays[cache_index] + var/I = drone_overlays[cache_index] + if(I) + cut_overlay(I) drone_overlays[cache_index] = null diff --git a/code/modules/mob/living/simple_animal/guardian/guardian.dm b/code/modules/mob/living/simple_animal/guardian/guardian.dm index af3001c2ecf..aafdf9c3364 100644 --- a/code/modules/mob/living/simple_animal/guardian/guardian.dm +++ b/code/modules/mob/living/simple_animal/guardian/guardian.dm @@ -261,13 +261,14 @@ var/global/list/parasites = list() //all currently existing/living guardians I.plane = ABOVE_HUD_PLANE /mob/living/simple_animal/hostile/guardian/proc/apply_overlay(cache_index) - var/image/I = guardian_overlays[cache_index] + var/I = guardian_overlays[cache_index] if(I) add_overlay(I) /mob/living/simple_animal/hostile/guardian/proc/remove_overlay(cache_index) - if(guardian_overlays[cache_index]) - overlays -= guardian_overlays[cache_index] + var/I = guardian_overlays[cache_index] + if(I) + cut_overlay(I) guardian_overlays[cache_index] = null /mob/living/simple_animal/hostile/guardian/update_inv_hands() diff --git a/code/modules/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm index d144a04b098..374e0d62c05 100644 --- a/code/modules/mob/living/simple_animal/hostile/mimic.dm +++ b/code/modules/mob/living/simple_animal/hostile/mimic.dm @@ -149,7 +149,7 @@ var/global/list/protected_objects = list(/obj/structure/table, /obj/structure/ca icon = O.icon icon_state = O.icon_state icon_living = icon_state - overlays = O.overlays + copy_overlays(O) googly_eyes = image('icons/mob/mob.dmi',"googly_eyes") add_overlay(googly_eyes) if(istype(O, /obj/structure) || istype(O, /obj/machinery)) diff --git a/code/modules/mob/living/simple_animal/slime/death.dm b/code/modules/mob/living/simple_animal/slime/death.dm index bdf63f66a1c..0e5e0750ca7 100644 --- a/code/modules/mob/living/simple_animal/slime/death.dm +++ b/code/modules/mob/living/simple_animal/slime/death.dm @@ -22,7 +22,7 @@ Feedstop(silent = 1) //releases ourselves from the mob we fed on. stat = DEAD - overlays.len = 0 + cut_overlays() update_canmove() diff --git a/code/modules/modular_computers/computers/machinery/modular_computer.dm b/code/modules/modular_computers/computers/machinery/modular_computer.dm index 5f469d0f024..388f351c4d1 100644 --- a/code/modules/modular_computers/computers/machinery/modular_computer.dm +++ b/code/modules/modular_computers/computers/machinery/modular_computer.dm @@ -64,7 +64,7 @@ var/list/global_modular_computers = list() if(cpu.active_program) add_overlay(cpu.active_program.program_icon_state ? cpu.active_program.program_icon_state : screen_icon_state_menu) else - overlays.Add(screen_icon_state_menu) + add_overlay(screen_icon_state_menu) if(cpu && cpu.obj_integrity <= cpu.integrity_failure) add_overlay("bsod") diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index c99a2bc2f9a..4a8e3b73a21 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -529,9 +529,9 @@ ..() /obj/item/weapon/picture_frame/update_icon() - overlays.Cut() + cut_overlays() if(displayed) - overlays |= getFlatIcon(displayed) + add_overlay(getFlatIcon(displayed)) else icon_state = initial(icon_state) @@ -543,7 +543,7 @@ "You attach the sign to [T].") playsound(T, 'sound/items/Deconstruct.ogg', 50, 1) var/obj/structure/sign/picture_frame/PF = new /obj/structure/sign/picture_frame(T) - PF.overlays = overlays.Copy() + PF.copy_overlays(src) if(displayed) PF.framed = displayed if(contents.len) @@ -601,8 +601,8 @@ framed.show() /obj/structure/sign/picture_frame/update_icon() - overlays.Cut() + cut_overlays() if(framed) - overlays |= getFlatIcon(framed) + add_overlay(getFlatIcon(framed)) else icon_state = initial(icon_state) \ No newline at end of file diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 6b9b1db1557..eecb7b7e43d 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -276,12 +276,10 @@ icon_state = "apcewires" if(!(update_state & UPSTATE_ALLGOOD)) - if(overlays.len) - cut_overlays() + cut_overlays() if(update & 2) - if(overlays.len) - cut_overlays() + cut_overlays() if(!(stat & (BROKEN|MAINT)) && update_state & UPSTATE_ALLGOOD) var/list/O = list( status_overlays_lock[locked+1], diff --git a/code/modules/projectiles/guns/ballistic/automatic.dm b/code/modules/projectiles/guns/ballistic/automatic.dm index f7337e4ee19..a4f412b9943 100644 --- a/code/modules/projectiles/guns/ballistic/automatic.dm +++ b/code/modules/projectiles/guns/ballistic/automatic.dm @@ -260,17 +260,11 @@ /obj/item/weapon/gun/ballistic/automatic/shotgun/bulldog/New() ..() update_icon() - return - -/obj/item/weapon/gun/ballistic/automatic/shotgun/bulldog/proc/update_magazine() - if(magazine) - src.overlays = 0 - add_overlay("[magazine.icon_state]") - return /obj/item/weapon/gun/ballistic/automatic/shotgun/bulldog/update_icon() - src.overlays = 0 - update_magazine() + if(magazine) + cut_overlays() + add_overlay("[magazine.icon_state]") icon_state = "bulldog[chambered ? "" : "-e"]" /obj/item/weapon/gun/ballistic/automatic/shotgun/bulldog/afterattack() diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index 3edd5f1489f..7f34371a92d 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -306,7 +306,7 @@ S.faction = list("\ref[owner]") S.icon = P.icon S.icon_state = P.icon_state - S.overlays = P.overlays + S.copy_overlays(P) S.color = P.color S.atom_colours = P.atom_colours.Copy() if(L.mind) diff --git a/code/modules/reagents/reagent_containers/bottle.dm b/code/modules/reagents/reagent_containers/bottle.dm index 9a142be07f0..01f39db4d35 100644 --- a/code/modules/reagents/reagent_containers/bottle.dm +++ b/code/modules/reagents/reagent_containers/bottle.dm @@ -37,7 +37,7 @@ filling.icon_state = "[icon_state]100" filling.color = mix_color_from_reagents(reagents.reagent_list) - overlays += filling + add_overlay(filling) /obj/item/weapon/reagent_containers/glass/bottle/epinephrine diff --git a/code/modules/research/protolathe.dm b/code/modules/research/protolathe.dm index bf4e40f8692..21f9d9937c3 100644 --- a/code/modules/research/protolathe.dm +++ b/code/modules/research/protolathe.dm @@ -115,7 +115,7 @@ Note: Must be placed west/left of and R&D console to function. user << "You add [amount_inserted] sheets to the [src.name]." add_overlay("protolathe_[stack_name]") sleep(10) - overlays -= "protolathe_[stack_name]" + cut_overlay("protolathe_[stack_name]") busy = FALSE updateUsrDialog() @@ -138,7 +138,7 @@ Note: Must be placed west/left of and R&D console to function. qdel(O) add_overlay("protolathe_bluespace") sleep(10) - overlays -= "protolathe_bluespace" + cut_overlay("protolathe_bluespace") busy = FALSE updateUsrDialog() diff --git a/code/modules/spells/spell_types/lightning.dm b/code/modules/spells/spell_types/lightning.dm index c1058161f55..78328e5d2cf 100644 --- a/code/modules/spells/spell_types/lightning.dm +++ b/code/modules/spells/spell_types/lightning.dm @@ -26,7 +26,7 @@ user << "You start gathering the power." Snd = new/sound('sound/magic/lightning_chargeup.ogg',channel = 7) halo = image("icon"='icons/effects/effects.dmi',"icon_state" ="electricity","layer" = EFFECTS_LAYER) - user.overlays.Add(halo) + user.add_overlay(halo) playsound(get_turf(user), Snd, 50, 0) if(do_mob(user,user,100,1)) if(ready && cast_check(skipcharge=1)) @@ -39,7 +39,7 @@ /obj/effect/proc_holder/spell/targeted/tesla/proc/Reset(mob/user = usr) ready = 0 if(halo) - user.overlays.Remove(halo) + user.cut_overlay(halo) /obj/effect/proc_holder/spell/targeted/tesla/revert_cast(mob/user = usr, message = 1) if(message) diff --git a/code/modules/telesci/gps.dm b/code/modules/telesci/gps.dm index d0815a5bbe3..09cc6c8e7c3 100644 --- a/code/modules/telesci/gps.dm +++ b/code/modules/telesci/gps.dm @@ -24,13 +24,13 @@ var/list/GPS_list = list() /obj/item/device/gps/emp_act(severity) emped = TRUE - overlays -= "working" + cut_overlay("working") add_overlay("emp") addtimer(CALLBACK(src, .proc/reboot), 300) /obj/item/device/gps/proc/reboot() emped = FALSE - overlays -= "emp" + cut_overlay("emp") add_overlay("working") /obj/item/device/gps/AltClick(mob/user) @@ -39,7 +39,7 @@ var/list/GPS_list = list() if(emped) user << "It's busted!" if(tracking) - overlays -= "working" + cut_overlay("working") user << "[src] is no longer tracking, or visible to other GPS devices." tracking = FALSE else diff --git a/code/modules/vehicles/atv.dm b/code/modules/vehicles/atv.dm index e1bb65c1758..6afd401b75a 100644 --- a/code/modules/vehicles/atv.dm +++ b/code/modules/vehicles/atv.dm @@ -20,7 +20,7 @@ if(has_buckled_mobs()) add_overlay(atvcover) else - overlays -= atvcover + cut_overlay(atvcover) diff --git a/tgstation.dme b/tgstation.dme index b0aa61fc137..ef45f56a02f 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -61,6 +61,7 @@ #include "code\__DEFINES\typeids.dm" #include "code\__DEFINES\vv.dm" #include "code\__DEFINES\wires.dm" +#include "code\__HELPERS\_lists.dm" #include "code\__HELPERS\_logging.dm" #include "code\__HELPERS\_string_lists.dm" #include "code\__HELPERS\bandetect.dm" @@ -70,7 +71,6 @@ #include "code\__HELPERS\global_lists.dm" #include "code\__HELPERS\icon_smoothing.dm" #include "code\__HELPERS\icons.dm" -#include "code\__HELPERS\lists.dm" #include "code\__HELPERS\maths.dm" #include "code\__HELPERS\matrices.dm" #include "code\__HELPERS\mobs.dm" @@ -187,6 +187,7 @@ #include "code\controllers\subsystem\processing\fastprocess.dm" #include "code\controllers\subsystem\processing\flightpacks.dm" #include "code\controllers\subsystem\processing\objects.dm" +#include "code\controllers\subsystem\processing\overlays.dm" #include "code\controllers\subsystem\processing\processing.dm" #include "code\datums\action.dm" #include "code\datums\ai_laws.dm"