From 59b1a223a32265653ef03ed5167807d1e128f225 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Sun, 8 Mar 2020 22:51:36 +0100 Subject: [PATCH] Ok, done. --- code/modules/VR/vr_sleeper.dm | 2 +- .../hostile/megafauna/colossus.dm | 5 +- .../computers/item/computer.dm | 19 +++-- .../computers/item/laptop.dm | 11 +-- .../computers/item/processor.dm | 11 ++- .../computers/item/tablet.dm | 7 +- .../computers/machinery/modular_computer.dm | 22 +++--- code/modules/newscaster/newscaster_machine.dm | 2 +- code/modules/paperwork/clipboard.dm | 12 ++-- code/modules/paperwork/contract.dm | 9 +-- code/modules/paperwork/folders.dm | 7 +- code/modules/paperwork/paper.dm | 8 +-- code/modules/paperwork/paper_cutter.dm | 10 +-- code/modules/paperwork/paperbin.dm | 10 +-- code/modules/paperwork/paperplane.dm | 6 +- code/modules/paperwork/pen.dm | 8 +-- code/modules/photography/photos/frame.dm | 12 ++-- code/modules/photography/photos/photo.dm | 2 +- code/modules/pool/pool_controller.dm | 5 +- code/modules/power/antimatter/control.dm | 5 +- code/modules/power/antimatter/shielding.dm | 7 +- code/modules/power/cable.dm | 2 +- code/modules/power/cell.dm | 15 ++-- code/modules/power/generator.dm | 14 ++-- code/modules/power/gravitygenerator.dm | 11 +-- code/modules/power/lighting.dm | 16 +++-- code/modules/power/port_gen.dm | 2 +- code/modules/power/singularity/collector.dm | 8 +-- code/modules/power/singularity/emitter.dm | 2 +- .../power/singularity/field_generator.dm | 10 +-- .../particle_accelerator.dm | 2 +- .../particle_accelerator/particle_control.dm | 2 +- code/modules/power/smes.dm | 20 +++--- .../projectiles/ammunition/_ammunition.dm | 3 +- .../ammunition/caseless/_caseless.dm | 3 +- .../projectiles/ammunition/caseless/foam.dm | 3 +- code/modules/projectiles/guns/ballistic.dm | 3 +- .../modules/projectiles/guns/ballistic/bow.dm | 2 +- .../guns/ballistic/laser_gatling.dm | 2 +- code/modules/projectiles/guns/magic.dm | 3 - code/modules/projectiles/guns/magic/wand.dm | 2 +- .../chemistry/machinery/chem_dispenser.dm | 8 +-- .../chemistry/machinery/chem_heater.dm | 2 +- .../chemistry/machinery/chem_master.dm | 10 +-- .../reagents/chemistry/machinery/pandemic.dm | 14 ++-- .../chemistry/machinery/reagentgrinder.dm | 2 +- .../chemistry/machinery/smoke_machine.dm | 3 +- .../reagents/reagent_containers/blood_pack.dm | 12 ++-- .../reagents/reagent_containers/bottle.dm | 21 +++--- .../reagents/reagent_containers/dropper.dm | 8 +-- .../reagents/reagent_containers/glass.dm | 16 ++--- .../reagents/reagent_containers/hypospray.dm | 13 ++-- .../reagents/reagent_containers/hypovial.dm | 46 +----------- .../reagents/reagent_containers/syringes.dm | 66 ++++++++---------- code/modules/recycling/conveyor2.dm | 2 +- code/modules/recycling/disposal/bin.dm | 16 ++--- code/modules/research/destructive_analyzer.dm | 2 +- code/modules/research/experimentor.dm | 2 +- code/modules/shuttle/emergency.dm | 5 +- code/modules/shuttle/manipulator.dm | 8 +-- code/modules/shuttle/special.dm | 2 +- code/modules/station_goals/shield.dm | 2 +- code/modules/surgery/organs/appendix.dm | 2 +- code/modules/surgery/organs/augments_arms.dm | 2 +- code/modules/surgery/organs/augments_chest.dm | 5 +- code/modules/surgery/organs/heart.dm | 2 +- code/modules/vehicles/pimpin_ride.dm | 8 +-- icons/obj/reagentfillings.dmi | Bin 4148 -> 4148 bytes 68 files changed, 255 insertions(+), 329 deletions(-) diff --git a/code/modules/VR/vr_sleeper.dm b/code/modules/VR/vr_sleeper.dm index 29d7224950..e79784290b 100644 --- a/code/modules/VR/vr_sleeper.dm +++ b/code/modules/VR/vr_sleeper.dm @@ -63,7 +63,7 @@ addtimer(CALLBACK(src, .proc/emagNotify), 150) return TRUE -/obj/machinery/vr_sleeper/update_icon() +/obj/machinery/vr_sleeper/update_icon_state() icon_state = "[initial(icon_state)][state_open ? "-open" : ""]" /obj/machinery/vr_sleeper/open_machine() diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm index d544671d3e..52083721b7 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm @@ -244,8 +244,9 @@ Difficulty: Very Hard var/list/stored_items = list() var/list/blacklist = list() -/obj/machinery/smartfridge/black_box/update_icon() - return +/obj/machinery/smartfridge/black_box/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_blocker) /obj/machinery/smartfridge/black_box/accept_check(obj/item/O) if(!istype(O)) diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm index a83720dc23..d722197bd9 100644 --- a/code/modules/modular_computers/computers/item/computer.dm +++ b/code/modules/modular_computers/computers/item/computer.dm @@ -26,6 +26,7 @@ var/icon_state_unpowered = null // Icon state when the computer is turned off. var/icon_state_powered = null // Icon state when the computer is turned on. var/icon_state_menu = "menu" // Icon state overlay when the computer is turned on, but no program is loaded that would override the screen. + var/display_overlays = TRUE // If FALSE, don't draw overlays on this device at all var/max_hardware_size = 0 // Maximal hardware w_class. Tablets/PDAs have 1, laptops 2, consoles 4. var/steel_sheet_cost = 5 // Amount of steel sheets refunded when disassembling an empty frame of this computer. @@ -208,20 +209,26 @@ else if(obj_integrity < max_integrity) . += "It is damaged." -/obj/item/modular_computer/update_icon() - cut_overlays() +/obj/item/modular_computer/update_icon_state() if(!enabled) icon_state = icon_state_unpowered else icon_state = icon_state_powered + + +/obj/item/modular_computer/update_overlays() + . = ..() + if(!display_overlays) + return + if(enabled) if(active_program) - add_overlay(active_program.program_icon_state ? active_program.program_icon_state : icon_state_menu) + . += active_program.program_icon_state ? active_program.program_icon_state : icon_state_menu else - add_overlay(icon_state_menu) + . += icon_state_menu if(obj_integrity <= integrity_failure * max_integrity) - add_overlay("bsod") - add_overlay("broken") + . += "bsod" + . += "broken" // On-click handling. Turns on the computer if it's off and opens the GUI. diff --git a/code/modules/modular_computers/computers/item/laptop.dm b/code/modules/modular_computers/computers/item/laptop.dm index 1f19cf64ff..a4d2e74657 100644 --- a/code/modules/modular_computers/computers/item/laptop.dm +++ b/code/modules/modular_computers/computers/item/laptop.dm @@ -18,6 +18,7 @@ screen_on = 0 // Starts closed var/start_open = TRUE // unless this var is set to 1 var/icon_state_closed = "laptop-closed" + display_overlays = FALSE var/w_class_open = WEIGHT_CLASS_BULKY /obj/item/modular_computer/laptop/examine(mob/user) @@ -31,12 +32,11 @@ if(start_open && !screen_on) toggle_open() -/obj/item/modular_computer/laptop/update_icon() - if(screen_on) - ..() - else - cut_overlays() +/obj/item/modular_computer/laptop/update_icon_state() + if(!screen_on) icon_state = icon_state_closed + else + . = ..() /obj/item/modular_computer/laptop/attack_self(mob/user) if(!screen_on) @@ -97,6 +97,7 @@ w_class = w_class_open screen_on = !screen_on + display_overlays = screen_on update_icon() diff --git a/code/modules/modular_computers/computers/item/processor.dm b/code/modules/modular_computers/computers/item/processor.dm index b86d4e5d0d..295ecc66c0 100644 --- a/code/modules/modular_computers/computers/item/processor.dm +++ b/code/modules/modular_computers/computers/item/processor.dm @@ -16,15 +16,15 @@ machinery_computer.cpu = null machinery_computer = null -/obj/item/modular_computer/processor/New(comp) +/obj/item/modular_computer/processor/Initialize(mapload) . = ..() - if(!comp || !istype(comp, /obj/machinery/modular_computer)) + if(!loc || !istype(loc, /obj/machinery/modular_computer)) CRASH("Inapropriate type passed to obj/item/modular_computer/processor/New()! Aborting.") return // Obtain reference to machinery computer all_components = list() idle_threads = list() - machinery_computer = comp + machinery_computer = loc machinery_computer.cpu = src hardware_flag = machinery_computer.hardware_flag max_hardware_size = machinery_computer.max_hardware_size @@ -34,14 +34,11 @@ integrity_failure = machinery_computer.integrity_failure base_active_power_usage = machinery_computer.base_active_power_usage base_idle_power_usage = machinery_computer.base_idle_power_usage + machinery_computer.RegisterSignal(src, COMSIG_ATOM_UPDATED_ICON, /atom/proc/update_icon) //when we update_icon, also update the computer /obj/item/modular_computer/processor/relay_qdel() qdel(machinery_computer) -/obj/item/modular_computer/processor/update_icon() - if(machinery_computer) - return machinery_computer.update_icon() - // This thing is not meant to be used on it's own, get topic data from our machinery owner. //obj/item/modular_computer/processor/canUseTopic(atom/movable/M, be_close=FALSE, no_dextery=FALSE, no_tk=FALSE) // if(!machinery_computer) diff --git a/code/modules/modular_computers/computers/item/tablet.dm b/code/modules/modular_computers/computers/item/tablet.dm index 0818ce8034..bc9d62acbe 100644 --- a/code/modules/modular_computers/computers/item/tablet.dm +++ b/code/modules/modular_computers/computers/item/tablet.dm @@ -15,14 +15,11 @@ var/has_variants = TRUE var/finish_color = null -/obj/item/modular_computer/tablet/update_icon() - ..() +/obj/item/modular_computer/tablet/update_icon_state() if(has_variants) if(!finish_color) finish_color = pick("red","blue","brown","green","black") - icon_state = "tablet-[finish_color]" - icon_state_unpowered = "tablet-[finish_color]" - icon_state_powered = "tablet-[finish_color]" + icon_state = icon_state_powered = icon_state_unpowered = "tablet-[finish_color]" /obj/item/modular_computer/tablet/syndicate_contract_uplink name = "contractor tablet" diff --git a/code/modules/modular_computers/computers/machinery/modular_computer.dm b/code/modules/modular_computers/computers/machinery/modular_computer.dm index a1f13878c1..89c6166a0d 100644 --- a/code/modules/modular_computers/computers/machinery/modular_computer.dm +++ b/code/modules/modular_computers/computers/machinery/modular_computer.dm @@ -48,26 +48,28 @@ if(cpu) . |= cpu.emag_act(user) -/obj/machinery/modular_computer/update_icon() - cut_overlays() - icon_state = icon_state_powered +/obj/machinery/modular_computer/update_icon_state() + if(cpu?.enabled) + icon_state = icon_state_powered + else if(stat & NOPOWER || !(cpu?.use_power())) + icon_state = icon_state_unpowered +/obj/machinery/modular_computer/update_overlays() + . = ..() if(!cpu || !cpu.enabled) if (!(stat & NOPOWER) && (cpu && cpu.use_power())) - add_overlay(screen_icon_screensaver) - else - icon_state = icon_state_unpowered + . += screen_icon_screensaver set_light(0) else set_light(light_strength) if(cpu.active_program) - add_overlay(cpu.active_program.program_icon_state ? cpu.active_program.program_icon_state : screen_icon_state_menu) + . += cpu.active_program.program_icon_state ? cpu.active_program.program_icon_state : screen_icon_state_menu else - add_overlay(screen_icon_state_menu) + . += screen_icon_state_menu if(cpu && cpu.obj_integrity <= cpu.integrity_failure * cpu.max_integrity) - add_overlay("bsod") - add_overlay("broken") + . += "bsod" + . += "broken" // Eject ID card from computer, if it has ID slot with card inside. /obj/machinery/modular_computer/proc/eject_id() diff --git a/code/modules/newscaster/newscaster_machine.dm b/code/modules/newscaster/newscaster_machine.dm index 93d5dc3b31..95a24817a0 100644 --- a/code/modules/newscaster/newscaster_machine.dm +++ b/code/modules/newscaster/newscaster_machine.dm @@ -53,7 +53,7 @@ GLOBAL_LIST_EMPTY(allCasters) picture = null return ..() -/obj/machinery/newscaster/update_icon() +/obj/machinery/newscaster/update_icon_state() if(stat & (NOPOWER|BROKEN)) icon_state = "newscaster_off" else diff --git a/code/modules/paperwork/clipboard.dm b/code/modules/paperwork/clipboard.dm index f75569ef7a..1a93661c76 100644 --- a/code/modules/paperwork/clipboard.dm +++ b/code/modules/paperwork/clipboard.dm @@ -25,14 +25,14 @@ QDEL_NULL(toppaper) //let movable/Destroy handle the rest return ..() -/obj/item/clipboard/update_icon() - cut_overlays() +/obj/item/clipboard/update_overlays() + . = ..() if(toppaper) - add_overlay(toppaper.icon_state) - copy_overlays(toppaper) + . += toppaper.icon_state + . += toppaper.overlays if(haspen) - add_overlay("clipboard_pen") - add_overlay("clipboard_over") + . += "clipboard_pen" + . += "clipboard_over" /obj/item/clipboard/attackby(obj/item/W, mob/user, params) diff --git a/code/modules/paperwork/contract.dm b/code/modules/paperwork/contract.dm index 5f7db07190..2c02903d3e 100644 --- a/code/modules/paperwork/contract.dm +++ b/code/modules/paperwork/contract.dm @@ -7,13 +7,14 @@ var/datum/mind/target item_flags = NOBLUDGEON +/obj/item/paper/contract/ComponentInitialize() + return + . = ..() + AddElement(/datum/element/update_icon_blocker) + /obj/item/paper/contract/proc/update_text() return -/obj/item/paper/contract/update_icon() - return - - /obj/item/paper/contract/employment icon_state = "paper_words" diff --git a/code/modules/paperwork/folders.dm b/code/modules/paperwork/folders.dm index 4cd44af5ab..a599ec9deb 100644 --- a/code/modules/paperwork/folders.dm +++ b/code/modules/paperwork/folders.dm @@ -28,11 +28,10 @@ icon_state = "folder_white" -/obj/item/folder/update_icon() - cut_overlays() +/obj/item/folder/update_overlays() + . = ..() if(contents.len) - add_overlay("folder_paper") - + . += "folder_paper" /obj/item/folder/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/paper) || istype(W, /obj/item/photo) || istype(W, /obj/item/documents)) diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index 20f4ab0c86..88b6230b7d 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -78,8 +78,7 @@ return get_dist(src, target) < 2 return ..() -/obj/item/paper/update_icon() - +/obj/item/paper/update_icon_state() if(resistance_flags & ON_FIRE) icon_state = "paper_onfire" return @@ -379,8 +378,9 @@ icon_state = "scrap" slot_flags = null -/obj/item/paper/crumpled/update_icon() - return +/obj/item/paper/crumpled/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_blocker) /obj/item/paper/crumpled/bloody icon_state = "scrap_bloodied" diff --git a/code/modules/paperwork/paper_cutter.dm b/code/modules/paperwork/paper_cutter.dm index 0f57d53111..0a7bf011a7 100644 --- a/code/modules/paperwork/paper_cutter.dm +++ b/code/modules/paperwork/paper_cutter.dm @@ -34,13 +34,13 @@ return (BRUTELOSS) -/obj/item/papercutter/update_icon() - ..() - cut_overlays() +/obj/item/papercutter/update_icon_state() icon_state = (storedcutter ? "[initial(icon_state)]-cutter" : "[initial(icon_state)]") - if(storedpaper) - add_overlay("paper") +/obj/item/papercutter/update_overlays() + . = ..() + if(storedpaper) + . += "paper" /obj/item/papercutter/attackby(obj/item/P, mob/user, params) if(istype(P, /obj/item/paper) && !storedpaper) diff --git a/code/modules/paperwork/paperbin.dm b/code/modules/paperwork/paperbin.dm index 5648bc7af8..b8bcbedbbe 100644 --- a/code/modules/paperwork/paperbin.dm +++ b/code/modules/paperwork/paperbin.dm @@ -51,7 +51,7 @@ else if(istype(over_object, /obj/screen/inventory/hand)) var/obj/screen/inventory/hand/H = over_object M.putItemFromInventoryInHandIfPossible(src, H.held_index) - + else . = ..() @@ -125,14 +125,16 @@ . += "It doesn't contain anything." -/obj/item/paper_bin/update_icon() +/obj/item/paper_bin/update_icon_state() if(total_paper < 1) icon_state = "paper_bin0" else icon_state = "[initial(icon_state)]" - cut_overlays() + +/obj/item/paper_bin/update_overlays() + . = ..() if(bin_pen) - add_overlay(mutable_appearance(bin_pen.icon, bin_pen.icon_state)) + . += mutable_appearance(bin_pen.icon, bin_pen.icon_state) /obj/item/paper_bin/construction name = "construction paper bin" diff --git a/code/modules/paperwork/paperplane.dm b/code/modules/paperwork/paperplane.dm index 06c16810b7..a9baf60c0c 100644 --- a/code/modules/paperwork/paperplane.dm +++ b/code/modules/paperwork/paperplane.dm @@ -55,12 +55,12 @@ sleep(10) return (BRUTELOSS) -/obj/item/paperplane/update_icon() - cut_overlays() +/obj/item/paperplane/update_overlays() + . = ..() var/list/stamped = internalPaper.stamped if(stamped) for(var/S in stamped) - add_overlay("paperplane_[S]") + . += "paperplane_[S]" /obj/item/paperplane/attack_self(mob/user) to_chat(user, "You unfold [src].") diff --git a/code/modules/paperwork/pen.dm b/code/modules/paperwork/pen.dm index a98f057c4a..227e22d499 100644 --- a/code/modules/paperwork/pen.dm +++ b/code/modules/paperwork/pen.dm @@ -179,9 +179,10 @@ sharpness = IS_SHARP var/on = FALSE -/obj/item/pen/edagger/Initialize() +/obj/item/pen/edagger/ComponentInitialize() . = ..() AddComponent(/datum/component/butchering, 60, 100, 0, 'sound/weapons/blade1.ogg') + AddElement(/datum/element/update_icon_updates_onmob) /obj/item/pen/edagger/get_sharpness() return on * sharpness @@ -209,10 +210,9 @@ to_chat(user, "[src] is now active.") update_icon() -/obj/item/pen/edagger/update_icon() +/obj/item/pen/edagger/update_icon_state() if(on) - icon_state = "edagger" - item_state = "edagger" + icon_state = item_state = "edagger" lefthand_file = 'icons/mob/inhands/weapons/swords_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/swords_righthand.dmi' else diff --git a/code/modules/photography/photos/frame.dm b/code/modules/photography/photos/frame.dm index d20a71d1c6..67559c0381 100644 --- a/code/modules/photography/photos/frame.dm +++ b/code/modules/photography/photos/frame.dm @@ -43,10 +43,10 @@ return list() return ..() -/obj/item/wallframe/picture/update_icon() - cut_overlays() +/obj/item/wallframe/picture/update_overlays() + . = ..() if(displayed) - add_overlay(image(displayed)) + . += image(displayed) /obj/item/wallframe/picture/after_attach(obj/O) ..() @@ -145,10 +145,10 @@ if(framed) framed.show(user) -/obj/structure/sign/picture_frame/update_icon() - cut_overlays() +/obj/structure/sign/picture_frame/update_overlays() + . = ..() if(framed) - add_overlay(image(framed)) + . += image(framed) /obj/structure/sign/picture_frame/deconstruct(disassembled = TRUE) if(!(flags_1 & NODECONSTRUCT_1)) diff --git a/code/modules/photography/photos/photo.dm b/code/modules/photography/photos/photo.dm index d45a119553..2f827f7d51 100644 --- a/code/modules/photography/photos/photo.dm +++ b/code/modules/photography/photos/photo.dm @@ -32,7 +32,7 @@ if(setdesc && P.picture_desc) desc = P.picture_desc -/obj/item/photo/update_icon() +/obj/item/photo/update_icon_state() if(!istype(picture) || !picture.picture_image) return var/icon/I = picture.get_small_icon() diff --git a/code/modules/pool/pool_controller.dm b/code/modules/pool/pool_controller.dm index 6f28a7c8dd..c9bc6be3e5 100644 --- a/code/modules/pool/pool_controller.dm +++ b/code/modules/pool/pool_controller.dm @@ -297,8 +297,7 @@ mist_on() update_icon() -/obj/machinery/pool/controller/update_icon() - . = ..() +/obj/machinery/pool/controller/update_icon_state() icon_state = "poolc_[temperature]" /obj/machinery/pool/controller/proc/CanUpTemp(mob/user) @@ -412,7 +411,7 @@ /obj/machinery/pool/controller/proc/mist_on() //Spawn /obj/effect/mist (from the shower) on all linked pool tiles if(mist_state) return - mist_off() //make sure it cycles and deletes everything + mist_off() //make sure it cycles and deletes everything mist_state = TRUE for(var/X in linked_turfs) var/turf/open/pool/W = X diff --git a/code/modules/power/antimatter/control.dm b/code/modules/power/antimatter/control.dm index 1ff398bdd3..568ad893a2 100644 --- a/code/modules/power/antimatter/control.dm +++ b/code/modules/power/antimatter/control.dm @@ -151,10 +151,11 @@ return -/obj/machinery/power/am_control_unit/update_icon() +/obj/machinery/power/am_control_unit/update_icon_state() if(active) icon_state = "control_on" - else icon_state = "control" + else + icon_state = "control" //No other icons for it atm diff --git a/code/modules/power/antimatter/shielding.dm b/code/modules/power/antimatter/shielding.dm index 624c4c0316..766c4d4392 100644 --- a/code/modules/power/antimatter/shielding.dm +++ b/code/modules/power/antimatter/shielding.dm @@ -107,10 +107,9 @@ check_stability() -/obj/machinery/am_shielding/update_icon() +/obj/machinery/am_shielding/update_icon_state() dirs = 0 coredirs = 0 - cut_overlays() for(var/direction in GLOB.alldirs) var/turf/T = get_step(loc, direction) for(var/obj/machinery/machine in T) @@ -137,8 +136,10 @@ icon_state = "[prefix]shield_[icondirs]" +/obj/machinery/am_shielding/update_overlays() + . = ..() if(core_check()) - add_overlay("core[control_unit && control_unit.active]") + . += "core[control_unit?.active]" if(!processing) setup_core() else if(processing) diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index b9d4d1adf1..8d5de661ae 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -130,7 +130,7 @@ By design, d1 is the smallest direction and d2 is the highest invisibility = i ? INVISIBILITY_MAXIMUM : 0 update_icon() -/obj/structure/cable/update_icon() +/obj/structure/cable/update_icon_state() icon_state = "[d1]-[d2]" color = null add_atom_colour(cable_color, FIXED_COLOUR_PRIORITY) diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index a15580498c..93fe7e8fa6 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -58,16 +58,16 @@ else return PROCESS_KILL -/obj/item/stock_parts/cell/update_icon() - cut_overlays() +/obj/item/stock_parts/cell/update_overlays() + . = ..() if(grown_battery) - add_overlay(image('icons/obj/power.dmi',"grown_wires")) + . += image('icons/obj/power.dmi',"grown_wires") if(charge < 0.01) return else if(charge/maxcharge >=0.995) - add_overlay("cell-o2") + . += "cell-o2" else - add_overlay("cell-o1") + . += "cell-o1" /obj/item/stock_parts/cell/proc/percent() // return % charge of cell return 100*charge/maxcharge @@ -281,8 +281,9 @@ maxcharge = 50000 ratingdesc = FALSE -/obj/item/stock_parts/cell/infinite/abductor/update_icon() - return +/obj/item/stock_parts/cell/infinite/abductor/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_blocker) /obj/item/stock_parts/cell/potato diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index 011a2e4fd2..6d63a57c88 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -30,19 +30,15 @@ SSair.atmos_machinery -= src return ..() -/obj/machinery/power/generator/update_icon() - - if(stat & (NOPOWER|BROKEN)) - cut_overlays() - else - cut_overlays() - +/obj/machinery/power/generator/update_overlays() + . = ..() + if(!(stat & (NOPOWER|BROKEN))) var/L = min(round(lastgenlev/100000),11) if(L != 0) - add_overlay(image('icons/obj/power.dmi', "teg-op[L]")) + . += image('icons/obj/power.dmi', "teg-op[L]") if(hot_circ && cold_circ) - add_overlay("teg-oc[lastcirc]") + . += "teg-oc[lastcirc]" #define GENRATE 800 // generator output coefficient from Q diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm index d0d1e2b475..582d72f6c0 100644 --- a/code/modules/power/gravitygenerator.dm +++ b/code/modules/power/gravitygenerator.dm @@ -44,8 +44,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne if(tesla_flags & TESLA_MACHINE_EXPLOSIVE) qdel(src)//like the singulo, tesla deletes it. stops it from exploding over and over -/obj/machinery/gravity_generator/update_icon() - ..() +/obj/machinery/gravity_generator/update_icon_state() icon_state = "[get_status()]_[sprite_number]" /obj/machinery/gravity_generator/proc/get_status() @@ -156,6 +155,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne part.main_part = src parts += part part.update_icon() + part.RegisterSignal(src, COMSIG_ATOM_UPDATED_ICON, /atom/proc/update_icon) /obj/machinery/gravity_generator/main/proc/connected_parts() return parts.len == 8 @@ -235,7 +235,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne data["charging_state"] = charging_state data["on"] = on data["operational"] = (stat & BROKEN) ? FALSE : TRUE - + return data /obj/machinery/gravity_generator/main/ui_act(action, params) @@ -259,11 +259,6 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne return "fix[min(broken_state, 3)]" return on || charging_state != POWER_IDLE ? "on" : "off" -/obj/machinery/gravity_generator/main/update_icon() - ..() - for(var/obj/O in parts) - O.update_icon() - // Set the charging state based on power/breaker. /obj/machinery/gravity_generator/main/proc/set_power() var/new_state = FALSE diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 6cfcc5192a..8d041efb76 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -291,8 +291,7 @@ QDEL_NULL(cell) return ..() -/obj/machinery/light/update_icon() - cut_overlays() +/obj/machinery/light/update_icon_state() switch(status) // set icon_states if(LIGHT_OK) var/area/A = get_base_area(src) @@ -303,17 +302,20 @@ icon_state = "[base_state]_hijacked" else icon_state = "[base_state]" - if(on) - var/mutable_appearance/glowybit = mutable_appearance(overlayicon, base_state, ABOVE_LIGHTING_LAYER, ABOVE_LIGHTING_PLANE) - glowybit.alpha = CLAMP(light_power*250, 30, 200) - add_overlay(glowybit) if(LIGHT_EMPTY) icon_state = "[base_state]-empty" if(LIGHT_BURNED) icon_state = "[base_state]-burned" if(LIGHT_BROKEN) icon_state = "[base_state]-broken" - return + +/obj/machinery/light/update_overlays() + . = ..() + if(on && status == LIGHT_OK) + var/mutable_appearance/glowybit = mutable_appearance(overlayicon, base_state, ABOVE_LIGHTING_LAYER, ABOVE_LIGHTING_PLANE) + glowybit.alpha = CLAMP(light_power*250, 30, 200) + . += glowybit + // update the icon_state and luminosity of the light depending on its state /obj/machinery/light/proc/update(trigger = TRUE) diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index 3a6a98d681..3c20f2f69c 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -39,7 +39,7 @@ /obj/machinery/power/port_gen/proc/handleInactive() return -/obj/machinery/power/port_gen/update_icon() +/obj/machinery/power/port_gen/update_icon_state() icon_state = "[base_icon]_[active]" /obj/machinery/power/port_gen/process() diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm index be8d456f20..2e6ec57f77 100644 --- a/code/modules/power/singularity/collector.dm +++ b/code/modules/power/singularity/collector.dm @@ -204,14 +204,14 @@ if(loaded_tank && active && pulse_strength > RAD_COLLECTOR_EFFICIENCY) stored_power += (pulse_strength-RAD_COLLECTOR_EFFICIENCY)*RAD_COLLECTOR_COEFFICIENT -/obj/machinery/power/rad_collector/update_icon() - cut_overlays() +/obj/machinery/power/rad_collector/update_overlays() + . = ..() if(loaded_tank) - add_overlay("ptank") + . += "ptank" if(stat & (NOPOWER|BROKEN)) return if(active) - add_overlay("on") + . += "on" /obj/machinery/power/rad_collector/proc/toggle_power() diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index e956742e92..d57f78e5b6 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -112,7 +112,7 @@ QDEL_NULL(sparks) return ..() -/obj/machinery/power/emitter/update_icon() +/obj/machinery/power/emitter/update_icon_state() if (active && powernet && avail(active_power_usage)) icon_state = icon_state_on else diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index 54aca32cf7..950e34098c 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -44,14 +44,14 @@ field_generator power level display var/list/obj/machinery/field/generator/connected_gens var/clean_up = 0 -/obj/machinery/field/generator/update_icon() - cut_overlays() +/obj/machinery/field/generator/update_overlays() + . = ..() if(warming_up) - add_overlay("+a[warming_up]") + . += "+a[warming_up]" if(fields.len) - add_overlay("+on") + . += "+on" if(power_level) - add_overlay("+p[power_level]") + . += "+p[power_level]" /obj/machinery/field/generator/Initialize() diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm index 09fb3ad4e9..59792b6539 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm @@ -124,7 +124,7 @@ investigate_log("was moved whilst active; it powered down.", INVESTIGATE_SINGULO) -/obj/structure/particle_accelerator/update_icon() +/obj/structure/particle_accelerator/update_icon_state() switch(construction_state) if(PA_CONSTRUCTION_UNSECURED,PA_CONSTRUCTION_UNWIRED) icon_state="[reference]" diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm index f583fc138d..af83f7ebca 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_control.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm @@ -60,7 +60,7 @@ active = 0 connected_parts.Cut() -/obj/machinery/particle_accelerator/control_box/update_icon() +/obj/machinery/particle_accelerator/control_box/update_icon_state() if(active) icon_state = "control_boxp1" else diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 774f7ba14d..47de07cd71 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -199,29 +199,25 @@ stat |= BROKEN -/obj/machinery/power/smes/update_icon() - cut_overlays() - if(stat & BROKEN) - return - - if(panel_open) +/obj/machinery/power/smes/update_overlays() + . = ..() + if((stat & BROKEN) || panel_open) return if(outputting) - add_overlay("smes-op1") + . += "smes-op1" else - add_overlay("smes-op0") + . += "smes-op0" if(inputting) - add_overlay("smes-oc1") + . += "smes-oc1" else if(input_attempt) - add_overlay("smes-oc0") + . += "smes-oc0" var/clevel = chargedisplay() if(clevel>0) - add_overlay("smes-og[clevel]") - + . += "smes-og[clevel]" /obj/machinery/power/smes/proc/chargedisplay() return CLAMP(round(5.5*charge/capacity),0,5) diff --git a/code/modules/projectiles/ammunition/_ammunition.dm b/code/modules/projectiles/ammunition/_ammunition.dm index 28b70bf276..ee6a25d8e4 100644 --- a/code/modules/projectiles/ammunition/_ammunition.dm +++ b/code/modules/projectiles/ammunition/_ammunition.dm @@ -39,8 +39,7 @@ QDEL_NULL(BB) return ..() -/obj/item/ammo_casing/update_icon() - ..() +/obj/item/ammo_casing/update_icon_state() icon_state = "[initial(icon_state)][BB ? "-live" : ""]" desc = "[initial(desc)][BB ? "" : " This one is spent."]" diff --git a/code/modules/projectiles/ammunition/caseless/_caseless.dm b/code/modules/projectiles/ammunition/caseless/_caseless.dm index db1aa6562c..33d096007d 100644 --- a/code/modules/projectiles/ammunition/caseless/_caseless.dm +++ b/code/modules/projectiles/ammunition/caseless/_caseless.dm @@ -11,6 +11,5 @@ else return FALSE -/obj/item/ammo_casing/caseless/update_icon() - ..() +/obj/item/ammo_casing/caseless/update_icon_state() icon_state = "[initial(icon_state)]" diff --git a/code/modules/projectiles/ammunition/caseless/foam.dm b/code/modules/projectiles/ammunition/caseless/foam.dm index 311f76797c..91ed69f7a5 100644 --- a/code/modules/projectiles/ammunition/caseless/foam.dm +++ b/code/modules/projectiles/ammunition/caseless/foam.dm @@ -9,8 +9,7 @@ harmful = FALSE var/modified = FALSE -/obj/item/ammo_casing/caseless/foam_dart/update_icon() - ..() +/obj/item/ammo_casing/caseless/foam_dart/update_icon_state() if (modified) icon_state = "foamdart_empty" desc = "It's nerf or nothing! ... Although, this one doesn't look too safe." diff --git a/code/modules/projectiles/guns/ballistic.dm b/code/modules/projectiles/guns/ballistic.dm index 9ea50562dd..e45483569e 100644 --- a/code/modules/projectiles/guns/ballistic.dm +++ b/code/modules/projectiles/guns/ballistic.dm @@ -19,8 +19,7 @@ chamber_round() update_icon() -/obj/item/gun/ballistic/update_icon() - ..() +/obj/item/gun/ballistic/update_icon_state() if(current_skin) icon_state = "[unique_reskin[current_skin]][suppressed ? "-suppressed" : ""][sawn_off ? "-sawn" : ""]" else diff --git a/code/modules/projectiles/guns/ballistic/bow.dm b/code/modules/projectiles/guns/ballistic/bow.dm index 0fc181f71c..c39afa03b7 100644 --- a/code/modules/projectiles/guns/ballistic/bow.dm +++ b/code/modules/projectiles/guns/ballistic/bow.dm @@ -44,7 +44,7 @@ to_chat(user, "You notch the arrow.") update_icon() -/obj/item/gun/ballistic/bow/update_icon() +/obj/item/gun/ballistic/bow/update_icon_state() icon_state = "[initial(icon_state)]_[get_ammo() ? (chambered ? "firing" : "loaded") : "unloaded"]" /obj/item/gun/ballistic/bow/can_shoot() diff --git a/code/modules/projectiles/guns/ballistic/laser_gatling.dm b/code/modules/projectiles/guns/ballistic/laser_gatling.dm index 82f6fa700b..366aa367b4 100644 --- a/code/modules/projectiles/guns/ballistic/laser_gatling.dm +++ b/code/modules/projectiles/guns/ballistic/laser_gatling.dm @@ -73,7 +73,7 @@ M.putItemFromInventoryInHandIfPossible(src, H.held_index) -/obj/item/minigunpack/update_icon() +/obj/item/minigunpack/update_icon_state() if(armed) icon_state = "notholstered" else diff --git a/code/modules/projectiles/guns/magic.dm b/code/modules/projectiles/guns/magic.dm index f724f982d0..ce87eddc67 100644 --- a/code/modules/projectiles/guns/magic.dm +++ b/code/modules/projectiles/guns/magic.dm @@ -73,9 +73,6 @@ recharge_newshot() return 1 -/obj/item/gun/magic/update_icon() - return - /obj/item/gun/magic/shoot_with_empty_chamber(mob/living/user as mob|obj) to_chat(user, "The [name] whizzles quietly.") diff --git a/code/modules/projectiles/guns/magic/wand.dm b/code/modules/projectiles/guns/magic/wand.dm index 4857369363..f48020aeb5 100644 --- a/code/modules/projectiles/guns/magic/wand.dm +++ b/code/modules/projectiles/guns/magic/wand.dm @@ -21,7 +21,7 @@ . = ..() . += "Has [charges] charge\s remaining." -/obj/item/gun/magic/wand/update_icon() +/obj/item/gun/magic/wand/update_icon_state() icon_state = "[initial(icon_state)][charges ? "" : "-drained"]" /obj/item/gun/magic/wand/attack(atom/target, mob/living/user) diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index be15bb70cf..2d177318aa 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -144,14 +144,14 @@ ..() icon_state = "[(nopower_state && !powered()) ? nopower_state : initial(icon_state)]" -/obj/machinery/chem_dispenser/update_icon() - cut_overlays() +/obj/machinery/chem_dispenser/update_overlays() + . = ..() if(has_panel_overlay && panel_open) - add_overlay(mutable_appearance(icon, "[initial(icon_state)]_panel-o")) + . += mutable_appearance(icon, "[initial(icon_state)]_panel-o") if(beaker) beaker_overlay = display_beaker() - add_overlay(beaker_overlay) + . += beaker_overlay /obj/machinery/chem_dispenser/emag_act(mob/user) . = ..() diff --git a/code/modules/reagents/chemistry/machinery/chem_heater.dm b/code/modules/reagents/chemistry/machinery/chem_heater.dm index 4c4d0fdb6e..63e9d724a4 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -22,7 +22,7 @@ beaker = null update_icon() -/obj/machinery/chem_heater/update_icon() +/obj/machinery/chem_heater/update_icon_state() if(beaker) icon_state = "mixer1b" else diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index abfd00ed90..22ff88d793 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -67,15 +67,17 @@ bottle = null update_icon() -/obj/machinery/chem_master/update_icon() - cut_overlays() - if (stat & BROKEN) - add_overlay("waitlight") +/obj/machinery/chem_master/update_icon_state() if(beaker) icon_state = "mixer1" else icon_state = "mixer0" +/obj/machinery/chem_master/update_overlays() + . = ..() + if (stat & BROKEN) + . += "waitlight" + /obj/machinery/chem_master/blob_act(obj/structure/blob/B) if (prob(50)) qdel(src) diff --git a/code/modules/reagents/chemistry/machinery/pandemic.dm b/code/modules/reagents/chemistry/machinery/pandemic.dm index 7b25aa769d..25315f457d 100644 --- a/code/modules/reagents/chemistry/machinery/pandemic.dm +++ b/code/modules/reagents/chemistry/machinery/pandemic.dm @@ -109,16 +109,16 @@ update_icon() playsound(loc, 'sound/machines/ping.ogg', 30, 1) -/obj/machinery/computer/pandemic/update_icon() +/obj/machinery/computer/pandemic/update_icon_state() if(stat & BROKEN) icon_state = (beaker ? "mixer1_b" : "mixer0_b") - return - - icon_state = "mixer[(beaker) ? "1" : "0"][powered() ? "" : "_nopower"]" - if(wait) - add_overlay("waitlight") else - cut_overlays() + icon_state = "mixer[(beaker) ? "1" : "0"][powered() ? "" : "_nopower"]" + +/obj/machinery/computer/pandemic/update_overlays() + . = ..() + if(!(stat & BROKEN) && wait) + . += "waitlight" /obj/machinery/computer/pandemic/ui_interact(mob/user, ui_key = "main", datum/tgui/ui, force_open = FALSE, datum/tgui/master_ui, datum/ui_state/state = GLOB.default_state) ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) diff --git a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm index 85cdc33e72..75848f89b9 100644 --- a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm +++ b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm @@ -66,7 +66,7 @@ AM.forceMove(drop_location()) holdingitems = list() -/obj/machinery/reagentgrinder/update_icon() +/obj/machinery/reagentgrinder/update_icon_state() if(beaker) icon_state = "juicer1" else diff --git a/code/modules/reagents/chemistry/machinery/smoke_machine.dm b/code/modules/reagents/chemistry/machinery/smoke_machine.dm index 189f58fec3..0a08395c1b 100644 --- a/code/modules/reagents/chemistry/machinery/smoke_machine.dm +++ b/code/modules/reagents/chemistry/machinery/smoke_machine.dm @@ -34,7 +34,7 @@ for(var/obj/item/stock_parts/matter_bin/B in component_parts) reagents.maximum_volume += REAGENTS_BASE_VOLUME * B.rating -/obj/machinery/smoke_machine/update_icon() +/obj/machinery/smoke_machine/update_icon_state() if((!is_operational()) || (!on) || (reagents.total_volume == 0)) if (panel_open) icon_state = "smoke0-o" @@ -42,7 +42,6 @@ icon_state = "smoke0" else icon_state = "smoke1" - return ..() /obj/machinery/smoke_machine/RefreshParts() var/new_volume = REAGENTS_BASE_VOLUME diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index 3296586c94..6be2e658c1 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -34,15 +34,11 @@ else name = "blood pack" -/obj/item/reagent_containers/blood/update_icon() - cut_overlays() - +/obj/item/reagent_containers/blood/update_overlays() + . = ..() var/v = min(round(reagents.total_volume / volume * 10), 10) if(v > 0) - var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "bloodpack1") - filling.icon_state = "bloodpack[v]" - filling.color = mix_color_from_reagents(reagents.reagent_list) - add_overlay(filling) + . += mutable_appearance('icons/obj/reagentfillings.dmi', "bloodpack[v]", color = mix_color_from_reagents(reagents.reagent_list)) /obj/item/reagent_containers/blood/random icon_state = "random_bloodpack" @@ -120,7 +116,7 @@ else if(!do_mob(user, C, 10)) return - + to_chat(user, "You take a sip from the [src].") user.visible_message("[user] puts the [src] up to their mouth.") if(reagents.total_volume <= 0) // Safety: In case you spam clicked the blood bag on yourself, and it is now empty (below will divide by zero) diff --git a/code/modules/reagents/reagent_containers/bottle.dm b/code/modules/reagents/reagent_containers/bottle.dm index e4741bb858..cc1cd21bac 100644 --- a/code/modules/reagents/reagent_containers/bottle.dm +++ b/code/modules/reagents/reagent_containers/bottle.dm @@ -18,26 +18,27 @@ /obj/item/reagent_containers/glass/bottle/on_reagent_change(changetype) update_icon() -/obj/item/reagent_containers/glass/bottle/update_icon() - cut_overlays() +/obj/item/reagent_containers/glass/bottle/update_overlays() + . = ..() + if(!cached_icon) + cached_icon = icon_state if(reagents.total_volume) - var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "[icon_state]-10") + var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "[cached_icon]-10", color = mix_color_from_reagents(reagents.reagent_list)) var/percent = round((reagents.total_volume / volume) * 100) switch(percent) if(0 to 9) - filling.icon_state = "[icon_state]-10" + filling.icon_state = "[cached_icon]-10" if(10 to 29) - filling.icon_state = "[icon_state]25" + filling.icon_state = "[cached_icon]25" if(30 to 49) - filling.icon_state = "[icon_state]50" + filling.icon_state = "[cached_icon]50" if(50 to 69) - filling.icon_state = "[icon_state]75" + filling.icon_state = "[cached_icon]75" if(70 to INFINITY) - filling.icon_state = "[icon_state]100" + filling.icon_state = "[cached_icon]100" - filling.color = mix_color_from_reagents(reagents.reagent_list) - add_overlay(filling) + . += filling /obj/item/reagent_containers/glass/bottle/epinephrine diff --git a/code/modules/reagents/reagent_containers/dropper.dm b/code/modules/reagents/reagent_containers/dropper.dm index 4e1de85fce..846637850b 100644 --- a/code/modules/reagents/reagent_containers/dropper.dm +++ b/code/modules/reagents/reagent_containers/dropper.dm @@ -86,12 +86,10 @@ update_icon() -/obj/item/reagent_containers/dropper/update_icon() - cut_overlays() +/obj/item/reagent_containers/dropper/update_overlays() + . = ..() if(reagents.total_volume) - var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "dropper") - filling.color = mix_color_from_reagents(reagents.reagent_list) - add_overlay(filling) + . += mutable_appearance('icons/obj/reagentfillings.dmi', "dropper", color = mix_color_from_reagents(reagents.reagent_list)) /obj/item/reagent_containers/dropper/get_belt_overlay() return mutable_appearance('icons/obj/clothing/belt_overlays.dmi', "pouch") diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index bf888dc50a..74e99cc326 100644 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -133,13 +133,13 @@ /obj/item/reagent_containers/glass/beaker/on_reagent_change(changetype) update_icon() -/obj/item/reagent_containers/glass/beaker/update_icon() +/obj/item/reagent_containers/glass/beaker/update_overlays() + . = ..() if(!cached_icon) cached_icon = icon_state - cut_overlays() if(reagents.total_volume) - var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "[cached_icon]10") + var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "[cached_icon]10", color = mix_color_from_reagents(reagents.reagent_list)) var/percent = round((reagents.total_volume / volume) * 100) switch(percent) @@ -157,9 +157,7 @@ filling.icon_state = "[cached_icon]80" if(91 to INFINITY) filling.icon_state = "[cached_icon]100" - - filling.color = mix_color_from_reagents(reagents.reagent_list) - add_overlay(filling) + . += filling /obj/item/reagent_containers/glass/beaker/jar name = "honey jar" @@ -215,11 +213,7 @@ amount_per_transfer_from_this = 10 possible_transfer_amounts = list(5,10,15,20,25,30,40,50,60,120,180) container_flags = TEMP_WEAK|APTFT_ALTCLICK|APTFT_VERB - -/obj/item/reagent_containers/glass/beaker/plastic/update_icon() - icon_state = "beakerlarge" // hack to lets us reuse the large beaker reagent fill states - ..() - icon_state = "beakerwhite" + cached_icon = "beakerlarge" /obj/item/reagent_containers/glass/beaker/meta name = "metamaterial beaker" diff --git a/code/modules/reagents/reagent_containers/hypospray.dm b/code/modules/reagents/reagent_containers/hypospray.dm index f29b785c95..3c4be7969d 100644 --- a/code/modules/reagents/reagent_containers/hypospray.dm +++ b/code/modules/reagents/reagent_containers/hypospray.dm @@ -119,7 +119,7 @@ reagents.add_reagent_list(list_reagents) update_icon() -/obj/item/reagent_containers/hypospray/medipen/update_icon() +/obj/item/reagent_containers/hypospray/medipen/update_icon_state() if(reagents.total_volume > 0) icon_state = initial(icon_state) else @@ -282,13 +282,12 @@ vial = new start_vial update_icon() -/obj/item/hypospray/mkii/update_icon() - ..() +/obj/item/hypospray/mkii/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_updates_onmob) + +/obj/item/hypospray/mkii/update_icon_state() icon_state = "[initial(icon_state)][vial ? "" : "-e"]" - if(ismob(loc)) - var/mob/M = loc - M.update_inv_hands() - return /obj/item/hypospray/mkii/examine(mob/user) . = ..() diff --git a/code/modules/reagents/reagent_containers/hypovial.dm b/code/modules/reagents/reagent_containers/hypovial.dm index db2d73c697..8d99248d97 100644 --- a/code/modules/reagents/reagent_containers/hypovial.dm +++ b/code/modules/reagents/reagent_containers/hypovial.dm @@ -19,37 +19,15 @@ "pink hypovial" = "hypovial-pink" ) always_reskinnable = TRUE + cached_icon = "hypovial" /obj/item/reagent_containers/glass/bottle/vial/Initialize() . = ..() - if(!icon_state) - icon_state = "hypovial" update_icon() /obj/item/reagent_containers/glass/bottle/vial/on_reagent_change() update_icon() -/obj/item/reagent_containers/glass/bottle/vial/update_icon() - cut_overlays() - if(reagents.total_volume) - var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "hypovial10") - - var/percent = round((reagents.total_volume / volume) * 100) - switch(percent) - if(0 to 9) - filling.icon_state = "hypovial10" - if(10 to 29) - filling.icon_state = "hypovial25" - if(30 to 49) - filling.icon_state = "hypovial50" - if(50 to 85) - filling.icon_state = "hypovial75" - if(86 to INFINITY) - filling.icon_state = "hypovial100" - - filling.color = mix_color_from_reagents(reagents.reagent_list) - add_overlay(filling) - /obj/item/reagent_containers/glass/bottle/vial/tiny name = "small hypovial" //Shouldn't be possible to get this without adminbuse @@ -80,27 +58,7 @@ "large purple hypovial" = "hypoviallarge-p", "large black hypovial" = "hypoviallarge-t" ) - -/obj/item/reagent_containers/glass/bottle/vial/large/update_icon() - cut_overlays() - if(reagents.total_volume) - var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "hypoviallarge10") - - var/percent = round((reagents.total_volume / volume) * 100) - switch(percent) - if(0 to 9) - filling.icon_state = "hypoviallarge10" - if(10 to 29) - filling.icon_state = "hypoviallarge25" - if(30 to 49) - filling.icon_state = "hypoviallarge50" - if(50 to 85) - filling.icon_state = "hypoviallarge75" - if(86 to INFINITY) - filling.icon_state = "hypoviallarge100" - - filling.color = mix_color_from_reagents(reagents.reagent_list) - add_overlay(filling) + cached_icon = "hypoviallarge" /obj/item/reagent_containers/glass/bottle/vial/large/bluespace possible_transfer_amounts = list(1,2,5,10,20) diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index 45bf8591a8..b8957775b1 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -12,6 +12,7 @@ var/mode = SYRINGE_DRAW var/busy = FALSE // needed for delayed drawing of blood var/proj_piercing = 0 //does it pierce through thick clothes when shot with syringe gun + var/show_filling = TRUE custom_materials = list(/datum/material/iron=10, /datum/material/glass=20) reagent_flags = TRANSPARENT @@ -21,6 +22,10 @@ mode = SYRINGE_INJECT update_icon() +/obj/item/reagent_containers/syringe/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_updates_onmob) + /obj/item/reagent_containers/syringe/on_reagent_change(changetype) update_icon() @@ -152,29 +157,32 @@ mode = SYRINGE_DRAW update_icon() - -/obj/item/reagent_containers/syringe/update_icon() - cut_overlays() - var/rounded_vol - if(reagents && reagents.total_volume) - rounded_vol = CLAMP(round((reagents.total_volume / volume * 15),5), 1, 15) - var/image/filling_overlay = mutable_appearance('icons/obj/reagentfillings.dmi', "syringe[rounded_vol]") - filling_overlay.color = mix_color_from_reagents(reagents.reagent_list) - add_overlay(filling_overlay) - else - rounded_vol = 0 +/obj/item/reagent_containers/syringe/update_icon_state() + var/rounded_vol = get_rounded_vol() icon_state = "[rounded_vol]" item_state = "syringe_[rounded_vol]" + +/obj/item/reagent_containers/syringe/update_overlays() + . = ..() + if(show_filling) + var/rounded_vol = get_rounded_vol() + if(reagents && reagents.total_volume) + . += mutable_appearance('icons/obj/reagentfillings.dmi', "syringe[rounded_vol]", color = mix_color_from_reagents(reagents.reagent_list)) if(ismob(loc)) - var/mob/M = loc var/injoverlay switch(mode) if (SYRINGE_DRAW) injoverlay = "draw" if (SYRINGE_INJECT) injoverlay = "inject" - add_overlay(injoverlay) - M.update_inv_hands() + . += injoverlay + +///Used by update_icon() and update_overlays() +/obj/item/reagent_containers/syringe/proc/get_rounded_vol() + if(reagents && reagents.total_volume) + return CLAMP(round((reagents.total_volume / volume * 15),5), 1, 15) + else + return 0 /obj/item/reagent_containers/syringe/epinephrine name = "syringe (epinephrine)" @@ -267,6 +275,7 @@ amount_per_transfer_from_this = 20 icon_state = "empty" item_state = "syringe_empty" + show_filling = FALSE var/emptrig = FALSE /obj/item/reagent_containers/syringe/dart/afterattack(atom/target, mob/user , proximity) @@ -317,28 +326,13 @@ /obj/item/reagent_containers/syringe/dart/attack_self(mob/user) return -/obj/item/reagent_containers/syringe/dart/update_icon() - cut_overlays() - var/rounded_vol - - rounded_vol = "empty" - if(reagents && reagents.total_volume) - if(volume/round(reagents.total_volume, 1) == 1) - rounded_vol="full" - mode = SYRINGE_INJECT - - icon_state = "[rounded_vol]" - item_state = "syringe_[rounded_vol]" - if(ismob(loc)) - var/mob/M = loc - var/injoverlay - switch(mode) - if (SYRINGE_DRAW) - injoverlay = "draw" - if (SYRINGE_INJECT) - injoverlay = "ready" - add_overlay(injoverlay) - M.update_inv_hands() +/obj/item/reagent_containers/syringe/dart/update_icon_state() + var/empty_full = "empty" + if(round(reagents.total_volume, 1) == reagents.maximum_volume) + empty_full = "full" + mode = SYRINGE_INJECT + icon_state = "[empty_full]" + item_state = "syringe_[empty_full]" /obj/item/reagent_containers/syringe/dart/emp_act(severity) emptrig = TRUE diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm index 11c80b14ee..425c94cd65 100644 --- a/code/modules/recycling/conveyor2.dm +++ b/code/modules/recycling/conveyor2.dm @@ -252,7 +252,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) // update the icon depending on the position -/obj/machinery/conveyor_switch/update_icon() +/obj/machinery/conveyor_switch/update_icon_state() if(position<0) if(invert_icon) icon_state = "switch-fwd" diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm index 78e18a01e2..65bfa1d98f 100644 --- a/code/modules/recycling/disposal/bin.dm +++ b/code/modules/recycling/disposal/bin.dm @@ -191,10 +191,6 @@ AM.pipe_eject(0) update_icon() -// update the icon & overlays to reflect mode & status -/obj/machinery/disposal/update_icon() - return - /obj/machinery/disposal/proc/flush() flushing = TRUE flushAnimation() @@ -386,8 +382,8 @@ pressure_charging = TRUE update_icon() -/obj/machinery/disposal/bin/update_icon() - cut_overlays() +/obj/machinery/disposal/bin/update_overlays() + . = ..() if(stat & BROKEN) pressure_charging = FALSE flush = FALSE @@ -395,7 +391,7 @@ //flush handle if(flush) - add_overlay("dispover-handle") + . += "dispover-handle" //only handle is shown if no power if(stat & NOPOWER || panel_open) @@ -403,13 +399,13 @@ //check for items in disposal - occupied light if(contents.len > 0) - add_overlay("dispover-full") + . += "dispover-full" //charging and ready light if(pressure_charging) - add_overlay("dispover-charge") + . += "dispover-charge" else if(full_pressure) - add_overlay("dispover-ready") + . += "dispover-ready" /obj/machinery/disposal/bin/proc/do_flush() set waitfor = FALSE diff --git a/code/modules/research/destructive_analyzer.dm b/code/modules/research/destructive_analyzer.dm index 10566b7de2..42b8a4dcbb 100644 --- a/code/modules/research/destructive_analyzer.dm +++ b/code/modules/research/destructive_analyzer.dm @@ -51,7 +51,7 @@ Note: Must be placed within 3 tiles of the R&D Console update_icon() reset_busy() -/obj/machinery/rnd/destructive_analyzer/update_icon() +/obj/machinery/rnd/destructive_analyzer/update_icon_state() if(loaded_item) icon_state = "d_analyzer_l" else diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm index b43abf97b2..3d4bf2b4c9 100644 --- a/code/modules/research/experimentor.dm +++ b/code/modules/research/experimentor.dm @@ -514,7 +514,7 @@ update_icon() recentlyExperimented = FALSE -/obj/machinery/rnd/experimentor/update_icon() +/obj/machinery/rnd/experimentor/update_icon_state() icon_state = "h_lathe" /obj/machinery/rnd/experimentor/proc/warn_admins(user, ReactionName) diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index 9919a6bf26..3e02ca4ee5 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -519,8 +519,9 @@ density = FALSE clockwork = TRUE //it'd look weird -/obj/machinery/computer/shuttle/pod/update_icon() - return +/obj/machinery/computer/shuttle/pod/ComponentInitialize() + . = ..() + AddElement(/datum/element/update_icon_blocker) /obj/machinery/computer/shuttle/pod/emag_act(mob/user) . = SEND_SIGNAL(src, COMSIG_ATOM_EMAG_ACT) diff --git a/code/modules/shuttle/manipulator.dm b/code/modules/shuttle/manipulator.dm index dcfb0793b5..3ba2198b35 100644 --- a/code/modules/shuttle/manipulator.dm +++ b/code/modules/shuttle/manipulator.dm @@ -31,14 +31,14 @@ SSshuttle.manipulator = null . = ..() -/obj/machinery/shuttle_manipulator/update_icon() - cut_overlays() +/obj/machinery/shuttle_manipulator/update_overlays() + . = ..() var/mutable_appearance/hologram_projection = mutable_appearance(icon, "hologram_on") hologram_projection.pixel_y = 22 var/mutable_appearance/hologram_ship = mutable_appearance(icon, "hologram_whiteship") hologram_ship.pixel_y = 27 - add_overlay(hologram_projection) - add_overlay(hologram_ship) + . += hologram_projection + . += hologram_ship /obj/machinery/shuttle_manipulator/can_interact(mob/user) // Only admins can use this, but they can use it from anywhere diff --git a/code/modules/shuttle/special.dm b/code/modules/shuttle/special.dm index f05adb9309..033187e353 100644 --- a/code/modules/shuttle/special.dm +++ b/code/modules/shuttle/special.dm @@ -21,7 +21,7 @@ desc = "Oh no, not again." update_icon() -/obj/machinery/power/emitter/energycannon/magical/update_icon() +/obj/machinery/power/emitter/energycannon/magical/update_icon_state() if(active) icon_state = icon_state_on else diff --git a/code/modules/station_goals/shield.dm b/code/modules/station_goals/shield.dm index b09dee04c7..cf0d79c742 100644 --- a/code/modules/station_goals/shield.dm +++ b/code/modules/station_goals/shield.dm @@ -118,7 +118,7 @@ anchored = FALSE update_icon() -/obj/machinery/satellite/update_icon() +/obj/machinery/satellite/update_icon_state() icon_state = active ? "sat_active" : "sat_inactive" /obj/machinery/satellite/attackby(obj/item/I, mob/user, params) diff --git a/code/modules/surgery/organs/appendix.dm b/code/modules/surgery/organs/appendix.dm index feace77018..9da20e4921 100644 --- a/code/modules/surgery/organs/appendix.dm +++ b/code/modules/surgery/organs/appendix.dm @@ -19,7 +19,7 @@ if(M) M.adjustToxLoss(4, TRUE, TRUE) //forced to ensure people don't use it to gain tox as slime person -/obj/item/organ/appendix/update_icon() +/obj/item/organ/appendix/update_icon_state() if(inflamed) icon_state = "appendixinflamed" name = "inflamed appendix" diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm index 37ee253d4b..daf3324980 100644 --- a/code/modules/surgery/organs/augments_arms.dm +++ b/code/modules/surgery/organs/augments_arms.dm @@ -31,7 +31,7 @@ else CRASH("Invalid zone for [type]") -/obj/item/organ/cyberimp/arm/update_icon() +/obj/item/organ/cyberimp/arm/update_icon_state() if(zone == BODY_ZONE_R_ARM) transform = null else // Mirroring the icon diff --git a/code/modules/surgery/organs/augments_chest.dm b/code/modules/surgery/organs/augments_chest.dm index 8426440bbb..47a452cc76 100644 --- a/code/modules/surgery/organs/augments_chest.dm +++ b/code/modules/surgery/organs/augments_chest.dm @@ -178,14 +178,11 @@ on = FALSE update_icon() -/obj/item/organ/cyberimp/chest/thrusters/update_icon() +/obj/item/organ/cyberimp/chest/thrusters/update_icon_state() if(on) icon_state = "imp_jetpack-on" else icon_state = "imp_jetpack" - for(var/X in actions) - var/datum/action/A = X - A.UpdateButtonIcon() /obj/item/organ/cyberimp/chest/thrusters/proc/move_react() allow_thrust(0.01) diff --git a/code/modules/surgery/organs/heart.dm b/code/modules/surgery/organs/heart.dm index 547ca38ead..ea98ecd32b 100644 --- a/code/modules/surgery/organs/heart.dm +++ b/code/modules/surgery/organs/heart.dm @@ -22,7 +22,7 @@ var/failed = FALSE //to prevent constantly running failing code var/operated = FALSE //whether the heart's been operated on to fix some of its damages -/obj/item/organ/heart/update_icon() +/obj/item/organ/heart/update_icon_state() if(beating) icon_state = "[icon_base]-on" else diff --git a/code/modules/vehicles/pimpin_ride.dm b/code/modules/vehicles/pimpin_ride.dm index c398b528d8..ef374f5db0 100644 --- a/code/modules/vehicles/pimpin_ride.dm +++ b/code/modules/vehicles/pimpin_ride.dm @@ -55,12 +55,12 @@ else return ..() -/obj/vehicle/ridden/janicart/update_icon() - cut_overlays() +/obj/vehicle/ridden/janicart/update_overlays() + . = ..() if(mybag) - add_overlay("cart_garbage") + . += "cart_garbage" if(floorbuffer) - add_overlay("cart_buffer") + . += "cart_buffer" /obj/vehicle/ridden/janicart/attack_hand(mob/user) . = ..() diff --git a/icons/obj/reagentfillings.dmi b/icons/obj/reagentfillings.dmi index eb3ca4b2f75436c9671241dd4e3333e1b132f8a2..3d5a825f27d17275c37304b9c24cd56c939249f3 100644 GIT binary patch delta 414 zcmV;P0b%~MAhaNmNPkPALzW6uF~B<*e08iGoaI;`-o68*O1k*-2GTFa_xWOOs=jvL z`=i<(_T`O2=j5ttwR)eG#od|Ms9G%-WzmqcO?-aoqK>3$H93)PDZI^Rld>=_bgEYK zviJ%5LeJ0tBn%f72rG2OHM-&kF9wyYgC#sA*1=MqhVx<_EPuhFu@08tm7k_6REa9mPc%BAQ8E7Dtfd*0;?K^96;IFfHBE^xZU z=?bU74bamMoUU=Y!Rcql5uks?R@mUcnuz_b2D{SD=#0ndDGIn)H)Pk|(Q3gpn!oWkI_b@V_+iRd&s@)^aZW)jS)+8wuQd)Sx1KLo^yOVeP) Iv)2J#4nzCU4gdfE delta 414 zcmV;P0b%~MAhaNmNPjIbWT`+E1H6O5SI5f1S&jwb?K?o)q>DdqApLaszFf?W)#vVO ze^lGUzPwRrom^F=7Vnd?xH}VTRjK)`ENXJLj?XV`)R9!BMkmq@g}3QsR2IgCR#j?R z7T-Z%==u4dgyC!n!X;X9g;reS&7hKXu!N_?I#|lna9*r~C4V?H*1-~-9P3~Sj_=iF znzxVOu9l`KOdq$ai2ruFrU~Lbg>>`!+<1L%E^-=7#3IR;S$dFcfLg$=%*SYeZe;pM~%8+bRd!UkSVtgwMMlV^izT|d0s zoMs@5jsj716bPcDKn#Cp#ml05=)h-mi0+~TpV4b-!x9{;-Eph7hkf}21Q5h8jhA;C Iv)2J#4(>G0bN~PV