From b033e1ed6a1e7f87edc73a75a96bcf6536e39aba Mon Sep 17 00:00:00 2001 From: Sun-Soaked <45698967+MemedHams@users.noreply.github.com> Date: Sat, 12 Aug 2023 02:37:59 -0400 Subject: [PATCH] Update_Appearance Port (#2170) ## About The Pull Request [(original pr)](https://github.com/tgstation/tgstation/pull/55468) After nine years in development we hope it was worth the wait I ported this specifically for the signals I'll need for world icons. However, it had a lot of other useful stuff, so I ended up just grabbing (almost) the entire pr. I tried to grab as few of the superfluous code rewrites as possible to make reviewing a bit easier, but I couldn't help grab stuff like the APC icon code rewrite(the original code was a war crime). ## Why It's Good For The Game - ports the wrapper proc `update_appearance` for icons, descs, and names, adds `update_desc` and `update_name` subprocs to handle those. Things. without just stuffing them into update_icons like some kind of psychopath - ports a bunch of signal hooks useful for changing names, descriptions, and icons. I needed these for world_icons which is where this wild ride all started - ports some `base_icon_state` implementation. Stuff like spear code makes slightly less duplicates(and more sense) now which is nice. We could definitely implement it more I think but that's a future me problem - 500 files of immersive vsc-mass-editing action to implement `update_appearance()`(sorry in advance, but not as sorry as I was when manually copy-pasting the custom ones for like 3 straight days) -"consig" and "comisg" have been taken out behind the codebase and shot. Not 'technically' a bug it just made my head hurt -My first pr with 0 player facing changes (confetti) ## Changelog :cl: TemporalOroboros, Memed Hams code: ports update_appearance, update_name, and update_desc from tg, as well as associated signals code: a bit of base_icon_state implementation. Can you believe it's been sitting in our code almost unused for like 3 years code: cleans up some code formatting, mainly around custom icons and overlays code: fixes the typos in COMSIG_STORAGE_EXITED and COMSIG_STORAGE_ENTERED /:cl: --- check_regex.yaml | 2 +- code/__DEFINES/dcs/signals.dm | 16 +- code/_onclick/hud/action_button.dm | 10 +- code/_onclick/hud/alien.dm | 6 +- code/_onclick/hud/alien_larva.dm | 4 +- code/_onclick/hud/constructs.dm | 2 +- code/_onclick/hud/devil.dm | 4 +- code/_onclick/hud/drones.dm | 2 +- code/_onclick/hud/families.dm | 7 +- code/_onclick/hud/generic_dextrous.dm | 6 +- code/_onclick/hud/guardian.dm | 4 +- code/_onclick/hud/holograms.dm | 4 +- code/_onclick/hud/hud.dm | 2 +- code/_onclick/hud/human.dm | 6 +- code/_onclick/hud/living.dm | 2 +- code/_onclick/hud/monkey.dm | 6 +- code/_onclick/hud/revenanthud.dm | 2 +- code/_onclick/hud/robot.dm | 15 +- code/_onclick/hud/screen_objects.dm | 37 +- code/_onclick/telekinesis.dm | 10 +- code/controllers/subsystem/acid.dm | 2 +- code/controllers/subsystem/mapping.dm | 2 +- code/controllers/subsystem/persistence.dm | 2 +- code/datums/components/armor_plate.dm | 2 +- code/datums/components/embedded.dm | 2 +- code/datums/components/plumbing/_plumbing.dm | 4 +- .../components/storage/concrete/_concrete.dm | 4 +- code/datums/components/storage/storage.dm | 2 +- code/datums/components/taped.dm | 2 +- code/datums/components/twohanded.dm | 18 +- code/datums/diseases/appendicitis.dm | 2 +- code/datums/elements/decals/_decals.dm | 6 +- code/datums/martial/sleeping_carp.dm | 6 +- code/datums/status_effects/neutral.dm | 2 +- code/datums/traits/neutral.dm | 2 +- code/datums/wires/airalarm.dm | 8 +- code/datums/wires/airlock.dm | 8 +- code/datums/wires/airlock_cycle.dm | 4 +- code/datums/wires/apc.dm | 3 +- code/datums/wires/syndicatebomb.dm | 4 +- code/game/area/areas.dm | 8 +- code/game/atoms.dm | 23 +- code/game/atoms_movable.dm | 4 +- .../game/gamemodes/clown_ops/bananium_bomb.dm | 12 +- code/game/gamemodes/events.dm | 8 +- code/game/gamemodes/gang/gang.dm | 2 +- code/game/gamemodes/sandbox/h_sandbox.dm | 2 +- code/game/machinery/PDApainter.dm | 20 +- code/game/machinery/Sleeper.dm | 11 +- code/game/machinery/_machinery.dm | 8 +- code/game/machinery/ai_slipper.dm | 10 +- code/game/machinery/airlock_control.dm | 26 +- code/game/machinery/airlock_cycle_control.dm | 65 +-- code/game/machinery/announcement_system.dm | 17 +- code/game/machinery/aug_manipulator.dm | 25 +- code/game/machinery/autolathe.dm | 2 +- code/game/machinery/buttons.dm | 18 +- code/game/machinery/camera/camera.dm | 23 +- code/game/machinery/camera/camera_assembly.dm | 7 +- code/game/machinery/camera/presets.dm | 4 +- code/game/machinery/cell_charger.dm | 8 +- code/game/machinery/cloning.dm | 4 +- code/game/machinery/computer/_computer.dm | 4 +- code/game/machinery/computer/aifixer.dm | 20 +- code/game/machinery/computer/apc_control.dm | 8 +- code/game/machinery/computer/arcade.dm | 2 +- code/game/machinery/computer/atmos_alert.dm | 7 +- code/game/machinery/computer/atmos_control.dm | 1 + .../game/machinery/computer/buildandrepair.dm | 18 +- code/game/machinery/computer/camera.dm | 1 + code/game/machinery/computer/teleporter.dm | 12 +- code/game/machinery/cryopod.dm | 2 +- code/game/machinery/dance_machine.dm | 10 +- code/game/machinery/defibrillator_mount.dm | 10 +- code/game/machinery/dish_drive.dm | 2 +- code/game/machinery/dna_scanner.dm | 18 +- code/game/machinery/doors/airlock.dm | 167 +++--- code/game/machinery/doors/airlock_types.dm | 6 +- code/game/machinery/doors/brigdoors.dm | 12 +- code/game/machinery/doors/door.dm | 11 +- code/game/machinery/doors/firedoor.dm | 41 +- code/game/machinery/doors/passworddoor.dm | 6 +- code/game/machinery/doors/poddoor.dm | 8 +- code/game/machinery/doors/windowdoor.dm | 8 +- code/game/machinery/doppler_array.dm | 11 +- code/game/machinery/droneDispenser.dm | 11 +- .../embedded_controller/access_controller.dm | 32 +- .../embedded_controller/airlock_controller.dm | 11 +- .../embedded_controller_base.dm | 2 +- .../simple_vent_controller.dm | 7 +- code/game/machinery/fat_sucker.dm | 8 +- code/game/machinery/firealarm.dm | 25 +- code/game/machinery/flasher.dm | 17 +- code/game/machinery/gulag_teleporter.dm | 11 +- code/game/machinery/harvester.dm | 22 +- code/game/machinery/hologram.dm | 15 +- code/game/machinery/hypnochair.dm | 21 +- code/game/machinery/igniter.dm | 21 +- code/game/machinery/iv_drip.dm | 33 +- code/game/machinery/lightswitch.dm | 30 +- code/game/machinery/medical_kiosk.dm | 69 ++- code/game/machinery/navbeacon.dm | 6 +- code/game/machinery/newscaster.dm | 29 +- code/game/machinery/pipe/pipe_dispenser.dm | 2 +- .../machinery/porta_turret/portable_turret.dm | 73 +-- .../porta_turret/portable_turret_cover.dm | 16 +- code/game/machinery/prisonlabor.dm | 22 +- code/game/machinery/recharger.dm | 44 +- code/game/machinery/rechargestation.dm | 14 +- code/game/machinery/recycler.dm | 12 +- code/game/machinery/requests_console.dm | 61 +- code/game/machinery/roulette_machine.dm | 15 +- code/game/machinery/sheetifier.dm | 7 +- code/game/machinery/shieldgen.dm | 19 +- code/game/machinery/shuttle/shuttle_engine.dm | 3 + code/game/machinery/slotmachine.dm | 24 +- code/game/machinery/spaceheater.dm | 23 +- code/game/machinery/stasis.dm | 47 +- code/game/machinery/suit_storage_unit.dm | 16 +- code/game/machinery/syndicatebomb.dm | 11 +- .../telecomms/machines/message_server.dm | 13 +- .../machinery/telecomms/telecomunications.dm | 14 +- code/game/machinery/teleporter.dm | 37 +- code/game/machinery/transformer.dm | 5 +- code/game/machinery/washing_machine.dm | 25 +- .../mecha/equipment/tools/medical_tools.dm | 4 +- code/game/mecha/equipment/tools/work_tools.dm | 4 +- code/game/mecha/mech_bay.dm | 14 +- code/game/mecha/mecha.dm | 8 +- code/game/mecha/working/ripley.dm | 4 +- .../effects/anomalies/anomalies_melter.dm | 10 +- code/game/objects/effects/decals/cleanable.dm | 2 +- .../effects/decals/cleanable/humans.dm | 14 +- .../effects/effect_system/effects_foam.dm | 2 +- .../effects/effect_system/effects_smoke.dm | 2 +- .../objects/effects/spawners/bombspawner.dm | 2 +- .../temporary_visuals/miscellaneous.dm | 16 +- code/game/objects/items/RCD.dm | 7 +- code/game/objects/items/RCL.dm | 18 +- code/game/objects/items/RPD.dm | 2 +- code/game/objects/items/broom.dm | 10 +- code/game/objects/items/candle.dm | 12 +- code/game/objects/items/cards_ids.dm | 8 +- code/game/objects/items/cash.dm | 19 +- code/game/objects/items/chrono_eraser.dm | 7 +- code/game/objects/items/cigs_lighters.dm | 9 +- code/game/objects/items/crayons.dm | 9 +- code/game/objects/items/credit_holochip.dm | 51 +- code/game/objects/items/defib.dm | 33 +- code/game/objects/items/devices/PDA/PDA.dm | 24 +- code/game/objects/items/devices/aicard.dm | 8 +- code/game/objects/items/devices/flashlight.dm | 36 +- .../objects/items/devices/geiger_counter.dm | 45 +- .../objects/items/devices/lightreplacer.dm | 5 +- code/game/objects/items/devices/multitool.dm | 2 +- .../items/devices/portable_chem_mixer.dm | 22 +- code/game/objects/items/devices/powersink.dm | 3 +- .../objects/items/devices/quantum_keycard.dm | 6 +- .../objects/items/devices/radio/intercom.dm | 6 +- code/game/objects/items/devices/swapper.dm | 16 +- .../objects/items/devices/taperecorder.dm | 27 +- .../objects/items/devices/traitordevices.dm | 2 +- .../objects/items/devices/transfer_valve.dm | 48 +- code/game/objects/items/dice.dm | 4 +- code/game/objects/items/documents.dm | 2 +- code/game/objects/items/dualsaber.dm | 8 +- code/game/objects/items/energyhalberd.dm | 4 +- code/game/objects/items/etherealdiscoball.dm | 7 +- code/game/objects/items/fireaxe.dm | 11 +- code/game/objects/items/flamethrower.dm | 16 +- .../objects/items/grenades/discogrenade.dm | 2 +- code/game/objects/items/grenades/festive.dm | 4 +- code/game/objects/items/handcuffs.dm | 11 +- code/game/objects/items/hot_potato.dm | 7 +- code/game/objects/items/hourglass.dm | 8 +- .../objects/items/implants/implantcase.dm | 16 +- .../objects/items/implants/implantchair.dm | 7 +- code/game/objects/items/implants/implanter.dm | 10 +- .../game/objects/items/implants/implantpad.dm | 7 +- code/game/objects/items/inducer.dm | 26 +- code/game/objects/items/melee/misc.dm | 19 +- code/game/objects/items/mop.dm | 2 +- code/game/objects/items/pet_carrier.dm | 15 +- code/game/objects/items/pinpointer.dm | 4 +- code/game/objects/items/pitchfork.dm | 6 +- code/game/objects/items/plushes.dm | 19 +- code/game/objects/items/pneumaticCannon.dm | 4 +- code/game/objects/items/puzzle_pieces.dm | 2 + code/game/objects/items/robot/robot_items.dm | 31 +- code/game/objects/items/robot/robot_parts.dm | 18 +- .../objects/items/robot/robot_upgrades.dm | 5 +- code/game/objects/items/sharpener.dm | 2 +- code/game/objects/items/shields.dm | 11 +- code/game/objects/items/singularityhammer.dm | 12 +- code/game/objects/items/spear.dm | 32 +- .../objects/items/stacks/license_plates.dm | 8 +- code/game/objects/items/stacks/medical.dm | 14 +- code/game/objects/items/stacks/rods.dm | 3 +- code/game/objects/items/stacks/stack.dm | 16 +- code/game/objects/items/stacks/tickets.dm | 3 +- .../items/stacks/tiles/tile_reskinning.dm | 2 +- code/game/objects/items/storage/bags.dm | 9 +- code/game/objects/items/storage/belt.dm | 25 +- code/game/objects/items/storage/boxes.dm | 3 +- code/game/objects/items/storage/fancy.dm | 200 ++++--- code/game/objects/items/storage/lockbox.dm | 20 +- code/game/objects/items/storage/sixpack.dm | 3 +- code/game/objects/items/storage/toolbox.dm | 4 +- code/game/objects/items/storage/wallets.dm | 11 +- code/game/objects/items/stunbaton.dm | 31 +- code/game/objects/items/tanks/watertank.dm | 2 +- code/game/objects/items/theft_tools.dm | 7 +- code/game/objects/items/tools/screwdriver.dm | 2 +- code/game/objects/items/tools/weldingtool.dm | 20 +- code/game/objects/items/tools/wirecutters.dm | 2 +- code/game/objects/items/tools/wrench.dm | 3 +- code/game/objects/items/toys.dm | 18 +- code/game/objects/items/weaponry.dm | 6 +- code/game/objects/obj_defense.dm | 6 +- code/game/objects/structures/ai_core.dm | 27 +- code/game/objects/structures/artstuff.dm | 27 +- code/game/objects/structures/bedsheet_bin.dm | 9 +- code/game/objects/structures/catwalk.dm | 8 +- .../structures/crates_lockers/closets.dm | 62 +-- .../crates_lockers/closets/bodybag.dm | 4 +- .../crates_lockers/closets/secure/personal.dm | 2 +- .../structures/crates_lockers/crates.dm | 7 +- .../structures/crates_lockers/crates/bins.dm | 13 +- .../crates_lockers/crates/critter.dm | 10 +- .../crates_lockers/crates/secure.dm | 9 +- code/game/objects/structures/displaycase.dm | 30 +- code/game/objects/structures/divine.dm | 5 +- code/game/objects/structures/door_assembly.dm | 15 +- code/game/objects/structures/extinguisher.dm | 14 +- code/game/objects/structures/false_walls.dm | 31 +- code/game/objects/structures/fireaxe.dm | 58 +- code/game/objects/structures/fireplace.dm | 33 +- code/game/objects/structures/grille.dm | 14 +- code/game/objects/structures/guncase.dm | 17 +- code/game/objects/structures/headpike.dm | 22 +- code/game/objects/structures/janicart.dm | 6 +- code/game/objects/structures/ladders.dm | 33 +- code/game/objects/structures/life_candle.dm | 8 +- code/game/objects/structures/mineral_doors.dm | 5 +- code/game/objects/structures/mop_bucket.dm | 4 +- code/game/objects/structures/morgue.dm | 92 ++- .../objects/structures/poddoor_assembly.dm | 6 +- code/game/objects/structures/safe.dm | 8 +- code/game/objects/structures/shower.dm | 2 +- code/game/objects/structures/stairs.dm | 10 +- code/game/objects/structures/tables_racks.dm | 1 + .../game/objects/structures/tank_dispenser.dm | 6 +- .../structures/transit_tubes/station.dm | 4 +- .../transit_tubes/transit_tube_pod.dm | 10 +- code/game/objects/structures/tribal_torch.dm | 6 +- code/game/objects/structures/votingbox.dm | 3 +- code/game/objects/structures/watercloset.dm | 29 +- .../objects/structures/windoor_assembly.dm | 7 +- code/game/objects/structures/window.dm | 53 +- code/game/turfs/closed/wall/conc_walls.dm | 2 +- code/game/turfs/closed/wall/reinf_walls.dm | 29 +- code/game/turfs/closed/walls.dm | 6 +- code/game/turfs/open/floor.dm | 2 +- code/game/turfs/open/floor/conc_floor.dm | 14 +- code/game/turfs/open/floor/fancy_floor.dm | 7 +- code/game/turfs/open/floor/light_floor.dm | 66 ++- code/game/turfs/open/floor/mineral_floor.dm | 10 +- code/game/turfs/open/floor/misc_floor.dm | 24 +- code/game/turfs/open/floor/plasteel_floor.dm | 3 +- code/game/turfs/open/floor/plating.dm | 2 +- code/game/turfs/open/floor/plating/icemoon.dm | 6 +- code/game/turfs/open/space/transit.dm | 3 +- code/modules/NTNet/relays.dm | 16 +- code/modules/admin/verbs/debug.dm | 4 +- code/modules/admin/verbs/manipulate_organs.dm | 2 +- .../abductor/equipment/abduction_gear.dm | 4 +- .../abductor/machinery/experiment.dm | 6 +- .../blob/blobstrains/_blobstrain.dm | 2 +- .../blob/blobstrains/replicating_foam.dm | 2 +- code/modules/antagonists/blob/overmind.dm | 4 +- code/modules/antagonists/blob/powers.dm | 4 +- .../antagonists/blob/structures/_blob.dm | 40 +- .../antagonists/blob/structures/core.dm | 29 +- .../antagonists/blob/structures/node.dm | 9 +- .../antagonists/blob/structures/shield.dm | 30 +- code/modules/antagonists/cult/cult_items.dm | 7 +- .../antagonists/cult/cult_structures.dm | 3 +- .../nukeop/equipment/nuclearbomb.dm | 25 +- .../antagonists/revolution/revolution.dm | 2 +- .../traitor/equipment/Malf_Modules.dm | 2 +- code/modules/assembly/assembly.dm | 10 +- code/modules/assembly/bomb.dm | 11 +- code/modules/assembly/doorcontrol.dm | 2 +- code/modules/assembly/flash.dm | 31 +- code/modules/assembly/health.dm | 2 +- code/modules/assembly/holder.dm | 42 +- code/modules/assembly/infrared.dm | 31 +- code/modules/assembly/mousetrap.dm | 22 +- code/modules/assembly/proximity.dm | 23 +- code/modules/assembly/signaler.dm | 9 +- code/modules/assembly/timer.dm | 20 +- .../atmospherics/machinery/airalarm.dm | 24 +- .../atmospherics/machinery/atmosmachinery.dm | 6 +- .../components/binary_devices/circulator.dm | 10 +- .../components/binary_devices/dp_vent_pump.dm | 6 +- .../components/binary_devices/passive_gate.dm | 8 +- .../binary_devices/pressure_valve.dm | 6 +- .../components/binary_devices/pump.dm | 8 +- .../components/binary_devices/relief_valve.dm | 2 +- .../binary_devices/temperature_gate.dm | 6 +- .../binary_devices/temperature_pump.dm | 6 +- .../components/binary_devices/volume_pump.dm | 8 +- .../machinery/components/components_base.dm | 5 +- .../components/trinary_devices/filter.dm | 21 +- .../components/trinary_devices/mixer.dm | 22 +- .../components/unary_devices/cryo.dm | 16 +- .../unary_devices/heat_exchanger.dm | 8 +- .../unary_devices/outlet_injector.dm | 8 +- .../components/unary_devices/relief_valve.dm | 2 +- .../components/unary_devices/thermomachine.dm | 19 +- .../components/unary_devices/unary_devices.dm | 2 +- .../components/unary_devices/vent_pump.dm | 6 +- .../components/unary_devices/vent_scrubber.dm | 6 +- .../atmospherics/machinery/other/miner.dm | 8 +- .../machinery/pipes/heat_exchange/junction.dm | 4 +- .../machinery/pipes/heat_exchange/manifold.dm | 10 +- .../pipes/heat_exchange/manifold4w.dm | 10 +- .../machinery/pipes/heat_exchange/simple.dm | 4 +- .../machinery/pipes/layermanifold.dm | 33 +- .../atmospherics/machinery/pipes/manifold.dm | 13 +- .../machinery/pipes/manifold4w.dm | 8 +- .../atmospherics/machinery/pipes/pipes.dm | 4 + .../atmospherics/machinery/pipes/simple.dm | 4 +- .../machinery/portable/canister.dm | 11 +- .../portable/portable_atmospherics.dm | 12 +- .../atmospherics/machinery/portable/pump.dm | 7 +- .../machinery/portable/scrubber.dm | 10 +- code/modules/atmospherics/multiz.dm | 8 +- code/modules/awaymissions/gateway.dm | 6 +- .../awaymissions/mission_code/challenge.dm | 1 + code/modules/buildmode/buildmode.dm | 4 +- code/modules/buildmode/buttons.dm | 6 +- code/modules/cargo/bounty_console.dm | 2 +- code/modules/cargo/centcom_podlauncher.dm | 2 +- code/modules/cargo/expressconsole.dm | 2 +- code/modules/cargo/gondolapod.dm | 5 +- code/modules/cargo/supplypod.dm | 10 +- code/modules/cargo/supplypod_beacon.dm | 11 +- code/modules/client/preferences_toggles.dm | 4 +- code/modules/clothing/chameleon.dm | 2 +- code/modules/clothing/clothing.dm | 23 +- code/modules/clothing/glasses/_glasses.dm | 5 +- .../clothing/glasses/engine_goggles.dm | 5 +- code/modules/clothing/head/hardhat.dm | 7 +- code/modules/clothing/head/helmet.dm | 10 +- code/modules/clothing/head/misc_special.dm | 14 +- code/modules/clothing/shoes/bananashoes.dm | 5 +- code/modules/clothing/spacesuits/hardsuit.dm | 11 +- code/modules/clothing/spacesuits/plasmamen.dm | 10 +- code/modules/disks/disk.dm | 2 +- code/modules/donator/_donator.dm | 2 +- code/modules/events/prison_break.dm | 2 +- code/modules/events/stray_cargo.dm | 2 +- .../modules/fishing/fishing_portal_machine.dm | 4 +- code/modules/fishing/fishing_rod.dm | 10 +- code/modules/flufftext/Hallucination.dm | 3 +- code/modules/food_and_drinks/drinks/drinks.dm | 2 +- .../food_and_drinks/drinks/drinks/bottle.dm | 5 +- .../food_and_drinks/drinks/drinks/modglass.dm | 6 +- .../modules/food_and_drinks/food/condiment.dm | 7 +- .../food_and_drinks/food/customizables.dm | 3 +- .../food_and_drinks/food/snacks_frozen.dm | 8 +- .../food_and_drinks/food/snacks_pastry.dm | 25 +- .../kitchen_machinery/cutting_board.dm | 6 +- .../kitchen_machinery/gibber.dm | 8 +- .../kitchen_machinery/grill.dm | 15 +- .../kitchen_machinery/icecream_vat.dm | 2 +- .../kitchen_machinery/microwave.dm | 20 +- .../kitchen_machinery/smartfridge.dm | 55 +- code/modules/food_and_drinks/pizzabox.dm | 83 +-- code/modules/games/cas.dm | 8 +- code/modules/holodeck/area_copy.dm | 2 +- code/modules/holodeck/items.dm | 3 +- .../hydroponics/beekeeping/honeycomb.dm | 4 +- code/modules/hydroponics/biogenerator.dm | 19 +- code/modules/hydroponics/fermenting_barrel.dm | 3 +- code/modules/hydroponics/gene_modder.dm | 7 +- code/modules/hydroponics/hydroponics.dm | 93 ++-- code/modules/hydroponics/plant_genes.dm | 6 +- code/modules/instruments/items.dm | 4 +- code/modules/library/lib_items.dm | 24 +- code/modules/library/random_books.dm | 2 +- code/modules/mapping/mapping_helpers.dm | 6 +- .../modules/mining/equipment/explorer_gear.dm | 2 +- .../mining/equipment/kinetic_crusher.dm | 9 +- .../mining/equipment/marker_beacons.dm | 22 +- .../mining/equipment/regenerative_core.dm | 8 +- code/modules/mining/equipment/survival_pod.dm | 1 + code/modules/mining/lavaland/ash_flora.dm | 1 + .../mining/lavaland/necropolis_chests.dm | 10 +- code/modules/mining/lavaland/ruins/gym.dm | 4 +- code/modules/mining/machine_bluespaceminer.dm | 9 +- code/modules/mining/machine_redemption.dm | 3 +- .../modules/mob/dead/new_player/new_player.dm | 2 +- code/modules/mob/dead/observer/login.dm | 2 +- code/modules/mob/dead/observer/observer.dm | 8 +- code/modules/mob/living/brain/MMI.dm | 14 +- code/modules/mob/living/brain/brain_item.dm | 2 +- code/modules/mob/living/brain/death.dm | 2 +- code/modules/mob/living/brain/posibrain.dm | 22 +- .../carbon/alien/humanoid/alien_powers.dm | 1 + .../carbon/alien/utilities/structures.dm | 7 +- code/modules/mob/living/carbon/carbon.dm | 4 +- .../mob/living/carbon/hologram/em_holopads.dm | 1 + .../mob/living/carbon/hologram/hologram.dm | 4 +- .../carbon/hologram/hologram_inventory.dm | 4 +- .../human/species_types/shadowpeople.dm | 2 +- .../mob/living/carbon/human/update_icons.dm | 28 +- .../modules/mob/living/carbon/update_icons.dm | 10 +- code/modules/mob/living/init_signals.dm | 4 +- code/modules/mob/living/silicon/ai/ai.dm | 6 +- .../modules/mob/living/silicon/ai/multicam.dm | 6 +- .../modules/mob/living/silicon/robot/robot.dm | 10 +- .../mob/living/silicon/robot/robot_defense.dm | 2 +- .../mob/living/silicon/robot/robot_modules.dm | 4 +- .../living/simple_animal/bot/SuperBeepsky.dm | 6 +- .../mob/living/simple_animal/bot/bot.dm | 11 +- .../living/simple_animal/bot/construction.dm | 27 +- .../mob/living/simple_animal/bot/firebot.dm | 21 +- .../mob/living/simple_animal/bot/floorbot.dm | 14 +- .../mob/living/simple_animal/bot/honkbot.dm | 4 +- .../living/simple_animal/bot/hygienebot.dm | 7 +- .../mob/living/simple_animal/bot/medbot.dm | 39 +- .../mob/living/simple_animal/bot/mulebot.dm | 13 +- .../mob/living/simple_animal/bot/secbot.dm | 10 +- .../mob/living/simple_animal/bot/vibebot.dm | 6 +- .../simple_animal/hostile/giant_spider.dm | 1 + .../mob/living/simple_animal/hostile/mimic.dm | 8 +- .../hostile/mining_mobs/basilisk.dm | 6 +- .../mob/living/simple_animal/simple_animal.dm | 4 +- .../mob/living/simple_animal/slime/slime.dm | 5 +- code/modules/mob/mob.dm | 4 +- code/modules/mob/mob_movement.dm | 2 +- .../computers/item/computer.dm | 19 +- .../computers/item/computer_components.dm | 2 +- .../computers/item/computer_ui.dm | 6 +- .../computers/item/laptop.dm | 13 +- .../computers/item/processor.dm | 4 +- .../computers/item/tablet.dm | 16 +- .../computers/machinery/modular_computer.dm | 38 +- .../computers/machinery/modular_console.dm | 2 +- .../modular_computers/file_system/program.dm | 4 +- .../programs/antagonist/revelation.dm | 2 +- .../file_system/programs/arcade.dm | 6 +- .../file_system/programs/radar.dm | 6 +- .../file_system/programs/sm_monitor.dm | 2 +- code/modules/ninja/suit/ninjaDrainAct.dm | 4 +- code/modules/ninja/suit/suit_attackby.dm | 2 +- .../overmap/missions/research_mission.dm | 2 +- code/modules/overmap/objects/dynamic_datum.dm | 2 +- code/modules/overmap/objects/event_datum.dm | 10 +- code/modules/overmap/overmap_token.dm | 2 +- .../overmap/ships/controlled_ship_datum.dm | 2 +- code/modules/paperwork/clipboard.dm | 8 +- code/modules/paperwork/contract.dm | 2 +- code/modules/paperwork/folders.dm | 16 +- code/modules/paperwork/paper_cutter.dm | 11 +- code/modules/paperwork/paperbin.dm | 13 +- code/modules/paperwork/paperplane.dm | 4 +- code/modules/paperwork/pen.dm | 3 +- code/modules/paperwork/ticketmachine.dm | 11 +- code/modules/photography/photos/frame.dm | 10 +- code/modules/photography/photos/photo.dm | 5 +- code/modules/plumbing/ducts.dm | 11 +- code/modules/plumbing/plumbers/acclimator.dm | 7 +- code/modules/plumbing/plumbers/pumps.dm | 12 +- code/modules/plumbing/plumbers/synthesizer.dm | 2 +- code/modules/power/apc.dm | 524 ++++++++++-------- code/modules/power/cable.dm | 42 +- code/modules/power/cell.dm | 27 +- code/modules/power/generator.dm | 17 +- code/modules/power/gravitygenerator.dm | 23 +- code/modules/power/lighting.dm | 5 +- code/modules/power/port_gen.dm | 5 +- code/modules/power/power.dm | 2 +- code/modules/power/singularity/collector.dm | 6 +- code/modules/power/singularity/emitter.dm | 19 +- .../power/singularity/field_generator.dm | 10 +- .../particle_accelerator.dm | 5 +- .../particle_accelerator/particle_control.dm | 17 +- code/modules/power/smes.dm | 18 +- code/modules/power/solar.dm | 10 +- code/modules/power/supermatter/supermatter.dm | 4 +- .../projectiles/ammunition/_ammunition.dm | 13 +- .../modules/projectiles/ammunition/_firing.dm | 2 +- .../ammunition/ballistic/shotgun.dm | 1 + .../ammunition/caseless/_caseless.dm | 3 +- .../projectiles/ammunition/caseless/foam.dm | 23 +- .../boxes_magazines/_box_magazine.dm | 55 +- .../boxes_magazines/external/lmg.dm | 7 +- .../boxes_magazines/external/pistol.dm | 29 +- .../boxes_magazines/external/rechargable.dm | 9 +- .../boxes_magazines/external/rifle.dm | 31 +- .../boxes_magazines/external/shotgun.dm | 15 +- .../boxes_magazines/external/smg.dm | 58 +- .../boxes_magazines/external/sniper.dm | 10 +- .../boxes_magazines/external/toy.dm | 24 +- code/modules/projectiles/gun.dm | 12 +- code/modules/projectiles/guns/ballistic.dm | 35 +- .../projectiles/guns/ballistic/assault.dm | 4 +- .../projectiles/guns/ballistic/automatic.dm | 2 +- .../modules/projectiles/guns/ballistic/hmg.dm | 5 +- .../projectiles/guns/ballistic/revolver.dm | 4 +- .../projectiles/guns/ballistic/rifle.dm | 2 +- .../projectiles/guns/ballistic/shotgun.dm | 4 +- .../modules/projectiles/guns/ballistic/smg.dm | 8 +- code/modules/projectiles/guns/energy.dm | 23 +- .../projectiles/guns/energy/dueling.dm | 24 +- .../projectiles/guns/energy/energy_gun.dm | 18 +- .../guns/energy/kinetic_accelerator.dm | 4 +- .../projectiles/guns/energy/laser_gatling.dm | 10 +- .../projectiles/guns/energy/special.dm | 8 +- code/modules/projectiles/guns/magic/wand.dm | 13 +- .../projectiles/guns/misc/blastcannon.dm | 14 +- code/modules/projectiles/guns/misc/bow.dm | 11 +- code/modules/projectiles/guns/powered.dm | 10 +- code/modules/projectiles/projectile/magic.dm | 10 +- .../projectile/reusable/foam_dart.dm | 4 +- .../projectiles/projectile/special/curse.dm | 1 + .../chemistry/machinery/chem_dispenser.dm | 18 +- .../chemistry/machinery/chem_heater.dm | 13 +- .../chemistry/machinery/chem_master.dm | 13 +- .../chemistry/machinery/chem_synthesizer.dm | 3 +- .../reagents/chemistry/machinery/pandemic.dm | 21 +- .../chemistry/machinery/reagentgrinder.dm | 15 +- .../chemistry/machinery/smoke_machine.dm | 19 +- .../chemistry/reagents/other_reagents.dm | 2 +- .../reagents/chemistry/recipes/special.dm | 2 +- code/modules/reagents/reagent_containers.dm | 32 +- .../reagents/reagent_containers/blood_pack.dm | 11 +- .../reagents/reagent_containers/borghydro.dm | 2 +- .../reagents/reagent_containers/dropper.dm | 15 +- .../reagents/reagent_containers/hypospray.dm | 49 +- .../reagents/reagent_containers/hypovial.dm | 10 +- .../reagents/reagent_containers/maunamug.dm | 43 +- .../reagents/reagent_containers/syringes.dm | 28 +- code/modules/reagents/reagent_dispenser.dm | 2 +- code/modules/recycling/conveyor2.dm | 40 +- code/modules/recycling/disposal/bin.dm | 43 +- .../recycling/disposal/construction.dm | 34 +- code/modules/research/bepis.dm | 22 +- code/modules/research/destructive_analyzer.dm | 13 +- code/modules/research/experimentor.dm | 8 +- .../research/nanites/nanite_chamber.dm | 34 +- .../nanites/nanite_chamber_computer.dm | 2 +- .../modules/research/nanites/nanite_remote.dm | 6 +- .../research/nanites/public_chamber.dm | 5 +- .../lavalandruin_code/elephantgraveyard.dm | 4 +- .../security_levels/keycard_authentication.dm | 4 +- code/modules/shuttle/on_move.dm | 4 +- code/modules/shuttle/shuttle_rotate.dm | 4 +- code/modules/shuttle/special.dm | 11 +- code/modules/spells/spell.dm | 4 +- code/modules/spells/spell_types/aimed.dm | 2 + code/modules/spells/spell_types/charge.dm | 2 +- .../spells/spell_types/pointed/pointed.dm | 7 +- code/modules/spells/spell_types/soultap.dm | 2 +- code/modules/spells/spell_types/summonitem.dm | 2 +- code/modules/station_goals/bsa.dm | 2 +- code/modules/station_goals/shield.dm | 6 +- .../surgery/bodyparts/dismemberment.dm | 6 +- code/modules/surgery/bodyparts/parts.dm | 4 +- code/modules/surgery/implant_removal.dm | 2 +- code/modules/surgery/organs/appendix.dm | 17 +- code/modules/surgery/organs/augments_arms.dm | 10 +- code/modules/surgery/organs/augments_chest.dm | 9 +- code/modules/surgery/organs/heart.dm | 16 +- code/modules/vehicles/motorized_wheelchair.dm | 2 +- code/modules/vehicles/pimpin_ride.dm | 8 +- code/modules/vending/_vending.dm | 18 +- 580 files changed, 4158 insertions(+), 3683 deletions(-) diff --git a/check_regex.yaml b/check_regex.yaml index 6d12924537bf..c28639172af2 100644 --- a/check_regex.yaml +++ b/check_regex.yaml @@ -38,7 +38,7 @@ standards: - exactly: [ - 290, + 297, "non-bitwise << uses", '(?You strengthen [R], improving its resistance against melee, bullet and laser damage.") else to_chat(user, "You strengthen [O], improving its resistance against melee attacks.") diff --git a/code/datums/components/embedded.dm b/code/datums/components/embedded.dm index 42f84ccfff2e..dcb4aff50bdf 100644 --- a/code/datums/components/embedded.dm +++ b/code/datums/components/embedded.dm @@ -329,7 +329,7 @@ M.Translate(pixelX, pixelY) overlay.transform = M RegisterSignal(hit,COMSIG_ATOM_UPDATE_OVERLAYS,.proc/apply_overlay) - hit.update_icon() + hit.update_appearance() if(harmful) hit.visible_message("[weapon] embeds itself in [hit]!") diff --git a/code/datums/components/plumbing/_plumbing.dm b/code/datums/components/plumbing/_plumbing.dm index 67697400ebd1..8512e46c361d 100644 --- a/code/datums/components/plumbing/_plumbing.dm +++ b/code/datums/components/plumbing/_plumbing.dm @@ -162,7 +162,7 @@ for(var/obj/machinery/duct/duct in get_step(parent, D)) duct.remove_connects(turn(D, 180)) duct.neighbours.Remove(parent) - duct.update_icon() + duct.update_appearance() ///settle wherever we are, and start behaving like a piece of plumbing /datum/component/plumbing/proc/enable() @@ -246,7 +246,7 @@ SIGNAL_HANDLER tile_covered = intact - AM.update_icon() + AM.update_appearance() ///has one pipe input that only takes, example is manual output pipe /datum/component/plumbing/simple_demand diff --git a/code/datums/components/storage/concrete/_concrete.dm b/code/datums/components/storage/concrete/_concrete.dm index d458886011de..4198ba5b974d 100644 --- a/code/datums/components/storage/concrete/_concrete.dm +++ b/code/datums/components/storage/concrete/_concrete.dm @@ -141,7 +141,7 @@ refresh_mob_views() if(isobj(parent)) var/obj/O = parent - O.update_icon() + O.update_appearance() return TRUE /datum/component/storage/concrete/proc/slave_can_insert_object(datum/component/storage/slave, obj/item/I, stop_messages = FALSE, mob/M) @@ -197,7 +197,7 @@ /datum/component/storage/concrete/update_icon() if(isobj(parent)) var/obj/O = parent - O.update_icon() + O.update_appearance() for(var/i in slaves) var/datum/component/storage/slave = i slave.update_icon() diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index da4fb04b3214..bba9f933e336 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -713,7 +713,7 @@ /datum/component/storage/proc/update_icon() if(isobj(parent)) var/obj/O = parent - O.update_icon() + O.update_appearance() /datum/component/storage/proc/signal_insertion_attempt(datum/source, obj/item/I, mob/M, silent = FALSE, force = FALSE) SIGNAL_HANDLER diff --git a/code/datums/components/taped.dm b/code/datums/components/taped.dm index 112f190c7024..32d5120c72e0 100644 --- a/code/datums/components/taped.dm +++ b/code/datums/components/taped.dm @@ -46,7 +46,7 @@ tape_marks.Blend(icon('icons/obj/tapes.dmi', "[taped_icon_state]_mask"), ICON_MULTIPLY) taped_icon = new(tape_marks) I.add_overlay(taped_icon) - I.update_icon() + I.update_appearance() /datum/component/taped/proc/tape_rip(datum/source, obj/item/attacker, mob/user) var/obj/item/I = attacker diff --git a/code/datums/components/twohanded.dm b/code/datums/components/twohanded.dm index d0f24ff5bf25..88cc0d190014 100644 --- a/code/datums/components/twohanded.dm +++ b/code/datums/components/twohanded.dm @@ -156,7 +156,7 @@ if(sharpened_increase) parent_item.force += sharpened_increase parent_item.name = "[parent_item.name] (Wielded)" - parent_item.update_icon() + parent_item.update_appearance() if(iscyborg(user)) to_chat(user, "You dedicate your module to [parent].") @@ -208,7 +208,7 @@ parent_item.name = "[initial(parent_item.name)]" // Update icons - parent_item.update_icon() + parent_item.update_appearance() if(user.get_item_by_slot(ITEM_SLOT_BACK) == parent) user.update_inv_back() else @@ -251,15 +251,15 @@ * * Updates the icon using icon_wielded if set */ -/datum/component/two_handed/proc/on_update_icon(datum/source) +/datum/component/two_handed/proc/on_update_icon(obj/item/source) SIGNAL_HANDLER - if(icon_wielded && wielded) - var/obj/item/parent_item = parent - if(parent_item) - parent_item.icon_state = icon_wielded - return COMSIG_ATOM_NO_UPDATE_ICON_STATE - + if(!wielded) + return NONE + if(!icon_wielded) + return NONE + source.icon_state = icon_wielded + return COMSIG_ATOM_NO_UPDATE_ICON_STATE /** * on_moved Triggers on item moved */ diff --git a/code/datums/diseases/appendicitis.dm b/code/datums/diseases/appendicitis.dm index 7a6ea142b361..5f1e9c304f69 100644 --- a/code/datums/diseases/appendicitis.dm +++ b/code/datums/diseases/appendicitis.dm @@ -24,7 +24,7 @@ var/obj/item/organ/appendix/A = affected_mob.getorgan(/obj/item/organ/appendix) if(A) A.inflamed = 1 - A.update_icon() + A.update_appearance() if(prob(3)) to_chat(affected_mob, "You feel a stabbing pain in your abdomen!") affected_mob.adjustOrganLoss(ORGAN_SLOT_APPENDIX, 5) diff --git a/code/datums/elements/decals/_decals.dm b/code/datums/elements/decals/_decals.dm index d0062da29224..17ba311bc5a3 100644 --- a/code/datums/elements/decals/_decals.dm +++ b/code/datums/elements/decals/_decals.dm @@ -28,7 +28,7 @@ if(isturf(target)) RegisterSignal(target,COMSIG_TURF_AFTER_SHUTTLE_MOVE,.proc/shuttlemove_react, TRUE) if(target.flags_1 & INITIALIZED_1) - target.update_icon() //could use some queuing here now maybe. + target.update_appearance() //could use some queuing here now maybe. else RegisterSignal(target,COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZE,.proc/late_update_icon, TRUE) if(isitem(target)) @@ -61,7 +61,7 @@ /datum/element/decal/Detach(atom/source, force) UnregisterSignal(source, list(COMSIG_ATOM_DIR_CHANGE, COMSIG_COMPONENT_CLEAN_ACT, COMSIG_PARENT_EXAMINE, COMSIG_ATOM_UPDATE_OVERLAYS, COMSIG_TURF_AFTER_SHUTTLE_MOVE)) - source.update_icon() + source.update_appearance() if(isitem(source)) INVOKE_ASYNC(source, /obj/item/.proc/update_slot_icon) return ..() @@ -70,7 +70,7 @@ SIGNAL_HANDLER if(source && istype(source)) - source.update_icon() + source.update_appearance() UnregisterSignal(source,COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZE) diff --git a/code/datums/martial/sleeping_carp.dm b/code/datums/martial/sleeping_carp.dm index bde8aeb753dc..01c7e93ba516 100644 --- a/code/datums/martial/sleeping_carp.dm +++ b/code/datums/martial/sleeping_carp.dm @@ -181,6 +181,7 @@ attack_verb = list("smashed", "slammed", "whacked", "thwacked") icon = 'icons/obj/items_and_weapons.dmi' icon_state = "bostaff0" + base_icon_state = "bostaff" lefthand_file = 'icons/mob/inhands/weapons/staves_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/staves_righthand.dmi' block_chance = 50 @@ -193,7 +194,7 @@ /obj/item/staff/bostaff/ComponentInitialize() . = ..() - AddComponent(/datum/component/two_handed, force_unwielded=10, force_wielded=24, icon_wielded="bostaff1") + AddComponent(/datum/component/two_handed, force_unwielded=10, force_wielded=24, icon_wielded="[base_icon_state]1") /// triggered on wield of two handed item /obj/item/staff/bostaff/proc/on_wield(obj/item/source, mob/user) @@ -208,7 +209,8 @@ wielded = FALSE /obj/item/staff/bostaff/update_icon_state() - icon_state = "bostaff0" + icon_state = "[base_icon_state]0" + return ..() /obj/item/staff/bostaff/attack(mob/target, mob/living/user) add_fingerprint(user) diff --git a/code/datums/status_effects/neutral.dm b/code/datums/status_effects/neutral.dm index 9d4d70b575a4..4952479fa635 100644 --- a/code/datums/status_effects/neutral.dm +++ b/code/datums/status_effects/neutral.dm @@ -115,7 +115,7 @@ for(var/obj/effect/proc_holder/spell/spell in rewarded.mind.spell_list) spell.charge_counter = spell.charge_max spell.recharging = FALSE - spell.update_icon() + spell.update_appearance() rewarded.adjustBruteLoss(-25) rewarded.adjustFireLoss(-25) rewarded.adjustToxLoss(-25) diff --git a/code/datums/traits/neutral.dm b/code/datums/traits/neutral.dm index 118889264091..0705a2837b6e 100644 --- a/code/datums/traits/neutral.dm +++ b/code/datums/traits/neutral.dm @@ -203,7 +203,7 @@ W.hairstyle = pick(GLOB.hairstyles_list - "Bald") else W.hairstyle = old_hair - W.update_icon() + W.update_appearance() var/list/slots = list ( "head" = ITEM_SLOT_HEAD, "backpack" = ITEM_SLOT_BACKPACK, diff --git a/code/datums/wires/airalarm.dm b/code/datums/wires/airalarm.dm index 87c17a1b4515..6afccd547660 100644 --- a/code/datums/wires/airalarm.dm +++ b/code/datums/wires/airalarm.dm @@ -30,7 +30,7 @@ if(WIRE_POWER) // Short out for a long time. if(!A.shorted) A.shorted = TRUE - A.update_icon() + A.update_appearance() addtimer(CALLBACK(A, /obj/machinery/airalarm.proc/reset, wire), 1200) if(WIRE_IDSCAN) // Toggle lock. A.locked = !A.locked @@ -49,7 +49,7 @@ var/area/AA = get_area(A) if(AA.atmosalert(FALSE, holder)) A.post_alert(0) - A.update_icon() + A.update_appearance() /datum/wires/airalarm/on_cut(wire, mend) var/obj/machinery/airalarm/A = holder @@ -57,7 +57,7 @@ if(WIRE_POWER) // Short out forever. A.shock(usr, 50) A.shorted = !mend - A.update_icon() + A.update_appearance() if(WIRE_IDSCAN) if(!mend) A.locked = TRUE @@ -71,4 +71,4 @@ var/area/AA = get_area(A) if(AA.atmosalert(TRUE, holder)) A.post_alert(2) - A.update_icon() + A.update_appearance() diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm index 4d2e7d8f04ad..c9e969a8ebd0 100644 --- a/code/datums/wires/airlock.dm +++ b/code/datums/wires/airlock.dm @@ -72,13 +72,13 @@ else if(A.hasPower()) A.unbolt() - A.update_icon() + A.update_appearance() if(WIRE_IDSCAN) // Pulse to disable emergency access and flash red lights. if(A.hasPower() && A.density) A.do_animate("deny") if(A.emergency) A.emergency = FALSE - A.update_icon() + A.update_appearance() if(WIRE_AI) // Pulse to disable WIRE_AI control for 10 ticks (follows same rules as cutting). if(A.aiControlDisabled == AI_WIRE_NORMAL) A.aiControlDisabled = AI_WIRE_DISABLED @@ -97,7 +97,7 @@ A.normalspeed = !A.normalspeed if(WIRE_LIGHT) A.lights = !A.lights - A.update_icon() + A.update_appearance() /obj/machinery/door/airlock/proc/reset_ai_wire() if(aiControlDisabled == AI_WIRE_DISABLED) @@ -152,7 +152,7 @@ A.close() if(WIRE_LIGHT) // Cut to disable lights, mend to re-enable. A.lights = mend - A.update_icon() + A.update_appearance() if(WIRE_ZAP1, WIRE_ZAP2) // Ouch. if(isliving(usr)) A.shock(usr, 50) diff --git a/code/datums/wires/airlock_cycle.dm b/code/datums/wires/airlock_cycle.dm index d9572686a096..a1f942dab2e9 100644 --- a/code/datums/wires/airlock_cycle.dm +++ b/code/datums/wires/airlock_cycle.dm @@ -29,7 +29,7 @@ if(WIRE_POWER) // Short out for a long time. if(!A.shorted) A.shorted = TRUE - A.update_icon() + A.update_appearance() addtimer(CALLBACK(A, /obj/machinery/advanced_airlock_controller.proc/reset, wire), 1200) if(WIRE_IDSCAN) // Toggle lock. A.locked = !A.locked @@ -44,7 +44,7 @@ if(WIRE_POWER) // Short out forever. A.shock(usr, 50) A.shorted = !mend - A.update_icon() + A.update_appearance() if(WIRE_IDSCAN) if(!mend) A.locked = TRUE diff --git a/code/datums/wires/apc.dm b/code/datums/wires/apc.dm index e97c1f3654e3..933b9aae0222 100644 --- a/code/datums/wires/apc.dm +++ b/code/datums/wires/apc.dm @@ -44,10 +44,9 @@ if(WIRE_POWER1, WIRE_POWER2) // Short out. if(mend && !is_cut(WIRE_POWER1) && !is_cut(WIRE_POWER2)) A.shorted = FALSE - A.shock(usr, 50) else A.shorted = TRUE - A.shock(usr, 50) + A.shock(usr, 50) if(WIRE_AI) // Disable AI control. if(mend) A.aidisabled = FALSE diff --git a/code/datums/wires/syndicatebomb.dm b/code/datums/wires/syndicatebomb.dm index 8732a0a21d71..8a2dba38d1bc 100644 --- a/code/datums/wires/syndicatebomb.dm +++ b/code/datums/wires/syndicatebomb.dm @@ -49,7 +49,7 @@ if(!B.active) holder.visible_message("[icon2html(B, viewers(holder))] You hear the bomb start ticking!") B.activate() - B.update_icon() + B.update_appearance() else if(B.delayedlittle) holder.visible_message("[icon2html(B, viewers(holder))] Nothing happens.") else @@ -81,7 +81,7 @@ B.active = FALSE B.delayedlittle = FALSE B.delayedbig = FALSE - B.update_icon() + B.update_appearance() /datum/wires/syndicatebomb/proc/tell_admins(obj/machinery/syndicatebomb/B) if(istype(B, /obj/machinery/syndicatebomb/training)) diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index e7e43ccdb708..b7d13f80d70e 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -336,7 +336,7 @@ GLOBAL_LIST_EMPTY(teleportlocs) ModifyFiredoors(FALSE) for(var/item in firealarms) var/obj/machinery/firealarm/F = item - F.update_icon() + F.update_appearance() for (var/item in GLOB.alert_consoles) var/obj/machinery/computer/station_alert/a = item @@ -367,7 +367,7 @@ GLOBAL_LIST_EMPTY(teleportlocs) ModifyFiredoors(TRUE) for(var/item in firealarms) var/obj/machinery/firealarm/F = item - F.update_icon() + F.update_appearance() for (var/item in GLOB.silicon_mobs) var/mob/living/silicon/aiPlayer = item @@ -491,11 +491,13 @@ GLOBAL_LIST_EMPTY(teleportlocs) weather_icon = TRUE if(!weather_icon) icon_state = null + return ..() /** * Update the icon of the area (overridden to always be null for space */ /area/space/update_icon_state() + SHOULD_CALL_PARENT(FALSE) icon_state = null @@ -536,7 +538,7 @@ GLOBAL_LIST_EMPTY(teleportlocs) for(var/obj/machinery/M in src) // for each machine in the area M.power_change() // reverify power status (to update icons etc.) SEND_SIGNAL(src, COMSIG_AREA_POWER_CHANGE) - update_icon() + update_appearance() /** diff --git a/code/game/atoms.dm b/code/game/atoms.dm index e0f711640db3..88fd3a3faeb6 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -694,17 +694,20 @@ return SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_DESC, updates) /// Updates the icon of the atom -/atom/proc/update_icon() +/atom/proc/update_icon(updates=ALL) SIGNAL_HANDLER + SHOULD_CALL_PARENT(TRUE) - var/signalOut = SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_ICON) - . = FALSE - - if(!(signalOut & COMSIG_ATOM_NO_UPDATE_ICON_STATE)) + . = NONE + updates &= ~SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_ICON, updates) + if(updates & UPDATE_ICON_STATE) update_icon_state() - . = TRUE + . |= UPDATE_ICON_STATE + + if(updates & UPDATE_OVERLAYS) + if(LAZYLEN(managed_vis_overlays)) + SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) - if(!(signalOut & COMSIG_ATOM_NO_UPDATE_OVERLAYS)) var/list/new_overlays = update_overlays() if(managed_overlays) cut_overlay(managed_overlays) @@ -712,12 +715,14 @@ if(length(new_overlays)) managed_overlays = new_overlays add_overlay(new_overlays) - . = TRUE + . |= UPDATE_OVERLAYS - SEND_SIGNAL(src, COMSIG_ATOM_UPDATED_ICON, signalOut, .) + . |= SEND_SIGNAL(src, COMSIG_ATOM_UPDATED_ICON, updates, .) /// Updates the icon state of the atom /atom/proc/update_icon_state() + SHOULD_CALL_PARENT(TRUE) + return SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_ICON_STATE) /// Updates the overlays of the atom /atom/proc/update_overlays() diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 7e1e8f8547e7..ad45018cec39 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -899,11 +899,11 @@ /// called when this atom is removed from a storage item, which is passed on as S. The loc variable is already set to the new destination before this is called. /atom/movable/proc/on_exit_storage(datum/component/storage/concrete/master_storage) - SEND_SIGNAL(src, CONSIG_STORAGE_EXITED, master_storage) + SEND_SIGNAL(src, COMSIG_STORAGE_EXITED, master_storage) /// called when this atom is added into a storage item, which is passed on as S. The loc variable is already set to the storage item. /atom/movable/proc/on_enter_storage(datum/component/storage/concrete/master_storage) - SEND_SIGNAL(src, COMISG_STORAGE_ENTERED, master_storage) + SEND_SIGNAL(src, COMSIG_STORAGE_ENTERED, master_storage) /atom/movable/proc/get_spacemove_backup() var/atom/movable/dense_object_backup diff --git a/code/game/gamemodes/clown_ops/bananium_bomb.dm b/code/game/gamemodes/clown_ops/bananium_bomb.dm index 8c948c9d42d4..01c270895360 100644 --- a/code/game/gamemodes/clown_ops/bananium_bomb.dm +++ b/code/game/gamemodes/clown_ops/bananium_bomb.dm @@ -3,19 +3,21 @@ desc = "You probably shouldn't stick around to see if this is armed." icon = 'icons/obj/machines/nuke.dmi' icon_state = "bananiumbomb_base" + base_icon_state = "bananiumbomb" /obj/machinery/nuclearbomb/syndicate/bananium/update_icon_state() if(deconstruction_state != NUKESTATE_INTACT) - icon_state = "bananiumbomb_base" - return + icon_state = "[base_icon_state]_base" + return ..() switch(get_nuke_state()) if(NUKE_OFF_LOCKED, NUKE_OFF_UNLOCKED) - icon_state = "bananiumbomb_base" + icon_state = "[base_icon_state]_base" if(NUKE_ON_TIMING) - icon_state = "bananiumbomb_timing" + icon_state = "[base_icon_state]_timing" if(NUKE_ON_EXPLODING) - icon_state = "bananiumbomb_exploding" + icon_state = "[base_icon_state]_exploding" + return ..() /obj/machinery/nuclearbomb/syndicate/bananium/get_cinematic_type(off_station) switch(off_station) diff --git a/code/game/gamemodes/events.dm b/code/game/gamemodes/events.dm index 26556bfc0b48..56f873a50bd1 100644 --- a/code/game/gamemodes/events.dm +++ b/code/game/gamemodes/events.dm @@ -6,7 +6,7 @@ S.charge = 0 S.output_level = 0 S.output_attempt = FALSE - S.update_icon() + S.update_appearance() S.power_change() for(var/area/A in GLOB.sortedAreas) @@ -35,14 +35,14 @@ if(!C.cell || (z_level && C.virtual_z() != z_level)) continue C.cell.charge = C.cell.maxcharge - C.failure_timer = 0 + COOLDOWN_RESET(C, failure_timer) for(var/obj/machinery/power/smes/S in GLOB.machines) if(z_level && S.virtual_z() != z_level) continue S.charge = S.capacity S.output_level = S.output_level_max S.output_attempt = TRUE - S.update_icon() + S.update_appearance() S.power_change() for(var/area/A in GLOB.sortedAreas) if(!A.requires_power || A.always_unpowered) @@ -59,6 +59,6 @@ S.charge = S.capacity S.output_level = S.output_level_max S.output_attempt = TRUE - S.update_icon() + S.update_appearance() S.power_change() diff --git a/code/game/gamemodes/gang/gang.dm b/code/game/gamemodes/gang/gang.dm index 04cb6ecb9c7a..1682a27584fd 100644 --- a/code/game/gamemodes/gang/gang.dm +++ b/code/game/gamemodes/gang/gang.dm @@ -247,7 +247,7 @@ GLOBAL_VAR_INIT(deaths_during_shift, 0) var/datum/hud/H = M.hud_used H.wanted_lvl.level = newlevel H.wanted_lvl.cops_arrived = cops_arrived - H.wanted_lvl.update_icon() + H.wanted_lvl.update_appearance() /datum/game_mode/gang/proc/on_gain_wanted_level(newlevel) var/announcement_message diff --git a/code/game/gamemodes/sandbox/h_sandbox.dm b/code/game/gamemodes/sandbox/h_sandbox.dm index 0ade780c8fb9..69679c95079f 100644 --- a/code/game/gamemodes/sandbox/h_sandbox.dm +++ b/code/game/gamemodes/sandbox/h_sandbox.dm @@ -180,7 +180,7 @@ GLOBAL_VAR_INIT(hsboxspawn, TRUE) if("hsbscrubber") // This is beyond its normal capability but this is sandbox and you spawned one, I assume you need it var/obj/hsb = new/obj/machinery/portable_atmospherics/scrubber{volume_rate=50*ONE_ATMOSPHERE;on=1}(usr.loc) - hsb.update_icon() // hackish but it wasn't meant to be spawned I guess? + hsb.update_appearance() // hackish but it wasn't meant to be spawned I guess? // // Stacked Materials diff --git a/code/game/machinery/PDApainter.dm b/code/game/machinery/PDApainter.dm index 70cb4f065969..e9906a6a0089 100644 --- a/code/game/machinery/PDApainter.dm +++ b/code/game/machinery/PDApainter.dm @@ -3,6 +3,7 @@ desc = "A PDA painting machine. To use, simply insert your PDA and choose the desired preset paint scheme." icon = 'icons/obj/pda.dmi' icon_state = "pdapainter" + base_icon_state = "pdapainter" density = TRUE max_integrity = 200 var/obj/item/pda/storedpda = null @@ -10,13 +11,10 @@ /obj/machinery/pdapainter/update_icon_state() if(machine_stat & BROKEN) - icon_state = "[initial(icon_state)]-broken" - return - - if(powered()) - icon_state = initial(icon_state) - else - icon_state = "[initial(icon_state)]-off" + icon_state = "[base_icon_state]-broken" + return ..() + icon_state = "[base_icon_state][powered() ? null : "-off"]" + return ..() /obj/machinery/pdapainter/update_overlays() . = ..() @@ -62,7 +60,7 @@ /obj/machinery/pdapainter/handle_atom_del(atom/A) if(A == storedpda) storedpda = null - update_icon() + update_appearance() /obj/machinery/pdapainter/attackby(obj/item/O, mob/user, params) if(machine_stat & BROKEN) @@ -78,7 +76,7 @@ to_chat(user, "You repair [src].") set_machine_stat(machine_stat & ~BROKEN) obj_integrity = max_integrity - update_icon() + update_appearance() else return ..() @@ -95,7 +93,7 @@ return storedpda = O O.add_fingerprint(user) - update_icon() + update_appearance() else return ..() @@ -140,6 +138,6 @@ if(storedpda) storedpda.forceMove(drop_location()) storedpda = null - update_icon() + update_appearance() else to_chat(usr, "[src] is empty!") diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index 6f7363ba8811..f0a1c403cfa4 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -9,6 +9,7 @@ desc = "An enclosed machine used to stabilize and heal patients." icon = 'icons/obj/machines/sleeper.dmi' icon_state = "sleeper" + base_icon_state = "sleeper" density = FALSE state_open = TRUE circuit = /obj/item/circuitboard/machine/sleeper @@ -45,7 +46,7 @@ /obj/machinery/sleeper/Initialize(mapload) . = ..() occupant_typecache = GLOB.typecache_living - update_icon() + update_appearance() if(mapload && starting_beakers) chembag = new(src) for(var/beaker in starting_beakers) @@ -73,10 +74,8 @@ update_contents() /obj/machinery/sleeper/update_icon_state() - if(state_open) - icon_state = "[initial(icon_state)]-open" - else - icon_state = initial(icon_state) + icon_state = "[base_icon_state][state_open ? "-open" : null]" + return ..() /obj/machinery/sleeper/container_resist_act(mob/living/user) visible_message("[occupant] emerges from [src]!", @@ -367,6 +366,8 @@ /obj/machinery/sleeper/syndie icon_state = "sleeper_s" controls_inside = TRUE + base_icon_state = "sleeper_s" /obj/machinery/sleeper/old icon_state = "oldpod" + base_icon_state = "oldpod" diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 06dd63a41e95..b1d790677317 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -215,7 +215,7 @@ Class Procs: density = FALSE if(drop) dropContents() - update_icon() + update_appearance() updateUsrDialog() /obj/machinery/proc/dropContents(list/subset = null) @@ -269,7 +269,7 @@ Class Procs: occupant = target target.forceMove(src) updateUsrDialog() - update_icon() + update_appearance() /obj/machinery/proc/auto_use_power() if(!powered(power_channel)) @@ -452,7 +452,7 @@ Class Procs: if(!(machine_stat & BROKEN) && !(flags_1 & NODECONSTRUCT_1)) set_machine_stat(machine_stat | BROKEN) SEND_SIGNAL(src, COMSIG_MACHINERY_BROKEN, damage_flag) - update_icon() + update_appearance() return TRUE /obj/machinery/contents_explosion(severity, target) @@ -462,7 +462,7 @@ Class Procs: /obj/machinery/handle_atom_del(atom/A) if(A == occupant) occupant = null - update_icon() + update_appearance() updateUsrDialog() return ..() diff --git a/code/game/machinery/ai_slipper.dm b/code/game/machinery/ai_slipper.dm index 43fafb819eed..eb46da7f568b 100644 --- a/code/game/machinery/ai_slipper.dm +++ b/code/game/machinery/ai_slipper.dm @@ -3,6 +3,7 @@ desc = "A remotely-activatable dispenser for crowd-controlling foam." icon = 'icons/obj/device.dmi' icon_state = "ai-slipper0" + base_icon_state = "ai-slipper" layer = PROJECTILE_HIT_THRESHHOLD_LAYER plane = FLOOR_PLANE max_integrity = 200 @@ -19,11 +20,12 @@ /obj/machinery/ai_slipper/update_icon_state() if(machine_stat & BROKEN) - return + return ..() if((machine_stat & NOPOWER) || cooldown_time > world.time || !uses) - icon_state = "ai-slipper0" - else - icon_state = "ai-slipper1" + icon_state = "[base_icon_state]0" + return ..() + icon_state = "[base_icon_state]1" + return ..() /obj/machinery/ai_slipper/interact(mob/user) if(!allowed(user)) diff --git a/code/game/machinery/airlock_control.dm b/code/game/machinery/airlock_control.dm index 4d7e59c32b34..9a3f470fe99d 100644 --- a/code/game/machinery/airlock_control.dm +++ b/code/game/machinery/airlock_control.dm @@ -5,7 +5,8 @@ var/id_tag var/frequency var/datum/radio_frequency/radio_connection - + /// The current state of the airlock, used to construct the airlock overlays + var/airlock_state /obj/machinery/door/airlock/receive_signal(datum/signal/signal) if(!signal) @@ -23,21 +24,21 @@ if("unlock") locked = FALSE - update_icon() + update_appearance() if("lock") locked = TRUE - update_icon() + update_appearance() if("secure_open") locked = FALSE - update_icon() + update_appearance() sleep(2) open(1) locked = TRUE - update_icon() + update_appearance() if("secure_close") locked = FALSE @@ -45,7 +46,7 @@ locked = TRUE sleep(2) - update_icon() + update_appearance() send_status() @@ -114,13 +115,14 @@ master_tag = INCINERATOR_SYNDICATELAVA_AIRLOCK_CONTROLLER /obj/machinery/airlock_sensor/update_icon_state() - if(on) + if(!on) + icon_state = "[base_icon_state]_off" + else if(alert) - icon_state = "airlock_sensor_alert" + icon_state = "[base_icon_state]_alert" else - icon_state = "airlock_sensor_standby" - else - icon_state = "airlock_sensor_off" + icon_state = "[base_icon_state]_standby" + return ..() /obj/machinery/airlock_sensor/attack_hand(mob/user) . = ..() @@ -148,7 +150,7 @@ radio_connection.post_signal(src, signal, range = AIRLOCK_CONTROL_RANGE, filter = RADIO_AIRLOCK) - update_icon() + update_appearance() /obj/machinery/airlock_sensor/proc/set_frequency(new_frequency) SSradio.remove_object(src, frequency) diff --git a/code/game/machinery/airlock_cycle_control.dm b/code/game/machinery/airlock_cycle_control.dm index dbe5bdd5a194..c2d9e0da07cb 100644 --- a/code/game/machinery/airlock_cycle_control.dm +++ b/code/game/machinery/airlock_cycle_control.dm @@ -128,7 +128,7 @@ pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24) pixel_y = (dir & 3)? (dir == 1 ? -24 : 24) : 0 - update_icon() + update_appearance() /obj/machinery/advanced_airlock_controller/Destroy() qdel(wires) @@ -155,10 +155,10 @@ if(airlock.density && (cyclestate == AIRLOCK_CYCLESTATE_CLOSED || (airlocks[A] == EXTERIOR_AIRLOCK && cyclestate == AIRLOCK_CYCLESTATE_INOPEN) || (airlocks[A] == INTERIOR_AIRLOCK && cyclestate == AIRLOCK_CYCLESTATE_OUTOPEN))) airlock.bolt() -/obj/machinery/advanced_airlock_controller/update_icon(use_hash = FALSE) +/obj/machinery/advanced_airlock_controller/update_icon(updates=ALL, use_hash = FALSE) var/turf/location = get_turf(src) if(!location) - return + return ..() var/pressure = 0 if(location) var/datum/gas_mixture/environment = location.return_air() @@ -169,7 +169,7 @@ var/new_overlays_hash = "[pressure_bars]-[cyclestate]-[buildstage]-[panel_open]-[machine_stat]-[shorted]-[locked]-\ref[vis_target]" if(use_hash && new_overlays_hash == overlays_hash) - return + return ..() overlays_hash = new_overlays_hash cut_overlays() @@ -181,12 +181,12 @@ icon_state = "aac_b2" if(BUILD_NO_CIRCUIT) icon_state = "aac_b1" - return + return ..() icon_state = "aac" if((machine_stat & (NOPOWER|BROKEN)) || shorted) - return + return ..() var/is_exterior_pressure = (cyclestate == AIRLOCK_CYCLESTATE_OUTCLOSING || cyclestate == AIRLOCK_CYCLESTATE_OUTOPENING || cyclestate == AIRLOCK_CYCLESTATE_OUTOPEN) add_overlay("aac_[is_exterior_pressure ? "ext" : "int"]p_[pressure_bars]") @@ -208,13 +208,14 @@ var/mutable_appearance/M = mutable_appearance(icon, "hologram-line", ABOVE_LIGHTING_LAYER, ABOVE_LIGHTING_PLANE) M.transform = TR add_overlay(M) + return ..() /obj/machinery/advanced_airlock_controller/proc/reset(wire) switch(wire) if(WIRE_POWER) if(!wires.is_cut(WIRE_POWER)) shorted = FALSE - update_icon() + update_appearance() if(WIRE_AI) if(!wires.is_cut(WIRE_AI)) aidisabled = FALSE @@ -316,12 +317,12 @@ /obj/machinery/advanced_airlock_controller/process_atmos() if((machine_stat & (NOPOWER|BROKEN)) || shorted) - update_icon(TRUE) + update_icon(ALL, TRUE) return var/turf/location = get_turf(src) if(!location) - update_icon(TRUE) + update_icon(ALL, TRUE) return var/pressure = 0 if(location) @@ -347,10 +348,10 @@ vent.pressure_checks = VENT_EXT_BOUND vent.external_pressure_bound = interior_pressure vent.on = TRUE - vent.update_icon() + vent.update_appearance() else vent.on = FALSE - vent.update_icon() + vent.update_appearance() return if(AIRLOCK_CYCLESTATE_INCLOSING) for(var/airlock in airlocks) @@ -364,10 +365,10 @@ vent.external_pressure_bound = 0 vents_valid = FALSE vent.on = TRUE - vent.update_icon() + vent.update_appearance() else vent.on = FALSE - vent.update_icon() + vent.update_appearance() if(pressure < depressurization_margin) vents_valid = TRUE if((doors_valid && vents_valid) || is_skipping) @@ -385,10 +386,10 @@ vent.external_pressure_bound = 0 vents_valid = FALSE vent.on = TRUE - vent.update_icon() + vent.update_appearance() else vent.on = FALSE - vent.update_icon() + vent.update_appearance() if(pressure < depressurization_margin) vents_valid = TRUE if(vents_valid || is_skipping) @@ -406,10 +407,10 @@ vent.external_pressure_bound = interior_pressure vents_valid = FALSE vent.on = TRUE - vent.update_icon() + vent.update_appearance() else vent.on = FALSE - vent.update_icon() + vent.update_appearance() if(pressure > interior_pressure - 0.5) vents_valid = TRUE if(vents_valid || is_skipping) @@ -431,10 +432,10 @@ vent.external_pressure_bound = exterior_pressure vents_valid = FALSE vent.on = TRUE - vent.update_icon() + vent.update_appearance() else vent.on = FALSE - vent.update_icon() + vent.update_appearance() if(pressure > exterior_pressure - 0.5) vents_valid = TRUE if(vents_valid || is_skipping) @@ -448,13 +449,13 @@ for(var/V in vents) var/obj/machinery/atmospherics/components/unary/vent_pump/vent = V vent.on = FALSE - vent.update_icon() + vent.update_appearance() if(AIRLOCK_CYCLESTATE_OUTOPEN) for(var/V in vents) var/obj/machinery/atmospherics/components/unary/vent_pump/vent = V vent.on = FALSE - vent.update_icon() - update_icon(TRUE) + vent.update_appearance() + update_icon(ALL, TRUE) /obj/machinery/advanced_airlock_controller/attackby(obj/item/W, mob/user, params) switch(buildstage) @@ -464,13 +465,13 @@ to_chat(user, "You cut the final wires.") new /obj/item/stack/cable_coil(loc, 5) buildstage = BUILD_NO_WIRES - update_icon() + update_appearance() return else if(W.tool_behaviour == TOOL_SCREWDRIVER) // Opening that up. W.play_tool_sound(src) panel_open = !panel_open to_chat(user, "The wires have been [panel_open ? "exposed" : "unexposed"].") - update_icon() + update_appearance() return else if(istype(W, /obj/item/card/id) || istype(W, /obj/item/pda))// trying to unlock the interface with an ID card togglelock(user) @@ -489,7 +490,7 @@ new /obj/item/electronics/advanced_airlock_controller(src.loc) playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1) buildstage = BUILD_NO_CIRCUIT - update_icon() + update_appearance() return if(istype(W, /obj/item/stack/cable_coil)) @@ -510,14 +511,14 @@ cut_links() shorted = FALSE buildstage = BUILD_COMPLETE - update_icon() + update_appearance() return if(BUILD_NO_CIRCUIT) if(istype(W, /obj/item/electronics/advanced_airlock_controller)) if(user.temporarilyRemoveItemFromInventory(W)) to_chat(user, "You insert the circuit.") buildstage = BUILD_NO_WIRES - update_icon() + update_appearance() qdel(W) return @@ -528,7 +529,7 @@ user.visible_message("[user] fabricates a circuit and places it into [src].", \ "You adapt an airlock controller circuit and slot it into the assembly.") buildstage = BUILD_NO_WIRES - update_icon() + update_appearance() return if(W.tool_behaviour == TOOL_WRENCH) @@ -757,7 +758,7 @@ depressurization_margin = clamp(text2num(params["pressure"]), 0.15, 40) if("skip_delay") skip_delay = clamp(text2num(params["skip_delay"]), 0, 1200) - update_icon(TRUE) + update_icon(ALL, TRUE) /obj/machinery/advanced_airlock_controller/proc/request_from_door(airlock) var/role = airlocks[airlock] @@ -800,7 +801,7 @@ else if(src.allowed(usr) && !wires.is_cut(WIRE_IDSCAN)) locked = !locked - update_icon() + update_appearance() to_chat(user, "You [ locked ? "lock" : "unlock"] the airlock controller interface.") updateUsrDialog() else @@ -809,7 +810,7 @@ /obj/machinery/advanced_airlock_controller/power_change() ..() - update_icon() + update_appearance() /obj/machinery/advanced_airlock_controller/emag_act(mob/user) if(obj_flags & EMAGGED) @@ -820,7 +821,7 @@ /obj/machinery/advanced_airlock_controller/obj_break(damage_flag) ..() - update_icon() + update_appearance() /obj/machinery/advanced_airlock_controller/deconstruct(disassembled = TRUE) if(!(flags_1 & NODECONSTRUCT_1)) diff --git a/code/game/machinery/announcement_system.dm b/code/game/machinery/announcement_system.dm index daebe8a066f3..f275d234fca7 100644 --- a/code/game/machinery/announcement_system.dm +++ b/code/game/machinery/announcement_system.dm @@ -6,6 +6,7 @@ GLOBAL_LIST_EMPTY(announcement_systems) desc = "An automated announcement system that handles minor announcements over the radio." icon = 'icons/obj/machines/telecomms.dmi' icon_state = "AAS_On" + base_icon_state = "AAS" verb_say = "coldly states" verb_ask = "queries" @@ -30,13 +31,11 @@ GLOBAL_LIST_EMPTY(announcement_systems) . = ..() GLOB.announcement_systems += src radio = new /obj/item/radio/headset/silicon/ai(src) - update_icon() + update_appearance() /obj/machinery/announcement_system/update_icon_state() - if(is_operational) - icon_state = (panel_open ? "AAS_On_Open" : "AAS_On") - else - icon_state = (panel_open ? "AAS_Off_Open" : "AAS_Off") + icon_state = "[base_icon_state]_[is_operational ? "On" : "Off"][panel_open ? "_Open" : null]" + return ..() /obj/machinery/announcement_system/update_overlays() . = ..() @@ -59,13 +58,13 @@ GLOBAL_LIST_EMPTY(announcement_systems) P.play_tool_sound(src) panel_open = !panel_open to_chat(user, "You [panel_open ? "open" : "close"] the maintenance hatch of [src].") - update_icon() + update_appearance() else if(default_deconstruction_crowbar(P)) return else if(P.tool_behaviour == TOOL_MULTITOOL && panel_open && (machine_stat & BROKEN)) to_chat(user, "You reset [src]'s firmware.") set_machine_stat(machine_stat & ~BROKEN) - update_icon() + update_appearance() else return ..() @@ -138,10 +137,10 @@ GLOBAL_LIST_EMPTY(announcement_systems) log_game("The head announcement was updated: [NewMessage] by:[key_name(usr)]") if("NewheadToggle") newheadToggle = !newheadToggle - update_icon() + update_appearance() if("ArrivalToggle") arrivalToggle = !arrivalToggle - update_icon() + update_appearance() add_fingerprint(usr) /obj/machinery/announcement_system/attack_robot(mob/living/silicon/user) diff --git a/code/game/machinery/aug_manipulator.dm b/code/game/machinery/aug_manipulator.dm index 76e662d640f1..9c536c0d97d8 100644 --- a/code/game/machinery/aug_manipulator.dm +++ b/code/game/machinery/aug_manipulator.dm @@ -3,6 +3,7 @@ desc = "A machine for custom fitting augmentations, with in-built spraypainter." icon = 'icons/obj/pda.dmi' icon_state = "pdapainter" + base_icon_state = "pdapainter" circuit = /obj/item/circuitboard/machine/aug_manipulator density = TRUE obj_integrity = 200 @@ -18,23 +19,21 @@ . += "Alt-click to eject the limb." /obj/machinery/aug_manipulator/Initialize() - initial_icon_state = initial(icon_state) + if(!base_icon_state) + base_icon_state = initial(icon_state) return ..() /obj/machinery/aug_manipulator/update_icon_state() if(machine_stat & BROKEN) - icon_state = "[initial_icon_state]-broken" - return - - if(powered()) - icon_state = initial_icon_state - else - icon_state = "[initial_icon_state]-off" + icon_state = "[base_icon_state]-broken" + return ..() + icon_state = "[base_icon_state][powered() ? null : "-off"]" + return ..() /obj/machinery/aug_manipulator/update_overlays() . = ..() if(storedpart) - . += "[initial_icon_state]-closed" + . += "[base_icon_state]-closed" /obj/machinery/aug_manipulator/Destroy() QDEL_NULL(storedpart) @@ -52,7 +51,7 @@ /obj/machinery/aug_manipulator/handle_atom_del(atom/A) if(A == storedpart) storedpart = null - update_icon() + update_appearance() /obj/machinery/aug_manipulator/attackby(obj/item/O, mob/user, params) if(default_deconstruction_screwdriver(user, "pdapainter-broken", "pdapainter", O)) //placeholder, get a sprite monkey to make an actual sprite, I can't be asked. @@ -81,7 +80,7 @@ return storedpart = O O.add_fingerprint(user) - update_icon() + update_appearance() else if(O.tool_behaviour == TOOL_WELDER && user.a_intent != INTENT_HARM) if(obj_integrity < max_integrity) @@ -98,7 +97,7 @@ to_chat(user, "You repair [src].") set_machine_stat(machine_stat & ~BROKEN) obj_integrity = max(obj_integrity, max_integrity) - update_icon() + update_appearance() else to_chat(user, "[src] does not need repairs.") else @@ -130,7 +129,7 @@ if(storedpart) storedpart.forceMove(get_turf(src)) storedpart = null - update_icon() + update_appearance() else to_chat(user, "[src] is empty!") diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 412a9264e38c..811064d6d193 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -338,7 +338,7 @@ if(is_stack) var/obj/item/stack/N = new being_built.build_path(A, multiplier, FALSE) - N.update_icon() + N.update_appearance() N.autolathe_crafted(src) else for(var/i=1, i<=multiplier, i++) diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm index c87050f066f4..3e04893bf8a9 100644 --- a/code/game/machinery/buttons.dm +++ b/code/game/machinery/buttons.dm @@ -25,7 +25,7 @@ pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24) pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0 panel_open = TRUE - update_icon() + update_appearance() if(!built && !device && device_type) @@ -46,10 +46,12 @@ /obj/machinery/button/update_icon_state() if(panel_open) icon_state = "button-open" - else if(machine_stat & (NOPOWER|BROKEN)) + return ..() + if(machine_stat & (NOPOWER|BROKEN)) icon_state = "[skin]-p" - else - icon_state = skin + return ..() + icon_state = skin + return ..() /obj/machinery/button/update_overlays() . = ..() @@ -64,7 +66,7 @@ if(W.tool_behaviour == TOOL_SCREWDRIVER) if(panel_open || allowed(user)) default_deconstruction_screwdriver(user, "button-open", "[skin]",W) - update_icon() + update_appearance() else to_chat(user, "Maintenance Access Denied.") flick("[skin]-denied", src) @@ -98,7 +100,7 @@ playsound(loc, 'sound/items/deconstruct.ogg', 50, TRUE) qdel(src) - update_icon() + update_appearance() return if(user.a_intent != INTENT_HARM && !(W.item_flags & NOBLUDGEON)) @@ -150,7 +152,7 @@ req_access = list() req_one_access = list() board = null - update_icon() + update_appearance() to_chat(user, "You remove electronics from the button frame.") else @@ -179,7 +181,7 @@ device.pulsed() SEND_GLOBAL_SIGNAL(COMSIG_GLOB_BUTTON_PRESSED,src) - addtimer(CALLBACK(src, /atom/.proc/update_icon), 15) + addtimer(CALLBACK(src, /atom/.proc/update_appearance), 15) /obj/machinery/button/door name = "door button" diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 17219e83ebfc..5b31770af80c 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -17,7 +17,7 @@ armor = list("melee" = 50, "bullet" = 20, "laser" = 20, "energy" = 20, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 90, "acid" = 50) max_integrity = 100 integrity_failure = 0.5 - var/default_camera_icon = "camera" //the camera's base icon used by update_icon - icon_state is primarily used for mapping display purposes. + var/default_camera_icon = "camera" //the camera's base icon used by update_appearance - icon_state is primarily used for mapping display purposes. var/list/network = list("ss13") var/c_tag = null var/status = TRUE @@ -88,7 +88,7 @@ if(mapload && prob(3) && !start_active) toggle_cam() else //this is handled by toggle_camera, so no need to update it twice. - update_icon() + update_appearance() /obj/machinery/camera/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) for(var/i in network) @@ -142,13 +142,13 @@ return if(!(. & EMP_PROTECT_SELF)) if(prob(150/severity)) - update_icon() + update_appearance() network = list() GLOB.cameranet.removeCamera(src) set_machine_stat(machine_stat | EMPED) set_light(0) emped = emped+1 //Increase the number of consecutive EMP's - update_icon() + update_appearance() addtimer(CALLBACK(src, .proc/post_emp_reset, emped, network), 90 SECONDS) for(var/i in GLOB.player_list) var/mob/M = i @@ -165,7 +165,7 @@ return network = previous_network set_machine_stat(machine_stat & ~EMPED) - update_icon() + update_appearance() if(can_use()) GLOB.cameranet.addCamera(src) emped = 0 //Resets the consecutive EMP count @@ -197,7 +197,7 @@ panel_open = !panel_open to_chat(user, "You screw the camera's panel [panel_open ? "open" : "closed"].") I.play_tool_sound(src) - update_icon() + update_appearance() return TRUE /obj/machinery/camera/crowbar_act(mob/living/user, obj/item/I) @@ -398,12 +398,15 @@ var/xray_module if(isXRay(TRUE)) xray_module = "xray" + if(!status) icon_state = "[xray_module][default_camera_icon]_off" - else if (machine_stat & EMPED) + return ..() + if(machine_stat & EMPED) icon_state = "[xray_module][default_camera_icon]_emp" - else - icon_state = "[xray_module][default_camera_icon][in_use_lights ? "_in_use" : ""]" + return ..() + icon_state = "[xray_module][default_camera_icon][in_use_lights ? "_in_use" : ""]" + return ..() /obj/machinery/camera/proc/toggle_cam(mob/user, displaymessage = 1) status = !status @@ -434,7 +437,7 @@ visible_message("\The [src] [change_msg]!") playsound(src, 'sound/items/wirecutter.ogg', 100, TRUE) - update_icon() //update Initialize() if you remove this. + update_appearance() //update Initialize() if you remove this. // now disconnect anyone using the camera //Apparently, this will disconnect anyone even if the camera was re-activated. diff --git a/code/game/machinery/camera/camera_assembly.dm b/code/game/machinery/camera/camera_assembly.dm index a8e565e5b056..dcf280ec72d5 100644 --- a/code/game/machinery/camera/camera_assembly.dm +++ b/code/game/machinery/camera/camera_assembly.dm @@ -70,11 +70,12 @@ /obj/structure/camera_assembly/update_icon_state() icon_state = "[xray_module ? "xray" : null][initial(icon_state)]" + return ..() /obj/structure/camera_assembly/handle_atom_del(atom/A) if(A == xray_module) xray_module = null - update_icon() + update_appearance() if(malf_xray_firmware_present) malf_xray_firmware_active = malf_xray_firmware_present //re-enable firmware based upgrades after the part is removed. if(istype(loc, /obj/machinery/camera)) @@ -110,7 +111,7 @@ xray_module = null if(malf_xray_firmware_present) malf_xray_firmware_active = malf_xray_firmware_present //re-enable firmware based upgrades after the part is removed. - update_icon() + update_appearance() else if(I == emp_module) emp_module = null @@ -175,7 +176,7 @@ if(malf_xray_firmware_active) malf_xray_firmware_active = FALSE //flavor reason: MALF AI Upgrade Camera Network ability's firmware is incompatible with the new part //real reason: make it a normal upgrade so the finished camera's icons and examine texts are restored. - update_icon() + update_appearance() return else if(istype(W, /obj/item/assembly/prox_sensor)) //motion sensing upgrade diff --git a/code/game/machinery/camera/presets.dm b/code/game/machinery/camera/presets.dm index b2b8665121f9..6b2bf6859049 100644 --- a/code/game/machinery/camera/presets.dm +++ b/code/game/machinery/camera/presets.dm @@ -113,12 +113,12 @@ assembly.malf_xray_firmware_active = FALSE //make it appear like it's just normally upgraded so the icons and examine texts are restored. upgrades |= CAMERA_UPGRADE_XRAY - update_icon() + update_appearance() /obj/machinery/camera/proc/removeXRay(ignore_malf_upgrades) if(!ignore_malf_upgrades) //don't downgrade it if malf software is forced onto it. upgrades &= ~CAMERA_UPGRADE_XRAY - update_icon() + update_appearance() diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm index 7979fd612338..e1be8d8e4453 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -54,7 +54,7 @@ charging = W user.visible_message("[user] inserts a cell into [src].", "You insert a cell into [src].") - update_icon() + update_appearance() else if(!charging && default_deconstruction_screwdriver(user, icon_state, icon_state, W)) return @@ -74,9 +74,9 @@ return ..() /obj/machinery/cell_charger/proc/removecell() - charging.update_icon() + charging.update_appearance() charging = null - update_icon() + update_appearance() /obj/machinery/cell_charger/attack_hand(mob/user) . = ..() @@ -127,4 +127,4 @@ use_power(charge_rate) charging.give(charge_rate) //this is 2558, efficient batteries exist - update_icon() + update_appearance() diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 991a89ffb8bc..60c41eeeb921 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -97,7 +97,7 @@ beaker = new_beaker else beaker = null - update_icon() + update_appearance() return TRUE /obj/machinery/clonepod/ui_interact(mob/user, datum/tgui/ui) @@ -209,7 +209,7 @@ INVOKE_ASYNC(src, .proc/horrifyingsound) mess = TRUE icon_state = "pod_g" - update_icon() + update_appearance() return NONE attempting = TRUE //One at a time!! countdown.start() diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm index bfed7c72602b..e782bd209c22 100644 --- a/code/game/machinery/computer/_computer.dm +++ b/code/game/machinery/computer/_computer.dm @@ -40,8 +40,6 @@ /obj/machinery/computer/update_overlays() . = ..() - - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) if(machine_stat & BROKEN) SSvis_overlays.add_vis_overlay(src, icon, "[icon_state]_broken", layer, plane, dir) return @@ -118,7 +116,7 @@ to_chat(user, "You disconnect the monitor.") newframe.state = 4 circuit = null - newframe.update_icon() + newframe.update_appearance() for(var/obj/internal_objects in src) internal_objects.forceMove(loc) qdel(src) diff --git a/code/game/machinery/computer/aifixer.dm b/code/game/machinery/computer/aifixer.dm index 2aba0a8b6124..77cf776158fc 100644 --- a/code/game/machinery/computer/aifixer.dm +++ b/code/game/machinery/computer/aifixer.dm @@ -82,7 +82,7 @@ var/oldstat = occupier.stat restoring = Fix() if(oldstat != occupier.stat) - update_icon() + update_appearance() /obj/machinery/computer/aifixer/update_overlays() . = ..() @@ -91,14 +91,14 @@ if(restoring) . += "ai-fixer-on" - if (occupier) - switch (occupier.stat) - if (CONSCIOUS) - . += "ai-fixer-full" - if (UNCONSCIOUS, HARD_CRIT) - . += "ai-fixer-404" - else + if(!occupier) . += "ai-fixer-empty" + return + switch(occupier.stat) + if(CONSCIOUS) + . += "ai-fixer-full" + if(UNCONSCIOUS, HARD_CRIT) + . += "ai-fixer-404" /obj/machinery/computer/aifixer/transfer_ai(interaction, mob/user, mob/living/silicon/ai/AI, obj/item/aicard/card) if(!..()) @@ -115,7 +115,7 @@ to_chat(AI, "You have been uploaded to a stationary terminal. Sadly, there is no remote access from here.") to_chat(user, "Transfer successful: [AI.name] ([rand(1000,9999)].exe) installed and executed successfully. Local copy has been removed.") card.AI = null - update_icon() + update_appearance() else //Uploading AI from terminal to card if(occupier && !restoring) @@ -124,7 +124,7 @@ occupier.forceMove(card) card.AI = occupier occupier = null - update_icon() + update_appearance() else if (restoring) to_chat(user, "ERROR: Reconstruction in progress.") else if (!occupier) diff --git a/code/game/machinery/computer/apc_control.dm b/code/game/machinery/computer/apc_control.dm index 1c3f8a943f39..eb43515d6e47 100644 --- a/code/game/machinery/computer/apc_control.dm +++ b/code/game/machinery/computer/apc_control.dm @@ -26,7 +26,7 @@ playsound(active_apc, 'sound/machines/boltsdown.ogg', 25, FALSE) playsound(active_apc, 'sound/machines/terminal_alert.ogg', 50, FALSE) active_apc.locked = TRUE - active_apc.update_icon() + active_apc.update_appearance() active_apc.remote_control = null active_apc = null @@ -127,7 +127,7 @@ playsound(active_apc, 'sound/machines/boltsdown.ogg', 25, FALSE) playsound(active_apc, 'sound/machines/terminal_alert.ogg', 50, FALSE) active_apc.locked = TRUE - active_apc.update_icon() + active_apc.update_appearance() active_apc.remote_control = null active_apc = null APC.remote_control = src @@ -140,7 +140,7 @@ playsound(APC, 'sound/machines/boltsup.ogg', 25, FALSE) playsound(APC, 'sound/machines/terminal_alert.ogg', 50, FALSE) APC.locked = FALSE - APC.update_icon() + APC.update_appearance() active_apc = APC if("check-logs") log_activity("Checked Logs") @@ -154,7 +154,7 @@ if(!target) return target.vars[type] = target.setsubsystem(text2num(value)) - target.update_icon() + target.update_appearance() target.update() var/setTo = "" switch(target.vars[type]) diff --git a/code/game/machinery/computer/arcade.dm b/code/game/machinery/computer/arcade.dm index d30a07c9a029..94b57a2d9f57 100644 --- a/code/game/machinery/computer/arcade.dm +++ b/code/game/machinery/computer/arcade.dm @@ -136,7 +136,7 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list( return prizevend(user) T.pay_tickets() - T.update_icon() + T.update_appearance() O = T to_chat(user, "You turn in 2 tickets to the [src] and claim a prize!") return diff --git a/code/game/machinery/computer/atmos_alert.dm b/code/game/machinery/computer/atmos_alert.dm index 98ee1dc56ce0..7a64743c900b 100644 --- a/code/game/machinery/computer/atmos_alert.dm +++ b/code/game/machinery/computer/atmos_alert.dm @@ -62,7 +62,7 @@ to_chat(usr, "Minor alarm for [zone] cleared.") minor_alarms -= zone . = TRUE - update_icon() + update_appearance() /obj/machinery/computer/atmos_alert/proc/set_frequency(new_frequency) SSradio.remove_object(src, receive_frequency) @@ -85,7 +85,7 @@ priority_alarms += zone else if (severity == "minor") minor_alarms += zone - update_icon() + update_appearance() return /obj/machinery/computer/atmos_alert/update_overlays() @@ -94,5 +94,6 @@ return if(priority_alarms.len) . += "alert:2" - else if(minor_alarms.len) + return + if(minor_alarms.len) . += "alert:1" diff --git a/code/game/machinery/computer/atmos_control.dm b/code/game/machinery/computer/atmos_control.dm index e2b5fd34dca3..23937947d80c 100644 --- a/code/game/machinery/computer/atmos_control.dm +++ b/code/game/machinery/computer/atmos_control.dm @@ -45,6 +45,7 @@ /obj/machinery/air_sensor/update_icon_state() icon_state = "gsensor[on]" + return ..() /obj/machinery/air_sensor/process_atmos() if(on) diff --git a/code/game/machinery/computer/buildandrepair.dm b/code/game/machinery/computer/buildandrepair.dm index 917a9ff9a24d..e4e98f28b21e 100644 --- a/code/game/machinery/computer/buildandrepair.dm +++ b/code/game/machinery/computer/buildandrepair.dm @@ -46,7 +46,7 @@ to_chat(user, "You place [P] inside the frame.") circuit = P circuit.add_fingerprint(user) - update_icon() + update_appearance() return else if(istype(P, /obj/item/circuitboard) && !circuit) @@ -56,7 +56,7 @@ P.play_tool_sound(src) to_chat(user, "You screw [circuit] into place.") state = 2 - update_icon() + update_appearance() return if(P.tool_behaviour == TOOL_CROWBAR && circuit) P.play_tool_sound(src) @@ -65,14 +65,14 @@ circuit.forceMove(drop_location()) circuit.add_fingerprint(user) circuit = null - update_icon() + update_appearance() return if(2) if(P.tool_behaviour == TOOL_SCREWDRIVER && circuit) P.play_tool_sound(src) to_chat(user, "You unfasten the circuit board.") state = 1 - update_icon() + update_appearance() return if(istype(P, /obj/item/stack/cable_coil)) if(!P.tool_start_check(user, amount=5)) @@ -83,14 +83,14 @@ return to_chat(user, "You add cables to the frame.") state = 3 - update_icon() + update_appearance() return if(3) if(P.tool_behaviour == TOOL_WIRECUTTER) P.play_tool_sound(src) to_chat(user, "You remove the cables.") state = 2 - update_icon() + update_appearance() var/obj/item/stack/cable_coil/A = new (drop_location(), 5) A.add_fingerprint(user) return @@ -105,14 +105,14 @@ return to_chat(user, "You put in the glass panel.") state = 4 - update_icon() + update_appearance() return if(4) if(P.tool_behaviour == TOOL_CROWBAR) P.play_tool_sound(src) to_chat(user, "You remove the glass panel.") state = 3 - update_icon() + update_appearance() var/obj/item/stack/sheet/glass/G = new(drop_location(), 2) G.add_fingerprint(user) return @@ -126,7 +126,7 @@ built_comp.icon = built_icon built_comp.icon_state = built_icon_state built_comp.deconpath = deconpath - built_comp.update_icon() + built_comp.update_appearance() qdel(src) return if(user.a_intent == INTENT_HARM) diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 097f538666d0..3275bb33f272 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -254,6 +254,7 @@ icon_state = initial(icon_state) if(machine_stat & BROKEN) icon_state += "b" + return ..() /obj/machinery/computer/security/telescreen/entertainment name = "entertainment monitor" diff --git a/code/game/machinery/computer/teleporter.dm b/code/game/machinery/computer/teleporter.dm index bba4799e08b0..6c83c0389487 100644 --- a/code/game/machinery/computer/teleporter.dm +++ b/code/game/machinery/computer/teleporter.dm @@ -69,13 +69,13 @@ switch(action) if("regimeset") power_station.engaged = FALSE - power_station.teleporter_hub.update_icon() + power_station.teleporter_hub.update_appearance() power_station.teleporter_hub.calibrated = FALSE reset_regime() . = TRUE if("settarget") power_station.engaged = FALSE - power_station.teleporter_hub.update_icon() + power_station.teleporter_hub.update_appearance() power_station.teleporter_hub.calibrated = FALSE set_target(usr) . = TRUE @@ -89,7 +89,7 @@ say("Processing hub calibration to target...") calibrating = TRUE - power_station.update_icon() + power_station.update_appearance() addtimer(CALLBACK(src, .proc/finish_calibration), 50 * (3 - power_station.teleporter_hub.accuracy)) //Better parts mean faster calibration . = TRUE @@ -100,7 +100,7 @@ say("Calibration complete.") else say("Error: Unable to detect hub.") - power_station.update_icon() + power_station.update_appearance() /obj/machinery/computer/teleporter/proc/check_hub_connection() if(!power_station) @@ -164,10 +164,10 @@ target_station.set_machine_stat(target_station.machine_stat & ~NOPOWER) if(target_station.teleporter_hub) target_station.teleporter_hub.set_machine_stat(target_station.teleporter_hub.machine_stat & ~NOPOWER) - target_station.teleporter_hub.update_icon() + target_station.teleporter_hub.update_appearance() if(target_station.teleporter_console) target_station.teleporter_console.set_machine_stat(target_station.teleporter_console.machine_stat & ~NOPOWER) - target_station.teleporter_console.update_icon() + target_station.teleporter_console.update_appearance() /obj/machinery/computer/teleporter/proc/is_eligible(atom/movable/AM) var/turf/T = get_turf(AM) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 5b2129794210..8b2ef4b1169c 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -178,7 +178,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/computer/cryopod/retro, 17) return ..() /obj/machinery/cryopod/LateInitialize() - update_icon() + update_appearance() find_control_computer() /obj/machinery/cryopod/proc/find_control_computer(urgent = FALSE) diff --git a/code/game/machinery/dance_machine.dm b/code/game/machinery/dance_machine.dm index 4a91f9481061..dc66649c0aa9 100644 --- a/code/game/machinery/dance_machine.dm +++ b/code/game/machinery/dance_machine.dm @@ -54,10 +54,8 @@ return ..() /obj/machinery/jukebox/update_icon_state() - if(active) - icon_state = "[initial(icon_state)]-active" - else - icon_state = "[initial(icon_state)]" + icon_state = "[initial(icon_state)]-[active ? "active" : null]" + return ..() /obj/machinery/jukebox/ui_status(mob/user) if(!anchored) @@ -155,7 +153,7 @@ var/jukeboxslottotake = SSjukeboxes.addjukebox(src, selection, 2) //WS Edit Cit #7367 & #7458 if(jukeboxslottotake) active = TRUE - update_icon() + update_appearance() START_PROCESSING(SSobj, src) stop = world.time + selection.song_length return TRUE @@ -453,7 +451,7 @@ active = FALSE dance_over() playsound(src,'sound/machines/terminal_off.ogg',50,TRUE) - update_icon() + update_appearance() stop = world.time + 100 /obj/machinery/jukebox/disco/process() diff --git a/code/game/machinery/defibrillator_mount.dm b/code/game/machinery/defibrillator_mount.dm index 2b1f9c26d85c..f3fa616032d3 100644 --- a/code/game/machinery/defibrillator_mount.dm +++ b/code/game/machinery/defibrillator_mount.dm @@ -87,7 +87,7 @@ // Make sure the defib is set before processing begins. defib = I begin_processing() - update_icon() + update_appearance() return else if(defib && I == defib.paddles) defib.paddles.snap_back() @@ -100,7 +100,7 @@ return clamps_locked = !clamps_locked to_chat(user, "Clamps [clamps_locked ? "" : "dis"]engaged.") - update_icon() + update_appearance() else to_chat(user, "Insufficient access.") return @@ -123,7 +123,7 @@ "You override the locking clamps on [src]!") playsound(src, 'sound/machines/locktoggle.ogg', 50, TRUE) clamps_locked = FALSE - update_icon() + update_appearance() return TRUE /obj/machinery/defibrillator_mount/wrench_act(mob/living/user, obj/item/wrench/W) @@ -159,7 +159,7 @@ // Make sure processing ends before the defib is nulled end_processing() defib = null - update_icon() + update_appearance() /obj/machinery/defibrillator_mount/charging name = "PENLITE defibrillator mount" @@ -189,7 +189,7 @@ if(C.charge < C.maxcharge) use_power(100) C.give(80) - update_icon() + update_appearance() //wallframe, for attaching the mounts easily /obj/item/wallframe/defib_mount diff --git a/code/game/machinery/dish_drive.dm b/code/game/machinery/dish_drive.dm index 8d62bcf287cb..baf3d6ae2cc1 100644 --- a/code/game/machinery/dish_drive.dm +++ b/code/game/machinery/dish_drive.dm @@ -125,6 +125,6 @@ playsound(src, 'sound/items/pshoom.ogg', 50, TRUE) playsound(bin, 'sound/items/pshoom.ogg', 50, TRUE) Beam(bin, icon_state = "rped_upgrade", time = 5) - bin.update_icon() + bin.update_appearance() flick("synthesizer_beam", src) time_since_dishes = world.time + 600 diff --git a/code/game/machinery/dna_scanner.dm b/code/game/machinery/dna_scanner.dm index c0f49c36bdab..51e7562c49db 100644 --- a/code/game/machinery/dna_scanner.dm +++ b/code/game/machinery/dna_scanner.dm @@ -3,6 +3,7 @@ desc = "It scans DNA structures." icon = 'icons/obj/machines/cloning.dmi' icon_state = "scanner" + base_icon_state = "scanner" density = TRUE use_power = IDLE_POWER_USE idle_power_usage = 50 @@ -36,20 +37,21 @@ /obj/machinery/dna_scannernew/update_icon_state() //no power or maintenance if(machine_stat & (NOPOWER|BROKEN)) - icon_state = initial(icon_state)+ (state_open ? "_open" : "") + "_unpowered" - return + icon_state = "[base_icon_state][state_open ? "_open" : null]_unpowered" + return ..() if((machine_stat & MAINT) || panel_open) - icon_state = initial(icon_state)+ (state_open ? "_open" : "") + "_maintenance" - return + icon_state = "[base_icon_state][state_open ? "_open" : null]_maintenance" + return ..() //running and someone in there if(occupant) - icon_state = initial(icon_state)+ "_occupied" - return + icon_state = "[base_icon_state]_occupied" + return ..() //running - icon_state = initial(icon_state)+ (state_open ? "_open" : "") + icon_state = "[base_icon_state][state_open ? "_open" : null]" + return ..() /obj/machinery/dna_scannernew/proc/toggle_open(mob/user) if(panel_open) @@ -125,7 +127,7 @@ /obj/machinery/dna_scannernew/attackby(obj/item/I, mob/user, params) if(!occupant && default_deconstruction_screwdriver(user, icon_state, icon_state, I))//sent icon_state is irrelevant... - update_icon()//..since we're updating the icon here, since the scanner can be unpowered when opened/closed + update_appearance()//..since we're updating the icon here, since the scanner can be unpowered when opened/closed return if(default_pry_open(I)) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 680e0f898919..98e546ddefac 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -147,7 +147,7 @@ RegisterSignal(src, COMSIG_MACHINERY_BROKEN, .proc/on_break) - update_icon() + update_appearance() var/static/list/connections = list( COMSIG_ATOM_ENTERED = .proc/on_entered, @@ -185,7 +185,7 @@ welded = TRUE if(24 to 30) panel_open = TRUE - update_icon() + update_appearance() /obj/machinery/door/airlock/ComponentInitialize() . = ..() @@ -204,7 +204,7 @@ SIGNAL_HANDLER if(density && has_hatch && (mover.pass_flags & PASSDOORHATCH) && !hatchstate) hatchstate = 1 - update_icon() + update_appearance() playsound(loc, hatch_open_sound, 40, 1, -1, mono_adj = TRUE) if(mover.layer != initial(mover.layer)) return @@ -218,7 +218,7 @@ /obj/machinery/door/airlock/proc/close_hatch() hatchstate = 0 - update_icon() + update_appearance() playsound(loc, hatch_close_sound, 30, 1, -1, mono_adj = TRUE) /obj/machinery/door/airlock/proc/update_other_id() @@ -346,7 +346,7 @@ return emergency = !emergency - update_icon() + update_appearance() /obj/machinery/door/airlock/lock() bolt() @@ -357,7 +357,7 @@ locked = TRUE playsound(src, boltDown, 30, FALSE, 3, mono_adj = TRUE) audible_message("You hear a click from the bottom of the door.", null, 1) - update_icon() + update_appearance() /obj/machinery/door/airlock/unlock() unbolt() @@ -368,7 +368,7 @@ locked = FALSE playsound(src, boltUp, 30, FALSE, 3, mono_adj = TRUE) audible_message("You hear a click from the bottom of the door.", null, 1) - update_icon() + update_appearance() /obj/machinery/door/airlock/narsie_act() var/turf/T = get_turf(src) @@ -409,10 +409,10 @@ /obj/machinery/door/airlock/handle_atom_del(atom/A) if(A == note) note = null - update_icon() + update_appearance() if(A == seal) seal = null - update_icon() + update_appearance() /obj/machinery/door/airlock/bumpopen(mob/living/user) //Airlocks now zap you when you 'bump' them open when they're electrified. --NeoFite if(!issilicon(usr)) @@ -466,7 +466,7 @@ /obj/machinery/door/airlock/proc/regainMainPower() if(secondsMainPowerLost > 0) secondsMainPowerLost = 0 - update_icon() + update_appearance() /obj/machinery/door/airlock/proc/handlePowerRestore() var/cont = TRUE @@ -487,7 +487,7 @@ cont = TRUE spawnPowerRestoreRunning = FALSE updateDialog() - update_icon() + update_appearance() /obj/machinery/door/airlock/proc/loseMainPower() if(secondsMainPowerLost <= 0) @@ -497,7 +497,7 @@ if(!spawnPowerRestoreRunning) spawnPowerRestoreRunning = TRUE INVOKE_ASYNC(src, .proc/handlePowerRestore) - update_icon() + update_appearance() /obj/machinery/door/airlock/proc/loseBackupPower() if(secondsBackupPowerLost < 60) @@ -505,12 +505,12 @@ if(!spawnPowerRestoreRunning) spawnPowerRestoreRunning = TRUE INVOKE_ASYNC(src, .proc/handlePowerRestore) - update_icon() + update_appearance() /obj/machinery/door/airlock/proc/regainBackupPower() if(secondsBackupPowerLost > 0) secondsBackupPowerLost = 0 - update_icon() + update_appearance() // shock user with probability prb (if all connections & power are working) // returns TRUE if shocked, FALSE otherwise @@ -530,23 +530,31 @@ else return FALSE -/obj/machinery/door/airlock/update_icon(state=0, override=0) +/obj/machinery/door/airlock/update_icon(updates=ALL, state=0, override=FALSE) if(operating && !override) return - switch(state) - if(0) - if(density) - state = AIRLOCK_CLOSED - else - state = AIRLOCK_OPEN - icon_state = "" + if(!state) + state = density ? AIRLOCK_CLOSED : AIRLOCK_OPEN + airlock_state = state + + . = ..() + + if(hasPower() && unres_sides) + set_light(2, 1) + else + set_light(0) + +/obj/machinery/door/airlock/update_icon_state() + . = ..() + switch(airlock_state) if(AIRLOCK_OPEN, AIRLOCK_CLOSED) icon_state = "" if(AIRLOCK_DENY, AIRLOCK_OPENING, AIRLOCK_CLOSING, AIRLOCK_EMAG) icon_state = "nonexistenticonstate" //MADNESS - set_airlock_overlays(state) -/obj/machinery/door/airlock/proc/set_airlock_overlays(state) +/obj/machinery/door/airlock/update_overlays() + . = ..() + var/mutable_appearance/frame_overlay var/mutable_appearance/filling_overlay var/mutable_appearance/lights_overlay @@ -559,7 +567,7 @@ var/notetype = note_type() var/mutable_appearance/hatch_overlay - switch(state) + switch(airlock_state) if(AIRLOCK_CLOSED) frame_overlay = get_airlock_overlay("closed", icon) if(airlock_material) @@ -697,64 +705,57 @@ if(has_hatch) hatch_overlay = get_airlock_overlay("hatch_opening", icon) - cut_overlays() - add_overlay(frame_overlay) - add_overlay(filling_overlay) - add_overlay(lights_overlay) - add_overlay(panel_overlay) - add_overlay(weld_overlay) - add_overlay(sparks_overlay) - add_overlay(damag_overlay) - add_overlay(note_overlay) - add_overlay(hatch_overlay) //WS edit - Drone hatches - add_overlay(seal_overlay) - check_unres() + . += frame_overlay + . += filling_overlay + . += lights_overlay + . += panel_overlay + . += weld_overlay + . += sparks_overlay + . += damag_overlay + . += note_overlay + . += seal_overlay + . += hatch_overlay -/proc/get_airlock_overlay(icon_state, icon_file) - var/obj/machinery/door/airlock/A - pass(A) //suppress unused warning - var/list/airlock_overlays = A.airlock_overlays - var/iconkey = "[icon_state][icon_file]" - if((!(. = airlock_overlays[iconkey]))) - . = airlock_overlays[iconkey] = mutable_appearance(icon_file, icon_state) - -/obj/machinery/door/airlock/proc/check_unres() //unrestricted sides. This overlay indicates which directions the player can access even without an ID if(hasPower() && unres_sides) if(unres_sides & NORTH) var/image/I = image(icon='icons/obj/doors/airlocks/station/overlays.dmi', icon_state="unres_n") I.pixel_y = 32 - set_light(l_range = 2, l_power = 1) - add_overlay(I) + . += I if(unres_sides & SOUTH) var/image/I = image(icon='icons/obj/doors/airlocks/station/overlays.dmi', icon_state="unres_s") I.pixel_y = -32 - set_light(l_range = 2, l_power = 1) - add_overlay(I) + . += I if(unres_sides & EAST) var/image/I = image(icon='icons/obj/doors/airlocks/station/overlays.dmi', icon_state="unres_e") I.pixel_x = 32 - set_light(l_range = 2, l_power = 1) - add_overlay(I) + . += I if(unres_sides & WEST) var/image/I = image(icon='icons/obj/doors/airlocks/station/overlays.dmi', icon_state="unres_w") I.pixel_x = -32 - set_light(l_range = 2, l_power = 1) - add_overlay(I) + . += I else set_light(0) +/proc/get_airlock_overlay(icon_state, icon_file) + var/obj/machinery/door/airlock/A + pass(A) //suppress unused warning + var/list/airlock_overlays = A.airlock_overlays + var/iconkey = "[icon_state][icon_file]" + if((!(. = airlock_overlays[iconkey]))) + . = airlock_overlays[iconkey] = mutable_appearance(icon_file, icon_state) + /obj/machinery/door/airlock/do_animate(animation) switch(animation) if("opening") - update_icon(AIRLOCK_OPENING) + update_icon(ALL, AIRLOCK_OPENING) if("closing") - update_icon(AIRLOCK_CLOSING) + update_icon(ALL, AIRLOCK_CLOSING) if("deny") if(!machine_stat) - update_icon(AIRLOCK_DENY) + update_icon(ALL, AIRLOCK_DENY) playsound(src, doorDeni, 50, FALSE, 3, mono_adj = TRUE) sleep(6) - update_icon(AIRLOCK_CLOSED) + update_icon(ALL, AIRLOCK_CLOSED) /obj/machinery/door/airlock/examine(mob/user) . = ..() @@ -872,7 +873,7 @@ user.visible_message("[user] grabs [note] from [src].", "You remove [note] from [src].") user.put_in_hands(note) note = null - update_icon() //WS end + update_appearance() //WS end return TRUE if(locked && allowed(user) && aac) aac.request_from_door(src) @@ -960,7 +961,7 @@ user.visible_message("[user] reinforces \the [src] with metal.", "You reinforce \the [src] with metal.") security_level = AIRLOCK_SECURITY_METAL - update_icon() + update_appearance() return else if(istype(C, /obj/item/stack/sheet/plasteel)) var/obj/item/stack/sheet/plasteel/S = C @@ -976,7 +977,7 @@ security_level = AIRLOCK_SECURITY_PLASTEEL modify_max_integrity(max_integrity * AIRLOCK_INTEGRITY_MULTIPLIER) damage_deflection = AIRLOCK_DAMAGE_DEFLECTION_R - update_icon() + update_appearance() return if(AIRLOCK_SECURITY_METAL) if(C.tool_behaviour == TOOL_WELDER) @@ -991,7 +992,7 @@ "You hear welding.") security_level = AIRLOCK_SECURITY_NONE spawn_atom_to_turf(/obj/item/stack/sheet/metal, user.loc, 2) - update_icon() + update_appearance() return if(AIRLOCK_SECURITY_PLASTEEL_I_S) if(C.tool_behaviour == TOOL_CROWBAR) @@ -1008,7 +1009,7 @@ modify_max_integrity(max_integrity / AIRLOCK_INTEGRITY_MULTIPLIER) damage_deflection = AIRLOCK_DAMAGE_DEFLECTION_N spawn_atom_to_turf(/obj/item/stack/sheet/plasteel, user.loc, 1) - update_icon() + update_appearance() return if(AIRLOCK_SECURITY_PLASTEEL_I) if(C.tool_behaviour == TOOL_WELDER) @@ -1068,13 +1069,13 @@ panel_open = !panel_open to_chat(user, "You [panel_open ? "open":"close"] the maintenance panel of the airlock.") C.play_tool_sound(src) - update_icon() + update_appearance() else if((C.tool_behaviour == TOOL_WIRECUTTER) && note) user.visible_message("[user] cuts down [note] from [src].", "You remove [note] from [src].") C.play_tool_sound(src) note.forceMove(get_turf(user)) note = null - update_icon() + update_appearance() else if(is_wire_tool(C) && panel_open) attempt_wire_interaction(user) return @@ -1108,7 +1109,7 @@ user.visible_message("[user] finishes sealing [src].", "You finish sealing [src].") seal = airlockseal modify_max_integrity(max_integrity * AIRLOCK_SEAL_MULTIPLIER) - update_icon() + update_appearance() else if(istype(C, /obj/item/paper) || istype(C, /obj/item/photo)) if(note) @@ -1119,7 +1120,7 @@ return user.visible_message("[user] pins [C] to [src].", "You pin [C] to [src].") note = C - update_icon() + update_appearance() else return ..() @@ -1139,7 +1140,7 @@ welded = !welded user.visible_message("[user] [welded? "welds shut":"unwelds"] [src].", \ "You [welded ? "weld the airlock shut":"unweld the airlock"].") - update_icon() + update_appearance() else if(obj_integrity < max_integrity) if(!W.tool_start_check(user, amount=0)) @@ -1152,7 +1153,7 @@ set_machine_stat(machine_stat & ~BROKEN) user.visible_message("[user] finishes welding [src].", \ "You finish repairing the airlock.") - update_icon() + update_appearance() else to_chat(user, "The airlock doesn't need repairing.") @@ -1185,7 +1186,7 @@ user.visible_message("[user] finishes removing the seal from [src].", "You finish removing [src]'s pneumatic seal.") seal = null modify_max_integrity(max_integrity / AIRLOCK_SEAL_MULTIPLIER) - update_icon() + update_appearance() return TRUE @@ -1262,7 +1263,7 @@ if(!density) return TRUE operating = TRUE - update_icon(AIRLOCK_OPENING, 1) + update_icon(ALL, AIRLOCK_OPENING, TRUE) sleep(1) set_opacity(0) update_freelook_sight() @@ -1272,7 +1273,7 @@ air_update_turf(1) sleep(1) layer = OPEN_DOOR_LAYER - update_icon(AIRLOCK_OPEN, 1) + update_icon(ALL, AIRLOCK_OPEN, TRUE) operating = FALSE if(delayed_close_requested) delayed_close_requested = FALSE @@ -1307,7 +1308,7 @@ SSexplosions.medobj += killthis operating = TRUE - update_icon(AIRLOCK_CLOSING, 1) + update_icon(ALL, AIRLOCK_CLOSING, 1) layer = CLOSED_DOOR_LAYER if(air_tight) density = TRUE @@ -1325,7 +1326,7 @@ set_opacity(1) update_freelook_sight() sleep(1) - update_icon(AIRLOCK_CLOSED, 1) + update_icon(ALL, AIRLOCK_CLOSED, 1) operating = FALSE delayed_close_requested = FALSE if(safe) @@ -1362,7 +1363,7 @@ icon = airlock.icon overlays_file = airlock.overlays_file assemblytype = airlock.assemblytype - update_icon() + update_appearance() // these are just hanging around but are never placed, we need to delete them qdel(airlock) @@ -1375,13 +1376,13 @@ /obj/machinery/door/airlock/emag_act(mob/user) if(!operating && density && hasPower() && !(obj_flags & EMAGGED)) operating = TRUE - update_icon(AIRLOCK_EMAG, 1) + update_icon(ALL, AIRLOCK_EMAG, 1) sleep(6) if(QDELETED(src)) return operating = FALSE if(!open()) - update_icon(AIRLOCK_CLOSED, 1) + update_icon(ALL, AIRLOCK_CLOSED, 1) obj_flags |= EMAGGED lights = FALSE locked = TRUE @@ -1464,7 +1465,7 @@ /obj/machinery/door/airlock/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir) . = ..() if(obj_integrity < (0.75 * max_integrity)) - update_icon() + update_appearance() /obj/machinery/door/airlock/deconstruct(disassembled = TRUE, mob/user) @@ -1482,7 +1483,7 @@ A.created_name = name A.previous_assembly = previous_airlock A.update_name() - A.update_icon() + A.update_appearance() A.dir = dir if(!disassembled) @@ -1593,14 +1594,14 @@ if("disrupt-main") if(!secondsMainPowerLost) loseMainPower() - update_icon() + update_appearance() else to_chat(usr, "Main power is already offline.") . = TRUE if("disrupt-backup") if(!secondsBackupPowerLost) loseBackupPower() - update_icon() + update_appearance() else to_chat(usr, "Backup power is already offline.") . = TRUE @@ -1624,7 +1625,7 @@ . = TRUE if("light-toggle") lights = !lights - update_icon() + update_appearance() . = TRUE if("safe-toggle") safe = !safe @@ -1683,7 +1684,7 @@ if(!user_allowed(user)) return emergency = !emergency - update_icon() + update_appearance() /obj/machinery/door/airlock/proc/user_toggle_open(mob/user) if(!user_allowed(user)) diff --git a/code/game/machinery/doors/airlock_types.dm b/code/game/machinery/doors/airlock_types.dm index 7d6edd417451..1d9525cf014f 100644 --- a/code/game/machinery/doors/airlock_types.dm +++ b/code/game/machinery/doors/airlock_types.dm @@ -253,7 +253,7 @@ DA.glass = TRUE if(heat_proof) DA.heat_proof_finished = TRUE - DA.update_icon() + DA.update_appearance() DA.update_name() qdel(src) @@ -539,7 +539,7 @@ name = "airlock" desc = "It opens and closes." stealthy = TRUE - update_icon() + update_appearance() /obj/machinery/door/airlock/cult/proc/reveal() icon = initial(icon) @@ -547,7 +547,7 @@ name = initial(name) desc = initial(desc) stealthy = initial(stealthy) - update_icon() + update_appearance() /obj/machinery/door/airlock/cult/narsie_act() return diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm index 53f0f27e06a6..7013d3f68a7a 100644 --- a/code/game/machinery/doors/brigdoors.dm +++ b/code/game/machinery/doors/brigdoors.dm @@ -65,7 +65,7 @@ if(!targets.len) obj_break() - update_icon() + update_appearance() //Main door timer loop, if it's timing and time is >0 reduce time by 1. @@ -78,7 +78,7 @@ if(timing) if(world.time - activation_time >= timer_duration) timer_end() // open doors, reset timer, clear status screen - update_icon() + update_appearance() // open/closedoor checks if door_timer has power, if so it checks if the // linked door is open/closed (by density) then opens it/closes it. @@ -105,7 +105,7 @@ if(C.opened && !C.close()) continue C.locked = TRUE - C.update_icon() + C.update_appearance() return 1 @@ -121,7 +121,7 @@ timing = FALSE activation_time = null set_timer(0) - update_icon() + update_appearance() for(var/obj/machinery/door/window/brigdoor/door in targets) if(!door.density) @@ -139,7 +139,7 @@ if(C.opened) continue C.locked = FALSE - C.update_icon() + C.update_appearance() return 1 @@ -165,8 +165,8 @@ // if BROKEN, display blue screen of death icon AI uses // if timing=true, run update display function /obj/machinery/door_timer/update_icon() + . = ..() if(machine_stat & (NOPOWER)) - icon_state = "frame" return if(machine_stat & (BROKEN)) diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 7d0f5a993183..f2e1200564b9 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -3,6 +3,7 @@ desc = "It opens and closes." icon = 'icons/obj/doors/Doorint.dmi' icon_state = "door1" + base_icon_state = "door" opacity = TRUE density = TRUE move_resist = MOVE_FORCE_VERY_STRONG @@ -301,10 +302,8 @@ secondsElectrified = MACHINE_NOT_ELECTRIFIED /obj/machinery/door/update_icon_state() - if(density) - icon_state = "door1" - else - icon_state = "door0" + icon_state = "[base_icon_state][density]" + return ..() /obj/machinery/door/proc/do_animate(animation) switch(animation) @@ -336,7 +335,7 @@ flags_1 &= ~PREVENT_CLICK_UNDER_1 sleep(5) layer = initial(layer) - update_icon() + update_appearance() set_opacity(0) operating = FALSE air_update_turf(1) @@ -367,7 +366,7 @@ density = TRUE flags_1 |= PREVENT_CLICK_UNDER_1 sleep(5) - update_icon() + update_appearance() if(visible && !glass) set_opacity(1) operating = FALSE diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 2053d33a3e9a..fed9d49239e7 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -163,7 +163,7 @@ if(W.use_tool(src, user, 40, volume=50)) welded = !welded to_chat(user, "[user] [welded?"welds":"unwelds"] [src].", "You [welded ? "weld" : "unweld"] [src].") - update_icon() + update_appearance() /obj/machinery/door/firedoor/try_to_crowbar(obj/item/I, mob/user) if(welded || operating) @@ -221,19 +221,14 @@ flick("door_closing", src) /obj/machinery/door/firedoor/update_icon_state() - if(density) - icon_state = "door_closed" - else - icon_state = "door_open" + . = ..() + icon_state = "[base_icon_state]_[density ? "closed" : "open"]" /obj/machinery/door/firedoor/update_overlays() . = ..() if(!welded) return - if(density) - . += "welded" - else - . += "welded_open" + . += density ? "welded" : "welded_open" /obj/machinery/door/firedoor/open() playsound(loc, door_open_sound, 90, TRUE) @@ -310,7 +305,7 @@ else F.constructionStep = CONSTRUCTION_WIRES_EXPOSED F.obj_integrity = F.max_integrity * 0.5 - F.update_icon() + F.update_appearance() qdel(src) @@ -489,6 +484,7 @@ desc = "A partially completed firelock." icon = 'icons/obj/doors/doorfire.dmi' icon_state = "frame1" + base_icon_state = "frame" anchored = FALSE density = TRUE var/constructionStep = CONSTRUCTION_NOCIRCUIT @@ -510,7 +506,8 @@ . += "There are no firelock electronics in the frame. The frame could be cut apart." /obj/structure/firelock_frame/update_icon_state() - icon_state = "frame[constructionStep]" + icon_state = "[base_icon_state][constructionStep]" + return ..() /obj/structure/firelock_frame/attackby(obj/item/C, mob/user) switch(constructionStep) @@ -529,7 +526,7 @@ "[user] pries out a metal plate from [src], exposing the wires.", \ "You remove the cover plate from [src], exposing the wires.") constructionStep = CONSTRUCTION_WIRES_EXPOSED - update_icon() + update_appearance() return if(C.tool_behaviour == TOOL_WRENCH) var/obj/machinery/door/firedoor/A = locate(/obj/machinery/door/firedoor) in get_turf(src) @@ -554,7 +551,7 @@ else var/obj/machinery/door/firedoor/F = new firelock_type(get_turf(src)) F.dir = src.dir - F.update_icon() + F.update_appearance() qdel(src) return if(istype(C, /obj/item/stack/sheet/plasteel)) @@ -595,7 +592,7 @@ "You remove the wiring from [src], exposing the circuit board.") new/obj/item/stack/cable_coil(get_turf(src), 5) constructionStep = CONSTRUCTION_GUTTED - update_icon() + update_appearance() return if(C.tool_behaviour == TOOL_CROWBAR) C.play_tool_sound(src) @@ -611,7 +608,7 @@ "[user] pries the metal plate into [src].", \ "You pry [src]'s cover plate into place, hiding the wires.") constructionStep = CONSTRUCTION_PANEL_OPEN - update_icon() + update_appearance() return if(CONSTRUCTION_GUTTED) if(C.tool_behaviour == TOOL_CROWBAR) @@ -627,7 +624,7 @@ "You remove the circuit board from [src].") new /obj/item/electronics/firelock(drop_location()) constructionStep = CONSTRUCTION_NOCIRCUIT - update_icon() + update_appearance() return if(istype(C, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/B = C @@ -647,7 +644,7 @@ playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, TRUE) B.use(5) constructionStep = CONSTRUCTION_WIRES_EXPOSED - update_icon() + update_appearance() return if(CONSTRUCTION_NOCIRCUIT) if(C.tool_behaviour == TOOL_WELDER) @@ -684,7 +681,7 @@ "You insert and secure [C].") playsound(get_turf(src), 'sound/items/deconstruct.ogg', 50, TRUE) constructionStep = CONSTRUCTION_GUTTED - update_icon() + update_appearance() return if(istype(C, /obj/item/electroadaptive_pseudocircuit)) var/obj/item/electroadaptive_pseudocircuit/P = C @@ -693,7 +690,7 @@ user.visible_message("[user] fabricates a circuit and places it into [src].", \ "You adapt a firelock circuit and slot it into the assembly.") constructionStep = CONSTRUCTION_GUTTED - update_icon() + update_appearance() return return ..() @@ -710,7 +707,7 @@ user.visible_message("[user] fabricates a circuit and places it into [src].", \ "You adapt a firelock circuit and slot it into the assembly.") constructionStep = CONSTRUCTION_GUTTED - update_icon() + update_appearance() return TRUE if(RCD_DECONSTRUCT) to_chat(user, "You deconstruct [src].") @@ -772,8 +769,8 @@ icon = 'icons/obj/doors/doorfirewindow.dmi' icon_state = "door_frame" -/obj/structure/firelock_frame/window/update_icon() - return +/obj/structure/firelock_frame/window/update_appearance() + return ..() #undef CONSTRUCTION_COMPLETE diff --git a/code/game/machinery/doors/passworddoor.dm b/code/game/machinery/doors/passworddoor.dm index e2fe57e42669..a788bb603a6e 100644 --- a/code/game/machinery/doors/passworddoor.dm +++ b/code/game/machinery/doors/passworddoor.dm @@ -43,10 +43,8 @@ do_animate("deny") /obj/machinery/door/password/update_icon_state() - if(density) - icon_state = "closed" - else - icon_state = "open" + . = ..() + icon_state = density ? "closed" : "open" /obj/machinery/door/password/do_animate(animation) switch(animation) diff --git a/code/game/machinery/doors/poddoor.dm b/code/game/machinery/doors/poddoor.dm index a55b68c5593d..56418d523b1d 100644 --- a/code/game/machinery/doors/poddoor.dm +++ b/code/game/machinery/doors/poddoor.dm @@ -63,7 +63,7 @@ assembly.state = AIRLOCK_ASSEMBLY_NEEDS_ELECTRONICS assembly.created_name = name assembly.update_name() - assembly.update_icon() + assembly.update_appearance() assembly.welded = TRUE assembly.dir = dir new /obj/item/electronics/airlock(loc) @@ -136,10 +136,8 @@ playsound(src, close_sound, 30, FALSE) /obj/machinery/door/poddoor/update_icon_state() - if(density) - icon_state = "closed" - else - icon_state = "open" + . = ..() + icon_state = density ? "closed" : "open" /obj/machinery/door/poddoor/try_to_activate_door(mob/user) return diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 8aed9c5eb709..f4cc13e5eeff 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -58,10 +58,8 @@ return ..() /obj/machinery/door/window/update_icon_state() - if(density) - icon_state = base_state - else - icon_state = "[base_state]open" + . = ..() + icon_state = "[base_state][density ? null : "open"]" /obj/machinery/door/window/proc/open_and_close() if(!open()) @@ -266,7 +264,7 @@ WA.set_anchored(TRUE) WA.state= "02" WA.setDir(dir) - WA.update_icon() + WA.update_appearance() WA.created_name = name if(obj_flags & EMAGGED) diff --git a/code/game/machinery/doppler_array.dm b/code/game/machinery/doppler_array.dm index ca93d30dfdda..8af3908ec531 100644 --- a/code/game/machinery/doppler_array.dm +++ b/code/game/machinery/doppler_array.dm @@ -4,7 +4,7 @@ name = "tachyon-doppler array" desc = "A highly precise directional sensor array which measures the release of quants from decaying tachyons. The doppler shifting of the mirror-image formed by these quants can reveal the size, location and temporal affects of energetic disturbances within a large radius ahead of the array.\n" icon = 'icons/obj/machines/research.dmi' - icon_state = "tdoppler" + base_icon_state = "tdoppler" density = TRUE verb_say = "states coldly" var/cooldown = 10 @@ -187,11 +187,10 @@ /obj/machinery/doppler_array/update_icon_state() if(machine_stat & BROKEN) - icon_state = "[initial(icon_state)]-broken" - else if(powered()) - icon_state = initial(icon_state) - else - icon_state = "[initial(icon_state)]-off" + icon_state = "[base_icon_state]-broken" + return ..() + icon_state = "[base_icon_state][powered() ? null : "-off"]" + return ..() /obj/machinery/doppler_array/research name = "tachyon-doppler research array" diff --git a/code/game/machinery/droneDispenser.dm b/code/game/machinery/droneDispenser.dm index 35eee6d6d1d8..34ffe2c9d6ea 100644 --- a/code/game/machinery/droneDispenser.dm +++ b/code/game/machinery/droneDispenser.dm @@ -168,7 +168,7 @@ playsound(src, work_sound, 50, TRUE) mode = DRONE_PRODUCTION timer = world.time + production_time - update_icon() + update_appearance() if(DRONE_PRODUCTION) materials.use_materials(using_materials) @@ -185,7 +185,7 @@ mode = DRONE_RECHARGING timer = world.time + cooldownTime - update_icon() + update_appearance() if(DRONE_RECHARGING) if(recharge_sound) @@ -194,7 +194,7 @@ visible_message("[src] [recharge_message]") mode = DRONE_READY - update_icon() + update_appearance() /obj/machinery/droneDispenser/proc/count_shells() . = 0 @@ -211,6 +211,9 @@ icon_state = icon_creating else icon_state = icon_on + return ..() + +// icon_state = "["icon"]_[(mode == DRONE_RECHARGING) ? "recharging"]" /obj/machinery/droneDispenser/attackby(obj/item/I, mob/living/user) if(I.tool_behaviour == TOOL_CROWBAR) @@ -240,7 +243,7 @@ set_machine_stat(machine_stat & ~BROKEN) obj_integrity = max_integrity - update_icon() + update_appearance() else return ..() diff --git a/code/game/machinery/embedded_controller/access_controller.dm b/code/game/machinery/embedded_controller/access_controller.dm index 6b15dc876b5c..3b1bfbd4b351 100644 --- a/code/game/machinery/embedded_controller/access_controller.dm +++ b/code/game/machinery/embedded_controller/access_controller.dm @@ -40,6 +40,7 @@ /obj/machinery/doorButtons/access_button icon = 'icons/obj/airlock_machines.dmi' icon_state = "access_button_standby" + base_icon_state = "access_button" name = "access button" desc = "A button used for the explicit purpose of opening an airlock." var/idDoor @@ -67,7 +68,7 @@ if(controller.machine_stat & NOPOWER) return busy = TRUE - update_icon() + update_appearance() if(door.density) if(!controller.exteriorAirlock || !controller.interiorAirlock) controller.onlyOpen(door) @@ -82,16 +83,14 @@ /obj/machinery/doorButtons/access_button/proc/not_busy() busy = FALSE - update_icon() + update_appearance() /obj/machinery/doorButtons/access_button/update_icon_state() if(machine_stat & NOPOWER) - icon_state = "access_button_off" - else - if(busy) - icon_state = "access_button_cycle" - else - icon_state = "access_button_standby" + icon_state = "[base_icon_state]_off" + return ..() + icon_state = "[base_icon_state]_[busy ? "cycle" : "standby"]" + return ..() /obj/machinery/doorButtons/access_button/removeMe(obj/O) if(O == door) @@ -102,6 +101,7 @@ /obj/machinery/doorButtons/airlock_controller icon = 'icons/obj/airlock_machines.dmi' icon_state = "access_control_standby" + base_icon_state = "access_control" name = "access console" desc = "A small console that can cycle opening between two airlocks." var/obj/machinery/door/airlock/interiorAirlock @@ -148,7 +148,7 @@ /obj/machinery/doorButtons/airlock_controller/proc/onlyOpen(obj/machinery/door/airlock/A) if(A) busy = CLOSING - update_icon() + update_appearance() openDoor(A) /obj/machinery/doorButtons/airlock_controller/proc/onlyClose(obj/machinery/door/airlock/A) @@ -160,7 +160,7 @@ if(A.density) goIdle() return FALSE - update_icon() + update_appearance() A.safe = FALSE //Door crushies, manual door after all. Set every time in case someone changed it, safe doors can end up waiting forever. A.unbolt() if(A.close()) @@ -179,7 +179,7 @@ if(exteriorAirlock.density == interiorAirlock.density || !A.density) return busy = CYCLE - update_icon() + update_appearance() if(A == interiorAirlock) if(closeDoor(exteriorAirlock)) busy = CYCLE_INTERIOR @@ -219,7 +219,7 @@ lostPower = FALSE busy = FALSE if(update) - update_icon() + update_appearance() updateUsrDialog() /obj/machinery/doorButtons/airlock_controller/process() @@ -248,11 +248,9 @@ /obj/machinery/doorButtons/airlock_controller/update_icon_state() if(machine_stat & NOPOWER) icon_state = "access_control_off" - return - if(busy || lostPower) - icon_state = "access_control_process" - else - icon_state = "access_control_standby" + return ..() + icon_state = "[base_icon_state]_[(busy || lostPower) ? "process" : "standby"]" + return ..() /obj/machinery/doorButtons/airlock_controller/ui_interact(mob/user) var/datum/browser/popup = new(user, "computer", name) diff --git a/code/game/machinery/embedded_controller/airlock_controller.dm b/code/game/machinery/embedded_controller/airlock_controller.dm index bb47bcc5a512..a4de8908abfe 100644 --- a/code/game/machinery/embedded_controller/airlock_controller.dm +++ b/code/game/machinery/embedded_controller/airlock_controller.dm @@ -196,6 +196,7 @@ /obj/machinery/embedded_controller/radio/airlock_controller icon = 'icons/obj/airlock_machines.dmi' icon_state = "airlock_control_standby" + base_icon_state = "airlock_control" name = "airlock console" density = FALSE @@ -257,12 +258,10 @@ /obj/machinery/embedded_controller/radio/airlock_controller/update_icon_state() if(on && program) - if(program.memory["processing"]) - icon_state = "airlock_control_process" - else - icon_state = "airlock_control_standby" - else - icon_state = "airlock_control_off" + icon_state = "[base_icon_state]_[program.memory["processing"] ? "process" : "standby"]" + return ..() + icon_state = "[base_icon_state]_off" + return ..() /obj/machinery/embedded_controller/radio/airlock_controller/return_text() diff --git a/code/game/machinery/embedded_controller/embedded_controller_base.dm b/code/game/machinery/embedded_controller/embedded_controller_base.dm index 29040acb5242..315f2e128303 100644 --- a/code/game/machinery/embedded_controller/embedded_controller_base.dm +++ b/code/game/machinery/embedded_controller/embedded_controller_base.dm @@ -65,7 +65,7 @@ if(program) program.process() - update_icon() + update_appearance() src.updateDialog() /obj/machinery/embedded_controller/radio diff --git a/code/game/machinery/embedded_controller/simple_vent_controller.dm b/code/game/machinery/embedded_controller/simple_vent_controller.dm index 4de102becb00..931e9eb0f40a 100644 --- a/code/game/machinery/embedded_controller/simple_vent_controller.dm +++ b/code/game/machinery/embedded_controller/simple_vent_controller.dm @@ -55,10 +55,9 @@ program = new_prog /obj/machinery/embedded_controller/radio/simple_vent_controller/update_icon_state() - if(on && program) - icon_state = "airlock_control_standby" - else - icon_state = "airlock_control_off" + icon_state = "[base_icon_state]_[(on && program) ? "standby" : "off"]" + return ..() + /obj/machinery/embedded_controller/radio/simple_vent_controller/return_text() diff --git a/code/game/machinery/fat_sucker.dm b/code/game/machinery/fat_sucker.dm index 995d8a4fb85d..28218a366f0b 100644 --- a/code/game/machinery/fat_sucker.dm +++ b/code/game/machinery/fat_sucker.dm @@ -30,7 +30,7 @@ /obj/machinery/fat_sucker/Initialize() . = ..() soundloop = new(list(src), FALSE) - update_icon() + update_appearance() /obj/machinery/fat_sucker/RefreshParts() ..() @@ -59,7 +59,7 @@ return to_chat(occupant, "You enter [src].") addtimer(CALLBACK(src, .proc/start_extracting), 20, TIMER_OVERRIDE|TIMER_UNIQUE) - update_icon() + update_appearance() /obj/machinery/fat_sucker/open_machine(mob/user) make_meat() @@ -159,7 +159,7 @@ if(C.nutrition > start_at) processing = TRUE soundloop.start() - update_icon() + update_appearance() set_light(2, 1, "#ff0000") else say("Subject not fat enough.") @@ -196,7 +196,7 @@ to_chat(user, "[src] must be closed to [panel_open ? "close" : "open"] its maintenance hatch!") return if(default_deconstruction_screwdriver(user, icon_state, icon_state, I)) - update_icon() + update_appearance() return return FALSE diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index 7d87d34d2be1..faceb46419d5 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -47,7 +47,7 @@ panel_open = TRUE if(dir) setDir(dir) - update_icon() + update_appearance() myarea = get_area(src) LAZYADD(myarea.firealarms, src) @@ -59,18 +59,17 @@ /obj/machinery/firealarm/update_icon_state() if(panel_open) icon_state = "fire_b[buildstage]" - return + return ..() if(machine_stat & BROKEN) icon_state = "firex" - return + return ..() icon_state = "fire0" + return ..() /obj/machinery/firealarm/update_overlays() . = ..() - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) - if(machine_stat & NOPOWER) return @@ -107,7 +106,7 @@ if(obj_flags & EMAGGED) return obj_flags |= EMAGGED - update_icon() + update_appearance() if(user) user.visible_message("Sparks fly out of [src]!", "You emag [src], disabling its thermal sensors.") @@ -160,7 +159,7 @@ W.play_tool_sound(src) panel_open = !panel_open to_chat(user, "The wires have been [panel_open ? "exposed" : "unexposed"].") - update_icon() + update_appearance() return if(panel_open) @@ -193,7 +192,7 @@ W.play_tool_sound(src) new /obj/item/stack/cable_coil(user.loc, 5) to_chat(user, "You cut the wires from \the [src].") - update_icon() + update_appearance() return else if(W.force) //hit and turn it on @@ -212,7 +211,7 @@ coil.use(5) buildstage = 2 to_chat(user, "You wire \the [src].") - update_icon() + update_appearance() return else if(W.tool_behaviour == TOOL_CROWBAR) @@ -227,14 +226,14 @@ to_chat(user, "You pry out the circuit.") new /obj/item/electronics/firealarm(user.loc) buildstage = 0 - update_icon() + update_appearance() return if(0) if(istype(W, /obj/item/electronics/firealarm)) to_chat(user, "You insert the circuit.") qdel(W) buildstage = 1 - update_icon() + update_appearance() return else if(istype(W, /obj/item/electroadaptive_pseudocircuit)) @@ -246,7 +245,7 @@ "You adapt a fire alarm circuit and slot it into the assembly." ) buildstage = 1 - update_icon() + update_appearance() return else if(W.tool_behaviour == TOOL_WRENCH) @@ -275,7 +274,7 @@ "You adapt a fire alarm circuit and slot it into the assembly." ) buildstage = 1 - update_icon() + update_appearance() return TRUE return FALSE diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm index c6a283d5aa1e..e68b3e0837f9 100644 --- a/code/game/machinery/flasher.dm +++ b/code/game/machinery/flasher.dm @@ -5,6 +5,7 @@ desc = "A wall-mounted flashbulb device." icon = 'icons/obj/stationobjs.dmi' icon_state = "mflash1" + base_icon_state = "mflash" max_integrity = 250 integrity_failure = 0.4 light_color = COLOR_WHITE @@ -15,7 +16,6 @@ var/range = 2 //this is roughly the size of brig cell var/last_flash = 0 //Don't want it getting spammed like regular flashes var/strength = 100 //How knocked down targets are when flashed. - var/base_state = "mflash" /obj/machinery/flasher/portable //Portable version of the flasher. Only flashes when anchored name = "portable flasher" @@ -23,7 +23,7 @@ icon_state = "pflash1-p" strength = 80 anchored = FALSE - base_state = "pflash" + base_icon_state = "pflash" density = TRUE light_system = MOVABLE_LIGHT //Used as a flash here. light_range = FLASH_LIGHT_RANGE @@ -52,13 +52,8 @@ return ..() /obj/machinery/flasher/update_icon_state() - if (powered()) - if(bulb.burnt_out) - icon_state = "[base_state]1-p" - else - icon_state = "[base_state]1" - else - icon_state = "[base_state]1-p" + icon_state = "[base_icon_state]1[(bulb?.burnt_out || !powered()) ? "-p" : null]" + return ..() //Don't want to render prison breaks impossible /obj/machinery/flasher/attackby(obj/item/W, mob/user, params) @@ -110,7 +105,7 @@ return playsound(src.loc, 'sound/weapons/flash.ogg', 100, TRUE) - flick("[base_state]_flash", src) + flick("[base_icon_state]_flash", src) set_light_on(TRUE) addtimer(CALLBACK(src, .proc/flash_end), FLASH_LIGHT_DURATION, TIMER_OVERRIDE|TIMER_UNIQUE) @@ -183,7 +178,7 @@ if (!anchored && !isinspace()) to_chat(user, "[src] is now secured.") - add_overlay("[base_state]-s") + add_overlay("[base_icon_state]-s") set_anchored(TRUE) power_change() proximity_monitor.SetRange(range) diff --git a/code/game/machinery/gulag_teleporter.dm b/code/game/machinery/gulag_teleporter.dm index 5b5e0c8a2966..e147e24717ca 100644 --- a/code/game/machinery/gulag_teleporter.dm +++ b/code/game/machinery/gulag_teleporter.dm @@ -11,6 +11,7 @@ The console is located at computer/gulag_teleporter.dm desc = "A bluespace teleporter used for teleporting prisoners to the labor camp." icon = 'icons/obj/machines/implantchair.dmi' icon_state = "implantchair" + base_icon_state = "implantchair" state_open = FALSE density = TRUE use_power = IDLE_POWER_USE @@ -53,7 +54,7 @@ The console is located at computer/gulag_teleporter.dm /obj/machinery/gulag_teleporter/attackby(obj/item/I, mob/user) if(!occupant && default_deconstruction_screwdriver(user, "[icon_state]", "[icon_state]",I)) - update_icon() + update_appearance() return if(default_deconstruction_crowbar(I)) @@ -65,22 +66,22 @@ The console is located at computer/gulag_teleporter.dm return ..() /obj/machinery/gulag_teleporter/update_icon_state() - icon_state = initial(icon_state) + (state_open ? "_open" : "") + icon_state = "[base_icon_state][state_open ? "_open" : null]" //no power or maintenance if(machine_stat & (NOPOWER|BROKEN)) icon_state += "_unpowered" if((machine_stat & MAINT) || panel_open) icon_state += "_maintenance" - return + return ..() if((machine_stat & MAINT) || panel_open) icon_state += "_maintenance" - return + return ..() //running and someone in there if(occupant) icon_state += "_occupied" - return + return ..() /obj/machinery/gulag_teleporter/relaymove(mob/living/user, direction) diff --git a/code/game/machinery/harvester.dm b/code/game/machinery/harvester.dm index 924a1e95ec81..82ef63c3d738 100644 --- a/code/game/machinery/harvester.dm +++ b/code/game/machinery/harvester.dm @@ -4,6 +4,7 @@ density = TRUE icon = 'icons/obj/machines/harvester.dmi' icon_state = "harvester" + base_icon_state = "harvester" verb_say = "states" state_open = FALSE idle_power_usage = 50 @@ -30,13 +31,16 @@ /obj/machinery/harvester/update_icon_state() if(state_open) - icon_state = initial(icon_state)+"-open" - else if(warming_up) - icon_state = initial(icon_state)+"-charging" - else if(harvesting) - icon_state = initial(icon_state)+"-active" - else - icon_state = initial(icon_state) + icon_state = "[base_icon_state]-open" + return ..() + if(warming_up) + icon_state = "[base_icon_state]-charging" + return ..() + if(harvesting) + icon_state = "[base_icon_state]-active" + return ..() + icon_state = base_icon_state + return ..() /obj/machinery/harvester/open_machine(drop = TRUE) if(panel_open) @@ -89,12 +93,12 @@ harvesting = TRUE visible_message("The [name] begins warming up!") say("Initializing harvest protocol.") - update_icon() + update_appearance() addtimer(CALLBACK(src, .proc/harvest), interval) /obj/machinery/harvester/proc/harvest() warming_up = FALSE - update_icon() + update_appearance() if(!harvesting || state_open || !powered() || !occupant || !iscarbon(occupant)) return playsound(src, 'sound/machines/juicer.ogg', 20, TRUE) diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index 0fb4a77bebbe..e41be5ede09a 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -31,6 +31,7 @@ Possible to do for anyone motivated enough: name = "holopad" desc = "It's a floor-mounted device for projecting holographic images." icon_state = "holopad0" + base_icon_state = "holopad" layer = LOW_OBJ_LAYER plane = FLOOR_PLANE req_access = list(ACCESS_KEYCARD_AUTH) //Used to allow for forced connecting to other (not secure) holopads. Anyone can make a call, though. @@ -380,7 +381,7 @@ Possible to do for anyone motivated enough: playsound(src, 'sound/machines/twobeep.ogg', 100) //bring, bring! ringing = TRUE - update_icon() + update_appearance() /obj/machinery/holopad/proc/activate_holo(mob/living/user) var/mob/living/silicon/ai/AI = user @@ -449,16 +450,16 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ set_light(2) else set_light(0) - update_icon() + update_appearance() /obj/machinery/holopad/update_icon_state() var/total_users = LAZYLEN(masters) + LAZYLEN(holo_calls) if(ringing) - icon_state = "holopad_ringing" - else if(total_users || replay_mode) - icon_state = "holopad1" - else - icon_state = "holopad0" + icon_state = "[base_icon_state]_ringing" + return ..() + icon_state = "[base_icon_state][(total_users || replay_mode) ? 1 : 0]" + return ..() + /obj/machinery/holopad/proc/set_holo(mob/living/user, obj/effect/overlay/holo_pad_hologram/h) LAZYSET(masters, user, h) diff --git a/code/game/machinery/hypnochair.dm b/code/game/machinery/hypnochair.dm index 89a2158a0078..8e86447f6060 100644 --- a/code/game/machinery/hypnochair.dm +++ b/code/game/machinery/hypnochair.dm @@ -3,6 +3,7 @@ desc = "A device used to perform \"enhanced interrogation\" through invasive mental conditioning." icon = 'icons/obj/machines/implantchair.dmi' icon_state = "hypnochair" + base_icon_state = "hypnochair" circuit = /obj/item/circuitboard/machine/hypnochair density = TRUE opacity = FALSE @@ -17,11 +18,11 @@ /obj/machinery/hypnochair/Initialize() . = ..() open_machine() - update_icon() + update_appearance() /obj/machinery/hypnochair/attackby(obj/item/I, mob/user, params) if(!occupant && default_deconstruction_screwdriver(user, icon_state, icon_state, I)) - update_icon() + update_appearance() return if(default_pry_open(I)) return @@ -96,7 +97,7 @@ interrogating = TRUE START_PROCESSING(SSobj, src) start_time = world.time - update_icon() + update_appearance() timerid = addtimer(CALLBACK(src, .proc/finish_interrogation), 450, TIMER_STOPPABLE) /obj/machinery/hypnochair/process() @@ -116,7 +117,7 @@ /obj/machinery/hypnochair/proc/finish_interrogation() interrogating = FALSE STOP_PROCESSING(SSobj, src) - update_icon() + update_appearance() var/temp_trigger = trigger_phrase trigger_phrase = "" //Erase evidence, in case the subject is able to look at the panel afterwards audible_message("[src] pings!") @@ -139,7 +140,7 @@ deltimer(timerid) interrogating = FALSE STOP_PROCESSING(SSobj, src) - update_icon() + update_appearance() if(QDELETED(victim)) victim = null @@ -168,14 +169,8 @@ victim = null /obj/machinery/hypnochair/update_icon_state() - icon_state = initial(icon_state) - if(state_open) - icon_state += "_open" - if(occupant) - if(interrogating) - icon_state += "_active" - else - icon_state += "_occupied" + icon_state = "[base_icon_state][state_open ? "_open" : null][occupant ? "_[interrogating ? "active" : "occupied"]" : null]" + return ..() /obj/machinery/hypnochair/container_resist_act(mob/living/user) user.changeNext_move(CLICK_CD_BREAKOUT) diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm index 0a3b7d562ca7..a610ec5d11b8 100644 --- a/code/game/machinery/igniter.dm +++ b/code/game/machinery/igniter.dm @@ -3,6 +3,7 @@ desc = "It's useful for igniting plasma." icon = 'icons/obj/stationobjs.dmi' icon_state = "igniter0" + base_icon_state = "igniter" plane = FLOOR_PLANE use_power = IDLE_POWER_USE idle_power_usage = 2 @@ -34,7 +35,7 @@ use_power(50) on = !(on) - update_icon() + update_appearance() /obj/machinery/igniter/process() //ugh why is this even in process()? if (src.on && !(machine_stat & NOPOWER)) @@ -48,10 +49,8 @@ icon_state = "igniter[on]" /obj/machinery/igniter/update_icon_state() - if(machine_stat & NOPOWER) - icon_state = "igniter0" - else - icon_state = "igniter[on]" + icon_state = "[base_icon_state][(machine_stat & NOPOWER) ? 0 : on]" + return ..() /obj/machinery/igniter/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) id = "[REF(port)][id]" @@ -63,6 +62,7 @@ desc = "A wall-mounted ignition device." icon = 'icons/obj/stationobjs.dmi' icon_state = "migniter" + base_icon_state = "migniter" resistance_flags = FIRE_PROOF var/id = null var/disable = 0 @@ -84,11 +84,10 @@ /obj/machinery/sparker/update_icon_state() if(disable) - icon_state = "[initial(icon_state)]-d" - else if(powered()) - icon_state = "[initial(icon_state)]" - else - icon_state = "[initial(icon_state)]-p" + icon_state = "[base_icon_state]-d" + return ..() + icon_state = "[base_icon_state][powered() ? null : "-p"]" + return ..() /obj/machinery/sparker/powered() if(!disable) @@ -103,7 +102,7 @@ user.visible_message("[user] disables \the [src]!", "You disable the connection to \the [src].") if (!src.disable) user.visible_message("[user] reconnects \the [src]!", "You fix the connection to \the [src].") - update_icon() + update_appearance() else return ..() diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index 0439ad3a00de..67f867e2b948 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -6,6 +6,7 @@ desc = "An IV drip with an advanced infusion pump that can both drain blood into and inject liquids from attached containers. Blood packs are processed at an accelerated rate. Alt-Click to change the transfer rate." icon = 'icons/obj/iv_drip.dmi' icon_state = "iv_drip" + base_icon_state = "iv_drip" anchored = FALSE mouse_drag_pointer = MOUSE_ACTIVE_POINTER var/mob/living/carbon/attached @@ -19,7 +20,7 @@ /obj/machinery/iv_drip/Initialize(mapload) . = ..() - update_icon() + update_appearance() /obj/machinery/iv_drip/Destroy() attached = null @@ -28,15 +29,10 @@ /obj/machinery/iv_drip/update_icon_state() if(attached) - if(mode) - icon_state = "injecting" - else - icon_state = "donating" + icon_state = "[base_icon_state]_[mode ? "injecting" : "donating"]" else - if(mode) - icon_state = "injectidle" - else - icon_state = "donateidle" + icon_state = "[base_icon_state]_[mode ? "injecting" : "donating"]" + return ..() /obj/machinery/iv_drip/update_overlays() . = ..() @@ -77,7 +73,7 @@ if(attached) visible_message("[attached] is detached from [src].") attached = null - update_icon() + update_appearance() return if(!target.has_dna()) @@ -91,7 +87,7 @@ add_fingerprint(usr) attached = target START_PROCESSING(SSmachines, src) - update_icon() + update_appearance() else to_chat(usr, "There's nothing attached to the IV drip!") @@ -107,7 +103,7 @@ to_chat(user, "You attach [W] to [src].") user.log_message("attached a [W] to [src] at [AREACOORD(src)] containing ([beaker.reagents.log_list()])", LOG_ATTACK) add_fingerprint(user) - update_icon() + update_appearance() return else return ..() @@ -125,7 +121,7 @@ to_chat(attached, "The IV drip needle is ripped out of you!") attached.apply_damage(3, BRUTE, pick(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM)) attached = null - update_icon() + update_appearance() return PROCESS_KILL if(beaker) @@ -139,7 +135,7 @@ // speed up transfer on blood packs transfer_amount *= 2 beaker.reagents.trans_to(attached, transfer_amount, method = INJECT, show_message = FALSE) //make reagents reacts, but don't spam messages - update_icon() + update_appearance() // Take blood else @@ -156,7 +152,7 @@ visible_message("[src] beeps loudly.") playsound(loc, 'sound/machines/twobeep_high.ogg', 50, TRUE) attached.transfer_blood_to(beaker, amount) - update_icon() + update_appearance() /obj/machinery/iv_drip/attack_hand(mob/user) . = ..() @@ -167,7 +163,7 @@ if(attached) visible_message("[attached] is detached from [src].") attached = null - update_icon() + update_appearance() return else if(beaker) eject_beaker(user) @@ -198,7 +194,7 @@ if(beaker) beaker.forceMove(drop_location()) beaker = null - update_icon() + update_appearance() /obj/machinery/iv_drip/verb/toggle_mode() set category = "Object" @@ -213,7 +209,7 @@ return mode = !mode to_chat(usr, "The IV drip is now [mode ? "injecting" : "taking blood"].") - update_icon() + update_appearance() /obj/machinery/iv_drip/examine(mob/user) . = ..() @@ -237,6 +233,7 @@ name = "saline drip" desc = "An all-you-can-drip saline canister designed to supply a hospital without running out, with a scary looking pump rigged to inject saline into containers, but filling people directly might be a bad idea." icon_state = "saline" + base_icon_state = "saline" density = TRUE /obj/machinery/iv_drip/saline/Initialize(mapload) diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index 2651ad237183..1d30d35ce561 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -3,6 +3,7 @@ name = "light switch" icon = 'icons/obj/power.dmi' icon_state = "light1" + base_icon_state = "light" desc = "Make dark." power_channel = AREA_USAGE_LIGHT /// Set this to a string, path, or area instance to control that area @@ -29,20 +30,23 @@ if(!name) name = "light switch ([area.name])" - update_icon() + update_appearance() + +/obj/machinery/light_switch/update_appearance(updates=ALL) + . = ..() + luminosity = (machine_stat & NOPOWER) ? 0 : 1 /obj/machinery/light_switch/update_icon_state() - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) - luminosity = 0 if(machine_stat & NOPOWER) - icon_state = "light-p" - else - luminosity = 1 - SSvis_overlays.add_vis_overlay(src, icon, "light-glow", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) - if(area.lightswitch) - icon_state = "light1" - else - icon_state = "light0" + icon_state = "[base_icon_state]-p" + return ..() + icon_state = "[base_icon_state][area.lightswitch ? 1 : 0]" + return ..() + +/obj/machinery/light_switch/update_overlays() + . = ..() + if(!(machine_stat & NOPOWER)) + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]-glow", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) /obj/machinery/light_switch/examine(mob/user) . = ..() @@ -53,10 +57,10 @@ area.lightswitch = !area.lightswitch play_click_sound("button") - area.update_icon() + area.update_appearance() for(var/obj/machinery/light_switch/L in area) - L.update_icon() + L.update_appearance() area.power_change() diff --git a/code/game/machinery/medical_kiosk.dm b/code/game/machinery/medical_kiosk.dm index 95d6de9c0d0d..79fb5e83bdf1 100644 --- a/code/game/machinery/medical_kiosk.dm +++ b/code/game/machinery/medical_kiosk.dm @@ -1,12 +1,21 @@ //The Medical Kiosk is designed to act as a low access alernative to a medical analyzer, and doesn't require breaking into medical. Self Diagnose at your heart's content! //For a fee that is. Comes in 4 flavors of medical scan. +/// Shows if the machine is being used for a general scan. +#define KIOSK_SCANNING_GENERAL (1<<0) +/// Shows if the machine is being used for a disease scan. +#define KIOSK_SCANNING_SYMPTOMS (1<<1) +/// Shows if the machine is being used for a radiation/brain trauma scan. +#define KIOSK_SCANNING_NEURORAD (1<<2) +/// Shows if the machine is being used for a reagent scan. +#define KIOSK_SCANNING_REAGENTS (1<<3) /obj/machinery/medical_kiosk name = "medical kiosk" desc = "A freestanding medical kiosk, which can provide a wide range of medical analysis for diagnosis." icon = 'icons/obj/machines/medical_kiosk.dmi' icon_state = "kiosk" + base_icon_state = "kiosk" layer = ABOVE_MOB_LAYER density = TRUE circuit = /obj/item/circuitboard/machine/medical_kiosk @@ -15,10 +24,10 @@ var/active_price = 15 //Change by using a multitool on the board. var/pandemonium = FALSE //AKA: Emag mode. - var/scan_active_1 = FALSE //Shows if the machine is being used for a general scan. - var/scan_active_2 = FALSE //as above, symptom scan - var/scan_active_3 = FALSE //as above, radiological scan - var/scan_active_4 = FALSE //as above, chemical/hallucinations. + /// Shows whether the kiosk is being used to scan someone and what it's being used for. + var/scan_active = NONE + + /// Do we have someone paying to use this? var/paying_customer = FALSE //Ticked yes if passing inuse() var/datum/bank_account/account //payer's account. @@ -51,23 +60,25 @@ D.adjust_money(active_price) use_power(20) paying_customer = TRUE - icon_state = "kiosk_active" + icon_state = "[base_icon_state]_active" say("Thank you for your patronage!") RefreshParts() return /obj/machinery/medical_kiosk/proc/clearScans() //Called it enough times to be it's own proc - scan_active_1 = FALSE - scan_active_2 = FALSE - scan_active_3 = FALSE - scan_active_4 = FALSE + scan_active = NONE + update_appearance() return /obj/machinery/medical_kiosk/update_icon_state() - if(is_operational) - icon_state = "kiosk_off" - else - icon_state = "kiosk" + if(panel_open) + icon_state = "[base_icon_state]_open" + return ..() + if(!is_operational) + icon_state = "[base_icon_state]_off" + return ..() + icon_state = "[base_icon_state][scan_active ? "active" : null]" + return ..() /obj/machinery/medical_kiosk/wrench_act(mob/living/user, obj/item/I) //Allows for wrenching/unwrenching the machine. ..() @@ -81,7 +92,7 @@ return /obj/machinery/medical_kiosk/attackby(obj/item/O, mob/user, params) - if(default_deconstruction_screwdriver(user, "kiosk_open", "kiosk", O)) + if(default_deconstruction_screwdriver(user, "[base_icon_state]_open", "[base_icon_state]_off", O)) return else if(default_deconstruction_crowbar(O)) return @@ -166,7 +177,7 @@ if(!ui) ui = new(user, src, "MedicalKiosk", name) ui.open() - icon_state = "kiosk_off" + icon_state = "[base_icon_state]_active" RefreshParts() H = user C = H.get_idcard(TRUE) @@ -314,10 +325,10 @@ data["addict_list"] = addict_list data["hallucinating_status"] = hallucination_status - data["active_status_1"] = scan_active_1 // General Scan Check - data["active_status_2"] = scan_active_2 // Symptom Scan Check - data["active_status_3"] = scan_active_3 // Radio-Neuro Scan Check - data["active_status_4"] = scan_active_4 // Radio-Neuro Scan Check + data["active_status_1"] = scan_active & KIOSK_SCANNING_GENERAL // General Scan Check + data["active_status_2"] = scan_active & KIOSK_SCANNING_SYMPTOMS // Symptom Scan Check + data["active_status_3"] = scan_active & KIOSK_SCANNING_NEURORAD // Radio-Neuro Scan Check + data["active_status_4"] = scan_active & KIOSK_SCANNING_REAGENTS // Reagents/hallucination Scan Check return data /obj/machinery/medical_kiosk/ui_act(action,active) @@ -327,24 +338,28 @@ switch(action) if("beginScan_1") - inuse() + if(!(scan_active & KIOSK_SCANNING_GENERAL)) + inuse() if(paying_customer == TRUE) - scan_active_1 = TRUE + scan_active |= KIOSK_SCANNING_GENERAL paying_customer = FALSE if("beginScan_2") - inuse() + if(!(scan_active & KIOSK_SCANNING_SYMPTOMS)) + inuse() if(paying_customer == TRUE) - scan_active_2 = TRUE + scan_active |= KIOSK_SCANNING_SYMPTOMS paying_customer = FALSE if("beginScan_3") - inuse() + if(!(scan_active & KIOSK_SCANNING_NEURORAD)) + inuse() if(paying_customer == TRUE) - scan_active_3 = TRUE + scan_active |= KIOSK_SCANNING_NEURORAD paying_customer = FALSE if("beginScan_4") - inuse() + if(!(scan_active & KIOSK_SCANNING_REAGENTS)) + inuse() if(paying_customer == TRUE) - scan_active_4 = TRUE + scan_active |= KIOSK_SCANNING_REAGENTS paying_customer = FALSE if("clearTarget") altPatient = null diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index f9b291a9ed8a..1f97013e1262 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -5,6 +5,7 @@ icon = 'icons/obj/objects.dmi' icon_state = "navbeacon0-f" + base_icon_state = "navbeacon" name = "navigation beacon" desc = "A radio beacon used for bot navigation and crew wayfinding." plane = FLOOR_PLANE @@ -89,7 +90,8 @@ // update the icon_state /obj/machinery/navbeacon/update_icon_state() - icon_state = "navbeacon[open]" + icon_state = "[base_icon_state][open]" + return ..() /obj/machinery/navbeacon/attackby(obj/item/I, mob/user, params) var/turf/T = loc @@ -101,7 +103,7 @@ user.visible_message("[user] [open ? "opens" : "closes"] the beacon's cover.", "You [open ? "open" : "close"] the beacon's cover.") - update_icon() + update_appearance() else if (istype(I, /obj/item/card/id)||istype(I, /obj/item/pda)) if(open) diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index 00ad26295ca5..2711ee9ee61a 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -150,7 +150,7 @@ GLOBAL_LIST_EMPTY(allCasters) if(newMessage) for(var/obj/machinery/newscaster/N in GLOB.allCasters) N.newsAlert() - N.update_icon() + N.update_appearance() /datum/newscaster/feed_network/proc/deleteWanted() wanted_issue.active = 0 @@ -159,7 +159,7 @@ GLOBAL_LIST_EMPTY(allCasters) wanted_issue.scannedUser = null wanted_issue.img = null for(var/obj/machinery/newscaster/NEWSCASTER in GLOB.allCasters) - NEWSCASTER.update_icon() + NEWSCASTER.update_appearance() /datum/newscaster/feed_network/proc/save_photo(icon/photo) var/photo_file = copytext_char(md5("\icon[photo]"), 1, 6) @@ -185,6 +185,7 @@ GLOBAL_LIST_EMPTY(allCasters) desc = "A standard Nanotrasen brand newsfeed handler. All the news you absolutely have no use for, in one place!" icon = 'icons/obj/terminals.dmi' icon_state = "newscaster" + base_icon_state = "newscaster" verb_say = "beeps" verb_ask = "beeps" verb_exclaim = "beeps" @@ -230,7 +231,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/newscaster/security_unit, 30) GLOB.allCasters += src unit_no = GLOB.allCasters.len - update_icon() + update_appearance() /obj/machinery/newscaster/Destroy() GLOB.allCasters -= src @@ -242,26 +243,26 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/newscaster/security_unit, 30) . = ..() SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) if(machine_stat & BROKEN) - SSvis_overlays.add_vis_overlay(src, icon, "newscaster_broken", layer, plane, dir) + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]_broken", layer, plane, dir) return if(machine_stat & NOPOWER) return if(GLOB.news_network.wanted_issue.active) - SSvis_overlays.add_vis_overlay(src, icon, "newscaster_wanted", layer, plane, dir) - SSvis_overlays.add_vis_overlay(src, icon, "newscaster_wanted", layer, EMISSIVE_PLANE, dir) + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]_wanted", layer, plane, dir) + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]_wanted", layer, EMISSIVE_PLANE, dir) else if(alert) - SSvis_overlays.add_vis_overlay(src, icon, "newscaster_alert", layer, plane, dir) - SSvis_overlays.add_vis_overlay(src, icon, "newscaster_alert", layer, EMISSIVE_PLANE, dir) + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]_alert", layer, plane, dir) + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]_alert", layer, EMISSIVE_PLANE, dir) else - SSvis_overlays.add_vis_overlay(src, icon, "newscaster_normal", layer, plane, dir) - SSvis_overlays.add_vis_overlay(src, icon, "newscaster_normal", layer, EMISSIVE_PLANE, dir) + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]_normal", layer, plane, dir) + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]_normal", layer, EMISSIVE_PLANE, dir) /obj/machinery/newscaster/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir) . = ..() - update_icon() + update_appearance() /obj/machinery/newscaster/ui_interact(mob/user) . = ..() @@ -743,7 +744,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/newscaster/security_unit, 30) to_chat(user, "You repair [src].") obj_integrity = max_integrity set_machine_stat(machine_stat & ~BROKEN) - update_icon() + update_appearance() else to_chat(user, "[src] does not need repairs.") else @@ -847,13 +848,13 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/newscaster/security_unit, 30) /obj/machinery/newscaster/proc/remove_alert() alert = FALSE - update_icon() + update_appearance() /obj/machinery/newscaster/proc/newsAlert(channel) if(channel) say("Breaking news from [channel]!") alert = TRUE - update_icon() + update_appearance() addtimer(CALLBACK(src,.proc/remove_alert),alert_delay,TIMER_UNIQUE|TIMER_OVERRIDE) playsound(loc, 'sound/machines/twobeep_high.ogg', 75, TRUE) else diff --git a/code/game/machinery/pipe/pipe_dispenser.dm b/code/game/machinery/pipe/pipe_dispenser.dm index af3813f874fc..0772e483a536 100644 --- a/code/game/machinery/pipe/pipe_dispenser.dm +++ b/code/game/machinery/pipe/pipe_dispenser.dm @@ -158,7 +158,7 @@ if(href_list["dir"]) C.setDir(text2num(href_list["dir"])) C.add_fingerprint(usr) - C.update_icon() + C.update_appearance() wait = world.time + 15 return diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index bc07e19852c4..64b7fb47edd0 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -106,7 +106,7 @@ DEFINE_BITFIELD(turret_flags, list( . = ..() if(!base) base = src - update_icon() + update_appearance() //Sets up a spark system spark_system = new /datum/effect_system/spark_spread spark_system.set_up(5, 0, src) @@ -144,21 +144,22 @@ DEFINE_BITFIELD(turret_flags, list( /obj/machinery/porta_turret/update_icon_state() if(!anchored) icon_state = "turretCover" - return + return ..() if(machine_stat & BROKEN) icon_state = "[base_icon_state]_broken" - else - if(powered()) - if(on && raised) - switch(mode) - if(TURRET_STUN) - icon_state = "[base_icon_state]_stun" - if(TURRET_LETHAL) - icon_state = "[base_icon_state]_lethal" - else - icon_state = "[base_icon_state]_off" - else - icon_state = "[base_icon_state]_unpowered" + return ..() + if(!powered()) + icon_state = "[base_icon_state]_unpowered" + return ..() + if(!on || !raised) + icon_state = "[base_icon_state]_off" + return ..() + switch(mode) + if(TURRET_STUN) + icon_state = "[base_icon_state]_stun" + if(TURRET_LETHAL) + icon_state = "[base_icon_state]_lethal" + return ..() /obj/machinery/porta_turret/proc/setup(obj/item/gun/turret_gun) if(stored_gun) @@ -185,7 +186,7 @@ DEFINE_BITFIELD(turret_flags, list( if(gun_properties["reqpower"]) reqpower = gun_properties["reqpower"] - update_icon() + update_appearance() return gun_properties /obj/machinery/porta_turret/Destroy() @@ -278,7 +279,7 @@ DEFINE_BITFIELD(turret_flags, list( /obj/machinery/porta_turret/power_change() . = ..() if(!anchored || (machine_stat & BROKEN) || !powered()) - update_icon() + update_appearance() remove_control() check_should_process() @@ -313,7 +314,7 @@ DEFINE_BITFIELD(turret_flags, list( if(obj_integrity > (max_integrity * integrity_failure) && BROKEN) obj_integrity = max_integrity set_machine_stat(machine_stat & ~BROKEN) - update_icon() + update_appearance() check_should_process() else to_chat(user, "[src] is already in good condition!") @@ -328,7 +329,7 @@ DEFINE_BITFIELD(turret_flags, list( if(!anchored && !isinspace()) set_anchored(TRUE) invisibility = INVISIBILITY_MAXIMUM - update_icon() + update_appearance() to_chat(user, "You secure the exterior bolts on the turret.") if(has_cover) cover = new /obj/machinery/porta_turret_cover(loc) //create a new turret. While this is handled in process(), this is to workaround a bug where the turret becomes invisible for a split second @@ -340,21 +341,23 @@ DEFINE_BITFIELD(turret_flags, list( invisibility = 0 qdel(cover) //deletes the cover, and the turret instance itself becomes its own cover. - else if(I.GetID()) + if(I.GetID()) //Behavior lock/unlock mangement if(allowed(user)) locked = !locked - to_chat(user, "Controls are now [locked ? "locked" : "unlocked"].") + to_chat(user, "Controls are now [locked ? "locked" : "unlocked"].") else to_chat(user, "Access denied.") - else if(I.tool_behaviour == TOOL_MULTITOOL && !locked) + return + + if(I.tool_behaviour == TOOL_MULTITOOL && !locked) if(!multitool_check_buffer(user, I)) return var/obj/item/multitool/M = I M.buffer = src to_chat(user, "You add [src] to multitool buffer.") - else - return ..() + return + return ..() /obj/machinery/porta_turret/emag_act(mob/user) if(obj_flags & EMAGGED) @@ -364,7 +367,7 @@ DEFINE_BITFIELD(turret_flags, list( obj_flags |= EMAGGED controllock = TRUE toggle_on(FALSE) //turns off the turret temporarily - update_icon() + update_appearance() //6 seconds for the traitor to gtfo of the area before the turret decides to ruin his shit addtimer(CALLBACK(src, .proc/toggle_on, TRUE), 6 SECONDS) //turns it back on. The cover popUp() popDown() are automatically called in process(), no need to define it here @@ -530,7 +533,7 @@ DEFINE_BITFIELD(turret_flags, list( cover.icon_state = "turretCover" raised = 0 invisibility = 2 - update_icon() + update_appearance() /obj/machinery/porta_turret/proc/assess_perp(mob/living/carbon/human/perp) var/threatcount = 0 //the integer returned @@ -613,7 +616,7 @@ DEFINE_BITFIELD(turret_flags, list( T = closer break - update_icon() + update_appearance() var/obj/projectile/A //any emagged turrets drains 2x power and uses a different projectile? if(mode == TURRET_STUN) @@ -845,6 +848,7 @@ DEFINE_BITFIELD(turret_flags, list( desc = "Used to control a room's automated defenses." icon = 'icons/obj/machines/turret_control.dmi' icon_state = "control_standby" + base_icon_state = "control" density = FALSE req_access = list(ACCESS_AI_UPLOAD) resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF @@ -1000,18 +1004,17 @@ DEFINE_BITFIELD(turret_flags, list( /obj/machinery/turretid/proc/updateTurrets() for (var/obj/machinery/porta_turret/aTurret in turrets) aTurret.setState(enabled, lethal, shoot_cyborgs) - update_icon() + update_appearance() /obj/machinery/turretid/update_icon_state() if(machine_stat & NOPOWER) - icon_state = "control_off" - else if (enabled) - if (lethal) - icon_state = "control_kill" - else - icon_state = "control_stun" - else - icon_state = "control_standby" + icon_state = "[base_icon_state]_off" + return ..() + if (enabled) + icon_state = "[base_icon_state]_[lethal ? "kill" : "stun"]" + return ..() + icon_state = "[base_icon_state]_standby" + return ..() /obj/machinery/turretid/lethal lethal = TRUE diff --git a/code/game/machinery/porta_turret/portable_turret_cover.dm b/code/game/machinery/porta_turret/portable_turret_cover.dm index 9508f0158db3..a1da4cbf6463 100644 --- a/code/game/machinery/porta_turret/portable_turret_cover.dm +++ b/code/game/machinery/porta_turret/portable_turret_cover.dm @@ -44,28 +44,30 @@ parent_turret.set_anchored(TRUE) to_chat(user, "You secure the exterior bolts on the turret.") parent_turret.invisibility = 0 - parent_turret.update_icon() + parent_turret.update_appearance() else parent_turret.set_anchored(FALSE) to_chat(user, "You unsecure the exterior bolts on the turret.") parent_turret.invisibility = INVISIBILITY_MAXIMUM - parent_turret.update_icon() + parent_turret.update_appearance() qdel(src) - - else if(I.GetID()) + return + if(I.GetID()) if(parent_turret.allowed(user)) parent_turret.locked = !parent_turret.locked to_chat(user, "Controls are now [parent_turret.locked ? "locked" : "unlocked"].") else to_chat(user, "Access denied.") - else if(I.tool_behaviour == TOOL_MULTITOOL && !parent_turret.locked) + return + + if(I.tool_behaviour == TOOL_MULTITOOL && !parent_turret.locked) if(!multitool_check_buffer(user, I)) return var/obj/item/multitool/M = I M.buffer = parent_turret to_chat(user, "You add [parent_turret] to multitool buffer.") - else - return ..() + return + return ..() /obj/machinery/porta_turret_cover/attacked_by(obj/item/I, mob/user) parent_turret.attacked_by(I, user) diff --git a/code/game/machinery/prisonlabor.dm b/code/game/machinery/prisonlabor.dm index e8af9185552a..6fe329ed4a71 100644 --- a/code/game/machinery/prisonlabor.dm +++ b/code/game/machinery/prisonlabor.dm @@ -9,17 +9,19 @@ var/obj/item/stack/license_plates/empty/current_plate var/pressing = FALSE -/obj/machinery/plate_press/update_icon() +/obj/machinery/plate_press/update_icon_state() . = ..() if(!is_operational) icon_state = "offline" - else if(pressing) + return ..() + if(pressing) icon_state = "loop" - else if(current_plate) + return ..() + if(current_plate) icon_state = "online_loaded" - else - icon_state = "online" - + return ..() + icon_state = "online" + return ..() /obj/machinery/plate_press/Destroy() QDEL_NULL(current_plate) . = ..() @@ -35,7 +37,7 @@ var/obj/item/stack/license_plates/empty/plate = I plate.use(1) current_plate = new plate.type(src, 1) //Spawn a new single sheet in the machine - update_icon() + update_appearance() else return ..() @@ -48,12 +50,12 @@ /obj/machinery/plate_press/proc/work_press(mob/living/user) pressing = TRUE - update_icon() + update_appearance() to_chat(user, "You start pressing a new license plate!") if(!do_after(user, 40, target = src)) pressing = FALSE - update_icon() + update_appearance() return FALSE use_power(100) @@ -61,6 +63,6 @@ pressing = FALSE QDEL_NULL(current_plate) - update_icon() + update_appearance() new /obj/item/stack/license_plates/filled(drop_location(), 1) diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index a23e480f6ad4..3ca96ae5dcba 100644 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -2,6 +2,7 @@ name = "recharger" icon = 'icons/obj/stationobjs.dmi' icon_state = "recharger" + base_icon_state = "recharger" desc = "A charging dock for energy based weaponry." use_power = IDLE_POWER_USE idle_power_usage = 4 @@ -48,11 +49,11 @@ START_PROCESSING(SSmachines, src) use_power = ACTIVE_POWER_USE using_power = TRUE - update_icon() + update_appearance() else use_power = IDLE_POWER_USE using_power = FALSE - update_icon() + update_appearance() /obj/machinery/recharger/attackby(obj/item/G, mob/user, params) if(G.tool_behaviour == TOOL_WRENCH) @@ -109,14 +110,14 @@ add_fingerprint(user) if(charging) - charging.update_icon() + charging.update_appearance() charging.forceMove(drop_location()) user.put_in_hands(charging) setCharging(null) /obj/machinery/recharger/attack_tk(mob/user) if(charging) - charging.update_icon() + charging.update_appearance() charging.forceMove(drop_location()) setCharging(null) @@ -132,7 +133,7 @@ C.give(C.chargerate * recharge_coeff) use_power(250 * recharge_coeff) using_power = TRUE - update_icon() + update_appearance() if(istype(charging, /obj/item/ammo_box/magazine/recharge)) var/obj/item/ammo_box/magazine/recharge/R = charging @@ -140,7 +141,7 @@ R.stored_ammo += new R.ammo_type(R) use_power(200 * recharge_coeff) using_power = TRUE - update_icon() + update_appearance() return else return PROCESS_KILL @@ -160,21 +161,28 @@ if(B.cell) B.cell.charge = 0 + +/obj/machinery/recharger/update_appearance(updates) + . = ..() + if((machine_stat & (NOPOWER|BROKEN)) || panel_open || !anchored) + luminosity = 0 + return + luminosity = 1 + /obj/machinery/recharger/update_overlays() . = ..() - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) - luminosity = 0 if(machine_stat & (NOPOWER|BROKEN) || !anchored || panel_open) return luminosity = 1 - if (charging) - if(using_power) - SSvis_overlays.add_vis_overlay(src, icon, "recharger-charging", layer, plane, dir, alpha) - SSvis_overlays.add_vis_overlay(src, icon, "recharger-charging", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) - else - SSvis_overlays.add_vis_overlay(src, icon, "recharger-full", layer, plane, dir, alpha) - SSvis_overlays.add_vis_overlay(src, icon, "recharger-full", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) - else - SSvis_overlays.add_vis_overlay(src, icon, "recharger-empty", layer, plane, dir, alpha) - SSvis_overlays.add_vis_overlay(src, icon, "recharger-empty", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) + if(!charging) + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]-empty", layer, plane, dir, alpha) + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]-empty", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) + return + if(using_power) + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]-charging", layer, plane, dir, alpha) + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]-charging", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) + return + + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]-full", layer, plane, dir, alpha) + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]-full", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index 8cdbcb59b3c9..7039b015e673 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -18,7 +18,7 @@ /obj/machinery/recharge_station/Initialize() . = ..() - update_icon() + update_appearance() if(is_operational) begin_processing() @@ -99,13 +99,11 @@ add_fingerprint(occupant) /obj/machinery/recharge_station/update_icon_state() - if(is_operational) - if(state_open) - icon_state = "borgcharger0" - else - icon_state = (occupant ? "borgcharger1" : "borgcharger2") - else - icon_state = (state_open ? "borgcharger-u0" : "borgcharger-u1") + if(!is_operational) + icon_state = "borgcharger-u[state_open ? 0 : 1]" + return ..() + icon_state = "borgcharger[state_open ? 0 : (occupant ? 1 : 2)]" + return ..() /obj/machinery/recharge_station/proc/process_occupant() if(!occupant) diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index 1d002076874e..b602624eb7e6 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -21,7 +21,7 @@ AddComponent(/datum/component/butchering/recycler, 1, amount_produced,amount_produced/5) AddComponent(/datum/component/material_container, list(/datum/material/iron, /datum/material/glass, /datum/material/silver, /datum/material/plasma, /datum/material/gold, /datum/material/diamond, /datum/material/plastic, /datum/material/uranium, /datum/material/bananium, /datum/material/titanium, /datum/material/bluespace), INFINITY, FALSE, null, null, null, TRUE) . = ..() - update_icon() + update_appearance() req_one_access = get_all_accesses() + get_all_centcom_access() var/static/list/loc_connections = list( @@ -72,16 +72,16 @@ obj_flags |= EMAGGED if(safety_mode) safety_mode = FALSE - update_icon() + update_appearance() playsound(src, "sparks", 75, TRUE, SILENCED_SOUND_EXTRARANGE) to_chat(user, "You use the cryptographic sequencer on [src].") /obj/machinery/recycler/update_icon_state() - ..() var/is_powered = !(machine_stat & (BROKEN|NOPOWER)) if(safety_mode) is_powered = FALSE icon_state = icon_name + "[is_powered]" + "[(blood ? "bld" : "")]" // add the blood tag at the end + return ..() /obj/machinery/recycler/CanAllowThrough(atom/movable/AM) . = ..() @@ -166,13 +166,13 @@ /obj/machinery/recycler/proc/emergency_stop() playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE) safety_mode = TRUE - update_icon() + update_appearance() addtimer(CALLBACK(src, .proc/reboot), SAFETY_COOLDOWN) /obj/machinery/recycler/proc/reboot() playsound(src, 'sound/machines/ping.ogg', 50, FALSE) safety_mode = FALSE - update_icon() + update_appearance() /obj/machinery/recycler/proc/crush_living(mob/living/L) @@ -190,7 +190,7 @@ if(!blood && !issilicon(L)) blood = TRUE - update_icon() + update_appearance() // Instantly lie down, also go unconscious from the pain, before you die. L.Unconscious(100) diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm index b05199508e2f..3a03453a2ce3 100644 --- a/code/game/machinery/requests_console.dm +++ b/code/game/machinery/requests_console.dm @@ -29,6 +29,7 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) desc = "A console intended to send requests between different vessels and settlements in a local region." icon = 'icons/obj/terminals.dmi' icon_state = "req_comp0" + base_icon_state = "req_comp" var/department = "Unknown" //The list of all departments on the station (Determined from this variable on each unit) Set this to the same thing if you want several consoles in one department var/list/messages = list() //List of all messages var/departmentType = 0 //bitflag @@ -77,28 +78,32 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) dir_amount = 8\ ) -/obj/machinery/requests_console/update_icon_state() +/obj/machinery/requests_console/update_appearance(updates=ALL) + . = ..() if(machine_stat & NOPOWER) set_light(0) - else - set_light(1.4,0.7,"#34D352")//green light + return + set_light(1.4,0.7,"#34D352")//green light + +/obj/machinery/requests_console/update_icon_state() if(open) - if(!hackState) - icon_state="req_comp_open" - else - icon_state="req_comp_rewired" - else if(machine_stat & NOPOWER) - if(icon_state != "req_comp_off") - icon_state = "req_comp_off" - else - if(emergency || (newmessagepriority == REQ_EXTREME_MESSAGE_PRIORITY)) - icon_state = "req_comp3" - else if(newmessagepriority == REQ_HIGH_MESSAGE_PRIORITY) - icon_state = "req_comp2" - else if(newmessagepriority == REQ_NORMAL_MESSAGE_PRIORITY) - icon_state = "req_comp1" - else - icon_state = "req_comp0" + icon_state="[base_icon_state]_[hackState ? "rewired" : "open"]" + return ..() + if(machine_stat & NOPOWER) + icon_state = "[base_icon_state]_off" + return ..() + + if(emergency || (newmessagepriority == REQ_EXTREME_MESSAGE_PRIORITY)) + icon_state = "[base_icon_state]3" + return ..() + if(newmessagepriority == REQ_HIGH_MESSAGE_PRIORITY) + icon_state = "[base_icon_state]2" + return ..() + if(newmessagepriority == REQ_NORMAL_MESSAGE_PRIORITY) + icon_state = "[base_icon_state]1" + return ..() + icon_state = "[base_icon_state]0" + return ..() /obj/machinery/requests_console/Initialize() . = ..() @@ -182,10 +187,10 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) for (var/obj/machinery/requests_console/Console in GLOB.allConsoles) if (Console.department == department) Console.newmessagepriority = REQ_NO_NEW_MESSAGE - Console.update_icon() + Console.update_appearance() newmessagepriority = REQ_NO_NEW_MESSAGE - update_icon() + update_appearance() var/messageComposite = "" for(var/msg in messages) // This puts more recent messages at the *top*, where they belong. messageComposite = "
[msg]
" + messageComposite @@ -292,7 +297,7 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) if(radio_freq) Radio.set_frequency(radio_freq) Radio.talk_into(src,"[emergency] emergency in [department]!!",radio_freq) - update_icon() + update_appearance() addtimer(CALLBACK(src, .proc/clear_emergency), 5 MINUTES) if(href_list["send"] && message && to_department && priority) @@ -342,7 +347,7 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) /obj/machinery/requests_console/proc/clear_emergency() emergency = null - update_icon() + update_appearance() //from message_server.dm: Console.createmessage(data["sender"], data["send_dpt"], data["message"], data["verified"], data["stamped"], data["priority"], data["notify_freq"]) /obj/machinery/requests_console/proc/createmessage(source, source_department, message, msgVerified, msgStamped, priority, radio_freq) @@ -365,14 +370,14 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) if(REQ_NORMAL_MESSAGE_PRIORITY) if(newmessagepriority < REQ_NORMAL_MESSAGE_PRIORITY) newmessagepriority = REQ_NORMAL_MESSAGE_PRIORITY - update_icon() + update_appearance() if(REQ_HIGH_MESSAGE_PRIORITY) header = "High Priority
[header]" alert = "PRIORITY Alert from [source][authentic]" if(newmessagepriority < REQ_HIGH_MESSAGE_PRIORITY) newmessagepriority = REQ_HIGH_MESSAGE_PRIORITY - update_icon() + update_appearance() if(REQ_EXTREME_MESSAGE_PRIORITY) header = "!!!Extreme Priority!!!
[header]" @@ -380,7 +385,7 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) silenced = FALSE if(newmessagepriority < REQ_EXTREME_MESSAGE_PRIORITY) newmessagepriority = REQ_EXTREME_MESSAGE_PRIORITY - update_icon() + update_appearance() messages += "[header][sending]" @@ -400,7 +405,7 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) else to_chat(user, "You open the maintenance panel.") open = TRUE - update_icon() + update_appearance() return if(O.tool_behaviour == TOOL_SCREWDRIVER) if(open) @@ -409,7 +414,7 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) to_chat(user, "You modify the wiring.") else to_chat(user, "You reset the wiring.") - update_icon() + update_appearance() else to_chat(user, "You must open the maintenance panel first!") return diff --git a/code/game/machinery/roulette_machine.dm b/code/game/machinery/roulette_machine.dm index 5ce00a0627a0..2cc1dd2dafb3 100644 --- a/code/game/machinery/roulette_machine.dm +++ b/code/game/machinery/roulette_machine.dm @@ -100,7 +100,7 @@ if("ChangeBetType") chosen_bet_type = params["type"] . = TRUE - update_icon() // Not applicable to all objects. + update_appearance() // Not applicable to all objects. ///Handles setting ownership and the betting itself. /obj/machinery/roulette/attackby(obj/item/W, mob/user, params) @@ -183,7 +183,7 @@ my_card.registered_account.transfer_money(player_id.registered_account, bet_amount) playing = TRUE - update_icon() + update_appearance() set_light(0) var/rolled_number = rand(0, 36) @@ -324,14 +324,19 @@ playsound(src, 'sound/machines/buzz-two.ogg', 30, TRUE) return FALSE -/obj/machinery/roulette/update_icon(payout, color, rolled_number, is_winner = FALSE) - cut_overlays() +/obj/machinery/roulette/update_overlays() + . = ..() if(machine_stat & MAINT) return if(playing) - add_overlay("random_numbers") + . += "random_numbers" + +/obj/machinery/roulette/update_icon(updates=ALL, payout, color, rolled_number, is_winner = FALSE) + . = ..() + if(machine_stat & MAINT) + return if(!payout || !color || isnull(rolled_number)) //Don't fall for tricks. return diff --git a/code/game/machinery/sheetifier.dm b/code/game/machinery/sheetifier.dm index 4728050b6bb4..b80cca3864ff 100644 --- a/code/game/machinery/sheetifier.dm +++ b/code/game/machinery/sheetifier.dm @@ -24,13 +24,14 @@ /obj/machinery/sheetifier/update_icon_state() icon_state = "base_machine[busy_processing ? "_processing" : ""]" + return ..() /obj/machinery/sheetifier/proc/CanInsertMaterials() return !busy_processing /obj/machinery/sheetifier/proc/AfterInsertMaterials(item_inserted, id_inserted, amount_inserted) busy_processing = TRUE - update_icon() + update_appearance() var/datum/material/last_inserted_material = id_inserted var/mutable_appearance/processing_overlay = mutable_appearance(icon, "processing") processing_overlay.color = last_inserted_material.color @@ -39,7 +40,7 @@ /obj/machinery/sheetifier/proc/finish_processing() busy_processing = FALSE - update_icon() + update_appearance() var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.retrieve_all() //Returns all as sheets @@ -47,7 +48,7 @@ if(default_unfasten_wrench(user, I)) return if(default_deconstruction_screwdriver(user, I)) - update_icon() + update_appearance() return if(default_deconstruction_crowbar(I)) return diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index f8cebcb08bac..bdb167ee1732 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -93,7 +93,7 @@ /obj/machinery/shieldgen/proc/shields_up() active = TRUE - update_icon() + update_appearance() move_resist = INFINITY for(var/turf/target_tile in range(shield_range, src)) @@ -104,7 +104,7 @@ /obj/machinery/shieldgen/proc/shields_down() active = FALSE move_resist = initial(move_resist) - update_icon() + update_appearance() QDEL_LIST(deployed_shields) /obj/machinery/shieldgen/process() @@ -164,7 +164,7 @@ obj_integrity = max_integrity set_machine_stat(machine_stat & ~BROKEN) to_chat(user, "You repair \the [src].") - update_icon() + update_appearance() else if(W.tool_behaviour == TOOL_WRENCH) if(locked) @@ -204,10 +204,8 @@ to_chat(user, "You short out the access controller.") /obj/machinery/shieldgen/update_icon_state() - if(active) - icon_state = (machine_stat & BROKEN) ? "shieldonbr":"shieldon" - else - icon_state = (machine_stat & BROKEN) ? "shieldoffbr":"shieldoff" + icon_state = "shield[active ? "on" : "off"][(machine_stat & BROKEN) ? "br" : null]" + return ..() #define ACTIVE_SETUPFIELDS 1 #define ACTIVE_HASFIELDS 2 @@ -287,13 +285,14 @@ else for(var/direction in GLOB.cardinals) cleanup_field(direction) - update_icon() + update_appearance() /obj/machinery/power/shieldwallgen/update_icon_state() if(active) icon_state = initial(icon_state) + "_on" else icon_state = initial(icon_state) + return ..() /obj/machinery/power/shieldwallgen/update_overlays() . = ..() @@ -361,7 +360,7 @@ // update_cable_icons_on_turf(T) - Removed because smartwire Revert //WS Begin - Smartwire Revert var/obj/structure/cable/cable = locate(/obj/structure/cable) in turf - cable.update_icon() + cable.update_appearance() //WS End - Smartwire Revert if(. == SUCCESSFUL_UNFASTEN && anchored) connect_to_network() @@ -369,7 +368,7 @@ /obj/machinery/power/shieldwallgen/attackby(obj/item/item, mob/user, params) if(default_deconstruction_screwdriver(user, icon_state, icon_state, item)) - update_icon() + update_appearance() updateUsrDialog() return TRUE diff --git a/code/game/machinery/shuttle/shuttle_engine.dm b/code/game/machinery/shuttle/shuttle_engine.dm index 26bfc846c5d0..ad6695c8b812 100644 --- a/code/game/machinery/shuttle/shuttle_engine.dm +++ b/code/game/machinery/shuttle/shuttle_engine.dm @@ -55,10 +55,13 @@ update_engine() //Calls this so it sets the accurate icon if(panel_open) icon_state = icon_state_open + return ..() else if(thruster_active && enabled && return_fuel()) icon_state = icon_state_closed + return ..() else icon_state = icon_state_off + return ..() /obj/machinery/power/shuttle/engine/Initialize() . = ..() diff --git a/code/game/machinery/slotmachine.dm b/code/game/machinery/slotmachine.dm index 9e5333a7e307..b05b0a2c2a18 100644 --- a/code/game/machinery/slotmachine.dm +++ b/code/game/machinery/slotmachine.dm @@ -19,6 +19,7 @@ desc = "Gambling for the antisocial." icon = 'icons/obj/economy.dmi' icon_state = "slots1" + base_icon_state = "slots" density = TRUE use_power = IDLE_POWER_USE idle_power_usage = 50 @@ -68,16 +69,17 @@ /obj/machinery/computer/slot_machine/update_icon_state() if(machine_stat & NOPOWER) - icon_state = "slots0" - - else if(machine_stat & BROKEN) - icon_state = "slotsb" - - else if(working) - icon_state = "slots2" + icon_state = "[base_icon_state]0" + return ..() + if(machine_stat & BROKEN) + icon_state = "[base_icon_state]b" + return ..() + if(working) + icon_state = "[base_icon_state]2" + return ..() + icon_state = "[base_icon_state]1" + return ..() - else - icon_state = "slots1" /obj/machinery/computer/slot_machine/attackby(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/coin)) @@ -206,7 +208,7 @@ working = TRUE toggle_reel_spin(1) - update_icon() + update_appearance() updateDialog() var/spin_loop = addtimer(CALLBACK(src, .proc/do_spin), 2, TIMER_LOOP|TIMER_STOPPABLE) @@ -223,7 +225,7 @@ working = FALSE deltimer(spin_loop) give_prizes(the_name, user) - update_icon() + update_appearance() updateDialog() /obj/machinery/computer/slot_machine/proc/can_spin(mob/user) diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index 27e1aebf2cab..26ebc727ec70 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -8,6 +8,7 @@ interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN icon = 'icons/obj/atmos.dmi' icon_state = "sheater-off" + base_icon_state = "sheater" name = "space heater" desc = "Made by Space Amish using traditional space techniques, this heater/cooler is guaranteed* not to set the air on fire. Warranty void if used in engines." max_integrity = 250 @@ -33,13 +34,13 @@ /obj/machinery/space_heater/Initialize() . = ..() cell = new(src) - update_icon() + update_appearance() /obj/machinery/space_heater/on_construction() qdel(cell) cell = null panel_open = TRUE - update_icon() + update_appearance() return ..() /obj/machinery/space_heater/on_deconstruction() @@ -59,16 +60,14 @@ . += "The status display reads: Temperature range at [settableTemperatureRange]°C.
Heating power at [heatingPower*0.001]kJ.
Power consumption at [(efficiency*-0.0025)+150]%.
" //100%, 75%, 50%, 25% /obj/machinery/space_heater/update_icon_state() - if(on) - icon_state = "sheater-[mode]" - else - icon_state = "sheater-off" + icon_state = "[base_icon_state]-[on ? mode : "off"]" + return ..() /obj/machinery/space_heater/update_overlays() . = ..() if(panel_open) - . += "sheater-open" + . += "[base_icon_state]-open" /obj/machinery/space_heater/process_atmos() //TODO figure out delta_time if(!on || !is_operational) @@ -81,7 +80,7 @@ if(!istype(L)) if(mode != HEATER_MODE_STANDBY) mode = HEATER_MODE_STANDBY - update_icon() + update_appearance() return var/datum/gas_mixture/env = L.return_air() @@ -94,7 +93,7 @@ if(mode != newMode) mode = newMode - update_icon() + update_appearance() if(mode == HEATER_MODE_STANDBY) return @@ -115,7 +114,7 @@ cell.use(requiredPower / efficiency) else on = FALSE - update_icon() + update_appearance() return PROCESS_KILL /obj/machinery/space_heater/RefreshParts() @@ -164,7 +163,7 @@ else if(I.tool_behaviour == TOOL_SCREWDRIVER) panel_open = !panel_open user.visible_message("\The [user] [panel_open ? "opens" : "closes"] the hatch on \the [src].", "You [panel_open ? "open" : "close"] the hatch on \the [src].") - update_icon() + update_appearance() else if(default_deconstruction_crowbar(I)) return else @@ -211,7 +210,7 @@ on = !on mode = HEATER_MODE_STANDBY usr.visible_message("[usr] switches [on ? "on" : "off"] \the [src].", "You switch [on ? "on" : "off"] \the [src].") - update_icon() + update_appearance() if (on) SSair.start_processing_machine(src) . = TRUE diff --git a/code/game/machinery/stasis.dm b/code/game/machinery/stasis.dm index ec3daa91cd6c..37e079715dcd 100644 --- a/code/game/machinery/stasis.dm +++ b/code/game/machinery/stasis.dm @@ -4,6 +4,7 @@ desc = "A not so comfortable looking bed with some nozzles at the top and bottom. It will keep someone in stasis." icon = 'icons/obj/machines/stasis.dmi' icon_state = "stasis" + base_icon_state = "stasis" density = FALSE can_buckle = TRUE buckle_lying = 90 @@ -54,7 +55,7 @@ "You [stasis_enabled ? "power on" : "shut down"] \the [src].", \ "You hear a nearby machine [stasis_enabled ? "power on" : "shut down"].") play_power_sound() - update_icon() + update_appearance() /obj/machinery/stasis/Exited(atom/movable/AM, atom/newloc) if(AM == occupant) @@ -68,30 +69,32 @@ /obj/machinery/stasis/update_icon_state() if(machine_stat & BROKEN) - icon_state = "stasis_broken" - return + icon_state = "[base_icon_state]_broken" + return ..() if(panel_open || machine_stat & MAINT) - icon_state = "stasis_maintenance" - return - icon_state = "stasis" + icon_state = "[base_icon_state]_maintenance" + return ..() + icon_state = base_icon_state + return ..() /obj/machinery/stasis/update_overlays() . = ..() + if(!mattress_state) + return var/_running = stasis_running() - var/list/overlays_to_remove = managed_vis_overlays - - if(mattress_state) - if(!mattress_on || !managed_vis_overlays) - mattress_on = SSvis_overlays.add_vis_overlay(src, icon, mattress_state, layer, plane, dir, alpha = 0, unique = TRUE) - - if(mattress_on.alpha ? !_running : _running) //check the inverse of _running compared to truthy alpha, to see if they differ - var/new_alpha = _running ? 255 : 0 - var/easing_direction = _running ? EASE_OUT : EASE_IN - animate(mattress_on, alpha = new_alpha, time = 50, easing = CUBIC_EASING|easing_direction) - - overlays_to_remove = managed_vis_overlays - mattress_on + if(!mattress_on) + mattress_on = SSvis_overlays.add_vis_overlay(src, icon, mattress_state, BELOW_OBJ_LAYER, plane, dir, alpha = 0, unique = TRUE) + else + vis_contents += mattress_on + if(managed_vis_overlays) + managed_vis_overlays += mattress_on + else + managed_vis_overlays = list(mattress_on) - SSvis_overlays.remove_vis_overlay(src, overlays_to_remove) + if(mattress_on.alpha ? !_running : _running) //check the inverse of _running compared to truthy alpha, to see if they differ + var/new_alpha = _running ? 255 : 0 + var/easing_direction = _running ? EASE_OUT : EASE_IN + animate(mattress_on, alpha = new_alpha, time = 50, easing = CUBIC_EASING|easing_direction) /obj/machinery/stasis/obj_break(damage_flag) . = ..() @@ -122,13 +125,13 @@ occupant = L if(stasis_running()) chill_out(L) - update_icon() + update_appearance() /obj/machinery/stasis/post_unbuckle_mob(mob/living/L) thaw_them(L) if(L == occupant) occupant = null - update_icon() + update_appearance() /obj/machinery/stasis/process() if(!occupant || !isliving(occupant)) @@ -144,7 +147,7 @@ /obj/machinery/stasis/screwdriver_act(mob/living/user, obj/item/I) . = ..() . |= default_deconstruction_screwdriver(user, "stasis_maintenance", "stasis", I) - update_icon() + update_appearance() /obj/machinery/stasis/crowbar_act(mob/living/user, obj/item/I) . = ..() diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 968bdca67b4a..231e36282bdc 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -189,7 +189,7 @@ mask = new mask_type(src) if(storage_type) storage = new storage_type(src) - update_icon() + update_appearance() /obj/machinery/suit_storage_unit/Destroy() QDEL_NULL(suit) @@ -236,7 +236,7 @@ if(!is_operational && state_open) open_machine() dump_contents() - update_icon() + update_appearance() /obj/machinery/suit_storage_unit/dump_contents() dropContents() @@ -328,12 +328,12 @@ if (item_to_dispense) vars[choice] = null try_put_in_hand(item_to_dispense, user) - update_icon() + update_appearance() else var/obj/item/in_hands = user.get_active_held_item() if (in_hands) attackby(in_hands, user) - update_icon() + update_appearance() interact(user) @@ -402,7 +402,7 @@ uv_cycles-- uv = TRUE locked = TRUE - update_icon() + update_appearance() if(occupant) if(uv_super) mob_occupant.adjustFireLoss(rand(20, 36)) @@ -539,7 +539,7 @@ storage = I visible_message("[user] inserts [I] into [src]", "You load [I] into [src].") - update_icon() + update_appearance() return if(panel_open && is_wire_tool(I)) @@ -547,7 +547,7 @@ return if(!state_open) if(default_deconstruction_screwdriver(user, "[base_icon_state]", "[base_icon_state]", I)) - update_icon() + update_appearance() return if(default_pry_open(I)) dump_contents() @@ -595,4 +595,4 @@ else if(istype(AM, /obj/item) && !storage) AM.forceMove(src) storage = AM - update_icon() + update_appearance() diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index 4e4ab6714e0c..83182bedb942 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -78,7 +78,7 @@ if(active && ((detonation_timer <= world.time) || explode_now)) active = FALSE timer_set = initial(timer_set) - update_icon() + update_appearance() try_detonate(TRUE) /obj/machinery/syndicatebomb/Initialize() @@ -86,7 +86,7 @@ wires = new /datum/wires/syndicatebomb(src) if(payload) payload = new payload(src) - update_icon() + update_appearance() countdown = new(src) end_processing() @@ -102,6 +102,7 @@ /obj/machinery/syndicatebomb/update_icon_state() icon_state = "[initial(icon_state)][active ? "-active" : "-inactive"][open_panel ? "-wires" : ""]" + return ..() /obj/machinery/syndicatebomb/proc/seconds_remaining() if(active) @@ -130,7 +131,7 @@ else if(I.tool_behaviour == TOOL_SCREWDRIVER) open_panel = !open_panel - update_icon() + update_appearance() to_chat(user, "You [open_panel ? "open" : "close"] the wire panel.") else if(is_wire_tool(I) && open_panel) @@ -204,7 +205,7 @@ if(!active) visible_message("[icon2html(src, viewers(loc))] [timer_set] seconds until detonation, please clear the area.") activate() - update_icon() + update_appearance() add_fingerprint(user) if(payload && !istype(payload, /obj/item/bombcore/training)) @@ -304,7 +305,7 @@ holder.delayedbig = FALSE holder.delayedlittle = FALSE holder.explode_now = FALSE - holder.update_icon() + holder.update_appearance() holder.updateDialog() STOP_PROCESSING(SSfastprocess, holder) diff --git a/code/game/machinery/telecomms/machines/message_server.dm b/code/game/machinery/telecomms/machines/message_server.dm index 8f37befee68e..20a5b823a230 100644 --- a/code/game/machinery/telecomms/machines/message_server.dm +++ b/code/game/machinery/telecomms/machines/message_server.dm @@ -27,7 +27,7 @@ user.put_in_hands(stored) stored = null to_chat(user, "You remove the blackbox from [src]. The tapes stop spinning.") - update_icon() + update_appearance() return else to_chat(user, "It seems that the blackbox is missing...") @@ -42,7 +42,7 @@ "You press the device into [src], and it clicks into place. The tapes begin spinning again.") playsound(src, 'sound/machines/click.ogg', 50, TRUE) stored = I - update_icon() + update_appearance() return return ..() @@ -52,12 +52,9 @@ new /obj/effect/decal/cleanable/oil(loc) return ..() -/obj/machinery/blackbox_recorder/update_icon() - . = ..() - if(!stored) - icon_state = "blackbox_b" - else - icon_state = "blackbox" +/obj/machinery/blackbox_recorder/update_icon_state() + icon_state = "blackbox[stored ? null : "_b"]" + return ..() /obj/item/blackbox name = "\proper the blackbox" diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm index 891c19acc607..dec15ed3013b 100644 --- a/code/game/machinery/telecomms/telecomunications.dm +++ b/code/game/machinery/telecomms/telecomunications.dm @@ -111,16 +111,8 @@ GLOBAL_LIST_EMPTY(telecomms_list) /obj/machinery/telecomms/update_icon_state() - if(on) - if(panel_open) - icon_state = "[initial(icon_state)]_o" - else - icon_state = initial(icon_state) - else - if(panel_open) - icon_state = "[initial(icon_state)]_o_off" - else - icon_state = "[initial(icon_state)]_off" + icon_state = "[initial(icon_state)][panel_open ? "_o" : null][on ? null : "_off"]" + return ..() /obj/machinery/telecomms/proc/update_power() @@ -136,7 +128,7 @@ GLOBAL_LIST_EMPTY(telecomms_list) update_power() // Update the icon - update_icon() + update_appearance() if(traffic > 0) traffic -= netspeed diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm index e97df7e7450f..6e0551b25d41 100644 --- a/code/game/machinery/teleporter.dm +++ b/code/game/machinery/teleporter.dm @@ -7,6 +7,7 @@ name = "teleporter hub" desc = "It's the hub of a teleporting machine." icon_state = "tele0" + base_icon_state = "tele" use_power = IDLE_POWER_USE idle_power_usage = 10 active_power_usage = 2000 @@ -57,7 +58,7 @@ if(default_deconstruction_screwdriver(user, "tele-o", "tele0", W)) if(power_station && power_station.engaged) power_station.engaged = 0 //hub with panel open is off, so the station must be informed. - update_icon() + update_appearance() return if(default_deconstruction_crowbar(W)) return @@ -87,12 +88,8 @@ return /obj/machinery/teleport/hub/update_icon_state() - if(panel_open) - icon_state = "tele-o" - else if(is_ready()) - icon_state = "tele1" - else - icon_state = "tele0" + icon_state = "[base_icon_state][panel_open ? "-o" : (is_ready() ? 1 : 0)]" + return ..() /obj/machinery/teleport/hub/proc/is_ready() . = !panel_open && !(machine_stat & (BROKEN|NOPOWER)) && power_station && power_station.engaged && !(power_station.machine_stat & (BROKEN|NOPOWER)) @@ -107,6 +104,7 @@ name = "teleporter station" desc = "The power control station for a bluespace teleporter. Used for toggling power, and can activate a test-fire to prevent malfunctions." icon_state = "controller" + base_icon_state = "controller" use_power = IDLE_POWER_USE idle_power_usage = 10 active_power_usage = 2000 @@ -153,7 +151,7 @@ /obj/machinery/teleport/station/Destroy() if(teleporter_hub) teleporter_hub.power_station = null - teleporter_hub.update_icon() + teleporter_hub.update_appearance() teleporter_hub = null if (teleporter_console) teleporter_console.power_station = null @@ -178,7 +176,7 @@ to_chat(user, "This station can't hold more information, try to use better parts.") return else if(default_deconstruction_screwdriver(user, "controller-o", "controller", W)) - update_icon() + update_appearance() return else if(default_deconstruction_crowbar(W)) @@ -202,20 +200,23 @@ else to_chat(user, "No target detected.") engaged = FALSE - teleporter_hub.update_icon() + teleporter_hub.update_appearance() add_fingerprint(user) /obj/machinery/teleport/station/power_change() . = ..() if(teleporter_hub) - teleporter_hub.update_icon() + teleporter_hub.update_appearance() /obj/machinery/teleport/station/update_icon_state() if(panel_open) - icon_state = "controller-o" - else if(machine_stat & (BROKEN|NOPOWER)) - icon_state = "controller-p" - else if(teleporter_console && teleporter_console.calibrating) - icon_state = "controller-c" - else - icon_state = "controller" + icon_state = "[base_icon_state]-o" + return ..() + if(machine_stat & (BROKEN|NOPOWER)) + icon_state = "[base_icon_state]-p" + return ..() + if(teleporter_console?.calibrating) + icon_state = "[base_icon_state]-c" + return ..() + icon_state = base_icon_state + return ..() diff --git a/code/game/machinery/transformer.dm b/code/game/machinery/transformer.dm index 4b22b6b31e0c..8f49c9758f57 100644 --- a/code/game/machinery/transformer.dm +++ b/code/game/machinery/transformer.dm @@ -39,6 +39,7 @@ icon_state = "separator-AO0" else icon_state = initial(icon_state) + return ..() /obj/machinery/transformer/Bumped(atom/movable/AM) if(cooldown == 1) @@ -66,7 +67,7 @@ /obj/machinery/transformer/process() if(cooldown && (cooldown_timer <= world.time)) cooldown = FALSE - update_icon() + update_appearance() /obj/machinery/transformer/proc/do_transform(mob/living/carbon/human/H) if(machine_stat & (BROKEN|NOPOWER)) @@ -81,7 +82,7 @@ // Activate the cooldown cooldown = 1 cooldown_timer = world.time + cooldown_duration - update_icon() + update_appearance() playsound(src.loc, 'sound/items/welder.ogg', 50, TRUE) H.emote("scream") // It is painful diff --git a/code/game/machinery/washing_machine.dm b/code/game/machinery/washing_machine.dm index be98913086e0..a437c59c9352 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -159,7 +159,7 @@ GLOBAL_LIST_INIT(dye_registry, list( to_chat(user, "[src] must be cleaned up first!") return busy = TRUE - update_icon() + update_appearance() addtimer(CALLBACK(src, .proc/wash_cycle), 200) START_PROCESSING(SSfastprocess, src) @@ -185,7 +185,7 @@ GLOBAL_LIST_INIT(dye_registry, list( . = ..() if(!busy && bloody_mess && (clean_types & CLEAN_TYPE_BLOOD)) bloody_mess = FALSE - update_icon() + update_appearance() . = TRUE /obj/machinery/washing_machine/proc/wash_cycle() @@ -198,7 +198,7 @@ GLOBAL_LIST_INIT(dye_registry, list( if(color_source) qdel(color_source) color_source = null - update_icon() + update_appearance() /obj/item/proc/dye_item(dye_color, dye_key_override) var/dye_key_selector = dye_key_override ? dye_key_override : dying_key @@ -280,11 +280,14 @@ GLOBAL_LIST_INIT(dye_registry, list( /obj/machinery/washing_machine/update_icon_state() if(busy) icon_state = "wm_running_[bloody_mess]" - else if(bloody_mess) + return ..() + if(bloody_mess) icon_state = "wm_[state_open]_blood" - else - var/full = contents.len ? 1 : 0 - icon_state = "wm_[state_open]_[full]" + return ..() + + var/full = contents.len ? 1 : 0 + icon_state = "wm_[state_open]_[full]" + return ..() /obj/machinery/washing_machine/update_overlays() . = ..() @@ -296,7 +299,7 @@ GLOBAL_LIST_INIT(dye_registry, list( return if(default_deconstruction_screwdriver(user, null, null, W)) - update_icon() + update_appearance() return else if(user.a_intent != INTENT_HARM) @@ -317,7 +320,7 @@ GLOBAL_LIST_INIT(dye_registry, list( return TRUE if(W.dye_color) color_source = W - update_icon() + update_appearance() else return ..() @@ -337,14 +340,14 @@ GLOBAL_LIST_INIT(dye_registry, list( if(state_open) if(istype(L, /mob/living/simple_animal/pet)) L.forceMove(src) - update_icon() + update_appearance() return if(!state_open) open_machine() else state_open = FALSE //close the door - update_icon() + update_appearance() /obj/machinery/washing_machine/deconstruct(disassembled = TRUE) new /obj/item/stack/sheet/metal(drop_location(), 2) diff --git a/code/game/mecha/equipment/tools/medical_tools.dm b/code/game/mecha/equipment/tools/medical_tools.dm index 2309818a995a..ee5dd4db846d 100644 --- a/code/game/mecha/equipment/tools/medical_tools.dm +++ b/code/game/mecha/equipment/tools/medical_tools.dm @@ -337,12 +337,12 @@ else if(mechsyringe.loc == trg) mechsyringe.icon_state = initial(mechsyringe.icon_state) mechsyringe.icon = initial(mechsyringe.icon) - mechsyringe.update_icon() + mechsyringe.update_appearance() break else mechsyringe.icon_state = initial(mechsyringe.icon_state) mechsyringe.icon = initial(mechsyringe.icon) - mechsyringe.update_icon() + mechsyringe.update_appearance() break sleep(1) return 1 diff --git a/code/game/mecha/equipment/tools/work_tools.dm b/code/game/mecha/equipment/tools/work_tools.dm index e81a2446def9..fe48f4ead497 100644 --- a/code/game/mecha/equipment/tools/work_tools.dm +++ b/code/game/mecha/equipment/tools/work_tools.dm @@ -470,13 +470,13 @@ var/obj/structure/cable/NC = new(new_turf, "red") NC.d1 = 0 NC.d2 = fdirn - NC.update_icon() + NC.update_appearance() var/datum/powernet/PN if(last_piece && last_piece.d2 != chassis.dir) last_piece.d1 = min(last_piece.d2, chassis.dir) last_piece.d2 = max(last_piece.d2, chassis.dir) - last_piece.update_icon() + last_piece.update_appearance() PN = last_piece.powernet if(!PN) diff --git a/code/game/mecha/mech_bay.dm b/code/game/mecha/mech_bay.dm index 5c752b1e3cc3..ca24240b4f2e 100644 --- a/code/game/mecha/mech_bay.dm +++ b/code/game/mecha/mech_bay.dm @@ -55,17 +55,17 @@ if(!recharging_mech) recharging_mech = locate(/obj/mecha) in recharging_turf if(recharging_mech) - recharge_console.update_icon() + recharge_console.update_appearance() if(recharging_mech && recharging_mech.cell) if(recharging_mech.cell.charge < recharging_mech.cell.maxcharge) var/delta = min(max_charge, recharging_mech.cell.maxcharge - recharging_mech.cell.charge) recharging_mech.give_power(delta) use_power(delta*150) else - recharge_console.update_icon() + recharge_console.update_appearance() if(recharging_mech.loc != recharging_turf) recharging_mech = null - recharge_console.update_icon() + recharge_console.update_appearance() /obj/machinery/mech_bay_recharge_port/attackby(obj/item/I, mob/user, params) @@ -113,7 +113,7 @@ if("reconnect") reconnect() . = TRUE - update_icon() + update_appearance() /obj/machinery/computer/mech_bay_power_console/ui_data(mob/user) var/list/data = list() @@ -148,7 +148,11 @@ /obj/machinery/computer/mech_bay_power_console/update_overlays() . = ..() - if(!recharge_port || !recharge_port.recharging_mech || !recharge_port.recharging_mech.cell || !(recharge_port.recharging_mech.cell.charge < recharge_port.recharging_mech.cell.maxcharge) || machine_stat & (NOPOWER|BROKEN)) + if(machine_stat & (NOPOWER|BROKEN)) + return + if(!recharge_port?.recharging_mech?.cell) + return + if(recharge_port.recharging_mech.cell.charge >= recharge_port.recharging_mech.cell.maxcharge) return . += "recharge_comp_on" diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 35ea91edfa51..62e8f10455a8 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -151,6 +151,8 @@ /obj/mecha/update_icon_state() if(silicon_pilot && silicon_icon_state) icon_state = silicon_icon_state + return ..() + return ..() /obj/mecha/get_cell() return cell @@ -799,7 +801,7 @@ occupant = AI silicon_pilot = TRUE icon_state = initial(icon_state) - update_icon() + update_appearance() playsound(src, 'sound/machines/windowdoor.ogg', 50, TRUE) if(!internal_damage) SEND_SOUND(occupant, sound('sound/mecha/nominal.ogg',volume=50)) @@ -990,7 +992,7 @@ B.remote_control = src B.update_mouse_pointer() icon_state = initial(icon_state) - update_icon() + update_appearance() setDir(dir_in) log_message("[M] moved in as pilot.", LOG_MECHA) if(!internal_damage) @@ -1083,7 +1085,7 @@ L.forceMove(mmi) L.reset_perspective() mmi.set_mecha(null) - mmi.update_icon() + mmi.update_appearance() icon_state = initial(icon_state)+"-open" setDir(dir_in) diff --git a/code/game/mecha/working/ripley.dm b/code/game/mecha/working/ripley.dm index bae9a13afdce..2ef07992eb26 100644 --- a/code/game/mecha/working/ripley.dm +++ b/code/game/mecha/working/ripley.dm @@ -45,11 +45,11 @@ /obj/mecha/working/ripley/go_out() ..() - update_icon() + update_appearance() /obj/mecha/working/ripley/moved_inside(mob/living/carbon/human/H) ..() - update_icon() + update_appearance() /obj/mecha/working/ripley/check_for_internal_damage(list/possible_int_damage,ignore_threshold=null) if (!enclosed) diff --git a/code/game/objects/effects/anomalies/anomalies_melter.dm b/code/game/objects/effects/anomalies/anomalies_melter.dm index 763c1f334610..ad13faf2113a 100644 --- a/code/game/objects/effects/anomalies/anomalies_melter.dm +++ b/code/game/objects/effects/anomalies/anomalies_melter.dm @@ -18,16 +18,16 @@ for(var/X in meltee.get_equipped_items()) var/obj/item/I = X I.acid_act(20, 20) - I.update_icon() + I.update_appearance() for (var/obj/item/melt in range(effectrange, src)) melt.acid_act(20, 10) - melt.update_icon() + melt.update_appearance() /obj/effect/anomaly/melter/Bumped(atom/movable/AM) if(isobj(AM)) var/obj/acid = AM acid.acid_act(100,20) - acid.update_icon() + acid.update_appearance() /obj/effect/anomaly/melter/detonate() @@ -35,10 +35,10 @@ for(var/X in meltee.get_equipped_items()) var/obj/item/I = X I.acid_act(200, 20) - I.update_icon() + I.update_appearance() for(var/obj/item in range(effectrange, src)) item.acid_act(100,20) - item.update_icon() + item.update_appearance() . = ..() diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index b44719ba904e..57c871ed4c00 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -90,7 +90,7 @@ SIGNAL_HANDLER if(iscarbon(AM) && blood_state && bloodiness > 40) SEND_SIGNAL(AM, COMSIG_STEP_ON_BLOOD, src) - update_icon() + update_appearance() /obj/effect/decal/cleanable/wash(clean_types) ..() diff --git a/code/game/objects/effects/decals/cleanable/humans.dm b/code/game/objects/effects/decals/cleanable/humans.dm index 5e4f4978b75a..3dd327dda08c 100644 --- a/code/game/objects/effects/decals/cleanable/humans.dm +++ b/code/game/objects/effects/decals/cleanable/humans.dm @@ -206,7 +206,7 @@ icon_state = "" //All of the footprint visuals come from overlays if(mapload) entered_dirs |= dir //Keep the same appearance as in the map editor - update_icon() + update_appearance() //Rotate all of the footprint directions too /obj/effect/decal/cleanable/blood/footprints/setDir(newdir) @@ -225,23 +225,27 @@ if(old_exited_dirs & Ddir) exited_dirs |= angle2dir_cardinal(dir2angle(Ddir) + ang_change) - update_icon() + update_appearance() return ..() /obj/effect/decal/cleanable/blood/footprints/update_icon() - cut_overlays() + . = ..() + alpha = min(BLOODY_FOOTPRINT_BASE_ALPHA + (255 - BLOODY_FOOTPRINT_BASE_ALPHA) * bloodiness / (BLOOD_ITEM_MAX / 2), 255) +/obj/effect/decal/cleanable/blood/footprints/update_overlays() + . = ..() for(var/Ddir in GLOB.cardinals) if(entered_dirs & Ddir) var/image/bloodstep_overlay = GLOB.bloody_footprints_cache["entered-[blood_state]-[Ddir]"] if(!bloodstep_overlay) GLOB.bloody_footprints_cache["entered-[blood_state]-[Ddir]"] = bloodstep_overlay = image(icon, "[blood_state]1", dir = Ddir) - add_overlay(bloodstep_overlay) + . += bloodstep_overlay + if(exited_dirs & Ddir) var/image/bloodstep_overlay = GLOB.bloody_footprints_cache["exited-[blood_state]-[Ddir]"] if(!bloodstep_overlay) GLOB.bloody_footprints_cache["exited-[blood_state]-[Ddir]"] = bloodstep_overlay = image(icon, "[blood_state]2", dir = Ddir) - add_overlay(bloodstep_overlay) + . += bloodstep_overlay alpha = min(BLOODY_FOOTPRINT_BASE_ALPHA + (255 - BLOODY_FOOTPRINT_BASE_ALPHA) * bloodiness / (BLOOD_ITEM_MAX / 2), 255) diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm index 4259403c2de0..51020d8f60dc 100644 --- a/code/game/objects/effects/effect_system/effects_foam.dm +++ b/code/game/objects/effects/effect_system/effects_foam.dm @@ -321,7 +321,7 @@ for(var/obj/machinery/atmospherics/components/unary/U in O) if(!U.welded) U.welded = TRUE - U.update_icon() + U.update_appearance() U.visible_message("[U] sealed shut!") for(var/mob/living/L in O) L.ExtinguishMob() diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm index e357ac3ea79a..a19ab7781269 100644 --- a/code/game/objects/effects/effect_system/effects_smoke.dm +++ b/code/game/objects/effects/effect_system/effects_smoke.dm @@ -168,7 +168,7 @@ for(var/obj/machinery/atmospherics/components/unary/U in T) if(!isnull(U.welded) && !U.welded) //must be an unwelded vent pump or vent scrubber. U.welded = TRUE - U.update_icon() + U.update_appearance() U.visible_message("[U] is frozen shut!") for(var/mob/living/L in T) L.ExtinguishMob() diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm index cb5b34ec8cca..914b910d9830 100644 --- a/code/game/objects/effects/spawners/bombspawner.dm +++ b/code/game/objects/effects/spawners/bombspawner.dm @@ -35,7 +35,7 @@ V.attached_device = A A.holder = V - V.update_icon() + V.update_appearance() return INITIALIZE_HINT_QDEL diff --git a/code/game/objects/effects/temporary_visuals/miscellaneous.dm b/code/game/objects/effects/temporary_visuals/miscellaneous.dm index 4c3e4397e73f..be1516810a02 100644 --- a/code/game/objects/effects/temporary_visuals/miscellaneous.dm +++ b/code/game/objects/effects/temporary_visuals/miscellaneous.dm @@ -502,22 +502,26 @@ status = rcd_status delay = rcd_delay if (status == RCD_DECONSTRUCT) - addtimer(CALLBACK(src, /atom/.proc/update_icon), 11) + addtimer(CALLBACK(src, /atom/.proc/update_appearance), 1.1 SECONDS) delay -= 11 icon_state = "rcd_end_reverse" else - update_icon() + update_appearance() /obj/effect/constructing_effect/update_icon_state() icon_state = "rcd" - if (delay < 10) + if(delay < 10) icon_state += "_shortest" - else if (delay < 20) + return ..() + if (delay < 20) icon_state += "_shorter" - else if (delay < 37) + return ..() + if (delay < 37) icon_state += "_short" - if (status == RCD_DECONSTRUCT) + return ..() + if(status == RCD_DECONSTRUCT) icon_state += "_reverse" + return ..() /obj/effect/constructing_effect/proc/end_animation() if (status == RCD_DECONSTRUCT) diff --git a/code/game/objects/items/RCD.dm b/code/game/objects/items/RCD.dm index 43d7ab5d8358..b84ccff2b8c9 100644 --- a/code/game/objects/items/RCD.dm +++ b/code/game/objects/items/RCD.dm @@ -101,7 +101,7 @@ RLD qdel(W) else return ..() - update_icon() //ensures that ammo counters (if present) get updated + update_appearance() //ensures that ammo counters (if present) get updated /obj/item/construction/proc/loadwithsheets(obj/item/stack/sheet/S, value, mob/user) var/maxsheets = round((max_matter-matter)/value) //calculate the max number of sheets that will fit in RCD @@ -130,7 +130,7 @@ RLD to_chat(user, no_ammo_message) return FALSE matter -= amount - update_icon() + update_appearance() return TRUE else if(silo_mats.on_hold()) @@ -521,7 +521,7 @@ RLD /obj/item/construction/rcd/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/construction/rcd/borg no_ammo_message = "Insufficient charge." @@ -658,6 +658,7 @@ RLD /obj/item/construction/rld/update_icon_state() icon_state = "rld-[round(matter/matter_divisor)]" + return ..() /obj/item/construction/rld/attack_self(mob/user) ..() diff --git a/code/game/objects/items/RCL.dm b/code/game/objects/items/RCL.dm index b72a01394ff9..18661712b6e4 100644 --- a/code/game/objects/items/RCL.dm +++ b/code/game/objects/items/RCL.dm @@ -64,7 +64,7 @@ loaded.amount += transfer_amount else return - update_icon() + update_appearance() to_chat(user, "You add the cables to [src]. It now contains [loaded.amount].") else if(W.tool_behaviour == TOOL_SCREWDRIVER) if(!loaded) @@ -96,7 +96,7 @@ loaded.forceMove(get_turf(user)) loaded = null - update_icon() + update_appearance() else ..() @@ -116,7 +116,7 @@ if(!loaded) icon_state = "rcl-0" item_state = "rcl-0" - return + return ..() switch(loaded.amount) if(61 to INFINITY) icon_state = "rcl-30" @@ -130,9 +130,10 @@ else icon_state = "rcl-0" item_state = "rcl-0" + return ..() /obj/item/rcl/proc/is_empty(mob/user, loud = 1) - update_icon() + update_appearance() if(!loaded || !loaded.amount) if(loud) to_chat(user, "The last of the cables unreel from [src].") @@ -213,7 +214,7 @@ loaded.cable_color = colors[current_color_index] last = loaded.place_turf(get_turf(src), user, turn(user.dir, 180)) is_empty(user) //If we've run out, display message - update_icon() + update_appearance() //searches the current tile for a stub cable of the same colour @@ -302,11 +303,11 @@ loaded = new() loaded.max_amount = max_amount loaded.amount = max_amount - update_icon() + update_appearance() /obj/item/rcl/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/rcl/ui_action_click(mob/user, action) if(istype(action, /datum/action/item_action/rcl_col)) @@ -335,7 +336,7 @@ if(!loaded) icon_state = "rclg-0" item_state = "rclg-0" - return + return ..() switch(loaded.amount) if(1 to INFINITY) icon_state = "rclg-1" @@ -343,3 +344,4 @@ else icon_state = "rclg-1" item_state = "rclg-1" + return ..() diff --git a/code/game/objects/items/RPD.dm b/code/game/objects/items/RPD.dm index 28c426c26489..6ea32ab181e3 100644 --- a/code/game/objects/items/RPD.dm +++ b/code/game/objects/items/RPD.dm @@ -434,7 +434,7 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list( activate() C.add_fingerprint(usr) - C.update_icon() + C.update_appearance() if(mode & WRENCH_MODE) C.wrench_act(user, src) return diff --git a/code/game/objects/items/broom.dm b/code/game/objects/items/broom.dm index 14ab77ca43ea..78ee6cc25d3c 100644 --- a/code/game/objects/items/broom.dm +++ b/code/game/objects/items/broom.dm @@ -3,6 +3,7 @@ desc = "This is my BROOMSTICK! It can be used manually or braced with two hands to sweep items as you move. It has a telescopic handle for compact storage." icon = 'icons/obj/janitor.dmi' icon_state = "broom0" + base_icon_state = "broom" lefthand_file = 'icons/mob/inhands/equipment/custodial_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/custodial_righthand.dmi' force = 8 @@ -21,10 +22,11 @@ /obj/item/pushbroom/ComponentInitialize() . = ..() - AddComponent(/datum/component/two_handed, force_unwielded=8, force_wielded=12, icon_wielded="broom1") + AddComponent(/datum/component/two_handed, force_unwielded=8, force_wielded=12, icon_wielded="[base_icon_state]1") /obj/item/pushbroom/update_icon_state() - icon_state = "broom0" + icon_state = "[base_icon_state]0" + return ..() /// triggered on wield of two handed item /obj/item/pushbroom/proc/on_wield(obj/item/source, mob/user) @@ -65,11 +67,11 @@ break if(i > 0) if (target_bin) - target_bin.update_icon() + target_bin.update_appearance() to_chat(user, "You sweep the pile of garbage into [target_bin].") playsound(loc, 'sound/weapons/thudswoosh.ogg', 30, TRUE, -1) /obj/item/pushbroom/proc/janicart_insert(mob/user, obj/structure/janitorialcart/J) //bless you whoever fixes this copypasta J.put_in_cart(src, user) J.mybroom=src - J.update_icon() + J.update_appearance() diff --git a/code/game/objects/items/candle.dm b/code/game/objects/items/candle.dm index 85606d74e10a..595c798d4c9e 100644 --- a/code/game/objects/items/candle.dm +++ b/code/game/objects/items/candle.dm @@ -21,6 +21,7 @@ /obj/item/candle/update_icon_state() icon_state = "candle[(wax > 400) ? ((wax > 750) ? 1 : 2) : 3][lit ? "_lit" : ""]" + return ..() /obj/item/candle/attackby(obj/item/W, mob/user, params) var/msg = W.ignition_effect(src, user) @@ -44,13 +45,13 @@ usr.visible_message(show_message) set_light(CANDLE_LUMINOSITY, 0.8) START_PROCESSING(SSobj, src) - update_icon() + update_appearance() /obj/item/candle/proc/put_out_candle() if(!lit) return lit = FALSE - update_icon() + update_appearance() set_light(0) return TRUE @@ -66,7 +67,7 @@ if(!wax) new /obj/item/trash/candle(loc) qdel(src) - update_icon() + update_appearance() open_flame() /obj/item/candle/attack_self(mob/user) @@ -114,12 +115,13 @@ user.visible_message( "[user] snuffs [src] out.") lit = FALSE - update_icon() + update_appearance() set_light(0) -/obj/item/candle/tribal_torch/update_icon() +/obj/item/candle/tribal_torch/update_appearance() icon_state = "torch[lit ? "_lit" : "_unlit"]" item_state = "torch[lit ? "-on" : ""]" + return ..() #undef CANDLE_LUMINOSITY diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index 1666721f4793..58eba6e70e88 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -35,7 +35,7 @@ /obj/item/card/data/Initialize() .=..() - update_icon() + update_appearance() /obj/item/card/data/update_overlays() . = ..() @@ -383,7 +383,7 @@ var/obj/item/storage/wallet/powergaming = loc if(powergaming.front_id == src) powergaming.update_label() - powergaming.update_icon() + powergaming.update_appearance() /obj/item/card/id/proc/get_cached_flat_icon() if(!cached_flat_icon) @@ -420,7 +420,7 @@ update_label() /obj/item/card/id/proc/update_label() var/blank = !registered_name name = "[blank ? initial(name) : "[registered_name]'s ID Card"][(!assignment) ? "" : " ([assignment])"]" - update_icon() + update_appearance() /obj/item/card/id/silver name = "silver identification card" @@ -602,7 +602,7 @@ update_label() /obj/item/card/id/captains_spare/update_label() //so it doesn't change to Captain's ID card (Captain) on a sneeze if(registered_name == "Captain") name = "[initial(name)][(!assignment || assignment == "Captain") ? "" : " ([assignment])"]" - update_icon() + update_appearance() else ..() diff --git a/code/game/objects/items/cash.dm b/code/game/objects/items/cash.dm index 0ec1885ed7e6..53a809d1cd0c 100644 --- a/code/game/objects/items/cash.dm +++ b/code/game/objects/items/cash.dm @@ -20,7 +20,7 @@ ..() if(amount) value = amount - update_icon() + update_appearance() /obj/item/spacecash/attackby(obj/item/W, mob/user) if(istype(W, /obj/item/spacecash)) @@ -35,7 +35,7 @@ qdel(cash) bundle.value += value - bundle.update_icon() + bundle.update_appearance() if(ishuman(user)) var/mob/living/carbon/human/H = user H.dropItemToGround(src) @@ -53,9 +53,9 @@ /obj/item/spacecash/bundle/Initialize() . = ..() - update_icon() + update_appearance() -/obj/item/spacecash/bundle/update_icon() +/obj/item/spacecash/bundle/update_appearance() icon_state = "nothing" cut_overlays() var/remaining_value = value @@ -110,6 +110,7 @@ desc = "That's a lot of dosh." drop_sound = 'sound/items/handling/dosh_drop.ogg' pickup_sound = 'sound/items/handling/dosh_pickup.ogg' + return ..() /obj/item/spacecash/bundle/attack_self() var/cashamount = input(usr, "How many credits do you want to take? (0 to [value])", "Take Money", 20) as num @@ -128,9 +129,9 @@ var/obj/item/spacecash/bundle/bundle = new (usr.loc) bundle.value = cashamount - bundle.update_icon() + bundle.update_appearance() usr.put_in_hands(bundle) - update_icon() + update_appearance() /obj/item/spacecash/bundle/AltClick(mob/living/user) var/cashamount = input(usr, "How many credits do you want to take? (0 to [value])", "Take Money", 20) as num @@ -149,9 +150,9 @@ var/obj/item/spacecash/bundle/bundle = new (usr.loc) bundle.value = cashamount - bundle.update_icon() + bundle.update_appearance() usr.put_in_hands(bundle) - update_icon() + update_appearance() /obj/item/spacecash/bundle/attack_hand(mob/user) if(user.get_inactive_held_item() == src) @@ -161,7 +162,7 @@ var/nuvalue = value - 1 value = nuvalue user.put_in_hands(new /obj/item/spacecash/bundle(loc, 1)) - update_icon() + update_appearance() else . = ..() diff --git a/code/game/objects/items/chrono_eraser.dm b/code/game/objects/items/chrono_eraser.dm index 28ff54d0f6d8..61a174871de5 100644 --- a/code/game/objects/items/chrono_eraser.dm +++ b/code/game/objects/items/chrono_eraser.dm @@ -190,7 +190,7 @@ cached_icon.Insert(mob_icon, "frame[i]") mob_underlay = mutable_appearance(cached_icon, "frame1") - update_icon() + update_appearance() desc = initial(desc) + "
It appears to contain [target.name]." START_PROCESSING(SSobj, src) @@ -201,7 +201,8 @@ gun.field_disconnect(src) return ..() -/obj/structure/chrono_field/update_icon() +/obj/structure/chrono_field/update_overlays() + . = ..() var/ttk_frame = 1 - (tickstokill / initial(tickstokill)) ttk_frame = clamp(CEILING(ttk_frame * CHRONO_FRAME_COUNT, 1), 1, CHRONO_FRAME_COUNT) if(ttk_frame != RPpos) @@ -230,7 +231,7 @@ captured.Unconscious(80) if(captured.loc != src) captured.forceMove(src) - update_icon() + update_appearance() if(gun) if(gun.field_check(src)) tickstokill-- diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm index 0b3aa3ef332c..44857142e4db 100644 --- a/code/game/objects/items/cigs_lighters.dm +++ b/code/game/objects/items/cigs_lighters.dm @@ -50,7 +50,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM desc = "A [initial(name)]. This one is lit." attack_verb = list("burnt","singed") START_PROCESSING(SSobj, src) - update_icon() + update_appearance() /obj/item/match/proc/matchburnout() if(lit) @@ -594,7 +594,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM . = ..() if(!overlay_state) overlay_state = pick(overlay_list) - update_icon() + update_appearance() /obj/item/lighter/cyborg_unequip(mob/user) if(!lit) @@ -607,6 +607,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM /obj/item/lighter/update_icon_state() icon_state = "[initial(icon_state)][lit ? "-on" : ""]" + return ..() /obj/item/lighter/proc/create_lighter_overlay() return mutable_appearance(icon, "lighter_overlay_[overlay_state][lit ? "-on" : ""]") @@ -629,7 +630,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM force = 0 attack_verb = null //human_defense.dm takes care of it set_light_on(lit) - update_icon() + update_appearance() /obj/item/lighter/extinguish() set_lit(FALSE) @@ -732,7 +733,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM . = ..() if(!lighter_color) lighter_color = pick(color_list) - update_icon() + update_appearance() /obj/item/lighter/greyscale/create_lighter_overlay() var/mutable_appearance/lighter_overlay = ..() diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index de828a547d4d..595c45ff9a9b 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -164,7 +164,7 @@ if(has_cap) is_capped = !is_capped to_chat(user, "The cap on [src] is now [is_capped ? "on" : "off"].") - update_icon() + update_appearance() /obj/item/toy/crayon/CtrlClick(mob/user) if(can_change_colour && !isturf(loc) && user.canUseTopic(src, BE_CLOSE, ismonkey(user))) @@ -259,7 +259,7 @@ . = TRUE paint_mode = PAINT_NORMAL drawtype = "a" - update_icon() + update_appearance() /obj/item/toy/crayon/proc/select_colour(mob/user) var/chosen_colour = input(user, "", "Choose Color", paint_color) as color|null @@ -600,7 +600,7 @@ new /obj/item/toy/crayon/blue(src) new /obj/item/toy/crayon/purple(src) new /obj/item/toy/crayon/black(src) - update_icon() + update_appearance() /obj/item/storage/crayons/update_overlays() . = ..() @@ -662,7 +662,7 @@ paint_color = pick("#DA0000","#FF9300","#FFF200","#A8E61D","#00B7EF", "#DA00FF") refill() - update_icon() + update_appearance() /obj/item/toy/crayon/spraycan/examine(mob/user) @@ -738,6 +738,7 @@ /obj/item/toy/crayon/spraycan/update_icon_state() icon_state = is_capped ? icon_capped : icon_uncapped + return ..() /obj/item/toy/crayon/spraycan/update_overlays() . = ..() diff --git a/code/game/objects/items/credit_holochip.dm b/code/game/objects/items/credit_holochip.dm index 52af27b5d819..9a6663cf2046 100644 --- a/code/game/objects/items/credit_holochip.dm +++ b/code/game/objects/items/credit_holochip.dm @@ -3,6 +3,7 @@ desc = "A hard-light chip encoded with an amount of credits. It is a modern replacement for physical money that can be directly converted to virtual currency and viceversa. Keep away from magnets." icon = 'icons/obj/economy.dmi' icon_state = "holochip" + base_icon_state = "holochip" throwforce = 0 force = 0 w_class = WEIGHT_CLASS_TINY @@ -11,7 +12,7 @@ /obj/item/holochip/Initialize(mapload, amount) . = ..() credits = amount - update_icon() + update_appearance() /obj/item/holochip/examine(mob/user) . = ..() @@ -21,21 +22,36 @@ /obj/item/holochip/get_item_credit_value() return credits -/obj/item/holochip/update_icon() +/obj/item/holochip/update_name() name = "\improper [credits] credit holochip" - var/rounded_credits = credits + return ..() + +/obj/item/holochip/update_icon_state() + var/icon_suffix = "" + switch(credits) + if(1e3 to (1e6 - 1)) + icon_suffix = "_kilo" + if(1e6 to (1e9 - 1)) + icon_suffix = "_mega" + if(1e9 to INFINITY) + icon_suffix = "_giga" + + icon_state = "[base_icon_state][icon_suffix]" + return ..() + +/obj/item/holochip/update_overlays() + . = ..() + var/rounded_credits switch(credits) - if(1 to 999) - icon_state = "holochip" - if(1000 to 999999) - icon_state = "holochip_kilo" - rounded_credits = round(rounded_credits * 0.001) - if(1000000 to 999999999) - icon_state = "holochip_mega" - rounded_credits = round(rounded_credits * 0.000001) - if(1000000000 to INFINITY) - icon_state = "holochip_giga" - rounded_credits = round(rounded_credits * 0.000000001) + if(0 to (1e3 - 1)) + rounded_credits = round(credits) + if(1e3 to (1e6 - 1)) + rounded_credits = round(credits * 1e-3) + if(1e6 to (1e9 - 1)) + rounded_credits = round(credits * 1e-6) + if(1e9 to INFINITY) + rounded_credits = round(credits * 1e-9) + var/overlay_color = "#914792" switch(rounded_credits) if(0 to 4) @@ -54,17 +70,16 @@ overlay_color = "#0153C1" if(500 to INFINITY) overlay_color = "#2C2C2C" - cut_overlays() var/mutable_appearance/holochip_overlay = mutable_appearance('icons/obj/economy.dmi', "[icon_state]-color") holochip_overlay.color = overlay_color - add_overlay(holochip_overlay) + . += holochip_overlay /obj/item/holochip/proc/spend(amount, pay_anyway = FALSE) if(credits >= amount) credits -= amount if(credits == 0) qdel(src) - update_icon() + update_appearance() return amount else if(pay_anyway) qdel(src) @@ -78,7 +93,7 @@ var/obj/item/holochip/H = I credits += H.credits to_chat(user, "You insert the credits into [src].") - update_icon() + update_appearance() qdel(H) /obj/item/holochip/AltClick(mob/user) diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm index 910669a5cf14..bf61f194b9b7 100644 --- a/code/game/objects/items/defib.dm +++ b/code/game/objects/items/defib.dm @@ -58,7 +58,7 @@ powered = TRUE else powered = FALSE - update_icon() + update_appearance() /obj/item/defibrillator/update_overlays() . = ..() @@ -130,7 +130,7 @@ else if(W.tool_behaviour == TOOL_SCREWDRIVER) if(cell) - cell.update_icon() + cell.update_appearance() cell.forceMove(get_turf(src)) cell = null to_chat(user, "You remove the cell from [src].") @@ -232,7 +232,7 @@ visible_message("[src] beeps: Charge depleted.") playsound(src, 'sound/machines/defib_failed.ogg', 50, FALSE) paddles.cooldown = FALSE - paddles.update_icon() + paddles.update_appearance() update_power() /obj/item/defibrillator/compact @@ -358,13 +358,13 @@ if(req_defib || !time) return cooldown = TRUE - update_icon() + update_appearance() sleep(time) var/turf/T = get_turf(src) T.audible_message("[src] beeps: Unit is recharged.") playsound(src, 'sound/machines/defib_ready.ogg', 50, FALSE) cooldown = FALSE - update_icon() + update_appearance() /obj/item/shockpaddles/Initialize() . = ..() @@ -377,13 +377,14 @@ return INITIALIZE_HINT_QDEL defib = loc busy = FALSE - update_icon() + update_appearance() /obj/item/shockpaddles/update_icon_state() icon_state = "[base_icon_state][wielded]" item_state = icon_state if(cooldown) icon_state = "[base_icon_state][wielded]_cooldown" + return ..() /obj/item/shockpaddles/dropped(mob/user) if(!req_defib) @@ -476,7 +477,7 @@ defib.deductcharge(revivecost) cooldown = TRUE busy = FALSE - update_icon() + update_appearance() if(req_defib) defib.cooldowncheck(user) else @@ -490,7 +491,7 @@ user.visible_message("[user] begins to place [src] on [H]'s chest.", "You overcharge the paddles and begin to place them onto [H]'s chest...") busy = TRUE - update_icon() + update_appearance() if(do_after(user, 15, target = H)) user.visible_message("[user] places [src] on [H]'s chest.", "You place [src] on [H]'s chest and begin to charge them.") @@ -503,13 +504,13 @@ if(do_after(user, 15, target = H)) //Takes longer due to overcharging if(!H) busy = FALSE - update_icon() + update_appearance() return if(H && H.stat == DEAD) to_chat(user, "[H] is dead.") playsound(src, 'sound/machines/defib_failed.ogg', 50, FALSE) busy = FALSE - update_icon() + update_appearance() return user.visible_message("[user] shocks [H] with \the [src]!", "You shock [H] with \the [src]!") playsound(src, 'sound/machines/defib_zap.ogg', 100, TRUE, -1) @@ -529,18 +530,18 @@ defib.deductcharge(revivecost) cooldown = TRUE busy = FALSE - update_icon() + update_appearance() if(!req_defib) recharge(60) if(req_defib && (defib.cooldowncheck(user))) return busy = FALSE - update_icon() + update_appearance() /obj/item/shockpaddles/proc/do_help(mob/living/carbon/H, mob/living/user) user.visible_message("[user] begins to place [src] on [H]'s chest.", "You begin to place [src] on [H]'s chest...") busy = TRUE - update_icon() + update_appearance() if(do_after(user, 30, target = H)) //beginning to place the paddles on patient's chest to allow some time for people to move away to stop the process user.visible_message("[user] places [src] on [H]'s chest.", "You place [src] on [H]'s chest.") playsound(src, 'sound/machines/defib_charge.ogg', 75, FALSE) @@ -554,7 +555,7 @@ user.audible_message("[req_defib ? "[defib]" : "[src]"] buzzes: Patient's chest is obscured. Operation aborted.") playsound(src, 'sound/machines/defib_failed.ogg', 50, FALSE) busy = FALSE - update_icon() + update_appearance() return if(H.stat == DEAD) H.visible_message("[H]'s body convulses a bit.") @@ -609,7 +610,7 @@ if(req_defib) defib.deductcharge(revivecost) cooldown = 1 - update_icon() + update_appearance() if(req_defib) defib.cooldowncheck(user) else @@ -629,7 +630,7 @@ user.visible_message("[req_defib ? "[defib]" : "[src]"] buzzes: Patient is not in a valid state. Operation aborted.") playsound(src, 'sound/machines/defib_failed.ogg', 50, FALSE) busy = FALSE - update_icon() + update_appearance() /obj/item/shockpaddles/cyborg name = "cyborg defibrillator paddles" diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index d507e1594f5f..e7da99ab87e7 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -106,7 +106,7 @@ GLOBAL_LIST_EMPTY(PDAs) inserted_item = new inserted_item(src) else inserted_item = new /obj/item/pen(src) - update_icon() + update_appearance() /obj/item/pda/equipped(mob/user, slot) . = ..() @@ -282,7 +282,7 @@ GLOBAL_LIST_EMPTY(PDAs) if (pai) if(pai.loc != src) pai = null - update_icon() + update_appearance() else dat += "
  • [PDAIMG(status)] pAI Device Configuration
  • " dat += "
  • [PDAIMG(status)] Eject pAI Device
  • " @@ -432,7 +432,7 @@ GLOBAL_LIST_EMPTY(PDAs) scanmode = 0 cartridge.host_pda = null cartridge = null - update_icon() + update_appearance() //MENU FUNCTIONS=================================== @@ -612,7 +612,7 @@ GLOBAL_LIST_EMPTY(PDAs) . = id id = null updateSelfDialog() - update_icon() + update_appearance() if(ishuman(loc)) var/mob/living/carbon/human/H = loc @@ -730,7 +730,7 @@ GLOBAL_LIST_EMPTY(PDAs) to_chat(L, "[icon2html(src)] PDA message from [hrefstart][signal.data["name"]] ([signal.data["job"]])[hrefend], [inbound_message] [reply]") - update_icon() + update_appearance() add_overlay(icon_alert) /obj/item/pda/proc/send_to_all(mob/living/U) @@ -806,7 +806,7 @@ GLOBAL_LIST_EMPTY(PDAs) set_light_on(FALSE) else if(light_range) set_light_on(TRUE) - update_icon() + update_appearance() for(var/X in actions) var/datum/action/A = X A.UpdateButtonIcon() @@ -820,7 +820,7 @@ GLOBAL_LIST_EMPTY(PDAs) user.put_in_hands(inserted_item) to_chat(user, "You remove [inserted_item] from [src].") inserted_item = null - update_icon() + update_appearance() else to_chat(user, "This PDA does not have a pen in it!") @@ -834,7 +834,7 @@ GLOBAL_LIST_EMPTY(PDAs) cartridge.host_pda = null cartridge = null updateSelfDialog() - update_icon() + update_appearance() //trying to insert or remove an id /obj/item/pda/proc/id_check(mob/user, obj/item/card/id/I) @@ -851,7 +851,7 @@ GLOBAL_LIST_EMPTY(PDAs) if(!user.transferItemToLoc(I, src)) return FALSE insert_id(I, user) - update_icon() + update_appearance() return TRUE @@ -879,7 +879,7 @@ GLOBAL_LIST_EMPTY(PDAs) cartridge.host_pda = src to_chat(user, "You insert [cartridge] into [src].") updateSelfDialog() - update_icon() + update_appearance() else if(istype(C, /obj/item/card/id)) var/obj/item/card/id/idcard = C @@ -904,7 +904,7 @@ GLOBAL_LIST_EMPTY(PDAs) return pai = C to_chat(user, "You slot \the [C] into [src].") - update_icon() + update_appearance() updateUsrDialog() else if(is_type_in_list(C, contained_item)) //Checks if there is a pen if(inserted_item) @@ -914,7 +914,7 @@ GLOBAL_LIST_EMPTY(PDAs) return to_chat(user, "You slide \the [C] into \the [src].") inserted_item = C - update_icon() + update_appearance() else if(istype(C, /obj/item/photo)) var/obj/item/photo/P = C picture = P.picture diff --git a/code/game/objects/items/devices/aicard.dm b/code/game/objects/items/devices/aicard.dm index f5ef31b2e695..f0714b01dddd 100644 --- a/code/game/objects/items/devices/aicard.dm +++ b/code/game/objects/items/devices/aicard.dm @@ -32,10 +32,9 @@ target.transfer_ai(AI_TRANS_TO_CARD, user, null, src) if(AI) log_combat(user, AI, "carded", src) - update_icon() //Whatever happened, update the card's state (icon, name) to match. + update_appearance() //Whatever happened, update the card's state (icon, name) to match. -/obj/item/aicard/update_icon() - cut_overlays() +/obj/item/aicard/update_icon_state() if(AI) name = "[initial(name)] - [AI.name]" if(AI.stat == DEAD) @@ -48,6 +47,7 @@ else name = initial(name) icon_state = initial(icon_state) + return ..() /obj/item/aicard/ui_state(mob/user) return GLOB.hands_state @@ -99,4 +99,4 @@ AI.radio_enabled = !AI.radio_enabled to_chat(AI, "Your Subspace Transceiver has been [AI.radio_enabled ? "enabled" : "disabled"]!") . = TRUE - update_icon() + update_appearance() diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index d33baf5510ac..584bbcc1227f 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -467,6 +467,7 @@ light_range = 4 light_system = MOVABLE_LIGHT color = LIGHT_COLOR_GREEN + base_icon_state = "glowstick" icon_state = "glowstick" item_state = "glowstick" grind_results = list(/datum/reagent/phenol = 15, /datum/reagent/hydrogen = 10, /datum/reagent/oxygen = 5) //Meth-in-a-stick @@ -491,28 +492,35 @@ if(!fuel) turn_off() STOP_PROCESSING(SSobj, src) - update_icon() + update_appearance() /obj/item/flashlight/glowstick/proc/turn_off() on = FALSE - update_icon() + update_appearance() -/obj/item/flashlight/glowstick/update_icon() - item_state = "glowstick" - cut_overlays() +/obj/item/flashlight/glowstick/update_appearance(updates=ALL) + . = ..() if(!fuel) - icon_state = "glowstick-empty" - cut_overlays() set_light_on(FALSE) else if(on) - var/mutable_appearance/glowstick_overlay = mutable_appearance(icon, "glowstick-glow") - glowstick_overlay.color = color - add_overlay(glowstick_overlay) - item_state = "glowstick-on" + return + if(on) set_light_on(TRUE) - else - icon_state = "glowstick" - cut_overlays() + return + +/obj/item/flashlight/glowstick/update_icon_state() + icon_state = "[base_icon_state][(fuel <= 0) ? "-empty" : ""]" + item_state = "[base_icon_state][((fuel > 0) && on) ? "-on" : ""]" + return ..() + +/obj/item/flashlight/glowstick/update_overlays() + . = ..() + if(fuel <= 0 && !on) + return + + var/mutable_appearance/glowstick_overlay = mutable_appearance(icon, "glowstick-glow") + glowstick_overlay.color = color + . += glowstick_overlay /obj/item/flashlight/glowstick/attack_self(mob/user) if(!fuel) diff --git a/code/game/objects/items/devices/geiger_counter.dm b/code/game/objects/items/devices/geiger_counter.dm index f9399a8f40c4..1b1177e137a7 100644 --- a/code/game/objects/items/devices/geiger_counter.dm +++ b/code/game/objects/items/devices/geiger_counter.dm @@ -42,7 +42,7 @@ return ..() /obj/item/geiger_counter/process() - update_icon() + update_appearance() update_sound() if(!scanning) @@ -90,22 +90,25 @@ /obj/item/geiger_counter/update_icon_state() if(!scanning) icon_state = "geiger_off" - else if(obj_flags & EMAGGED) + return ..() + if(obj_flags & EMAGGED) icon_state = "geiger_on_emag" - else - switch(radiation_count) - if(-INFINITY to RAD_LEVEL_NORMAL) - icon_state = "geiger_on_1" - if(RAD_LEVEL_NORMAL + 1 to RAD_LEVEL_MODERATE) - icon_state = "geiger_on_2" - if(RAD_LEVEL_MODERATE + 1 to RAD_LEVEL_HIGH) - icon_state = "geiger_on_3" - if(RAD_LEVEL_HIGH + 1 to RAD_LEVEL_VERY_HIGH) - icon_state = "geiger_on_4" - if(RAD_LEVEL_VERY_HIGH + 1 to RAD_LEVEL_CRITICAL) - icon_state = "geiger_on_4" - if(RAD_LEVEL_CRITICAL + 1 to INFINITY) - icon_state = "geiger_on_5" + return ..() + + switch(radiation_count) + if(-INFINITY to RAD_LEVEL_NORMAL) + icon_state = "geiger_on_1" + if(RAD_LEVEL_NORMAL + 1 to RAD_LEVEL_MODERATE) + icon_state = "geiger_on_2" + if(RAD_LEVEL_MODERATE + 1 to RAD_LEVEL_HIGH) + icon_state = "geiger_on_3" + if(RAD_LEVEL_HIGH + 1 to RAD_LEVEL_VERY_HIGH) + icon_state = "geiger_on_4" + if(RAD_LEVEL_VERY_HIGH + 1 to RAD_LEVEL_CRITICAL) + icon_state = "geiger_on_4" + if(RAD_LEVEL_CRITICAL + 1 to INFINITY) + icon_state = "geiger_on_5" + return ..() /obj/item/geiger_counter/proc/update_sound() var/datum/looping_sound/geiger/loop = soundloop @@ -123,11 +126,11 @@ if(amount <= RAD_BACKGROUND_RADIATION || !scanning) return current_tick_amount += amount - update_icon() + update_appearance() /obj/item/geiger_counter/attack_self(mob/user) scanning = !scanning - update_icon() + update_appearance() to_chat(user, "[icon2html(src, user)] You switch [scanning ? "on" : "off"] [src].") /obj/item/geiger_counter/afterattack(atom/target, mob/user) @@ -168,7 +171,7 @@ user.visible_message("[user] refastens [src]'s maintenance panel!", "You reset [src] to its factory settings!") obj_flags &= ~EMAGGED radiation_count = 0 - update_icon() + update_appearance() return 1 else return ..() @@ -181,7 +184,7 @@ return 0 radiation_count = 0 to_chat(usr, "You flush [src]'s radiation counts, resetting it to normal.") - update_icon() + update_appearance() /obj/item/geiger_counter/emag_act(mob/user) if(obj_flags & EMAGGED) @@ -201,7 +204,7 @@ if(!scanning) return scanning = FALSE - update_icon() + update_appearance() /obj/item/geiger_counter/cyborg/equipped(mob/user) . = ..() diff --git a/code/game/objects/items/devices/lightreplacer.dm b/code/game/objects/items/devices/lightreplacer.dm index ff92f7564b07..c6ad17b81255 100644 --- a/code/game/objects/items/devices/lightreplacer.dm +++ b/code/game/objects/items/devices/lightreplacer.dm @@ -154,6 +154,7 @@ /obj/item/lightreplacer/update_icon_state() icon_state = "lightreplacer[(obj_flags & EMAGGED ? 1 : 0)]" + return ..() /obj/item/lightreplacer/proc/status_string() return "It has [uses] light\s remaining (plus [bulb_shards] fragment\s)." @@ -225,7 +226,7 @@ name = "shortcircuited [initial(name)]" else name = initial(name) - update_icon() + update_appearance() /obj/item/lightreplacer/proc/CanUse(mob/living/user) src.add_fingerprint(user) @@ -255,7 +256,7 @@ /obj/item/lightreplacer/proc/janicart_insert(mob/user, obj/structure/janitorialcart/J) J.put_in_cart(src, user) J.myreplacer = src - J.update_icon() + J.update_appearance() /obj/item/lightreplacer/cyborg/janicart_insert(mob/user, obj/structure/janitorialcart/J) return diff --git a/code/game/objects/items/devices/multitool.dm b/code/game/objects/items/devices/multitool.dm index be3f71d935b1..dca088c1be2e 100644 --- a/code/game/objects/items/devices/multitool.dm +++ b/code/game/objects/items/devices/multitool.dm @@ -83,7 +83,7 @@ if(eye.eye_user) eye.setLoc(get_turf(src)) multitool_detect() - update_icon() + update_appearance() track_cooldown = world.time + track_delay /obj/item/multitool/ai_detect/proc/toggle_hud(mob/user) diff --git a/code/game/objects/items/devices/portable_chem_mixer.dm b/code/game/objects/items/devices/portable_chem_mixer.dm index 3999e67c1952..fa777fec1124 100644 --- a/code/game/objects/items/devices/portable_chem_mixer.dm +++ b/code/game/objects/items/devices/portable_chem_mixer.dm @@ -46,7 +46,7 @@ update_contents() if (locked) replace_beaker(user) - update_icon() + update_appearance() I.play_tool_sound(src, 50) return @@ -56,7 +56,7 @@ if(!user.transferItemToLoc(B, src)) return replace_beaker(user, B) - update_icon() + update_appearance() updateUsrDialog() return @@ -80,23 +80,23 @@ return /obj/item/storage/portable_chem_mixer/update_icon_state() - var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED) - if (!locked) + if(!SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)) icon_state = "portablechemicalmixer_open" - else if (beaker) + return ..() + if(beaker) icon_state = "portablechemicalmixer_full" - else - icon_state = "portablechemicalmixer_empty" - + return ..() + icon_state = "portablechemicalmixer_empty" + return ..() /obj/item/storage/portable_chem_mixer/AltClick(mob/living/user) var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED) - if (!locked) + if(!locked) return ..() if(!can_interact(user) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) return replace_beaker(user) - update_icon() + update_appearance() /** * Replaces the beaker of the portable chemical mixer with another beaker, or simply adds the new beaker if none is in currently @@ -215,5 +215,5 @@ . = TRUE if("eject") replace_beaker(usr) - update_icon() + update_appearance() . = TRUE diff --git a/code/game/objects/items/devices/powersink.dm b/code/game/objects/items/devices/powersink.dm index 342a7ab675b8..3a6ba2f73950 100644 --- a/code/game/objects/items/devices/powersink.dm +++ b/code/game/objects/items/devices/powersink.dm @@ -28,6 +28,7 @@ /obj/item/powersink/update_icon_state() icon_state = "powersink[mode == OPERATING]" + return ..() /obj/item/powersink/set_anchored(anchorvalue) . = ..() @@ -57,7 +58,7 @@ set_anchored(TRUE) mode = value - update_icon() + update_appearance() set_light(0) /obj/item/powersink/attackby(obj/item/I, mob/user, params) diff --git a/code/game/objects/items/devices/quantum_keycard.dm b/code/game/objects/items/devices/quantum_keycard.dm index 3a4dd7177c83..86051885c65c 100644 --- a/code/game/objects/items/devices/quantum_keycard.dm +++ b/code/game/objects/items/devices/quantum_keycard.dm @@ -26,7 +26,5 @@ qpad = null /obj/item/quantum_keycard/update_icon_state() - if(qpad) - icon_state = "quantum_keycard_on" - else - icon_state = initial(icon_state) + icon_state = qpad ? "quantum_keycard_on" : initial(icon_state) + return ..() diff --git a/code/game/objects/items/devices/radio/intercom.dm b/code/game/objects/items/devices/radio/intercom.dm index f135d6e97711..35d8be6efa55 100644 --- a/code/game/objects/items/devices/radio/intercom.dm +++ b/code/game/objects/items/devices/radio/intercom.dm @@ -103,7 +103,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/item/radio/intercom, 31) /obj/item/radio/intercom/emp_act(severity) . = ..() // Parent call here will set `on` to FALSE. - update_icon() + update_appearance() /obj/item/radio/intercom/end_emp_effect(curremp) . = ..() @@ -117,7 +117,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/item/radio/intercom, 31) icon_state = "[initial(icon_state)]-p" /** - * Proc called whenever the intercom's area loses or gains power. Responsible for setting the `on` variable and calling `update_icon()`. + * Proc called whenever the intercom's area loses or gains power. Responsible for setting the `on` variable and calling `update_appearance()`. * * Normally called after the intercom's area recieves the `COMSIG_AREA_POWER_CHANGE` signal, but it can also be called directly. * Arguments: @@ -129,7 +129,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/item/radio/intercom, 31) on = FALSE else on = current_area.powered(AREA_USAGE_EQUIP) // set "on" to the equipment power status of our area. - update_icon() + update_appearance() /obj/item/radio/intercom/add_blood_DNA(list/blood_dna) return FALSE diff --git a/code/game/objects/items/devices/swapper.dm b/code/game/objects/items/devices/swapper.dm index 42224d9cd23a..b152504a3431 100644 --- a/code/game/objects/items/devices/swapper.dm +++ b/code/game/objects/items/devices/swapper.dm @@ -16,15 +16,13 @@ /obj/item/swapper/Destroy() if(linked_swapper) linked_swapper.linked_swapper = null //*inception music* - linked_swapper.update_icon() + linked_swapper.update_appearance() linked_swapper = null return ..() /obj/item/swapper/update_icon_state() - if(linked_swapper) - icon_state = "swapper-linked" - else - icon_state = "swapper" + icon_state = "swapper[linked_swapper ? "-linked" : null]" + return ..() /obj/item/swapper/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/swapper)) @@ -38,8 +36,8 @@ to_chat(user, "You establish a quantum link between the two devices.") linked_swapper = other_swapper other_swapper.linked_swapper = src - update_icon() - linked_swapper.update_icon() + update_appearance() + linked_swapper.update_appearance() else return ..() @@ -74,9 +72,9 @@ to_chat(user, "You break the current quantum link.") if(!QDELETED(linked_swapper)) linked_swapper.linked_swapper = null - linked_swapper.update_icon() + linked_swapper.update_appearance() linked_swapper = null - update_icon() + update_appearance() //Gets the topmost teleportable container /obj/item/swapper/proc/get_teleportable_container() diff --git a/code/game/objects/items/devices/taperecorder.dm b/code/game/objects/items/devices/taperecorder.dm index 8a0827f0ed6e..d072fcc9c23a 100644 --- a/code/game/objects/items/devices/taperecorder.dm +++ b/code/game/objects/items/devices/taperecorder.dm @@ -26,7 +26,7 @@ . = ..() if(starting_tape_type) mytape = new starting_tape_type(src) - update_icon() + update_appearance() become_hearing_sensitive(ROUNDSTART_TRAIT) /obj/item/taperecorder/Destroy() @@ -44,7 +44,7 @@ return mytape = I to_chat(user, "You insert [I] into [src].") - update_icon() + update_appearance() /obj/item/taperecorder/proc/eject(mob/user) @@ -53,7 +53,7 @@ stop() user.put_in_hands(mytape) mytape = null - update_icon() + update_appearance() /obj/item/taperecorder/fire_act(exposed_temperature, exposed_volume) mytape.ruin() //Fires destroy the tape @@ -87,12 +87,15 @@ /obj/item/taperecorder/update_icon_state() if(!mytape) icon_state = "taperecorder_empty" - else if(recording) + return ..() + if(recording) icon_state = "taperecorder_recording" - else if(playing) + return ..() + if(playing) icon_state = "taperecorder_playing" - else - icon_state = "taperecorder_idle" + return ..() + icon_state = "taperecorder_idle" + return ..() /obj/item/taperecorder/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, spans, list/message_mods = list()) @@ -117,7 +120,7 @@ if(mytape.used_capacity < mytape.max_capacity) to_chat(usr, "Recording started.") recording = 1 - update_icon() + update_appearance() mytape.timestamp += mytape.used_capacity mytape.storedinfo += "\[[time2text(mytape.used_capacity * 10,"mm:ss")]\] Recording started." var/used = mytape.used_capacity //to stop runtimes when you eject the tape @@ -127,7 +130,7 @@ used++ sleep(10) recording = 0 - update_icon() + update_appearance() else to_chat(usr, "The tape is full.") @@ -149,7 +152,7 @@ playing = 0 var/turf/T = get_turf(src) T.visible_message("Tape Recorder: Playback stopped.") - update_icon() + update_appearance() /obj/item/taperecorder/verb/play() @@ -166,7 +169,7 @@ return playing = 1 - update_icon() + update_appearance() to_chat(usr, "Playing started.") var/used = mytape.used_capacity //to stop runtimes when you eject the tape var/max = mytape.max_capacity @@ -191,7 +194,7 @@ i++ playing = 0 - update_icon() + update_appearance() /obj/item/taperecorder/attack_self(mob/user) diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm index 8632a0fd6355..3d054927d2c8 100644 --- a/code/game/objects/items/devices/traitordevices.dm +++ b/code/game/objects/items/devices/traitordevices.dm @@ -260,4 +260,4 @@ effective or pretty fucking useless. GLOB.active_jammers |= src else GLOB.active_jammers -= src - update_icon() + update_appearance() diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm index 8a3550962b39..438b37fe5944 100644 --- a/code/game/objects/items/devices/transfer_valve.dm +++ b/code/game/objects/items/devices/transfer_valve.dm @@ -3,6 +3,7 @@ name = "tank transfer valve" icon_state = "valve_1" item_state = "ttv" + base_icon_state = "valve" lefthand_file = 'icons/mob/inhands/weapons/bombs_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/bombs_righthand.dmi' desc = "Regulates the transfer of air between two tanks." @@ -35,7 +36,7 @@ tank_two = item to_chat(user, "You attach the tank to the transfer valve.") - update_icon() + update_appearance() //TODO: Have this take an assemblyholder else if(isassembly(item)) var/obj/item/assembly/A = item @@ -51,7 +52,7 @@ to_chat(user, "You attach the [item] to the valve controls and secure it.") A.on_attach() A.holder = src - A.toggle_secure() //this calls update_icon(), which calls update_icon() on the holder (i.e. the bomb). + A.toggle_secure() //this calls update_appearance(), which calls update_appearance() on the holder (i.e. the bomb). log_bomber(user, "attached a [item.name] to a ttv -", src, null, FALSE) attacher = user return @@ -88,30 +89,33 @@ /obj/item/transfer_valve/proc/toggle_off() toggle = TRUE -/obj/item/transfer_valve/update_icon() - cut_overlays() - - if(!tank_one && !tank_two && !attached_device) - icon_state = "valve_1" - return - icon_state = "valve" +/obj/item/transfer_valve/update_icon_state() + icon_state = "[base_icon_state][(!tank_one && !tank_two && !attached_device) ? "_1" : null]" + return ..() +/obj/item/transfer_valve/update_overlays() + . = ..() if(tank_one) - add_overlay("[tank_one.icon_state]") - if(tank_two) + . += "[tank_one.icon_state]" + + if(!tank_two) + underlays = null + else var/mutable_appearance/J = mutable_appearance(icon, icon_state = "[tank_two.icon_state]") var/matrix/T = matrix() T.Translate(-13, 0) J.transform = T underlays = list(J) - else - underlays = null - if(attached_device) - add_overlay("device") - if(istype(attached_device, /obj/item/assembly/infra)) - var/obj/item/assembly/infra/sensor = attached_device - if(sensor.on && sensor.visible) - add_overlay("proxy_beam") + + if(!attached_device) + return + + . += "device" + if(!istype(attached_device, /obj/item/assembly/infra)) + return + var/obj/item/assembly/infra/sensor = attached_device + if(sensor.on && sensor.visible) + . += "proxy_beam" /obj/item/transfer_valve/proc/merge_gases(datum/gas_mixture/target, change_volume = TRUE) var/target_self = FALSE @@ -170,12 +174,12 @@ merge_gases() for(var/i in 1 to 6) - addtimer(CALLBACK(src, /atom/.proc/update_icon), 20 + (i - 1) * 10) + addtimer(CALLBACK(src, /atom/.proc/update_appearance), 20 + (i - 1) * 10) else if(valve_open && tank_one && tank_two) split_gases() valve_open = FALSE - update_icon() + update_appearance() /* This doesn't do anything but the timer etc. expects it to be here eventually maybe have it update icon to show state (timer, prox etc.) like old bombs @@ -233,4 +237,4 @@ attached_device = null . = TRUE - update_icon() + update_appearance() diff --git a/code/game/objects/items/dice.dm b/code/game/objects/items/dice.dm index 642ccdd3a6e4..631466b3240a 100644 --- a/code/game/objects/items/dice.dm +++ b/code/game/objects/items/dice.dm @@ -58,7 +58,7 @@ . = ..() if(!result) result = roll(sides) - update_icon() + update_appearance() /obj/item/dice/d1 name = "d1" @@ -194,7 +194,7 @@ comment = "NAT 20!" else if(sides == 20 && result == 1) comment = "Ouch, bad luck." - update_icon() + update_appearance() if(initial(icon_state) == "d00") result = (result - 1)*10 if(special_faces.len == sides) diff --git a/code/game/objects/items/documents.dm b/code/game/objects/items/documents.dm index 2e028170a5f1..51c17ff4290d 100644 --- a/code/game/objects/items/documents.dm +++ b/code/game/objects/items/documents.dm @@ -63,4 +63,4 @@ icon_state = "docs_[C.crayon_color]" forgedseal = C.crayon_color to_chat(user, "You forge the official seal with a [C.crayon_color] crayon. No one will notice... right?") - update_icon() + update_appearance() diff --git a/code/game/objects/items/dualsaber.dm b/code/game/objects/items/dualsaber.dm index 3560b9b3ac88..39fe7d490320 100644 --- a/code/game/objects/items/dualsaber.dm +++ b/code/game/objects/items/dualsaber.dm @@ -65,10 +65,8 @@ /obj/item/dualsaber/update_icon_state() - if(wielded) - icon_state = "dualsaber[saber_color]" - else - icon_state = "dualsaber" + icon_state = wielded ? "dualsaber[saber_color][wielded]" : "dualsaber0" + return ..() /obj/item/dualsaber/Initialize() . = ..() @@ -169,7 +167,7 @@ hacked = TRUE to_chat(user, "2XRNBW_ENGAGE") saber_color = "rainbow" - update_icon() + update_appearance() else to_chat(user, "It's starting to look like a triple rainbow - no, nevermind.") else diff --git a/code/game/objects/items/energyhalberd.dm b/code/game/objects/items/energyhalberd.dm index 72aeb52132ca..fb03f24fbeb6 100644 --- a/code/game/objects/items/energyhalberd.dm +++ b/code/game/objects/items/energyhalberd.dm @@ -69,8 +69,10 @@ /obj/item/energyhalberd/update_icon_state() if(wielded) icon_state = "halberd[halberd_color]" + return ..() else icon_state = "halberd" + return ..() /obj/item/energyhalberd/Initialize() . = ..() @@ -165,7 +167,7 @@ hacked = TRUE to_chat(user, "HLBRDRNBW_ENGAGE") halberd_color = "rainbow" - update_icon() + update_appearance() else to_chat(user, "It's starting to look like a triple rainbow - no, nevermind.") else diff --git a/code/game/objects/items/etherealdiscoball.dm b/code/game/objects/items/etherealdiscoball.dm index db35c246db23..a695bd70e410 100644 --- a/code/game/objects/items/etherealdiscoball.dm +++ b/code/game/objects/items/etherealdiscoball.dm @@ -25,7 +25,7 @@ /obj/structure/etherealball/Initialize() . = ..() - update_icon() + update_appearance() /obj/structure/etherealball/attack_hand(mob/living/carbon/human/user) . = ..() @@ -49,7 +49,7 @@ TurnedOn = FALSE set_light(0) remove_atom_colour(TEMPORARY_COLOUR_PRIORITY) - update_icon() + update_appearance() if(TimerID) deltimer(TimerID) @@ -58,11 +58,12 @@ current_color = random_color() set_light(range, power, current_color) add_atom_colour("#[current_color]", FIXED_COLOUR_PRIORITY) - update_icon() + update_appearance() TimerID = addtimer(CALLBACK(src, .proc/DiscoFever), 5, TIMER_STOPPABLE) //Call ourselves every 0.5 seconds to change colors /obj/structure/etherealball/update_icon_state() icon_state = "ethdisco_head_[TurnedOn]" + return ..() /obj/structure/etherealball/update_overlays() . = ..() diff --git a/code/game/objects/items/fireaxe.dm b/code/game/objects/items/fireaxe.dm index 207da2cfbecf..8203880b2b27 100644 --- a/code/game/objects/items/fireaxe.dm +++ b/code/game/objects/items/fireaxe.dm @@ -3,6 +3,7 @@ */ /obj/item/fireaxe // DEM AXES MAN, marker -Agouri icon_state = "fireaxe0" + base_icon_state = "fireaxe" lefthand_file = 'icons/mob/inhands/weapons/axes_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/axes_righthand.dmi' name = "fire axe" @@ -28,7 +29,7 @@ /obj/item/fireaxe/ComponentInitialize() . = ..() AddComponent(/datum/component/butchering, 100, 80, 0 , hitsound) //axes are not known for being precision butchering tools - AddComponent(/datum/component/two_handed, force_unwielded=5, force_wielded=24, icon_wielded="fireaxe1") + AddComponent(/datum/component/two_handed, force_unwielded=5, force_wielded=24, icon_wielded="[base_icon_state]1") /// triggered on wield of two handed item /obj/item/fireaxe/proc/on_wield(obj/item/source, mob/user) @@ -43,7 +44,8 @@ wielded = FALSE /obj/item/fireaxe/update_icon_state() - icon_state = "fireaxe0" + icon_state = "[base_icon_state]0" + return ..() /obj/item/fireaxe/afterattack(atom/A, mob/user, proximity) . = ..() @@ -59,13 +61,12 @@ */ /obj/item/fireaxe/boneaxe // Blatant imitation of the fireaxe, but made out of bone. icon_state = "bone_axe0" + base_icon_state = "bone_axe" name = "bone axe" desc = "A large, vicious axe crafted out of several sharpened bone plates and crudely tied together. Made of monsters, by killing monsters, for killing monsters." icon = 'icons/obj/items_and_weapons.dmi' /obj/item/fireaxe/boneaxe/ComponentInitialize() . = ..() - AddComponent(/datum/component/two_handed, force_unwielded=5, force_wielded=23, icon_wielded="bone_axe1") + AddComponent(/datum/component/two_handed, force_unwielded=5, force_wielded=23, icon_wielded="[base_icon_state]1") -/obj/item/fireaxe/boneaxe/update_icon_state() - icon_state = "bone_axe0" diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm index d52788bb9000..7412c1892676 100644 --- a/code/game/objects/items/flamethrower.dm +++ b/code/game/objects/items/flamethrower.dm @@ -60,6 +60,7 @@ /obj/item/flamethrower/update_icon_state() item_state = "flamethrower_[lit]" + return ..() /obj/item/flamethrower/update_overlays() . = ..() @@ -104,7 +105,7 @@ else if(W.tool_behaviour == TOOL_SCREWDRIVER && igniter && !lit) status = !status to_chat(user, "[igniter] is now [status ? "secured" : "unsecured"]!") - update_icon() + update_appearance() return else if(isigniter(W)) @@ -116,7 +117,7 @@ if(!user.transferItemToLoc(W, src)) return igniter = I - update_icon() + update_appearance() return else if(istype(W, /obj/item/reagent_containers) && !(W.item_flags & ABSTRACT) && W.is_open_container()) @@ -129,7 +130,7 @@ if(!user.transferItemToLoc(W, src)) return beaker = W - update_icon() + update_appearance() return else @@ -144,7 +145,7 @@ user.put_in_hands(beaker) beaker = null to_chat(user, "You remove the fuel container from [src]!") - update_icon() + update_appearance() /obj/item/flamethrower/examine(mob/user) . = ..() @@ -170,7 +171,7 @@ playsound(loc, deac_sound, 50, TRUE) STOP_PROCESSING(SSobj,src) set_light_on(lit) - update_icon() + update_appearance() /obj/item/flamethrower/CheckParts(list/parts_list) ..() @@ -179,7 +180,7 @@ weldtool.status = FALSE igniter.secured = FALSE status = TRUE - update_icon() + update_appearance() #define REQUIRED_POWER_TO_FIRE_FLAMETHROWER 10 #define FLAMETHROWER_POWER_MULTIPLIER 0.5 @@ -268,7 +269,7 @@ if(create_with_tank) beaker = new /obj/item/reagent_containers/glass/beaker/large(src) beaker.reagents.add_reagent(/datum/reagent/fuel, beaker.reagents.maximum_volume) - update_icon() + update_appearance() /obj/item/flamethrower/full icon = 'icons/obj/guns/48x32guns.dmi' @@ -277,6 +278,7 @@ /obj/item/flamethrower/full/update_icon_state() item_state = "prebuilt_flamethrower_[lit]" + return ..() /obj/item/flamethrower/full/tank create_with_tank = TRUE diff --git a/code/game/objects/items/grenades/discogrenade.dm b/code/game/objects/items/grenades/discogrenade.dm index 7791ecf1b177..181feff62147 100644 --- a/code/game/objects/items/grenades/discogrenade.dm +++ b/code/game/objects/items/grenades/discogrenade.dm @@ -83,7 +83,7 @@ lightcolor = random_color() set_light(range, power, lightcolor) add_atom_colour("#[lightcolor]", FIXED_COLOUR_PRIORITY) - update_icon() + update_appearance() timerID = addtimer(CALLBACK(src, .proc/randomiseLightColor), 2, TIMER_STOPPABLE) /obj/item/grenade/discogrenade/subgrenade/proc/forcedance(turf/target_turf , mob/living/carbon/human/target) diff --git a/code/game/objects/items/grenades/festive.dm b/code/game/objects/items/grenades/festive.dm index cedcb23dcca6..bffc31db28fd 100644 --- a/code/game/objects/items/grenades/festive.dm +++ b/code/game/objects/items/grenades/festive.dm @@ -35,7 +35,7 @@ damtype = "fire" START_PROCESSING(SSobj, src) playsound(src, 'sound/effects/fuse.ogg', 20, TRUE) - update_icon() + update_appearance() /obj/item/sparkler/process() burntime-- @@ -92,7 +92,7 @@ to_chat(user, "You shorten the fuse of [src] with [I].") playsound(src, 'sound/items/wirecutter.ogg', 20, TRUE) icon_state = initial(icon_state) + "_[det_time]" - update_icon() + update_appearance() else to_chat(user, "You've already removed all of the fuse!") diff --git a/code/game/objects/items/handcuffs.dm b/code/game/objects/items/handcuffs.dm index e966176c3d5a..764bf8a61ccd 100644 --- a/code/game/objects/items/handcuffs.dm +++ b/code/game/objects/items/handcuffs.dm @@ -122,9 +122,9 @@ cable_color = param_color || cable_color || pick(cable_colors) if(cable_colors[cable_color]) cable_color = cable_colors[cable_color] - update_icon() + update_appearance() -/obj/item/restraints/handcuffs/cable/update_icon() +/obj/item/restraints/handcuffs/cable/update_appearance() color = null add_atom_colour(cable_color, FIXED_COLOUR_PRIORITY) */ @@ -237,7 +237,7 @@ /obj/item/restraints/legcuffs/beartrap/Initialize() . = ..() - update_icon() + update_appearance() var/static/list/loc_connections = list( COMSIG_ATOM_ENTERED = .proc/on_entered, @@ -246,18 +246,19 @@ /obj/item/restraints/legcuffs/beartrap/update_icon_state() icon_state = "[initial(icon_state)][armed]" + return ..() /obj/item/restraints/legcuffs/beartrap/attack_self(mob/user) . = ..() if(!ishuman(user) || user.stat != CONSCIOUS || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) return armed = !armed - update_icon() + update_appearance() to_chat(user, "[src] is now [armed ? "armed" : "disarmed"]") /obj/item/restraints/legcuffs/beartrap/proc/close_trap() armed = FALSE - update_icon() + update_appearance() playsound(src, 'sound/effects/snap.ogg', 50, TRUE) /obj/item/restraints/legcuffs/beartrap/proc/on_entered(datum/source, AM as mob|obj) diff --git a/code/game/objects/items/hot_potato.dm b/code/game/objects/items/hot_potato.dm index ac238a85a336..915c7e36cc90 100644 --- a/code/game/objects/items/hot_potato.dm +++ b/code/game/objects/items/hot_potato.dm @@ -134,7 +134,7 @@ /obj/item/hot_potato/proc/activate(delay, mob/user) if(active) return - update_icon() + update_appearance() if(sticky) ADD_TRAIT(src, TRAIT_NODROP, HOT_POTATO_TRAIT) name = "primed [name]" @@ -148,7 +148,7 @@ active = TRUE /obj/item/hot_potato/proc/deactivate() - update_icon() + update_appearance() name = initial(name) REMOVE_TRAIT(src, TRAIT_NODROP, HOT_POTATO_TRAIT) deltimer(detonation_timerid) @@ -158,7 +158,8 @@ active = FALSE /obj/item/hot_potato/update_icon_state() - icon_state = active? icon_on : icon_off + icon_state = active ? icon_on : icon_off + return ..() /obj/item/hot_potato/syndicate detonate_light_range = 4 diff --git a/code/game/objects/items/hourglass.dm b/code/game/objects/items/hourglass.dm index f4997089c685..acfe971b0337 100644 --- a/code/game/objects/items/hourglass.dm +++ b/code/game/objects/items/hourglass.dm @@ -30,10 +30,8 @@ stop() /obj/item/hourglass/update_icon_state() - if(timing_id) - icon_state = "hourglass_active" - else - icon_state = "hourglass_idle" + icon_state = "hourglass_[timing_id ? "active" : "idle"]" + return ..() /obj/item/hourglass/proc/start() finish_time = world.time + time @@ -54,7 +52,7 @@ countdown.stop() finish_time = null animate(src) - update_icon() + update_appearance() /obj/item/hourglass/proc/finish() visible_message("[src] stops.") diff --git a/code/game/objects/items/implants/implantcase.dm b/code/game/objects/items/implants/implantcase.dm index 70baa76a7fe6..23f7aec9b199 100644 --- a/code/game/objects/items/implants/implantcase.dm +++ b/code/game/objects/items/implants/implantcase.dm @@ -15,10 +15,8 @@ /obj/item/implantcase/update_icon_state() - if(imp) - icon_state = "implantcase-[imp.implant_color]" - else - icon_state = "implantcase-0" + icon_state = "implantcase-[imp ? imp.implant_color : 0]" + return ..() /obj/item/implantcase/attackby(obj/item/W, mob/user, params) @@ -43,9 +41,9 @@ I.imp.forceMove(src) imp = I.imp I.imp = null - update_icon() + update_appearance() reagents = imp.reagents - I.update_icon() + I.update_appearance() else if(imp) if(I.imp) @@ -54,8 +52,8 @@ I.imp = imp imp = null reagents = null - update_icon() - I.update_icon() + update_appearance() + I.update_appearance() else return ..() @@ -64,7 +62,7 @@ . = ..() if(imp_type) imp = new imp_type(src) - update_icon() + update_appearance() reagents = imp.reagents diff --git a/code/game/objects/items/implants/implantchair.dm b/code/game/objects/items/implants/implantchair.dm index bac1528e3da1..e8122bd34263 100644 --- a/code/game/objects/items/implants/implantchair.dm +++ b/code/game/objects/items/implants/implantchair.dm @@ -24,7 +24,7 @@ /obj/machinery/implantchair/Initialize() . = ..() open_machine() - update_icon() + update_appearance() /obj/machinery/implantchair/ui_state(mob/user) return GLOB.notcontained_state @@ -83,7 +83,7 @@ addtimer(CALLBACK(src,.proc/set_ready),injection_cooldown) else playsound(get_turf(src), 'sound/machines/buzz-sigh.ogg', 25, TRUE) - update_icon() + update_appearance() /obj/machinery/implantchair/proc/implant_action(mob/living/M) var/obj/item/I = new implant_type @@ -104,6 +104,7 @@ icon_state += "_open" if(occupant) icon_state += "_occupied" + return ..() /obj/machinery/implantchair/update_overlays() . = ..() @@ -120,7 +121,7 @@ /obj/machinery/implantchair/proc/set_ready() ready = TRUE - update_icon() + update_appearance() /obj/machinery/implantchair/container_resist_act(mob/living/user) user.changeNext_move(CLICK_CD_BREAKOUT) diff --git a/code/game/objects/items/implants/implanter.dm b/code/game/objects/items/implants/implanter.dm index 6731673d1c16..5b8db550a87d 100644 --- a/code/game/objects/items/implants/implanter.dm +++ b/code/game/objects/items/implants/implanter.dm @@ -15,10 +15,8 @@ /obj/item/implanter/update_icon_state() - if(imp) - icon_state = "implanter1" - else - icon_state = "implanter0" + icon_state = "implanter[imp ? 1 : 0]" + return ..() /obj/item/implanter/attack(mob/living/M, mob/user) @@ -37,7 +35,7 @@ else M.visible_message("[user] implants [M].", "[user] implants you.") imp = null - update_icon() + update_appearance() else to_chat(user, "[src] fails to implant [M].") @@ -62,4 +60,4 @@ . = ..() if(imp_type) imp = new imp_type(src) - update_icon() + update_appearance() diff --git a/code/game/objects/items/implants/implantpad.dm b/code/game/objects/items/implants/implantpad.dm index 13d1a5302726..37667786262f 100644 --- a/code/game/objects/items/implants/implantpad.dm +++ b/code/game/objects/items/implants/implantpad.dm @@ -13,6 +13,7 @@ /obj/item/implantpad/update_icon_state() icon_state = "implantpad-[!QDELETED(case)]" + return ..() /obj/item/implantpad/examine(mob/user) . = ..() @@ -27,7 +28,7 @@ /obj/item/implantpad/handle_atom_del(atom/A) if(A == case) case = null - update_icon() + update_appearance() updateSelfDialog() . = ..() @@ -46,7 +47,7 @@ case = null updateSelfDialog() - update_icon() + update_appearance() /obj/item/implantpad/attackby(obj/item/implantcase/C, mob/user, params) if(istype(C, /obj/item/implantcase) && !case) @@ -54,7 +55,7 @@ return case = C updateSelfDialog() - update_icon() + update_appearance() else return ..() diff --git a/code/game/objects/items/inducer.dm b/code/game/objects/items/inducer.dm index 7ba7217c1d6d..4f4a088f8a7c 100644 --- a/code/game/objects/items/inducer.dm +++ b/code/game/objects/items/inducer.dm @@ -22,8 +22,8 @@ var/totransfer = min(cell.charge,(powertransfer * coefficient)) var/transferred = target.give(totransfer) cell.use(transferred) - cell.update_icon() - target.update_icon() + cell.update_appearance() + target.update_appearance() /obj/item/inducer/get_cell() return cell @@ -66,12 +66,12 @@ if(!opened) to_chat(user, "You unscrew the battery compartment.") opened = TRUE - update_icon() + update_appearance() return else to_chat(user, "You close the battery compartment.") opened = FALSE - update_icon() + update_appearance() return if(istype(W, /obj/item/stock_parts/cell)) if(opened) @@ -80,7 +80,7 @@ return to_chat(user, "You insert [W] into [src].") cell = W - update_icon() + update_appearance() return else to_chat(user, "[src] already has \a [cell] installed!") @@ -122,7 +122,7 @@ induce(C, coefficient) do_sparks(1, FALSE, A) if(O) - O.update_icon() + O.update_appearance() else break if(done_any) // Only show a message if we succeeded at least once @@ -147,10 +147,10 @@ /obj/item/inducer/attack_self(mob/user) if(opened && cell) user.visible_message("[user] removes [cell] from [src]!", "You remove [cell].") - cell.update_icon() + cell.update_appearance() user.put_in_hands(cell) cell = null - update_icon() + update_appearance() /obj/item/inducer/examine(mob/living/M) @@ -164,11 +164,9 @@ /obj/item/inducer/update_overlays() . = ..() - if(opened) - if(!cell) - . += "inducer-nobat" - else - . += "inducer-bat" + if(!opened) + return + . += "inducer-[cell ? "bat" : "nobat"]" /obj/item/inducer/sci icon_state = "inducer-sci" @@ -180,7 +178,7 @@ /obj/item/inducer/sci/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/inducer/syndicate icon_state = "inducer-syndi" diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm index 71d789178f12..16404d1d13bd 100644 --- a/code/game/objects/items/melee/misc.dm +++ b/code/game/objects/items/melee/misc.dm @@ -505,14 +505,14 @@ held_sausage = target else to_chat(user, "[target] doesn't seem to want to get on [src]!") - update_icon() + update_appearance() /obj/item/melee/roastingstick/attack_hand(mob/user) ..() if (held_sausage) user.put_in_hands(held_sausage) held_sausage = null - update_icon() + update_appearance() /obj/item/melee/roastingstick/update_overlays() . = ..() @@ -534,7 +534,7 @@ /obj/item/melee/roastingstick/handle_atom_del(atom/target) if (target == held_sausage) held_sausage = null - update_icon() + update_appearance() /obj/item/melee/roastingstick/afterattack(atom/target, mob/user, proximity) . = ..() @@ -565,7 +565,7 @@ held_sausage.add_atom_colour(rgb(103,63,24), FIXED_COLOUR_PRIORITY) held_sausage.name = "[target.name]-roasted [held_sausage.name]" held_sausage.desc = "[held_sausage.desc] It has been cooked to perfection on \a [target]." - update_icon() + update_appearance() /obj/item/melee/cleric_mace name = "cleric mace" @@ -736,7 +736,7 @@ playsound(user, dash_sound, 25, TRUE) user.visible_message("[user] swiftly draws \the [I].", "You draw \the [I].") user.put_in_hands(I) - update_icon() + update_appearance() else to_chat(user, "[src] is empty!") @@ -750,13 +750,13 @@ playsound(user, 'sound/items/sheath.ogg', 25, TRUE) to_chat(user, "You return your stance.") primed = FALSE - update_icon() + update_appearance() else CP.locked = TRUE //Prevents normal removal of the blade while primed playsound(user, 'sound/items/unsheath.ogg', 25, TRUE) user.visible_message("[user] grips the blade within [src] and primes to attack.", "You take an opening stance...", "You hear a weapon being drawn...") primed = TRUE - update_icon() + update_appearance() else to_chat(user, "[src] is empty!") @@ -772,7 +772,7 @@ var/datum/component/storage/CP = GetComponent(/datum/component/storage) CP.locked = FALSE primed = FALSE - update_icon() + update_appearance() primed_attack(A, user) if(CanReach(A, I)) I.melee_attack_chain(user, A, params) @@ -816,6 +816,7 @@ else icon_state += "-blade" item_state += "-sabre" + return ..() /obj/item/storage/belt/weebstick/PopulateContents() //Time to generate names now that we have the sword @@ -824,4 +825,4 @@ var/obj/item/melee/weebstick/sword = new /obj/item/melee/weebstick(src) sword.name = "[n_title] blade of clan [n_name]" name = "[n_title] scabbard of clan [n_name]" - update_icon() + update_appearance() diff --git a/code/game/objects/items/mop.dm b/code/game/objects/items/mop.dm index 5abda1a6ba56..3f8d0210442d 100644 --- a/code/game/objects/items/mop.dm +++ b/code/game/objects/items/mop.dm @@ -73,7 +73,7 @@ if(insertable) J.put_in_cart(src, user) J.mymop=src - J.update_icon() + J.update_appearance() else to_chat(user, "You are unable to fit your [name] into the [J.name].") return diff --git a/code/game/objects/items/pet_carrier.dm b/code/game/objects/items/pet_carrier.dm index 00ba8536ba34..d9311f5e2b43 100644 --- a/code/game/objects/items/pet_carrier.dm +++ b/code/game/objects/items/pet_carrier.dm @@ -68,7 +68,7 @@ to_chat(user, "You open [src]'s door.") playsound(user, 'sound/effects/bin_open.ogg', 50, TRUE) open = TRUE - update_icon() + update_appearance() /obj/item/pet_carrier/AltClick(mob/living/user) if(open || !user.canUseTopic(src, BE_CLOSE)) @@ -79,7 +79,7 @@ playsound(user, 'sound/machines/boltsdown.ogg', 30, TRUE) else playsound(user, 'sound/machines/boltsup.ogg', 30, TRUE) - update_icon() + update_appearance() /obj/item/pet_carrier/attack(mob/living/target, mob/living/user) if(user.a_intent == INTENT_HARM) @@ -108,7 +108,7 @@ loc.visible_message("[user] pushes open the door to [src]!", \ "[user] pushes open the door of [src]!") open = TRUE - update_icon() + update_appearance() return else if(user.client) container_resist_act(user) @@ -125,7 +125,7 @@ to_chat(user, "Bingo! The lock pops open!") locked = FALSE playsound(src, 'sound/machines/boltsup.ogg', 30, TRUE) - update_icon() + update_appearance() else loc.visible_message("[src] starts rattling as something pushes against the door!", null, null, null, user) to_chat(user, "You start pushing out of [src]... (This will take about 20 seconds.)") @@ -135,14 +135,15 @@ to_chat(user, "You shove open [src]'s door against the lock's resistance and fall out!") locked = FALSE open = TRUE - update_icon() + update_appearance() remove_occupant(user) /obj/item/pet_carrier/update_icon_state() if(open) icon_state = initial(icon_state) - else - icon_state = "pet_carrier_[!occupants.len ? "closed" : "occupied"]" + return ..() + icon_state = "pet_carrier_[!occupants.len ? "closed" : "occupied"]" + return ..() /obj/item/pet_carrier/update_overlays() . = ..() diff --git a/code/game/objects/items/pinpointer.dm b/code/game/objects/items/pinpointer.dm index b886e8d81ed0..12f91f99fb8c 100644 --- a/code/game/objects/items/pinpointer.dm +++ b/code/game/objects/items/pinpointer.dm @@ -47,14 +47,14 @@ else target = null STOP_PROCESSING(SSfastprocess, src) - update_icon() + update_appearance() /obj/item/pinpointer/process() if(!active) return PROCESS_KILL if(process_scan) scan_for_target() - update_icon() + update_appearance() /obj/item/pinpointer/proc/scan_for_target() return diff --git a/code/game/objects/items/pitchfork.dm b/code/game/objects/items/pitchfork.dm index 3d7a0ef94fd3..401007c824b0 100644 --- a/code/game/objects/items/pitchfork.dm +++ b/code/game/objects/items/pitchfork.dm @@ -1,5 +1,6 @@ /obj/item/pitchfork icon_state = "pitchfork0" + base_icon_state = "pitchfork" lefthand_file = 'icons/mob/inhands/weapons/polearms_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/polearms_righthand.dmi' name = "pitchfork" @@ -22,7 +23,7 @@ /obj/item/pitchfork/ComponentInitialize() . = ..() - AddComponent(/datum/component/two_handed, force_unwielded=7, force_wielded=15, icon_wielded="pitchfork1") + AddComponent(/datum/component/two_handed, force_unwielded=7, force_wielded=15, icon_wielded="[base_icon_state]1") /// triggered on wield of two handed item /obj/item/pitchfork/proc/on_wield(obj/item/source, mob/user) @@ -37,7 +38,8 @@ wielded = FALSE /obj/item/pitchfork/update_icon_state() - icon_state = "pitchfork0" + icon_state = "[base_icon_state]0" + return ..() /obj/item/pitchfork/demonic name = "demonic pitchfork" diff --git a/code/game/objects/items/plushes.dm b/code/game/objects/items/plushes.dm index a7f75f2a695b..e2461af4175a 100644 --- a/code/game/objects/items/plushes.dm +++ b/code/game/objects/items/plushes.dm @@ -254,7 +254,7 @@ vowbroken = TRUE mood_message = pick(vowbroken_message) - update_plush_desc() + update_desc() /obj/item/toy/plush/proc/scorned_by(obj/item/toy/plush/Outmoded) scorned_by.Add(Outmoded) @@ -268,7 +268,7 @@ lover.cheer_up() mood_message = pick(love_message) - update_plush_desc() + update_desc() if(partner) //who? partner = null //more like who cares @@ -285,7 +285,7 @@ partner.heal_memories() mood_message = pick(partner_message) - update_plush_desc() + update_desc() /obj/item/toy/plush/proc/plop(obj/item/toy/plush/Daddy) if(partner != Daddy) @@ -310,12 +310,12 @@ young = TRUE name = "[Mama] Jr" //Icelandic naming convention pending normal_desc = "[src] is a little baby of [maternal_parent] and [paternal_parent]!" //original desc won't be used so the child can have moods - update_plush_desc() + update_desc() Mama.mood_message = pick(Mama.parent_message) - Mama.update_plush_desc() + Mama.update_desc() Dada.mood_message = pick(Dada.parent_message) - Dada.update_plush_desc() + Dada.update_desc() /obj/item/toy/plush/proc/bad_news(obj/item/toy/plush/Deceased) //cotton to cotton, sawdust to sawdust var/is_that_letter_for_me = FALSE @@ -354,7 +354,7 @@ if(is_that_letter_for_me) heartbroken = TRUE mood_message = pick(heartbroken_message) - update_plush_desc() + update_desc() /obj/item/toy/plush/proc/cheer_up() //it'll be all right if(!heartbroken) @@ -366,7 +366,7 @@ if(mood_message in heartbroken_message) mood_message = null - update_plush_desc() + update_desc() /obj/item/toy/plush/proc/heal_memories() //time fixes all wounds if(!vowbroken) @@ -375,8 +375,9 @@ mood_message = null cheer_up() -/obj/item/toy/plush/proc/update_plush_desc() +/obj/item/toy/plush/update_desc() desc = normal_desc + . = ..() if(mood_message) desc += mood_message diff --git a/code/game/objects/items/pneumaticCannon.dm b/code/game/objects/items/pneumaticCannon.dm index d49bf239d890..060e59f0f5de 100644 --- a/code/game/objects/items/pneumaticCannon.dm +++ b/code/game/objects/items/pneumaticCannon.dm @@ -229,7 +229,7 @@ loadedWeightClass-- else if (A == tank) tank = null - update_icon() + update_appearance() /obj/item/pneumatic_cannon/ghetto //Obtainable by improvised methods; more gas per use, less capacity name = "improvised pneumatic cannon" @@ -254,7 +254,7 @@ return to_chat(user, "You hook \the [thetank] up to \the [src].") tank = thetank - update_icon() + update_appearance() /obj/item/pneumatic_cannon/update_overlays() . = ..() diff --git a/code/game/objects/items/puzzle_pieces.dm b/code/game/objects/items/puzzle_pieces.dm index 77440f89b7ee..2582f91860b2 100644 --- a/code/game/objects/items/puzzle_pieces.dm +++ b/code/game/objects/items/puzzle_pieces.dm @@ -150,8 +150,10 @@ /obj/machinery/door/keycard/gates/update_icon_state() if(density) icon_state = "closed" + return ..() else icon_state = "open" + return ..() /obj/machinery/door/keycard/gates/drakelair puzzle_id = "drakelairkey" diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm index 91dcf5f25e0d..47a4120061b4 100644 --- a/code/game/objects/items/robot/robot_items.dm +++ b/code/game/objects/items/robot/robot_items.dm @@ -155,6 +155,7 @@ /obj/item/borg/charger/update_icon_state() icon_state = "charger_[mode]" + return ..() /obj/item/borg/charger/attack_self(mob/user) if(mode == "draw") @@ -162,7 +163,7 @@ else mode = "draw" to_chat(user, "You toggle [src] to \"[mode]\" mode.") - update_icon() + update_appearance() /obj/item/borg/charger/afterattack(obj/item/target, mob/living/silicon/robot/user, proximity_flag) . = ..() @@ -225,7 +226,7 @@ break if(!user.cell.give(draw)) break - target.update_icon() + target.update_appearance() to_chat(user, "You stop charging yourself.") @@ -263,7 +264,7 @@ break if(!cell.give(draw)) break - target.update_icon() + target.update_appearance() to_chat(user, "You stop charging [target].") @@ -589,11 +590,12 @@ to_chat(user, "[src]'s safety cutoff prevents you from activating it due to living beings being ontop of you!") else deactivate_field() - update_icon() + update_appearance() to_chat(user, "You [active? "activate":"deactivate"] [src].") /obj/item/borg/projectile_dampen/update_icon_state() icon_state = "[initial(icon_state)][active]" + return ..() /obj/item/borg/projectile_dampen/proc/activate_field() if(istype(dampening_field)) @@ -771,7 +773,7 @@ if(A == stored) //sanity check UnregisterSignal(stored, COMSIG_ATOM_UPDATE_ICON) stored = null - update_icon() + update_appearance() . = ..() ///A right-click verb, for those not using hotkey mode. @@ -803,14 +805,19 @@ var/obj/item/O = A O.forceMove(src) stored = O - RegisterSignal(stored, COMSIG_ATOM_UPDATE_ICON, /atom/.proc/update_icon) - update_icon() + RegisterSignal(stored, COMSIG_ATOM_UPDATE_ICON, .proc/on_update_icon) + update_appearance() return else stored.melee_attack_chain(user, A, params) return . = ..() +/// Exists to eat signal args +/obj/item/borg/apparatus/proc/on_update_icon(datum/source, updates) + SIGNAL_HANDLER + return on_update_icon(updates) + /obj/item/borg/apparatus/attackby(obj/item/W, mob/user, params) if(stored) W.melee_attack_chain(user, stored, params) @@ -831,8 +838,8 @@ /obj/item/borg/apparatus/beaker/Initialize() . = ..() stored = new /obj/item/reagent_containers/glass/beaker/large(src) - RegisterSignal(stored, COMSIG_ATOM_UPDATE_ICON, /atom/.proc/update_icon) - update_icon() + RegisterSignal(stored, COMSIG_ATOM_UPDATE_ICON, .proc/on_update_icon) + update_appearance() /obj/item/borg/apparatus/beaker/Destroy() if(stored) @@ -891,8 +898,8 @@ /obj/item/borg/apparatus/beaker/service/Initialize() . = ..() stored = new /obj/item/reagent_containers/food/drinks/drinkingglass(src) - RegisterSignal(stored, COMSIG_ATOM_UPDATE_ICON, /atom/.proc/update_icon) - update_icon() + RegisterSignal(stored, COMSIG_ATOM_UPDATE_ICON, .proc/on_update_icon) + update_appearance() //////////////////// //engi part holder// @@ -907,7 +914,7 @@ /obj/item/borg/apparatus/circuit/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/borg/apparatus/circuit/update_overlays() . = ..() diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index de37c06316a9..3194c1302512 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -34,7 +34,7 @@ /obj/item/robot_suit/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/robot_suit/prebuilt/Initialize() . = ..() @@ -48,7 +48,7 @@ chest = new(src) chest.wired = TRUE chest.cell = new /obj/item/stock_parts/cell/high/plus(chest) - update_icon() + update_appearance() /obj/item/robot_suit/update_overlays() . = ..() @@ -108,7 +108,7 @@ to_chat(user, "You disassemble the cyborg shell.") else to_chat(user, "There is nothing to remove from the endoskeleton!") - update_icon() + update_appearance() /obj/item/robot_suit/proc/put_in_hand_or_drop(mob/living/user, obj/item/I) //normal put_in_hands() drops the item ontop of the player, this drops it at the suit's loc if(!user.put_in_hands(I)) @@ -172,7 +172,7 @@ W.icon_state = initial(W.icon_state) W.cut_overlays() l_leg = W - update_icon() + update_appearance() else if(istype(W, /obj/item/bodypart/leg/right/robot)) if(src.r_leg) @@ -182,7 +182,7 @@ W.icon_state = initial(W.icon_state) W.cut_overlays() r_leg = W - update_icon() + update_appearance() else if(istype(W, /obj/item/bodypart/l_arm/robot)) if(l_arm) @@ -192,7 +192,7 @@ W.icon_state = initial(W.icon_state) W.cut_overlays() l_arm = W - update_icon() + update_appearance() else if(istype(W, /obj/item/bodypart/r_arm/robot)) if(r_arm) @@ -202,7 +202,7 @@ W.icon_state = initial(W.icon_state)//in case it is a dismembered robotic limb W.cut_overlays() r_arm = W - update_icon() + update_appearance() else if(istype(W, /obj/item/bodypart/chest/robot)) var/obj/item/bodypart/chest/robot/CH = W @@ -214,7 +214,7 @@ CH.icon_state = initial(CH.icon_state) //in case it is a dismembered robotic limb CH.cut_overlays() chest = CH - update_icon() + update_appearance() else if(!CH.wired) to_chat(user, "You need to attach wires to it first!") else @@ -234,7 +234,7 @@ HD.icon_state = initial(HD.icon_state)//in case it is a dismembered robotic limb HD.cut_overlays() head = HD - update_icon() + update_appearance() else to_chat(user, "You need to attach a flash to it first!") diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index bf583e0d7caa..e87691b651a9 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -316,16 +316,17 @@ icon_state = "selfrepair_[on ? "on" : "off"]" else icon_state = "cyborg_upgrade5" + return ..() /obj/item/borg/upgrade/selfrepair/proc/activate_sr() START_PROCESSING(SSobj, src) on = TRUE - update_icon() + update_appearance() /obj/item/borg/upgrade/selfrepair/proc/deactivate_sr() STOP_PROCESSING(SSobj, src) on = FALSE - update_icon() + update_appearance() /obj/item/borg/upgrade/selfrepair/process() if(!repair_tick) diff --git a/code/game/objects/items/sharpener.dm b/code/game/objects/items/sharpener.dm index 8b74e8ba23f1..f9d429b55a3e 100644 --- a/code/game/objects/items/sharpener.dm +++ b/code/game/objects/items/sharpener.dm @@ -45,7 +45,7 @@ name = "worn out [name]" desc = "[desc] At least, it used to." used = 1 - update_icon() + update_appearance() /obj/item/sharpener/super name = "super whetstone" diff --git a/code/game/objects/items/shields.dm b/code/game/objects/items/shields.dm index 3b8d887e818a..685bfeae8a8a 100644 --- a/code/game/objects/items/shields.dm +++ b/code/game/objects/items/shields.dm @@ -137,17 +137,17 @@ /obj/item/shield/riot/flash/attack(mob/living/M, mob/user) . = embedded_flash.attack(M, user) - update_icon() + update_appearance() /obj/item/shield/riot/flash/attack_self(mob/living/carbon/user) . = embedded_flash.attack_self(user) - update_icon() + update_appearance() /obj/item/shield/riot/flash/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) . = ..() if (. && !embedded_flash.burnt_out) embedded_flash.activate() - update_icon() + update_appearance() /obj/item/shield/riot/flash/attackby(obj/item/W, mob/user) @@ -165,14 +165,14 @@ qdel(embedded_flash) embedded_flash = flash flash.forceMove(src) - update_icon() + update_appearance() return ..() /obj/item/shield/riot/flash/emp_act(severity) . = ..() embedded_flash.emp_act(severity) - update_icon() + update_appearance() /obj/item/shield/riot/flash/update_icon_state() if(!embedded_flash || embedded_flash.burnt_out) @@ -181,6 +181,7 @@ else icon_state = "flashshield" item_state = "flashshield" + return ..() /obj/item/shield/riot/flash/examine(mob/user) . = ..() diff --git a/code/game/objects/items/singularityhammer.dm b/code/game/objects/items/singularityhammer.dm index 63dd64031258..e2803060e4eb 100644 --- a/code/game/objects/items/singularityhammer.dm +++ b/code/game/objects/items/singularityhammer.dm @@ -2,6 +2,7 @@ name = "singularity hammer" desc = "The pinnacle of close combat technology, the hammer harnesses the power of a miniaturized singularity to deal crushing blows." icon_state = "singularity0" + base_icon_state = "singularity_hammer" lefthand_file = 'icons/mob/inhands/weapons/hammers_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/hammers_righthand.dmi' flags_1 = CONDUCT_1 @@ -24,7 +25,7 @@ /obj/item/singularityhammer/ComponentInitialize() . = ..() - AddComponent(/datum/component/two_handed, force_multiplier=4, icon_wielded="singularity1") + AddComponent(/datum/component/two_handed, force_multiplier=4, icon_wielded="[base_icon_state]1") /// triggered on wield of two handed item /obj/item/singularityhammer/proc/on_wield(obj/item/source, mob/user) @@ -39,7 +40,8 @@ wielded = FALSE /obj/item/singularityhammer/update_icon_state() - icon_state = "singularity0" + icon_state = "[base_icon_state]0" + return ..() /obj/item/singularityhammer/Destroy() STOP_PROCESSING(SSobj, src) @@ -88,6 +90,7 @@ name = "Mjolnir" desc = "A weapon worthy of a god, able to strike with the force of a lightning bolt. It crackles with barely contained energy." icon_state = "mjollnir0" + base_icon_state = "mjollnir" lefthand_file = 'icons/mob/inhands/weapons/hammers_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/hammers_righthand.dmi' flags_1 = CONDUCT_1 @@ -105,7 +108,7 @@ /obj/item/mjollnir/ComponentInitialize() . = ..() - AddComponent(/datum/component/two_handed, force_multiplier=5, icon_wielded="mjollnir1", attacksound="sparks") + AddComponent(/datum/component/two_handed, force_multiplier=5, icon_wielded="[base_icon_state]1", attacksound="sparks") /// triggered on wield of two handed item /obj/item/mjollnir/proc/on_wield(obj/item/source, mob/user) @@ -116,7 +119,8 @@ wielded = FALSE /obj/item/mjollnir/update_icon_state() - icon_state = "mjollnir0" + icon_state = "[base_icon_state]0" + return ..() /obj/item/mjollnir/proc/shock(mob/living/target) target.Stun(60) diff --git a/code/game/objects/items/spear.dm b/code/game/objects/items/spear.dm index 2b1b7df9d89c..e5ea0b1b8229 100644 --- a/code/game/objects/items/spear.dm +++ b/code/game/objects/items/spear.dm @@ -30,6 +30,7 @@ /obj/item/spear/update_icon_state() icon_state = "[icon_prefix]0" + return ..() /obj/item/spear/CheckParts(list/parts_list) var/obj/item/shard/tip = locate() in parts_list @@ -37,12 +38,15 @@ throwforce = 21 icon_prefix = "spearplasma" AddComponent(/datum/component/two_handed, force_unwielded=11, force_wielded=19, icon_wielded="[icon_prefix]1") - update_icon() + update_appearance() qdel(tip) ..() /obj/item/spear/explosive name = "explosive lance" + icon_state = "spearbomb0" + base_icon_state = "spearbomb" + icon_prefix = "spearbomb" var/obj/item/grenade/explosive = null var/wielded = FALSE // track wielded status on item @@ -54,7 +58,7 @@ /obj/item/spear/explosive/ComponentInitialize() . = ..() - AddComponent(/datum/component/two_handed, force_unwielded=10, force_wielded=18, icon_wielded="spearbomb1") + AddComponent(/datum/component/two_handed, force_unwielded=10, force_wielded=18, icon_wielded="[icon_prefix]1") /// triggered on wield of two handed item /obj/item/spear/explosive/proc/on_wield(obj/item/source, mob/user) @@ -68,9 +72,6 @@ wielded = FALSE -/obj/item/spear/explosive/update_icon_state() - icon_state = "spearbomb0" - /obj/item/spear/explosive/proc/set_explosive(obj/item/grenade/G) if(explosive) QDEL_NULL(explosive) @@ -149,6 +150,8 @@ /obj/item/spear/bonespear //Blatant imitation of spear, but made out of bone. Not valid for explosive modification. icon_state = "bone_spear0" name = "bone spear" + base_icon_state = "bone_spear0" + icon_prefix = "bone_spear" desc = "A haphazardly-constructed yet still deadly weapon. The pinnacle of modern technology." icon = 'icons/obj/items_and_weapons.dmi' lefthand_file = 'icons/mob/inhands/weapons/polearms_lefthand.dmi' @@ -160,11 +163,7 @@ /obj/item/spear/bonespear/ComponentInitialize() . = ..() - AddComponent(/datum/component/two_handed, force_unwielded=12, force_wielded=20, icon_wielded="bone_spear1") - -/obj/item/spear/bonespear/update_icon_state() - icon_state = "bone_spear0" - + AddComponent(/datum/component/two_handed, force_unwielded=12, force_wielded=20, icon_wielded="[icon_prefix]1") /obj/item/spear/dragonspear//version of the bone spear crafted from the trophy dropped by the Ash Drake. High damage, high ap, burns. name = "dragonslayer's spear" desc = "A bone spear crafted from the leading spine of a fully-grown drake, razor-sharp and hotter then magma. Wielded by the deranged, pyromaniacs, and champions of lavaland." @@ -178,6 +177,8 @@ armour_penetration = 30 embedding = list("impact_pain_mult" = 5) icon_prefix = "dragonspear" + base_icon_state = "dragonspear0" + icon_state = "dragonspear0" var/list/nemesis_factions = list("mining", "boss") var/faction_bonus_force = 25 attack_verb = list("seared", "braided", "impaled", "smote", "gored") @@ -207,10 +208,6 @@ . = ..() AddComponent(/datum/component/two_handed, force_unwielded=20, force_wielded=25, icon_wielded="[icon_prefix]1") AddComponent(/datum/component/butchering, 60, 150) - icon_state = "[icon_prefix]0" - -/obj/item/spear/dragonspear/update_icon_state() - icon_state = "[icon_prefix]0" /obj/item/spear/dragonspear/attack(atom/target, blocked = FALSE) if(iscarbon(target)) @@ -230,6 +227,8 @@ name = "crystal spear" desc = "While more 'sharp stick' than spear, this thing is extremely dangerous neverless. Crafted out of the mysterous crystals, it can hit for very high damage, although it will break with repeated use." icon = 'icons/obj/items_and_weapons.dmi' + base_icon_state = "crystal_spear" + icon_prefix = "crystal_spear" lefthand_file = 'icons/mob/inhands/weapons/polearms_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/polearms_righthand.dmi' mob_overlay_icon = 'icons/mob/clothing/back.dmi' @@ -241,10 +240,7 @@ /obj/item/spear/crystal/ComponentInitialize() . = ..() - AddComponent(/datum/component/two_handed, force_unwielded=12, force_wielded=30, icon_wielded="crystal_spear1") //4 hit crit - -/obj/item/spear/crystal/update_icon_state() - icon_state = "crystal_spear0" + AddComponent(/datum/component/two_handed, force_unwielded=12, force_wielded=30, icon_wielded="[icon_prefix]1") //4 hit crit /obj/item/spear/crystal/examine(mob/user) . = ..() diff --git a/code/game/objects/items/stacks/license_plates.dm b/code/game/objects/items/stacks/license_plates.dm index 06dc86ee6152..1a5cb1b05eeb 100644 --- a/code/game/objects/items/stacks/license_plates.dm +++ b/code/game/objects/items/stacks/license_plates.dm @@ -20,11 +20,13 @@ ///Override to allow for variations /obj/item/stack/license_plates/filled/update_icon_state() + . = ..() if(novariants) return if(amount <= (max_amount * (1/3))) icon_state = "filled_plate_[rand(1,6)]_1" - else if (amount <= (max_amount * (2/3))) + return + if (amount <= (max_amount * (2/3))) icon_state = "filled_plate_[rand(1,6)]_2" - else - icon_state = "filled_plate_[rand(1,6)]_3" + return + icon_state = "filled_plate_[rand(1,6)]_3" diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 31ebce35b57c..de636902eb52 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -268,13 +268,12 @@ . = ..() if(amount == max_amount) //only seal full mesh packs is_open = FALSE - update_icon() + update_appearance() /obj/item/stack/medical/mesh/update_icon_state() - if(!is_open) - icon_state = "regen_mesh_closed" - else + if(is_open) return ..() + icon_state = "regen_mesh_closed" /obj/item/stack/medical/mesh/heal(mob/living/target, mob/user) . = ..() @@ -308,7 +307,7 @@ if(!is_open) is_open = TRUE to_chat(user, "You open the sterile mesh package.") - update_icon() + update_appearance() playsound(src, 'sound/items/poster_ripped.ogg', 20, TRUE) return . = ..() @@ -324,10 +323,9 @@ grind_results = list(/datum/reagent/consumable/aloejuice = 1) /obj/item/stack/medical/mesh/advanced/update_icon_state() - if(!is_open) - icon_state = "aloe_mesh_closed" - else + if(is_open) return ..() + icon_state = "aloe_mesh_closed" /obj/item/stack/medical/aloe name = "aloe cream" diff --git a/code/game/objects/items/stacks/rods.dm b/code/game/objects/items/stacks/rods.dm index 79fb483a8c17..f0be0cdd7e81 100644 --- a/code/game/objects/items/stacks/rods.dm +++ b/code/game/objects/items/stacks/rods.dm @@ -32,13 +32,14 @@ GLOBAL_LIST_INIT(rod_recipes, list ( \ /obj/item/stack/rods/Initialize(mapload, new_amount, merge = TRUE) . = ..() - update_icon() + update_appearance() /obj/item/stack/rods/get_main_recipes() . = ..() . += GLOB.rod_recipes /obj/item/stack/rods/update_icon_state() + . = ..() var/amount = get_amount() if(amount <= 5) icon_state = "rods-[amount]" diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index 396ebb114075..ec750eb66aca 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -72,7 +72,7 @@ var/list/temp = SSmaterials.rigid_stack_recipes.Copy() recipes += temp update_weight() - update_icon() + update_appearance() var/static/list/loc_connections = list( COMSIG_ATOM_ENTERED = .proc/on_movable_entered_occupied_turf, @@ -93,13 +93,15 @@ /obj/item/stack/update_icon_state() if(novariants) - return + return ..() if(amount <= (max_amount * (1/3))) icon_state = initial(icon_state) - else if (amount <= (max_amount * (2/3))) + return ..() + if (amount <= (max_amount * (2/3))) icon_state = "[initial(icon_state)]_2" - else - icon_state = "[initial(icon_state)]_3" + return ..() + icon_state = "[initial(icon_state)]_3" + return ..() /obj/item/stack/examine(mob/user) . = ..() @@ -332,7 +334,7 @@ return TRUE for(var/i in mats_per_unit) custom_materials[i] = amount * mats_per_unit[i] - update_icon() + update_appearance() update_weight() return TRUE @@ -374,7 +376,7 @@ for(var/i in mats_per_unit) custom_materials[i] = mats_per_unit[i] * src.amount set_custom_materials() //Refresh - update_icon() + update_appearance() update_weight() /** Checks whether this stack can merge itself into another stack. diff --git a/code/game/objects/items/stacks/tickets.dm b/code/game/objects/items/stacks/tickets.dm index f525794a6e4e..477b349f4b16 100644 --- a/code/game/objects/items/stacks/tickets.dm +++ b/code/game/objects/items/stacks/tickets.dm @@ -9,9 +9,10 @@ /obj/item/stack/arcadeticket/Initialize(mapload, new_amount, merge = TRUE) . = ..() - update_icon() + update_appearance() /obj/item/stack/arcadeticket/update_icon_state() + . = ..() var/amount = get_amount() switch(amount) if(12 to INFINITY) diff --git a/code/game/objects/items/stacks/tiles/tile_reskinning.dm b/code/game/objects/items/stacks/tiles/tile_reskinning.dm index 2af074e8ff5f..92a68ed15b79 100644 --- a/code/game/objects/items/stacks/tiles/tile_reskinning.dm +++ b/code/game/objects/items/stacks/tiles/tile_reskinning.dm @@ -36,7 +36,7 @@ GLOBAL_LIST_EMPTY(tile_reskin_lists) icon_state = initial(choice.icon_state) turf_type = initial(choice.turf_type) merge_type = initial(choice.merge_type) - update_icon() + update_appearance() return choice = new choice(user.drop_location(), amount) diff --git a/code/game/objects/items/storage/bags.dm b/code/game/objects/items/storage/bags.dm index c97d50eaf719..910ea174c3a6 100644 --- a/code/game/objects/items/storage/bags.dm +++ b/code/game/objects/items/storage/bags.dm @@ -60,6 +60,7 @@ icon_state = "[initial(icon_state)]1" else icon_state = "[initial(icon_state)]" + return ..() /obj/item/storage/bag/trash/cyborg insertable = FALSE @@ -68,7 +69,7 @@ if(insertable) J.put_in_cart(src, user) J.mybag=src - J.update_icon() + J.update_appearance() else to_chat(user, "You are unable to fit your [name] into the [J.name].") return @@ -344,7 +345,7 @@ if(ishuman(M) || ismonkey(M)) if(prob(10)) M.Paralyze(40) - update_icon() + update_appearance() /obj/item/storage/bag/tray/proc/do_scatter(obj/item/I) for(var/i in 1 to rand(1,2)) @@ -362,11 +363,11 @@ /obj/item/storage/bag/tray/Entered() . = ..() - update_icon() + update_appearance() /obj/item/storage/bag/tray/Exited() . = ..() - update_icon() + update_appearance() /obj/item/storage/bag/tray/cafeteria name = "cafeteria tray" diff --git a/code/game/objects/items/storage/belt.dm b/code/game/objects/items/storage/belt.dm index ddcd04b26454..05b02e77f8b1 100644 --- a/code/game/objects/items/storage/belt.dm +++ b/code/game/objects/items/storage/belt.dm @@ -18,13 +18,15 @@ /obj/item/storage/belt/update_overlays() . = ..() - if(content_overlays) - for(var/obj/item/I in contents) - . += I.get_belt_overlay() + if(!content_overlays) + return + for(var/obj/item/I in contents) + . += I.get_belt_overlay() + /obj/item/storage/belt/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/storage/belt/utility name = "toolbelt" //Carn: utility belt is nicer, but it bamboozles the text parsing. @@ -225,7 +227,7 @@ new /obj/item/reagent_containers/syringe(src) new /obj/item/reagent_containers/glass/bottle/epinephrine(src) new /obj/item/reagent_containers/glass/bottle/formaldehyde(src) - update_icon() + update_appearance() /obj/item/storage/belt/medical/webbing/paramedic/PopulateContents() new /obj/item/sensor_device(src) @@ -234,7 +236,7 @@ new /obj/item/reagent_containers/syringe(src) new /obj/item/reagent_containers/glass/bottle/epinephrine(src) new /obj/item/reagent_containers/glass/bottle/formaldehyde(src) - update_icon() + update_appearance() /obj/item/storage/belt/medical/surgery/PopulateContents() new /obj/item/scalpel(src) @@ -244,7 +246,7 @@ new /obj/item/cautery(src) new /obj/item/hemostat(src) new /obj/item/hypospray/mkii(src) - update_icon() + update_appearance() /obj/item/storage/belt/security name = "security belt" @@ -286,7 +288,7 @@ new /obj/item/grenade/flashbang(src) new /obj/item/assembly/flash/handheld(src) new /obj/item/melee/baton/loaded(src) - update_icon() + update_appearance() /obj/item/storage/belt/security/webbing name = "security webbing" @@ -778,7 +780,7 @@ var/obj/item/I = contents[1] user.visible_message("[user] takes [I] out of [src].", "You take [I] out of [src].") user.put_in_hands(I) - update_icon() + update_appearance() else to_chat(user, "[src] is empty!") @@ -788,10 +790,11 @@ if(contents.len) icon_state += "-sabre" item_state += "-sabre" + return ..() /obj/item/storage/belt/sabre/PopulateContents() new /obj/item/melee/sabre(src) - update_icon() + update_appearance() /obj/item/storage/belt/sabre/solgov name = "solarian sabre sheath" @@ -814,7 +817,7 @@ /obj/item/storage/belt/sabre/solgov/PopulateContents() new /obj/item/melee/sabre/solgov(src) - update_icon() + update_appearance() /obj/item/storage/belt/security/webbing/inteq name = "inteq webbing" diff --git a/code/game/objects/items/storage/boxes.dm b/code/game/objects/items/storage/boxes.dm index 0cf59262a96a..98fa24e97379 100644 --- a/code/game/objects/items/storage/boxes.dm +++ b/code/game/objects/items/storage/boxes.dm @@ -36,7 +36,7 @@ /obj/item/storage/box/Initialize(mapload) . = ..() - update_icon() + update_appearance() /obj/item/storage/box/ComponentInitialize() . = ..() @@ -930,6 +930,7 @@ icon_state = "[item_state]" else icon_state = "[item_state]_closed" + return ..() /obj/item/storage/box/papersack/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/pen)) diff --git a/code/game/objects/items/storage/fancy.dm b/code/game/objects/items/storage/fancy.dm index b3e32f2be8a6..2aefd383342e 100644 --- a/code/game/objects/items/storage/fancy.dm +++ b/code/game/objects/items/storage/fancy.dm @@ -2,9 +2,6 @@ * The 'fancy' path is for objects like donut boxes that show how many items are in the storage item on the sprite itself * .. Sorry for the shitty path name, I couldnt think of a better one. * - * WARNING: var/icon_type is used for both examine text and sprite name. Please look at the procs below and adjust your sprite names accordingly - * TODO: Cigarette boxes should be ported to this standard - * * Contains: * Donut Box * Egg Box @@ -16,44 +13,50 @@ /obj/item/storage/fancy icon = 'icons/obj/food/containers.dmi' + icon_state = "donutbox" + base_icon_state = "donutbox" resistance_flags = FLAMMABLE - var/icon_type = "donut" + /// Used by examine to report what this thing is holding. + var/contents_tag = "errors" + /// What type of thing to fill this storage with. var/spawn_type = null - var/fancy_open = FALSE + /// Whether the container is open or not + var/is_open = FALSE /obj/item/storage/fancy/PopulateContents() + if(!spawn_type) + return var/datum/component/storage/STR = GetComponent(/datum/component/storage) for(var/i = 1 to STR.max_items) new spawn_type(src) /obj/item/storage/fancy/update_icon_state() - if(fancy_open) - icon_state = "[icon_type]box[contents.len]" - else - icon_state = "[icon_type]box" + icon_state = "[base_icon_state][is_open ? contents.len : null]" + return ..() /obj/item/storage/fancy/examine(mob/user) . = ..() - if(fancy_open) - if(length(contents) == 1) - . += "There is one [icon_type] left." - else - . += "There are [contents.len <= 0 ? "no" : "[contents.len]"] [icon_type]s left." + if(!is_open) + return + if(length(contents) == 1) + . += "There is one [contents_tag] left." + else + . += "There are [contents.len <= 0 ? "no" : "[contents.len]"] [contents_tag]s left." /obj/item/storage/fancy/attack_self(mob/user) - fancy_open = !fancy_open - update_icon() + is_open = !is_open + update_appearance() . = ..() /obj/item/storage/fancy/Exited() . = ..() - fancy_open = TRUE - update_icon() + is_open = TRUE + update_appearance() /obj/item/storage/fancy/Entered() . = ..() - fancy_open = TRUE - update_icon() + is_open = TRUE + update_appearance() #define DONUT_INBOX_SPRITE_WIDTH 3 @@ -66,10 +69,11 @@ desc = "Mmm. Donuts." icon = 'icons/obj/food/donuts.dmi' icon_state = "donutbox_inner" - icon_type = "donut" + base_icon_state = "donutbox" spawn_type = /obj/item/reagent_containers/food/snacks/donut - fancy_open = TRUE + is_open = TRUE appearance_flags = KEEP_TOGETHER + contents_tag = "donut" /obj/item/storage/fancy/donut_box/ComponentInitialize() . = ..() @@ -79,23 +83,21 @@ /obj/item/storage/fancy/donut_box/PopulateContents() . = ..() - update_icon() + update_appearance() /obj/item/storage/fancy/donut_box/update_icon_state() - if(fancy_open) - icon_state = "donutbox_inner" - else - icon_state = "donutbox" + . = ..() + icon_state = "[base_icon_state][is_open ? "_inner" : null]" /obj/item/storage/fancy/donut_box/update_overlays() . = ..() - if (!fancy_open) + if(!is_open) return var/donuts = 0 - for (var/_donut in contents) + for(var/_donut in contents) var/obj/item/reagent_containers/food/snacks/donut/donut = _donut if (!istype(donut)) continue @@ -103,7 +105,7 @@ . += image(icon = initial(icon), icon_state = donut.in_box_sprite(), pixel_x = donuts * DONUT_INBOX_SPRITE_WIDTH) donuts += 1 - . += image(icon = initial(icon), icon_state = "donutbox_top") + . += image(icon = initial(icon), icon_state = "[base_icon_state]_top") #undef DONUT_INBOX_SPRITE_WIDTH @@ -115,12 +117,13 @@ icon = 'icons/obj/food/containers.dmi' item_state = "eggbox" icon_state = "eggbox" - icon_type = "egg" + base_icon_state = "eggbox" lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi' righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi' name = "egg box" desc = "A carton for containing eggs." spawn_type = /obj/item/reagent_containers/food/snacks/egg + contents_tag = "egg" /obj/item/storage/fancy/egg_box/ComponentInitialize() . = ..() @@ -137,12 +140,13 @@ desc = "A pack of red candles." icon = 'icons/obj/candle.dmi' icon_state = "candlebox5" - icon_type = "candle" + base_icon_state = "candlebox" item_state = "candlebox5" throwforce = 2 slot_flags = ITEM_SLOT_BELT spawn_type = /obj/item/candle - fancy_open = TRUE + is_open = TRUE + contents_tag = "candle" /obj/item/storage/fancy/candle_box/ComponentInitialize() . = ..() @@ -159,15 +163,16 @@ name = "\improper Space Cigarettes packet" desc = "The most popular brand of cigarettes, sponsors of the Space Olympics." icon = 'icons/obj/cigarettes.dmi' + base_icon_state = "cig" icon_state = "cig" item_state = "cigpacket" w_class = WEIGHT_CLASS_TINY throwforce = 0 slot_flags = ITEM_SLOT_BELT - icon_type = "cigarette" spawn_type = /obj/item/clothing/mask/cigarette/space_cigarette var/candy = FALSE //for cigarette overlay custom_price = 75 + contents_tag = "cigarette" /obj/item/storage/fancy/cigarettes/ComponentInitialize() . = ..() @@ -189,99 +194,108 @@ contents -= W to_chat(user, "You take \a [W] out of the pack.") else - to_chat(user, "There are no [icon_type]s left in the pack.") + to_chat(user, "There are no [contents_tag]s left in the pack.") /obj/item/storage/fancy/cigarettes/update_icon_state() - if(fancy_open || !contents.len) - if(!contents.len) - icon_state = "[initial(icon_state)]_empty" - else - icon_state = initial(icon_state) + . = ..() + icon_state = "[base_icon_state][contents.len ? null : "_empty"]" + return /obj/item/storage/fancy/cigarettes/update_overlays() . = ..() - if(fancy_open && contents.len) - . += "[icon_state]_open" - var/cig_position = 1 - for(var/C in contents) - var/mutable_appearance/inserted_overlay = mutable_appearance(icon) - - if(istype(C, /obj/item/lighter/greyscale)) - inserted_overlay.icon_state = "lighter_in" - else if(istype(C, /obj/item/lighter)) - inserted_overlay.icon_state = "zippo_in" - else if(candy) - inserted_overlay.icon_state = "candy" - else - inserted_overlay.icon_state = "cigarette" - - inserted_overlay.icon_state = "[inserted_overlay.icon_state]_[cig_position]" - . += inserted_overlay - cig_position++ - -/obj/item/storage/fancy/cigarettes/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) - if(!ismob(M)) + if(!is_open || !contents.len) return - var/obj/item/clothing/mask/cigarette/cig = locate(/obj/item/clothing/mask/cigarette) in contents - if(cig) - if(M == user && contents.len > 0 && !user.wear_mask) - var/obj/item/clothing/mask/cigarette/W = cig - SEND_SIGNAL(src, COMSIG_TRY_STORAGE_TAKE, W, M) - M.equip_to_slot_if_possible(W, ITEM_SLOT_MASK) - contents -= W - to_chat(user, "You take \a [W] out of the pack.") + + . += "[icon_state]_open" + var/cig_position = 1 + for(var/C in contents) + var/mutable_appearance/inserted_overlay = mutable_appearance(icon) + + if(istype(C, /obj/item/lighter/greyscale)) + inserted_overlay.icon_state = "lighter_in" + else if(istype(C, /obj/item/lighter)) + inserted_overlay.icon_state = "zippo_in" + else if(candy) + inserted_overlay.icon_state = "candy" else - ..() - else - to_chat(user, "There are no [icon_type]s left in the pack.") + inserted_overlay.icon_state = "cigarette" + + inserted_overlay.icon_state = "[inserted_overlay.icon_state]_[cig_position]" + . += inserted_overlay + cig_position++ + +/obj/item/storage/fancy/cigarettes/attack(mob/living/carbon/target, mob/living/carbon/user) + if(!istype(target)) + return + + var/obj/item/clothing/mask/cigarette/cig = locate() in contents + if(!cig) + to_chat(user, "There are no [contents_tag]s left in the pack.") + return + if(target != user || !contents.len || user.wear_mask) + return ..() + + SEND_SIGNAL(src, COMSIG_TRY_STORAGE_TAKE, cig, target) + target.equip_to_slot_if_possible(cig, ITEM_SLOT_MASK) + contents -= cig + to_chat(user, "You take \a [cig] out of the pack.") + return /obj/item/storage/fancy/cigarettes/dromedaryco name = "\improper DromedaryCo packet" desc = "A packet of six imported DromedaryCo cancer sticks. A label on the packaging reads, \"Wouldn't a slow death make a change?\"" icon_state = "dromedary" + base_icon_state = "dromedary" spawn_type = /obj/item/clothing/mask/cigarette/dromedary /obj/item/storage/fancy/cigarettes/cigpack_uplift name = "\improper Uplift Smooth packet" desc = "Your favorite brand, now menthol flavored." icon_state = "uplift" + base_icon_state = "uplift" spawn_type = /obj/item/clothing/mask/cigarette/uplift /obj/item/storage/fancy/cigarettes/cigpack_robust name = "\improper Robust packet" desc = "Smoked by the robust." icon_state = "robust" + base_icon_state = "robust" spawn_type = /obj/item/clothing/mask/cigarette/robust /obj/item/storage/fancy/cigarettes/cigpack_robustgold name = "\improper Robust Gold packet" desc = "Smoked by the truly robust." icon_state = "robustg" + base_icon_state = "robustg" spawn_type = /obj/item/clothing/mask/cigarette/robustgold /obj/item/storage/fancy/cigarettes/cigpack_carp name = "\improper Carp Classic packet" desc = "Since 2313." icon_state = "carp" + base_icon_state = "carp" spawn_type = /obj/item/clothing/mask/cigarette/carp /obj/item/storage/fancy/cigarettes/cigpack_syndicate name = "cigarette packet" desc = "An obscure brand of cigarettes." icon_state = "syndie" + base_icon_state = "syndie" spawn_type = /obj/item/clothing/mask/cigarette/syndicate /obj/item/storage/fancy/cigarettes/cigpack_midori name = "\improper Midori Tabako packet" desc = "You can't understand the runes, but the packet smells funny." icon_state = "midori" + base_icon_state = "midori" spawn_type = /obj/item/clothing/mask/cigarette/rollie/nicotine /obj/item/storage/fancy/cigarettes/cigpack_candy name = "\improper Timmy's First Candy Smokes packet" desc = "Unsure about smoking? Want to bring your children safely into the family tradition? Look no more with this special packet! Includes 100%* Nicotine-Free candy cigarettes." icon_state = "candy" - icon_type = "candy cigarette" + base_icon_state = "candy" + contents_tag = "candy cigarette" spawn_type = /obj/item/clothing/mask/cigarette/candy candy = TRUE @@ -294,24 +308,28 @@ name = "\improper Shady Jim's Super Slims packet" desc = "Is your weight slowing you down? Having trouble running away from gravitational singularities? Can't stop stuffing your mouth? Smoke Shady Jim's Super Slims and watch all that fat burn away. Guaranteed results!" icon_state = "shadyjim" + base_icon_state = "shadyjim" spawn_type = /obj/item/clothing/mask/cigarette/shadyjims /obj/item/storage/fancy/cigarettes/cigpack_xeno name = "\improper Xeno Filtered packet" desc = "Loaded with 100% pure slime. And also nicotine." icon_state = "slime" + base_icon_state = "slime" spawn_type = /obj/item/clothing/mask/cigarette/xeno /obj/item/storage/fancy/cigarettes/cigpack_cannabis name = "\improper Freak Brothers' Special packet" desc = "A label on the packaging reads, \"Endorsed by Phineas, Freddy and Franklin.\"" icon_state = "midori" + base_icon_state = "midori" spawn_type = /obj/item/clothing/mask/cigarette/rollie/cannabis /obj/item/storage/fancy/cigarettes/cigpack_mindbreaker name = "\improper Leary's Delight packet" desc = "Banned in over 36 galaxies." icon_state = "shadyjim" + base_icon_state = "shadyjim" spawn_type = /obj/item/clothing/mask/cigarette/rollie/mindbreaker /obj/item/storage/fancy/rollingpapers @@ -320,8 +338,8 @@ w_class = WEIGHT_CLASS_TINY icon = 'icons/obj/cigarettes.dmi' icon_state = "cig_paper_pack" - ///The value in here has NOTHING to do with icons. It needs to be this for the proper examine. - icon_type = "rolling paper" + base_icon_state = "cig_paper_pack" + contents_tag = "rolling paper" spawn_type = /obj/item/rollingpaper custom_price = 25 @@ -333,12 +351,13 @@ ///Overrides to do nothing because fancy boxes are fucking insane. /obj/item/storage/fancy/rollingpapers/update_icon_state() + SHOULD_CALL_PARENT(FALSE) return /obj/item/storage/fancy/rollingpapers/update_overlays() . = ..() if(!contents.len) - . += "[icon_state]_empty" + . += "[base_icon_state]_empty" /obj/item/storage/fancy/cigarettes/derringer name = "\improper Robust packet" @@ -389,7 +408,7 @@ icon = 'icons/obj/cigarettes.dmi' icon_state = "cigarcase" w_class = WEIGHT_CLASS_NORMAL - icon_type = "premium cigar" + base_icon_state = "cigarcase" spawn_type = /obj/item/clothing/mask/cigarette/cigar /obj/item/storage/fancy/cigarettes/cigars/ComponentInitialize() @@ -399,30 +418,31 @@ STR.set_holdable(list(/obj/item/clothing/mask/cigarette/cigar)) /obj/item/storage/fancy/cigarettes/cigars/update_icon_state() - if(fancy_open) - icon_state = "[initial(icon_state)]_open" - else - icon_state = "[initial(icon_state)]" + . = ..() + icon_state = "[base_icon_state][is_open ? "_open" : null]" /obj/item/storage/fancy/cigarettes/cigars/update_overlays() . = ..() - if(fancy_open) - var/cigar_position = 1 //generate sprites for cigars in the box - for(var/obj/item/clothing/mask/cigarette/cigar/smokes in contents) - var/mutable_appearance/cigar_overlay = mutable_appearance(icon, "[smokes.icon_off]_[cigar_position]") - . += cigar_overlay - cigar_position++ + if(!is_open) + return + var/cigar_position = 1 //generate sprites for cigars in the box + for(var/obj/item/clothing/mask/cigarette/cigar/smokes in contents) + var/mutable_appearance/cigar_overlay = mutable_appearance(icon, "[smokes.icon_off]_[cigar_position]") + . += cigar_overlay + cigar_position++ /obj/item/storage/fancy/cigarettes/cigars/cohiba name = "\improper Cohiba Robusto cigar case" desc = "A case of imported Cohiba cigars, renowned for their strong flavor." icon_state = "cohibacase" + base_icon_state = "cohibacase" spawn_type = /obj/item/clothing/mask/cigarette/cigar/cohiba /obj/item/storage/fancy/cigarettes/cigars/havana name = "\improper premium Havanian cigar case" desc = "A case of classy Havanian cigars." icon_state = "cohibacase" + base_icon_state = "cohibacase" spawn_type = /obj/item/clothing/mask/cigarette/cigar/havana /* @@ -435,10 +455,11 @@ icon = 'icons/obj/food/containers.dmi' item_state = "chocolatebox" icon_state = "chocolatebox" - icon_type = "chocolate" + base_icon_state = "chocolatebox" lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi' righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi' spawn_type = /obj/item/reagent_containers/food/snacks/tinychocolate + contents_tag = "chocolate" /obj/item/storage/fancy/heart_box/ComponentInitialize() . = ..() @@ -452,7 +473,8 @@ desc = "A cardboard box used for holding chicken nuggies." icon = 'icons/obj/food/containers.dmi' icon_state = "nuggetbox" - icon_type = "nugget" + base_icon_state = "nuggetbox" + contents_tag = "nugget" spawn_type = /obj/item/reagent_containers/food/snacks/nugget /obj/item/storage/fancy/nugget_box/ComponentInitialize() diff --git a/code/game/objects/items/storage/lockbox.dm b/code/game/objects/items/storage/lockbox.dm index 505db0812137..6d6690106b4d 100644 --- a/code/game/objects/items/storage/lockbox.dm +++ b/code/game/objects/items/storage/lockbox.dm @@ -62,12 +62,12 @@ /obj/item/storage/lockbox/Entered() . = ..() open = TRUE - update_icon() + update_appearance() /obj/item/storage/lockbox/Exited() . = ..() open = TRUE - update_icon() + update_appearance() /obj/item/storage/lockbox/loyalty name = "lockbox of mindshield implants" @@ -113,7 +113,7 @@ if(user.canUseTopic(src, BE_CLOSE)) if(!SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)) open = (open ? FALSE : TRUE) - update_icon() + update_appearance() ..() /obj/item/storage/lockbox/medal/PopulateContents() @@ -131,12 +131,14 @@ var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED) if(locked) icon_state = "medalbox+l" - else - icon_state = "medalbox" - if(open) - icon_state += "open" - if(broken) - icon_state += "+b" + return ..() + + icon_state = "medalbox" + if(open) + icon_state += "open" + if(broken) + icon_state += "+b" + return ..() /obj/item/storage/lockbox/medal/update_overlays() . = ..() diff --git a/code/game/objects/items/storage/sixpack.dm b/code/game/objects/items/storage/sixpack.dm index 08e39df8e413..1a229909aa82 100644 --- a/code/game/objects/items/storage/sixpack.dm +++ b/code/game/objects/items/storage/sixpack.dm @@ -11,10 +11,11 @@ /obj/item/storage/cans/update_icon_state() icon_state = "[initial(icon_state)][contents.len]" + return ..() /obj/item/storage/cans/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/storage/cans/ComponentInitialize() . = ..() diff --git a/code/game/objects/items/storage/toolbox.dm b/code/game/objects/items/storage/toolbox.dm index 171d89fa0a52..113e2d111266 100644 --- a/code/game/objects/items/storage/toolbox.dm +++ b/code/game/objects/items/storage/toolbox.dm @@ -27,7 +27,7 @@ latches = "double_latch" if(prob(1)) latches = "triple_latch" - update_icon() + update_appearance() /obj/item/storage/toolbox/ComponentInitialize() . = ..() @@ -335,7 +335,7 @@ if(/obj/item/storage/toolbox/syndicate) B.toolbox_color = "s" user.put_in_hands(B) - B.update_icon() + B.update_appearance() to_chat(user, "You add the tiles into the empty [name]. They protrude from the top.") qdel(src) else diff --git a/code/game/objects/items/storage/wallets.dm b/code/game/objects/items/storage/wallets.dm index 62c2e0c2ecbf..91f47f56cdd5 100644 --- a/code/game/objects/items/storage/wallets.dm +++ b/code/game/objects/items/storage/wallets.dm @@ -56,7 +56,7 @@ var/mob/living/carbon/human/H = loc if(H.wear_id == src) H.sec_hud_set_ID() - update_icon() + update_appearance() update_label() /obj/item/storage/wallet/Entered(atom/movable/AM) @@ -66,10 +66,11 @@ /obj/item/storage/wallet/update_overlays() . = ..() cached_flat_icon = null - if(front_id) - . += mutable_appearance(front_id.icon, front_id.icon_state) - . += front_id.overlays - . += mutable_appearance(icon, "wallet_overlay") + if(!front_id) + return + . += mutable_appearance(front_id.icon, front_id.icon_state) + . += front_id.overlays + . += mutable_appearance(icon, "wallet_overlay") /obj/item/storage/wallet/proc/get_cached_flat_icon() if(!cached_flat_icon) diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 96cb2dd15f28..d9f3dd296a9b 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -46,7 +46,7 @@ log_mapping("[src] at [AREACOORD(src)] had an invalid preload_cell_type: [preload_cell_type].") else cell = new preload_cell_type(src) - update_icon() + update_appearance() RegisterSignal(src, COMSIG_PARENT_ATTACKBY, .proc/convert) @@ -73,7 +73,7 @@ if(A == cell) cell = null turned_on = FALSE - update_icon() + update_appearance() return ..() /obj/item/melee/baton/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum) @@ -93,17 +93,19 @@ if(turned_on && cell.charge < cell_hit_cost) //we're below minimum, turn off turned_on = FALSE - update_icon() + update_appearance() playsound(src, activate_sound, 75, TRUE, -1) /obj/item/melee/baton/update_icon_state() if(turned_on) icon_state = "[initial(icon_state)]_active" - else if(!cell) + return ..() + if(!cell) icon_state = "[initial(icon_state)]_nocell" - else - icon_state = "[initial(icon_state)]" + return ..() + icon_state = "[initial(icon_state)]" + return ..() /obj/item/melee/baton/examine(mob/user) . = ..() @@ -125,7 +127,7 @@ return cell = W to_chat(user, "You install a cell in [src].") - update_icon() + update_appearance() else if(W.tool_behaviour == TOOL_SCREWDRIVER) tryremovecell(user) @@ -134,12 +136,12 @@ /obj/item/melee/baton/proc/tryremovecell(mob/user) if(cell && can_remove_cell) - cell.update_icon() + cell.update_appearance() cell.forceMove(get_turf(src)) cell = null to_chat(user, "You remove the cell from [src].") turned_on = FALSE - update_icon() + update_appearance() /obj/item/melee/baton/attack_self(mob/user) toggle_on(user) @@ -155,7 +157,7 @@ to_chat(user, "[src] does not have a power source!") else to_chat(user, "[src] is out of charge.") - update_icon() + update_appearance() add_fingerprint(user) /obj/item/melee/baton/proc/clumsy_check(mob/living/carbon/human/user) @@ -325,14 +327,5 @@ else return ..() - -/obj/item/melee/baton/boomerang/update_icon_state() - if(turned_on) - icon_state = "[initial(icon_state)]_active" - else if(!cell) - icon_state = "[initial(icon_state)]_nocell" - else - icon_state = "[initial(icon_state)]" - /obj/item/melee/baton/boomerang/loaded //Same as above, comes with a cell. preload_cell_type = /obj/item/stock_parts/cell/high diff --git a/code/game/objects/items/tanks/watertank.dm b/code/game/objects/items/tanks/watertank.dm index 6b27a51f58ac..0f4f5adee562 100644 --- a/code/game/objects/items/tanks/watertank.dm +++ b/code/game/objects/items/tanks/watertank.dm @@ -420,7 +420,7 @@ var/used_amount = injection_amount/usage_ratio reagents.trans_to(user,used_amount,multiplier=usage_ratio, method = INJECT) - update_icon() + update_appearance() user.update_inv_back() //for overlays update //Operator backpack spray diff --git a/code/game/objects/items/theft_tools.dm b/code/game/objects/items/theft_tools.dm index 92480c9dae29..cb6b8d3abe9f 100644 --- a/code/game/objects/items/theft_tools.dm +++ b/code/game/objects/items/theft_tools.dm @@ -134,7 +134,7 @@ return FALSE forceMove(tongs) tongs.sliver = src - tongs.update_icon() + tongs.update_appearance() to_chat(user, "You carefully pick up [src] with [tongs].") else if(istype(W, /obj/item/scalpel/supermatter) || istype(W, /obj/item/nuke_core_container/supermatter/)) // we don't want it to dust return @@ -225,6 +225,7 @@ icon_state = "supermatter_tongs_loaded" else icon_state = "supermatter_tongs" + return ..() /obj/item/hemostat/supermatter/afterattack(atom/O, mob/user, proximity) . = ..() @@ -238,7 +239,7 @@ sliver.forceMove(loc) visible_message("\The [sliver] falls out of \the [src] as it hits the ground.") sliver = null - update_icon() + update_appearance() ..() /obj/item/hemostat/supermatter/proc/Consume(atom/movable/AM, mob/user) @@ -258,4 +259,4 @@ radiation_pulse(src, 500, 2) playsound(src, 'sound/effects/supermatter.ogg', 50, TRUE) QDEL_NULL(sliver) - update_icon() + update_appearance() diff --git a/code/game/objects/items/tools/screwdriver.dm b/code/game/objects/items/tools/screwdriver.dm index f1122cc2b1a1..f0b298931ee4 100644 --- a/code/game/objects/items/tools/screwdriver.dm +++ b/code/game/objects/items/tools/screwdriver.dm @@ -40,7 +40,7 @@ icon_state = "screwdriver" var/our_color = pick(screwdriver_colors) add_atom_colour(screwdriver_colors[our_color], FIXED_COLOUR_PRIORITY) - update_icon() + update_appearance() if(prob(75)) pixel_y = rand(0, 16) diff --git a/code/game/objects/items/tools/weldingtool.dm b/code/game/objects/items/tools/weldingtool.dm index 83f503cad3c2..c792af38486a 100644 --- a/code/game/objects/items/tools/weldingtool.dm +++ b/code/game/objects/items/tools/weldingtool.dm @@ -48,7 +48,7 @@ create_reagents(max_fuel) if(start_full) reagents.add_reagent(/datum/reagent/fuel, max_fuel) - update_icon() + update_appearance() /obj/item/weldingtool/ComponentInitialize() . = ..() @@ -60,7 +60,7 @@ item_state = "[initial(item_state)]1" else item_state = "[initial(item_state)]" - + return ..() /obj/item/weldingtool/update_overlays() . = ..() @@ -77,7 +77,7 @@ if(0) force = 3 damtype = "brute" - update_icon() + update_appearance() if(!can_off_process) STOP_PROCESSING(SSobj, src) return @@ -88,7 +88,7 @@ ++burned_fuel_for if(burned_fuel_for >= WELDER_FUEL_BURN_INTERVAL) use(1) - update_icon() + update_appearance() //This is to start fires. process() is only called if the welder is on. open_flame() @@ -100,7 +100,7 @@ flamethrower_rods(I, user) else . = ..() - update_icon() + update_appearance() /obj/item/weldingtool/proc/explode() var/turf/T = get_turf(loc) @@ -145,7 +145,7 @@ if(!status && O.is_refillable()) reagents.trans_to(O, reagents.total_volume, transfered_by = user) to_chat(user, "You empty [src]'s fuel tank into [O].") - update_icon() + update_appearance() /obj/item/weldingtool/attack_qdeleted(atom/O, mob/user, proximity) . = ..() @@ -168,7 +168,7 @@ explode() switched_on(user) - update_icon() + update_appearance() // Ah fuck, I can't believe you've done this @@ -211,7 +211,7 @@ if(get_fuel() <= 0 && welding) set_light_on(FALSE) switched_on(user) - update_icon() + update_appearance() return 0 return 1 @@ -228,7 +228,7 @@ force = 15 damtype = "fire" hitsound = 'sound/items/welder.ogg' - update_icon() + update_appearance() START_PROCESSING(SSobj, src) else to_chat(user, "You need more fuel!") @@ -245,7 +245,7 @@ force = 3 damtype = "brute" hitsound = "swing_hit" - update_icon() + update_appearance() /obj/item/weldingtool/examine(mob/user) diff --git a/code/game/objects/items/tools/wirecutters.dm b/code/game/objects/items/tools/wirecutters.dm index d2a420664df0..235e267e43c3 100644 --- a/code/game/objects/items/tools/wirecutters.dm +++ b/code/game/objects/items/tools/wirecutters.dm @@ -40,7 +40,7 @@ icon_state = "cutters" var/our_color = pick(wirecutter_colors) add_atom_colour(wirecutter_colors[our_color], FIXED_COLOUR_PRIORITY) - update_icon() + update_appearance() /obj/item/wirecutters/update_overlays() . = ..() diff --git a/code/game/objects/items/tools/wrench.dm b/code/game/objects/items/tools/wrench.dm index 805a06945983..3e9898d87508 100644 --- a/code/game/objects/items/tools/wrench.dm +++ b/code/game/objects/items/tools/wrench.dm @@ -83,7 +83,7 @@ hitsound = 'sound/weapons/blade1.ogg' playsound(user, 'sound/weapons/saberon.ogg', 5, TRUE) to_chat(user, "[src] is now active. Woe onto your enemies!") - update_icon() + update_appearance() /obj/item/wrench/combat/update_icon_state() if(on) @@ -92,6 +92,7 @@ else icon_state = "[initial(icon_state)]" item_state = "[initial(item_state)]" + return ..() /obj/item/wrench/syndie name = "suspicious-looking wrench" diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 78890682f79f..0046ece63058 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -68,7 +68,7 @@ A.reagents.trans_to(src, 10, transfered_by = user) to_chat(user, "You fill the balloon with the contents of [A].") desc = "A translucent balloon with some form of liquid sloshing around in it." - update_icon() + update_appearance() /obj/item/toy/waterballoon/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/reagent_containers/glass)) @@ -81,7 +81,7 @@ desc = "A translucent balloon with some form of liquid sloshing around in it." to_chat(user, "You fill the balloon with the contents of [I].") I.reagents.trans_to(src, 10, transfered_by = user) - update_icon() + update_appearance() else if(I.get_sharpness()) balloon_burst() else @@ -106,13 +106,13 @@ qdel(src) /obj/item/toy/waterballoon/update_icon_state() - if(src.reagents.total_volume >= 1) + if(reagents.total_volume >= 1) icon_state = "waterballoon" item_state = "balloon" else icon_state = "waterballoon-e" item_state = "balloon-empty" - + return ..() #define BALLOON_COLORS list("red", "blue", "green", "yellow") /obj/item/toy/balloon @@ -217,7 +217,7 @@ to_chat(user, text("You reload [] cap\s.", 7 - src.bullets)) A.amount_left -= 7 - src.bullets src.bullets = 7 - A.update_icon() + A.update_appearance() return 1 else return ..() @@ -253,6 +253,7 @@ /obj/item/toy/ammo/gun/update_icon_state() icon_state = "357OLD-[amount_left]" + return ..() /obj/item/toy/ammo/gun/examine(mob/user) . = ..() @@ -659,7 +660,7 @@ H.pickup(user) user.put_in_hands(H) user.visible_message("[user] draws a card from the deck.", "You draw a card from the deck.") - update_icon() + update_appearance() return H /obj/item/toy/cards/deck/update_icon_state() @@ -672,6 +673,7 @@ icon_state = "deck_[deckstyle]_low" else icon_state = "deck_[deckstyle]_empty" + return ..() /obj/item/toy/cards/deck/attack_self(mob/user) if(cooldown < world.time - 50) @@ -692,7 +694,7 @@ qdel(SC) else to_chat(user, "You can't mix cards from other decks!") - update_icon() + update_appearance() else if(istype(I, /obj/item/toy/cards/cardhand)) var/obj/item/toy/cards/cardhand/CH = I if(CH.parentdeck == src) @@ -704,7 +706,7 @@ qdel(CH) else to_chat(user, "You can't mix cards from other decks!") - update_icon() + update_appearance() else return ..() diff --git a/code/game/objects/items/weaponry.dm b/code/game/objects/items/weaponry.dm index 42d0f2fe40c2..d6955ff244ba 100644 --- a/code/game/objects/items/weaponry.dm +++ b/code/game/objects/items/weaponry.dm @@ -741,6 +741,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 //HF blade /obj/item/vibro_weapon icon_state = "hfrequency0" + base_icon_state = "hfrequency" lefthand_file = 'icons/mob/inhands/weapons/swords_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/swords_righthand.dmi' name = "vibro sword" @@ -765,7 +766,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 /obj/item/vibro_weapon/ComponentInitialize() . = ..() AddComponent(/datum/component/butchering, 20, 105) - AddComponent(/datum/component/two_handed, force_multiplier=2, icon_wielded="hfrequency1") + AddComponent(/datum/component/two_handed, force_multiplier=2, icon_wielded="[base_icon_state]1") /// triggered on wield of two handed item /obj/item/vibro_weapon/proc/on_wield(obj/item/source, mob/user) @@ -780,7 +781,8 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 wielded = FALSE /obj/item/vibro_weapon/update_icon_state() - icon_state = "hfrequency0" + icon_state = "[base_icon_state]0" + return ..() /obj/item/vibro_weapon/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) if(wielded) diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm index ef538159b018..61acce5c9d0a 100644 --- a/code/game/objects/obj_defense.dm +++ b/code/game/objects/obj_defense.dm @@ -175,7 +175,7 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e if(!acid_level) SSacid.processing[src] = src - update_icon() + update_appearance() var/acid_cap = acidpwr * 300 //so we cannot use huge amounts of weak acids to do as well as strong acids. if(acid_level < acid_cap) acid_level = min(acid_level + acidpwr * acid_volume, acid_cap) @@ -211,7 +211,7 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e if(!(resistance_flags & ON_FIRE) && (resistance_flags & FLAMMABLE) && !(resistance_flags & FIRE_PROOF)) resistance_flags |= ON_FIRE SSfire_burning.processing[src] = src - update_icon() + update_appearance() return 1 return ..() @@ -225,7 +225,7 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e /obj/proc/extinguish() if(resistance_flags & ON_FIRE) resistance_flags &= ~ON_FIRE - update_icon() + update_appearance() SSfire_burning.processing -= src ///Called when the obj is hit by a tesla bolt. diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm index d684ebef34a2..563e48e27f49 100644 --- a/code/game/objects/structures/ai_core.dm +++ b/code/game/objects/structures/ai_core.dm @@ -22,7 +22,7 @@ circuit = null if((state != GLASS_CORE) && (state != AI_READY_CORE)) state = EMPTY_CORE - update_icon() + update_appearance() if(A == brain) brain = null . = ..() @@ -112,7 +112,7 @@ return playsound(loc, 'sound/items/deconstruct.ogg', 50, TRUE) to_chat(user, "You place the circuit board inside the frame.") - update_icon() + update_appearance() state = CIRCUIT_CORE circuit = P return @@ -121,13 +121,13 @@ P.play_tool_sound(src) to_chat(user, "You screw the circuit board into place.") state = SCREWED_CORE - update_icon() + update_appearance() return if(P.tool_behaviour == TOOL_CROWBAR) P.play_tool_sound(src) to_chat(user, "You remove the circuit board.") state = EMPTY_CORE - update_icon() + update_appearance() circuit.forceMove(loc) circuit = null return @@ -136,7 +136,7 @@ P.play_tool_sound(src) to_chat(user, "You unfasten the circuit board.") state = CIRCUIT_CORE - update_icon() + update_appearance() return if(istype(P, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/C = P @@ -146,7 +146,7 @@ if(do_after(user, 20, target = src) && state == SCREWED_CORE && C.use(5)) to_chat(user, "You add cables to the frame.") state = CABLED_CORE - update_icon() + update_appearance() else to_chat(user, "You need five lengths of cable to wire the AI core!") return @@ -158,7 +158,7 @@ P.play_tool_sound(src) to_chat(user, "You remove the cables.") state = SCREWED_CORE - update_icon() + update_appearance() new /obj/item/stack/cable_coil(drop_location(), 5) return @@ -170,7 +170,7 @@ if(do_after(user, 20, target = src) && state == CABLED_CORE && G.use(2)) to_chat(user, "You put in the glass panel.") state = GLASS_CORE - update_icon() + update_appearance() else to_chat(user, "You need two sheets of reinforced glass to insert them into the AI core!") return @@ -198,7 +198,7 @@ brain = M to_chat(user, "You add [M.name] to the frame.") - update_icon() + update_appearance() return if(P.tool_behaviour == TOOL_CROWBAR && brain) @@ -206,7 +206,7 @@ to_chat(user, "You remove the brain.") brain.forceMove(loc) brain = null - update_icon() + update_appearance() return if(GLASS_CORE) @@ -214,7 +214,7 @@ P.play_tool_sound(src) to_chat(user, "You remove the glass panel.") state = CABLED_CORE - update_icon() + update_appearance() new /obj/item/stack/sheet/rglass(loc, 2) return @@ -239,7 +239,7 @@ qdel(src) else state = AI_READY_CORE - update_icon() + update_appearance() return if(AI_READY_CORE) @@ -251,7 +251,7 @@ P.play_tool_sound(src) to_chat(user, "You disconnect the monitor.") state = GLASS_CORE - update_icon() + update_appearance() return return ..() @@ -272,6 +272,7 @@ icon_state = "4" if(AI_READY_CORE) icon_state = "ai-empty" + return ..() /obj/structure/AIcore/deconstruct(disassembled = TRUE) if(state == GLASS_CORE) diff --git a/code/game/objects/structures/artstuff.dm b/code/game/objects/structures/artstuff.dm index cab897e263fb..03cff6da3f82 100644 --- a/code/game/objects/structures/artstuff.dm +++ b/code/game/objects/structures/artstuff.dm @@ -117,7 +117,7 @@ var/y = text2num(params["y"]) grid[x][y] = color used = TRUE - update_icon() + update_appearance() . = TRUE if("finalize") . = TRUE @@ -132,17 +132,19 @@ /obj/item/canvas/update_overlays() . = ..() - if(!icon_generated) - if(used) - var/mutable_appearance/detail = mutable_appearance(icon,"[icon_state]wip") - detail.pixel_x = 1 - detail.pixel_y = 1 - . += detail - else + if(icon_generated) var/mutable_appearance/detail = mutable_appearance(generated_icon) detail.pixel_x = 1 detail.pixel_y = 1 . += detail + return + if(!used) + return + + var/mutable_appearance/detail = mutable_appearance(icon, "[icon_state]wip") + detail.pixel_x = 1 + detail.pixel_y = 1 + . += detail /obj/item/canvas/proc/generate_proper_overlay() if(icon_generated) @@ -153,7 +155,7 @@ CRASH("Error generating painting png : [result]") generated_icon = new(png_filename) icon_generated = TRUE - update_icon() + update_appearance() /obj/item/canvas/proc/get_data_string() var/list/data = list() @@ -274,7 +276,7 @@ C.forceMove(drop_location()) C = null to_chat(user, "You remove the painting from the frame.") - update_icon() + update_appearance() return TRUE /obj/structure/sign/painting/proc/frame_canvas(mob/user,obj/item/canvas/new_canvas) @@ -283,7 +285,7 @@ if(!C.finalized) C.finalize(user) to_chat(user,"You frame [C].") - update_icon() + update_appearance() /obj/structure/sign/painting/proc/try_rename(mob/user) if(!C.painting_name) @@ -295,6 +297,7 @@ icon_state = null else icon_state = "frame-empty" + return ..() /obj/structure/sign/painting/update_overlays() . = ..() @@ -336,7 +339,7 @@ new_canvas.painting_name = title new_canvas.author_ckey = author C = new_canvas - update_icon() + update_appearance() /obj/structure/sign/painting/proc/save_persistent() if(!persistence_id || !C) diff --git a/code/game/objects/structures/bedsheet_bin.dm b/code/game/objects/structures/bedsheet_bin.dm index b1c27a421dee..f959d911bd33 100644 --- a/code/game/objects/structures/bedsheet_bin.dm +++ b/code/game/objects/structures/bedsheet_bin.dm @@ -455,11 +455,12 @@ LINEN BINS icon_state = "linenbin-half" else icon_state = "linenbin-full" + return ..() /obj/structure/bedsheetbin/fire_act(exposed_temperature, exposed_volume) if(amount) amount = 0 - update_icon() + update_appearance() ..() /obj/structure/bedsheetbin/attackby(obj/item/I, mob/user, params) @@ -469,7 +470,7 @@ LINEN BINS sheets.Add(I) amount++ to_chat(user, "You put [I] in [src].") - update_icon() + update_appearance() else if(default_unfasten_wrench(user, I, 5)) return @@ -518,7 +519,7 @@ LINEN BINS B.forceMove(drop_location()) user.put_in_hands(B) to_chat(user, "You take [B] out of [src].") - update_icon() + update_appearance() if(hidden) hidden.forceMove(drop_location()) @@ -541,7 +542,7 @@ LINEN BINS B.forceMove(drop_location()) to_chat(user, "You telekinetically remove [B] from [src].") - update_icon() + update_appearance() if(hidden) hidden.forceMove(drop_location()) diff --git a/code/game/objects/structures/catwalk.dm b/code/game/objects/structures/catwalk.dm index c115e1161c76..36b764590609 100644 --- a/code/game/objects/structures/catwalk.dm +++ b/code/game/objects/structures/catwalk.dm @@ -20,7 +20,7 @@ /obj/structure/catwalk/Initialize() . = ..() - update_icon() + update_appearance() /obj/structure/catwalk/over layer = CATWALK_LAYER //over pipes, duh @@ -38,7 +38,7 @@ plated_tile = /obj/item/stack/tile/plasteel/white icon_state = "catwalk_platedwhite" -/obj/structure/catwalk/update_icon() +/obj/structure/catwalk/update_appearance() ..() cut_overlays() icon_state = hatch_open ? "open" : "catwalk" @@ -69,7 +69,7 @@ else playsound(src, 'sound/items/Deconstruct.ogg', 100, 2) to_chat(user, "You shut \the [src]'s maintenance hatch.") - update_icon() + update_appearance() return if(istype(C, /obj/item/stack/tile) && !plated_tile) var/obj/item/stack/tile/plasteel/ST = C @@ -80,7 +80,7 @@ src.add_fingerprint(user) if(ST.use(1)) plated_tile = ST.type - update_icon() + update_appearance() return return ..() diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 1525ccd62994..137af446fa15 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -45,7 +45,7 @@ if(mapload && !opened) // if closed, any item at the crate's loc is put in the contents addtimer(CALLBACK(src, .proc/take_contents), 0) . = ..() - update_icon() + update_appearance() if(populate) PopulateContents() @@ -62,12 +62,17 @@ dump_contents() return ..() +/obj/structure/closet/update_appearance(updates=ALL) + . = ..() + if(opened || broken || !secure) + luminosity = 0 + return + luminosity = 1 + /obj/structure/closet/update_icon() . = ..() - if(!opened) - layer = OBJ_LAYER - else - layer = BELOW_OBJ_LAYER + + layer = opened ? BELOW_OBJ_LAYER : OBJ_LAYER /obj/structure/closet/update_overlays() . = ..() @@ -75,28 +80,19 @@ /obj/structure/closet/proc/closet_update_overlays(list/new_overlays) . = new_overlays - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) - luminosity = 0 - if(!opened) - if(icon_door) - . += "[icon_door]_door" - else - . += "[icon_state]_door" - if(welded) - . += icon_welded - if(secure && !broken) - //Overlay is similar enough for both that we can use the same mask for both - luminosity = 1 - SSvis_overlays.add_vis_overlay(src, icon, "locked", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) - if(locked) - . += "locked" - else - . += "unlocked" - else - if(icon_door_override) - . += "[icon_door]_open" - else - . += "[icon_state]_open" + if(opened) + . += "[icon_door_override ? icon_door : icon_state]_open" + return + + . += "[icon_door || icon_state]_door" + if(welded) + . += icon_welded + + if(broken || !secure) + return + //Overlay is similar enough for both that we can use the same mask for both + SSvis_overlays.add_vis_overlay(src, icon, "locked", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) + . += locked ? "locked" : "unlocked" /obj/structure/closet/examine(mob/user) . = ..() @@ -173,7 +169,7 @@ density = FALSE climb_time *= 0.5 //it's faster to climb onto an open thing dump_contents() - update_icon() + update_appearance() return TRUE /obj/structure/closet/proc/insert(atom/movable/AM) @@ -225,7 +221,7 @@ climb_time = initial(climb_time) opened = FALSE density = TRUE - update_icon() + update_appearance() return TRUE /obj/structure/closet/proc/toggle(mob/living/user) @@ -288,7 +284,7 @@ user.visible_message("[user] [welded ? "welds shut" : "unwelded"] \the [src].", "You [welded ? "weld" : "unwelded"] \the [src] with \the [W].", "You hear welding.") - update_icon() + update_appearance() else if(W.tool_behaviour == TOOL_WRENCH && anchorable) if(isinspace() && !anchored) return @@ -465,7 +461,7 @@ locked = !locked user.visible_message("[user] [locked ? null : "un"]locks [src].", "You [locked ? null : "un"]lock [src].") - update_icon() + update_appearance() else if(!silent) to_chat(user, "Access Denied.") else if(secure && broken) @@ -480,7 +476,7 @@ playsound(src, "sparks", 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) broken = TRUE locked = FALSE - update_icon() + update_appearance() /obj/structure/closet/get_remote_view_fullscreens(mob/user) if(user.stat == DEAD || !(user.sight & (SEEOBJS|SEEMOBS))) @@ -496,7 +492,7 @@ if(secure && !broken && !(. & EMP_PROTECT_SELF)) if(prob(50 / severity)) locked = !locked - update_icon() + update_appearance() if(prob(20 / severity) && !opened) if(!locked) open() diff --git a/code/game/objects/structures/crates_lockers/closets/bodybag.dm b/code/game/objects/structures/crates_lockers/closets/bodybag.dm index 1ffe0f0a5b23..23e3bde31173 100644 --- a/code/game/objects/structures/crates_lockers/closets/bodybag.dm +++ b/code/game/objects/structures/crates_lockers/closets/bodybag.dm @@ -39,7 +39,7 @@ if(t) name = "body bag - [t]" tagged = 1 - update_icon() + update_appearance() else name = "body bag" return @@ -47,7 +47,7 @@ to_chat(user, "You cut the tag off [src].") name = "body bag" tagged = 0 - update_icon() + update_appearance() /obj/structure/closet/body_bag/update_overlays() . = ..() diff --git a/code/game/objects/structures/crates_lockers/closets/secure/personal.dm b/code/game/objects/structures/crates_lockers/closets/secure/personal.dm index 4e003189da7c..e221117f74a9 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/personal.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/personal.dm @@ -48,7 +48,7 @@ if(allowed(user) || !registered_name || (istype(I) && (registered_name == I.registered_name))) //they can open all lockers, or nobody owns this, or they own this locker locked = !locked - update_icon() + update_appearance() if(!registered_name) registered_name = I.registered_name diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm index d8f53246fc23..252aff8d4d5a 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -23,7 +23,7 @@ . = ..() if(icon_state == "[initial(icon_state)]open") opened = TRUE - update_icon() + update_appearance() /obj/structure/closet/crate/CanAllowThrough(atom/movable/mover, turf/target) . = ..() @@ -37,6 +37,7 @@ /obj/structure/closet/crate/update_icon_state() icon_state = "[initial(icon_state)][opened ? "open" : ""]" + return ..() /obj/structure/closet/crate/closet_update_overlays(list/new_overlays) . = new_overlays @@ -57,7 +58,7 @@ playsound(src, 'sound/items/poster_ripped.ogg', 75, TRUE) manifest.forceMove(get_turf(src)) manifest = null - update_icon() + update_appearance() /obj/structure/closet/crate/proc/tear_manifest(mob/user) to_chat(user, "You tear the manifest off of [src].") @@ -67,7 +68,7 @@ if(ishuman(user)) user.put_in_hands(manifest) manifest = null - update_icon() + update_appearance() /obj/structure/closet/crate/coffin name = "coffin" diff --git a/code/game/objects/structures/crates_lockers/crates/bins.dm b/code/game/objects/structures/crates_lockers/crates/bins.dm index 6b8e3ac6586e..26335320c2b3 100644 --- a/code/game/objects/structures/crates_lockers/crates/bins.dm +++ b/code/game/objects/structures/crates_lockers/crates/bins.dm @@ -10,16 +10,17 @@ /obj/structure/closet/crate/bin/Initialize() . = ..() - update_icon() + update_appearance() /obj/structure/closet/crate/bin/update_overlays() . = ..() if(contents.len == 0) . += "largebing" - else if(contents.len >= storage_capacity) + return + if(contents.len >= storage_capacity) . += "largebinr" - else - . += "largebino" + return + . += "largebino" /obj/structure/closet/crate/bin/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/storage/bag/trash)) @@ -27,7 +28,7 @@ to_chat(user, "You fill the bag.") for(var/obj/item/O in src) SEND_SIGNAL(T, COMSIG_TRY_STORAGE_INSERT, O, user, TRUE) - T.update_icon() + T.update_appearance() do_animate() return TRUE else @@ -40,4 +41,4 @@ /obj/structure/closet/crate/bin/proc/do_close() playsound(loc, close_sound, 15, TRUE, -3) - update_icon() + update_appearance() diff --git a/code/game/objects/structures/crates_lockers/crates/critter.dm b/code/game/objects/structures/crates_lockers/crates/critter.dm index 78bb1b06234a..8ca58d9e20a5 100644 --- a/code/game/objects/structures/crates_lockers/crates/critter.dm +++ b/code/game/objects/structures/crates_lockers/crates/critter.dm @@ -27,16 +27,18 @@ return ..() /obj/structure/closet/crate/critter/update_icon_state() + SHOULD_CALL_PARENT(FALSE) return /obj/structure/closet/crate/critter/update_overlays() . = ..() if(opened) . += "crittercrate_door_open" - else - . += "crittercrate_door" - if(manifest) - . += "manifest" + return + + . += "crittercrate_door" + if(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 93a11342e274..63d9b6552c16 100644 --- a/code/game/objects/structures/crates_lockers/crates/secure.dm +++ b/code/game/objects/structures/crates_lockers/crates/secure.dm @@ -13,10 +13,11 @@ . = ..() if(broken) . += "securecrateemag" - else if(locked) + return + if(locked) . += "securecrater" - else - . += "securecrateg" + return + . += "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) @@ -92,7 +93,7 @@ user.visible_message("[user] unlocks [src]'s privacy lock.", "You unlock [src]'s privacy lock.") privacy_lock = FALSE - update_icon() + update_appearance() else if(!silent) to_chat(user, "Bank account does not match with buyer!") else if(!silent) diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index 368026e4146f..4431bd1307c2 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -30,7 +30,7 @@ trophy_message = showpiece_entry["trophy_message"] if(start_showpiece_type) showpiece = new start_showpiece_type (src) - update_icon() + update_appearance() /obj/structure/displaycase/Destroy() if(electronics) @@ -75,7 +75,7 @@ broken = 1 new /obj/item/shard(src.loc) playsound(src, "shatter", 70, TRUE) - update_icon() + update_appearance() trigger_alarm() /obj/structure/displaycase/proc/trigger_alarm() @@ -85,7 +85,7 @@ alarmed.burglaralert(src) playsound(src, 'sound/effects/alert.ogg', 50, TRUE) -/obj/structure/displaycase/update_icon() +/obj/structure/displaycase/update_appearance() var/icon/I if(open) I = icon('icons/obj/stationobjs.dmi',"glassbox_open") @@ -98,7 +98,7 @@ S.Scale(17,17) I.Blend(S,ICON_UNDERLAY,8,8) src.icon = I - return + return ..() /obj/structure/displaycase/attackby(obj/item/W, mob/user, params) if(W.GetID() && !broken && openable) @@ -115,7 +115,7 @@ to_chat(user, "You begin repairing [src]...") if(W.use_tool(src, user, 40, amount=5, volume=50)) obj_integrity = max_integrity - update_icon() + update_appearance() to_chat(user, "You repair [src].") else to_chat(user, "[src] is already in good condition!") @@ -139,7 +139,7 @@ if(user.transferItemToLoc(W, src)) showpiece = W to_chat(user, "You put [W] on display.") - update_icon() + update_appearance() else if(glass_fix && broken && istype(W, /obj/item/stack/sheet/glass)) var/obj/item/stack/sheet/glass/G = W if(G.get_amount() < 2) @@ -150,13 +150,13 @@ G.use(2) broken = 0 obj_integrity = max_integrity - update_icon() + update_appearance() else return ..() /obj/structure/displaycase/proc/toggle_lock(mob/user) open = !open - update_icon() + update_appearance() /obj/structure/displaycase/attack_paw(mob/user) return attack_hand(user) @@ -171,7 +171,7 @@ log_combat(user, src, "deactivates the hover field of") dump() src.add_fingerprint(user) - update_icon() + update_appearance() return else //prevents remote "kicks" with TK @@ -318,7 +318,7 @@ to_chat(user, "You insert [W] into the case.") showpiece = W added_roundstart = FALSE - update_icon() + update_appearance() placer_key = user.ckey @@ -381,7 +381,7 @@ ///We're using the same trick as paper does in order to cache the image, and only load the UI when messed with. var/list/viewing_ui = list() -/obj/structure/displaycase/forsale/update_icon() //remind me to fix my shitcode later +/obj/structure/displaycase/forsale/update_appearance() //remind me to fix my shitcode later var/icon/I if(open) I = icon('icons/obj/stationobjs.dmi',"laserboxb0") @@ -396,7 +396,7 @@ S.Scale(17,17) I.Blend(S,ICON_UNDERLAY,8,12) src.icon = I - return + return ..() /obj/structure/displaycase/forsale/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) @@ -459,7 +459,7 @@ icon = 'icons/obj/stationobjs.dmi' flick("laserbox_vend", src) showpiece = null - update_icon() + update_appearance() SStgui.update_uis(src) return TRUE if("Open") @@ -525,7 +525,7 @@ if(do_after(user, 20, target = src)) broken = 0 obj_integrity = max_integrity - update_icon() + update_appearance() return TRUE /obj/structure/displaycase/forsale/wrench_act(mob/living/user, obj/item/I) @@ -565,7 +565,7 @@ if(!broken && !(flags_1 & NODECONSTRUCT_1)) broken = TRUE playsound(src, "shatter", 70, TRUE) - update_icon() + update_appearance() trigger_alarm() //In case it's given an alarm anyway. /obj/structure/displaycase/forsale/kitchen diff --git a/code/game/objects/structures/divine.dm b/code/game/objects/structures/divine.dm index d81a6ac4a863..f5e50fc57d06 100644 --- a/code/game/objects/structures/divine.dm +++ b/code/game/objects/structures/divine.dm @@ -40,8 +40,8 @@ last_process = world.time to_chat(user, "The water feels warm and soothing as you touch it. The fountain immediately dries up shortly afterwards.") user.reagents.add_reagent(/datum/reagent/medicine/omnizine/godblood,20) - update_icon() - addtimer(CALLBACK(src, /atom/.proc/update_icon), time_between_uses) + update_appearance() + addtimer(CALLBACK(src, /atom/.proc/update_appearance), time_between_uses) /obj/structure/healingfountain/update_icon_state() @@ -49,3 +49,4 @@ icon_state = "fountain" else icon_state = "fountain-red" + return ..() diff --git a/code/game/objects/structures/door_assembly.dm b/code/game/objects/structures/door_assembly.dm index 61aa5929d55f..4246075e49f6 100644 --- a/code/game/objects/structures/door_assembly.dm +++ b/code/game/objects/structures/door_assembly.dm @@ -22,8 +22,8 @@ /obj/structure/door_assembly/Initialize() . = ..() - update_icon() - update_door_name() + update_appearance() + update_name() /obj/structure/door_assembly/examine(mob/user) . = ..() @@ -271,12 +271,12 @@ door.name = base_name door.previous_airlock = previous_assembly electronics.forceMove(door) - door.update_icon() + door.update_appearance() qdel(src) else return ..() update_name() - update_icon() + update_appearance() /obj/structure/door_assembly/update_overlays() . = ..() @@ -286,7 +286,7 @@ . += get_airlock_overlay("glass_construction", overlays_file) . += get_airlock_overlay("panel_c[state+1]", overlays_file) -/obj/structure/door_assembly/proc/update_door_name() +/obj/structure/door_assembly/update_name() name = "" switch(state) if(AIRLOCK_ASSEMBLY_NEEDS_WIRES) @@ -297,6 +297,7 @@ if(AIRLOCK_ASSEMBLY_NEEDS_SCREWDRIVER) name = "near finished " name += "[heat_proof_finished ? "heat-proofed " : ""][glass ? "window " : ""][base_name] assembly" + return ..() /obj/structure/door_assembly/proc/transfer_assembly_vars(obj/structure/door_assembly/source, obj/structure/door_assembly/target, previous = FALSE) target.glass = source.glass @@ -309,8 +310,8 @@ if(electronics) target.electronics = source.electronics source.electronics.forceMove(target) - target.update_icon() - target.update_door_name() + target.update_appearance() + target.update_name() qdel(source) /obj/structure/door_assembly/deconstruct(disassembled = TRUE) diff --git a/code/game/objects/structures/extinguisher.dm b/code/game/objects/structures/extinguisher.dm index 962b2e1b8afd..89796ad80e1f 100644 --- a/code/game/objects/structures/extinguisher.dm +++ b/code/game/objects/structures/extinguisher.dm @@ -27,7 +27,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/extinguisher_cabinet, 28) opened = TRUE else stored_extinguisher = new /obj/item/extinguisher(src) - update_icon() + update_appearance() /obj/structure/extinguisher_cabinet/examine(mob/user) . = ..() @@ -52,7 +52,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/extinguisher_cabinet, 28) /obj/structure/extinguisher_cabinet/handle_atom_del(atom/A) if(A == stored_extinguisher) stored_extinguisher = null - update_icon() + update_appearance() /obj/structure/extinguisher_cabinet/attackby(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WRENCH && !stored_extinguisher) @@ -72,7 +72,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/extinguisher_cabinet, 28) return stored_extinguisher = I to_chat(user, "You place [I] in [src].") - update_icon() + update_appearance() return TRUE else toggle_cabinet(user) @@ -95,7 +95,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/extinguisher_cabinet, 28) if(!opened) opened = 1 playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3) - update_icon() + update_appearance() else toggle_cabinet(user) @@ -107,7 +107,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/extinguisher_cabinet, 28) stored_extinguisher = null opened = 1 playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3) - update_icon() + update_appearance() else toggle_cabinet(user) @@ -126,7 +126,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/extinguisher_cabinet, 28) else playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3) opened = !opened - update_icon() + update_appearance() /obj/structure/extinguisher_cabinet/update_overlays() . = ..() @@ -147,7 +147,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/extinguisher_cabinet, 28) if(stored_extinguisher) stored_extinguisher.forceMove(loc) stored_extinguisher = null - update_icon() + update_appearance() /obj/structure/extinguisher_cabinet/deconstruct(disassembled = TRUE) diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index 0cc0adf3e35a..5569c4cf6365 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -38,7 +38,7 @@ return opening = TRUE - update_icon() + update_appearance() if(!density) var/srcturf = get_turf(src) for(var/mob/living/obstacle in srcturf) //Stop people from using this as a shield @@ -51,24 +51,27 @@ density = !density set_opacity(density) opening = FALSE - update_icon() + update_appearance() 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 + . = ..() + if(!density) + return + if(opening) - if(density) - icon_state = "fwall_opening" - smoothing_flags = NONE - clear_smooth_overlays() - else - icon_state = "fwall_closing" + smoothing_flags = NONE + clear_smooth_overlays() else - if(density) - icon_state = "[base_icon_state]-[smoothing_junction]" - smoothing_flags = SMOOTH_BITMASK - QUEUE_SMOOTH(src) - else - icon_state = "fwall_open" + smoothing_flags = SMOOTH_BITMASK + QUEUE_SMOOTH(src) + +/obj/structure/falsewall/update_icon_state() + if(opening) + icon_state = "fwall_[density ? "opening" : "closing"]" + return ..() + icon_state = density ? "[base_icon_state]-[smoothing_junction]" : "fwall_open" + return ..() /obj/structure/falsewall/proc/ChangeToWall(delete = 1) var/turf/T = get_turf(src) diff --git a/code/game/objects/structures/fireaxe.dm b/code/game/objects/structures/fireaxe.dm index 2410e478d557..f6de885caf77 100644 --- a/code/game/objects/structures/fireaxe.dm +++ b/code/game/objects/structures/fireaxe.dm @@ -15,7 +15,7 @@ /obj/structure/fireaxecabinet/Initialize() . = ..() fireaxe = new - update_icon() + update_appearance() /obj/structure/fireaxecabinet/Destroy() if(fireaxe) @@ -33,7 +33,7 @@ to_chat(user, "You begin repairing [src].") if(I.use_tool(src, user, 40, volume=50, amount=2)) obj_integrity = max_integrity - update_icon() + update_appearance() to_chat(user, "You repair [src].") else to_chat(user, "[src] is already in good condition!") @@ -47,7 +47,7 @@ if(do_after(user, 20, target = src) && G.use(2)) broken = 0 obj_integrity = max_integrity - update_icon() + update_appearance() else if(open || broken) if(istype(I, /obj/item/fireaxe) && !fireaxe) var/obj/item/fireaxe/F = I @@ -58,7 +58,7 @@ return fireaxe = F to_chat(user, "You place the [F.name] back in the [name].") - update_icon() + update_appearance() return else if(!broken) toggle_open() @@ -80,11 +80,11 @@ return . = ..() if(.) - update_icon() + update_appearance() /obj/structure/fireaxecabinet/obj_break(damage_flag) if(!broken && !(flags_1 & NODECONSTRUCT_1)) - update_icon() + update_appearance() broken = TRUE playsound(src, 'sound/effects/glassbr3.ogg', 100, TRUE) new /obj/item/shard(loc) @@ -114,14 +114,14 @@ fireaxe = null to_chat(user, "You take the fire axe from the [name].") src.add_fingerprint(user) - update_icon() + update_appearance() return if(locked) to_chat(user, "The [name] won't budge!") return else open = !open - update_icon() + update_appearance() return /obj/structure/fireaxecabinet/attack_paw(mob/living/user) @@ -137,33 +137,31 @@ return else open = !open - update_icon() + update_appearance() return /obj/structure/fireaxecabinet/update_overlays() . = ..() if(fireaxe) . += "axe" - if(!open) - var/hp_percent = obj_integrity/max_integrity * 100 - if(broken) - . += "glass4" - else - switch(hp_percent) - if(-INFINITY to 40) - . += "glass3" - if(40 to 60) - . += "glass2" - if(60 to 80) - . += "glass1" - if(80 to INFINITY) - . += "glass" - if(locked) - . += "locked" - else - . += "unlocked" - else + if(open) . += "glass_raised" + return + var/hp_percent = obj_integrity/max_integrity * 100 + if(broken) + . += "glass4" + else + switch(hp_percent) + if(-INFINITY to 40) + . += "glass3" + if(40 to 60) + . += "glass2" + if(60 to 80) + . += "glass1" + if(80 to INFINITY) + . += "glass" + + . += locked ? "locked" : "unlocked" /obj/structure/fireaxecabinet/proc/toggle_lock(mob/user) to_chat(user, "Resetting circuitry...") @@ -171,7 +169,7 @@ if(do_after(user, 20, target = src)) to_chat(user, "You [locked ? "disable" : "re-enable"] the locking modules.") locked = !locked - update_icon() + update_appearance() /obj/structure/fireaxecabinet/verb/toggle_open() set name = "Open/Close" @@ -183,5 +181,5 @@ return else open = !open - update_icon() + update_appearance() return diff --git a/code/game/objects/structures/fireplace.dm b/code/game/objects/structures/fireplace.dm index e761ae2dbc44..8c9c0ca9f64e 100644 --- a/code/game/objects/structures/fireplace.dm +++ b/code/game/objects/structures/fireplace.dm @@ -71,20 +71,21 @@ /obj/structure/fireplace/update_overlays() . = ..() - if(lit) - 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" + 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) set_light(0) @@ -112,7 +113,7 @@ playsound(src, 'sound/effects/comfyfire.ogg',50,FALSE, FALSE, TRUE) var/turf/T = get_turf(src) T.hotspot_expose(700, 5) - update_icon() + update_appearance() adjust_light() /obj/structure/fireplace/extinguish() @@ -142,11 +143,11 @@ desc = "A large stone brick fireplace, warm and cozy." flame_expiry_timer = world.time + fuel_added fuel_added = 0 - update_icon() + update_appearance() adjust_light() /obj/structure/fireplace/proc/put_out() lit = FALSE - update_icon() + update_appearance() adjust_light() desc = initial(desc) diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index a77d857e020f..103e29bb2b1a 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -3,6 +3,7 @@ name = "grille" icon = 'icons/obj/structures.dmi' icon_state = "grille" + base_icon_state = "grille" density = TRUE anchored = TRUE pass_flags_self = PASSGRILLE @@ -29,21 +30,20 @@ /obj/structure/grille/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir) . = ..() - update_icon() + update_appearance() -/obj/structure/grille/update_icon() +/obj/structure/grille/update_appearance(updates) if(QDELETED(src) || broken) return - var/ratio = obj_integrity / max_integrity - ratio = CEILING(ratio*4, 1) * 25 + . = ..() if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) QUEUE_SMOOTH(src) - if(ratio > 50) - return - icon_state = "grille50_[rand(0,3)]" +/obj/structure/grille/update_icon_state() + icon_state = "[base_icon_state][((obj_integrity / max_integrity) <= 0.5) ? "50_[rand(0, 3)]" : null]" + return ..() /obj/structure/grille/examine(mob/user) . = ..() diff --git a/code/game/objects/structures/guncase.dm b/code/game/objects/structures/guncase.dm index 9588691c214e..571f5ca0d3a3 100644 --- a/code/game/objects/structures/guncase.dm +++ b/code/game/objects/structures/guncase.dm @@ -20,7 +20,7 @@ I.forceMove(src) if(contents.len >= capacity) break - update_icon() + update_appearance() /obj/structure/guncase/update_overlays() . = ..() @@ -29,10 +29,7 @@ for(var/i in 1 to contents.len) gun_overlay.pixel_x = 3 * (i - 1) . += new /mutable_appearance(gun_overlay) - if(open) - . += "[icon_state]_open" - else - . += "[icon_state]_door" + . += "[icon_state]_[open ? "open" : "door"]" /obj/structure/guncase/attackby(obj/item/I, mob/user, params) if(iscyborg(user) || isalien(user)) @@ -42,14 +39,14 @@ if(!user.transferItemToLoc(I, src)) return to_chat(user, "You place [I] in [src].") - update_icon() + update_appearance() else to_chat(user, "[src] is full.") return else if(user.a_intent != INTENT_HARM) open = !open - update_icon() + update_appearance() else return ..() @@ -63,7 +60,7 @@ show_menu(user) else open = !open - update_icon() + update_appearance() /** * show_menu: Shows a radial menu to a user consisting of an available weaponry for taking @@ -95,7 +92,7 @@ return if(!user.put_in_hands(weapon)) weapon.forceMove(get_turf(src)) - update_icon() + update_appearance() /** * check_menu: Checks if we are allowed to interact with a radial menu @@ -113,7 +110,7 @@ return TRUE /obj/structure/guncase/handle_atom_del(atom/A) - update_icon() + update_appearance() /obj/structure/guncase/contents_explosion(severity, target) for(var/atom/A in contents) diff --git a/code/game/objects/structures/headpike.dm b/code/game/objects/structures/headpike.dm index ffdaf86bde55..aff870c6eedf 100644 --- a/code/game/objects/structures/headpike.dm +++ b/code/game/objects/structures/headpike.dm @@ -16,8 +16,7 @@ /obj/structure/headpike/CheckParts(list/parts_list) ..() victim = locate(/obj/item/bodypart/head) in parts_list - name = "[victim.name] on a spear" - update_icon() + update_appearance() if(bonespear) spear = locate(/obj/item/spear/bonespear) in parts_list else @@ -27,6 +26,11 @@ . = ..() pixel_x = rand(-8, 8) +/obj/structure/headpike/Destroy() + QDEL_NULL(victim) + QDEL_NULL(spear) + return ..() + /obj/structure/headpike/update_overlays() . = ..() var/obj/item/bodypart/head/H = locate() in contents @@ -47,3 +51,17 @@ spear.forceMove(drop_location()) spear = null qdel(src) + +/obj/structure/headpike/update_name() + name = "[victim.real_name] on a [spear]" + return ..() + +/obj/structure/headpike/update_overlays() + . = ..() + if(!victim) + return + var/mutable_appearance/MA = new() + MA.copy_overlays(victim) + MA.pixel_y = 12 + MA.pixel_x = pixel_x + . += victim diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index 48da6f8126e6..f97624af0e0d 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -67,7 +67,7 @@ if(!myspray) put_in_cart(I, user) myspray=I - update_icon() + update_appearance() else to_chat(user, fail_msg) else if(istype(I, /obj/item/lightreplacer)) @@ -80,7 +80,7 @@ if(signs < max_signs) put_in_cart(I, user) signs++ - update_icon() + update_appearance() else to_chat(user, "[src] can't hold any more signs!") else if(mybag) @@ -159,7 +159,7 @@ WARNING("Signs ([signs]) didn't match contents") signs = 0 - update_icon() + update_appearance() updateUsrDialog() diff --git a/code/game/objects/structures/ladders.dm b/code/game/objects/structures/ladders.dm index 088c7fdcae79..4ba59605eb0d 100644 --- a/code/game/objects/structures/ladders.dm +++ b/code/game/objects/structures/ladders.dm @@ -15,11 +15,11 @@ if (up) src.up = up up.down = src - up.update_icon() + up.update_appearance() if (down) src.down = down down.up = src - down.update_icon() + down.update_appearance() return INITIALIZE_HINT_LATELOAD /obj/structure/ladder/Destroy(force) @@ -39,35 +39,30 @@ if(crafted == L.crafted) down = L L.up = src // Don't waste effort looping the other way - L.update_icon() + L.update_appearance() if (!up) L = locate() in T.above() if (L) if(crafted == L.crafted) up = L L.down = src // Don't waste effort looping the other way - L.update_icon() + L.update_appearance() - update_icon() + update_appearance() /obj/structure/ladder/proc/disconnect() if(up && up.down == src) up.down = null - up.update_icon() + up.update_appearance() if(down && down.up == src) down.up = null - down.update_icon() + down.update_appearance() up = down = null /obj/structure/ladder/update_icon_state() - if(up && down) - icon_state = "ladder11" - else if(up) - icon_state = "ladder10" - else if(down) - icon_state = "ladder01" - else //wtf make your ladders properly assholes - icon_state = "ladder00" + icon_state = "ladder[up ? 1 : 0][down ? 1 : 0]" + return ..() + /obj/structure/ladder/singularity_pull() if (!(resistance_flags & INDESTRUCTIBLE)) @@ -171,7 +166,7 @@ /obj/structure/ladder/unbreakable/LateInitialize() // Override the parent to find ladders based on being height-linked if (!id || (up && down)) - update_icon() + update_appearance() return for (var/O in GLOB.ladders) @@ -181,17 +176,17 @@ if (!down && L.height == height - 1) down = L L.up = src - L.update_icon() + L.update_appearance() if (up) break // break if both our connections are filled else if (!up && L.height == height + 1) up = L L.down = src - L.update_icon() + L.update_appearance() if (down) break // break if both our connections are filled - update_icon() + update_appearance() /obj/structure/ladder/crafted crafted = TRUE diff --git a/code/game/objects/structures/life_candle.dm b/code/game/objects/structures/life_candle.dm index 3a0cb6bd6db5..7e562976e1af 100644 --- a/code/game/objects/structures/life_candle.dm +++ b/code/game/objects/structures/life_candle.dm @@ -37,7 +37,7 @@ user.visible_message("[user] touches [src]. It seems to respond to [user.p_their()] presence!", "You create a connection between you and [src].") linked_minds |= user.mind - update_icon() + update_appearance() float(linked_minds.len) if(linked_minds.len) START_PROCESSING(SSobj, src) @@ -47,10 +47,8 @@ set_light(0) /obj/structure/life_candle/update_icon_state() - if(linked_minds.len) - icon_state = icon_state_active - else - icon_state = icon_state_inactive + icon_state = linked_minds.len ? icon_state_active : icon_state_inactive + return ..() /obj/structure/life_candle/examine(mob/user) . = ..() diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index 34f42398d27b..bf7c919215d1 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -95,7 +95,7 @@ door_opened = TRUE layer = OPEN_DOOR_LAYER air_update_turf(1) - update_icon() + update_appearance() isSwitchingStates = FALSE if(close_delay != -1) @@ -116,11 +116,12 @@ door_opened = FALSE layer = initial(layer) air_update_turf(1) - update_icon() + update_appearance() isSwitchingStates = FALSE /obj/structure/mineral_door/update_icon_state() icon_state = "[initial(icon_state)][door_opened ? "open":""]" + return ..() /obj/structure/mineral_door/attackby(obj/item/I, mob/user) if(pickaxe_door(user, I)) diff --git a/code/game/objects/structures/mop_bucket.dm b/code/game/objects/structures/mop_bucket.dm index 457bd0faf4d0..3ccf6486fa1e 100644 --- a/code/game/objects/structures/mop_bucket.dm +++ b/code/game/objects/structures/mop_bucket.dm @@ -19,10 +19,10 @@ reagents.trans_to(I, 5, transfered_by = user) to_chat(user, "You wet [I] in [src].") playsound(loc, 'sound/effects/slosh.ogg', 25, TRUE) - update_icon() + update_appearance() else . = ..() - update_icon() + update_appearance() /obj/structure/mopbucket/update_overlays() . = ..() diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 43e693ee0ba6..8b50469eb8c0 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -37,16 +37,12 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an GLOB.bodycontainers -= src open() if(connected) - qdel(connected) - connected = null + QDEL_NULL(connected) return ..() /obj/structure/bodycontainer/on_log(login) ..() - update_icon() - -/obj/structure/bodycontainer/update_icon() - return + update_appearance() /obj/structure/bodycontainer/relaymove(mob/living/user, direction) if(user.stat || !isturf(loc)) @@ -130,7 +126,7 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an connected.setDir(dir) for(var/atom/movable/AM as anything in src) AM.forceMove(T) - update_icon() + update_appearance() /obj/structure/bodycontainer/proc/close() playsound(src, 'sound/effects/roll.ogg', 5, TRUE) @@ -141,7 +137,7 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an continue AM.forceMove(src) recursive_organ_check(src) - update_icon() + update_appearance() /obj/structure/bodycontainer/get_remote_view_fullscreens(mob/user) if(user.stat == DEAD || !(user.sight & (SEEOBJS|SEEMOBS))) @@ -154,9 +150,12 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an desc = "Used to keep bodies in until someone fetches them. Now includes a high-tech alert system." icon_state = "morgue1" dir = EAST + /// Whether or not this morgue beeps to alert parameds of revivable corpses. var/beeper = TRUE - var/beep_cooldown = 50 - var/next_beep = 0 + /// The minimum time between beeps. + var/beep_cooldown = 5 SECONDS + /// The cooldown to prevent this from spamming beeps. + COOLDOWN_DECLARE(next_beep) /obj/structure/bodycontainer/morgue/Initialize() . = ..() @@ -174,28 +173,31 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an beeper = !beeper to_chat(user, "You turn the speaker function [beeper ? "on" : "off"].") -/obj/structure/bodycontainer/morgue/update_icon() - if (!connected || connected.loc != src) // Open or tray is gone. +/obj/structure/bodycontainer/morgue/update_icon_state() + if(!connected || connected.loc != src) // Open or tray is gone. icon_state = "morgue0" - else - if(contents.len == 1) // Empty - icon_state = "morgue1" - else - icon_state = "morgue2" // Dead, brainded mob. - var/list/compiled = GetAllContents(/mob/living) // Search for mobs in all contents. - if(!length(compiled)) // No mobs? - icon_state = "morgue3" - return - - for(var/mob/living/M in compiled) - var/mob/living/mob_occupant = get_mob_or_brainmob(M) - if(mob_occupant.client && !(HAS_TRAIT(mob_occupant, TRAIT_BADDNA)) && !mob_occupant.hellbound) - icon_state = "morgue4" // Revivable - if(mob_occupant.stat == DEAD && beeper) - if(world.time > next_beep) - playsound(src, 'sound/weapons/gun/general/empty_alarm.ogg', 50, FALSE) //Revive them you blind fucks - next_beep = world.time + beep_cooldown - break + return ..() + + if(contents.len == 1) // Empty + icon_state = "morgue1" + return ..() + + var/list/compiled = GetAllContents(/mob/living) // Search for mobs in all contents. + if(!length(compiled)) // No mobs? + icon_state = "morgue3" + return ..() + + for(var/mob/living/M in compiled) + var/mob/living/mob_occupant = get_mob_or_brainmob(M) + if(mob_occupant.client && !(HAS_TRAIT(mob_occupant, TRAIT_BADDNA)) && !mob_occupant.hellbound) + icon_state = "morgue4" // Revivable + if(mob_occupant.stat == DEAD && beeper && COOLDOWN_FINISHED(src, next_beep)) + playsound(src, 'sound/weapons/gun/general/empty_alarm.ogg', 50, FALSE) //Revive them you blind fucks + COOLDOWN_START(src, next_beep, beep_cooldown) + return ..() + + icon_state = "morgue2" // Dead, brainded mob. + return ..() /obj/item/paper/guides/jobs/medical/morgue @@ -210,6 +212,7 @@ GLOBAL_LIST_EMPTY(crematoriums) name = "crematorium" desc = "A human incinerator. Works well on barbecue nights." icon_state = "crema1" + base_icon_state = "crema" dir = SOUTH var/id = 1 @@ -233,20 +236,15 @@ GLOBAL_LIST_EMPTY(crematoriums) /obj/structure/bodycontainer/crematorium/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) id = "[REF(port)][id]" -/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" - else - src.icon_state = "crema1" - - if(locked) - src.icon_state = "crema_active" - - return + icon_state = "[base_icon_state]0" + return ..() + if(locked) + icon_state = "[base_icon_state]_active" + return ..() + icon_state = "[base_icon_state][(contents.len > 1) ? 2 : 1]" + return ..() /obj/structure/bodycontainer/crematorium/proc/cremate(mob/user) if(locked) @@ -262,7 +260,7 @@ GLOBAL_LIST_EMPTY(crematoriums) audible_message("You hear a roar as the crematorium activates.") locked = TRUE - update_icon() + update_appearance() for(var/mob/living/M in conts) if (M.stat != DEAD) @@ -287,7 +285,7 @@ GLOBAL_LIST_EMPTY(crematoriums) if(!QDELETED(src)) locked = FALSE - update_icon() + update_appearance() playsound(src.loc, 'sound/machines/ding.ogg', 50, TRUE) //you horrible people /obj/structure/bodycontainer/crematorium/creamatorium @@ -321,7 +319,7 @@ GLOBAL_LIST_EMPTY(crematoriums) /obj/structure/tray/Destroy() if(connected) connected.connected = null - connected.update_icon() + connected.update_appearance() connected = null return ..() diff --git a/code/game/objects/structures/poddoor_assembly.dm b/code/game/objects/structures/poddoor_assembly.dm index 919a92b11128..c8cf1931c701 100644 --- a/code/game/objects/structures/poddoor_assembly.dm +++ b/code/game/objects/structures/poddoor_assembly.dm @@ -21,7 +21,7 @@ /obj/structure/poddoor_assembly/Initialize() . = ..() - update_icon() + update_appearance() update_door_name() /obj/structure/poddoor_assembly/ComponentInitialize() @@ -190,12 +190,12 @@ door.name = base_name door.assemblytype = previous_assembly electronics.forceMove(door) - door.update_icon() + door.update_appearance() qdel(src) else return ..() update_door_name() - update_icon() + update_appearance() /obj/structure/poddoor_assembly/proc/update_door_name() diff --git a/code/game/objects/structures/safe.dm b/code/game/objects/structures/safe.dm index 38cc7d7942d4..0df440340eed 100644 --- a/code/game/objects/structures/safe.dm +++ b/code/game/objects/structures/safe.dm @@ -57,10 +57,8 @@ FLOOR SAFES I.forceMove(src) /obj/structure/safe/update_icon_state() - if(open) - icon_state = "[initial(icon_state)]-open" - else - icon_state = initial(icon_state) + icon_state = "[initial(icon_state)][open ? "-open" : null]" + return ..() /obj/structure/safe/attackby(obj/item/I, mob/user, params) if(open) @@ -147,7 +145,7 @@ FLOOR SAFES return to_chat(user, "You [open ? "close" : "open"] [src].") open = !open - update_icon() + update_appearance() return TRUE if("turnright") if(open) diff --git a/code/game/objects/structures/shower.dm b/code/game/objects/structures/shower.dm index 9a4ef44f0f02..a2c5d59af916 100644 --- a/code/game/objects/structures/shower.dm +++ b/code/game/objects/structures/shower.dm @@ -34,7 +34,7 @@ /obj/machinery/shower/interact(mob/M) on = !on - update_icon() + update_appearance() handle_mist() add_fingerprint(M) if(on) diff --git a/code/game/objects/structures/stairs.dm b/code/game/objects/structures/stairs.dm index dcbbc63b0090..3e496f06252a 100644 --- a/code/game/objects/structures/stairs.dm +++ b/code/game/objects/structures/stairs.dm @@ -51,12 +51,12 @@ update_surrounding() /obj/structure/stairs/proc/update_surrounding() - update_icon() + update_appearance() for(var/i in GLOB.cardinals) var/turf/T = get_step(get_turf(src), i) var/obj/structure/stairs/S = locate() in T if(S) - S.update_icon() + S.update_appearance() /obj/structure/stairs/proc/on_exit(datum/source, atom/movable/leaving, direction) SIGNAL_HANDLER @@ -75,10 +75,8 @@ return ..() /obj/structure/stairs/update_icon_state() - if(isTerminator()) - icon_state = "stairs_t" - else - icon_state = "stairs" + icon_state = "stairs[isTerminator() ? "_t" : null]" + return ..() /obj/structure/stairs/proc/stair_ascend(atom/movable/AM) var/turf/checking = get_step_multiz(get_turf(src), UP) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index e1b01e43df9b..0d540477684f 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -51,6 +51,7 @@ return "The top is screwed on, but the main bolts are also visible." /obj/structure/table/update_icon() + . = ..() if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) QUEUE_SMOOTH(src) QUEUE_SMOOTH_NEIGHBORS(src) diff --git a/code/game/objects/structures/tank_dispenser.dm b/code/game/objects/structures/tank_dispenser.dm index 568f18678311..1be5f857e155 100644 --- a/code/game/objects/structures/tank_dispenser.dm +++ b/code/game/objects/structures/tank_dispenser.dm @@ -23,7 +23,7 @@ new /obj/item/tank/internals/oxygen(src) for(var/i in 1 to plasmatanks) new /obj/item/tank/internals/plasma(src) - update_icon() + update_appearance() /obj/structure/tank_dispenser/update_overlays() . = ..() @@ -65,7 +65,7 @@ if(!user.transferItemToLoc(I, src)) return to_chat(user, "You put [I] in [src].") - update_icon() + update_appearance() /obj/structure/tank_dispenser/ui_state(mob/user) return GLOB.physical_state @@ -100,7 +100,7 @@ usr.put_in_hands(tank) oxygentanks-- . = TRUE - update_icon() + update_appearance() /obj/structure/tank_dispenser/deconstruct(disassembled = TRUE) diff --git a/code/game/objects/structures/transit_tubes/station.dm b/code/game/objects/structures/transit_tubes/station.dm index 4de8ad772eba..570ead69ead7 100644 --- a/code/game/objects/structures/transit_tubes/station.dm +++ b/code/game/objects/structures/transit_tubes/station.dm @@ -38,7 +38,7 @@ for(var/obj/structure/transit_tube_pod/pod in loc) if(!pod.moving) AM.forceMove(pod) - pod.update_icon() + pod.update_appearance() return @@ -249,7 +249,7 @@ playsound(src, 'sound/weapons/emitter2.ogg', 50, TRUE) pod.setDir(turn(src.dir, -90)) AM.forceMove(pod) - pod.update_icon() + pod.update_appearance() launch_pod() /obj/structure/transit_tube/station/dispenser/pod_stopped(obj/structure/transit_tube_pod/pod, from_dir) 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 c557c9037ee5..7c744154c0d6 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm @@ -21,10 +21,8 @@ return ..() /obj/structure/transit_tube_pod/update_icon_state() - if(contents.len) - icon_state = occupied_icon_state - else - icon_state = initial(icon_state) + icon_state = contents.len ? occupied_icon_state : initial(icon_state) + return ..() /obj/structure/transit_tube_pod/attackby(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_CROWBAR) @@ -88,7 +86,7 @@ location = get_turf(src) for(var/atom/movable/M in contents) M.forceMove(location) - update_icon() + update_appearance() /obj/structure/transit_tube_pod/Process_Spacemove() if(moving) //No drifting while moving in the tubes @@ -201,7 +199,7 @@ if(direction == turn(station.boarding_dir,180)) if(station.open_status == STATION_TUBE_OPEN) mob.forceMove(loc) - update_icon() + update_appearance() else station.open_animation() diff --git a/code/game/objects/structures/tribal_torch.dm b/code/game/objects/structures/tribal_torch.dm index abec3409e470..0c093662a5aa 100644 --- a/code/game/objects/structures/tribal_torch.dm +++ b/code/game/objects/structures/tribal_torch.dm @@ -19,7 +19,7 @@ burning = FALSE icon_state = "torch_unlit" set_light(0) - update_icon() + update_appearance() return if(!burning) user.visible_message("[user] starts to pull [src] free from the ground....", "You start to pull [src] free from the ground...") @@ -33,7 +33,7 @@ /obj/structure/destructible/tribal_torch/attackby(obj/item/W, mob/user, params) if(W.get_temperature()) StartBurning() - update_icon() + update_appearance() user.visible_message("[user] lights [src] with [W].", "You light [src] with [W].") return @@ -42,7 +42,7 @@ burning = TRUE icon_state = "torch_lit" set_light(7) - update_icon() + update_appearance() return /obj/structure/destructible/tribal_torch/fire_act(exposed_temperature, exposed_volume) diff --git a/code/game/objects/structures/votingbox.dm b/code/game/objects/structures/votingbox.dm index b8aec9fd280f..3376272e8e06 100644 --- a/code/game/objects/structures/votingbox.dm +++ b/code/game/objects/structures/votingbox.dm @@ -71,7 +71,7 @@ switch(href_list["act"]) if("toggle_vote") voting_active = !voting_active - update_icon() + update_appearance() if("toggle_auth") id_auth = !id_auth if("reset_voted") @@ -217,6 +217,7 @@ /obj/structure/votebox/update_icon_state() icon_state = "votebox_[voting_active ? "active" : "maint"]" + return ..() #undef VOTE_TEXT_LIMIT #undef MAX_VOTES diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index 511473f06d1c..377c40d4e7ce 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -15,7 +15,7 @@ /obj/structure/toilet/Initialize() . = ..() open = round(rand(0, 1)) - update_icon() + update_appearance() /obj/structure/toilet/attack_hand(mob/living/user) @@ -71,11 +71,12 @@ w_items -= I.w_class else open = !open - update_icon() + update_appearance() /obj/structure/toilet/update_icon_state() icon_state = "toilet[open][cistern]" + return ..() /obj/structure/toilet/deconstruct() if(!(flags_1 & NODECONSTRUCT_1)) @@ -95,7 +96,7 @@ if(I.use_tool(src, user, 30)) user.visible_message("[user] [cistern ? "replaces the lid on the cistern" : "lifts the lid off the cistern"]!", "You [cistern ? "replace the lid on the cistern" : "lift the lid off the cistern"]!", "You hear grinding porcelain.") cistern = !cistern - update_icon() + update_appearance() else if(I.tool_behaviour == TOOL_WRENCH && !(flags_1&NODECONSTRUCT_1)) I.play_tool_sound(src) deconstruct() @@ -436,20 +437,20 @@ /obj/structure/curtain/proc/toggle() open = !open - update_icon() - -/obj/structure/curtain/update_icon() - if(!open) - icon_state = "[icon_type]-closed" + if(open) + layer = SIGN_LAYER + density = FALSE + set_opacity(FALSE) + else layer = WALL_OBJ_LAYER - open = FALSE if(opaque_closed) set_opacity(TRUE) - else - icon_state = "[icon_type]-open" - layer = SIGN_LAYER - open = TRUE - set_opacity(FALSE) + + update_appearance() + +/obj/structure/curtain/update_icon_state() + icon_state = "[icon_type]-[open ? "open" : "closed"]" + return ..() /obj/structure/curtain/attackby(obj/item/W, mob/user) if (istype(W, /obj/item/toy/crayon)) diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index a187b49db9b9..490752373295 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -55,6 +55,7 @@ /obj/structure/windoor_assembly/update_icon_state() icon_state = "[facing]_[secure ? "secure_" : ""]windoor_assembly[state]" + return ..() /obj/structure/windoor_assembly/CanAllowThrough(atom/movable/mover, turf/target) . = ..() @@ -317,7 +318,7 @@ return ..() //Update to reflect changes(if applicable) - update_icon() + update_appearance() @@ -338,7 +339,7 @@ return TRUE /obj/structure/windoor_assembly/proc/after_rotation(mob/user) - update_icon() + update_appearance() //Flips the windoor assembly, determines whather the door opens to the left or the right /obj/structure/windoor_assembly/verb/flip() @@ -360,5 +361,5 @@ facing = "l" to_chat(usr, "The windoor will now slide to the left.") - update_icon() + update_appearance() return diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 7009605cf9f2..3b43831f2751 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -322,28 +322,26 @@ //This proc is used to update the icons of nearby windows. /obj/structure/window/proc/update_nearby_icons() - update_icon() + update_appearance() if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) QUEUE_SMOOTH_NEIGHBORS(src) //merges adjacent full-tile windows into one /obj/structure/window/update_overlays() . = ..() - if(!QDELETED(src)) - if(!fulltile) - return - - var/ratio = obj_integrity / max_integrity - ratio = CEILING(ratio*4, 1) * 25 + if(QDELETED(src) || !fulltile) + return - if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) - QUEUE_SMOOTH(src) + if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + QUEUE_SMOOTH(src) - cut_overlay(crack_overlay) - if(ratio > 75) - return - crack_overlay = mutable_appearance('icons/obj/structures.dmi', "damage[ratio]", -(layer+0.1)) - . += crack_overlay + var/ratio = obj_integrity / max_integrity + ratio = CEILING(ratio*4, 1) * 25 + cut_overlay(crack_overlay) + if(ratio > 75) + return + crack_overlay = mutable_appearance('icons/obj/structures.dmi', "damage[ratio]", -(layer+0.1)) + . += crack_overlay /obj/structure/window/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) @@ -769,7 +767,7 @@ /obj/structure/window/paperframe/Initialize() . = ..() - update_icon() + update_appearance() /obj/structure/window/paperframe/examine(mob/user) . = ..() @@ -791,24 +789,25 @@ user.visible_message("[user] knocks on [src].") playsound(src, "pageturn", 50, TRUE) else - take_damage(4,BRUTE,"melee", 0) + take_damage(4, BRUTE, "melee", 0) playsound(src, hitsound, 50, TRUE) if(!QDELETED(src)) user.visible_message("[user] tears a hole in [src].") - update_icon() + update_appearance() + +/obj/structure/window/paperframe/update_appearance(updates) + . = ..() + set_opacity(obj_integrity >= max_integrity) + /obj/structure/window/paperframe/update_icon() - if(obj_integrity < max_integrity) - cut_overlay(paper) - add_overlay(torn) - set_opacity(FALSE) - else - cut_overlay(torn) - add_overlay(paper) - set_opacity(TRUE) + . = ..() if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) QUEUE_SMOOTH(src) +/obj/structure/window/paperframe/update_overlays() + . = ..() + . += (obj_integrity < max_integrity) ? torn : paper /obj/structure/window/paperframe/attackby(obj/item/W, mob/user) if(W.get_temperature()) @@ -823,10 +822,10 @@ qdel(W) user.visible_message("[user] patches some of the holes in \the [src].") if(obj_integrity == max_integrity) - update_icon() + update_appearance() return ..() - update_icon() + update_appearance() /obj/structure/window/bronze name = "brass window" diff --git a/code/game/turfs/closed/wall/conc_walls.dm b/code/game/turfs/closed/wall/conc_walls.dm index 47ccf5e6a659..6f0487ff39b7 100644 --- a/code/game/turfs/closed/wall/conc_walls.dm +++ b/code/game/turfs/closed/wall/conc_walls.dm @@ -118,7 +118,7 @@ /turf/closed/wall/concrete/proc/update_stats() // explosion block is diminished on a damaged / soft wall explosion_block = (health / max_health) * harden_lvl * initial(explosion_block) - update_icon() + update_appearance() /turf/closed/wall/concrete/proc/alter_health(delta) // 8x as vulnerable when unhardened diff --git a/code/game/turfs/closed/wall/reinf_walls.dm b/code/game/turfs/closed/wall/reinf_walls.dm index a0f803ddc983..1bd8f6783fd5 100644 --- a/code/game/turfs/closed/wall/reinf_walls.dm +++ b/code/game/turfs/closed/wall/reinf_walls.dm @@ -73,7 +73,7 @@ if(W.tool_behaviour == TOOL_WIRECUTTER) W.play_tool_sound(src, 100) d_state = SUPPORT_LINES - update_icon() + update_appearance() to_chat(user, "You cut the outer grille.") return 1 @@ -84,14 +84,14 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != SUPPORT_LINES) return 1 d_state = COVER - update_icon() + update_appearance() to_chat(user, "You unsecure the support lines.") return 1 else if(W.tool_behaviour == TOOL_WIRECUTTER) W.play_tool_sound(src, 100) d_state = INTACT - update_icon() + update_appearance() to_chat(user, "You repair the outer grille.") return 1 @@ -104,7 +104,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != COVER) return 1 d_state = CUT_COVER - update_icon() + update_appearance() to_chat(user, "You press firmly on the cover, dislodging it.") return 1 @@ -114,7 +114,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != COVER) return 1 d_state = SUPPORT_LINES - update_icon() + update_appearance() to_chat(user, "The support lines have been secured.") return 1 @@ -125,7 +125,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != CUT_COVER) return 1 d_state = ANCHOR_BOLTS - update_icon() + update_appearance() to_chat(user, "You pry off the cover.") return 1 @@ -137,7 +137,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != CUT_COVER) return TRUE d_state = COVER - update_icon() + update_appearance() to_chat(user, "The metal cover has been welded securely to the frame.") return 1 @@ -148,7 +148,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != ANCHOR_BOLTS) return 1 d_state = SUPPORT_RODS - update_icon() + update_appearance() to_chat(user, "You remove the bolts anchoring the support rods.") return 1 @@ -158,7 +158,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != ANCHOR_BOLTS) return 1 d_state = CUT_COVER - update_icon() + update_appearance() to_chat(user, "The metal cover has been pried back into place.") return 1 @@ -171,7 +171,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != SUPPORT_RODS) return 1 d_state = SHEATH - update_icon() + update_appearance() to_chat(user, "You slice through the support rods.") return 1 @@ -182,7 +182,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != SUPPORT_RODS) return 1 d_state = ANCHOR_BOLTS - update_icon() + update_appearance() to_chat(user, "You tighten the bolts anchoring the support rods.") return 1 @@ -204,7 +204,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != SHEATH) return TRUE d_state = SUPPORT_RODS - update_icon() + update_appearance() to_chat(user, "You weld the support rods back together.") return 1 return 0 @@ -220,16 +220,21 @@ switch(d_state) if(SUPPORT_LINES, COVER) icon = 'icons/turf/walls/rwalls/reinforced_wall_2.dmi' + return ..() if(CUT_COVER) icon = 'icons/turf/walls/rwalls/reinforced_wall_3.dmi' + return ..() if(ANCHOR_BOLTS, SUPPORT_RODS) icon = 'icons/turf/walls/rwalls/reinforced_wall_4.dmi' + return ..() if(SHEATH) icon = 'icons/turf/walls/rwalls/reinforced_wall_5.dmi' + return ..() else icon = initial(icon) base_icon_state = initial(base_icon_state) icon_state = "[base_icon_state]-[smoothing_junction]" + return ..() /turf/closed/wall/r_wall/wall_singularity_pull(current_size) if(current_size >= STAGE_FIVE) diff --git a/code/game/turfs/closed/walls.dm b/code/game/turfs/closed/walls.dm index 4b03b9c462f3..7be9fb0e21d6 100644 --- a/code/game/turfs/closed/walls.dm +++ b/code/game/turfs/closed/walls.dm @@ -52,7 +52,7 @@ var/turf/closed/wall/wall_copy = T if(LAZYLEN(dent_decals)) wall_copy.dent_decals = dent_decals.Copy() - wall_copy.update_icon() + wall_copy.update_appearance() /turf/closed/wall/update_overlays() . = ..() @@ -213,7 +213,7 @@ if(iswallturf(src) && LAZYLEN(dent_decals)) to_chat(user, "You fix some dents on the wall.") dent_decals = null - update_icon() + update_appearance() return TRUE return FALSE @@ -316,6 +316,6 @@ decal.pixel_x = x decal.pixel_y = y LAZYADD(dent_decals, decal) - update_icon() + update_appearance() #undef MAX_DENT_DECALS diff --git a/code/game/turfs/open/floor.dm b/code/game/turfs/open/floor.dm index 981ed32ad090..b8931f740c4b 100644 --- a/code/game/turfs/open/floor.dm +++ b/code/game/turfs/open/floor.dm @@ -21,7 +21,7 @@ intact = TRUE tiled_dirt = TRUE - // initiailized as null to stop turfs that update_icon() before Initialize() (in late ruin loading) from getting "stuck" as plating + // initiailized as null to stop turfs that update_appearance() before Initialize() (in late ruin loading) from getting "stuck" as plating var/icon_plating = null var/broken = FALSE var/burnt = FALSE diff --git a/code/game/turfs/open/floor/conc_floor.dm b/code/game/turfs/open/floor/conc_floor.dm index 229cfabb61e9..6a4908a4889b 100644 --- a/code/game/turfs/open/floor/conc_floor.dm +++ b/code/game/turfs/open/floor/conc_floor.dm @@ -32,7 +32,7 @@ /turf/open/floor/concrete/Initialize() . = ..() check_harden() - update_icon() + update_appearance() /turf/open/floor/concrete/examine(mob/user) . = ..() @@ -86,7 +86,7 @@ var/turf/open/floor/concrete/newconc = ChangeTurf(choice, flags = CHANGETURF_INHERIT_AIR) newconc.harden_lvl = old_harden newconc.check_harden() - newconc.update_icon() + newconc.update_appearance() return TRUE /turf/open/floor/concrete/proc/check_menu(mob/living/user) @@ -102,7 +102,7 @@ return if(!(entered_dirs & AM.dir)) entered_dirs |= AM.dir - update_icon() + update_appearance() /turf/open/floor/concrete/Exited(atom/movable/AM) . = ..() @@ -110,7 +110,7 @@ return if(!(exited_dirs & AM.dir)) exited_dirs |= AM.dir - update_icon() + update_appearance() /turf/open/floor/concrete/update_icon() . = ..() @@ -161,7 +161,7 @@ if(old_exited_dirs & Ddir) exited_dirs |= NDir - update_icon() + update_appearance() return ..() /turf/open/floor/concrete/proc/check_harden() @@ -173,7 +173,7 @@ harden_lvl = min(harden_lvl + (wait/time_to_harden), 1) if(harden_lvl == 1) STOP_PROCESSING(SSobj, src) - update_icon() + update_appearance() /turf/open/floor/concrete/break_tile() if(harden_lvl < 0.8) @@ -186,7 +186,7 @@ return harden_lvl = 1 // burning while soft instantly hardens STOP_PROCESSING(SSobj, src) - update_icon() + update_appearance() return /turf/open/floor/concrete/try_replace_tile(obj/item/stack/tile/T, mob/user, params) diff --git a/code/game/turfs/open/floor/fancy_floor.dm b/code/game/turfs/open/floor/fancy_floor.dm index 7686d70612ab..37c369a3d8c9 100644 --- a/code/game/turfs/open/floor/fancy_floor.dm +++ b/code/game/turfs/open/floor/fancy_floor.dm @@ -231,9 +231,10 @@ /turf/open/floor/carpet/Initialize(mapload, inherited_virtual_z) . = ..() - update_icon() + update_appearance() /turf/open/floor/carpet/update_icon() + . = ..() if(!..()) return 0 if(!broken && !burnt) @@ -441,11 +442,11 @@ /turf/open/floor/carpet/break_tile() broken = TRUE - update_icon() + update_appearance() /turf/open/floor/carpet/burn_tile() burnt = TRUE - update_icon() + update_appearance() /turf/open/floor/carpet/get_smooth_underlay_icon(mutable_appearance/underlay_appearance, turf/asking_turf, adjacency_dir) return FALSE diff --git a/code/game/turfs/open/floor/light_floor.dm b/code/game/turfs/open/floor/light_floor.dm index 2eb01418bf8b..9157bfecc5b0 100644 --- a/code/game/turfs/open/floor/light_floor.dm +++ b/code/game/turfs/open/floor/light_floor.dm @@ -49,38 +49,50 @@ /turf/open/floor/light/Initialize(mapload, inherited_virtual_z) . = ..() - update_icon() + update_appearance() if(!length(lighttile_designs)) populate_lighttile_designs() /turf/open/floor/light/break_tile() ..() state = pick(LIGHTFLOOR_FLICKER, LIGHTFLOOR_BREAKING, LIGHTFLOOR_BROKEN)/// pick a broken state - update_icon() + update_appearance() -/turf/open/floor/light/update_icon() - ..() - if(on) - switch(state) - if(LIGHTFLOOR_FINE) - icon_state = "light_on-[LAZYFIND(coloredlights, currentcolor)]" - set_light_color(currentcolor) - set_light(5) - light_range = 3 - if(LIGHTFLOOR_FLICKER) - icon_state = "light_on_flicker-[LAZYFIND(coloredlights, currentcolor)]" - set_light_color(currentcolor) - set_light(3) - light_range = 2 - if(LIGHTFLOOR_BREAKING) - icon_state = "light_on_broken" - set_light(1) - if(LIGHTFLOOR_BROKEN) - icon_state = "light_off" - set_light(0) - else +/turf/open/floor/light/update_appearance(updates) + . = ..() + if(!on) set_light(0) + return + + switch(state) + if(LIGHTFLOOR_FINE) + set_light_color(currentcolor) + set_light(5) + light_range = 3 + if(LIGHTFLOOR_FLICKER) + set_light_color(currentcolor) + set_light(3) + light_range = 2 + if(LIGHTFLOOR_BREAKING) + set_light(1) + if(LIGHTFLOOR_BROKEN) + set_light(0) + +/turf/open/floor/light/update_icon_state() + if(!on) icon_state = "light_off" + return ..() + + switch(state) + if(LIGHTFLOOR_FINE) + icon_state = "light_on-[LAZYFIND(coloredlights, currentcolor)]" + if(LIGHTFLOOR_FLICKER) + icon_state = "light_on_flicker-[LAZYFIND(coloredlights, currentcolor)]" + if(LIGHTFLOOR_BREAKING) + icon_state = "light_on_broken" + if(LIGHTFLOOR_BROKEN) + icon_state = "light_off" + return ..() /turf/open/floor/light/ChangeTurf(path, new_baseturf, flags) set_light(0) @@ -91,7 +103,7 @@ if(!can_modify_colour) return on = !on - update_icon() + update_appearance() /turf/open/floor/light/multitool_act(mob/living/user, obj/item/I) . = ..() @@ -103,7 +115,7 @@ if(!choice) return FALSE currentcolor = choice - update_icon() + update_appearance() /turf/open/floor/light/attackby(obj/item/C, mob/user, params) if(..()) @@ -116,7 +128,7 @@ if(state && user.temporarilyRemoveItemFromInventory(C)) qdel(C) state = LIGHTFLOOR_FINE //fixing it by bashing it with a light bulb, fun eh? - update_icon() + update_appearance() to_chat(user, "You replace the light bulb.") else to_chat(user, "The light bulb seems fine, no need to replace it.") @@ -131,7 +143,7 @@ if(prob(50)) state++ currentcolor = pick(coloredlights) - update_icon() + update_appearance() //Cycles through all of the colours /turf/open/floor/light/colour_cycle diff --git a/code/game/turfs/open/floor/mineral_floor.dm b/code/game/turfs/open/floor/mineral_floor.dm index 55bc1404b0b9..476a69fa468d 100644 --- a/code/game/turfs/open/floor/mineral_floor.dm +++ b/code/game/turfs/open/floor/mineral_floor.dm @@ -23,12 +23,10 @@ icons = typelist("icons", icons) -/turf/open/floor/mineral/update_icon() - if(!..()) - return 0 - if(!broken && !burnt) - if(!(icon_state in icons)) - icon_state = initial(icon_state) +/turf/open/floor/mineral/update_icon_state() + if(!broken && !burnt && !(icon_state in icons)) + icon_state = initial(icon_state) + return ..() //PLASMA diff --git a/code/game/turfs/open/floor/misc_floor.dm b/code/game/turfs/open/floor/misc_floor.dm index 8f9185d16ba9..525221000f86 100644 --- a/code/game/turfs/open/floor/misc_floor.dm +++ b/code/game/turfs/open/floor/misc_floor.dm @@ -20,25 +20,25 @@ /turf/open/floor/circuit/Initialize(mapload, inherited_virtual_z) SSmapping.nuke_tiles += src - update_icon() + update_appearance() . = ..() /turf/open/floor/circuit/Destroy() SSmapping.nuke_tiles -= src return ..() -/turf/open/floor/circuit/update_icon() - if(on) - if(LAZYLEN(SSmapping.nuke_threats)) - icon_state = "rcircuitanim" - set_light_color(LIGHT_COLOR_FLARE) - else - icon_state = icon_normal - set_light_color(initial(light_color)) - set_light(1.4, 0.5) - else - icon_state = "[icon_normal]off" +/turf/open/floor/circuit/update_appearance(updates) + . = ..() + if(!on) set_light(0) + return + + set_light_color(LAZYLEN(SSmapping.nuke_threats) ? LIGHT_COLOR_FLARE : initial(light_color)) + set_light(1.4, 0.5) + +/turf/open/floor/circuit/update_icon_state() + icon_state = on ? (LAZYLEN(SSmapping.nuke_threats) ? "rcircuitanim" : icon_normal) : "[icon_normal]off" + return ..() /turf/open/floor/circuit/off icon_state = "bcircuitoff" diff --git a/code/game/turfs/open/floor/plasteel_floor.dm b/code/game/turfs/open/floor/plasteel_floor.dm index 3f0c6a662055..10760b3af5cf 100644 --- a/code/game/turfs/open/floor/plasteel_floor.dm +++ b/code/game/turfs/open/floor/plasteel_floor.dm @@ -12,8 +12,9 @@ /turf/open/floor/plasteel/update_icon_state() if(broken || burnt) - return + return ..() icon_state = base_icon_state + return ..() /turf/open/floor/plasteel/airless initial_gas_mix = AIRLESS_ATMOS diff --git a/code/game/turfs/open/floor/plating.dm b/code/game/turfs/open/floor/plating.dm index 80e98dde6a6e..5a41e234f53f 100644 --- a/code/game/turfs/open/floor/plating.dm +++ b/code/game/turfs/open/floor/plating.dm @@ -44,7 +44,7 @@ else icon_plating = initial(icon_state) -/turf/open/floor/plating/update_icon() +/turf/open/floor/plating/update_appearance() if(!..()) return if(!broken && !burnt && icon_plating) diff --git a/code/game/turfs/open/floor/plating/icemoon.dm b/code/game/turfs/open/floor/plating/icemoon.dm index 1b67a5404ea7..2b1892d5a4ed 100644 --- a/code/game/turfs/open/floor/plating/icemoon.dm +++ b/code/game/turfs/open/floor/plating/icemoon.dm @@ -27,7 +27,7 @@ return if(!(entered_dirs & AM.dir)) entered_dirs |= AM.dir - update_icon() + update_appearance() /turf/open/floor/plating/asteroid/snow/Exited(atom/movable/AM) . = ..() @@ -35,7 +35,7 @@ return if(!(exited_dirs & AM.dir)) exited_dirs |= AM.dir - update_icon() + update_appearance() // adapted version of footprints' update_icon code /turf/open/floor/plating/asteroid/snow/update_overlays() @@ -72,7 +72,7 @@ if(old_exited_dirs & Ddir) exited_dirs |= NDir - update_icon() + update_appearance() return ..() /turf/open/floor/plating/asteroid/snow/getDug() diff --git a/code/game/turfs/open/space/transit.dm b/code/game/turfs/open/space/transit.dm index bc9789cf4f3a..6aa9558720cd 100644 --- a/code/game/turfs/open/space/transit.dm +++ b/code/game/turfs/open/space/transit.dm @@ -48,7 +48,7 @@ /turf/open/space/transit/Initialize(mapload, inherited_virtual_z) . = ..() - update_icon() + update_appearance() for(var/atom/movable/AM in src) AM.throw_atom_into_space() @@ -58,6 +58,7 @@ /turf/open/space/transit/update_icon_state() icon_state = "speedspace_ns_[get_transit_state(src)]" + return ..() /proc/get_transit_state(turf/T) var/p = 9 diff --git a/code/modules/NTNet/relays.dm b/code/modules/NTNet/relays.dm index 54fd9d3f370a..9a1b01403eda 100644 --- a/code/modules/NTNet/relays.dm +++ b/code/modules/NTNet/relays.dm @@ -59,10 +59,8 @@ /obj/machinery/ntnet_relay/update_icon_state() - if(is_operational) - icon_state = "bus" - else - icon_state = "bus_off" + icon_state = "bus[is_operational ? null : "_off"]" + return ..() /obj/machinery/ntnet_relay/process() if(is_operational) @@ -70,7 +68,7 @@ else use_power = IDLE_POWER_USE - update_icon() + update_appearance() if(dos_overload) dos_overload = max(0, dos_overload - dos_dissipate) @@ -78,12 +76,12 @@ // If DoS traffic exceeded capacity, crash. if((dos_overload > dos_capacity) && !dos_failure) set_dos_failure(TRUE) - update_icon() + update_appearance() SSnetworks.station_network.add_log("Quantum relay switched from normal operation mode to overload recovery mode.") // If the DoS buffer reaches 0 again, restart. if((dos_overload == 0) && dos_failure) set_dos_failure(FALSE) - update_icon() + update_appearance() SSnetworks.station_network.add_log("Quantum relay switched from overload recovery mode to normal operation mode.") ..() @@ -109,13 +107,13 @@ if("restart") dos_overload = 0 set_dos_failure(FALSE) - update_icon() + update_appearance() SSnetworks.station_network.add_log("Quantum relay manually restarted from overload recovery mode to normal operation mode.") return TRUE if("toggle") set_relay_enabled(!relay_enabled) SSnetworks.station_network.add_log("Quantum relay manually [relay_enabled ? "enabled" : "disabled"].") - update_icon() + update_appearance() return TRUE /obj/machinery/ntnet_relay/Initialize() diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 524cd800f698..63f0fc81bc87 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -216,7 +216,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that var/obj/item/storage/wallet/W = worn W.front_id = id id.forceMove(W) - W.update_icon() + W.update_appearance() else H.equip_to_slot(id,ITEM_SLOT_ID) @@ -549,7 +549,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that F.power = 250 F.warming_up = 3 F.start_fields() - F.update_icon() + F.update_appearance() spawn(30) for(var/obj/machinery/the_singularitygen/G in GLOB.machines) diff --git a/code/modules/admin/verbs/manipulate_organs.dm b/code/modules/admin/verbs/manipulate_organs.dm index a3b7e4247c1d..0695777a6897 100644 --- a/code/modules/admin/verbs/manipulate_organs.dm +++ b/code/modules/admin/verbs/manipulate_organs.dm @@ -71,4 +71,4 @@ var/obj/item/implantcase/case = new(get_turf(C)) case.imp = I I.forceMove(case) - case.update_icon() + case.update_appearance() diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm index 85bc5a9522c5..8d0149bf7950 100644 --- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm +++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm @@ -485,9 +485,10 @@ Congratulations! You are now trained for invasive xenobiology research!"} if(!turned_on) toggle_on(user) to_chat(usr, "You switch the baton to [txt] mode.") - update_icon() + update_appearance() /obj/item/melee/baton/abductor/update_icon_state() + . = ..() switch(mode) if(BATON_STUN) icon_state = "wonderprodStun" @@ -501,6 +502,7 @@ Congratulations! You are now trained for invasive xenobiology research!"} if(BATON_PROBE) icon_state = "wonderprodProbe" item_state = "wonderprodProbe" + return ..() /obj/item/melee/baton/abductor/attack(mob/target, mob/living/user) if(!AbductorCheck(user)) diff --git a/code/modules/antagonists/abductor/machinery/experiment.dm b/code/modules/antagonists/abductor/machinery/experiment.dm index 0f8b770db4be..f0e68a84a95f 100644 --- a/code/modules/antagonists/abductor/machinery/experiment.dm +++ b/code/modules/antagonists/abductor/machinery/experiment.dm @@ -183,7 +183,5 @@ return /obj/machinery/abductor/experiment/update_icon_state() - if(state_open) - icon_state = "experiment-open" - else - icon_state = "experiment" + icon_state = "experiment[state_open ? "-open" : null]" + return ..() diff --git a/code/modules/antagonists/blob/blobstrains/_blobstrain.dm b/code/modules/antagonists/blob/blobstrains/_blobstrain.dm index f6c61109512e..cae4fb2aa983 100644 --- a/code/modules/antagonists/blob/blobstrains/_blobstrain.dm +++ b/code/modules/antagonists/blob/blobstrains/_blobstrain.dm @@ -26,7 +26,7 @@ GLOBAL_LIST_INIT(valid_blobstrains, subtypesof(/datum/blobstrain) - list(/datum/ overmind.color = complementary_color for(var/BL in GLOB.blobs) var/obj/structure/blob/B = BL - B.update_icon() + B.update_appearance() for(var/BLO in overmind.blob_mobs) var/mob/living/simple_animal/hostile/blob/BM = BLO BM.update_icons() //If it's getting a new strain, tell it what it does! diff --git a/code/modules/antagonists/blob/blobstrains/replicating_foam.dm b/code/modules/antagonists/blob/blobstrains/replicating_foam.dm index f6bd6c9ef525..4800aed698d2 100644 --- a/code/modules/antagonists/blob/blobstrains/replicating_foam.dm +++ b/code/modules/antagonists/blob/blobstrains/replicating_foam.dm @@ -17,7 +17,7 @@ var/obj/structure/blob/newB = B.expand(null, null, 0) if(newB) newB.obj_integrity = B.obj_integrity - damage - newB.update_icon() + newB.update_appearance() return ..() diff --git a/code/modules/antagonists/blob/overmind.dm b/code/modules/antagonists/blob/overmind.dm index 25857459d556..a2b1022bb186 100644 --- a/code/modules/antagonists/blob/overmind.dm +++ b/code/modules/antagonists/blob/overmind.dm @@ -57,7 +57,7 @@ GLOBAL_LIST_EMPTY(blob_nodes) set_strain(BS) color = blobstrain.complementary_color if(blob_core) - blob_core.update_icon() + blob_core.update_appearance() announcement_time = world.time + 6000 . = ..() START_PROCESSING(SSobj, src) @@ -178,7 +178,7 @@ GLOBAL_LIST_EMPTY(blob_nodes) var/obj/structure/blob/B = BL if(B && B.overmind == src) B.overmind = null - B.update_icon() //reset anything that was ours + B.update_appearance() //reset anything that was ours for(var/BLO in blob_mobs) var/mob/living/simple_animal/hostile/blob/BM = BLO if(BM) diff --git a/code/modules/antagonists/blob/powers.dm b/code/modules/antagonists/blob/powers.dm index b119dc500208..2fba8e460e22 100644 --- a/code/modules/antagonists/blob/powers.dm +++ b/code/modules/antagonists/blob/powers.dm @@ -55,7 +55,7 @@ core.overmind = src blobs_legit += src blob_core = core - core.update_icon() + core.update_appearance() update_health_hud() placed = 1 return 1 @@ -181,7 +181,7 @@ if(LAZYLEN(candidates)) //if we got at least one candidate, they're a blobbernaut now. B.max_integrity = initial(B.max_integrity) * 0.25 //factories that produced a blobbernaut have much lower health B.obj_integrity = min(B.obj_integrity, B.max_integrity) - B.update_icon() + B.update_appearance() B.visible_message("The blobbernaut [pick("rips", "tears", "shreds")] its way out of the factory blob!") playsound(B.loc, 'sound/effects/splat.ogg', 50, TRUE) var/mob/living/simple_animal/hostile/blob/blobbernaut/blobber = new /mob/living/simple_animal/hostile/blob/blobbernaut(get_turf(B)) diff --git a/code/modules/antagonists/blob/structures/_blob.dm b/code/modules/antagonists/blob/structures/_blob.dm index 1fb0b0b12142..726c12fbd1bc 100644 --- a/code/modules/antagonists/blob/structures/_blob.dm +++ b/code/modules/antagonists/blob/structures/_blob.dm @@ -30,7 +30,7 @@ overmind.blobs_legit += src GLOB.blobs += src //Keep track of the blob in the normal list either way setDir(pick(GLOB.cardinals)) - update_icon() + update_appearance() if(atmosblock) air_update_turf(1) ConsumeTile() @@ -72,6 +72,7 @@ return !atmosblock /obj/structure/blob/update_icon() //Updates color based on overmind color if we have an overmind. + . = ..() if(overmind) add_atom_colour(overmind.blobstrain.color, FIXED_COLOUR_PRIORITY) else @@ -92,7 +93,7 @@ var/obj/structure/blob/B = L if(!B.overmind && !istype(B, /obj/structure/blob/core) && prob(30)) B.overmind = pulsing_overmind //reclaim unclaimed, non-core blobs. - B.update_icon() + B.update_appearance() var/distance = get_dist(get_turf(src), get_turf(B)) var/expand_probablity = max(20 - distance * 8, 1) if(B.Adjacent(src)) @@ -116,7 +117,7 @@ if(heal_timestamp <= world.time) obj_integrity = min(max_integrity, obj_integrity+health_regen) heal_timestamp = world.time + 20 - update_icon() + update_appearance() pulse_timestamp = world.time + 10 return 1 //we did it, we were pulsed! return 0 //oh no we failed @@ -174,7 +175,7 @@ if(T.Enter(B,src)) //NOW we can attempt to move into the tile B.density = initial(B.density) B.forceMove(T) - B.update_icon() + B.update_appearance() if(B.overmind && expand_reaction) B.overmind.blobstrain.expand_reaction(src, B, T, controller) return B @@ -279,7 +280,7 @@ /obj/structure/blob/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir) . = ..() if(. && obj_integrity > 0) - update_icon() + update_appearance() /obj/structure/blob/obj_destruction(damage_flag) if(overmind) @@ -291,7 +292,7 @@ CRASH("change_to(): invalid type for blob") var/obj/structure/blob/B = new type(src.loc, controller) B.creation_action() - B.update_icon() + B.update_appearance() B.setDir(dir) qdel(src) return B @@ -334,20 +335,27 @@ return "Currently weak to brute damage." return "N/A" -/obj/structure/blob/normal/update_icon() - ..() +/obj/structure/blob/normal/update_name() + . = ..() + name = "[(obj_integrity <= 15) ? "fragile " : (overmind ? null : "dead ")][initial(name)]" + +/obj/structure/blob/normal/update_desc() + . = ..() if(obj_integrity <= 15) - icon_state = "blob_damaged" - name = "fragile blob" desc = "A thin lattice of slightly twitching tendrils." + else if(overmind) + desc = "A thick wall of writhing tendrils." + else + desc = "A thick wall of lifeless tendrils." + +/obj/structure/blob/normal/update_icon_state() + icon_state = "blob[(obj_integrity <= 15) ? "_damaged" : null]" + + /// - [] TODO: Move this elsewhere + if(obj_integrity <= 15) brute_resist = 0.5 else if (overmind) - icon_state = "blob" - name = "blob" - desc = "A thick wall of writhing tendrils." brute_resist = 0.25 else - icon_state = "blob" - name = "dead blob" - desc = "A thick wall of lifeless tendrils." brute_resist = 0.25 + return ..() diff --git a/code/modules/antagonists/blob/structures/core.dm b/code/modules/antagonists/blob/structures/core.dm index 37c5cf42a90d..ebebdc336676 100644 --- a/code/modules/antagonists/blob/structures/core.dm +++ b/code/modules/antagonists/blob/structures/core.dm @@ -14,31 +14,34 @@ GLOB.blob_cores += src START_PROCESSING(SSobj, src) GLOB.poi_list |= src - update_icon() //so it atleast appears + update_appearance() //so it atleast appears if(!placed && !overmind) return INITIALIZE_HINT_QDEL if(overmind) - update_icon() + update_appearance() . = ..() +/obj/structure/blob/special/core/Destroy() + GLOB.blob_cores -= src + if(overmind) + overmind.blob_core = null + overmind = null + STOP_PROCESSING(SSobj, src) + return ..() + /obj/structure/blob/core/scannerreport() return "Directs the blob's expansion, gradually expands, and sustains nearby blob spores and blobbernauts." -/obj/structure/blob/core/update_icon() - cut_overlays() - color = null +/obj/structure/blob/special/core/update_overlays() + . = ..() var/mutable_appearance/blob_overlay = mutable_appearance('icons/mob/blob.dmi', "blob") if(overmind) blob_overlay.color = overmind.blobstrain.color - add_overlay(blob_overlay) - add_overlay(mutable_appearance('icons/mob/blob.dmi', "blob_core_overlay")) + . += blob_overlay + . += mutable_appearance('icons/mob/blob.dmi', "blob_core_overlay") -/obj/structure/blob/core/Destroy() - GLOB.blob_cores -= src - if(overmind) - overmind.blob_core = null - overmind = null - STOP_PROCESSING(SSobj, src) +/obj/structure/blob/special/core/update_appearance() + color = null GLOB.poi_list -= src return ..() diff --git a/code/modules/antagonists/blob/structures/node.dm b/code/modules/antagonists/blob/structures/node.dm index 8a8645c1518d..de7c674b807c 100644 --- a/code/modules/antagonists/blob/structures/node.dm +++ b/code/modules/antagonists/blob/structures/node.dm @@ -19,13 +19,16 @@ return "Gradually expands and sustains nearby blob spores and blobbernauts." /obj/structure/blob/node/update_icon() - cut_overlays() color = null + return ..() + +/obj/structure/blob/special/node/update_overlays() + . = ..() var/mutable_appearance/blob_overlay = mutable_appearance('icons/mob/blob.dmi', "blob") if(overmind) blob_overlay.color = overmind.blobstrain.color - add_overlay(blob_overlay) - add_overlay(mutable_appearance('icons/mob/blob.dmi', "blob_node_overlay")) + . += blob_overlay + . += mutable_appearance('icons/mob/blob.dmi', "blob_node_overlay") /obj/structure/blob/node/Destroy() GLOB.blob_nodes -= src diff --git a/code/modules/antagonists/blob/structures/shield.dm b/code/modules/antagonists/blob/structures/shield.dm index bd0e8c62c683..f0a01f70e1a8 100644 --- a/code/modules/antagonists/blob/structures/shield.dm +++ b/code/modules/antagonists/blob/structures/shield.dm @@ -19,19 +19,23 @@ /obj/structure/blob/shield/core point_return = 0 -/obj/structure/blob/shield/update_icon() - ..() - if(obj_integrity < max_integrity * 0.5) - icon_state = "[initial(icon_state)]_damaged" - name = "weakened [initial(name)]" - desc = "[damaged_desc]" - atmosblock = FALSE - else - icon_state = initial(icon_state) - name = initial(name) - desc = initial(desc) - atmosblock = TRUE - air_update_turf(1) +/obj/structure/blob/shield/update_name(updates) + . = ..() + name = "[(obj_integrity < (max_integrity * 0.5)) ? "weakened " : null][initial(name)]" + +/obj/structure/blob/shield/update_desc(updates) + . = ..() + desc = (obj_integrity < (max_integrity * 0.5)) ? "[damaged_desc]" : initial(desc) + +/obj/structure/blob/shield/take_damage(damage_amount, damage_type, damage_flag, sound_effect, attack_dir) + . = ..() + if(. && obj_integrity > 0) + atmosblock = obj_integrity < (max_integrity * 0.5) + air_update_turf(TRUE, atmosblock) + +/obj/structure/blob/shield/update_icon_state() + icon_state = "[initial(icon_state)][(obj_integrity < (max_integrity * 0.5)) ? "_damaged" : null]" + return ..() /obj/structure/blob/shield/reflective name = "reflective blob" diff --git a/code/modules/antagonists/cult/cult_items.dm b/code/modules/antagonists/cult/cult_items.dm index 8a8736d32c5a..7eb00197b742 100644 --- a/code/modules/antagonists/cult/cult_items.dm +++ b/code/modules/antagonists/cult/cult_items.dm @@ -379,6 +379,7 @@ /obj/item/sharpener/cult/update_icon_state() icon_state = "cult_sharpener[used ? "_used" : ""]" + return ..() /obj/item/clothing/suit/hooded/cultrobes/cult_shield name = "empowered cultist armor" @@ -580,6 +581,7 @@ name = "blood halberd" desc = "A sickening spear composed entirely of crystallized blood." icon_state = "bloodspear0" + base_icon_state = "occultpoleaxe" lefthand_file = 'icons/mob/inhands/weapons/polearms_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/polearms_righthand.dmi' slot_flags = 0 @@ -602,7 +604,7 @@ /obj/item/cult_spear/ComponentInitialize() . = ..() AddComponent(/datum/component/butchering, 100, 90) - AddComponent(/datum/component/two_handed, force_unwielded=17, force_wielded=24, icon_wielded="bloodspear1") + AddComponent(/datum/component/two_handed, force_unwielded=17, force_wielded=24, icon_wielded="[base_icon_state]1") /// triggered on wield of two handed item /obj/item/cult_spear/proc/on_wield(obj/item/source, mob/user) @@ -617,7 +619,8 @@ wielded = FALSE /obj/item/cult_spear/update_icon_state() - icon_state = "bloodspear0" + icon_state = "[base_icon_state]0" + return ..() /obj/item/cult_spear/Destroy() if(spear_act) diff --git a/code/modules/antagonists/cult/cult_structures.dm b/code/modules/antagonists/cult/cult_structures.dm index f2f6856755d6..8c60f724215d 100644 --- a/code/modules/antagonists/cult/cult_structures.dm +++ b/code/modules/antagonists/cult/cult_structures.dm @@ -58,10 +58,11 @@ . = ..() if(isnull(.)) return - update_icon() + update_appearance() /obj/structure/destructible/cult/update_icon_state() icon_state = "[initial(icon_state)][anchored ? null : "_off"]" + return ..() /obj/structure/destructible/cult/attackby(obj/I, mob/user, params) if(istype(I, /obj/item/melee/cultblade/dagger) && iscultist(user)) diff --git a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm index 9f5b2b7d0e68..c3595010981f 100644 --- a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm +++ b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm @@ -37,7 +37,7 @@ GLOB.nuke_list += src core = new /obj/item/nuke_core(src) STOP_PROCESSING(SSobj, core) - update_icon() + update_appearance() GLOB.poi_list |= src previous_level = get_security_level() @@ -109,7 +109,7 @@ if(I.use_tool(src, user, 60, volume=100)) deconstruction_state = NUKESTATE_UNSCREWED to_chat(user, "You remove the screws from [src]'s front panel.") - update_icon() + update_appearance() return if(NUKESTATE_PANEL_REMOVED) @@ -120,7 +120,7 @@ if(I.use_tool(src, user, 80, volume=100, amount=1)) to_chat(user, "You cut [src]'s inner plate.") deconstruction_state = NUKESTATE_WELDED - update_icon() + update_appearance() return if(NUKESTATE_CORE_EXPOSED) if(istype(I, /obj/item/nuke_core_container)) @@ -130,7 +130,7 @@ if(core_box.load(core, user)) to_chat(user, "You load the plutonium core into [core_box].") deconstruction_state = NUKESTATE_CORE_REMOVED - update_icon() + update_appearance() core = null else to_chat(user, "You fail to load the plutonium core into [core_box]. [core_box] has already been used!") @@ -144,7 +144,7 @@ to_chat(user, "You repair [src]'s inner metal plate. The radiation is contained.") deconstruction_state = NUKESTATE_PANEL_REMOVED STOP_PROCESSING(SSobj, core) - update_icon() + update_appearance() return . = ..() @@ -156,14 +156,14 @@ if(tool.use_tool(src, user, 30, volume=100)) to_chat(user, "You remove [src]'s front panel.") deconstruction_state = NUKESTATE_PANEL_REMOVED - update_icon() + update_appearance() return TRUE if(NUKESTATE_WELDED) to_chat(user, "You start prying off [src]'s inner plate...") if(tool.use_tool(src, user, 30, volume=100)) to_chat(user, "You pry off [src]'s inner plate. You can see the core's green glow!") deconstruction_state = NUKESTATE_CORE_EXPOSED - update_icon() + update_appearance() START_PROCESSING(SSobj, core) return TRUE @@ -180,7 +180,7 @@ /obj/machinery/nuclearbomb/update_icon_state() if(deconstruction_state != NUKESTATE_INTACT) icon_state = "nuclearbomb_base" - return + return ..() switch(get_nuke_state()) if(NUKE_OFF_LOCKED, NUKE_OFF_UNLOCKED) icon_state = "nuclearbomb_base" @@ -188,6 +188,7 @@ icon_state = "nuclearbomb_timing" if(NUKE_ON_EXPLODING) icon_state = "nuclearbomb_exploding" + return ..() /obj/machinery/nuclearbomb/update_overlays() . += ..() @@ -407,7 +408,7 @@ timing = FALSE detonation_timer = null countdown.stop() - update_icon() + update_appearance() /obj/machinery/nuclearbomb/proc/set_active() if(safety) @@ -427,7 +428,7 @@ S.switch_mode_to(initial(S.mode)) S.alert = FALSE countdown.stop() - update_icon() + update_appearance() /obj/machinery/nuclearbomb/proc/get_time_left() if(timing) @@ -454,7 +455,7 @@ exploding = TRUE yes_code = FALSE safety = TRUE - update_icon() + update_appearance() sound_to_playing_players('sound/machines/alarm.ogg') if(SSticker && SSticker.mode) SSticker.roundend_check_paused = TRUE @@ -550,7 +551,7 @@ S.switch_mode_to(initial(S.mode)) S.alert = FALSE countdown.stop() - update_icon() + update_appearance() /obj/machinery/nuclearbomb/beer/proc/fizzbuzz() var/datum/reagents/R = new/datum/reagents(1000) diff --git a/code/modules/antagonists/revolution/revolution.dm b/code/modules/antagonists/revolution/revolution.dm index 88cdc68a2c8b..8a9200fb08d0 100644 --- a/code/modules/antagonists/revolution/revolution.dm +++ b/code/modules/antagonists/revolution/revolution.dm @@ -146,7 +146,7 @@ to_chat(admin, "Repairing flash failed!") else flash.burnt_out = FALSE - flash.update_icon() + flash.update_appearance() /datum/antagonist/rev/head/proc/admin_demote(datum/mind/target,mob/user) message_admins("[key_name_admin(user)] has demoted [key_name_admin(owner)] from head revolutionary.") diff --git a/code/modules/antagonists/traitor/equipment/Malf_Modules.dm b/code/modules/antagonists/traitor/equipment/Malf_Modules.dm index db65e0cbd688..0a2d4268ba9f 100644 --- a/code/modules/antagonists/traitor/equipment/Malf_Modules.dm +++ b/code/modules/antagonists/traitor/equipment/Malf_Modules.dm @@ -626,7 +626,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/AI_Module)) /datum/action/innate/ai/break_fire_alarms/Activate() for(var/obj/machinery/firealarm/F in GLOB.machines) F.obj_flags |= EMAGGED - F.update_icon() + F.update_appearance() to_chat(owner, "All thermal sensors on the station have been disabled. Fire alerts will no longer be recognized.") owner.playsound_local(owner, 'sound/machines/terminal_off.ogg', 50, 0) diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index b040be6b05d9..4917e1587fcc 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -18,8 +18,12 @@ throw_range = 7 drop_sound = 'sound/items/handling/component_drop.ogg' pickup_sound = 'sound/items/handling/component_pickup.ogg' - var/is_position_sensitive = FALSE //set to true if the device has different icons for each position. - //This will prevent things such as visible lasers from facing the incorrect direction when transformed by assembly_holder's update_icon() + + + //Set to true if the device has different icons for each position. + //This will prevent things such as visible lasers from facing the incorrect direction when transformed by assembly_holder's update_appearance() + + var/is_position_sensitive = FALSE var/secured = TRUE var/list/attached_overlays = null var/obj/item/assembly_holder/holder = null @@ -92,7 +96,7 @@ /obj/item/assembly/proc/toggle_secure() secured = !secured - update_icon() + update_appearance() return secured /obj/item/assembly/attackby(obj/item/W, mob/user, params) diff --git a/code/modules/assembly/bomb.dm b/code/modules/assembly/bomb.dm index bbbd54feed12..ab64cdc86700 100644 --- a/code/modules/assembly/bomb.dm +++ b/code/modules/assembly/bomb.dm @@ -26,10 +26,13 @@ /obj/item/onetankbomb/examine(mob/user) return bombtank.examine(user) +/obj/item/onetankbomb/update_icon(updates) + icon = bombtank?.icon || initial(icon) + return ..() + /obj/item/onetankbomb/update_icon_state() - if(bombtank) - icon = bombtank.icon - icon_state = bombtank.icon_state + icon_state = bombtank?.icon_state || initial(icon_state) + return ..() /obj/item/onetankbomb/update_overlays() . = ..() @@ -142,7 +145,7 @@ master = bomb forceMove(bomb) - bomb.update_icon() + bomb.update_appearance() user.put_in_hands(bomb) //Equips the bomb if possible, or puts it on the floor. to_chat(user, "You attach [assembly] to [src].") diff --git a/code/modules/assembly/doorcontrol.dm b/code/modules/assembly/doorcontrol.dm index f7fb2164dfe3..40a10a168ea0 100644 --- a/code/modules/assembly/doorcontrol.dm +++ b/code/modules/assembly/doorcontrol.dm @@ -61,7 +61,7 @@ if(specialfunctions & BOLTS) if(!D.wires.is_cut(WIRE_BOLTS) && D.hasPower()) D.locked = !D.locked - D.update_icon() + D.update_appearance() if(specialfunctions & SHOCK) if(D.secondsElectrified) D.set_electrified(MACHINE_ELECTRIFIED_PERMANENT, usr) diff --git a/code/modules/assembly/flash.dm b/code/modules/assembly/flash.dm index 8386bfe2e002..b7a1ba88f39b 100644 --- a/code/modules/assembly/flash.dm +++ b/code/modules/assembly/flash.dm @@ -14,6 +14,9 @@ light_color = COLOR_WHITE light_power = FLASH_LIGHT_POWER light_on = FALSE + /// Whether we currently have the flashing overlay. + var/flashing = FALSE + /// The overlay we use for flashing. var/flashing_overlay = "flash-f" var/times_used = 0 //Number of times it's been used. var/burnt_out = FALSE //Is the flash burnt out? @@ -22,18 +25,22 @@ var/cooldown = 0 var/last_trigger = 0 //Last time it was successfully triggered. -/obj/item/assembly/flash/update_icon(flash = FALSE) - cut_overlays() +/obj/item/assembly/flash/update_icon(updates=ALL, flash = FALSE) + flashing = flash + . = ..() + if(flash) + addtimer(CALLBACK(src, /atom/.proc/update_icon), 5) + holder?.update_icon(updates) + +/obj/item/assembly/flash/update_overlays() attached_overlays = list() + . = ..() if(burnt_out) - add_overlay("flashburnt") + . += "flashburnt" attached_overlays += "flashburnt" - if(flash) - add_overlay(flashing_overlay) + if(flashing) + . += flashing_overlay attached_overlays += flashing_overlay - addtimer(CALLBACK(src, /atom/.proc/update_icon), 5) - if(holder) - holder.update_icon() /obj/item/assembly/flash/proc/clown_check(mob/living/carbon/human/user) if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50)) @@ -44,7 +51,7 @@ /obj/item/assembly/flash/proc/burn_out() //Made so you can override it if you want to have an invincible flash from R&D or something. if(!burnt_out) burnt_out = TRUE - update_icon() + update_appearance() if(ismob(loc)) var/mob/M = loc M.visible_message("[src] burns out!","[src] burns out!") @@ -93,7 +100,7 @@ addtimer(CALLBACK(src, .proc/flash_end), FLASH_LIGHT_DURATION, TIMER_OVERRIDE|TIMER_UNIQUE) times_used++ flash_recharge() - update_icon(TRUE) + update_icon(ALL, TRUE) if(user && !clown_check(user)) return FALSE return TRUE @@ -144,7 +151,7 @@ else if(issilicon(M)) var/mob/living/silicon/robot/R = M log_combat(user, R, "flashed", src) - update_icon(1) + update_icon(ALL, TRUE) R.Paralyze(rand(80,120)) var/diff = 5 * CONFUSION_STACK_MAX_MULTIPLIER - M.confused R.confused += min(5, diff) @@ -241,7 +248,7 @@ overheat = TRUE addtimer(CALLBACK(src, .proc/cooldown), flashcd) playsound(src, 'sound/weapons/flash.ogg', 100, TRUE) - update_icon(1) + update_icon(ALL, TRUE) return TRUE diff --git a/code/modules/assembly/health.dm b/code/modules/assembly/health.dm index 0af6c85fb6b5..2a07737e2c63 100644 --- a/code/modules/assembly/health.dm +++ b/code/modules/assembly/health.dm @@ -27,7 +27,7 @@ else scanning = FALSE STOP_PROCESSING(SSobj, src) - update_icon() + update_appearance() return secured /obj/item/assembly/health/AltClick(mob/living/user) diff --git a/code/modules/assembly/holder.dm b/code/modules/assembly/holder.dm index cf517fa4eb55..4d2ffdac5d4e 100644 --- a/code/modules/assembly/holder.dm +++ b/code/modules/assembly/holder.dm @@ -34,7 +34,7 @@ attach(A,user) attach(A2,user) name = "[A.name]-[A2.name] assembly" - update_icon() + update_appearance() SSblackbox.record_feedback("tally", "assembly_made", 1, "[initial(A.name)]-[initial(A2.name)]") /obj/item/assembly_holder/proc/attach(obj/item/assembly/A, mob/user) @@ -51,27 +51,31 @@ a_right = A A.holder_movement() -/obj/item/assembly_holder/update_icon() - cut_overlays() +/obj/item/assembly_holder/update_appearance(updates=ALL) + . = ..() + master?.update_appearance(updates) + +/obj/item/assembly_holder/update_overlays() + . = ..() if(a_left) - add_overlay("[a_left.icon_state]_left") - for(var/O in a_left.attached_overlays) - add_overlay("[O]_l") + . += "[a_left.icon_state]_left" + for(var/left_overlay in a_left.attached_overlays) + . += "[left_overlay]_l" + if(!a_right) + return - if(a_right) - if(a_right.is_position_sensitive) - add_overlay("[a_right.icon_state]_right") - for(var/O in a_right.attached_overlays) - add_overlay("[O]_r") - else - var/mutable_appearance/right = mutable_appearance(icon, "[a_right.icon_state]_left") - right.transform = matrix(-1, 0, 0, 0, 1, 0) - for(var/O in a_right.attached_overlays) - right.add_overlay("[O]_l") - add_overlay(right) + if(a_right.is_position_sensitive) + . += "[a_right.icon_state]_right" + for(var/right_overlay in a_right.attached_overlays) + . += "[right_overlay]_r" + return + + var/mutable_appearance/right = mutable_appearance(icon, "[a_right.icon_state]_left") + right.transform = matrix(-1, 0, 0, 0, 1, 0) + for(var/right_overlay in a_right.attached_overlays) + right.add_overlay("[right_overlay]_l") + . += right - if(master) - master.update_icon() /obj/item/assembly_holder/proc/on_entered(datum/source, atom/movable/AM as mob|obj) SIGNAL_HANDLER diff --git a/code/modules/assembly/infrared.dm b/code/modules/assembly/infrared.dm index 734a14220c2a..bc8fdcc3d908 100644 --- a/code/modules/assembly/infrared.dm +++ b/code/modules/assembly/infrared.dm @@ -42,7 +42,7 @@ return FALSE //Cooldown check on = !on refreshBeam() - update_icon() + update_appearance() return TRUE /obj/item/assembly/infra/toggle_secure() @@ -53,22 +53,23 @@ else QDEL_LIST(beams) STOP_PROCESSING(SSobj, src) - update_icon() + update_appearance() return secured -/obj/item/assembly/infra/update_icon() - cut_overlays() - attached_overlays = list() - if(on) - add_overlay("infrared_on") - attached_overlays += "infrared_on" - if(visible && secured) - add_overlay("infrared_visible") - attached_overlays += "infrared_visible" +/obj/item/assembly/infra/update_appearance(updates=ALL) + . = ..() + holder?.update_appearance(updates) - if(holder) - holder.update_icon() - return +/obj/item/assembly/infra/update_overlays() + . = ..() + attached_overlays = list() + if(!on) + return + . += "infrared_on" + attached_overlays += "infrared_on" + if(visible && secured) + . += "infrared_visible" + attached_overlays += "infrared_visible" /obj/item/assembly/infra/dropped() . = ..() @@ -211,7 +212,7 @@ visible = !visible . = TRUE - update_icon() + update_appearance() refreshBeam() /***************************IBeam*********************************/ diff --git a/code/modules/assembly/mousetrap.dm b/code/modules/assembly/mousetrap.dm index e96d602c3cae..bf9353a658d9 100644 --- a/code/modules/assembly/mousetrap.dm +++ b/code/modules/assembly/mousetrap.dm @@ -24,16 +24,16 @@ if((HAS_TRAIT(user, TRAIT_DUMB) || HAS_TRAIT(user, TRAIT_CLUMSY)) && prob(50)) to_chat(user, "Your hand slips, setting off the trigger!") pulse(FALSE) - update_icon() + update_appearance() playsound(src, 'sound/weapons/handcuffs.ogg', 30, TRUE, -3) -/obj/item/assembly/mousetrap/update_icon() - if(armed) - icon_state = "mousetraparmed" - else - icon_state = "mousetrap" - if(holder) - holder.update_icon() +/obj/item/assembly/mousetrap/update_icon_state() + icon_state = "mousetrap[armed ? "armed" : ""]" + return ..() + +/obj/item/assembly/mousetrap/update_icon(updates=ALL) + . = ..() + holder?.update_icon(updates) /obj/item/assembly/mousetrap/proc/triggered(mob/target, type = "feet") if(!armed) @@ -44,7 +44,7 @@ if(HAS_TRAIT(H, TRAIT_PIERCEIMMUNE)) playsound(src, 'sound/effects/snap.ogg', 50, TRUE) armed = FALSE - update_icon() + update_appearance() pulse(FALSE) return FALSE switch(type) @@ -65,7 +65,7 @@ M.splat() playsound(src, 'sound/effects/snap.ogg', 50, TRUE) armed = FALSE - update_icon() + update_appearance() pulse(FALSE) @@ -85,7 +85,7 @@ return to_chat(user, "You disarm [src].") armed = !armed - update_icon() + update_appearance() playsound(src, 'sound/weapons/handcuffs.ogg', 30, TRUE, -3) diff --git a/code/modules/assembly/proximity.dm b/code/modules/assembly/proximity.dm index 5877f1d9c687..c68ee14dd867 100644 --- a/code/modules/assembly/proximity.dm +++ b/code/modules/assembly/proximity.dm @@ -32,7 +32,7 @@ timing = !timing else scanning = FALSE - update_icon() + update_appearance() return TRUE /obj/item/assembly/prox_sensor/on_detach() @@ -53,7 +53,7 @@ else START_PROCESSING(SSobj, src) proximity_monitor.SetHost(loc,src) - update_icon() + update_appearance() return secured /obj/item/assembly/prox_sensor/HasProximity(atom/movable/AM as mob|obj) @@ -85,7 +85,7 @@ return FALSE scanning = scan proximity_monitor.SetRange(scanning ? sensitivity : 0) - update_icon() + update_appearance() /obj/item/assembly/prox_sensor/proc/sensitivity_change(value) var/sense = min(max(sensitivity + value, 0), 5) @@ -93,18 +93,19 @@ if(scanning && proximity_monitor.SetRange(sense)) sense() -/obj/item/assembly/prox_sensor/update_icon() - cut_overlays() +/obj/item/assembly/prox_sensor/update_appearance() + . = ..() + holder?.update_appearance() + +/obj/item/assembly/prox_sensor/update_overlays() + . = ..() attached_overlays = list() if(timing) add_overlay("prox_timing") - attached_overlays += "prox_timing" + . += "prox_timing" if(scanning) add_overlay("prox_scanning") - attached_overlays += "prox_scanning" - if(holder) - holder.update_icon() - return + . += "prox_scanning" /obj/item/assembly/prox_sensor/ui_status(mob/user) if(is_secured(user)) @@ -142,7 +143,7 @@ . = TRUE if("time") timing = !timing - update_icon() + update_appearance() . = TRUE if("input") var/value = text2num(params["adjust"]) diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm index fc2f42864f91..d403449df893 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -31,10 +31,9 @@ signal() return TRUE -/obj/item/assembly/signaler/update_icon() - if(holder) - holder.update_icon() - return +/obj/item/assembly/signaler/update_appearance() + . = ..() + holder?.update_appearance() /obj/item/assembly/signaler/ui_status(mob/user) if(is_secured(user)) @@ -80,7 +79,7 @@ code = initial(code) . = TRUE - update_icon() + update_appearance() /obj/item/assembly/signaler/attackby(obj/item/W, mob/user, params) if(issignaler(W)) diff --git a/code/modules/assembly/timer.dm b/code/modules/assembly/timer.dm index 152c5f6bb5ec..90f45df20179 100644 --- a/code/modules/assembly/timer.dm +++ b/code/modules/assembly/timer.dm @@ -29,7 +29,7 @@ if(!..()) return FALSE//Cooldown check timing = !timing - update_icon() + update_appearance() return TRUE /obj/item/assembly/timer/toggle_secure() @@ -39,7 +39,7 @@ else timing = FALSE STOP_PROCESSING(SSobj, src) - update_icon() + update_appearance() return secured /obj/item/assembly/timer/proc/timer_end() @@ -51,7 +51,7 @@ hearing_mob.playsound_local(get_turf(src), 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE) if(loop) timing = TRUE - update_icon() + update_appearance() /obj/item/assembly/timer/process() if(!timing) @@ -62,14 +62,16 @@ timer_end() time = saved_time -/obj/item/assembly/timer/update_icon() - cut_overlays() +/obj/item/assembly/timer/update_appearance() + . = ..() + holder?.update_appearance() + +/obj/item/assembly/timer/update_overlays() + . = ..() attached_overlays = list() if(timing) - add_overlay("timer_timing") + . += "timer_timing" attached_overlays += "timer_timing" - if(holder) - holder.update_icon() /obj/item/assembly/timer/ui_status(mob/user) if(is_secured(user)) @@ -100,7 +102,7 @@ timing = !timing if(timing && istype(holder, /obj/item/transfer_valve)) log_bomber(usr, "activated a", src, "attachment on [holder]") - update_icon() + update_appearance() . = TRUE if("repeat") loop = !loop diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm index cc9e94b91567..bef2f277f7e1 100644 --- a/code/modules/atmospherics/machinery/airalarm.dm +++ b/code/modules/atmospherics/machinery/airalarm.dm @@ -221,7 +221,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 27) if(name == initial(name)) name = "[get_area_name(src)] Air Alarm" - update_icon() + update_appearance() /obj/machinery/airalarm/Destroy() SSradio.remove_object(src, frequency) @@ -467,7 +467,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 27) investigate_log("has had its setpoint changed to [heating_temp_setpoint] by [key_name(usr)]",INVESTIGATE_ATMOS) . = TRUE - update_icon() + update_appearance() /obj/machinery/airalarm/proc/reset(wire) @@ -475,7 +475,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 27) if(WIRE_POWER) if(!wires.is_cut(WIRE_POWER)) shorted = FALSE - update_icon() + update_appearance() if(WIRE_AI) if(!wires.is_cut(WIRE_AI)) aidisabled = FALSE @@ -656,7 +656,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 27) icon_state = "alarm_b2" if(0) icon_state = "alarm_b1" - return + return ..() icon_state = "alarm" return ..() @@ -801,7 +801,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 27) if(A.atmosalert(new_area_danger_level,src)) //if area was in normal state or if area was in alert state post_alert(new_area_danger_level) - update_icon() + update_appearance() /obj/machinery/airalarm/attackby(obj/item/W, mob/user, params) switch(buildstage) @@ -811,13 +811,13 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 27) to_chat(user, "You cut the final wires.") new /obj/item/stack/cable_coil(loc, 5) buildstage = 1 - update_icon() + update_appearance() return else if(W.tool_behaviour == TOOL_SCREWDRIVER) // Opening that Air Alarm up. W.play_tool_sound(src) panel_open = !panel_open to_chat(user, "The wires have been [panel_open ? "exposed" : "unexposed"].") - update_icon() + update_appearance() return else if(istype(W, /obj/item/card/id) || istype(W, /obj/item/pda))// trying to unlock the interface with an ID card togglelock(user) @@ -836,7 +836,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 27) new /obj/item/electronics/airalarm(src.loc) playsound(src.loc, 'sound/items/deconstruct.ogg', 50, TRUE) buildstage = 0 - update_icon() + update_appearance() return if(istype(W, /obj/item/stack/cable_coil)) @@ -857,14 +857,14 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 27) shorted = 0 post_alert(0) buildstage = 2 - update_icon() + update_appearance() return if(0) if(istype(W, /obj/item/electronics/airalarm)) if(user.temporarilyRemoveItemFromInventory(W)) to_chat(user, "You insert the circuit.") buildstage = 1 - update_icon() + update_appearance() qdel(W) return @@ -875,7 +875,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 27) user.visible_message("[user] fabricates a circuit and places it into [src].", \ "You adapt an air alarm circuit and slot it into the assembly.") buildstage = 1 - update_icon() + update_appearance() return if(W.tool_behaviour == TOOL_WRENCH) @@ -898,7 +898,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 27) user.visible_message("[user] fabricates a circuit and places it into [src].", \ "You adapt an air alarm circuit and slot it into the assembly.") buildstage = 1 - update_icon() + update_appearance() return TRUE return FALSE diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm index 6e647fe9da15..a7924f4c0c3c 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -130,11 +130,11 @@ if(can_be_node(target, i)) nodes[i] = target break - update_icon() + update_appearance() /obj/machinery/atmospherics/proc/setPipingLayer(new_layer) piping_layer = (pipe_flags & PIPING_DEFAULT_LAYER_ONLY) ? PIPING_LAYER_DEFAULT : new_layer - update_icon() + update_appearance() /obj/machinery/atmospherics/proc/can_be_node(obj/machinery/atmospherics/target, iteration) return connection_check(target, piping_layer) @@ -186,7 +186,7 @@ var/ref_position = nodes.Find(reference) if(ref_position) nodes[ref_position] = null - update_icon() + update_appearance() /obj/machinery/atmospherics/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/pipe)) //lets you autodrop diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm index 88edcf9cf699..9f2d582be256 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm @@ -38,7 +38,7 @@ /obj/machinery/atmospherics/components/binary/circulator/Initialize(mapload) .=..() component_parts = list(new /obj/item/circuitboard/machine/circulator) - update_icon() + update_appearance() /obj/machinery/atmospherics/components/binary/circulator/ComponentInitialize() . = ..() @@ -84,7 +84,7 @@ ..() update_icon_nopipes() -/obj/machinery/atmospherics/components/binary/circulator/update_icon() +/obj/machinery/atmospherics/components/binary/circulator/update_appearance() cut_overlays() if(anchored) @@ -190,7 +190,7 @@ node2.addMember(src) SSair.add_to_rebuild_queue(src) - update_icon() + update_appearance() return TRUE @@ -258,7 +258,7 @@ generator.cold_circ = null else generator.hot_circ = null - generator.update_icon() + generator.update_appearance() generator = null /obj/machinery/atmospherics/components/binary/circulator/setPipingLayer(new_layer) @@ -283,5 +283,5 @@ /obj/machinery/atmospherics/components/binary/circulator/obj_break(damage_flag) if(generator) generator.kill_circs() - generator.update_icon() + generator.update_appearance() ..() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm index ed4eb50b253a..0d93d554c47f 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm @@ -202,7 +202,7 @@ addtimer(CALLBACK(src, .proc/broadcast_status), 2) if(!("status" in signal.data)) //do not update_icon - update_icon() + update_appearance() /obj/machinery/atmospherics/components/binary/dp_vent_pump/welder_act(mob/living/user, obj/item/I) ..() @@ -216,7 +216,7 @@ else user.visible_message("[user] unwelded the vent.", "You unweld the vent.", "You hear welding.") welded = FALSE - update_icon() + update_appearance() pipe_vision_img = image(src, loc, layer = ABOVE_HUD_LAYER, dir = dir) pipe_vision_img.plane = ABOVE_HUD_PLANE investigate_log("was [welded ? "welded shut" : "unwelded"] by [key_name(user)]", INVESTIGATE_ATMOS) @@ -246,7 +246,7 @@ return user.visible_message("[user] furiously claws at [src]!", "You manage to clear away the stuff blocking the vent.", "You hear loud scraping noises.") welded = FALSE - update_icon() + update_appearance() pipe_vision_img = image(src, loc, layer = ABOVE_HUD_LAYER, dir = dir) pipe_vision_img.plane = ABOVE_HUD_PLANE playsound(loc, 'sound/weapons/bladeslice.ogg', 100, TRUE) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm index 4b3da9179662..4078c9ef38c2 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm @@ -30,7 +30,7 @@ Passive gate is similar to the regular pump except: if(can_interact(user)) on = !on investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/binary/passive_gate/AltClick(mob/user) @@ -38,7 +38,7 @@ Passive gate is similar to the regular pump except: target_pressure = MAX_OUTPUT_PRESSURE investigate_log("was set to [target_pressure] kPa by [key_name(user)]", INVESTIGATE_ATMOS) to_chat(user, "You maximize the pressure output on [src] to [target_pressure] kPa.") - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/binary/passive_gate/Destroy() @@ -115,7 +115,7 @@ Passive gate is similar to the regular pump except: if(.) target_pressure = clamp(pressure, 0, MAX_OUTPUT_PRESSURE) investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() /obj/machinery/atmospherics/components/binary/passive_gate/atmosinit() ..() @@ -145,7 +145,7 @@ Passive gate is similar to the regular pump except: return broadcast_status() - update_icon() + update_appearance() /obj/machinery/atmospherics/components/binary/passive_gate/can_unwrench(mob/user) . = ..() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm index c8a00c3445ef..fd98028ca306 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm @@ -20,7 +20,7 @@ if(can_interact(user)) on = !on investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/binary/pressure_valve/AltClick(mob/user) @@ -28,7 +28,7 @@ target_pressure = MAX_OUTPUT_PRESSURE investigate_log("was set to [target_pressure] kPa by [key_name(user)]", INVESTIGATE_ATMOS) to_chat(user, span_notice("pressure output set to [target_pressure] kPa.")) - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/binary/pressure_valve/update_icon_nopipes() @@ -88,7 +88,7 @@ if(.) target_pressure = clamp(pressure, 0, ONE_ATMOSPHERE*100) investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() /obj/machinery/atmospherics/components/binary/pressure_valve/can_unwrench(mob/user) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm index 5556149b908c..8579d70a1165 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm @@ -31,7 +31,7 @@ if(can_interact(user)) on = !on investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/binary/pump/AltClick(mob/user) @@ -39,7 +39,7 @@ target_pressure = MAX_OUTPUT_PRESSURE investigate_log("was set to [target_pressure] kPa by [key_name(user)]", INVESTIGATE_ATMOS) to_chat(user, "You maximize the pressure output on [src] to [target_pressure] kPa.") - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/binary/pump/Destroy() @@ -123,7 +123,7 @@ if(.) target_pressure = clamp(pressure, 0, MAX_OUTPUT_PRESSURE) investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() /obj/machinery/atmospherics/components/binary/pump/atmosinit() ..() @@ -153,7 +153,7 @@ return broadcast_status() - update_icon() + update_appearance() /obj/machinery/atmospherics/components/binary/pump/can_unwrench(mob/user) . = ..() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/relief_valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/relief_valve.dm index 8ef01b857653..91c22fd0a884 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/relief_valve.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/relief_valve.dm @@ -104,4 +104,4 @@ if(.) close_pressure = clamp(pressure, 0, open_pressure) investigate_log("close pressure was set to [close_pressure] kPa by [key_name(usr)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/temperature_gate.dm b/code/modules/atmospherics/machinery/components/binary_devices/temperature_gate.dm index 190ad024652e..cdc0f75c6781 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/temperature_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/temperature_gate.dm @@ -23,7 +23,7 @@ if(can_interact(user)) on = !on investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/binary/temperature_gate/AltClick(mob/user) @@ -31,7 +31,7 @@ target_temperature = max_temperature investigate_log("was set to [target_temperature] K by [key_name(user)]", INVESTIGATE_ATMOS) to_chat(user, "You set the target temperature on [src] to [target_temperature] K.") - update_icon() + update_appearance() return ..() @@ -108,7 +108,7 @@ if(.) target_temperature = clamp(minimum_temperature, temperature, max_temperature) investigate_log("was set to [target_temperature] K by [key_name(usr)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() /obj/machinery/atmospherics/components/binary/temperature_gate/can_unwrench(mob/user) . = ..() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm index 6d09aeb2b143..eff2a0525230 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm @@ -18,14 +18,14 @@ if(can_interact(user)) on = !on investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/binary/temperature_pump/AltClick(mob/user) if(can_interact(user) && !(heat_transfer_rate == max_heat_transfer_rate)) heat_transfer_rate = max_heat_transfer_rate investigate_log("was set to [heat_transfer_rate]% by [key_name(user)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/binary/temperature_pump/update_icon_nopipes() @@ -91,4 +91,4 @@ if(.) heat_transfer_rate = clamp(rate, 0, max_heat_transfer_rate) investigate_log("was set to [heat_transfer_rate]% by [key_name(usr)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm index 12a07cba9f5f..3cbd43897878 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm @@ -32,7 +32,7 @@ if(can_interact(user)) on = !on investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/binary/volume_pump/AltClick(mob/user) @@ -40,7 +40,7 @@ transfer_rate = MAX_TRANSFER_RATE investigate_log("was set to [transfer_rate] L/s by [key_name(user)]", INVESTIGATE_ATMOS) to_chat(user, "You maximize the volume output on [src] to [transfer_rate] L/s.") - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/binary/volume_pump/Destroy() @@ -143,7 +143,7 @@ if(.) transfer_rate = clamp(rate, 0, MAX_TRANSFER_RATE) investigate_log("was set to [transfer_rate] L/s by [key_name(usr)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() /obj/machinery/atmospherics/components/binary/volume_pump/receive_signal(datum/signal/signal) if(!signal.data["tag"] || (signal.data["tag"] != id) || (signal.data["sigtype"]!="command")) @@ -169,7 +169,7 @@ return //do not update_icon broadcast_status() - update_icon() + update_appearance() /obj/machinery/atmospherics/components/binary/volume_pump/can_unwrench(mob/user) . = ..() diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm index 46ecc06af84b..b4a02de7d108 100644 --- a/code/modules/atmospherics/machinery/components/components_base.dm +++ b/code/modules/atmospherics/machinery/components/components_base.dm @@ -36,7 +36,7 @@ /obj/machinery/atmospherics/components/proc/hide_pipe(datum/source, covered) showpipe = !covered - update_icon() + update_appearance() /obj/machinery/atmospherics/components/update_icon() update_icon_nopipes() @@ -45,7 +45,7 @@ plane = showpipe ? FLOOR_PLANE : FLOOR_PLANE if(!showpipe) - return + return ..() var/connected = 0 //Direction bitset @@ -62,6 +62,7 @@ if(!shift_underlay_only) PIPING_LAYER_SHIFT(src, piping_layer) + return ..() /obj/machinery/atmospherics/components/proc/get_pipe_underlay(state, dir, color = null) if(color) diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm index 1797b361539b..404ecbf46eb2 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm @@ -18,7 +18,7 @@ if(can_interact(user)) on = !on investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/trinary/filter/AltClick(mob/user) @@ -26,7 +26,7 @@ transfer_rate = MAX_TRANSFER_RATE investigate_log("was set to [transfer_rate] L/s by [key_name(user)]", INVESTIGATE_ATMOS) to_chat(user, "You maximize the volume output on [src] to [transfer_rate] L/s.") - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/trinary/filter/proc/set_frequency(new_frequency) @@ -39,22 +39,13 @@ SSradio.remove_object(src,frequency) return ..() -/obj/machinery/atmospherics/components/trinary/filter/update_icon() - cut_overlays() +/obj/machinery/atmospherics/components/trinary/filter/update_overlays() + . = ..() for(var/direction in GLOB.cardinals) if(!(direction & initialize_directions)) continue var/obj/machinery/atmospherics/node = findConnecting(direction) - - var/image/cap - if(node) - cap = getpipeimage(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer, trinary = TRUE) - else - cap = getpipeimage(icon, "cap", direction, piping_layer = piping_layer, trinary = TRUE) - - add_overlay(cap) - - return ..() + . += getpipeimage(icon, "cap", direction, node?.pipe_color, piping_layer, TRUE) /obj/machinery/atmospherics/components/trinary/filter/update_icon_nopipes() var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational @@ -145,7 +136,7 @@ filter_name = GLOB.gas_data.names[gas] investigate_log("was set to filter [filter_name] by [key_name(usr)]", INVESTIGATE_ATMOS) . = TRUE - update_icon() + update_appearance() /obj/machinery/atmospherics/components/trinary/filter/can_unwrench(mob/user) . = ..() diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm index 47ec5369254a..c21aaf7ccd79 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm @@ -20,7 +20,7 @@ if(can_interact(user)) on = !on investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/trinary/mixer/AltClick(mob/user) @@ -28,25 +28,17 @@ target_pressure = MAX_OUTPUT_PRESSURE investigate_log("was set to [target_pressure] kPa by [key_name(user)]", INVESTIGATE_ATMOS) to_chat(user, "You maximize the pressure output on [src] to [target_pressure] kPa.") - update_icon() + update_appearance() return ..() -/obj/machinery/atmospherics/components/trinary/mixer/update_icon() - cut_overlays() +/obj/machinery/atmospherics/components/trinary/mixer/update_overlays() + . = ..() for(var/direction in GLOB.cardinals) if(!(direction & initialize_directions)) continue - var/obj/machinery/atmospherics/node = findConnecting(direction) - - var/image/cap - if(node) - cap = getpipeimage(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer, trinary = TRUE) - else - cap = getpipeimage(icon, "cap", direction, piping_layer = piping_layer, trinary = TRUE) - add_overlay(cap) - - return ..() + var/obj/machinery/atmospherics/node = findConnecting(direction) + . += getpipeimage(icon, "cap", direction, node?.pipe_color, piping_layer, TRUE) /obj/machinery/atmospherics/components/trinary/mixer/update_icon_nopipes() var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational @@ -168,7 +160,7 @@ adjust_node1_value(100 - value) investigate_log("was set to [node2_concentration] % on node 2 by [key_name(usr)]", INVESTIGATE_ATMOS) . = TRUE - update_icon() + update_appearance() /obj/machinery/atmospherics/components/trinary/mixer/proc/adjust_node1_value(newValue) node1_concentration = newValue / 100 diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index 2fccbc914f91..3864bc2ada18 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -53,7 +53,7 @@ var/oldoccupant = occupant . = ..() // Parent proc takes care of removing occupant if necessary if (AM == oldoccupant) - update_icon() + update_appearance() /obj/machinery/atmospherics/components/unary/cryo_cell/on_construction() ..(dir, dir) @@ -102,7 +102,7 @@ beaker = null /obj/machinery/atmospherics/components/unary/cryo_cell/update_icon() - + . = ..() cut_overlays() if(panel_open) @@ -172,7 +172,7 @@ if(old_value) //Turned off on = FALSE end_processing() - update_icon() + update_appearance() else //Turned on begin_processing() @@ -190,7 +190,7 @@ if(mob_occupant.health >= mob_occupant.getMaxHealth()) // Don't bother with fully healed people. on = FALSE - update_icon() + update_appearance() playsound(src, 'sound/machines/cryo_warning.ogg', volume) // Bug the doctors. var/msg = "Patient fully restored." if(autoeject) // Eject if configured. @@ -225,7 +225,7 @@ if(!nodes[1] || !airs[1] || air1.get_moles(GAS_O2) < 5) // Turn off if the machine won't work due to not having enough moles to operate. on = FALSE - update_icon() + update_appearance() return if(occupant) @@ -320,7 +320,7 @@ || default_change_direction_wrench(user, I) \ || default_pry_open(I) \ || default_deconstruction_crowbar(I)) - update_icon() + update_appearance() return else if(I.tool_behaviour == TOOL_SCREWDRIVER) to_chat(user, "You can't access the maintenance panel while the pod is " \ @@ -398,7 +398,7 @@ on = FALSE else if(!state_open) on = TRUE - update_icon() + update_appearance() . = TRUE if("door") if(state_open) @@ -420,7 +420,7 @@ /obj/machinery/atmospherics/components/unary/cryo_cell/CtrlClick(mob/user) if(can_interact(user) && !state_open) on = !on - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/unary/cryo_cell/AltClick(mob/user) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm index 26c473c975f7..a73d70bb99f7 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm @@ -23,13 +23,15 @@ piping_layer = 4 icon_state = "he_map-4" +/obj/machinery/atmospherics/components/unary/heat_exchanger/update_icon_state() + icon_state = "he[nodes[1] ? 1 : 0]" + return ..() + /obj/machinery/atmospherics/components/unary/heat_exchanger/update_icon() + . = ..() if(nodes[1]) - icon_state = "he1" var/obj/machinery/atmospherics/node = nodes[1] add_atom_colour(node.color, FIXED_COLOUR_PRIORITY) - else - icon_state = "he0" PIPING_LAYER_SHIFT(src, piping_layer) /obj/machinery/atmospherics/components/unary/heat_exchanger/atmosinit() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm index bc424d1b7ecc..a051df7de2c9 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm @@ -28,7 +28,7 @@ if(can_interact(user)) on = !on investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/unary/outlet_injector/AltClick(mob/user) @@ -36,7 +36,7 @@ volume_rate = MAX_TRANSFER_RATE investigate_log("was set to [volume_rate] L/s by [key_name(user)]", INVESTIGATE_ATMOS) to_chat(user, "You maximize the volume output on [src] to [volume_rate] L/s.") - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/unary/outlet_injector/Destroy() @@ -135,7 +135,7 @@ addtimer(CALLBACK(src, .proc/broadcast_status), 2) if(!("status" in signal.data)) //do not update_icon - update_icon() + update_appearance() /obj/machinery/atmospherics/components/unary/outlet_injector/ui_interact(mob/user, datum/tgui/ui) @@ -172,7 +172,7 @@ if(.) volume_rate = clamp(rate, 0, MAX_TRANSFER_RATE) investigate_log("was set to [volume_rate] L/s by [key_name(usr)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() broadcast_status() /obj/machinery/atmospherics/components/unary/outlet_injector/can_unwrench(mob/user) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/relief_valve.dm b/code/modules/atmospherics/machinery/components/unary_devices/relief_valve.dm index 1bc4bf810d48..d5f51757685d 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/relief_valve.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/relief_valve.dm @@ -102,4 +102,4 @@ if(.) close_pressure = clamp(pressure, 0, open_pressure) investigate_log("close pressure was set to [close_pressure] kPa by [key_name(usr)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm index 71828ab24921..3b570f209c8b 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm @@ -41,17 +41,20 @@ B += M.rating heat_capacity = 5000 * ((B - 1) ** 2) -/obj/machinery/atmospherics/components/unary/thermomachine/update_icon() - cut_overlays() +/obj/machinery/atmospherics/components/unary/thermomachine/update_icon_state() if(panel_open) icon_state = icon_state_open - else if(on && is_operational) + return ..() + if(on && is_operational) icon_state = icon_state_on - else - icon_state = icon_state_off + return ..() + icon_state = icon_state_off + return ..() - add_overlay(getpipeimage(icon, "pipe", dir, , piping_layer)) +/obj/machinery/atmospherics/components/unary/thermomachine/update_overlays() + . = ..() + . += getpipeimage(icon, "pipe", dir, , piping_layer) /obj/machinery/atmospherics/components/unary/thermomachine/update_icon_nopipes() cut_overlays() @@ -170,7 +173,7 @@ target_temperature = clamp(target, min_temperature, max_temperature) investigate_log("was set to [target_temperature] K by [key_name(usr)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() //WS Edit - Update from Cit's Thermomachine - PR #8800, adds additional info to ctrl and alt clicks - BFAT @@ -181,7 +184,7 @@ return on = !on investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS) message_admins("[src.name] was turned [on ? "on" : "off"] [ADMIN_LOOKUPFLW(usr)] at [ADMIN_COORDJMP(T)], [A]") diff --git a/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm b/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm index 136f540d4b96..4904d2b3a4ec 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm @@ -18,7 +18,7 @@ /obj/machinery/atmospherics/components/unary/on_construction() ..() - update_icon() + update_appearance() /obj/machinery/atmospherics/components/unary/proc/assign_uid_vents() uid = num2text(gl_uid++) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm index a3109fb98bdf..3a878409d0e2 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm @@ -250,7 +250,7 @@ // log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]") broadcast_status() - update_icon() + update_appearance() /obj/machinery/atmospherics/components/unary/vent_pump/welder_act(mob/living/user, obj/item/I) ..() @@ -264,7 +264,7 @@ else user.visible_message("[user] unwelded the vent.", "You unweld the vent.", "You hear welding.") welded = FALSE - update_icon() + update_appearance() pipe_vision_img = image(src, loc, layer = ABOVE_HUD_LAYER, dir = dir) pipe_vision_img.plane = ABOVE_HUD_PLANE investigate_log("was [welded ? "welded shut" : "unwelded"] by [key_name(user)]", INVESTIGATE_ATMOS) @@ -294,7 +294,7 @@ return user.visible_message("[user] furiously claws at [src]!", "You manage to clear away the stuff blocking the vent.", "You hear loud scraping noises.") welded = FALSE - update_icon() + update_appearance() pipe_vision_img = image(src, loc, layer = ABOVE_HUD_LAYER, dir = dir) pipe_vision_img.plane = ABOVE_HUD_PLANE playsound(loc, 'sound/weapons/bladeslice.ogg', 100, TRUE) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm index 6cd9be66ee65..0e5e7dc1c74a 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm @@ -224,7 +224,7 @@ return //do not update_icon broadcast_status() - update_icon() + update_appearance() return /obj/machinery/atmospherics/components/unary/vent_scrubber/power_change() @@ -243,7 +243,7 @@ else user.visible_message("[user] unwelds the scrubber.", "You unweld the scrubber.", "You hear welding.") welded = FALSE - update_icon() + update_appearance() pipe_vision_img = image(src, loc, layer = ABOVE_HUD_LAYER, dir = dir) pipe_vision_img.plane = ABOVE_HUD_PLANE investigate_log("was [welded ? "welded shut" : "unwelded"] by [key_name(user)]", INVESTIGATE_ATMOS) @@ -269,7 +269,7 @@ return user.visible_message("[user] furiously claws at [src]!", "You manage to clear away the stuff blocking the scrubber.", "You hear loud scraping noises.") welded = FALSE - update_icon() + update_appearance() pipe_vision_img = image(src, loc, layer = ABOVE_HUD_LAYER, dir = dir) pipe_vision_img.plane = ABOVE_HUD_PLANE playsound(loc, 'sound/weapons/bladeslice.ogg', 100, TRUE) diff --git a/code/modules/atmospherics/machinery/other/miner.dm b/code/modules/atmospherics/machinery/other/miner.dm index 5500e1bed375..37045635cf1a 100644 --- a/code/modules/atmospherics/machinery/other/miner.dm +++ b/code/modules/atmospherics/machinery/other/miner.dm @@ -72,12 +72,12 @@ /obj/machinery/atmospherics/miner/proc/set_active(setting) if(active != setting) active = setting - update_icon() + update_appearance() /obj/machinery/atmospherics/miner/proc/set_broken(setting) if(broken != setting) broken = setting - update_icon() + update_appearance() /obj/machinery/atmospherics/miner/proc/update_power() if(!active) @@ -113,7 +113,9 @@ . = ..() if(broken) . += "broken" - else if(active) + return + + if(active) var/mutable_appearance/on_overlay = mutable_appearance(icon, "on") on_overlay.color = overlay_color . += on_overlay diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/junction.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/junction.dm index ebb23870d2af..b7fca049449c 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/junction.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/junction.dm @@ -30,9 +30,9 @@ return ..(target, given_layer, FALSE) //we want a normal pipe instead return ..(target, given_layer, TRUE) -/obj/machinery/atmospherics/pipe/heat_exchanging/junction/update_icon() +/obj/machinery/atmospherics/pipe/heat_exchanging/junction/update_icon_state() icon_state = "pipe[nodes[1] ? "1" : "0"][nodes[2] ? "1" : "0"]-[piping_layer]" - update_layer() + return ..() /obj/machinery/atmospherics/pipe/heat_exchanging/junction/layer1 piping_layer = 1 diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm index 675ef020ba22..61d909c7fc71 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm @@ -26,18 +26,16 @@ initialize_directions = ALL_CARDINALS initialize_directions &= ~dir -/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/update_icon() - cut_overlays() +/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/update_overlays() + . = ..() PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer) - add_overlay(center) + . += center //Add non-broken pieces for(var/i in 1 to device_type) if(nodes[i]) - add_overlay( getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i]))) - - update_layer() + . += getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) /obj/machinery/atmospherics/pipe/heat_exchanging/manifold/layer1 piping_layer = 1 diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm index 366edcece03f..57e9b6ea797b 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm @@ -24,18 +24,16 @@ /obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w/SetInitDirections() initialize_directions = initial(initialize_directions) -/obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w/update_icon() - cut_overlays() +/obj/machinery/atmospherics/pipe/manifold4w/update_overlays() + . = ..() PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer) - add_overlay(center) + . += center //Add non-broken pieces for(var/i in 1 to device_type) if(nodes[i]) - add_overlay( getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i]))) - - update_layer() + . += getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) /obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w/layer1 piping_layer = 1 diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm index d80caf175a12..debbe9350c14 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm @@ -24,9 +24,9 @@ if(EAST, WEST) initialize_directions = EAST|WEST -/obj/machinery/atmospherics/pipe/heat_exchanging/simple/update_icon() +/obj/machinery/atmospherics/pipe/heat_exchanging/simple/update_icon_state() icon_state = "pipe[nodes[1] ? "1" : "0"][nodes[2] ? "1" : "0"]-[piping_layer]" - update_layer() + return ..() /obj/machinery/atmospherics/pipe/heat_exchanging/simple/layer1 piping_layer = 1 diff --git a/code/modules/atmospherics/machinery/pipes/layermanifold.dm b/code/modules/atmospherics/machinery/pipes/layermanifold.dm index 4e838eee617f..22ae79ad9719 100644 --- a/code/modules/atmospherics/machinery/pipes/layermanifold.dm +++ b/code/modules/atmospherics/machinery/pipes/layermanifold.dm @@ -42,34 +42,35 @@ /obj/machinery/atmospherics/pipe/layer_manifold/proc/get_all_connected_nodes() return front_nodes + back_nodes + nodes -/obj/machinery/atmospherics/pipe/layer_manifold/update_icon() //HEAVILY WIP FOR UPDATE ICONS!! +/obj/machinery/atmospherics/pipe/layer_manifold/update_layer() cut_overlays() layer = initial(layer) + (PIPING_LAYER_MAX * PIPING_LAYER_LCHANGE) //This is above everything else. +/obj/machinery/atmospherics/pipe/layer_manifold/update_overlays() + . = ..() + for(var/node in front_nodes) - add_attached_images(node) + . += get_attached_images(node) for(var/node in back_nodes) - add_attached_images(node) + . += get_attached_images(node) -/obj/machinery/atmospherics/pipe/layer_manifold/proc/add_attached_images(obj/machinery/atmospherics/A) +/obj/machinery/atmospherics/pipe/layer_manifold/proc/get_attached_images(obj/machinery/atmospherics/A) if(!A) return + + . = list() if(istype(A, /obj/machinery/atmospherics/pipe/layer_manifold)) for(var/i in PIPING_LAYER_MIN to PIPING_LAYER_MAX) - add_attached_image(get_dir(src, A), i) - return - add_attached_image(get_dir(src, A), A.piping_layer, A.pipe_color) + . += get_attached_image(get_dir(src, A), i) + return + . += get_attached_image(get_dir(src, A), A.piping_layer, A.pipe_color) -/obj/machinery/atmospherics/pipe/layer_manifold/proc/add_attached_image(p_dir, p_layer, p_color = null) - var/image/I +/obj/machinery/atmospherics/pipe/layer_manifold/proc/get_attached_image(p_dir, p_layer, p_color = null) - if(p_color) - I = getpipeimage(icon, "pipe", p_dir, p_color, piping_layer = p_layer) - else - I = getpipeimage(icon, "pipe", p_dir, piping_layer = p_layer) + var/image/I = getpipeimage(icon, "pipe-3", p_dir, p_color, p_layer) I.layer = layer - 0.01 - add_overlay(I) + return I /obj/machinery/atmospherics/pipe/layer_manifold/SetInitDirections() switch(dir) @@ -96,7 +97,7 @@ new_nodes += foundfront if(foundback && !QDELETED(foundback)) new_nodes += foundback - update_icon() + update_appearance() return new_nodes /obj/machinery/atmospherics/pipe/layer_manifold/atmosinit() @@ -123,7 +124,7 @@ if(reference in back_nodes) var/i = back_nodes.Find(reference) back_nodes[i] = null - update_icon() + update_appearance() /obj/machinery/atmospherics/pipe/layer_manifold/relaymove(mob/living/user, direction) if(initialize_directions & direction) diff --git a/code/modules/atmospherics/machinery/pipes/manifold.dm b/code/modules/atmospherics/machinery/pipes/manifold.dm index 9316e14d398a..106c7b8c7693 100644 --- a/code/modules/atmospherics/machinery/pipes/manifold.dm +++ b/code/modules/atmospherics/machinery/pipes/manifold.dm @@ -22,7 +22,7 @@ var/mutable_appearance/center -/* We use New() instead of Initialize() because these values are used in update_icon() +/* We use New() instead of Initialize() because these values are used in update_appearance() * in the mapping subsystem init before Initialize() is called in the atoms subsystem init. * This is true for the other manifolds (the 4 ways and the heat exchanges) too. */ @@ -35,16 +35,15 @@ initialize_directions = ALL_CARDINALS initialize_directions &= ~dir -/obj/machinery/atmospherics/pipe/manifold/update_icon() - cut_overlays() +/obj/machinery/atmospherics/pipe/manifold/update_overlays() + . = ..() + if(!center) center = mutable_appearance(icon, "manifold_center") PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer) - add_overlay(center) + . += center //Add non-broken pieces for(var/i in 1 to device_type) if(nodes[i]) - add_overlay( getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i]))) - - update_layer() + . += getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) diff --git a/code/modules/atmospherics/machinery/pipes/manifold4w.dm b/code/modules/atmospherics/machinery/pipes/manifold4w.dm index c00f36cdbfff..f52f0daa53b7 100644 --- a/code/modules/atmospherics/machinery/pipes/manifold4w.dm +++ b/code/modules/atmospherics/machinery/pipes/manifold4w.dm @@ -29,16 +29,16 @@ /obj/machinery/atmospherics/pipe/manifold4w/SetInitDirections() initialize_directions = initial(initialize_directions) -/obj/machinery/atmospherics/pipe/manifold4w/update_icon() - cut_overlays() +/obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w/update_overlays() + . = ..() if(!center) center = mutable_appearance(icon, "manifold_center") PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer) - add_overlay(center) + . += center //Add non-broken pieces for(var/i in 1 to device_type) if(nodes[i]) - add_overlay( getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i]))) + . += getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) update_layer() diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm index 720d22f6bff2..fcadc8cd4ff6 100644 --- a/code/modules/atmospherics/machinery/pipes/pipes.dm +++ b/code/modules/atmospherics/machinery/pipes/pipes.dm @@ -95,6 +95,10 @@ qdel(meter) . = ..() +/obj/machinery/atmospherics/pipe/update_icon() + . = ..() + update_layer() + /obj/machinery/atmospherics/pipe/proc/update_node_icon() for(var/i in 1 to device_type) if(nodes[i]) diff --git a/code/modules/atmospherics/machinery/pipes/simple.dm b/code/modules/atmospherics/machinery/pipes/simple.dm index 3c945933dd18..0fdba0c1dd0b 100644 --- a/code/modules/atmospherics/machinery/pipes/simple.dm +++ b/code/modules/atmospherics/machinery/pipes/simple.dm @@ -31,6 +31,6 @@ if(EAST, WEST) initialize_directions = EAST|WEST -/obj/machinery/atmospherics/pipe/simple/update_icon() +/obj/machinery/atmospherics/pipe/simple/update_icon_state() icon_state = "pipe[nodes[1] ? "1" : "0"][nodes[2] ? "1" : "0"]-[piping_layer]" - update_layer() + return ..() diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index 18601d8efc9c..6b0f025b6b89 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -168,7 +168,7 @@ timing = !timing if(timing) valve_timer = world.time + (timer_set * 10) - update_icon() + update_appearance() /obj/machinery/portable_atmospherics/canister/proto name = "prototype canister" @@ -200,7 +200,7 @@ air_contents.copy_from(existing_mixture) else create_gas() - update_icon() + update_appearance() /obj/machinery/portable_atmospherics/canister/proc/create_gas() @@ -219,6 +219,7 @@ /obj/machinery/portable_atmospherics/canister/update_icon_state() if(machine_stat & BROKEN) icon_state = "[icon_state]-1" + return ..() /obj/machinery/portable_atmospherics/canister/update_overlays() . = ..() @@ -293,7 +294,7 @@ if(.) if(close_valve) valve_open = FALSE - update_icon() + update_appearance() investigate_log("Valve was closed by [key_name(user)].", INVESTIGATE_ATMOS) else if(valve_open && holding) investigate_log("[key_name(user)] started a transfer into [holding].", INVESTIGATE_ATMOS) @@ -314,7 +315,7 @@ if(air_contents.release_gas_to(target_air, release_pressure) && !holding) air_update_turf() - update_icon() + update_appearance() /obj/machinery/portable_atmospherics/canister/ui_state(mob/user) return GLOB.physical_state @@ -459,4 +460,4 @@ investigate_log("[key_name(usr)] removed the [holding], leaving the valve open and transferring into the air.", INVESTIGATE_ATMOS) replace_tank(usr, FALSE) . = TRUE - update_icon() + update_appearance() diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm index 4c6d0ecf498f..ad5f95cf349d 100644 --- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm +++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm @@ -68,7 +68,7 @@ anchored = TRUE //Prevent movement pixel_x = new_port.pixel_x pixel_y = new_port.pixel_y - update_icon() + update_appearance() return TRUE /obj/machinery/portable_atmospherics/Move() @@ -84,7 +84,7 @@ connected_port = null pixel_x = 0 pixel_y = 0 - update_icon() + update_appearance() return TRUE /obj/machinery/portable_atmospherics/AltClick(mob/living/user) @@ -109,7 +109,7 @@ holding = null if(new_tank) holding = new_tank - update_icon() + update_appearance() return TRUE /obj/machinery/portable_atmospherics/attackby(obj/item/W, mob/user, params) @@ -121,7 +121,7 @@ to_chat(user, "[holding ? "In one smooth motion you pop [holding] out of [src]'s connector and replace it with [T]" : "You insert [T] into [src]"].") investigate_log("had its internal [holding] swapped with [T] by [key_name(user)].", INVESTIGATE_ATMOS) replace_tank(user, FALSE, T) - update_icon() + update_appearance() else if(W.tool_behaviour == TOOL_WRENCH) if(!(machine_stat & BROKEN)) if(connected_port) @@ -132,7 +132,7 @@ "[user] disconnects [src].", \ "You unfasten [src] from the port.", \ "You hear a ratchet.") - update_icon() + update_appearance() return else var/obj/machinery/atmospherics/components/unary/portables_connector/possible_port = locate(/obj/machinery/atmospherics/components/unary/portables_connector) in loc @@ -147,7 +147,7 @@ "[user] connects [src].", \ "You fasten [src] to the port.", \ "You hear a ratchet.") - update_icon() + update_appearance() investigate_log("was connected to [possible_port] by [key_name(user)].", INVESTIGATE_ATMOS) else return ..() diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm index 317a55e47d55..4cff27388903 100644 --- a/code/modules/atmospherics/machinery/portable/pump.dm +++ b/code/modules/atmospherics/machinery/portable/pump.dm @@ -32,6 +32,7 @@ /obj/machinery/portable_atmospherics/pump/update_icon_state() icon_state = "psiphon:[on]" + return ..() /obj/machinery/portable_atmospherics/pump/update_overlays() . = ..() @@ -69,7 +70,7 @@ if(prob(100 / severity)) direction = PUMP_OUT pump.target_pressure = rand(0, 100 * ONE_ATMOSPHERE) - update_icon() + update_appearance() /obj/machinery/portable_atmospherics/pump/replace_tank(mob/living/user, close_valve) . = ..() @@ -77,7 +78,7 @@ if(close_valve) if(on) on = FALSE - update_icon() + update_appearance() else if(on && holding && direction == PUMP_OUT) investigate_log("[key_name(user)] started a transfer into [holding].", INVESTIGATE_ATMOS) @@ -151,4 +152,4 @@ if(holding) replace_tank(usr, FALSE) . = TRUE - update_icon() + update_appearance() diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm index fddd2d362fa7..b608d5849e38 100644 --- a/code/modules/atmospherics/machinery/portable/scrubber.dm +++ b/code/modules/atmospherics/machinery/portable/scrubber.dm @@ -18,6 +18,7 @@ /obj/machinery/portable_atmospherics/scrubber/update_icon_state() icon_state = "pscrubber:[on]" + return ..() /obj/machinery/portable_atmospherics/scrubber/update_overlays() . = ..() @@ -54,7 +55,7 @@ if(is_operational) if(prob(50 / severity)) on = !on - update_icon() + update_appearance() /obj/machinery/portable_atmospherics/scrubber/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) @@ -87,7 +88,7 @@ if(close_valve) if(on) on = FALSE - update_icon() + update_appearance() else if(on && holding) investigate_log("[key_name(user)] started a transfer into [holding].", INVESTIGATE_ATMOS) @@ -106,7 +107,7 @@ if("toggle_filter") scrubbing ^= params["val"] . = TRUE - update_icon() + update_appearance() /obj/machinery/portable_atmospherics/scrubber/huge name = "huge air scrubber" @@ -130,11 +131,12 @@ /obj/machinery/portable_atmospherics/scrubber/huge/update_icon_state() icon_state = "scrubber:[on]" + return ..() /obj/machinery/portable_atmospherics/scrubber/huge/process_atmos() if((!anchored && !movable) || !is_operational) on = FALSE - update_icon() + update_appearance() use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE if(!on) return diff --git a/code/modules/atmospherics/multiz.dm b/code/modules/atmospherics/multiz.dm index ab2753809f70..f4363ee88286 100644 --- a/code/modules/atmospherics/multiz.dm +++ b/code/modules/atmospherics/multiz.dm @@ -4,14 +4,16 @@ icon_state = "multiz_pipe" icon = 'icons/obj/atmos.dmi' -/obj/machinery/atmospherics/pipe/simple/multiz/update_icon() +/obj/machinery/atmospherics/pipe/multiz/update_layer() + return // Noop because we're moving this to /obj/machinery/atmospherics/pipe + +/obj/machinery/atmospherics/pipe/multiz/update_overlays() . = ..() - cut_overlays() //This adds the overlay showing it's a multiz pipe. This should go above turfs and such var/image/multiz_overlay_node = new(src) //If we have a firing state, light em up! multiz_overlay_node.icon = 'icons/obj/atmos.dmi' multiz_overlay_node.icon_state = "multiz_pipe" multiz_overlay_node.layer = HIGH_OBJ_LAYER - add_overlay(multiz_overlay_node) + . += multiz_overlay_node ///Attempts to locate a multiz pipe that's above us, if it finds one it merges us into its pipenet /obj/machinery/atmospherics/pipe/simple/multiz/pipeline_expansion() diff --git a/code/modules/awaymissions/gateway.dm b/code/modules/awaymissions/gateway.dm index b05ebf430e6d..d41b68de24a2 100644 --- a/code/modules/awaymissions/gateway.dm +++ b/code/modules/awaymissions/gateway.dm @@ -176,7 +176,7 @@ GLOBAL_LIST_EMPTY(gateway_destinations) /obj/machinery/gateway/Initialize() generate_destination() - update_icon() + update_appearance() portal_visuals = new vis_contents += portal_visuals return ..() @@ -193,7 +193,7 @@ GLOBAL_LIST_EMPTY(gateway_destinations) dest.deactivate(src) QDEL_NULL(portal) use_power = IDLE_POWER_USE - update_icon() + update_appearance() portal_visuals.reset_visuals() /obj/machinery/gateway/process() @@ -216,7 +216,7 @@ GLOBAL_LIST_EMPTY(gateway_destinations) portal_visuals.setup_visuals(target) generate_bumper() use_power = ACTIVE_POWER_USE - update_icon() + update_appearance() /obj/machinery/gateway/proc/Transfer(atom/movable/AM) if(!target || !target.incoming_pass_check(AM)) diff --git a/code/modules/awaymissions/mission_code/challenge.dm b/code/modules/awaymissions/mission_code/challenge.dm index 4df8fbf32f89..05d079220151 100644 --- a/code/modules/awaymissions/mission_code/challenge.dm +++ b/code/modules/awaymissions/mission_code/challenge.dm @@ -20,6 +20,7 @@ desc = "A heavy duty industrial laser." icon = 'icons/obj/singularity.dmi' icon_state = "emitter_+a" + base_icon_state = "emitter_+a" anchored = TRUE density = TRUE resistance_flags = INDESTRUCTIBLE | FIRE_PROOF | ACID_PROOF diff --git a/code/modules/buildmode/buildmode.dm b/code/modules/buildmode/buildmode.dm index 921d1e057bbc..8ee15ad72e2c 100644 --- a/code/modules/buildmode/buildmode.dm +++ b/code/modules/buildmode/buildmode.dm @@ -130,12 +130,12 @@ close_switchstates() mode = new newmode(src) mode.enter_mode(src) - modebutton.update_icon() + modebutton.update_appearance() /datum/buildmode/proc/change_dir(newdir) build_dir = newdir close_dirswitch() - dirbutton.update_icon() + dirbutton.update_appearance() return 1 /datum/buildmode/proc/InterceptClickOn(mob/user, params, atom/object) diff --git a/code/modules/buildmode/buttons.dm b/code/modules/buildmode/buttons.dm index 25132f957a96..a1893b4b6232 100644 --- a/code/modules/buildmode/buttons.dm +++ b/code/modules/buildmode/buttons.dm @@ -24,11 +24,12 @@ else if(LAZYACCESS(modifiers, RIGHT_CLICK)) bd.mode.change_settings(usr.client) - update_icon() + update_appearance() return 1 /atom/movable/screen/buildmode/mode/update_icon_state() icon_state = bd.mode.get_button_iconstate() + return ..() /atom/movable/screen/buildmode/help icon_state = "buildhelp" @@ -46,10 +47,11 @@ /atom/movable/screen/buildmode/bdir/update_icon_state() dir = bd.build_dir + return ..() /atom/movable/screen/buildmode/bdir/Click() bd.toggle_dirswitch() - update_icon() + update_appearance() return 1 // used to switch between modes diff --git a/code/modules/cargo/bounty_console.dm b/code/modules/cargo/bounty_console.dm index 097c9e84807e..f8017122b040 100644 --- a/code/modules/cargo/bounty_console.dm +++ b/code/modules/cargo/bounty_console.dm @@ -26,7 +26,7 @@ /obj/item/paper/bounty_printout/Initialize() . = ..() default_raw_text = "

    Nanotrasen Cargo Bounties


    " - update_icon() + update_appearance() for(var/datum/bounty/bounty as anything in GLOB.bounties_list) if(bounty.claimed) diff --git a/code/modules/cargo/centcom_podlauncher.dm b/code/modules/cargo/centcom_podlauncher.dm index fccc26b521b8..3e5938bbaa55 100644 --- a/code/modules/cargo/centcom_podlauncher.dm +++ b/code/modules/cargo/centcom_podlauncher.dm @@ -557,7 +557,7 @@ return var/obj/structure/closet/supplypod/centcompod/toLaunch = DuplicateObject(temp_pod) //Duplicate the temp_pod (which we have been varediting or configuring with the UI) and store the result toLaunch.bay = bay //Bay is currently a nonstatic expression, so it cant go into toLaunch using DuplicateObject - toLaunch.update_icon()//we update_icon() here so that the door doesnt "flicker on" right after it lands + toLaunch.update_appearance()//we update_appearance() here so that the door doesnt "flicker on" right after it lands var/shippingLane = GLOB.areas_by_type[/area/centcom/supplypod/flyMeToTheMoon] toLaunch.forceMove(shippingLane) if (launchClone) //We arent launching the actual items from the bay, rather we are creating clones and launching those diff --git a/code/modules/cargo/expressconsole.dm b/code/modules/cargo/expressconsole.dm index 533bd895ceee..9074a87d7bbe 100644 --- a/code/modules/cargo/expressconsole.dm +++ b/code/modules/cargo/expressconsole.dm @@ -245,7 +245,7 @@ rank = "Silicon" var/datum/supply_order/SO = new(pack, name, rank, usr.ckey, "") new /obj/effect/DPtarget(landing_turf, podType, SO) - update_icon() // ?????????????????? + update_appearance() // ?????????????????? return TRUE if("mission-act") diff --git a/code/modules/cargo/gondolapod.dm b/code/modules/cargo/gondolapod.dm index 31998df93f41..72d4d409ccb6 100644 --- a/code/modules/cargo/gondolapod.dm +++ b/code/modules/cargo/gondolapod.dm @@ -39,6 +39,7 @@ icon_state = "gondolapod_open" else icon_state = "gondolapod" + return ..() /mob/living/simple_animal/pet/gondola/gondolapod/verb/deliver() set name = "Release Contents" @@ -65,12 +66,12 @@ /mob/living/simple_animal/pet/gondola/gondolapod/proc/setOpened() opened = TRUE - update_icon() + update_appearance() addtimer(CALLBACK(src, .proc/setClosed), 50) /mob/living/simple_animal/pet/gondola/gondolapod/proc/setClosed() opened = FALSE - update_icon() + update_appearance() /mob/living/simple_animal/pet/gondola/gondolapod/death() qdel(linked_pod) //Will cause the open() proc for the linked supplypod to be called with the "broken" parameter set to true, meaning that it will dump its contents on death diff --git a/code/modules/cargo/supplypod.dm b/code/modules/cargo/supplypod.dm index 39410aa07a35..f33ade28bfb8 100644 --- a/code/modules/cargo/supplypod.dm +++ b/code/modules/cargo/supplypod.dm @@ -98,7 +98,7 @@ if (!adminNamed && !specialised) //We dont want to name it ourselves if it has been specifically named by an admin using the centcom_podlauncher datum name = POD_STYLES[chosenStyle][POD_NAME] desc = POD_STYLES[chosenStyle][POD_DESC] - update_icon() + update_appearance() /obj/structure/closet/supplypod/tool_interact(obj/item/W, mob/user) if(bluespace) //We dont want to worry about interacting with bluespace pods, as they are due to delete themselves soon anyways. @@ -212,7 +212,7 @@ playsound(get_turf(holder), openingSound, soundVolume, FALSE, FALSE) //Special admin sound to play INVOKE_ASYNC(holder, .proc/setOpened) //Use the INVOKE_ASYNC proc to call setOpened() on whatever the holder may be, without giving the atom/movable base class a setOpened() proc definition if (style == STYLE_SEETHROUGH) - update_icon() + update_appearance() for (var/atom/movable/O in holder.contents) //Go through the contents of the holder O.forceMove(T) //move everything from the contents of the holder to the turf of the holder if (!effectQuiet && !openingSound && style != STYLE_SEETHROUGH) //If we aren't being quiet, play the default pod open sound @@ -254,10 +254,10 @@ handleReturningClose(holder, FALSE) /obj/structure/closet/supplypod/proc/setOpened() //Proc exists here, as well as in any atom that can assume the role of a "holder" of a supplypod. Check the open() proc for more details - update_icon() + update_appearance() /obj/structure/closet/supplypod/proc/setClosed() //Ditto - update_icon() + update_appearance() /obj/structure/closet/supplypod/Destroy() open_pod(holder = src, broken = TRUE) //Lets dump our contents by opening up @@ -348,7 +348,7 @@ addtimer(CALLBACK(src, .proc/endLaunch), pod.fallDuration, TIMER_CLIENT_TIME) //Go onto the last step after a very short falling animation /obj/effect/DPtarget/proc/endLaunch() - pod.update_icon() + pod.update_appearance() pod.forceMove(drop_location()) //The fallingPod animation is over, now's a good time to forceMove the actual pod into position QDEL_NULL(fallingPod) //Delete the falling pod effect, because at this point its animation is over. We dont use temp_visual because we want to manually delete it as soon as the pod appears for (var/mob/living/M in src) //Remember earlier (initialization) when we moved mobs into the DPTarget so they wouldnt get lost in nullspace? Time to get them out diff --git a/code/modules/cargo/supplypod_beacon.dm b/code/modules/cargo/supplypod_beacon.dm index 31cb4a7f82a1..b5ae8023bb4d 100644 --- a/code/modules/cargo/supplypod_beacon.dm +++ b/code/modules/cargo/supplypod_beacon.dm @@ -29,16 +29,19 @@ playsound(src,'sound/machines/synth_no.ogg',50,FALSE) if (SP_UNREADY) ready = FALSE - update_icon() + update_appearance() /obj/item/supplypod_beacon/update_overlays() . = ..() - if (launched) + if(launched) . += "sp_green" - else if (ready) + return + if(ready) . += "sp_yellow" - else if (linked) + return + if(linked) . += "sp_orange" + return /obj/item/supplypod_beacon/proc/endLaunch() launched = FALSE diff --git a/code/modules/client/preferences_toggles.dm b/code/modules/client/preferences_toggles.dm index 6b1d5f097840..3a4204feb103 100644 --- a/code/modules/client/preferences_toggles.dm +++ b/code/modules/client/preferences_toggles.dm @@ -334,7 +334,7 @@ GLOBAL_LIST_INIT(ghost_forms, sortList(list("ghost","ghostking","ghostian2","ske prefs.save_preferences() if(isobserver(mob)) var/mob/dead/observer/O = mob - O.update_icon(new_form) + O.update_icon(ALL, new_form) GLOBAL_LIST_INIT(ghost_orbits, list(GHOST_ORBIT_CIRCLE,GHOST_ORBIT_TRIANGLE,GHOST_ORBIT_SQUARE,GHOST_ORBIT_HEXAGON,GHOST_ORBIT_PENTAGON)) @@ -363,7 +363,7 @@ GLOBAL_LIST_INIT(ghost_orbits, list(GHOST_ORBIT_CIRCLE,GHOST_ORBIT_TRIANGLE,GHOS prefs.save_preferences() if(isobserver(mob)) var/mob/dead/observer/O = mob - O.update_icon() + O.update_appearance() /client/verb/pick_ghost_customization() set name = "Ghost Customization" diff --git a/code/modules/clothing/chameleon.dm b/code/modules/clothing/chameleon.dm index 1b10fb109c40..f8ee83b60b0c 100644 --- a/code/modules/clothing/chameleon.dm +++ b/code/modules/clothing/chameleon.dm @@ -278,7 +278,7 @@ var/obj/item/pda/agent_pda = target if(istype(agent_pda)) agent_pda.update_label() - agent_pda.update_icon() + agent_pda.update_appearance() /datum/action/item_action/chameleon/change/pda/apply_job_data(datum/job/job_datum) ..() diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 9c70b89c2924..9a5ad91cef0e 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -262,18 +262,19 @@ /obj/item/clothing/update_overlays() . = ..() - if(damaged_clothes) - var/index = "[REF(initial(icon))]-[initial(icon_state)]" - var/static/list/damaged_clothes_icons = list() - var/icon/damaged_clothes_icon = damaged_clothes_icons[index] - if(!damaged_clothes_icon) - damaged_clothes_icon = icon(initial(icon), initial(icon_state), , 1) //we only want to apply damaged effect to the initial icon_state for each object - damaged_clothes_icon.Blend("#fff", ICON_ADD) //fills the icon_state with white (except where it's transparent) - damaged_clothes_icon.Blend(icon('icons/effects/item_damage.dmi', "itemdamaged"), ICON_MULTIPLY) //adds damage effect and the remaining white areas become transparant - damaged_clothes_icon = fcopy_rsc(damaged_clothes_icon) - damaged_clothes_icons[index] = damaged_clothes_icon - . += damaged_clothes_icon + if(!damaged_clothes) + return + var/index = "[REF(initial(icon))]-[initial(icon_state)]" + var/static/list/damaged_clothes_icons = list() + var/icon/damaged_clothes_icon = damaged_clothes_icons[index] + if(!damaged_clothes_icon) + damaged_clothes_icon = icon(initial(icon), initial(icon_state), , 1) //we only want to apply damaged effect to the initial icon_state for each object + damaged_clothes_icon.Blend("#fff", ICON_ADD) //fills the icon_state with white (except where it's transparent) + damaged_clothes_icon.Blend(icon('icons/effects/item_damage.dmi', "itemdamaged"), ICON_MULTIPLY) //adds damage effect and the remaining white areas become transparant + damaged_clothes_icon = fcopy_rsc(damaged_clothes_icon) + damaged_clothes_icons[index] = damaged_clothes_icon + . += damaged_clothes_icon /* * SEE_SELF // can see self, no matter what * SEE_MOBS // can see all mobs, no matter what diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm index 778ab19c266c..a94a18bce614 100644 --- a/code/modules/clothing/glasses/_glasses.dm +++ b/code/modules/clothing/glasses/_glasses.dm @@ -329,11 +329,12 @@ /obj/item/clothing/glasses/blindfold/white/visual_equipped(mob/living/carbon/human/user, slot) if(ishuman(user) && slot == ITEM_SLOT_EYES) - update_icon(user) + update_icon(ALL, user) user.update_inv_glasses() //Color might have been changed by update_icon. ..() -/obj/item/clothing/glasses/blindfold/white/update_icon(mob/living/carbon/human/user) +/obj/item/clothing/glasses/blindfold/white/update_icon(updates = ALL, mob/living/carbon/human/user) + . = ..() if(ishuman(user) && !colored_before) add_atom_colour("#[user.eye_color]", FIXED_COLOUR_PRIORITY) colored_before = TRUE diff --git a/code/modules/clothing/glasses/engine_goggles.dm b/code/modules/clothing/glasses/engine_goggles.dm index db7611262a96..05ec517c4afc 100644 --- a/code/modules/clothing/glasses/engine_goggles.dm +++ b/code/modules/clothing/glasses/engine_goggles.dm @@ -25,7 +25,7 @@ /obj/item/clothing/glasses/meson/engine/Initialize() . = ..() START_PROCESSING(SSobj, src) - update_icon() + update_appearance() /obj/item/clothing/glasses/meson/engine/ComponentInitialize() . = ..() @@ -66,7 +66,7 @@ if(H.glasses == src) H.update_sight() - update_icon() + update_appearance() for(var/X in actions) var/datum/action/A = X A.UpdateButtonIcon() @@ -133,6 +133,7 @@ /obj/item/clothing/glasses/meson/engine/update_icon_state() icon_state = item_state = "trayson-[mode]" + return ..() /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 6cfbbd0921a8..7885e4636823 100644 --- a/code/modules/clothing/head/hardhat.dm +++ b/code/modules/clothing/head/hardhat.dm @@ -46,7 +46,7 @@ turn_on(user) else turn_off(user) - update_icon() + update_appearance() /obj/item/clothing/head/hardhat/update_icon_state() if(on) @@ -55,6 +55,7 @@ else icon_state = "[initial(icon_state)]" item_state = "[initial(icon_state)]" + return ..() /obj/item/clothing/head/hardhat/proc/turn_on(mob/user) set_light_on(TRUE) @@ -158,7 +159,7 @@ /obj/item/clothing/head/hardhat/weldhat/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/clothing/head/hardhat/weldhat/attack_self(mob/living/user) toggle_helmet_light(user) @@ -170,7 +171,7 @@ /obj/item/clothing/head/hardhat/weldhat/proc/toggle_welding_screen(mob/living/user) if(weldingvisortoggle(user)) playsound(src, 'sound/mecha/mechmove03.ogg', 50, TRUE) //Visors don't just come from nothing - update_icon() + update_appearance() /obj/item/clothing/head/hardhat/weldhat/worn_overlays(isinhands) . = ..() diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index 8a1b48b49c58..35960c36bbab 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -47,7 +47,7 @@ if(A == attached_light) set_attached_light(null) update_helmlight() - update_icon() + update_appearance() QDEL_NULL(action_light) qdel(A) return ..() @@ -105,7 +105,7 @@ return to_chat(user, "You click [attaching_seclite] into place on [src].") set_attached_light(attaching_seclite) - update_icon() + update_appearance() update_helmlight() action_light = new(src) if(loc == user) @@ -125,7 +125,7 @@ var/obj/item/flashlight/removed_light = set_attached_light(null) update_helmlight() removed_light.update_brightness(user) - update_icon() + update_appearance() user.update_inv_head() QDEL_NULL(action_light) return TRUE @@ -150,7 +150,7 @@ /obj/item/clothing/head/helmet/proc/update_helmlight() if(attached_light) - update_icon() + update_appearance() for(var/datum/action/action as anything in actions) action.UpdateButtonIcon() @@ -229,7 +229,7 @@ /obj/item/clothing/head/helmet/marine/Initialize(mapload) set_attached_light(new /obj/item/flashlight/seclite) update_helmlight() - update_icon() + update_appearance() . = ..() /obj/item/clothing/head/helmet/marine/security diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index 795a06443f4e..94cd299b3cc0 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -173,11 +173,12 @@ /obj/item/clothing/head/kitty/visual_equipped(mob/living/carbon/human/user, slot) if(ishuman(user) && slot == ITEM_SLOT_HEAD) - update_icon(user) + update_icon(ALL, user) user.update_inv_head() //Color might have been changed by update_icon. ..() -/obj/item/clothing/head/kitty/update_icon(mob/living/carbon/human/user) +/obj/item/clothing/head/kitty/update_icon(updates=ALL, mob/living/carbon/human/user) + . = ..() if(ishuman(user)) add_atom_colour("#[user.hair_color]", FIXED_COLOUR_PRIORITY) @@ -232,7 +233,7 @@ /obj/item/clothing/head/wig/Initialize(mapload) . = ..() - update_icon() + update_appearance() /obj/item/clothing/head/wig/update_icon_state() var/datum/sprite_accessory/S = GLOB.hairstyles_list[hairstyle] @@ -242,6 +243,7 @@ else icon = S.icon icon_state = S.icon_state + return ..() /obj/item/clothing/head/wig/worn_overlays(isinhands = FALSE, file2use) . = list() @@ -264,7 +266,7 @@ user.visible_message("[user] changes \the [src]'s hairstyle to [new_style].", "You change \the [src]'s hairstyle to [new_style].") if(newcolor && newcolor != color) // only update if necessary add_atom_colour(newcolor, FIXED_COLOUR_PRIORITY) - update_icon() + update_appearance() /obj/item/clothing/head/wig/afterattack(mob/living/carbon/human/target, mob/user) . = ..() @@ -272,7 +274,7 @@ to_chat(user, "You adjust the [src] to look just like [target.name]'s [target.hairstyle].") add_atom_colour("#[target.hair_color]", FIXED_COLOUR_PRIORITY) hairstyle = target.hairstyle - update_icon() + update_appearance() /obj/item/clothing/head/wig/random/Initialize(mapload) hairstyle = pick(GLOB.hairstyles_list - "Bald") //Don't want invisible wig @@ -295,7 +297,7 @@ if(ishuman(user) && slot == ITEM_SLOT_HEAD) if (color != "#[user.hair_color]") // only update if necessary add_atom_colour("#[user.hair_color]", FIXED_COLOUR_PRIORITY) - update_icon() + update_appearance() user.update_inv_head() /obj/item/clothing/head/bronze diff --git a/code/modules/clothing/shoes/bananashoes.dm b/code/modules/clothing/shoes/bananashoes.dm index 28bbd8b969d7..a09ea07a3250 100644 --- a/code/modules/clothing/shoes/bananashoes.dm +++ b/code/modules/clothing/shoes/bananashoes.dm @@ -28,7 +28,7 @@ on = !on if(!always_noslip) clothing_flags &= ~NOSLIP - update_icon() + update_appearance() to_chat(loc, "You ran out of bananium!") else new /obj/item/grown/bananapeel/specialpeel(get_step(src,turn(wearer.dir, 180))) //honk @@ -50,7 +50,7 @@ var/datum/component/material_container/bananium = GetComponent(/datum/component/material_container) if(bananium.get_material_amount(/datum/material/bananium)) on = !on - update_icon() + update_appearance() to_chat(user, "You [on ? "activate" : "deactivate"] the prototype shoes.") if(!always_noslip) if(on) @@ -65,3 +65,4 @@ icon_state = "clown_prototype_on" else icon_state = "clown_prototype_off" + return ..() diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index d95f24acb2d3..9b044b8cf0b9 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -331,6 +331,7 @@ /obj/item/clothing/head/helmet/space/hardsuit/syndi/update_icon_state() icon_state = "hardsuit[on]-[hardsuit_type]" + return ..() /obj/item/clothing/head/helmet/space/hardsuit/syndi/Initialize() . = ..() @@ -366,7 +367,7 @@ else flags_cover &= ~(HEADCOVERSMOUTH) flags_inv &= ~visor_flags_inv - update_icon() + update_appearance() playsound(src.loc, 'sound/mecha/mechmove03.ogg', 50, TRUE) toggle_hardsuit_mode(user) user.update_inv_head() @@ -395,7 +396,7 @@ linkedsuit.flags_inv &= ~(HIDEGLOVES | HIDESHOES | HIDEJUMPSUIT) linkedsuit.icon_state = "hardsuit[on]-[hardsuit_type]" - linkedsuit.update_icon() + linkedsuit.update_appearance() user.update_inv_wear_suit() user.update_inv_w_uniform() user.update_equipment_speed_mods() @@ -986,7 +987,7 @@ turn_on(user) else turn_off(user) - update_icon() + update_appearance() /obj/item/clothing/head/helmet/space/light/update_icon_state() if(on) @@ -995,6 +996,7 @@ else icon_state = "[initial(icon_state)]" item_state = "[initial(icon_state)]" + return ..() /obj/item/clothing/head/helmet/space/light/proc/turn_on(mob/user) set_light_on(TRUE) @@ -1118,6 +1120,7 @@ /obj/item/clothing/head/helmet/space/pilot/update_icon_state() icon_state = "space-pilot-[skin][up]" + return ..() /obj/item/clothing/head/helmet/space/pilot/New() ..() @@ -1167,7 +1170,7 @@ flags_cover &= ~(HEADCOVERSEYES | HEADCOVERSMOUTH) flags_inv &= ~visor_flags_inv cold_protection &= ~HEAD - update_icon() + update_appearance() playsound(src.loc, 'sound/mecha/mechmove03.ogg', 50, TRUE) user.update_inv_head() if(iscarbon(user)) diff --git a/code/modules/clothing/spacesuits/plasmamen.dm b/code/modules/clothing/spacesuits/plasmamen.dm index 74b9161c521f..e6e15c51aecc 100644 --- a/code/modules/clothing/spacesuits/plasmamen.dm +++ b/code/modules/clothing/spacesuits/plasmamen.dm @@ -71,7 +71,7 @@ /obj/item/clothing/head/helmet/space/plasmaman/Initialize() . = ..() visor_toggling() - update_icon() + update_appearance() /obj/item/clothing/head/helmet/space/plasmaman/AltClick(mob/user) if(user.canUseTopic(src, BE_CLOSE)) @@ -83,10 +83,10 @@ to_chat(user, "Your helmet's torch can't pass through your welding visor!") helmet_on = FALSE playsound(src, 'sound/mecha/mechmove03.ogg', 50, TRUE) //Visors don't just come from nothing - update_icon() + update_appearance() else playsound(src, 'sound/mecha/mechmove03.ogg', 50, TRUE) //Visors don't just come from nothing - update_icon() + update_appearance() /obj/item/clothing/head/helmet/space/plasmaman/update_overlays() . = ..() @@ -102,7 +102,7 @@ smile = TRUE smile_color = CR.paint_color to_chat(user, "You draw a smiley on the helmet visor.") - update_icon() + update_appearance() else to_chat(user, "Seems like someone already drew something on this helmet's visor!") @@ -121,7 +121,7 @@ . = ..() if(smile && (clean_types & CLEAN_TYPE_PAINT)) smile = FALSE - update_icon() + update_appearance() return TRUE /obj/item/clothing/head/helmet/space/plasmaman/attack_self(mob/user) diff --git a/code/modules/disks/disk.dm b/code/modules/disks/disk.dm index 9d2f4aac8232..f3d9939becfe 100644 --- a/code/modules/disks/disk.dm +++ b/code/modules/disks/disk.dm @@ -32,7 +32,7 @@ add_atom_colour(random_disk_colors[our_color], FIXED_COLOUR_PRIORITY) else add_atom_colour(color, FIXED_COLOUR_PRIORITY) - update_icon() + update_appearance() update_overlays() /obj/item/disk/update_overlays() diff --git a/code/modules/donator/_donator.dm b/code/modules/donator/_donator.dm index ee596645d7ca..02631ee8ea28 100644 --- a/code/modules/donator/_donator.dm +++ b/code/modules/donator/_donator.dm @@ -290,7 +290,7 @@ GLOBAL_PROTECT(donators) reward.icon = initial(reward.icon) reward.icon_state = reskin_target - reward.update_icon() + reward.update_appearance() return TRUE if(REWARD_CONV) diff --git a/code/modules/events/prison_break.dm b/code/modules/events/prison_break.dm index 5adb1fe27f93..8e3fe9b0a94a 100644 --- a/code/modules/events/prison_break.dm +++ b/code/modules/events/prison_break.dm @@ -47,7 +47,7 @@ if(istype(O, /obj/structure/closet/secure_closet)) var/obj/structure/closet/secure_closet/temp = O temp.locked = FALSE - temp.update_icon() + temp.update_appearance() else if(istype(O, /obj/machinery/door/airlock)) var/obj/machinery/door/airlock/temp = O if(temp.critical_machine) //Skip doors in critical positions, such as the SM chamber. diff --git a/code/modules/events/stray_cargo.dm b/code/modules/events/stray_cargo.dm index 905de941d211..4c740ad924ae 100644 --- a/code/modules/events/stray_cargo.dm +++ b/code/modules/events/stray_cargo.dm @@ -49,7 +49,7 @@ var/datum/supply_pack/SP = new pack_type var/obj/structure/closet/crate/crate = SP.generate(null) crate.locked = FALSE //Unlock secure crates - crate.update_icon() + crate.update_appearance() var/obj/structure/closet/supplypod/pod = make_pod() new /obj/effect/DPtarget(LZ, pod, crate) diff --git a/code/modules/fishing/fishing_portal_machine.dm b/code/modules/fishing/fishing_portal_machine.dm index d85565ced0bb..0cbeae7c3dac 100644 --- a/code/modules/fishing/fishing_portal_machine.dm +++ b/code/modules/fishing/fishing_portal_machine.dm @@ -36,12 +36,12 @@ /obj/machinery/fishing_portal_generator/proc/activate() active = AddComponent(/datum/component/fishing_spot, fishing_source) use_power = ACTIVE_POWER_USE - update_icon() + update_appearance() /obj/machinery/fishing_portal_generator/proc/deactivate() QDEL_NULL(active) use_power = IDLE_POWER_USE - update_icon() + update_appearance() /obj/machinery/fishing_portal_generator/on_set_is_operational(old_value) if(old_value) diff --git a/code/modules/fishing/fishing_rod.dm b/code/modules/fishing/fishing_rod.dm index e4a1bdb4c881..176a7183f560 100644 --- a/code/modules/fishing/fishing_rod.dm +++ b/code/modules/fishing/fishing_rod.dm @@ -54,7 +54,7 @@ /obj/item/fishing_rod/proc/consume_bait() if(bait) QDEL_NULL(bait) - update_icon() + update_appearance() /obj/item/fishing_rod/attack_self(mob/user) if(currently_hooked_item) @@ -303,7 +303,7 @@ // Trying to remove the item if(!new_item && current_item) user.put_in_hands(current_item) - update_icon() + update_appearance() return // Trying to insert item into empty slot if(new_item && !current_item) @@ -317,7 +317,7 @@ hook = new_item if(ROD_SLOT_LINE) line = new_item - update_icon() + update_appearance() /// Trying to swap item if(new_item && current_item) if(!slot_check(new_item,slot)) @@ -331,7 +331,7 @@ if(ROD_SLOT_LINE) line = new_item user.put_in_hands(current_item) - update_icon() + update_appearance() /obj/item/fishing_rod/Exited(atom/movable/gone, direction) @@ -361,7 +361,7 @@ . = ..() var/obj/item/reagent_containers/food/snacks/bait/doughball/synthetic/infinite_supply_of_bait = new(src) bait = infinite_supply_of_bait - update_icon() + update_appearance() /obj/item/fishing_rod/tech/consume_bait() return diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index fc128a052f03..61c63b5407b0 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -123,7 +123,7 @@ GLOBAL_LIST_INIT(hallucination_list, list( if(target.client) target.client.images |= current_image -/obj/effect/hallucination/simple/update_icon(new_state,new_icon,new_px=0,new_py=0) +/obj/effect/hallucination/simple/update_icon(updates=ALL, new_state,new_icon,new_px=0,new_py=0) image_state = new_state if(new_icon) image_icon = new_icon @@ -131,6 +131,7 @@ GLOBAL_LIST_INIT(hallucination_list, list( image_icon = initial(image_icon) px = new_px py = new_py + . = ..() Show() /obj/effect/hallucination/simple/Moved(atom/OldLoc, Dir) diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index 41b2d4f3b78f..542c2383cb27 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -344,7 +344,7 @@ list_reagents = list(random_reagent.type = 50) . = ..() desc += "The writing reads '[random_reagent.name]'." - update_icon() + update_appearance() /obj/item/reagent_containers/food/drinks/beer name = "space beer" diff --git a/code/modules/food_and_drinks/drinks/drinks/bottle.dm b/code/modules/food_and_drinks/drinks/drinks/bottle.dm index 88c743afd278..65c3ac05dd5b 100644 --- a/code/modules/food_and_drinks/drinks/drinks/bottle.dm +++ b/code/modules/food_and_drinks/drinks/drinks/bottle.dm @@ -661,7 +661,7 @@ /obj/item/storage/bottles/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/storage/bottles/ComponentInitialize() . = ..() @@ -681,6 +681,7 @@ icon_state = "[initial(icon_state)]_seal" else icon_state = "[initial(icon_state)]_[contents.len]" + return ..() /obj/item/storage/bottles/examine(mob/user) . = ..() @@ -696,7 +697,7 @@ sealed = FALSE S.locked = FALSE new /obj/item/stack/sheet/mineral/wood(get_turf(src), 1) - update_icon() + update_appearance() return TRUE /obj/item/storage/bottles/sandblast diff --git a/code/modules/food_and_drinks/drinks/drinks/modglass.dm b/code/modules/food_and_drinks/drinks/drinks/modglass.dm index 8d519ac2e11e..01ec56b6ca86 100644 --- a/code/modules/food_and_drinks/drinks/drinks/modglass.dm +++ b/code/modules/food_and_drinks/drinks/drinks/modglass.dm @@ -82,7 +82,7 @@ GLOBAL_LIST_EMPTY(glass_variants) if(!choice || choice == icon_state) return icon_state = choice - update_icon() + update_appearance() //if the object is a garnish, with a valid garnish_state, and there isnt already a garnish of the same type, add it to the list at the index of its layer /obj/item/reagent_containers/food/drinks/modglass/attackby(obj/item/garnish/garnish, mob/user, params) @@ -94,13 +94,13 @@ GLOBAL_LIST_EMPTY(glass_variants) to_chat(user, "Theres already something on this part of the glass!") return ..() garnishes["[garnish.garnish_layer]"] = garnish.garnish_state - update_icon() + update_appearance() qdel(garnish) //clear garnishes on wash /obj/item/reagent_containers/food/drinks/modglass/wash(clean_types) garnishes = list() - update_icon() + update_appearance() /** * for each layer a garnish can be on, if there is a garnish in that layers index, apply a mutable appearance of its type and our rim size diff --git a/code/modules/food_and_drinks/food/condiment.dm b/code/modules/food_and_drinks/food/condiment.dm index 0326ffb96555..b1b53adff787 100644 --- a/code/modules/food_and_drinks/food/condiment.dm +++ b/code/modules/food_and_drinks/food/condiment.dm @@ -40,7 +40,7 @@ . = ..() possible_states = typelist("possible_states", possible_states) - update_icon() + update_appearance() /obj/item/reagent_containers/food/condiment/update_icon() cut_overlays() @@ -120,7 +120,7 @@ playsound(src, 'sound/items/glass_transfer.ogg', 50, 1) /obj/item/reagent_containers/food/condiment/on_reagent_change(changetype) - update_icon() + update_appearance() /obj/item/reagent_containers/food/condiment/enzyme name = "universal enzyme" @@ -235,7 +235,8 @@ ) /obj/item/reagent_containers/food/condiment/pack/update_icon() - return + SHOULD_CALL_PARENT(FALSE) + return ..() /obj/item/reagent_containers/food/condiment/pack/attack(mob/M, mob/user, def_zone) //Can't feed these to people directly. return diff --git a/code/modules/food_and_drinks/food/customizables.dm b/code/modules/food_and_drinks/food/customizables.dm index e17257a6505b..465b7939c0b7 100644 --- a/code/modules/food_and_drinks/food/customizables.dm +++ b/code/modules/food_and_drinks/food/customizables.dm @@ -325,11 +325,12 @@ /obj/item/reagent_containers/glass/bowl/on_reagent_change(changetype) ..() - update_icon() + update_appearance() /obj/item/reagent_containers/glass/bowl/update_icon_state() if(!reagents || !reagents.total_volume) icon_state = "bowl" + return ..() /obj/item/reagent_containers/glass/bowl/update_overlays() . = ..() diff --git a/code/modules/food_and_drinks/food/snacks_frozen.dm b/code/modules/food_and_drinks/food/snacks_frozen.dm index ce0aef118ce1..95ef84ae5cb7 100644 --- a/code/modules/food_and_drinks/food/snacks_frozen.dm +++ b/code/modules/food_and_drinks/food/snacks_frozen.dm @@ -222,14 +222,14 @@ /obj/item/reagent_containers/food/snacks/popsicle/update_overlays() . = ..() - if(bitecount) - . += "[initial(overlay_state)]_[min(bitecount, 3)]" - else + if(!bitecount) . += initial(overlay_state) + return + . += "[initial(overlay_state)]_[min(bitecount, 3)]" /obj/item/reagent_containers/food/snacks/popsicle/On_Consume(mob/living/eater) . = ..() - update_icon() + update_appearance() /obj/item/popsicle_stick name = "popsicle stick" diff --git a/code/modules/food_and_drinks/food/snacks_pastry.dm b/code/modules/food_and_drinks/food/snacks_pastry.dm index e27e92e402af..6cedb2a98142 100644 --- a/code/modules/food_and_drinks/food/snacks_pastry.dm +++ b/code/modules/food_and_drinks/food/snacks_pastry.dm @@ -769,15 +769,22 @@ /obj/item/reagent_containers/food/snacks/pancakes/Initialize() . = ..() - update_icon() + update_appearance() + +/obj/item/food/pancakes/update_name() + name = contents.len ? "stack of pancakes" : initial(name) + return ..() + +/obj/item/food/pancakes/update_icon(updates=ALL) + if(!(updates & UPDATE_OVERLAYS)) + return ..() + + updates &= ~UPDATE_OVERLAYS + . = ..() // Don't update overlays. We're doing that here -/obj/item/reagent_containers/food/snacks/pancakes/update_icon() - if(contents.len) - name = "stack of pancakes" - else - name = initial(name) if(contents.len < LAZYLEN(overlays)) - overlays-=overlays[overlays.len] + overlays -= overlays[overlays.len] + . |= UPDATE_OVERLAYS /obj/item/reagent_containers/food/snacks/pancakes/examine(mob/user) var/ingredients_listed = "" @@ -835,14 +842,14 @@ pancake.pixel_x = rand(-1,1) pancake.pixel_y = 3 * contents.len - 1 add_overlay(pancake) - update_icon() + update_appearance() /obj/item/reagent_containers/food/snacks/pancakes/attack(mob/M, mob/user, def_zone, stacked = TRUE) if(user.a_intent == INTENT_HARM || !contents.len || !stacked) return ..() var/obj/item/O = contents[contents.len] . = O.attack(M, user, def_zone, FALSE) - update_icon() + update_appearance() #undef PANCAKE_MAX_STACK diff --git a/code/modules/food_and_drinks/kitchen_machinery/cutting_board.dm b/code/modules/food_and_drinks/kitchen_machinery/cutting_board.dm index 89af54550e7f..b0d91d370ab1 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/cutting_board.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/cutting_board.dm @@ -71,7 +71,7 @@ for(var/obj/target_item as anything in contents) target_item.forceMove(get_turf(src)) - update_icon() + update_appearance() /obj/item/cutting_board/wrench_act(mob/living/user, obj/item/I) . = ..() @@ -102,7 +102,7 @@ processed_thing.reagents.copy_to(new_food_item, processed_thing.reagents.total_volume)//, multiplier = 1 / food_multiplier) qdel(processed_thing) - update_icon() + update_appearance() /obj/item/cutting_board/attackby(obj/item/attacking_item, mob/living/user, params) if(user.a_intent == INTENT_HARM) @@ -135,7 +135,7 @@ attacking_item.forceMove(src) balloon_alert(user, "placed [attacking_item] on board") - update_icon() + update_appearance() return //if(IS_EDIBLE(attacking_item)) //We may have failed but the user wants some feedback on why they can't put x food item on the board diff --git a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm index cd0f59140894..3a7c7245955c 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm @@ -99,7 +99,7 @@ user.visible_message("[user] stuffs [C] into the gibber!") C.forceMove(src) occupant = C - update_icon() + update_appearance() else startgibbing(user) @@ -133,7 +133,7 @@ /obj/machinery/gibber/proc/go_out() dropContents() - update_icon() + update_appearance() /obj/machinery/gibber/proc/startgibbing(mob/user) if(src.operating) @@ -145,7 +145,7 @@ audible_message("You hear a loud squelchy grinding sound.") playsound(src.loc, 'sound/machines/juicer.ogg', 50, TRUE) operating = TRUE - update_icon() + update_appearance() var/offset = prob(50) ? -2 : 2 animate(src, pixel_x = pixel_x + offset, time = 0.2, loop = 200) //start shaking @@ -221,7 +221,7 @@ pixel_x = base_pixel_x //return to its spot after shaking operating = FALSE - update_icon() + update_appearance() //auto-gibs anything that bumps into it /obj/machinery/gibber/autogibber diff --git a/code/modules/food_and_drinks/kitchen_machinery/grill.dm b/code/modules/food_and_drinks/kitchen_machinery/grill.dm index 89efb1b1cf8d..90fb5c27ae7b 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/grill.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/grill.dm @@ -20,11 +20,13 @@ /obj/machinery/grill/update_icon_state() if(grilled_item) icon_state = "grill" + return ..() else if(grill_fuel) icon_state = "grill_on" + return ..() else icon_state = "grill_open" - + return ..() /obj/machinery/grill/attackby(obj/item/I, mob/user) if(istype(I, /obj/item/stack/sheet/mineral/coal) || istype(I, /obj/item/stack/sheet/mineral/wood)) var/obj/item/stack/S = I @@ -35,7 +37,7 @@ else grill_fuel += (50 * stackamount) S.use(stackamount) - update_icon() + update_appearance() return if(I.resistance_flags & INDESTRUCTIBLE) to_chat(user, "You don't feel it would be wise to grill [I]...") @@ -55,7 +57,7 @@ grilled_item = food_item grilled_item.foodtype |= GRILLED to_chat(user, "You put the [grilled_item] on [src].") - update_icon() + update_appearance() grill_loop.start() return else @@ -63,13 +65,13 @@ grill_fuel += (20 * (I.reagents.get_reagent_amount(/datum/reagent/consumable/monkey_energy))) to_chat(user, "You pour the Monkey Energy in [src].") I.reagents.remove_reagent(/datum/reagent/consumable/monkey_energy, I.reagents.get_reagent_amount(/datum/reagent/consumable/monkey_energy)) - update_icon() + update_appearance() return ..() /obj/machinery/grill/process() ..() - update_icon() + update_appearance() if(!grill_fuel) return else @@ -118,7 +120,7 @@ if(grilled_item) to_chat(user, "You take out [grilled_item] from [src].") grilled_item.forceMove(drop_location()) - update_icon() + update_appearance() return return ..() @@ -161,6 +163,7 @@ icon_state = "catgrill_on" else icon_state = "catgrill_open" + return ..() /obj/machinery/grill/cat/proc/owoify() var/static/regex/owo = new("r|l", "g") diff --git a/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm b/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm index 404dfb79a77a..1d4e366ad6d9 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/icecream_vat.dm @@ -131,7 +131,7 @@ replace_beaker(user, B) to_chat(user, "You add [B] to [src].") updateUsrDialog() - update_icon() + update_appearance() return else if(O.is_drainable()) return diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm index 237d4ad2c832..101b733d3677 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm @@ -90,16 +90,22 @@ /obj/machinery/microwave/update_icon_state() if(broken) icon_state = "mwb" + return ..() else if(dirty_anim_playing) icon_state = "mwbloody1" + return ..() else if(dirty == 100) icon_state = "mwbloody" + return ..() else if(operating) icon_state = "mw1" + return ..() else if(panel_open) icon_state = "mw-o" + return ..() else icon_state = "mw" + return ..() /obj/machinery/microwave/attackby(obj/item/O, mob/user, params) if(operating) @@ -109,7 +115,7 @@ if(dirty < 100) if(default_deconstruction_screwdriver(user, icon_state, icon_state, O) || default_unfasten_wrench(user, O)) - update_icon() + update_appearance() return if(panel_open && is_wire_tool(O)) @@ -127,7 +133,7 @@ if(O.use_tool(src, user, 20)) user.visible_message("[user] fixes \the [src].", "You fix \the [src].") broken = 0 - update_icon() + update_appearance() return FALSE //to use some fuel else to_chat(user, "It's broken!") @@ -141,7 +147,7 @@ playsound(loc, 'sound/effects/spray3.ogg', 50, TRUE, -6) user.visible_message("[user] cleans \the [src].", "You clean \the [src].") dirty = 0 - update_icon() + update_appearance() else to_chat(user, "You need more space cleaner!") return TRUE @@ -152,7 +158,7 @@ if(do_after(user, P.cleanspeed, target = src)) user.visible_message("[user] cleans \the [src].", "You clean \the [src].") dirty = 0 - update_icon() + update_appearance() return TRUE if(dirty == 100) // The microwave is all dirty so can't be used! @@ -258,7 +264,7 @@ set_light(1.5) soundloop.start() - update_icon() + update_appearance() /obj/machinery/microwave/proc/spark() visible_message("Sparks fly around [src]!") @@ -282,7 +288,7 @@ wzhzhzh() playsound(src.loc, 'sound/effects/splat.ogg', 50, TRUE) dirty_anim_playing = TRUE - update_icon() + update_appearance() loop(MICROWAVE_MUCK, 4) /obj/machinery/microwave/proc/loop(type, time, wait = max(12 - 2 * efficiency, 2)) // standard wait is 10 @@ -350,7 +356,7 @@ /obj/machinery/microwave/proc/after_finish_loop() set_light(0) soundloop.stop() - update_icon() + update_appearance() #undef MICROWAVE_NORMAL #undef MICROWAVE_MUCK diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm index 9b7298c0d69c..ed1347fb5124 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm @@ -40,24 +40,29 @@ . += "The status display reads: This unit can hold a maximum of [max_n_of_items] items." /obj/machinery/smartfridge/update_icon_state() - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) - if(!machine_stat) - SSvis_overlays.add_vis_overlay(src, icon, "smartfridge-light-mask", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) - if (visible_contents) - switch(contents.len) - if(0) - icon_state = "[initial(icon_state)]" - if(1 to 25) - icon_state = "[initial(icon_state)]1" - if(26 to 75) - icon_state = "[initial(icon_state)]2" - if(76 to INFINITY) - icon_state = "[initial(icon_state)]3" - else - icon_state = "[initial(icon_state)]" - else + if(machine_stat) icon_state = "[initial(icon_state)]-off" + return ..() + if(!visible_contents) + icon_state = "[initial(icon_state)]" + return ..() + + switch(contents.len) + if(0) + icon_state = "[initial(icon_state)]" + if(1 to 25) + icon_state = "[initial(icon_state)]1" + if(26 to 75) + icon_state = "[initial(icon_state)]2" + if(76 to INFINITY) + icon_state = "[initial(icon_state)]3" + return ..() + +/obj/machinery/smartfridge/update_overlays() + . = ..() + if(!machine_stat) + SSvis_overlays.add_vis_overlay(src, icon, "smartfridge-light-mask", EMISSIVE_LAYER, EMISSIVE_PLANE, dir, alpha) /******************* @@ -94,7 +99,7 @@ user.visible_message("[user] adds \the [O] to \the [src].", "You add \the [O] to \the [src].") updateUsrDialog() if (visible_contents) - update_icon() + update_appearance() return TRUE if(istype(O, /obj/item/storage/bag)) @@ -120,7 +125,7 @@ if(O.contents.len > 0) to_chat(user, "Some items are refused.") if (visible_contents) - update_icon() + update_appearance() return TRUE else to_chat(user, "There is nothing in [O] to put in [src]!") @@ -216,7 +221,7 @@ dispense(O, usr) break if (visible_contents) - update_icon() + update_appearance() return TRUE for(var/obj/item/O in src) @@ -226,7 +231,7 @@ dispense(O, usr) desired-- if (visible_contents) - update_icon() + update_appearance() return TRUE return FALSE @@ -273,7 +278,7 @@ /obj/machinery/smartfridge/drying_rack/ui_act(action, params) . = ..() if(.) - update_icon() // This is to handle a case where the last item is taken out manually instead of through drying pop-out + update_appearance() // This is to handle a case where the last item is taken out manually instead of through drying pop-out return switch(action) if("Dry") @@ -293,7 +298,7 @@ /obj/machinery/smartfridge/drying_rack/load() //For updating the filled overlay ..() - update_icon() + update_appearance() /obj/machinery/smartfridge/drying_rack/update_overlays() . = ..() @@ -307,7 +312,7 @@ if(drying) if(rack_dry())//no need to update unless something got dried SStgui.update_uis(src) - update_icon() + update_appearance() /obj/machinery/smartfridge/drying_rack/accept_check(obj/item/O) if(istype(O, /obj/item/reagent_containers/food/snacks/)) @@ -325,7 +330,7 @@ else drying = TRUE use_power = ACTIVE_POWER_USE - update_icon() + update_appearance() /obj/machinery/smartfridge/drying_rack/proc/rack_dry() for(var/obj/item/reagent_containers/food/snacks/S in src) @@ -523,7 +528,7 @@ return FALSE /obj/machinery/smartfridge/bloodbank/update_icon_state() - return + return ..() /obj/machinery/smartfridge/bloodbank/preloaded initial_contents = list( diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm index 209a8c93b772..772893e3ff16 100644 --- a/code/modules/food_and_drinks/pizzabox.dm +++ b/code/modules/food_and_drinks/pizzabox.dm @@ -12,6 +12,7 @@ icon = 'icons/obj/food/containers.dmi' icon_state = "pizzabox" item_state = "pizzabox" + base_icon_state = "pizzabox" lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi' righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi' @@ -31,16 +32,17 @@ /obj/item/pizzabox/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/pizzabox/Destroy() unprocess() return ..() -/obj/item/pizzabox/update_icon() +/obj/item/pizzabox/update_desc() // Description desc = initial(desc) + . = ..() if(open) if(pizza) desc = "[desc] It appears to have \a [pizza] inside. Use your other hand to take it out." @@ -57,34 +59,41 @@ if(box.boxtag != "") desc = "[desc] The [boxes.len ? "top box" : "box"]'s tag reads: [box.boxtag]" - // Icon/Overlays - cut_overlays() +/obj/item/pizzabox/update_icon_state() + if(!open) + icon_state = "[base_icon_state]" + return ..() + + icon_state = pizza ? "[base_icon_state]_messy" : "[base_icon_state]_open" + bomb?.icon_state = "pizzabomb_[bomb_active ? "active" : "inactive"]" + return ..() + +/obj/item/pizzabox/update_overlays() + . = ..() if(open) - icon_state = "pizzabox_open" if(pizza) - icon_state = "pizzabox_messy" var/mutable_appearance/pizza_overlay = mutable_appearance(pizza.icon, pizza.icon_state) pizza_overlay.pixel_y = -3 - add_overlay(pizza_overlay) + . += pizza_overlay if(bomb) - bomb.icon_state = "pizzabomb_[bomb_active ? "active" : "inactive"]" var/mutable_appearance/bomb_overlay = mutable_appearance(bomb.icon, bomb.icon_state) bomb_overlay.pixel_y = 5 - add_overlay(bomb_overlay) - else - icon_state = "pizzabox" - var/current_offset = 3 - for(var/V in boxes) - var/obj/item/pizzabox/P = V - var/mutable_appearance/box_overlay = mutable_appearance(P.icon, P.icon_state) - box_overlay.pixel_y = current_offset - add_overlay(box_overlay) - current_offset += 3 - var/obj/item/pizzabox/box = boxes.len ? boxes[boxes.len] : src - if(box.boxtag != "") - var/mutable_appearance/tag_overlay = mutable_appearance(icon, "pizzabox_tag") - tag_overlay.pixel_y = boxes.len * 3 - add_overlay(tag_overlay) + . += bomb_overlay + return + + var/box_offset = 0 + for(var/stacked_box in boxes) + box_offset += 3 + var/obj/item/pizzabox/box = stacked_box + var/mutable_appearance/box_overlay = mutable_appearance(box.icon, box.icon_state) + box_overlay.pixel_y = box_offset + . += box_overlay + + var/obj/item/pizzabox/box = LAZYLEN(boxes.len) ? boxes[boxes.len] : src + if(box.boxtag != "") + var/mutable_appearance/tag_overlay = mutable_appearance(icon, "pizzabox_tag") + tag_overlay.pixel_y = box_offset + . += tag_overlay /obj/item/pizzabox/worn_overlays(isinhands, icon_file) . = list() @@ -104,7 +113,7 @@ audible_message("[icon2html(src, hearers(src))] *beep*") bomb_active = TRUE START_PROCESSING(SSobj, src) - update_icon() + update_appearance() //ATTACK HAND IGNORING PARENT RETURN VALUE /obj/item/pizzabox/attack_hand(mob/user) @@ -115,13 +124,13 @@ user.put_in_hands(pizza) to_chat(user, "You take [pizza] out of [src].") pizza = null - update_icon() + update_appearance() else if(bomb) if(wires.is_all_cut() && bomb_defused) user.put_in_hands(bomb) to_chat(user, "You carefully remove the [bomb] from [src].") bomb = null - update_icon() + update_appearance() return else bomb_timer = input(user, "Set the [bomb] timer from [BOMB_TIMER_MIN] to [BOMB_TIMER_MAX].", bomb, bomb_timer) as num|null @@ -136,14 +145,14 @@ bomb.adminlog = "The [bomb.name] in [src.name] that [key_name(user)] activated has detonated!" to_chat(user, "You trap [src] with [bomb].") - update_icon() + update_appearance() else if(boxes.len) var/obj/item/pizzabox/topbox = boxes[boxes.len] boxes -= topbox user.put_in_hands(topbox) to_chat(user, "You remove the topmost [name] from the stack.") - topbox.update_icon() - update_icon() + topbox.update_appearance() + update_appearance() user.regenerate_icons() /obj/item/pizzabox/attackby(obj/item/I, mob/user, params) @@ -158,8 +167,8 @@ boxes += add newbox.boxes.Cut() to_chat(user, "You put [newbox] on top of [src]!") - newbox.update_icon() - update_icon() + newbox.update_appearance() + update_appearance() user.regenerate_icons() if(boxes.len >= 5) if(prob(10 * boxes.len)) @@ -179,7 +188,7 @@ return pizza = I to_chat(user, "You put [I] in [src].") - update_icon() + update_appearance() return else if(istype(I, /obj/item/bombcore/miniature/pizza)) if(open && !bomb) @@ -188,7 +197,7 @@ wires = new /datum/wires/explosive/pizza(src) bomb = I to_chat(user, "You put [I] in [src]. Sneeki breeki...") - update_icon() + update_appearance() return else if(bomb) to_chat(user, "[src] already has a bomb in it!") @@ -202,7 +211,7 @@ if(!user.canUseTopic(src, BE_CLOSE)) return to_chat(user, "You write with [I] on [src].") - update_icon() + update_appearance() return else if(is_wire_tool(I)) if(wires && bomb) @@ -248,9 +257,9 @@ fall_dir = pick(GLOB.alldirs) step(P.pizza, fall_dir) P.pizza = null - P.update_icon() + P.update_appearance() boxes -= P - update_icon() + update_appearance() if(isliving(loc)) var/mob/living/L = loc L.regenerate_icons() @@ -259,7 +268,7 @@ STOP_PROCESSING(SSobj, src) qdel(wires) wires = null - update_icon() + update_appearance() /obj/item/pizzabox/bomb/Initialize() . = ..() diff --git a/code/modules/games/cas.dm b/code/modules/games/cas.dm index 339e64c8771d..b24749aa9a1a 100644 --- a/code/modules/games/cas.dm +++ b/code/modules/games/cas.dm @@ -78,7 +78,7 @@ H.pickup(user) user.put_in_hands(H) user.visible_message("[user] draws a card from the deck.", "You draw a card from the deck.") - update_icon() + update_appearance() /obj/item/toy/cards/deck/cas/attackby(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/toy/cards/singlecard/cas)) @@ -93,11 +93,12 @@ cards += RC user.visible_message("[user] adds a card to the bottom of the deck.","You add the card to the bottom of the deck.") qdel(SC) - update_icon() + update_appearance() /obj/item/toy/cards/deck/cas/update_icon_state() if(cards.len < 26) icon_state = "deck_[deckstyle]_low" + return ..() /obj/item/toy/cards/singlecard/cas name = "CAS card" @@ -129,7 +130,7 @@ else if(flipped) name = buffertext flipped = !flipped - update_icon() + update_appearance() /obj/item/toy/cards/singlecard/cas/AltClick(mob/living/user) if(!ishuman(user) || !user.canUseTopic(src, BE_CLOSE)) @@ -141,6 +142,7 @@ icon_state = "[card_face]_flipped" else icon_state = "[card_face]" + return ..() /obj/item/toy/cards/singlecard/cas/attackby(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/pen)) diff --git a/code/modules/holodeck/area_copy.dm b/code/modules/holodeck/area_copy.dm index 1f0a2c94e98f..92687709e7d9 100644 --- a/code/modules/holodeck/area_copy.dm +++ b/code/modules/holodeck/area_copy.dm @@ -34,7 +34,7 @@ GLOBAL_LIST_INIT(duplicate_forbidden_vars,list( var/obj/item/I = O I.damtype = STAMINA // thou shalt not - N.update_icon() + N.update_appearance() if(ismachinery(O)) var/obj/machinery/M = O M.power_change() diff --git a/code/modules/holodeck/items.dm b/code/modules/holodeck/items.dm index be7dbcdf4bd7..9e89336ae08e 100644 --- a/code/modules/holodeck/items.dm +++ b/code/modules/holodeck/items.dm @@ -185,7 +185,7 @@ ready = !ready - update_icon() + update_appearance() var/numbuttons = 0 var/numready = 0 @@ -202,6 +202,7 @@ icon_state = "auth_on" else icon_state = "auth_off" + return ..() /obj/machinery/readybutton/proc/begin_event() diff --git a/code/modules/hydroponics/beekeeping/honeycomb.dm b/code/modules/hydroponics/beekeeping/honeycomb.dm index c0ce6dfb6db7..01208eb8eb7e 100644 --- a/code/modules/hydroponics/beekeeping/honeycomb.dm +++ b/code/modules/hydroponics/beekeeping/honeycomb.dm @@ -17,7 +17,7 @@ . = ..() pixel_x = rand(8,-8) pixel_y = rand(8,-8) - update_icon() + update_appearance() /obj/item/reagent_containers/honeycomb/update_overlays() @@ -37,4 +37,4 @@ reagents.add_reagent(R.type,5) else honey_color = "" - update_icon() + update_appearance() diff --git a/code/modules/hydroponics/biogenerator.dm b/code/modules/hydroponics/biogenerator.dm index ca61d071e0b5..e9e40fd167b8 100644 --- a/code/modules/hydroponics/biogenerator.dm +++ b/code/modules/hydroponics/biogenerator.dm @@ -42,7 +42,7 @@ ..() if(A == beaker) beaker = null - update_icon() + update_appearance() /obj/machinery/biogenerator/RefreshParts() var/E = 0 @@ -63,7 +63,7 @@ . += "The status display reads: Productivity at [productivity*100]%.
    Matter consumption reduced by [(efficiency*25)-25]%.
    Machine can hold up to [max_items] pieces of produce.
    " /obj/machinery/biogenerator/on_reagent_change(changetype) //When the reagents change, change the icon as well. - update_icon() + update_appearance() /obj/machinery/biogenerator/update_icon_state() if(panel_open) @@ -74,6 +74,7 @@ icon_state = "biogen-stand" else icon_state = "biogen-work" + return ..() /obj/machinery/biogenerator/attackby(obj/item/O, mob/user, params) if(user.a_intent == INTENT_HARM) @@ -88,7 +89,7 @@ var/obj/item/reagent_containers/glass/B = beaker B.forceMove(drop_location()) beaker = null - update_icon() + update_appearance() return if(default_deconstruction_crowbar(O)) @@ -104,7 +105,7 @@ return beaker = O to_chat(user, "You add the container to the machine.") - update_icon() + update_appearance() else to_chat(user, "Close the maintenance panel first.") return @@ -184,12 +185,12 @@ qdel(I) if(S) processing = TRUE - update_icon() + update_appearance() playsound(loc, 'sound/machines/blender.ogg', 50, TRUE) use_power(S * 30) sleep(S + 15 / productivity) processing = FALSE - update_icon() + update_appearance() /obj/machinery/biogenerator/proc/check_cost(list/materials, multiplier = 1, remove_points = TRUE) if(materials.len != 1 || materials[1] != SSmaterials.GetMaterialRef(/datum/material/biomass)) @@ -199,7 +200,7 @@ else if(remove_points) points -= materials[SSmaterials.GetMaterialRef(/datum/material/biomass)]*multiplier/efficiency - update_icon() + update_appearance() return TRUE /obj/machinery/biogenerator/proc/check_container_volume(list/reagents, multiplier = 1) @@ -240,7 +241,7 @@ beaker.reagents.add_reagent(R, D.make_reagents[R]) . = 1 --i - update_icon() + update_appearance() return . /obj/machinery/biogenerator/proc/detach(mob/living/user) @@ -250,7 +251,7 @@ else beaker.drop_location(get_turf(src)) beaker = null - update_icon() + update_appearance() /obj/machinery/biogenerator/ui_status(mob/user) if(machine_stat & BROKEN || panel_open) diff --git a/code/modules/hydroponics/fermenting_barrel.dm b/code/modules/hydroponics/fermenting_barrel.dm index 8d996e6b17d9..4c9eb274dcb0 100644 --- a/code/modules/hydroponics/fermenting_barrel.dm +++ b/code/modules/hydroponics/fermenting_barrel.dm @@ -66,13 +66,14 @@ reagents.flags |= DRAINABLE reagents.flags &= ~(REFILLABLE) to_chat(user, "You close [src], letting you draw from its tap.") - update_icon() + update_appearance() /obj/structure/fermenting_barrel/update_icon_state() if(open) icon_state = "barrel_open" else icon_state = "barrel" + return ..() /datum/crafting_recipe/fermenting_barrel name = "Wooden Barrel" diff --git a/code/modules/hydroponics/gene_modder.dm b/code/modules/hydroponics/gene_modder.dm index 250d33be2e77..a21e9f71afc4 100644 --- a/code/modules/hydroponics/gene_modder.dm +++ b/code/modules/hydroponics/gene_modder.dm @@ -58,6 +58,7 @@ icon_state = "dnamod-off" else icon_state = "dnamod" + return ..() /obj/machinery/plantgenes/update_overlays() . = ..() @@ -68,7 +69,7 @@ /obj/machinery/plantgenes/attackby(obj/item/I, mob/user, params) if(default_deconstruction_screwdriver(user, "dnamod", "dnamod", I)) - update_icon() + update_appearance() return if(default_deconstruction_crowbar(I)) return @@ -327,7 +328,7 @@ disk.update_disk_name() qdel(seed) seed = null - update_icon() + update_appearance() if("replace") if(disk && disk.gene && istype(disk.gene, G.type) && istype(G, /datum/plant_gene/core)) seed.genes -= G @@ -359,7 +360,7 @@ S.forceMove(src) seed = S update_genes() - update_icon() + update_appearance() /obj/machinery/plantgenes/proc/eject_disk() if (disk && !operation) diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index d53303e6d201..fee6a3857d67 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -29,6 +29,9 @@ var/recent_bee_visit = FALSE //Have we been visited by a bee recently, so bees dont overpollinate one plant var/datum/weakref/lastuser //Last user to add reagents to a tray. Mostly for logging. var/self_sustaining = FALSE //If the tray generates nutrients and water on its own + ///The icon state for the overlay used to represent that this tray is self-sustaining. + var/self_sustaining_overlay_icon_state = "gaia_blessing" + // Here lies irrigation. You won't be missed, because you were never used. /obj/machinery/hydroponics/Initialize() @@ -120,7 +123,7 @@ visible_message("[name]'s auto-grow functionality shuts off!") idle_power_usage = 0 self_sustaining = FALSE - update_icon() + update_appearance() else if(self_sustaining) adjustWater(rand(1,2)) @@ -265,7 +268,7 @@ weedinvasion() // Weed invasion into empty tray needs_update = 1 if (needs_update) - update_icon() + update_appearance() if(myseed && prob(5 * (11-myseed.production))) for(var/g in myseed.genes) @@ -274,31 +277,28 @@ selectedtrait.on_grow(src) return -/obj/machinery/hydroponics/update_icon() - //Refreshes the icon and sets the luminosity - cut_overlays() +/obj/machinery/hydroponics/update_appearance(updates) + . = ..() if(self_sustaining) - if(istype(src, /obj/machinery/hydroponics/soil)) - add_atom_colour(rgb(255, 175, 0), FIXED_COLOUR_PRIORITY) - else - add_overlay(mutable_appearance('icons/obj/hydroponics/equipment.dmi', "gaia_blessing")) set_light(3) + return + if(myseed?.get_gene(/datum/plant_gene/trait/glow)) // Hydroponics needs a refactor, badly. + var/datum/plant_gene/trait/glow/G = myseed.get_gene(/datum/plant_gene/trait/glow) + set_light(G.glow_range(myseed), G.glow_power(myseed), G.glow_color) + return + set_light(0) +/obj/machinery/hydroponics/update_overlays() + . = ..() if(myseed) - update_icon_plant() - update_icon_lights() + . += update_plant_overlay() + . += update_status_light_overlays() - if(!self_sustaining) - if(myseed && myseed.get_gene(/datum/plant_gene/trait/glow)) - var/datum/plant_gene/trait/glow/G = myseed.get_gene(/datum/plant_gene/trait/glow) - set_light(G.glow_range(myseed), G.glow_power(myseed), G.glow_color) - else - set_light(0) - - return + if(self_sustaining && self_sustaining_overlay_icon_state) + . += mutable_appearance(icon, self_sustaining_overlay_icon_state) -/obj/machinery/hydroponics/proc/update_icon_plant() +/obj/machinery/hydroponics/proc/update_plant_overlay() var/mutable_appearance/plant_overlay = mutable_appearance(myseed.growing_icon, layer = OBJ_LAYER + 0.01) if(dead) plant_overlay.icon_state = myseed.icon_dead @@ -311,19 +311,20 @@ var/t_growthstate = clamp(round((age / myseed.maturation) * myseed.growthstages), 1, myseed.growthstages) plant_overlay.icon_state = "[myseed.icon_grow][t_growthstate]" plant_overlay.pixel_y += 3 //to adjust the plant sprites to the new one without touching every single file - add_overlay(plant_overlay) + return plant_overlay -/obj/machinery/hydroponics/proc/update_icon_lights() +/obj/machinery/hydroponics/proc/update_status_light_overlays() + . = list() if(harvest) - add_overlay(mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_harvest3")) + . += mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_harvest3") if(plant_health <= (myseed.endurance / 2)) - add_overlay(mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_lowhealth3")) + . += mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_lowhealth3") if(weedlevel >= 5 || pestlevel >= 5 || toxic >= 40) - add_overlay(mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_alert3")) + . += mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_alert3") if(reagents.total_volume <= 2) - add_overlay(mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_lownutri3")) + . += mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_lownutri3") if(waterlevel <= 10) - add_overlay(mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_lowwater3")) + . += mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_lowwater3") /obj/machinery/hydroponics/examine(user) @@ -385,7 +386,7 @@ harvest = 0 weedlevel = 0 // Reset pestlevel = 0 // Reset - update_icon() + update_appearance() visible_message("The [oldPlantName] is overtaken by some [myseed.plantname]!") name = "hydroponics tray ([myseed.plantname])" if(myseed.product) @@ -421,7 +422,7 @@ weedlevel = 0 // Reset sleep(5) // Wait a while - update_icon() + update_appearance() visible_message("[oldPlantName] suddenly mutates into [myseed.plantname]!") TRAY_NAME_UPDATE @@ -441,7 +442,7 @@ weedlevel = 0 // Reset sleep(5) // Wait a while - update_icon() + update_appearance() visible_message("The mutated weeds in [src] spawn some [myseed.plantname]!") TRAY_NAME_UPDATE else @@ -458,7 +459,7 @@ pestlevel = 0 // Pests die lastproduce = 0 if(!dead) - update_icon() + update_appearance() dead = TRUE @@ -529,11 +530,11 @@ if(istype(reagent_source, /obj/item/reagent_containers/food/snacks) || istype(reagent_source, /obj/item/reagent_containers/pill)) qdel(reagent_source) lastuser = user - H.update_icon() + H.update_appearance() return 1 - H.update_icon() + H.update_appearance() if(reagent_source) // If the source wasn't composted and destroyed - reagent_source.update_icon() + reagent_source.update_appearance() return 1 else if(istype(O, /obj/item/seeds) && !istype(O, /obj/item/seeds/sample)) @@ -549,7 +550,7 @@ age = 1 plant_health = myseed.endurance lastcycle = world.time - update_icon() + update_appearance() return else to_chat(user, "[src] already has seeds in it!") @@ -582,7 +583,7 @@ if(weedlevel > 0) user.visible_message("[user] uproots the weeds.", "You remove the weeds from [src].") weedlevel = 0 - update_icon() + update_appearance() else to_chat(user, "This plot is completely devoid of weeds! It doesn't need uprooting.") @@ -612,7 +613,7 @@ name = initial(name) desc = initial(desc) weedlevel = 0 //Has a side effect of cleaning up those nasty weeds - update_icon() + update_appearance() else if(istype(O, /obj/item/gun/energy/floragun)) var/obj/item/gun/energy/floragun/flowergun = O if(flowergun.cell.charge < REVOLUTION_CHARGE) // In case an admin var edits the gun or guns gain the ability to have their cell upgraded @@ -638,7 +639,7 @@ myseed.mutatelist = list(fresh_mut_list[locked_mutation]) myseed.endurance = (myseed.endurance/2) flowergun.cell.use(REVOLUTION_CHARGE) - flowergun.update_icon() + flowergun.update_appearance() to_chat(user, "[myseed.plantname]'s mutation was set to [locked_mutation], depleting [flowergun]'s cell!") return else @@ -665,7 +666,7 @@ to_chat(user, "You remove the dead plant from [src].") qdel(myseed) myseed = null - update_icon() + update_appearance() TRAY_NAME_UPDATE else if(user) @@ -683,12 +684,12 @@ self_sustaining = !self_sustaining idle_power_usage = self_sustaining ? 1250 : 0 to_chat(user, "You [self_sustaining ? "activate" : "deactivated"] [src]'s autogrow function[self_sustaining ? ", maintaining the tray's health while using high amounts of power" : ""].") - update_icon() + update_appearance() /obj/machinery/hydroponics/AltClick(mob/user) . = ..() if(!anchored) - update_icon() + update_appearance() return FALSE var/warning = alert(user, "Are you sure you wish to empty the tray's nutrient beaker?","Empty Tray Nutrients?", "Yes", "No") if(warning == "Yes" && user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) @@ -714,7 +715,7 @@ if(self_sustaining) //No reason to pay for an empty tray. idle_power_usage = 0 self_sustaining = FALSE - update_icon() + update_appearance() /// Tray Setters - The following procs adjust the tray or plants variables, and make sure that the stat doesn't go out of bounds./// /obj/machinery/hydroponics/proc/adjustWater(adjustamt) @@ -753,8 +754,14 @@ use_power = NO_POWER_USE flags_1 = NODECONSTRUCT_1 unwrenchable = FALSE + self_sustaining_overlay_icon_state = null + +/obj/machinery/hydroponics/soil/update_icon(updates=ALL) + . = ..() + if(self_sustaining) + add_atom_colour(rgb(255, 175, 0), FIXED_COLOUR_PRIORITY) -/obj/machinery/hydroponics/soil/update_icon_lights() +/obj/machinery/hydroponics/soil/update_status_light_overlays() return // Has no lights /obj/machinery/hydroponics/soil/attackby(obj/item/O, mob/user, params) diff --git a/code/modules/hydroponics/plant_genes.dm b/code/modules/hydroponics/plant_genes.dm index 0a6264b8bda6..bc18ce87377b 100644 --- a/code/modules/hydroponics/plant_genes.dm +++ b/code/modules/hydroponics/plant_genes.dm @@ -276,8 +276,8 @@ C.charge = newcharge if(isobj(C.loc)) var/obj/O = C.loc - O.update_icon() //update power meters and such - C.update_icon() + O.update_appearance() //update power meters and such + C.update_appearance() batteries_recharged = 1 if(batteries_recharged) to_chat(target, "Your batteries are recharged!") @@ -481,7 +481,7 @@ HY.harvest = 0 HY.weedlevel = 0 // Reset HY.pestlevel = 0 // Reset - HY.update_icon() + HY.update_appearance() HY.visible_message("The [H.myseed.plantname] spreads!") /datum/plant_gene/trait/plant_type // Parent type diff --git a/code/modules/instruments/items.dm b/code/modules/instruments/items.dm index b4adea4b87b2..146d8e32d7e2 100644 --- a/code/modules/instruments/items.dm +++ b/code/modules/instruments/items.dm @@ -93,14 +93,14 @@ */ /obj/item/instrument/piano_synth/headphones/proc/start_playing() icon_state = "[initial(icon_state)]_on" - update_icon() + update_appearance() /** * Called by a component signal when our song stops playing. */ /obj/item/instrument/piano_synth/headphones/proc/stop_playing() icon_state = "[initial(icon_state)]" - update_icon() + update_appearance() /obj/item/instrument/piano_synth/headphones/spacepods name = "\improper Nanotrasen space pods" diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm index fd2c512b5ef1..dd664843ed41 100644 --- a/code/modules/library/lib_items.dm +++ b/code/modules/library/lib_items.dm @@ -57,7 +57,7 @@ if(!isbook(I)) continue I.forceMove(src) - update_icon() + update_appearance() /obj/structure/bookcase/set_anchored(anchorvalue) . = ..() @@ -70,7 +70,7 @@ if(!isbook(I)) continue I.forceMove(Tsec) - update_icon() + update_appearance() /obj/structure/bookcase/attackby(obj/item/I, mob/user, params) switch(state) @@ -91,7 +91,7 @@ W.use(2) to_chat(user, "You add a shelf.") state = BOOKCASE_FINISHED - update_icon() + update_appearance() else if(I.tool_behaviour == TOOL_WRENCH) I.play_tool_sound(src, 100) to_chat(user, "You unwrench the frame.") @@ -102,13 +102,13 @@ if(isbook(I)) if(!user.transferItemToLoc(I, src)) return - update_icon() + update_appearance() else if(STR) for(var/obj/item/T in I.contents) if(istype(T, /obj/item/book) || istype(T, /obj/item/spellbook)) STR.remove_from_storage(T, src) to_chat(user, "You empty \the [I] into \the [src].") - update_icon() + update_appearance() else if(istype(I, /obj/item/pen)) if(!user.is_literate()) to_chat(user, "You scribble illegibly on the side of [src]!") @@ -128,7 +128,7 @@ to_chat(user, "You pry the shelf out.") new /obj/item/stack/sheet/mineral/wood(drop_location(), 2) state = BOOKCASE_ANCHORED - update_icon() + update_appearance() else return ..() @@ -152,7 +152,7 @@ user.put_in_hands(choice) else choice.forceMove(drop_location()) - update_icon() + update_appearance() /obj/structure/bookcase/deconstruct(disassembled = TRUE) @@ -168,13 +168,13 @@ /obj/structure/bookcase/update_icon_state() if(state == BOOKCASE_UNANCHORED) icon_state = "bookempty" - return + return ..() var/amount = contents.len if(load_random_books) amount += books_to_load icon_state = "book-[clamp(amount, 0, 5)]" - + return ..() /obj/structure/bookcase/manuals/engineering name = "engineering manuals bookcase" @@ -186,7 +186,7 @@ new /obj/item/book/manual/wiki/engineering_guide(src) new /obj/item/book/manual/wiki/engineering_singulo_tesla(src) new /obj/item/book/manual/wiki/robotics_cyborgs(src) - update_icon() + update_appearance() /obj/structure/bookcase/manuals/research_and_development @@ -195,7 +195,7 @@ /obj/structure/bookcase/manuals/research_and_development/Initialize() . = ..() new /obj/item/book/manual/wiki/research_and_development(src) - update_icon() + update_appearance() /* @@ -379,7 +379,7 @@ /obj/structure/bookcase/manuals/medical/Initialize() . = ..() new /obj/item/book/manual/wiki/medical_cloning(src) - update_icon() + update_appearance() #undef BOOKCASE_UNANCHORED #undef BOOKCASE_ANCHORED diff --git a/code/modules/library/random_books.dm b/code/modules/library/random_books.dm index d91ac014862e..d957c89e65a8 100644 --- a/code/modules/library/random_books.dm +++ b/code/modules/library/random_books.dm @@ -34,7 +34,7 @@ . = ..() if(books_to_load && isnum(books_to_load)) books_to_load += pick(-1,-1,0,1,1) - update_icon() + update_appearance() /proc/create_random_books(amount, location, fail_loud = FALSE, category = null, obj/item/book/existing_book) . = list() diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm index 5cf93f3d6b65..5adc1b373471 100644 --- a/code/modules/mapping/mapping_helpers.dm +++ b/code/modules/mapping/mapping_helpers.dm @@ -246,7 +246,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava) else var/obj/item/organ/O = part O.organ_flags |= ORGAN_FROZEN - j.update_icon() + j.update_appearance() qdel(src) @@ -369,7 +369,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava) var/obj/machinery/door/airlock/found_airlock = locate(/obj/machinery/door/airlock) in turf if(note_path) found_airlock.note = note_path - found_airlock.update_icon() + found_airlock.update_appearance() qdel(src) if(note_info) var/obj/item/paper/paper = new /obj/item/paper(src) @@ -378,7 +378,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava) paper.add_raw_text("[note_info]") paper.update_appearance() paper.forceMove(found_airlock) - found_airlock.update_icon() + found_airlock.update_appearance() qdel(src) log_mapping("[src] at [x],[y] had no note_path or note_info, cannot place paper note.") qdel(src) diff --git a/code/modules/mining/equipment/explorer_gear.dm b/code/modules/mining/equipment/explorer_gear.dm index ee0ec659a854..8bac57a8b764 100644 --- a/code/modules/mining/equipment/explorer_gear.dm +++ b/code/modules/mining/equipment/explorer_gear.dm @@ -98,7 +98,7 @@ /obj/item/clothing/head/helmet/space/hostile_environment/Initialize() . = ..() AddComponent(/datum/component/spraycan_paintable) - update_icon() + update_appearance() /obj/item/clothing/head/helmet/space/hostile_environment/update_overlays() . = ..() diff --git a/code/modules/mining/equipment/kinetic_crusher.dm b/code/modules/mining/equipment/kinetic_crusher.dm index 1a35cf1642c7..f36c7c441bad 100644 --- a/code/modules/mining/equipment/kinetic_crusher.dm +++ b/code/modules/mining/equipment/kinetic_crusher.dm @@ -110,7 +110,7 @@ playsound(user, 'sound/weapons/plasma_cutter.ogg', 100, TRUE) D.fire() charged = FALSE - update_icon() + update_appearance() addtimer(CALLBACK(src, .proc/Recharge), charge_time) return if(proximity_flag && isliving(target)) @@ -142,17 +142,18 @@ /obj/item/kinetic_crusher/proc/Recharge() if(!charged) charged = TRUE - update_icon() + update_appearance() playsound(src.loc, 'sound/weapons/kenetic_reload.ogg', 60, TRUE) /obj/item/kinetic_crusher/ui_action_click(mob/user, actiontype) set_light_on(!light_on) playsound(user, 'sound/weapons/empty.ogg', 100, TRUE) - update_icon() + update_appearance() /obj/item/kinetic_crusher/update_icon_state() item_state = "crusher[wielded]" // this is not icon_state and not supported by 2hcomponent + return ..() /obj/item/kinetic_crusher/update_overlays() . = ..() @@ -749,6 +750,7 @@ /obj/item/kinetic_crusher/old/update_icon_state() item_state = "crusherold[wielded]" // still not supported by 2hcomponent + return ..() //100% original syndicate oc, plz do not steal. More effective against human targets then the typical crusher, with a bit of block chance. /obj/item/kinetic_crusher/syndie_crusher @@ -807,6 +809,7 @@ /obj/item/kinetic_crusher/syndie_crusher/update_icon_state() item_state = "crushersyndie[wielded]" // this is not icon_state and not supported by 2hcomponent + return ..() /obj/item/kinetic_crusher/syndie_crusher/update_overlays() . = ..() diff --git a/code/modules/mining/equipment/marker_beacons.dm b/code/modules/mining/equipment/marker_beacons.dm index d4531fd1630a..74ed8ce30fbd 100644 --- a/code/modules/mining/equipment/marker_beacons.dm +++ b/code/modules/mining/equipment/marker_beacons.dm @@ -34,7 +34,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sortList(list( /obj/item/stack/marker_beacon/Initialize(mapload) . = ..() - update_icon() + update_appearance() /obj/item/stack/marker_beacon/examine(mob/user) . = ..() @@ -43,6 +43,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sortList(list( /obj/item/stack/marker_beacon/update_icon_state() icon_state = "[initial(icon_state)][lowertext(picked_color)]" + return ..() /obj/item/stack/marker_beacon/attack_self(mob/user) if(!isturf(user.loc)) @@ -65,7 +66,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sortList(list( return if(input_color) picked_color = input_color - update_icon() + update_appearance() /obj/structure/marker_beacon name = "marker beacon" @@ -85,25 +86,30 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sortList(list( . = ..() if(set_color) picked_color = set_color - update_icon() + update_appearance() /obj/structure/marker_beacon/deconstruct(disassembled = TRUE) if(!(flags_1 & NODECONSTRUCT_1)) var/obj/item/stack/marker_beacon/M = new(loc) M.picked_color = picked_color - M.update_icon() + M.update_appearance() qdel(src) /obj/structure/marker_beacon/examine(mob/user) . = ..() . += "Alt-click to select a color. Current color is [picked_color]." -/obj/structure/marker_beacon/update_icon() +/obj/structure/marker_beacon/update_appearance(updates) while(!picked_color || !GLOB.marker_beacon_colors[picked_color]) picked_color = pick(GLOB.marker_beacon_colors) - icon_state = "[initial(icon_state)][lowertext(picked_color)]-on" + + . = ..() set_light(light_range, light_power, GLOB.marker_beacon_colors[picked_color]) +/obj/structure/marker_beacon/update_icon_state() + icon_state = "[initial(icon_state)][lowertext(picked_color)]-on" + return ..() + /obj/structure/marker_beacon/attack_hand(mob/living/user) . = ..() if(.) @@ -112,7 +118,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sortList(list( if(do_after(user, remove_speed, target = src)) var/obj/item/stack/marker_beacon/M = new(loc) M.picked_color = picked_color - M.update_icon() + M.update_appearance() transfer_fingerprints_to(M) if(user.put_in_hands(M, TRUE)) //delete the beacon if it fails playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE) @@ -145,4 +151,4 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sortList(list( return if(input_color) picked_color = input_color - update_icon() + update_appearance() diff --git a/code/modules/mining/equipment/regenerative_core.dm b/code/modules/mining/equipment/regenerative_core.dm index c1ae174aa970..b8240b34ddd2 100644 --- a/code/modules/mining/equipment/regenerative_core.dm +++ b/code/modules/mining/equipment/regenerative_core.dm @@ -44,7 +44,7 @@ /obj/item/organ/regenerative_core/proc/preserved(implanted = 0) inert = FALSE preserved = TRUE - update_icon() + update_appearance() desc = "All that remains of a hivelord. It is preserved, allowing you to use it to heal completely without danger of decay." if(implanted) SSblackbox.record_feedback("nested tally", "hivelord_core", 1, list("[type]", "implanted")) @@ -56,7 +56,7 @@ name = "decayed regenerative core" desc = "All that remains of a hivelord. It has decayed, and is completely useless." SSblackbox.record_feedback("nested tally", "hivelord_core", 1, list("[type]", "inert")) - update_icon() + update_appearance() /obj/item/organ/regenerative_core/ui_action_click() if(inert) @@ -139,10 +139,11 @@ /obj/item/organ/regenerative_core/legion/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/organ/regenerative_core/update_icon_state() icon_state = inert ? "legion_soul_inert" : "legion_soul" + return ..() /obj/item/organ/regenerative_core/update_overlays() . = ..() @@ -193,3 +194,4 @@ icon_state = inert ? "crystal_heart_inert" : "crystal_heart" if(preserved) icon_state = "crystal_heart_preserved" + return ..() diff --git a/code/modules/mining/equipment/survival_pod.dm b/code/modules/mining/equipment/survival_pod.dm index 1bf858b8aa60..80c3d276d9b8 100644 --- a/code/modules/mining/equipment/survival_pod.dm +++ b/code/modules/mining/equipment/survival_pod.dm @@ -149,6 +149,7 @@ /obj/machinery/stasis/survival_pod icon = 'icons/obj/lavaland/survival_pod.dmi' icon_state = "sleeper" + base_icon_state = "sleeper" mattress_state = null buckle_lying = 270 diff --git a/code/modules/mining/lavaland/ash_flora.dm b/code/modules/mining/lavaland/ash_flora.dm index 1311968c9f38..ec7c69a7f3a3 100644 --- a/code/modules/mining/lavaland/ash_flora.dm +++ b/code/modules/mining/lavaland/ash_flora.dm @@ -465,6 +465,7 @@ /obj/item/reagent_containers/glass/bowl/mushroom_bowl/update_icon_state() if(!reagents || !reagents.total_volume) icon_state = "mushroom_bowl" + return ..() /obj/item/reagent_containers/glass/bowl/mushroom_bowl/attackby(obj/item/I,mob/user, params) if(istype(I, /obj/item/reagent_containers/food/snacks)) diff --git a/code/modules/mining/lavaland/necropolis_chests.dm b/code/modules/mining/lavaland/necropolis_chests.dm index fae519926241..77947d71043b 100644 --- a/code/modules/mining/lavaland/necropolis_chests.dm +++ b/code/modules/mining/lavaland/necropolis_chests.dm @@ -943,7 +943,7 @@ . = ..() . += "This weapon contains a gradual heat accelerator that increases shot power as the weapon's energy stores are depleted. Shots at low power are significantly stronger, but also have incredibly short range." -/obj/item/gun/energy/spur/update_icon() +/obj/item/gun/energy/spur/update_appearance() var/maxcharge = cell.maxcharge var/charge = cell.charge @@ -968,7 +968,8 @@ if(chargesound != oldsound) playsound(src, chargesound, 100) - return + return ..() + return ..() /obj/item/ammo_casing/energy/spur projectile_type = /obj/projectile/bullet/spur @@ -1660,11 +1661,12 @@ /obj/item/hierophant_club/update_icon_state() icon_state = item_state = "hierophant_club[timer <= world.time ? "_ready":""][(beacon && !QDELETED(beacon)) ? "":"_beacon"]" + return ..() /obj/item/hierophant_club/proc/prepare_icon_update() - update_icon() + update_appearance() sleep(timer - world.time) - update_icon() + update_appearance() /obj/item/hierophant_club/ui_action_click(mob/user, action) if(istype(action, /datum/action/item_action/toggle_unfriendly_fire)) //toggle friendly fire... diff --git a/code/modules/mining/lavaland/ruins/gym.dm b/code/modules/mining/lavaland/ruins/gym.dm index 67b554a2333a..8a73aff51a69 100644 --- a/code/modules/mining/lavaland/ruins/gym.dm +++ b/code/modules/mining/lavaland/ruins/gym.dm @@ -48,7 +48,7 @@ return else obj_flags |= IN_USE - update_icon() + update_appearance() user.setDir(SOUTH) user.Stun(80) user.forceMove(src.loc) @@ -58,7 +58,7 @@ playsound(user, 'sound/machines/click.ogg', 60, TRUE) obj_flags &= ~IN_USE - update_icon() + update_appearance() user.pixel_y = user.base_pixel_y var/finishmessage = pick("You feel stronger!","You feel like you can take on the world!","You feel robust!","You feel indestructible!") SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "exercise", /datum/mood_event/exercise) diff --git a/code/modules/mining/machine_bluespaceminer.dm b/code/modules/mining/machine_bluespaceminer.dm index f07d8a546caa..feffb562a7e0 100644 --- a/code/modules/mining/machine_bluespaceminer.dm +++ b/code/modules/mining/machine_bluespaceminer.dm @@ -41,6 +41,7 @@ icon_state = (active) ? "bsm_on" : "bsm_idle" else icon_state = "bsm_off" + return ..() /obj/machinery/power/bluespace_miner/RefreshParts() var/M_C = 0 //mining_chance @@ -100,7 +101,7 @@ return TRUE active = TRUE to_chat(user, "You turn on the [src].") - update_icon() + update_appearance() else to_chat(user, "[src] needs to be firmly secured to the floor first!") return TRUE @@ -115,7 +116,7 @@ if(!anchored || (!powernet && idle_power_usage)) powered = FALSE active = FALSE - update_icon() + update_appearance() return if(active) var/true_power_usage = idle_power_usage * power_coeff @@ -123,13 +124,13 @@ add_load(true_power_usage) if(!powered) powered = TRUE - update_icon() + update_appearance() if(prob(mining_chance)) mine() else if(powered) powered = FALSE - update_icon() + update_appearance() return /obj/machinery/power/bluespace_miner/can_be_unfasten_wrench(mob/user, silent) diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 8194f93c50da..fd36a4bb4ab1 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -346,11 +346,10 @@ ..() /obj/machinery/mineral/ore_redemption/update_icon_state() - // WS Start - Directional ORM Sprites if (panel_open) icon_state = "[initial(icon_state)]-open" - // WS End - Directional ORM Sprites if(powered()) icon_state = initial(icon_state) else icon_state = "[initial(icon_state)]-off" + return ..() diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index fc23e4b79200..b1e18d191920 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -244,7 +244,7 @@ observer.real_name = observer.client.prefs.real_name observer.name = observer.real_name observer.client.init_verbs() - observer.update_icon() + observer.update_appearance() observer.stop_sound_channel(CHANNEL_LOBBYMUSIC) deadchat_broadcast(" has observed.", "[observer.real_name]", follow_target = observer, turf_target = get_turf(observer), message_type = DEADCHAT_DEATHRATTLE) QDEL_NULL(mind) diff --git a/code/modules/mob/dead/observer/login.dm b/code/modules/mob/dead/observer/login.dm index 2f3b164805f1..0e870bc68fe4 100644 --- a/code/modules/mob/dead/observer/login.dm +++ b/code/modules/mob/dead/observer/login.dm @@ -14,5 +14,5 @@ preferred_form = client.prefs.ghost_form ghost_orbit = client.prefs.ghost_orbit - update_icon(preferred_form) + update_icon(ALL, preferred_form) updateghostimages() diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 768d20870528..87b241dc8d53 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -112,7 +112,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) facial_hairstyle = body_human.facial_hairstyle facial_hair_color = brighten_color(body_human.facial_hair_color) - update_icon() + update_appearance() if(!T) var/list/turfs = get_areatype_turfs(/area/overmap) @@ -180,12 +180,12 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) /* * This proc will update the icon of the ghost itself, with hair overlays, as well as the ghost image. - * Please call update_icon(icon_state) from now on when you want to update the icon_state of the ghost, + * Please call update_icon(updates, icon_state) from now on when you want to update the icon_state of the ghost, * or you might end up with hair on a sprite that's not supposed to get it. * Hair will always update its dir, so if your sprite has no dirs the haircut will go all over the place. * |- Ricotez */ -/mob/dead/observer/update_icon(new_form) +/mob/dead/observer/update_icon(updates=ALL, new_form) . = ..() if(client) //We update our preferences in case they changed right before update_icon was called. @@ -799,7 +799,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp facial_hairstyle = client.prefs.facial_hairstyle facial_hair_color = brighten_color(client.prefs.facial_hair_color) - update_icon() + update_appearance() /mob/dead/observer/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE) return isAdminGhostAI(usr) diff --git a/code/modules/mob/living/brain/MMI.dm b/code/modules/mob/living/brain/MMI.dm index 4acd0873a556..d04b54fa2804 100644 --- a/code/modules/mob/living/brain/MMI.dm +++ b/code/modules/mob/living/brain/MMI.dm @@ -3,6 +3,7 @@ desc = "The Warrior's bland acronym, MMI, obscures the true horror of this monstrosity. Circuit board to brain." icon = 'icons/obj/assemblies.dmi' icon_state = "mmi_off" + base_icon_state = "mmi" w_class = WEIGHT_CLASS_NORMAL var/braintype = "Cyborg" var/obj/item/radio/radio = null //Let's give it a radio. @@ -33,11 +34,12 @@ /obj/item/mmi/update_icon_state() if(!brain) - icon_state = "mmi_off" + icon_state = "[base_icon_state]_off" else if(istype(brain, /obj/item/organ/brain/alien)) - icon_state = "mmi_brain_alien" + icon_state = "[base_icon_state]_brain_alien" else - icon_state = "mmi_brain" + icon_state = "[base_icon_state]_brain" + return ..() /obj/item/mmi/update_overlays() . = ..() @@ -87,7 +89,7 @@ brain.organ_flags |= ORGAN_FROZEN name = "[initial(name)]: [brainmob.real_name]" - update_icon() + update_appearance() if(istype(brain, /obj/item/organ/brain/alien)) braintype = "Xenoborg" //HISS....Beep. else @@ -108,7 +110,7 @@ to_chat(user, "You toggle [src]'s radio system [radio.on==1 ? "on" : "off"].") else eject_brain(user) - update_icon() + update_appearance() name = initial(name) to_chat(user, "You unlock and upend [src], spilling the brain onto the floor.") @@ -153,7 +155,7 @@ brain.organ_flags |= ORGAN_FROZEN name = "[initial(name)]: [brainmob.real_name]" - update_icon() + update_appearance() if(istype(brain, /obj/item/organ/brain/alien)) braintype = "Xenoborg" //HISS....Beep. else diff --git a/code/modules/mob/living/brain/brain_item.dm b/code/modules/mob/living/brain/brain_item.dm index f7c294638a40..3f55549c3b6f 100644 --- a/code/modules/mob/living/brain/brain_item.dm +++ b/code/modules/mob/living/brain/brain_item.dm @@ -283,7 +283,7 @@ brainmob.set_stat(CONSCIOUS) //mmis are conscious brainmob.remove_from_dead_mob_list() brainmob.add_to_alive_mob_list() //mmis are technically alive I guess? - stored_mmi.update_icon() //update it because the brain is alive now + stored_mmi.update_appearance() //update it because the brain is alive now brainmob.reset_perspective() //resets perspective to the mmi brainmob = null //clears the brainmob var so it doesn't get deleted when the holder is destroyed diff --git a/code/modules/mob/living/brain/death.dm b/code/modules/mob/living/brain/death.dm index 7caff58d720a..32db2599c0b4 100644 --- a/code/modules/mob/living/brain/death.dm +++ b/code/modules/mob/living/brain/death.dm @@ -7,7 +7,7 @@ var/obj/item/mmi = container mmi.visible_message("[src]'s MMI flatlines!", \ "You hear something flatline.") - mmi.update_icon() + mmi.update_appearance() return ..() diff --git a/code/modules/mob/living/brain/posibrain.dm b/code/modules/mob/living/brain/posibrain.dm index a6d8ea948e99..06bc7e0bc886 100644 --- a/code/modules/mob/living/brain/posibrain.dm +++ b/code/modules/mob/living/brain/posibrain.dm @@ -5,6 +5,7 @@ GLOBAL_VAR(posibrain_notify_cooldown) desc = "A cube of shining metal, four inches to a side and covered in shallow grooves." icon = 'icons/obj/assemblies.dmi' icon_state = "posibrain" + base_icon_state = "posibrain" w_class = WEIGHT_CLASS_NORMAL var/ask_role = "" ///Can be set to tell ghosts what the brain will be used for var/next_ask ///World time tick when ghost polling will be available again @@ -56,7 +57,7 @@ GLOBAL_VAR(posibrain_notify_cooldown) ping_ghosts("requested", FALSE) next_ask = world.time + askDelay searching = TRUE - update_icon() + update_appearance() addtimer(CALLBACK(src, .proc/check_success), askDelay) /obj/item/mmi/posibrain/AltClick(mob/living/user) @@ -68,11 +69,11 @@ GLOBAL_VAR(posibrain_notify_cooldown) if(input_seed) to_chat(user, "You set the personality seed to \"[input_seed]\".") ask_role = input_seed - update_icon() + update_appearance() /obj/item/mmi/posibrain/proc/check_success() searching = FALSE - update_icon() + update_appearance() if(QDELETED(brainmob)) return if(brainmob.client) @@ -122,7 +123,7 @@ GLOBAL_VAR(posibrain_notify_cooldown) brainmob.mind.remove_all_antag() brainmob.mind.wipe_memory() - update_icon() + update_appearance() ///Moves the candidate from the ghost to the posibrain /obj/item/mmi/posibrain/proc/transfer_personality(mob/candidate) @@ -185,12 +186,15 @@ GLOBAL_VAR(posibrain_notify_cooldown) /obj/item/mmi/posibrain/update_icon_state() + . = ..() if(searching) - icon_state = "[initial(icon_state)]-searching" - else if(brainmob && brainmob.key) - icon_state = "[initial(icon_state)]-occupied" - else - icon_state = initial(icon_state) + icon_state = "[base_icon_state]-searching" + return + if(brainmob?.key) + icon_state = "[base_icon_state]-occupied" + return + icon_state = "[base_icon_state]" + return /obj/item/mmi/posibrain/add_mmi_overlay() return diff --git a/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm b/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm index 0c135007d17b..ec4105fde0ce 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm @@ -202,6 +202,7 @@ Doesn't work on other aliens/AI.*/ /obj/effect/proc_holder/alien/neurotoxin/update_icon() action.button_icon_state = "alien_neurotoxin_[active]" action.UpdateButtonIcon() + return ..() /obj/effect/proc_holder/alien/neurotoxin/InterceptClickOn(mob/living/caller, params, atom/target) if(..()) diff --git a/code/modules/mob/living/carbon/alien/utilities/structures.dm b/code/modules/mob/living/carbon/alien/utilities/structures.dm index 344a689f731f..6989434995f9 100644 --- a/code/modules/mob/living/carbon/alien/utilities/structures.dm +++ b/code/modules/mob/living/carbon/alien/utilities/structures.dm @@ -313,7 +313,7 @@ /obj/structure/alien/egg/Initialize(mapload) . = ..() - update_icon() + update_appearance() if(status == GROWING || status == GROWN) child = new(src) if(status == GROWING) @@ -330,6 +330,7 @@ icon_state = "[base_icon]" if(BURST) icon_state = "[base_icon]_hatched" + return ..() /obj/structure/alien/egg/attack_paw(mob/living/user) return attack_hand(user) @@ -362,7 +363,7 @@ /obj/structure/alien/egg/proc/Grow() status = GROWN - update_icon() + update_appearance() proximity_monitor.SetRange(1) //drops and kills the hugger if any is remaining @@ -370,7 +371,7 @@ if(status == GROWN || status == GROWING) proximity_monitor.SetRange(0) status = BURST - update_icon() + update_appearance() flick("egg_opening", src) addtimer(CALLBACK(src, .proc/finish_bursting, kill), 15) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index ad0acd832cd5..f6bf7d8d08ab 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -33,10 +33,10 @@ var/atom/movable/screen/inventory/hand/H H = hud_used.hand_slots["[oindex]"] if(H) - H.update_icon() + H.update_appearance() H = hud_used.hand_slots["[held_index]"] if(H) - H.update_icon() + H.update_appearance() /mob/living/carbon/activate_hand(selhand) //l/r OR 1-held_items.len diff --git a/code/modules/mob/living/carbon/hologram/em_holopads.dm b/code/modules/mob/living/carbon/hologram/em_holopads.dm index 9829d68cfff4..96947ef44326 100644 --- a/code/modules/mob/living/carbon/hologram/em_holopads.dm +++ b/code/modules/mob/living/carbon/hologram/em_holopads.dm @@ -32,6 +32,7 @@ icon_state = "holopad1" else icon_state = "holopad3" + return ..() /obj/machinery/holopad/emergency/attack_ghost(mob/dead/observer/user) if(!SSticker.HasRoundStarted() || !loc || !em_starting || em) diff --git a/code/modules/mob/living/carbon/hologram/hologram.dm b/code/modules/mob/living/carbon/hologram/hologram.dm index e1582bec3b54..9479a2357c36 100644 --- a/code/modules/mob/living/carbon/hologram/hologram.dm +++ b/code/modules/mob/living/carbon/hologram/hologram.dm @@ -203,10 +203,10 @@ drop_all_held_items() //can't hold things when you don't actually exist dextrous = FALSE//see above comment to_chat(src, "You toggle your density [density ? "on" : "off"].") - update_icon() + update_appearance() update_gravity() -/mob/living/simple_animal/hologram/update_icon() +/mob/living/simple_animal/hologram/update_appearance() . = ..() alpha = density ? initial(alpha) : 100 //applies opacity effect if non-dense color = density ? initial(color) : "#77abff" //makes the hologram slightly blue diff --git a/code/modules/mob/living/carbon/hologram/hologram_inventory.dm b/code/modules/mob/living/carbon/hologram/hologram_inventory.dm index 0745de663690..f7f98bf5ebbe 100644 --- a/code/modules/mob/living/carbon/hologram/hologram_inventory.dm +++ b/code/modules/mob/living/carbon/hologram/hologram_inventory.dm @@ -106,10 +106,10 @@ var/atom/movable/screen/inventory/inv inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_LPOCKET) + 1] - inv.update_icon() + inv.update_appearance() inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_RPOCKET) + 1] - inv.update_icon() + inv.update_appearance() if(l_store) l_store.screen_loc = ui_storage1 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 eb2663309517..f54c9dff634d 100644 --- a/code/modules/mob/living/carbon/human/species_types/shadowpeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/shadowpeople.dm @@ -218,7 +218,7 @@ var/obj/item/pda/PDA = O PDA.set_light_on(FALSE) PDA.set_light_range(0) //It won't be turning on again. - PDA.update_icon() + PDA.update_appearance() visible_message("The light in [PDA] shorts out!") else visible_message("[O] is disintegrated by [src]!") diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index c74894d4c3be..d7d6754b0e5d 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -102,7 +102,7 @@ There are several things that need to be remembered: if(client && hud_used) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_ICLOTHING) + 1] - inv.update_icon() + inv.update_appearance() if(istype(w_uniform, /obj/item/clothing/under)) var/obj/item/clothing/under/U = w_uniform @@ -159,7 +159,7 @@ There are several things that need to be remembered: if(client && hud_used) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_ID) + 1] - inv.update_icon() + inv.update_appearance() var/mutable_appearance/id_overlay = overlays_standing[ID_LAYER] @@ -181,7 +181,7 @@ There are several things that need to be remembered: if(client && hud_used && hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_GLOVES) + 1]) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_GLOVES) + 1] - inv.update_icon() + inv.update_appearance() //Bloody hands begin if(!gloves && blood_in_hands && (num_hands > 0)) @@ -231,7 +231,7 @@ There are several things that need to be remembered: if(client && hud_used) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_EYES) + 1] - inv.update_icon() + inv.update_appearance() if(glasses) var/obj/item/I = glasses @@ -264,7 +264,7 @@ There are several things that need to be remembered: if(client && hud_used) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_EARS) + 1] - inv.update_icon() + inv.update_appearance() if(ears) var/obj/item/I = ears @@ -297,7 +297,7 @@ There are several things that need to be remembered: if(client && hud_used) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_FEET) + 1] - inv.update_icon() + inv.update_appearance() if(shoes) var/obj/item/I = shoes @@ -335,7 +335,7 @@ There are several things that need to be remembered: if(client && hud_used) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_SUITSTORE) + 1] - inv.update_icon() + inv.update_appearance() if(s_store) var/obj/item/I = s_store @@ -357,7 +357,7 @@ There are several things that need to be remembered: remove_overlay(HEAD_LAYER) if(client && hud_used && hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_BACK) + 1]) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_HEAD) + 1] - inv.update_icon() + inv.update_appearance() if(head) var/obj/item/I = head @@ -390,7 +390,7 @@ There are several things that need to be remembered: if(client && hud_used) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_BELT) + 1] - inv.update_icon() + inv.update_appearance() if(belt) var/obj/item/I = belt @@ -424,7 +424,7 @@ There are several things that need to be remembered: if(client && hud_used) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_OCLOTHING) + 1] - inv.update_icon() + inv.update_appearance() if(wear_suit) var/obj/item/I = wear_suit @@ -465,7 +465,7 @@ There are several things that need to be remembered: inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_LPOCKET) + 1] inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_RPOCKET) + 1] - inv.update_icon() + inv.update_appearance() if(l_store) l_store.screen_loc = ui_storage1 @@ -488,7 +488,7 @@ There are several things that need to be remembered: if(client && hud_used && hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_MASK) + 1]) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_MASK) + 1] - inv.update_icon() + inv.update_appearance() if(wear_mask) var/obj/item/I = wear_mask @@ -522,7 +522,7 @@ There are several things that need to be remembered: if(client && hud_used && hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_NECK) + 1]) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_NECK) + 1] - inv.update_icon() + inv.update_appearance() if(wear_neck) var/obj/item/I = wear_neck @@ -545,7 +545,7 @@ There are several things that need to be remembered: if(client && hud_used && hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_BACK) + 1]) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_BACK) + 1] - inv.update_icon() + inv.update_appearance() if(back) var/obj/item/I = back diff --git a/code/modules/mob/living/carbon/update_icons.dm b/code/modules/mob/living/carbon/update_icons.dm index 7292436c4d68..308abdb92f36 100644 --- a/code/modules/mob/living/carbon/update_icons.dm +++ b/code/modules/mob/living/carbon/update_icons.dm @@ -120,7 +120,7 @@ if(client && hud_used && hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_MASK) + 1]) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_MASK) + 1] - inv.update_icon() + inv.update_appearance() if(wear_mask) if(!(ITEM_SLOT_MASK in check_obscured_slots())) @@ -134,7 +134,7 @@ if(client && hud_used && hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_NECK) + 1]) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_NECK) + 1] - inv.update_icon() + inv.update_appearance() if(wear_neck) if(!(ITEM_SLOT_NECK in check_obscured_slots())) @@ -148,7 +148,7 @@ if(client && hud_used && hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_BACK) + 1]) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_BACK) + 1] - inv.update_icon() + inv.update_appearance() if(back) overlays_standing[BACK_LAYER] = back.build_worn_icon(default_layer = BACK_LAYER, default_icon_file = 'icons/mob/clothing/back.dmi', mob_species = dna?.species) @@ -164,7 +164,7 @@ if(client && hud_used && hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_BACK) + 1]) var/atom/movable/screen/inventory/inv = hud_used.inv_slots[TOBITSHIFT(ITEM_SLOT_HEAD) + 1] - inv.update_icon() + inv.update_appearance() if(head) overlays_standing[HEAD_LAYER] = head.build_worn_icon(default_layer = HEAD_LAYER, default_icon_file = 'icons/mob/clothing/head.dmi', mob_species = dna?.species) @@ -188,7 +188,7 @@ for(var/hand in hud_used.hand_slots) var/atom/movable/screen/inventory/hand/H = hud_used.hand_slots[hand] if(H) - H.update_icon() + H.update_appearance() //update whether our head item appears on our hud. /mob/living/carbon/proc/update_hud_head(obj/item/I) diff --git a/code/modules/mob/living/init_signals.dm b/code/modules/mob/living/init_signals.dm index d02e64391536..65bb3b762955 100644 --- a/code/modules/mob/living/init_signals.dm +++ b/code/modules/mob/living/init_signals.dm @@ -134,14 +134,14 @@ SIGNAL_HANDLER ADD_TRAIT(src, TRAIT_UI_BLOCKED, TRAIT_INCAPACITATED) ADD_TRAIT(src, TRAIT_PULL_BLOCKED, TRAIT_INCAPACITATED) - update_icon() + update_appearance() /// Called when [TRAIT_INCAPACITATED] is removed from the mob. /mob/living/proc/on_incapacitated_trait_loss(datum/source) SIGNAL_HANDLER REMOVE_TRAIT(src, TRAIT_UI_BLOCKED, TRAIT_INCAPACITATED) REMOVE_TRAIT(src, TRAIT_PULL_BLOCKED, TRAIT_INCAPACITATED) - update_icon() + update_appearance() /// Called when [TRAIT_RESTRAINED] is added to the mob. diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index e8c8a9286ec7..d782d21dfd53 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -904,7 +904,7 @@ to_chat(src, "Hack aborted. The designated APC no longer exists on the power network.") playsound(get_turf(src), 'sound/machines/buzz-two.ogg', 50, TRUE, ignore_walls = FALSE) else if(apc.aidisabled) - to_chat(src, "Hack aborted. \The [apc] is no longer responding to our systems.") + to_chat(src, "Hack aborted. [apc] is no longer responding to our systems.") playsound(get_turf(src), 'sound/machines/buzz-sigh.ogg', 50, TRUE, ignore_walls = FALSE) else malf_picker.processing_time += 10 @@ -915,8 +915,8 @@ apc.coverlocked = TRUE playsound(get_turf(src), 'sound/machines/ding.ogg', 50, TRUE, ignore_walls = FALSE) - to_chat(src, "Hack complete. \The [apc] is now under your exclusive control.") - apc.update_icon() + to_chat(src, "Hack complete. [apc] is now under your exclusive control.") + apc.update_appearance() /mob/living/silicon/ai/verb/deploy_to_shell(mob/living/silicon/robot/target) set category = "AI Commands" diff --git a/code/modules/mob/living/silicon/ai/multicam.dm b/code/modules/mob/living/silicon/ai/multicam.dm index e40f5034437b..712450ec7dd2 100644 --- a/code/modules/mob/living/silicon/ai/multicam.dm +++ b/code/modules/mob/living/silicon/ai/multicam.dm @@ -168,14 +168,14 @@ GLOBAL_DATUM(ai_camera_room_landmark, /obj/effect/landmark/ai_multicam_room) continue cameras_telegraphed -= C C.in_use_lights-- - C.update_icon() + C.update_appearance() for (var/V in add) var/obj/machinery/camera/C = V if(QDELETED(C)) continue cameras_telegraphed |= C C.in_use_lights++ - C.update_icon() + C.update_appearance() /mob/camera/aiEye/pic_in_pic/proc/disable_camera_telegraphing() telegraph_cameras = FALSE @@ -184,7 +184,7 @@ GLOBAL_DATUM(ai_camera_room_landmark, /obj/effect/landmark/ai_multicam_room) if(QDELETED(C)) continue C.in_use_lights-- - C.update_icon() + C.update_appearance() cameras_telegraphed.Cut() /mob/camera/aiEye/pic_in_pic/Destroy() diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 8dfca209ce39..02f1918ccef4 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -155,7 +155,7 @@ mmi.brainmob.name = src.real_name mmi.brainmob.real_name = src.real_name mmi.brainmob.container = mmi - mmi.update_icon() + mmi.update_appearance() INVOKE_ASYNC(src, .proc/updatename) @@ -184,7 +184,7 @@ mmi.brainmob.remove_from_dead_mob_list() mmi.brainmob.add_to_alive_mob_list() mind.transfer_to(mmi.brainmob) - mmi.update_icon() + mmi.update_appearance() else to_chat(src, "Oops! Something went very wrong, your MMI was unable to receive your mind. You have been ghosted. Please make a bug report so we can fix this bug.") ghostize() @@ -570,14 +570,14 @@ if(!(update_color && lamp_enabled) && (turn_off || lamp_enabled || update_color || !lamp_functional || stat || low_power_mode)) set_light_on(FALSE) lamp_enabled = FALSE - lampButton.update_icon() + lampButton.update_appearance() update_icons() return set_light_range(lamp_intensity) set_light_color(lamp_color) set_light_on(TRUE) lamp_enabled = TRUE - lampButton.update_icon() + lampButton.update_appearance() update_icons() /mob/living/silicon/robot/proc/deconstruct() @@ -605,7 +605,7 @@ robot_suit.head.flash2.burn_out() robot_suit.head.flash2 = null robot_suit.head = null - robot_suit.update_icon() + robot_suit.update_appearance() else new /obj/item/robot_suit(T) new /obj/item/bodypart/leg/left/robot(T) diff --git a/code/modules/mob/living/silicon/robot/robot_defense.dm b/code/modules/mob/living/silicon/robot/robot_defense.dm index 5f398d24b7b6..433c735a2784 100644 --- a/code/modules/mob/living/silicon/robot/robot_defense.dm +++ b/code/modules/mob/living/silicon/robot/robot_defense.dm @@ -292,7 +292,7 @@ GLOBAL_LIST_INIT(blacklisted_borg_hats, typecacheof(list( //Hats that don't real add_fingerprint(user) if(opened && !wiresexposed && !issilicon(user)) if(cell) - cell.update_icon() + cell.update_appearance() cell.add_fingerprint(user) user.put_in_active_hand(cell) to_chat(user, "You remove \the [cell].") diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm index 82af2a7afdcd..dee91ab20f81 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -143,7 +143,7 @@ var/obj/item/assembly/flash/F = I F.times_used = 0 F.burnt_out = FALSE - F.update_icon() + F.update_appearance() else if(istype(I, /obj/item/melee/baton)) var/obj/item/melee/baton/B = I if(B.cell) @@ -614,7 +614,7 @@ if(T.cell.charge < T.cell.maxcharge) var/obj/item/ammo_casing/energy/S = T.ammo_type[T.select] T.cell.give(S.e_cost * coeff) - T.update_icon() + T.update_appearance() else T.charge_tick = 0 diff --git a/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm b/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm index 02136fee0f0e..b0c583b9c247 100644 --- a/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm +++ b/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm @@ -51,7 +51,7 @@ weapon.attack(C, src) playsound(src, 'sound/weapons/blade1.ogg', 50, TRUE, -1) if(C.stat == DEAD) - addtimer(CALLBACK(src, /atom/.proc/update_icon), 2) + addtimer(CALLBACK(src, /atom/.proc/update_appearance), 2) back_to_idle() @@ -60,13 +60,13 @@ return switch(mode) if(BOT_IDLE) // idle - update_icon() + update_appearance() walk_to(src,0) look_for_perp() // see if any criminals are in range if(!mode && auto_patrol) // still idle, and set to patrol mode = BOT_START_PATROL // switch to patrol mode if(BOT_HUNT) // hunting for perp - update_icon() + update_appearance() playsound(src,'sound/effects/beepskyspinsabre.ogg',100,TRUE,-1) // general beepsky doesn't give up so easily, jedi scum if(frustration >= 20) diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index ea152c9baea3..be4807b33369 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -134,7 +134,7 @@ REMOVE_TRAIT(src, TRAIT_IMMOBILIZED, POWER_LACK_TRAIT) REMOVE_TRAIT(src, TRAIT_HANDS_BLOCKED, POWER_LACK_TRAIT) set_light_on(on) - update_icon() + update_appearance() diag_hud_set_botstat() return TRUE @@ -145,7 +145,7 @@ ADD_TRAIT(src, TRAIT_HANDS_BLOCKED, POWER_LACK_TRAIT) set_light_on(on) bot_reset() //Resets an AI's call, should it exist. - update_icon() + update_appearance() /mob/living/simple_animal/bot/Initialize() . = ..() @@ -430,7 +430,7 @@ if(istype(dropped_item, /obj/item/stock_parts/cell)) var/obj/item/stock_parts/cell/dropped_cell = dropped_item dropped_cell.charge = 0 - dropped_cell.update_icon() + dropped_cell.update_appearance() else if(istype(dropped_item, /obj/item/storage)) var/obj/item/storage/S = dropped_item @@ -439,7 +439,7 @@ else if(istype(dropped_item, /obj/item/gun/energy)) var/obj/item/gun/energy/dropped_gun = dropped_item dropped_gun.cell.charge = 0 - dropped_gun.update_icon() + dropped_gun.update_appearance() //Generalized behavior code, override where needed! @@ -893,6 +893,7 @@ Pass a positive integer as an argument to override a bot's default speed. /mob/living/simple_animal/bot/update_icon_state() icon_state = "[initial(icon_state)][on]" + return ..() // Machinery to simplify topic and access calls /obj/machinery/bot_core @@ -1004,7 +1005,7 @@ Pass a positive integer as an argument to override a bot's default speed. /mob/living/simple_animal/bot/revive(full_heal = FALSE, admin_revive = FALSE) if(..()) - update_icon() + update_appearance() . = TRUE /mob/living/simple_animal/bot/ghost() diff --git a/code/modules/mob/living/simple_animal/bot/construction.dm b/code/modules/mob/living/simple_animal/bot/construction.dm index 17a790477476..4a072df3ab8b 100644 --- a/code/modules/mob/living/simple_animal/bot/construction.dm +++ b/code/modules/mob/living/simple_animal/bot/construction.dm @@ -167,19 +167,30 @@ /obj/item/bot_assembly/floorbot/Initialize() . = ..() - update_icon() + update_appearance() -/obj/item/bot_assembly/floorbot/update_icon() - ..() +/obj/item/bot_assembly/floorbot/update_name() + . = ..() switch(build_step) - if(ASSEMBLY_FIRST_STEP) - desc = initial(desc) + if(ASSEMBLY_SECOND_STEP) + name = "incomplete floorbot assembly" + else name = initial(name) - icon_state = "[toolbox_color]toolbox_tiles" +/obj/item/bot_assembly/floorbot/update_desc() + . = ..() + switch(build_step) if(ASSEMBLY_SECOND_STEP) desc = "It's a toolbox with tiles sticking out the top and a sensor attached." - name = "incomplete floorbot assembly" + else + desc = initial(desc) + +/obj/item/bot_assembly/floorbot/update_icon_state() + . = ..() + switch(build_step) + if(ASSEMBLY_FIRST_STEP) + icon_state = "[toolbox_color]toolbox_tiles" + if(ASSEMBLY_SECOND_STEP) icon_state = "[toolbox_color]toolbox_tiles_sensor" /obj/item/bot_assembly/floorbot/attackby(obj/item/W, mob/user, params) @@ -192,7 +203,7 @@ to_chat(user, "You add [W] to [src].") qdel(W) build_step++ - update_icon() + update_appearance() if(ASSEMBLY_SECOND_STEP) if(istype(W, /obj/item/bodypart/l_arm/robot) || istype(W, /obj/item/bodypart/r_arm/robot)) diff --git a/code/modules/mob/living/simple_animal/bot/firebot.dm b/code/modules/mob/living/simple_animal/bot/firebot.dm index e7be1b12234a..4bfa9dd98a6c 100644 --- a/code/modules/mob/living/simple_animal/bot/firebot.dm +++ b/code/modules/mob/living/simple_animal/bot/firebot.dm @@ -59,7 +59,7 @@ /mob/living/simple_animal/bot/firebot/Initialize() . = ..() ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT) - update_icon() + update_appearance() var/datum/job/engineer/J = new/datum/job/engineer access_card.access += J.get_access() prev_access = access_card.access @@ -98,11 +98,11 @@ /mob/living/simple_animal/bot/firebot/turn_on() . = ..() - update_icon() + update_appearance() /mob/living/simple_animal/bot/firebot/turn_off() ..() - update_icon() + update_appearance() /mob/living/simple_animal/bot/firebot/bot_reset() ..() @@ -110,14 +110,14 @@ old_target_fire = null ignore_list = list() anchored = FALSE - update_icon() + update_appearance() /mob/living/simple_animal/bot/firebot/proc/soft_reset() path = list() target_fire = null mode = BOT_IDLE last_found = world.time - update_icon() + update_appearance() /mob/living/simple_animal/bot/firebot/set_custom_texts() text_hack = "You corrupt [name]'s safety protocols." @@ -174,7 +174,7 @@ stationary_mode = !stationary_mode update_controls() - update_icon() + update_appearance() /mob/living/simple_animal/bot/firebot/proc/is_burning(atom/target) if(ismob(target)) @@ -306,17 +306,18 @@ flick("firebot1_use", user) internal_ext.afterattack(target, user, null) -/mob/living/simple_animal/bot/firebot/update_icon() +/mob/living/simple_animal/bot/firebot/update_icon_state() + . = ..() if(!on) icon_state = "firebot0" return if(IsStun() || IsParalyzed()) icon_state = "firebots1" + return else if(stationary_mode) //Bot has yellow light to indicate stationary mode. icon_state = "firebots1" - else - icon_state = "firebot1" - + return + icon_state = "firebot1" /mob/living/simple_animal/bot/firebot/explode() on = FALSE diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm index 401522e5dbe7..fa6faaa6a889 100644 --- a/code/modules/mob/living/simple_animal/bot/floorbot.dm +++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm @@ -55,7 +55,7 @@ ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT) if(new_toolbox_color) toolbox_color = new_toolbox_color - update_icon() + update_appearance() var/datum/job/engineer/J = new/datum/job/engineer access_card.access += J.get_access() prev_access = access_card.access @@ -65,11 +65,11 @@ /mob/living/simple_animal/bot/floorbot/turn_on() . = ..() - update_icon() + update_appearance() /mob/living/simple_animal/bot/floorbot/turn_off() ..() - update_icon() + update_appearance() /mob/living/simple_animal/bot/floorbot/bot_reset() ..() @@ -77,7 +77,7 @@ oldloc = null ignore_list = list() anchored = FALSE - update_icon() + update_appearance() /mob/living/simple_animal/bot/floorbot/set_custom_texts() text_hack = "You corrupt [name]'s construction protocols." @@ -367,14 +367,14 @@ if(specialtiles == 0) speak("Requesting refill of custom floortiles to continue replacing.") mode = BOT_IDLE - update_icon() + update_appearance() anchored = FALSE target = null -/mob/living/simple_animal/bot/floorbot/update_icon() +/mob/living/simple_animal/bot/floorbot/update_icon_state() + . = ..() icon_state = "[toolbox_color]floorbot[on]" - /mob/living/simple_animal/bot/floorbot/explode() on = FALSE visible_message("[src] blows apart!") diff --git a/code/modules/mob/living/simple_animal/bot/honkbot.dm b/code/modules/mob/living/simple_animal/bot/honkbot.dm index d4fa1ccdc43d..7697ac90f37f 100644 --- a/code/modules/mob/living/simple_animal/bot/honkbot.dm +++ b/code/modules/mob/living/simple_animal/bot/honkbot.dm @@ -38,7 +38,7 @@ /mob/living/simple_animal/bot/honkbot/Initialize() . = ..() - update_icon() + update_appearance() auto_patrol = TRUE var/datum/job/clown/J = new/datum/job/clown access_card.access += J.get_access() @@ -132,7 +132,7 @@ Maintenance panel panel is [open ? "opened" : "closed"]"}, oldtarget_name = user.name audible_message("[src] gives out an evil laugh!") playsound(src, 'sound/machines/honkbot_evil_laugh.ogg', 75, TRUE, -1) // evil laughter - update_icon() + update_appearance() /mob/living/simple_animal/bot/honkbot/bullet_act(obj/projectile/Proj) if((istype(Proj,/obj/projectile/beam)) || (istype(Proj,/obj/projectile/bullet) && (Proj.damage_type == BURN))||(Proj.damage_type == BRUTE) && (!Proj.nodamage && Proj.damage < health && ishuman(Proj.firer))) diff --git a/code/modules/mob/living/simple_animal/bot/hygienebot.dm b/code/modules/mob/living/simple_animal/bot/hygienebot.dm index cd05106f934e..af1ce80b2a88 100644 --- a/code/modules/mob/living/simple_animal/bot/hygienebot.dm +++ b/code/modules/mob/living/simple_animal/bot/hygienebot.dm @@ -4,6 +4,7 @@ desc = "A flying cleaning robot, he'll chase down people who can't shower properly!" icon = 'icons/obj/watercloset.dmi' icon_state = "drone" + base_icon_state = "hygienebot" density = FALSE anchored = FALSE health = 100 @@ -31,7 +32,7 @@ /mob/living/simple_animal/bot/hygienebot/Initialize() . = ..() - update_icon() + update_appearance() var/datum/job/janitor/J = new/datum/job/janitor access_card.access += J.get_access() prev_access = access_card.access @@ -200,11 +201,11 @@ /mob/living/simple_animal/bot/hygienebot/proc/start_washing() washing = TRUE - update_icon() + update_appearance() /mob/living/simple_animal/bot/hygienebot/proc/stop_washing() washing = FALSE - update_icon() + update_appearance() diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index 4e6cf8fc9057..73991d41c76a 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -14,6 +14,7 @@ desc = "A little medical robot. He looks somewhat underwhelmed." icon = 'icons/mob/aibots.dmi' icon_state = "medibot0" + base_icon_state = "medibot" density = FALSE anchored = FALSE health = 20 @@ -90,23 +91,23 @@ declare_crit = 0 heal_amount = 5 -/mob/living/simple_animal/bot/medbot/update_icon() - cut_overlays() - if(skin) - add_overlay("medskin_[skin]") +/mob/living/simple_animal/bot/medbot/update_icon_state() + . = ..() if(!on) - icon_state = "medibot0" + icon_state = "[base_icon_state]0" return if(HAS_TRAIT(src, TRAIT_INCAPACITATED)) - icon_state = "medibota" + icon_state = "[base_icon_state]a" return if(mode == BOT_HEALING) - icon_state = "medibots[stationary_mode]" + icon_state = "[base_icon_state]s[stationary_mode]" return - else if(stationary_mode) //Bot has yellow light to indicate stationary mode. - icon_state = "medibot2" - else - icon_state = "medibot1" + icon_state = "[base_icon_state][stationary_mode ? 2 : 1]" //Bot has yellow light to indicate stationary mode. + +/mob/living/simple_animal/bot/medbot/update_overlays() + . = ..() + if(skin) + . += "medskin_[skin]" /mob/living/simple_animal/bot/medbot/Initialize(mapload, new_skin) . = ..() @@ -116,7 +117,7 @@ qdel(J) if(new_skin) skin = new_skin - update_icon() + update_appearance() /mob/living/simple_animal/bot/medbot/Destroy() linked_techweb = null @@ -129,14 +130,14 @@ oldloc = null last_found = world.time declare_cooldown = 0 - update_icon() + update_appearance() /mob/living/simple_animal/bot/medbot/proc/soft_reset() //Allows the medibot to still actively perform its medical duties without being completely halted as a hard reset does. path = list() patient = null mode = BOT_IDLE last_found = world.time - update_icon() + update_appearance() /mob/living/simple_animal/bot/medbot/set_custom_texts() @@ -192,7 +193,7 @@ else if(href_list["stationary"]) stationary_mode = !stationary_mode path = list() - update_icon() + update_appearance() else if(href_list["hptech"]) if(!linked_techweb) @@ -376,7 +377,7 @@ if(patient && (get_dist(src,patient) <= 1) && !tending) //Patient is next to us, begin treatment! if(mode != BOT_HEALING) mode = BOT_HEALING - update_icon() + update_appearance() frustration = 0 medicate_patient(patient) return @@ -493,9 +494,9 @@ var/mob/living/carbon/C = A patient = C mode = BOT_HEALING - update_icon() + update_appearance() medicate_patient(C) - update_icon() + update_appearance() else ..() @@ -573,7 +574,7 @@ else tending = FALSE - update_icon() + update_appearance() if(!tending) visible_message("[src] places its tools back into itself.") soft_reset() diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index 77a29aadcd4b..e64b0b362e0a 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -134,7 +134,7 @@ if(open) turn_off() else - update_icon() //this is also handled by turn_off(), so no need to call this twice. + update_appearance() //this is also handled by turn_off(), so no need to call this twice. else if(istype(I, /obj/item/stock_parts/cell) && open) if(cell) to_chat(user, "[src] already has a power cell!") @@ -179,6 +179,7 @@ playsound(src, "sparks", 100, FALSE, SHORT_RANGE_SOUND_EXTRARANGE) /mob/living/simple_animal/bot/mulebot/update_icon_state() //if you change the icon_state names, please make sure to update /datum/wires/mulebot/on_pulse() as well. <3 + . = ..() icon_state = "[base_icon][on ? wires.is_cut(WIRE_AVOIDANCE) : 0]" /mob/living/simple_animal/bot/mulebot/update_overlays() @@ -447,7 +448,7 @@ load = AM mode = BOT_IDLE - update_icon() + update_appearance() /mob/living/simple_animal/bot/mulebot/proc/load_mob(mob/living/M) can_buckle = TRUE @@ -468,7 +469,7 @@ if(QDELETED(load)) if(load) //if our thing was qdel'd, there's likely a leftover reference. just clear it and remove the overlay. we'll let the bot keep moving around to prevent it abruptly stopping somewhere. load = null - update_icon() + update_appearance() return mode = BOT_IDLE @@ -487,7 +488,7 @@ if(dirn) //move the thing to the delivery point. cached_load.Move(get_step(loc,dirn), dirn) - update_icon() + update_appearance() /mob/living/simple_animal/bot/mulebot/get_status_tab_items() . = ..() @@ -766,7 +767,7 @@ new /obj/item/stack/cable_coil/cut(Tsec) if(cell) cell.forceMove(Tsec) - cell.update_icon() + cell.update_appearance() cell = null do_sparks(3, TRUE, src) @@ -842,7 +843,7 @@ load = AM mode = BOT_IDLE - update_icon() + update_appearance() /mob/living/simple_animal/bot/mulebot/paranormal/update_overlays() diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm index 8e954265fcf2..f55d71a8590f 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -78,7 +78,7 @@ /mob/living/simple_animal/bot/secbot/Initialize() . = ..() weapon = new baton_type() - update_icon() + update_appearance() var/datum/job/detective/J = new/datum/job/detective access_card.access += J.get_access() prev_access = access_card.access @@ -91,11 +91,11 @@ QDEL_NULL(weapon) return ..() -/mob/living/simple_animal/bot/secbot/update_icon() +/mob/living/simple_animal/bot/secbot/update_icon_state() if(mode == BOT_HUNT) icon_state = "[initial(icon_state)]-c" return - ..() + return ..() /mob/living/simple_animal/bot/secbot/turn_off() ..() @@ -222,7 +222,7 @@ Auto Patrol: []"}, oldtarget_name = user.name audible_message("[src] buzzes oddly!") declare_arrests = FALSE - update_icon() + update_appearance() /mob/living/simple_animal/bot/secbot/bullet_act(obj/projectile/Proj) if(istype(Proj , /obj/projectile/beam)||istype(Proj, /obj/projectile/bullet)) @@ -453,7 +453,7 @@ Auto Patrol: []"}, new /obj/item/assembly/prox_sensor(Tsec) var/obj/item/gun/energy/disabler/G = new (Tsec) G.cell.charge = 0 - G.update_icon() + G.update_appearance() if(prob(50)) new /obj/item/bodypart/leg/left/robot(Tsec) if(prob(25)) diff --git a/code/modules/mob/living/simple_animal/bot/vibebot.dm b/code/modules/mob/living/simple_animal/bot/vibebot.dm index c5f65c4633cd..9a9d93163937 100644 --- a/code/modules/mob/living/simple_animal/bot/vibebot.dm +++ b/code/modules/mob/living/simple_animal/bot/vibebot.dm @@ -24,7 +24,7 @@ /mob/living/simple_animal/bot/vibebot/Initialize() . = ..() - update_icon() + update_appearance() /mob/living/simple_animal/bot/vibebot/get_controls(mob/user) var/list/dat = list() @@ -43,13 +43,13 @@ /mob/living/simple_animal/bot/vibebot/turn_off() . = ..() remove_atom_colour(TEMPORARY_COLOUR_PRIORITY) - update_icon() + update_appearance() /mob/living/simple_animal/bot/vibebot/proc/Vibe() remove_atom_colour(TEMPORARY_COLOUR_PRIORITY) add_atom_colour("#[random_color()]", TEMPORARY_COLOUR_PRIORITY) set_light_color(color) - update_icon() + update_appearance() /mob/living/simple_animal/bot/vibebot/proc/retaliate(mob/living/carbon/human/H) diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm index 8dbd15b64640..ec4516703253 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -403,6 +403,7 @@ /obj/effect/proc_holder/wrap/update_icon() action.button_icon_state = "wrap_[active]" action.UpdateButtonIcon() + return ..() /obj/effect/proc_holder/wrap/Click() if(!istype(usr, /mob/living/simple_animal/hostile/poison/giant_spider/nurse)) diff --git a/code/modules/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm index 78c03dfddcf4..c9391c4cab28 100644 --- a/code/modules/mob/living/simple_animal/hostile/mimic.dm +++ b/code/modules/mob/living/simple_animal/hostile/mimic.dm @@ -243,19 +243,19 @@ GLOBAL_LIST_INIT(protected_objects, list(/obj/structure/table, /obj/structure/ca var/obj/item/ammo_casing/energy/shot = Zapgun.ammo_type[Zapgun.select] if(Zapgun.cell.charge >= shot.e_cost) Zapgun.cell.use(shot.e_cost) - Zapgun.update_icon() + Zapgun.update_appearance() ..() else if(Zapstick) if(Zapstick.charges) Zapstick.charges-- - Zapstick.update_icon() + Zapstick.update_appearance() ..() else if(Pewgun) if(Pewgun.chambered) if(Pewgun.chambered.BB) qdel(Pewgun.chambered.BB) Pewgun.chambered.BB = null //because qdel takes too long, ensures icon update - Pewgun.chambered.update_icon() + Pewgun.chambered.update_appearance() ..() else visible_message("The [src] clears a jam!") @@ -264,7 +264,7 @@ GLOBAL_LIST_INIT(protected_objects, list(/obj/structure/table, /obj/structure/ca if(Pewgun.magazine && Pewgun.magazine.stored_ammo.len) Pewgun.chambered = Pewgun.magazine.get_round(0) Pewgun.chambered.forceMove(Pewgun) - Pewgun.update_icon() + Pewgun.update_appearance() else if(Pewgun.magazine && Pewgun.magazine.stored_ammo.len) //only true for pumpguns i think Pewgun.chambered = Pewgun.magazine.get_round(0) Pewgun.chambered.forceMove(Pewgun) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm index 1611ef0d5c3d..ce83232c3430 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/basilisk.dm @@ -136,9 +136,9 @@ audible_message("[src]'s shell violently cracks as it's armor is shattered!") throw_message = "bounces off of" shell_snap_message = TRUE //so it doesnt repeat - update_icon() + update_appearance() return TRUE - update_icon() + update_appearance() return FALSE /mob/living/simple_animal/hostile/asteroid/basilisk/whitesands/CanAttack(atom/the_target) @@ -185,7 +185,7 @@ ..() cut_overlays() -/mob/living/simple_animal/hostile/asteroid/basilisk/whitesands/update_icon() +/mob/living/simple_animal/hostile/asteroid/basilisk/whitesands/update_appearance() . = ..() if(stat == CONSCIOUS) if(has_shell) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index d8a36828d064..00e64d63c6ed 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -575,10 +575,10 @@ var/atom/movable/screen/inventory/hand/H H = hud_used.hand_slots["[hand_index]"] if(H) - H.update_icon() + H.update_appearance() H = hud_used.hand_slots["[oindex]"] if(H) - H.update_icon() + H.update_appearance() /mob/living/simple_animal/put_in_hands(obj/item/I, del_on_fail = FALSE, merge_stacks = TRUE) . = ..(I, del_on_fail, merge_stacks) diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index 4128eedfefb4..654b7d9bd7e6 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -117,17 +117,18 @@ /mob/living/simple_animal/slime/proc/set_colour(new_colour) colour = new_colour - update_slime_name() + update_name() slime_mutation = mutation_table(colour) var/sanitizedcolour = replacetext(colour, " ", "") coretype = text2path("/obj/item/slime_extract/[sanitizedcolour]") regenerate_icons() -/mob/living/simple_animal/slime/proc/update_slime_name() +/mob/living/simple_animal/slime/update_name() if(slime_name_regex.Find(name)) number = rand(1, 1000) name = "[colour] [is_adult ? "adult" : "baby"] slime ([number])" real_name = name + return ..() /mob/living/simple_animal/slime/proc/random_colour() set_colour(pick(slime_colours)) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 63e95644fd07..022e02a763a5 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -625,11 +625,11 @@ ///Update the pulling hud icon /mob/proc/update_pull_hud_icon() - hud_used?.pull_icon?.update_icon() + hud_used?.pull_icon?.update_appearance() ///Update the resting hud icon /mob/proc/update_rest_hud_icon() - hud_used?.rest_icon?.update_icon() + hud_used?.rest_icon?.update_appearance() /** * Verb to activate the object in your held hand diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 1a861dc304b4..498538185578 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -457,7 +457,7 @@ m_intent = MOVE_INTENT_RUN if(hud_used && hud_used.static_inventory) for(var/atom/movable/screen/mov_intent/selector in hud_used.static_inventory) - selector.update_icon() + selector.update_appearance() ///Moves a mob upwards in z level /mob/verb/up() diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm index 3615797e8466..f78c7e36ac6d 100644 --- a/code/modules/modular_computers/computers/item/computer.dm +++ b/code/modules/modular_computers/computers/item/computer.dm @@ -55,7 +55,7 @@ physical = src comp_light_color = "#FFFFFF" idle_threads = list() - update_icon() + update_appearance() /obj/item/modular_computer/Destroy() @@ -157,20 +157,15 @@ . += get_modular_computer_parts_examine(user) /obj/item/modular_computer/update_icon_state() - if(!enabled) - icon_state = icon_state_unpowered - else - icon_state = icon_state_powered + icon_state = enabled ? icon_state_powered : icon_state_unpowered + return ..() /obj/item/modular_computer/update_overlays() . = ..() if(!display_overlays) return if(enabled) - if(active_program) - . += active_program.program_icon_state ? active_program.program_icon_state : icon_state_menu - else - . += icon_state_menu + . += active_program?.program_icon_state || icon_state_menu if(obj_integrity <= integrity_failure * max_integrity) . += "bsod" @@ -204,7 +199,7 @@ else to_chat(user, "You press the power button and start up \the [src].") enabled = 1 - update_icon() + update_appearance() ui_interact(user) else // Unpowered if(issynth) @@ -338,7 +333,7 @@ var/mob/user = usr if(user && istype(user)) ui_interact(user) // Re-open the UI on this computer. It should show the main screen now. - update_icon() + update_appearance() // Returns 0 for No Signal, 1 for Low Signal and 2 for Good Signal. 3 is for wired connection (always-on) /obj/item/modular_computer/proc/get_ntnet_status(specific_action = 0) @@ -362,7 +357,7 @@ if(loud) physical.visible_message("\The [src] shuts down.") enabled = 0 - update_icon() + update_appearance() /obj/item/modular_computer/screwdriver_act(mob/user, obj/item/tool) if(!all_components.len) diff --git a/code/modules/modular_computers/computers/item/computer_components.dm b/code/modules/modular_computers/computers/item/computer_components.dm index 03720bf52676..a1a67d019a11 100644 --- a/code/modules/modular_computers/computers/item/computer_components.dm +++ b/code/modules/modular_computers/computers/item/computer_components.dm @@ -42,7 +42,7 @@ H.on_remove(src, user) if(enabled && !use_power()) shutdown_computer() - update_icon() + update_appearance() return TRUE diff --git a/code/modules/modular_computers/computers/item/computer_ui.dm b/code/modules/modular_computers/computers/item/computer_ui.dm index 63b8b42c1f5a..4729117052b6 100644 --- a/code/modules/modular_computers/computers/item/computer_ui.dm +++ b/code/modules/modular_computers/computers/item/computer_ui.dm @@ -108,7 +108,7 @@ active_program.program_state = PROGRAM_STATE_BACKGROUND // Should close any existing UIs active_program = null - update_icon() + update_appearance() if(user && istype(user)) ui_interact(user) // Re-open the UI on this computer. It should show the main screen now. @@ -147,7 +147,7 @@ active_program = P P.alert_pending = FALSE idle_threads.Remove(P) - update_icon() + update_appearance() return var/obj/item/computer_hardware/processor_unit/PU = all_components[MC_CPU] @@ -162,7 +162,7 @@ if(P.run_program(user)) active_program = P P.alert_pending = FALSE - update_icon() + update_appearance() return 1 if("PC_toggle_light") diff --git a/code/modules/modular_computers/computers/item/laptop.dm b/code/modules/modular_computers/computers/item/laptop.dm index fe0e5e8ff674..f7a518d3568f 100644 --- a/code/modules/modular_computers/computers/item/laptop.dm +++ b/code/modules/modular_computers/computers/item/laptop.dm @@ -37,15 +37,14 @@ /obj/item/modular_computer/laptop/update_icon_state() if(!screen_on) icon_state = icon_state_closed - else - . = ..() + return + return ..() /obj/item/modular_computer/laptop/update_overlays() - if(screen_on) - return ..() - else + if(!screen_on) cut_overlays() - icon_state = icon_state_closed + return + return ..() /obj/item/modular_computer/laptop/attack_self(mob/user) if(!screen_on) @@ -111,7 +110,7 @@ screen_on = !screen_on display_overlays = screen_on - update_icon() + update_appearance() diff --git a/code/modules/modular_computers/computers/item/processor.dm b/code/modules/modular_computers/computers/item/processor.dm index 5670acaa76e8..ec4741851545 100644 --- a/code/modules/modular_computers/computers/item/processor.dm +++ b/code/modules/modular_computers/computers/item/processor.dm @@ -38,7 +38,7 @@ 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 + machinery_computer.RegisterSignal(src, COMSIG_ATOM_UPDATED_ICON, /obj/machinery/modular_computer/proc/relay_icon_update) //when we update_icon, also update the computer /obj/item/modular_computer/processor/relay_qdel() qdel(machinery_computer) @@ -54,7 +54,7 @@ if(!machinery_computer) return ..() - machinery_computer.update_icon() + machinery_computer.update_appearance() return /obj/item/modular_computer/processor/attack_ghost(mob/user) diff --git a/code/modules/modular_computers/computers/item/tablet.dm b/code/modules/modular_computers/computers/item/tablet.dm index e3ba9f80134d..9931e70ca1ba 100644 --- a/code/modules/modular_computers/computers/item/tablet.dm +++ b/code/modules/modular_computers/computers/item/tablet.dm @@ -2,9 +2,10 @@ name = "tablet computer" icon = 'icons/obj/modular_tablet.dmi' icon_state = "tablet-red" - icon_state_unpowered = "tablet" - icon_state_powered = "tablet" + icon_state_unpowered = "tablet-red" + icon_state_powered = "tablet-red" icon_state_menu = "menu" + base_icon_state = "tablet" hardware_flag = PROGRAM_TABLET max_hardware_size = 1 w_class = WEIGHT_CLASS_SMALL @@ -20,7 +21,8 @@ if(has_variants) if(!finish_color) finish_color = pick("red","blue","brown","green","black") - icon_state = icon_state_powered = icon_state_unpowered = "tablet-[finish_color]" + icon_state = icon_state_powered = icon_state_unpowered = "[base_icon_state]-[finish_color]" + return ..() /obj/item/modular_computer/tablet/syndicate_contract_uplink name = "contractor tablet" @@ -41,6 +43,8 @@ has_variants = FALSE device_theme = "syndicate" light_color = COLOR_RED + icon_state_powered = "tablet-syndicate" + icon_state_unpowered = "tablet-syndicate" /obj/item/modular_computer/tablet/nukeops/emag_act(mob/user) if(!enabled) @@ -53,6 +57,9 @@ /obj/item/modular_computer/tablet/integrated name = "modular interface" icon_state = "tablet-silicon" + icon_state_powered = "tablet-silicon" + icon_state_unpowered = "tablet-silicon" + base_icon_state = "tablet-silicon" has_light = FALSE //tablet light button actually enables/disables the borg lamp comp_light_luminosity = 0 has_variants = FALSE @@ -153,7 +160,8 @@ /obj/item/modular_computer/tablet/integrated/syndicate icon_state = "tablet-silicon-syndicate" device_theme = "syndicate" - + icon_state_powered = "tablet-silicon-syndicate" + icon_state_unpowered = "tablet-silicon-syndicate" /obj/item/modular_computer/tablet/integrated/syndicate/Initialize() . = ..() diff --git a/code/modules/modular_computers/computers/machinery/modular_computer.dm b/code/modules/modular_computers/computers/machinery/modular_computer.dm index 3c2f2175a85a..b7f1a2f5d912 100644 --- a/code/modules/modular_computers/computers/machinery/modular_computer.dm +++ b/code/modules/modular_computers/computers/machinery/modular_computer.dm @@ -53,26 +53,25 @@ return FALSE return (cpu.emag_act(user)) -/obj/machinery/modular_computer/update_icon() - cut_overlays() - icon_state = icon_state_powered +/obj/machinery/modular_computer/update_appearance() + . = ..() + set_light(cpu?.enabled ? light_strength : 0) + +/obj/machinery/modular_computer/update_icon_state() + icon_state = (cpu?.enabled || (!(machine_stat & NOPOWER) && cpu?.use_power())) ? icon_state_powered : icon_state_unpowered + return ..() - if(!cpu || !cpu.enabled) +/obj/machinery/modular_computer/update_overlays() + . = ..() + if(!cpu?.enabled) if (!(machine_stat & NOPOWER) && (cpu && cpu.use_power())) - add_overlay(screen_icon_screensaver) - else - icon_state = icon_state_unpowered - set_light(0) + . += screen_icon_screensaver 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) - else - add_overlay(screen_icon_state_menu) + . += cpu.active_program?.program_icon_state || screen_icon_state_menu if(cpu && cpu.obj_integrity <= cpu.integrity_failure * cpu.max_integrity) - add_overlay("bsod") - add_overlay("broken") + . += "bsod" + . += "broken" /obj/machinery/modular_computer/AltClick(mob/user) if(cpu) @@ -101,13 +100,13 @@ if(cpu) cpu.shutdown_computer(0) set_machine_stat(machine_stat | NOPOWER) - update_icon() + update_appearance() // Modular computers can have battery in them, we handle power in previous proc, so prevent this from messing it up for us. /obj/machinery/modular_computer/power_change() if(cpu && cpu.use_power()) // If MC_CPU still has a power source, PC wouldn't go offline. set_machine_stat(machine_stat & ~NOPOWER) - update_icon() + update_appearance() return . = ..() @@ -148,3 +147,8 @@ /obj/machinery/modular_computer/bullet_act(obj/projectile/Proj) if(cpu) cpu.bullet_act(Proj) + +/// Eats the "source" arg because update_icon actually expects args now. +/obj/machinery/modular_computer/proc/relay_icon_update(datum/source, updates, updated) + SIGNAL_HANDLER + return update_icon(updates) diff --git a/code/modules/modular_computers/computers/machinery/modular_console.dm b/code/modules/modular_computers/computers/machinery/modular_console.dm index e9540c55e762..6213cba441a6 100644 --- a/code/modules/modular_computers/computers/machinery/modular_console.dm +++ b/code/modules/modular_computers/computers/machinery/modular_console.dm @@ -53,4 +53,4 @@ network_card.identification_string = "Unknown Console" if(cpu) cpu.screen_on = 1 - update_icon() + update_appearance() diff --git a/code/modules/modular_computers/file_system/program.dm b/code/modules/modular_computers/file_system/program.dm index aa50e2bad6e6..b784b1d848bc 100644 --- a/code/modules/modular_computers/file_system/program.dm +++ b/code/modules/modular_computers/file_system/program.dm @@ -64,7 +64,7 @@ // Relays icon update to the computer. /datum/computer_file/program/proc/update_computer_icon() if(computer) - computer.update_icon() + computer.update_appearance() // Attempts to create a log in global ntnet datum. Returns 1 on success, 0 on fail. /datum/computer_file/program/proc/generate_network_log(text) @@ -216,7 +216,7 @@ program_state = PROGRAM_STATE_BACKGROUND // Should close any existing UIs computer.active_program = null - computer.update_icon() + computer.update_appearance() ui.close() if(user && istype(user)) diff --git a/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm b/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm index ba24a5ab3e0c..939cafb13f0c 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm @@ -26,7 +26,7 @@ computer.visible_message("\The [computer]'s screen brightly flashes and loud electrical buzzing is heard.") computer.enabled = FALSE - computer.update_icon() + computer.update_appearance() var/obj/item/computer_hardware/hard_drive/hard_drive = computer.all_components[MC_HDD] var/obj/item/computer_hardware/battery/battery_module = computer.all_components[MC_CELL] var/obj/item/computer_hardware/recharger/recharger = computer.all_components[MC_CHARGE] diff --git a/code/modules/modular_computers/file_system/programs/arcade.dm b/code/modules/modular_computers/file_system/programs/arcade.dm index c6e1fc2d2f24..c220881365ec 100644 --- a/code/modules/modular_computers/file_system/programs/arcade.dm +++ b/code/modules/modular_computers/file_system/programs/arcade.dm @@ -32,7 +32,7 @@ game_active = FALSE program_icon_state = "arcade_off" if(istype(computer)) - computer.update_icon() + computer.update_appearance() ticket_count += 1 usr?.mind?.adjust_experience(/datum/skill/gaming, 50) sleep(10) @@ -42,7 +42,7 @@ game_active = FALSE program_icon_state = "arcade_off" if(istype(computer)) - computer.update_icon() + computer.update_appearance() usr?.mind?.adjust_experience(/datum/skill/gaming, 10) sleep(10) @@ -172,4 +172,4 @@ boss_id = rand(1,6) pause_state = FALSE if(istype(computer)) - computer.update_icon() + computer.update_appearance() diff --git a/code/modules/modular_computers/file_system/programs/radar.dm b/code/modules/modular_computers/file_system/programs/radar.dm index 84dd8e9a122b..d082503a012d 100644 --- a/code/modules/modular_computers/file_system/programs/radar.dm +++ b/code/modules/modular_computers/file_system/programs/radar.dm @@ -15,7 +15,7 @@ var/atom/selected ///Used to store when the next scan is available. Updated by the scan() proc. var/next_scan = 0 - ///Used to keep track of the last value program_icon_state was set to, to prevent constant unnecessary update_icon() calls + ///Used to keep track of the last value program_icon_state was set to, to prevent constant unnecessary update_appearance() calls var/last_icon_state = "" ///Used by the tgui interface, themed NT or Syndicate. var/arrowstyle = "ntosradarpointer.png" @@ -174,7 +174,7 @@ if(!trackable(signal)) program_icon_state = "[initial(program_icon_state)]lost" if(last_icon_state != program_icon_state) - computer.update_icon() + computer.update_appearance() last_icon_state = program_icon_state return @@ -192,7 +192,7 @@ program_icon_state = "[initial(program_icon_state)]far" if(last_icon_state != program_icon_state) - computer.update_icon() + computer.update_appearance() last_icon_state = program_icon_state computer.setDir(get_dir(here_turf, target_turf)) diff --git a/code/modules/modular_computers/file_system/programs/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/sm_monitor.dm index 2aeba2beba33..7e2954611bfc 100644 --- a/code/modules/modular_computers/file_system/programs/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/sm_monitor.dm @@ -27,7 +27,7 @@ ui_header = "smmon_[last_status].gif" program_icon_state = "smmon_[last_status]" if(istype(computer)) - computer.update_icon() + computer.update_appearance() /datum/computer_file/program/supermatter_monitor/run_program(mob/living/user) . = ..(user) diff --git a/code/modules/ninja/suit/ninjaDrainAct.dm b/code/modules/ninja/suit/ninjaDrainAct.dm index 777c72e47dc2..2e3dac4fddbe 100644 --- a/code/modules/ninja/suit/ninjaDrainAct.dm +++ b/code/modules/ninja/suit/ninjaDrainAct.dm @@ -55,7 +55,7 @@ They *could* go in their appropriate files, but this is supposed to be modular playsound(loc, "sparks", 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) obj_flags |= EMAGGED locked = FALSE - update_icon() + update_appearance() @@ -112,7 +112,7 @@ They *could* go in their appropriate files, but this is supposed to be modular S.cell.give(charge) charge = 0 corrupt() - update_icon() + update_appearance() /obj/machinery/proc/AI_notify_hack() var/alertstr = "Network Alert: Hacking attempt detected[get_area(src)?" in [get_area_name(src, TRUE)]":". Unable to pinpoint location"]." diff --git a/code/modules/ninja/suit/suit_attackby.dm b/code/modules/ninja/suit/suit_attackby.dm index fa20f9e50ef6..f9641a7a63ff 100644 --- a/code/modules/ninja/suit/suit_attackby.dm +++ b/code/modules/ninja/suit/suit_attackby.dm @@ -29,7 +29,7 @@ U.put_in_hands(old_cell) old_cell.add_fingerprint(U) old_cell.corrupt() - old_cell.update_icon() + old_cell.update_appearance() cell = CELL to_chat(U, "Upgrade complete. Maximum capacity: [round(cell.maxcharge/100)]%") else diff --git a/code/modules/overmap/missions/research_mission.dm b/code/modules/overmap/missions/research_mission.dm index 181d1a4d9ba4..c1de1318b5b5 100644 --- a/code/modules/overmap/missions/research_mission.dm +++ b/code/modules/overmap/missions/research_mission.dm @@ -127,7 +127,7 @@ set_is_operational(FALSE) STOP_PROCESSING(SSmachines, src) use_power = NO_POWER_USE - power_change() // calls update_icon(), makes sure we're powered + power_change() // calls update_appearance(), makes sure we're powered /obj/machinery/mission_scanner/update_icon_state() . = ..() diff --git a/code/modules/overmap/objects/dynamic_datum.dm b/code/modules/overmap/objects/dynamic_datum.dm index b960becce4c5..38f44e2d2fe0 100644 --- a/code/modules/overmap/objects/dynamic_datum.dm +++ b/code/modules/overmap/objects/dynamic_datum.dm @@ -152,7 +152,7 @@ if(!preserve_level) token.desc += " It may not still be here if you leave it." - token.update_icon() + token.update_appearance() /datum/overmap/dynamic/proc/gen_planet_name() . = "" diff --git a/code/modules/overmap/objects/event_datum.dm b/code/modules/overmap/objects/event_datum.dm index 8ee2136e0d02..f63c2ceae82a 100644 --- a/code/modules/overmap/objects/event_datum.dm +++ b/code/modules/overmap/objects/event_datum.dm @@ -58,7 +58,7 @@ token.icon_state = "meteor[rand(1, 4)]" token.color = "#a08444" token.light_color = "#a08444" - token.update_icon() + token.update_appearance() /datum/overmap/event/meteor/apply_effect() for(var/datum/overmap/ship/controlled/Ship in get_nearby_overmap_objects()) @@ -106,7 +106,7 @@ token.icon_state = "ion[rand(1, 4)]" token.color = "#7cb4d4" token.light_color = "#7cb4d4" - token.update_icon() + token.update_appearance() /datum/overmap/event/emp/affect_ship(datum/overmap/ship/controlled/S) var/area/source_area = pick(S.shuttle_port.shuttle_areas) @@ -146,7 +146,7 @@ token.icon_state = "electrical[rand(1, 4)]" token.color = "#e8e85c" token.light_color = "#e8e85c" - token.update_icon() + token.update_appearance() /datum/overmap/event/electric/affect_ship(datum/overmap/ship/controlled/S) var/datum/virtual_level/ship_vlevel = S.shuttle_port.get_virtual_level() @@ -183,7 +183,7 @@ token.opacity = TRUE token.color = "#c053f3" token.light_color = "#c053f3" - token.update_icon() + token.update_appearance() /datum/overmap/event/wormhole name = "wormhole" @@ -206,7 +206,7 @@ other_wormhole = new(null, src) //Create a new wormhole at a random location token.color = adjust_colors() token.light_color = adjust_colors() - token.update_icon() + token.update_appearance() /datum/overmap/event/wormhole/affect_ship(datum/overmap/ship/controlled/S) if(!other_wormhole) diff --git a/code/modules/overmap/overmap_token.dm b/code/modules/overmap/overmap_token.dm index 45f50f9e41c1..b69b63142cf0 100644 --- a/code/modules/overmap/overmap_token.dm +++ b/code/modules/overmap/overmap_token.dm @@ -34,7 +34,7 @@ cam_background.assigned_map = map_name cam_background.del_on_map_removal = FALSE update_screen() - update_icon() + update_appearance() /obj/overmap/Destroy(force) if(parent) diff --git a/code/modules/overmap/ships/controlled_ship_datum.dm b/code/modules/overmap/ships/controlled_ship_datum.dm index 51454aa48d99..0577d3eb668c 100644 --- a/code/modules/overmap/ships/controlled_ship_datum.dm +++ b/code/modules/overmap/ships/controlled_ship_datum.dm @@ -413,7 +413,7 @@ icon_state = "shipkey_plasticbod" var/our_color = pick(key_colors) add_atom_colour(key_colors[our_color], FIXED_COLOUR_PRIORITY) - update_icon() + update_appearance() name = "ship key ([master_ship.name])" /obj/item/key/ship/update_overlays() diff --git a/code/modules/paperwork/clipboard.dm b/code/modules/paperwork/clipboard.dm index 112565e15157..462c75c18184 100644 --- a/code/modules/paperwork/clipboard.dm +++ b/code/modules/paperwork/clipboard.dm @@ -13,7 +13,7 @@ resistance_flags = FLAMMABLE /obj/item/clipboard/Initialize() - update_icon() + update_appearance() . = ..() /obj/item/clipboard/Destroy() @@ -36,10 +36,10 @@ return toppaper = W to_chat(user, "You clip the paper onto \the [src].") - update_icon() + update_appearance() else if(toppaper) toppaper.attackby(user.get_active_held_item(), user) - update_icon() + update_appearance() /obj/item/clipboard/attack_self(mob/user) @@ -118,4 +118,4 @@ //Update everything attack_self(usr) - update_icon() + update_appearance() diff --git a/code/modules/paperwork/contract.dm b/code/modules/paperwork/contract.dm index 8828cc3b37bc..b919078a97f7 100644 --- a/code/modules/paperwork/contract.dm +++ b/code/modules/paperwork/contract.dm @@ -314,7 +314,7 @@ var/obj/item/storage/wallet/W = worn W.front_id = id id.forceMove(worn) - worn.update_icon() + worn.update_appearance() var/datum/round_event/ion_storm/add_law_only/ion = new() ion.announceChance = 0 ion.ionMessage = "[user.name] is the only Captain of the station. [user.name] is the highest authority, legitimate or otherwise, on the station. [user.name] was always the captain and highest authority on the station. Do not state this law." diff --git a/code/modules/paperwork/folders.dm b/code/modules/paperwork/folders.dm index 724c625779a7..01f4547f048e 100644 --- a/code/modules/paperwork/folders.dm +++ b/code/modules/paperwork/folders.dm @@ -44,7 +44,7 @@ if(!user.transferItemToLoc(W, src)) return to_chat(user, "You put [W] into [src].") - update_icon() + update_appearance() else if(istype(W, /obj/item/pen)) if(!user.is_literate()) to_chat(user, "You scribble illegibly on the cover of [src]!") @@ -89,7 +89,7 @@ //Update everything attack_self(usr) - update_icon() + update_appearance() /obj/item/folder/documents name = "folder- 'TOP SECRET'" @@ -98,7 +98,7 @@ /obj/item/folder/documents/Initialize() . = ..() new /obj/item/documents/nanotrasen(src) - update_icon() + update_appearance() /obj/item/folder/syndicate icon_state = "folder_syndie" @@ -111,7 +111,7 @@ /obj/item/folder/syndicate/red/Initialize() . = ..() new /obj/item/documents/syndicate/red(src) - update_icon() + update_appearance() /obj/item/folder/syndicate/blue icon_state = "folder_sblue" @@ -119,12 +119,12 @@ /obj/item/folder/syndicate/blue/Initialize() . = ..() new /obj/item/documents/syndicate/blue(src) - update_icon() + update_appearance() /obj/item/folder/syndicate/mining/Initialize() . = ..() new /obj/item/documents/syndicate/mining(src) - update_icon() + update_appearance() /obj/item/folder/solgov/red desc = "A blue folder with a SolGov seal." @@ -133,7 +133,7 @@ /obj/item/folder/solgov/red/Initialize() . = ..() new /obj/item/documents/solgov(src) - update_icon() + update_appearance() /obj/item/folder/terragov/red @@ -143,4 +143,4 @@ /obj/item/folder/terragov/red/Initialize() . = ..() new /obj/item/documents/terragov(src) - update_icon() + update_appearance() diff --git a/code/modules/paperwork/paper_cutter.dm b/code/modules/paperwork/paper_cutter.dm index 883db4088539..1c1ebd86336e 100644 --- a/code/modules/paperwork/paper_cutter.dm +++ b/code/modules/paperwork/paper_cutter.dm @@ -15,10 +15,11 @@ /obj/item/papercutter/Initialize() . = ..() storedcutter = new /obj/item/hatchet/cutterblade(src) - update_icon() + update_appearance() /obj/item/papercutter/update_icon_state() icon_state = (storedcutter ? "[initial(icon_state)]-cutter" : "[initial(icon_state)]") + return ..() /obj/item/papercutter/update_overlays() . =..() @@ -33,7 +34,7 @@ playsound(loc, "pageturn", 60, TRUE) to_chat(user, "You place [P] in [src].") storedpaper = P - update_icon() + update_appearance() return if(istype(P, /obj/item/hatchet/cutterblade) && !storedcutter) if(!user.transferItemToLoc(P, src)) @@ -41,7 +42,7 @@ to_chat(user, "You replace [src]'s [P].") P.forceMove(src) storedcutter = P - update_icon() + update_appearance() return if(P.tool_behaviour == TOOL_SCREWDRIVER && storedcutter) P.play_tool_sound(src) @@ -63,7 +64,7 @@ to_chat(user, "You remove [src]'s [storedcutter].") user.put_in_hands(storedcutter) storedcutter = null - update_icon() + update_appearance() if(storedpaper) playsound(src.loc, 'sound/weapons/slash.ogg', 50, TRUE) @@ -72,7 +73,7 @@ qdel(storedpaper) new /obj/item/paperslip(get_turf(src)) new /obj/item/paperslip(get_turf(src)) - update_icon() + update_appearance() /obj/item/papercutter/MouseDrop(atom/over_object) . = ..() diff --git a/code/modules/paperwork/paperbin.dm b/code/modules/paperwork/paperbin.dm index e8a8222eb6c9..64d63199066c 100644 --- a/code/modules/paperwork/paperbin.dm +++ b/code/modules/paperwork/paperbin.dm @@ -25,7 +25,7 @@ if(P && !bin_pen) P.forceMove(src) bin_pen = P - update_icon() + update_appearance() /obj/item/paper_bin/Destroy() if(papers) @@ -37,7 +37,7 @@ /obj/item/paper_bin/fire_act(exposed_temperature, exposed_volume) if(total_paper) total_paper = 0 - update_icon() + update_appearance() ..() /obj/item/paper_bin/MouseDrop(atom/over_object) @@ -72,10 +72,10 @@ user.put_in_hands(P) to_chat(user, "You take [P] out of \the [src].") bin_pen = null - update_icon() + update_appearance() else if(total_paper >= 1) total_paper-- - update_icon() + update_appearance() // If there's any custom paper on the stack, use that instead of creating a new paper. var/obj/item/paper/paper if(papers.len > 0) @@ -106,14 +106,14 @@ to_chat(user, "You put [P] in [src].") papers.Add(P) total_paper++ - update_icon() + update_appearance() else if(istype(I, /obj/item/pen) && !bin_pen) var/obj/item/pen/P = I if(!user.transferItemToLoc(P, src)) return to_chat(user, "You put [P] in [src].") bin_pen = P - update_icon() + update_appearance() else return ..() @@ -130,6 +130,7 @@ icon_state = "paper_bin0" else icon_state = "[initial(icon_state)]" + return ..() /obj/item/paper_bin/update_overlays() . = ..() diff --git a/code/modules/paperwork/paperplane.dm b/code/modules/paperwork/paperplane.dm index 4c1356c4b6ec..eaf51fc9b25b 100644 --- a/code/modules/paperwork/paperplane.dm +++ b/code/modules/paperwork/paperplane.dm @@ -30,7 +30,7 @@ newPaper.forceMove(src) else internalPaper = new(src) - update_icon() + update_appearance() /obj/item/paperplane/handle_atom_del(atom/A) if(A == internalPaper) @@ -74,7 +74,7 @@ else if(istype(P, /obj/item/stamp)) //we don't randomize stamps on a paperplane internalPaper.attackby(P, user) //spoofed attack to update internal paper. - update_icon() + update_appearance() add_fingerprint(user) return diff --git a/code/modules/paperwork/pen.dm b/code/modules/paperwork/pen.dm index e0fd0dd69e73..b289c32e85e0 100644 --- a/code/modules/paperwork/pen.dm +++ b/code/modules/paperwork/pen.dm @@ -234,7 +234,7 @@ playsound(user, 'sound/weapons/saberon.ogg', 5, TRUE) to_chat(user, "[src] is now active.") updateEmbedding() - update_icon() + update_appearance() /obj/item/pen/edagger/update_icon_state() if(on) @@ -246,6 +246,7 @@ item_state = initial(item_state) lefthand_file = initial(lefthand_file) righthand_file = initial(righthand_file) + return ..() /obj/item/pen/survival name = "survival pen" diff --git a/code/modules/paperwork/ticketmachine.dm b/code/modules/paperwork/ticketmachine.dm index a5bd681e8d94..24a256282fad 100644 --- a/code/modules/paperwork/ticketmachine.dm +++ b/code/modules/paperwork/ticketmachine.dm @@ -41,11 +41,11 @@ ticket.audible_message("\the [ticket] disperses!") qdel(ticket) tickets.Cut() - update_icon() + update_appearance() /obj/machinery/ticket_machine/Initialize() . = ..() - update_icon() + update_appearance() /obj/machinery/ticket_machine/proc/increment() if(current_number > ticket_number) @@ -59,7 +59,7 @@ say("Now serving ticket #[current_number]!") if(!(obj_flags & EMAGGED) && tickets[current_number]) tickets[current_number].audible_message("\the [tickets[current_number]] vibrates!") - update_icon() //Update our icon here rather than when they take a ticket to show the current ticket number being served + update_appearance() //Update our icon here rather than when they take a ticket to show the current ticket number being served /obj/machinery/button/ticket_machine name = "increment ticket counter" @@ -125,6 +125,7 @@ if(100) icon_state = "ticketmachine_0" handle_maptext() + return ..() /obj/machinery/ticket_machine/proc/handle_maptext() switch(ticket_number) //This is here to handle maptext offsets so that the numbers align. @@ -154,7 +155,7 @@ qdel(ticket) tickets.Cut() max_number = initial(max_number) - update_icon() + update_appearance() return /obj/machinery/ticket_machine/proc/reset_cooldown() @@ -220,7 +221,7 @@ /obj/item/paper/extinguish() ..() - update_icon() + update_appearance() /obj/item/ticket_machine_ticket/Destroy() if(owner && source) diff --git a/code/modules/photography/photos/frame.dm b/code/modules/photography/photos/frame.dm index 25395bd677d8..9b41f9f6236d 100644 --- a/code/modules/photography/photos/frame.dm +++ b/code/modules/photography/photos/frame.dm @@ -16,7 +16,7 @@ if(!user.transferItemToLoc(I, src)) return displayed = I - update_icon() + update_appearance() else to_chat(user, "\The [src] already contains a photo.") ..() @@ -31,7 +31,7 @@ user.put_in_hands(I) to_chat(user, "You carefully remove the photo from \the [src].") displayed = null - update_icon() + update_appearance() return ..() /obj/item/wallframe/picture/attack_self(mob/user) @@ -106,7 +106,7 @@ else qdel(framed) framed = P - update_icon() + update_appearance() /obj/structure/sign/picture_frame/examine(mob/user) if(in_range(src, user) && framed) @@ -135,7 +135,7 @@ if(!user.transferItemToLoc(P, src)) return framed = P - update_icon() + update_appearance() else to_chat(user, "\The [src] already contains a photo.") @@ -162,5 +162,5 @@ if(contents.len) var/obj/item/I = pick(contents) I.forceMove(F) - F.update_icon() + F.update_appearance() qdel(src) diff --git a/code/modules/photography/photos/photo.dm b/code/modules/photography/photos/photo.dm index cb63b7a745ee..7274d477babb 100644 --- a/code/modules/photography/photos/photo.dm +++ b/code/modules/photography/photos/photo.dm @@ -21,7 +21,7 @@ if(!istype(P)) return picture = P - update_icon() + update_appearance() if(P.caption) scribble = P.caption if(setname && P.picture_name) @@ -34,10 +34,11 @@ /obj/item/photo/update_icon_state() if(!istype(picture) || !picture.picture_image) - return + return ..() var/icon/I = picture.get_small_icon(initial(icon_state)) if(I) icon = I + return ..() /obj/item/photo/attack_self(mob/user) user.examinate(src) diff --git a/code/modules/plumbing/ducts.dm b/code/modules/plumbing/ducts.dm index 567d5aab2ecb..ff344741ad99 100644 --- a/code/modules/plumbing/ducts.dm +++ b/code/modules/plumbing/ducts.dm @@ -82,7 +82,7 @@ All the important duct code: for(var/atom/movable/AM in get_step(src, D)) if(connect_network(AM, D)) add_connects(D) - update_icon() + update_appearance() ///see if whatever we found can be connected to /obj/machinery/duct/proc/connect_network(atom/movable/AM, direction, ignore_color) @@ -109,7 +109,7 @@ All the important duct code: add_neighbour(D, direction) D.add_connects(opposite_dir) - D.update_icon() + D.update_appearance() return TRUE //tell the current pipe to also update it's sprite if(!(D in neighbours)) //we cool if((duct_color != D.duct_color) && !(ignore_colors || D.ignore_colors)) @@ -160,7 +160,7 @@ All the important duct code: duct.remove_duct(src) lose_neighbours() reset_connects(0) - update_icon() + update_appearance() if(ispath(drop_on_wrench) && !QDELING(src)) new drop_on_wrench(drop_location()) qdel(src) @@ -196,7 +196,7 @@ All the important duct code: connects = 0 for(var/A in neighbours) connects |= neighbours[A] - update_icon() + update_appearance() ///create a new duct datum /obj/machinery/duct/proc/create_duct() @@ -254,6 +254,7 @@ All the important duct code: if(D == WEST) temp_icon += "_w" icon_state = temp_icon + return ..() ///update the layer we are on /obj/machinery/duct/proc/handle_layer() @@ -334,7 +335,7 @@ All the important duct code: add_connects(direction) //the connect of the other duct is handled in connect_network, but do this here for the parent duct because it's not necessary in normal cases add_neighbour(D, direction) connect_network(D, direction, TRUE) - update_icon() + update_appearance() ///has a total of 5 layers and doesnt give a shit about color. its also dumb so doesnt autoconnect. /obj/machinery/duct/multilayered diff --git a/code/modules/plumbing/plumbers/acclimator.dm b/code/modules/plumbing/plumbers/acclimator.dm index 58d6a3a0d4b3..1ac5b30a4b6a 100644 --- a/code/modules/plumbing/plumbers/acclimator.dm +++ b/code/modules/plumbing/plumbers/acclimator.dm @@ -34,17 +34,17 @@ if(machine_stat & NOPOWER || !enabled || !reagents.total_volume || reagents.chem_temp == target_temperature) if(acclimate_state != NEUTRAL) acclimate_state = NEUTRAL - update_icon() + update_appearance() if(!reagents.total_volume) emptying = FALSE return if(reagents.chem_temp < target_temperature && acclimate_state != HEATING) //note that we check if the temperature is the same at the start acclimate_state = HEATING - update_icon() + update_appearance() else if(reagents.chem_temp > target_temperature && acclimate_state != COOLING) acclimate_state = COOLING - update_icon() + update_appearance() if(!emptying) if(reagents.chem_temp >= target_temperature && target_temperature + allowed_temperature_difference >= reagents.chem_temp) //cooling here emptying = TRUE @@ -61,6 +61,7 @@ icon_state += "_cold" if(HEATING) icon_state += "_hot" + return ..() /obj/machinery/plumbing/acclimator/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) diff --git a/code/modules/plumbing/plumbers/pumps.dm b/code/modules/plumbing/plumbers/pumps.dm index dd0b709be9e0..331e3fc24d89 100644 --- a/code/modules/plumbing/plumbers/pumps.dm +++ b/code/modules/plumbing/plumbers/pumps.dm @@ -4,6 +4,7 @@ desc = "Pump up those sweet liquids from under the surface. Uses thermal energy from geysers to power itself." //better than placing 200 cables, because it wasnt fun icon = 'icons/obj/plumbing/plumbers.dmi' icon_state = "pump" + base_icon_state = "pump" anchored = FALSE density = TRUE idle_power_usage = 10 @@ -30,7 +31,7 @@ . = ..() if(. == SUCCESSFUL_UNFASTEN) geyser = null - update_icon() + update_appearance() geyserless = FALSE //we switched state, so lets just set this back aswell /obj/machinery/plumbing/liquid_pump/process() @@ -40,7 +41,7 @@ if(!geyser) for(var/obj/structure/geyser/G in loc.contents) geyser = G - update_icon() + update_appearance() if(!geyser) //we didnt find one, abort geyserless = TRUE visible_message("The [name] makes a sad beep!") @@ -57,8 +58,9 @@ /obj/machinery/plumbing/liquid_pump/update_icon_state() if(geyser) - icon_state = initial(icon_state) + "-on" + icon_state = "[base_icon_state]-on" else if(panel_open) - icon_state = initial(icon_state) + "-open" + icon_state = "[base_icon_state]-open" else - icon_state = initial(icon_state) + icon_state = "[base_icon_state]" + return ..() diff --git a/code/modules/plumbing/plumbers/synthesizer.dm b/code/modules/plumbing/plumbers/synthesizer.dm index 8c6a50ed09d8..fc36947a8901 100644 --- a/code/modules/plumbing/plumbers/synthesizer.dm +++ b/code/modules/plumbing/plumbers/synthesizer.dm @@ -99,7 +99,7 @@ if(new_reagent in dispensable_reagents) reagent_id = new_reagent . = TRUE - update_icon() + update_appearance() reagents.clear_reagents() /obj/machinery/plumbing/synthesizer/update_overlays() diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 1ab74e4d6a3b..f57a82b00d8f 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -1,47 +1,100 @@ -//update_state -#define UPSTATE_CELL_IN (1<<0) -#define UPSTATE_OPENED1 (1<<1) -#define UPSTATE_OPENED2 (1<<2) -#define UPSTATE_MAINT (1<<3) -#define UPSTATE_BROKE (1<<4) -#define UPSTATE_BLUESCREEN (1<<5) -#define UPSTATE_WIREEXP (1<<6) -#define UPSTATE_ALLGOOD (1<<7) - -#define APC_RESET_EMP "emp" - -//update_overlay -#define APC_UPOVERLAY_CHARGEING0 (1<<0) -#define APC_UPOVERLAY_CHARGEING1 (1<<1) -#define APC_UPOVERLAY_CHARGEING2 (1<<2) -#define APC_UPOVERLAY_EQUIPMENT0 (1<<3) -#define APC_UPOVERLAY_EQUIPMENT1 (1<<4) -#define APC_UPOVERLAY_EQUIPMENT2 (1<<5) -#define APC_UPOVERLAY_LIGHTING0 (1<<6) -#define APC_UPOVERLAY_LIGHTING1 (1<<7) -#define APC_UPOVERLAY_LIGHTING2 (1<<8) -#define APC_UPOVERLAY_ENVIRON0 (1<<9) -#define APC_UPOVERLAY_ENVIRON1 (1<<10) -#define APC_UPOVERLAY_ENVIRON2 (1<<11) -#define APC_UPOVERLAY_LOCKED (1<<12) -#define APC_UPOVERLAY_OPERATING (1<<13) - -#define APC_ELECTRONICS_MISSING 0 // None -#define APC_ELECTRONICS_INSTALLED 1 // Installed but not secured -#define APC_ELECTRONICS_SECURED 2 // Installed and secured - +// APC electronics status: +/// There are no electronics in the APC. +#define APC_ELECTRONICS_MISSING 0 +/// The electronics are installed but not secured. +#define APC_ELECTRONICS_INSTALLED 1 +/// The electronics are installed and secured. +#define APC_ELECTRONICS_SECURED 2 + +// APC cover status: +/// The APCs cover is closed. #define APC_COVER_CLOSED 0 +/// The APCs cover is open. #define APC_COVER_OPENED 1 +/// The APCs cover is missing. #define APC_COVER_REMOVED 2 +// APC charging status: +/// The APC is not charging. #define APC_NOT_CHARGING 0 +/// The APC is charging. #define APC_CHARGING 1 +/// The APC is fully charged. #define APC_FULLY_CHARGED 2 -//WS Begin -- Ethereal Charge Scaling -#define APC_DRAIN_TIME 75 +// APC channel status: +/// The APCs power channel is manually set off. +#define APC_CHANNEL_OFF 0 +/// The APCs power channel is automatically off. +#define APC_CHANNEL_AUTO_OFF 1 +/// The APCs power channel is manually set on. +#define APC_CHANNEL_ON 2 +/// The APCs power channel is automatically on. +#define APC_CHANNEL_AUTO_ON 3 + +// APC autoset enums: +/// The APC turns automated and manual power channels off. +#define AUTOSET_FORCE_OFF 0 +/// The APC turns automated power channels off. +#define AUTOSET_OFF 2 +/// The APC turns automated power channels on. +#define AUTOSET_ON 1 + +// External power status: +/// The APC either isn't attached to a powernet or there is no power on the external powernet. +#define APC_NO_POWER 0 +/// The APCs external powernet does not have enough power to charge the APC. +#define APC_LOW_POWER 1 +/// The APCs external powernet has enough power to charge the APC. +#define APC_HAS_POWER 2 + +// Elzuose: +/// How long it takes an elzu to drain or charge APCs. Also used as a spam limiter. +#define APC_DRAIN_TIME (7.5 SECONDS) +/// How much power elzu gain/drain from APCs. #define APC_POWER_GAIN (10 * ETHEREAL_CHARGE_SCALING_MULTIPLIER) -//WS End + +// Wires & EMPs: +/// The wire value used to reset the APCs wires after one's EMPed. +#define APC_RESET_EMP "emp" + +// update_state +// Bitshifts: (If you change the status values to be something other than an int or able to exceed 3 you will need to change these too) +/// The bit shift for the APCs cover status. +#define UPSTATE_COVER_SHIFT (0) + /// The bitflag representing the APCs cover being open for icon purposes. + #define UPSTATE_OPENED1 (APC_COVER_OPENED << UPSTATE_COVER_SHIFT) + /// The bitflag representing the APCs cover being missing for icon purposes. + #define UPSTATE_OPENED2 (APC_COVER_REMOVED << UPSTATE_COVER_SHIFT) + +// Bitflags: +/// The APC has a power cell. +#define UPSTATE_CELL_IN (1<<2) +/// The APC is broken or damaged. +#define UPSTATE_BROKE (1<<3) +/// The APC is undergoing maintenance. +#define UPSTATE_MAINT (1<<4) +/// The APC is emagged or malfed. +#define UPSTATE_BLUESCREEN (1<<5) +/// The APCs wires are exposed. +#define UPSTATE_WIREEXP (1<<6) + +// update_overlay +// Bitflags: +/// Bitflag indicating that the APCs operating status overlay should be shown. +#define UPOVERLAY_OPERATING (1<<0) +/// Bitflag indicating that the APCs locked status overlay should be shown. +#define UPOVERLAY_LOCKED (1<<1) + +// Bitshifts: (If you change the status values to be something other than an int or able to exceed 3 you will need to change these too) +/// Bit shift for the charging status of the APC. +#define UPOVERLAY_CHARGING_SHIFT (2) +/// Bit shift for the equipment status of the APC. +#define UPOVERLAY_EQUIPMENT_SHIFT (4) +/// Bit shift for the lighting channel status of the APC. +#define UPOVERLAY_LIGHTING_SHIFT (6) +/// Bit shift for the environment channel status of the APC. +#define UPOVERLAY_ENVIRON_SHIFT (8) // the Area Power Controller (APC), formerly Power Distribution Unit (PDU) // one per area, needs wire connection to power network through a terminal @@ -80,9 +133,9 @@ var/cell_type = /obj/item/stock_parts/cell/upgraded //Base cell has 2500 capacity. Enter the path of a different cell you want to use. cell determines charge rates, max capacity, ect. These can also be changed with other APC vars, but isn't recommended to minimize the risk of accidental usage of dirty editted APCs var/opened = APC_COVER_CLOSED var/shorted = 0 - var/lighting = 3 - var/equipment = 3 - var/environ = 3 + var/lighting = APC_CHANNEL_AUTO_ON + var/equipment = APC_CHANNEL_AUTO_ON + var/environ = APC_CHANNEL_AUTO_ON var/operating = TRUE var/charging = APC_NOT_CHARGING var/chargemode = 1 @@ -189,7 +242,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) operating = FALSE name = "\improper [get_area_name(area, TRUE)] APC" set_machine_stat(machine_stat | MAINT) - update_icon() + update_appearance() addtimer(CALLBACK(src, .proc/update), 5) /obj/machinery/power/apc/Destroy() @@ -215,7 +268,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) /obj/machinery/power/apc/handle_atom_del(atom/A) if(A == cell) cell = null - update_icon() + update_appearance() updateUsrDialog() /obj/machinery/power/apc/proc/make_terminal() @@ -280,43 +333,11 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) // update the APC icon to show the three base states // also add overlays for indicator lights -/obj/machinery/power/apc/update_icon() - var/update = check_updates() //returns 0 if no need to update icons. - // 1 if we need to update the icon_state - // 2 if we need to update the overlays - if(!update) - icon_update_needed = FALSE +/obj/machinery/power/apc/update_appearance(updates=check_updates()) + icon_update_needed = FALSE + if(!updates) return - if(update & 1) // Updating the icon state - if(update_state & UPSTATE_ALLGOOD) - icon_state = "apc0" - else if(update_state & (UPSTATE_OPENED1|UPSTATE_OPENED2)) - var/basestate = "apc[ cell ? "2" : "1" ]" - if(has_electronics == APC_ELECTRONICS_INSTALLED) //god - . += "apc-electronics" - if(update_state & UPSTATE_OPENED1) - if(update_state & (UPSTATE_MAINT|UPSTATE_BROKE)) - icon_state = "apcmaint" //disabled APC cannot hold cell - else - icon_state = basestate - else if(update_state & UPSTATE_OPENED2) - if (update_state & UPSTATE_BROKE || malfhack) - icon_state = "[basestate]-b-nocover" - else - icon_state = "[basestate]-nocover" - else if(update_state & UPSTATE_BROKE) - icon_state = "apc-b" - else if(update_state & UPSTATE_BLUESCREEN) - icon_state = "apcemag" - else if(update_state & UPSTATE_WIREEXP) - icon_state = "apcewires" - else if(update_state & UPSTATE_MAINT) - icon_state = "apc0" - - if(!(update_state & UPSTATE_ALLGOOD)) - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) - if(!cell) //it always peeved me that abandoned ships always had the apc lights on. this should fix it icon_update_needed = FALSE set_light(0) @@ -326,24 +347,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) icon_update_needed = FALSE set_light(0) return - - if(update & 2) - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) - if(!(machine_stat & (BROKEN|MAINT)) && update_state & UPSTATE_ALLGOOD) - SSvis_overlays.add_vis_overlay(src, icon, "apcox-[locked]", layer, plane, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apcox-[locked]", layer, EMISSIVE_PLANE, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apco3-[charging]", layer, plane, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apco3-[charging]", layer, EMISSIVE_PLANE, dir) - if(operating) - SSvis_overlays.add_vis_overlay(src, icon, "apco0-[equipment]", layer, plane, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apco0-[equipment]", layer, EMISSIVE_PLANE, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apco1-[lighting]", layer, plane, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apco1-[lighting]", layer, EMISSIVE_PLANE, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apco2-[environ]", layer, plane, dir) - SSvis_overlays.add_vis_overlay(src, icon, "apco2-[environ]", layer, EMISSIVE_PLANE, dir) - + //this may need to be moved up!! + . = ..() // And now, separately for cleanness, the lighting changing - if(update_state & UPSTATE_ALLGOOD) + if(!update_state) switch(charging) if(APC_NOT_CHARGING) set_light_color(COLOR_SOFT_RED) @@ -352,89 +359,104 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) if(APC_FULLY_CHARGED) set_light_color(LIGHT_COLOR_GREEN) set_light(lon_range) - else if(update_state & UPSTATE_BLUESCREEN) + return + + if(update_state & UPSTATE_BLUESCREEN) set_light_color(LIGHT_COLOR_BLUE) set_light(lon_range) - else - set_light(0) + return - icon_update_needed = FALSE +/obj/machinery/power/apc/update_icon_state() + if(!update_state) + icon_state = "apc0" + return ..() + if(update_state & (UPSTATE_OPENED1|UPSTATE_OPENED2)) + var/basestate = "apc[cell ? 2 : 1]" + if(update_state & UPSTATE_OPENED1) + icon_state = (update_state & (UPSTATE_MAINT|UPSTATE_BROKE)) ? "apcmaint" : basestate + else if(update_state & UPSTATE_OPENED2) + icon_state = "[basestate][((update_state & UPSTATE_BROKE) || malfhack) ? "-b" : null]-nocover" + return ..() + if(update_state & UPSTATE_BROKE) + icon_state = "apc-b" + return ..() + if(update_state & UPSTATE_BLUESCREEN) + icon_state = "apcemag" + return ..() + if(update_state & UPSTATE_WIREEXP) + icon_state = "apcewires" + return ..() + if(update_state & UPSTATE_MAINT) + icon_state = "apc0" + return ..() + +/obj/machinery/power/apc/update_overlays() + . = ..() + if((machine_stat & (BROKEN|MAINT)) || update_state) + return + + SSvis_overlays.add_vis_overlay(src, icon, "apcox-[locked]", layer, plane, dir) + SSvis_overlays.add_vis_overlay(src, icon, "apcox-[locked]", layer, EMISSIVE_PLANE, dir) + SSvis_overlays.add_vis_overlay(src, icon, "apco3-[charging]", layer, plane, dir) + SSvis_overlays.add_vis_overlay(src, icon, "apco3-[charging]", layer, EMISSIVE_PLANE, dir) + if(!operating) + return + + SSvis_overlays.add_vis_overlay(src, icon, "apco0-[equipment]", layer, plane, dir) + SSvis_overlays.add_vis_overlay(src, icon, "apco0-[equipment]", layer, EMISSIVE_PLANE, dir) + SSvis_overlays.add_vis_overlay(src, icon, "apco1-[lighting]", layer, plane, dir) + SSvis_overlays.add_vis_overlay(src, icon, "apco1-[lighting]", layer, EMISSIVE_PLANE, dir) + SSvis_overlays.add_vis_overlay(src, icon, "apco2-[environ]", layer, plane, dir) + SSvis_overlays.add_vis_overlay(src, icon, "apco2-[environ]", layer, EMISSIVE_PLANE, dir) +/// Checks for what icon updates we will need to handle /obj/machinery/power/apc/proc/check_updates() - var/last_update_state = update_state - var/last_update_overlay = update_overlay - update_state = 0 - update_overlay = 0 + SIGNAL_HANDLER + . = NONE - if(cell) - update_state |= UPSTATE_CELL_IN + // Handle icon status: + var/new_update_state = NONE if(machine_stat & BROKEN) - update_state |= UPSTATE_BROKE + new_update_state |= UPSTATE_BROKE if(machine_stat & MAINT) - update_state |= UPSTATE_MAINT + new_update_state |= UPSTATE_MAINT if(opened) - if(opened==APC_COVER_OPENED) - update_state |= UPSTATE_OPENED1 - if(opened==APC_COVER_REMOVED) - update_state |= UPSTATE_OPENED2 + new_update_state |= (opened << UPSTATE_COVER_SHIFT) + if(cell) + new_update_state |= UPSTATE_CELL_IN //WS Edit - Malf AI Rework else if((obj_flags & EMAGGED)) - update_state |= UPSTATE_BLUESCREEN + new_update_state |= UPSTATE_BLUESCREEN else if(malfai) - if(malfhackhide) - update_state |= UPSTATE_ALLGOOD - else - update_state |= UPSTATE_BLUESCREEN + // if(malfhackhide) + // new_update_state |= UPSTATE_ALLGOOD + //else + new_update_state |= UPSTATE_BLUESCREEN // EndWS Edit - Malf AI Rework else if(panel_open) - update_state |= UPSTATE_WIREEXP - if(update_state <= 1) - update_state |= UPSTATE_ALLGOOD + new_update_state |= UPSTATE_WIREEXP + if(new_update_state != update_state) + update_state = new_update_state + . |= UPDATE_ICON_STATE + + // Handle overlay status: + var/new_update_overlay = NONE if(operating) - update_overlay |= APC_UPOVERLAY_OPERATING + new_update_overlay |= UPOVERLAY_OPERATING - if(update_state & UPSTATE_ALLGOOD) + if(!update_state) if(locked) - update_overlay |= APC_UPOVERLAY_LOCKED - - if(!charging) - update_overlay |= APC_UPOVERLAY_CHARGEING0 - else if(charging == APC_CHARGING) - update_overlay |= APC_UPOVERLAY_CHARGEING1 - else if(charging == APC_FULLY_CHARGED) - update_overlay |= APC_UPOVERLAY_CHARGEING2 - - if (!equipment) - update_overlay |= APC_UPOVERLAY_EQUIPMENT0 - else if(equipment == 1) - update_overlay |= APC_UPOVERLAY_EQUIPMENT1 - else if(equipment == 2) - update_overlay |= APC_UPOVERLAY_EQUIPMENT2 - - if(!lighting) - update_overlay |= APC_UPOVERLAY_LIGHTING0 - else if(lighting == 1) - update_overlay |= APC_UPOVERLAY_LIGHTING1 - else if(lighting == 2) - update_overlay |= APC_UPOVERLAY_LIGHTING2 - - if(!environ) - update_overlay |= APC_UPOVERLAY_ENVIRON0 - else if(environ==1) - update_overlay |= APC_UPOVERLAY_ENVIRON1 - else if(environ==2) - update_overlay |= APC_UPOVERLAY_ENVIRON2 - - - var/results = 0 - if(last_update_state == update_state && last_update_overlay == update_overlay) - return 0 - if(last_update_state != update_state) - results += 1 - if(last_update_overlay != update_overlay) - results += 2 - return results + new_update_overlay |= UPOVERLAY_LOCKED + + new_update_overlay |= (charging << UPOVERLAY_CHARGING_SHIFT) + new_update_overlay |= (equipment << UPOVERLAY_EQUIPMENT_SHIFT) + new_update_overlay |= (lighting << UPOVERLAY_LIGHTING_SHIFT) + new_update_overlay |= (environ << UPOVERLAY_ENVIRON_SHIFT) + + if(new_update_overlay != update_overlay) + update_overlay = new_update_overlay + . |= UPDATE_OVERLAYS // Used in process so it doesn't update the icon too much /obj/machinery/power/apc/proc/queue_icon_update() @@ -814,7 +836,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) if(.) return - //WS Begin -- Ethereal Charge Scaling + //[REDACTED] Begin -- Ethereal Charge Scaling //Let the hubris remain but the name be forgotten if(isethereal(user)) var/mob/living/carbon/human/H = user var/datum/species/ethereal/E = H.dna.species @@ -829,8 +851,8 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) return E.drain_time = world.time + APC_DRAIN_TIME to_chat(H, "You start channeling some power through the APC into your body.") - while(do_after(user, APC_DRAIN_TIME, target = src)) //WS edit - E.drain_time = world.time + APC_DRAIN_TIME //WS edit + while(do_after(user, APC_DRAIN_TIME, target = src)) + E.drain_time = world.time + APC_DRAIN_TIME if(cell.charge <= (cell.maxcharge / 20) || (stomach.crystal_charge > charge_limit)) return if(istype(stomach)) @@ -949,13 +971,13 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) return 0 // 0 = User is not a Malf AI /obj/machinery/power/apc/proc/report() - return "[area.name] : [equipment]/[lighting]/[environ] ([lastused_equip+lastused_light+lastused_environ]) : [cell? cell.percent() : "N/C"] ([charging])" + return "[area.name] : [equipment]/[lighting]/[environ] ([lastused_total]) : [cell? cell.percent() : "N/C"] ([charging])" /obj/machinery/power/apc/proc/update() if(operating && !shorted && !failure_timer) - area.power_light = (lighting > 1) - area.power_equip = (equipment > 1) - area.power_environ = (environ > 1) + area.power_light = (lighting > APC_CHANNEL_AUTO_OFF) + area.power_equip = (equipment > APC_CHANNEL_AUTO_OFF) + area.power_environ = (environ > APC_CHANNEL_AUTO_OFF) else area.power_light = FALSE area.power_equip = FALSE @@ -1250,7 +1272,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) /obj/machinery/power/apc/process() if(icon_update_needed) - update_icon() + update_appearance() if(machine_stat & (BROKEN|MAINT)) return if(!area.requires_power) @@ -1278,11 +1300,11 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) var/excess = surplus() if(!src.avail()) - main_status = 0 + main_status = APC_NO_POWER else if(excess < 0) - main_status = 1 + main_status = APC_LOW_POWER else - main_status = 2 + main_status = APC_HAS_POWER if(cell && !shorted) // draw power from cell as before to power the area @@ -1305,10 +1327,9 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) charging = APC_NOT_CHARGING chargecount = 0 // This turns everything off in the case that there is still a charge left on the battery, just not enough to run the room. - equipment = autoset(equipment, 0) - lighting = autoset(lighting, 0) - environ = autoset(environ, 0) - + equipment = autoset(equipment, AUTOSET_FORCE_OFF) + lighting = autoset(lighting, AUTOSET_FORCE_OFF) + environ = autoset(environ, AUTOSET_FORCE_OFF) // set channels depending on how much charge we have left @@ -1319,19 +1340,19 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) longtermpower -= 2 if(cell.charge <= 0) // zero charge, turn all off - equipment = autoset(equipment, 0) - lighting = autoset(lighting, 0) - environ = autoset(environ, 0) + equipment = autoset(equipment, AUTOSET_FORCE_OFF) + lighting = autoset(lighting, AUTOSET_FORCE_OFF) + environ = autoset(environ, AUTOSET_FORCE_OFF) area.poweralert(0, src) else if(cell.percent() < 15 && longtermpower < 0) // <15%, turn off lighting & equipment - equipment = autoset(equipment, 2) - lighting = autoset(lighting, 2) - environ = autoset(environ, 1) + equipment = autoset(equipment, AUTOSET_OFF) + lighting = autoset(lighting, AUTOSET_OFF) + environ = autoset(environ, AUTOSET_ON) area.poweralert(0, src) else if(cell.percent() < 30 && longtermpower < 0) // <30%, turn off equipment - equipment = autoset(equipment, 2) - lighting = autoset(lighting, 1) - environ = autoset(environ, 1) + equipment = autoset(equipment, AUTOSET_ON) + lighting = autoset(lighting, AUTOSET_ON) + environ = autoset(environ, AUTOSET_ON) area.poweralert(0, src) else // otherwise all can be on equipment = autoset(equipment, 1) @@ -1371,17 +1392,17 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) charging = APC_CHARGING else // chargemode off - charging = 0 + charging = APC_NOT_CHARGING chargecount = 0 else // no cell, switch everything off charging = APC_NOT_CHARGING chargecount = 0 - equipment = autoset(equipment, 0) - lighting = autoset(lighting, 0) - environ = autoset(environ, 0) - area.poweralert(0, src) + equipment = autoset(equipment, AUTOSET_FORCE_OFF) + lighting = autoset(lighting, AUTOSET_FORCE_OFF) + environ = autoset(environ, AUTOSET_FORCE_OFF) + area.poweralert(TRUE, src) // update icon & area power if anything changed @@ -1392,23 +1413,55 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) else if (last_ch != charging) queue_icon_update() -// val 0=off, 1=off(auto) 2=on 3=on(auto) -// on 0=off, 1=on, 2=autooff +/** + * Returns the new status value for an APC channel. + * + * // val 0=off, 1=off(auto) 2=on 3=on(auto) + * // on 0=off, 1=on, 2=autooff + * TODO: Make this use bitflags instead. It should take at most three lines, but it's out of scope for now. + * + * Arguments: + * - val: The current status of the power channel. + * - [APC_CHANNEL_OFF]: The APCs channel has been manually set to off. This channel will not automatically change. + * - [APC_CHANNEL_AUTO_OFF]: The APCs channel is running on automatic and is currently off. Can be automatically set to [APC_CHANNEL_AUTO_ON]. + * - [APC_CHANNEL_ON]: The APCs channel has been manually set to on. This will be automatically changed only if the APC runs completely out of power or is disabled. + * - [APC_CHANNEL_AUTO_ON]: The APCs channel is running on automatic and is currently on. Can be automatically set to [APC_CHANNEL_AUTO_OFF]. + * - on: An enum dictating how to change the channel's status. + * - [AUTOSET_FORCE_OFF]: The APC forces the channel to turn off. This includes manually set channels. + * - [AUTOSET_ON]: The APC allows automatic channels to turn back on. + * - [AUTOSET_OFF]: The APC turns automatic channels off. + */ /obj/machinery/power/apc/proc/autoset(val, on) - if(on==0) - if(val==2) // if on, return off - return 0 - else if(val==3) // if auto-on, return auto-off - return 1 - else if(on==1) - if(val==1) // if auto-off, return auto-on - return 3 - else if(on==2) - if(val==3) // if auto-on, return auto-off - return 1 + if(on == AUTOSET_FORCE_OFF) + if(val == APC_CHANNEL_ON) // if on, return off + return APC_CHANNEL_OFF + else if(val == APC_CHANNEL_AUTO_ON) // if auto-on, return auto-off + return APC_CHANNEL_AUTO_OFF + else if(on == AUTOSET_ON) + if(val == APC_CHANNEL_AUTO_OFF) // if auto-off, return auto-on + return APC_CHANNEL_AUTO_ON + else if(on == AUTOSET_OFF) + if(val == APC_CHANNEL_AUTO_ON) // if auto-on, return auto-off + return APC_CHANNEL_AUTO_OFF return val +/** + * Used by external forces to set the APCs channel status's. + * + * Arguments: + * - val: The desired value of the subsystem: + * - 1: Manually sets the APCs channel to be [APC_CHANNEL_OFF]. + * - 2: Manually sets the APCs channel to be [APC_CHANNEL_AUTO_ON]. If the APC doesn't have any power this defaults to [APC_CHANNEL_OFF] instead. + * - 3: Sets the APCs channel to be [APC_CHANNEL_AUTO_ON]. If the APC doesn't have enough power this defaults to [APC_CHANNEL_AUTO_OFF] instead. + */ +/obj/machinery/power/apc/proc/setsubsystem(val) + if(cell && cell.charge > 0) + return (val == 1) ? APC_CHANNEL_OFF : val + if(val == 3) + return APC_CHANNEL_AUTO_OFF + return APC_CHANNEL_OFF + /obj/machinery/power/apc/proc/reset(wire) switch(wire) if(WIRE_IDSCAN) @@ -1420,9 +1473,9 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) if(!wires.is_cut(WIRE_AI)) aidisabled = FALSE if(APC_RESET_EMP) - equipment = 3 - environ = 3 - update_icon() + equipment = APC_CHANNEL_AUTO_ON + environ = APC_CHANNEL_AUTO_ON + update_appearance() update() // damage and destruction acts @@ -1435,10 +1488,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) occupier.emp_act(severity) if(. & EMP_PROTECT_SELF) return - lighting = 0 - equipment = 0 - environ = 0 - update_icon() + lighting = APC_CHANNEL_OFF + equipment = APC_CHANNEL_OFF + environ = APC_CHANNEL_OFF + update_appearance() update() addtimer(CALLBACK(src, .proc/reset, APC_RESET_EMP), 600) @@ -1486,15 +1539,6 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) else return 0 -/obj/machinery/power/apc/proc/setsubsystem(val) - if(cell && cell.charge > 0) - return (val==1) ? 0 : val - else if(val == 3) - return 1 - else - return 0 - - /obj/machinery/power/apc/proc/energy_fail(duration) for(var/obj/machinery/M in area.contents) if(M.critical_machine) @@ -1537,16 +1581,18 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) "nightshift_lights", ) -#undef UPSTATE_CELL_IN -#undef UPSTATE_OPENED1 -#undef UPSTATE_OPENED2 -#undef UPSTATE_MAINT -#undef UPSTATE_BROKE -#undef UPSTATE_BLUESCREEN -#undef UPSTATE_WIREEXP -#undef UPSTATE_ALLGOOD +#undef APC_CHANNEL_OFF +#undef APC_CHANNEL_AUTO_OFF +#undef APC_CHANNEL_ON +#undef APC_CHANNEL_AUTO_ON -#undef APC_RESET_EMP +#undef AUTOSET_FORCE_OFF +#undef AUTOSET_OFF +#undef AUTOSET_ON + +#undef APC_NO_POWER +#undef APC_LOW_POWER +#undef APC_HAS_POWER #undef APC_ELECTRONICS_MISSING #undef APC_ELECTRONICS_INSTALLED @@ -1565,21 +1611,23 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/power/apc/auto_name, 25) #undef APC_POWER_GAIN //WS End +#undef APC_RESET_EMP + +// update_state +#undef UPSTATE_CELL_IN +#undef UPSTATE_COVER_SHIFT +#undef UPSTATE_BROKE +#undef UPSTATE_MAINT +#undef UPSTATE_BLUESCREEN +#undef UPSTATE_WIREEXP + //update_overlay -#undef APC_UPOVERLAY_CHARGEING0 -#undef APC_UPOVERLAY_CHARGEING1 -#undef APC_UPOVERLAY_CHARGEING2 -#undef APC_UPOVERLAY_EQUIPMENT0 -#undef APC_UPOVERLAY_EQUIPMENT1 -#undef APC_UPOVERLAY_EQUIPMENT2 -#undef APC_UPOVERLAY_LIGHTING0 -#undef APC_UPOVERLAY_LIGHTING1 -#undef APC_UPOVERLAY_LIGHTING2 -#undef APC_UPOVERLAY_ENVIRON0 -#undef APC_UPOVERLAY_ENVIRON1 -#undef APC_UPOVERLAY_ENVIRON2 -#undef APC_UPOVERLAY_LOCKED -#undef APC_UPOVERLAY_OPERATING +#undef UPOVERLAY_OPERATING +#undef UPOVERLAY_LOCKED +#undef UPOVERLAY_CHARGING_SHIFT +#undef UPOVERLAY_EQUIPMENT_SHIFT +#undef UPOVERLAY_LIGHTING_SHIFT +#undef UPOVERLAY_ENVIRON_SHIFT /*Power module, used for APC construction*/ /obj/item/electronics/apc diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 4183c83d4ec3..cec3440d1319 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -108,7 +108,7 @@ GLOBAL_LIST_INIT(cable_colors, list( cable_color = param_color || cable_color || pick(cable_colors) if(cable_colors[cable_color]) cable_color = cable_colors[cable_color] - update_icon() + update_appearance() /obj/structure/cable/Destroy() // called when a cable is deleted if(powernet) @@ -127,11 +127,11 @@ GLOBAL_LIST_INIT(cable_colors, list( /////////////////////////////////// //If underfloor, hide the cable -/obj/structure/cable/update_icon() +/obj/structure/cable/update_appearance() icon_state = "[d1]-[d2]" color = null add_atom_colour(cable_color, FIXED_COLOUR_PRIORITY) - + return ..() /obj/structure/cable/proc/handlecable(obj/item/W, mob/user, params) var/turf/T = get_turf(src) @@ -195,7 +195,7 @@ GLOBAL_LIST_INIT(cable_colors, list( /obj/structure/cable/proc/update_stored(length = 1, colorC = "red") stored.amount = length stored.cable_color = colorC - stored.update_icon() + stored.update_appearance() //////////////////////////////////////////// // Power related @@ -483,6 +483,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list(new/datum/stack_recipe("cable restrain icon = 'icons/obj/power.dmi' icon_state = "coil" item_state = "coil" + base_icon_state = "coil" lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi' max_amount = MAXCOIL @@ -511,7 +512,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list(new/datum/stack_recipe("cable restrain /obj/item/stack/cable_coil/cyborg/attack_self(mob/user) var/cable_color = input(user,"Pick a cable color.","Cable Color") in list("red","yellow","green","blue","pink","orange","cyan","white") cable_color = cable_color - update_icon() + update_appearance() /obj/item/stack/cable_coil/Initialize(mapload, new_amount = null, param_color = null) . = ..() @@ -523,7 +524,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list(new/datum/stack_recipe("cable restrain pixel_x = base_pixel_x + rand(-2,2) pixel_y = base_pixel_y + rand(-2,2) - update_icon() + update_appearance() recipes = GLOB.cable_coil_recipes @@ -550,12 +551,20 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list(new/datum/stack_recipe("cable restrain return ..() -/obj/item/stack/cable_coil/update_icon() - icon_state = "[initial(item_state)][amount < 3 ? amount : ""]" - name = "cable [amount < 3 ? "piece" : "coil"]" +/obj/item/stack/cable_coil/update_appearance() + . = ..() + icon_state = "[base_icon_state][amount < 3 ? amount : ""]" color = null add_atom_colour(cable_color, FIXED_COLOUR_PRIORITY) +/obj/item/stack/cable_coil/update_name() + . = ..() + name = "cable [(amount < 3) ? "piece" : "coil"]" + +/obj/item/stack/cable_coil/update_desc() + . = ..() + desc = "A [(amount < 3) ? "piece" : "coil"] of insulated power cable." + /obj/item/stack/cable_coil/attack_hand(mob/user) . = ..() if(.) @@ -563,7 +572,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list(new/datum/stack_recipe("cable restrain var/obj/item/stack/cable_coil/new_cable = ..() if(istype(new_cable)) new_cable.cable_color = cable_color - new_cable.update_icon() + new_cable.update_appearance() //add cables to the stack /obj/item/stack/cable_coil/proc/give(extra) @@ -571,7 +580,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list(new/datum/stack_recipe("cable restrain amount = max_amount else amount += extra - update_icon() + update_appearance() /////////////////////////////////////////////// // Cable laying procedures @@ -618,7 +627,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list(new/datum/stack_recipe("cable restrain C.d1 = 0 //it's a O-X node cable C.d2 = dirn C.add_fingerprint(user) - C.update_icon() + C.update_appearance() C.update_stored(1, cable_color) //create a new powernet with the cable, if needed it will be merged later @@ -691,7 +700,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list(new/datum/stack_recipe("cable restrain NC.d1 = 0 NC.d2 = fdirn NC.add_fingerprint(user) - NC.update_icon() + NC.update_appearance() NC.update_stored(1, cable_color) //create a new powernet with the cable, if needed it will be merged later @@ -734,7 +743,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list(new/datum/stack_recipe("cable restrain return - C.update_icon() + C.update_appearance() C.d1 = nd1 C.d2 = nd2 @@ -743,7 +752,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list(new/datum/stack_recipe("cable restrain C.update_stored(2, cable_color) C.add_fingerprint(user) - C.update_icon() + C.update_appearance() C.mergeConnectedNetworks(C.d1) //merge the powernets... @@ -827,6 +836,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list(new/datum/stack_recipe("cable restrain /obj/item/stack/cable_coil/cut amount = null icon_state = "coil2" + base_icon_state = "coil2" /obj/item/stack/cable_coil/cut/Initialize(mapload) . = ..() @@ -834,7 +844,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list(new/datum/stack_recipe("cable restrain amount = rand(1,2) pixel_x = rand(-2,2) pixel_y = rand(-2,2) - update_icon() + update_appearance() /obj/item/stack/cable_coil/cut/red cable_color = "red" diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index 51a08e9ad588..66f1f74f11c1 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -37,7 +37,7 @@ charge = maxcharge if(ratingdesc) desc += " This one has a rating of [DisplayEnergy(maxcharge)], and you should not swallow it." - update_icon() + update_appearance() /obj/item/stock_parts/cell/Destroy() STOP_PROCESSING(SSobj, src) @@ -203,7 +203,7 @@ /obj/item/stock_parts/cell/crap/empty/Initialize() . = ..() charge = 0 - update_icon() + update_appearance() /obj/item/stock_parts/cell/upgraded name = "upgraded power cell" @@ -225,7 +225,7 @@ /obj/item/stock_parts/cell/secborg/empty/Initialize() . = ..() charge = 0 - update_icon() + update_appearance() /obj/item/stock_parts/cell/mini_egun name = "miniature energy gun power cell" @@ -271,7 +271,7 @@ /obj/item/stock_parts/cell/high/empty/Initialize() . = ..() charge = 0 - update_icon() + update_appearance() /obj/item/stock_parts/cell/super name = "super-capacity power cell" @@ -284,7 +284,7 @@ /obj/item/stock_parts/cell/super/empty/Initialize() . = ..() charge = 0 - update_icon() + update_appearance() /obj/item/stock_parts/cell/hyper name = "hyper-capacity power cell" @@ -297,7 +297,7 @@ /obj/item/stock_parts/cell/hyper/empty/Initialize() . = ..() charge = 0 - update_icon() + update_appearance() /obj/item/stock_parts/cell/bluespace name = "bluespace power cell" @@ -311,7 +311,7 @@ /obj/item/stock_parts/cell/bluespace/empty/Initialize() . = ..() charge = 0 - update_icon() + update_appearance() /obj/item/stock_parts/cell/infinite name = "infinite-capacity power cell!" @@ -367,7 +367,7 @@ /obj/item/stock_parts/cell/emproof/empty/Initialize() . = ..() charge = 0 - update_icon() + update_appearance() /obj/item/stock_parts/cell/emproof/empty/ComponentInitialize() . = ..() @@ -417,9 +417,9 @@ /obj/item/stock_parts/cell/gun/empty/Initialize() . = ..() charge = 0 - update_icon() + update_appearance() -/obj/item/stock_parts/cell/gun/update_icon() +/obj/item/stock_parts/cell/gun/update_appearance() cut_overlays() if(grown_battery) . += mutable_appearance('icons/obj/power.dmi', "grown_wires") @@ -433,6 +433,7 @@ add_overlay("[initial(icon_state)]-o2") else add_overlay("[initial(icon_state)]-o1") + return ..() /obj/item/stock_parts/cell/gun/upgraded name = "upgraded weapon power cell" @@ -444,7 +445,7 @@ /obj/item/stock_parts/cell/gun/upgraded/empty/Initialize() . = ..() charge = 0 - update_icon() + update_appearance() /obj/item/stock_parts/cell/gun/mini name = "miniature weapon power cell" @@ -456,7 +457,7 @@ /obj/item/stock_parts/cell/gun/mini/empty/Initialize() . = ..() charge = 0 - update_icon() + update_appearance() /obj/item/stock_parts/cell/gun/solgov name = "SolGov power cell" @@ -473,7 +474,7 @@ /obj/item/stock_parts/cell/gun/large/empty/Initialize() . = ..() charge = 0 - update_icon() + update_appearance() #undef CELL_DRAIN_TIME diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index 86a7a2d3da80..d83ce869e93e 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -19,7 +19,7 @@ find_circs() connect_to_network() SSair.start_processing_machine(src) - update_icon() + update_appearance() component_parts = list(new /obj/item/circuitboard/machine/generator) /obj/machinery/power/generator/ComponentInitialize() @@ -31,7 +31,7 @@ SSair.stop_processing_machine(src) return ..() -/obj/machinery/power/generator/update_icon() +/obj/machinery/power/generator/update_appearance() cut_overlays() SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) @@ -52,6 +52,7 @@ var/L = min(round(lastgenlev/100000),11) if(L != 0) SSvis_overlays.add_vis_overlay(src, icon, "teg-op[L]", ABOVE_LIGHTING_LAYER, ABOVE_LIGHTING_PLANE, dir) + return ..() #define GENRATE 800 // generator output coefficient from Q @@ -95,7 +96,7 @@ var/datum/gas_mixture/cold_circ_air1 = cold_circ.airs[1] cold_circ_air1.merge(cold_air) - update_icon() + update_appearance() src.updateDialog() @@ -181,7 +182,7 @@ to_chat(user, "You start removing the circulators...") if(I.use_tool(src, user, 30, volume=50)) kill_circs() - update_icon() + update_appearance() to_chat(user, "You disconnect [src]'s circulator links.") playsound(src, 'sound/misc/box_deploy.ogg', 50) return TRUE @@ -207,7 +208,7 @@ kill_circs() connect_to_network() to_chat(user, "You [anchored?"secure":"unsecure"] [src].") - update_icon() + update_appearance() return TRUE /obj/machinery/power/generator/screwdriver_act(mob/user, obj/item/I) @@ -222,7 +223,7 @@ panel_open = !panel_open I.play_tool_sound(src) to_chat(user, "You [panel_open?"open":"close"] the panel on [src].") - update_icon() + update_appearance() return TRUE /obj/machinery/power/generator/crowbar_act(mob/user, obj/item/I) @@ -245,11 +246,11 @@ /obj/machinery/power/generator/proc/kill_circs() if(hot_circ) hot_circ.generator = null - hot_circ.update_icon() + hot_circ.update_appearance() hot_circ = null if(cold_circ) cold_circ.generator = null - cold_circ.update_icon() + cold_circ.update_appearance() cold_circ = null /obj/machinery/power/generator/obj_break(damage_flag) diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm index 47174c2bb121..869f3b086b76 100644 --- a/code/modules/power/gravitygenerator.dm +++ b/code/modules/power/gravitygenerator.dm @@ -44,6 +44,7 @@ /obj/machinery/gravity_generator/update_icon_state() icon_state = "[get_status()]_[sprite_number]" + return ..() /obj/machinery/gravity_generator/proc/get_status() return "off" @@ -65,6 +66,7 @@ set_broken() return ..() + // // Part generator which is mostly there for looks // @@ -86,6 +88,11 @@ if(main_part && !(main_part.machine_stat & BROKEN)) main_part.set_broken() +/// Used to eat args +/obj/machinery/gravity_generator/part/proc/on_update_icon(obj/machinery/gravity_generator/source, updates, updated) + SIGNAL_HANDLER + return update_appearance(updates) + // // Generator which spawns with the station. // @@ -157,8 +164,8 @@ part.sprite_number = count part.main_part = src parts += part - part.update_icon() - part.RegisterSignal(src, COMSIG_ATOM_UPDATED_ICON, /atom/proc/update_icon) + part.update_appearance() + part.RegisterSignal(src, COMSIG_ATOM_UPDATED_ICON, /obj/machinery/gravity_generator/part/proc/on_update_icon) /obj/machinery/gravity_generator/main/proc/connected_parts() return parts.len == 8 @@ -181,7 +188,7 @@ if(M.machine_stat & BROKEN) M.set_fix() broken_state = FALSE - update_icon() + update_appearance() set_power() // Interaction @@ -194,14 +201,14 @@ to_chat(user, "You secure the screws of the framework.") I.play_tool_sound(src) broken_state++ - update_icon() + update_appearance() return if(GRAV_NEEDS_WELDING) if(I.tool_behaviour == TOOL_WELDER) if(I.use_tool(src, user, 0, volume=50, amount=1)) to_chat(user, "You mend the damaged framework.") broken_state++ - update_icon() + update_appearance() return if(GRAV_NEEDS_PLASTEEL) if(istype(I, /obj/item/stack/sheet/plasteel)) @@ -211,7 +218,7 @@ to_chat(user, "You add the plating to the framework.") playsound(src.loc, 'sound/machines/click.ogg', 75, TRUE) broken_state++ - update_icon() + update_appearance() else to_chat(user, "You need 10 sheets of plasteel!") return @@ -274,7 +281,7 @@ charging_state = new_state ? POWER_UP : POWER_DOWN // Startup sequence animation. investigate_log("is now [charging_state == POWER_UP ? "charging" : "discharging"].", INVESTIGATE_GRAVITY) - update_icon() + update_appearance() // Set the state of the gravity. /obj/machinery/gravity_generator/main/proc/set_state(new_state) @@ -295,7 +302,7 @@ investigate_log("was brought offline and there is now no gravity for this level.", INVESTIGATE_GRAVITY) message_admins("The gravity generator was brought offline with no backup generator. [ADMIN_VERBOSEJMP(src)]") - update_icon() + update_appearance() update_list() src.updateUsrDialog() if(alert) diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 498042664d1e..7f2f3c3efbe9 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -95,7 +95,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/light_construct, 32) if(cell) user.visible_message("[user] removes [cell] from [src]!", "You remove [cell].") user.put_in_hands(cell) - cell.update_icon() + cell.update_appearance() cell = null add_fingerprint(user) @@ -385,6 +385,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/light/small/built, 28) icon_state = "[base_state]-burned" if(LIGHT_BROKEN) icon_state = "[base_state]-broken" + return ..() // update the icon_state and luminosity of the light depending on its state /obj/machinery/light/proc/update(trigger = TRUE) @@ -428,7 +429,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/light/small/built, 28) else use_power = IDLE_POWER_USE set_light(0) - update_icon() + update_appearance() active_power_usage = (brightness * 10) if(on != on_gs) diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index 9b1d17de2b67..e235e9328549 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -51,12 +51,12 @@ /obj/machinery/power/port_gen/proc/TogglePower() if(active) active = FALSE - update_icon() + update_appearance() soundloop.stop() else if(HasFuel()) active = TRUE START_PROCESSING(SSmachines, src) - update_icon() + update_appearance() soundloop.start() /obj/machinery/power/port_gen/proc/overheat() @@ -64,6 +64,7 @@ /obj/machinery/power/port_gen/update_icon_state() icon_state = "[base_icon]_[active]" + return ..() /obj/machinery/power/port_gen/process() if(active) diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index e7ae7a22d786..3cf5f5766097 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -128,7 +128,7 @@ SEND_SIGNAL(src, COMSIG_MACHINERY_POWER_LOST) . = TRUE set_machine_stat(machine_stat | NOPOWER) - update_icon() + update_appearance() // connect the machine to a powernet if a node cable is present on the turf /obj/machinery/power/proc/connect_to_network() diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm index a16d4305abc7..2d801de426af 100644 --- a/code/modules/power/singularity/collector.dm +++ b/code/modules/power/singularity/collector.dm @@ -120,7 +120,7 @@ if(!user.transferItemToLoc(W, src)) return loaded_tank = W - update_icon() + update_appearance() else if(W.GetID()) if(allowed(user)) if(active) @@ -223,7 +223,7 @@ if(active) toggle_power() else - update_icon() + update_appearance() /obj/machinery/power/rad_collector/rad_act(pulse_strength) . = ..() @@ -248,7 +248,7 @@ else icon_state = "ca" flick("ca_deactive", src) - update_icon() + update_appearance() return #undef RAD_COLLECTOR_EFFICIENCY diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index be7a4614ece8..05bd1e648032 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -3,6 +3,7 @@ desc = "A heavy-duty industrial laser, often used in containment fields and power generation." icon = 'icons/obj/singularity.dmi' icon_state = "emitter" + base_icon_state = "emitter" anchored = FALSE density = TRUE @@ -135,10 +136,11 @@ return ..() /obj/machinery/power/emitter/update_icon_state() - if(active && powernet) - icon_state = avail(active_power_usage) ? icon_state_on : icon_state_underpowered - else - icon_state = initial(icon_state) + if(!active || !powernet) + icon_state = base_icon_state + return ..() + icon_state = avail(active_power_usage) ? icon_state_on : icon_state_underpowered + return ..() /obj/machinery/power/emitter/interact(mob/user) add_fingerprint(user) @@ -160,7 +162,7 @@ log_game("Emitter turned [active ? "ON" : "OFF"] by [key_name(user)] in [AREACOORD(src)]") investigate_log("turned [active ? "ON" : "OFF"] by [key_name(user)] at [AREACOORD(src)]", INVESTIGATE_SINGULO) - update_icon() + update_appearance() else to_chat(user, "The controls are locked!") @@ -182,19 +184,19 @@ return if(!welded || (!powernet && active_power_usage)) active = FALSE - update_icon() + update_appearance() return if(active == TRUE) if(!active_power_usage || surplus() >= active_power_usage) add_load(active_power_usage) if(!powered) powered = TRUE - update_icon() + update_appearance() investigate_log("regained power and turned ON at [AREACOORD(src)]", INVESTIGATE_SINGULO) else if(powered) powered = FALSE - update_icon() + update_appearance() investigate_log("lost power and turned OFF at [AREACOORD(src)]", INVESTIGATE_SINGULO) log_game("Emitter lost power in [AREACOORD(src)]") return @@ -373,6 +375,7 @@ /obj/machinery/power/emitter/prototype name = "Prototype Emitter" icon = 'icons/obj/turrets.dmi' + base_icon_state = "protoemitter" icon_state = "protoemitter" icon_state_on = "protoemitter_+a" icon_state_underpowered = "protoemitter_+u" diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index 26a4eca1507a..d11479a5ac74 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -187,7 +187,7 @@ field_generator power level display var/new_level = round(num_power_levels * power / field_generator_max_power) if(new_level != power_level) power_level = new_level - update_icon() + update_appearance() /obj/machinery/field/generator/proc/turn_off() active = FG_OFFLINE @@ -200,7 +200,7 @@ field_generator power level display if(active || warming_up <= 0) return warming_up-- - update_icon() + update_appearance() if(warming_up > 0) addtimer(CALLBACK(src, .proc/cool_down), 50) @@ -212,7 +212,7 @@ field_generator power level display if(!active) return warming_up++ - update_icon() + update_appearance() if(warming_up >= 3) start_fields() else @@ -326,7 +326,7 @@ field_generator power level display connected_gens |= G G.connected_gens |= src shield_floor(TRUE) - update_icon() + update_appearance() /obj/machinery/field/generator/proc/cleanup() @@ -343,7 +343,7 @@ field_generator power level display FG.cleanup() connected_gens -= FG clean_up = 0 - update_icon() + update_appearance() //This is here to help fight the "hurr durr, release singulo cos nobody will notice before the //singulo eats the evidence". It's not fool-proof but better than nothing. diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm index 5c0f31adccd2..421550cd52df 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm @@ -65,7 +65,7 @@ return construction_state = anchorvalue ? PA_CONSTRUCTION_UNWIRED : PA_CONSTRUCTION_UNSECURED update_state() - update_icon() + update_appearance() /obj/structure/particle_accelerator/attackby(obj/item/W, mob/user, params) var/did_something = FALSE @@ -115,7 +115,7 @@ if(did_something) user.changeNext_move(CLICK_CD_MELEE) update_state() - update_icon() + update_appearance() return return ..() @@ -144,6 +144,7 @@ icon_state="[reference]p[strength]" else icon_state="[reference]c" + return ..() /obj/structure/particle_accelerator/proc/update_state() if(master) diff --git a/code/modules/power/singularity/particle_accelerator/particle_control.dm b/code/modules/power/singularity/particle_accelerator/particle_control.dm index d5a3179731b8..7bc3fa552ad3 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_control.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_control.dm @@ -49,7 +49,7 @@ var/obj/structure/particle_accelerator/part = CP part.strength = null part.powered = FALSE - part.update_icon() + part.update_appearance() connected_parts.Cut() return if(!part_scan()) @@ -74,12 +74,13 @@ icon_state = "control_boxw" else icon_state = "control_boxc" + return ..() /obj/machinery/particle_accelerator/control_box/proc/strength_change() for(var/CP in connected_parts) var/obj/structure/particle_accelerator/part = CP part.strength = strength - part.update_icon() + part.update_appearance() /obj/machinery/particle_accelerator/control_box/proc/add_strength(s) if(assembled && (strength < strength_upper_limit)) @@ -113,7 +114,7 @@ if(connected_parts.len < 6) investigate_log("lost a connected part; It powered down.", INVESTIGATE_SINGULO) toggle_power() - update_icon() + update_appearance() return //emit some particles for(var/obj/structure/particle_accelerator/particle_emitter/PE in connected_parts) @@ -179,14 +180,14 @@ var/obj/structure/particle_accelerator/part = CP part.strength = strength part.powered = TRUE - part.update_icon() + part.update_appearance() else use_power = IDLE_POWER_USE for(var/CP in connected_parts) var/obj/structure/particle_accelerator/part = CP part.strength = null part.powered = FALSE - part.update_icon() + part.update_appearance() return TRUE /obj/machinery/particle_accelerator/control_box/examine(mob/user) @@ -205,7 +206,7 @@ return construction_state = anchorvalue ? PA_CONSTRUCTION_UNWIRED : PA_CONSTRUCTION_UNSECURED update_state() - update_icon() + update_appearance() /obj/machinery/particle_accelerator/control_box/attackby(obj/item/W, mob/user, params) var/did_something = FALSE @@ -255,7 +256,7 @@ if(did_something) user.changeNext_move(CLICK_CD_MELEE) update_state() - update_icon() + update_appearance() return return ..() @@ -320,7 +321,7 @@ remove_strength() . = TRUE - update_icon() + update_appearance() #undef PA_CONSTRUCTION_UNSECURED #undef PA_CONSTRUCTION_UNWIRED diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 8e8ad0a579ff..d923dc2df185 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -64,7 +64,7 @@ obj_break() return terminal.master = src - update_icon() + update_appearance() /obj/machinery/power/smes/RefreshParts() var/IO = 0 @@ -89,7 +89,7 @@ /obj/machinery/power/smes/attackby(obj/item/I, mob/user, params) //opening using screwdriver if(default_deconstruction_screwdriver(user, icon_state, icon_state, I)) - update_icon() + update_appearance() return //changing direction using wrench @@ -106,7 +106,7 @@ to_chat(user, "No power terminal found.") return set_machine_stat(machine_stat & ~BROKEN) - update_icon() + update_appearance() return //building and linking a terminal @@ -321,7 +321,7 @@ // only update icon if state changed if(last_disp != chargedisplay() || last_chrg != inputting || last_onln != outputting) - update_icon() + update_appearance() @@ -351,7 +351,7 @@ output_used -= excess if(clev != chargedisplay()) //if needed updates the icons overlay - update_icon() + update_appearance() return @@ -389,13 +389,13 @@ if("tryinput") input_attempt = !input_attempt log_smes(usr) - update_icon() + update_appearance() . = TRUE if("tryoutput") if(!is_emped) output_attempt = !output_attempt log_smes(usr) - update_icon() + update_appearance() . = TRUE if("input") var/target = params["target"] @@ -453,14 +453,14 @@ charge -= 1e6/severity if (charge < 0) charge = 0 - update_icon() + update_appearance() log_smes() /obj/machinery/power/smes/proc/emp_end(previous_output) is_emped = FALSE output_attempt = previous_output outputting = output_attempt - update_icon() + update_appearance() log_smes() /obj/machinery/power/smes/engineering diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index 9031ec86fabd..bb50b3b2c2e8 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -131,7 +131,7 @@ if(azimuth_current != azimuth_target) azimuth_current = azimuth_target occlusion_setup() - update_icon() + update_appearance() needs_to_update_solar_exposure = TRUE ///trace towards sun to see if we're in shadow @@ -373,8 +373,8 @@ . += mutable_appearance(icon, icon_keyboard) if(machine_stat & BROKEN) . += mutable_appearance(icon, "[icon_state]_broken") - else - . += mutable_appearance(icon, icon_screen) + return + . += mutable_appearance(icon, icon_screen) /obj/machinery/power/solar_control/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) @@ -443,7 +443,7 @@ A.circuit = M A.state = 3 A.set_anchored(TRUE) - A.update_icon() + A.update_appearance() qdel(src) else to_chat(user, "You disconnect the monitor.") @@ -454,7 +454,7 @@ A.circuit = M A.state = 4 A.set_anchored(TRUE) - A.update_icon() + A.update_appearance() qdel(src) else if(user.a_intent != INTENT_HARM && !(I.item_flags & NOBLUDGEON)) attack_hand(user) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index 61bd0f55165c..05b9be90cd62 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -363,7 +363,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) if(final_countdown) // We're already doing it go away return final_countdown = TRUE - update_icon() + update_appearance() var/speaking = "[emergency_alert] The supermatter has reached critical integrity failure. Emergency causality destabilization field has been activated." radio.talk_into(src, speaking, common_channel, language = get_selected_language()) @@ -371,7 +371,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) if(damage < explosion_point) // Cutting it a bit close there engineers radio.talk_into(src, "[safe_alert] Failsafe has been disengaged.", common_channel) final_countdown = FALSE - update_icon() + update_appearance() return else if((i % 50) != 0 && i > 50) // A message once every 5 seconds until the final 5 seconds which count down individualy sleep(10) diff --git a/code/modules/projectiles/ammunition/_ammunition.dm b/code/modules/projectiles/ammunition/_ammunition.dm index d884bd00cbe3..a814f7119e18 100644 --- a/code/modules/projectiles/ammunition/_ammunition.dm +++ b/code/modules/projectiles/ammunition/_ammunition.dm @@ -49,7 +49,7 @@ pixel_y = base_pixel_y + rand(-10, 10) if(auto_rotate) transform = transform.Turn(pick(0, 90, 180, 270)) - update_icon() + update_appearance() /obj/item/ammo_casing/Destroy() . = ..() @@ -59,10 +59,11 @@ /obj/item/ammo_casing/update_icon_state() icon_state = "[initial(icon_state)][BB ? (bullet_skin ? "-[bullet_skin]" : "") : "-empty"]" + return ..() -/obj/item/ammo_casing/update_icon() - . = ..() - desc = "[initial(desc)][BB ? "" : " This one is spent."]" +/obj/item/ammo_casing/update_desc() + desc = "[initial(desc)][BB ? null : " This one is spent."]" + return ..() //proc to magically refill a casing with a new projectile /obj/item/ammo_casing/proc/newshot() //For energy weapons, syringe gun, shotgun shells and wands (!). @@ -83,7 +84,7 @@ else continue if (boolets > 0) - box.update_icon() + box.update_appearance() to_chat(user, "You collect [boolets] shell\s. [box] now contains [box.stored_ammo.len] shell\s.") else to_chat(user, "You fail to collect anything!") @@ -97,7 +98,7 @@ /obj/item/ammo_casing/proc/bounce_away(still_warm = FALSE, bounce_delay = 3) if(!heavy_metal) return - update_icon() + update_appearance() SpinAnimation(10, 1) var/turf/T = get_turf(src) if(still_warm && T && T.bullet_sizzle) diff --git a/code/modules/projectiles/ammunition/_firing.dm b/code/modules/projectiles/ammunition/_firing.dm index 2f6d48b166a8..f8e1aa1dff1e 100644 --- a/code/modules/projectiles/ammunition/_firing.dm +++ b/code/modules/projectiles/ammunition/_firing.dm @@ -22,7 +22,7 @@ user.changeNext_move(CLICK_CD_RANGE) user.newtonian_move(get_dir(target, user)) - update_icon() + update_appearance() return TRUE /obj/item/ammo_casing/proc/ready_proj(atom/target, mob/living/user, quiet, zone_override = "", atom/fired_from) diff --git a/code/modules/projectiles/ammunition/ballistic/shotgun.dm b/code/modules/projectiles/ammunition/ballistic/shotgun.dm index 355e20fc60f4..cee1e7849481 100644 --- a/code/modules/projectiles/ammunition/ballistic/shotgun.dm +++ b/code/modules/projectiles/ammunition/ballistic/shotgun.dm @@ -11,6 +11,7 @@ /obj/item/ammo_casing/shotgun/update_icon_state() icon_state = "[initial(icon_state)][BB ? "" : "-spent"]" + return ..() /obj/item/ammo_casing/shotgun/buckshot name = "buckshot shell" diff --git a/code/modules/projectiles/ammunition/caseless/_caseless.dm b/code/modules/projectiles/ammunition/caseless/_caseless.dm index 6d2d0aa1e6ab..c675e2317586 100644 --- a/code/modules/projectiles/ammunition/caseless/_caseless.dm +++ b/code/modules/projectiles/ammunition/caseless/_caseless.dm @@ -13,4 +13,5 @@ // Overridden; caseless ammo does not distinguish between "live" and "empty"/"spent" icon states (because it has no casing). /obj/item/ammo_casing/caseless/update_icon_state() - return + . = ..() + icon_state = "[initial(icon_state)]" diff --git a/code/modules/projectiles/ammunition/caseless/foam.dm b/code/modules/projectiles/ammunition/caseless/foam.dm index c1776ee400fd..3c71d31eb5ed 100644 --- a/code/modules/projectiles/ammunition/caseless/foam.dm +++ b/code/modules/projectiles/ammunition/caseless/foam.dm @@ -5,23 +5,23 @@ caliber = "foam_force" icon = 'icons/obj/guns/toy.dmi' icon_state = "foamdart" + base_icon_state = "foamdart" custom_materials = list(/datum/material/iron = 11.25) 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." - if(BB) - BB.icon_state = "foamdart_empty" - else - icon_state = initial(icon_state) - desc = "It's nerf or nothing! Ages 8 and up." - if(BB) - BB.icon_state = initial(BB.icon_state) + icon_state = "[base_icon_state]_empty" + BB?.icon_state = "[base_icon_state]_empty" + return + icon_state = "[base_icon_state]" + BB?.icon_state = "[BB.base_icon_state]" +/obj/item/ammo_casing/caseless/foam_dart/update_desc() + . = ..() + desc = "It's nerf or nothing! [modified ? "... Although, this one doesn't look too safe." : "Ages 8 and up."]" /obj/item/ammo_casing/caseless/foam_dart/attackby(obj/item/A, mob/user, params) var/obj/projectile/bullet/reusable/foam_dart/FD = BB @@ -30,7 +30,7 @@ FD.modified = TRUE FD.damage_type = BRUTE to_chat(user, "You pop the safety cap off [src].") - update_icon() + update_appearance() else if (istype(A, /obj/item/pen)) if(modified) if(!FD.pen) @@ -62,4 +62,5 @@ desc = "Whose smart idea was it to use toys as crowd control? Ages 18 and up." projectile_type = /obj/projectile/bullet/reusable/foam_dart/riot icon_state = "foamdart_riot" + base_icon_state = "foamdart_riot" custom_materials = list(/datum/material/iron = 1125) diff --git a/code/modules/projectiles/boxes_magazines/_box_magazine.dm b/code/modules/projectiles/boxes_magazines/_box_magazine.dm index 97f54b5b4b8d..f26b7ac78d0f 100644 --- a/code/modules/projectiles/boxes_magazines/_box_magazine.dm +++ b/code/modules/projectiles/boxes_magazines/_box_magazine.dm @@ -45,7 +45,6 @@ if(!start_empty) for(var/i = 1, i <= max_ammo, i++) stored_ammo += new ammo_type(src) - update_icon() ///gets a round from the magazine, if keep is TRUE the round will stay in the gun /obj/item/ammo_box/proc/get_round(keep = FALSE) @@ -98,43 +97,59 @@ num_loaded++ if(!did_load || !multiload) break + if(num_loaded) + AM.update_ammo_count() if(istype(A, /obj/item/ammo_casing)) var/obj/item/ammo_casing/AC = A if(give_round(AC, replace_spent)) user.transferItemToLoc(AC, src, TRUE) num_loaded++ + AC.update_appearance() if(num_loaded) if(!silent) to_chat(user, "You load [num_loaded] shell\s into \the [src]!") playsound(src, 'sound/weapons/gun/general/mag_bullet_insert.ogg', 60, TRUE) - A.update_icon() - update_icon() + update_ammo_count() return num_loaded /obj/item/ammo_box/attack_self(mob/user) var/obj/item/ammo_casing/A = get_round() - if(A) - A.forceMove(drop_location()) - if(!user.is_holding(src) || !user.put_in_hands(A)) //incase they're using TK - A.bounce_away(FALSE, NONE) - playsound(src, 'sound/weapons/gun/general/mag_bullet_insert.ogg', 60, TRUE) - to_chat(user, "You remove a round from [src]!") - update_icon() - -/obj/item/ammo_box/update_icon() - var/shells_left = stored_ammo.len + if(!A) + return + + A.forceMove(drop_location()) + if(!user.is_holding(src) || !user.put_in_hands(A)) //incase they're using TK + A.bounce_away(FALSE, NONE) + playsound(src, 'sound/weapons/gun/general/mag_bullet_insert.ogg', 60, TRUE) + to_chat(user, "You remove a round from [src]!") + update_ammo_count() + +/// Updates the materials and appearance of this ammo box +/obj/item/ammo_box/proc/update_ammo_count() + update_custom_materials() + update_appearance() + +/obj/item/ammo_box/update_desc(updates) + . = ..() + var/shells_left = LAZYLEN(stored_ammo) + desc = "[initial(desc)] There [(shells_left == 1) ? "is" : "are"] [shells_left] shell\s left!" + +/obj/item/ammo_box/update_icon_state() + var/shells_left = LAZYLEN(stored_ammo) switch(multiple_sprites) if(AMMO_BOX_PER_BULLET) icon_state = "[initial(icon_state)]-[shells_left]" if(AMMO_BOX_FULL_EMPTY) icon_state = "[initial(icon_state)]-[shells_left ? "[max_ammo]" : "0"]" - desc = "[initial(desc)] There [(shells_left == 1) ? "is" : "are"] [shells_left] shell\s left!" - for (var/material in bullet_cost) - var/material_amount = bullet_cost[material] - material_amount = (material_amount*stored_ammo.len) + base_cost[material] - custom_materials[material] = material_amount - set_custom_materials(custom_materials)//make sure we setup the correct properties again + return ..() + +/// Updates the amount of material in this ammo box according to how many bullets are left in it. +/obj/item/ammo_box/proc/update_custom_materials() + var/temp_materials = custom_materials.Copy() + for(var/material in bullet_cost) + temp_materials[material] = (bullet_cost[material] * stored_ammo.len) + base_cost[material] + set_custom_materials(temp_materials) ///Count of number of bullets in the magazine /obj/item/ammo_box/magazine/proc/ammo_count(countempties = TRUE) @@ -160,4 +175,4 @@ /obj/item/ammo_box/magazine/handle_atom_del(atom/A) stored_ammo -= A - update_icon() + update_ammo_count() diff --git a/code/modules/projectiles/boxes_magazines/external/lmg.dm b/code/modules/projectiles/boxes_magazines/external/lmg.dm index f1e3a5740a61..c0110542bb70 100644 --- a/code/modules/projectiles/boxes_magazines/external/lmg.dm +++ b/code/modules/projectiles/boxes_magazines/external/lmg.dm @@ -1,6 +1,7 @@ /obj/item/ammo_box/magazine/mm712x82 name = "box magazine (7.12x82mm)" icon_state = "a762-50" + base_icon_state = "a762" ammo_type = /obj/item/ammo_casing/mm712x82 caliber = "mm71282" max_ammo = 50 @@ -21,6 +22,6 @@ name = "box magazine (Match 7.12x82mm)" ammo_type = /obj/item/ammo_casing/mm712x82/match -/obj/item/ammo_box/magazine/mm712x82/update_icon() - ..() - icon_state = "a762-[round(ammo_count(),10)]" +/obj/item/ammo_box/magazine/mm712x82/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[round(ammo_count(), 10)]" diff --git a/code/modules/projectiles/boxes_magazines/external/pistol.dm b/code/modules/projectiles/boxes_magazines/external/pistol.dm index 29daa875bf6f..c48a683e7f63 100644 --- a/code/modules/projectiles/boxes_magazines/external/pistol.dm +++ b/code/modules/projectiles/boxes_magazines/external/pistol.dm @@ -35,6 +35,7 @@ name = "pistol magazine (.45)" desc = "A single stack M1911 reproduction magazine, faithfully designed to chamber .45." icon_state = "45-8" + base_icon_state = "45" ammo_type = /obj/item/ammo_casing/c45 caliber = ".45" max_ammo = 8 @@ -59,17 +60,15 @@ desc = "A single stack M1911 reproduction magazine, faithfully designed to chamber .45. Loaded with less-lethal rubber rounds which disable targets without causing serious damage." ammo_type = /obj/item/ammo_casing/c45/rubbershot -/obj/item/ammo_box/magazine/m45/update_icon() - ..() - if (ammo_count() >= 8) - icon_state = "45-8" - else - icon_state = "45-[ammo_count()]" +/obj/item/ammo_box/magazine/m45/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[min(ammo_count(), 8)]" -/obj/item/ammo_box/magazine/co9mm //WS edit begin - commander +/obj/item/ammo_box/magazine/co9mm name = "pistol magazine (9mm)" desc = "A single stack M1911 reproduction magazine, modified to chamber 9mm." icon_state = "co9mm-10" + base_icon_state = "co9mm" ammo_type = /obj/item/ammo_casing/c9mm caliber = "9mm" max_ammo = 10 @@ -94,24 +93,22 @@ desc = "A single stack M1911 reproduction magazine, modified to chamber 9mm. Loaded with less-lethal rubber rounds which disable targets without causing serious damage." ammo_type = /obj/item/ammo_casing/c9mm/rubbershot -/obj/item/ammo_box/magazine/co9mm/update_icon() - ..() - if (ammo_count() == 1) - icon_state = "co9mm-1" - else - icon_state = "co9mm-[round(ammo_count(),2)]" +/obj/item/ammo_box/magazine/co9mm/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[ammo_count() == 1 ? 1 : round(ammo_count(),2)]" /obj/item/ammo_box/magazine/pistolm9mm name = "large pistol magazine (9mm)" desc = "A double stack pistol magazine, designed to chamber 9mm." icon_state = "9x19p-8" + base_icon_state = "9x19p" ammo_type = /obj/item/ammo_casing/c9mm caliber = "9mm" max_ammo = 15 -/obj/item/ammo_box/magazine/pistolm9mm/update_icon() - ..() - icon_state = "9x19p-[ammo_count() ? "8" : "0"]" +/obj/item/ammo_box/magazine/pistolm9mm/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[ammo_count() ? "8" : "0"]" /obj/item/ammo_box/magazine/m50 name = "handgun magazine (.50ae)" diff --git a/code/modules/projectiles/boxes_magazines/external/rechargable.dm b/code/modules/projectiles/boxes_magazines/external/rechargable.dm index 7ed0cde50a7b..5a4af7929cff 100644 --- a/code/modules/projectiles/boxes_magazines/external/rechargable.dm +++ b/code/modules/projectiles/boxes_magazines/external/rechargable.dm @@ -2,13 +2,18 @@ name = "power pack" desc = "A rechargeable, detachable battery that serves as a magazine for laser rifles." icon_state = "oldrifle-20" + base_icon_state = "oldrifle" ammo_type = /obj/item/ammo_casing/caseless/laser caliber = "laser" max_ammo = 20 -/obj/item/ammo_box/magazine/recharge/update_icon() +/obj/item/ammo_box/magazine/recharge/update_desc() + . = ..() desc = "[initial(desc)] It has [stored_ammo.len] shot\s left." - icon_state = "oldrifle-[round(ammo_count(),4)]" + +/obj/item/ammo_box/magazine/recharge/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[round(ammo_count(), 4)]" /obj/item/ammo_box/magazine/recharge/attack_self() //No popping out the "bullets" return diff --git a/code/modules/projectiles/boxes_magazines/external/rifle.dm b/code/modules/projectiles/boxes_magazines/external/rifle.dm index 127afd2d29d5..116848938dee 100644 --- a/code/modules/projectiles/boxes_magazines/external/rifle.dm +++ b/code/modules/projectiles/boxes_magazines/external/rifle.dm @@ -2,16 +2,14 @@ name = "rifle magazine (10mm)" desc = "A well-worn magazine fitted for the surplus rifle." icon_state = "75-8" + base_icon_state = "75" ammo_type = /obj/item/ammo_casing/c10mm caliber = "10mm" max_ammo = 10 -/obj/item/ammo_box/magazine/m10mm/rifle/update_icon() - ..() - if(ammo_count()) - icon_state = "75-8" - else - icon_state = "75-0" +/obj/item/ammo_box/magazine/m10mm/rifle/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[ammo_count() ? "8" : "0"]" /obj/item/ammo_box/magazine/m556 name = "toploader magazine (5.56mm)" @@ -24,13 +22,14 @@ /obj/item/ammo_box/magazine/rifle47x33mm name = "\improper SolGov AR magazine (4.73x33mm caseless)" icon_state = "47x33mm-50" + base_icon_state = "47x33mm" ammo_type = /obj/item/ammo_casing/caseless/c47x33mm caliber = "4.73x33mm caseless" max_ammo = 50 //brrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr -/obj/item/ammo_box/magazine/rifle47x33mm/update_icon() - ..() - icon_state = "47x33mm-[round(ammo_count(),5)]" +/obj/item/ammo_box/magazine/rifle47x33mm/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[round(ammo_count(),5)]" /obj/item/ammo_box/magazine/aks74u name = "\improper AKS-74U Magazine (5.45x39mm cartridge)" @@ -39,7 +38,7 @@ caliber = "5.45x39mm" max_ammo = 30 -/obj/item/ammo_box/magazine/aks74u/update_icon() +/obj/item/ammo_box/magazine/aks74u/update_icon_state() . = ..() icon_state = "ak47_mag-[!!ammo_count()]" @@ -50,7 +49,7 @@ caliber = "4.6x30mm" max_ammo = 30 -/obj/item/ammo_box/magazine/aknt/update_icon() +/obj/item/ammo_box/magazine/aknt/update_icon_state() . = ..() icon_state = "ak47_mag-[!!ammo_count()]" @@ -61,7 +60,7 @@ caliber = "7.62x39mm FMJ" max_ammo = 20 -/obj/item/ammo_box/magazine/ak47/update_icon() +/obj/item/ammo_box/magazine/ak47/update_icon_state() . = ..() icon_state = "ak47_mag-[!!ammo_count()]" @@ -72,7 +71,7 @@ caliber = ".308" max_ammo = 10 -/obj/item/ammo_box/magazine/ebr/update_icon() +/obj/item/ammo_box/magazine/ebr/update_icon_state() . = ..() icon_state = "ebr_mag-[!!ammo_count()]" @@ -83,7 +82,7 @@ caliber = ".308" max_ammo = 10 -/obj/item/ammo_box/magazine/gal/update_icon() +/obj/item/ammo_box/magazine/gal/update_icon_state() . = ..() icon_state = "galmag-[!!ammo_count()]" @@ -94,7 +93,7 @@ caliber = "a556" max_ammo = 30 -/obj/item/ammo_box/magazine/p16/update_icon() +/obj/item/ammo_box/magazine/p16/update_icon_state() . = ..() icon_state = "p16_mag-[!!ammo_count()]" @@ -105,7 +104,7 @@ caliber = "a556" max_ammo = 30 -/obj/item/ammo_box/magazine/swiss/update_icon() +/obj/item/ammo_box/magazine/swiss/update_icon_state() . = ..() icon_state = "swissmag-[!!ammo_count()]" diff --git a/code/modules/projectiles/boxes_magazines/external/shotgun.dm b/code/modules/projectiles/boxes_magazines/external/shotgun.dm index 6528442773a6..e2fe30d9525a 100644 --- a/code/modules/projectiles/boxes_magazines/external/shotgun.dm +++ b/code/modules/projectiles/boxes_magazines/external/shotgun.dm @@ -6,9 +6,9 @@ caliber = "shotgun" max_ammo = 8 -/obj/item/ammo_box/magazine/m12g/update_icon() - ..() - icon_state = "[initial(icon_state)]-[CEILING(ammo_count(FALSE)/8, 1)*8]" +/obj/item/ammo_box/magazine/m12g/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[CEILING(ammo_count(FALSE)/8, 1)*8]" /obj/item/ammo_box/magazine/m12g/stun name = "shotgun drum magazine (12g taser slugs)" @@ -34,11 +34,12 @@ name = "shotgun box magazine (12g buckshot)" desc = "A single-stack box magazine for a shotgun." icon_state = "m12gsmall" + base_icon_state = "m12gsmall" max_ammo = 6 -/obj/item/ammo_box/magazine/m12g/small/update_icon() - ..() - icon_state = "[initial(icon_state)]-[CEILING(ammo_count(FALSE)/6, 1)*6]" +/obj/item/ammo_box/magazine/m12g/small/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[CEILING(ammo_count(FALSE)/6, 1)*6]" /obj/item/ammo_box/magazine/cm15_mag name = "CM-15 magazine (12g buckshot)" @@ -47,6 +48,6 @@ caliber = "shotgun" max_ammo = 8 -/obj/item/ammo_box/magazine/cm15_mag/update_icon() +/obj/item/ammo_box/magazine/cm15_mag/update_icon_state() . = ..() icon_state = "cm15_mag-[!!ammo_count()]" diff --git a/code/modules/projectiles/boxes_magazines/external/smg.dm b/code/modules/projectiles/boxes_magazines/external/smg.dm index 143c124420f0..8ca615c9c61a 100644 --- a/code/modules/projectiles/boxes_magazines/external/smg.dm +++ b/code/modules/projectiles/boxes_magazines/external/smg.dm @@ -1,53 +1,57 @@ /obj/item/ammo_box/magazine/wt550m9 name = "wt550 magazine (4.6x30mm)" icon_state = "46x30mmt-20" + base_icon_state = "46x30mmt" ammo_type = /obj/item/ammo_casing/c46x30mm caliber = "4.6x30mm" max_ammo = 20 -/obj/item/ammo_box/magazine/wt550m9/update_icon() - ..() - icon_state = "46x30mmt-[round(ammo_count(),4)]" +/obj/item/ammo_box/magazine/wt550m9/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[round(ammo_count(), 4)]" /obj/item/ammo_box/magazine/wt550m9/wtap name = "wt550 magazine (Armour Piercing 4.6x30mm)" icon_state = "46x30mmtA-20" + base_icon_state = "46x30mmtA" ammo_type = /obj/item/ammo_casing/c46x30mm/ap -/obj/item/ammo_box/magazine/wt550m9/wtap/update_icon() - ..() - icon_state = "46x30mmtA-[round(ammo_count(),4)]" +/obj/item/ammo_box/magazine/wt550m9/wtap/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[round(ammo_count(), 4)]" /obj/item/ammo_box/magazine/wt550m9/wtic name = "wt550 magazine (Incendiary 4.6x30mm)" icon_state = "46x30mmtI-20" ammo_type = /obj/item/ammo_casing/c46x30mm/inc -/obj/item/ammo_box/magazine/wt550m9/wtic/update_icon() - ..() - icon_state = "46x30mmtI-[round(ammo_count(),4)]" +/obj/item/ammo_box/magazine/wt550m9/wtic/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[round(ammo_count(),4)]" /obj/item/ammo_box/magazine/uzim9mm name = "uzi magazine (9mm)" icon_state = "uzi9mm-32" + base_icon_state = "uzi9mm" ammo_type = /obj/item/ammo_casing/c9mm caliber = "9mm" max_ammo = 32 -/obj/item/ammo_box/magazine/uzim9mm/update_icon() - ..() - icon_state = "uzi9mm-[round(ammo_count(),4)]" +/obj/item/ammo_box/magazine/uzim9mm/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[round(ammo_count(),4)]" /obj/item/ammo_box/magazine/smgm9mm name = "SMG magazine (9mm)" icon_state = "smg9mm-42" + base_icon_state = "smg9mm" ammo_type = /obj/item/ammo_casing/c9mm caliber = "9mm" max_ammo = 20 -/obj/item/ammo_box/magazine/smgm9mm/update_icon() - ..() - icon_state = "smg9mm-[ammo_count() ? "42" : "0"]" +/obj/item/ammo_box/magazine/smgm9mm/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[ammo_count() ? 42 : 0]" /obj/item/ammo_box/magazine/smgm9mm/ap name = "SMG magazine (Armour Piercing 9mm)" @@ -64,16 +68,14 @@ /obj/item/ammo_box/magazine/smgm10mm name = "SMG magazine (10mm)" icon_state = "smg10mm-24" + base_icon_state = "smg10mm" ammo_type = /obj/item/ammo_casing/c10mm caliber = "10mm" max_ammo = 24 -/obj/item/ammo_box/magazine/smgm10mm/update_icon() - ..() - if (ammo_count() == 1) - icon_state = "smg10mm-1" - else - icon_state = "smg10mm-[round(ammo_count(),3)]" +/obj/item/ammo_box/magazine/smgm10mm/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[ammo_count() == 1 ? 1 : round(ammo_count(),3)]" /obj/item/ammo_box/magazine/smgm10mm/rubbershot name = "SMG magazine (Rubbershot 10mm)" @@ -82,12 +84,13 @@ /obj/item/ammo_box/magazine/smgm45 name = "SMG magazine (.45)" icon_state = "c20r45-24" + base_icon_state = "c20r45" ammo_type = /obj/item/ammo_casing/c45 caliber = ".45" max_ammo = 24 -/obj/item/ammo_box/magazine/smgm45/update_icon() //This is stupid (whenever ammo is spent, it updates the icon path) - ..() +/obj/item/ammo_box/magazine/smgm45/update_icon_state() //This is stupid (whenever ammo is spent, it updates the icon path) + . = ..() icon_state = "c20r45-[round(ammo_count(),2)]" /obj/item/ammo_box/magazine/smgm45/drum @@ -95,20 +98,21 @@ icon_state = "drum45" max_ammo = 50 -/obj/item/ammo_box/magazine/smgm45/drum/update_icon() //Causes the mag to NOT inherit the parent's update_icon oooh the misery +/obj/item/ammo_box/magazine/smgm45/drum/update_icon_state() //Causes the mag to NOT inherit the parent's update_icon oooh the misery . = ..() icon_state = "drum45" /obj/item/ammo_box/magazine/pistol556mm name = "handgun magazine (5.56mm caseless)" icon_state = "5.56mmHITP-12" //ok i did it + base_icon_state = "5.56mmHITP" ammo_type = /obj/item/ammo_casing/caseless/c556mm caliber = "5.56mm caseless" max_ammo = 12 -/obj/item/ammo_box/magazine/pistol556mm/update_icon() - ..() - icon_state = "5.56mmHITP-[round(ammo_count(),2)]" +/obj/item/ammo_box/magazine/pistol556mm/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[round(ammo_count(),2)]" /obj/item/ammo_box/magazine/tec9 name = "machine pistol magazine(9mm AP)" diff --git a/code/modules/projectiles/boxes_magazines/external/sniper.dm b/code/modules/projectiles/boxes_magazines/external/sniper.dm index 14f35795acef..762c4bb873c0 100644 --- a/code/modules/projectiles/boxes_magazines/external/sniper.dm +++ b/code/modules/projectiles/boxes_magazines/external/sniper.dm @@ -1,16 +1,14 @@ /obj/item/ammo_box/magazine/sniper_rounds name = "sniper rounds (.50)" icon_state = ".50mag" + base_icon_state = ".50mag" ammo_type = /obj/item/ammo_casing/p50 max_ammo = 6 caliber = ".50" -/obj/item/ammo_box/magazine/sniper_rounds/update_icon() - ..() - if(ammo_count()) - icon_state = "[initial(icon_state)]-ammo" - else - icon_state = "[initial(icon_state)]" +/obj/item/ammo_box/magazine/sniper_rounds/update_icon_state() + . = ..() + icon_state = "[base_icon_state][ammo_count() ? "-ammo" : ""]" /obj/item/ammo_box/magazine/sniper_rounds/soporific name = "sniper rounds (Zzzzz)" diff --git a/code/modules/projectiles/boxes_magazines/external/toy.dm b/code/modules/projectiles/boxes_magazines/external/toy.dm index 2369bc6ce35a..78ad57cf9124 100644 --- a/code/modules/projectiles/boxes_magazines/external/toy.dm +++ b/code/modules/projectiles/boxes_magazines/external/toy.dm @@ -6,15 +6,13 @@ /obj/item/ammo_box/magazine/toy/smg name = "foam force SMG magazine" icon_state = "smg9mm-42" + base_icon_state = "smg9mm" ammo_type = /obj/item/ammo_casing/caseless/foam_dart max_ammo = 20 -/obj/item/ammo_box/magazine/toy/smg/update_icon() - ..() - if(ammo_count()) - icon_state = "smg9mm-42" - else - icon_state = "smg9mm-0" +/obj/item/ammo_box/magazine/toy/smg/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[ammo_count() ? 42 : 0]" /obj/item/ammo_box/magazine/toy/smg/riot ammo_type = /obj/item/ammo_casing/caseless/foam_dart/riot @@ -31,13 +29,14 @@ /obj/item/ammo_box/magazine/toy/smgm45 name = "donksoft SMG magazine" icon_state = "c20r45-toy" + base_icon_state = "c20r45" caliber = "foam_force" ammo_type = /obj/item/ammo_casing/caseless/foam_dart max_ammo = 20 -/obj/item/ammo_box/magazine/toy/smgm45/update_icon() - ..() - icon_state = "c20r45-[round(ammo_count(),2)]" +/obj/item/ammo_box/magazine/toy/smgm45/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[round(ammo_count(), 2)]" /obj/item/ammo_box/magazine/toy/smgm45/riot icon_state = "c20r45-riot" @@ -46,13 +45,14 @@ /obj/item/ammo_box/magazine/toy/m762 name = "donksoft box magazine" icon_state = "a762-toy" + base_icon_state = "a762" caliber = "foam_force" ammo_type = /obj/item/ammo_casing/caseless/foam_dart max_ammo = 50 -/obj/item/ammo_box/magazine/toy/m762/update_icon() - ..() - icon_state = "a762-[round(ammo_count(),10)]" +/obj/item/ammo_box/magazine/toy/m762/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[round(ammo_count(), 10)]" /obj/item/ammo_box/magazine/toy/m762/riot icon_state = "a762-riot" diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 7a513c7090fb..9d51296f3424 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -103,7 +103,7 @@ pin = null if(A == chambered) chambered = null - update_icon() + update_appearance() if(A == bayonet) clear_bayonet() if(A == gun_light) @@ -305,7 +305,7 @@ firing_burst = FALSE return FALSE process_chamber() - update_icon() + update_appearance() return TRUE /obj/item/gun/proc/process_fire(atom/target, mob/living/user, message = TRUE, params = null, zone_override = "", bonus_spread = 0) @@ -350,7 +350,7 @@ shoot_with_empty_chamber(user) return process_chamber() - update_icon() + update_appearance() semicd = TRUE addtimer(CALLBACK(src, .proc/reset_semicd), fire_delay) @@ -402,7 +402,7 @@ return to_chat(user, "You attach [K] to [src]'s bayonet lug.") bayonet = K - update_icon() + update_appearance() else return ..() @@ -492,7 +492,7 @@ if(!bayonet) return bayonet = null - update_icon() + update_appearance() return TRUE /obj/item/gun/proc/clear_gunlight() @@ -552,7 +552,7 @@ update_gunlight() /obj/item/gun/proc/update_gunlight() - update_icon() + update_appearance() for(var/X in actions) var/datum/action/A = X A.UpdateButtonIcon() diff --git a/code/modules/projectiles/guns/ballistic.dm b/code/modules/projectiles/guns/ballistic.dm index 7277bfeb9176..9efbc6169b25 100644 --- a/code/modules/projectiles/guns/ballistic.dm +++ b/code/modules/projectiles/guns/ballistic.dm @@ -91,18 +91,19 @@ . = ..() if (!spawnwithmagazine) bolt_locked = TRUE - update_icon() + update_appearance() return if (!magazine) magazine = new mag_type(src) chamber_round(TRUE) - update_icon() + update_appearance() /obj/item/gun/ballistic/update_icon_state() if(current_skin) icon_state = "[unique_reskin[current_skin]][sawn_off ? "_sawn" : ""]" else - icon_state = "[initial(icon_state)][sawn_off ? "_sawn" : ""]" + icon_state = "[base_icon_state || initial(icon_state)][sawn_off ? "_sawn" : ""]" + return ..() /obj/item/gun/ballistic/update_overlays() . = ..() @@ -177,7 +178,7 @@ playsound(src, lock_back_sound, lock_back_sound_volume, lock_back_sound_vary) else playsound(src, rack_sound, rack_sound_volume, rack_sound_vary) - update_icon() + update_appearance() ///Drops the bolt from a locked position /obj/item/gun/ballistic/proc/drop_bolt(mob/user = null) @@ -186,7 +187,7 @@ to_chat(user, "You drop the [bolt_wording] of \the [src].") chamber_round() bolt_locked = FALSE - update_icon() + update_appearance() ///Handles all the logic needed for magazine insertion /obj/item/gun/ballistic/proc/insert_magazine(mob/user, obj/item/ammo_box/magazine/AM, display_message = TRUE) @@ -203,7 +204,7 @@ playsound(src, load_empty_sound, load_sound_volume, load_sound_vary) if (bolt_type == BOLT_TYPE_OPEN && !bolt_locked) chamber_round(TRUE) - update_icon() + update_appearance() return TRUE else to_chat(user, "You cannot seem to get \the [src] out of your hands!") @@ -228,10 +229,10 @@ else magazine = null user.put_in_hands(old_mag) - old_mag.update_icon() + old_mag.update_appearance() if (display_message) to_chat(user, "You pull the [magazine_wording] out of \the [src].") - update_icon() + update_appearance() /obj/item/gun/ballistic/can_shoot() return chambered @@ -261,8 +262,8 @@ playsound(src, load_sound, load_sound_volume, load_sound_vary) if (chambered == null && bolt_type == BOLT_TYPE_NO_BOLT) chamber_round() - A.update_icon() - update_icon() + A.update_appearance() + update_appearance() return if(istype(A, /obj/item/suppressor)) var/obj/item/suppressor/S = A @@ -293,7 +294,7 @@ /obj/item/gun/ballistic/proc/install_suppressor(obj/item/suppressor/S) suppressed = S w_class += S.w_class //so pistols do not fit in pockets when suppressed - update_icon() + update_appearance() /obj/item/gun/ballistic/AltClick(mob/user) if (unique_reskin && !current_skin && user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY)) @@ -308,7 +309,7 @@ user.put_in_hands(suppressed) w_class -= S.w_class suppressed = null - update_icon() + update_appearance() return ///Prefire empty checks for the bolt drop @@ -317,17 +318,17 @@ if (bolt_type == BOLT_TYPE_OPEN && !bolt_locked) bolt_locked = TRUE playsound(src, bolt_drop_sound, bolt_drop_sound_volume) - update_icon() + update_appearance() ///postfire empty checks for bolt locking and sound alarms /obj/item/gun/ballistic/proc/postfire_empty_checks(last_shot_succeeded) if (!chambered && !get_ammo()) if (empty_alarm && last_shot_succeeded) playsound(src, empty_alarm_sound, empty_alarm_volume, empty_alarm_vary) - update_icon() + update_appearance() if (last_shot_succeeded && bolt_type == BOLT_TYPE_LOCKING) bolt_locked = TRUE - update_icon() + update_appearance() /obj/item/gun/ballistic/afterattack() prefire_empty_checks() @@ -369,7 +370,7 @@ if (num_unloaded) to_chat(user, "You unload [num_unloaded] [cartridge_wording]\s from [src].") playsound(user, eject_sound, eject_sound_volume, eject_sound_vary) - update_icon() + update_appearance() else to_chat(user, "[src] is empty!") return @@ -448,7 +449,7 @@ GLOBAL_LIST_INIT(gun_saw_types, typecacheof(list( slot_flags |= ITEM_SLOT_BELT //but you can wear it on your belt (poorly concealed under a trenchcoat, ideally) recoil = SAWN_OFF_RECOIL sawn_off = TRUE - update_icon() + update_appearance() return TRUE ///used for sawing guns, causes the gun to fire without the input of the user diff --git a/code/modules/projectiles/guns/ballistic/assault.dm b/code/modules/projectiles/guns/ballistic/assault.dm index 2e7cb428a909..5db8d252b647 100644 --- a/code/modules/projectiles/guns/ballistic/assault.dm +++ b/code/modules/projectiles/guns/ballistic/assault.dm @@ -61,7 +61,7 @@ folded = !folded playsound(src.loc, 'sound/weapons/empty.ogg', 100, 1) - update_icon() + update_appearance() /obj/item/gun/ballistic/automatic/assualt/ak47/nt/update_overlays() . = ..() @@ -165,6 +165,6 @@ to_chat(user, "You switch to [burst_size]-rnd Matter.") playsound(user, 'sound/weapons/empty.ogg', 100, TRUE) - update_icon() + update_appearance() for(var/datum/action/action as anything in actions) action.UpdateButtonIcon() diff --git a/code/modules/projectiles/guns/ballistic/automatic.dm b/code/modules/projectiles/guns/ballistic/automatic.dm index 4217d2e45199..ea1eab2ae70c 100644 --- a/code/modules/projectiles/guns/ballistic/automatic.dm +++ b/code/modules/projectiles/guns/ballistic/automatic.dm @@ -40,7 +40,7 @@ to_chat(user, "You switch to [burst_size]-rnd burst.") playsound(user, 'sound/weapons/empty.ogg', 100, TRUE) - update_icon() + update_appearance() for(var/X in actions) var/datum/action/A = X A.UpdateButtonIcon() diff --git a/code/modules/projectiles/guns/ballistic/hmg.dm b/code/modules/projectiles/guns/ballistic/hmg.dm index 22fb91a56be9..b94e679d4783 100644 --- a/code/modules/projectiles/guns/ballistic/hmg.dm +++ b/code/modules/projectiles/guns/ballistic/hmg.dm @@ -15,6 +15,7 @@ desc = "A heavy machine gun, designated 'L6 SAW'. Has 'Aussec Armoury - 490 FS' engraved on the receiver below the designation. Chambered in 7.12x82mm." icon_state = "l6" item_state = "l6closedmag" + base_icon_state = "l6" mag_type = /obj/item/ammo_box/magazine/mm712x82 can_suppress = FALSE spread = 7 @@ -42,7 +43,7 @@ cover_open = !cover_open to_chat(user, "You [cover_open ? "open" : "close"] [src]'s cover.") playsound(user, 'sound/weapons/gun/l6/l6_door.ogg', 60, TRUE) - update_icon() + update_appearance() /obj/item/gun/ballistic/automatic/hmg/l6_saw/update_overlays() @@ -56,7 +57,7 @@ return else . = ..() - update_icon() + update_appearance() //ATTACK HAND IGNORING PARENT RETURN VALUE /obj/item/gun/ballistic/automatic/hmg/l6_saw/attack_hand(mob/user) diff --git a/code/modules/projectiles/guns/ballistic/revolver.dm b/code/modules/projectiles/guns/ballistic/revolver.dm index 0de8f04e2230..af27a71833bf 100644 --- a/code/modules/projectiles/guns/ballistic/revolver.dm +++ b/code/modules/projectiles/guns/ballistic/revolver.dm @@ -183,8 +183,8 @@ ..() if(get_ammo() > 0) spin() - update_icon() - A.update_icon() + update_appearance() + A.update_appearance() return /obj/item/gun/ballistic/revolver/russian/attack_self(mob/user) diff --git a/code/modules/projectiles/guns/ballistic/rifle.dm b/code/modules/projectiles/guns/ballistic/rifle.dm index 8de128b3feb4..76ae2fc7e61b 100644 --- a/code/modules/projectiles/guns/ballistic/rifle.dm +++ b/code/modules/projectiles/guns/ballistic/rifle.dm @@ -27,7 +27,7 @@ playsound(src, rack_sound, rack_sound_volume, rack_sound_vary) process_chamber(FALSE, FALSE, FALSE) bolt_locked = TRUE - update_icon() + update_appearance() return drop_bolt(user) diff --git a/code/modules/projectiles/guns/ballistic/shotgun.dm b/code/modules/projectiles/guns/ballistic/shotgun.dm index a3af3b89a223..c6eed4ac079e 100644 --- a/code/modules/projectiles/guns/ballistic/shotgun.dm +++ b/code/modules/projectiles/guns/ballistic/shotgun.dm @@ -233,7 +233,7 @@ slot_flags = ITEM_SLOT_BACK to_chat(user, "You tie the lengths of cable to the shotgun, making a sling.") slung = TRUE - update_icon() + update_appearance() else to_chat(user, "You need at least ten lengths of cable if you want to make a sling!") @@ -256,7 +256,7 @@ if(. && slung) //sawing off the gun removes the sling new /obj/item/stack/cable_coil(get_turf(src), 10) slung = 0 - update_icon() + update_appearance() /obj/item/gun/ballistic/shotgun/doublebarrel/improvised/sawn name = "sawn-off improvised shotgun" diff --git a/code/modules/projectiles/guns/ballistic/smg.dm b/code/modules/projectiles/guns/ballistic/smg.dm index 097fa7d9a803..11db569a5181 100644 --- a/code/modules/projectiles/guns/ballistic/smg.dm +++ b/code/modules/projectiles/guns/ballistic/smg.dm @@ -42,7 +42,7 @@ /obj/item/gun/ballistic/automatic/smg/c20r/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/gun/ballistic/automatic/smg/c20r/cobra name = "\improper Cobra 20" @@ -137,7 +137,7 @@ /obj/item/gun/ballistic/automatic/smg/m90/Initialize() . = ..() underbarrel = new /obj/item/gun/ballistic/revolver/grenadelauncher(src) - update_icon() + update_appearance() /obj/item/gun/ballistic/automatic/smg/m90/unrestricted pin = /obj/item/firing_pin @@ -145,7 +145,7 @@ /obj/item/gun/ballistic/automatic/smg/m90/unrestricted/Initialize() . = ..() underbarrel = new /obj/item/gun/ballistic/revolver/grenadelauncher/unrestricted(src) - update_icon() + update_appearance() /obj/item/gun/ballistic/automatic/smg/m90/afterattack(atom/target, mob/living/user, flag, params) if(select == 2) @@ -188,7 +188,7 @@ fire_delay = 0 to_chat(user, "You switch to semi-auto.") playsound(user, 'sound/weapons/empty.ogg', 100, TRUE) - update_icon() + update_appearance() return /obj/item/gun/ballistic/automatic/smg/thompson diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index 19722fb11804..f810dc221dbf 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -10,7 +10,7 @@ var/list/ammo_type = list(/obj/item/ammo_casing/energy) var/select = 1 //The state of the select fire switch. Determines from the ammo_type list what kind of shot is fired next. var/can_charge = TRUE //Can it be charged in a recharger? - var/automatic_charge_overlays = TRUE //Do we handle overlays with base update_icon()? + var/automatic_charge_overlays = TRUE //Do we handle overlays with base update_appearance()? var/charge_sections = 4 ammo_x_offset = 2 var/shaded_charge = FALSE //if this gun uses a stateful charge bar for more detail @@ -38,7 +38,7 @@ cell.use(round(cell.charge / severity)) chambered = null //we empty the chamber recharge_newshot() //and try to charge a new shot - update_icon() + update_appearance() /obj/item/gun/energy/get_cell() return cell @@ -55,7 +55,7 @@ recharge_newshot(TRUE) if(selfcharge) START_PROCESSING(SSobj, src) - update_icon() + update_appearance() /obj/item/gun/energy/ComponentInitialize() . = ..() @@ -80,7 +80,7 @@ /obj/item/gun/energy/handle_atom_del(atom/A) if(A == cell) cell = null - update_icon() + update_appearance() return ..() /obj/item/gun/energy/process() @@ -92,12 +92,12 @@ cell.give(1000) //WS Edit - Egun energy cells if(!chambered) //if empty chamber we try to charge a new shot recharge_newshot(TRUE) - update_icon() + update_appearance() /obj/item/gun/energy/attack_self(mob/living/user as mob) if(ammo_type.len > 1) select_fire(user) - update_icon() + update_appearance() /obj/item/gun/energy/attackby(obj/item/A, mob/user, params) if (!internal_cell && istype(A, /obj/item/stock_parts/cell/gun)) @@ -117,7 +117,7 @@ cell = C to_chat(user, "You load the [C] into \the [src].") playsound(src, load_sound, sound_volume, load_sound_vary) - update_icon() + update_appearance() return TRUE else to_chat(user, "You cannot seem to get \the [src] out of your hands!") @@ -133,9 +133,9 @@ to_chat(user, "You dropped the old cell, but the new one doesn't fit. How embarassing.")*/ cell = null user.put_in_hands(old_cell) - old_cell.update_icon() + old_cell.update_appearance() to_chat(user, "You pull the cell out of \the [src].") - update_icon() + update_appearance() /obj/item/gun/energy/screwdriver_act(mob/living/user, obj/item/I) if(cell && !internal_cell && !bayonet && (!gun_light || !can_flashlight)) @@ -198,12 +198,12 @@ to_chat(user, "[src] is now set to [shot.select_name].") chambered = null recharge_newshot(TRUE) - update_icon() + update_appearance() return /obj/item/gun/energy/update_icon_state() if(initial(item_state)) - return + return ..() var/ratio = get_charge_ratio() var/new_item_state = "" new_item_state = initial(icon_state) @@ -212,6 +212,7 @@ new_item_state += "[shot.select_name]" new_item_state += "[ratio]" item_state = new_item_state + return ..() /obj/item/gun/energy/update_overlays() . = ..() diff --git a/code/modules/projectiles/guns/energy/dueling.dm b/code/modules/projectiles/guns/energy/dueling.dm index a10fa260e70e..db923335b369 100644 --- a/code/modules/projectiles/guns/energy/dueling.dm +++ b/code/modules/projectiles/guns/energy/dueling.dm @@ -173,7 +173,7 @@ if(DUEL_SETTING_C) setting = DUEL_SETTING_A to_chat(user,"You switch [src] setting to [setting] mode.") - update_icon() + update_appearance() /obj/item/gun/energy/dueling/update_overlays() . = ..() @@ -250,13 +250,13 @@ . = ..() var/obj/projectile/energy/duel/D = BB D.setting = setting - D.update_icon() + D.update_appearance() /obj/item/ammo_casing/energy/duel/fire_casing(atom/target, mob/living/user, params, distro, quiet, zone_override, spread, atom/fired_from) . = ..() var/obj/effect/temp_visual/dueling_chaff/C = new(get_turf(user)) C.setting = setting - C.update_icon() + C.update_appearance() //Projectile @@ -314,6 +314,7 @@ icon_locked = "medalbox+l" icon_closed = "medalbox" icon_broken = "medalbox+b" + base_icon_state = "medalbox" /obj/item/storage/lockbox/dueling/ComponentInitialize() . = ..() @@ -323,15 +324,14 @@ STR.set_holdable(list(/obj/item/gun/energy/dueling)) /obj/item/storage/lockbox/dueling/update_icon_state() - var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED) - if(locked) - icon_state = "medalbox+l" - else - icon_state = "medalbox" - if(open) - icon_state += "open" - if(broken) - icon_state += "+b" + if(SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)) + icon_state = icon_locked + return ..() + if(broken) + icon_state = icon_broken + return ..() + icon_state = open ? "[base_icon_state]open" : icon_closed + return ..() /obj/item/storage/lockbox/dueling/PopulateContents() . = ..() diff --git a/code/modules/projectiles/guns/energy/energy_gun.dm b/code/modules/projectiles/guns/energy/energy_gun.dm index 73eada04055b..1e4af286d44f 100644 --- a/code/modules/projectiles/guns/energy/energy_gun.dm +++ b/code/modules/projectiles/guns/energy/energy_gun.dm @@ -128,7 +128,7 @@ /obj/item/gun/energy/e_gun/nuclear/shoot_live_shot(mob/living/user, pointblank = 0, atom/pbtarget = null, message = 1) failcheck() - update_icon() + update_appearance() ..() /obj/item/gun/energy/e_gun/nuclear/proc/failcheck() @@ -155,14 +155,14 @@ . = ..() if(reactor_overloaded) . += "[icon_state]_fail_3" - else - switch(fail_tick) - if(0) - . += "[icon_state]_fail_0" - if(1 to 150) - . += "[icon_state]_fail_1" - if(151 to INFINITY) - . += "[icon_state]_fail_2" + return + switch(fail_tick) + if(0) + . += "[icon_state]_fail_0" + if(1 to 150) + . += "[icon_state]_fail_1" + if(151 to INFINITY) + . += "[icon_state]_fail_2" /obj/item/gun/energy/e_gun/rdgun name = "research director's PDW" diff --git a/code/modules/projectiles/guns/energy/kinetic_accelerator.dm b/code/modules/projectiles/guns/energy/kinetic_accelerator.dm index 6f3c7667245b..7928094cab13 100644 --- a/code/modules/projectiles/guns/energy/kinetic_accelerator.dm +++ b/code/modules/projectiles/guns/energy/kinetic_accelerator.dm @@ -122,7 +122,7 @@ /obj/item/gun/energy/kinetic_accelerator/proc/empty() if(cell) cell.use(cell.charge) - update_icon() + update_appearance() /obj/item/gun/energy/kinetic_accelerator/proc/attempt_reload(recharge_time) if(!cell) @@ -155,7 +155,7 @@ playsound(src.loc, 'sound/weapons/kenetic_reload.ogg', 60, TRUE) else to_chat(loc, "[src] silently charges up.") - update_icon() + update_appearance() overheat = FALSE /obj/item/gun/energy/kinetic_accelerator/update_overlays() diff --git a/code/modules/projectiles/guns/energy/laser_gatling.dm b/code/modules/projectiles/guns/energy/laser_gatling.dm index b34355331ac5..2ef1f8293bcf 100644 --- a/code/modules/projectiles/guns/energy/laser_gatling.dm +++ b/code/modules/projectiles/guns/energy/laser_gatling.dm @@ -41,7 +41,7 @@ armed = 0 to_chat(user, "You need a free hand to hold the gun!") return - update_icon() + update_appearance() user.update_inv_back() else to_chat(user, "You are already holding the gun!") @@ -77,10 +77,8 @@ /obj/item/minigunpack/update_icon_state() - if(armed) - icon_state = "notholstered" - else - icon_state = "holstered" + icon_state = "[(armed ? "not" : "")]holstered" + return ..() /obj/item/minigunpack/proc/attach_gun(mob/user) if(!gun) @@ -91,7 +89,7 @@ to_chat(user, "You attach the [gun.name] to the [name].") else src.visible_message("The [gun.name] snaps back onto the [name]!") - update_icon() + update_appearance() user.update_inv_back() diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index 9bdb7f33e03b..1311920eb8b2 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -207,12 +207,14 @@ ammo_type = list(/obj/item/ammo_casing/energy/wormhole, /obj/item/ammo_casing/energy/wormhole/orange) item_state = null icon_state = "wormhole_projector" + base_icon_state = "wormhole_projector" var/obj/effect/portal/p_blue var/obj/effect/portal/p_orange var/atmos_link = FALSE /obj/item/gun/energy/wormhole_projector/update_icon_state() - icon_state = item_state = "[initial(icon_state)][select]" + . = ..() + icon_state = item_state = "[base_icon_state][select]" /obj/item/gun/energy/wormhole_projector/update_ammo_types() . = ..() @@ -302,7 +304,7 @@ /obj/item/gun/energy/printer/commando/attack_self(mob/living/user as mob) if(ammo_type.len > 1) tac_fire(user) - update_icon() + update_appearance() /obj/item/gun/energy/printer/commando/proc/tac_fire(mob/living/user) select++ @@ -321,7 +323,7 @@ to_chat(user, "You rearm your [src] with CY-SOUR nonlethal rounds, which cause stamina damage and distrupt the focus of enemies.") chambered = null recharge_newshot(TRUE) - update_icon() + update_appearance() return /obj/item/gun/energy/temperature diff --git a/code/modules/projectiles/guns/magic/wand.dm b/code/modules/projectiles/guns/magic/wand.dm index eb21ace207f3..c6a25127878a 100644 --- a/code/modules/projectiles/guns/magic/wand.dm +++ b/code/modules/projectiles/guns/magic/wand.dm @@ -7,6 +7,7 @@ ammo_type = /obj/item/ammo_casing/magic icon_state = "nothingwand" item_state = "wand" + base_icon_state = "nothingwand" w_class = WEIGHT_CLASS_SMALL can_charge = FALSE max_charges = 100 //100, 50, 50, 34 (max charge distribution by 25%ths) @@ -25,7 +26,8 @@ . += "Has [charges] charge\s remaining." /obj/item/gun/magic/wand/update_icon_state() - icon_state = "[initial(icon_state)][charges ? "" : "-drained"]" + icon_state = "[base_icon_state][charges ? null : "-drained"]" + return ..() /obj/item/gun/magic/wand/attack(atom/target, mob/living/user) if(target == user) @@ -53,7 +55,7 @@ to_chat(user,"[src] overloads and disintegrates.") qdel(src) return - update_icon() + update_appearance() /obj/item/gun/magic/wand/shoot_with_empty_chamber(mob/living/user) if(prob(100*WAND_WREST_CHANCE)) @@ -79,6 +81,7 @@ fire_sound = 'sound/magic/wandodeath.ogg' ammo_type = /obj/item/ammo_casing/magic/death icon_state = "deathwand" + base_icon_state = "deathwand" max_charges = 3 //3, 2, 2, 1 /obj/item/gun/magic/wand/death/zap_self(mob/living/user) @@ -116,6 +119,7 @@ ammo_type = /obj/item/ammo_casing/magic/heal fire_sound = 'sound/magic/staff_healing.ogg' icon_state = "revivewand" + base_icon_state = "revivewand" max_charges = 10 //10, 5, 5, 4 /obj/item/gun/magic/wand/resurrection/zap_self(mob/living/user) @@ -151,6 +155,7 @@ desc = "This wand is attuned to chaos and will radically alter the victim's form." ammo_type = /obj/item/ammo_casing/magic/change icon_state = "polywand" + base_icon_state = "polywand" fire_sound = 'sound/magic/staff_change.ogg' max_charges = 10 //10, 5, 5, 4 @@ -170,6 +175,7 @@ ammo_type = /obj/item/ammo_casing/magic/teleport fire_sound = 'sound/magic/wand_teleport.ogg' icon_state = "telewand" + base_icon_state = "telewand" max_charges = 10 //10, 5, 5, 4 no_den_usage = TRUE @@ -187,6 +193,7 @@ ammo_type = /obj/item/ammo_casing/magic/safety fire_sound = 'sound/magic/wand_teleport.ogg' icon_state = "telewand" + base_icon_state = "telewand" max_charges = 10 //10, 5, 5, 4 no_den_usage = FALSE @@ -218,6 +225,7 @@ desc = "This particular wand can create doors in any wall for the unscrupulous wizard who shuns teleportation magics." ammo_type = /obj/item/ammo_casing/magic/door icon_state = "doorwand" + base_icon_state = "doorwand" fire_sound = 'sound/magic/staff_door.ogg' max_charges = 20 //20, 10, 10, 7 no_den_usage = 1 @@ -237,6 +245,7 @@ fire_sound = 'sound/magic/fireball.ogg' ammo_type = /obj/item/ammo_casing/magic/fireball icon_state = "firewand" + base_icon_state = "firewand" max_charges = 8 //8, 4, 4, 3 /obj/item/gun/magic/wand/fireball/zap_self(mob/living/user) diff --git a/code/modules/projectiles/guns/misc/blastcannon.dm b/code/modules/projectiles/guns/misc/blastcannon.dm index ef165df27a1f..d2a8c80827fc 100644 --- a/code/modules/projectiles/guns/misc/blastcannon.dm +++ b/code/modules/projectiles/guns/misc/blastcannon.dm @@ -2,8 +2,8 @@ name = "pipe gun" desc = "A pipe welded onto a gun stock, with a mechanical trigger. The pipe has an opening near the top, and there seems to be a spring loaded wheel in the hole." icon_state = "empty_blastcannon" - var/icon_state_loaded = "loaded_blastcannon" item_state = "blastcannon_empty" + base_icon_state = "blastcannon" w_class = WEIGHT_CLASS_NORMAL force = 10 fire_sound = 'sound/weapons/blastcannon.ogg' @@ -43,14 +43,12 @@ bomb = null name = initial(name) desc = initial(desc) - update_icon() + update_appearance() return ..() /obj/item/gun/blastcannon/update_icon_state() - if(bomb) - icon_state = icon_state_loaded - else - icon_state = initial(icon_state) + icon_state = "[bomb ? "loaded" : "empty"]_[base_icon_state]" + return ..() /obj/item/gun/blastcannon/attackby(obj/O, mob/user) if(istype(O, /obj/item/transfer_valve)) @@ -65,7 +63,7 @@ bomb = T name = "blast cannon" desc = "A makeshift device used to concentrate a bomb's blast energy to a narrow wave." - update_icon() + update_appearance() return TRUE return ..() @@ -94,7 +92,7 @@ var/power = bomb? calculate_bomb() : debug_power power = min(power, max_power) QDEL_NULL(bomb) - update_icon() + update_appearance() var/heavy = power * 0.25 var/medium = power * 0.5 var/light = power diff --git a/code/modules/projectiles/guns/misc/bow.dm b/code/modules/projectiles/guns/misc/bow.dm index 6144b4c85dab..df30f5a89022 100644 --- a/code/modules/projectiles/guns/misc/bow.dm +++ b/code/modules/projectiles/guns/misc/bow.dm @@ -17,12 +17,9 @@ bolt_type = BOLT_TYPE_NO_BOLT var/drawn = FALSE -/obj/item/gun/ballistic/bow/update_icon() +/obj/item/gun/ballistic/bow/update_icon_state() . = ..() - if(!chambered) - icon_state = "[initial(icon_state)]" - else - icon_state = "[initial(icon_state)]_[drawn]" + icon_state = chambered ? "bow_[drawn]" : "bow" /obj/item/gun/ballistic/bow/chamber_round(keep_bullet = FALSE, spin_cylinder, replace_new_round) if(chambered || !magazine) @@ -37,7 +34,7 @@ if(!drawn) playsound(src, 'sound/weapons/bowdraw.ogg', 75, 0) drawn = !drawn - update_icon() + update_appearance() /obj/item/gun/ballistic/bow/afterattack(atom/target, mob/living/user, flag, params, passthrough = FALSE) if(!chambered) @@ -47,7 +44,7 @@ return drawn = FALSE . = ..() //fires, removing the arrow - update_icon() + update_appearance() /obj/item/gun/ballistic/bow/shoot_with_empty_chamber(mob/living/user) return //so clicking sounds please diff --git a/code/modules/projectiles/guns/powered.dm b/code/modules/projectiles/guns/powered.dm index 31ab879bb8cc..698826436b18 100644 --- a/code/modules/projectiles/guns/powered.dm +++ b/code/modules/projectiles/guns/powered.dm @@ -8,7 +8,7 @@ var/empty_battery_sound = FALSE // play empty alarm if no battery var/shaded_charge = FALSE //if this gun uses a stateful charge bar for more detail - var/automatic_charge_overlays = TRUE //Do we handle overlays with base update_icon()? + var/automatic_charge_overlays = TRUE //Do we handle overlays with base update_appearance()? var/internal_cell = FALSE ///if the gun's cell cannot be replaced var/small_gun = FALSE ///if the gun is small and can only fit the small gun cell @@ -23,7 +23,7 @@ cell = new cell_type(src) else cell = new(src) - update_icon() + update_appearance() /obj/item/gun/ballistic/automatic/powered/examine(mob/user) . = ..() @@ -75,7 +75,7 @@ cell = C to_chat(user, "You load [C] into [src].") playsound(src, load_sound, sound_volume, load_sound_vary) - update_icon() + update_appearance() return TRUE else to_chat(user, "You cannot seem to get [src] out of your hands!") @@ -87,9 +87,9 @@ var/obj/item/stock_parts/cell/gun/old_cell = cell cell = null user.put_in_hands(old_cell) - old_cell.update_icon() + old_cell.update_appearance() to_chat(user, "You pull the cell out of \the [src].") - update_icon() + update_appearance() /obj/item/gun/ballistic/automatic/powered/screwdriver_act(mob/living/user, obj/item/I) if(cell && !internal_cell && !bayonet && (!gun_light || !can_flashlight)) diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index 33a917976d93..93e3de355636 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -417,7 +417,7 @@ for(var/atom/movable/AM in contents) locker_temp_instance.insert(AM) locker_temp_instance.welded = weld - locker_temp_instance.update_icon() + locker_temp_instance.update_appearance() created = TRUE return ..() @@ -444,7 +444,7 @@ if(!welded) return icon_state = magic_icon - update_icon() + update_appearance() /obj/structure/closet/decay/after_weld(weld_state) if(weld_state) @@ -464,7 +464,7 @@ /obj/structure/closet/decay/proc/unmagify() icon_state = weakened_icon - update_icon() + update_appearance() addtimer(CALLBACK(src, .proc/decay), 15 SECONDS) icon_welded = "welded" @@ -555,7 +555,7 @@ for(var/obj/effect/proc_holder/spell/spell in L.mind.spell_list) spell.charge_counter = spell.charge_max spell.recharging = FALSE - spell.update_icon() + spell.update_appearance() /obj/projectile/magic/fortify name = "bolt of light" @@ -580,7 +580,7 @@ for(var/obj/effect/proc_holder/spell/spell in L.mind.spell_list) spell.charge_counter = spell.charge_max spell.recharging = FALSE - spell.update_icon() + spell.update_appearance() /obj/projectile/magic/wipe name = "bolt of possession" diff --git a/code/modules/projectiles/projectile/reusable/foam_dart.dm b/code/modules/projectiles/projectile/reusable/foam_dart.dm index b1a59272a917..b3ac21660412 100644 --- a/code/modules/projectiles/projectile/reusable/foam_dart.dm +++ b/code/modules/projectiles/projectile/reusable/foam_dart.dm @@ -6,6 +6,7 @@ nodamage = TRUE icon = 'icons/obj/guns/toy.dmi' icon_state = "foamdart_proj" + base_icon_state = "foamdart_proj" ammo_type = /obj/item/ammo_casing/caseless/foam_dart range = 10 var/modified = FALSE @@ -27,7 +28,7 @@ newdart.pen = pen pen.forceMove(newdart) pen = null - newdart.update_icon() + newdart.update_appearance() /obj/projectile/bullet/reusable/foam_dart/Destroy() @@ -37,6 +38,7 @@ /obj/projectile/bullet/reusable/foam_dart/riot name = "riot foam dart" icon_state = "foamdart_riot_proj" + base_icon_state = "foamdart_riot_proj" ammo_type = /obj/item/ammo_casing/caseless/foam_dart/riot nodamage = FALSE stamina = 25 diff --git a/code/modules/projectiles/projectile/special/curse.dm b/code/modules/projectiles/projectile/special/curse.dm index 1993176de157..8001593d86a7 100644 --- a/code/modules/projectiles/projectile/special/curse.dm +++ b/code/modules/projectiles/projectile/special/curse.dm @@ -22,6 +22,7 @@ /obj/projectile/curse_hand/update_icon_state() icon_state = "[initial(icon_state)][handedness]" + return ..() /obj/projectile/curse_hand/fire(setAngle) if(starting) diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index e7e117277fdc..0985ce758976 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -17,6 +17,7 @@ density = TRUE icon = 'icons/obj/chemical.dmi' icon_state = "dispenser" + base_icon_state = "dispenser" use_power = IDLE_POWER_USE idle_power_usage = 40 interaction_flags_machine = INTERACT_MACHINE_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OFFLINE @@ -93,7 +94,7 @@ upgrade_reagents = sortList(upgrade_reagents, /proc/cmp_reagents_asc) if(is_operational) begin_processing() - update_icon() + update_appearance() /obj/machinery/chem_dispenser/Destroy() QDEL_NULL(beaker) @@ -137,12 +138,12 @@ flick(working_state,src) /obj/machinery/chem_dispenser/update_icon_state() - icon_state = "[(nopower_state && !powered()) ? nopower_state : initial(icon_state)]" - + icon_state = "[(nopower_state && !powered()) ? nopower_state : base_icon_state]" + return ..() /obj/machinery/chem_dispenser/update_overlays() . = ..() if(has_panel_overlay && panel_open) - . += mutable_appearance(icon, "[initial(icon_state)]_panel-o") + . += mutable_appearance(icon, "[base_icon_state]_panel-o") if(beaker) beaker_overlay = display_beaker() @@ -338,7 +339,7 @@ if(default_unfasten_wrench(user, I)) return if(default_deconstruction_screwdriver(user, icon_state, icon_state, I)) - update_icon() + update_appearance() return if(default_deconstruction_crowbar(I)) return @@ -404,7 +405,7 @@ beaker = null if(new_beaker) beaker = new_beaker - update_icon() + update_appearance() return TRUE /obj/machinery/chem_dispenser/on_deconstruction() @@ -428,7 +429,7 @@ var/old = dir . = ..() if(dir != old) - update_icon() // the beaker needs to be re-positioned if we rotate + update_appearance() // the beaker needs to be re-positioned if we rotate /obj/machinery/chem_dispenser/drinks/display_beaker() var/mutable_appearance/b_o = beaker_overlay || mutable_appearance(icon, "disp_beaker") @@ -452,6 +453,7 @@ desc = "Contains a large reservoir of soft drinks." icon = 'icons/obj/chemical.dmi' icon_state = "soda_dispenser" + base_icon_state = "soda_dispenser" has_panel_overlay = FALSE amount = 10 pixel_y = 6 @@ -506,6 +508,7 @@ /obj/machinery/chem_dispenser/drinks/beer name = "booze dispenser" desc = "Contains a large reservoir of the good stuff." + base_icon_state = "booze_dispenser" icon = 'icons/obj/chemical.dmi' icon_state = "booze_dispenser" circuit = /obj/item/circuitboard/machine/chem_dispenser/drinks/beer @@ -607,6 +610,7 @@ desc = "Synthesizes a variety of reagents using proto-matter." icon = 'icons/obj/abductor.dmi' icon_state = "chem_dispenser" + base_icon_state = "chem_dispenser" has_panel_overlay = FALSE circuit = /obj/item/circuitboard/machine/chem_dispenser/abductor working_state = null diff --git a/code/modules/reagents/chemistry/machinery/chem_heater.dm b/code/modules/reagents/chemistry/machinery/chem_heater.dm index aed9750934de..b3a0cfee615d 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -3,6 +3,7 @@ density = TRUE icon = 'icons/obj/chemical.dmi' icon_state = "mixer0b" + base_icon_state = "mixer" use_power = IDLE_POWER_USE idle_power_usage = 40 resistance_flags = FIRE_PROOF | ACID_PROOF @@ -21,13 +22,11 @@ . = ..() if(A == beaker) beaker = null - update_icon() + update_appearance() /obj/machinery/chem_heater/update_icon_state() - if(beaker) - icon_state = "mixer1b" - else - icon_state = "mixer0b" + icon_state = "[base_icon_state][beaker ? 1 : 0]b" + return ..() /obj/machinery/chem_heater/AltClick(mob/living/user) . = ..() @@ -46,7 +45,7 @@ beaker = null if(new_beaker) beaker = new_beaker - update_icon() + update_appearance() return TRUE /obj/machinery/chem_heater/RefreshParts() @@ -84,7 +83,7 @@ replace_beaker(user, B) to_chat(user, "You add [B] to [src].") updateUsrDialog() - update_icon() + update_appearance() return return ..() diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index 0dfce60863ef..602c37710a57 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -5,6 +5,7 @@ layer = BELOW_OBJ_LAYER icon = 'icons/obj/chemical.dmi' icon_state = "mixer0" + base_icon_state = "mixer" use_power = IDLE_POWER_USE idle_power_usage = 20 resistance_flags = FIRE_PROOF | ACID_PROOF @@ -72,15 +73,13 @@ if(A == beaker) beaker = null reagents.clear_reagents() - update_icon() + update_appearance() else if(A == bottle) bottle = null /obj/machinery/chem_master/update_icon_state() - if(beaker) - icon_state = "mixer1" - else - icon_state = "mixer0" + icon_state = "[base_icon_state][beaker ? 1 : 0]" + return ..() /obj/machinery/chem_master/update_overlays() . = ..() @@ -112,7 +111,7 @@ replace_beaker(user, B) to_chat(user, "You add [B] to [src].") updateUsrDialog() - update_icon() + update_appearance() else if(!condi && istype(I, /obj/item/storage/pill_bottle)) if(bottle) to_chat(user, "A pill bottle is already loaded into [src]!") @@ -142,7 +141,7 @@ beaker = null if(new_beaker) beaker = new_beaker - update_icon() + update_appearance() return TRUE /obj/machinery/chem_master/on_deconstruction() diff --git a/code/modules/reagents/chemistry/machinery/chem_synthesizer.dm b/code/modules/reagents/chemistry/machinery/chem_synthesizer.dm index ffe0e57a26a7..2c6f5ed38186 100644 --- a/code/modules/reagents/chemistry/machinery/chem_synthesizer.dm +++ b/code/modules/reagents/chemistry/machinery/chem_synthesizer.dm @@ -3,6 +3,7 @@ desc = "If you see this, yell at adminbus." icon = 'icons/obj/chemical.dmi' icon_state = "dispenser" + base_icon_state = "dispenser" amount = 10 resistance_flags = INDESTRUCTIBLE | FIRE_PROOF | ACID_PROOF | LAVA_PROOF flags_1 = NODECONSTRUCT_1 @@ -58,7 +59,7 @@ var/input = text2num(params["amount"]) if(input) amount = input - update_icon() + update_appearance() /obj/machinery/chem_dispenser/chem_synthesizer/proc/find_reagent(input) . = FALSE diff --git a/code/modules/reagents/chemistry/machinery/pandemic.dm b/code/modules/reagents/chemistry/machinery/pandemic.dm index 657e9a5bc57c..eb01cf28b714 100644 --- a/code/modules/reagents/chemistry/machinery/pandemic.dm +++ b/code/modules/reagents/chemistry/machinery/pandemic.dm @@ -7,6 +7,7 @@ density = TRUE icon = 'icons/obj/chemical.dmi' icon_state = "pandemic0" + base_icon_state = "pandemic" use_power = TRUE idle_power_usage = 20 resistance_flags = ACID_PROOF @@ -19,7 +20,7 @@ /obj/machinery/computer/pandemic/Initialize() . = ..() - update_icon() + update_appearance() /obj/machinery/computer/pandemic/Destroy() QDEL_NULL(beaker) @@ -44,7 +45,7 @@ /obj/machinery/computer/pandemic/handle_atom_del(atom/A) if(A == beaker) beaker = null - update_icon() + update_appearance() return ..() /obj/machinery/computer/pandemic/proc/get_by_index(thing, index) @@ -124,14 +125,12 @@ /obj/machinery/computer/pandemic/proc/reset_replicator_cooldown() wait = FALSE - update_icon() + update_appearance() playsound(src, 'sound/machines/ping.ogg', 30, TRUE) /obj/machinery/computer/pandemic/update_icon_state() - if(machine_stat & BROKEN) - icon_state = (beaker ? "pandemic1_b" : "pandemic0_b") - else - icon_state = "pandemic[(beaker) ? "1" : "0"][powered() ? "" : "_nopower"]" + icon_state = "[base_icon_state][beaker ? 1 : 0][(machine_stat & BROKEN) ? "_b" : (powered() ? null : "_nopower")]" + return ..() /obj/machinery/computer/pandemic/update_overlays() . = ..() @@ -142,7 +141,7 @@ if(beaker) beaker.forceMove(drop_location()) beaker = null - update_icon() + update_appearance() /obj/machinery/computer/pandemic/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) @@ -215,7 +214,7 @@ B.desc = "A small bottle. Contains [A.agent] culture in synthblood medium." B.reagents.add_reagent(/datum/reagent/blood, 20, data) wait = TRUE - update_icon() + update_appearance() var/turf/source_turf = get_turf(src) log_virus("A culture bottle was printed for the virus [A.admin_details()] at [loc_name(source_turf)] by [key_name(usr)]") addtimer(CALLBACK(src, .proc/reset_replicator_cooldown), 50) @@ -229,7 +228,7 @@ B.name = "[D.name] vaccine bottle" B.reagents.add_reagent(/datum/reagent/vaccine, 15, list(id)) wait = TRUE - update_icon() + update_appearance() addtimer(CALLBACK(src, .proc/reset_replicator_cooldown), 200) . = TRUE @@ -247,7 +246,7 @@ beaker = I to_chat(user, "You insert [I] into [src].") - update_icon() + update_appearance() else return ..() diff --git a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm index c9784c14ee75..b638c82fef78 100644 --- a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm +++ b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm @@ -5,6 +5,7 @@ desc = "From BlenderTech. Will It Blend? Let's test it out!" icon = 'icons/obj/kitchen.dmi' icon_state = "juicer1" + base_icon_state = "juicer" layer = BELOW_OBJ_LAYER use_power = IDLE_POWER_USE idle_power_usage = 5 @@ -34,7 +35,7 @@ . = ..() holdingitems = list() QDEL_NULL(beaker) - update_icon() + update_appearance() /obj/machinery/reagentgrinder/Destroy() if(beaker) @@ -92,7 +93,7 @@ . = ..() if(A == beaker) beaker = null - update_icon() + update_appearance() if(holdingitems[A]) holdingitems -= A @@ -103,10 +104,8 @@ holdingitems = list() /obj/machinery/reagentgrinder/update_icon_state() - if(beaker) - icon_state = "juicer1" - else - icon_state = "juicer0" + icon_state = "[base_icon_state][beaker ? 1 : 0]" + return ..() /obj/machinery/reagentgrinder/proc/replace_beaker(mob/living/user, obj/item/reagent_containers/new_beaker) if(!user || !can_interact(user)) @@ -119,7 +118,7 @@ beaker = null if(new_beaker) beaker = new_beaker - update_icon() + update_appearance() return TRUE /obj/machinery/reagentgrinder/attackby(obj/item/I, mob/user, params) @@ -143,7 +142,7 @@ return replace_beaker(user, B) to_chat(user, "You add [B] to [src].") - update_icon() + update_appearance() return TRUE //no afterattack if(holdingitems.len >= limit) diff --git a/code/modules/reagents/chemistry/machinery/smoke_machine.dm b/code/modules/reagents/chemistry/machinery/smoke_machine.dm index 9c31dd039669..7c67609593d5 100644 --- a/code/modules/reagents/chemistry/machinery/smoke_machine.dm +++ b/code/modules/reagents/chemistry/machinery/smoke_machine.dm @@ -5,6 +5,7 @@ desc = "A machine with a centrifuge installed into it. It produces smoke with any reagents you put into the machine." icon = 'icons/obj/chemical.dmi' icon_state = "smoke0" + base_icon_state = "smoke" density = TRUE circuit = /obj/item/circuitboard/machine/smoke_machine processing_flags = NONE @@ -42,12 +43,10 @@ /obj/machinery/smoke_machine/update_icon_state() if((!is_operational) || (!on) || (reagents.total_volume == 0)) - if (panel_open) - icon_state = "smoke0-o" - else - icon_state = "smoke0" - else - icon_state = "smoke1" + icon_state = "[base_icon_state]0[panel_open ? "-o" : null]" + return ..() + icon_state = "[base_icon_state]1" + return ..() /obj/machinery/smoke_machine/RefreshParts() var/new_volume = REAGENTS_BASE_VOLUME @@ -79,12 +78,12 @@ ..() if(reagents.total_volume == 0) on = FALSE - update_icon() + update_appearance() return var/turf/T = get_turf(src) var/smoke_test = locate(/obj/effect/particle_effect/smoke) in T if(on && !smoke_test) - update_icon() + update_appearance() var/datum/effect_system/smoke_spread/chem/smoke_machine/smoke = new() smoke.set_up(reagents, setting*3, efficiency, T) smoke.start() @@ -142,7 +141,7 @@ switch(action) if("purge") reagents.clear_reagents() - update_icon() + update_appearance() . = TRUE if("setting") var/amount = text2num(params["amount"]) @@ -151,7 +150,7 @@ . = TRUE if("power") on = !on - update_icon() + update_appearance() if(on) message_admins("[ADMIN_LOOKUPFLW(usr)] activated a smoke machine that contains [english_list(reagents.reagent_list)] at [ADMIN_VERBOSEJMP(src)].") log_game("[key_name(usr)] activated a smoke machine that contains [english_list(reagents.reagent_list)] at [AREACOORD(src)].") diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm index a81add0b3d52..4c150a53f299 100644 --- a/code/modules/reagents/chemistry/reagents/other_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm @@ -2721,7 +2721,7 @@ O.transfer_fingerprints_to(conc_floor) conc_floor.harden_lvl = 0 conc_floor.check_harden() - conc_floor.update_icon() + conc_floor.update_appearance() qdel(O) return diff --git a/code/modules/reagents/chemistry/recipes/special.dm b/code/modules/reagents/chemistry/recipes/special.dm index 957543f83c0a..f0aeaf8504cd 100644 --- a/code/modules/reagents/chemistry/recipes/special.dm +++ b/code/modules/reagents/chemistry/recipes/special.dm @@ -207,4 +207,4 @@ GLOBAL_LIST_INIT(food_reagents, build_reagents_to_food()) //reagentid = related dat += " above [recipe.required_temp] degrees" dat += "." default_raw_text = dat.Join("") - update_icon() + update_appearance() diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 527f559dedd9..0d583cb5a16f 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -60,7 +60,7 @@ cap_on = FALSE spillable = TRUE - update_icon() + update_appearance() /obj/item/reagent_containers/examine(mob/user) . = ..() @@ -254,7 +254,7 @@ return ..() /obj/item/reagent_containers/on_reagent_change(changetype) - update_icon() + update_appearance() /obj/item/reagent_containers/update_overlays() . = ..() @@ -262,19 +262,21 @@ . += cap_overlay if(!fill_icon_thresholds) return - if(reagents.total_volume) - var/fill_name = fill_icon_state? fill_icon_state : icon_state - var/mutable_appearance/filling = mutable_appearance(fill_icon, "[fill_name][fill_icon_thresholds[1]]") - - var/percent = round((reagents.total_volume / volume) * 100) - for(var/i in 1 to fill_icon_thresholds.len) - var/threshold = fill_icon_thresholds[i] - var/threshold_end = (i == fill_icon_thresholds.len)? INFINITY : fill_icon_thresholds[i+1] - if(threshold <= percent && percent < threshold_end) - filling.icon_state = "[fill_name][fill_icon_thresholds[i]]" - - filling.color = mix_color_from_reagents(reagents.reagent_list) - . += filling + if(!reagents.total_volume) + return + + var/fill_name = fill_icon_state? fill_icon_state : icon_state + var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "[fill_name][fill_icon_thresholds[1]]") + + var/percent = round((reagents.total_volume / volume) * 100) + for(var/i in 1 to fill_icon_thresholds.len) + var/threshold = fill_icon_thresholds[i] + var/threshold_end = (i == fill_icon_thresholds.len)? INFINITY : fill_icon_thresholds[i+1] + if(threshold <= percent && percent < threshold_end) + filling.icon_state = "[fill_name][fill_icon_thresholds[i]]" + + filling.color = mix_color_from_reagents(reagents.reagent_list) + . += filling /obj/item/reagent_containers/get_save_vars() //Leave it null. diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index c1aea0bd5ef7..a7a43f4b7109 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -13,7 +13,7 @@ . = ..() if(blood_type != null) reagents.add_reagent(unique_blood ? unique_blood : /datum/reagent/blood, 200, list("viruses"=null,"blood_DNA"=null,"blood_type"=get_blood_type(blood_type),"resistances"=null,"trace_chem"=null)) - update_icon() + update_appearance() /obj/item/reagent_containers/blood/on_reagent_change(changetype) if(reagents) @@ -22,10 +22,11 @@ blood_type = B.data["blood_type"] else blood_type = null - update_pack_name() - update_icon() + update_name() + update_appearance() -/obj/item/reagent_containers/blood/proc/update_pack_name() +/obj/item/reagent_containers/blood/update_name(updates) + . = ..() if(!labelled) if(blood_type) name = "blood pack[blood_type ? " - [unique_blood ? blood_type : blood_type.name]" : null]" @@ -88,6 +89,6 @@ name = "blood pack - [t]" else labelled = 0 - update_pack_name() + update_name() else return ..() diff --git a/code/modules/reagents/reagent_containers/borghydro.dm b/code/modules/reagents/reagent_containers/borghydro.dm index 50506a0d5984..a4cd49a131fb 100644 --- a/code/modules/reagents/reagent_containers/borghydro.dm +++ b/code/modules/reagents/reagent_containers/borghydro.dm @@ -53,7 +53,7 @@ Borg Hypospray regenerate_reagents() charge_tick = 0 - //update_icon() + //update_appearance() return 1 // Use this to add more chemicals for the borghypo to produce. diff --git a/code/modules/reagents/reagent_containers/dropper.dm b/code/modules/reagents/reagent_containers/dropper.dm index 1d3fde300b12..63acf014b214 100644 --- a/code/modules/reagents/reagent_containers/dropper.dm +++ b/code/modules/reagents/reagent_containers/dropper.dm @@ -44,7 +44,7 @@ "[user] tries to squirt something into your eyes, but fails!") to_chat(user, "You transfer [trans] unit\s of the solution.") - update_icon() + update_appearance() return else if(isalien(target)) //hiss-hiss has no eyes! to_chat(target, "[target] does not seem to have any eyes!") @@ -64,7 +64,7 @@ trans = src.reagents.trans_to(target, amount_per_transfer_from_this, transfered_by = user) to_chat(user, "You transfer [trans] unit\s of the solution.") - update_icon() + update_appearance() else @@ -80,11 +80,12 @@ to_chat(user, "You fill [src] with [trans] unit\s of the solution.") - update_icon() + update_appearance() /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) - . += filling + if(!reagents.total_volume) + return + var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "dropper") + filling.color = mix_color_from_reagents(reagents.reagent_list) + . += filling diff --git a/code/modules/reagents/reagent_containers/hypospray.dm b/code/modules/reagents/reagent_containers/hypospray.dm index e37086e77d6b..1e2a7126de70 100644 --- a/code/modules/reagents/reagent_containers/hypospray.dm +++ b/code/modules/reagents/reagent_containers/hypospray.dm @@ -95,14 +95,13 @@ desc = "A modified air-needle autoinjector for use in combat situations. Prefilled with experimental medical nanites and a stimulant for rapid healing and a combat boost." item_state = "nanite_hypo" icon_state = "nanite_hypo" + base_icon_state = "nanite_hypo" volume = 100 list_reagents = list(/datum/reagent/medicine/adminordrazine/quantum_heal = 80, /datum/reagent/medicine/synaptizine = 20) /obj/item/reagent_containers/hypospray/combat/nanites/update_icon_state() - if(reagents.total_volume > 0) - icon_state = initial(icon_state) - else - icon_state = "[initial(icon_state)]0" + icon_state = "[base_icon_state][(reagents.total_volume > 0) ? null : 0]" + return ..() /obj/item/reagent_containers/hypospray/combat/heresypurge name = "holy water piercing injector" @@ -120,6 +119,7 @@ desc = "A rapid and safe way to stabilize patients in critical condition for personnel without advanced medical knowledge. Contains a powerful preservative that can delay decomposition when applied to a dead body." icon_state = "medipen" item_state = "medipen" + base_icon_state = "medipen" lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi' amount_per_transfer_from_this = 13 @@ -136,17 +136,15 @@ if(.) reagents.maximum_volume = 0 //Makes them useless afterwards reagents.flags = NONE - update_icon() + update_appearance() /obj/item/reagent_containers/hypospray/medipen/attack_self(mob/user) if(user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK)) inject(user, user) /obj/item/reagent_containers/hypospray/medipen/update_icon_state() - if(reagents.total_volume > 0) - icon_state = initial(icon_state) - else - icon_state = "[initial(icon_state)]0" + icon_state = "[base_icon_state][(reagents.total_volume > 0) ? null : 0]" + return ..() /obj/item/reagent_containers/hypospray/medipen/examine() . = ..() @@ -173,6 +171,7 @@ name = "crisis stimpack" icon_state = "stimpen" item_state = "stimpen" + base_icon_state = "stimpen" desc = "A modified stimulant autoinjector, containing a cocktail of potent nerve excitants and long-release healing chemicals. Designed for use in emergency situations where medical help may be hours or days away." list_reagents = list(/datum/reagent/medicine/stimulants = 5, /datum/reagent/medicine/ephedrine = 5, /datum/reagent/medicine/omnizine = 15) @@ -181,6 +180,7 @@ desc = "Contains a very large amount of an incredibly powerful stimulant, vastly increasing your movement speed and reducing stuns by a very large amount for around five minutes. Do not take if pregnant." icon_state = "syndipen" item_state = "tbpen" + base_icon_state = "syndipen" volume = 50 amount_per_transfer_from_this = 50 list_reagents = list(/datum/reagent/medicine/stimulants = 50) @@ -189,6 +189,7 @@ name = "morphine medipen" desc = "A rapid way to get you out of a tight situation and fast! You'll feel rather drowsy, though." icon_state = "morphen" + base_icon_state = "morphen" item_state = "morphen" list_reagents = list(/datum/reagent/medicine/morphine = 10) @@ -197,6 +198,7 @@ desc = "A autoinjector containing oxandrolone, used to treat severe burns." icon_state = "oxapen" item_state = "oxapen" + base_icon_state = "oxapen" list_reagents = list(/datum/reagent/medicine/oxandrolone = 10) /obj/item/reagent_containers/hypospray/medipen/penacid @@ -204,6 +206,7 @@ desc = "A autoinjector containing pentetic acid, used to reduce high levels of radiations and moderate toxins." icon_state = "penacid" item_state = "penacid" + base_icon_state = "penacid" list_reagents = list(/datum/reagent/medicine/pen_acid = 10) /obj/item/reagent_containers/hypospray/medipen/salacid @@ -211,6 +214,7 @@ desc = "A autoinjector containing salicylic acid, used to treat severe brute damage." icon_state = "salacid" item_state = "salacid" + base_icon_state = "salacid" list_reagents = list(/datum/reagent/medicine/sal_acid = 10) /obj/item/reagent_containers/hypospray/medipen/salbutamol @@ -218,6 +222,7 @@ desc = "A autoinjector containing salbutamol, used to heal oxygen damage quickly." icon_state = "salpen" item_state = "salpen" + base_icon_state = "salpen" list_reagents = list(/datum/reagent/medicine/salbutamol = 10) /obj/item/reagent_containers/hypospray/medipen/tuberculosiscure @@ -225,17 +230,17 @@ desc = "Bio Virus Antidote Kit autoinjector. Has a two use system for yourself, and someone else. Inject when infected." icon_state = "tbpen" item_state = "tbpen" + base_icon_state = "tbpen" volume = 20 amount_per_transfer_from_this = 10 list_reagents = list(/datum/reagent/vaccine/fungal_tb = 20) /obj/item/reagent_containers/hypospray/medipen/tuberculosiscure/update_icon_state() + . = ..() if(reagents.total_volume > 30) - icon_state = initial(icon_state) - else if (reagents.total_volume > 0) - icon_state = "[initial(icon_state)]1" - else - icon_state = "[initial(icon_state)]0" + icon_state = base_icon_state + return + icon_state = "[base_icon_state][(reagents.total_volume > 0) ? 1 : 0]" /* Replaced with variant in whitesands/code/modules/reagents/reagent_containers/hypospray.dm /obj/item/reagent_containers/hypospray/medipen/survival @@ -252,6 +257,7 @@ desc = "A rapid way to save a person from a critical injury state!" icon_state = "atropen" item_state = "atropen" + base_icon_state = "atropen" list_reagents = list(/datum/reagent/medicine/atropine = 10) /obj/item/reagent_containers/hypospray/medipen/snail @@ -259,6 +265,7 @@ desc = "All-purpose snail medicine! Do not use on non-snails!" icon_state = "snail" item_state = "snail" + base_icon_state = "gorillapen" list_reagents = list(/datum/reagent/snail = 10) /obj/item/reagent_containers/hypospray/medipen/magillitis @@ -266,6 +273,7 @@ desc = "A custom-frame needle injector with a small single-use reservoir, containing an experimental serum. Unlike the more common medipen frame, it cannot pierce through protective armor or hardsuits, nor can the chemical inside be extracted." icon_state = "gorillapen" item_state = "gorillapen" + base_icon_state = "gorillapen" volume = 5 ignore_flags = 0 reagent_flags = NONE @@ -278,7 +286,7 @@ amount_per_transfer_from_this = 15 list_reagents = list(/datum/reagent/drug/pumpup = 15) icon_state = "maintenance" - + base_icon_state = "maintenance" /obj/item/reagent_containers/hypospray/medipen/bonefixingjuice name = "rejuvenating agent injector" @@ -350,13 +358,13 @@ /obj/item/hypospray/mkii/Initialize() . = ..() if(!spawnwithvial) - update_icon() + update_appearance() return if(start_vial) vial = new start_vial - update_icon() + update_appearance() -/obj/item/hypospray/mkii/update_icon() +/obj/item/hypospray/mkii/update_appearance() ..() icon_state = "[initial(icon_state)][vial ? "" : "-e"]" if(ismob(loc)) @@ -379,7 +387,7 @@ user.put_in_hands(V) to_chat(user, "You remove [vial] from [src].") vial = null - update_icon() + update_appearance() playsound(loc, 'sound/weapons/empty.ogg', 50, 1) else to_chat(user, "This hypo isn't loaded!") @@ -400,7 +408,7 @@ return FALSE vial = V user.visible_message("[user] has loaded a vial into [src].","You have loaded [vial] into [src].") - update_icon() + update_appearance() playsound(loc, 'sound/weapons/autoguninsert.ogg', 35, 1) return TRUE else @@ -582,6 +590,7 @@ desc = "A medical cocktail for surviving in the harshest of environments, quickly heals and inhibits pain to help overcome extreme conditions. WARNING: Frequent use has long-term side effects." icon_state = "stimpen" item_state = "stimpen" + base_icon_state = "stimpen" custom_price = 500 volume = 35 amount_per_transfer_from_this = 36 diff --git a/code/modules/reagents/reagent_containers/hypovial.dm b/code/modules/reagents/reagent_containers/hypovial.dm index a63e98ba58c7..f16984cd7e5b 100644 --- a/code/modules/reagents/reagent_containers/hypovial.dm +++ b/code/modules/reagents/reagent_containers/hypovial.dm @@ -28,13 +28,13 @@ icon_state = "hypovial" for(var/R in comes_with) reagents.add_reagent(R,comes_with[R]) - update_icon() + update_appearance() /obj/item/reagent_containers/glass/bottle/vial/on_reagent_change() - update_icon() + update_appearance() -/obj/item/reagent_containers/glass/bottle/vial/update_icon() +/obj/item/reagent_containers/glass/bottle/vial/update_appearance() cut_overlays() if(reagents.total_volume) var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "hypovial10") @@ -54,6 +54,7 @@ filling.color = mix_color_from_reagents(reagents.reagent_list) add_overlay(filling) + return ..() /obj/item/reagent_containers/glass/bottle/vial/tiny name = "small hypovial" @@ -86,7 +87,7 @@ "large black hypovial" = "hypoviallarge-t" ) -/obj/item/reagent_containers/glass/bottle/vial/large/update_icon() +/obj/item/reagent_containers/glass/bottle/vial/large/update_appearance() cut_overlays() if(reagents.total_volume) var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "hypoviallarge10") @@ -106,6 +107,7 @@ filling.color = mix_color_from_reagents(reagents.reagent_list) add_overlay(filling) + return ..() /obj/item/reagent_containers/glass/bottle/vial/large/bluespace possible_transfer_amounts = list(5,10,15,20) diff --git a/code/modules/reagents/reagent_containers/maunamug.dm b/code/modules/reagents/reagent_containers/maunamug.dm index 39289d71c07a..bed7808dc795 100644 --- a/code/modules/reagents/reagent_containers/maunamug.dm +++ b/code/modules/reagents/reagent_containers/maunamug.dm @@ -3,6 +3,7 @@ desc = "A drink served in a classy mug. Now with built-in heating!" icon = 'icons/obj/mauna_mug.dmi' icon_state = "maunamug" + base_icon_state = "maunamug" spillable = TRUE reagent_flags = OPENCONTAINER fill_icon_state = "maunafilling" @@ -32,7 +33,7 @@ var/max_temp = min(500 + (500 * (0.2 * cell.rating)), 1000) // 373 to 1000 reagents.adjust_thermal_energy(0.8 * cell.maxcharge * reagents.total_volume, max_temp = max_temp) // 4 kelvin every tick on a basic cell. 160k on bluespace reagents.handle_reactions() - update_icon() + update_appearance() if(reagents.chem_temp >= max_temp) change_power_status(FALSE) audible_message("The Mauna Mug lets out a happy beep and turns off!") @@ -59,13 +60,13 @@ START_PROCESSING(SSobj, src) else STOP_PROCESSING(SSobj, src) - update_icon() + update_appearance() /obj/item/reagent_containers/glass/maunamug/screwdriver_act(mob/living/user, obj/item/I) . = ..() open = !open to_chat(user, "You screw the battery case on [src] [open ? "open" : "closed"] .") - update_icon() + update_appearance() /obj/item/reagent_containers/glass/maunamug/attackby(obj/item/I, mob/user, params) add_fingerprint(user) @@ -81,32 +82,32 @@ return cell = I user.visible_message("[user] inserts a power cell into [src].", "You insert the power cell into [src].") - update_icon() + update_appearance() /obj/item/reagent_containers/glass/maunamug/attack_hand(mob/living/user) if(cell && open) - cell.update_icon() + cell.update_appearance() user.put_in_hands(cell) cell = null to_chat(user, "You remove the power cell from [src].") on = FALSE - update_icon() + update_appearance() return TRUE return ..() -/obj/item/reagent_containers/glass/maunamug/update_icon() - ..() +/obj/item/reagent_containers/glass/maunamug/update_icon_state() if(open) - if(cell) - icon_state = "maunamug_bat" - else - icon_state = "maunamug_no_bat" - else if(on) - icon_state = "maunamug_on" - else - icon_state = "maunamug" - if(reagents.total_volume && reagents.chem_temp >= 400) - var/intensity = (reagents.chem_temp - 400) * 1 / 600 //Get the opacity of the incandescent overlay. Ranging from 400 to 1000 - var/mutable_appearance/mug_glow = mutable_appearance(icon, "maunamug_incand") - mug_glow.alpha = 255 * intensity - add_overlay(mug_glow) + icon_state = "[base_icon_state][cell ? null : "_no"]_bat" + return ..() + icon_state = "[base_icon_state][on ? "_on" : null]" + return ..() + +/obj/item/reagent_containers/glass/maunamug/update_overlays() + . = ..() + if(!reagents.total_volume || reagents.chem_temp < 400) + return + + var/intensity = (reagents.chem_temp - 400) * 1 / 600 //Get the opacity of the incandescent overlay. Ranging from 400 to 1000 + var/mutable_appearance/mug_glow = mutable_appearance(icon, "maunamug_incand") + mug_glow.alpha = 255 * intensity + . += mug_glow diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm index 1d1e7ca46879..021d37cd61b0 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -20,31 +20,31 @@ . = ..() if(list_reagents) //syringe starts in inject mode if its already got something inside mode = SYRINGE_INJECT - update_icon() + update_appearance() /obj/item/reagent_containers/syringe/ComponentInitialize() . = ..() AddElement(/datum/element/update_icon_updates_onmob) /obj/item/reagent_containers/syringe/on_reagent_change(changetype) - update_icon() + update_appearance() /obj/item/reagent_containers/syringe/pickup(mob/user) ..() - update_icon() + update_appearance() /obj/item/reagent_containers/syringe/dropped(mob/user) ..() - update_icon() + update_appearance() /obj/item/reagent_containers/syringe/attack_self(mob/user) mode = !mode - update_icon() + update_appearance() //ATTACK HAND IGNORING PARENT RETURN VALUE /obj/item/reagent_containers/syringe/attack_hand() . = ..() - update_icon() + update_appearance() /obj/item/reagent_containers/syringe/attack_paw(mob/user) return attack_hand(user) @@ -111,7 +111,7 @@ to_chat(user, "You fill [src] with [trans] units of the solution. It now contains [reagents.total_volume] units.") if (reagents.total_volume >= reagents.maximum_volume) mode=!mode - update_icon() + update_appearance() if(SYRINGE_INJECT) // Always log attemped injections for admins @@ -153,17 +153,18 @@ to_chat(user, "You inject [amount_per_transfer_from_this] units of the solution. The syringe now contains [reagents.total_volume] units.") if (reagents.total_volume <= 0 && mode==SYRINGE_INJECT) mode = SYRINGE_DRAW - update_icon() + update_appearance() /obj/item/reagent_containers/syringe/update_icon_state() var/rounded_vol = get_rounded_vol() icon_state = "[base_icon_state]_[rounded_vol]" + item_state = "[base_icon_state]_[rounded_vol]" + return ..() /obj/item/reagent_containers/syringe/update_overlays() . = ..() - var/rounded_vol = get_rounded_vol() if(reagents && reagents.total_volume) - var/mutable_appearance/filling_overlay = mutable_appearance('icons/obj/reagentfillings.dmi', "syringe[rounded_vol]") + var/mutable_appearance/filling_overlay = mutable_appearance('icons/obj/reagentfillings.dmi', "syringe[get_rounded_vol()]") filling_overlay.color = mix_color_from_reagents(reagents.reagent_list) . += filling_overlay if(ismob(loc)) @@ -175,12 +176,11 @@ injoverlay = "inject" . += injoverlay -///Used by update_icon() and update_overlays() +///Used by update_appearance() 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 + if(!reagents?.total_volume) return 0 + return clamp(round((reagents.total_volume / volume * 15), 5), 1, 15) /obj/item/reagent_containers/syringe/epinephrine name = "syringe (epinephrine)" diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm index 0901478a49a9..84a8292f7263 100644 --- a/code/modules/reagents/reagent_dispenser.dm +++ b/code/modules/reagents/reagent_dispenser.dm @@ -102,7 +102,7 @@ reagents.trans_to(W, W.max_fuel, transfered_by = user) user.visible_message("[user] refills [user.p_their()] [W.name].", "You refill [W].") playsound(src, 'sound/effects/refill.ogg', 50, TRUE) - W.update_icon() + W.update_appearance() else user.visible_message("[user] catastrophically fails at refilling [user.p_their()] [I.name]!", "That was stupid of you.") log_bomber(user, "detonated a", src, "via welding tool") diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm index 4afd8a077c28..7a4e79f9e40c 100644 --- a/code/modules/recycling/conveyor2.dm +++ b/code/modules/recycling/conveyor2.dm @@ -8,6 +8,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) icon_state = "conveyor_map" name = "conveyor belt" desc = "A conveyor belt." + base_icon_state = "conveyor" layer = BELOW_OPEN_DOOR_LAYER processing_flags = START_PROCESSING_MANUALLY subsystem_type = /datum/controller/subsystem/processing/fastprocess @@ -45,7 +46,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) . = ..() if(.) operating = TRUE - update_icon() + update_appearance() begin_processing() //WS Edit - Auto Conveyor Fix (Issue #331) // create a conveyor @@ -112,15 +113,13 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) update() /obj/machinery/conveyor/update_icon_state() - if(machine_stat & BROKEN) - icon_state = "conveyor-broken" - else - icon_state = "conveyor[operating * verted]" + icon_state = "[base_icon_state][(machine_stat & BROKEN) ? "-broken" : (operating * verted)]" + return ..() /obj/machinery/conveyor/proc/update() if(machine_stat & BROKEN || !operable || machine_stat & NOPOWER) operating = FALSE - update_icon() + update_appearance() return FALSE return TRUE @@ -235,6 +234,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) desc = "A conveyor control switch." icon = 'icons/obj/recycling.dmi' icon_state = "switch-off" + base_icon_state = "switch" processing_flags = START_PROCESSING_MANUALLY var/position = 0 // 0 off, -1 reverse, 1 forward @@ -248,7 +248,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) . = ..() if (newid) id = newid - update_icon() + update_appearance() LAZYADD(GLOB.conveyors_by_id[id], src) wires = new /datum/wires/conveyor(src) @@ -269,25 +269,21 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) // update the icon depending on the position /obj/machinery/conveyor_switch/update_icon_state() - if(position<0) - if(invert_icon) - icon_state = "switch-fwd" - else - icon_state = "switch-rev" - else if(position>0) - if(invert_icon) - icon_state = "switch-rev" - else - icon_state = "switch-fwd" - else - icon_state = "switch-off" + if(position < 0) + icon_state = "[base_icon_state]-[invert_icon ? "fwd" : "rev"]" + return ..() + if(position > 0) + icon_state = "[base_icon_state]-[invert_icon ? "rev" : "fwd"]" + return ..() + icon_state = "[base_icon_state]-off" + return ..() /// Updates all conveyor belts that are linked to this switch, and tells them to start processing. /obj/machinery/conveyor_switch/proc/update_linked_conveyors() for(var/obj/machinery/conveyor/C in GLOB.conveyors_by_id[id]) C.operating = position C.update_move_direction() - C.update_icon() + C.update_appearance() if(C.operating) C.begin_processing() else @@ -299,7 +295,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) for(var/obj/machinery/conveyor_switch/S in GLOB.conveyors_by_id[id]) S.invert_icon = invert_icon S.position = position - S.update_icon() + S.update_appearance() CHECK_TICK /// Updates the switch's `position` and `last_pos` variable. Useful so that the switch can properly cycle between the forwards, backwards and neutral positions. @@ -323,7 +319,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) add_fingerprint(user) play_click_sound("switch") update_position() - update_icon() + update_appearance() update_linked_conveyors() update_linked_switches() diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm index e2bedeef660f..6cc5fa117bb6 100644 --- a/code/modules/recycling/disposal/bin.dm +++ b/code/modules/recycling/disposal/bin.dm @@ -40,7 +40,7 @@ air_contents = new /datum/gas_mixture() //gas.volume = 1.05 * CELLSTANDARD - update_icon() + update_appearance() return INITIALIZE_HINT_LATELOAD //we need turfs to have air @@ -97,7 +97,7 @@ if((I.item_flags & ABSTRACT) || !user.temporarilyRemoveItemFromInventory(I)) return place_item_in_disposal(I, user) - update_icon() + update_appearance() return 1 //no afterattack else return ..() @@ -141,7 +141,7 @@ target.visible_message("[user] places [target] in [src].", "[user] places you in [src].") log_combat(user, target, "stuffed", addition="into [src]") target.LAssailant = user - update_icon() + update_appearance() /obj/machinery/disposal/relaymove(mob/living/user, direction) attempt_escape(user) @@ -158,14 +158,14 @@ // leave the disposal /obj/machinery/disposal/proc/go_out(mob/user) user.forceMove(loc) - update_icon() + update_appearance() // monkeys and xenos can only pull the flush lever /obj/machinery/disposal/attack_paw(mob/user) if(machine_stat & BROKEN) return flush = !flush - update_icon() + update_appearance() // eject the contents of the disposal unit @@ -174,7 +174,7 @@ for(var/atom/movable/AM as anything in src) AM.forceMove(T) AM.pipe_eject(0) - update_icon() + update_appearance() /obj/machinery/disposal/proc/flush() flushing = TRUE @@ -230,7 +230,7 @@ src.transfer_fingerprints_to(stored) stored.set_anchored(FALSE) stored.density = TRUE - stored.update_icon() + stored.update_appearance() for(var/atom/movable/AM as anything in src) //out, out, darned crowbar! AM.forceMove(T) ..() @@ -270,8 +270,8 @@ to_chat(user, "You empty the bag.") for(var/obj/item/O in T.contents) STR.remove_from_storage(O,src) - T.update_icon() - update_icon() + T.update_appearance() + update_appearance() else return ..() @@ -306,22 +306,22 @@ switch(action) if("handle-0") flush = FALSE - update_icon() + update_appearance() . = TRUE if("handle-1") if(!panel_open) flush = TRUE - update_icon() + update_appearance() . = TRUE if("pump-0") if(pressure_charging) pressure_charging = FALSE - update_icon() + update_appearance() . = TRUE if("pump-1") if(!pressure_charging) pressure_charging = TRUE - update_icon() + update_appearance() . = TRUE if("eject") eject() @@ -333,7 +333,7 @@ if(prob(75)) AM.forceMove(src) visible_message("[AM] lands in [src].") - update_icon() + update_appearance() else visible_message("[AM] bounces off of [src]'s rim!") return ..() @@ -344,13 +344,17 @@ ..() full_pressure = FALSE pressure_charging = TRUE - update_icon() + update_appearance() -/obj/machinery/disposal/bin/update_overlays() +/obj/machinery/disposal/bin/update_appearance(updates) . = ..() + if((machine_stat & (BROKEN|NOPOWER)) || panel_open) + luminosity = 0 + return + luminosity = 1 - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) - luminosity = 0 +/obj/machinery/disposal/bin/update_overlays() + . = ..() if(machine_stat & BROKEN) return @@ -363,7 +367,6 @@ if(machine_stat & NOPOWER || panel_open) return - luminosity = 1 //check for items in disposal - occupied light if(contents.len > 0) . += "dispover-full" @@ -428,7 +431,7 @@ if(air_contents.return_pressure() >= SEND_PRESSURE) full_pressure = TRUE pressure_charging = FALSE - update_icon() + update_appearance() return /obj/machinery/disposal/bin/get_remote_view_fullscreens(mob/user) diff --git a/code/modules/recycling/disposal/construction.dm b/code/modules/recycling/disposal/construction.dm index 334988b9b237..7ffc4e3b9db1 100644 --- a/code/modules/recycling/disposal/construction.dm +++ b/code/modules/recycling/disposal/construction.dm @@ -37,7 +37,7 @@ var/datum/component/simple_rotation/rotcomp = GetComponent(/datum/component/simple_rotation) rotcomp.BaseRot(null,ROTATION_FLIP) - update_icon() + update_appearance() AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE) @@ -46,22 +46,22 @@ ..() setDir(old_dir) //pipes changing direction when moved is just annoying and buggy -// update iconstate and dpdir due to dir and type +/obj/structure/disposalconstruct/update_icon_state() + if(ispath(pipe_type, /obj/machinery/disposal/bin)) + // Disposal bins receive special icon treating + icon_state = "[anchored ? "con" : null]disposal" + return ..() + + icon_state = "[is_pipe() ? "con" : null][initial(pipe_type.icon_state)]" + return ..() + +// Extra layer handling /obj/structure/disposalconstruct/update_icon() - icon_state = initial(pipe_type.icon_state) - if(is_pipe()) - icon_state = "con[icon_state]" - if(anchored) - layer = initial(pipe_type.layer) - else - layer = initial(layer) + . = ..() + if(!is_pipe()) + return - else if(ispath(pipe_type, /obj/machinery/disposal/bin)) - // Disposal bins receive special icon treating - if(anchored) - icon_state = "disposal" - else - icon_state = "condisposal" + layer = anchored ? initial(pipe_type.layer) : initial(layer) /obj/structure/disposalconstruct/proc/get_disposal_dir() if(!is_pipe()) @@ -96,7 +96,7 @@ if(ISDIAGONALDIR(dir)) // Fix RPD-induced diagonal turning setDir(turn(dir, 45)) pipe_type = initial(temp.flip_type) - update_icon() + update_appearance() /obj/structure/disposalconstruct/proc/can_be_rotated(mob/user,rotation_type) if(anchored) @@ -148,7 +148,7 @@ set_anchored(TRUE) to_chat(user, "You attach the [pipename] to the underfloor.") I.play_tool_sound(src, 100) - update_icon() + update_appearance() return TRUE /obj/structure/disposalconstruct/welder_act(mob/living/user, obj/item/I) diff --git a/code/modules/research/bepis.dm b/code/modules/research/bepis.dm index d31b64170cda..3b9aaceb9f4e 100644 --- a/code/modules/research/bepis.dm +++ b/code/modules/research/bepis.dm @@ -13,6 +13,7 @@ desc = "A high fidelity testing device which unlocks the secrets of the known universe using the two most powerful substances available to man: excessive amounts of electricity and capital." icon = 'icons/obj/machines/bepis.dmi' icon_state = "chamber" + base_icon_state = "chamber" density = TRUE layer = ABOVE_MOB_LAYER use_power = IDLE_POWER_USE @@ -166,20 +167,21 @@ /obj/machinery/rnd/bepis/update_icon_state() if(panel_open == TRUE) - icon_state = "chamber_open" - return + icon_state = "[base_icon_state]_open" + return ..() if((use_power == ACTIVE_POWER_USE) && (banked_cash > 0) && (is_operational)) - icon_state = "chamber_active_loaded" - return + icon_state = "[base_icon_state]_active_loaded" + return ..() if (((use_power == IDLE_POWER_USE) && (banked_cash > 0)) || (banked_cash > 0) && (!is_operational)) - icon_state = "chamber_loaded" - return + icon_state = "[base_icon_state]_loaded" + return ..() if(use_power == ACTIVE_POWER_USE && is_operational) - icon_state = "chamber_active" - return + icon_state = "[base_icon_state]_active" + return ..() if(((use_power == IDLE_POWER_USE) && (banked_cash == 0)) || (!is_operational)) - icon_state = "chamber" - return + icon_state = base_icon_state + return ..() + return ..() /obj/machinery/rnd/bepis/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) diff --git a/code/modules/research/destructive_analyzer.dm b/code/modules/research/destructive_analyzer.dm index 0c14330400ab..8c2b53b624bc 100644 --- a/code/modules/research/destructive_analyzer.dm +++ b/code/modules/research/destructive_analyzer.dm @@ -11,6 +11,7 @@ Note: Must be placed within 3 tiles of the R&D Console name = "destructive analyzer" desc = "Learn science by destroying things!" icon_state = "d_analyzer" + base_icon_state = "d_analyzer" circuit = /obj/item/circuitboard/machine/destructive_analyzer var/decon_mod = 0 @@ -48,14 +49,12 @@ Note: Must be placed within 3 tiles of the R&D Console linked_console.updateUsrDialog() /obj/machinery/rnd/destructive_analyzer/proc/finish_loading() - update_icon() + update_appearance() reset_busy() /obj/machinery/rnd/destructive_analyzer/update_icon_state() - if(loaded_item) - icon_state = "d_analyzer_l" - else - icon_state = initial(icon_state) + icon_state = "[base_icon_state][loaded_item ? "_l" : null]" + return ..() /obj/machinery/rnd/destructive_analyzer/proc/reclaim_materials_from(obj/item/thing) . = 0 @@ -105,7 +104,7 @@ Note: Must be placed within 3 tiles of the R&D Console qdel(thing) loaded_item = null if (!innermode) - update_icon() + update_appearance() return TRUE /obj/machinery/rnd/destructive_analyzer/proc/user_try_decon_id(id, mob/user) @@ -162,5 +161,5 @@ Note: Must be placed within 3 tiles of the R&D Console return FALSE loaded_item.forceMove(get_turf(src)) loaded_item = null - update_icon() + update_appearance() return TRUE diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm index 1ce3ee0e687a..dd9003a52014 100644 --- a/code/modules/research/experimentor.dm +++ b/code/modules/research/experimentor.dm @@ -22,6 +22,7 @@ desc = "A \"replacement\" for the destructive analyzer with a slight tendency to catastrophically fail." icon = 'icons/obj/machines/heavy_lathe.dmi' icon_state = "h_lathe" + base_icon_state = "h_lathe" density = TRUE use_power = IDLE_POWER_USE circuit = /obj/item/circuitboard/machine/experimentor @@ -243,7 +244,7 @@ /obj/machinery/rnd/experimentor/proc/experiment(exp,obj/item/exp_on) recentlyExperimented = 1 - icon_state = "h_lathe_wloop" + icon_state = "[base_icon_state]_wloop" var/chosenchem var/criticalReaction = is_type_in_typecache(exp_on, critical_items_typecache) //////////////////////////////////////////////////////////////////////////////////////////////// @@ -524,11 +525,12 @@ new /obj/item/grown/bananapeel(loc) /obj/machinery/rnd/experimentor/proc/reset_exp() - update_icon() + update_appearance() recentlyExperimented = FALSE /obj/machinery/rnd/experimentor/update_icon_state() - icon_state = "h_lathe" + icon_state = base_icon_state + return ..() /obj/machinery/rnd/experimentor/proc/warn_admins(user, ReactionName) var/turf/T = get_turf(user) diff --git a/code/modules/research/nanites/nanite_chamber.dm b/code/modules/research/nanites/nanite_chamber.dm index cc6eed4ed282..4063ae19fb6e 100644 --- a/code/modules/research/nanites/nanite_chamber.dm +++ b/code/modules/research/nanites/nanite_chamber.dm @@ -4,6 +4,7 @@ circuit = /obj/item/circuitboard/machine/nanite_chamber icon = 'icons/obj/machines/nanite_chamber.dmi' icon_state = "nanite_chamber" + base_icon_state = "nanite_chamber" layer = ABOVE_WINDOW_LAYER use_power = IDLE_POWER_USE anchored = TRUE @@ -43,7 +44,7 @@ busy = status busy_message = message busy_icon_state = working_icon - update_icon() + update_appearance() /obj/machinery/nanite_chamber/proc/set_safety(threshold) if(!occupant) @@ -112,13 +113,11 @@ /obj/machinery/nanite_chamber/update_icon_state() //running and someone in there if(occupant) - if(busy) - icon_state = busy_icon_state - else - icon_state = initial(icon_state) + "_occupied" - else - //running - icon_state = initial(icon_state) + (state_open ? "_open" : "") + icon_state = busy ? busy_icon_state : "[base_icon_state]_occupied" + return ..() + //running + icon_state = "[base_icon_state][state_open ? "_open" : null]" + return ..() /obj/machinery/nanite_chamber/update_overlays() . = ..() @@ -126,13 +125,16 @@ if((machine_stat & MAINT) || panel_open) . += "maint" - else if(!(machine_stat & (NOPOWER|BROKEN))) - if(busy || locked) - . += "red" - if(locked) - . += "bolted" - else - . += "green" + return + if(machine_stat & (NOPOWER|BROKEN)) + return + + if(busy || locked) + . += "red" + if(locked) + . += "bolted" + return + . += "green" /obj/machinery/nanite_chamber/proc/toggle_open(mob/user) if(panel_open) @@ -199,7 +201,7 @@ linked_techweb = server.stored_research if(!occupant && default_deconstruction_screwdriver(user, icon_state, icon_state, I))//sent icon_state is irrelevant... - update_icon()//..since we're updating the icon here, since the scanner can be unpowered when opened/closed + update_appearance()//..since we're updating the icon here, since the scanner can be unpowered when opened/closed return if(default_pry_open(I)) diff --git a/code/modules/research/nanites/nanite_chamber_computer.dm b/code/modules/research/nanites/nanite_chamber_computer.dm index da65235772aa..f2b155c0e0cd 100644 --- a/code/modules/research/nanites/nanite_chamber_computer.dm +++ b/code/modules/research/nanites/nanite_chamber_computer.dm @@ -66,7 +66,7 @@ switch(action) if("toggle_lock") chamber.locked = !chamber.locked - chamber.update_icon() + chamber.update_appearance() . = TRUE if("set_safety") var/threshold = text2num(params["value"]) diff --git a/code/modules/research/nanites/nanite_remote.dm b/code/modules/research/nanites/nanite_remote.dm index fee5544ff766..f7e43f3b5540 100644 --- a/code/modules/research/nanites/nanite_remote.dm +++ b/code/modules/research/nanites/nanite_remote.dm @@ -33,7 +33,7 @@ if(allowed(user)) to_chat(user, "You unlock [src].") locked = FALSE - update_icon() + update_appearance() else to_chat(user, "Access denied.") @@ -44,7 +44,7 @@ obj_flags |= EMAGGED if(locked) locked = FALSE - update_icon() + update_appearance() /obj/item/nanite_remote/update_overlays() . = ..() @@ -165,7 +165,7 @@ if("lock") if(!(obj_flags & EMAGGED)) locked = TRUE - update_icon() + update_appearance() . = TRUE diff --git a/code/modules/research/nanites/public_chamber.dm b/code/modules/research/nanites/public_chamber.dm index 0da01b872205..f53707206a38 100644 --- a/code/modules/research/nanites/public_chamber.dm +++ b/code/modules/research/nanites/public_chamber.dm @@ -35,7 +35,7 @@ /obj/machinery/public_nanite_chamber/proc/set_busy(status, working_icon) busy = status busy_icon_state = working_icon - update_icon() + update_appearance() /obj/machinery/public_nanite_chamber/proc/inject_nanites(mob/living/attacker) if(machine_stat & (NOPOWER|BROKEN)) @@ -100,6 +100,7 @@ else //running icon_state = initial(icon_state)+ (state_open ? "_open" : "") + return ..() /obj/machinery/public_nanite_chamber/update_overlays() . = ..() @@ -195,7 +196,7 @@ return if(!occupant && default_deconstruction_screwdriver(user, icon_state, icon_state, I))//sent icon_state is irrelevant... - update_icon()//..since we're updating the icon here, since the scanner can be unpowered when opened/closed + update_appearance()//..since we're updating the icon here, since the scanner can be unpowered when opened/closed return if(default_pry_open(I)) diff --git a/code/modules/ruins/lavalandruin_code/elephantgraveyard.dm b/code/modules/ruins/lavalandruin_code/elephantgraveyard.dm index 157a56c0cf0a..5d29bf9dc2a6 100644 --- a/code/modules/ruins/lavalandruin_code/elephantgraveyard.dm +++ b/code/modules/ruins/lavalandruin_code/elephantgraveyard.dm @@ -148,7 +148,7 @@ opened = TRUE locked = TRUE dump_contents() - update_icon() + update_appearance() SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "graverobbing", /datum/mood_event/graverobbing) if(lead_tomb == TRUE && first_open == TRUE) user.gain_trauma(/datum/brain_trauma/magic/stalker) @@ -176,7 +176,7 @@ /obj/structure/closet/crate/grave/bust_open() ..() opened = TRUE - update_icon() + update_appearance() dump_contents() return diff --git a/code/modules/security_levels/keycard_authentication.dm b/code/modules/security_levels/keycard_authentication.dm index f7eba26da5f7..be021492b2de 100644 --- a/code/modules/security_levels/keycard_authentication.dm +++ b/code/modules/security_levels/keycard_authentication.dm @@ -124,7 +124,7 @@ GLOBAL_VAR_INIT(emergency_access, FALSE) for(var/area/ship/maintenance/A in world) for(var/obj/machinery/door/airlock/D in A) D.emergency = TRUE - D.update_icon(0) + D.update_icon(ALL, 0) minor_announce("Access restrictions on maintenance and external airlocks have been lifted.", "Attention! Sector-wide emergency declared!",1) GLOB.emergency_access = TRUE SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency maintenance access", "enabled")) @@ -133,7 +133,7 @@ GLOBAL_VAR_INIT(emergency_access, FALSE) for(var/area/ship/maintenance/A in world) for(var/obj/machinery/door/airlock/D in A) D.emergency = FALSE - D.update_icon(0) + D.update_icon(ALL, 0) minor_announce("Access restrictions in maintenance areas have been restored.", "Attention! Sector-wide emergency rescinded:") GLOB.emergency_access = FALSE SSblackbox.record_feedback("nested tally", "keycard_auths", 1, list("emergency maintenance access", "disabled")) diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index c7052dfa19ba..7b4c75fe0104 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -279,8 +279,8 @@ All ShuttleMove procs go here A.addMember(src) SSair.add_to_rebuild_queue(src) else - // atmosinit() calls update_icon(), so we don't need to call it - update_icon() + // atmosinit() calls update_appearance(), so we don't need to call it + update_appearance() /obj/machinery/navbeacon/beforeShuttleMove(turf/newT, rotation, move_mode, obj/docking_port/mobile/moving_dock) . = ..() diff --git a/code/modules/shuttle/shuttle_rotate.dm b/code/modules/shuttle/shuttle_rotate.dm index 9f4f60162cdd..4cb5d0c65268 100644 --- a/code/modules/shuttle/shuttle_rotate.dm +++ b/code/modules/shuttle/shuttle_rotate.dm @@ -42,7 +42,7 @@ If ever any of these procs are useful for non-shuttles, rename it to proc/rotate /mob/dead/observer/shuttleRotate(rotation, params) . = ..() - update_icon() + update_appearance() /************************************Structure rotate procs************************************/ @@ -60,7 +60,7 @@ If ever any of these procs are useful for non-shuttles, rename it to proc/rotate var/temp = d1 d1 = d2 d2 = temp - update_icon() + update_appearance() //WS Edit End - Smartwire Revert Do not TG MARG this //Fixes dpdir on shuttle rotation diff --git a/code/modules/shuttle/special.dm b/code/modules/shuttle/special.dm index 0b23acdce484..aa2206efb4ba 100644 --- a/code/modules/shuttle/special.dm +++ b/code/modules/shuttle/special.dm @@ -10,6 +10,7 @@ icon = 'icons/obj/machines/magic_emitter.dmi' icon_state = "wabbajack_statue" icon_state_on = "wabbajack_statue_on" + base_icon_state = "wabbajack_statue" active = FALSE allow_switch_interact = FALSE var/list/active_tables = list() @@ -19,13 +20,11 @@ . = ..() if(prob(50)) desc = "Oh no, not again." - update_icon() + update_appearance() /obj/machinery/power/emitter/energycannon/magical/update_icon_state() - if(active) - icon_state = icon_state_on - else - icon_state = initial(icon_state) + . = ..() + icon_state = active ? icon_state_on : initial(icon_state) /obj/machinery/power/emitter/energycannon/magical/process() . = ..() @@ -39,7 +38,7 @@ visible_message("\ [src] closes its eyes.") active = FALSE - update_icon() + update_appearance() /obj/machinery/power/emitter/energycannon/magical/attackby(obj/item/W, mob/user, params) return diff --git a/code/modules/spells/spell.dm b/code/modules/spells/spell.dm index aef9faea7bd6..4a791beb5ee7 100644 --- a/code/modules/spells/spell.dm +++ b/code/modules/spells/spell.dm @@ -74,7 +74,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th if(msg) to_chat(ranged_ability_user, msg) active = TRUE - update_icon() + update_appearance() /obj/effect/proc_holder/proc/remove_ranged_ability(msg) if(!ranged_ability_user || !ranged_ability_user.client || (ranged_ability_user.ranged_ability && ranged_ability_user.ranged_ability != src)) //To avoid removing the wrong ability @@ -86,7 +86,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th to_chat(ranged_ability_user, msg) ranged_ability_user = null active = FALSE - update_icon() + update_appearance() /obj/effect/proc_holder/spell name = "Spell" diff --git a/code/modules/spells/spell_types/aimed.dm b/code/modules/spells/spell_types/aimed.dm index ace2ad3c9f25..66c0c232c06c 100644 --- a/code/modules/spells/spell_types/aimed.dm +++ b/code/modules/spells/spell_types/aimed.dm @@ -43,6 +43,8 @@ /obj/effect/proc_holder/spell/aimed/update_icon() if(!action) return + + . = ..() action.button_icon_state = "[base_icon_state][active]" action.UpdateButtonIcon() diff --git a/code/modules/spells/spell_types/charge.dm b/code/modules/spells/spell_types/charge.dm index 694b34153db1..57325e685f4d 100644 --- a/code/modules/spells/spell_types/charge.dm +++ b/code/modules/spells/spell_types/charge.dm @@ -91,7 +91,7 @@ if(istype(C.loc, /obj/item/gun)) var/obj/item/gun/G = C.loc G.process_chamber() - item.update_icon() + item.update_appearance() charged_item = item break if(!charged_item) diff --git a/code/modules/spells/spell_types/pointed/pointed.dm b/code/modules/spells/spell_types/pointed/pointed.dm index 2f2a6c41a8d9..1002d34ccb52 100644 --- a/code/modules/spells/spell_types/pointed/pointed.dm +++ b/code/modules/spells/spell_types/pointed/pointed.dm @@ -59,10 +59,9 @@ /obj/effect/proc_holder/spell/pointed/update_icon() if(!action) return - if(active) - action.button_icon_state = "[action_icon_state]1" - else - action.button_icon_state = "[action_icon_state]" + + . = ..() + action.button_icon_state = "[action_icon_state][active ? 1 : null]" action.UpdateButtonIcon() /obj/effect/proc_holder/spell/pointed/InterceptClickOn(mob/living/caller, params, atom/target) diff --git a/code/modules/spells/spell_types/soultap.dm b/code/modules/spells/spell_types/soultap.dm index 9dafa04193ae..ffc43efeb4ae 100644 --- a/code/modules/spells/spell_types/soultap.dm +++ b/code/modules/spells/spell_types/soultap.dm @@ -30,4 +30,4 @@ for(var/obj/effect/proc_holder/spell/spell in user.mind.spell_list) spell.charge_counter = spell.charge_max spell.recharging = FALSE - spell.update_icon() + spell.update_appearance() diff --git a/code/modules/spells/spell_types/summonitem.dm b/code/modules/spells/spell_types/summonitem.dm index 8636211941c2..d93eec8b7244 100644 --- a/code/modules/spells/spell_types/summonitem.dm +++ b/code/modules/spells/spell_types/summonitem.dm @@ -82,7 +82,7 @@ if(istype(item_to_retrieve.loc, /obj/machinery/portable_atmospherics/)) //Edge cases for moved machinery var/obj/machinery/portable_atmospherics/P = item_to_retrieve.loc P.disconnect() - P.update_icon() + P.update_appearance() item_to_retrieve = item_to_retrieve.loc diff --git a/code/modules/station_goals/bsa.dm b/code/modules/station_goals/bsa.dm index c1804f8a3f71..7de9e83581fe 100644 --- a/code/modules/station_goals/bsa.dm +++ b/code/modules/station_goals/bsa.dm @@ -273,7 +273,7 @@ if("recalibrate") calibrate(usr) . = TRUE - update_icon() + update_appearance() /obj/machinery/computer/bsa_control/proc/calibrate(mob/user) if(!GLOB.bsa_unlock) diff --git a/code/modules/station_goals/shield.dm b/code/modules/station_goals/shield.dm index a00ee9749d15..4c9b3556b6aa 100644 --- a/code/modules/station_goals/shield.dm +++ b/code/modules/station_goals/shield.dm @@ -82,6 +82,7 @@ desc = "" icon = 'icons/obj/machines/satellite.dmi' icon_state = "sat_inactive" + base_icon_state = "sat" anchored = FALSE density = TRUE use_power = FALSE @@ -108,7 +109,7 @@ else end_processing() animate(src, pixel_y = 0, time = 10) - update_icon() + update_appearance() /obj/machinery/satellite/proc/toggle(mob/user) if(!active && !isinspace()) @@ -120,7 +121,8 @@ set_anchored(!anchored) /obj/machinery/satellite/update_icon_state() - icon_state = active ? "sat_active" : "sat_inactive" + icon_state = "[base_icon_state]_[active ? "active" : "inactive"]" + return ..() /obj/machinery/satellite/multitool_act(mob/living/user, obj/item/I) ..() diff --git a/code/modules/surgery/bodyparts/dismemberment.dm b/code/modules/surgery/bodyparts/dismemberment.dm index e360945a16d3..b063d01f8048 100644 --- a/code/modules/surgery/bodyparts/dismemberment.dm +++ b/code/modules/surgery/bodyparts/dismemberment.dm @@ -190,7 +190,7 @@ if(C.hud_used) var/atom/movable/screen/inventory/hand/R = C.hud_used.hand_slots["[held_index]"] if(R) - R.update_icon() + R.update_appearance() if(C.gloves) C.dropItemToGround(C.gloves, TRUE) C.update_inv_gloves() //to remove the bloody hands overlay @@ -208,7 +208,7 @@ if(C.hud_used) var/atom/movable/screen/inventory/hand/L = C.hud_used.hand_slots["[held_index]"] if(L) - L.update_icon() + L.update_appearance() if(C.gloves) C.dropItemToGround(C.gloves, TRUE) C.update_inv_gloves() //to remove the bloody hands overlay @@ -288,7 +288,7 @@ if(C.hud_used) var/atom/movable/screen/inventory/hand/hand = C.hud_used.hand_slots["[held_index]"] if(hand) - hand.update_icon() + hand.update_appearance() C.update_inv_gloves() if(special) //non conventional limb attachment diff --git a/code/modules/surgery/bodyparts/parts.dm b/code/modules/surgery/bodyparts/parts.dm index 300a17e7ab0d..8a101112377f 100644 --- a/code/modules/surgery/bodyparts/parts.dm +++ b/code/modules/surgery/bodyparts/parts.dm @@ -132,7 +132,7 @@ if(owner.hud_used) var/atom/movable/screen/inventory/hand/hand_screen_object = owner.hud_used.hand_slots["[held_index]"] - hand_screen_object?.update_icon() + hand_screen_object?.update_appearance() /obj/item/bodypart/l_arm/monkey @@ -234,7 +234,7 @@ if(owner.hud_used) var/atom/movable/screen/inventory/hand/hand_screen_object = owner.hud_used.hand_slots["[held_index]"] - hand_screen_object?.update_icon() + hand_screen_object?.update_appearance() /obj/item/bodypart/r_arm/monkey diff --git a/code/modules/surgery/implant_removal.dm b/code/modules/surgery/implant_removal.dm index 4866e8aa1541..68eb25bf2b15 100644 --- a/code/modules/surgery/implant_removal.dm +++ b/code/modules/surgery/implant_removal.dm @@ -46,7 +46,7 @@ if(case && !case.imp) case.imp = I I.forceMove(case) - case.update_icon() + case.update_appearance() display_results(user, target, "You place [I] into [case].", "[user] places [I] into [case]!", "[user] places it into [case]!") diff --git a/code/modules/surgery/organs/appendix.dm b/code/modules/surgery/organs/appendix.dm index 8945bac15073..69a7b2e95339 100644 --- a/code/modules/surgery/organs/appendix.dm +++ b/code/modules/surgery/organs/appendix.dm @@ -1,6 +1,7 @@ /obj/item/organ/appendix name = "appendix" icon_state = "appendix" + base_icon_state = "appendix" zone = BODY_ZONE_PRECISE_GROIN slot = ORGAN_SLOT_APPENDIX @@ -12,13 +13,13 @@ var/inflamed -/obj/item/organ/appendix/update_icon() - if(inflamed) - icon_state = "appendixinflamed" - name = "inflamed appendix" - else - icon_state = "appendix" - name = "appendix" +/obj/item/organ/appendix/update_name() + . = ..() + name = "[inflamed ? "inflamed " : null][initial(name)]" + +/obj/item/organ/appendix/update_icon_state() + icon_state = "[base_icon_state][inflamed ? "inflamed" : ""]" + return ..() /obj/item/organ/appendix/on_life() ..() @@ -35,7 +36,7 @@ for(var/datum/disease/appendicitis/A in M.diseases) A.cure() inflamed = TRUE - update_icon() + update_appearance() ..() /obj/item/organ/appendix/Insert(mob/living/carbon/M, special = 0) diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm index a51f89d3063e..524077a19e6f 100644 --- a/code/modules/surgery/organs/augments_arms.dm +++ b/code/modules/surgery/organs/augments_arms.dm @@ -18,7 +18,7 @@ if(ispath(holder)) holder = new holder(src) - update_icon() + update_appearance() SetSlotFromZone() items_list = contents.Copy() @@ -32,10 +32,8 @@ CRASH("Invalid zone for [type]") /obj/item/organ/cyberimp/arm/update_icon() - if(zone == BODY_ZONE_R_ARM) - transform = null - else // Mirroring the icon - transform = matrix(-1, 0, 0, 0, 1, 0) + . = ..() + transform = (zone == BODY_ZONE_R_ARM) ? null : matrix(-1, 0, 0, 0, 1, 0) /obj/item/organ/cyberimp/arm/examine(mob/user) . = ..() @@ -52,7 +50,7 @@ zone = BODY_ZONE_R_ARM SetSlotFromZone() to_chat(user, "You modify [src] to be installed on the [zone == BODY_ZONE_R_ARM ? "right" : "left"] arm.") - update_icon() + update_appearance() /obj/item/organ/cyberimp/arm/Remove(mob/living/carbon/M, special = 0) Retract() diff --git a/code/modules/surgery/organs/augments_chest.dm b/code/modules/surgery/organs/augments_chest.dm index 12b98bd29879..f8314a7c6dfa 100644 --- a/code/modules/surgery/organs/augments_chest.dm +++ b/code/modules/surgery/organs/augments_chest.dm @@ -122,6 +122,7 @@ Unlike regular jetpacks, this device has no stabilization system." slot = ORGAN_SLOT_THRUSTERS icon_state = "imp_jetpack" + base_icon_state = "imp_jetpack" implant_overlay = null implant_color = null actions_types = list(/datum/action/item_action/organ_action/toggle) @@ -166,13 +167,11 @@ if(!silent) to_chat(owner, "You turn your thrusters set off.") on = FALSE - update_icon() + update_appearance() /obj/item/organ/cyberimp/chest/thrusters/update_icon_state() - if(on) - icon_state = "imp_jetpack-on" - else - icon_state = "imp_jetpack" + icon_state = "[base_icon_state][on ? "-on" : null]" + return ..() /obj/item/organ/cyberimp/chest/thrusters/proc/move_react() if(!on)//If jet dont work, it dont work diff --git a/code/modules/surgery/organs/heart.dm b/code/modules/surgery/organs/heart.dm index 26d16ae23e10..dd6d8efc1065 100644 --- a/code/modules/surgery/organs/heart.dm +++ b/code/modules/surgery/organs/heart.dm @@ -2,6 +2,7 @@ name = "heart" desc = "I feel bad for the heartless bastard who lost this." icon_state = "heart-on" + base_icon_state = "heart" zone = BODY_ZONE_CHEST slot = ORGAN_SLOT_HEART @@ -15,7 +16,6 @@ // Heart attack code is in code/modules/mob/living/carbon/human/life.dm var/beating = 1 - var/icon_base = "heart" attack_verb = list("beat", "thumped") //is this mob having a heatbeat sound played? if so, which? var/beat = BEAT_NONE @@ -25,10 +25,8 @@ var/operated = FALSE /obj/item/organ/heart/update_icon_state() - if(beating) - icon_state = "[icon_base]-on" - else - icon_state = "[icon_base]-off" + icon_state = "[base_icon_state]-[beating ? "on" : "off"]" + return ..() /obj/item/organ/heart/Remove(mob/living/carbon/M, special = 0) ..() @@ -49,18 +47,18 @@ /obj/item/organ/heart/proc/Stop() beating = 0 - update_icon() + update_appearance() return 1 /obj/item/organ/heart/proc/Restart() beating = 1 - update_icon() + update_appearance() return 1 /obj/item/organ/heart/OnEatFrom(eater, feeder) . = ..() beating = FALSE - update_icon() + update_appearance() /obj/item/organ/heart/on_life() ..() @@ -101,7 +99,7 @@ name = "cursed heart" desc = "A heart that, when inserted, will force you to pump it manually." icon_state = "cursedheart-off" - icon_base = "cursedheart" + base_icon_state = "cursedheart" decay_factor = 0 actions_types = list(/datum/action/item_action/hands_free/organ_action/cursed_heart) var/last_pump = 0 diff --git a/code/modules/vehicles/motorized_wheelchair.dm b/code/modules/vehicles/motorized_wheelchair.dm index b5909a564b68..add121e6a061 100644 --- a/code/modules/vehicles/motorized_wheelchair.dm +++ b/code/modules/vehicles/motorized_wheelchair.dm @@ -67,7 +67,7 @@ /obj/vehicle/ridden/wheelchair/motorized/attack_hand(mob/living/user) if(power_cell && panel_open) - power_cell.update_icon() + power_cell.update_appearance() user.put_in_hands(power_cell) power_cell = null to_chat(user, "You remove the power cell from [src].") diff --git a/code/modules/vehicles/pimpin_ride.dm b/code/modules/vehicles/pimpin_ride.dm index 87d1d09d5b05..d4a9aff2d8b2 100644 --- a/code/modules/vehicles/pimpin_ride.dm +++ b/code/modules/vehicles/pimpin_ride.dm @@ -9,7 +9,7 @@ /obj/vehicle/ridden/janicart/Initialize(mapload) . = ..() - update_icon() + update_appearance() var/datum/component/riding/D = LoadComponent(/datum/component/riding) D.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0, 4), TEXT_SOUTH = list(0, 7), TEXT_EAST = list(-12, 7), TEXT_WEST = list(12, 7))) @@ -42,7 +42,7 @@ return to_chat(user, "You hook the trashbag onto [src].") mybag = I - update_icon() + update_appearance() else if(istype(I, /obj/item/janiupgrade)) if(floorbuffer) to_chat(user, "[src] already has a floor buffer!") @@ -51,7 +51,7 @@ qdel(I) to_chat(user, "You upgrade [src] with the floor buffer.") AddElement(/datum/element/cleaning) - update_icon() + update_appearance() else if(istype(I, /obj/item/key/janitor)) ..() else if(mybag) @@ -74,7 +74,7 @@ mybag.forceMove(get_turf(user)) user.put_in_hands(mybag) mybag = null - update_icon() + update_appearance() /obj/vehicle/ridden/janicart/upgraded floorbuffer = TRUE diff --git a/code/modules/vending/_vending.dm b/code/modules/vending/_vending.dm index d03b8a7225cb..1941d81accbe 100644 --- a/code/modules/vending/_vending.dm +++ b/code/modules/vending/_vending.dm @@ -224,17 +224,19 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C else ..() -/obj/machinery/vending/update_icon_state() +/obj/machinery/vending/update_appearance(updates=ALL) + . = ..() if(machine_stat & BROKEN) - icon_state = "[initial(icon_state)]-broken" - set_light(0) - else if(powered()) - icon_state = initial(icon_state) - set_light(1.4) - else - icon_state = "[initial(icon_state)]-off" set_light(0) + return + set_light(powered() ? MINIMUM_USEFUL_LIGHT_RANGE : 0) +/obj/machinery/vending/update_icon_state() + if(machine_stat & BROKEN) + icon_state = "[initial(icon_state)]-broken" + return ..() + icon_state = "[initial(icon_state)][powered() ? null : "-off"]" + return ..() /obj/machinery/vending/update_overlays() . = ..()