From ad4d290ea70e97027ddd8ae8765465e76d35eafb Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Sun, 8 Mar 2020 19:26:01 +0100 Subject: [PATCH] WIP --- code/game/objects/structures/ai_core.dm | 2 +- code/game/objects/structures/aliens.dm | 3 +- code/game/objects/structures/bedsheet_bin.dm | 2 +- .../structures/crates_lockers/closets.dm | 50 +++++++++------ .../crates_lockers/closets/bodybag.dm | 6 +- .../structures/crates_lockers/crates.dm | 7 ++- .../structures/crates_lockers/crates/bins.dm | 10 +-- .../crates_lockers/crates/critter.dm | 10 +-- .../crates_lockers/crates/secure.dm | 10 +-- code/game/objects/structures/displaycase.dm | 2 +- code/game/objects/structures/divine.dm | 2 +- code/game/objects/structures/door_assembly.dm | 10 +-- code/game/objects/structures/extinguisher.dm | 2 +- code/game/objects/structures/false_walls.dm | 2 +- code/game/objects/structures/fireaxe.dm | 22 +++---- code/game/objects/structures/fireplace.dm | 31 +++++----- code/game/objects/structures/grille.dm | 2 +- code/game/objects/structures/guncase.dm | 10 +-- code/game/objects/structures/headpike.dm | 8 +-- code/game/objects/structures/janicart.dm | 18 +++--- code/game/objects/structures/ladders.dm | 2 +- code/game/objects/structures/life_candle.dm | 2 +- code/game/objects/structures/mineral_doors.dm | 2 +- code/game/objects/structures/mop_bucket.dm | 6 +- code/game/objects/structures/morgue.dm | 18 ++---- code/game/objects/structures/safe.dm | 4 +- code/game/objects/structures/stairs.dm | 2 +- .../game/objects/structures/tank_dispenser.dm | 12 ++-- .../transit_tubes/transit_tube_pod.dm | 2 +- code/game/objects/structures/watercloset.dm | 52 ++++++++-------- .../objects/structures/windoor_assembly.dm | 2 +- code/game/objects/structures/window.dm | 26 ++++---- .../abductor/equipment/abduction_gear.dm | 11 +++- .../abductor/machinery/experiment.dm | 2 +- .../bloodsucker/objects/bloodsucker_crypt.dm | 4 +- .../clockcult/clock_effects/clock_sigils.dm | 1 + code/modules/antagonists/cult/cult_items.dm | 4 +- .../overthrow/overthrow_converter.dm | 2 +- .../antagonists/slaughter/slaughter.dm | 5 +- code/modules/assembly/bomb.dm | 12 ++-- .../atmospherics/machinery/airalarm.dm | 39 ++++++------ .../machinery/portable/canister.dm | 62 ++++--------------- .../atmospherics/machinery/portable/pump.dm | 10 +-- .../machinery/portable/scrubber.dm | 15 +++-- code/modules/awaymissions/gateway.dm | 21 ++----- .../awaymissions/mission_code/Academy.dm | 5 +- code/modules/awaymissions/pamphlet.dm | 5 +- code/modules/buildmode/buttons.dm | 5 +- code/modules/cargo/supplypod.dm | 11 ++-- code/modules/cargo/supplypod_beacon.dm | 10 +-- code/modules/clothing/clothing.dm | 19 +++--- code/modules/clothing/ears/_ears.dm | 11 ++-- .../clothing/glasses/engine_goggles.dm | 16 ++--- code/modules/clothing/head/hardhat.dm | 20 +++--- code/modules/clothing/head/helmet.dm | 10 +-- code/modules/clothing/head/misc_special.dm | 15 +++-- code/modules/clothing/shoes/bananashoes.dm | 19 +++--- code/modules/clothing/spacesuits/hardsuit.dm | 26 +++----- code/modules/events/pirates.dm | 2 +- .../food_and_drinks/food/customizables.dm | 13 ++-- .../kitchen_machinery/gibber.dm | 12 ++-- .../kitchen_machinery/grill.dm | 2 +- .../kitchen_machinery/microwave.dm | 2 +- .../kitchen_machinery/smartfridge.dm | 11 ++-- code/modules/games/cas.dm | 4 +- code/modules/holodeck/items.dm | 2 +- .../hydroponics/beekeeping/honeycomb.dm | 6 +- code/modules/hydroponics/biogenerator.dm | 2 +- code/modules/hydroponics/fermenting_barrel.dm | 2 +- code/modules/hydroponics/gene_modder.dm | 11 ++-- .../integrated_electronics/core/assemblies.dm | 10 +-- .../integrated_electronics/core/detailer.dm | 11 ++-- .../integrated_electronics/core/wirer.dm | 4 +- code/modules/library/lib_items.dm | 7 +-- .../modules/mining/equipment/explorer_gear.dm | 8 +-- .../mining/equipment/kinetic_crusher.dm | 19 +++--- .../mining/equipment/marker_beacons.dm | 2 +- .../mining/equipment/regenerative_core.dm | 11 ++-- code/modules/mining/equipment/survival_pod.dm | 14 ++--- code/modules/mining/lavaland/ash_flora.dm | 14 ++--- .../mining/lavaland/necropolis_chests.dm | 15 +++-- code/modules/mining/machine_redemption.dm | 3 +- code/modules/mining/machine_vending.dm | 2 +- code/modules/mining/ores_coins.dm | 9 ++- code/modules/mining/point_bank.dm | 3 +- code/modules/mob/living/brain/MMI.dm | 25 +++++--- code/modules/mob/living/brain/posibrain.dm | 5 +- .../human/species_types/shadowpeople.dm | 6 +- .../living/simple_animal/guardian/guardian.dm | 5 +- 89 files changed, 443 insertions(+), 498 deletions(-) diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm index fcd1f80a4f..3e35c12314 100644 --- a/code/game/objects/structures/ai_core.dm +++ b/code/game/objects/structures/ai_core.dm @@ -255,7 +255,7 @@ return return ..() -/obj/structure/AIcore/update_icon() +/obj/structure/AIcore/update_icon_state() switch(state) if(EMPTY_CORE) icon_state = "0" diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm index 32e40bedec..a793459c5d 100644 --- a/code/game/objects/structures/aliens.dm +++ b/code/game/objects/structures/aliens.dm @@ -234,8 +234,7 @@ if(status == BURST) obj_integrity = integrity_failure * max_integrity -/obj/structure/alien/egg/update_icon() - ..() +/obj/structure/alien/egg/update_icon_state() switch(status) if(GROWING) icon_state = "[base_icon]_growing" diff --git a/code/game/objects/structures/bedsheet_bin.dm b/code/game/objects/structures/bedsheet_bin.dm index 8dc7caa5ad..0991351102 100644 --- a/code/game/objects/structures/bedsheet_bin.dm +++ b/code/game/objects/structures/bedsheet_bin.dm @@ -303,7 +303,7 @@ LINEN BINS . += "There are [amount] sheets in the bin." -/obj/structure/bedsheetbin/update_icon() +/obj/structure/bedsheetbin/update_icon_state() switch(amount) if(0) icon_state = "linenbin-empty" diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index c932dd96e8..e19feea582 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -58,30 +58,40 @@ return ..() /obj/structure/closet/update_icon() - cut_overlays() - if(opened & icon_door_override) - add_overlay("[icon_door]_open") + . = ..() + if(!opened) layer = OBJ_LAYER - return - else if(opened) - add_overlay("[icon_state]_open") - return - if(icon_door) - add_overlay("[icon_door]_door") else layer = BELOW_OBJ_LAYER - add_overlay("[icon_state]_door") - if(welded) - add_overlay("welded") - if(!secure) - return - if(broken) - add_overlay("off") - add_overlay("sparking") - else if(locked) - add_overlay("locked") + +/obj/structure/closet/update_overlays() + . = ..() + closet_update_overlays(.) + +/obj/structure/closet/proc/closet_update_overlays(list/new_overlays) + . = new_overlays + if(!opened) + if(icon_door) + . += "[icon_door]_door" + else + . += "[icon_state]_door" + if(welded) + . += "welded" + if(!secure) + return + if(broken) + . += "off" + . += "sparking" + else if(locked) + . += "locked" + else + . += "unlocked" else - add_overlay("unlocked") + if(icon_door_override) + . += "[icon_door]_open" + else + . += "[icon_state]_open" + /obj/structure/closet/examine(mob/user) . = ..() diff --git a/code/game/objects/structures/crates_lockers/closets/bodybag.dm b/code/game/objects/structures/crates_lockers/closets/bodybag.dm index 1c34850274..5ec3851128 100644 --- a/code/game/objects/structures/crates_lockers/closets/bodybag.dm +++ b/code/game/objects/structures/crates_lockers/closets/bodybag.dm @@ -38,10 +38,10 @@ tagged = 0 update_icon() -/obj/structure/closet/body_bag/update_icon() - ..() +/obj/structure/closet/body_bag/update_overlays() + . = ..() if (tagged) - add_overlay("bodybag_label") + . += "bodybag_label" /obj/structure/closet/body_bag/close() if(..()) diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm index 4f6d6729fc..b0dfec6318 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -33,12 +33,13 @@ return 1 return !density -/obj/structure/closet/crate/update_icon() +/obj/structure/closet/crate/update_icon_state() icon_state = "[initial(icon_state)][opened ? "open" : ""]" - cut_overlays() +/obj/structure/closet/crate/closet_update_overlays(list/new_overlays) + . = new_overlays if(manifest) - add_overlay("manifest") + . += "manifest" /obj/structure/closet/crate/attack_hand(mob/user) . = ..() diff --git a/code/game/objects/structures/crates_lockers/crates/bins.dm b/code/game/objects/structures/crates_lockers/crates/bins.dm index bc3697a550..b57af43d3e 100644 --- a/code/game/objects/structures/crates_lockers/crates/bins.dm +++ b/code/game/objects/structures/crates_lockers/crates/bins.dm @@ -14,15 +14,15 @@ ..() update_icon() -/obj/structure/closet/crate/bin/update_icon() - ..() +/obj/structure/closet/crate/bin/closet_update_overlays(list/new_overlays) + . = new_overlays cut_overlays() if(contents.len == 0) - add_overlay("largebing") + . += "largebing" else if(contents.len >= storage_capacity) - add_overlay("largebinr") + . += "largebinr" else - add_overlay("largebino") + . += "largebino" /obj/structure/closet/crate/bin/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/storage/bag/trash)) diff --git a/code/game/objects/structures/crates_lockers/crates/critter.dm b/code/game/objects/structures/crates_lockers/crates/critter.dm index 3c0021b513..3dbbfd5c23 100644 --- a/code/game/objects/structures/crates_lockers/crates/critter.dm +++ b/code/game/objects/structures/crates_lockers/crates/critter.dm @@ -22,14 +22,14 @@ return ..() -/obj/structure/closet/crate/critter/update_icon() - cut_overlays() +/obj/structure/closet/crate/critter/closet_update_overlays(list/new_overlays) + . = new_overlays if(opened) - add_overlay("crittercrate_door_open") + . += "crittercrate_door_open" else - add_overlay("crittercrate_door") + . += "crittercrate_door" if(manifest) - add_overlay("manifest") + . += "manifest" /obj/structure/closet/crate/critter/return_air() if(tank) diff --git a/code/game/objects/structures/crates_lockers/crates/secure.dm b/code/game/objects/structures/crates_lockers/crates/secure.dm index 602adfb367..4ac69253d3 100644 --- a/code/game/objects/structures/crates_lockers/crates/secure.dm +++ b/code/game/objects/structures/crates_lockers/crates/secure.dm @@ -13,14 +13,14 @@ return 0 . = ..() -/obj/structure/closet/crate/secure/update_icon() - ..() +/obj/structure/closet/crate/secure/update_overlays() + . += ..() if(broken) - add_overlay("securecrateemag") + . += "securecrateemag" else if(locked) - add_overlay("securecrater") + . += "securecrater" else - add_overlay("securecrateg") + . += "securecrateg" /obj/structure/closet/crate/secure/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1) if(prob(tamperproof) && damage_amount >= DAMAGE_PRECISION) diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index 8a5b678f22..c332a07edf 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -84,7 +84,7 @@ alarmed.burglaralert(src) playsound(src, 'sound/effects/alert.ogg', 50, 1) -/obj/structure/displaycase/update_icon() +/obj/structure/displaycase/update_icon_state() var/icon/I if(open) I = icon('icons/obj/stationobjs.dmi',"glassbox_open") diff --git a/code/game/objects/structures/divine.dm b/code/game/objects/structures/divine.dm index 1da8a26b52..bca96e67d1 100644 --- a/code/game/objects/structures/divine.dm +++ b/code/game/objects/structures/divine.dm @@ -44,7 +44,7 @@ addtimer(CALLBACK(src, /atom/.proc/update_icon), time_between_uses) -/obj/structure/healingfountain/update_icon() +/obj/structure/healingfountain/update_icon_state() if(last_process + time_between_uses > world.time) icon_state = "fountain" else diff --git a/code/game/objects/structures/door_assembly.dm b/code/game/objects/structures/door_assembly.dm index f35e9e7d55..79600d5bf2 100644 --- a/code/game/objects/structures/door_assembly.dm +++ b/code/game/objects/structures/door_assembly.dm @@ -260,13 +260,13 @@ update_name() update_icon() -/obj/structure/door_assembly/update_icon() - cut_overlays() +/obj/structure/door_assembly/update_overlays() + . = ..() if(!glass) - add_overlay(get_airlock_overlay("fill_construction", icon)) + . += get_airlock_overlay("fill_construction", icon) else if(glass) - add_overlay(get_airlock_overlay("glass_construction", overlays_file)) - add_overlay(get_airlock_overlay("panel_c[state+1]", overlays_file)) + . += get_airlock_overlay("glass_construction", overlays_file) + . += get_airlock_overlay("panel_c[state+1]", overlays_file) /obj/structure/door_assembly/proc/update_name() name = "" diff --git a/code/game/objects/structures/extinguisher.dm b/code/game/objects/structures/extinguisher.dm index 2124c83d7d..9b736517be 100644 --- a/code/game/objects/structures/extinguisher.dm +++ b/code/game/objects/structures/extinguisher.dm @@ -116,7 +116,7 @@ opened = !opened update_icon() -/obj/structure/extinguisher_cabinet/update_icon() +/obj/structure/extinguisher_cabinet/update_icon_state() if(!opened) icon_state = "extinguisher_closed" return diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index 52441c2987..e44698f96e 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -64,7 +64,7 @@ update_icon() air_update_turf(TRUE) -/obj/structure/falsewall/update_icon()//Calling icon_update will refresh the smoothwalls if it's closed, otherwise it will make sure the icon is correct if it's open +/obj/structure/falsewall/update_icon_state()//Calling icon_update will refresh the smoothwalls if it's closed, otherwise it will make sure the icon is correct if it's open if(opening) if(density) icon_state = "fwall_opening" diff --git a/code/game/objects/structures/fireaxe.dm b/code/game/objects/structures/fireaxe.dm index 8457a397a9..0f3a23dd0f 100644 --- a/code/game/objects/structures/fireaxe.dm +++ b/code/game/objects/structures/fireaxe.dm @@ -140,30 +140,30 @@ update_icon() return -/obj/structure/fireaxecabinet/update_icon() - cut_overlays() +/obj/structure/fireaxecabinet/update_overlays() + . = ..() if(fireaxe) - add_overlay("axe") + . += "axe" if(!open) var/hp_percent = obj_integrity/max_integrity * 100 if(broken) - add_overlay("glass4") + . += "glass4" else switch(hp_percent) if(-INFINITY to 40) - add_overlay("glass3") + . += "glass3" if(40 to 60) - add_overlay("glass2") + . += "glass2" if(60 to 80) - add_overlay("glass1") + . += "glass1" if(80 to INFINITY) - add_overlay("glass") + . += "glass" if(locked) - add_overlay("locked") + . += "locked" else - add_overlay("unlocked") + . += "unlocked" else - add_overlay("glass_raised") + . += "glass_raised" /obj/structure/fireaxecabinet/proc/toggle_lock(mob/user) to_chat(user, " Resetting circuitry...") diff --git a/code/game/objects/structures/fireplace.dm b/code/game/objects/structures/fireplace.dm index b670fe5cf0..ee8f285230 100644 --- a/code/game/objects/structures/fireplace.dm +++ b/code/game/objects/structures/fireplace.dm @@ -69,21 +69,22 @@ else . = ..() -/obj/structure/fireplace/update_icon() - cut_overlays() - if(lit) - switch(burn_time_remaining()) - if(0 to 500) - add_overlay("fireplace_fire0") - if(500 to 1000) - add_overlay("fireplace_fire1") - if(1000 to 1500) - add_overlay("fireplace_fire2") - if(1500 to 2000) - add_overlay("fireplace_fire3") - if(2000 to MAXIMUM_BURN_TIMER) - add_overlay("fireplace_fire4") - add_overlay("fireplace_glow") +/obj/structure/fireplace/update_overlays() + . = ..() + if(!lit) + return + switch(burn_time_remaining()) + if(0 to 500) + . += "fireplace_fire0" + if(500 to 1000) + . += "fireplace_fire1" + if(1000 to 1500) + . += "fireplace_fire2" + if(1500 to 2000) + . += "fireplace_fire3" + if(2000 to MAXIMUM_BURN_TIMER) + . += "fireplace_fire4" + . += "fireplace_glow" /obj/structure/fireplace/proc/adjust_light() if(!lit) diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 0f43040c87..61983dcb4f 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -22,7 +22,7 @@ . = ..() update_icon() -/obj/structure/grille/update_icon() +/obj/structure/grille/update_icon_state() if(QDELETED(src) || broken) return diff --git a/code/game/objects/structures/guncase.dm b/code/game/objects/structures/guncase.dm index 701a4d071c..ede7e31e0d 100644 --- a/code/game/objects/structures/guncase.dm +++ b/code/game/objects/structures/guncase.dm @@ -22,17 +22,17 @@ break update_icon() -/obj/structure/guncase/update_icon() - cut_overlays() +/obj/structure/guncase/update_overlays() + . = ..() if(case_type && LAZYLEN(contents)) var/mutable_appearance/gun_overlay = mutable_appearance(icon, case_type) for(var/i in 1 to contents.len) gun_overlay.pixel_x = 3 * (i - 1) - add_overlay(gun_overlay) + . += gun_overlay if(open) - add_overlay("[icon_state]_open") + . += "[icon_state]_open" else - add_overlay("[icon_state]_door") + . += "[icon_state]_door" /obj/structure/guncase/attackby(obj/item/I, mob/user, params) if(iscyborg(user) || isalien(user)) diff --git a/code/game/objects/structures/headpike.dm b/code/game/objects/structures/headpike.dm index 81433b562d..581ce850de 100644 --- a/code/game/objects/structures/headpike.dm +++ b/code/game/objects/structures/headpike.dm @@ -28,14 +28,14 @@ . = ..() pixel_x = rand(-8, 8) -/obj/structure/headpike/update_icon() - ..() +/obj/structure/headpike/update_overlays() + . = ..() var/obj/item/bodypart/head/H = locate() in contents - var/mutable_appearance/MA = new() if(H) + var/mutable_appearance/MA = new() MA.copy_overlays(H) MA.pixel_y = 12 - add_overlay(H) + . += H /obj/structure/headpike/attack_hand(mob/user) . = ..() diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index 58c8a739dc..b10ca8002c 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -161,20 +161,20 @@ updateUsrDialog() -/obj/structure/janitorialcart/update_icon() - cut_overlays() +/obj/structure/janitorialcart/update_overlays() + . = ..() if(mybag) - add_overlay("cart_garbage") + . += "cart_garbage" if(mymop) - add_overlay("cart_mop") + . += "cart_mop" if(mybroom) - add_overlay("cart_broom") + . += "cart_broom" if(myspray) - add_overlay("cart_spray") + . += "cart_spray" if(myreplacer) - add_overlay("cart_replacer") + . += "cart_replacer" if(signs) - add_overlay("cart_sign[signs]") + . += "cart_sign[signs]" if(reagents.total_volume > 0) - add_overlay("cart_water") + . += "cart_water" diff --git a/code/game/objects/structures/ladders.dm b/code/game/objects/structures/ladders.dm index b3f415bafe..53a1f609d1 100644 --- a/code/game/objects/structures/ladders.dm +++ b/code/game/objects/structures/ladders.dm @@ -55,7 +55,7 @@ down.update_icon() up = down = null -/obj/structure/ladder/update_icon() +/obj/structure/ladder/update_icon_state() if(up && down) icon_state = "ladder11" diff --git a/code/game/objects/structures/life_candle.dm b/code/game/objects/structures/life_candle.dm index 0ae0e29459..a64dc6c6a9 100644 --- a/code/game/objects/structures/life_candle.dm +++ b/code/game/objects/structures/life_candle.dm @@ -46,7 +46,7 @@ STOP_PROCESSING(SSobj, src) set_light(0) -/obj/structure/life_candle/update_icon() +/obj/structure/life_candle/update_icon_state() if(linked_minds.len) icon_state = icon_state_active else diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index caad9e7bd4..f52fa0576a 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -118,7 +118,7 @@ update_icon() isSwitchingStates = 0 -/obj/structure/mineral_door/update_icon() +/obj/structure/mineral_door/update_icon_state() if(state) icon_state = "[initial_state]open" else diff --git a/code/game/objects/structures/mop_bucket.dm b/code/game/objects/structures/mop_bucket.dm index a9e12c1404..e1bb143fef 100644 --- a/code/game/objects/structures/mop_bucket.dm +++ b/code/game/objects/structures/mop_bucket.dm @@ -23,7 +23,7 @@ else return ..() -/obj/structure/mopbucket/update_icon() - cut_overlays() +/obj/structure/mopbucket/update_overlays() + . = ..() if(reagents.total_volume > 0) - add_overlay("mopbucket_water") \ No newline at end of file + . += "mopbucket_water" \ No newline at end of file diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index bf891ef223..8cf5b1ee66 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -45,9 +45,6 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an ..() update_icon() -/obj/structure/bodycontainer/update_icon() - return - /obj/structure/bodycontainer/relaymove(mob/user) if(user.stat || !isturf(loc)) return @@ -174,7 +171,7 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an to_chat(user, "You turn the speaker function [beeper ? "on" : "off"].") return TRUE -/obj/structure/bodycontainer/morgue/update_icon() +/obj/structure/bodycontainer/morgue/update_icon_state() if (!connected || connected.loc != src) // Open or tray is gone. icon_state = "morgue0" else @@ -228,20 +225,17 @@ GLOBAL_LIST_EMPTY(crematoriums) GLOB.crematoriums.Add(src) ..() -/obj/structure/bodycontainer/crematorium/update_icon() +/obj/structure/bodycontainer/crematorium/update_icon_state() if(!connected || connected.loc != src) icon_state = "crema0" else - - if(src.contents.len > 1) - src.icon_state = "crema2" + if(contents.len > 1) + icon_state = "crema2" else - src.icon_state = "crema1" + icon_state = "crema1" if(locked) - src.icon_state = "crema_active" - - return + icon_state = "crema_active" /obj/structure/bodycontainer/crematorium/proc/cremate(mob/user) if(locked) diff --git a/code/game/objects/structures/safe.dm b/code/game/objects/structures/safe.dm index 92c4d0a066..2a7fc9aeb6 100644 --- a/code/game/objects/structures/safe.dm +++ b/code/game/objects/structures/safe.dm @@ -13,7 +13,7 @@ FLOOR SAFES anchored = TRUE density = TRUE resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF - interaction_flags_atom = INTERACT_ATOM_ATTACK_HAND | INTERACT_ATOM_UI_INTERACT + interaction_flags_atom = INTERACT_ATOM_ATTACK_HAND | INTERACT_ATOM_UI_INTERACT var/open = FALSE //is the safe open? var/tumbler_1_pos //the tumbler position- from 0 to 72 var/tumbler_1_open //the tumbler position to open at- 0 to 72 @@ -73,7 +73,7 @@ FLOOR SAFES num = 0 return num -/obj/structure/safe/update_icon() +/obj/structure/safe/update_icon_state() if(open) icon_state = "[initial(icon_state)]-open" else diff --git a/code/game/objects/structures/stairs.dm b/code/game/objects/structures/stairs.dm index f2c4e628e0..d1a2a6f9f6 100644 --- a/code/game/objects/structures/stairs.dm +++ b/code/game/objects/structures/stairs.dm @@ -54,7 +54,7 @@ return FALSE return ..() -/obj/structure/stairs/update_icon() +/obj/structure/stairs/update_icon_state() if(isTerminator()) icon_state = "stairs_t" else diff --git a/code/game/objects/structures/tank_dispenser.dm b/code/game/objects/structures/tank_dispenser.dm index 5fabcafd75..6a8175b921 100644 --- a/code/game/objects/structures/tank_dispenser.dm +++ b/code/game/objects/structures/tank_dispenser.dm @@ -25,18 +25,18 @@ new /obj/item/tank/internals/plasma(src) update_icon() -/obj/structure/tank_dispenser/update_icon() - cut_overlays() +/obj/structure/tank_dispenser/update_overlays() + . = ..() switch(oxygentanks) if(1 to 3) - add_overlay("oxygen-[oxygentanks]") + . += "oxygen-[oxygentanks]" if(4 to TANK_DISPENSER_CAPACITY) - add_overlay("oxygen-4") + . += "oxygen-4" switch(plasmatanks) if(1 to 4) - add_overlay("plasma-[plasmatanks]") + . += "plasma-[plasmatanks]" if(5 to TANK_DISPENSER_CAPACITY) - add_overlay("plasma-5") + . += "plasma-5" /obj/structure/tank_dispenser/attackby(obj/item/I, mob/user, params) var/full diff --git a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm index 392c802ed8..04f113a0c8 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm @@ -19,7 +19,7 @@ empty_pod() return ..() -/obj/structure/transit_tube_pod/update_icon() +/obj/structure/transit_tube_pod/update_icon_state() if(contents.len) icon_state = "pod_occupied" else diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index 78df9b5d57..5f806e7fc4 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -72,7 +72,7 @@ update_icon() -/obj/structure/toilet/update_icon() +/obj/structure/toilet/update_icon_state() icon_state = "toilet[open][cistern]" @@ -216,8 +216,6 @@ density = FALSE use_power = NO_POWER_USE var/on = FALSE - var/obj/effect/mist/mymist = null - var/ismist = 0 //needs a var so we can make it linger~ var/watertemp = "normal" //freezing, normal, or boiling var/datum/looping_sound/showering/soundloop @@ -240,6 +238,7 @@ /obj/machinery/shower/interact(mob/M) on = !on update_icon() + handle_mist() add_fingerprint(M) if(on) START_PROCESSING(SSmachines, src) @@ -280,31 +279,30 @@ return TRUE -/obj/machinery/shower/update_icon() //this is terribly unreadable, but basically it makes the shower mist up - cut_overlays() //once it's been on for a while, in addition to handling the water overlay. - if(mymist) - qdel(mymist) - +/obj/machinery/shower/update_overlays() + . = ..() if(on) - add_overlay(mutable_appearance('icons/obj/watercloset.dmi', "water", ABOVE_MOB_LAYER)) - if(watertemp == "freezing") - return - if(!ismist) - spawn(50) - if(src && on) - ismist = 1 - mymist = new /obj/effect/mist(loc) - else - ismist = 1 - mymist = new /obj/effect/mist(loc) - else if(ismist) - ismist = 1 - mymist = new /obj/effect/mist(loc) - spawn(250) - if(!on && mymist) - qdel(mymist) - ismist = 0 + . += mutable_appearance('icons/obj/watercloset.dmi', "water", ABOVE_MOB_LAYER) +/obj/machinery/shower/proc/handle_mist() + // If there is no mist, and the shower was turned on (on a non-freezing temp): make mist in 5 seconds + // If there was already mist, and the shower was turned off (or made cold): remove the existing mist in 25 sec + var/obj/effect/mist/mist = locate() in loc + if(!mist && on && watertemp != "freezing") + addtimer(CALLBACK(src, .proc/make_mist), 5 SECONDS) + + if(mist && (!on || watertemp == "freezing")) + addtimer(CALLBACK(src, .proc/clear_mist), 25 SECONDS) + +/obj/machinery/shower/proc/make_mist() + var/obj/effect/mist/mist = locate() in loc + if(!mist && on && watertemp != "freezing") + new /obj/effect/mist(loc) + +/obj/machinery/shower/proc/clear_mist() + var/obj/effect/mist/mist = locate() in loc + if(mist && (!on || watertemp == "freezing")) + qdel(mist) /obj/machinery/shower/Crossed(atom/movable/AM) ..() @@ -692,7 +690,7 @@ open = !open update_icon() -/obj/structure/curtain/update_icon() +/obj/structure/curtain/update_icon_state() if(!open) icon_state = "closed" layer = WALL_OBJ_LAYER diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index e824567b50..531367585e 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -47,7 +47,7 @@ setDir(ini_dir) move_update_air(T) -/obj/structure/windoor_assembly/update_icon() +/obj/structure/windoor_assembly/update_icon_state() icon_state = "[facing]_[secure ? "secure_" : ""]windoor_assembly[state]" /obj/structure/windoor_assembly/CanPass(atom/movable/mover, turf/target) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index d4925c8604..5dd4e7d987 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -18,7 +18,6 @@ var/obj/item/stack/sheet/glass_type = /obj/item/stack/sheet/glass var/cleanable_type = /obj/effect/decal/cleanable/glass var/glass_amount = 1 - var/mutable_appearance/crack_overlay can_be_unanchored = TRUE resistance_flags = ACID_PROOF armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 100) @@ -337,22 +336,19 @@ queue_smooth_neighbors(src) //merges adjacent full-tile windows into one -/obj/structure/window/update_icon() - if(!QDELETED(src)) - if(!fulltile) - return +/obj/structure/window/update_overlays() + . = ..() + if(QDELETED(src) || !fulltile) + return + var/ratio = obj_integrity / max_integrity + ratio = CEILING(ratio*4, 1) * 25 - var/ratio = obj_integrity / max_integrity - ratio = CEILING(ratio*4, 1) * 25 + if(smooth) + queue_smooth(src) - if(smooth) - queue_smooth(src) - - cut_overlay(crack_overlay) - if(ratio > 75) - return - crack_overlay = mutable_appearance('icons/obj/structures.dmi', "damage[ratio]", -(layer+0.1)) - add_overlay(crack_overlay) + if(ratio > 75) + return + . += mutable_appearance('icons/obj/structures.dmi', "damage[ratio]", -(layer+0.1)) /obj/structure/window/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm index c2a3f953f5..39cdf8a5fa 100644 --- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm +++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm @@ -419,8 +419,9 @@
Congratulations! You are now trained for invasive xenobiology research!"} -/obj/item/paper/guides/antag/abductor/update_icon() - return +/obj/item/paper/guides/antag/abductor/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_blocker) /obj/item/paper/guides/antag/abductor/AltClick() return //otherwise it would fold into a paperplane. @@ -442,6 +443,10 @@ w_class = WEIGHT_CLASS_NORMAL actions_types = list(/datum/action/item_action/toggle_mode) +/obj/item/abductor/baton/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_updates_onmob) + /obj/item/abductor/baton/proc/toggle(mob/living/user=usr) mode = (mode+1)%BATON_MODES var/txt @@ -458,7 +463,7 @@ to_chat(usr, "You switch the baton to [txt] mode.") update_icon() -/obj/item/abductor/baton/update_icon() +/obj/item/abductor/baton/update_icon_state() switch(mode) if(BATON_STUN) icon_state = "wonderprodStun" diff --git a/code/modules/antagonists/abductor/machinery/experiment.dm b/code/modules/antagonists/abductor/machinery/experiment.dm index b5233606cf..96bcd27a3b 100644 --- a/code/modules/antagonists/abductor/machinery/experiment.dm +++ b/code/modules/antagonists/abductor/machinery/experiment.dm @@ -223,7 +223,7 @@ return -/obj/machinery/abductor/experiment/update_icon() +/obj/machinery/abductor/experiment/update_icon_state() if(state_open) icon_state = "experiment-open" else diff --git a/code/modules/antagonists/bloodsucker/objects/bloodsucker_crypt.dm b/code/modules/antagonists/bloodsucker/objects/bloodsucker_crypt.dm index db286dd6fe..a8925dfb7b 100644 --- a/code/modules/antagonists/bloodsucker/objects/bloodsucker_crypt.dm +++ b/code/modules/antagonists/bloodsucker/objects/bloodsucker_crypt.dm @@ -258,7 +258,7 @@ /obj/structure/bloodsucker/vassalrack/proc/torture_victim(mob/living/user, mob/living/target) var/datum/antagonist/bloodsucker/bloodsuckerdatum = user.mind.has_antag_datum(ANTAG_DATUM_BLOODSUCKER) // Check Bloodmob/living/M, force = FALSE, check_loc = TRUE - var/convert_cost = 200 + 200 * bloodsuckerdatum.vassals + var/convert_cost = 200 + 200 * bloodsuckerdatum.vassals if(user.blood_volume < convert_cost + 5) to_chat(user, "You don't have enough blood to initiate the Dark Communion with [target].") return @@ -449,7 +449,7 @@ /obj/structure/bloodsucker/candelabrum/Destroy() STOP_PROCESSING(SSobj, src) -/obj/structure/bloodsucker/candelabrum/update_icon() +/obj/structure/bloodsucker/candelabrum/update_icon_state() icon_state = "candelabrum[lit ? "_lit" : ""]" /obj/structure/bloodsucker/candelabrum/examine(mob/user) diff --git a/code/modules/antagonists/clockcult/clock_effects/clock_sigils.dm b/code/modules/antagonists/clockcult/clock_effects/clock_sigils.dm index 1b4d26ac86..62382966f0 100644 --- a/code/modules/antagonists/clockcult/clock_effects/clock_sigils.dm +++ b/code/modules/antagonists/clockcult/clock_effects/clock_sigils.dm @@ -251,6 +251,7 @@ return TRUE /obj/effect/clockwork/sigil/transmission/update_icon() + . = ..() var/power_charge = get_clockwork_power() if(GLOB.ratvar_awakens) alpha = 255 diff --git a/code/modules/antagonists/cult/cult_items.dm b/code/modules/antagonists/cult/cult_items.dm index 3dc199b56d..1fbf01de97 100644 --- a/code/modules/antagonists/cult/cult_items.dm +++ b/code/modules/antagonists/cult/cult_items.dm @@ -372,7 +372,7 @@ max = 40 prefix = "darkened" -/obj/item/sharpener/cult/update_icon() +/obj/item/sharpener/cult/update_icon_state() var/old_state = icon_state icon_state = "cult_sharpener[used ? "_used" : ""]" if(old_state != icon_state) @@ -688,7 +688,7 @@ qdel(spear_act) ..() -/obj/item/twohanded/cult_spear/update_icon() +/obj/item/twohanded/cult_spear/update_icon_state() icon_state = "bloodspear[wielded]" /obj/item/twohanded/cult_spear/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum) diff --git a/code/modules/antagonists/overthrow/overthrow_converter.dm b/code/modules/antagonists/overthrow/overthrow_converter.dm index 99d1a52de8..eec6163107 100644 --- a/code/modules/antagonists/overthrow/overthrow_converter.dm +++ b/code/modules/antagonists/overthrow/overthrow_converter.dm @@ -49,7 +49,7 @@ else to_chat(user, "[user] fails to implant [M].") -/obj/item/overthrow_converter/update_icon() +/obj/item/overthrow_converter/update_icon_state() if(uses) icon_state = "implanter1" else diff --git a/code/modules/antagonists/slaughter/slaughter.dm b/code/modules/antagonists/slaughter/slaughter.dm index 8a01622c87..475438ba52 100644 --- a/code/modules/antagonists/slaughter/slaughter.dm +++ b/code/modules/antagonists/slaughter/slaughter.dm @@ -76,8 +76,9 @@ icon_state = "demon_heart-on" decay_factor = 0 -/obj/item/organ/heart/demon/update_icon() - return //always beating visually +/obj/item/organ/heart/demon/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_blocker) /obj/item/organ/heart/demon/attack(mob/M, mob/living/carbon/user, obj/target) if(M != user) diff --git a/code/modules/assembly/bomb.dm b/code/modules/assembly/bomb.dm index 28bb543828..3dfc0d859d 100644 --- a/code/modules/assembly/bomb.dm +++ b/code/modules/assembly/bomb.dm @@ -19,15 +19,17 @@ /obj/item/onetankbomb/examine(mob/user) bombtank.examine(user) -/obj/item/onetankbomb/update_icon() - cut_overlays() +/obj/item/onetankbomb/update_icon_state() if(bombtank) icon = bombtank.icon icon_state = bombtank.icon_state + +/obj/item/onetankbomb/update_overlays() + . = ..() if(bombassembly) - add_overlay(bombassembly.icon_state) - copy_overlays(bombassembly) - add_overlay("bomb_assembly") + . += bombassembly.icon_state + . += bombassembly.overlays + . += "bomb_assembly" /obj/item/onetankbomb/wrench_act(mob/living/user, obj/item/I) to_chat(user, "You disassemble [src]!") diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm index 4d2b8de586..07ddd4c042 100644 --- a/code/modules/atmospherics/machinery/airalarm.dm +++ b/code/modules/atmospherics/machinery/airalarm.dm @@ -624,10 +624,7 @@ "set_internal_pressure" = 0 )) -/obj/machinery/airalarm/update_icon() - set_light(0) - cut_overlays() - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) +/obj/machinery/airalarm/update_icon_state() if(stat & NOPOWER) icon_state = "alarm0" return @@ -636,35 +633,39 @@ icon_state = "alarmx" return - if(panel_open) - switch(buildstage) - if(2) - icon_state = "alarmx" - if(1) - icon_state = "alarm_b2" - if(0) - icon_state = "alarm_b1" + if(!panel_open) + icon_state = "alarm1" return - icon_state = "alarm1" + switch(buildstage) + if(2) + icon_state = "alarmx" + if(1) + icon_state = "alarm_b2" + if(0) + icon_state = "alarm_b1" + +/obj/machinery/airalarm/update_overlays() + . = ..() + SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) var/overlay_state = AALARM_OVERLAY_OFF var/area/A = get_base_area(src) switch(max(danger_level, A.atmosalm)) if(0) - add_overlay(AALARM_OVERLAY_GREEN) overlay_state = AALARM_OVERLAY_GREEN light_color = LIGHT_COLOR_GREEN - set_light(brightness_on) if(1) - add_overlay(AALARM_OVERLAY_WARN) overlay_state = AALARM_OVERLAY_WARN light_color = LIGHT_COLOR_LAVA - set_light(brightness_on) if(2) - add_overlay(AALARM_OVERLAY_DANGER) overlay_state = AALARM_OVERLAY_DANGER light_color = LIGHT_COLOR_RED - set_light(brightness_on) + + if(overlay_state != AALARM_OVERLAY_OFF) + . += overlay_state + set_light(brightness_on) + else + set_light(0) SSvis_overlays.add_vis_overlay(src, icon, overlay_state, ABOVE_LIGHTING_LAYER, ABOVE_LIGHTING_PLANE, dir) update_light() diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index 0d335da482..0b26cfc2f0 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -34,7 +34,6 @@ var/restricted = FALSE req_access = list() - var/update = 0 var/static/list/label2types = list( "n2" = /obj/machinery/portable_atmospherics/canister/nitrogen, "o2" = /obj/machinery/portable_atmospherics/canister/oxygen, @@ -213,61 +212,26 @@ air_contents.gases[/datum/gas/oxygen] = (O2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature) air_contents.gases[/datum/gas/nitrogen] = (N2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature) -#define HOLDING (1<<0) -#define CONNECTED (1<<1) -#define EMPTY (1<<2) -#define LOW (1<<3) -#define MEDIUM (1<<4) -#define FULL (1<<5) -#define DANGER (1<<6) -/obj/machinery/portable_atmospherics/canister/update_icon() +/obj/machinery/portable_atmospherics/canister/update_icon_state() if(stat & BROKEN) - cut_overlays() icon_state = "[icon_state]-1" - return - var/last_update = update - update = 0 +/obj/machinery/portable_atmospherics/canister/update_overlays() + . = ..() if(holding) - update |= HOLDING + . += "can-open" if(connected_port) - update |= CONNECTED + . += "can-connector" var/pressure = air_contents.return_pressure() - if(pressure < 10) - update |= EMPTY - else if(pressure < 5 * ONE_ATMOSPHERE) - update |= LOW - else if(pressure < 10 * ONE_ATMOSPHERE) - update |= MEDIUM - else if(pressure < 40 * ONE_ATMOSPHERE) - update |= FULL - else - update |= DANGER - - if(update == last_update) - return - - cut_overlays() - if(update & HOLDING) - add_overlay("can-open") - if(update & CONNECTED) - add_overlay("can-connector") - if(update & LOW) - add_overlay("can-o0") - else if(update & MEDIUM) - add_overlay("can-o1") - else if(update & FULL) - add_overlay("can-o2") - else if(update & DANGER) - add_overlay("can-o3") -#undef HOLDING -#undef CONNECTED -#undef EMPTY -#undef LOW -#undef MEDIUM -#undef FULL -#undef DANGER + if(pressure >= 40 * ONE_ATMOSPHERE) + . += "can-o3" + else if(pressure >= 10 * ONE_ATMOSPHERE) + . += "can-o2" + else if(pressure >= 5 * ONE_ATMOSPHERE) + . += "can-o1" + else if(pressure >= 10) + . += "can-o0" /obj/machinery/portable_atmospherics/canister/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > temperature_resistance) diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm index ddb907a2ad..3603e46490 100644 --- a/code/modules/atmospherics/machinery/portable/pump.dm +++ b/code/modules/atmospherics/machinery/portable/pump.dm @@ -29,14 +29,16 @@ QDEL_NULL(pump) return ..() -/obj/machinery/portable_atmospherics/pump/update_icon() +/obj/machinery/portable_atmospherics/pump/update_icon_state() icon_state = "psiphon:[on]" - cut_overlays() + +/obj/machinery/portable_atmospherics/pump/update_overlays() + . = ..() if(holding) - add_overlay("siphon-open") + . += "siphon-open" if(connected_port) - add_overlay("siphon-connector") + . += "siphon-connector" /obj/machinery/portable_atmospherics/pump/process_atmos() ..() diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm index 0c902e0426..3dfce7c1bf 100644 --- a/code/modules/atmospherics/machinery/portable/scrubber.dm +++ b/code/modules/atmospherics/machinery/portable/scrubber.dm @@ -5,6 +5,7 @@ var/on = FALSE var/volume_rate = 1000 + var/use_overlays = TRUE volume = 1000 var/list/scrubbing = list(/datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz, /datum/gas/nitryl, /datum/gas/tritium, /datum/gas/hypernoblium, /datum/gas/water_vapor) @@ -15,14 +16,17 @@ air_update_turf() return ..() -/obj/machinery/portable_atmospherics/scrubber/update_icon() +/obj/machinery/portable_atmospherics/scrubber/update_icon_state() icon_state = "pscrubber:[on]" - cut_overlays() +/obj/machinery/portable_atmospherics/scrubber/update_overlays() + . = ..() + if(!use_overlays) + return if(holding) - add_overlay("scrubber-open") + . += "scrubber-open" if(connected_port) - add_overlay("scrubber-connector") + . += "scrubber-connector" /obj/machinery/portable_atmospherics/scrubber/process_atmos() ..() @@ -117,11 +121,12 @@ volume = 50000 var/movable = FALSE + use_overlays = FALSE /obj/machinery/portable_atmospherics/scrubber/huge/movable movable = TRUE -/obj/machinery/portable_atmospherics/scrubber/huge/update_icon() +/obj/machinery/portable_atmospherics/scrubber/huge/update_icon_state() icon_state = "scrubber:[on]" /obj/machinery/portable_atmospherics/scrubber/huge/process_atmos() diff --git a/code/modules/awaymissions/gateway.dm b/code/modules/awaymissions/gateway.dm index e693abc8e4..4f155d4174 100644 --- a/code/modules/awaymissions/gateway.dm +++ b/code/modules/awaymissions/gateway.dm @@ -53,11 +53,8 @@ GLOBAL_DATUM(the_gateway, /obj/machinery/gateway/centerstation) ready = TRUE return ready -/obj/machinery/gateway/update_icon() - if(active) - icon_state = "on" - return - icon_state = "off" +/obj/machinery/gateway/update_icon_state() + icon_state = active ? "on" : "off" /obj/machinery/gateway/attack_hand(mob/user) . = ..() @@ -100,11 +97,8 @@ GLOBAL_DATUM(the_gateway, /obj/machinery/gateway/centerstation) var/obj/machinery/gateway/centeraway/awaygate = null can_link = TRUE -/obj/machinery/gateway/centerstation/update_icon() - if(active) - icon_state = "oncenter" - return - icon_state = "offcenter" +/obj/machinery/gateway/centerstation/update_icon_state() + icon_state = active ? "oncenter" : "offcenter" /obj/machinery/gateway/centerstation/process() if((stat & (NOPOWER)) && use_power) @@ -185,11 +179,8 @@ GLOBAL_DATUM(the_gateway, /obj/machinery/gateway/centerstation) stationgate = locate(/obj/machinery/gateway/centerstation) -/obj/machinery/gateway/centeraway/update_icon() - if(active) - icon_state = "oncenter" - return - icon_state = "offcenter" +/obj/machinery/gateway/centeraway/update_icon_state() + icon_state = active ? "oncenter" : "offcenter" /obj/machinery/gateway/centeraway/toggleon(mob/user) if(!detect()) diff --git a/code/modules/awaymissions/mission_code/Academy.dm b/code/modules/awaymissions/mission_code/Academy.dm index f24cb065dd..a1453f6aa1 100644 --- a/code/modules/awaymissions/mission_code/Academy.dm +++ b/code/modules/awaymissions/mission_code/Academy.dm @@ -337,8 +337,9 @@ icon_state = "1" color = rgb(0,0,255) -/obj/structure/ladder/unbreakable/rune/update_icon() - return +/obj/structure/ladder/unbreakable/rune/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_blocker) /obj/structure/ladder/unbreakable/rune/show_fluff_message(up,mob/user) user.visible_message("[user] activates \the [src].","You activate \the [src].") diff --git a/code/modules/awaymissions/pamphlet.dm b/code/modules/awaymissions/pamphlet.dm index 7cbbde096d..74bcb4b302 100644 --- a/code/modules/awaymissions/pamphlet.dm +++ b/code/modules/awaymissions/pamphlet.dm @@ -35,5 +35,6 @@ environs." //we don't want the silly text overlay! -/obj/item/paper/pamphlet/update_icon() - return +/obj/item/paper/pamphlet/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_blocker) diff --git a/code/modules/buildmode/buttons.dm b/code/modules/buildmode/buttons.dm index e72dbde064..c219f18cec 100644 --- a/code/modules/buildmode/buttons.dm +++ b/code/modules/buildmode/buttons.dm @@ -27,7 +27,7 @@ update_icon() return 1 -/obj/screen/buildmode/mode/update_icon() +/obj/screen/buildmode/mode/update_icon_state() icon_state = bd.mode.get_button_iconstate() /obj/screen/buildmode/help @@ -44,9 +44,8 @@ screen_loc = "NORTH,WEST+2" name = "Change Dir" -/obj/screen/buildmode/bdir/update_icon() +/obj/screen/buildmode/bdir/update_icon_state() dir = bd.build_dir - return /obj/screen/buildmode/bdir/Click() bd.toggle_dirswitch() diff --git a/code/modules/cargo/supplypod.dm b/code/modules/cargo/supplypod.dm index e82a2141eb..aaa1afb004 100644 --- a/code/modules/cargo/supplypod.dm +++ b/code/modules/cargo/supplypod.dm @@ -78,15 +78,14 @@ . = ..() setStyle(style, TRUE) //Upon initialization, give the supplypod an iconstate, name, and description based on the "style" variable. This system is important for the centcom_podlauncher to function correctly -/obj/structure/closet/supplypod/update_icon() - cut_overlays() +/obj/structure/closet/supplypod/closet_update_overlays(list/new_overlays) + . = new_overlays if (style == STYLE_SEETHROUGH || style == STYLE_INVISIBLE) //If we're invisible, we dont bother adding any overlays return + if (opened) + . += "[icon_state]_open" else - if (opened) - add_overlay("[icon_state]_open") - else - add_overlay("[icon_state]_door") + . += "[icon_state]_door" /obj/structure/closet/supplypod/proc/setStyle(chosenStyle, var/duringInit = FALSE) //Used to give the sprite an icon state, name, and description if (!duringInit && style == chosenStyle) //Check if the input style is already the same as the pod's style. This happens in centcom_podlauncher, and as such we set the style to STYLE_CENTCOM. diff --git a/code/modules/cargo/supplypod_beacon.dm b/code/modules/cargo/supplypod_beacon.dm index 668698d2e9..b749d4def6 100644 --- a/code/modules/cargo/supplypod_beacon.dm +++ b/code/modules/cargo/supplypod_beacon.dm @@ -31,14 +31,14 @@ ready = FALSE update_icon() -/obj/item/supplypod_beacon/update_icon() - cut_overlays() +/obj/item/supplypod_beacon/update_overlays() + . = ..() if (launched) - add_overlay("sp_green") + . += "sp_green" else if (ready) - add_overlay("sp_yellow") + . += "sp_yellow" else if (linked) - add_overlay("sp_orange") + . += "sp_orange" /obj/item/supplypod_beacon/proc/endLaunch() launched = FALSE diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index ef2ee331a9..7e2d73190a 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -441,17 +441,14 @@ BLIND // can't see anything return TRUE -/obj/item/clothing/update_icon() // Polychrome stuff - ..() +/obj/item/clothing/update_overlays() // Polychrome stuff + . = ..() if(hasprimary) //Checks if the overlay is enabled - var/mutable_appearance/primary_overlay = mutable_appearance(icon, "[item_color]-primary") //Automagically picks overlays - primary_overlay.color = primary_color //Colors the greyscaled overlay - add_overlay(primary_overlay) //Applies the coloured overlay onto the item sprite. but NOT the mob sprite. + var/mutable_appearance/primary_overlay = mutable_appearance(icon, "[item_color]-primary", color = primary_color) //Automagically picks overlays + . += primary_overlay //Applies the coloured overlay onto the item sprite. but NOT the mob sprite. if(hassecondary) - var/mutable_appearance/secondary_overlay = mutable_appearance(icon, "[item_color]-secondary") - secondary_overlay.color = secondary_color - add_overlay(secondary_overlay) + var/mutable_appearance/secondary_overlay = mutable_appearance(icon, "[item_color]-secondary", color = secondary_color) + . += secondary_overlay if(hastertiary) - var/mutable_appearance/tertiary_overlay = mutable_appearance(icon, "[item_color]-tertiary") - tertiary_overlay.color = tertiary_color - add_overlay(tertiary_overlay) \ No newline at end of file + var/mutable_appearance/tertiary_overlay = mutable_appearance(icon, "[item_color]-tertiary", color = tertiary_color) + . += tertiary_overlay \ No newline at end of file diff --git a/code/modules/clothing/ears/_ears.dm b/code/modules/clothing/ears/_ears.dm index 6775279ef6..1c31e19202 100644 --- a/code/modules/clothing/ears/_ears.dm +++ b/code/modules/clothing/ears/_ears.dm @@ -35,16 +35,15 @@ . = ..() update_icon() -/obj/item/clothing/ears/headphones/update_icon() +/obj/item/clothing/ears/headphones/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_updates_onmob) + +/obj/item/clothing/ears/headphones/update_icon_state() icon_state = "[initial(icon_state)]_[headphones_on? "on" : "off"]" item_state = "[initial(item_state)]_[headphones_on? "on" : "off"]" /obj/item/clothing/ears/headphones/proc/toggle(owner) headphones_on = !headphones_on update_icon() - var/mob/living/carbon/human/H = owner - if(istype(H)) - H.update_inv_ears() - H.update_inv_neck() - H.update_inv_head() to_chat(owner, "You turn the music [headphones_on? "on. Untz Untz Untz!" : "off."]") diff --git a/code/modules/clothing/glasses/engine_goggles.dm b/code/modules/clothing/glasses/engine_goggles.dm index 0132fa8596..2a64445776 100644 --- a/code/modules/clothing/glasses/engine_goggles.dm +++ b/code/modules/clothing/glasses/engine_goggles.dm @@ -31,6 +31,10 @@ START_PROCESSING(SSobj, src) update_icon() +/obj/item/clothing/glasses/meson/engine/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_updates_onmob) + /obj/item/clothing/glasses/meson/engine/Destroy() STOP_PROCESSING(SSobj, src) return ..() @@ -120,18 +124,8 @@ pic = new('icons/turf/overlays.dmi', place, "redOverlay", AREA_LAYER) flick_overlay(pic, list(user.client), 8) -/obj/item/clothing/glasses/meson/engine/update_icon() +/obj/item/clothing/glasses/meson/engine/update_icon_state() icon_state = "trayson-[mode]" - update_mob() - -/obj/item/clothing/glasses/meson/engine/proc/update_mob() - item_state = icon_state - if(isliving(loc)) - var/mob/living/user = loc - if(user.get_item_by_slot(SLOT_GLASSES) == src) - user.update_inv_glasses() - else - user.update_inv_hands() /obj/item/clothing/glasses/meson/engine/tray //atmos techs have lived far too long without tray goggles while those damned engineers get their dual-purpose gogles all to themselves name = "optical t-ray scanner" diff --git a/code/modules/clothing/head/hardhat.dm b/code/modules/clothing/head/hardhat.dm index e7a8243889..29b0aa9552 100644 --- a/code/modules/clothing/head/hardhat.dm +++ b/code/modules/clothing/head/hardhat.dm @@ -16,6 +16,11 @@ dog_fashion = /datum/dog_fashion/head + +/obj/item/clothing/head/hardhat/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_updates_onmob) + /obj/item/clothing/head/hardhat/attack_self(mob/living/user) toggle_helmet_light(user) @@ -27,15 +32,9 @@ turn_off(user) update_icon() -/obj/item/clothing/head/hardhat/update_icon() +/obj/item/clothing/head/hardhat/update_icon_state() icon_state = "hardhat[on]_[item_color]" item_state = "hardhat[on]_[item_color]" - if(ishuman(loc)) - var/mob/living/carbon/human/H = loc - H.update_inv_head() - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtonIcon(force = TRUE) /obj/item/clothing/head/hardhat/proc/turn_on(mob/user) set_light(brightness_on, power_on) @@ -132,11 +131,10 @@ if(!up) . += mutable_appearance('icons/mob/head.dmi', "weldvisor") -/obj/item/clothing/head/hardhat/weldhat/update_icon() - cut_overlays() +/obj/item/clothing/head/hardhat/weldhat/update_overlays() + . = ..() if(!up) - add_overlay("weldvisor") - ..() + . += "weldvisor" /obj/item/clothing/head/hardhat/weldhat/orange icon_state = "hardhat0_orange" diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index e176943aa9..3b1b92ea78 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -258,7 +258,11 @@ //LightToggle -/obj/item/clothing/head/helmet/update_icon() +/obj/item/clothing/head/helment/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_updates_onmob) + +/obj/item/clothing/head/helmet/update_icon_state() var/state = "[initial(icon_state)]" if(F) if(F.on) @@ -268,10 +272,6 @@ icon_state = state - if(ishuman(loc)) - var/mob/living/carbon/human/H = loc - H.update_inv_head() - /obj/item/clothing/head/helmet/ui_action_click(mob/user, action) if(istype(action, /datum/action/item_action/toggle_helmet_flashlight)) toggle_helmlight() diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index 4be949a65e..0b58ea234c 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -197,16 +197,19 @@ . = ..() update_icon() -/obj/item/clothing/head/wig/update_icon() - cut_overlays() +/obj/item/clothing/head/wig/update_icon_state() var/datum/sprite_accessory/S = GLOB.hair_styles_list[hair_style] if(!S) + icon = 'icons/obj/clothing/hats.dmi' icon_state = "pwig" - else - var/mutable_appearance/M = mutable_appearance(S.icon,S.icon_state) + +/obj/item/clothing/head/wig/update_overlays() + . = ..() + var/datum/sprite_accessory/S = GLOB.hair_styles_list[hair_style] + if(S) + var/mutable_appearance/M = mutable_appearance(S.icon, S.icon_state, color = hair_color) M.appearance_flags |= RESET_COLOR - M.color = hair_color - add_overlay(M) + . += M /obj/item/clothing/head/wig/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE) . = list() diff --git a/code/modules/clothing/shoes/bananashoes.dm b/code/modules/clothing/shoes/bananashoes.dm index ffb7771d2f..08f12deb1f 100644 --- a/code/modules/clothing/shoes/bananashoes.dm +++ b/code/modules/clothing/shoes/bananashoes.dm @@ -10,11 +10,15 @@ /obj/item/clothing/shoes/clown_shoes/banana_shoes/Initialize() . = ..() - AddComponent(/datum/component/material_container, list(/datum/material/bananium), 200000, TRUE, /obj/item/stack) - AddComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg'=1), 75) if(always_noslip) clothing_flags |= NOSLIP +/obj/item/clothing/shoes/clown_shoes/banana_shoes/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_updates_onmob) + AddComponent(/datum/component/material_container, list(/datum/material/bananium), 200000, TRUE, /obj/item/stack) + AddComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg'=1), 75) + /obj/item/clothing/shoes/clown_shoes/banana_shoes/step_action() . = ..() var/datum/component/material_container/bananium = GetComponent(/datum/component/material_container) @@ -55,12 +59,5 @@ else to_chat(user, "You need bananium to turn the prototype shoes on!") -/obj/item/clothing/shoes/clown_shoes/banana_shoes/update_icon() - if(on) - icon_state = "clown_prototype_on" - else - icon_state = "clown_prototype_off" - usr.update_inv_shoes() - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtonIcon() +/obj/item/clothing/shoes/clown_shoes/banana_shoes/update_icon_state() + icon_state = "clown_prototype_[on? "on" : "off"]" \ No newline at end of file diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index d9e4f17649..59c9ea19ec 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -275,7 +275,7 @@ visor_flags_inv = HIDEMASK|HIDEEYES|HIDEFACE|HIDEFACIALHAIR visor_flags = STOPSPRESSUREDAMAGE -/obj/item/clothing/head/helmet/space/hardsuit/syndi/update_icon() +/obj/item/clothing/head/helmet/space/hardsuit/syndi/update_icon_state() icon_state = "hardsuit[on]-[item_color]" /obj/item/clothing/head/helmet/space/hardsuit/syndi/Initialize() @@ -946,15 +946,9 @@ var/datum/action/A = X A.UpdateButtonIcon() -/obj/item/clothing/head/helmet/space/hardsuit/lavaknight/update_icon() - var/mutable_appearance/helm_overlay = mutable_appearance(icon, "knight_cydonia_overlay") - - if(energy_color) - helm_overlay.color = energy_color - - cut_overlays() //So that it doesn't keep stacking overlays non-stop on top of each other - - add_overlay(helm_overlay) +/obj/item/clothing/head/helmet/space/hardsuit/lavaknight/update_overlays() + . = ..() + . += mutable_appearance(icon, "knight_cydonia_overlay", color = energy_color) /obj/item/clothing/head/helmet/space/hardsuit/lavaknight/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE) . = ..() @@ -983,15 +977,9 @@ set_light(1) update_icon() -/obj/item/clothing/suit/space/hardsuit/lavaknight/update_icon() - var/mutable_appearance/suit_overlay = mutable_appearance(icon, "knight_cydonia_overlay") - - if(energy_color) - suit_overlay.color = energy_color - - cut_overlays() //So that it doesn't keep stacking overlays non-stop on top of each other - - add_overlay(suit_overlay) +/obj/item/clothing/suit/space/hardsuit/lavaknight/update_overlays() + . = ..() + . += mutable_appearance(icon, "knight_cydonia_overlay", color = energy_color) /obj/item/clothing/suit/space/hardsuit/lavaknight/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE) . = ..() diff --git a/code/modules/events/pirates.dm b/code/modules/events/pirates.dm index ab9ab96678..47cde0899b 100644 --- a/code/modules/events/pirates.dm +++ b/code/modules/events/pirates.dm @@ -157,7 +157,7 @@ active = FALSE STOP_PROCESSING(SSobj,src) -/obj/machinery/shuttle_scrambler/update_icon() +/obj/machinery/shuttle_scrambler/update_icon_state() if(active) icon_state = "dominator-blue" else diff --git a/code/modules/food_and_drinks/food/customizables.dm b/code/modules/food_and_drinks/food/customizables.dm index 2a313361c4..bd20ad8d69 100644 --- a/code/modules/food_and_drinks/food/customizables.dm +++ b/code/modules/food_and_drinks/food/customizables.dm @@ -318,14 +318,17 @@ ..() update_icon() -/obj/item/reagent_containers/glass/bowl/update_icon() - cut_overlays() + +/obj/item/reagent_containers/glass/bowl/update_icon_state() + if(!reagents || !reagents.total_volume) + icon_state = "bowl" + +/obj/item/reagent_containers/glass/bowl/update_overlays() + . = ..() if(reagents && reagents.total_volume) var/mutable_appearance/filling = mutable_appearance('icons/obj/food/soupsalad.dmi', "fullbowl") filling.color = mix_color_from_reagents(reagents.reagent_list) - add_overlay(filling) - else - icon_state = "bowl" + . += filling #undef INGREDIENTS_FILL #undef INGREDIENTS_SCATTER diff --git a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm index 24f60300fa..1b3561b0e6 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm @@ -38,18 +38,18 @@ if(M.rating >= 2) . += "Gibber has been upgraded to process inorganic materials." -/obj/machinery/gibber/update_icon() - cut_overlays() +/obj/machinery/gibber/update_overlays() + . = ..() if (dirty) - add_overlay("grbloody") + . += "grbloody" if(stat & (NOPOWER|BROKEN)) return if (!occupant) - add_overlay("grjam") + . += "grjam" else if (operating) - add_overlay("gruse") + . += "gruse" else - add_overlay("gridle") + . += "gridle" /obj/machinery/gibber/attack_paw(mob/user) return attack_hand(user) diff --git a/code/modules/food_and_drinks/kitchen_machinery/grill.dm b/code/modules/food_and_drinks/kitchen_machinery/grill.dm index c52389cd56..547ed244c0 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/grill.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/grill.dm @@ -15,7 +15,7 @@ . = ..() grill_loop = new(list(src), FALSE) -/obj/machinery/grill/update_icon() +/obj/machinery/grill/update_icon_state() if(grilled_item) icon_state = "grill" else if(grill_fuel) diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm index 24dd99e5e0..2adff414e8 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm @@ -85,7 +85,7 @@ . += "- Capacity: [max_n_of_items] items." . += "- Cook time reduced by [(efficiency - 1) * 25]%." -/obj/machinery/microwave/update_icon() +/obj/machinery/microwave/update_icon_state() if(broken) icon_state = "mwb" else if(dirty_anim_playing) diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm index 7619f68448..67a636eb9c 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm @@ -42,7 +42,7 @@ ..() update_icon() -/obj/machinery/smartfridge/update_icon() +/obj/machinery/smartfridge/update_icon_state() if(!stat) if(visible_contents) switch(contents.len) @@ -289,13 +289,12 @@ ..() update_icon() -/obj/machinery/smartfridge/drying_rack/update_icon() - ..() - cut_overlays() +/obj/machinery/smartfridge/drying_rack/update_overlays() + . = ..() if(drying) - add_overlay("drying_rack_drying") + . += "drying_rack_drying" if(contents.len) - add_overlay("drying_rack_filled") + . += "drying_rack_filled" /obj/machinery/smartfridge/drying_rack/process() ..() diff --git a/code/modules/games/cas.dm b/code/modules/games/cas.dm index 4fbb931b32..77db8dbe3f 100644 --- a/code/modules/games/cas.dm +++ b/code/modules/games/cas.dm @@ -93,7 +93,7 @@ qdel(SC) update_icon() -/obj/item/toy/cards/deck/cas/update_icon() +/obj/item/toy/cards/deck/cas/update_icon_state() if(cards.len < 26) icon_state = "deck_[deckstyle]_low" @@ -136,7 +136,7 @@ Flip() return TRUE -/obj/item/toy/cards/singlecard/cas/update_icon() +/obj/item/toy/cards/singlecard/cas/update_icon_state() if(flipped) icon_state = "[card_face]_flipped" else diff --git a/code/modules/holodeck/items.dm b/code/modules/holodeck/items.dm index e6aed7a8ca..884769ebd4 100644 --- a/code/modules/holodeck/items.dm +++ b/code/modules/holodeck/items.dm @@ -196,7 +196,7 @@ if(numbuttons == numready) begin_event() -/obj/machinery/readybutton/update_icon() +/obj/machinery/readybutton/update_icon_state() if(ready) icon_state = "auth_on" else diff --git a/code/modules/hydroponics/beekeeping/honeycomb.dm b/code/modules/hydroponics/beekeeping/honeycomb.dm index 5bb2936c1e..1a3e1bc1be 100644 --- a/code/modules/hydroponics/beekeeping/honeycomb.dm +++ b/code/modules/hydroponics/beekeeping/honeycomb.dm @@ -20,13 +20,13 @@ update_icon() -/obj/item/reagent_containers/honeycomb/update_icon() - cut_overlays() +/obj/item/reagent_containers/honeycomb/update_overlays() + . = ..() var/mutable_appearance/honey_overlay = mutable_appearance(icon, "honey") if(honey_color) honey_overlay.icon_state = "greyscale_honey" honey_overlay.color = honey_color - add_overlay(honey_overlay) + . += honey_overlay /obj/item/reagent_containers/honeycomb/proc/set_reagent(reagent) diff --git a/code/modules/hydroponics/biogenerator.dm b/code/modules/hydroponics/biogenerator.dm index f7715e7320..6a3fd56208 100644 --- a/code/modules/hydroponics/biogenerator.dm +++ b/code/modules/hydroponics/biogenerator.dm @@ -61,7 +61,7 @@ /obj/machinery/biogenerator/on_reagent_change(changetype) //When the reagents change, change the icon as well. update_icon() -/obj/machinery/biogenerator/update_icon() +/obj/machinery/biogenerator/update_icon_state() if(panel_open) icon_state = "biogen-empty-o" else if(!src.beaker) diff --git a/code/modules/hydroponics/fermenting_barrel.dm b/code/modules/hydroponics/fermenting_barrel.dm index ab6625b46d..1c31113332 100644 --- a/code/modules/hydroponics/fermenting_barrel.dm +++ b/code/modules/hydroponics/fermenting_barrel.dm @@ -64,7 +64,7 @@ to_chat(user, "You close [src], letting you draw from its tap.") update_icon() -/obj/structure/fermenting_barrel/update_icon() +/obj/structure/fermenting_barrel/update_icon_state() if(open) icon_state = "barrel_open" else diff --git a/code/modules/hydroponics/gene_modder.dm b/code/modules/hydroponics/gene_modder.dm index fe6d13f69e..4e545c13ee 100644 --- a/code/modules/hydroponics/gene_modder.dm +++ b/code/modules/hydroponics/gene_modder.dm @@ -53,17 +53,18 @@ min_wchance = 0 min_wrate = 0 -/obj/machinery/plantgenes/update_icon() - ..() - cut_overlays() +/obj/machinery/plantgenes/update_icon_state() if((stat & (BROKEN|NOPOWER))) icon_state = "dnamod-off" else icon_state = "dnamod" + +/obj/machinery/plantgenes/update_overlays() + . = ..() if(seed) - add_overlay("dnamod-dna") + . += "dnamod-dna" if(panel_open) - add_overlay("dnamod-open") + . += "dnamod-open" /obj/machinery/plantgenes/attackby(obj/item/I, mob/user, params) if(default_deconstruction_screwdriver(user, "dnamod", "dnamod", I)) diff --git a/code/modules/integrated_electronics/core/assemblies.dm b/code/modules/integrated_electronics/core/assemblies.dm index 2a0cf8c334..9026c45f82 100644 --- a/code/modules/integrated_electronics/core/assemblies.dm +++ b/code/modules/integrated_electronics/core/assemblies.dm @@ -305,17 +305,17 @@ /obj/item/electronic_assembly/proc/can_move() return FALSE -/obj/item/electronic_assembly/update_icon() +/obj/item/electronic_assembly/update_icon_state() if(opened) icon_state = initial(icon_state) + "-open" else icon_state = initial(icon_state) - cut_overlays() + +/obj/item/electronic_assembly/update_overlays() + . = ..() if(detail_color == COLOR_ASSEMBLY_BLACK) //Black colored overlay looks almost but not exactly like the base sprite, so just cut the overlay and avoid it looking kinda off. return - var/mutable_appearance/detail_overlay = mutable_appearance('icons/obj/assemblies/electronic_setups.dmi', "[icon_state]-color") - detail_overlay.color = detail_color - add_overlay(detail_overlay) + . += mutable_appearance('icons/obj/assemblies/electronic_setups.dmi', "[icon_state]-color", color = detail_color) /obj/item/electronic_assembly/proc/return_total_complexity() . = 0 diff --git a/code/modules/integrated_electronics/core/detailer.dm b/code/modules/integrated_electronics/core/detailer.dm index 52739c7940..9720bccfe5 100644 --- a/code/modules/integrated_electronics/core/detailer.dm +++ b/code/modules/integrated_electronics/core/detailer.dm @@ -34,18 +34,17 @@ .=..() update_icon() -/obj/item/integrated_electronics/detailer/update_icon() - cut_overlays() - var/mutable_appearance/detail_overlay = mutable_appearance('icons/obj/assemblies/electronic_tools.dmi', "detailer-color") - detail_overlay.color = detail_color - add_overlay(detail_overlay) +/obj/item/integrated_electronics/detailer/update_overlays() + . = ..() + . += mutable_appearance('icons/obj/assemblies/electronic_tools.dmi', "detailer-color", color = detail_color) + /obj/item/integrated_electronics/detailer/attack_self(mob/user) var/color_choice = input(user, "Select color.", "Assembly Detailer") as null|anything in color_list if(!color_list[color_choice]) return if(!in_range(src, user)) - return + return if(color_choice == "custom") detail_color = input(user,"","Choose Color",detail_color) as color|null else diff --git a/code/modules/integrated_electronics/core/wirer.dm b/code/modules/integrated_electronics/core/wirer.dm index 9550f9b4ae..95f46564cb 100644 --- a/code/modules/integrated_electronics/core/wirer.dm +++ b/code/modules/integrated_electronics/core/wirer.dm @@ -15,7 +15,7 @@ var/datum/integrated_io/selected_io = null var/mode = WIRE -/obj/item/integrated_electronics/wirer/update_icon() +/obj/item/integrated_electronics/wirer/update_icon_state() icon_state = "wirer-[mode]" /obj/item/integrated_electronics/wirer/proc/wire(var/datum/integrated_io/io, mob/user) @@ -27,7 +27,7 @@ selected_io = io to_chat(user, "You attach a data wire to \the [selected_io.holder]'s [selected_io.name] data channel.") mode = WIRING - update_icon() + update_icon() if(WIRING) if(io == selected_io) to_chat(user, "Wiring \the [selected_io.holder]'s [selected_io.name] into itself is rather pointless.") diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm index bfd0ae03cb..89fa3ac6cf 100644 --- a/code/modules/library/lib_items.dm +++ b/code/modules/library/lib_items.dm @@ -147,11 +147,8 @@ qdel(src) -/obj/structure/bookcase/update_icon() - if(contents.len < 5) - icon_state = "book-[contents.len]" - else - icon_state = "book-5" +/obj/structure/bookcase/update_icon_state() + icon_state = "book-[min(length(contents), 5)]" /obj/structure/bookcase/manuals/medical diff --git a/code/modules/mining/equipment/explorer_gear.dm b/code/modules/mining/equipment/explorer_gear.dm index 5165d95340..e83ac26153 100644 --- a/code/modules/mining/equipment/explorer_gear.dm +++ b/code/modules/mining/equipment/explorer_gear.dm @@ -110,12 +110,12 @@ AddComponent(/datum/component/spraycan_paintable) update_icon() -/obj/item/clothing/head/helmet/space/hostile_environment/update_icon() - ..() - cut_overlays() + +/obj/item/clothing/head/helmet/space/hostile_environment/update_overlays() + . = ..() var/mutable_appearance/glass_overlay = mutable_appearance(icon, "hostile_env_glass") glass_overlay.appearance_flags = RESET_COLOR - add_overlay(glass_overlay) + . += glass_overlay /obj/item/clothing/head/helmet/space/hostile_environment/worn_overlays(isinhands, icon_file, style_flags = NONE) . = ..() diff --git a/code/modules/mining/equipment/kinetic_crusher.dm b/code/modules/mining/equipment/kinetic_crusher.dm index d4b86d5138..b515ebbc13 100644 --- a/code/modules/mining/equipment/kinetic_crusher.dm +++ b/code/modules/mining/equipment/kinetic_crusher.dm @@ -155,19 +155,16 @@ else set_light(0) -/obj/item/twohanded/kinetic_crusher/update_icon() - ..() - cut_overlays() - if(!charged) - add_overlay("[icon_state]_uncharged") - if(light_on) - add_overlay("[icon_state]_lit") - spawn(1) - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtonIcon() +/obj/item/twohanded/kinetic_crusher/update_icon_state() item_state = "crusher[wielded]" +/obj/item/twohanded/kinetic_crusher/update_overlays() + . = ..() + if(!charged) + . += "[icon_state]_uncharged" + if(light_on) + . += "[icon_state]_lit" + //destablizing force /obj/item/projectile/destabilizer name = "destabilizing force" diff --git a/code/modules/mining/equipment/marker_beacons.dm b/code/modules/mining/equipment/marker_beacons.dm index 9d595664ff..8853a56911 100644 --- a/code/modules/mining/equipment/marker_beacons.dm +++ b/code/modules/mining/equipment/marker_beacons.dm @@ -40,7 +40,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, list( . += "Use in-hand to place a [singular_name]." . += "Alt-click to select a color. Current color is [picked_color]." -/obj/item/stack/marker_beacon/update_icon() +/obj/item/stack/marker_beacon/update_icon_state() icon_state = "[initial(icon_state)][lowertext(picked_color)]" /obj/item/stack/marker_beacon/attack_self(mob/user) diff --git a/code/modules/mining/equipment/regenerative_core.dm b/code/modules/mining/equipment/regenerative_core.dm index e8ba72e62f..ae451ba1a8 100644 --- a/code/modules/mining/equipment/regenerative_core.dm +++ b/code/modules/mining/equipment/regenerative_core.dm @@ -129,14 +129,13 @@ . = ..() update_icon() -/obj/item/organ/regenerative_core/update_icon() +/obj/item/organ/regenerative_core/update_icon_state() icon_state = inert ? "legion_soul_inert" : "legion_soul" - cut_overlays() + +/obj/item/organ/regenerative_core/update_overlays() + . = ..() if(!inert && !preserved) - add_overlay("legion_soul_crackle") - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtonIcon() + . += "legion_soul_crackle" /obj/item/organ/regenerative_core/legion/go_inert() ..() diff --git a/code/modules/mining/equipment/survival_pod.dm b/code/modules/mining/equipment/survival_pod.dm index 68e70dc882..b9f85a5c8f 100644 --- a/code/modules/mining/equipment/survival_pod.dm +++ b/code/modules/mining/equipment/survival_pod.dm @@ -139,11 +139,10 @@ icon = 'icons/obj/lavaland/survival_pod.dmi' icon_state = "sleeper" -/obj/machinery/sleeper/survival_pod/update_icon() - if(state_open) - cut_overlays() - else - add_overlay("sleeper_cover") +/obj/machinery/sleeper/survival_pod/update_overlays() + . = ..() + if(!state_open) + . += "sleeper_cover" //Computer /obj/item/gps/computer @@ -190,8 +189,9 @@ flags_1 = NODECONSTRUCT_1 var/empty = FALSE -/obj/machinery/smartfridge/survival_pod/update_icon() - return +/obj/machinery/stasis/survival_pod/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_blocker) /obj/machinery/smartfridge/survival_pod/Initialize(mapload) . = ..() diff --git a/code/modules/mining/lavaland/ash_flora.dm b/code/modules/mining/lavaland/ash_flora.dm index 43c8dec129..38830fd824 100644 --- a/code/modules/mining/lavaland/ash_flora.dm +++ b/code/modules/mining/lavaland/ash_flora.dm @@ -201,15 +201,15 @@ icon = 'icons/obj/lavaland/ash_flora.dmi' icon_state = "mushroom_bowl" -/obj/item/reagent_containers/glass/bowl/mushroom_bowl/update_icon() - cut_overlays() - if(reagents && reagents.total_volume) - var/mutable_appearance/filling = mutable_appearance('icons/obj/lavaland/ash_flora.dmi', "fullbowl") - filling.color = mix_color_from_reagents(reagents.reagent_list) - add_overlay(filling) - else +/obj/item/reagent_containers/glass/bowl/mushroom_bowl/update_icon_state() + if(!reagents || !reagents.total_volume) icon_state = "mushroom_bowl" +/obj/item/reagent_containers/glass/bowl/mushroom_bowl/update_overlays() + . = ..() + if(reagents && reagents.total_volume) + . += mutable_appearance('icons/obj/lavaland/ash_flora.dmi', "fullbowl", color = mix_color_from_reagents(reagents.reagent_list)) + /obj/item/reagent_containers/glass/bowl/mushroom_bowl/attackby(obj/item/I,mob/user, params) if(istype(I, /obj/item/reagent_containers/food/snacks)) var/obj/item/reagent_containers/food/snacks/S = I diff --git a/code/modules/mining/lavaland/necropolis_chests.dm b/code/modules/mining/lavaland/necropolis_chests.dm index 343083456d..5faa465b8c 100644 --- a/code/modules/mining/lavaland/necropolis_chests.dm +++ b/code/modules/mining/lavaland/necropolis_chests.dm @@ -561,7 +561,7 @@ desc = "A flask with an almost-holy aura emitting from it. The label on the bottle says: 'erqo'hyy tvi'rf lbh jv'atf'." list_reagents = list(/datum/reagent/flightpotion = 5) -/obj/item/reagent_containers/glass/bottle/potion/update_icon() +/obj/item/reagent_containers/glass/bottle/potion/update_icon_state() if(reagents.total_volume) icon_state = "potionflask" else @@ -1072,6 +1072,10 @@ var/teleporting = FALSE //if we ARE teleporting var/friendly_fire_check = FALSE //if the blasts we make will consider our faction against the faction of hit targets +/obj/item/hierophant_club/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_updates_onmob) + /obj/item/hierophant_club/examine(mob/user) . = ..() . += "The[beacon ? " beacon is not currently":"re is a beacon"] attached." @@ -1134,13 +1138,8 @@ chaser_speed = max(chaser_speed + health_percent, 0.5) //one tenth of a second faster for each missing 10% of health blast_range -= round(health_percent * 10) //one additional range for each missing 10% of health -/obj/item/hierophant_club/update_icon() - icon_state = "hierophant_club[timer <= world.time ? "_ready":""][(beacon && !QDELETED(beacon)) ? "":"_beacon"]" - item_state = icon_state - if(ismob(loc)) - var/mob/M = loc - M.update_inv_hands() - M.update_inv_back() +/obj/item/hierophant_club/update_icon_state() + icon_state = item_state = "hierophant_club[timer <= world.time ? "_ready":""][(beacon && !QDELETED(beacon)) ? "":"_beacon"]" /obj/item/hierophant_club/proc/prepare_icon_update() update_icon() diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 0f0ca8bf0c..2f6e8a9b7c 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -341,9 +341,8 @@ ..() update_icon() -/obj/machinery/mineral/ore_redemption/update_icon() +/obj/machinery/mineral/ore_redemption/update_icon_state() if(powered()) icon_state = initial(icon_state) else icon_state = "[initial(icon_state)]-off" - return diff --git a/code/modules/mining/machine_vending.dm b/code/modules/mining/machine_vending.dm index 78b1a665db..dd3b13d8dd 100644 --- a/code/modules/mining/machine_vending.dm +++ b/code/modules/mining/machine_vending.dm @@ -87,7 +87,7 @@ ..() update_icon() -/obj/machinery/mineral/equipment_vendor/update_icon() +/obj/machinery/mineral/equipment_vendor/update_icon_state() if(powered()) icon_state = initial(icon_state) else diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm index 4f9bad2f0f..c7c34b0389 100644 --- a/code/modules/mining/ores_coins.dm +++ b/code/modules/mining/ores_coins.dm @@ -20,25 +20,24 @@ mats_per_stack = MINERAL_MATERIAL_AMOUNT var/list/stack_overlays -/obj/item/stack/ore/update_icon() +/obj/item/stack/ore/update_overlays() + . = ..() var/difference = min(ORESTACK_OVERLAYS_MAX, amount) - (LAZYLEN(stack_overlays)+1) if(difference == 0) return else if(difference < 0 && LAZYLEN(stack_overlays)) //amount < stack_overlays, remove excess. - cut_overlays() if (LAZYLEN(stack_overlays)-difference <= 0) - stack_overlays = null; + stack_overlays = null else stack_overlays.len += difference else if(difference > 0) //amount > stack_overlays, add some. - cut_overlays() for(var/i in 1 to difference) var/mutable_appearance/newore = mutable_appearance(icon, icon_state) newore.pixel_x = rand(-8,8) newore.pixel_y = rand(-8,8) LAZYADD(stack_overlays, newore) if (stack_overlays) - add_overlay(stack_overlays) + . += stack_overlays /obj/item/stack/ore/welder_act(mob/living/user, obj/item/I) if(!refined_type) diff --git a/code/modules/mining/point_bank.dm b/code/modules/mining/point_bank.dm index 8d0bb4e1e4..11f23a5d7c 100644 --- a/code/modules/mining/point_bank.dm +++ b/code/modules/mining/point_bank.dm @@ -41,9 +41,8 @@ ..() update_icon() -/obj/machinery/point_bank/update_icon() +/obj/machinery/point_bank/update_icon_state() if(powered()) icon_state = initial(icon_state) else icon_state = "[initial(icon_state)]-off" - return \ No newline at end of file diff --git a/code/modules/mob/living/brain/MMI.dm b/code/modules/mob/living/brain/MMI.dm index 2a57506df6..77844a4788 100644 --- a/code/modules/mob/living/brain/MMI.dm +++ b/code/modules/mob/living/brain/MMI.dm @@ -14,20 +14,20 @@ var/force_replace_ai_name = FALSE var/overrides_aicore_laws = FALSE // Whether the laws on the MMI, if any, override possible pre-existing laws loaded on the AI core. -/obj/item/mmi/update_icon() +/obj/item/mmi/update_icon_state() if(!brain) icon_state = "mmi_off" - return - if(istype(brain, /obj/item/organ/brain/alien)) + else if(istype(brain, /obj/item/organ/brain/alien)) icon_state = "mmi_brain_alien" - braintype = "Xenoborg" //HISS....Beep. else icon_state = "mmi_brain" - braintype = "Cyborg" + +/obj/item/mmi/update_overlays() + . = ..() if(brainmob && brainmob.stat != DEAD) - add_overlay("mmi_alive") + . += "mmi_alive" else - add_overlay("mmi_dead") + . += "mmi_dead" /obj/item/mmi/Initialize() . = ..() @@ -68,6 +68,10 @@ name = "Man-Machine Interface: [brainmob.real_name]" update_icon() + if(istype(brain, /obj/item/organ/brain/alien)) + braintype = "Xenoborg" //HISS....Beep. + else + braintype = "Cyborg" SSblackbox.record_feedback("amount", "mmis_filled", 1) @@ -85,7 +89,7 @@ to_chat(user, "You unlock and upend the MMI, spilling the brain onto the floor.") eject_brain(user) update_icon() - name = "Man-Machine Interface" + name = initial(name) /obj/item/mmi/proc/eject_brain(mob/user) brainmob.container = null //Reset brainmob mmi var. @@ -129,7 +133,10 @@ name = "Man-Machine Interface: [brainmob.real_name]" update_icon() - return + if(istype(brain, /obj/item/organ/brain/alien)) + braintype = "Xenoborg" //HISS....Beep. + else + braintype = "Cyborg" /obj/item/mmi/proc/replacement_ai_name() return brainmob.name diff --git a/code/modules/mob/living/brain/posibrain.dm b/code/modules/mob/living/brain/posibrain.dm index e2d6b095fe..224b5ad807 100644 --- a/code/modules/mob/living/brain/posibrain.dm +++ b/code/modules/mob/living/brain/posibrain.dm @@ -184,11 +184,10 @@ GLOBAL_VAR(posibrain_notify_cooldown) return -/obj/item/mmi/posibrain/update_icon() +/obj/item/mmi/posibrain/update_icon_state() if(searching) icon_state = "[initial(icon_state)]-searching" - return - if(brainmob && brainmob.key) + else if(brainmob && brainmob.key) icon_state = "[initial(icon_state)]-occupied" else icon_state = initial(icon_state) diff --git a/code/modules/mob/living/carbon/human/species_types/shadowpeople.dm b/code/modules/mob/living/carbon/human/species_types/shadowpeople.dm index 70abba5a01..e229860cf7 100644 --- a/code/modules/mob/living/carbon/human/species_types/shadowpeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/shadowpeople.dm @@ -100,6 +100,9 @@ var/obj/item/light_eater/blade decay_factor = 0 +/obj/item/organ/heart/nightmare/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_blocker) /obj/item/organ/heart/nightmare/attack(mob/M, mob/living/carbon/user, obj/target) if(M != user) @@ -130,9 +133,6 @@ /obj/item/organ/heart/nightmare/Stop() return 0 -/obj/item/organ/heart/nightmare/update_icon() - return //always beating visually - /obj/item/organ/heart/nightmare/on_death() if(!owner) return diff --git a/code/modules/mob/living/simple_animal/guardian/guardian.dm b/code/modules/mob/living/simple_animal/guardian/guardian.dm index 9ad3cbd373..ff42512666 100644 --- a/code/modules/mob/living/simple_animal/guardian/guardian.dm +++ b/code/modules/mob/living/simple_animal/guardian/guardian.dm @@ -633,8 +633,9 @@ GLOBAL_LIST_EMPTY(parasites) //all currently existing/living guardians
"} -/obj/item/paper/guides/antag/guardian/update_icon() - return +/obj/item/paper/guides/antag/guardian/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_blocker) /obj/item/paper/guides/antag/guardian/wizard name = "Guardian Guide"