From 18eca2756922bf88390163be5bd6fae2b26a08ba Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Fri, 19 Feb 2021 17:08:09 +0100 Subject: [PATCH] [MIRROR] update_appearance (#3508) * update_appearance * a * a Co-authored-by: TemporalOroboros Co-authored-by: Gandalf2k15 --- code/__DEFINES/dcs/signals.dm | 27 +- code/__DEFINES/flags.dm | 12 + code/_onclick/hud/action_button.dm | 9 +- code/_onclick/hud/alien.dm | 6 +- code/_onclick/hud/alien_larva.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/hud.dm | 2 +- code/_onclick/hud/human.dm | 6 +- code/_onclick/hud/living.dm | 2 +- code/_onclick/hud/ooze.dm | 2 +- code/_onclick/hud/revenanthud.dm | 2 +- code/_onclick/hud/robot.dm | 15 +- code/_onclick/hud/screen_objects.dm | 57 +- code/_onclick/telekinesis.dm | 10 +- code/controllers/subsystem/communications.dm | 2 +- code/controllers/subsystem/mapping.dm | 2 +- code/controllers/subsystem/persistence.dm | 2 +- code/datums/action.dm | 1 - code/datums/components/acid.dm | 4 +- code/datums/components/armor_plate.dm | 2 +- code/datums/components/bloodysoles.dm | 8 +- code/datums/components/grillable.dm | 4 +- code/datums/components/plumbing/_plumbing.dm | 6 +- .../components/storage/concrete/_concrete.dm | 4 +- code/datums/components/storage/storage.dm | 2 +- code/datums/components/swabbing.dm | 4 +- code/datums/components/twohanded.dm | 18 +- code/datums/diseases/appendicitis.dm | 2 +- code/datums/elements/decal.dm | 6 +- code/datums/martial/sleeping_carp.dm | 6 +- code/datums/quirks/neutral.dm | 2 +- code/datums/status_effects/debuffs.dm | 8 +- code/datums/status_effects/neutral.dm | 2 +- code/datums/wires/airalarm.dm | 8 +- code/datums/wires/airlock.dm | 8 +- code/datums/wires/apc.dm | 14 +- code/datums/wires/syndicatebomb.dm | 4 +- code/game/area/areas.dm | 8 +- code/game/atoms.dm | 54 +- .../game/gamemodes/clown_ops/bananium_bomb.dm | 12 +- code/game/gamemodes/events.dm | 8 +- code/game/gamemodes/gang/gang_handler.dm | 2 +- code/game/gamemodes/sandbox/h_sandbox.dm | 2 +- code/game/machinery/PDApainter.dm | 20 +- code/game/machinery/Sleeper.dm | 12 +- code/game/machinery/_machinery.dm | 8 +- code/game/machinery/accounting.dm | 21 +- code/game/machinery/ai_slipper.dm | 10 +- code/game/machinery/airlock_control.dm | 28 +- code/game/machinery/announcement_system.dm | 17 +- code/game/machinery/aug_manipulator.dm | 26 +- 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/computer/_computer.dm | 2 - code/game/machinery/computer/aifixer.dm | 21 +- code/game/machinery/computer/apc_control.dm | 8 +- code/game/machinery/computer/arcade.dm | 2 +- code/game/machinery/computer/arena.dm | 2 +- code/game/machinery/computer/atmos_alert.dm | 7 +- code/game/machinery/computer/atmos_control.dm | 1 + code/game/machinery/computer/camera.dm | 1 + code/game/machinery/computer/medical.dm | 2 +- code/game/machinery/computer/security.dm | 2 +- code/game/machinery/computer/teleporter.dm | 12 +- 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 | 183 +++--- 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 | 25 +- code/game/machinery/doors/passworddoor.dm | 6 +- code/game/machinery/doors/poddoor.dm | 6 +- code/game/machinery/doors/windowdoor.dm | 8 +- code/game/machinery/doppler_array.dm | 12 +- code/game/machinery/droneDispenser.dm | 19 +- code/game/machinery/electrolyzer.dm | 14 +- .../embedded_controller/access_controller.dm | 32 +- .../embedded_controller/airlock_controller.dm | 11 +- .../embedded_controller_base.dm | 2 +- .../simple_vent_controller.dm | 6 +- code/game/machinery/fat_sucker.dm | 8 +- code/game/machinery/firealarm.dm | 32 +- code/game/machinery/flasher.dm | 17 +- code/game/machinery/gulag_teleporter.dm | 11 +- code/game/machinery/harvester.dm | 22 +- code/game/machinery/hologram.dm | 14 +- code/game/machinery/hypnochair.dm | 21 +- code/game/machinery/igniter.dm | 21 +- code/game/machinery/iv_drip.dm | 85 ++- code/game/machinery/lightswitch.dm | 30 +- code/game/machinery/medical_kiosk.dm | 74 ++- code/game/machinery/navbeacon.dm | 6 +- code/game/machinery/newscaster.dm | 25 +- code/game/machinery/pipe/pipe_dispenser.dm | 2 +- .../machinery/porta_turret/portable_turret.dm | 61 +- .../porta_turret/portable_turret_cover.dm | 16 +- code/game/machinery/prisonlabor.dm | 22 +- code/game/machinery/recharger.dm | 48 +- 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 | 16 +- code/game/machinery/sheetifier.dm | 7 +- code/game/machinery/shieldgen.dm | 12 +- code/game/machinery/slotmachine.dm | 25 +- code/game/machinery/spaceheater.dm | 24 +- code/game/machinery/stasis.dm | 46 +- code/game/machinery/suit_storage_unit.dm | 42 +- code/game/machinery/syndicatebomb.dm | 11 +- .../telecomms/machine_interactions.dm | 2 +- .../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 +- code/game/objects/effects/decals/cleanable.dm | 2 +- .../effects/decals/cleanable/humans.dm | 16 +- .../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 | 24 +- code/game/objects/items/RPD.dm | 2 +- code/game/objects/items/broom.dm | 10 +- code/game/objects/items/candle.dm | 7 +- code/game/objects/items/cards_ids.dm | 8 +- code/game/objects/items/chrono_eraser.dm | 7 +- code/game/objects/items/cigs_lighters.dm | 9 +- code/game/objects/items/crayons.dm | 11 +- code/game/objects/items/credit_holochip.dm | 52 +- code/game/objects/items/defib.dm | 33 +- code/game/objects/items/devices/PDA/PDA.dm | 24 +- code/game/objects/items/devices/aicard.dm | 9 +- code/game/objects/items/devices/flashlight.dm | 38 +- .../objects/items/devices/geiger_counter.dm | 45 +- .../objects/items/devices/lightreplacer.dm | 5 +- code/game/objects/items/devices/multitool.dm | 2 +- code/game/objects/items/devices/paicard.dm | 8 +- .../items/devices/portable_chem_mixer.dm | 21 +- code/game/objects/items/devices/powersink.dm | 3 +- .../objects/items/devices/quantum_keycard.dm | 6 +- .../objects/items/devices/radio/intercom.dm | 13 +- code/game/objects/items/devices/swapper.dm | 16 +- .../objects/items/devices/taperecorder.dm | 23 +- .../objects/items/devices/traitordevices.dm | 2 +- .../objects/items/devices/transfer_valve.dm | 47 +- 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/etherealdiscoball.dm | 7 +- code/game/objects/items/fireaxe.dm | 17 +- code/game/objects/items/flamethrower.dm | 17 +- code/game/objects/items/food/frozen.dm | 8 +- code/game/objects/items/food/pastries.dm | 25 +- code/game/objects/items/grenades/festive.dm | 4 +- code/game/objects/items/handcuffs.dm | 7 +- 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 | 10 +- 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 | 3 +- code/game/objects/items/pneumaticCannon.dm | 4 +- 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 | 6 +- code/game/objects/items/shields.dm | 11 +- code/game/objects/items/singularityhammer.dm | 13 +- code/game/objects/items/spear.dm | 20 +- code/game/objects/items/stacks/cannonballs.dm | 8 +- code/game/objects/items/stacks/cash.dm | 6 +- .../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 +- code/game/objects/items/storage/bags.dm | 9 +- code/game/objects/items/storage/belt.dm | 18 +- code/game/objects/items/storage/boxes.dm | 3 +- code/game/objects/items/storage/fancy.dm | 243 ++++---- code/game/objects/items/storage/firstaid.dm | 14 +- 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/tank_types.dm | 2 +- code/game/objects/items/tanks/watertank.dm | 2 +- code/game/objects/items/tcg/tcg.dm | 50 +- code/game/objects/items/theft_tools.dm | 7 +- code/game/objects/items/tools/crowbar.dm | 10 +- code/game/objects/items/tools/screwdriver.dm | 2 +- code/game/objects/items/tools/weldingtool.dm | 19 +- code/game/objects/items/tools/wirecutters.dm | 2 +- code/game/objects/items/tools/wrench.dm | 3 +- code/game/objects/items/toys.dm | 20 +- code/game/objects/items/wayfinding.dm | 11 +- code/game/objects/items/weaponry.dm | 6 +- code/game/objects/obj_defense.dm | 4 +- code/game/objects/structures/ai_core.dm | 27 +- code/game/objects/structures/aliens.dm | 7 +- code/game/objects/structures/artstuff.dm | 75 ++- code/game/objects/structures/bedsheet_bin.dm | 9 +- .../structures/crates_lockers/closets.dm | 64 +- .../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 | 31 +- code/game/objects/structures/divine.dm | 5 +- code/game/objects/structures/door_assembly.dm | 11 +- code/game/objects/structures/extinguisher.dm | 26 +- code/game/objects/structures/false_walls.dm | 31 +- code/game/objects/structures/fireaxe.dm | 58 +- code/game/objects/structures/fireplace.dm | 34 +- code/game/objects/structures/grille.dm | 15 +- code/game/objects/structures/guncase.dm | 17 +- code/game/objects/structures/headpike.dm | 37 +- code/game/objects/structures/janicart.dm | 6 +- code/game/objects/structures/ladders.dm | 32 +- 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 | 90 ++- code/game/objects/structures/safe.dm | 8 +- code/game/objects/structures/shower.dm | 13 +- code/game/objects/structures/stairs.dm | 10 +- code/game/objects/structures/statues.dm | 13 +- 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/votingbox.dm | 5 +- code/game/objects/structures/watercloset.dm | 32 +- .../objects/structures/windoor_assembly.dm | 7 +- code/game/objects/structures/window.dm | 52 +- code/game/turfs/closed/wall/reinf_walls.dm | 33 +- code/game/turfs/open/floor.dm | 6 +- code/game/turfs/open/floor/fancy_floor.dm | 6 +- code/game/turfs/open/floor/iron_floor.dm | 3 +- code/game/turfs/open/floor/light_floor.dm | 66 ++- code/game/turfs/open/floor/mineral_floor.dm | 11 +- code/game/turfs/open/floor/misc_floor.dm | 24 +- code/game/turfs/open/space/transit.dm | 3 +- code/modules/NTNet/relays.dm | 16 +- code/modules/admin/verbs/debug.dm | 2 +- code/modules/admin/verbs/manipulate_organs.dm | 2 +- .../abductor/equipment/abduction_gear.dm | 3 +- .../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 | 33 +- .../antagonists/blob/structures/node.dm | 9 +- .../antagonists/blob/structures/shield.dm | 31 +- code/modules/antagonists/cult/cult_items.dm | 14 +- .../antagonists/cult/cult_structures.dm | 3 +- .../eldritch_cult/eldritch_book.dm | 2 +- .../eldritch_cult/eldritch_magic.dm | 2 +- .../eldritch_cult/eldritch_structures.dm | 8 +- .../nukeop/equipment/nuclearbomb.dm | 25 +- .../antagonists/revolution/revolution.dm | 2 +- .../traitor/equipment/Malf_Modules.dm | 2 +- code/modules/aquarium/aquarium.dm | 12 +- code/modules/assembly/assembly.dm | 10 +- code/modules/assembly/bomb.dm | 11 +- code/modules/assembly/doorcontrol.dm | 2 +- code/modules/assembly/flash.dm | 35 +- 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 | 27 +- .../atmospherics/machinery/atmosmachinery.dm | 6 +- .../components/binary_devices/circulator.dm | 17 +- .../components/binary_devices/dp_vent_pump.dm | 4 +- .../components/binary_devices/passive_gate.dm | 8 +- .../binary_devices/pressure_valve.dm | 8 +- .../components/binary_devices/pump.dm | 8 +- .../binary_devices/temperature_gate.dm | 6 +- .../binary_devices/temperature_pump.dm | 6 +- .../components/binary_devices/volume_pump.dm | 10 +- .../machinery/components/components_base.dm | 2 +- .../machinery/components/fusion/hypertorus.dm | 45 +- .../components/trinary_devices/filter.dm | 22 +- .../components/trinary_devices/mixer.dm | 22 +- .../components/unary_devices/cryo.dm | 18 +- .../unary_devices/heat_exchanger.dm | 8 +- .../unary_devices/outlet_injector.dm | 8 +- .../components/unary_devices/thermomachine.dm | 24 +- .../components/unary_devices/unary_devices.dm | 2 +- .../components/unary_devices/vent_pump.dm | 8 +- .../components/unary_devices/vent_scrubber.dm | 8 +- .../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 | 40 +- .../atmospherics/machinery/pipes/manifold.dm | 11 +- .../machinery/pipes/manifold4w.dm | 10 +- .../atmospherics/machinery/pipes/multiz.dm | 12 +- .../atmospherics/machinery/pipes/pipes.dm | 4 + .../atmospherics/machinery/pipes/simple.dm | 4 +- .../machinery/portable/canister.dm | 30 +- .../portable/portable_atmospherics.dm | 12 +- .../atmospherics/machinery/portable/pump.dm | 7 +- .../machinery/portable/scrubber.dm | 10 +- code/modules/awaymissions/gateway.dm | 7 +- .../awaymissions/mission_code/challenge.dm | 1 + code/modules/buildmode/buildmode.dm | 4 +- code/modules/buildmode/buttons.dm | 6 +- code/modules/cargo/centcom_podlauncher.dm | 2 +- code/modules/cargo/expressconsole.dm | 4 +- code/modules/cargo/gondolapod.dm | 4 +- code/modules/cargo/order.dm | 6 +- code/modules/cargo/packs.dm | 4 +- code/modules/cargo/supplypod.dm | 70 +-- 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 | 24 +- 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 | 12 +- code/modules/clothing/head/misc_special.dm | 20 +- code/modules/clothing/shoes/bananashoes.dm | 10 +- code/modules/clothing/shoes/miscellaneous.dm | 2 +- code/modules/clothing/spacesuits/hardsuit.dm | 5 +- code/modules/clothing/spacesuits/plasmamen.dm | 10 +- code/modules/detectivework/scanner.dm | 2 +- code/modules/events/pirates.dm | 10 +- code/modules/events/prison_break.dm | 2 +- code/modules/events/shuttle_loan.dm | 2 +- code/modules/events/stray_cargo.dm | 2 +- code/modules/flufftext/Hallucination.dm | 5 +- code/modules/food_and_drinks/drinks/drinks.dm | 78 ++- .../drinks/drinks/drinkingglass.dm | 49 +- .../modules/food_and_drinks/food/condiment.dm | 15 +- .../kitchen_machinery/gibber.dm | 19 +- .../kitchen_machinery/griddle.dm | 6 +- .../kitchen_machinery/grill.dm | 18 +- .../kitchen_machinery/icecream_vat.dm | 2 +- .../kitchen_machinery/microwave.dm | 31 +- .../kitchen_machinery/smartfridge.dm | 53 +- code/modules/food_and_drinks/pizzabox.dm | 86 +-- code/modules/games/cas.dm | 13 +- code/modules/holodeck/area_copy.dm | 2 +- code/modules/holodeck/items.dm | 8 +- code/modules/holodeck/turfs.dm | 2 +- .../hydroponics/beekeeping/honeycomb.dm | 4 +- code/modules/hydroponics/biogenerator.dm | 27 +- code/modules/hydroponics/fermenting_barrel.dm | 8 +- code/modules/hydroponics/hydroponics.dm | 95 +-- code/modules/hydroponics/plant_genes.dm | 6 +- code/modules/instruments/items.dm | 4 +- code/modules/library/lib_items.dm | 21 +- code/modules/library/random_books.dm | 2 +- .../library/skill_learning/skill_station.dm | 13 +- code/modules/library/soapstone.dm | 6 +- code/modules/mafia/controller.dm | 6 +- code/modules/mapping/mapping_helpers.dm | 6 +- .../modules/mining/equipment/explorer_gear.dm | 2 +- .../mining/equipment/kinetic_crusher.dm | 7 +- .../mining/equipment/marker_beacons.dm | 22 +- .../mining/equipment/regenerative_core.dm | 7 +- code/modules/mining/equipment/survival_pod.dm | 1 + code/modules/mining/lavaland/ash_flora.dm | 10 +- .../mining/lavaland/necropolis_chests.dm | 11 +- code/modules/mining/machine_redemption.dm | 6 +- code/modules/mining/machine_vending.dm | 6 +- code/modules/mining/ores_coins.dm | 17 +- .../modules/mob/dead/new_player/new_player.dm | 2 +- code/modules/mob/dead/observer/login.dm | 2 +- code/modules/mob/dead/observer/observer.dm | 10 +- code/modules/mob/living/brain/MMI.dm | 19 +- code/modules/mob/living/brain/death.dm | 2 +- code/modules/mob/living/brain/posibrain.dm | 22 +- .../carbon/alien/humanoid/alien_powers.dm | 1 + code/modules/mob/living/carbon/carbon.dm | 4 +- .../mob/living/carbon/carbon_update_icons.dm | 10 +- .../living/carbon/human/human_update_icons.dm | 22 +- .../carbon/human/species_types/flypeople.dm | 5 +- code/modules/mob/living/init_signals.dm | 4 +- code/modules/mob/living/living_defense.dm | 2 +- code/modules/mob/living/silicon/ai/ai.dm | 6 +- .../modules/mob/living/silicon/ai/multicam.dm | 6 +- code/modules/mob/living/silicon/pai/pai.dm | 8 +- .../mob/living/silicon/pai/software.dm | 2 +- .../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 | 23 +- .../mob/living/simple_animal/bot/floorbot.dm | 9 +- .../mob/living/simple_animal/bot/honkbot.dm | 8 +- .../living/simple_animal/bot/hygienebot.dm | 19 +- .../mob/living/simple_animal/bot/medbot.dm | 39 +- .../mob/living/simple_animal/bot/mulebot.dm | 13 +- .../mob/living/simple_animal/bot/secbot.dm | 12 +- .../mob/living/simple_animal/bot/vibebot.dm | 6 +- .../living/simple_animal/eldritch_demons.dm | 2 +- .../mob/living/simple_animal/hostile/bees.dm | 7 +- .../simple_animal/hostile/giant_spider.dm | 2 + .../hostile/megafauna/hierophant.dm | 2 +- .../mob/living/simple_animal/hostile/mimic.dm | 8 +- .../mob/living/simple_animal/simple_animal.dm | 4 +- .../mob/living/simple_animal/slime/slime.dm | 3 +- code/modules/mob/mob.dm | 4 +- code/modules/mob/mob_movement.dm | 2 +- .../computers/item/computer.dm | 21 +- .../computers/item/computer_components.dm | 2 +- .../computers/item/computer_ui.dm | 6 +- .../computers/item/laptop.dm | 13 +- .../computers/item/processor.dm | 2 +- .../computers/item/tablet.dm | 17 +- .../computers/machinery/modular_computer.dm | 33 +- .../computers/machinery/modular_console.dm | 2 +- .../modular_computers/file_system/program.dm | 4 +- .../file_system/programs/airestorer.dm | 2 +- .../programs/antagonist/revelation.dm | 2 +- .../file_system/programs/arcade.dm | 6 +- .../file_system/programs/radar.dm | 6 +- .../file_system/programs/sm_monitor.dm | 2 +- .../modular_computers/hardware/printer.dm | 2 +- code/modules/ninja/suit/ninjaDrainAct.dm | 4 +- code/modules/ninja/suit/suit_attackby.dm | 2 +- code/modules/paperwork/carbonpaper.dm | 16 +- code/modules/paperwork/clipboard.dm | 8 +- code/modules/paperwork/folders.dm | 12 +- code/modules/paperwork/paper.dm | 8 +- code/modules/paperwork/paper_cutter.dm | 11 +- code/modules/paperwork/paperbin.dm | 13 +- code/modules/paperwork/paperplane.dm | 11 +- code/modules/paperwork/pen.dm | 3 +- code/modules/paperwork/photocopier.dm | 2 +- code/modules/paperwork/ticketmachine.dm | 23 +- 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 | 17 +- code/modules/plumbing/plumbers/pumps.dm | 14 +- code/modules/plumbing/plumbers/synthesizer.dm | 7 +- code/modules/plumbing/plumbers/teleporter.dm | 2 +- code/modules/power/apc.dm | 559 ++++++++++-------- code/modules/power/cable.dm | 72 +-- code/modules/power/cell.dm | 21 +- code/modules/power/generator.dm | 19 +- code/modules/power/gravitygenerator.dm | 22 +- code/modules/power/lighting.dm | 25 +- code/modules/power/pipecleaners.dm | 39 +- code/modules/power/port_gen.dm | 5 +- code/modules/power/power.dm | 6 +- code/modules/power/singularity/collector.dm | 6 +- code/modules/power/singularity/emitter.dm | 22 +- .../power/singularity/field_generator.dm | 10 +- code/modules/power/smes.dm | 29 +- code/modules/power/solar.dm | 12 +- code/modules/power/supermatter/supermatter.dm | 4 +- .../projectiles/ammunition/_ammunition.dm | 19 +- .../modules/projectiles/ammunition/_firing.dm | 2 +- .../ammunition/caseless/_caseless.dm | 4 +- .../projectiles/ammunition/caseless/foam.dm | 27 +- .../boxes_magazines/_box_magazine.dm | 58 +- .../boxes_magazines/external/lmg.dm | 6 +- .../boxes_magazines/external/pistol.dm | 22 +- .../boxes_magazines/external/rechargable.dm | 9 +- .../boxes_magazines/external/rifle.dm | 10 +- .../boxes_magazines/external/shotgun.dm | 7 +- .../boxes_magazines/external/smg.dm | 52 +- .../boxes_magazines/external/sniper.dm | 10 +- .../boxes_magazines/external/toy.dm | 24 +- .../boxes_magazines/internal/_cylinder.dm | 2 +- code/modules/projectiles/gun.dm | 14 +- code/modules/projectiles/guns/ballistic.dm | 93 +-- .../projectiles/guns/ballistic/automatic.dm | 28 +- .../guns/ballistic/laser_gatling.dm | 10 +- .../projectiles/guns/ballistic/revolver.dm | 4 +- .../projectiles/guns/ballistic/rifle.dm | 4 +- code/modules/projectiles/guns/energy.dm | 42 +- .../projectiles/guns/energy/dueling.dm | 24 +- .../projectiles/guns/energy/energy_gun.dm | 19 +- .../guns/energy/kinetic_accelerator.dm | 4 +- .../projectiles/guns/energy/special.dm | 4 +- code/modules/projectiles/guns/magic.dm | 2 +- code/modules/projectiles/guns/magic/wand.dm | 13 +- .../projectiles/guns/misc/blastcannon.dm | 14 +- code/modules/projectiles/guns/misc/bow.dm | 15 +- .../projectiles/guns/misc/syringe_gun.dm | 6 +- code/modules/projectiles/projectile/magic.dm | 6 +- .../projectile/reusable/foam_dart.dm | 4 +- .../projectiles/projectile/special/curse.dm | 6 +- .../chemistry/machinery/chem_dispenser.dm | 17 +- .../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 +- .../reagents/chemistry/recipes/special.dm | 2 +- code/modules/reagents/reagent_containers.dm | 26 +- .../reagents/reagent_containers/blood_pack.dm | 17 +- .../reagents/reagent_containers/bottle.dm | 2 +- .../reagents/reagent_containers/dropper.dm | 15 +- .../reagents/reagent_containers/glass.dm | 2 +- .../reagents/reagent_containers/hypospray.dm | 41 +- .../reagents/reagent_containers/maunamug.dm | 43 +- .../reagents/reagent_containers/syringes.dm | 14 +- code/modules/reagents/reagent_dispenser.dm | 20 +- code/modules/recycling/conveyor2.dm | 42 +- code/modules/recycling/disposal/bin.dm | 44 +- .../recycling/disposal/construction.dm | 36 +- code/modules/research/bepis.dm | 38 +- code/modules/research/destructive_analyzer.dm | 13 +- code/modules/research/experimentor.dm | 8 +- .../research/nanites/nanite_chamber.dm | 35 +- .../nanites/nanite_chamber_computer.dm | 2 +- .../research/nanites/nanite_program_hub.dm | 1 - .../research/nanites/nanite_programmer.dm | 1 - .../modules/research/nanites/nanite_remote.dm | 6 +- .../research/nanites/public_chamber.dm | 33 +- code/modules/research/server.dm | 12 +- .../xenobiology/vatgrowing/microscope.dm | 2 +- .../xenobiology/vatgrowing/petri_dish.dm | 2 +- .../xenobiology/vatgrowing/vatgrower.dm | 4 +- .../lavalandruin_code/elephantgraveyard.dm | 4 +- .../ruins/spaceruin_code/hilbertshotel.dm | 4 +- .../security_levels/keycard_authentication.dm | 4 +- .../security_levels/security_levels.dm | 8 +- code/modules/shuttle/on_move.dm | 4 +- code/modules/shuttle/shuttle_rotate.dm | 2 +- .../shuttle/spaceship_navigation_beacon.dm | 7 +- 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/mecha/_mecha.dm | 20 +- .../mecha/equipment/weapons/mecha_ammo.dm | 22 +- code/modules/vehicles/mecha/mech_bay.dm | 14 +- code/modules/vehicles/motorized_wheelchair.dm | 2 +- code/modules/vehicles/pimpin_ride.dm | 8 +- code/modules/vending/_vending.dm | 20 +- icons/obj/machines/medical_kiosk.dmi | Bin 2331 -> 2330 bytes .../SiliconQoL/code/robotic_factory.dm | 1 + .../aesthetics/airlock/code/airlock.dm | 102 ++-- .../extinguisher/code/extinguisher.dm | 1 + .../crates_lockers/bluespace_locker.dm | 3 +- .../cloning/code/game/machinery/cloning.dm | 1 + .../game/objects/items/storage/rings.dm | 3 - .../modules/clothing/ears/ears.dm | 1 + .../hyposprays/code/game/hyposprays_II.dm | 1 + .../modules/inflatables/code/inflatable.dm | 1 + .../modules/sec_haul/code/guns/ammo.dm | 2 + tools/Redirector/Configurations.dm | 4 +- 595 files changed, 4768 insertions(+), 4208 deletions(-) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 6098ea22d88..52e0be78c38 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -82,13 +82,30 @@ #define EXAMINE_POSITION_BEFORE (1<<1) //End positions #define COMPONENT_EXNAME_CHANGED (1<<0) -///from base of atom/update_icon(): () + +///from base of [/atom/proc/update_appearance]: (updates) +#define COMSIG_ATOM_UPDATE_APPEARANCE "atom_update_appearance" + /// If returned from [COMSIG_ATOM_UPDATE_APPEARANCE] it prevents the atom from updating its name. + #define COMSIG_ATOM_NO_UPDATE_NAME UPDATE_NAME + /// If returned from [COMSIG_ATOM_UPDATE_APPEARANCE] it prevents the atom from updating its desc. + #define COMSIG_ATOM_NO_UPDATE_DESC UPDATE_DESC + /// If returned from [COMSIG_ATOM_UPDATE_APPEARANCE] it prevents the atom from updating its icon. + #define COMSIG_ATOM_NO_UPDATE_ICON UPDATE_ICON +///from base of [/atom/proc/update_name]: (updates) +#define COMSIG_ATOM_UPDATE_NAME "atom_update_name" +///from base of [/atom/proc/update_desc]: (updates) +#define COMSIG_ATOM_UPDATE_DESC "atom_update_desc" +///from base of [/atom/update_icon]: () #define COMSIG_ATOM_UPDATE_ICON "atom_update_icon" - #define COMSIG_ATOM_NO_UPDATE_ICON_STATE (1<<0) - #define COMSIG_ATOM_NO_UPDATE_OVERLAYS (1<<1) -///from base of atom/update_overlays(): (list/new_overlays) + /// If returned from [COMSIG_ATOM_UPDATE_ICON] it prevents the atom from updating its icon state. + #define COMSIG_ATOM_NO_UPDATE_ICON_STATE UPDATE_ICON_STATE + /// If returned from [COMSIG_ATOM_UPDATE_ICON] it prevents the atom from updating its overlays. + #define COMSIG_ATOM_NO_UPDATE_OVERLAYS UPDATE_OVERLAYS +///from base of [atom/update_icon_state]: () +#define COMSIG_ATOM_UPDATE_ICON_STATE "atom_update_icon_state" +///from base of [/atom/update_overlays]: (list/new_overlays) #define COMSIG_ATOM_UPDATE_OVERLAYS "atom_update_overlays" -///from base of atom/update_icon(): (signalOut, did_anything) +///from base of [/atom/update_icon]: (signalOut, did_anything) #define COMSIG_ATOM_UPDATED_ICON "atom_updated_icon" ///from base of atom/Entered(): (atom/movable/entering, /atom) #define COMSIG_ATOM_ENTERED "atom_entered" diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index aece8199dc7..37c4c514b39 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -62,6 +62,18 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 #define SUPERMATTER_IGNORES_1 (1 << 23) +// Update flags for [/atom/proc/update_appearance] +/// Update the atom's name +#define UPDATE_NAME (1<<0) +/// Update the atom's desc +#define UPDATE_DESC (1<<1) +/// Update the atom's icon state +#define UPDATE_ICON_STATE (1<<2) +/// Update the atom's overlays +#define UPDATE_OVERLAYS (1<<3) +/// Update the atom's icon +#define UPDATE_ICON (UPDATE_ICON_STATE|UPDATE_OVERLAYS) + /// If the thing can reflect light (lasers/energy) #define RICOCHET_SHINY (1<<0) /// If the thing can reflect matter (bullets/bomb shrapnel) diff --git a/code/_onclick/hud/action_button.dm b/code/_onclick/hud/action_button.dm index 412375a77e6..4b0ecfd25b1 100644 --- a/code/_onclick/hud/action_button.dm +++ b/code/_onclick/hud/action_button.dm @@ -130,7 +130,7 @@ name = "Show Buttons" else name = "Hide Buttons" - update_icon() + update_appearance() usr.update_action_buttons() /atom/movable/screen/movable/action_button/hide_toggle/AltClick(mob/user) @@ -151,14 +151,11 @@ hide_icon = settings["toggle_icon"] hide_state = settings["toggle_hide"] show_state = settings["toggle_show"] - update_icon() + update_appearance() /atom/movable/screen/movable/action_button/hide_toggle/update_overlays() . = ..() - if(hidden) - . += show_appearance - else - . += hide_appearance + . += hidden ? show_appearance : hide_appearance /atom/movable/screen/movable/action_button/MouseEntered(location,control,params) if(!QDELETED(src)) diff --git a/code/_onclick/hud/alien.dm b/code/_onclick/hud/alien.dm index 0c552a3afa7..ce78c63094a 100644 --- a/code/_onclick/hud/alien.dm +++ b/code/_onclick/hud/alien.dm @@ -87,7 +87,7 @@ pull_icon = new /atom/movable/screen/pull() pull_icon.icon = ui_style - pull_icon.update_icon() + pull_icon.update_appearance() pull_icon.screen_loc = ui_above_movement pull_icon.hud = src static_inventory += pull_icon @@ -109,14 +109,14 @@ zone_select = new /atom/movable/screen/zone_sel/alien() zone_select.hud = src - zone_select.update_icon() + zone_select.update_appearance() static_inventory += zone_select for(var/atom/movable/screen/inventory/inv in (static_inventory + toggleable_inventory)) if(inv.slot_id) inv.hud = src inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv - inv.update_icon() + inv.update_appearance() /datum/hud/alien/persistent_inventory_update() if(!mymob) diff --git a/code/_onclick/hud/alien_larva.dm b/code/_onclick/hud/alien_larva.dm index d656b57ea4b..4060da697b7 100644 --- a/code/_onclick/hud/alien_larva.dm +++ b/code/_onclick/hud/alien_larva.dm @@ -21,7 +21,7 @@ pull_icon = new /atom/movable/screen/pull() pull_icon.icon = 'icons/hud/screen_alien.dmi' - pull_icon.update_icon() + pull_icon.update_appearance() pull_icon.screen_loc = ui_above_movement pull_icon.hud = src hotkeybuttons += pull_icon @@ -33,5 +33,5 @@ zone_select = new /atom/movable/screen/zone_sel/alien() zone_select.hud = src - zone_select.update_icon() + zone_select.update_appearance() static_inventory += zone_select diff --git a/code/_onclick/hud/drones.dm b/code/_onclick/hud/drones.dm index 0128e2970c2..61c006ac6fe 100644 --- a/code/_onclick/hud/drones.dm +++ b/code/_onclick/hud/drones.dm @@ -26,7 +26,7 @@ if(inv.slot_id) inv.hud = src inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv - inv.update_icon() + inv.update_appearance() /datum/hud/dextrous/drone/persistent_inventory_update() diff --git a/code/_onclick/hud/families.dm b/code/_onclick/hud/families.dm index 0232e0dab2d..1183a82b096 100644 --- a/code/_onclick/hud/families.dm +++ b/code/_onclick/hud/families.dm @@ -3,6 +3,7 @@ desc = "Shows the current level of hostility the space police is planning to rain down on you. Better be careful." icon = 'icons/obj/gang/wanted_160x32.dmi' icon_state = "wanted_0" + base_icon_state = "wanted" screen_loc = ui_wanted_lvl /// Wanted level, affects the hud icon. Level 0 is default, and the level 0 icon is blank, so in case of no families gamemode (and thus no wanted level), this HUD element will never appear. var/level = 0 @@ -14,7 +15,7 @@ /atom/movable/screen/wanted/Initialize() . = ..() - update_icon() + update_appearance() /atom/movable/screen/wanted/MouseEntered(location,control,params) openToolTip(usr,src,params,title = name,content = desc, theme = "alerttooltipstyle") @@ -23,5 +24,5 @@ closeToolTip(usr) /atom/movable/screen/wanted/update_icon_state() - . = ..() - icon_state = "wanted_[level][cops_arrived ? "_active" : ""]" + icon_state = "[base_icon_state]_[level][cops_arrived ? "_active" : null]" + return ..() diff --git a/code/_onclick/hud/generic_dextrous.dm b/code/_onclick/hud/generic_dextrous.dm index ffddafdc610..9358ef18384 100644 --- a/code/_onclick/hud/generic_dextrous.dm +++ b/code/_onclick/hud/generic_dextrous.dm @@ -11,7 +11,7 @@ pull_icon = new /atom/movable/screen/pull() pull_icon.icon = ui_style - pull_icon.update_icon() + pull_icon.update_appearance() pull_icon.screen_loc = ui_drone_pull pull_icon.hud = src static_inventory += pull_icon @@ -42,7 +42,7 @@ zone_select = new /atom/movable/screen/zone_sel() zone_select.icon = ui_style zone_select.hud = src - zone_select.update_icon() + zone_select.update_appearance() static_inventory += zone_select using = new /atom/movable/screen/area_creator @@ -56,7 +56,7 @@ if(inv.slot_id) inv.hud = src inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv - inv.update_icon() + inv.update_appearance() /datum/hud/dextrous/persistent_inventory_update() if(!mymob) diff --git a/code/_onclick/hud/guardian.dm b/code/_onclick/hud/guardian.dm index 1c5bcd4362c..e5fbab5ddef 100644 --- a/code/_onclick/hud/guardian.dm +++ b/code/_onclick/hud/guardian.dm @@ -7,7 +7,7 @@ pull_icon = new /atom/movable/screen/pull() pull_icon.icon = ui_style - pull_icon.update_icon() + pull_icon.update_appearance() pull_icon.screen_loc = ui_living_pull pull_icon.hud = src static_inventory += pull_icon @@ -70,7 +70,7 @@ pull_icon = new /atom/movable/screen/pull() pull_icon.icon = 'icons/hud/guardian.dmi' - pull_icon.update_icon() + pull_icon.update_appearance() pull_icon.screen_loc = ui_living_pull pull_icon.hud = src static_inventory += pull_icon diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index 0afa9538cc9..ce9be78fe4b 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -297,7 +297,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list( hand_slots["[i]"] = hand_box hand_box.hud = src static_inventory += hand_box - hand_box.update_icon() + hand_box.update_appearance() var/i = 1 for(var/atom/movable/screen/swap_hand/SH in static_inventory) diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 18d720c3394..572220dc3bc 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -293,7 +293,7 @@ pull_icon = new /atom/movable/screen/pull() pull_icon.icon = ui_style - pull_icon.update_icon() + pull_icon.update_appearance() pull_icon.screen_loc = ui_above_intent pull_icon.hud = src static_inventory += pull_icon @@ -309,7 +309,7 @@ zone_select = new /atom/movable/screen/zone_sel() zone_select.icon = ui_style zone_select.hud = src - zone_select.update_icon() + zone_select.update_appearance() static_inventory += zone_select combo_display = new /atom/movable/screen/combo() @@ -319,7 +319,7 @@ if(inv.slot_id) inv.hud = src inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv - inv.update_icon() + inv.update_appearance() update_locked_slots() diff --git a/code/_onclick/hud/living.dm b/code/_onclick/hud/living.dm index 8afb7892404..366079f233d 100644 --- a/code/_onclick/hud/living.dm +++ b/code/_onclick/hud/living.dm @@ -6,7 +6,7 @@ pull_icon = new /atom/movable/screen/pull() pull_icon.icon = ui_style - pull_icon.update_icon() + pull_icon.update_appearance() pull_icon.screen_loc = ui_living_pull pull_icon.hud = src static_inventory += pull_icon diff --git a/code/_onclick/hud/ooze.dm b/code/_onclick/hud/ooze.dm index a43515b1051..d3ebe3e7288 100644 --- a/code/_onclick/hud/ooze.dm +++ b/code/_onclick/hud/ooze.dm @@ -5,7 +5,7 @@ zone_select = new /atom/movable/screen/zone_sel() zone_select.icon = ui_style zone_select.hud = src - zone_select.update_icon() + zone_select.update_appearance() static_inventory += zone_select alien_plasma_display = new /atom/movable/screen/ooze_nutrition_display //Just going to use the alien plasma display because making new vars for each object is braindead. diff --git a/code/_onclick/hud/revenanthud.dm b/code/_onclick/hud/revenanthud.dm index 0e7b7959655..75865d3d454 100644 --- a/code/_onclick/hud/revenanthud.dm +++ b/code/_onclick/hud/revenanthud.dm @@ -6,7 +6,7 @@ pull_icon = new /atom/movable/screen/pull() pull_icon.icon = ui_style - pull_icon.update_icon() + pull_icon.update_appearance() pull_icon.screen_loc = ui_living_pull pull_icon.hud = src static_inventory += pull_icon diff --git a/code/_onclick/hud/robot.dm b/code/_onclick/hud/robot.dm index cffffd605b9..d140db11f0e 100644 --- a/code/_onclick/hud/robot.dm +++ b/code/_onclick/hud/robot.dm @@ -168,13 +168,13 @@ pull_icon.icon = 'icons/hud/screen_cyborg.dmi' pull_icon.screen_loc = ui_borg_pull pull_icon.hud = src - pull_icon.update_icon() + pull_icon.update_appearance() hotkeybuttons += pull_icon zone_select = new /atom/movable/screen/zone_sel/robot() zone_select.hud = src - zone_select.update_icon() + zone_select.update_appearance() static_inventory += zone_select // SKYRAT EDIT ADDITION BEGIN: Cyborg PDA @@ -287,6 +287,7 @@ /atom/movable/screen/robot/lamp name = "headlamp" icon_state = "lamp_off" + base_icon_state = "lamp" var/mob/living/silicon/robot/robot /atom/movable/screen/robot/lamp/Click() @@ -294,13 +295,11 @@ if(.) return robot?.toggle_headlamp() - update_icon() + update_appearance() -/atom/movable/screen/robot/lamp/update_icon() - if(robot?.lamp_enabled) - icon_state = "lamp_on" - else - icon_state = "lamp_off" +/atom/movable/screen/robot/lamp/update_icon_state() + icon_state = "[base_icon_state]_[robot?.lamp_enabled ? "on" : "off"]" + return ..() /atom/movable/screen/robot/modPC name = "Modular Interface" diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index f1e06534e36..3bb1a4818a0 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -162,11 +162,10 @@ if(!icon_empty) icon_empty = icon_state - if(hud?.mymob && slot_id && icon_full) - if(hud.mymob.get_item_by_slot(slot_id)) - icon_state = icon_full - else - icon_state = icon_empty + if(!hud?.mymob || !slot_id || !icon_full) + return ..() + icon_state = hud.mymob.get_item_by_slot(slot_id) ? icon_full : icon_empty + return ..() /atom/movable/screen/inventory/proc/add_overlays() var/mob/user = hud?.mymob @@ -274,20 +273,20 @@ /atom/movable/screen/combattoggle/New(loc, ...) . = ..() - update_icon() + update_appearance() /atom/movable/screen/combattoggle/Click() if(isliving(usr)) var/mob/living/owner = usr owner.set_combat_mode(!owner.combat_mode, FALSE) - update_icon() + update_appearance() /atom/movable/screen/combattoggle/update_icon_state() - . = ..() var/mob/living/user = hud?.mymob if(!istype(user) || !user.client) - return + return ..() icon_state = user.combat_mode ? "combat" : "combat_off" //Treats the combat_mode + return ..() //Version of the combat toggle with the flashy overlay /atom/movable/screen/combattoggle/flashy @@ -300,11 +299,13 @@ if(!istype(user) || !user.client) return - if(user.combat_mode) - if(!flashy) - flashy = mutable_appearance('icons/hud/screen_gen.dmi', "togglefull_flash") - flashy.color = "#C62727" - . += flashy + if(!user.combat_mode) + return + + if(!flashy) + flashy = mutable_appearance('icons/hud/screen_gen.dmi', "togglefull_flash") + flashy.color = "#C62727" + . += flashy /atom/movable/screen/combattoggle/robot icon = 'icons/hud/screen_cyborg.dmi' @@ -389,6 +390,7 @@ icon_state = "walking" if(MOVE_INTENT_RUN) icon_state = "running" + return ..() /atom/movable/screen/mov_intent/proc/toggle(mob/user) if(isobserver(user)) @@ -399,6 +401,7 @@ name = "stop pulling" icon = 'icons/hud/screen_midnight.dmi' icon_state = "pull" + base_icon_state = "pull" /atom/movable/screen/pull/Click() if(isobserver(usr)) @@ -406,10 +409,8 @@ usr.stop_pulling() /atom/movable/screen/pull/update_icon_state() - if(hud?.mymob?.pulling) - icon_state = "pull" - else - icon_state = "pull0" + icon_state = "[base_icon_state][hud?.mymob?.pulling ? null : 0]" + return ..() /atom/movable/screen/resist name = "resist" @@ -427,6 +428,7 @@ name = "rest" icon = 'icons/hud/screen_midnight.dmi' icon_state = "act_rest" + base_icon_state = "act_rest" layer = HUD_LAYER plane = HUD_PLANE @@ -438,11 +440,9 @@ /atom/movable/screen/rest/update_icon_state() var/mob/living/user = hud?.mymob if(!istype(user)) - return - if(!user.resting) - icon_state = "act_rest" - else - icon_state = "act_rest0" + return ..() + icon_state = "[base_icon_state][user.resting ? 0 : null]" + return ..() /atom/movable/screen/storage name = "storage" @@ -580,7 +580,7 @@ if(choice != hud.mymob.zone_selected) hud.mymob.zone_selected = choice - update_icon() + update_appearance() return TRUE @@ -747,14 +747,15 @@ /atom/movable/screen/combo/update_icon_state(streak = "") clear_streak() - if (timerid) + if(timerid) deltimer(timerid) - if (!streak) - return + if(!streak) + return ..() timerid = addtimer(CALLBACK(src, .proc/clear_streak), 20, TIMER_UNIQUE | TIMER_STOPPABLE) icon_state = "combo" - for (var/i = 1; i <= length(streak); ++i) + for(var/i = 1; i <= length(streak); ++i) var/intent_text = copytext(streak, i, i + 1) var/image/intent_icon = image(icon,src,"combo_[intent_text]") intent_icon.pixel_x = 16 * (i - 1) - 8 * length(streak) add_overlay(intent_icon) + return ..() diff --git a/code/_onclick/telekinesis.dm b/code/_onclick/telekinesis.dm index 8712b362484..959c8a71577 100644 --- a/code/_onclick/telekinesis.dm +++ b/code/_onclick/telekinesis.dm @@ -109,7 +109,7 @@ /obj/item/tk_grab/process() if(check_if_focusable(focus)) //if somebody grabs your thing, no waiting for them to put it down and hitting them again. - update_icon() + update_appearance() /obj/item/tk_grab/dropped(mob/user) if(focus && user && loc != user && loc != user.loc) // drop_item() gets called when you tk-attack a table/closet with an item @@ -139,7 +139,7 @@ return if(focus.attack_self_tk(user) & COMPONENT_CANCEL_ATTACK_CHAIN) . = TRUE - update_icon() + update_appearance() /obj/item/tk_grab/afterattack(atom/target, mob/living/carbon/user, proximity, params)//TODO: go over this @@ -160,7 +160,7 @@ if(target == focus) if(target.attack_self_tk(user) & COMPONENT_CANCEL_ATTACK_CHAIN) . = TRUE - update_icon() + update_appearance() return if(!isturf(target) && isitem(focus) && target.Adjacent(focus)) @@ -175,7 +175,7 @@ //Only items can be thrown 10 tiles everything else only 1 tile focus.throw_at(target, focus.tk_throw_range, 1,user) user.changeNext_move(CLICK_CD_MELEE) - update_icon() + update_appearance() /proc/tkMaxRangeCheck(mob/user, atom/target) @@ -192,7 +192,7 @@ if(!check_if_focusable(target)) return focus = target - update_icon() + update_appearance() apply_focus_overlay() return TRUE diff --git a/code/controllers/subsystem/communications.dm b/code/controllers/subsystem/communications.dm index 39cebb1f671..3bab7faf704 100644 --- a/code/controllers/subsystem/communications.dm +++ b/code/controllers/subsystem/communications.dm @@ -40,7 +40,7 @@ SUBSYSTEM_DEF(communications) var/obj/item/paper/P = new /obj/item/paper(C.loc) P.name = "paper - '[sending.title]'" P.info = sending.content - P.update_icon() + P.update_appearance() #undef COMMUNICATION_COOLDOWN #undef COMMUNICATION_COOLDOWN_AI diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 515e94a6634..075fd8cc3f3 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -176,7 +176,7 @@ Used by the AI doomsday and the self-destruct nuke. for(var/N in nuke_tiles) var/turf/open/floor/circuit/C = N - C.update_icon() + C.update_appearance() /datum/controller/subsystem/mapping/Recover() flags |= SS_NO_INIT diff --git a/code/controllers/subsystem/persistence.dm b/code/controllers/subsystem/persistence.dm index 9e6c0475b35..0b0b79af890 100644 --- a/code/controllers/subsystem/persistence.dm +++ b/code/controllers/subsystem/persistence.dm @@ -169,7 +169,7 @@ SUBSYSTEM_DEF(persistence) T.showpiece = new /obj/item/showpiece_dummy(T, path) T.trophy_message = chosen_trophy["message"] T.placer_key = chosen_trophy["placer_key"] - T.update_icon() + T.update_appearance() /datum/controller/subsystem/persistence/proc/CollectData() CollectChiselMessages() diff --git a/code/datums/action.dm b/code/datums/action.dm index 7f7cd083aa9..e91f44e0edb 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -141,7 +141,6 @@ /datum/action/proc/OnUpdatedIcon() SIGNAL_HANDLER - UpdateButtonIcon() //Presets for item actions diff --git a/code/datums/components/acid.dm b/code/datums/components/acid.dm index 1c5c5a4adc6..003fdff5118 100644 --- a/code/datums/components/acid.dm +++ b/code/datums/components/acid.dm @@ -49,7 +49,7 @@ var/atom/parent_atom = parent RegisterSignal(parent, COMSIG_ATOM_UPDATE_OVERLAYS, .proc/on_update_overlays) - parent_atom.update_icon() + parent_atom.update_appearance() sizzle = new(list(parent), TRUE) START_PROCESSING(SSacid, src) @@ -62,7 +62,7 @@ UnregisterSignal(parent, COMSIG_ATOM_UPDATE_OVERLAYS) if(parent && !QDELING(parent)) var/atom/parent_atom = parent - parent_atom.update_icon() + parent_atom.update_appearance() return ..() /datum/component/acid/RegisterWithParent() diff --git a/code/datums/components/armor_plate.dm b/code/datums/components/armor_plate.dm index 16d16ab83aa..156ee14d95e 100644 --- a/code/datums/components/armor_plate.dm +++ b/code/datums/components/armor_plate.dm @@ -72,7 +72,7 @@ if(ismecha(O)) var/obj/vehicle/sealed/mecha/R = O - R.update_icon() + R.update_appearance() to_chat(user, "You strengthen [R], improving its resistance against melee, bullet and laser damage.") else SEND_SIGNAL(O, COMSIG_ARMOR_PLATED, amount, maxamount) diff --git a/code/datums/components/bloodysoles.dm b/code/datums/components/bloodysoles.dm index 59c8a7fc560..660f010f034 100644 --- a/code/datums/components/bloodysoles.dm +++ b/code/datums/components/bloodysoles.dm @@ -141,7 +141,7 @@ add_parent_to_footprint(oldLocFP) if (!(oldLocFP.exited_dirs & wielder.dir)) oldLocFP.exited_dirs |= wielder.dir - oldLocFP.update_icon() + oldLocFP.update_appearance() else if(find_pool_by_blood_state(oldLocTurf)) // No footprints in the tile we left, but there was some other blood pool there. Add exit footprints on it bloody_shoes[last_blood_state] -= half_our_blood @@ -153,7 +153,7 @@ add_parent_to_footprint(oldLocFP) oldLocFP.bloodiness = half_our_blood oldLocFP.add_blood_DNA(parent_atom.return_blood_DNA()) - oldLocFP.update_icon() + oldLocFP.update_appearance() half_our_blood = bloody_shoes[last_blood_state] / 2 @@ -172,7 +172,7 @@ add_parent_to_footprint(FP) FP.bloodiness = half_our_blood FP.add_blood_DNA(parent_atom.return_blood_DNA()) - FP.update_icon() + FP.update_appearance() /** @@ -193,7 +193,7 @@ if((bloody_shoes[last_blood_state] / 2) >= BLOOD_FOOTPRINTS_MIN && !(pool_FP.entered_dirs & wielder.dir)) // If our feet are bloody enough, add an entered dir pool_FP.entered_dirs |= wielder.dir - pool_FP.update_icon() + pool_FP.update_appearance() share_blood(pool) diff --git a/code/datums/components/grillable.dm b/code/datums/components/grillable.dm index 08095c99441..0ad66639002 100644 --- a/code/datums/components/grillable.dm +++ b/code/datums/components/grillable.dm @@ -62,7 +62,7 @@ RegisterSignal(parent, COMSIG_ATOM_UPDATE_OVERLAYS, .proc/AddGrilledItemOverlay) var/atom/A = parent - A.update_icon() + A.update_appearance() ///Ran when an object finished grilling /datum/component/grillable/proc/FinishGrilling(atom/grill_source) @@ -98,7 +98,7 @@ currently_grilling = FALSE UnregisterSignal(parent, COMSIG_ATOM_UPDATE_OVERLAYS) UnregisterSignal(parent, COMSIG_MOVABLE_MOVED) - A.update_icon() + A.update_appearance() /datum/component/grillable/proc/AddGrilledItemOverlay(datum/source, list/overlays) SIGNAL_HANDLER diff --git a/code/datums/components/plumbing/_plumbing.dm b/code/datums/components/plumbing/_plumbing.dm index 1cf3d70caf4..6ceefcbccb8 100644 --- a/code/datums/components/plumbing/_plumbing.dm +++ b/code/datums/components/plumbing/_plumbing.dm @@ -195,7 +195,7 @@ for(var/obj/machinery/duct/duct in get_step(parent, D)) if(duct.duct_layer == ducting_layer) duct.remove_connects(turn(D, 180)) - duct.update_icon() + duct.update_appearance() ///settle wherever we are, and start behaving like a piece of plumbing /datum/component/plumbing/proc/enable() @@ -279,14 +279,14 @@ SIGNAL_HANDLER tile_covered = intact - AM.update_icon() + AM.update_appearance() /datum/component/plumbing/proc/change_ducting_layer(obj/caller, obj/O, new_layer = DUCT_LAYER_DEFAULT) ducting_layer = new_layer if(ismovable(parent)) var/atom/movable/AM = parent - AM.update_icon() + AM.update_appearance() if(O) playsound(O, 'sound/items/ratchet.ogg', 10, TRUE) //sound diff --git a/code/datums/components/storage/concrete/_concrete.dm b/code/datums/components/storage/concrete/_concrete.dm index 7b0e9bbba82..a04099dd0f7 100644 --- a/code/datums/components/storage/concrete/_concrete.dm +++ b/code/datums/components/storage/concrete/_concrete.dm @@ -139,7 +139,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) @@ -195,7 +195,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 8eb7844cfb5..b19c849df07 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -703,7 +703,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/swabbing.dm b/code/datums/components/swabbing.dm index 71759689de9..37f94afbcb7 100644 --- a/code/datums/components/swabbing.dm +++ b/code/datums/components/swabbing.dm @@ -82,7 +82,7 @@ This component is used in vat growing to swab for microbiological samples which LAZYCLEARLIST(swabbed_items) var/obj/item/I = parent - I.update_icon() + I.update_appearance() return COMPONENT_CANCEL_ATTACK_CHAIN if(!can_swab(target)) @@ -108,7 +108,7 @@ This component is used in vat growing to swab for microbiological samples which to_chat(user, "You manage to collect a microbiological sample from [target]!") var/obj/item/parent_item = parent - parent_item.update_icon() + parent_item.update_appearance() ///Checks if the swabbing component can swab the specific object or nots /datum/component/swabbing/proc/can_swab(atom/target) diff --git a/code/datums/components/twohanded.dm b/code/datums/components/twohanded.dm index 286fc58ba50..4088b8ff2d0 100644 --- a/code/datums/components/twohanded.dm +++ b/code/datums/components/twohanded.dm @@ -163,7 +163,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].") @@ -215,7 +215,7 @@ parent_item.name = "[initial(parent_item.name)]" // Update icons - parent_item.update_icon() + parent_item.update_appearance() if(istype(user)) // tk showed that we might not have a mob here if(user.get_item_by_slot(ITEM_SLOT_BACK) == parent) @@ -260,14 +260,14 @@ * * 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 f59e6eabf20..d60967f2722 100644 --- a/code/datums/diseases/appendicitis.dm +++ b/code/datums/diseases/appendicitis.dm @@ -28,7 +28,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/decal.dm b/code/datums/elements/decal.dm index d33f5bac775..5cf4b8a5e9e 100644 --- a/code/datums/elements/decal.dm +++ b/code/datums/elements/decal.dm @@ -14,7 +14,7 @@ RegisterSignal(target,COMSIG_ATOM_UPDATE_OVERLAYS,.proc/apply_overlay, 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)) @@ -37,7 +37,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)) - source.update_icon() + source.update_appearance() if(isitem(source)) INVOKE_ASYNC(source, /obj/item/.proc/update_slot_icon) return ..() @@ -46,7 +46,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 cd5f87775ba..0fcf22f4938 100644 --- a/code/datums/martial/sleeping_carp.dm +++ b/code/datums/martial/sleeping_carp.dm @@ -163,6 +163,7 @@ attack_verb_simple = list("smash", "slam", "whack", "thwack") 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 @@ -175,7 +176,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) @@ -190,7 +191,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, params) add_fingerprint(user) diff --git a/code/datums/quirks/neutral.dm b/code/datums/quirks/neutral.dm index b871f998a35..2431c12bac1 100644 --- a/code/datums/quirks/neutral.dm +++ b/code/datums/quirks/neutral.dm @@ -240,7 +240,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/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index f41a99c7c6a..26b1ffd91d0 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -382,13 +382,13 @@ /datum/status_effect/eldritch/on_apply() if(owner.mob_size >= MOB_SIZE_HUMAN) RegisterSignal(owner,COMSIG_ATOM_UPDATE_OVERLAYS,.proc/update_owner_underlay) - owner.update_icon() + owner.update_appearance() return TRUE return FALSE /datum/status_effect/eldritch/on_remove() UnregisterSignal(owner,COMSIG_ATOM_UPDATE_OVERLAYS) - owner.update_icon() + owner.update_appearance() return ..() /datum/status_effect/eldritch/proc/update_owner_underlay(atom/source, list/overlays) @@ -951,7 +951,7 @@ /datum/status_effect/cloudstruck/on_apply() mob_overlay = mutable_appearance('icons/effects/eldritch.dmi', "cloud_swirl", ABOVE_MOB_LAYER) owner.overlays += mob_overlay - owner.update_icon() + owner.update_appearance() ADD_TRAIT(owner, TRAIT_BLIND, "cloudstruck") return TRUE @@ -962,7 +962,7 @@ REMOVE_TRAIT(owner, TRAIT_BLIND, "cloudstruck") if(owner) owner.overlays -= mob_overlay - owner.update_icon() + owner.update_appearance() /datum/status_effect/cloudstruck/Destroy() . = ..() diff --git a/code/datums/status_effects/neutral.dm b/code/datums/status_effects/neutral.dm index c47158f74d4..4990a29da3d 100644 --- a/code/datums/status_effects/neutral.dm +++ b/code/datums/status_effects/neutral.dm @@ -109,7 +109,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/wires/airalarm.dm b/code/datums/wires/airalarm.dm index 87c17a1b451..6afccd54766 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 6ed570b88f6..ce8a7081fbd 100644 --- a/code/datums/wires/airlock.dm +++ b/code/datums/wires/airlock.dm @@ -105,13 +105,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 @@ -130,7 +130,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) @@ -185,7 +185,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/apc.dm b/code/datums/wires/apc.dm index 88f55dc7cab..83c527bebdc 100644 --- a/code/datums/wires/apc.dm +++ b/code/datums/wires/apc.dm @@ -29,14 +29,14 @@ if(WIRE_POWER1, WIRE_POWER2) // Short for a long while. if(!A.shorted) A.shorted = TRUE - addtimer(CALLBACK(A, /obj/machinery/power/apc.proc/reset, wire), 1200) + addtimer(CALLBACK(A, /obj/machinery/power/apc.proc/reset, wire), 2 MINUTES) if(WIRE_IDSCAN) // Unlock for a little while. A.locked = FALSE - addtimer(CALLBACK(A, /obj/machinery/power/apc.proc/reset, wire), 300) + addtimer(CALLBACK(A, /obj/machinery/power/apc.proc/reset, wire), 30 SECONDS) if(WIRE_AI) // Disable AI control for a very short time. if(!A.aidisabled) A.aidisabled = TRUE - addtimer(CALLBACK(A, /obj/machinery/power/apc.proc/reset, wire), 10) + addtimer(CALLBACK(A, /obj/machinery/power/apc.proc/reset, wire), 1 SECONDS) /datum/wires/apc/on_cut(index, mend) var/obj/machinery/power/apc/A = holder @@ -44,15 +44,11 @@ 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 - else - A.aidisabled = TRUE + A.aidisabled = !mend /datum/wires/apc/can_reveal_wires(mob/user) if(HAS_TRAIT(user, TRAIT_KNOW_ENGI_WIRES)) diff --git a/code/datums/wires/syndicatebomb.dm b/code/datums/wires/syndicatebomb.dm index 32a7739b36d..b5147a3c760 100644 --- a/code/datums/wires/syndicatebomb.dm +++ b/code/datums/wires/syndicatebomb.dm @@ -50,7 +50,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 @@ -82,7 +82,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 9c9f52bb4a6..494ff044531 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -348,7 +348,7 @@ GLOBAL_LIST_EMPTY(teleportlocs) ModifyFiredoors(FALSE) for(var/item in firealarms) var/obj/machinery/firealarm/F = item - F.update_icon() + F.update_appearance() if (!(area_flags & NO_ALERTS)) //Check here instead at the start of the proc so that fire alarms can still work locally even in areas that don't send alerts for (var/item in GLOB.alert_consoles) var/obj/machinery/computer/station_alert/a = item @@ -378,7 +378,7 @@ GLOBAL_LIST_EMPTY(teleportlocs) ModifyFiredoors(TRUE) for(var/item in firealarms) var/obj/machinery/firealarm/F = item - F.update_icon() + F.update_appearance() if (!(area_flags & NO_ALERTS)) //Check here instead at the start of the proc so that fire alarms can still work locally even in areas that don't send alerts for (var/item in GLOB.silicon_mobs) var/mob/living/silicon/aiPlayer = item @@ -483,11 +483,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 @@ -528,7 +530,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 258f48b8e46..f07727c8591 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -643,18 +643,52 @@ if(!LAZYLEN(.)) // lol ..length return list("You examine [src] closer, but find nothing of interest...") +/** + * Updates the appearence of the icon + * + * Mostly delegates to update_name, update_desc, and update_icon + * + * Arguments: + * - updates: A set of bitflags dictating what should be updated. Defaults to [ALL] + */ +/atom/proc/update_appearance(updates=ALL) + SHOULD_NOT_SLEEP(TRUE) + SHOULD_CALL_PARENT(TRUE) + + . = NONE + updates &= ~SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_APPEARANCE, updates) + if(updates & UPDATE_NAME) + . |= update_name(updates) + if(updates & UPDATE_DESC) + . |= update_desc(updates) + if(updates & UPDATE_ICON) + . |= update_icon(updates) + +/// Updates the name of the atom +/atom/proc/update_name(updates=ALL) + SHOULD_CALL_PARENT(TRUE) + return SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_NAME, updates) + +/// Updates the description of the atom +/atom/proc/update_desc(updates=ALL) + SHOULD_CALL_PARENT(TRUE) + 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) @@ -662,12 +696,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/gamemodes/clown_ops/bananium_bomb.dm b/code/game/gamemodes/clown_ops/bananium_bomb.dm index f7bb2ad1274..28294860e26 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" + 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" /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 a512523b1b6..b8afc2db56e 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.the_station_areas) @@ -34,14 +34,14 @@ for(var/obj/machinery/power/apc/C in GLOB.machines) if(C.cell && is_station_level(C.z)) 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(!is_station_level(S.z)) 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.the_station_areas) if(!A.requires_power || A.always_unpowered) @@ -61,6 +61,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_handler.dm b/code/game/gamemodes/gang/gang_handler.dm index 294ae0330e8..7732885b074 100644 --- a/code/game/gamemodes/gang/gang_handler.dm +++ b/code/game/gamemodes/gang/gang_handler.dm @@ -346,7 +346,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() /// Internal. Updates the end_time and sends out an announcement if the wanted level has increased. Called by update_wanted_level(). /datum/gang_handler/proc/on_gain_wanted_level(newlevel) diff --git a/code/game/gamemodes/sandbox/h_sandbox.dm b/code/game/gamemodes/sandbox/h_sandbox.dm index 777dc057af7..7a984f34676 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 89a24ef3dba..cb393a5e35b 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/living/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 fab8f6a4020..b1135325546 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 @@ -35,7 +36,7 @@ LAZYREMOVE(component_parts, circuit) QDEL_NULL(circuit) occupant_typecache = GLOB.typecache_living - update_icon() + update_appearance() reset_chem_buttons() /obj/machinery/sleeper/RefreshParts() @@ -54,10 +55,8 @@ reset_chem_buttons() /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]!", @@ -266,6 +265,7 @@ /obj/machinery/sleeper/syndie icon_state = "sleeper_s" + base_icon_state = "sleeper_s" controls_inside = TRUE /obj/machinery/sleeper/syndie/fullupgrade/Initialize() @@ -286,11 +286,13 @@ /obj/machinery/sleeper/old icon_state = "oldpod" + base_icon_state = "oldpod" /obj/machinery/sleeper/party name = "party pod" desc = "'Sleeper' units were once known for their healing properties, until a lengthy investigation revealed they were also dosing patients with deadly lead acetate. This appears to be one of those old 'sleeper' units repurposed as a 'Party Pod'. It’s probably not a good idea to use it." icon_state = "partypod" + base_icon_state = "partypod" idle_power_usage = 3000 circuit = /obj/item/circuitboard/machine/sleeper/party var/leddit = FALSE //Get it like reddit and lead alright fine diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 74c1f4989e0..49c7b27acda 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -222,7 +222,7 @@ density = FALSE if(drop) dump_inventory_contents() - update_icon() + update_appearance() updateUsrDialog() /** @@ -305,7 +305,7 @@ set_occupant(target) target.forceMove(src) updateUsrDialog() - update_icon() + update_appearance() /obj/machinery/proc/auto_use_power() if(!powered(power_channel)) @@ -530,7 +530,7 @@ 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) @@ -539,7 +539,7 @@ /obj/machinery/handle_atom_del(atom/A) if(A == occupant) set_occupant(null) - update_icon() + update_appearance() updateUsrDialog() return ..() diff --git a/code/game/machinery/accounting.dm b/code/game/machinery/accounting.dm index 4877329633b..2f08319f398 100644 --- a/code/game/machinery/accounting.dm +++ b/code/game/machinery/accounting.dm @@ -30,7 +30,7 @@ var/datum/bank_account/bank_account = new /datum/bank_account(inserted_id.registered_name) inserted_id.registered_account = bank_account playsound(loc, 'sound/machines/synth_yes.ogg', 30 , TRUE) - update_icon() + update_appearance() return return ..() @@ -51,21 +51,26 @@ /obj/machinery/accounting/proc/remove_card() UnregisterSignal(inserted_id, COMSIG_PARENT_QDELETING) inserted_id = null - update_icon() + update_appearance() /obj/machinery/accounting/update_overlays() . = ..() - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) - luminosity = 0 if(machine_stat & (NOPOWER|BROKEN) || !anchored) return if(panel_open) SSvis_overlays.add_vis_overlay(src, icon, "recharger-open", layer, plane, dir, alpha) return - luminosity = 1 if(inserted_id) 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) + return + + 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) + +/obj/machinery/accounting/update_appearance(updates) + . = ..() + if((machine_stat & (NOPOWER|BROKEN)) || panel_open || !anchored) + luminosity = 0 + return + luminosity = 1 diff --git a/code/game/machinery/ai_slipper.dm b/code/game/machinery/ai_slipper.dm index 847a2e62ee4..0c43e4ff7e2 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 6a9f2452e88..a99c60daa3a 100644 --- a/code/game/machinery/airlock_control.dm +++ b/code/game/machinery/airlock_control.dm @@ -2,6 +2,8 @@ // This code allows for airlocks to be controlled externally by setting an id_tag and comm frequency (disables ID access) /obj/machinery/door/airlock + /// The current state of the airlock, used to construct the airlock overlays + var/airlock_state var/frequency var/datum/radio_frequency/radio_connection @@ -22,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 @@ -44,7 +46,7 @@ locked = TRUE sleep(2) - update_icon() + update_appearance() send_status() @@ -86,6 +88,7 @@ /obj/machinery/airlock_sensor icon = 'icons/obj/airlock_machines.dmi' icon_state = "airlock_sensor_off" + base_icon_state = "airlock_sensor" name = "airlock sensor" resistance_flags = FIRE_PROOF @@ -112,13 +115,14 @@ master_tag = INCINERATOR_SYNDICATELAVA_AIRLOCK_CONTROLLER /obj/machinery/airlock_sensor/update_icon_state() - if(on) - if(alert) - icon_state = "airlock_sensor_alert" - else - icon_state = "airlock_sensor_standby" + if(!on) + icon_state = "[base_icon_state]_off" else - icon_state = "airlock_sensor_off" + if(alert) + icon_state = "[base_icon_state]_alert" + else + icon_state = "[base_icon_state]_standby" + return ..() /obj/machinery/airlock_sensor/attack_hand(mob/user, list/modifiers) . = ..() @@ -146,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/announcement_system.dm b/code/game/machinery/announcement_system.dm index 89454ae462d..98c7968b9cd 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 711dedd073d..5dc2bdbfbf6 100644 --- a/code/game/machinery/aug_manipulator.dm +++ b/code/game/machinery/aug_manipulator.dm @@ -3,11 +3,11 @@ desc = "A machine for custom fitting augmentations, with in-built spraypainter." icon = 'icons/obj/pda.dmi' icon_state = "pdapainter" + base_icon_state = "pdapainter" density = TRUE obj_integrity = 200 max_integrity = 200 var/obj/item/bodypart/storedpart - var/initial_icon_state var/static/list/style_list_icons = list("standard" = 'icons/mob/augmentation/augments.dmi', "engineer" = 'icons/mob/augmentation/augments_engineer.dmi', "security" = 'icons/mob/augmentation/augments_security.dmi', "mining" = 'icons/mob/augmentation/augments_mining.dmi') /obj/machinery/aug_manipulator/examine(mob/user) @@ -16,23 +16,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) @@ -50,7 +48,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/living/user, params) if(default_unfasten_wrench(user, O)) @@ -71,7 +69,7 @@ return storedpart = O O.add_fingerprint(user) - update_icon() + update_appearance() else if(O.tool_behaviour == TOOL_WELDER && !user.combat_mode) if(obj_integrity < max_integrity) @@ -88,7 +86,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 @@ -135,7 +133,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 d22dca8bd8d..8ccc4464e84 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -224,7 +224,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 edf7e08ed7f..c209d483f60 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.combat_mode && !(W.item_flags & NOBLUDGEON)) @@ -149,7 +151,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 @@ -178,7 +180,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 5315dec0724..b6e9a71b1df 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -16,7 +16,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 @@ -82,7 +82,7 @@ if(mapload && is_station_level(z) && 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) @@ -380,12 +380,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 @@ -416,7 +419,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 0eeb6596ee6..f042a8ec708 100644 --- a/code/game/machinery/camera/camera_assembly.dm +++ b/code/game/machinery/camera/camera_assembly.dm @@ -69,11 +69,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)) @@ -109,7 +110,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 @@ -174,7 +175,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 aa7ac1c7378..47615a045f5 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 1727ad41a47..775826dc684 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -55,7 +55,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 @@ -75,9 +75,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, list/modifiers) . = ..() @@ -135,4 +135,4 @@ charging.give(main_draw) use_power(charge_rate / 100) //use a small bit for the charger itself, but power usage scales up with the part tier - update_icon() + update_appearance() diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm index e13acbf67f2..64d0ebd730f 100644 --- a/code/game/machinery/computer/_computer.dm +++ b/code/game/machinery/computer/_computer.dm @@ -30,8 +30,6 @@ /obj/machinery/computer/update_overlays() . = ..() - - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) if(machine_stat & NOPOWER) . += "[icon_keyboard]_off" return diff --git a/code/game/machinery/computer/aifixer.dm b/code/game/machinery/computer/aifixer.dm index 3a32617e27b..8e6c0113af4 100644 --- a/code/game/machinery/computer/aifixer.dm +++ b/code/game/machinery/computer/aifixer.dm @@ -86,7 +86,7 @@ var/oldstat = occupier.stat restoring = Fix() if(oldstat != occupier.stat) - update_icon() + update_appearance() /obj/machinery/computer/aifixer/update_overlays() . = ..() @@ -95,14 +95,15 @@ 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(!..()) @@ -119,7 +120,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) @@ -128,7 +129,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 b49293a7f63..2b3fc59f2ab 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 @@ -132,7 +132,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 @@ -145,7 +145,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") @@ -168,7 +168,7 @@ log_game("Warning: possible href exploit by [key_name(usr)] - attempted to set [type] on [target] to [value]") return - 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 8962f0964f2..f7a4be6c237 100644 --- a/code/game/machinery/computer/arcade.dm +++ b/code/game/machinery/computer/arcade.dm @@ -131,7 +131,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/arena.dm b/code/game/machinery/computer/arena.dm index 9d6d0ff72d3..0d83aa86d8b 100644 --- a/code/game/machinery/computer/arena.dm +++ b/code/game/machinery/computer/arena.dm @@ -205,7 +205,7 @@ ready_to_spawn = !ready_to_spawn to_chat(user,"You [ready_to_spawn ? "enable" : "disable"] the spawners.") log_admin("[key_name(user)] toggled event arena spawning for [arena_id] arena.") - // Could use update_icon on spawnpoints here to show they're on + // Could use update_appearance on spawnpoints here to show they're on if(ready_to_spawn) for(var/mob/M in all_contestants()) to_chat(M,"Arena you're signed up for is ready!") diff --git a/code/game/machinery/computer/atmos_alert.dm b/code/game/machinery/computer/atmos_alert.dm index 8e04d4d796f..26019e67cfe 100644 --- a/code/game/machinery/computer/atmos_alert.dm +++ b/code/game/machinery/computer/atmos_alert.dm @@ -58,7 +58,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) @@ -81,7 +81,7 @@ priority_alarms += zone else if (severity == "minor") minor_alarms += zone - update_icon() + update_appearance() return /obj/machinery/computer/atmos_alert/update_overlays() @@ -90,5 +90,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 cf358d60b58..a3edc32172e 100644 --- a/code/game/machinery/computer/atmos_control.dm +++ b/code/game/machinery/computer/atmos_control.dm @@ -91,6 +91,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/camera.dm b/code/game/machinery/computer/camera.dm index 718beceee39..b05f73cce62 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -262,6 +262,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/medical.dm b/code/game/machinery/computer/medical.dm index c08162f58fa..22c23d701af 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -528,7 +528,7 @@ P.info += "Medical Record Lost!
" P.name = text("MR-[] '[]'", GLOB.data_core.medicalPrintCount, "Record Lost") P.info += "" - P.update_icon() + P.update_appearance() printing = null add_fingerprint(usr) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index cf25f7e94d3..df01c8465ff 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -414,7 +414,7 @@ What a mess.*/ P.info += "Security Record Lost!
" P.name = text("SR-[] '[]'", GLOB.data_core.securityPrintCount, "Record Lost") P.info += "" - P.update_icon() + P.update_appearance() printing = null if("Print Poster") if(!( printing )) diff --git a/code/game/machinery/computer/teleporter.dm b/code/game/machinery/computer/teleporter.dm index a63dc04110c..1ece68be2a8 100644 --- a/code/game/machinery/computer/teleporter.dm +++ b/code/game/machinery/computer/teleporter.dm @@ -74,13 +74,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 @@ -94,7 +94,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 @@ -111,7 +111,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) @@ -175,10 +175,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/dance_machine.dm b/code/game/machinery/dance_machine.dm index 58deec934e1..cd6a0afcff8 100644 --- a/code/game/machinery/dance_machine.dm +++ b/code/game/machinery/dance_machine.dm @@ -81,10 +81,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) @@ -177,7 +175,7 @@ /obj/machinery/jukebox/proc/activate_music() active = TRUE - update_icon() + update_appearance() START_PROCESSING(SSobj, src) stop = world.time + selection.song_length @@ -472,7 +470,7 @@ STOP_PROCESSING(SSobj, src) 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 26aaac8b836..57022bf665f 100644 --- a/code/game/machinery/defibrillator_mount.dm +++ b/code/game/machinery/defibrillator_mount.dm @@ -95,7 +95,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() @@ -108,7 +108,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 @@ -131,7 +131,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) @@ -169,7 +169,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" @@ -200,7 +200,7 @@ if(C.charge < C.maxcharge) use_power(50 * delta_time) C.give(40 * delta_time) - 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 2447a0805ff..6efd684daac 100644 --- a/code/game/machinery/dish_drive.dm +++ b/code/game/machinery/dish_drive.dm @@ -134,7 +134,7 @@ 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) else visible_message("There are no disposable items in [src]!") diff --git a/code/game/machinery/dna_scanner.dm b/code/game/machinery/dna_scanner.dm index e4b5e98372a..7c5ee131277 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 4a961f155d1..d46590b453e 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -122,6 +122,20 @@ //SKYRAT EDIT ADDITION BEGIN if(multi_tile) SetBounds() + //overlay2 + vis_overlay1 = new() + vis_overlay1.icon = overlays_file + //overlay1 + vis_overlay2 = new() + vis_overlay2.icon = overlays_file + vis_overlay2.layer = layer + vis_overlay2.plane = 1 + vis_contents += vis_overlay1 + vis_contents += vis_overlay2 + if(multi_tile) + vis_overlay1.dir = src.dir + vis_overlay2.dir = src.dir + update_overlays() //SKYRAT EDIT END wires = set_wires() if(frequency) @@ -176,7 +190,7 @@ panel_open = TRUE if(cutAiWire) wires.cut(WIRE_AI) - update_icon() + update_appearance() /obj/machinery/door/airlock/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) @@ -262,7 +276,7 @@ return emergency = !emergency - update_icon() + update_appearance() /obj/machinery/door/airlock/lock() bolt() @@ -273,7 +287,7 @@ locked = TRUE playsound(src,boltDown,30,FALSE,3) audible_message("You hear a click from the bottom of the door.", null, 1) - update_icon() + update_appearance() /obj/machinery/door/airlock/unlock() unbolt() @@ -284,7 +298,7 @@ locked = FALSE playsound(src,boltUp,30,FALSE,3) 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) @@ -325,10 +339,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)) @@ -369,7 +383,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 @@ -390,7 +404,7 @@ cont = TRUE spawnPowerRestoreRunning = FALSE updateDialog() - update_icon() + update_appearance() /obj/machinery/door/airlock/proc/loseMainPower() if(secondsMainPowerLost <= 0) @@ -400,7 +414,7 @@ if(!spawnPowerRestoreRunning) spawnPowerRestoreRunning = TRUE INVOKE_ASYNC(src, .proc/handlePowerRestore) - update_icon() + update_appearance() /obj/machinery/door/airlock/proc/loseBackupPower() if(secondsBackupPowerLost < 60) @@ -408,12 +422,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 @@ -433,24 +447,33 @@ 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) /* SKYRAT EDIT MOVED TO AIRLOCK.DM IN AESTHETICS MODULE -/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 @@ -461,8 +484,7 @@ var/mutable_appearance/note_overlay var/mutable_appearance/seal_overlay var/notetype = note_type() - - switch(state) + switch(airlock_state) if(AIRLOCK_CLOSED) frame_overlay = get_airlock_overlay("closed", icon) if(airlock_material) @@ -586,77 +608,46 @@ if(note) note_overlay = get_airlock_overlay("[notetype]_opening", note_overlay_file) - 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(seal_overlay) - check_unres() -*/ + . += frame_overlay + . += filling_overlay + . += lights_overlay + . += panel_overlay + . += weld_overlay + . += sparks_overlay + . += damag_overlay + . += note_overlay + . += seal_overlay -//SKYRAT EDIT CHANGE BEGIN - AESTHETICS -/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 - 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 - 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 - 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 - add_overlay(I) - -/* - SKYRAT ORIGINAL -/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) - 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) - 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) - 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) - else - set_light(0) + . += I */ -//SKYRAT EDIT END + /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) - addtimer(CALLBACK(src, /atom/proc/update_icon, AIRLOCK_CLOSED), AIRLOCK_DENY_ANIMATION_TIME) + addtimer(CALLBACK(src, /atom/proc/update_icon, ALL, AIRLOCK_CLOSED), AIRLOCK_DENY_ANIMATION_TIME) /obj/machinery/door/airlock/examine(mob/user) . = ..() @@ -851,7 +842,7 @@ user.visible_message("[user] reinforces \the [src] with iron.", "You reinforce \the [src] with iron.") security_level = AIRLOCK_SECURITY_IRON - update_icon() + update_appearance() return else if(istype(C, /obj/item/stack/sheet/plasteel)) var/obj/item/stack/sheet/plasteel/S = C @@ -867,7 +858,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_IRON) if(C.tool_behaviour == TOOL_WELDER) @@ -882,7 +873,7 @@ "You hear welding.") security_level = AIRLOCK_SECURITY_NONE spawn_atom_to_turf(/obj/item/stack/sheet/iron, user.loc, 2) - update_icon() + update_appearance() return if(AIRLOCK_SECURITY_PLASTEEL_I_S) if(C.tool_behaviour == TOOL_CROWBAR) @@ -899,7 +890,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) @@ -959,13 +950,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 @@ -999,7 +990,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) @@ -1010,7 +1001,7 @@ return user.visible_message("[user] pins [C] to [src].", "You pin [C] to [src].") note = C - update_icon() + update_appearance() else return ..() @@ -1032,7 +1023,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.") @@ -1048,7 +1039,7 @@ user.visible_message("[user] [welded? "welds shut":"unwelds"] [src].", \ "You [welded ? "weld the airlock shut":"unweld the airlock"].") log_game("[key_name(user)] [welded ? "welded":"unwelded"] airlock [src] with [tool] at [AREACOORD(src)]") - update_icon() + update_appearance() /obj/machinery/door/airlock/proc/weld_checks(obj/item/weldingtool/W, mob/user) return !operating && density @@ -1079,7 +1070,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 @@ -1161,7 +1152,7 @@ return TRUE SEND_SIGNAL(src, COMSIG_AIRLOCK_OPEN, forced) operating = TRUE - update_icon(AIRLOCK_OPENING, 1) + update_icon(ALL, AIRLOCK_OPENING, TRUE) sleep(1) set_opacity(0) //SKYRAT EDIT ADDITION BEGIN - LARGE_DOOR @@ -1179,7 +1170,7 @@ air_update_turf(TRUE, FALSE) 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 @@ -1217,7 +1208,7 @@ SSexplosions.med_mov_atom += killthis SEND_SIGNAL(src, COMSIG_AIRLOCK_CLOSE, forced) operating = TRUE - update_icon(AIRLOCK_CLOSING, 1) + update_icon(ALL, AIRLOCK_CLOSING, 1) layer = CLOSED_DOOR_LAYER if(air_tight) density = TRUE @@ -1244,7 +1235,7 @@ filler.set_opacity(TRUE) update_freelook_sight() sleep(1) - update_icon(AIRLOCK_CLOSED, 1) + update_icon(ALL, AIRLOCK_CLOSED, 1) operating = FALSE delayed_close_requested = FALSE if(!dangerous_close) @@ -1282,7 +1273,7 @@ icon = initial(airlock.icon) overlays_file = initial(airlock.overlays_file) assemblytype = initial(airlock.assemblytype) - update_icon() + update_appearance() /obj/machinery/door/airlock/CanAStarPass(obj/item/card/id/ID) //Airlock is passable if it is open (!density), bot has access, and is not bolted shut or powered off) @@ -1293,13 +1284,13 @@ if(istype(D, /obj/item/card/emag/doorjack)) D.use_charge(user) 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 @@ -1383,7 +1374,7 @@ flags_1 |= NODECONSTRUCT_1 //If an explosive took us out, don't drop the assembly . = ..() if(obj_integrity < (0.75 * max_integrity)) - update_icon() + update_appearance() /obj/machinery/door/airlock/deconstruct(disassembled = TRUE, mob/user) @@ -1401,7 +1392,7 @@ A.created_name = name A.previous_assembly = previous_airlock A.update_name() - A.update_icon() + A.update_appearance() if(!disassembled) if(A) @@ -1510,14 +1501,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 @@ -1541,7 +1532,7 @@ . = TRUE if("light-toggle") lights = !lights - update_icon() + update_appearance() . = TRUE if("safe-toggle") safe = !safe @@ -1600,7 +1591,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 1db8c337dd1..6d3ed6c06b1 100644 --- a/code/game/machinery/doors/airlock_types.dm +++ b/code/game/machinery/doors/airlock_types.dm @@ -233,7 +233,7 @@ DA.glass = TRUE if(heat_proof) DA.heat_proof_finished = TRUE - DA.update_icon() + DA.update_appearance() DA.update_name() qdel(src) @@ -501,7 +501,7 @@ name = "airlock" desc = "It opens and closes." stealthy = TRUE - update_icon() + update_appearance() /obj/machinery/door/airlock/cult/proc/reveal() icon = initial(icon) @@ -509,7 +509,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 7d3a0b94008..24bc0293c67 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. @@ -79,7 +79,7 @@ //if(world.time - activation_time >= timer_duration) //ORIGINAL if(world.realtime - activation_time >= timer_duration) //SKYRAT EDIT CHANGE 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. @@ -102,7 +102,7 @@ if(C.opened && !C.close()) continue C.locked = TRUE - C.update_icon() + C.update_appearance() return 1 @@ -118,7 +118,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) @@ -131,7 +131,7 @@ if(C.opened) continue C.locked = FALSE - C.update_icon() + C.update_appearance() return 1 @@ -158,8 +158,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 d07a8ed9d0d..d8ed7824d6b 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -4,6 +4,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 @@ -277,10 +278,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) @@ -312,7 +311,7 @@ flags_1 &= ~PREVENT_CLICK_UNDER_1 sleep(5) layer = initial(layer) - update_icon() + update_appearance() set_opacity(0) operating = FALSE air_update_turf(TRUE, FALSE) @@ -341,7 +340,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 2cabd3bf088..af6c42bdb1b 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -128,7 +128,7 @@ welded = !welded to_chat(user, "[user] [welded?"welds":"unwelds"] [src].", "You [welded ? "weld" : "unweld"] [src].") log_game("[key_name(user)] [welded ? "welded":"unwelded"] firedoor [src] with [W] at [AREACOORD(src)]") - update_icon() + update_appearance() /obj/machinery/door/firedoor/try_to_crowbar(obj/item/I, mob/user) if(welded || operating) @@ -167,19 +167,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() . = ..() @@ -199,7 +194,7 @@ else F.constructionStep = CONSTRUCTION_NO_CIRCUIT F.obj_integrity = F.max_integrity * 0.5 - F.update_icon() + F.update_appearance() else new /obj/item/electronics/firelock (T) qdel(src) @@ -263,6 +258,7 @@ desc = "A partially completed firelock." icon = 'icons/obj/doors/Doorfire.dmi' //ICON OVERRIDEN IN SKYRAT AESTHETICS - SEE MODULE icon_state = "frame1" + base_icon_state = "frame" anchored = FALSE density = TRUE var/constructionStep = CONSTRUCTION_NO_CIRCUIT @@ -279,7 +275,8 @@ . += "There are no firelock electronics in the frame. The frame could be welded 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) @@ -297,7 +294,7 @@ "You remove the circuit board from [src].") new /obj/item/electronics/firelock(drop_location()) constructionStep = CONSTRUCTION_NO_CIRCUIT - update_icon() + update_appearance() return if(C.tool_behaviour == TOOL_WRENCH) if(locate(/obj/machinery/door/firedoor) in get_turf(src)) @@ -378,7 +375,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_PANEL_OPEN - update_icon() + update_appearance() return return ..() @@ -395,7 +392,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_PANEL_OPEN - update_icon() + update_appearance() return TRUE if(RCD_DECONSTRUCT) to_chat(user, "You deconstruct [src].") diff --git a/code/game/machinery/doors/passworddoor.dm b/code/game/machinery/doors/passworddoor.dm index 225ee10bd71..efe87f016e5 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 67fecab39c9..a8b49a39b47 100644 --- a/code/game/machinery/doors/poddoor.dm +++ b/code/game/machinery/doors/poddoor.dm @@ -157,10 +157,8 @@ playsound(src, door_sound, 30, TRUE) //SKYRAT EDIT CHANGE - AESTHETICS /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 84ff78643b9..16ad607382d 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()) @@ -260,7 +258,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 fc3f7ba0c77..df609d0edea 100644 --- a/code/game/machinery/doppler_array.dm +++ b/code/game/machinery/doppler_array.dm @@ -5,6 +5,7 @@ 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 @@ -111,7 +112,7 @@
  • Theoretical Outer Radius: [record.theory_radius["outer_radius"]]
  • Theoretical Shockwave Radius: [record.theory_radius["shockwave_radius"]]
  • "} - update_icon() + update_appearance() /obj/machinery/doppler_array/attackby(obj/item/I, mob/user, params) if(I.tool_behaviour == TOOL_WRENCH) @@ -186,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 0c4db767900..212c5a060ac 100644 --- a/code/game/machinery/droneDispenser.dm +++ b/code/game/machinery/droneDispenser.dm @@ -146,7 +146,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) @@ -163,7 +163,7 @@ mode = DRONE_RECHARGING timer = world.time + cooldownTime - update_icon() + update_appearance() if(DRONE_RECHARGING) if(recharge_sound) @@ -172,7 +172,7 @@ visible_message("[src] [recharge_message]") mode = DRONE_READY - update_icon() + update_appearance() /obj/machinery/drone_dispenser/proc/count_shells() . = 0 @@ -183,12 +183,15 @@ /obj/machinery/drone_dispenser/update_icon_state() if(machine_stat & (BROKEN|NOPOWER)) icon_state = icon_off - else if(mode == DRONE_RECHARGING) + return ..() + if(mode == DRONE_RECHARGING) icon_state = icon_recharging - else if(mode == DRONE_PRODUCTION) + return ..() + if(mode == DRONE_PRODUCTION) icon_state = icon_creating - else - icon_state = icon_on + return ..() + icon_state = icon_on + return ..() /obj/machinery/drone_dispenser/attackby(obj/item/I, mob/living/user) if(I.tool_behaviour == TOOL_CROWBAR) @@ -218,7 +221,7 @@ set_machine_stat(machine_stat & ~BROKEN) obj_integrity = max_integrity - update_icon() + update_appearance() else return ..() diff --git a/code/game/machinery/electrolyzer.dm b/code/game/machinery/electrolyzer.dm index cc4cb771b7c..75f461230a6 100644 --- a/code/game/machinery/electrolyzer.dm +++ b/code/game/machinery/electrolyzer.dm @@ -32,7 +32,7 @@ . = ..() if(ispath(cell)) cell = new cell(src) - update_icon() + update_appearance() /obj/machinery/electrolyzer/Destroy() if(cell) @@ -56,10 +56,10 @@ /obj/machinery/electrolyzer/update_icon_state() icon_state = "electrolyzer-[on ? "[mode]" : "off"]" + return ..() /obj/machinery/electrolyzer/update_overlays() . = ..() - if(panel_open) . += "electrolyzer-open" @@ -71,21 +71,21 @@ if(!cell || cell.charge <= 0) on = FALSE - update_icon() + update_appearance() return PROCESS_KILL var/turf/L = loc if(!istype(L)) if(mode != ELECTROLYZER_MODE_STANDBY) mode = ELECTROLYZER_MODE_STANDBY - update_icon() + update_appearance() return var/newMode = on ? ELECTROLYZER_MODE_WORKING : ELECTROLYZER_MODE_STANDBY //change the mode to working if the machine is on if(mode != newMode) //check if the mode is set correctly mode = newMode - update_icon() + update_appearance() if(mode == ELECTROLYZER_MODE_STANDBY) return @@ -140,7 +140,7 @@ 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() return if(default_deconstruction_crowbar(I)) return @@ -173,7 +173,7 @@ on = !on mode = ELECTROLYZER_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) START_PROCESSING(SSmachines, src) . = TRUE diff --git a/code/game/machinery/embedded_controller/access_controller.dm b/code/game/machinery/embedded_controller/access_controller.dm index 244a9392ca6..22c314f622d 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/door_buttons/access_button//SKYRAT EDIT - ICON OVERRIDEN BY AESTHETICS - SEE MODULE 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/door_buttons/access_button/proc/not_busy() busy = FALSE - update_icon() + update_appearance() /obj/machinery/door_buttons/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/door_buttons/access_button/removeMe(obj/O) if(O == door) @@ -102,6 +101,7 @@ /obj/machinery/door_buttons/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/door_buttons/airlock_controller/proc/onlyOpen(obj/machinery/door/airlock/A) if(A) busy = CLOSING - update_icon() + update_appearance() openDoor(A) /obj/machinery/door_buttons/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/door_buttons/airlock_controller/process() @@ -248,11 +248,9 @@ /obj/machinery/door_buttons/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/door_buttons/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 f200f5df73e..e5bc3dc818f 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//SKYRAT EDIT - ICON OVERRIDEN BY AESTHETICS - SEE MODULE icon = 'icons/obj/airlock_machines.dmi' icon_state = "airlock_control_standby" + base_icon_state = "airlock_control" name = "airlock console" density = FALSE @@ -256,12 +257,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 68237b30e28..bfbe73af79e 100644 --- a/code/game/machinery/embedded_controller/embedded_controller_base.dm +++ b/code/game/machinery/embedded_controller/embedded_controller_base.dm @@ -57,7 +57,7 @@ if(program) program.process(delta_time) - 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 361a624d5eb..078e93fa3fc 100644 --- a/code/game/machinery/embedded_controller/simple_vent_controller.dm +++ b/code/game/machinery/embedded_controller/simple_vent_controller.dm @@ -55,10 +55,8 @@ 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 b026ed542c7..2b4c868439f 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.") @@ -198,7 +198,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 bda27b26bb0..9acb9fd4fc4 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -48,7 +48,7 @@ panel_open = TRUE pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24) pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0 - update_icon() + update_appearance() myarea = get_area(src) LAZYADD(myarea.firealarms, src) @@ -66,23 +66,19 @@ /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 . += "fire_overlay" - if(is_station_level(z)) . += "fire_[GLOB.security_level]" SSvis_overlays.add_vis_overlay(src, icon, "fire_[GLOB.security_level]", layer, plane, dir) @@ -125,7 +121,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.") @@ -140,7 +136,7 @@ if(!triggered) triggered = TRUE myarea.triggered_firealarms += 1 - update_icon() + update_appearance() alarm() /obj/machinery/firealarm/atmos_end(datum/gas_mixture/air, exposed_temperature) @@ -149,7 +145,7 @@ if(triggered) triggered = FALSE myarea.triggered_firealarms -= 1 - update_icon() + update_appearance() /obj/machinery/firealarm/proc/alarm(mob/user) if(!is_operational || !COOLDOWN_FINISHED(src, last_alarm)) @@ -193,7 +189,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) @@ -226,7 +222,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 @@ -245,7 +241,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) @@ -260,14 +256,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)) @@ -277,7 +273,7 @@ user.visible_message("[user] fabricates a circuit and places it into [src].", \ "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) @@ -302,7 +298,7 @@ user.visible_message("[user] fabricates a circuit and places it into [src].", \ "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 8a6c9590965..6073334bb0b 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,15 +16,14 @@ 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" desc = "A portable flashing device. Wrench to activate and deactivate. Cannot detect slow movements." icon_state = "pflash1-p" + base_icon_state = "pflash" strength = 80 anchored = FALSE - base_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) @@ -184,7 +179,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 320973e8d31..547d09c824b 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 @@ -56,7 +57,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)) @@ -68,22 +69,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 0acc84d40db..c1465e22b70 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 eadc9fc8bde..3274e6ba492 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 flags_1 = HEAR_1 @@ -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 @@ -446,16 +447,15 @@ 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 64f5885a684..fa64a839cf6 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 @@ -97,7 +98,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(delta_time) @@ -117,7 +118,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!") @@ -140,7 +141,7 @@ deltimer(timerid) interrogating = FALSE STOP_PROCESSING(SSobj, src) - update_icon() + update_appearance() if(QDELETED(victim)) victim = null @@ -169,14 +170,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 84f065b1b43..fe54485e067 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 (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 = "[port.id]_[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 (!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 fd3b7adb93f..e13e6acde2b 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. Right-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 ///Who are we sticking our needle in? @@ -26,7 +27,7 @@ /obj/machinery/iv_drip/Initialize(mapload) . = ..() - update_icon() + update_appearance() if(use_internal_storage) create_reagents(100, TRANSPARENT) @@ -36,51 +37,43 @@ return ..() /obj/machinery/iv_drip/update_icon_state() - icon_state = initial(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 ? "injectidle" : "donateidle"]" + return ..() /obj/machinery/iv_drip/update_overlays() . = ..() - if(beaker) - if(attached) - . += "beakeractive" - else - . += "beakeridle" + if(!beaker) + return - var/datum/reagents/target_reagents = get_reagent_holder() - if(target_reagents) - var/mutable_appearance/filling_overlay = mutable_appearance('icons/obj/iv_drip.dmi', "reagent") + . += attached ? "beakeractive" : "beakeridle" + var/datum/reagents/target_reagents = get_reagent_holder() + if(!target_reagents) + return - var/percent = round((target_reagents.total_volume / target_reagents.maximum_volume) * 100) - switch(percent) - if(0 to 9) - filling_overlay.icon_state = "reagent0" - if(10 to 24) - filling_overlay.icon_state = "reagent10" - if(25 to 49) - filling_overlay.icon_state = "reagent25" - if(50 to 74) - filling_overlay.icon_state = "reagent50" - if(75 to 79) - filling_overlay.icon_state = "reagent75" - if(80 to 90) - filling_overlay.icon_state = "reagent80" - if(91 to INFINITY) - filling_overlay.icon_state = "reagent100" + var/mutable_appearance/filling_overlay = mutable_appearance('icons/obj/iv_drip.dmi', "reagent") + var/percent = round((target_reagents.total_volume / target_reagents.maximum_volume) * 100) + switch(percent) + if(0 to 9) + filling_overlay.icon_state = "reagent0" + if(10 to 24) + filling_overlay.icon_state = "reagent10" + if(25 to 49) + filling_overlay.icon_state = "reagent25" + if(50 to 74) + filling_overlay.icon_state = "reagent50" + if(75 to 79) + filling_overlay.icon_state = "reagent75" + if(80 to 90) + filling_overlay.icon_state = "reagent80" + if(91 to INFINITY) + filling_overlay.icon_state = "reagent100" - filling_overlay.color = mix_color_from_reagents(target_reagents.reagent_list) - . += filling_overlay + filling_overlay.color = mix_color_from_reagents(target_reagents.reagent_list) + . += filling_overlay /obj/machinery/iv_drip/MouseDrop(mob/living/target) . = ..() @@ -90,7 +83,7 @@ if(attached) visible_message("[attached] is detached from [src].") attached = null - update_icon() + update_appearance() return if(!target.has_dna()) @@ -118,7 +111,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 ..() @@ -150,7 +143,7 @@ // speed up transfer on blood packs transfer_amount *= 2 target_reagents.trans_to(attached, transfer_amount * delta_time * 0.5, methods = INJECT, show_message = FALSE) //make reagents reacts, but don't spam messages - update_icon() + update_appearance() // Take blood else @@ -168,7 +161,7 @@ playsound(loc, 'sound/machines/twobeep_high.ogg', 50, TRUE) var/atom/movable/target = use_internal_storage ? src : beaker attached.transfer_blood_to(target, amount) - update_icon() + update_appearance() /obj/machinery/iv_drip/attack_hand(mob/user, list/modifiers) . = ..() @@ -202,7 +195,7 @@ add_fingerprint(usr) attached = target START_PROCESSING(SSmachines, src) - update_icon() + update_appearance() SEND_SIGNAL(src, COMSIG_IV_ATTACH, target) @@ -211,7 +204,7 @@ SEND_SIGNAL(src, COMSIG_IV_DETACH, attached) attached = null - update_icon() + update_appearance() /obj/machinery/iv_drip/proc/get_reagent_holder() return use_internal_storage ? reagents : beaker?.reagents @@ -230,7 +223,7 @@ if(beaker) beaker.forceMove(drop_location()) beaker = null - update_icon() + update_appearance() /obj/machinery/iv_drip/verb/toggle_mode() set category = "Object" @@ -245,7 +238,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) . = ..() @@ -271,6 +264,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) @@ -292,6 +286,7 @@ name = "automated IV drip" desc = "A modified IV drip with plumbing connects. Reagents received from the connect are injected directly into their bloodstream, blood that is drawn goes to the internal storage and then into the ducting." icon_state = "plumb" + base_icon_state = "plumb" density = TRUE use_internal_storage = TRUE diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index 15150b38854..7beed29b675 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 OVERRIDEN IN SKYRAT AESTHETICS - SEE MODULE 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 @@ -21,20 +22,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) . = ..() @@ -44,10 +48,10 @@ . = ..() area.lightswitch = !area.lightswitch - 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 1d81dae7480..45560ce85c1 100644 --- a/code/game/machinery/medical_kiosk.dm +++ b/code/game/machinery/medical_kiosk.dm @@ -1,30 +1,48 @@ //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 payment_department = ACCOUNT_MED var/obj/item/scanner_wand + /// How much it costs to use the kiosk by default. var/default_price = 15 //I'm defaulting to a low price on this, but in the future I wouldn't have an issue making it more or less expensive. + /// How much it currently costs to use the kiosk. var/active_price = 15 //Change by using a multitool on the board. + /// Makes the TGUI display gibberish and/or incorrect/erratic information. 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() + /// Who's pockets are we sifting through when we're used? var/datum/bank_account/account //payer's account. + /// Who's paying? var/mob/living/carbon/human/H //The person using the console in each instance. Used for paying for the kiosk. + /// Who's getting scanned? var/mob/living/carbon/human/altPatient //If scanning someone else, this will be the target. + /// Used to find the money. var/obj/item/card/id/C //the account of the person using the console. /obj/machinery/medical_kiosk/Initialize() //loaded subtype for mapping use @@ -46,23 +64,25 @@ return 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. ..() @@ -76,7 +96,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 @@ -161,7 +181,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) @@ -324,10 +344,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) @@ -337,28 +357,28 @@ switch(action) if("beginScan_1") - if(!scan_active_1) + 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") - if(!scan_active_2) + 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") - if(!scan_active_3) + 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") - if(!scan_active_4) + 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 ac1667ace4b..a7cfca4df97 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." layer = LOW_OBJ_LAYER @@ -90,7 +91,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 @@ -102,7 +104,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 97c2e03a3ce..8fcfe3d4d65 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -167,7 +167,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 = FALSE @@ -176,7 +176,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) @@ -200,6 +200,7 @@ GLOBAL_LIST_EMPTY(allCasters) desc = "A standard Nanotrasen-licensed newsfeed handler for use in commercial space stations. All the news you absolutely have no use for, in one place!" icon = 'icons/obj/terminals.dmi' //ICON OVERRIDEN IN SKYRAT AESTHETICS - SEE MODULE icon_state = "newscaster_normal" + base_icon_state = "newscaster" verb_say = "beeps" verb_ask = "beeps" verb_exclaim = "beeps" @@ -233,7 +234,7 @@ GLOBAL_LIST_EMPTY(allCasters) GLOB.allCasters += src unit_no = GLOB.allCasters.len - update_icon() + update_appearance() /obj/machinery/newscaster/Destroy() GLOB.allCasters -= src @@ -243,12 +244,10 @@ GLOBAL_LIST_EMPTY(allCasters) /obj/machinery/newscaster/update_icon_state() if(machine_stat & (NOPOWER|BROKEN)) - icon_state = "newscaster_off" - else - if(GLOB.news_network.wanted_issue.active) - icon_state = "newscaster_wanted" - else - icon_state = "newscaster_normal" + icon_state = "[base_icon_state]_off" + return ..() + icon_state = "[base_icon_state]_[GLOB.news_network.wanted_issue.active ? "wanted" : "normal"]" + return ..() /obj/machinery/newscaster/update_overlays() . = ..() @@ -269,7 +268,7 @@ GLOBAL_LIST_EMPTY(allCasters) /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) . = ..() @@ -748,7 +747,7 @@ GLOBAL_LIST_EMPTY(allCasters) 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 @@ -843,7 +842,7 @@ GLOBAL_LIST_EMPTY(allCasters) /obj/machinery/newscaster/proc/remove_alert() alert = FALSE - update_icon() + update_appearance() /obj/machinery/newscaster/proc/newsAlert(channel, update_alert = TRUE) if(channel) @@ -851,7 +850,7 @@ GLOBAL_LIST_EMPTY(allCasters) say("Breaking news from [channel]!") playsound(loc, 'sound/machines/twobeep_high.ogg', 75, TRUE) alert = TRUE - update_icon() + update_appearance() addtimer(CALLBACK(src,.proc/remove_alert),alert_delay,TIMER_UNIQUE|TIMER_OVERRIDE) else if(!channel && update_alert) diff --git a/code/game/machinery/pipe/pipe_dispenser.dm b/code/game/machinery/pipe/pipe_dispenser.dm index ee747ed78dc..283ab2c802e 100644 --- a/code/game/machinery/pipe/pipe_dispenser.dm +++ b/code/game/machinery/pipe/pipe_dispenser.dm @@ -148,7 +148,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 ec062fb815a..72b1d94ce29 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -109,7 +109,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) @@ -147,21 +147,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) @@ -190,7 +191,7 @@ DEFINE_BITFIELD(turret_flags, list( if(gun_properties["reqpower"]) reqpower = gun_properties["reqpower"] - update_icon() + update_appearance() return gun_properties ///destroys reference to stored_gun to prevent hard deletions @@ -289,7 +290,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() @@ -321,7 +322,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 @@ -357,7 +358,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 @@ -531,7 +532,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 @@ -612,7 +613,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) @@ -818,7 +819,7 @@ DEFINE_BITFIELD(turret_flags, list( max_integrity = 260 always_up = TRUE use_power = NO_POWER_USE - has_cover = 0 + has_cover = FALSE scan_range = 9 stun_projectile = /obj/projectile/beam/laser lethal_projectile = /obj/projectile/beam/laser @@ -857,6 +858,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 @@ -1011,18 +1013,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/item/wallframe/turret_control name = "turret control frame" diff --git a/code/game/machinery/porta_turret/portable_turret_cover.dm b/code/game/machinery/porta_turret/portable_turret_cover.dm index 255a0cce1a4..d1b860f3b93 100644 --- a/code/game/machinery/porta_turret/portable_turret_cover.dm +++ b/code/game/machinery/porta_turret/portable_turret_cover.dm @@ -39,33 +39,35 @@ if(I.tool_behaviour == TOOL_WRENCH && !parent_turret.on) if(parent_turret.raised) return - if(!parent_turret.anchored) 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) + return - else if(I.GetID()) + 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 ccc0c540048..8c0d1134ff6 100644 --- a/code/game/machinery/prisonlabor.dm +++ b/code/game/machinery/prisonlabor.dm @@ -9,16 +9,18 @@ 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 427405930cc..a493f21bef1 100755 --- 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 @@ -46,11 +47,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) @@ -92,7 +93,7 @@ if(anchored && !charging) if(default_deconstruction_screwdriver(user, "recharger", "recharger", G)) - update_icon() + update_appearance() return if(panel_open && G.tool_behaviour == TOOL_CROWBAR) @@ -108,7 +109,7 @@ add_fingerprint(user) if(charging) - charging.update_icon() + charging.update_appearance() charging.forceMove(drop_location()) user.put_in_hands(charging) setCharging(null) @@ -117,7 +118,7 @@ /obj/machinery/recharger/attack_tk(mob/user) if(!charging) return - charging.update_icon() + charging.update_appearance() charging.forceMove(drop_location()) setCharging(null) return COMPONENT_CANCEL_ATTACK_CHAIN @@ -135,7 +136,7 @@ C.give(C.chargerate * recharge_coeff * delta_time / 2) use_power(125 * recharge_coeff * delta_time) 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 @@ -143,7 +144,7 @@ R.stored_ammo += new R.ammo_type(R) use_power(100 * recharge_coeff * delta_time) using_power = TRUE - update_icon() + update_appearance() return else return PROCESS_KILL @@ -163,24 +164,29 @@ 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) return if(panel_open) - SSvis_overlays.add_vis_overlay(src, icon, "recharger-open", layer, plane, dir, alpha) + SSvis_overlays.add_vis_overlay(src, icon, "[base_icon_state]-open", layer, plane, dir, alpha) 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 7f2e49acdc3..87112b9c5db 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(delta_time) if(!occupant) diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index c5dcdbf0376..2d3aca0c067 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -33,7 +33,7 @@ ) AddComponent(/datum/component/material_container, allowed_materials, INFINITY, MATCONTAINER_NO_INSERT|BREAKDOWN_FLAGS_RECYCLER) . = ..() - update_icon() + update_appearance() req_one_access = get_all_accesses() + get_all_centcom_access() /obj/machinery/recycler/RefreshParts() @@ -79,16 +79,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]" + "[(bloody ? "bld" : "")]" // add the blood tag at the end + return ..() /obj/machinery/recycler/CanAllowThrough(atom/movable/AM) . = ..() @@ -172,13 +172,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) @@ -196,7 +196,7 @@ if(!bloody && !issilicon(L)) bloody = 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 e5e64e0fe47..be6065ba7c7 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 to different departments on the station." icon = 'icons/obj/terminals.dmi' //OVERRIDEN IN SKYRAT AESTHETICS - SEE MODULE 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 @@ -69,28 +70,32 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) max_integrity = 300 armor = list(MELEE = 70, BULLET = 30, LASER = 30, ENERGY = 30, BOMB = 0, BIO = 0, RAD = 0, FIRE = 90, ACID = 90) -/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() . = ..() @@ -174,10 +179,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 @@ -289,7 +294,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) @@ -352,7 +357,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) @@ -375,14 +380,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]" @@ -390,7 +395,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]" @@ -410,7 +415,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) @@ -419,7 +424,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 624dbbf1ba0..86d4c85a90a 100644 --- a/code/game/machinery/roulette_machine.dm +++ b/code/game/machinery/roulette_machine.dm @@ -99,7 +99,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) @@ -182,7 +182,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) @@ -322,14 +322,18 @@ 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 e99c3925739..35c07010f88 100644 --- a/code/game/machinery/sheetifier.dm +++ b/code/game/machinery/sheetifier.dm @@ -25,13 +25,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 @@ -40,7 +41,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 @@ -48,7 +49,7 @@ if(default_unfasten_wrench(user, I)) return if(default_deconstruction_screwdriver(user, initial(icon_state), initial(icon_state), 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 f5c79563c2b..dbf64ded838 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -134,7 +134,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)) @@ -145,7 +145,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(delta_time) @@ -205,7 +205,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) @@ -245,10 +245,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 diff --git a/code/game/machinery/slotmachine.dm b/code/game/machinery/slotmachine.dm index 882781d4d2e..4995638255f 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,16 @@ /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" - - else - icon_state = "slots1" + 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 ..() /obj/machinery/computer/slot_machine/attackby(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/coin)) @@ -206,7 +207,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 +224,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 05684f98e71..58f09794722 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 OVERRIDEN IN SKYRAT AESTHETICS - SEE MODULE 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 station on fire. Warranty void if used in engines." max_integrity = 250 @@ -32,13 +33,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() @@ -58,16 +59,13 @@ . += "The status display reads: Temperature range at [settableTemperatureRange]°C.
    Heating power at [siunit(heatingPower, "W", 1)].
    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(delta_time) if(!on || !is_operational) @@ -80,7 +78,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() @@ -93,7 +91,7 @@ if(mode != newMode) mode = newMode - update_icon() + update_appearance() if(mode == HEATER_MODE_STANDBY) return @@ -114,7 +112,7 @@ cell.use(requiredEnergy / efficiency) else on = FALSE - update_icon() + update_appearance() return PROCESS_KILL /obj/machinery/space_heater/RefreshParts() @@ -163,7 +161,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 @@ -210,7 +208,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) START_PROCESSING(SSmachines, src) . = TRUE diff --git a/code/game/machinery/stasis.dm b/code/game/machinery/stasis.dm index 50b82413c8e..22fbd9ecfa8 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 @@ -56,7 +57,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) @@ -70,30 +71,33 @@ /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_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) - if(mattress_state) - if(!mattress_on || !managed_vis_overlays) - mattress_on = SSvis_overlays.add_vis_overlay(src, icon, mattress_state, BELOW_OBJ_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) - 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 - - SSvis_overlays.remove_vis_overlay(src, overlays_to_remove) /obj/machinery/stasis/obj_break(damage_flag) . = ..() @@ -126,13 +130,13 @@ set_occupant(L) if(stasis_running() && check_nap_violations()) chill_out(L) - update_icon() + update_appearance() /obj/machinery/stasis/post_unbuckle_mob(mob/living/L) thaw_them(L) if(L == occupant) set_occupant(null) - update_icon() + update_appearance() /obj/machinery/stasis/process() if( !( occupant && isliving(occupant) && check_nap_violations() ) ) @@ -148,7 +152,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 85b8b323e2b..c99a20f4ccb 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -150,7 +150,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) @@ -165,30 +165,38 @@ if(uv) if(uv_super) . += "super" - else if(occupant) + return + if(occupant) . += "uvhuman" - else - . += "uv" - else if(state_open) + return + + . += "uv" + return + + if(state_open) if(machine_stat & BROKEN) . += "broken" - else - . += "open" - if(suit) - . += "suit" - if(helmet) - . += "helm" - if(storage) - . += "storage" - else if(occupant) + return + + . += "open" + if(suit) + . += "suit" + if(helmet) + . += "helm" + if(storage) + . += "storage" + return + + if(occupant) . += "human" + return /obj/machinery/suit_storage_unit/power_change() . = ..() if(!is_operational && state_open) open_machine() dump_inventory_contents() - update_icon() + update_appearance() /obj/machinery/suit_storage_unit/dump_inventory_contents() . = ..() @@ -352,7 +360,7 @@ uv_cycles-- uv = TRUE locked = TRUE - update_icon() + update_appearance() if(mob_occupant) if(uv_super) mob_occupant.adjustFireLoss(rand(20, 36)) @@ -503,7 +511,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)) diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index 1d6cc870abf..ff1936cb0fa 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)) @@ -317,7 +318,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/machine_interactions.dm b/code/game/machinery/telecomms/machine_interactions.dm index e4356528144..16b605cd2e7 100644 --- a/code/game/machinery/telecomms/machine_interactions.dm +++ b/code/game/machinery/telecomms/machine_interactions.dm @@ -93,7 +93,7 @@ if("toggle") toggled = !toggled update_power() - update_icon() + update_appearance() log_game("[key_name(operator)] toggled [toggled ? "On" : "Off"] [src] at [AREACOORD(src)].") . = TRUE if("id") diff --git a/code/game/machinery/telecomms/machines/message_server.dm b/code/game/machinery/telecomms/machines/message_server.dm index 4274b085ac1..502cb341177 100644 --- a/code/game/machinery/telecomms/machines/message_server.dm +++ b/code/game/machinery/telecomms/machines/message_server.dm @@ -29,7 +29,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...") @@ -44,7 +44,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 ..() @@ -54,12 +54,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 39b846fa3c7..7cece0bc6ff 100644 --- a/code/game/machinery/telecomms/telecomunications.dm +++ b/code/game/machinery/telecomms/telecomunications.dm @@ -115,16 +115,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() @@ -143,7 +135,7 @@ GLOBAL_LIST_EMPTY(telecomms_list) update_power() // Update the icon - update_icon() + update_appearance() if(traffic > 0) traffic -= netspeed * delta_time diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm index afbcac59ba5..54d69533ee8 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?.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 @@ -107,12 +108,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)) @@ -127,6 +124,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 @@ -173,7 +171,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 @@ -198,7 +196,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)) @@ -222,20 +220,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?.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 4b22b6b31e0..8f49c9758f5 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 4e24d2309ca..63533d4f394 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -162,7 +162,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) @@ -188,7 +188,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() @@ -201,7 +201,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 @@ -282,11 +282,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() . = ..() @@ -298,7 +301,7 @@ GLOBAL_LIST_INIT(dye_registry, list( return if(default_deconstruction_screwdriver(user, null, null, W)) - update_icon() + update_appearance() return else if(!user.combat_mode) @@ -319,7 +322,7 @@ GLOBAL_LIST_INIT(dye_registry, list( return TRUE if(W.dye_color) color_source = W - update_icon() + update_appearance() else return ..() @@ -339,14 +342,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) if (!(flags_1 & NODECONSTRUCT_1)) diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index 0000a937c76..b24d1741836 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -87,7 +87,7 @@ ..() if(iscarbon(AM) && blood_state && bloodiness > 0) 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 060c171a0ce..69fe0aba5e1 100644 --- a/code/game/objects/effects/decals/cleanable/humans.dm +++ b/code/game/objects/effects/decals/cleanable/humans.dm @@ -177,7 +177,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) @@ -196,25 +196,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) - - alpha = min(BLOODY_FOOTPRINT_BASE_ALPHA + (255 - BLOODY_FOOTPRINT_BASE_ALPHA) * bloodiness / (BLOOD_ITEM_MAX / 2), 255) + . += bloodstep_overlay /obj/effect/decal/cleanable/blood/footprints/examine(mob/user) diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm index f355010dcf5..7ecddafae29 100644 --- a/code/game/objects/effects/effect_system/effects_foam.dm +++ b/code/game/objects/effects/effect_system/effects_foam.dm @@ -330,7 +330,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.extinguish_mob() diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm index aaf4f52889b..14f0a665882 100644 --- a/code/game/objects/effects/effect_system/effects_smoke.dm +++ b/code/game/objects/effects/effect_system/effects_smoke.dm @@ -178,7 +178,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.extinguish_mob() diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm index 804240a322e..67b09b786fb 100644 --- a/code/game/objects/effects/spawners/bombspawner.dm +++ b/code/game/objects/effects/spawners/bombspawner.dm @@ -37,7 +37,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 852868a9991..87c6b98c29f 100644 --- a/code/game/objects/effects/temporary_visuals/miscellaneous.dm +++ b/code/game/objects/effects/temporary_visuals/miscellaneous.dm @@ -480,22 +480,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 08fe36bee72..b23d8531a5a 100644 --- a/code/game/objects/items/RCD.dm +++ b/code/game/objects/items/RCD.dm @@ -111,7 +111,7 @@ RLD loaded = loadwithsheets(O, user) if(loaded) to_chat(user, "[src] now holds [matter]/[max_matter] matter-units.") - update_icon() //ensures that ammo counters (if present) get updated + update_appearance() //ensures that ammo counters (if present) get updated return loaded /obj/item/construction/proc/loadwithsheets(obj/item/stack/S, mob/user) @@ -145,7 +145,7 @@ RLD to_chat(user, no_ammo_message) return FALSE matter -= amount - update_icon() + update_appearance() return TRUE else if(silo_mats.on_hold()) @@ -674,7 +674,7 @@ RLD /obj/item/construction/rcd/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/construction/rcd/borg no_ammo_message = "Insufficient charge." @@ -825,6 +825,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 32b7523cbd4..5464c6d1d69 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 pipe cleaners 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" inhand_icon_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" inhand_icon_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 pipe cleaners unreel from [src].") @@ -211,10 +212,10 @@ else last = null loaded.color = GLOB.pipe_cleaner_colors[colors[current_color_index]] - loaded.update_icon() + loaded.update_appearance() 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 pipe_cleaner of the same colour @@ -285,7 +286,7 @@ return loaded.color = GLOB.pipe_cleaner_colors[colors[current_color_index]] - loaded.update_icon() + loaded.update_appearance() var/obj/structure/pipe_cleaner/linkingCable = findLinkingCable(user) if(linkingCable) @@ -304,11 +305,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)) @@ -319,7 +320,7 @@ to_chat(user, "Color changed to [cwname]!") if(loaded) loaded.color = GLOB.pipe_cleaner_colors[colors[current_color_index]] - loaded.update_icon() + loaded.update_appearance() if(wiring_gui_menu) wiringGuiUpdate(user) else if(istype(action, /datum/action/item_action/rcl_gui)) @@ -338,7 +339,7 @@ if(!loaded) icon_state = "rclg-0" inhand_icon_state = "rclg-0" - return + return ..() switch(loaded.amount) if(1 to INFINITY) icon_state = "rclg-1" @@ -346,3 +347,4 @@ else icon_state = "rclg-1" inhand_icon_state = "rclg-1" + return ..() diff --git a/code/game/objects/items/RPD.dm b/code/game/objects/items/RPD.dm index ce7ef8e03a1..52b9ce97b74 100644 --- a/code/game/objects/items/RPD.dm +++ b/code/game/objects/items/RPD.dm @@ -490,7 +490,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 ccc6271c537..236377dacfd 100644 --- a/code/game/objects/items/broom.dm +++ b/code/game/objects/items/broom.dm @@ -6,6 +6,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 @@ -24,10 +25,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 ..() /** * Handles registering the sweep proc when the broom is wielded @@ -90,7 +92,7 @@ break if(i > 1) 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) @@ -104,7 +106,7 @@ /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() /obj/item/pushbroom/cyborg name = "robotic push broom" diff --git a/code/game/objects/items/candle.dm b/code/game/objects/items/candle.dm index 7d4fad649ba..c3a4b432da7 100644 --- a/code/game/objects/items/candle.dm +++ b/code/game/objects/items/candle.dm @@ -22,6 +22,7 @@ /obj/item/candle/update_icon_state() icon_state = "candle[(wax > 800) ? ((wax > 1500) ? 1 : 2) : 3][lit ? "_lit" : ""]" + return ..() /obj/item/candle/attackby(obj/item/W, mob/user, params) var/msg = W.ignition_effect(src, user) @@ -45,13 +46,13 @@ usr.visible_message(show_message) set_light(CANDLE_LUMINOSITY) 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 @@ -67,7 +68,7 @@ if(wax <= 0) new /obj/item/trash/candle(loc) qdel(src) - update_icon() + update_appearance() open_flame() /obj/item/candle/attack_self(mob/user) diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index ae2f4da71bf..c3205394f85 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -39,7 +39,7 @@ /obj/item/card/data/Initialize() .=..() - update_icon() + update_appearance() /obj/item/card/data/update_overlays() . = ..() @@ -309,7 +309,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) @@ -331,7 +331,7 @@ update_label() /obj/item/card/id/proc/update_label() var/blank = !registered_name name = "[blank ? id_type_name : "[registered_name]'s ID Card"][(!assignment) ? "" : " ([assignment])"]" - update_icon() + update_appearance() /obj/item/card/id/silver name = "silver identification card" @@ -509,7 +509,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 = "[id_type_name][(!assignment || assignment == "Captain") ? "" : " ([assignment])"]" - update_icon() + update_appearance() else ..() diff --git a/code/game/objects/items/chrono_eraser.dm b/code/game/objects/items/chrono_eraser.dm index 5b4bc52183b..e6b2d46fe90 100644 --- a/code/game/objects/items/chrono_eraser.dm +++ b/code/game/objects/items/chrono_eraser.dm @@ -189,7 +189,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) @@ -200,7 +200,8 @@ gun.field_disconnect(src) return ..() -/obj/structure/chrono_field/update_icon() +/obj/structure/chrono_field/update_overlays() + . = ..() var/ttk_frame = 1 - (timetokill / initial(timetokill)) ttk_frame = clamp(CEILING(ttk_frame * CHRONO_FRAME_COUNT, 1), 1, CHRONO_FRAME_COUNT) if(ttk_frame != RPpos) @@ -229,7 +230,7 @@ captured.Unconscious(80) if(captured.loc != src) captured.forceMove(src) - update_icon() + update_appearance() if(gun) if(gun.field_check(src)) timetokill -= delta_time diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm index 7c13a5ef4ab..eb3dd829abc 100644 --- a/code/game/objects/items/cigs_lighters.dm +++ b/code/game/objects/items/cigs_lighters.dm @@ -52,7 +52,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM attack_verb_continuous = string_list(list("burns", "sings")) attack_verb_simple = string_list(list("burn", "sing")) START_PROCESSING(SSobj, src) - update_icon() + update_appearance() /obj/item/match/proc/matchburnout() if(lit) @@ -643,7 +643,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) @@ -665,6 +665,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" : ""]") @@ -691,7 +692,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM attack_verb_simple = null STOP_PROCESSING(SSobj, src) set_light_on(lit) - update_icon() + update_appearance() /obj/item/lighter/extinguish() set_lit(FALSE) @@ -790,7 +791,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 17916a94d5f..8f47ff2793b 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -162,7 +162,7 @@ if(has_cap && user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, TRUE)) 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, NO_DEXTERITY, FALSE, TRUE)) @@ -257,7 +257,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 @@ -605,7 +605,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() . = ..() @@ -685,7 +685,7 @@ playsound(src, 'sound/effects/spray.ogg', 5, TRUE, 5) if(can_change_colour) paint_color = "#C0C0C0" - update_icon() + update_appearance() if(actually_paints) H.update_lips("spray_face", paint_color) var/used = use_charges(user, 10, FALSE) @@ -700,7 +700,7 @@ paint_color = pick("#DA0000","#FF9300","#FFF200","#A8E61D","#00B7EF", "#DA00FF") refill() - update_icon() + update_appearance() /obj/item/toy/crayon/spraycan/examine(mob/user) @@ -769,6 +769,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 74f6d4d043d..6f6bb9aa744 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(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(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(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,17 @@ 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 +94,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 4cd0092460e..76880d2e541 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 @@ -360,13 +360,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() . = ..() @@ -379,7 +379,7 @@ return INITIALIZE_HINT_QDEL defib = loc busy = FALSE - update_icon() + update_appearance() /obj/item/shockpaddles/suicide_act(mob/user) user.visible_message("[user] is putting the live paddles on [user.p_their()] chest! It looks like [user.p_theyre()] trying to commit suicide!") @@ -393,6 +393,7 @@ inhand_icon_state = icon_state if(cooldown) icon_state = "[base_icon_state][wielded]_cooldown" + return ..() /obj/item/shockpaddles/dropped(mob/user) . = ..() @@ -484,7 +485,7 @@ defib.deductcharge(revivecost) cooldown = TRUE busy = FALSE - update_icon() + update_appearance() if(req_defib) defib.cooldowncheck(user) else @@ -498,7 +499,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, 1.5 SECONDS, H)) user.visible_message("[user] places [src] on [H]'s chest.", "You place [src] on [H]'s chest and begin to charge them.") @@ -511,13 +512,13 @@ if(do_after(user, 1.5 SECONDS, 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) @@ -537,18 +538,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, 3 SECONDS, 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) @@ -560,7 +561,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.") @@ -621,7 +622,7 @@ if(req_defib) defib.deductcharge(revivecost) cooldown = 1 - update_icon() + update_appearance() if(req_defib) defib.cooldowncheck(user) else @@ -641,7 +642,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 b55b3492010..14952052c6b 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -117,7 +117,7 @@ GLOBAL_LIST_EMPTY(PDAs) else inserted_item = new /obj/item/pen(src) RegisterSignal(src, COMSIG_LIGHT_EATER_ACT, .proc/on_light_eater) - update_icon() + update_appearance() /obj/item/pda/equipped(mob/user, slot) . = ..() @@ -318,7 +318,7 @@ GLOBAL_LIST_EMPTY(PDAs) if (pai) if(pai.loc != src) pai = null - update_icon() + update_appearance() else dat += "
  • pAI Device Configuration
  • " dat += "
  • Eject pAI Device
  • " @@ -670,7 +670,7 @@ GLOBAL_LIST_EMPTY(PDAs) //EXTRA FUNCTIONS=================================== if (mode == 2 || mode == 21)//To clear message overlays. - update_icon() + update_appearance() if ((honkamt > 0) && (prob(60)))//For clown virus. honkamt-- @@ -701,7 +701,7 @@ GLOBAL_LIST_EMPTY(PDAs) . = id id = null updateSelfDialog() - update_icon() + update_appearance() playsound(src, 'sound/machines/terminal_eject.ogg', 50, TRUE) if(ishuman(loc)) @@ -817,7 +817,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) @@ -887,7 +887,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() @@ -910,7 +910,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() playsound(src, 'sound/machines/pda_button2.ogg', 50, TRUE) else to_chat(user, "This PDA does not have a pen in it!") @@ -925,7 +925,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) @@ -942,7 +942,7 @@ GLOBAL_LIST_EMPTY(PDAs) if(!user.transferItemToLoc(I, src)) return FALSE insert_id(I, user) - update_icon() + update_appearance() playsound(src, 'sound/machines/pda_button1.ogg', 50, TRUE) return TRUE @@ -995,7 +995,7 @@ GLOBAL_LIST_EMPTY(PDAs) cartridge.host_pda = src to_chat(user, "You insert [cartridge] into [src].") updateSelfDialog() - update_icon() + update_appearance() playsound(src, 'sound/machines/pda_button1.ogg', 50, TRUE) else if(istype(C, /obj/item/card/id)) @@ -1025,7 +1025,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) @@ -1035,7 +1035,7 @@ GLOBAL_LIST_EMPTY(PDAs) return to_chat(user, "You slide \the [C] into \the [src].") inserted_item = C - update_icon() + update_appearance() playsound(src, 'sound/machines/pda_button1.ogg', 50, TRUE) else if(istype(C, /obj/item/photo)) var/obj/item/photo/P = C diff --git a/code/game/objects/items/devices/aicard.dm b/code/game/objects/items/devices/aicard.dm index c7fe47c7ec4..29f174134e6 100644 --- a/code/game/objects/items/devices/aicard.dm +++ b/code/game/objects/items/devices/aicard.dm @@ -38,20 +38,21 @@ 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_state() if(!AI) name = initial(name) icon_state = initial(icon_state) - return + return ..() name = "[initial(name)] - [AI.name]" icon_state = "[initial(icon_state)][AI.stat == DEAD ? "-404" : "-full"]" AI.cancel_camera() + return ..() /obj/item/aicard/update_overlays() . = ..() - if(!AI || AI.control_disabled) + if(!AI?.control_disabled) return . += "[initial(icon_state)]-on" @@ -105,4 +106,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 50dc0474c2e..66e5084fcf6 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -458,6 +458,7 @@ light_system = MOVABLE_LIGHT color = LIGHT_COLOR_GREEN icon_state = "glowstick" + base_icon_state = "glowstick" inhand_icon_state = "glowstick" worn_icon_state = "lightstick" grind_results = list(/datum/reagent/phenol = 15, /datum/reagent/hydrogen = 10, /datum/reagent/oxygen = 5) //Meth-in-a-stick @@ -481,28 +482,35 @@ if(fuel <= 0) 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() - inhand_icon_state = "glowstick" - cut_overlays() +/obj/item/flashlight/glowstick/update_appearance(updates=ALL) + . = ..() if(fuel <= 0) - 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) - inhand_icon_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" : ""]" + inhand_icon_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 <= 0) diff --git a/code/game/objects/items/devices/geiger_counter.dm b/code/game/objects/items/devices/geiger_counter.dm index ca7ca5be86b..f93abd99e5c 100644 --- a/code/game/objects/items/devices/geiger_counter.dm +++ b/code/game/objects/items/devices/geiger_counter.dm @@ -53,7 +53,7 @@ current_tick_amount = 0 - update_icon() + update_appearance() update_sound() /obj/item/geiger_counter/examine(mob/user) @@ -83,22 +83,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 @@ -116,11 +119,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/living/user, params) @@ -161,7 +164,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 TRUE else return ..() @@ -174,7 +177,7 @@ return 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) @@ -194,7 +197,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 47dd084fc78..c468f2610ac 100644 --- a/code/game/objects/items/devices/lightreplacer.dm +++ b/code/game/objects/items/devices/lightreplacer.dm @@ -155,6 +155,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)." @@ -226,7 +227,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) @@ -256,7 +257,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 dec3b006efa..19e75e4a727 100644 --- a/code/game/objects/items/devices/multitool.dm +++ b/code/game/objects/items/devices/multitool.dm @@ -89,7 +89,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/paicard.dm b/code/game/objects/items/devices/paicard.dm index 36df5a5158f..2c812bbd64b 100644 --- a/code/game/objects/items/devices/paicard.dm +++ b/code/game/objects/items/devices/paicard.dm @@ -21,18 +21,18 @@ /obj/item/paicard/Initialize() SSpai.pai_card_list += src . = ..() - update_icon() + update_appearance() /obj/item/paicard/vv_edit_var(vname, vval) . = ..() if(vname == NAMEOF(src, emotion_icon)) - update_icon() + update_appearance() /obj/item/paicard/handle_atom_del(atom/A) if(A == pai) //double check /mob/living/silicon/pai/Destroy() if you change these. pai = null emotion_icon = initial(emotion_icon) - update_icon() + update_appearance() return ..() /obj/item/paicard/update_overlays() @@ -153,7 +153,7 @@ /obj/item/paicard/proc/setPersonality(mob/living/silicon/pai/personality) pai = personality emotion_icon = "null" - update_icon() + update_appearance() playsound(loc, 'sound/effects/pai_boot.ogg', 50, TRUE, -1) audible_message("\The [src] plays a cheerful startup noise!") diff --git a/code/game/objects/items/devices/portable_chem_mixer.dm b/code/game/objects/items/devices/portable_chem_mixer.dm index 4ee52406437..1e600b7df08 100644 --- a/code/game/objects/items/devices/portable_chem_mixer.dm +++ b/code/game/objects/items/devices/portable_chem_mixer.dm @@ -47,7 +47,7 @@ if(!user.transferItemToLoc(B, src)) return replace_beaker(user, B) - update_icon() + update_appearance() updateUsrDialog() return return ..() @@ -70,23 +70,24 @@ 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() /obj/item/storage/portable_chem_mixer/CtrlClick(mob/living/user) var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED) @@ -95,7 +96,7 @@ update_contents() if (locked) replace_beaker(user) - update_icon() + update_appearance() playsound(src, 'sound/items/screwdriver2.ogg', 50) return @@ -221,5 +222,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 e4828edd9b4..54188838551 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 0f21d21bf8d..95ca5e8e8ec 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 d169bda03a7..bc723b87442 100644 --- a/code/game/objects/items/devices/radio/intercom.dm +++ b/code/game/objects/items/devices/radio/intercom.dm @@ -102,18 +102,15 @@ /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) . = ..() AreaPowerCheck() // Make sure the area/local APC is powered first before we actually turn back on. -/obj/item/radio/intercom/update_icon() - . = ..() - if(on) - icon_state = initial(icon_state) - else - icon_state = "intercom-p" +/obj/item/radio/intercom/update_icon_state() + icon_state = on ? initial(icon_state) : "intercom-p" + return ..() /** * Proc called whenever the intercom's area loses or gains power. Responsible for setting the `on` variable and calling `update_icon()`. @@ -128,7 +125,7 @@ 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 6cc56578d0d..8b13348dbfd 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 270083b76ab..a4ea1f0b9b1 100644 --- a/code/game/objects/items/devices/taperecorder.dm +++ b/code/game/objects/items/devices/taperecorder.dm @@ -37,7 +37,7 @@ if(starting_tape_type) mytape = new starting_tape_type(src) soundloop = new(list(src)) - update_icon() + update_appearance() /obj/item/taperecorder/proc/readout() if(mytape) @@ -88,7 +88,7 @@ mytape = I to_chat(user, "You insert [I] into [src].") playsound(src, 'sound/items/taperecorder/taperecorder_close.ogg', 50, FALSE) - update_icon() + update_appearance() /obj/item/taperecorder/proc/eject(mob/user) @@ -98,7 +98,7 @@ stop() user.put_in_hands(mytape) mytape = null - update_icon() + update_appearance() /obj/item/taperecorder/fire_act(exposed_temperature, exposed_volume) mytape.unspool() //Fires unspool the tape, which makes sense if you don't think about it @@ -132,12 +132,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()) @@ -166,7 +169,7 @@ recording = TRUE say("Recording started.") update_sound() - update_icon() + update_appearance() var/used = mytape.used_capacity //to stop runtimes when you eject the tape var/max = mytape.max_capacity while(recording && used < max) @@ -200,7 +203,7 @@ say("Playback stopped.") playing = FALSE time_warned = FALSE - update_icon() + update_appearance() update_sound() /obj/item/taperecorder/verb/play() @@ -217,7 +220,7 @@ return playing = TRUE - update_icon() + update_appearance() update_sound() say("Playback started.") playsound(src, 'sound/items/taperecorder/taperecorder_play.ogg', 50, FALSE) diff --git a/code/game/objects/items/devices/traitordevices.dm b/code/game/objects/items/devices/traitordevices.dm index 7fed37df316..534b03367fd 100644 --- a/code/game/objects/items/devices/traitordevices.dm +++ b/code/game/objects/items/devices/traitordevices.dm @@ -267,7 +267,7 @@ effective or pretty fucking useless. GLOB.active_jammers |= src else GLOB.active_jammers -= src - update_icon() + update_appearance() /obj/item/storage/toolbox/emergency/turret desc = "You feel a strange urge to hit this with a wrench." diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm index b74f61604e8..1c1725057e5 100644 --- a/code/game/objects/items/devices/transfer_valve.dm +++ b/code/game/objects/items/devices/transfer_valve.dm @@ -2,6 +2,7 @@ icon = 'icons/obj/assemblies.dmi' name = "tank transfer valve" icon_state = "valve_1" + base_icon_state = "valve" inhand_icon_state = "ttv" lefthand_file = 'icons/mob/inhands/weapons/bombs_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/bombs_righthand.dmi' @@ -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 @@ -92,30 +93,34 @@ /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 @@ -182,12 +187,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 @@ -245,7 +250,7 @@ attached_device = null . = TRUE - update_icon() + update_appearance() /** * Returns if this is ready to be detonated. Checks if both tanks are in place. diff --git a/code/game/objects/items/dice.dm b/code/game/objects/items/dice.dm index ff72dc4d627..ce7d1fa0ffc 100644 --- a/code/game/objects/items/dice.dm +++ b/code/game/objects/items/dice.dm @@ -62,7 +62,7 @@ . = ..() if(!result) result = roll(sides) - update_icon() + update_appearance() /obj/item/dice/suicide_act(mob/user) user.visible_message("[user] is gambling with death! It looks like [user.p_theyre()] trying to commit suicide!") @@ -203,7 +203,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 5ecd2ddb5e9..54367e75bd1 100644 --- a/code/game/objects/items/documents.dm +++ b/code/game/objects/items/documents.dm @@ -55,7 +55,7 @@ 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() /obj/item/inspector name = "\improper N-spect scanner" diff --git a/code/game/objects/items/dualsaber.dm b/code/game/objects/items/dualsaber.dm index a4c0f4f4ea6..702d73794e4 100644 --- a/code/game/objects/items/dualsaber.dm +++ b/code/game/objects/items/dualsaber.dm @@ -73,10 +73,8 @@ return wielded * sharpness /obj/item/dualsaber/update_icon_state() - if(wielded) - icon_state = "dualsaber[saber_color][wielded]" - else - icon_state = "dualsaber0" + icon_state = wielded ? "dualsaber[saber_color][wielded]" : "dualsaber0" + return ..() /obj/item/dualsaber/suicide_act(mob/living/carbon/user) if(wielded) @@ -196,7 +194,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/etherealdiscoball.dm b/code/game/objects/items/etherealdiscoball.dm index 59750b14a93..aebd6ea9847 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, list/modifiers) . = ..() @@ -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 4e966809867..6122f3dccac 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" @@ -30,7 +31,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) @@ -45,7 +46,8 @@ wielded = FALSE /obj/item/fireaxe/update_icon_state() - icon_state = "fireaxe0" + icon_state = "[base_icon_state]0" + return ..() /obj/item/fireaxe/suicide_act(mob/user) user.visible_message("[user] axes [user.p_them()]self from head to toe! It looks like [user.p_theyre()] trying to commit suicide!") @@ -65,27 +67,24 @@ */ /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." /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" /* * Metal Hydrogen Axe */ /obj/item/fireaxe/metal_h2_axe // Blatant imitation of the fireaxe, but made out of metallic hydrogen icon_state = "metalh2_axe0" + base_icon_state = "metalh2_axe" name = "metallic hydrogen axe" desc = "A large, menacing axe made of an unknown substance that the eldest atmosians call Metallic Hydrogen. Truly an otherworldly weapon." /obj/item/fireaxe/metal_h2_axe/ComponentInitialize() . = ..() - AddComponent(/datum/component/two_handed, force_unwielded=5, force_wielded=23, icon_wielded="metalh2_axe1") - -/obj/item/fireaxe/metal_h2_axe/update_icon_state() - icon_state = "metalh2_axe0" + AddComponent(/datum/component/two_handed, force_unwielded=5, force_wielded=23, icon_wielded="[base_icon_state]1") diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm index 765cece8745..ef448bbafef 100644 --- a/code/game/objects/items/flamethrower.dm +++ b/code/game/objects/items/flamethrower.dm @@ -59,6 +59,7 @@ /obj/item/flamethrower/update_icon_state() inhand_icon_state = "flamethrower_[lit]" + return ..() /obj/item/flamethrower/update_overlays() . = ..() @@ -105,7 +106,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)) @@ -117,7 +118,7 @@ if(!user.transferItemToLoc(W, src)) return igniter = I - update_icon() + update_appearance() return else if(istype(W, /obj/item/tank/internals/plasma)) @@ -130,7 +131,7 @@ if(!user.transferItemToLoc(W, src)) return ptank = W - update_icon() + update_appearance() return else @@ -150,7 +151,7 @@ user.put_in_hands(ptank) ptank = null to_chat(user, "You remove the plasma tank from [src]!") - update_icon() + update_appearance() /obj/item/flamethrower/examine(mob/user) . = ..() @@ -176,7 +177,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) ..() @@ -185,7 +186,7 @@ weldtool.status = FALSE igniter.secured = FALSE status = TRUE - update_icon() + update_appearance() //Called from turf.dm turf/dblclick /obj/item/flamethrower/proc/flame_turf(turflist) @@ -235,7 +236,7 @@ status = TRUE if(create_with_tank) ptank = new /obj/item/tank/internals/plasma/full(src) - update_icon() + update_appearance() RegisterSignal(src, COMSIG_ITEM_RECHARGED, .proc/instant_refill) /obj/item/flamethrower/full @@ -267,4 +268,4 @@ ptank.air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE)*ptank.volume/(R_IDEAL_GAS_EQUATION*T20C) else ptank = new /obj/item/tank/internals/plasma/full(src) - update_icon() + update_appearance() diff --git a/code/game/objects/items/food/frozen.dm b/code/game/objects/items/food/frozen.dm index ca7405cb177..c01bbcbdb7c 100644 --- a/code/game/objects/items/food/frozen.dm +++ b/code/game/objects/items/food/frozen.dm @@ -229,14 +229,14 @@ /obj/item/food/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/food/popsicle/proc/after_bite(mob/living/eater, mob/living/feeder, bitecount) src.bitecount = bitecount - update_icon() + update_appearance() /obj/item/popsicle_stick name = "popsicle stick" diff --git a/code/game/objects/items/food/pastries.dm b/code/game/objects/items/food/pastries.dm index 45a28642c37..81a4a21ece1 100644 --- a/code/game/objects/items/food/pastries.dm +++ b/code/game/objects/items/food/pastries.dm @@ -770,15 +770,22 @@ /obj/item/food/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/food/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/food/pancakes/examine(mob/user) var/ingredients_listed = "" @@ -831,14 +838,14 @@ pancake_visual.pixel_x = rand(-1,1) pancake_visual.pixel_y = 3 * contents.len - 1 add_overlay(pancake_visual) - update_icon() + update_appearance() /obj/item/food/pancakes/attack(mob/M, mob/living/user, params, stacked = TRUE) if(user.combat_mode || !contents.len || !stacked) return ..() var/obj/item/O = contents[contents.len] . = O.attack(M, user, params, FALSE) - update_icon() + update_appearance() #undef PANCAKE_MAX_STACK diff --git a/code/game/objects/items/grenades/festive.dm b/code/game/objects/items/grenades/festive.dm index a034f9ccf8b..4f68e7c1267 100644 --- a/code/game/objects/items/grenades/festive.dm +++ b/code/game/objects/items/grenades/festive.dm @@ -37,7 +37,7 @@ damtype = BURN START_PROCESSING(SSobj, src) playsound(src, 'sound/effects/fuse.ogg', 20, TRUE) - update_icon() + update_appearance() /obj/item/sparkler/process(delta_time) burntime -= delta_time @@ -94,7 +94,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 eb26cb15b47..29a80ef3ce7 100644 --- a/code/game/objects/items/handcuffs.dm +++ b/code/game/objects/items/handcuffs.dm @@ -227,10 +227,11 @@ /obj/item/restraints/legcuffs/beartrap/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/restraints/legcuffs/beartrap/update_icon_state() icon_state = "[initial(icon_state)][armed]" + return ..() /obj/item/restraints/legcuffs/beartrap/suicide_act(mob/user) user.visible_message("[user] is sticking [user.p_their()] head in the [src.name]! It looks like [user.p_theyre()] trying to commit suicide!") @@ -242,12 +243,12 @@ 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/Crossed(AM as mob|obj) diff --git a/code/game/objects/items/hot_potato.dm b/code/game/objects/items/hot_potato.dm index b9b9c0b85fc..350a2df3a08 100644 --- a/code/game/objects/items/hot_potato.dm +++ b/code/game/objects/items/hot_potato.dm @@ -137,7 +137,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]" @@ -151,7 +151,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) @@ -161,7 +161,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 d7fd0f3df4c..fac76b79714 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 feb422db233..c509e1bde2d 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() if(imp) reagents = imp.reagents diff --git a/code/game/objects/items/implants/implantchair.dm b/code/game/objects/items/implants/implantchair.dm index 5f0a3db6bbd..d25fc7cae48 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 @@ -84,7 +84,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 @@ -105,6 +105,7 @@ icon_state += "_open" if(occupant) icon_state += "_occupied" + return ..() /obj/machinery/implantchair/update_overlays() . = ..() @@ -121,7 +122,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 51335a24060..4240321e3bb 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 d3ac5c60305..89b6240ac0f 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 f5928a3ef61..91e23bffc54 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!") @@ -125,7 +125,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 @@ -150,10 +150,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) @@ -167,11 +167,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" @@ -183,7 +181,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 fa4d58428fb..84a3186c834 100644 --- a/code/game/objects/items/melee/misc.dm +++ b/code/game/objects/items/melee/misc.dm @@ -609,18 +609,18 @@ 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, list/modifiers) ..() if (held_sausage) user.put_in_hands(held_sausage) held_sausage = null - update_icon() + update_appearance() /obj/item/melee/roastingstick/update_overlays() . = ..() - if (held_sausage) + if(held_sausage) . += mutable_appearance(icon, "roastingstick_sausage") /obj/item/melee/roastingstick/proc/extend(user) @@ -638,7 +638,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) . = ..() @@ -669,7 +669,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" diff --git a/code/game/objects/items/mop.dm b/code/game/objects/items/mop.dm index b0c4b752afc..13ce5e02f70 100644 --- a/code/game/objects/items/mop.dm +++ b/code/game/objects/items/mop.dm @@ -77,7 +77,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 52b199b1824..3b8f36be4d0 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.combat_mode) @@ -112,7 +112,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) @@ -129,7 +129,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.)") @@ -139,14 +139,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 72763c7caad..989f1b8ede7 100644 --- a/code/game/objects/items/pinpointer.dm +++ b/code/game/objects/items/pinpointer.dm @@ -45,14 +45,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 277ac9ce207..c3e9f4548d6 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" @@ -23,7 +24,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) @@ -38,4 +39,5 @@ wielded = FALSE /obj/item/pitchfork/update_icon_state() - icon_state = "pitchfork0" + icon_state = "[base_icon_state]0" + return ..() diff --git a/code/game/objects/items/plushes.dm b/code/game/objects/items/plushes.dm index 316ee01c97c..6bc265ebf0c 100644 --- a/code/game/objects/items/plushes.dm +++ b/code/game/objects/items/plushes.dm @@ -375,8 +375,9 @@ mood_message = null cheer_up() -/obj/item/toy/plush/proc/update_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 1ee7b437bfb..f7e491ec029 100644 --- a/code/game/objects/items/pneumaticCannon.dm +++ b/code/game/objects/items/pneumaticCannon.dm @@ -231,7 +231,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" @@ -256,7 +256,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/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm index 737cbf4f859..390d943bad9 100644 --- a/code/game/objects/items/robot/robot_items.dm +++ b/code/game/objects/items/robot/robot_items.dm @@ -159,6 +159,7 @@ /obj/item/borg/charger/update_icon_state() icon_state = "charger_[mode]" + return ..() /obj/item/borg/charger/attack_self(mob/user) if(mode == "draw") @@ -166,7 +167,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) . = ..() @@ -229,7 +230,7 @@ break if(!user.cell.give(draw)) break - target.update_icon() + target.update_appearance() to_chat(user, "You stop charging yourself.") @@ -267,7 +268,7 @@ break if(!cell.give(draw)) break - target.update_icon() + target.update_appearance() to_chat(user, "You stop charging [target].") @@ -634,11 +635,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)) @@ -812,7 +814,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. @@ -844,14 +846,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) @@ -872,8 +879,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) @@ -932,8 +939,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() ///////////////////// //organ storage bag// @@ -997,7 +1004,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 58d14b06904..9483612ead7 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() . = ..() @@ -106,7 +106,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)) @@ -170,7 +170,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/r_leg/robot)) if(src.r_leg) @@ -180,7 +180,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) @@ -190,7 +190,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) @@ -200,7 +200,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 @@ -212,7 +212,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 @@ -232,7 +232,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 5b9b301a1e1..e22b660424d 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -350,16 +350,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(world.time < next_repair) diff --git a/code/game/objects/items/sharpener.dm b/code/game/objects/items/sharpener.dm index ad2139836e3..dae8e9e7d97 100644 --- a/code/game/objects/items/sharpener.dm +++ b/code/game/objects/items/sharpener.dm @@ -60,7 +60,11 @@ uses-- //this doesn't cause issues because we check if uses == 0 earlier in this proc if(uses == 0) name = "worn out [name]" //whetstone becomes used whetstone - update_icon() + update_appearance() + +/obj/item/sharpener/update_name() + name = "[!uses ? "worn out " : null][initial(name)]" + return ..() /** * # Super whetstone diff --git a/code/game/objects/items/shields.dm b/code/game/objects/items/shields.dm index 88714449cbe..1efabc871dd 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" inhand_icon_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 09b3a436880..ab29c5a66f8 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 = "singularity_hammer0" + base_icon_state = "singularity_hammer" lefthand_file = 'icons/mob/inhands/weapons/hammers_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/hammers_righthand.dmi' worn_icon_state = "singularity_hammer" @@ -26,7 +27,7 @@ /obj/item/singularityhammer/ComponentInitialize() . = ..() - AddComponent(/datum/component/two_handed, force_multiplier=4, icon_wielded="singularity_hammer1") + 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) @@ -41,8 +42,8 @@ wielded = FALSE /obj/item/singularityhammer/update_icon_state() - . = ..() - icon_state = "singularity_hammer0" + icon_state = "[base_icon_state]0" + return ..() /obj/item/singularityhammer/proc/recharge() charged = TRUE @@ -87,6 +88,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" worn_icon_state = "mjolnir" lefthand_file = 'icons/mob/inhands/weapons/hammers_lefthand.dmi' righthand_file = 'icons/mob/inhands/weapons/hammers_righthand.dmi' @@ -105,7 +107,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 +118,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(1.5 SECONDS) diff --git a/code/game/objects/items/spear.dm b/code/game/objects/items/spear.dm index 4b8886be7e8..61a6b6f4e40 100644 --- a/code/game/objects/items/spear.dm +++ b/code/game/objects/items/spear.dm @@ -29,10 +29,11 @@ AddComponent(/datum/component/butchering, 100, 70) //decent in a pinch, but pretty bad. AddComponent(/datum/component/jousting) AddComponent(/datum/component/two_handed, force_unwielded=10, force_wielded=18, icon_wielded="[icon_prefix]1") - update_icon() + update_appearance() /obj/item/spear/update_icon_state() icon_state = "[icon_prefix]0" + return ..() /obj/item/spear/suicide_act(mob/living/carbon/user) user.visible_message("[user] begins to sword-swallow \the [src]! It looks like [user.p_theyre()] trying to commit suicide!") @@ -45,13 +46,16 @@ 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() parts_list -= tip qdel(tip) return ..() /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 @@ -63,7 +67,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) @@ -77,9 +81,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) @@ -167,6 +168,8 @@ */ /obj/item/spear/bonespear //Blatant imitation of spear, but made out of bone. Not valid for explosive modification. icon_state = "bone_spear0" + base_icon_state = "bone_spear0" + icon_prefix = "bone_spear" name = "bone spear" desc = "A haphazardly-constructed yet still deadly weapon. The pinnacle of modern technology." force = 12 @@ -176,7 +179,4 @@ /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") diff --git a/code/game/objects/items/stacks/cannonballs.dm b/code/game/objects/items/stacks/cannonballs.dm index 4eefdc45b42..4f66129932f 100644 --- a/code/game/objects/items/stacks/cannonballs.dm +++ b/code/game/objects/items/stacks/cannonballs.dm @@ -2,6 +2,7 @@ name = "cannonballs" desc = "A stack of heavy plasteel cannonballs. Gunnery for the space age!" icon_state = "cannonballs" + base_icon_state = "cannonballs" max_amount = 14 singular_name = "cannonball" merge_type = /obj/item/stack/cannonball @@ -15,11 +16,8 @@ var/obj/projectile/projectile_type = /obj/projectile/bullet/cannonball /obj/item/stack/cannonball/update_icon_state() - if(amount == 1) - icon_state = "[initial(icon_state)]" - else - icon_state = "[initial(icon_state)]_[min(amount, 14)]" - + . = ..() + icon_state = (amount == 1) ? "[base_icon_state]" : "[base_icon_state]_[min(amount, 14)]" /obj/item/stack/cannonball/fourteen amount = 14 diff --git a/code/game/objects/items/stacks/cash.dm b/code/game/objects/items/stacks/cash.dm index 73aa5eecb50..2db2bf98ce0 100644 --- a/code/game/objects/items/stacks/cash.dm +++ b/code/game/objects/items/stacks/cash.dm @@ -18,9 +18,10 @@ . = ..() update_desc() -/obj/item/stack/spacecash/proc/update_desc() +/obj/item/stack/spacecash/update_desc() + . = ..() var/total_worth = get_item_credit_value() - desc = "It's worth [total_worth] credit[( total_worth > 1 ) ? "s" : ""] in total." + desc = "It's worth [total_worth] credit[(total_worth > 1) ? "s" : null] in total." /obj/item/stack/spacecash/get_item_credit_value() return (amount*value) @@ -34,6 +35,7 @@ update_desc() /obj/item/stack/spacecash/update_icon_state() + . = ..() var/cash_value = get_item_credit_value() switch(cash_value) if(1 to 9) diff --git a/code/game/objects/items/stacks/license_plates.dm b/code/game/objects/items/stacks/license_plates.dm index 12060f073d4..0ed1282e6c9 100644 --- a/code/game/objects/items/stacks/license_plates.dm +++ b/code/game/objects/items/stacks/license_plates.dm @@ -22,11 +22,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 ec9b387a2d6..c193fcadfd0 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -292,13 +292,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/try_heal(mob/living/M, mob/user, silent = FALSE) if(!is_open) @@ -322,7 +321,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 return ..() @@ -340,10 +339,9 @@ merge_type = /obj/item/stack/medical/mesh/advanced /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 0be94aa0f80..329176c7074 100644 --- a/code/game/objects/items/stacks/rods.dm +++ b/code/game/objects/items/stacks/rods.dm @@ -38,13 +38,14 @@ GLOBAL_LIST_INIT(rod_recipes, list ( \ /obj/item/stack/rods/Initialize(mapload, new_amount, merge = TRUE, list/mat_override=null, mat_amt=1) . = ..() - 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 dc5b0d24cb5..1660f702154 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -76,7 +76,7 @@ var/list/temp = SSmaterials.rigid_stack_recipes.Copy() recipes += temp update_weight() - update_icon() + update_appearance() /** Sets the amount of materials per unit for this stack. * @@ -125,13 +125,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) . = ..() @@ -364,7 +366,7 @@ return TRUE if(length(mats_per_unit)) update_custom_materials() - update_icon() + update_appearance() update_weight() return TRUE @@ -402,7 +404,7 @@ amount += _amount if(length(mats_per_unit)) update_custom_materials() - 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 92a66471c6b..20e6843b977 100644 --- a/code/game/objects/items/stacks/tickets.dm +++ b/code/game/objects/items/stacks/tickets.dm @@ -10,9 +10,10 @@ /obj/item/stack/arcadeticket/Initialize(mapload, new_amount, merge = TRUE, list/mat_override=null, mat_amt=1) . = ..() - 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/storage/bags.dm b/code/game/objects/items/storage/bags.dm index 7df266728a3..0e5ab012756 100644 --- a/code/game/objects/items/storage/bags.dm +++ b/code/game/objects/items/storage/bags.dm @@ -65,6 +65,7 @@ icon_state = "[initial(icon_state)]1" else icon_state = "[initial(icon_state)]" + return ..() /obj/item/storage/bag/trash/cyborg insertable = FALSE @@ -73,7 +74,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 @@ -355,7 +356,7 @@ if(ishuman(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)) @@ -373,11 +374,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 6b9cb3841a8..6d1c7decfff 100644 --- a/code/game/objects/items/storage/belt.dm +++ b/code/game/objects/items/storage/belt.dm @@ -20,13 +20,14 @@ /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. @@ -208,7 +209,7 @@ new /obj/item/stack/medical/bone_gel(src) new /obj/item/stack/sticky_tape/surgical(src) new /obj/item/reagent_containers/glass/bottle/formaldehyde(src) - update_icon() + update_appearance() /obj/item/storage/belt/security name = "security belt" @@ -249,7 +250,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" @@ -710,7 +711,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!") @@ -722,10 +723,11 @@ icon_state += "-sabre" inhand_icon_state += "-sabre" worn_icon_state += "-sabre" + return ..() /obj/item/storage/belt/sabre/PopulateContents() new /obj/item/melee/sabre(src) - update_icon() + update_appearance() /obj/item/storage/belt/plant name = "botanical belt" diff --git a/code/game/objects/items/storage/boxes.dm b/code/game/objects/items/storage/boxes.dm index cfdcc2c913a..96979eb9aaa 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/suicide_act(mob/living/carbon/user) var/obj/item/bodypart/head/myhead = user.get_bodypart(BODY_ZONE_HEAD) @@ -924,6 +924,7 @@ icon_state = "[inhand_icon_state]" else icon_state = "[inhand_icon_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 ed46f4f2361..39cdde43fcf 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,51 +13,59 @@ /obj/item/storage/fancy icon = 'icons/obj/food/containers.dmi' + icon_state = "donutbox" + base_icon_state = "donutbox" resistance_flags = FLAMMABLE custom_materials = list(/datum/material/cardboard = 2000) - 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 + /// What this container folds up into when it's empty. var/obj/fold_result = /obj/item/stack/sheet/cardboard /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() . = ..() - if(!contents.len) - new fold_result(user.drop_location()) - to_chat(user, "You fold the [src] into [initial(fold_result.name)].") - user.put_in_active_hand(fold_result) - qdel(src) + if(contents.len) + return + new fold_result(user.drop_location()) + to_chat(user, "You fold the [src] into [initial(fold_result.name)].") + user.put_in_active_hand(fold_result) + qdel(src) /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 @@ -73,11 +78,12 @@ desc = "Mmm. Donuts." icon = 'icons/obj/food/donuts.dmi' icon_state = "donutbox_inner" - icon_type = "donut" + base_icon_state = "donutbox" spawn_type = /obj/item/food/donut - fancy_open = TRUE + is_open = TRUE appearance_flags = KEEP_TOGETHER custom_premium_price = PAYCHECK_HARD * 1.75 + contents_tag = "donut" /obj/item/storage/fancy/donut_box/ComponentInitialize() . = ..() @@ -87,23 +93,19 @@ /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/food/donut/donut = _donut if (!istype(donut)) continue @@ -111,7 +113,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 @@ -123,12 +125,13 @@ icon = 'icons/obj/food/containers.dmi' inhand_icon_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/food/egg + contents_tag = "egg" /obj/item/storage/fancy/egg_box/ComponentInitialize() . = ..() @@ -145,13 +148,14 @@ desc = "A pack of red candles." icon = 'icons/obj/candle.dmi' icon_state = "candlebox5" - icon_type = "candle" + base_icon_state = "candlebox" inhand_icon_state = "candlebox5" worn_icon_state = "cigpack" 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() . = ..() @@ -175,13 +179,14 @@ icon_state = "cig" inhand_icon_state = "cigpacket" worn_icon_state = "cigpack" + base_icon_state = "cig" w_class = WEIGHT_CLASS_TINY throwforce = 0 slot_flags = ITEM_SLOT_BELT - icon_type = "cigarette" spawn_type = /obj/item/clothing/mask/cigarette/space_cigarette custom_price = PAYCHECK_MEDIUM age_restricted = TRUE + contents_tag = "cigarette" ///for cigarette overlay var/candy = FALSE /// Does this cigarette packet come with a coupon attached? @@ -190,19 +195,20 @@ var/rigged_omen = FALSE /obj/item/storage/fancy/cigarettes/attack_self(mob/user) - if(contents.len == 0 && spawn_coupon) - to_chat(user, "You rip the back off \the [src] and get a coupon!") - var/obj/item/coupon/attached_coupon = new - user.put_in_hands(attached_coupon) - attached_coupon.generate(rigged_omen) - attached_coupon = null - spawn_coupon = FALSE - name = "discarded cigarette packet" - desc = "An old cigarette packet with the back torn off, worth less than nothing now." - var/datum/component/storage/STR = GetComponent(/datum/component/storage) - STR.max_items = 0 - return - return ..() + if(contents.len != 0 || !spawn_coupon) + return ..() + + to_chat(user, "You rip the back off \the [src] and get a coupon!") + var/obj/item/coupon/attached_coupon = new + user.put_in_hands(attached_coupon) + attached_coupon.generate(rigged_omen) + attached_coupon = null + spawn_coupon = FALSE + name = "discarded cigarette packet" + desc = "An old cigarette packet with the back torn off, worth less than nothing now." + var/datum/component/storage/STR = GetComponent(/datum/component/storage) + STR.max_items = 0 + return /obj/item/storage/fancy/cigarettes/ComponentInitialize() . = ..() @@ -227,99 +233,109 @@ 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 age_restricted = FALSE @@ -333,24 +349,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 @@ -359,8 +379,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 = PAYCHECK_PRISONER @@ -372,12 +392,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" ///////////// //CIGAR BOX// @@ -388,8 +409,9 @@ desc = "A case of premium cigars. Very expensive." icon = 'icons/obj/cigarettes.dmi' icon_state = "cigarcase" + base_icon_state = "cigarcase" w_class = WEIGHT_CLASS_NORMAL - icon_type = "premium cigar" + contents_tag = "premium cigar" spawn_type = /obj/item/clothing/mask/cigarette/cigar spawn_coupon = FALSE @@ -400,30 +422,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 /* @@ -436,9 +459,10 @@ icon = 'icons/obj/food/containers.dmi' inhand_icon_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' + contents_tag = "chocolate" spawn_type = /obj/item/food/tinychocolate /obj/item/storage/fancy/heart_box/ComponentInitialize() @@ -453,7 +477,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/food/nugget /obj/item/storage/fancy/nugget_box/ComponentInitialize() diff --git a/code/game/objects/items/storage/firstaid.dm b/code/game/objects/items/storage/firstaid.dm index a59cc9e6369..b89785929df 100644 --- a/code/game/objects/items/storage/firstaid.dm +++ b/code/game/objects/items/storage/firstaid.dm @@ -541,6 +541,7 @@ name = "organ transport box" desc = "An advanced box with an cooling mechanism that uses cryostylane or other cold reagents to keep the organs or bodyparts inside preserved." icon_state = "organbox" + base_icon_state = "organbox" lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi' throw_speed = 3 @@ -581,22 +582,19 @@ cool = TRUE if(!cooling && cool) cooling = TRUE - update_icon() + update_appearance() for(var/C in contents) freeze(C) return if(cooling && !cool) cooling = FALSE - update_icon() + update_appearance() for(var/C in contents) unfreeze(C) -/obj/item/storage/organbox/update_icon() - . = ..() - if(cooling) - icon_state = "organbox-working" - else - icon_state = "organbox" +/obj/item/storage/organbox/update_icon_state() + icon_state = "[base_icon_state][cooling ? "-working" : null]" + return ..() ///freezes the organ and loops bodyparts like heads /obj/item/storage/organbox/proc/freeze(datum/source, obj/item/I) diff --git a/code/game/objects/items/storage/lockbox.dm b/code/game/objects/items/storage/lockbox.dm index 04ba8e6a637..eebcca2c357 100644 --- a/code/game/objects/items/storage/lockbox.dm +++ b/code/game/objects/items/storage/lockbox.dm @@ -60,12 +60,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" @@ -114,7 +114,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() @@ -132,12 +132,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 f3b3896fca4..3a1f9b2720c 100644 --- a/code/game/objects/items/storage/sixpack.dm +++ b/code/game/objects/items/storage/sixpack.dm @@ -15,10 +15,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 0a3e0a6ce96..51219d15210 100644 --- a/code/game/objects/items/storage/toolbox.dm +++ b/code/game/objects/items/storage/toolbox.dm @@ -29,7 +29,7 @@ latches = "double_latch" if(prob(1)) latches = "triple_latch" - update_icon() + update_appearance() /obj/item/storage/toolbox/update_overlays() . = ..() @@ -311,7 +311,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 521e52ab4d7..e48c79cf596 100644 --- a/code/game/objects/items/storage/wallets.dm +++ b/code/game/objects/items/storage/wallets.dm @@ -57,7 +57,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) @@ -67,10 +67,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 647f95fe55e..31b5d6cbd8a 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -56,7 +56,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) @@ -83,7 +83,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) @@ -103,17 +103,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) . = ..() @@ -135,7 +137,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) @@ -144,12 +146,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) @@ -165,7 +167,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) @@ -341,14 +343,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/tank_types.dm b/code/game/objects/items/tanks/tank_types.dm index 3a865bae6a5..38b985995fc 100644 --- a/code/game/objects/items/tanks/tank_types.dm +++ b/code/game/objects/items/tanks/tank_types.dm @@ -84,7 +84,7 @@ return src.master = F F.ptank = src - F.update_icon() + F.update_appearance() else return ..() diff --git a/code/game/objects/items/tanks/watertank.dm b/code/game/objects/items/tanks/watertank.dm index 78a7e74c4d4..81b96b64bde 100644 --- a/code/game/objects/items/tanks/watertank.dm +++ b/code/game/objects/items/tanks/watertank.dm @@ -423,7 +423,7 @@ var/inj_am = injection_amount * delta_time var/used_amount = inj_am / usage_ratio reagents.trans_to(user, used_amount, multiplier=usage_ratio, methods = INJECT) - update_icon() + update_appearance() user.update_inv_back() //for overlays update //Operator backpack spray diff --git a/code/game/objects/items/tcg/tcg.dm b/code/game/objects/items/tcg/tcg.dm index 8fc12b481b0..aa8872b7369 100644 --- a/code/game/objects/items/tcg/tcg.dm +++ b/code/game/objects/items/tcg/tcg.dm @@ -100,18 +100,30 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices) . = ..() flip_card(user) -/obj/item/tcgcard/update_icon_state() +/obj/item/tcgcard/update_name(updates) . = ..() if(!flipped) var/datum/card/template = extract_datum() name = template.name - desc = "[template.desc]" - icon_state = template.icon_state - else name = "Trading Card" + +/obj/item/tcgcard/update_desc(updates) + . = ..() + if(!flipped) + var/datum/card/template = GLOB.cached_cards[series]["ALL"][id] + desc = "[template.desc]" + else desc = "It's the back of a trading card... no peeking!" + +/obj/item/tcgcard/update_icon_state() + if(flipped) icon_state = "cardback" + return ..() + + var/datum/card/template = GLOB.cached_cards[series]["ALL"][id] + icon_state = template.icon_state + return ..() /obj/item/tcgcard/attackby(obj/item/I, mob/living/user, params) if(istype(I, /obj/item/tcgcard)) @@ -129,8 +141,8 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices) return user.transferItemToLoc(src, old_deck) flipped = old_deck.flipped - old_deck.update_icon() - update_icon() + old_deck.update_appearance() + update_appearance() return ..() /obj/item/tcgcard/proc/check_menu(mob/living/user) @@ -171,6 +183,7 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices) desc = "A stack of TCG cards." icon = 'icons/obj/tcgmisc.dmi' icon_state = "deck_up" + base_icon_state = "deck" obj_flags = UNIQUE_RENAME var/flipped = FALSE var/static/radial_draw = image(icon = 'icons/hud/radial.dmi', icon_state = "radial_draw") @@ -182,17 +195,20 @@ GLOBAL_LIST_EMPTY(tcgcard_radial_choices) LoadComponent(/datum/component/storage/concrete/tcg) /obj/item/tcgcard_deck/update_icon_state() - . = ..() - if(flipped) - switch(contents.len) - if(1 to 10) - icon_state = "deck_tcg_low" - if(11 to 20) - icon_state = "deck_tcg_half" - if(21 to INFINITY) - icon_state = "deck_tcg_full" - else - icon_state = "deck_up" + if(!flipped) + icon_state = "[base_icon_state]_up" + return ..() + + switch(contents.len) + if(1 to 10) + icon_state = "[icon_state]_tcg_low" + if(11 to 20) + icon_state = "[icon_state]_tcg_half" + if(21 to INFINITY) + icon_state = "[icon_state]_tcg_full" + else + icon_state = "[base_icon_state]_tcg" + return ..() /obj/item/tcgcard_deck/examine(mob/user) . = ..() diff --git a/code/game/objects/items/theft_tools.dm b/code/game/objects/items/theft_tools.dm index d1d5aff2196..c85acb9141b 100644 --- a/code/game/objects/items/theft_tools.dm +++ b/code/game/objects/items/theft_tools.dm @@ -140,7 +140,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 @@ -253,6 +253,7 @@ /obj/item/hemostat/supermatter/update_icon_state() icon_state = "supermatter_tongs[sliver ? "_loaded" : null]" inhand_icon_state = "supermatter_tongs[sliver ? "_loaded" : null]" + return ..() /obj/item/hemostat/supermatter/afterattack(atom/O, mob/user, proximity) . = ..() @@ -266,7 +267,7 @@ sliver.forceMove(loc) visible_message("\The [sliver] falls out of \the [src] as it hits the ground.") sliver = null - update_icon() + update_appearance() return ..() /obj/item/hemostat/supermatter/proc/Consume(atom/movable/AM, mob/living/user) @@ -293,4 +294,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/crowbar.dm b/code/game/objects/items/tools/crowbar.dm index 027073d8570..2d1fcc1171d 100644 --- a/code/game/objects/items/tools/crowbar.dm +++ b/code/game/objects/items/tools/crowbar.dm @@ -99,25 +99,27 @@ tool_behaviour = TOOL_WIRECUTTER to_chat(user, "You attach the cutting jaws to [src].") usesound = 'sound/items/jaws_cut.ogg' - update_icon() + update_appearance() else tool_behaviour = TOOL_CROWBAR to_chat(user, "You attach the prying jaws to [src].") usesound = 'sound/items/jaws_pry.ogg' - update_icon() + update_appearance() -/obj/item/crowbar/power/update_icon() +/obj/item/crowbar/power/update_icon_state() if(tool_behaviour == TOOL_WIRECUTTER) icon_state = "jaws_cutter" else icon_state = "jaws_pry" + return ..() -/obj/item/crowbar/power/syndicate/update_icon() +/obj/item/crowbar/power/syndicate/update_icon_state() if(tool_behaviour == TOOL_WIRECUTTER) icon_state = "jaws_cutter_syndie" else icon_state = "jaws_pry_syndie" + return ..() /obj/item/crowbar/power/attack(mob/living/carbon/C, mob/user) if(istype(C) && C.handcuffed && tool_behaviour == TOOL_WIRECUTTER) diff --git a/code/game/objects/items/tools/screwdriver.dm b/code/game/objects/items/tools/screwdriver.dm index 7050a3012e4..54e279d78a6 100644 --- a/code/game/objects/items/tools/screwdriver.dm +++ b/code/game/objects/items/tools/screwdriver.dm @@ -47,7 +47,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 9f9fa47338a..746133c2201 100644 --- a/code/game/objects/items/tools/weldingtool.dm +++ b/code/game/objects/items/tools/weldingtool.dm @@ -47,7 +47,7 @@ . = ..() create_reagents(max_fuel) reagents.add_reagent(/datum/reagent/fuel, max_fuel) - update_icon() + update_appearance() /obj/item/weldingtool/ComponentInitialize() . = ..() @@ -59,6 +59,7 @@ inhand_icon_state = "[initial(inhand_icon_state)]1" else inhand_icon_state = "[initial(inhand_icon_state)]" + return ..() /obj/item/weldingtool/update_overlays() @@ -76,7 +77,7 @@ if(0) force = 3 damtype = BRUTE - update_icon() + update_appearance() if(!can_off_process) STOP_PROCESSING(SSobj, src) return @@ -87,7 +88,7 @@ burned_fuel_for += delta_time 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() @@ -105,7 +106,7 @@ flamethrower_rods(I, user) else . = ..() - update_icon() + update_appearance() /obj/item/weldingtool/proc/explode() var/turf/T = get_turf(loc) @@ -147,7 +148,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) . = ..() @@ -170,7 +171,7 @@ explode() switched_on(user) - update_icon() + update_appearance() // Ah fuck, I can't believe you've done this @@ -214,7 +215,7 @@ if(get_fuel() <= 0 && welding) set_light_on(FALSE) switched_on(user) - update_icon() + update_appearance() return FALSE return TRUE @@ -231,7 +232,7 @@ force = 15 damtype = BURN hitsound = 'sound/items/welder.ogg' - update_icon() + update_appearance() START_PROCESSING(SSobj, src) else to_chat(user, "You need more fuel!") @@ -248,7 +249,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 4ceebbd3220..080fc32b56f 100644 --- a/code/game/objects/items/tools/wirecutters.dm +++ b/code/game/objects/items/tools/wirecutters.dm @@ -41,7 +41,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 e3c0d3add04..49dd7c09da5 100644 --- a/code/game/objects/items/tools/wrench.dm +++ b/code/game/objects/items/tools/wrench.dm @@ -112,7 +112,7 @@ toolspeed = 1 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) @@ -121,3 +121,4 @@ else icon_state = "[initial(icon_state)]" inhand_icon_state = "[initial(inhand_icon_state)]" + return ..() diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index e8d0fd36658..fda7457608a 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,12 +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" inhand_icon_state = "balloon" else icon_state = "waterballoon-e" inhand_icon_state = "balloon-empty" + return ..() #define BALLOON_COLORS list("red", "blue", "green", "yellow") @@ -272,7 +273,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 ..() @@ -306,6 +307,7 @@ /obj/item/toy/ammo/gun/update_icon_state() icon_state = "357OLD-[amount_left]" + return ..() /obj/item/toy/ammo/gun/examine(mob/user) . = ..() @@ -719,7 +721,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() @@ -732,6 +734,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) @@ -752,7 +755,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) @@ -764,7 +767,7 @@ qdel(CH) else to_chat(user, "You can't mix cards from other decks!") - update_icon() + update_appearance() else return ..() @@ -1514,10 +1517,11 @@ /obj/item/toy/eldritch_book/attack_self(mob/user) book_open = !book_open - update_icon() + update_appearance() /obj/item/toy/eldritch_book/update_icon_state() icon_state = book_open ? "book_open" : "book" + return ..() /* * Fake tear diff --git a/code/game/objects/items/wayfinding.dm b/code/game/objects/items/wayfinding.dm index 357fbb62c25..875b3a7b113 100644 --- a/code/game/objects/items/wayfinding.dm +++ b/code/game/objects/items/wayfinding.dm @@ -70,13 +70,12 @@ set_expression("veryhappy", 2 SECONDS) //v happy to be back in the pinpointer business START_PROCESSING(SSmachines, src) -/obj/machinery/pinpointer_dispenser/update_icon_state() - if(machine_stat & BROKEN) - set_light(0) - else if(powered()) - set_light(1.4) - else +/obj/machinery/pinpointer_dispenser/update_appearance(updates) + . = ..() + if((machine_stat & BROKEN) || !powered()) set_light(0) + return + set_light(1.4) /obj/machinery/pinpointer_dispenser/process(delta_time) if(machine_stat & (BROKEN|NOPOWER)) diff --git a/code/game/objects/items/weaponry.dm b/code/game/objects/items/weaponry.dm index dfa85a944ef..a50d2027d37 100644 --- a/code/game/objects/items/weaponry.dm +++ b/code/game/objects/items/weaponry.dm @@ -788,6 +788,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" @@ -813,7 +814,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) @@ -828,7 +829,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 13642b56940..20d0f526305 100644 --- a/code/game/objects/obj_defense.dm +++ b/code/game/objects/obj_defense.dm @@ -180,7 +180,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 ..() @@ -194,7 +194,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 a150a998754..112908ea18c 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 return ..() @@ -120,7 +120,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 @@ -129,13 +129,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 @@ -144,7 +144,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 @@ -154,7 +154,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 @@ -166,7 +166,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 @@ -178,7 +178,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 @@ -206,7 +206,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) @@ -214,7 +214,7 @@ to_chat(user, "You remove the brain.") brain.forceMove(loc) brain = null - update_icon() + update_appearance() return if(GLASS_CORE) @@ -222,7 +222,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 @@ -249,7 +249,7 @@ qdel(src) else state = AI_READY_CORE - update_icon() + update_appearance() return if(AI_READY_CORE) @@ -260,7 +260,7 @@ P.play_tool_sound(src) to_chat(user, "You disconnect the monitor.") state = GLASS_CORE - update_icon() + update_appearance() return return ..() @@ -281,6 +281,7 @@ icon_state = "4" if(AI_READY_CORE) icon_state = "ai-empty" + return ..() /obj/structure/ai_core/deconstruct(disassembled = TRUE) if(state == GLASS_CORE) diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm index c2d1b660885..b786fc8c747 100644 --- a/code/game/objects/structures/aliens.dm +++ b/code/game/objects/structures/aliens.dm @@ -277,7 +277,7 @@ /obj/structure/alien/egg/Initialize(mapload) . = ..() - update_icon() + update_appearance() if(status == GROWING || status == GROWN) child = new(src) if(status == GROWING) @@ -298,6 +298,7 @@ icon_state = "[base_icon]" if(BURST) icon_state = "[base_icon]_hatched" + return ..() /obj/structure/alien/egg/attack_paw(mob/living/user, list/modifiers) return attack_hand(user, modifiers) @@ -330,7 +331,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 @@ -338,7 +339,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/game/objects/structures/artstuff.dm b/code/game/objects/structures/artstuff.dm index 4cb788a3b58..aceb89553ca 100644 --- a/code/game/objects/structures/artstuff.dm +++ b/code/game/objects/structures/artstuff.dm @@ -118,7 +118,7 @@ var/y = text2num(params["y"]) grid[x][y] = color used = TRUE - update_icon() + update_appearance() . = TRUE if("finalize") . = TRUE @@ -133,17 +133,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) @@ -154,7 +156,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() @@ -241,6 +243,7 @@ desc = "Art or \"Art\"? You decide." icon = 'icons/obj/decals.dmi' icon_state = "frame-empty" + base_icon_state = "frame" custom_materials = list(/datum/material/wood = 2000) buildable_sign = FALSE ///Canvas we're currently displaying. @@ -284,8 +287,7 @@ current_canvas.forceMove(drop_location()) current_canvas = null to_chat(user, "You remove the painting from the frame.") - update_icon() - update_name_and_desc() + update_appearance() return TRUE /obj/structure/sign/painting/proc/frame_canvas(mob/user,obj/item/canvas/new_canvas) @@ -294,40 +296,37 @@ if(!current_canvas.finalized) current_canvas.finalize(user) to_chat(user,"You frame [current_canvas].") - update_icon() - update_name_and_desc() + update_appearance() /obj/structure/sign/painting/proc/try_rename(mob/user) if(current_canvas.painting_name == initial(current_canvas.painting_name)) current_canvas.try_rename(user) -/obj/structure/sign/painting/proc/update_name_and_desc() - if(current_canvas) - name = "painting - [current_canvas.painting_name]" - desc = desc_with_canvas - else - name = initial(name) - desc = initial(desc) +/obj/structure/sign/painting/update_name(updates) + name = current_canvas ? "painting - [current_canvas.painting_name]" : initial(name) + return ..() + +/obj/structure/sign/painting/update_desc(updates) + desc = current_canvas ? desc_with_canvas : initial(desc) + return ..() /obj/structure/sign/painting/update_icon_state() - . = ..() - if(current_canvas?.generated_icon) - icon_state = "frame-overlay" - else - icon_state = "frame-empty" - + icon_state = "[base_icon_state]-[current_canvas?.generated_icon ? "overlay" : "empty"]" + return ..() /obj/structure/sign/painting/update_overlays() . = ..() - if(current_canvas?.generated_icon) - var/mutable_appearance/MA = mutable_appearance(current_canvas.generated_icon) - MA.pixel_x = current_canvas.framed_offset_x - MA.pixel_y = current_canvas.framed_offset_y - . += MA - var/mutable_appearance/frame = mutable_appearance(current_canvas.icon,"[current_canvas.icon_state]frame") - frame.pixel_x = current_canvas.framed_offset_x - 1 - frame.pixel_y = current_canvas.framed_offset_y - 1 - . += frame + if(!current_canvas?.generated_icon) + return + + var/mutable_appearance/MA = mutable_appearance(current_canvas.generated_icon) + MA.pixel_x = current_canvas.framed_offset_x + MA.pixel_y = current_canvas.framed_offset_y + . += MA + var/mutable_appearance/frame = mutable_appearance(current_canvas.icon,"[current_canvas.icon_state]frame") + frame.pixel_x = current_canvas.framed_offset_x - 1 + frame.pixel_y = current_canvas.framed_offset_y - 1 + . += frame /obj/structure/sign/painting/proc/load_persistent() if(!persistence_id) @@ -362,8 +361,7 @@ new_canvas.author_ckey = author new_canvas.name = "painting - [title]" current_canvas = new_canvas - update_icon() - update_name_and_desc() + update_appearance() /obj/structure/sign/painting/proc/save_persistent() if(!persistence_id || !current_canvas) @@ -439,7 +437,6 @@ for(var/obj/structure/sign/painting/P in SSpersistence.painting_frames) if(P.current_canvas && md5(P.current_canvas.get_data_string()) == md5) QDEL_NULL(P.current_canvas) - P.update_icon() - P.update_name_and_desc() + P.update_appearance() log_admin("[key_name(user)] has deleted a persistent painting made by [author].") message_admins("[key_name_admin(user)] has deleted persistent painting made by [author].") diff --git a/code/game/objects/structures/bedsheet_bin.dm b/code/game/objects/structures/bedsheet_bin.dm index b6ee894b1c6..59d7390aef5 100644 --- a/code/game/objects/structures/bedsheet_bin.dm +++ b/code/game/objects/structures/bedsheet_bin.dm @@ -325,11 +325,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) @@ -339,7 +340,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 @@ -388,7 +389,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()) @@ -412,7 +413,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/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index c8a86825870..22557345324 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() PopulateContents() //USE THIS TO FILL IT, NOT INITIALIZE OR NEW @@ -56,14 +56,19 @@ 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 (istype(src, /obj/structure/closet/supplypod)) + if(istype(src, /obj/structure/closet/supplypod)) return - if(!opened) - layer = OBJ_LAYER - else - layer = BELOW_OBJ_LAYER + + layer = opened ? BELOW_OBJ_LAYER : OBJ_LAYER /obj/structure/closet/update_overlays() . = ..() @@ -71,28 +76,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) . = ..() @@ -168,7 +164,7 @@ if(!dense_when_open) density = FALSE dump_contents() - update_icon() + update_appearance() after_open(user, force) return TRUE @@ -224,7 +220,7 @@ playsound(loc, close_sound, close_sound_volume, TRUE, -3) opened = FALSE density = TRUE - update_icon() + update_appearance() after_close(user) return TRUE @@ -294,7 +290,7 @@ "You [welded ? "weld" : "unwelded"] \the [src] with \the [W].", "You hear welding.") log_game("[key_name(user)] [welded ? "welded":"unwelded"] closet [src] with [W] at [AREACOORD(src)]") - update_icon() + update_appearance() else if(W.tool_behaviour == TOOL_WRENCH && anchorable) if(isinspace() && !anchored) return @@ -466,7 +462,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) @@ -481,7 +477,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))) @@ -497,7 +493,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 915f1088600..906ba9ddf99 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 = "[initial(name)] - [t]" tagged = TRUE - update_icon() + update_appearance() else name = initial(name) return @@ -47,7 +47,7 @@ to_chat(user, "You cut the tag off [src].") name = "body bag" tagged = FALSE - 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 eeb3c1ef9f1..dd104f2c960 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/personal.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/personal.dm @@ -46,7 +46,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 11ef4e3315e..f0d6cf58f19 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -25,7 +25,7 @@ AddElement(/datum/element/climbable, climb_time = crate_climb_time * 0.5, climb_stun = 0) else AddElement(/datum/element/climbable, climb_time = crate_climb_time, climb_stun = 0) - update_icon() + update_appearance() /obj/structure/closet/crate/CanAllowThrough(atom/movable/mover, turf/target) . = ..() @@ -39,6 +39,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 @@ -70,7 +71,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].") @@ -80,7 +81,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 6b8e3ac6586..26335320c2b 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 78bb1b06234..8ca58d9e20a 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 82439bb13a4..44f4f4fd761 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) @@ -116,7 +117,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 96e2a920327..61d9eea22b8 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -31,19 +31,19 @@ trophy_message = showpiece_entry["trophy_message"] if(start_showpiece_type) showpiece = new start_showpiece_type (src) - update_icon() + update_appearance() /obj/structure/displaycase/vv_edit_var(vname, vval) . = ..() if(vname in list(NAMEOF(src, open), NAMEOF(src, showpiece), NAMEOF(src, custom_glass_overlay))) - update_icon() + update_appearance() /obj/structure/displaycase/handle_atom_del(atom/A) if(A == electronics) electronics = null if(A == showpiece) showpiece = null - update_icon() + update_appearance() return ..() /obj/structure/displaycase/Destroy() @@ -65,7 +65,7 @@ return showpiece.forceMove(drop_location()) showpiece = null - update_icon() + update_appearance() /obj/structure/displaycase/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0) switch(damage_type) @@ -88,7 +88,7 @@ broken = TRUE new /obj/item/shard(drop_location()) playsound(src, "shatter", 70, TRUE) - update_icon() + update_appearance() trigger_alarm() ///Anti-theft alarm triggered when broken. @@ -110,8 +110,10 @@ return if(broken) . += "[initial(icon_state)]_broken" - else if(!open) + return + if(!open) . += "[initial(icon_state)]_closed" + return /obj/structure/displaycase/attackby(obj/item/W, mob/living/user, params) if(W.GetID() && !broken && openable) @@ -128,7 +130,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!") @@ -157,7 +159,7 @@ G.use(2) broken = FALSE obj_integrity = max_integrity - update_icon() + update_appearance() else return ..() @@ -168,11 +170,11 @@ if(user.transferItemToLoc(wack, src)) showpiece = wack to_chat(user, "You put [wack] on display.") - update_icon() + update_appearance() /obj/structure/displaycase/proc/toggle_lock(mob/user) open = !open - update_icon() + update_appearance() /obj/structure/displaycase/attack_paw(mob/user, list/modifiers) return attack_hand(user, modifiers) @@ -334,7 +336,7 @@ to_chat(user, "You insert [W] into the case.") showpiece = W added_roundstart = FALSE - update_icon() + update_appearance() placer_key = user.ckey @@ -399,6 +401,7 @@ /obj/structure/displaycase/forsale/update_icon_state() icon_state = "[initial(icon_state)][broken ? "_broken" : (open ? "_open" : (!showpiece ? "_empty" : null))]" + return ..() /obj/structure/displaycase/forsale/update_overlays() . = ..() @@ -468,7 +471,7 @@ playsound(src, 'sound/effects/cashregister.ogg', 40, TRUE) flick("[initial(icon_state)]_vend", src) showpiece = null - update_icon() + update_appearance() SStgui.update_uis(src) return TRUE if("Open") @@ -534,7 +537,7 @@ if(do_after(user, 20, target = src)) broken = FALSE obj_integrity = max_integrity - update_icon() + update_appearance() return TRUE /obj/structure/displaycase/forsale/wrench_act(mob/living/user, obj/item/I) @@ -574,7 +577,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 6cdab82d822..2cef40702ab 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 09120ffb084..d11d5b8b76e 100644 --- a/code/game/objects/structures/door_assembly.dm +++ b/code/game/objects/structures/door_assembly.dm @@ -22,7 +22,7 @@ /obj/structure/door_assembly/Initialize() . = ..() - update_icon() + update_appearance() update_name() /obj/structure/door_assembly/examine(mob/user) @@ -267,12 +267,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() . = ..() @@ -282,7 +282,7 @@ . += get_airlock_overlay("glass_construction", overlays_file) . += get_airlock_overlay("panel_c[state+1]", overlays_file) -/obj/structure/door_assembly/proc/update_name() +/obj/structure/door_assembly/update_name() name = "" switch(state) if(AIRLOCK_ASSEMBLY_NEEDS_WIRES) @@ -293,6 +293,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 @@ -305,7 +306,7 @@ if(electronics) target.electronics = source.electronics source.electronics.forceMove(target) - target.update_icon() + target.update_appearance() target.update_name() qdel(source) diff --git a/code/game/objects/structures/extinguisher.dm b/code/game/objects/structures/extinguisher.dm index 24452c4d302..cf528d8fc6a 100644 --- a/code/game/objects/structures/extinguisher.dm +++ b/code/game/objects/structures/extinguisher.dm @@ -45,7 +45,7 @@ /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/living/user, params) if(I.tool_behaviour == TOOL_WRENCH && !stored_extinguisher) @@ -65,7 +65,7 @@ return stored_extinguisher = I to_chat(user, "You place [I] in [src].") - update_icon() + update_appearance() return TRUE else toggle_cabinet(user) @@ -88,7 +88,7 @@ if(!opened) opened = 1 playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3) - update_icon() + update_appearance() else toggle_cabinet(user) @@ -101,7 +101,7 @@ stored_extinguisher = null opened = TRUE playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3) - update_icon() + update_appearance() return toggle_cabinet(user) @@ -120,19 +120,21 @@ else playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3) opened = !opened - update_icon() + update_appearance() /* SKYRAT EDIT REMOVAL BEGIN - AESTHETICS - MOVED TO MODULAR. /obj/structure/extinguisher_cabinet/update_icon_state() if(!opened) icon_state = "extinguisher_closed" - else if(stored_extinguisher) - if(istype(stored_extinguisher, /obj/item/extinguisher/mini)) - icon_state = "extinguisher_mini" - else - icon_state = "extinguisher_full" - else + return ..() + if(!stored_extinguisher) icon_state = "extinguisher_empty" + return ..() + if(istype(stored_extinguisher, /obj/item/extinguisher/mini)) + icon_state = "extinguisher_mini" + return ..() + icon_state = "extinguisher_full" + return ..() */ /obj/structure/extinguisher_cabinet/obj_break(damage_flag) @@ -142,7 +144,7 @@ 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 e919d387c9f..012dbad0518 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -39,7 +39,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 @@ -52,24 +52,27 @@ density = !density set_opacity(density) opening = FALSE - update_icon() + update_appearance() air_update_turf(TRUE, !density) /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 53f883fb2f1..38ff0b224ad 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 = FALSE 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, list/modifiers) @@ -138,33 +138,31 @@ to_chat(user, "The [name] won't budge!") return open = !open - update_icon() + update_appearance() /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...") @@ -172,7 +170,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" @@ -184,5 +182,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 23db4e2d89b..9f640f439e1 100644 --- a/code/game/objects/structures/fireplace.dm +++ b/code/game/objects/structures/fireplace.dm @@ -71,19 +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) @@ -112,7 +114,7 @@ playsound(src, 'sound/effects/comfyfire.ogg',50,FALSE, FALSE, TRUE) var/turf/T = get_turf(src) T.hotspot_expose(700, 2.5 * delta_time) - update_icon() + update_appearance() adjust_light() /obj/structure/fireplace/extinguish() @@ -142,11 +144,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 b3d753518be..3f5d3eeeb6d 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 @@ -27,21 +28,19 @@ /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 2ff2d86f014..0b48c748f4b 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/living/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.combat_mode) 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/thing in contents) diff --git a/code/game/objects/structures/headpike.dm b/code/game/objects/structures/headpike.dm index 8a0db6b0d59..5b81f8ecd84 100644 --- a/code/game/objects/structures/headpike.dm +++ b/code/game/objects/structures/headpike.dm @@ -17,24 +17,38 @@ . = ..() if(mapload) CheckParts() + pixel_x = rand(-8, 8) + +/obj/structure/headpike/Destroy() + QDEL_NULL(victim) + QDEL_NULL(spear) + return ..() /obj/structure/headpike/CheckParts(list/parts_list) victim = locate() in parts_list if(!victim) //likely a mapspawned one victim = new(src) victim.real_name = random_unique_name(prob(50)) - name = "[victim.real_name] on a spear" spear = locate(bonespear ? /obj/item/spear/bonespear : /obj/item/spear) in parts_list if(!spear) spear = bonespear ? new/obj/item/spear/bonespear(src) : new/obj/item/spear(src) - update_icon() + update_appearance() return ..() -/obj/structure/headpike/Destroy() - QDEL_NULL(victim) - QDEL_NULL(spear) +/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 + /obj/structure/headpike/handle_atom_del(atom/A) if(A == victim) victim = null @@ -54,19 +68,6 @@ spear = null return ..() -/obj/structure/headpike/Initialize() - . = ..() - pixel_x = rand(-8, 8) - -/obj/structure/headpike/update_overlays() - . = ..() - if(victim) - var/mutable_appearance/MA = new() - MA.copy_overlays(victim) - MA.pixel_y = 12 - MA.pixel_x = pixel_x - . += victim - /obj/structure/headpike/attack_hand(mob/user, list/modifiers) . = ..() if(.) diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index e743ff49ce2..d6635cd5a9f 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -66,7 +66,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)) @@ -79,7 +79,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 @@ else return - update_icon() + update_appearance() /** * check_menu: Checks if we are allowed to interact with a radial menu diff --git a/code/game/objects/structures/ladders.dm b/code/game/objects/structures/ladders.dm index 81a0ce8b844..00bb3867a95 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,29 @@ 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 SSmapping.get_turf_above(T) 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)) @@ -186,7 +180,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) @@ -196,17 +190,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 4c7d8251df7..8b5dbb51bcf 100644 --- a/code/game/objects/structures/life_candle.dm +++ b/code/game/objects/structures/life_candle.dm @@ -45,7 +45,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() if(linked_minds.len) START_PROCESSING(SSobj, src) set_light(lit_luminosity) @@ -54,10 +54,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 980fcecd2bc..17dcf76632d 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -100,7 +100,7 @@ door_opened = TRUE layer = OPEN_DOOR_LAYER air_update_turf(TRUE, FALSE) - update_icon() + update_appearance() isSwitchingStates = FALSE if(close_delay != -1) @@ -121,11 +121,12 @@ door_opened = FALSE layer = initial(layer) air_update_turf(TRUE, TRUE) - 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/living/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 92bc098e855..e35debd6348 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 b91a93aa98a..4b1bfdd15cc 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)) @@ -131,7 +127,7 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an connected.setDir(dir) for(var/atom/movable/AM in src) AM.forceMove(T) - update_icon() + update_appearance() /obj/structure/bodycontainer/proc/close() playsound(src, 'sound/effects/roll.ogg', 5, TRUE) @@ -142,7 +138,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))) @@ -155,9 +151,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() . = ..() @@ -175,28 +174,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 = get_all_contents_type(/mob/living) // Search for mobs in all contents. - if(!length(compiled)) // No mobs? - icon_state = "morgue3" - return + return ..() - for(var/mob/living/M in compiled) - var/mob/living/mob_occupant = get_mob_or_brainmob(M) - if(mob_occupant.client && !mob_occupant.suiciding && !(HAS_TRAIT(mob_occupant, TRAIT_BADDNA))) - 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 + if(contents.len == 1) // Empty + icon_state = "morgue1" + return ..() + + var/list/compiled = get_all_contents_type(/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 && !mob_occupant.suiciding && !(HAS_TRAIT(mob_occupant, TRAIT_BADDNA))) + 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 @@ -211,6 +213,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 @@ -234,20 +237,15 @@ GLOBAL_LIST_EMPTY(crematoriums) /obj/structure/bodycontainer/crematorium/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) id = "[port.id]_[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) @@ -263,7 +261,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) @@ -288,7 +286,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 @@ -322,7 +320,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/safe.dm b/code/game/objects/structures/safe.dm index d02a802350b..6ec84a5fb23 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 b12411bd3c4..4a82035cbaa 100644 --- a/code/game/objects/structures/shower.dm +++ b/code/game/objects/structures/shower.dm @@ -55,7 +55,7 @@ to_chat(M,"\The [src] is dry.") return FALSE on = !on - update_icon() + update_appearance() handle_mist() add_fingerprint(M) if(on) @@ -105,10 +105,11 @@ /obj/machinery/shower/update_overlays() . = ..() - if(on) - var/mutable_appearance/water_falling = mutable_appearance('icons/obj/watercloset.dmi', "water", ABOVE_MOB_LAYER) - water_falling.color = mix_color_from_reagents(reagents.reagent_list) - . += water_falling + if(!on) + return + var/mutable_appearance/water_falling = mutable_appearance('icons/obj/watercloset.dmi', "water", ABOVE_MOB_LAYER) + water_falling.color = mix_color_from_reagents(reagents.reagent_list) + . += water_falling /obj/machinery/shower/proc/handle_mist() // If there is no mist, and the shower was turned on (on a non-freezing temp): make mist in 5 seconds @@ -160,7 +161,7 @@ handle_mist() if(can_refill) reagents.add_reagent(reagent_id, refill_rate * delta_time) - update_icon() + update_appearance() if(reagents.total_volume == reagents.maximum_volume) return PROCESS_KILL diff --git a/code/game/objects/structures/stairs.dm b/code/game/objects/structures/stairs.dm index e7b228d6fda..63998e84774 100644 --- a/code/game/objects/structures/stairs.dm +++ b/code/game/objects/structures/stairs.dm @@ -46,12 +46,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/Uncross(atom/movable/AM, atom/newloc) if(!newloc || !AM) @@ -67,10 +67,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/statues.dm b/code/game/objects/structures/statues.dm index 1c0a43da63b..df5879435f4 100644 --- a/code/game/objects/structures/statues.dm +++ b/code/game/objects/structures/statues.dm @@ -458,10 +458,11 @@ Moving interrupts /obj/structure/carving_block/update_overlays() . = ..() - if(target_appearance_with_filters) - //We're only keeping one instance here that changes in the middle so we have to clone it to avoid managed overlay issues - var/mutable_appearance/clone = new(target_appearance_with_filters) - . += clone + if(!target_appearance_with_filters) + return + //We're only keeping one instance here that changes in the middle so we have to clone it to avoid managed overlay issues + var/mutable_appearance/clone = new(target_appearance_with_filters) + . += clone /obj/structure/carving_block/proc/is_viable_target(atom/movable/target) //Only things on turfs @@ -508,7 +509,7 @@ Moving interrupts remove_filter("partial_uncover") add_filter("partial_uncover", 1, alpha_mask_filter(icon = white, y = -mask_offset)) target_appearance_with_filters.filters = filter(type="alpha",icon=white,y=-mask_offset,flags=MASK_INVERSE) - update_icon() + update_appearance() /// Returns a list of preset statues carvable from this block depending on the custom materials @@ -559,7 +560,7 @@ Moving interrupts content_ma.alpha = 255 content_ma.appearance_flags &= ~KEEP_APART //Don't want this content_ma.filters = filter(type="color",color=greyscale_with_value_bump,space=FILTER_COLOR_HSV) - update_icon() + update_appearance() /obj/structure/statue/custom/update_overlays() . = ..() diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 9e79ca17619..17f9733e2d9 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -50,6 +50,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 042dea1e7c9..0f0153c9c05 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 8f19433d50a..f069005fe05 100644 --- a/code/game/objects/structures/transit_tubes/station.dm +++ b/code/game/objects/structures/transit_tubes/station.dm @@ -37,7 +37,7 @@ for(var/obj/structure/transit_tube_pod/pod in loc) if(!pod.moving) AM.forceMove(pod) - pod.update_icon() + pod.update_appearance() return @@ -259,7 +259,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 d8da0c885d2..f703c2a2f53 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm @@ -31,10 +31,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) @@ -98,7 +96,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 @@ -199,7 +197,7 @@ if(direction == turn(station.boarding_dir,180)) if(station.open_status == STATION_TUBE_OPEN) user.forceMove(loc) - update_icon() + update_appearance() else station.open_animation() else if(direction in station.tube_dirs) diff --git a/code/game/objects/structures/votingbox.dm b/code/game/objects/structures/votingbox.dm index 1c0237f7f14..fe2f3731209 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") @@ -205,12 +205,13 @@ P.info = tally.Join() P.name = "Voting Results" - P.update_icon() + P.update_appearance() user.put_in_hands(P) to_chat(user,"[src] prints out the voting tally.") /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 023e23ba9ed..02e01450a8a 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, list/modifiers) @@ -75,11 +75,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)) @@ -99,7 +100,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() @@ -636,22 +637,21 @@ /obj/structure/curtain/proc/toggle() open = !open - update_icon() - -/obj/structure/curtain/update_icon() - if(!open) - icon_state = "[icon_type]-closed" - layer = WALL_OBJ_LAYER - density = TRUE - open = FALSE - if(opaque_closed) - set_opacity(TRUE) - else - icon_state = "[icon_type]-open" + if(open) layer = SIGN_LAYER density = FALSE - open = TRUE set_opacity(FALSE) + else + layer = WALL_OBJ_LAYER + density = TRUE + if(opaque_closed) + set_opacity(TRUE) + + 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 846a1385ac9..05c20c8ace8 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -47,6 +47,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) . = ..() @@ -302,7 +303,7 @@ return ..() //Update to reflect changes(if applicable) - update_icon() + update_appearance() @@ -323,7 +324,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() @@ -345,5 +346,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 049490d4931..c1113b50bc1 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -312,28 +312,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 + if(QDELETED(src) || !fulltile) + return - var/ratio = obj_integrity / max_integrity - ratio = CEILING(ratio*4, 1) * 25 + 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/should_atmos_process(datum/gas_mixture/air, exposed_temperature) return exposed_temperature > T0C + heat_resistance @@ -766,7 +764,7 @@ /obj/structure/window/paperframe/Initialize() . = ..() - update_icon() + update_appearance() /obj/structure/window/paperframe/examine(mob/user) . = ..() @@ -783,22 +781,22 @@ if(.) return if(user.combat_mode) - take_damage(4,BRUTE,MELEE, 0) + take_damage(4, BRUTE, MELEE, 0) if(!QDELETED(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/living/user) if(W.get_temperature()) @@ -813,10 +811,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/reinf_walls.dm b/code/game/turfs/closed/wall/reinf_walls.dm index 8cc1ca81d00..9b275ab9c53 100644 --- a/code/game/turfs/closed/wall/reinf_walls.dm +++ b/code/game/turfs/closed/wall/reinf_walls.dm @@ -60,7 +60,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 TRUE @@ -71,14 +71,14 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != SUPPORT_LINES) return TRUE d_state = COVER - update_icon() + update_appearance() to_chat(user, "You unsecure the support lines.") return TRUE 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 TRUE @@ -91,7 +91,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != COVER) return TRUE d_state = CUT_COVER - update_icon() + update_appearance() to_chat(user, "You press firmly on the cover, dislodging it.") return TRUE @@ -101,7 +101,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != COVER) return TRUE d_state = SUPPORT_LINES - update_icon() + update_appearance() to_chat(user, "The support lines have been secured.") return TRUE @@ -112,7 +112,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != CUT_COVER) return TRUE d_state = ANCHOR_BOLTS - update_icon() + update_appearance() to_chat(user, "You pry off the cover.") return TRUE @@ -124,7 +124,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 TRUE @@ -135,7 +135,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != ANCHOR_BOLTS) return TRUE d_state = SUPPORT_RODS - update_icon() + update_appearance() to_chat(user, "You remove the bolts anchoring the support rods.") return TRUE @@ -145,7 +145,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != ANCHOR_BOLTS) return TRUE d_state = CUT_COVER - update_icon() + update_appearance() to_chat(user, "The metal cover has been pried back into place.") return TRUE @@ -158,7 +158,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != SUPPORT_RODS) return TRUE d_state = SHEATH - update_icon() + update_appearance() to_chat(user, "You slice through the support rods.") return TRUE @@ -169,7 +169,7 @@ if(!istype(src, /turf/closed/wall/r_wall) || d_state != SUPPORT_RODS) return TRUE d_state = ANCHOR_BOLTS - update_icon() + update_appearance() to_chat(user, "You tighten the bolts anchoring the support rods.") return TRUE @@ -191,7 +191,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 TRUE return FALSE @@ -200,16 +200,17 @@ . = ..() if(d_state != INTACT) smoothing_flags = NONE - else - smoothing_flags = SMOOTH_BITMASK - QUEUE_SMOOTH_NEIGHBORS(src) - QUEUE_SMOOTH(src) + return + smoothing_flags = SMOOTH_BITMASK + QUEUE_SMOOTH_NEIGHBORS(src) + QUEUE_SMOOTH(src) /turf/closed/wall/r_wall/update_icon_state() if(d_state != INTACT) icon_state = "r_wall-[d_state]" else 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/open/floor.dm b/code/game/turfs/open/floor.dm index 48b10ccc32f..993d84319bd 100644 --- a/code/game/turfs/open/floor.dm +++ b/code/game/turfs/open/floor.dm @@ -149,7 +149,7 @@ var/old_dir = dir var/turf/open/floor/W = ..() W.setDir(old_dir) - W.update_icon() + W.update_appearance() return W /turf/open/floor/attackby(obj/item/object, mob/living/user, params) @@ -275,7 +275,7 @@ new_window.req_one_access = the_rcd.airlock_electronics.one_access new_window.unres_sides = the_rcd.airlock_electronics.unres_sides new_window.autoclose = TRUE - new_window.update_icon() + new_window.update_appearance() return TRUE to_chat(user, "You build an airlock.") var/obj/machinery/door/airlock/new_airlock = new the_rcd.airlock_type(src) @@ -291,7 +291,7 @@ if(new_airlock.electronics.unres_sides) new_airlock.unres_sides = new_airlock.electronics.unres_sides new_airlock.autoclose = TRUE - new_airlock.update_icon() + new_airlock.update_appearance() return TRUE if(RCD_DECONSTRUCT) if(!ScrapeAway(flags = CHANGETURF_INHERIT_AIR)) diff --git a/code/game/turfs/open/floor/fancy_floor.dm b/code/game/turfs/open/floor/fancy_floor.dm index 17be29e6ba6..4981fae4643 100644 --- a/code/game/turfs/open/floor/fancy_floor.dm +++ b/code/game/turfs/open/floor/fancy_floor.dm @@ -208,7 +208,7 @@ /turf/open/floor/carpet/Initialize() . = ..() - update_icon() + update_appearance() /turf/open/floor/carpet/update_icon() . = ..() @@ -367,11 +367,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/iron_floor.dm b/code/game/turfs/open/floor/iron_floor.dm index 79cfae18f0c..bf5a52073df 100644 --- a/code/game/turfs/open/floor/iron_floor.dm +++ b/code/game/turfs/open/floor/iron_floor.dm @@ -22,8 +22,9 @@ /turf/open/floor/iron/update_icon_state() if(broken || burnt) - return + return ..() icon_state = base_icon_state + return ..() /turf/open/floor/iron/airless diff --git a/code/game/turfs/open/floor/light_floor.dm b/code/game/turfs/open/floor/light_floor.dm index 82bb229a8af..120ac98bcb2 100644 --- a/code/game/turfs/open/floor/light_floor.dm +++ b/code/game/turfs/open/floor/light_floor.dm @@ -51,38 +51,50 @@ /turf/open/floor/light/Initialize() . = ..() - 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) - set_light_range(3) - if(LIGHTFLOOR_FLICKER) - icon_state = "light_on_flicker-[LAZYFIND(coloredlights, currentcolor)]" - set_light_color(currentcolor) - set_light(3) - set_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) @@ -93,7 +105,7 @@ if(!can_modify_colour) return on = !on - update_icon() + update_appearance() /turf/open/floor/light/multitool_act(mob/living/user, obj/item/I) . = ..() @@ -105,7 +117,7 @@ if(!choice) return FALSE currentcolor = choice - update_icon() + update_appearance() /turf/open/floor/light/attackby(obj/item/C, mob/user, params) if(..()) @@ -118,7 +130,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.") @@ -133,7 +145,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 0cd4766229e..00fd3e7c62b 100644 --- a/code/game/turfs/open/floor/mineral_floor.dm +++ b/code/game/turfs/open/floor/mineral_floor.dm @@ -23,13 +23,10 @@ /turf/open/floor/mineral/setup_broken_states() return list("[initial(icon_state)]_dam") -/turf/open/floor/mineral/update_icon() - . = ..() - if(!.) - return - 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 c67e7395999..26c18d079a3 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() 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/space/transit.dm b/code/game/turfs/open/space/transit.dm index 1502a7c2438..8f705c03c38 100644 --- a/code/game/turfs/open/space/transit.dm +++ b/code/game/turfs/open/space/transit.dm @@ -78,7 +78,7 @@ /turf/open/space/transit/Initialize() . = ..() - update_icon() + update_appearance() for(var/atom/movable/AM in src) throw_atom(AM) @@ -88,6 +88,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 f66b6966690..a586cef8e98 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(delta_time) if(is_operational) @@ -70,7 +68,7 @@ else use_power = IDLE_POWER_USE - update_icon() + update_appearance() if(dos_overload > 0) dos_overload = max(0, dos_overload - dos_dissipate * delta_time) @@ -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.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.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.add_log("Quantum relay manually restarted from overload recovery mode to normal operation mode.") return TRUE if("toggle") set_relay_enabled(!relay_enabled) SSnetworks.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 74f9331ce9d..602aa3366fc 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) diff --git a/code/modules/admin/verbs/manipulate_organs.dm b/code/modules/admin/verbs/manipulate_organs.dm index a3b7e4247c1..0695777a689 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 0b3dccbd693..01f24931f4e 100644 --- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm +++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm @@ -488,9 +488,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" diff --git a/code/modules/antagonists/abductor/machinery/experiment.dm b/code/modules/antagonists/abductor/machinery/experiment.dm index 6a196df29d2..f8987ed4694 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 8e081706e70..70a8e1cfbaa 100644 --- a/code/modules/antagonists/blob/blobstrains/_blobstrain.dm +++ b/code/modules/antagonists/blob/blobstrains/_blobstrain.dm @@ -95,7 +95,7 @@ GLOBAL_LIST_INIT(valid_blobstrains, subtypesof(/datum/blobstrain) - list(/datum/ for(var/obj/structure/blob/B as anything in overmind.all_blobs) B.max_integrity *= max_structure_health_multiplier B.obj_integrity *= max_structure_health_multiplier - B.update_icon() + B.update_appearance() for(var/mob/living/simple_animal/hostile/blob/BM as anything in overmind.blob_mobs) BM.maxHealth *= max_mob_health_multiplier diff --git a/code/modules/antagonists/blob/blobstrains/replicating_foam.dm b/code/modules/antagonists/blob/blobstrains/replicating_foam.dm index 16670ce1158..bdfc0ad7357 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 0fb62ff9bd9..b49bb2dbb55 100644 --- a/code/modules/antagonists/blob/overmind.dm +++ b/code/modules/antagonists/blob/overmind.dm @@ -64,7 +64,7 @@ GLOBAL_LIST_EMPTY(blob_nodes) set_strain(BS) color = blobstrain.complementary_color if(blob_core) - blob_core.update_icon() + blob_core.update_appearance() SSshuttle.registerHostileEnvironment(src) . = ..() START_PROCESSING(SSobj, src) @@ -186,7 +186,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 ca285953236..77ba191bb6c 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 = TRUE announcement_time = world.time + OVERMIND_ANNOUNCEMENT_MAX_TIME @@ -146,7 +146,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 2726b16039b..da2a4acd633 100644 --- a/code/modules/antagonists/blob/structures/_blob.dm +++ b/code/modules/antagonists/blob/structures/_blob.dm @@ -41,7 +41,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(TRUE, TRUE) ConsumeTile() @@ -86,6 +86,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 @@ -97,7 +98,7 @@ if(COOLDOWN_FINISHED(src, heal_timestamp)) obj_integrity = min(max_integrity, obj_integrity+health_regen) COOLDOWN_START(src, heal_timestamp, 20) - update_icon() + update_appearance() COOLDOWN_START(src, pulse_timestamp, 10) return TRUE//we did it, we were pulsed! return FALSE //oh no we failed @@ -161,7 +162,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 @@ -267,7 +268,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) @@ -279,7 +280,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 @@ -321,23 +322,30 @@ 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 = BLOB_BRUTE_RESIST else if (overmind) - icon_state = "blob" - name = "blob" - desc = "A thick wall of writhing tendrils." brute_resist = BLOB_BRUTE_RESIST * 0.5 else - icon_state = "blob" - name = "dead blob" - desc = "A thick wall of lifeless tendrils." brute_resist = BLOB_BRUTE_RESIST * 0.5 + return ..() /obj/structure/blob/special // Generic type for nodes/factories/cores/resource // Core and node vars: claiming, pulsing and expanding @@ -386,7 +394,7 @@ var/obj/structure/blob/B = L if(!B.overmind && 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)) diff --git a/code/modules/antagonists/blob/structures/core.dm b/code/modules/antagonists/blob/structures/core.dm index af808c2aa8d..9d5d65a758f 100644 --- a/code/modules/antagonists/blob/structures/core.dm +++ b/code/modules/antagonists/blob/structures/core.dm @@ -21,34 +21,37 @@ GLOB.blob_cores += src START_PROCESSING(SSobj, src) AddElement(/datum/element/point_of_interest) - update_icon() //so it atleast appears + update_appearance() //so it atleast appears if(!placed && !overmind) return INITIALIZE_HINT_QDEL if(overmind) overmind.blobstrain.on_gain() - update_icon() + update_appearance() . = ..() -/obj/structure/blob/special/core/scannerreport() - return "Directs the blob's expansion, gradually expands, and sustains nearby blob spores and blobbernauts." - -/obj/structure/blob/special/core/update_icon() - cut_overlays() - color = null - 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")) - /obj/structure/blob/special/core/Destroy() GLOB.blob_cores -= src if(overmind) overmind.blob_core = null - overmind = null + overmind = null STOP_PROCESSING(SSobj, src) return ..() +/obj/structure/blob/special/core/scannerreport() + return "Directs the blob's expansion, gradually expands, and sustains nearby blob spores and blobbernauts." + +/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 + . += blob_overlay + . += mutable_appearance('icons/mob/blob.dmi', "blob_core_overlay") + +/obj/structure/blob/special/core/update_icon() + color = null + return ..() + /obj/structure/blob/special/core/ex_act(severity, target) var/damage = 50 - 10 * severity //remember, the core takes half brute damage, so this is 20/15/10 damage based on severity take_damage(damage, BRUTE, BOMB, 0) diff --git a/code/modules/antagonists/blob/structures/node.dm b/code/modules/antagonists/blob/structures/node.dm index 89df63444b0..290ad0d6058 100644 --- a/code/modules/antagonists/blob/structures/node.dm +++ b/code/modules/antagonists/blob/structures/node.dm @@ -24,13 +24,16 @@ return "Gradually expands and sustains nearby blob spores and blobbernauts." /obj/structure/blob/special/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/special/node/creation_action() if(overmind) diff --git a/code/modules/antagonists/blob/structures/shield.dm b/code/modules/antagonists/blob/structures/shield.dm index 1f98a071457..8ed01886c68 100644 --- a/code/modules/antagonists/blob/structures/shield.dm +++ b/code/modules/antagonists/blob/structures/shield.dm @@ -20,20 +20,23 @@ /obj/structure/blob/shield/core // Automatically generated by the 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 - air_update_turf(TRUE, FALSE) - else - icon_state = initial(icon_state) - name = initial(name) - desc = initial(desc) - atmosblock = TRUE - air_update_turf(TRUE, TRUE) +/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 5011f21fa4a..7651077284f 100644 --- a/code/modules/antagonists/cult/cult_items.dm +++ b/code/modules/antagonists/cult/cult_items.dm @@ -372,6 +372,7 @@ /obj/item/sharpener/cult/update_icon_state() icon_state = "cult_sharpener[(uses == 0) ? "_used" : ""]" + return ..() /obj/item/clothing/suit/hooded/cultrobes/cult_shield name = "empowered cultist armor" @@ -639,8 +640,7 @@ name = "bloody halberd" desc = "A halberd with a volatile axehead made from crystallized blood. It seems linked to its creator. And, admittedly, more of a poleaxe than a halberd." icon_state = "occultpoleaxe0" - inhand_icon_state = "occultpoleaxe0" - base_icon_state = "occultpoleaxe0" + base_icon_state = "occultpoleaxe" w_class = WEIGHT_CLASS_HUGE force = 17 throwforce = 40 @@ -663,7 +663,7 @@ /obj/item/melee/cultblade/halberd/ComponentInitialize() . = ..() AddComponent(/datum/component/butchering, 100, 90) - AddComponent(/datum/component/two_handed, force_unwielded=17, force_wielded=24) + 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/melee/cultblade/halberd/proc/on_wield(obj/item/source, mob/user) @@ -678,12 +678,8 @@ wielded = FALSE /obj/item/melee/cultblade/halberd/update_icon_state() - if(wielded) - icon_state = "occultpoleaxe1" - inhand_icon_state = "occultpoleaxe1" - else - icon_state = "[base_icon_state]" - inhand_icon_state = "[base_icon_state]" + icon_state = "[base_icon_state]0" + return ..() /obj/item/melee/cultblade/halberd/Destroy() if(halberd_act) diff --git a/code/modules/antagonists/cult/cult_structures.dm b/code/modules/antagonists/cult/cult_structures.dm index 78e9cefcc2a..616434a03c7 100644 --- a/code/modules/antagonists/cult/cult_structures.dm +++ b/code/modules/antagonists/cult/cult_structures.dm @@ -63,10 +63,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/eldritch_cult/eldritch_book.dm b/code/modules/antagonists/eldritch_cult/eldritch_book.dm index 9be366f43a7..ca9262ff853 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_book.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_book.dm @@ -135,7 +135,7 @@ charge -= initial(EK.cost) return TRUE - update_icon() // Not applicable to all objects. + update_appearance() // Not applicable to all objects. /obj/item/forbidden_book/ui_close(mob/user) flick("book_closing",src) diff --git a/code/modules/antagonists/eldritch_cult/eldritch_magic.dm b/code/modules/antagonists/eldritch_cult/eldritch_magic.dm index 614a9becee5..e24d95f67ef 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_magic.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_magic.dm @@ -630,7 +630,7 @@ pixel_y = rand(-6,6) pixel_x = rand(-6,6) icon_state = "small_rune_[rand(12)]" - update_icon() + update_appearance() /obj/effect/proc_holder/spell/cone/staggered/entropic_plume name = "Entropic Plume" diff --git a/code/modules/antagonists/eldritch_cult/eldritch_structures.dm b/code/modules/antagonists/eldritch_cult/eldritch_structures.dm index 5be347389b7..772fdaddf45 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_structures.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_structures.dm @@ -3,6 +3,7 @@ desc = "Immortalized cast iron, the steel-like teeth holding it in place, it's vile extract has the power of rebirthing things, remaking them from the very beginning." icon = 'icons/obj/eldritch.dmi' icon_state = "crucible" + base_icon_state = "crucible" anchored = FALSE density = TRUE ///How much mass this currently holds @@ -100,11 +101,8 @@ update_icon_state() /obj/structure/eldritch_crucible/update_icon_state() - . = ..() - if(current_mass == max_mass) - icon_state = "crucible" - else - icon_state = "crucible_empty" + icon_state = "[base_icon_state][(current_mass == max_mass) ? null : "_empty"]" + return ..() /obj/structure/trap/eldritch name = "elder carving" diff --git a/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm b/code/modules/antagonists/nukeop/equipment/nuclearbomb.dm index 9238f83f67a..b54083490df 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() AddElement(/datum/element/point_of_interest) previous_level = get_security_level() @@ -108,7 +108,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) @@ -119,7 +119,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)) @@ -129,7 +129,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!") @@ -143,7 +143,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 . = ..() @@ -155,14 +155,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 @@ -179,7 +179,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" @@ -187,6 +187,7 @@ icon_state = "nuclearbomb_timing" if(NUKE_ON_EXPLODING) icon_state = "nuclearbomb_exploding" + return ..() /obj/machinery/nuclearbomb/update_overlays() . += ..() @@ -406,7 +407,7 @@ timing = FALSE detonation_timer = null countdown.stop() - update_icon() + update_appearance() /obj/machinery/nuclearbomb/proc/set_active() var/turf/our_turf = get_turf(src) @@ -432,7 +433,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) @@ -459,7 +460,7 @@ exploding = TRUE yes_code = FALSE safety = TRUE - update_icon() + update_appearance() sound_to_playing_players('sound/machines/alarm.ogg') if(SSticker?.mode) SSticker.roundend_check_paused = TRUE @@ -555,7 +556,7 @@ S.switch_mode_to(initial(S.mode)) S.alert = FALSE countdown.stop() - update_icon() + update_appearance() /obj/machinery/nuclearbomb/beer/proc/local_foam() 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 0b636d34843..c46883e9e7d 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 c4256961a23..f9b4307dd94 100644 --- a/code/modules/antagonists/traitor/equipment/Malf_Modules.dm +++ b/code/modules/antagonists/traitor/equipment/Malf_Modules.dm @@ -678,7 +678,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) if(!is_station_level(F.z)) continue 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/aquarium/aquarium.dm b/code/modules/aquarium/aquarium.dm index b6fcb511cbb..ec2c9563fe9 100644 --- a/code/modules/aquarium/aquarium.dm +++ b/code/modules/aquarium/aquarium.dm @@ -42,7 +42,7 @@ /obj/structure/aquarium/Initialize() . = ..() - update_icon() + update_appearance() RegisterSignal(src,COMSIG_PARENT_ATTACKBY, .proc/feed_feedback) @@ -96,7 +96,7 @@ if(!user.canUseTopic(src, BE_CLOSE)) return ..() panel_open = !panel_open - update_icon() + update_appearance() /obj/structure/aquarium/wrench_act(mob/living/user, obj/item/I) if(default_unfasten_wrench(user,I)) @@ -114,7 +114,7 @@ glass.use(2) broken = FALSE obj_integrity = max_integrity - update_icon() + update_appearance() return TRUE else // This signal exists so we common items instead of adding component on init can just register creation of one in response. @@ -123,7 +123,7 @@ var/datum/component/aquarium_content/content_component = I.GetComponent(/datum/component/aquarium_content) if(content_component && content_component.is_ready_to_insert(src)) if(user.transferItemToLoc(I,src)) - update_icon() + update_appearance() return TRUE else return ..() @@ -163,7 +163,7 @@ return user.visible_message("[user] stuffs [living_pulled] into [src]!") living_pulled.forceMove(src) - update_icon() + update_appearance() ///Apply mood bonus depending on aquarium status /obj/structure/aquarium/proc/admire(mob/user) @@ -250,7 +250,7 @@ var/datum/reagents/reagent_splash = new() reagent_splash.add_reagent(/datum/reagent/water, 30) chem_splash(droploc, 3, list(reagent_splash)) - update_icon() + update_appearance() #undef AQUARIUM_LAYER_STEP #undef AQUARIUM_MIN_OFFSET diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index 2158129372d..559868960c6 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 @@ -82,7 +86,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 3797dd59b29..eaeef57dd5f 100644 --- a/code/modules/assembly/bomb.dm +++ b/code/modules/assembly/bomb.dm @@ -19,10 +19,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() . = ..() @@ -135,7 +138,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 bf9aacf5721..98eac45c09f 100644 --- a/code/modules/assembly/doorcontrol.dm +++ b/code/modules/assembly/doorcontrol.dm @@ -83,7 +83,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 52d42b920b5..372bb543303 100644 --- a/code/modules/assembly/flash.dm +++ b/code/modules/assembly/flash.dm @@ -22,6 +22,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? @@ -42,18 +45,22 @@ attack(user,user) return FIRELOSS -/obj/item/assembly/flash/update_icon(flash = FALSE) - cut_overlays() - attached_overlays = list() - if(burnt_out) - add_overlay("flashburnt") - attached_overlays += "flashburnt" +/obj/item/assembly/flash/update_icon(updates=ALL, flash = FALSE) + flashing = flash + . = ..() if(flash) - add_overlay(flashing_overlay) - attached_overlays += flashing_overlay addtimer(CALLBACK(src, /atom/.proc/update_icon), 5) - if(holder) - holder.update_icon() + holder?.update_icon(updates) + +/obj/item/assembly/flash/update_overlays() + attached_overlays = list() + . = ..() + if(burnt_out) + . += "flashburnt" + attached_overlays += "flashburnt" + if(flashing) + . += flashing_overlay + attached_overlays += flashing_overlay /obj/item/assembly/flash/proc/clown_check(mob/living/carbon/human/user) if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50)) @@ -64,7 +71,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!") @@ -113,7 +120,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 @@ -239,7 +246,7 @@ if(issilicon(M)) var/mob/living/silicon/robot/flashed_borgo = M log_combat(user, flashed_borgo, "flashed", src) - update_icon(TRUE) + update_icon(ALL, TRUE) if(!flashed_borgo.flash_act(affect_silicon = TRUE)) user.visible_message("[user] fails to blind [flashed_borgo] with the flash!", "You fail to blind [flashed_borgo] with the flash!") return @@ -346,7 +353,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 31c6b0db584..d2bc2036bd7 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 2f52615bfc4..27ebdb409a3 100644 --- a/code/modules/assembly/holder.dm +++ b/code/modules/assembly/holder.dm @@ -27,7 +27,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) @@ -44,27 +44,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) - 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) + return - if(master) - master.update_icon() + 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 /obj/item/assembly_holder/Crossed(atom/movable/AM as mob|obj) . = ..() diff --git a/code/modules/assembly/infrared.dm b/code/modules/assembly/infrared.dm index 1c49ebeca76..5e861507023 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() . = ..() @@ -213,7 +214,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 ce32086aef2..46c2bb530c1 100644 --- a/code/modules/assembly/mousetrap.dm +++ b/code/modules/assembly/mousetrap.dm @@ -23,16 +23,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) @@ -43,7 +43,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) @@ -71,7 +71,7 @@ visible_message("Skreeeee!") //He's simply too large to be affected by a tiny mouse trap. playsound(src, 'sound/effects/snap.ogg', 50, TRUE) armed = FALSE - update_icon() + update_appearance() pulse(FALSE) @@ -89,7 +89,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 a8ee4601d2f..60a9b2618c8 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) @@ -87,7 +87,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) @@ -95,18 +95,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") + . += "prox_timing" attached_overlays += "prox_timing" if(scanning) - add_overlay("prox_scanning") + . += "prox_scanning" attached_overlays += "prox_scanning" - if(holder) - holder.update_icon() - return /obj/item/assembly/prox_sensor/ui_status(mob/user) if(is_secured(user)) @@ -144,7 +145,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 5eb39705bff..2eca104f199 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -61,10 +61,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)) @@ -110,7 +109,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 98840d33f2a..d860e0a1d47 100644 --- a/code/modules/assembly/timer.dm +++ b/code/modules/assembly/timer.dm @@ -40,7 +40,7 @@ if(!..()) return FALSE//Cooldown check timing = !timing - update_icon() + update_appearance() return TRUE /obj/item/assembly/timer/toggle_secure() @@ -50,7 +50,7 @@ else timing = FALSE STOP_PROCESSING(SSobj, src) - update_icon() + update_appearance() return secured /obj/item/assembly/timer/proc/timer_end() @@ -64,7 +64,7 @@ LM.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(delta_time) if(!timing) @@ -75,14 +75,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)) @@ -113,7 +115,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 eac5d29f852..c050e4a60f1 100644 --- a/code/modules/atmospherics/machinery/airalarm.dm +++ b/code/modules/atmospherics/machinery/airalarm.dm @@ -227,7 +227,7 @@ if(name == initial(name)) name = "[get_area_name(src)] Air Alarm" - update_icon() + update_appearance() /obj/machinery/airalarm/Destroy() SSradio.remove_object(src, frequency) @@ -451,7 +451,7 @@ if(A.atmosalert(FALSE, src)) post_alert(0) . = TRUE - update_icon() + update_appearance() /obj/machinery/airalarm/proc/reset(wire) @@ -459,7 +459,7 @@ 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 @@ -648,11 +648,11 @@ icon_state = "alarm_b2" if(0) icon_state = "alarm_b1" - return + return ..() if((machine_stat & (NOPOWER|BROKEN)) || shorted) icon_state = "alarmp" - return + return ..() var/area/A = get_area(src) switch(max(danger_level, A.atmosalm)) @@ -662,6 +662,7 @@ icon_state = "alarm2" //yes, alarm2 is yellow alarm if(2) icon_state = "alarm1" + return ..() /obj/machinery/airalarm/process() if((machine_stat & (NOPOWER|BROKEN)) || shorted) @@ -732,7 +733,7 @@ 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) @@ -742,13 +743,13 @@ 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(W.GetID())// trying to unlock the interface with an ID card togglelock(user) @@ -767,7 +768,7 @@ 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)) @@ -788,14 +789,14 @@ 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 @@ -806,7 +807,7 @@ 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) @@ -829,7 +830,7 @@ 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 6a8e51dfeae..eec02c2a3ba 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -158,7 +158,7 @@ if(can_be_node(target, i)) nodes[i] = target break - update_icon() + update_appearance() /** * setter for pipe layers @@ -169,7 +169,7 @@ */ /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/update_icon() layer = initial(layer) + piping_layer / 1000 @@ -280,7 +280,7 @@ var/obj/machinery/atmospherics/pipe/P = reference P.destroy_network() nodes[nodes.Find(reference)] = 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 de255487e62..8659701fc11 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm @@ -67,18 +67,21 @@ /obj/machinery/atmospherics/components/binary/circulator/process_atmos() ..() - update_icon() + update_appearance() -/obj/machinery/atmospherics/components/binary/circulator/update_icon() +/obj/machinery/atmospherics/components/binary/circulator/update_icon_state() if(!is_operational) icon_state = "circ-p-[flipped]" - else if(last_pressure_delta > 0) + return ..() + if(last_pressure_delta > 0) if(last_pressure_delta > ONE_ATMOSPHERE) icon_state = "circ-run-[flipped]" else icon_state = "circ-slow-[flipped]" - else - icon_state = "circ-off-[flipped]" + return ..() + + icon_state = "circ-off-[flipped]" + return ..() /obj/machinery/atmospherics/components/binary/circulator/wrench_act(mob/living/user, obj/item/I) if(!panel_open) @@ -162,7 +165,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) @@ -184,4 +187,4 @@ flipped = !flipped to_chat(usr, "You flip [src].") - update_icon() + 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 d7225502e54..11ccf801ce1 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 @@ -170,8 +170,8 @@ addtimer(CALLBACK(src, .proc/broadcast_status), 2) - if(!("status" in signal.data)) //do not update_icon - update_icon() + if(!("status" in signal.data)) //do not update_appearance + update_appearance() /obj/machinery/atmospherics/components/binary/dp_vent_pump/high_volume name = "large dual-port air vent" 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 15b88d354ef..6cb87cf3211 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm @@ -31,7 +31,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) @@ -39,7 +39,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() @@ -117,7 +117,7 @@ Passive gate is similar to the regular pump except: 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/passive_gate/atmosinit() ..() @@ -147,7 +147,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 c1178a9e266..5f6cd434f16 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm @@ -24,7 +24,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) @@ -32,7 +32,7 @@ target_pressure = MAX_OUTPUT_PRESSURE investigate_log("was set to [target_pressure] kPa by [key_name(user)]", INVESTIGATE_ATMOS) to_chat(user, "You set the target pressure on [src] to [target_pressure] kPa.") - update_icon() + update_appearance() return ..() /obj/machinery/atmospherics/components/binary/pressure_valve/Destroy() @@ -117,7 +117,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/atmosinit() . = ..() @@ -147,7 +147,7 @@ return broadcast_status() - 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 12fcc827fa9..ec19f28777e 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() @@ -115,7 +115,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() ..() @@ -145,7 +145,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/temperature_gate.dm b/code/modules/atmospherics/machinery/components/binary_devices/temperature_gate.dm index e8592715f83..756e8d3377b 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 ..() @@ -110,7 +110,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 3c604ccbe49..97b3ca23360 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() @@ -92,4 +92,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 0e05d8ef81b..1222d14f172 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() @@ -147,7 +147,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")) @@ -170,10 +170,10 @@ if("status" in signal.data) broadcast_status() - return //do not update_icon + return //do not update_appearance 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 2d89c177914..764ab103587 100644 --- a/code/modules/atmospherics/machinery/components/components_base.dm +++ b/code/modules/atmospherics/machinery/components/components_base.dm @@ -35,7 +35,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() diff --git a/code/modules/atmospherics/machinery/components/fusion/hypertorus.dm b/code/modules/atmospherics/machinery/components/fusion/hypertorus.dm index b9dd26be81b..a2ffd6a3176 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hypertorus.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hypertorus.dm @@ -108,14 +108,15 @@ node.addMember(src) SSair.add_to_rebuild_queue(src) -/obj/machinery/atmospherics/components/unary/hypertorus/update_icon() - . = ..() +/obj/machinery/atmospherics/components/unary/hypertorus/update_icon_state() if(panel_open) icon_state = icon_state_open - else if(active) + return ..() + if(active) icon_state = icon_state_active - else - icon_state = icon_state_off + return ..() + icon_state = icon_state_off + return ..() /obj/machinery/atmospherics/components/unary/hypertorus/fuel_input name = "HFR fuel input port" @@ -411,22 +412,22 @@ return to_chat(user, "You link all parts toghether.") active = TRUE - update_icon() + update_appearance() linked_interface.active = TRUE - linked_interface.update_icon() + linked_interface.update_appearance() RegisterSignal(linked_interface, COMSIG_PARENT_QDELETING, .proc/unregister_signals) linked_input.active = TRUE - linked_input.update_icon() + linked_input.update_appearance() RegisterSignal(linked_input, COMSIG_PARENT_QDELETING, .proc/unregister_signals) linked_output.active = TRUE - linked_output.update_icon() + linked_output.update_appearance() RegisterSignal(linked_output, COMSIG_PARENT_QDELETING, .proc/unregister_signals) linked_moderator.active = TRUE - linked_moderator.update_icon() + linked_moderator.update_appearance() RegisterSignal(linked_moderator, COMSIG_PARENT_QDELETING, .proc/unregister_signals) for(var/obj/machinery/hypertorus/corner/corner in corners) corner.active = TRUE - corner.update_icon() + corner.update_appearance() RegisterSignal(corner, COMSIG_PARENT_QDELETING, .proc/unregister_signals) soundloop = new(list(src), TRUE) soundloop.volume = 5 @@ -445,27 +446,27 @@ if(!active) return active = FALSE - update_icon() + update_appearance() if(linked_interface) linked_interface.active = FALSE - linked_interface.update_icon() + linked_interface.update_appearance() linked_interface = null if(linked_input) linked_input.active = FALSE - linked_input.update_icon() + linked_input.update_appearance() linked_input = null if(linked_output) linked_output.active = FALSE - linked_output.update_icon() + linked_output.update_appearance() linked_output = null if(linked_moderator) linked_moderator.active = FALSE - linked_moderator.update_icon() + linked_moderator.update_appearance() linked_moderator = null if(corners.len) for(var/obj/machinery/hypertorus/corner/corner in corners) corner.active = FALSE - corner.update_icon() + corner.update_appearance() corners = list() QDEL_NULL(soundloop) @@ -1154,13 +1155,15 @@ return return ..() -/obj/machinery/hypertorus/update_icon() +/obj/machinery/hypertorus/update_icon_state() if(panel_open) icon_state = icon_state_open - else if(active) + return ..() + if(active) icon_state = icon_state_active - else - icon_state = icon_state_off + return ..() + icon_state = icon_state_off + return ..() /obj/machinery/hypertorus/interface name = "HFR interface" diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm index 056407756db..0b35b229a22 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,14 @@ 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 @@ -168,7 +160,7 @@ filter_name = GLOB.meta_gas_info[gas][META_GAS_NAME] 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 e015ada5614..685bf6d153f 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 ..() + . += 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 @@ -170,7 +162,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 df1e107409a..6de3419f98e 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -122,7 +122,7 @@ /obj/machinery/atmospherics/components/unary/cryo_cell/set_occupant(atom/movable/new_occupant) . = ..() - update_icon() + update_appearance() /obj/machinery/atmospherics/components/unary/cryo_cell/on_construction() ..(dir, dir) @@ -183,10 +183,13 @@ beaker.forceMove(drop_location()) beaker = null +/obj/machinery/atmospherics/components/unary/cryo_cell/update_icon_state() + icon_state = (state_open) ? "pod-open" : ((on && is_operational) ? "pod-on" : "pod-off") + return ..() + /obj/machinery/atmospherics/components/unary/cryo_cell/update_icon() . = ..() plane = initial(plane) - icon_state = (state_open) ? "pod-open" : (on && is_operational) ? "pod-on" : "pod-off" GLOBAL_VAR_INIT(cryo_overlay_cover_on, mutable_appearance('icons/obj/cryogenics.dmi', "cover-on", layer = ABOVE_WINDOW_LAYER + 0.02)) GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics.dmi', "cover-off", layer = ABOVE_WINDOW_LAYER + 0.02)) @@ -197,10 +200,7 @@ GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics . += "pod-panel" if(state_open) return - if(on && is_operational) - . += GLOB.cryo_overlay_cover_on - else - . += GLOB.cryo_overlay_cover_off + . += (on && is_operational) ? GLOB.cryo_overlay_cover_on : GLOB.cryo_overlay_cover_off /obj/machinery/atmospherics/components/unary/cryo_cell/nap_violation(mob/violator) open_machine() @@ -212,7 +212,7 @@ GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics SEND_SIGNAL(src, COMSIG_CRYO_SET_ON, new_value) . = on on = new_value - update_icon() + update_appearance() /obj/machinery/atmospherics/components/unary/cryo_cell/on_set_is_operational(old_value) if(old_value) //Turned off @@ -315,7 +315,7 @@ GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics if(air1.temperature > 2000) take_damage(clamp((air1.temperature)/200, 10, 20), BURN) - + update_parents() /obj/machinery/atmospherics/components/unary/cryo_cell/relaymove(mob/living/user, direction) @@ -392,7 +392,7 @@ GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics || 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 " \ 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 403173acbdf..dbec0cf3cbc 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 e288b4f64e8..50ac5e7c9ad 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm @@ -27,7 +27,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) @@ -35,7 +35,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() @@ -139,7 +139,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) @@ -176,7 +176,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/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm index b95ecd02ea4..c8bfe4f4160 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm @@ -31,7 +31,7 @@ . = ..() initialize_directions = dir RefreshParts() - update_icon() + update_appearance() /obj/machinery/atmospherics/components/unary/thermomachine/proc/swap_function() cooling = !cooling @@ -45,7 +45,7 @@ icon_state_open = "heater-o" target_temperature = T20C RefreshParts() - update_icon() + update_appearance() /obj/machinery/atmospherics/components/unary/thermomachine/on_construction(obj_color, set_layer) var/obj/item/circuitboard/machine/thermomachine/board = circuit @@ -72,17 +72,19 @@ calculated_laser_rating += laser.rating max_temperature = T20C + (base_heating * calculated_laser_rating) //573.15K with T1 stock parts -/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() @@ -221,14 +223,14 @@ 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() /obj/machinery/atmospherics/components/unary/thermomachine/CtrlClick(mob/living/user) if(!can_interact(user)) return on = !on investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) - update_icon() + update_appearance() /obj/machinery/atmospherics/components/unary/thermomachine/freezer icon_state = "freezer" 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 1d18dc83492..e859ccda14b 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm @@ -13,7 +13,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 c9d1fb537c7..99c01dbdc14 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm @@ -246,11 +246,11 @@ if("status" in signal.data) broadcast_status() - return // do not update_icon + return // do not update_appearance // 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 17e94c7fb40..8026ffa30ab 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm @@ -255,10 +255,10 @@ if("status" in signal.data) broadcast_status() - return //do not update_icon + return //do not update_appearance broadcast_status() - update_icon() + update_appearance() return /obj/machinery/atmospherics/components/unary/vent_scrubber/power_change() @@ -277,7 +277,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) @@ -303,7 +303,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 51dd4b02685..7fd522f5cca 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 a5b736806f0..ac7c85cb2fe 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/layer2 piping_layer = 2 diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm index f02e1a4b75a..d452f11c11e 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/layer2 piping_layer = 2 diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm index 18b4b1923f3..315fec68f40 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/heat_exchanging/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/layer2 piping_layer = 2 diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm index 69461373fa8..60379cb3a57 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/layer2 piping_layer = 2 diff --git a/code/modules/atmospherics/machinery/pipes/layermanifold.dm b/code/modules/atmospherics/machinery/pipes/layermanifold.dm index 977164282c0..cfc598c457f 100644 --- a/code/modules/atmospherics/machinery/pipes/layermanifold.dm +++ b/code/modules/atmospherics/machinery/pipes/layermanifold.dm @@ -38,35 +38,33 @@ /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() - cut_overlays() +/obj/machinery/atmospherics/pipe/layer_manifold/update_layer() layer = initial(layer) + (PIPING_LAYER_MAX * PIPING_LAYER_LCHANGE) //This is above everything else. - for(var/node in front_nodes) - add_attached_images(node) - for(var/node in back_nodes) - add_attached_images(node) +/obj/machinery/atmospherics/pipe/layer_manifold/update_overlays() + . = ..() -/obj/machinery/atmospherics/pipe/layer_manifold/proc/add_attached_images(obj/machinery/atmospherics/A) + for(var/node in front_nodes) + . += get_attached_images(node) + for(var/node in back_nodes) + . += get_attached_images(node) + +/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) - -/obj/machinery/atmospherics/pipe/layer_manifold/proc/add_attached_image(p_dir, p_layer, p_color = null) - var/image/I + . += 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/get_attached_image(p_dir, p_layer, p_color = null) // Uses pipe-3 because we don't want the vertical shifting - if(p_color) - I = getpipeimage(icon, "pipe-3", p_dir, p_color, piping_layer = p_layer) - else - I = getpipeimage(icon, "pipe-3", 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) @@ -93,7 +91,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() @@ -120,7 +118,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 024395e5d6d..1ee21d90c1b 100644 --- a/code/modules/atmospherics/machinery/pipes/manifold.dm +++ b/code/modules/atmospherics/machinery/pipes/manifold.dm @@ -30,16 +30,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 9118cef2267..f44ae7962a8 100644 --- a/code/modules/atmospherics/machinery/pipes/manifold4w.dm +++ b/code/modules/atmospherics/machinery/pipes/manifold4w.dm @@ -24,16 +24,14 @@ /obj/machinery/atmospherics/pipe/manifold4w/SetInitDirections() initialize_directions = initial(initialize_directions) -/obj/machinery/atmospherics/pipe/manifold4w/update_icon() - cut_overlays() +/obj/machinery/atmospherics/pipe/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])) ) - - update_layer() + . += getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) diff --git a/code/modules/atmospherics/machinery/pipes/multiz.dm b/code/modules/atmospherics/machinery/pipes/multiz.dm index d52e4a923a8..60246239c07 100644 --- a/code/modules/atmospherics/machinery/pipes/multiz.dm +++ b/code/modules/atmospherics/machinery/pipes/multiz.dm @@ -32,13 +32,17 @@ /obj/machinery/atmospherics/pipe/multiz/SetInitDirections() initialize_directions = dir -/obj/machinery/atmospherics/pipe/multiz/update_icon() - cut_overlays() +/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() + . = ..() pipe.color = front_node ? front_node.pipe_color : rgb(255, 255, 255) pipe.icon_state = "pipe-[piping_layer]" + . += pipe center.pixel_x = PIPING_LAYER_P_X * (piping_layer - PIPING_LAYER_DEFAULT) - add_overlay(pipe) - add_overlay(center) + . += center + ///Attempts to locate a multiz pipe that's above us, if it finds one it merges us into its pipenet /obj/machinery/atmospherics/pipe/multiz/pipeline_expansion() diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm index 85ce96f882b..6ff05d40a54 100644 --- a/code/modules/atmospherics/machinery/pipes/pipes.dm +++ b/code/modules/atmospherics/machinery/pipes/pipes.dm @@ -83,6 +83,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 79e31359c01..87104e6d1aa 100644 --- a/code/modules/atmospherics/machinery/pipes/simple.dm +++ b/code/modules/atmospherics/machinery/pipes/simple.dm @@ -27,6 +27,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 67473db5796..e2d3d9a1a55 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -275,7 +275,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" @@ -330,7 +330,7 @@ air_contents.copy_from(existing_mixture) else create_gas() - update_icon() + update_appearance() /obj/machinery/portable_atmospherics/canister/proc/create_gas() @@ -350,6 +350,7 @@ /obj/machinery/portable_atmospherics/canister/update_icon_state() if(machine_stat & BROKEN) icon_state = "[base_icon_state]-1" + return ..() /obj/machinery/portable_atmospherics/canister/update_overlays() . = ..() @@ -362,15 +363,16 @@ . += "can-open" if(connected_port) . += "can-connector" - var/pressure = air_contents.return_pressure() - if(pressure >= 40 * ONE_ATMOSPHERE) - . += "can-3" - else if(pressure >= 10 * ONE_ATMOSPHERE) - . += "can-2" - else if(pressure >= 5 * ONE_ATMOSPHERE) - . += "can-1" - else if(pressure >= 10) - . += "can-0" + + switch(air_contents.return_pressure()) + if((40 * ONE_ATMOSPHERE) to INFINITY) + . += "can-3" + if((10 * ONE_ATMOSPHERE) to (40 * ONE_ATMOSPHERE)) + . += "can-2" + if((5 * ONE_ATMOSPHERE) to (10 * ONE_ATMOSPHERE)) + . += "can-1" + if((10) to (5 * ONE_ATMOSPHERE)) + . += "can-0" /obj/machinery/portable_atmospherics/canister/should_atmos_process(datum/gas_mixture/air, exposed_temperature) @@ -444,7 +446,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) @@ -471,7 +473,7 @@ ///function used to check the limit of the canisters and also set the amount of damage that the canister can receive, if the heat and pressure are way higher than the limit the more damage will be done if(our_temperature > heat_limit || our_pressure > pressure_limit) take_damage(clamp((our_temperature/heat_limit) * (our_pressure/pressure_limit) * delta_time * 2, 5, 50), BURN, 0) - update_icon() + update_appearance() /obj/machinery/portable_atmospherics/canister/ui_state(mob/user) return GLOB.physical_state @@ -619,4 +621,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 cc6a28e7a4f..f17f2813b53 100644 --- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm +++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm @@ -70,7 +70,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() @@ -86,7 +86,7 @@ connected_port = null pixel_x = 0 pixel_y = 0 - update_icon() + update_appearance() return TRUE /obj/machinery/portable_atmospherics/AltClick(mob/living/user) @@ -111,7 +111,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) @@ -123,7 +123,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) @@ -134,7 +134,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 @@ -149,7 +149,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 40bdb4230a3..66f8cd5db62 100644 --- a/code/modules/atmospherics/machinery/portable/pump.dm +++ b/code/modules/atmospherics/machinery/portable/pump.dm @@ -29,6 +29,7 @@ /obj/machinery/portable_atmospherics/pump/update_icon_state() icon_state = "psiphon:[on]" + return ..() /obj/machinery/portable_atmospherics/pump/update_overlays() . = ..() @@ -74,7 +75,7 @@ if(prob(100 / severity)) direction = PUMP_OUT target_pressure = rand(0, 100 * ONE_ATMOSPHERE) - update_icon() + update_appearance() /obj/machinery/portable_atmospherics/pump/replace_tank(mob/living/user, close_valve) . = ..() @@ -82,7 +83,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) @@ -156,4 +157,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 dcd44b7e09c..c0bb7c3a2f3 100644 --- a/code/modules/atmospherics/machinery/portable/scrubber.dm +++ b/code/modules/atmospherics/machinery/portable/scrubber.dm @@ -38,6 +38,7 @@ /obj/machinery/portable_atmospherics/scrubber/update_icon_state() icon_state = "pscrubber:[on]" + return ..() /obj/machinery/portable_atmospherics/scrubber/update_overlays() . = ..() @@ -97,7 +98,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) @@ -131,7 +132,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) @@ -150,7 +151,7 @@ if("toggle_filter") scrubbing ^= gas_id2path(params["val"]) . = TRUE - update_icon() + update_appearance() /obj/machinery/portable_atmospherics/scrubber/huge name = "huge air scrubber" @@ -174,11 +175,12 @@ /obj/machinery/portable_atmospherics/scrubber/huge/update_icon_state() icon_state = "scrubber:[on]" + return ..() /obj/machinery/portable_atmospherics/scrubber/huge/process_atmos(delta_time) 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/awaymissions/gateway.dm b/code/modules/awaymissions/gateway.dm index b1a10024201..9cdbfcadfbb 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() @@ -201,6 +201,7 @@ GLOBAL_LIST_EMPTY(gateway_destinations) if(target) deactivate() return + /obj/machinery/gateway/safe_throw_at(atom/target, range, speed, mob/thrower, spin = TRUE, diagonals_first = FALSE, datum/callback/callback, force = MOVE_FORCE_STRONG, gentle = FALSE) return @@ -216,7 +217,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 4df8fbf32f8..05d07922015 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 921d1e057bb..8ee15ad72e2 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 28af8acce05..1ac5451bd38 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/centcom_podlauncher.dm b/code/modules/cargo/centcom_podlauncher.dm index 4385e1053c2..d6948b20618 100644 --- a/code/modules/cargo/centcom_podlauncher.dm +++ b/code/modules/cargo/centcom_podlauncher.dm @@ -709,7 +709,7 @@ if (isnull(target_turf)) 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.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/supplypod_temp_holding] 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 539175c58c1..ed4093e39d8 100644 --- a/code/modules/cargo/expressconsole.dm +++ b/code/modules/cargo/expressconsole.dm @@ -210,7 +210,7 @@ else new /obj/effect/pod_landingzone(LZ, podType, SO) . = TRUE - update_icon() + update_appearance() else if(SO.pack.get_cost() * (0.72*MAX_EMAG_ROCKETS) <= points_to_check) // bulk discount :^) landingzone = GLOB.areas_by_type[pick(GLOB.the_station_areas)] //override default landing zone @@ -232,5 +232,5 @@ else new /obj/effect/pod_landingzone(LZ, podType, SO) . = TRUE - update_icon() + update_appearance() CHECK_TICK diff --git a/code/modules/cargo/gondolapod.dm b/code/modules/cargo/gondolapod.dm index 8ede2a26dc2..3e0cf7f74ff 100644 --- a/code/modules/cargo/gondolapod.dm +++ b/code/modules/cargo/gondolapod.dm @@ -65,12 +65,12 @@ /mob/living/simple_animal/pet/gondola/gondolapod/setOpened() opened = TRUE - update_icon() + update_appearance() addtimer(CALLBACK(src, /atom/.proc/setClosed), 50) /mob/living/simple_animal/pet/gondola/gondolapod/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/order.dm b/code/modules/cargo/order.dm index cd051881a2b..fc63973efd4 100644 --- a/code/modules/cargo/order.dm +++ b/code/modules/cargo/order.dm @@ -58,7 +58,7 @@ P.info += "Rank: [orderer_rank]
    " P.info += "Comment: [reason]
    " - P.update_icon() + P.update_appearance() return P /datum/supply_order/proc/generateManifest(obj/container, owner, packname) //generates-the-manifests. @@ -96,13 +96,13 @@ while(--lost >= 0) qdel(pick(container.contents)) - P.update_icon() + P.update_appearance() P.forceMove(container) if(istype(container, /obj/structure/closet/crate)) var/obj/structure/closet/crate/C = container C.manifest = P - C.update_icon() + C.update_appearance() else container.contents += P diff --git a/code/modules/cargo/packs.dm b/code/modules/cargo/packs.dm index 9591e40f385..a061caadb38 100644 --- a/code/modules/cargo/packs.dm +++ b/code/modules/cargo/packs.dm @@ -1840,7 +1840,7 @@ var/obj/item/pizzabox/infinite/fourfiveeight = new(C) fourfiveeight.boxtag = P.boxtag fourfiveeight.boxtag_set = TRUE - fourfiveeight.update_icon() + fourfiveeight.update_appearance() qdel(P) anomalous_box_provided = TRUE log_game("An anomalous pizza box was provided in a pizza crate at during cargo delivery") @@ -1875,7 +1875,7 @@ P.pizza = new replacement_type P.boxtag = P.pizza.boxtag P.boxtag_set = TRUE - P.update_icon() + P.update_appearance() /datum/supply_pack/organic/pizza/proc/anomalous_pizza_report() print_command_report("[station_name()], our anomalous materials divison has reported a missing object that is highly likely to have been sent to your station during a routine cargo \ diff --git a/code/modules/cargo/supplypod.dm b/code/modules/cargo/supplypod.dm index 619b6795e20..160a0fe01a4 100644 --- a/code/modules/cargo/supplypod.dm +++ b/code/modules/cargo/supplypod.dm @@ -107,7 +107,7 @@ door = "[base]_door" else door = FALSE - update_icon() + update_appearance() /obj/structure/closet/supplypod/proc/SetReverseIcon() fin_mask = "bottomfin" @@ -115,7 +115,7 @@ icon_state = GLOB.podstyles[style][POD_BASE] + "_reverse" pixel_x = initial(pixel_x) transform = matrix() - update_icon() + update_appearance() /obj/structure/closet/supplypod/proc/backToNonReverseIcon() fin_mask = initial(fin_mask) @@ -123,33 +123,35 @@ icon_state = GLOB.podstyles[style][POD_BASE] pixel_x = initial(pixel_x) transform = matrix() - update_icon() + update_appearance() /obj/structure/closet/supplypod/closet_update_overlays(list/new_overlays) return /obj/structure/closet/supplypod/update_overlays() . = ..() - if (style == STYLE_INVISIBLE) + if(style == STYLE_INVISIBLE) return - if (rubble) + + if(rubble) . += rubble.getForeground(src) - if (style == STYLE_SEETHROUGH) - for (var/atom/A in contents) + + if(style == STYLE_SEETHROUGH) + for(var/atom/A in contents) var/mutable_appearance/itemIcon = new(A) itemIcon.transform = matrix().Translate(-1 * SUPPLYPOD_X_OFFSET, 0) . += itemIcon - for (var/t in turfs_in_cargo)//T is just a turf's type + for(var/t in turfs_in_cargo)//T is just a turf's type var/turf/turf_type = t var/mutable_appearance/itemIcon = mutable_appearance(initial(turf_type.icon), initial(turf_type.icon_state)) itemIcon.transform = matrix().Translate(-1 * SUPPLYPOD_X_OFFSET, 0) . += itemIcon return - if (opened) //We're opened means all we have to worry about is masking a decal if we have one - if (!decal) //We don't have a decal to mask + if(opened) //We're opened means all we have to worry about is masking a decal if we have one + if(!decal) //We don't have a decal to mask return - if (!door) //We have a decal but no door, so let's just add the decal + if(!door) //We have a decal but no door, so let's just add the decal . += decal return var/icon/masked_decal = new(icon, decal) //The decal we want to apply @@ -159,23 +161,25 @@ door_masker.Blend("#000000", ICON_SUBTRACT) masked_decal.Blend(door_masker, ICON_ADD) . += masked_decal - else //If we're closed - if (!door) //We have no door, lets see if we have a decal. If not, theres nothing we need to do - if (decal) - . += decal - return - else if (GLOB.podstyles[style][POD_SHAPE] != POD_SHAPE_NORML) //If we're not a normal pod shape (aka, if we don't have fins), just add the door without masking - . += door - else - var/icon/masked_door = new(icon, door) //The door we want to apply - var/icon/fin_masker = new(icon, "mask_[fin_mask]") //The fin shape we want to 'cut out' of the door - fin_masker.MapColors(0,0,0,1, 0,0,0,1, 0,0,0,1, 1,1,1,0, 0,0,0,1) - fin_masker.SwapColor("#ffffffff", null) - fin_masker.Blend("#000000", ICON_SUBTRACT) - masked_door.Blend(fin_masker, ICON_ADD) - . += masked_door - if (decal) + return + + //If we're closed + if(!door) //We have no door, lets see if we have a decal. If not, theres nothing we need to do + if(decal) . += decal + return + else if (GLOB.podstyles[style][POD_SHAPE] != POD_SHAPE_NORML) //If we're not a normal pod shape (aka, if we don't have fins), just add the door without masking + . += door + else + var/icon/masked_door = new(icon, door) //The door we want to apply + var/icon/fin_masker = new(icon, "mask_[fin_mask]") //The fin shape we want to 'cut out' of the door + fin_masker.MapColors(0,0,0,1, 0,0,0,1, 0,0,0,1, 1,1,1,0, 0,0,0,1) + fin_masker.SwapColor("#ffffffff", null) + fin_masker.Blend("#000000", ICON_SUBTRACT) + masked_door.Blend(fin_masker, ICON_ADD) + . += masked_door + if(decal) + . += decal /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. @@ -408,17 +412,17 @@ /obj/structure/closet/supplypod/setOpened() //Proc exists here, as well as in any atom that can assume the role of a "holder" of a supplypod. Check the open_pod() proc for more details opened = TRUE density = FALSE - update_icon() + update_appearance() /obj/structure/closet/supplypod/extractionpod/setOpened() opened = TRUE density = TRUE - update_icon() + update_appearance() /obj/structure/closet/supplypod/setClosed() //Ditto opened = FALSE density = TRUE - update_icon() + update_appearance() /obj/structure/closet/supplypod/proc/tryMakeRubble(turf/T) //Ditto if (rubble_type == RUBBLE_NONE) @@ -431,7 +435,7 @@ return rubble = new /obj/effect/supplypod_rubble(T) rubble.setStyle(rubble_type, src) - update_icon() + update_appearance() /obj/structure/closet/supplypod/Moved() deleteRubble() @@ -440,7 +444,7 @@ /obj/structure/closet/supplypod/proc/deleteRubble() rubble?.fadeAway() rubble = null - update_icon() + update_appearance() /obj/structure/closet/supplypod/proc/addGlow() if (GLOB.podstyles[style][POD_SHAPE] != POD_SHAPE_NORML) @@ -587,7 +591,7 @@ /obj/effect/pod_landingzone/proc/beginLaunch(effectCircle) //Begin the animation for the pod falling. The effectCircle param determines whether the pod gets to come in from any descent angle pod.addGlow() - pod.update_icon() + pod.update_appearance() if (pod.style != STYLE_INVISIBLE) pod.add_filter("motionblur",1,list("type"="motion_blur", "x"=0, "y"=3)) pod.forceMove(drop_location()) diff --git a/code/modules/cargo/supplypod_beacon.dm b/code/modules/cargo/supplypod_beacon.dm index 309448bfb31..59ee4c7c47f 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 20f21ada743..8ab208b3b1c 100644 --- a/code/modules/client/preferences_toggles.dm +++ b/code/modules/client/preferences_toggles.dm @@ -321,7 +321,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)) @@ -350,7 +350,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 129eaa6804e..438ccb4a181 100644 --- a/code/modules/clothing/chameleon.dm +++ b/code/modules/clothing/chameleon.dm @@ -282,7 +282,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 dc2c1c4aee3..48383f8008c 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -411,17 +411,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 diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm index cd2e2b3a23c..3c7b35b9321 100644 --- a/code/modules/clothing/glasses/_glasses.dm +++ b/code/modules/clothing/glasses/_glasses.dm @@ -341,11 +341,12 @@ /obj/item/clothing/glasses/blindfold/white/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 bc5dcbeec43..5c07d06268a 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 = inhand_icon_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 9b540825708..a7f6aba1386 100644 --- a/code/modules/clothing/head/hardhat.dm +++ b/code/modules/clothing/head/hardhat.dm @@ -34,10 +34,11 @@ turn_on(user) else turn_off(user) - update_icon() + update_appearance() /obj/item/clothing/head/hardhat/update_icon_state() icon_state = inhand_icon_state = "hardhat[on]_[hat_type]" + return ..() /obj/item/clothing/head/hardhat/proc/turn_on(mob/user) set_light_on(TRUE) @@ -121,7 +122,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) @@ -133,7 +134,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 06519ce228a..4bf70b88493 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -46,7 +46,7 @@ if(A == attached_light) set_attached_light(null) update_helmlight() - update_icon() + update_appearance() QDEL_NULL(alight) qdel(A) return ..() @@ -397,7 +397,7 @@ /obj/item/clothing/head/helmet/monkey_sentience/Initialize() . = ..() light_colors = rand(1,3) - update_icon() + update_appearance() /obj/item/clothing/head/helmet/monkey_sentience/examine(mob/user) . = ..() @@ -410,6 +410,7 @@ /obj/item/clothing/head/helmet/monkey_sentience/update_icon_state() icon_state = "[initial(icon_state)][light_colors][magnification ? "up" : ""]" + return ..() /obj/item/clothing/head/helmet/monkey_sentience/equipped(mob/user, slot) . = ..() @@ -493,6 +494,7 @@ state += "-flight" //etc. icon_state = state + return ..() /obj/item/clothing/head/helmet/ui_action_click(mob/user, action) if(istype(action, alight)) @@ -508,7 +510,7 @@ return to_chat(user, "You click [S] into place on [src].") set_attached_light(S) - update_icon() + update_appearance() update_helmlight() alight = new(src) if(loc == user) @@ -528,7 +530,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(alight) return TRUE @@ -553,7 +555,7 @@ /obj/item/clothing/head/helmet/proc/update_helmlight() if(attached_light) - update_icon() + update_appearance() for(var/X in actions) var/datum/action/A = X diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index 58b995d6716..2aede6b78cd 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -167,11 +167,12 @@ /obj/item/clothing/head/kitty/equipped(mob/living/carbon/human/user, slot) if(ishuman(user) && slot == ITEM_SLOT_HEAD) - update_icon(user) - user.update_inv_head() //Color might have been changed by update_icon. + update_icon(ALL, user) + user.update_inv_head() //Color might have been changed by update_appearance. ..() -/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) @@ -228,14 +229,13 @@ /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] - if(!S) - return - else + if(S) icon_state = S.icon_state + return ..() /obj/item/clothing/head/wig/worn_overlays(isinhands = FALSE, file2use) @@ -259,7 +259,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) . = ..() @@ -267,7 +267,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 @@ -290,7 +290,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 9b8b8d64dd6..af9248aa9fd 100644 --- a/code/modules/clothing/shoes/bananashoes.dm +++ b/code/modules/clothing/shoes/bananashoes.dm @@ -30,7 +30,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 @@ -52,7 +52,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) @@ -63,7 +63,5 @@ to_chat(user, "You need bananium to turn the prototype shoes on!") /obj/item/clothing/shoes/clown_shoes/banana_shoes/update_icon_state() - if(on) - icon_state = "clown_prototype_on" - else - icon_state = "clown_prototype_off" + icon_state = "clown_prototype_[on ? "on" : "off"]" + return ..() diff --git a/code/modules/clothing/shoes/miscellaneous.dm b/code/modules/clothing/shoes/miscellaneous.dm index 6e034c923fa..f67fe81356f 100644 --- a/code/modules/clothing/shoes/miscellaneous.dm +++ b/code/modules/clothing/shoes/miscellaneous.dm @@ -346,7 +346,7 @@ else worn_icon_state = "[initial(icon_state)]" playsound(src, 'sound/weapons/tap.ogg', 10, TRUE) - update_icon() + update_appearance() /obj/item/clothing/shoes/wheelys/Destroy() QDEL_NULL(wheels) diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index 735b84c8204..f358817be9d 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -350,6 +350,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() . = ..() @@ -379,7 +380,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) toggle_hardsuit_mode(user) user.update_inv_head() @@ -406,7 +407,7 @@ linkedsuit.cold_protection &= ~(CHEST | GROIN | LEGS | FEET | ARMS | HANDS) 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() diff --git a/code/modules/clothing/spacesuits/plasmamen.dm b/code/modules/clothing/spacesuits/plasmamen.dm index 9db34a64bda..c1e5d80489f 100644 --- a/code/modules/clothing/spacesuits/plasmamen.dm +++ b/code/modules/clothing/spacesuits/plasmamen.dm @@ -62,7 +62,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)) @@ -74,10 +74,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() . = ..() @@ -93,7 +93,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!") @@ -112,7 +112,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/detectivework/scanner.dm b/code/modules/detectivework/scanner.dm index a38a5ed31b8..0162867c9e6 100644 --- a/code/modules/detectivework/scanner.dm +++ b/code/modules/detectivework/scanner.dm @@ -52,7 +52,7 @@ P.info = text("
    Forensic Record - (FR-[])


    ", frNum) P.info += jointext(log, "
    ") P.info += "
    Notes:
    " - P.update_icon() + P.update_appearance() if(ismob(loc)) var/mob/M = loc diff --git a/code/modules/events/pirates.dm b/code/modules/events/pirates.dm index 0b7a8fd64af..339f7ca20cc 100644 --- a/code/modules/events/pirates.dm +++ b/code/modules/events/pirates.dm @@ -131,7 +131,7 @@ /obj/machinery/shuttle_scrambler/Initialize(mapload) . = ..() - update_icon() + update_appearance() /obj/machinery/shuttle_scrambler/process() if(active) @@ -162,7 +162,7 @@ if(active || !user.canUseTopic(src, BE_CLOSE)) return toggle_on(user) - update_icon() + update_appearance() send_notification() else dump_loot(user) @@ -192,10 +192,8 @@ STOP_PROCESSING(SSobj,src) /obj/machinery/shuttle_scrambler/update_icon_state() - if(active) - icon_state = "dominator-blue" - else - icon_state = "dominator" + icon_state = active ? "dominator-blue" : "dominator" + return ..() /obj/machinery/shuttle_scrambler/Destroy() toggle_off() diff --git a/code/modules/events/prison_break.dm b/code/modules/events/prison_break.dm index f658dcd5c77..fd16a0ba3f3 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/shuttle_loan.dm b/code/modules/events/shuttle_loan.dm index 8dfc896aef9..7fff101c953 100644 --- a/code/modules/events/shuttle_loan.dm +++ b/code/modules/events/shuttle_loan.dm @@ -263,7 +263,7 @@ set_anchored(TRUE) timer_set = rand(480, 600) //once the supply shuttle docks (after 5 minutes travel time), players have between 3-5 minutes to defuse the bomb activate() - update_icon() + update_appearance() /obj/item/paper/fluff/cargo/bomb name = "hastly scribbled note" diff --git a/code/modules/events/stray_cargo.dm b/code/modules/events/stray_cargo.dm index 3f5a75d1708..c74fd4174e5 100644 --- a/code/modules/events/stray_cargo.dm +++ b/code/modules/events/stray_cargo.dm @@ -53,7 +53,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/pod_landingzone(LZ, pod, crate) diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index c9b843265e8..40e11bb5e8b 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -135,7 +135,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 @@ -143,6 +143,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) @@ -248,7 +249,7 @@ GLOBAL_LIST_INIT(hallucination_list, list( name = "alien hunter ([rand(1, 1000)])" /obj/effect/hallucination/simple/xeno/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum) - update_icon("alienh_pounce") + update_icon(ALL, "alienh_pounce") if(hit_atom == target && target.stat!=DEAD) target.Paralyze(100) target.visible_message("[target] flails around wildly.","[name] pounces on you!") diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index 3514a6f1156..f6850f425df 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -246,8 +246,8 @@ spillable = TRUE /obj/item/reagent_containers/food/drinks/mug/update_icon_state() - . = ..() icon_state = reagents.total_volume ? "tea" : "tea_empty" + return ..() /obj/item/reagent_containers/food/drinks/mug/tea name = "Duke Purple tea" @@ -297,7 +297,7 @@ cap_overlay = mutable_appearance(icon, cap_icon_state) if(cap_on) spillable = FALSE - update_icon() + update_appearance() /obj/item/reagent_containers/food/drinks/waterbottle/update_overlays() . = ..() @@ -333,7 +333,7 @@ cap_on = TRUE spillable = FALSE to_chat(user, "You put the cap on [src].") - update_icon() + update_appearance() /obj/item/reagent_containers/food/drinks/waterbottle/is_refillable() if(cap_on) @@ -415,7 +415,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" @@ -449,8 +449,8 @@ isGlass = FALSE /obj/item/reagent_containers/food/drinks/sillycup/update_icon_state() - . = ..() icon_state = reagents.total_volume ? "water_cup" : "water_cup_e" + return ..() /obj/item/reagent_containers/food/drinks/sillycup/smallcarton name = "small carton" @@ -458,44 +458,74 @@ icon_state = "juicebox" volume = 15 //I figure if you have to craft these it should at least be slightly better than something you can get for free from a watercooler +/// Reagent container icon updates, especially this one, are complete jank. I will need to rework them after this is merged. /obj/item/reagent_containers/food/drinks/sillycup/smallcarton/on_reagent_change(datum/reagents/holder, ...) . = ..() if(!length(reagents.reagent_list)) - name = "small carton" - desc = "A small carton, intended for holding drinks." - foodtype = NONE + foodtype = NONE /// Why are food types on the _container_? TODO: move these to the reagents return - switch(reagents.get_master_reagent_id()) // - [] TODO: Unshitcode this. Right now I'm just passing through and this really needs it's own dedicated PR. + switch(reagents.get_master_reagent_id()) if(/datum/reagent/consumable/orangejuice) - name = "orange juice box" // I know this shouldn't be here, but I really don't have the time to fix this right now. Blame the last guy - desc = "A great source of vitamins. Stay healthy!" // Ditto - foodtype = FRUIT | BREAKFAST // Ditto + foodtype = FRUIT | BREAKFAST if(/datum/reagent/consumable/milk) - name = "carton of milk" - desc = "An excellent source of calcium for growing space explorers." foodtype = DAIRY | BREAKFAST if(/datum/reagent/consumable/applejuice) - name = "apple juice box" - desc = "Sweet apple juice. Don't be late for school!" foodtype = FRUIT if(/datum/reagent/consumable/grapejuice) - name = "grape juice box" - desc = "Tasty grape juice in a fun little container. Non-alcoholic!" foodtype = FRUIT if(/datum/reagent/consumable/pineapplejuice) - name = "pineapple juice box" - desc = "Why would you even want this?" foodtype = FRUIT | PINEAPPLE if(/datum/reagent/consumable/milk/chocolate_milk) - name = "carton of chocolate milk" - desc = "Milk for cool kids!" foodtype = SUGAR if(/datum/reagent/consumable/ethanol/eggnog) - name = "carton of eggnog" - desc = "For enjoying the most wonderful time of the year." foodtype = MEAT +/obj/item/reagent_containers/food/drinks/sillycup/smallcarton/update_name(updates) + . = ..() + if(!length(reagents.reagent_list)) + name = "small carton" + return + + switch(reagents.get_master_reagent_id()) + if(/datum/reagent/consumable/orangejuice) + name = "orange juice box" + if(/datum/reagent/consumable/milk) + name = "carton of milk" + if(/datum/reagent/consumable/applejuice) + name = "apple juice box" + if(/datum/reagent/consumable/grapejuice) + name = "grape juice box" + if(/datum/reagent/consumable/pineapplejuice) + name = "pineapple juice box" + if(/datum/reagent/consumable/milk/chocolate_milk) + name = "carton of chocolate milk" + if(/datum/reagent/consumable/ethanol/eggnog) + name = "carton of eggnog" + +/obj/item/reagent_containers/food/drinks/sillycup/smallcarton/update_desc(updates) + . = ..() + if(!length(reagents.reagent_list)) + desc = "A small carton, intended for holding drinks." + return + + switch(reagents.get_master_reagent_id()) + if(/datum/reagent/consumable/orangejuice) + desc = "A great source of vitamins. Stay healthy!" + if(/datum/reagent/consumable/milk) + desc = "An excellent source of calcium for growing space explorers." + if(/datum/reagent/consumable/applejuice) + desc = "Sweet apple juice. Don't be late for school!" + if(/datum/reagent/consumable/grapejuice) + desc = "Tasty grape juice in a fun little container. Non-alcoholic!" + if(/datum/reagent/consumable/pineapplejuice) + desc = "Why would you even want this?" + if(/datum/reagent/consumable/milk/chocolate_milk) + desc = "Milk for cool kids!" + if(/datum/reagent/consumable/ethanol/eggnog) + desc = "For enjoying the most wonderful time of the year." + + /obj/item/reagent_containers/food/drinks/sillycup/smallcarton/update_icon_state() . = ..() if(!length(reagents.reagent_list)) diff --git a/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm b/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm index cfb441fbb38..5b0a0f7701f 100644 --- a/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm +++ b/code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm @@ -19,26 +19,31 @@ . = ..() if(!length(reagents.reagent_list)) renamedByPlayer = FALSE //so new drinks can rename the glass - return +/obj/item/reagent_containers/food/drinks/drinkingglass/update_name(updates) if(renamedByPlayer) return - + . = ..() var/datum/reagent/largest_reagent = reagents.get_master_reagent() - name = largest_reagent.glass_name || initial(name) - desc = largest_reagent.glass_desc || initial(desc) + name = largest_reagent?.glass_name || initial(name) + +/obj/item/reagent_containers/food/drinks/drinkingglass/update_desc(updates) + if(renamedByPlayer) + return + . = ..() + var/datum/reagent/largest_reagent = reagents.get_master_reagent() + desc = largest_reagent?.glass_desc || initial(desc) /obj/item/reagent_containers/food/drinks/drinkingglass/update_icon_state() - . = ..() if(!length(reagents.reagent_list)) icon_state = "glass_empty" - return + return ..() var/datum/reagent/largest_reagent = reagents.get_master_reagent() - if(largest_reagent.glass_icon_state) + if(largest_reagent?.glass_icon_state) icon_state = largest_reagent.glass_icon_state icon = largest_reagent.glass_icon || 'icons/obj/drinks.dmi' //SKYRAT EDIT ADDITION - CUSTOMIZATION - return NONE + return ..() /obj/item/reagent_containers/food/drinks/drinkingglass/update_overlays() . = ..() @@ -60,6 +65,7 @@ name = "shot glass" desc = "A shot glass - the universal symbol for bad decisions." icon_state = "shotglass" + base_icon_state = "shotglass" gulp_size = 15 amount_per_transfer_from_this = 15 possible_transfer_amounts = list() @@ -67,32 +73,33 @@ custom_materials = list(/datum/material/glass=100) custom_price = PAYCHECK_ASSISTANT * 0.4 -/obj/item/reagent_containers/food/drinks/drinkingglass/shotglass/on_reagent_change(datum/reagents/holder, ...) +/obj/item/reagent_containers/food/drinks/drinkingglass/shotglass/update_name(updates) + if(renamedByPlayer) + return + . = ..() + name = "[length(reagents.reagent_list) ? "filled " : null]shot glass" + +/obj/item/reagent_containers/food/drinks/drinkingglass/shotglass/update_desc(updates) + if(renamedByPlayer) + return . = ..() if(!length(reagents.reagent_list)) - name = "shot glass" desc = "A shot glass - the universal symbol for bad decisions." - return - - name = "filled shot glass" - desc = "The challenge is not taking as many as you can, but guessing what it is before you pass out." + else + desc = "The challenge is not taking as many as you can, but guessing what it is before you pass out." /obj/item/reagent_containers/food/drinks/drinkingglass/shotglass/update_icon_state() . = ..() if(!length(reagents.reagent_list)) - icon_state = "shotglass" - name = "shot glass" - desc = "A shot glass - the universal symbol for bad decisions." + icon_state = base_icon_state return var/datum/reagent/largest_reagent = reagents.get_master_reagent() - name = "filled shot glass" - desc = "The challenge is not taking as many as you can, but guessing what it is before you pass out." - icon_state = largest_reagent.shot_glass_icon_state || "shotglassclear" + icon_state = largest_reagent.shot_glass_icon_state || "[base_icon_state]clear" /obj/item/reagent_containers/food/drinks/drinkingglass/shotglass/update_overlays() . = ..() - if(icon_state != "shotglassclear") + if(icon_state != "[base_icon_state]clear") return var/mutable_appearance/shot_overlay = mutable_appearance(icon, "shotglassoverlay") diff --git a/code/modules/food_and_drinks/food/condiment.dm b/code/modules/food_and_drinks/food/condiment.dm index e7896ba448c..c5317ca1950 100644 --- a/code/modules/food_and_drinks/food/condiment.dm +++ b/code/modules/food_and_drinks/food/condiment.dm @@ -25,14 +25,16 @@ /obj/item/reagent_containers/food/condiment/update_icon_state() . = ..() - if (reagents.reagent_list.len) - if (icon_preempty) + if(reagents.reagent_list.len) + if(icon_preempty) icon_state = icon_preempty icon_preempty = null - else - if (icon_empty && !icon_preempty) - icon_preempty = icon_state - icon_state = icon_empty + return ..() + + if(icon_empty && !icon_preempty) + icon_preempty = icon_state + icon_state = icon_empty + return ..() /obj/item/reagent_containers/food/condiment/suicide_act(mob/living/carbon/user) user.visible_message("[user] is trying to eat the entire [src]! It looks like [user.p_they()] forgot how food works!") @@ -243,6 +245,7 @@ RegisterSignal(reagents, COMSIG_REAGENTS_DEL_REAGENT, .proc/on_reagent_del, TRUE) /obj/item/reagent_containers/food/condiment/pack/update_icon() + 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. diff --git a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm index c033f55ddb4..3ef791baed9 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm @@ -40,16 +40,17 @@ /obj/machinery/gibber/update_overlays() . = ..() - if (dirty) + if(dirty) . +="grbloody" if(machine_stat & (NOPOWER|BROKEN)) return - if (!occupant) + if(!occupant) . += "grjam" - else if (operating) + return + if(operating) . += "gruse" - else - . += "gridle" + return + . += "gridle" /obj/machinery/gibber/attack_paw(mob/user, list/modifiers) return attack_hand(user, modifiers) @@ -99,7 +100,7 @@ user.visible_message("[user] stuffs [C] into the gibber!") C.forceMove(src) set_occupant(C) - update_icon() + update_appearance() else startgibbing(user) @@ -131,7 +132,7 @@ /obj/machinery/gibber/proc/go_out() dump_inventory_contents() - update_icon() + update_appearance() /obj/machinery/gibber/proc/startgibbing(mob/user) if(operating) @@ -144,7 +145,7 @@ audible_message("You hear a loud squelchy grinding sound.") playsound(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 +222,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/griddle.dm b/code/modules/food_and_drinks/kitchen_machinery/griddle.dm index 0b15823bdee..b272bcc5ee6 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/griddle.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/griddle.dm @@ -72,7 +72,7 @@ I.pixel_y = clamp(text2num(LAZYACCESS(modifiers, ICON_Y)) - 16, -(world.icon_size/2), world.icon_size/2) to_chat(user, "You place [I] on [src].") AddToGrill(I, user) - update_icon() + update_appearance() else return ..() @@ -83,7 +83,7 @@ begin_processing() else end_processing() - update_icon() + update_appearance() update_grill_audio() @@ -132,8 +132,8 @@ visible_message("[griddled_item] doesn't seem to be doing too great on the [src]!") /obj/machinery/griddle/update_icon_state() - . = ..() icon_state = "griddle[variant]_[on ? "on" : "off"]" + return ..() /obj/machinery/griddle/stand name = "griddle stand" diff --git a/code/modules/food_and_drinks/kitchen_machinery/grill.dm b/code/modules/food_and_drinks/kitchen_machinery/grill.dm index d96c6d78e16..d2b84ac64ab 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/grill.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/grill.dm @@ -23,10 +23,12 @@ /obj/machinery/grill/update_icon_state() if(grilled_item) icon_state = "grill" - else if(grill_fuel > 0) + return ..() + if(grill_fuel > 0) icon_state = "grill_on" - else - icon_state = "grill_open" + return ..() + 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)) @@ -38,7 +40,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]...") @@ -48,7 +50,7 @@ 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 else if(IS_EDIBLE(I)) if(HAS_TRAIT(I, TRAIT_NODROP) || (I.item_flags & (ABSTRACT | DROPDEL))) @@ -64,7 +66,7 @@ RegisterSignal(grilled_item, COMSIG_GRILL_COMPLETED, .proc/GrillCompleted) ADD_TRAIT(grilled_item, TRAIT_FOOD_GRILLED, "boomers") to_chat(user, "You put the [grilled_item] on [src].") - update_icon() + update_appearance() grill_loop.start() return @@ -72,7 +74,7 @@ /obj/machinery/grill/process(delta_time) ..() - update_icon() + update_appearance() if(grill_fuel <= 0) return else @@ -122,7 +124,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 ..() 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 30f66cd9477..40e9b9a590b 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 e018fd62867..8d1072a3895 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm @@ -90,16 +90,21 @@ /obj/machinery/microwave/update_icon_state() if(broken) icon_state = "mwb" - else if(dirty_anim_playing) + return ..() + if(dirty_anim_playing) icon_state = "mwbloody1" - else if(dirty == 100) + return ..() + if(dirty == 100) icon_state = "mwbloody" - else if(operating) + return ..() + if(operating) icon_state = "mw1" - else if(panel_open) + return ..() + if(panel_open) icon_state = "mw-o" - else - icon_state = "mw" + return ..() + icon_state = "mw" + return ..() /obj/machinery/microwave/attackby(obj/item/O, mob/living/user, params) if(operating) @@ -109,7 +114,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 +132,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 +146,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 @@ -155,7 +160,7 @@ if(do_after(user, 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! @@ -263,7 +268,7 @@ set_light(1.5) soundloop.start() - update_icon() + update_appearance() /obj/machinery/microwave/proc/spark() visible_message("Sparks fly around [src]!") @@ -287,7 +292,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 @@ -358,7 +363,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 7a2950856df..7b6fea47bd8 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm @@ -41,23 +41,30 @@ . += "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) + 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) - 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 - icon_state = "[initial(icon_state)]-off" + @@ -95,7 +102,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)) @@ -119,7 +126,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]!") @@ -222,7 +229,7 @@ dispense(O, usr) break if (visible_contents) - update_icon() + update_appearance() return TRUE for(var/obj/item/O in src) @@ -234,7 +241,7 @@ dispense(O, usr) desired-- if (visible_contents) - update_icon() + update_appearance() return TRUE return FALSE @@ -289,7 +296,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") @@ -309,7 +316,7 @@ /obj/machinery/smartfridge/drying_rack/load(/obj/item/dried_object) //For updating the filled overlay . = ..() - update_icon() + update_appearance() /obj/machinery/smartfridge/drying_rack/update_overlays() . = ..() @@ -327,7 +334,7 @@ rack_dry(item_iterator) SStgui.update_uis(src) - update_icon() + update_appearance() /obj/machinery/smartfridge/drying_rack/accept_check(obj/item/O) if(HAS_TRAIT(O, TRAIT_DRYABLE)) //set on dryable element @@ -341,7 +348,7 @@ else drying = TRUE use_power = ACTIVE_POWER_USE - update_icon() + update_appearance() /obj/machinery/smartfridge/drying_rack/proc/rack_dry(obj/item/target) SEND_SIGNAL(target, COMSIG_ITEM_DRIED) diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm index 6421c3efab5..1c3cf009469 100644 --- a/code/modules/food_and_drinks/pizzabox.dm +++ b/code/modules/food_and_drinks/pizzabox.dm @@ -11,6 +11,7 @@ desc = "A box suited for pizzas." icon = 'icons/obj/food/containers.dmi' icon_state = "pizzabox" + base_icon_state = "pizzabox" inhand_icon_state = "pizzabox" lefthand_file = 'icons/mob/inhands/misc/food_lefthand.dmi' righthand_file = 'icons/mob/inhands/misc/food_righthand.dmi' @@ -38,16 +39,16 @@ . = ..() if(pizza) pizza = new pizza - update_icon() + update_appearance() /obj/item/pizzabox/Destroy() unprocess() return ..() -/obj/item/pizzabox/update_icon() - // Description +/obj/item/pizzabox/update_desc() desc = initial(desc) + . = ..() if(pizza && pizza.boxtag && !boxtag_set) boxtag = pizza.boxtag boxtag_set = TRUE @@ -67,34 +68,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() @@ -120,7 +128,7 @@ user.put_in_active_hand(cardboard) qdel(src) return - update_icon() + update_appearance() //ATTACK HAND IGNORING PARENT RETURN VALUE /obj/item/pizzabox/attack_hand(mob/user, list/modifiers) @@ -131,13 +139,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 @@ -152,14 +160,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) @@ -174,8 +182,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)) @@ -195,7 +203,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) @@ -204,7 +212,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!") @@ -219,7 +227,7 @@ return to_chat(user, "You write with [I] on [src].") boxtag_set = TRUE - update_icon() + update_appearance() return else if(is_wire_tool(I)) if(wires && bomb) @@ -273,9 +281,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() @@ -284,7 +292,7 @@ STOP_PROCESSING(SSobj, src) qdel(wires) wires = null - update_icon() + update_appearance() /obj/item/pizzabox/bomb/Initialize() . = ..() @@ -382,5 +390,5 @@ var/obj/item/food/pizza/favourite_pizza_type = pizza_preferences[nommer.ckey] pizza = new favourite_pizza_type boxtag_set = FALSE - update_icon() //update our boxtag to match our new pizza + update_appearance() //update our boxtag to match our new pizza pizza.foodtypes = nommer.dna.species.liked_food //it's our favorite! diff --git a/code/modules/games/cas.dm b/code/modules/games/cas.dm index 339e64c8771..b616877e8a8 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)) @@ -137,10 +138,8 @@ Flip() /obj/item/toy/cards/singlecard/cas/update_icon_state() - if(flipped) - icon_state = "[card_face]_flipped" - else - icon_state = "[card_face]" + icon_state = "[card_face][flipped ? "_flipped" : null]" + 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 07641f5f152..d6a656fcc36 100644 --- a/code/modules/holodeck/area_copy.dm +++ b/code/modules/holodeck/area_copy.dm @@ -37,7 +37,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 36b19c1545c..68d27886a55 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 @@ -198,10 +198,8 @@ begin_event() /obj/machinery/readybutton/update_icon_state() - if(ready) - icon_state = "auth_on" - else - icon_state = "auth_off" + icon_state = "auth_[ready ? "on" : "off"]" + return ..() /obj/machinery/readybutton/proc/begin_event() diff --git a/code/modules/holodeck/turfs.dm b/code/modules/holodeck/turfs.dm index 24d1cbac153..78c7e7f2f21 100644 --- a/code/modules/holodeck/turfs.dm +++ b/code/modules/holodeck/turfs.dm @@ -144,7 +144,7 @@ /turf/open/floor/holofloor/carpet/Initialize() . = ..() - addtimer(CALLBACK(src, /atom/.proc/update_icon), 1) + addtimer(CALLBACK(src, /atom/.proc/update_appearance), 1) /turf/open/floor/holofloor/carpet/update_icon() . = ..() diff --git a/code/modules/hydroponics/beekeeping/honeycomb.dm b/code/modules/hydroponics/beekeeping/honeycomb.dm index 8018c40fe78..41a08c8998f 100644 --- a/code/modules/hydroponics/beekeeping/honeycomb.dm +++ b/code/modules/hydroponics/beekeeping/honeycomb.dm @@ -17,7 +17,7 @@ . = ..() pixel_x = base_pixel_x + rand(8, -8) pixel_y = base_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 e22091f64b4..b200711bf8e 100644 --- a/code/modules/hydroponics/biogenerator.dm +++ b/code/modules/hydroponics/biogenerator.dm @@ -41,7 +41,7 @@ ..() if(A == beaker) beaker = null - update_icon() + update_appearance() /obj/machinery/biogenerator/RefreshParts() var/E = 0 @@ -64,12 +64,15 @@ /obj/machinery/biogenerator/update_icon_state() if(panel_open) icon_state = "biogen-empty-o" - else if(!src.beaker) + return ..() + if(!beaker) icon_state = "biogen-empty" - else if(!src.processing) + return ..() + if(!processing) icon_state = "biogen-stand" - else - icon_state = "biogen-work" + return ..() + icon_state = "biogen-work" + return ..() /obj/machinery/biogenerator/attackby(obj/item/O, mob/living/user, params) if(user.combat_mode) @@ -84,7 +87,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)) @@ -100,7 +103,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 @@ -180,12 +183,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] != GET_MATERIAL_REF(/datum/material/biomass)) @@ -195,7 +198,7 @@ else if(remove_points) points -= materials[GET_MATERIAL_REF(/datum/material/biomass)]*multiplier/efficiency - update_icon() + update_appearance() return TRUE /obj/machinery/biogenerator/proc/check_container_volume(list/reagents, multiplier = 1) @@ -236,7 +239,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) @@ -246,7 +249,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 b240d744780..d878142e9a1 100644 --- a/code/modules/hydroponics/fermenting_barrel.dm +++ b/code/modules/hydroponics/fermenting_barrel.dm @@ -69,13 +69,11 @@ reagents.flags |= DRAINABLE reagents.flags &= ~(REFILLABLE | TRANSPARENT) 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" + icon_state = open ? "barrel_open" : "barrel" + return ..() /datum/crafting_recipe/fermenting_barrel name = "Wooden Barrel" diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 992ca653f3d..03f8004a312 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -52,6 +52,8 @@ var/datum/weakref/lastuser ///If the tray generates nutrients and water on its own var/self_sustaining = FALSE + ///The icon state for the overlay used to represent that this tray is self-sustaining. + var/self_sustaining_overlay_icon_state = "gaia_blessing" /obj/machinery/hydroponics/Initialize() //ALRIGHT YOU DEGENERATES. YOU HAD REAGENT HOLDERS FOR AT LEAST 4 YEARS AND NONE OF YOU MADE HYDROPONICS TRAYS HOLD NUTRIENT CHEMS INSTEAD OF USING "Points". @@ -133,7 +135,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) * delta_time * 0.5) @@ -285,38 +287,34 @@ weedinvasion() needs_update = 1 if (needs_update) - update_icon() + update_appearance() if(myseed && prob(5 * (11-myseed.production))) SEND_SIGNAL(myseed, COMSIG_PLANT_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?.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) + if(self_sustaining && self_sustaining_overlay_icon_state) + . += mutable_appearance(icon, self_sustaining_overlay_icon_state) - return - -/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 @@ -328,19 +326,20 @@ else var/t_growthstate = clamp(round((age / myseed.maturation) * myseed.growthstages), 1, myseed.growthstages) plant_overlay.icon_state = "[myseed.icon_grow][t_growthstate]" - add_overlay(plant_overlay) + return plant_overlay -/obj/machinery/hydroponics/proc/update_icon_lights() +/obj/machinery/hydroponics/proc/update_status_light_overlays() + . = list() if(waterlevel <= 10) - add_overlay(mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_lowwater3")) + . += mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_lowwater3") 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(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(harvest) - add_overlay(mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_harvest3")) + . += mutable_appearance('icons/obj/hydroponics/equipment.dmi', "over_harvest3") /obj/machinery/hydroponics/examine(user) @@ -402,7 +401,7 @@ harvest = FALSE weedlevel = 0 // Reset pestlevel = 0 // Reset - update_icon() + update_appearance() visible_message("The [oldPlantName] is overtaken by some [myseed.plantname]!") TRAY_NAME_UPDATE @@ -436,7 +435,7 @@ weedlevel = 0 // Reset sleep(5) // Wait a while - update_icon() + update_appearance() visible_message("[oldPlantName] suddenly mutates into [myseed.plantname]!") TRAY_NAME_UPDATE @@ -456,7 +455,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 @@ -472,7 +471,7 @@ pestlevel = 0 // Pests die lastproduce = 0 if(!dead) - update_icon() + update_appearance() dead = TRUE /** @@ -560,11 +559,11 @@ lastuser = WEAKREF(user) if(IS_EDIBLE(reagent_source) || istype(reagent_source, /obj/item/reagent_containers/pill)) qdel(reagent_source) - 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)) @@ -580,7 +579,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!") @@ -590,7 +589,7 @@ if(weedlevel > 0) user.visible_message("[user] uproots the weeds.", "You remove the weeds from [src].") weedlevel = 0 - update_icon() + update_appearance() return else to_chat(user, "This plot is completely devoid of weeds! It doesn't need uprooting.") @@ -649,7 +648,7 @@ myseed.reagents_from_genes() adjustHealth(-15) to_chat(user, "You carefully shear the genes off of the [myseed.plantname], leaving the plant looking weaker.") - update_icon() + update_appearance() return else if(istype(O, /obj/item/graft)) @@ -692,7 +691,7 @@ name = initial(name) desc = initial(desc) weedlevel = 0 //Has a side effect of cleaning up those nasty weeds - update_icon() + update_appearance() return else if(istype(O, /obj/item/storage/part_replacer)) RefreshParts() @@ -722,7 +721,7 @@ myseed.mutatelist = list(fresh_mut_list[locked_mutation]) myseed.set_endurance(myseed.endurance/2) flowergun.cell.use(flowergun.cell.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 @@ -754,7 +753,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) @@ -772,12 +771,12 @@ self_sustaining = !self_sustaining idle_power_usage = self_sustaining ? 5000 : 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)) @@ -810,7 +809,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. /** @@ -879,8 +878,14 @@ use_power = NO_POWER_USE flags_1 = NODECONSTRUCT_1 unwrenchable = FALSE + self_sustaining_overlay_icon_state = null -/obj/machinery/hydroponics/soil/update_icon_lights() +/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_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 1d1a3c3e8d1..1de6bd44d67 100644 --- a/code/modules/hydroponics/plant_genes.dm +++ b/code/modules/hydroponics/plant_genes.dm @@ -405,8 +405,8 @@ found_cell.charge = newcharge if(isobj(found_cell.loc)) var/obj/cell_location = found_cell.loc - cell_location.update_icon() //update power meters and such - found_cell.update_icon() + cell_location.update_appearance() //update power meters and such + found_cell.update_appearance() batteries_recharged = TRUE if(batteries_recharged) to_chat(eater, "Your batteries are recharged!") @@ -752,7 +752,7 @@ target_tray.harvest = FALSE target_tray.weedlevel = 0 // Reset target_tray.pestlevel = 0 // Reset - target_tray.update_icon() + target_tray.update_appearance() target_tray.visible_message("The [origin_tray.myseed.plantname] spreads!") if(target_tray.myseed) target_tray.name = "[initial(target_tray.name)] ([target_tray.myseed.plantname])" diff --git a/code/modules/instruments/items.dm b/code/modules/instruments/items.dm index 31dff351c19..49f73e9157c 100644 --- a/code/modules/instruments/items.dm +++ b/code/modules/instruments/items.dm @@ -97,14 +97,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 4f1bff36f55..05bbb8131e0 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,11 +168,12 @@ /obj/structure/bookcase/update_icon_state() if(state == BOOKCASE_UNANCHORED || state == BOOKCASE_ANCHORED) 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 @@ -185,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 @@ -194,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() /* diff --git a/code/modules/library/random_books.dm b/code/modules/library/random_books.dm index bd2bbafa76b..295bdd59153 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/library/skill_learning/skill_station.dm b/code/modules/library/skill_learning/skill_station.dm index d38f8300050..7c9cf1f9256 100644 --- a/code/modules/library/skill_learning/skill_station.dm +++ b/code/modules/library/skill_learning/skill_station.dm @@ -20,7 +20,7 @@ /obj/machinery/skill_station/Initialize() . = ..() - update_icon() + update_appearance() //Only usable by the person inside /obj/machinery/skill_station/ui_state(mob/user) @@ -38,6 +38,7 @@ icon_state += "_open" if(occupant) icon_state += "_occupied" + return ..() /obj/machinery/skill_station/update_overlays() . = ..() @@ -72,7 +73,7 @@ if(work_timer) deltimer(work_timer) work_timer = null - update_icon() + update_appearance() /obj/machinery/skill_station/interact(mob/user) . = ..() @@ -115,7 +116,7 @@ working = TRUE work_timer = addtimer(CALLBACK(src,.proc/implant),SKILLCHIP_IMPLANT_TIME,TIMER_STOPPABLE) - update_icon() + update_appearance() /// Finish implanting. /obj/machinery/skill_station/proc/implant() @@ -129,7 +130,7 @@ to_chat(carbon_occupant,"Operation complete!") inserted_skillchip = null - update_icon() + update_appearance() /// Start removal. /obj/machinery/skill_station/proc/start_removal(obj/item/skillchip/to_be_removed) @@ -142,13 +143,13 @@ working = TRUE work_timer = addtimer(CALLBACK(src,.proc/remove_skillchip,to_be_removed),SKILLCHIP_REMOVAL_TIME,TIMER_STOPPABLE) - update_icon() + update_appearance() /// Finish removal. /obj/machinery/skill_station/proc/remove_skillchip(obj/item/skillchip/to_be_removed) working = FALSE work_timer = null - update_icon() + update_appearance() var/mob/living/carbon/carbon_occupant = occupant diff --git a/code/modules/library/soapstone.dm b/code/modules/library/soapstone.dm index abf01f695fd..449b74aabd0 100644 --- a/code/modules/library/soapstone.dm +++ b/code/modules/library/soapstone.dm @@ -150,10 +150,10 @@ but only permanently removed with the curator's soapstone. creator_key = user.ckey realdate = world.realtime map = SSmapping.config.map_name - update_icon() + update_appearance() /obj/structure/chisel_message/update_icon() - ..() + . = ..() var/hash = md5(hidden_message) var/newcolor = copytext_char(hash, 1, 7) add_atom_colour("#[newcolor]", FIXED_COLOUR_PRIORITY) @@ -195,7 +195,7 @@ but only permanently removed with the curator's soapstone. var/turf/newloc = locate(x, y, z) if(isturf(newloc)) forceMove(newloc) - update_icon() + update_appearance() /obj/structure/chisel_message/examine(mob/user) . = ..() diff --git a/code/modules/mafia/controller.dm b/code/modules/mafia/controller.dm index 1cc126bc75d..81184563f5f 100644 --- a/code/modules/mafia/controller.dm +++ b/code/modules/mafia/controller.dm @@ -488,10 +488,10 @@ else send_message("[voter.body.real_name] voted for [target.body.real_name]!",team = teams) if(!teams) - target.body.update_icon() //Update the vote display if it's a public vote + target.body.update_appearance() //Update the vote display if it's a public vote var/datum/mafia_role/old = old_vote if(old) - old.body.update_icon() + old.body.update_appearance() /** * Clears out the votes of a certain type (day votes, mafia kill votes) while leaving others untouched @@ -503,7 +503,7 @@ bodies_to_update += R.body votes[vote_type] = list() for(var/mob/M in bodies_to_update) - M.update_icon() + M.update_appearance() /** * Returns how many people voted for the role, in whatever vote (day vote, night kill vote) diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm index d9aea4abaef..e9abcdbe151 100644 --- a/code/modules/mapping/mapping_helpers.dm +++ b/code/modules/mapping/mapping_helpers.dm @@ -252,7 +252,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) @@ -375,7 +375,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) @@ -384,7 +384,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava) paper.info = "[note_info]" found_airlock.note = paper 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 2a358e8dc0f..21c88b63ee4 100644 --- a/code/modules/mining/equipment/explorer_gear.dm +++ b/code/modules/mining/equipment/explorer_gear.dm @@ -92,7 +92,7 @@ /obj/item/clothing/head/helmet/space/hostile_environment/Initialize() . = ..() - 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 aca5e431159..d3f5e768a09 100644 --- a/code/modules/mining/equipment/kinetic_crusher.dm +++ b/code/modules/mining/equipment/kinetic_crusher.dm @@ -112,7 +112,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)) @@ -146,17 +146,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() inhand_icon_state = "crusher[wielded]" // this is not icon_state and not supported by 2hcomponent + return ..() /obj/item/kinetic_crusher/update_overlays() . = ..() diff --git a/code/modules/mining/equipment/marker_beacons.dm b/code/modules/mining/equipment/marker_beacons.dm index d6a4a4bf2c4..a9f3235c29c 100644 --- a/code/modules/mining/equipment/marker_beacons.dm +++ b/code/modules/mining/equipment/marker_beacons.dm @@ -35,7 +35,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sortList(list( /obj/item/stack/marker_beacon/Initialize(mapload, new_amount, merge = TRUE, list/mat_override=null, mat_amt=1) . = ..() - update_icon() + update_appearance() /obj/item/stack/marker_beacon/examine(mob/user) . = ..() @@ -44,6 +44,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)) @@ -66,7 +67,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" @@ -87,25 +88,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 = "[icon_prefix][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 = "[icon_prefix][lowertext(picked_color)]-on" + return ..() + /obj/structure/marker_beacon/attack_hand(mob/living/user, list/modifiers) . = ..() if(.) @@ -114,7 +120,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) @@ -147,7 +153,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sortList(list( return if(input_color) picked_color = input_color - update_icon() + update_appearance() /* Preset marker beacon types, for mapping */ diff --git a/code/modules/mining/equipment/regenerative_core.dm b/code/modules/mining/equipment/regenerative_core.dm index ee0f67e0619..93eb6b6aabf 100644 --- a/code/modules/mining/equipment/regenerative_core.dm +++ b/code/modules/mining/equipment/regenerative_core.dm @@ -43,7 +43,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")) @@ -55,7 +55,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) @@ -118,10 +118,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() . = ..() diff --git a/code/modules/mining/equipment/survival_pod.dm b/code/modules/mining/equipment/survival_pod.dm index 8ea369188c5..365d9d75a31 100644 --- a/code/modules/mining/equipment/survival_pod.dm +++ b/code/modules/mining/equipment/survival_pod.dm @@ -143,6 +143,7 @@ /obj/machinery/sleeper/survival_pod icon = 'icons/obj/lavaland/survival_pod.dmi' icon_state = "sleeper" + base_icon_state = "sleeper" /obj/machinery/sleeper/survival_pod/update_overlays() . = ..() diff --git a/code/modules/mining/lavaland/ash_flora.dm b/code/modules/mining/lavaland/ash_flora.dm index bd5255cc15a..dc6b6847231 100644 --- a/code/modules/mining/lavaland/ash_flora.dm +++ b/code/modules/mining/lavaland/ash_flora.dm @@ -350,11 +350,13 @@ /obj/item/reagent_containers/glass/bowl/mushroom_bowl/update_overlays() . = ..() - if(reagents?.total_volume) - var/mutable_appearance/filling = mutable_appearance('icons/obj/lavaland/ash_flora.dmi', "fullbowl") - filling.color = mix_color_from_reagents(reagents.reagent_list) - . += filling + if(!reagents?.total_volume) + return + var/mutable_appearance/filling = mutable_appearance('icons/obj/lavaland/ash_flora.dmi', "fullbowl") + filling.color = mix_color_from_reagents(reagents.reagent_list) + . += filling /obj/item/reagent_containers/glass/bowl/mushroom_bowl/update_icon_state() if(!reagents || !reagents.total_volume) icon_state = "mushroom_bowl" + return ..() diff --git a/code/modules/mining/lavaland/necropolis_chests.dm b/code/modules/mining/lavaland/necropolis_chests.dm index 983379dfd41..488deb305b4 100644 --- a/code/modules/mining/lavaland/necropolis_chests.dm +++ b/code/modules/mining/lavaland/necropolis_chests.dm @@ -608,10 +608,8 @@ list_reagents = list(/datum/reagent/flightpotion = 5) /obj/item/reagent_containers/glass/bottle/potion/update_icon_state() - if(reagents.total_volume) - icon_state = "potionflask" - else - icon_state = "potionflask_empty" + icon_state = "potionflask[reagents.total_volume ? null : "_empty"]" + return ..() /datum/reagent/flightpotion name = "Flight Potion" @@ -1127,13 +1125,13 @@ var/obj/item/hierophant_club/club = src.target if(istype(club)) club.blink_charged = FALSE - club.update_icon() + club.update_appearance() /datum/action/innate/dash/hierophant/charge() var/obj/item/hierophant_club/club = target if(istype(club)) club.blink_charged = TRUE - club.update_icon() + club.update_appearance() current_charges = clamp(current_charges + 1, 0, max_charges) holder.update_action_buttons_icon() @@ -1212,6 +1210,7 @@ /obj/item/hierophant_club/update_icon_state() icon_state = inhand_icon_state = "hierophant_club[blink_charged ? "_ready":""][(!QDELETED(beacon)) ? "":"_beacon"]" + return ..() /obj/item/hierophant_club/ui_action_click(mob/user, action) if(!user.is_holding(src)) //you need to hold the staff to teleport diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index 50226f53552..05eb945f1fd 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -350,7 +350,5 @@ ..() /obj/machinery/mineral/ore_redemption/update_icon_state() - if(powered()) - icon_state = initial(icon_state) - else - icon_state = "[initial(icon_state)]-off" + icon_state = "[initial(icon_state)][powered() ? null : "-off"]" + return ..() diff --git a/code/modules/mining/machine_vending.dm b/code/modules/mining/machine_vending.dm index 3fcbede322c..c3e4bc3e3e6 100644 --- a/code/modules/mining/machine_vending.dm +++ b/code/modules/mining/machine_vending.dm @@ -84,10 +84,8 @@ GLOB.vending_products[M.equipment_path] = 1 /obj/machinery/mineral/equipment_vendor/update_icon_state() - if(powered()) - icon_state = initial(icon_state) - else - icon_state = "[initial(icon_state)]-off" + icon_state = "[initial(icon_state)][powered() ? null : "-off"]" + return ..() /obj/machinery/mineral/equipment_vendor/ui_assets(mob/user) return list( diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm index ad6d09ead06..faacf5a4768 100644 --- a/code/modules/mining/ores_coins.dm +++ b/code/modules/mining/ores_coins.dm @@ -25,20 +25,23 @@ /obj/item/stack/ore/update_overlays() . = ..() var/difference = min(ORESTACK_OVERLAYS_MAX, amount) - (LAZYLEN(stack_overlays)+1) - if(difference == 0) + if(!difference) return - else if(difference < 0 && LAZYLEN(stack_overlays)) //amount < stack_overlays, remove excess. - if (LAZYLEN(stack_overlays)-difference <= 0) + + if(difference < 0 && LAZYLEN(stack_overlays)) //amount < stack_overlays, remove excess. + if(LAZYLEN(stack_overlays)-difference <= 0) stack_overlays = null - else - stack_overlays.len += difference - else if(difference > 0) //amount > stack_overlays, add some. + return + stack_overlays.len += difference + + else //amount > stack_overlays, add some. for(var/i in 1 to difference) var/mutable_appearance/newore = mutable_appearance(icon, icon_state) newore.pixel_x = rand(-8,8) newore.pixel_y = rand(-8,8) LAZYADD(stack_overlays, newore) - if (stack_overlays) + + if(stack_overlays) . += stack_overlays /obj/item/stack/ore/welder_act(mob/living/user, obj/item/I) diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index c6cb01748d8..df3b0ae0d78 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -241,7 +241,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 c98a452bdfa..497be6db9c1 100644 --- a/code/modules/mob/dead/observer/login.dm +++ b/code/modules/mob/dead/observer/login.dm @@ -18,7 +18,7 @@ if (isturf(T)) update_z(T.z) - update_icon(preferred_form) + update_icon(ALL, preferred_form) updateghostimages() client.set_right_click_menu_mode(FALSE) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index be1411902c5..ed0732f9284 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -114,7 +114,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_area_turfs(/area/shuttle/arrival) @@ -182,15 +182,15 @@ 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. + if(client) //We update our preferences in case they changed right before update_appearance was called. ghost_accs = client.prefs.ghost_accs ghost_others = client.prefs.ghost_others @@ -804,7 +804,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, need_hands = FALSE, floor_okay=FALSE) return isAdminGhostAI(usr) diff --git a/code/modules/mob/living/brain/MMI.dm b/code/modules/mob/living/brain/MMI.dm index 9d3c6d451a7..9041d67cb8e 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, that nevertheless has become standard-issue on Nanotrasen stations." 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,10 @@ /obj/item/mmi/update_icon_state() if(!brain) - icon_state = "mmi_off" - else if(istype(brain, /obj/item/organ/brain/alien)) - icon_state = "mmi_brain_alien" - else - icon_state = "mmi_brain" + icon_state = "[base_icon_state]_off" + return ..() + icon_state = "[base_icon_state]_brain[istype(brain, /obj/item/organ/brain/alien) ? "_alien" : null]" + return ..() /obj/item/mmi/update_overlays() . = ..() @@ -46,7 +46,8 @@ /obj/item/mmi/proc/add_mmi_overlay() if(brainmob && brainmob.stat != DEAD) . += "mmi_alive" - else if(brain) + return + if(brain) . += "mmi_dead" /obj/item/mmi/attackby(obj/item/O, mob/user, params) @@ -86,7 +87,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 @@ -107,7 +108,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.") @@ -149,7 +150,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/death.dm b/code/modules/mob/living/brain/death.dm index 7caff58d720..32db2599c0b 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 852c920b46c..2712c7bb6ed 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 @@ -59,7 +60,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) @@ -71,11 +72,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) @@ -130,7 +131,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) @@ -191,12 +192,15 @@ GLOBAL_VAR(posibrain_notify_cooldown) /obj/item/mmi/posibrain/update_icon_state() + . = ..() if(searching) - icon_state = "[initial(icon_state)]-searching" - else if(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 1b45653fa03..60b4a1f30f9 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/alien_powers.dm @@ -204,6 +204,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) . = ..() diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 5f2baccb41a..d97cafeb02f 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -43,10 +43,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/carbon_update_icons.dm b/code/modules/mob/living/carbon/carbon_update_icons.dm index 199beeeae8b..8f39855b7d6 100644 --- a/code/modules/mob/living/carbon/carbon_update_icons.dm +++ b/code/modules/mob/living/carbon/carbon_update_icons.dm @@ -114,7 +114,7 @@ if(client && 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(!(check_obscured_slots() & ITEM_SLOT_MASK)) @@ -130,7 +130,7 @@ if(client && 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(!(check_obscured_slots() & ITEM_SLOT_NECK)) @@ -144,7 +144,7 @@ if(client && 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') @@ -162,7 +162,7 @@ if(client && 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') @@ -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/carbon/human/human_update_icons.dm b/code/modules/mob/living/carbon/human/human_update_icons.dm index b2c63ca3813..1555c76f820 100644 --- a/code/modules/mob/living/carbon/human/human_update_icons.dm +++ b/code/modules/mob/living/carbon/human/human_update_icons.dm @@ -104,7 +104,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 @@ -150,7 +150,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] @@ -175,7 +175,7 @@ There are several things that need to be remembered: if(client && 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() if(!gloves && blood_in_hands && !(NOBLOODOVERLAY in dna.species.species_traits)) var/mutable_appearance/bloody_overlay = mutable_appearance('icons/effects/blood.dmi', "bloodyhands", -GLOVES_LAYER) @@ -213,7 +213,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) glasses.screen_loc = ui_glasses //...draw the item in the inventory screen @@ -243,7 +243,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) ears.screen_loc = ui_ears //move the item to the appropriate screen loc @@ -270,7 +270,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) shoes.screen_loc = ui_shoes //move the item to the appropriate screen loc @@ -295,7 +295,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) s_store.screen_loc = ui_sstore1 @@ -328,7 +328,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) belt.screen_loc = ui_belt @@ -353,7 +353,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(istype(wear_suit, /obj/item/clothing/suit)) wear_suit.screen_loc = ui_oclothing @@ -380,10 +380,10 @@ There are several things that need to be remembered: 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/flypeople.dm b/code/modules/mob/living/carbon/human/species_types/flypeople.dm index c94027b029a..d8f27a439d8 100644 --- a/code/modules/mob/living/carbon/human/species_types/flypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/flypeople.dm @@ -42,6 +42,7 @@ icon_state = pick("brain-x-d", "liver-x", "kidneys-x", "stomach-x", "lungs-x", "random_fly_1", "random_fly_2", "random_fly_3", "random_fly_4", "random_fly_5") /obj/item/organ/heart/fly/update_icon_state() + SHOULD_CALL_PARENT(FALSE) return //don't set icon thank you /obj/item/organ/lungs/fly @@ -87,8 +88,8 @@ name = odd_organ_name() icon_state = pick("brain-x-d", "liver-x", "kidneys-x", "stomach-x", "lungs-x", "random_fly_1", "random_fly_2", "random_fly_3", "random_fly_4", "random_fly_5") -/obj/item/organ/appendix/fly/update_icon() - return //don't set name or icon thank you +/obj/item/organ/appendix/fly/update_appearance(updates=ALL) + return ..(updates & ~(UPDATE_NAME|UPDATE_ICON)) //don't set name or icon thank you //useless organs we throw in just to fuck with surgeons a bit more /obj/item/organ/fly diff --git a/code/modules/mob/living/init_signals.dm b/code/modules/mob/living/init_signals.dm index 08ddbf7a5f7..cf32ad2f7fa 100644 --- a/code/modules/mob/living/init_signals.dm +++ b/code/modules/mob/living/init_signals.dm @@ -153,14 +153,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/living_defense.dm b/code/modules/mob/living/living_defense.dm index cd0379fc869..807f916c193 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -78,7 +78,7 @@ . = combat_mode combat_mode = new_mode if(hud_used?.action_intent) - hud_used.action_intent.update_icon() + hud_used.action_intent.update_appearance() //SKYRAT EDIT ADDITION BEGIN if(istype(get_active_held_item(), /obj/item/gun)) var/obj/item/gun/G = get_active_held_item() diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 321dc9ed822..a95c212241d 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -910,7 +910,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 @@ -921,8 +921,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 c16fb59beaf..a4cb80e1061 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/ai_eye/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/ai_eye/pic_in_pic/Destroy() diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 66b25adcec1..34a8786b1ad 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -97,7 +97,7 @@ if(A == hacking_cable) hacking_cable = null if(!QDELETED(card)) - card.update_icon() + card.update_appearance() if(A == internal_instrument) internal_instrument = null if(A == newscaster) @@ -121,7 +121,7 @@ card.forceMove(drop_location()) card.pai = null //these are otherwise handled by paicard/handle_atom_del() card.emotion_icon = initial(card.emotion_icon) - card.update_icon() + card.update_appearance() GLOB.pai_list -= src return ..() @@ -175,7 +175,7 @@ hackdoor = null QDEL_NULL(hacking_cable) if(!QDELETED(card)) - card.update_icon() + card.update_appearance() return if(screen == "doorjack" && subscreen == 0) // Update our view, if appropriate paiInterface() @@ -303,7 +303,7 @@ T.visible_message("[hacking_cable] rapidly retracts back into its spool.", "You hear a click and the sound of wire spooling rapidly.") QDEL_NULL(hacking_cable) if(!QDELETED(card)) - card.update_icon() + card.update_appearance() else if(hacking) process_hack() silent = max(silent - 1, 0) diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm index 3c38a1a5c7d..d0e9df77a45 100644 --- a/code/modules/mob/living/silicon/pai/software.dm +++ b/code/modules/mob/living/silicon/pai/software.dm @@ -157,7 +157,7 @@ card.emotion_icon = "extremely-happy" else card.emotion_icon = "[lowertext(newImage)]" - card.update_icon() + card.update_appearance() if("news") newscaster.ui_interact(src) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 391eb8f04f6..9ef5be235cd 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -60,7 +60,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) @@ -104,7 +104,7 @@ if(mmi.brainmob.stat == DEAD) mmi.brainmob.set_stat(CONSCIOUS) 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() @@ -478,14 +478,14 @@ set_light_color(COLOR_RED) //This should only matter for doomsday borgs, as any other time the lamp will be off and the color not seen set_light_range(1) //Again, like above, this only takes effect when the light is forced on by doomsday mode. lamp_enabled = FALSE - lampButton?.update_icon() + lampButton?.update_appearance() update_icons() return set_light_range(lamp_intensity) set_light_color(lamp_doom? COLOR_RED : lamp_color) //Red for doomsday killborgs, borg's choice otherwise set_light_on(TRUE) lamp_enabled = TRUE - lampButton?.update_icon() + lampButton?.update_appearance() update_icons() /mob/living/silicon/robot/proc/deconstruct() @@ -513,7 +513,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/l_leg/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 4ed40421921..c78d6cc52ef 100644 --- a/code/modules/mob/living/silicon/robot/robot_defense.dm +++ b/code/modules/mob/living/silicon/robot/robot_defense.dm @@ -279,7 +279,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 a35b3bea94f..51868eeea51 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -100,7 +100,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) @@ -449,7 +449,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_timer = 0 diff --git a/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm b/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm index a56015be5d2..4b72304bcda 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 d06ef2bb2c7..163db238a09 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() to_chat(src, "You turned on!") diag_hud_set_botstat() return TRUE @@ -147,7 +147,7 @@ set_light_on(on) bot_reset() //Resets an AI's call, should it exist. to_chat(src, "You turned off!") - update_icon() + update_appearance() /mob/living/simple_animal/bot/Initialize() . = ..() @@ -428,7 +428,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 @@ -437,7 +437,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! @@ -891,6 +891,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 6d03c5444c6..804a21b7e1b 100644 --- a/code/modules/mob/living/simple_animal/bot/construction.dm +++ b/code/modules/mob/living/simple_animal/bot/construction.dm @@ -175,19 +175,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) @@ -200,7 +211,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 9c500cd2f16..bfcee595c03 100644 --- a/code/modules/mob/living/simple_animal/bot/firebot.dm +++ b/code/modules/mob/living/simple_animal/bot/firebot.dm @@ -41,7 +41,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 @@ -82,11 +82,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() ..() @@ -94,14 +94,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." @@ -158,7 +158,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)) @@ -292,16 +292,15 @@ 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()) + if(IsStun() || IsParalyzed() || stationary_mode) //Bot has yellow light to indicate stationary mode. icon_state = "firebots1" - 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() diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm index ffe3bb1e5be..426ef97ce18 100644 --- a/code/modules/mob/living/simple_animal/bot/floorbot.dm +++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm @@ -43,7 +43,7 @@ . = ..() ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT) 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 @@ -64,11 +64,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() ..() @@ -388,7 +388,8 @@ if(!QDELETED(src)) go_idle() -/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() diff --git a/code/modules/mob/living/simple_animal/bot/honkbot.dm b/code/modules/mob/living/simple_animal/bot/honkbot.dm index 6b8f9128c71..511c1f448a8 100644 --- a/code/modules/mob/living/simple_animal/bot/honkbot.dm +++ b/code/modules/mob/living/simple_animal/bot/honkbot.dm @@ -39,7 +39,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() @@ -50,7 +50,7 @@ /mob/living/simple_animal/bot/honkbot/proc/sensor_blink() icon_state = "honkbot-c" - addtimer(CALLBACK(src, /atom/.proc/update_icon), 5, TIMER_OVERRIDE|TIMER_UNIQUE) + addtimer(CALLBACK(src, /atom/.proc/update_appearance), 0.5 SECONDS, TIMER_OVERRIDE|TIMER_UNIQUE) //honkbots react with sounds. /mob/living/simple_animal/bot/honkbot/proc/react_ping() @@ -133,7 +133,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))) @@ -178,7 +178,7 @@ Maintenance panel panel is [open ? "opened" : "closed"]"}, playsound(src, "honkbot_e", 50, FALSE) limiting_spam = TRUE // prevent spam icon_state = "honkbot-e" - addtimer(CALLBACK(src, /atom/.proc/update_icon), 30, TIMER_OVERRIDE|TIMER_UNIQUE) + addtimer(CALLBACK(src, /atom/.proc/update_appearance), 3 SECONDS, TIMER_OVERRIDE|TIMER_UNIQUE) addtimer(CALLBACK(src, .proc/limiting_spam_false), cooldowntimehorn) /mob/living/simple_animal/bot/honkbot/proc/honk_attack(mob/living/carbon/C) // horn attack diff --git a/code/modules/mob/living/simple_animal/bot/hygienebot.dm b/code/modules/mob/living/simple_animal/bot/hygienebot.dm index 4212fcf9476..7d7760b1d80 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/mob/aibots.dmi' icon_state = "hygienebot" + base_icon_state = "hygienebot" density = FALSE anchored = FALSE health = 100 @@ -39,7 +40,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 @@ -65,22 +66,16 @@ /mob/living/simple_animal/bot/hygienebot/update_icon_state() . = ..() - if(on) - icon_state = "hygienebot-on" - else - icon_state = "hygienebot" + icon_state = "[base_icon_state][on ? "-on" : null]" /mob/living/simple_animal/bot/hygienebot/update_overlays() . = ..() if(on) - var/mutable_appearance/fire_overlay = mutable_appearance(icon, "hygienebot-flame") - . +=fire_overlay - + . += mutable_appearance(icon, "hygienebot-flame") if(washing) - var/mutable_appearance/water_overlay = mutable_appearance(icon, emagged ? "hygienebot-fire" : "hygienebot-water") - . += water_overlay + . += mutable_appearance(icon, emagged ? "hygienebot-fire" : "hygienebot-water") /mob/living/simple_animal/bot/hygienebot/turn_off() @@ -203,11 +198,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 81b55080965..646abc094a9 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 @@ -86,23 +87,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) . = ..() @@ -111,7 +112,7 @@ prev_access = access_card.access qdel(J) skin = new_skin - update_icon() + update_appearance() linked_techweb = SSresearch.science_tech if(damagetype_healer == "all") return @@ -124,14 +125,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() @@ -187,7 +188,7 @@ else if(href_list["stationary"]) stationary_mode = !stationary_mode path = list() - update_icon() + update_appearance() else if(href_list["hptech"]) var/oldheal_amount = heal_amount @@ -358,7 +359,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 @@ -481,9 +482,9 @@ var/mob/living/carbon/C = A patient = C mode = BOT_HEALING - update_icon() + update_appearance() medicate_patient(C) - update_icon() + update_appearance() else ..() @@ -571,7 +572,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 42362303c35..f67cf507def 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -137,7 +137,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!") @@ -184,6 +184,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() @@ -453,7 +454,7 @@ load = AM mode = BOT_IDLE - update_icon() + update_appearance() ///resolves the name to display for the loaded mob. primarily needed for the paranormal subtype since we don't want to show the name of ghosts riding it. /mob/living/simple_animal/bot/mulebot/proc/get_load_name() @@ -478,7 +479,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 @@ -497,7 +498,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() . = ..() @@ -790,7 +791,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) @@ -871,7 +872,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 f7b5654b8ce..b93c0f31e99 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -77,7 +77,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 @@ -90,11 +90,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() ..() @@ -230,7 +230,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)) @@ -284,7 +284,7 @@ Auto Patrol: []"}, var/judgement_criteria = judgement_criteria() playsound(src, 'sound/weapons/egloves.ogg', 50, TRUE, -1) icon_state = "[initial(icon_state)]-c" - addtimer(CALLBACK(src, /atom/.proc/update_icon), 2) + addtimer(CALLBACK(src, /atom/.proc/update_appearance), 0.2 SECONDS) var/threat = 5 if(harm) @@ -466,7 +466,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/l_leg/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 ba6a292c669..d88a95156c2 100644 --- a/code/modules/mob/living/simple_animal/bot/vibebot.dm +++ b/code/modules/mob/living/simple_animal/bot/vibebot.dm @@ -26,7 +26,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() @@ -45,13 +45,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/eldritch_demons.dm b/code/modules/mob/living/simple_animal/eldritch_demons.dm index b2fdc337898..acb453d1c9f 100644 --- a/code/modules/mob/living/simple_animal/eldritch_demons.dm +++ b/code/modules/mob/living/simple_animal/eldritch_demons.dm @@ -321,7 +321,7 @@ icon_state = "rust_walker_n" else if(newdir == SOUTH) icon_state = "rust_walker_s" - update_icon() + update_appearance() /mob/living/simple_animal/hostile/eldritch/rust_spirit/Moved() . = ..() diff --git a/code/modules/mob/living/simple_animal/hostile/bees.dm b/code/modules/mob/living/simple_animal/hostile/bees.dm index df0a4c19391..70f3d568079 100644 --- a/code/modules/mob/living/simple_animal/hostile/bees.dm +++ b/code/modules/mob/living/simple_animal/hostile/bees.dm @@ -93,7 +93,7 @@ if(beegent) bee_to_eat.beegent = beegent bee_to_eat.reagents.add_reagent(beegent.type, 5) - bee_to_eat.update_icon() + bee_to_eat.update_appearance() beegent = null ..() @@ -356,10 +356,9 @@ . = ..() AddComponent(/datum/component/edible, list(/datum/reagent/consumable/nutriment/vitamin = 5), null, RAW | MEAT | GROSS, 10, 0, list("bee"), null, 10) -/obj/item/trash/bee/update_icon() +/obj/item/trash/bee/update_overlays() . = ..() - cut_overlays() var/mutable_appearance/body_overlay = mutable_appearance(icon = icon, icon_state = "bee_item_overlay") body_overlay.color = beegent ? beegent.color : BEE_DEFAULT_COLOUR - add_overlay(body_overlay) + . += body_overlay 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 53ce73f5013..f01d1dedc10 100644 --- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm +++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm @@ -395,6 +395,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/midwife)) @@ -452,6 +453,7 @@ /obj/effect/proc_holder/tarantula_charge/update_icon() action.button_icon_state = "wrap_[active]" action.UpdateButtonIcon() + return ..() /obj/effect/proc_holder/tarantula_charge/Click() if(!istype(usr, /mob/living/simple_animal/hostile/poison/giant_spider/tarantula)) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm index 67b73064173..c206452662a 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm @@ -741,7 +741,7 @@ Difficulty: Hard new /obj/effect/temp_visual/hierophant/telegraph/teleport(get_turf(src), user) to_chat(user, "You collect [src], reattaching it to the club!") H.beacon = null - H.update_icon() + H.update_appearance() user.update_action_buttons_icon() qdel(src) else diff --git a/code/modules/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm index 4d3035444e0..32fe764df80 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.loaded_projectile) qdel(Pewgun.chambered.loaded_projectile) Pewgun.chambered.loaded_projectile = 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/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index beedeea489d..3a5648e8545 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -655,10 +655,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 7aa4c38f8c5..3c304361db1 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -134,11 +134,12 @@ coretype = text2path("/obj/item/slime_extract/[sanitizedcolour]") regenerate_icons() -/mob/living/simple_animal/slime/proc/update_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 0735d3e8f25..d85b806fcee 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -630,11 +630,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 ea745736fbd..5cf0a973abf 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -491,7 +491,7 @@ m_intent = MOVE_INTENT_RUN if(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 2769479e0a7..fc289de56c7 100644 --- a/code/modules/modular_computers/computers/item/computer.dm +++ b/code/modules/modular_computers/computers/item/computer.dm @@ -62,7 +62,7 @@ idle_threads = list() if(looping_sound) soundloop = new(list(src), enabled) - update_icon() + update_appearance() /obj/item/modular_computer/Destroy() kill_program(forced = TRUE) @@ -168,21 +168,16 @@ . += 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 + if(enabled) + . += active_program?.program_icon_state || icon_state_menu if(obj_integrity <= integrity_failure * max_integrity) . += "bsod" . += "broken" @@ -217,7 +212,7 @@ if(looping_sound) soundloop.start() enabled = 1 - update_icon() + update_appearance() ui_interact(user) return TRUE else // Unpowered @@ -353,7 +348,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) @@ -380,7 +375,7 @@ if(loud) physical.visible_message("\The [src] shuts down.") enabled = 0 - update_icon() + update_appearance() /** * Toggles the computer's flashlight, if it has one. diff --git a/code/modules/modular_computers/computers/item/computer_components.dm b/code/modules/modular_computers/computers/item/computer_components.dm index 8668b279cf4..dd84879d043 100644 --- a/code/modules/modular_computers/computers/item/computer_components.dm +++ b/code/modules/modular_computers/computers/item/computer_components.dm @@ -54,7 +54,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 a9f353bca42..3559006f0de 100644 --- a/code/modules/modular_computers/computers/item/computer_ui.dm +++ b/code/modules/modular_computers/computers/item/computer_ui.dm @@ -111,7 +111,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. @@ -150,7 +150,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] @@ -165,7 +165,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 d3eb160281c..3ac2e3d4c18 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 970dc8bd1df..e1a292810b4 100644 --- a/code/modules/modular_computers/computers/item/processor.dm +++ b/code/modules/modular_computers/computers/item/processor.dm @@ -47,7 +47,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 bdad719f854..72d5ad7127d 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" worn_icon_state = "tablet" hardware_flag = PROGRAM_TABLET max_hardware_size = 1 @@ -21,8 +22,9 @@ /obj/item/modular_computer/tablet/update_icon_state() 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]" + finish_color = pick("red", "blue", "brown", "green", "black") + 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" @@ -39,6 +41,8 @@ /// Given to Nuke Ops members. /obj/item/modular_computer/tablet/nukeops icon_state = "tablet-syndicate" + icon_state_powered = "tablet-syndicate" + icon_state_unpowered = "tablet-syndicate" comp_light_luminosity = 6.3 has_variants = FALSE device_theme = "syndicate" @@ -55,6 +59,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 @@ -139,6 +146,8 @@ /obj/item/modular_computer/tablet/integrated/syndicate icon_state = "tablet-silicon-syndicate" + icon_state_powered = "tablet-silicon-syndicate" + icon_state_unpowered = "tablet-silicon-syndicate" device_theme = "syndicate" diff --git a/code/modules/modular_computers/computers/machinery/modular_computer.dm b/code/modules/modular_computers/computers/machinery/modular_computer.dm index 06af3e31d9f..ddadac91a57 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(updates) + . = ..() + set_light(cpu?.enabled ? light_strength : 0) - if(!cpu || !cpu.enabled) +/obj/machinery/modular_computer/update_icon_state() + icon_state = (cpu?.enabled || (!(machine_stat & NOPOWER) && cpu?.use_power())) ? icon_state_powered : icon_state_unpowered + return ..() + +/obj/machinery/modular_computer/update_overlays() + . = ..() + if(!cpu?.enabled) if (!(machine_stat & NOPOWER) && (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?.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 . = ..() diff --git a/code/modules/modular_computers/computers/machinery/modular_console.dm b/code/modules/modular_computers/computers/machinery/modular_console.dm index 0e27d813053..93dc5b303c2 100644 --- a/code/modules/modular_computers/computers/machinery/modular_console.dm +++ b/code/modules/modular_computers/computers/machinery/modular_console.dm @@ -52,4 +52,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 0bce722a5b3..7462d180a02 100644 --- a/code/modules/modular_computers/file_system/program.dm +++ b/code/modules/modular_computers/file_system/program.dm @@ -66,7 +66,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) @@ -221,7 +221,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/airestorer.dm b/code/modules/modular_computers/file_system/programs/airestorer.dm index bec4ab7dd1e..2c24c37a04a 100644 --- a/code/modules/modular_computers/file_system/programs/airestorer.dm +++ b/code/modules/modular_computers/file_system/programs/airestorer.dm @@ -84,7 +84,7 @@ if(A.health >= 0 && A.stat == DEAD) A.revive(full_heal = FALSE, admin_revive = FALSE) - cardhold.update_icon() + cardhold.update_appearance() // Finished restoring if(A.health >= 100) 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 829f9ccef8c..16584b41429 100644 --- a/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm +++ b/code/modules/modular_computers/file_system/programs/antagonist/revelation.dm @@ -27,7 +27,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 8349680f716..0b9a86f9fb6 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 user?.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() user?.mind?.adjust_experience(/datum/skill/gaming, 10) sleep(10) @@ -175,4 +175,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 31142b37291..f7abfc7a63f 100644 --- a/code/modules/modular_computers/file_system/programs/radar.dm +++ b/code/modules/modular_computers/file_system/programs/radar.dm @@ -16,7 +16,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" @@ -175,7 +175,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 @@ -193,7 +193,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 940742dfde0..b681f5b930f 100644 --- a/code/modules/modular_computers/file_system/programs/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/sm_monitor.dm @@ -28,7 +28,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/modular_computers/hardware/printer.dm b/code/modules/modular_computers/hardware/printer.dm index 3bd5946435b..f534a94a0d3 100644 --- a/code/modules/modular_computers/hardware/printer.dm +++ b/code/modules/modular_computers/hardware/printer.dm @@ -33,7 +33,7 @@ P.info = text_to_print if(paper_title) P.name = paper_title - P.update_icon() + P.update_appearance() stored_paper-- P = null return TRUE diff --git a/code/modules/ninja/suit/ninjaDrainAct.dm b/code/modules/ninja/suit/ninjaDrainAct.dm index 7bb21c70a56..fd52bb7bb65 100644 --- a/code/modules/ninja/suit/ninjaDrainAct.dm +++ b/code/modules/ninja/suit/ninjaDrainAct.dm @@ -48,7 +48,7 @@ playsound(loc, "sparks", 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) obj_flags |= EMAGGED locked = FALSE - update_icon() + update_appearance() return drain_total @@ -103,7 +103,7 @@ ninja_suit.cell.give(charge) charge = 0 corrupt() - update_icon() + update_appearance() return drain_total diff --git a/code/modules/ninja/suit/suit_attackby.dm b/code/modules/ninja/suit/suit_attackby.dm index f00d2f49750..a5ebd44fdb3 100644 --- a/code/modules/ninja/suit/suit_attackby.dm +++ b/code/modules/ninja/suit/suit_attackby.dm @@ -21,7 +21,7 @@ ninja.put_in_hands(old_cell) old_cell.add_fingerprint(ninja) old_cell.corrupt() - old_cell.update_icon() + old_cell.update_appearance() cell = CELL to_chat(ninja, "Upgrade complete. Maximum capacity: [round(cell.maxcharge/100)]%") else diff --git a/code/modules/paperwork/carbonpaper.dm b/code/modules/paperwork/carbonpaper.dm index dc2ad7f0748..8aaacfcd606 100644 --- a/code/modules/paperwork/carbonpaper.dm +++ b/code/modules/paperwork/carbonpaper.dm @@ -7,14 +7,18 @@ var/iscopy = FALSE /obj/item/paper/carbon/update_icon_state() - if(iscopy) - icon_state = "cpaper" - else if(copied) - icon_state = "paper" - else - icon_state = "paper_stack" if(info) icon_state = "[icon_state]_words" + return ..() + if(iscopy) + icon_state = "cpaper" + return ..() + if(copied) + icon_state = "paper" + return ..() + + icon_state = "paper_stack" + return ..() /obj/item/paper/carbon/proc/removecopy(mob/living/user) if(!copied) diff --git a/code/modules/paperwork/clipboard.dm b/code/modules/paperwork/clipboard.dm index b2747c63d74..326e664b715 100644 --- a/code/modules/paperwork/clipboard.dm +++ b/code/modules/paperwork/clipboard.dm @@ -18,7 +18,7 @@ return BRUTELOSS//the clipboard's clip is very strong. industrial duty. can kill a man easily. /obj/item/clipboard/Initialize() - update_icon() + update_appearance() . = ..() /obj/item/clipboard/Destroy() @@ -41,10 +41,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) @@ -123,4 +123,4 @@ //Update everything attack_self(usr) - update_icon() + update_appearance() diff --git a/code/modules/paperwork/folders.dm b/code/modules/paperwork/folders.dm index 058346d6d00..532edb88d3d 100644 --- a/code/modules/paperwork/folders.dm +++ b/code/modules/paperwork/folders.dm @@ -41,7 +41,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]!") @@ -94,7 +94,7 @@ //Update everything attack_self(usr) - update_icon() + update_appearance() /obj/item/folder/documents name = "folder- 'TOP SECRET'" @@ -103,7 +103,7 @@ /obj/item/folder/documents/Initialize() . = ..() new /obj/item/documents/nanotrasen(src) - update_icon() + update_appearance() /obj/item/folder/syndicate icon_state = "folder_syndie" @@ -116,7 +116,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" @@ -124,9 +124,9 @@ /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() diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index d8fc67bb7f3..39c1c39c7a5 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -102,11 +102,12 @@ . = ..() pixel_x = base_pixel_x + rand(-9, 9) pixel_y = base_pixel_y + rand(-8, 8) - update_icon() + update_appearance() /obj/item/paper/update_icon_state() if(info && show_written_words) icon_state = "[initial(icon_state)]_words" + return ..() /obj/item/paper/verb/rename() set name = "Rename paper" @@ -338,7 +339,7 @@ update_static_data(usr,ui) - update_icon() + update_appearance() . = TRUE /** @@ -363,9 +364,6 @@ slot_flags = null show_written_words = FALSE -/obj/item/paper/crumpled/update_icon_state() - return - /obj/item/paper/crumpled/bloody icon_state = "scrap_bloodied" diff --git a/code/modules/paperwork/paper_cutter.dm b/code/modules/paperwork/paper_cutter.dm index 365245b7494..5c7a60b6ff4 100644 --- a/code/modules/paperwork/paper_cutter.dm +++ b/code/modules/paperwork/paper_cutter.dm @@ -15,7 +15,7 @@ /obj/item/papercutter/Initialize() . = ..() storedcutter = new /obj/item/hatchet/cutterblade(src) - update_icon() + update_appearance() /obj/item/papercutter/suicide_act(mob/user) @@ -36,6 +36,7 @@ /obj/item/papercutter/update_icon_state() icon_state = (storedcutter ? "[initial(icon_state)]-cutter" : "[initial(icon_state)]") + return ..() /obj/item/papercutter/update_overlays() . =..() @@ -50,7 +51,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)) @@ -58,7 +59,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) @@ -80,7 +81,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) @@ -89,7 +90,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 f8be5179161..7504bac7e33 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/P if(papers.len > 0) @@ -105,14 +105,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 ..() @@ -129,6 +129,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 e926df0013c..c0392f80553 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/Exited(atom/movable/AM, atom/newLoc) . = ..() @@ -56,9 +56,10 @@ /obj/item/paperplane/update_overlays() . = ..() var/list/stamped = internalPaper.stamped - if(stamped) - for(var/S in stamped) - . += "paperplane_[S]" + if(!LAZYLEN(stamped)) + return + for(var/S in stamped) + . += "paperplane_[S]" /obj/item/paperplane/attack_self(mob/user) to_chat(user, "You unfold [src].") @@ -77,7 +78,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 d231aaca6c6..7982ee48ab9 100644 --- a/code/modules/paperwork/pen.dm +++ b/code/modules/paperwork/pen.dm @@ -267,7 +267,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) @@ -279,6 +279,7 @@ inhand_icon_state = initial(inhand_icon_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/photocopier.dm b/code/modules/paperwork/photocopier.dm index ea90e185cc0..0e3e874043c 100644 --- a/code/modules/paperwork/photocopier.dm +++ b/code/modules/paperwork/photocopier.dm @@ -243,7 +243,7 @@ copied_paper.info += copied_info copied_paper.info += "" copied_paper.name = paper_copy.name - copied_paper.update_icon() + copied_paper.update_appearance() copied_paper.stamps = paper_copy.stamps if(paper_copy.stamped) copied_paper.stamped = paper_copy.stamped.Copy() diff --git a/code/modules/paperwork/ticketmachine.dm b/code/modules/paperwork/ticketmachine.dm index 99a0bb532c1..b66a5c546f8 100644 --- a/code/modules/paperwork/ticketmachine.dm +++ b/code/modules/paperwork/ticketmachine.dm @@ -5,6 +5,7 @@ name = "ticket machine" icon = 'icons/obj/bureaucracy.dmi' icon_state = "ticketmachine" + base_icon_state = "ticketmachine" desc = "A marvel of bureaucratic engineering encased in an efficient plastic shell. It can be refilled with a hand labeler refill roll and linked to buttons with a multitool." density = FALSE maptext_height = 26 @@ -41,11 +42,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 +60,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" @@ -117,14 +118,18 @@ addtimer(VARSET_CALLBACK(src, cooldown, FALSE), 10) /obj/machinery/ticket_machine/update_icon() + . = ..() + handle_maptext() + +/obj/machinery/ticket_machine/update_icon_state() switch(ticket_number) //Gives you an idea of how many tickets are left if(0 to 49) - icon_state = "ticketmachine_100" + icon_state = "[base_icon_state]_100" if(50 to 99) - icon_state = "ticketmachine_50" + icon_state = "[base_icon_state]_50" if(100) - icon_state = "ticketmachine_0" - handle_maptext() + icon_state = "[base_icon_state]_0" + 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 +159,7 @@ qdel(ticket) tickets.Cut() max_number = initial(max_number) - update_icon() + update_appearance() return /obj/machinery/ticket_machine/proc/reset_cooldown() @@ -220,7 +225,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 f953e8c9cd2..9d10bd19837 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) @@ -107,7 +107,7 @@ else qdel(framed) framed = P - update_icon() + update_appearance() /obj/structure/sign/picture_frame/examine(mob/user) if(in_range(src, user) && framed) @@ -136,7 +136,7 @@ if(!user.transferItemToLoc(P, src)) return framed = P - update_icon() + update_appearance() else to_chat(user, "\The [src] already contains a photo.") @@ -163,7 +163,7 @@ 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 5f4bb327b31..284c8b70568 100644 --- a/code/modules/photography/photos/photo.dm +++ b/code/modules/photography/photos/photo.dm @@ -22,7 +22,7 @@ if(!istype(P)) return picture = P - update_icon() + update_appearance() if(P.caption) scribble = P.caption if(setname && P.picture_name) @@ -43,10 +43,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/suicide_act(mob/living/carbon/user) user.visible_message("[user] is taking one last look at \the [src]! It looks like [user.p_theyre()] giving in to death!")//when you wanna look at photo of waifu one last time before you die... diff --git a/code/modules/plumbing/ducts.dm b/code/modules/plumbing/ducts.dm index b4dbc523c94..a98d6413295 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)) @@ -161,7 +161,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) @@ -197,7 +197,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() @@ -255,6 +255,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() @@ -335,7 +336,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 2d32a255800..9e9114014ac 100644 --- a/code/modules/plumbing/plumbers/acclimator.dm +++ b/code/modules/plumbing/plumbers/acclimator.dm @@ -9,6 +9,7 @@ desc = "An efficient cooler and heater for the perfect showering temperature or illicit chemical factory." icon_state = "acclimator" + base_icon_state = "acclimator" buffer = 200 ///towards wich temperature do we build? @@ -34,17 +35,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 @@ -56,15 +57,17 @@ reagents.handle_reactions() else if(acclimate_state != NEUTRAL) acclimate_state = NEUTRAL - update_icon() + update_appearance() /obj/machinery/plumbing/acclimator/update_icon_state() - icon_state = initial(icon_state) switch(acclimate_state) if(COOLING) - icon_state += "_cold" + icon_state = "[base_icon_state]_cold" if(HEATING) - icon_state += "_hot" + icon_state = "[base_icon_state]_hot" + else + icon_state = base_icon_state + 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 da6d3324d42..5f82b4550bd 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 wasn't fun icon = 'icons/obj/plumbing/plumbers.dmi' icon_state = "pump" + base_icon_state = "pump" anchored = FALSE density = TRUE idle_power_usage = 10 @@ -27,7 +28,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(delta_time) @@ -37,7 +38,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!") @@ -54,8 +55,7 @@ /obj/machinery/plumbing/liquid_pump/update_icon_state() if(geyser) - icon_state = initial(icon_state) + "-on" - else if(panel_open) - icon_state = initial(icon_state) + "-open" - else - icon_state = initial(icon_state) + icon_state = "[base_icon_state]-on" + return ..() + icon_state = "[base_icon_state][panel_open ? "-open" : null]" + return ..() diff --git a/code/modules/plumbing/plumbers/synthesizer.dm b/code/modules/plumbing/plumbers/synthesizer.dm index 0be1e0a3b91..43ae1570108 100644 --- a/code/modules/plumbing/plumbers/synthesizer.dm +++ b/code/modules/plumbing/plumbers/synthesizer.dm @@ -94,14 +94,11 @@ if(new_reagent in dispensable_reagents) reagent_id = new_reagent . = TRUE - update_icon() + update_appearance() reagents.clear_reagents() /obj/machinery/plumbing/synthesizer/update_overlays() . = ..() var/mutable_appearance/r_overlay = mutable_appearance(icon, "[icon_state]_overlay") - if(reagent_id) - r_overlay.color = initial(reagent_id.color) - else - r_overlay.color = "#FFFFFF" + r_overlay.color = reagent_id ? initial(reagent_id.color) : "#FFFFFF" . += r_overlay diff --git a/code/modules/plumbing/plumbers/teleporter.dm b/code/modules/plumbing/plumbers/teleporter.dm index 902ef2c7abc..311199a00a0 100644 --- a/code/modules/plumbing/plumbers/teleporter.dm +++ b/code/modules/plumbing/plumbers/teleporter.dm @@ -108,7 +108,7 @@ /obj/machinery/plumbing/receiver/attackby(obj/item/I, mob/user, params) if(default_deconstruction_screwdriver(user, icon_state + "_open", initial(icon_state), I)) - update_icon() + update_appearance() return if(default_pry_open(I)) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index dcc585c12b8..8b5202b6745 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -1,46 +1,101 @@ -//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 -#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 + +// Etherials: +/// How long it takes an ethereal to drain or charge APCs. Also used as a spam limiter. +#define APC_DRAIN_TIME (7.5 SECONDS) +/// How much power ethereals gain/drain from APCs. #define APC_POWER_GAIN 200 +// 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 @@ -69,9 +124,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 = FALSE - 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 @@ -191,7 +246,7 @@ 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() @@ -216,7 +271,7 @@ /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() @@ -250,7 +305,7 @@ if(auto_name) name = "\improper [get_area_name(area, TRUE)] APC" - update_icon() + update_appearance() make_terminal() @@ -291,58 +346,14 @@ // 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(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(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) - + . = ..() // 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,82 +363,102 @@ 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 + set_light(0) +/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 + else if((obj_flags & EMAGGED) || malfai) - update_state |= UPSTATE_BLUESCREEN + new_update_state |= UPSTATE_BLUESCREEN 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 + new_update_overlay |= 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 + 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 (!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(new_update_overlay != update_overlay) + update_overlay = new_update_overlay + . |= UPDATE_OVERLAYS - 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 // Used in process so it doesn't update the icon too much /obj/machinery/power/apc/proc/queue_icon_update() @@ -471,7 +502,7 @@ else if (opened!=APC_COVER_REMOVED) opened = APC_COVER_CLOSED coverlocked = TRUE //closing cover relocks it - update_icon() + update_appearance() return else if (!(machine_stat & BROKEN)) if(coverlocked && !(machine_stat & MAINT)) // locked... @@ -482,7 +513,7 @@ return else opened = APC_COVER_OPENED - update_icon() + update_appearance() return /obj/machinery/power/apc/screwdriver_act(mob/living/user, obj/item/W) @@ -494,10 +525,10 @@ user.visible_message("[user] removes \the [cell] from [src]!", "You remove \the [cell].") var/turf/T = get_turf(user) cell.forceMove(T) - cell.update_icon() + cell.update_appearance() cell = null charging = APC_NOT_CHARGING - update_icon() + update_appearance() return else switch (has_electronics) @@ -514,14 +545,14 @@ else to_chat(user, "There is nothing to secure!") return - update_icon() + update_appearance() else if(obj_flags & EMAGGED) to_chat(user, "The interface is broken!") return else panel_open = !panel_open to_chat(user, "The wires have been [panel_open ? "exposed" : "unexposed"].") - update_icon() + update_appearance() /obj/machinery/power/apc/wirecutter_act(mob/living/user, obj/item/W) . = ..() @@ -569,7 +600,7 @@ user.visible_message("[user.name] inserts the power cell to [src.name]!",\ "You insert the power cell.") chargecount = 0 - update_icon() + update_appearance() else if (W.GetID()) togglelock(user) else if (istype(W, /obj/item/stack/cable_coil) && opened) @@ -647,7 +678,7 @@ chargecount = 0 user.visible_message("[user] fabricates a weak power cell and places it into [src].", \ "Your [P.name] whirrs with strain as you create a weak power cell and place it into [src]!") - update_icon() + update_appearance() else to_chat(user, "[src] has both electronics and a cell.") return @@ -662,7 +693,7 @@ to_chat(user, "You replace missing APC's cover.") qdel(W) opened = APC_COVER_OPENED - update_icon() + update_appearance() return if (has_electronics) to_chat(user, "You cannot repair this APC until you remove the electronics still inside!") @@ -676,7 +707,7 @@ obj_integrity = max_integrity if (opened==APC_COVER_REMOVED) opened = APC_COVER_OPENED - update_icon() + update_appearance() return else if(panel_open && !opened && is_wire_tool(W)) wires.interact(user) @@ -722,7 +753,7 @@ chargecount = 0 user.visible_message("[user] fabricates a weak power cell and places it into [src].", \ "Your [the_rcd.name] whirrs with strain as you create a weak power cell and place it into [src]!") - update_icon() + update_appearance() return TRUE else to_chat(user, "[src] has both electronics and a cell.") @@ -749,7 +780,7 @@ if(allowed(usr) && !wires.is_cut(WIRE_IDSCAN) && !malfhack) locked = !locked to_chat(user, "You [ locked ? "lock" : "unlock"] the APC interface.") - update_icon() + update_appearance() updateUsrDialog() else to_chat(user, "Access denied.") @@ -779,7 +810,7 @@ opened = APC_COVER_REMOVED coverlocked = FALSE visible_message("The APC cover is knocked down!") - update_icon() + update_appearance() /obj/machinery/power/apc/emag_act(mob/user) if(!(obj_flags & EMAGGED) && !malfhack) @@ -795,7 +826,7 @@ obj_flags |= EMAGGED locked = FALSE to_chat(user, "You emag the APC interface.") - update_icon() + update_appearance() // attack with hand - remove cell (if cover open) or interact with the APC @@ -818,9 +849,9 @@ if(stomach.crystal_charge < 10) to_chat(H, "Your charge is too low!") return - E.drain_time = world.time + 75 + E.drain_time = world.time + APC_DRAIN_TIME to_chat(H, "You start channeling power through your body into the APC.") - if(do_after(user, 75, target = src)) + if(do_after(user, APC_DRAIN_TIME, target = src)) if(cell.charge == cell.maxcharge || (stomach.crystal_charge < 10)) return if(istype(stomach)) @@ -854,10 +885,10 @@ if(cell) user.visible_message("[user] removes \the [cell] from [src]!", "You remove \the [cell].") user.put_in_hands(cell) - cell.update_icon() + cell.update_appearance() src.cell = null charging = APC_NOT_CHARGING - src.update_icon() + src.update_appearance() return if((machine_stat & MAINT) && !opened) //no board; no interface return @@ -935,13 +966,13 @@ 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 @@ -989,7 +1020,7 @@ to_chat(usr, "The APC does not respond to the command!") else locked = !locked - update_icon() + update_appearance() . = TRUE if("cover") coverlocked = !coverlocked @@ -1004,20 +1035,20 @@ chargemode = !chargemode if(!chargemode) charging = APC_NOT_CHARGING - update_icon() + update_appearance() . = TRUE if("channel") if(params["eqp"]) equipment = setsubsystem(text2num(params["eqp"])) - update_icon() + update_appearance() update() else if(params["lgt"]) lighting = setsubsystem(text2num(params["lgt"])) - update_icon() + update_appearance() update() else if(params["env"]) environ = setsubsystem(text2num(params["env"])) - update_icon() + update_appearance() update() . = TRUE if("overload") @@ -1035,7 +1066,7 @@ malfvacate() if("reboot") failure_timer = 0 - update_icon() + update_appearance() update() if("emergency_lighting") emergency_lights = !emergency_lights @@ -1053,7 +1084,7 @@ add_hiddenprint(user) log_game("[key_name(user)] turned [operating ? "on" : "off"] the [src] in [AREACOORD(src)]") update() - update_icon() + update_appearance() /obj/machinery/power/apc/proc/malfhack(mob/living/silicon/ai/malf) if(!istype(malf)) @@ -1190,7 +1221,7 @@ /obj/machinery/power/apc/process() if(icon_update_needed) - update_icon() + update_appearance() if(machine_stat & (BROKEN|MAINT)) return if(!area || !area.requires_power) @@ -1217,12 +1248,12 @@ var/excess = surplus() - if(!src.avail()) - main_status = 0 + if(!avail()) + 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 @@ -1245,9 +1276,9 @@ 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 @@ -1259,24 +1290,24 @@ 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(TRUE, 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(TRUE, 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_OFF) + lighting = autoset(lighting, AUTOSET_ON) + environ = autoset(environ, AUTOSET_ON) area.poweralert(TRUE, src) else // otherwise all can be on - equipment = autoset(equipment, 1) - 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(FALSE, src) if(cell.percent() > 75) area.poweralert(FALSE, src) @@ -1311,16 +1342,16 @@ 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) + 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 @@ -1332,23 +1363,54 @@ 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) @@ -1360,9 +1422,9 @@ 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 @@ -1375,10 +1437,10 @@ 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) @@ -1426,14 +1488,6 @@ else return FALSE -/obj/machinery/power/apc/proc/setsubsystem(val) - if(cell && cell.charge > 0) - return (val==1) ? 0 : val - else if(val == 3) - return TRUE - else - return FALSE - /obj/machinery/power/apc/proc/energy_fail(duration) for(var/obj/machinery/M in area.contents) @@ -1455,16 +1509,19 @@ L.update(FALSE) CHECK_TICK -#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_RESET_EMP +#undef APC_CHANNEL_OFF +#undef APC_CHANNEL_AUTO_OFF +#undef APC_CHANNEL_ON +#undef APC_CHANNEL_AUTO_ON + +#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 @@ -1481,21 +1538,23 @@ #undef APC_DRAIN_TIME #undef APC_POWER_GAIN +#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 932fb072a5e..9e841fb593b 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -95,9 +95,9 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri if(C.cable_layer & cable_layer) linked_dirs |= check_dir C.linked_dirs |= inverse - C.update_icon() + C.update_appearance() - update_icon() + update_appearance() ///Clear the linked indicator bitflags /obj/structure/cable/proc/Disconnect_cable() @@ -108,7 +108,7 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri for(var/obj/structure/cable/C in TB) if(cable_layer & C.cable_layer) C.linked_dirs &= ~inverse - C.update_icon() + C.update_appearance() /obj/structure/cable/Destroy() // called when a cable is deleted Disconnect_cable() @@ -131,24 +131,26 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri /obj/structure/cable/update_icon_state() if(!linked_dirs) icon_state = "l[cable_layer]-noconnection" - else - var/list/dir_icon_list = list() - for(var/check_dir in GLOB.cardinals) - if(linked_dirs & check_dir) - dir_icon_list += "[check_dir]" - var/dir_string = dir_icon_list.Join("-") - if(dir_icon_list.len > 1) - for(var/obj/O in loc) - if(GLOB.wire_node_generating_types[O.type]) + return ..() + + var/list/dir_icon_list = list() + for(var/check_dir in GLOB.cardinals) + if(linked_dirs & check_dir) + dir_icon_list += "[check_dir]" + var/dir_string = dir_icon_list.Join("-") + if(dir_icon_list.len > 1) + for(var/obj/O in loc) + if(GLOB.wire_node_generating_types[O.type]) + dir_string = "[dir_string]-node" + break + else if(istype(O, /obj/machinery/power)) + var/obj/machinery/power/P = O + if(P.should_have_node()) dir_string = "[dir_string]-node" break - else if(istype(O, /obj/machinery/power)) - var/obj/machinery/power/P = O - if(P.should_have_node()) - dir_string = "[dir_string]-node" - break - dir_string = "l[cable_layer]-[dir_string]" - icon_state = dir_string + dir_string = "l[cable_layer]-[dir_string]" + icon_state = dir_string + return ..() /obj/structure/cable/proc/handlecable(obj/item/W, mob/user, params) @@ -395,6 +397,7 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri icon = 'icons/obj/power.dmi' icon_state = "coil" inhand_icon_state = "coil" + base_icon_state = "coil" novariants = FALSE lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi' @@ -426,19 +429,25 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri . = ..() pixel_x = base_pixel_x + rand(-2, 2) pixel_y = base_pixel_y + rand(-2, 2) - update_icon() + update_appearance() /obj/item/stack/cable_coil/examine(mob/user) . = ..() . += "Ctrl+Click to change the layer you are placing on." +/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/update_icon_state() if(novariants) return - icon_state = "[initial(icon_state)][amount < 3 ? amount : ""]" - var/how_many_things = amount < 3 ? "piece" : "coil" - name = "cable [how_many_things]" - desc = "A [how_many_things] of insulated power cable." + . = ..() + icon_state = "[base_icon_state][amount < 3 ? amount : ""]" /obj/item/stack/cable_coil/suicide_act(mob/user) if(locate(/obj/structure/chair/stool) in get_turf(user)) @@ -514,7 +523,7 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri var/obj/item/restraints/handcuffs/cable/restraints = new restraints.color = color user.put_in_hands(restraints) - update_icon() + update_appearance() /////////////////////////////////// @@ -543,7 +552,7 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri amount = max_amount else amount += extra - update_icon() + update_appearance() /////////////////////////////////////////////// @@ -598,6 +607,7 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri amount = null icon_state = "coil2" worn_icon_state = "coil" + base_icon_state = "coil2" /obj/item/stack/cable_coil/cut/Initialize(mapload, new_amount, merge = TRUE, list/mat_override=null, mat_amt=1) if(!amount) @@ -605,7 +615,7 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri . = ..() pixel_x = base_pixel_x + rand(-2, 2) pixel_y = base_pixel_y + rand(-2, 2) - update_icon() + update_appearance() #undef CABLE_RESTRAINTS_COST #undef UNDER_SMES @@ -648,18 +658,14 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri vis_flags = VIS_INHERIT_ID|VIS_INHERIT_PLANE|VIS_INHERIT_LAYER|VIS_UNDERLAY /obj/structure/cable/multilayer/update_icon_state() + SHOULD_CALL_PARENT(FALSE) return /obj/structure/cable/multilayer/update_icon() - machinery_node?.alpha = machinery_layer & MACHINERY_LAYER_1 ? 255 : 0 - cable_node_1?.alpha = cable_layer & CABLE_LAYER_1 ? 255 : 0 - cable_node_2?.alpha = cable_layer & CABLE_LAYER_2 ? 255 : 0 - cable_node_3?.alpha = cable_layer & CABLE_LAYER_3 ? 255 : 0 - return ..() /obj/structure/cable/multilayer/Initialize(mapload) @@ -680,7 +686,7 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri vis_contents += cable_node_2 cable_node_3 = new /obj/effect/node/layer3() vis_contents += cable_node_3 - update_icon() + update_appearance() /obj/structure/cable/multilayer/Destroy() // called when a cable is deleted QDEL_NULL(machinery_node) diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index d8098f92b07..d5c6e62ac69 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -36,7 +36,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/create_reagents(max_vol, flags) . = ..() @@ -55,10 +55,7 @@ . += mutable_appearance('icons/obj/power.dmi', "grown_wires") if(charge < 0.01) return - else if(charge/maxcharge >=0.995) - . += mutable_appearance('icons/obj/power.dmi', "cell-o2") - else - . += mutable_appearance('icons/obj/power.dmi', "cell-o1") + . += mutable_appearance('icons/obj/power.dmi', "cell-o[((charge / maxcharge) >= 0.995) ? 2 : 1]") /obj/item/stock_parts/cell/proc/percent() // return % charge of cell return 100*charge/maxcharge @@ -203,7 +200,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 +222,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" @@ -266,7 +263,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" @@ -279,7 +276,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" @@ -292,7 +289,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" @@ -306,7 +303,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!" @@ -355,7 +352,7 @@ /obj/item/stock_parts/cell/emproof/empty/Initialize() . = ..() charge = 0 - update_icon() + update_appearance() /obj/item/stock_parts/cell/emproof/corrupt() return diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index aac314828dc..37baf3b5724 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -20,7 +20,7 @@ find_circs() connect_to_network() SSair.start_processing_machine(src) - update_icon() + update_appearance() /obj/machinery/power/generator/ComponentInitialize() . = ..() @@ -33,13 +33,14 @@ /obj/machinery/power/generator/update_overlays() . = ..() - if(!(machine_stat & (NOPOWER|BROKEN))) - var/L = min(round(lastgenlev/100000),11) - if(L != 0) - . += mutable_appearance('icons/obj/power.dmi', "teg-op[L]") + if(machine_stat & (NOPOWER|BROKEN)) + return - if(hot_circ && cold_circ) - . += "teg-oc[lastcirc]" + var/L = min(round(lastgenlev / 100000), 11) + if(L != 0) + . += mutable_appearance('icons/obj/power.dmi', "teg-op[L]") + if(hot_circ && cold_circ) + . += "teg-oc[lastcirc]" #define GENRATE 800 // generator output coefficient from Q @@ -83,12 +84,12 @@ var/datum/gas_mixture/cold_circ_air1 = cold_circ.airs[1] cold_circ_air1.merge(cold_air) - update_icon() + update_appearance() var/circ = "[cold_circ?.last_pressure_delta > 0 ? "1" : "0"][hot_circ?.last_pressure_delta > 0 ? "1" : "0"]" if(circ != lastcirc) lastcirc = circ - update_icon() + update_appearance() src.updateDialog() diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm index 3a13bb34a05..b2d055840c7 100644 --- a/code/modules/power/gravitygenerator.dm +++ b/code/modules/power/gravitygenerator.dm @@ -52,6 +52,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne /obj/machinery/gravity_generator/update_icon_state() icon_state = "[get_status()]_[sprite_number]" + return ..() /obj/machinery/gravity_generator/proc/get_status() return "off" @@ -95,6 +96,11 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne 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. // @@ -161,8 +167,8 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne 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 @@ -185,7 +191,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne if(M.machine_stat & BROKEN) M.set_fix() broken_state = FALSE - update_icon() + update_appearance() set_power() // Interaction @@ -198,14 +204,14 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne 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)) @@ -215,7 +221,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne 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 @@ -278,7 +284,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne 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) @@ -301,7 +307,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne 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 c8a8f5031d6..a9696cea489 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -93,7 +93,7 @@ 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) @@ -398,18 +398,21 @@ icon_state = "[base_state]-burned" if(LIGHT_BROKEN) icon_state = "[base_state]-broken" + return ..() /obj/machinery/light/update_overlays() . = ..() - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) - if(on && status == LIGHT_OK) - var/area/A = get_area(src) - if(emergency_mode || (A?.fire)) - SSvis_overlays.add_vis_overlay(src, overlayicon, "[base_state]_emergency", layer, plane, dir) - else if (nightshift_enabled) - SSvis_overlays.add_vis_overlay(src, overlayicon, "[base_state]_nightshift", layer, plane, dir) - else - SSvis_overlays.add_vis_overlay(src, overlayicon, base_state, layer, plane, dir) + if(!on || status != LIGHT_OK) + return + + var/area/A = get_area(src) + if(emergency_mode || (A?.fire)) + SSvis_overlays.add_vis_overlay(src, overlayicon, "[base_state]_emergency", layer, plane, dir) + return + if(nightshift_enabled) + SSvis_overlays.add_vis_overlay(src, overlayicon, "[base_state]_nightshift", layer, plane, dir) + return + SSvis_overlays.add_vis_overlay(src, overlayicon, base_state, layer, plane, dir) //SKYRAT EDIT ADDITION BEGIN - AESTHETICS #define LIGHT_ON_DELAY_UPPER 3 SECONDS @@ -465,7 +468,7 @@ 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/pipecleaners.dm b/code/modules/power/pipecleaners.dm index 59fe0f8dbc9..894527f66ea 100644 --- a/code/modules/power/pipecleaners.dm +++ b/code/modules/power/pipecleaners.dm @@ -90,7 +90,7 @@ By design, d1 is the smallest direction and d2 is the highest var/list/pipe_cleaner_colors = GLOB.pipe_cleaner_colors var/random_color = pick(pipe_cleaner_colors) color = pipe_cleaner_colors[random_color] - update_icon() + update_appearance() /obj/structure/pipe_cleaner/Destroy() // called when a pipe_cleaner is deleted //If we have a stored item at this point, lets just delete it, since that should be @@ -113,8 +113,12 @@ By design, d1 is the smallest direction and d2 is the highest // General procedures /////////////////////////////////// -/obj/structure/pipe_cleaner/update_icon() +/obj/structure/pipe_cleaner/update_icon_state() icon_state = "[d1]-[d2]" + return ..() + +/obj/structure/pipe_cleaner/update_icon() + . = ..() add_atom_colour(color, FIXED_COLOUR_PRIORITY) // Items usable on a pipe_cleaner : @@ -152,7 +156,7 @@ By design, d1 is the smallest direction and d2 is the highest /obj/structure/pipe_cleaner/proc/update_stored(length = 1, colorC = COLOR_RED) stored.amount = length stored.color = colorC - stored.update_icon() + stored.update_appearance() /obj/structure/pipe_cleaner/AltClick(mob/living/user) if(!user.canUseTopic(src, BE_CLOSE)) @@ -210,7 +214,7 @@ By design, d1 is the smallest direction and d2 is the highest if(!selected_color) return color = pipe_cleaner_colors[selected_color] - update_icon() + update_appearance() /** * Checks if we are allowed to interact with a radial menu @@ -246,15 +250,22 @@ By design, d1 is the smallest direction and d2 is the highest pixel_x = base_pixel_x + rand(-2, 2) pixel_y = base_pixel_y + rand(-2, 2) - update_icon() + update_appearance() /////////////////////////////////// // General procedures /////////////////////////////////// -/obj/item/stack/pipe_cleaner_coil/update_icon() - icon_state = "[initial(inhand_icon_state)][amount < 3 ? amount : ""]" +/obj/item/stack/pipe_cleaner_coil/update_name() + . = ..() name = "pipe cleaner [amount < 3 ? "piece" : "coil"]" + +/obj/item/stack/pipe_cleaner_coil/update_icon_state() + . = ..() + icon_state = "[initial(inhand_icon_state)][amount < 3 ? amount : ""]" + +/obj/item/stack/pipe_cleaner_coil/update_icon() + . = ..() add_atom_colour(color, FIXED_COLOUR_PRIORITY) /obj/item/stack/pipe_cleaner_coil/attack_hand(mob/user, list/modifiers) @@ -264,7 +275,7 @@ By design, d1 is the smallest direction and d2 is the highest var/obj/item/stack/pipe_cleaner_coil/new_pipe_cleaner = ..() if(istype(new_pipe_cleaner)) new_pipe_cleaner.color = color - new_pipe_cleaner.update_icon() + new_pipe_cleaner.update_appearance() //add pipe_cleaners to the stack /obj/item/stack/pipe_cleaner_coil/proc/give(extra) @@ -272,7 +283,7 @@ By design, d1 is the smallest direction and d2 is the highest amount = max_amount else amount += extra - update_icon() + update_appearance() /////////////////////////////////////////////// // Cable laying procedures @@ -319,7 +330,7 @@ By design, d1 is the smallest direction and d2 is the highest C.d1 = 0 //it's a O-X node pipe_cleaner C.d2 = dirn C.add_fingerprint(user) - C.update_icon() + C.update_appearance() use(1) @@ -373,7 +384,7 @@ By design, d1 is the smallest direction and d2 is the highest NC.d1 = 0 NC.d2 = fdirn NC.add_fingerprint(user) - NC.update_icon() + NC.update_appearance() use(1) @@ -401,7 +412,7 @@ By design, d1 is the smallest direction and d2 is the highest return - C.update_icon() + C.update_appearance() C.d1 = nd1 C.d2 = nd2 @@ -410,7 +421,7 @@ By design, d1 is the smallest direction and d2 is the highest C.update_stored(2, color) C.add_fingerprint(user) - C.update_icon() + C.update_appearance() use(1) @@ -460,7 +471,7 @@ By design, d1 is the smallest direction and d2 is the highest . = ..() pixel_x = base_pixel_x + rand(-2, 2) pixel_y = base_pixel_y + rand(-2, 2) - update_icon() + update_appearance() /obj/item/stack/pipe_cleaner_coil/cut/red color = COLOR_RED diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index 004143e415b..214c0ff7a47 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -48,16 +48,17 @@ /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/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 e7714e166e9..3f9623cf671 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -184,7 +184,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 or a terminal is present on the turf /obj/machinery/power/proc/connect_to_network() @@ -269,7 +269,7 @@ /proc/update_cable_icons_on_turf(turf/T) for(var/obj/structure/cable/C in T.contents) - C.update_icon() + C.update_appearance() /////////////////////////////////////////// // GLOBAL PROCS for powernets handling @@ -422,7 +422,7 @@ return null for(var/obj/structure/cable/C in src) if(C.machinery_layer & machinery_layer) - C.update_icon() + C.update_appearance() return C return null diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm index 987f5915c8b..014b3874bc4 100644 --- a/code/modules/power/singularity/collector.dm +++ b/code/modules/power/singularity/collector.dm @@ -97,7 +97,7 @@ if(!user.transferItemToLoc(W, src)) return loaded_tank = W - update_icon() + update_appearance() else if(W.GetID()) if(allowed(user)) if(active) @@ -171,7 +171,7 @@ if(active) toggle_power() else - update_icon() + update_appearance() /obj/machinery/power/rad_collector/rad_act(pulse_strength) . = ..() @@ -195,7 +195,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 3e82d209fdc..fc9e44eed68 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 OVERRIDEN IN SKYRAT AESTHETICS - SEE MODULE icon_state = "emitter" + base_icon_state = "emitter" anchored = FALSE density = TRUE @@ -13,7 +14,9 @@ idle_power_usage = 10 active_power_usage = 300 + /// The icon state used by the emitter when it's on. var/icon_state_on = "emitter_+a" + /// The icon state used by the emitter when it's on and low on power. var/icon_state_underpowered = "emitter_+u" var/active = FALSE var/powered = FALSE @@ -133,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) @@ -158,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!") @@ -180,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 @@ -372,8 +376,10 @@ name = "Prototype Emitter" icon = 'icons/obj/turrets.dmi' icon_state = "protoemitter" + base_icon_state = "protoemitter" icon_state_on = "protoemitter_+a" icon_state_underpowered = "protoemitter_+u" + base_icon_state = "protoemitter" can_buckle = TRUE buckle_lying = 0 var/view_range = 4.5 diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index 9273d4cee7a..09d80158f84 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -183,7 +183,7 @@ no power level overlay is currently in the overlays list. var/new_level = round(6 * 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 @@ -196,7 +196,7 @@ no power level overlay is currently in the overlays list. if(active || warming_up <= 0) return warming_up-- - update_icon() + update_appearance() if(warming_up > 0) addtimer(CALLBACK(src, .proc/cool_down), 50) @@ -208,7 +208,7 @@ no power level overlay is currently in the overlays list. if(!active) return warming_up++ - update_icon() + update_appearance() if(warming_up >= 3) start_fields() else @@ -322,7 +322,7 @@ no power level overlay is currently in the overlays list. connected_gens |= G G.connected_gens |= src shield_floor(TRUE) - update_icon() + update_appearance() /obj/machinery/field/generator/proc/cleanup() @@ -339,7 +339,7 @@ no power level overlay is currently in the overlays list. FG.cleanup() connected_gens -= FG clean_up = 0 - update_icon() + update_appearance() move_resist = initial(move_resist) diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 39cc3cd0a8e..dfda7979383 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -58,7 +58,7 @@ obj_break() return terminal.master = src - update_icon() + update_appearance() /obj/machinery/power/smes/RefreshParts() var/IO = 0 @@ -81,7 +81,7 @@ /obj/machinery/power/smes/attackby(obj/item/I, mob/user, params) //opening using screwdriver if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-o", initial(icon_state), I)) - update_icon() + update_appearance() return //changing direction using wrench @@ -98,7 +98,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 @@ -211,18 +211,11 @@ if(panel_open) return - if(outputting) - . += "smes-op1" - else - . += "smes-op0" - - if(inputting) - . += "smes-oc1" - else if(input_attempt) - . += "smes-oc0" + . += "smes-op[outputting ? 1 : 0]" + . += "smes-oc[inputting ? 1 : 0]" var/clevel = chargedisplay() - if(clevel>0) + if(clevel > 0) . += "smes-og[clevel]" @@ -282,7 +275,7 @@ // only update icon if state changed if(last_disp != chargedisplay() || last_chrg != inputting || last_onln != outputting) - update_icon() + update_appearance() @@ -312,7 +305,7 @@ output_used -= excess if(clev != chargedisplay() ) //if needed updates the icons overlay - update_icon() + update_appearance() return @@ -350,12 +343,12 @@ if("tryinput") input_attempt = !input_attempt log_smes(usr) - update_icon() + update_appearance() . = TRUE if("tryoutput") output_attempt = !output_attempt log_smes(usr) - update_icon() + update_appearance() . = TRUE if("input") var/target = params["target"] @@ -411,7 +404,7 @@ charge -= 1e6/severity if (charge < 0) charge = 0 - 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 77bd57ba132..a69743ad5cf 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -114,10 +114,7 @@ var/matrix/turner = matrix() turner.Turn(azimuth_current) panel.transform = turner - if(machine_stat & BROKEN) - panel.icon_state = "solar_panel-b" - else - panel.icon_state = "solar_panel" + panel.icon_state = "solar_panel[(machine_stat & BROKEN) ? "-b" : null]" /obj/machinery/power/solar/proc/queue_turn(azimuth) needs_to_turn = TRUE @@ -133,7 +130,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 @@ -346,11 +343,12 @@ if(machine_stat & NOPOWER) . += mutable_appearance(icon, "[icon_keyboard]_off") return + . += 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) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index 836fb1c393e..78a4f72bb51 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -410,7 +410,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()) @@ -418,7 +418,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 b8d7b3a0bdb..3817e5ecfee 100644 --- a/code/modules/projectiles/ammunition/_ammunition.dm +++ b/code/modules/projectiles/ammunition/_ammunition.dm @@ -44,7 +44,7 @@ pixel_x = base_pixel_x + rand(-10, 10) pixel_y = base_pixel_y + rand(-10, 10) setDir(pick(GLOB.alldirs)) - update_icon() + update_appearance() /obj/item/ammo_casing/Destroy() . = ..() @@ -54,10 +54,13 @@ SSblackbox.record_feedback("tally", "station_mess_destroyed", 1, name) QDEL_NULL(loaded_projectile) -/obj/item/ammo_casing/update_icon() - . = ..() - icon_state = "[initial(icon_state)][loaded_projectile ? "-live" : ""]" - desc = "[initial(desc)][loaded_projectile ? "" : " This one is spent."]" +/obj/item/ammo_casing/update_icon_state() + icon_state = "[initial(icon_state)][loaded_projectile ? "-live" : null]" + return ..() + +/obj/item/ammo_casing/update_desc() + desc = "[initial(desc)][loaded_projectile ? null : " This one is spent."]" + return ..() /* * On accidental consumption, 'spend' the ammo, and add in some gunpowder @@ -65,7 +68,7 @@ /obj/item/ammo_casing/on_accidental_consumption(mob/living/carbon/victim, mob/living/carbon/user, obj/item/source_item, discover_after = TRUE) if(loaded_projectile) loaded_projectile = null - update_icon() + update_appearance() victim.reagents?.add_reagent(/datum/reagent/gunpowder, 3) source_item?.reagents?.add_reagent(/datum/reagent/gunpowder, source_item.reagents.total_volume*(2/3)) @@ -90,7 +93,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!") @@ -104,7 +107,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?.bullet_sizzle) diff --git a/code/modules/projectiles/ammunition/_firing.dm b/code/modules/projectiles/ammunition/_firing.dm index 489769c5e09..e6c4bf496e7 100644 --- a/code/modules/projectiles/ammunition/_firing.dm +++ b/code/modules/projectiles/ammunition/_firing.dm @@ -24,7 +24,7 @@ else user.changeNext_move(CLICK_CD_RANGE) //SKYRAT EDIT END 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/caseless/_caseless.dm b/code/modules/projectiles/ammunition/caseless/_caseless.dm index db1aa6562c4..6718e88a872 100644 --- a/code/modules/projectiles/ammunition/caseless/_caseless.dm +++ b/code/modules/projectiles/ammunition/caseless/_caseless.dm @@ -11,6 +11,6 @@ else return FALSE -/obj/item/ammo_casing/caseless/update_icon() - ..() +/obj/item/ammo_casing/caseless/update_icon_state() + . = ..() icon_state = "[initial(icon_state)]" diff --git a/code/modules/projectiles/ammunition/caseless/foam.dm b/code/modules/projectiles/ammunition/caseless/foam.dm index f36fccfe353..b9f3ffb574a 100644 --- a/code/modules/projectiles/ammunition/caseless/foam.dm +++ b/code/modules/projectiles/ammunition/caseless/foam.dm @@ -5,23 +5,23 @@ caliber = CALIBER_FOAM 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() - ..() - if (modified) - icon_state = "foamdart_empty" - desc = "It's Donk or Don't! ... Although, this one doesn't look too safe." - if(loaded_projectile) - loaded_projectile.icon_state = "foamdart_empty" - else - icon_state = initial(icon_state) - desc = "It's Donk or Don't! Ages 8 and up." - if(loaded_projectile) - loaded_projectile.icon_state = initial(loaded_projectile.icon_state) +/obj/item/ammo_casing/caseless/foam_dart/update_icon_state() + . = ..() + if(modified) + icon_state = "[base_icon_state]_empty" + loaded_projectile?.icon_state = "[base_icon_state]_empty" + return + icon_state = "[base_icon_state]" + loaded_projectile?.icon_state = "[loaded_projectile.base_icon_state]" +/obj/item/ammo_casing/caseless/foam_dart/update_desc() + . = ..() + desc = "It's Donk or Don't! [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 = loaded_projectile @@ -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 15f63bc01fd..399447b0e14 100644 --- a/code/modules/projectiles/boxes_magazines/_box_magazine.dm +++ b/code/modules/projectiles/boxes_magazines/_box_magazine.dm @@ -40,7 +40,6 @@ bullet_cost = SSmaterials.FindOrCreateMaterialCombo(custom_materials, 0.9 / max_ammo) if(!start_empty) top_off(starting=TRUE) - update_icon() /** * top_off is used to refill the magazine to max, in case you want to increase the size of a magazine with VV then refill it at once @@ -60,7 +59,7 @@ for(var/i = max(1, stored_ammo.len), i <= max_ammo, i++) stored_ammo += new round_check() //SKYRAT EDTI CHANGE - SEC_HUAL - Moving to nullspace seems to help with lag. - update_icon() + update_ammo_count() ///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) @@ -113,32 +112,47 @@ 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() + if(!A) + return -/obj/item/ammo_box/update_icon() - var/shells_left = stored_ammo.len + 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]" @@ -149,13 +163,15 @@ icon_state = "[initial(icon_state)]-[shells_left ? "full" : "empty"]" //SKYRAT EDIT END desc = "[initial(desc)] There [(shells_left == 1) ? "is" : "are"] [shells_left] shell\s left!" - if(length(bullet_cost)) - var/temp_materials = custom_materials.Copy() - for (var/material in bullet_cost) - var/material_amount = bullet_cost[material] - material_amount = (material_amount*stored_ammo.len) + base_cost[material] - temp_materials[material] = material_amount - set_custom_materials(temp_materials) + update_custom_materials() + 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) @@ -181,7 +197,7 @@ /obj/item/ammo_box/magazine/handle_atom_del(atom/A) stored_ammo -= A - update_icon() + update_ammo_count() //SKRYAT EDIT ADDITION BEGIN - SEC_HAUL /obj/item/ammo_box/Destroy() diff --git a/code/modules/projectiles/boxes_magazines/external/lmg.dm b/code/modules/projectiles/boxes_magazines/external/lmg.dm index 6108455d3c9..49664272fa0 100644 --- a/code/modules/projectiles/boxes_magazines/external/lmg.dm +++ b/code/modules/projectiles/boxes_magazines/external/lmg.dm @@ -29,6 +29,6 @@ name = "hi-cap box magazine (Rubber 7.12x82mm)" max_ammo = 150 -/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 = "a762-[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 d1c95db4bb5..91d76ab1d74 100644 --- a/code/modules/projectiles/boxes_magazines/external/pistol.dm +++ b/code/modules/projectiles/boxes_magazines/external/pistol.dm @@ -10,27 +10,26 @@ /obj/item/ammo_box/magazine/m45 name = "handgun magazine (.45)" icon_state = "45-8" + base_icon_state = "45" ammo_type = /obj/item/ammo_casing/c45 caliber = CALIBER_45 max_ammo = 8 -/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/m9mm name = "pistol magazine (9mm)" icon_state = "9x19p-8" + base_icon_state = "9x19p" ammo_type = /obj/item/ammo_casing/c9mm caliber = CALIBER_9MM max_ammo = 8 -/obj/item/ammo_box/magazine/m9mm/update_icon() - ..() - icon_state = "9x19p-[ammo_count() ? "8" : "0"]" +/obj/item/ammo_box/magazine/m9mm/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[ammo_count() ? "8" : "0"]" /obj/item/ammo_box/magazine/m9mm/fire name = "pistol magazine (9mm incendiary)" @@ -53,13 +52,14 @@ /obj/item/ammo_box/magazine/m9mm_aps name = "stechkin pistol magazine (9mm)" icon_state = "9mmaps-15" + base_icon_state = "9mmaps" ammo_type = /obj/item/ammo_casing/c9mm caliber = CALIBER_9MM max_ammo = 15 -/obj/item/ammo_box/magazine/m9mm_aps/update_icon() +/obj/item/ammo_box/magazine/m9mm_aps/update_icon_state() . = ..() - icon_state = "9mmaps-[round(ammo_count(),5)]" + icon_state = "[base_icon_state]-[round(ammo_count(), 5)]" /obj/item/ammo_box/magazine/m9mm_aps/fire name = "stechkin pistol magazine (9mm incendiary)" diff --git a/code/modules/projectiles/boxes_magazines/external/rechargable.dm b/code/modules/projectiles/boxes_magazines/external/rechargable.dm index fc86cd23f29..9e1e2597a66 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 = 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 6c5c2e334ea..14c1d1550bd 100644 --- a/code/modules/projectiles/boxes_magazines/external/rifle.dm +++ b/code/modules/projectiles/boxes_magazines/external/rifle.dm @@ -2,15 +2,13 @@ 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 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)" diff --git a/code/modules/projectiles/boxes_magazines/external/shotgun.dm b/code/modules/projectiles/boxes_magazines/external/shotgun.dm index 542d346a33e..f9b7a4fe83a 100644 --- a/code/modules/projectiles/boxes_magazines/external/shotgun.dm +++ b/code/modules/projectiles/boxes_magazines/external/shotgun.dm @@ -2,13 +2,14 @@ name = "shotgun magazine (12g buckshot slugs)" desc = "A drum magazine." icon_state = "m12gb" + base_icon_state = "m12gb" ammo_type = /obj/item/ammo_casing/shotgun/buckshot caliber = 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 magazine (12g taser slugs)" diff --git a/code/modules/projectiles/boxes_magazines/external/smg.dm b/code/modules/projectiles/boxes_magazines/external/smg.dm index f8a9f9151da..34ecf436f71 100644 --- a/code/modules/projectiles/boxes_magazines/external/smg.dm +++ b/code/modules/projectiles/boxes_magazines/external/smg.dm @@ -1,67 +1,70 @@ /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 = CALIBER_46X30MM 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" + base_icon_state = "46x30mmtI" 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/plastikov9mm name = "PP-95 magazine (9x19mm)" - icon_state = CALIBER_9X19MM + icon_state = "9x19-50" + base_icon_state = "9x19" ammo_type = /obj/item/ammo_casing/c9x19mm caliber = CALIBER_9X19MM max_ammo = 50 -/obj/item/ammo_box/magazine/plastikov9mm/update_icon() +/obj/item/ammo_box/magazine/plastikov9mm/update_icon_state() . = ..() - if(ammo_count()) - icon_state = "9x19-50" - return - icon_state = "9x19-0" + icon_state = "[base_icon_state]-[ammo_count() ? 50 : 0]" /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 = 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 = CALIBER_9MM max_ammo = 21 -/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)" @@ -74,13 +77,14 @@ /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 = CALIBER_45 max_ammo = 24 -/obj/item/ammo_box/magazine/smgm45/update_icon() - ..() - icon_state = "c20r45-[round(ammo_count(),2)]" +/obj/item/ammo_box/magazine/smgm45/update_icon_state() + . = ..() + icon_state = "[base_icon_state]-[round(ammo_count(), 2)]" /obj/item/ammo_box/magazine/smgm45/ap name = "SMG magazine (Armour Piercing .45)" diff --git a/code/modules/projectiles/boxes_magazines/external/sniper.dm b/code/modules/projectiles/boxes_magazines/external/sniper.dm index f87c872a023..ee249d70989 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 = 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 f285fed9835..f972461de8a 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 = CALIBER_FOAM 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,12 +45,13 @@ /obj/item/ammo_box/magazine/toy/m762 name = "donksoft box magazine" icon_state = "a762-toy" + base_icon_state = "a762" 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/boxes_magazines/internal/_cylinder.dm b/code/modules/projectiles/boxes_magazines/internal/_cylinder.dm index 59d6519ec22..c84ae96b9d8 100644 --- a/code/modules/projectiles/boxes_magazines/internal/_cylinder.dm +++ b/code/modules/projectiles/boxes_magazines/internal/_cylinder.dm @@ -58,4 +58,4 @@ for(var/i = 1, i <= max_ammo, i++) if(!give_round(new load_type(src))) break - update_icon() + update_appearance() diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 88ecbf092bb..5d521353e86 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -108,7 +108,7 @@ pin = null if(A == chambered) chambered = null - update_icon() + update_appearance() if(A == bayonet) clear_bayonet() if(A == gun_light) @@ -122,7 +122,7 @@ if(!can_unsuppress) return suppressed = null - update_icon() + update_appearance() /obj/item/gun/examine(mob/user) . = ..() @@ -325,7 +325,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) @@ -373,7 +373,7 @@ shoot_with_empty_chamber(user) return process_chamber() - update_icon() + update_appearance() semicd = TRUE addtimer(CALLBACK(src, .proc/reset_semicd), fire_delay) @@ -426,7 +426,7 @@ return to_chat(user, "You attach [K] to [src]'s bayonet lug.") bayonet = K - update_icon() + update_appearance() else return ..() @@ -513,7 +513,7 @@ if(!bayonet) return bayonet = null - update_icon() + update_appearance() return TRUE /obj/item/gun/proc/clear_gunlight() @@ -574,7 +574,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 b4f868abf82..d0b34668f59 100644 --- a/code/modules/projectiles/guns/ballistic.dm +++ b/code/modules/projectiles/guns/ballistic.dm @@ -115,7 +115,7 @@ . = ..() if (!spawnwithmagazine) bolt_locked = TRUE - update_icon() + update_appearance() return if (!magazine) magazine = new mag_type(src) @@ -123,19 +123,20 @@ chamber_round() else chamber_round(replace_new_round = TRUE) - update_icon() + update_appearance() RegisterSignal(src, COMSIG_ITEM_RECHARGED, .proc/instant_reload) /obj/item/gun/ballistic/vv_edit_var(vname, vval) . = ..() if(vname in list(NAMEOF(src, suppressor_x_offset), NAMEOF(src, suppressor_y_offset), NAMEOF(src, internal_magazine), NAMEOF(src, magazine), NAMEOF(src, chambered), NAMEOF(src, empty_indicator), NAMEOF(src, sawn_off), NAMEOF(src, bolt_locked), NAMEOF(src, bolt_type))) - 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() . = ..() @@ -144,42 +145,50 @@ . += "[icon_state]_bolt[bolt_locked ? "_locked" : ""]" if (bolt_type == BOLT_TYPE_OPEN && bolt_locked) . += "[icon_state]_bolt" - if (suppressed) + + if(suppressed) var/mutable_appearance/MA = mutable_appearance(icon, "[icon_state]_suppressor") if(suppressor_x_offset) MA.pixel_x = suppressor_x_offset if(suppressor_y_offset) MA.pixel_y = suppressor_y_offset . += MA + if(!chambered && empty_indicator) //this is duplicated in c20's update_overlayss due to a layering issue with the select fire icon. . += "[icon_state]_empty" if(gun_flags & TOY_FIREARM_OVERLAY) . += "[icon_state]_toy" - if (magazine && !internal_magazine) - if (special_mags) - . += "[icon_state]_mag_[initial(magazine.icon_state)]" - if (mag_display_ammo && !magazine.ammo_count()) - . += "[icon_state]_mag_empty" - else - . += "[icon_state]_mag" - if(!mag_display_ammo) - return - var/capacity_number - switch(get_ammo() / magazine.max_ammo) - if(1 to INFINITY) //cause we can have one in the chamber. - capacity_number = 100 - if(0.8 to 1) - capacity_number = 80 - if(0.6 to 0.8) - capacity_number = 60 - if(0.4 to 0.6) - capacity_number = 40 - if(0.2 to 0.4) - capacity_number = 20 - if (capacity_number) - . += "[icon_state]_mag_[capacity_number]" + + if(!magazine || internal_magazine) + return + + if(special_mags) + . += "[icon_state]_mag_[initial(magazine.icon_state)]" + if(mag_display_ammo && !magazine.ammo_count()) + . += "[icon_state]_mag_empty" + return + + . += "[icon_state]_mag" + if(!mag_display_ammo) + return + + var/capacity_number + switch(get_ammo() / magazine.max_ammo) + if(1 to INFINITY) //cause we can have one in the chamber. + capacity_number = 100 + if(0.8 to 1) + capacity_number = 80 + if(0.6 to 0.8) + capacity_number = 60 + if(0.4 to 0.6) + capacity_number = 40 + if(0.2 to 0.4) + capacity_number = 20 + if(capacity_number) + . += "[icon_state]_mag_[capacity_number]" + /obj/item/gun/ballistic/process_chamber(empty_chamber = TRUE, from_firing = TRUE, chamber_next_round = TRUE) if(!semi_auto && from_firing) @@ -224,7 +233,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) @@ -233,7 +242,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) @@ -247,7 +256,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!") @@ -272,10 +281,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 @@ -305,8 +314,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 @@ -354,7 +363,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/clear_suppressor() if(!can_unsuppress) @@ -383,17 +392,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() @@ -436,7 +445,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 @@ -550,7 +559,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 /obj/item/gun/ballistic/proc/guncleaning(mob/user, /obj/item/A) @@ -624,7 +633,7 @@ GLOBAL_LIST_INIT(gun_saw_types, typecacheof(list( return magazine = new mag_type(src) chamber_round() - update_icon() + update_appearance() /obj/item/suppressor name = "suppressor" diff --git a/code/modules/projectiles/guns/ballistic/automatic.dm b/code/modules/projectiles/guns/ballistic/automatic.dm index 64f75c7b227..643259cdd27 100644 --- a/code/modules/projectiles/guns/ballistic/automatic.dm +++ b/code/modules/projectiles/guns/ballistic/automatic.dm @@ -32,10 +32,12 @@ . = ..() if(!selector_switch_icon) return - if(!select) - . += "[initial(icon_state)]_semi" - if(select == 1) - . += "[initial(icon_state)]_burst" + + switch(select) + if(0) + . += "[initial(icon_state)]_semi" + if(1) + . += "[initial(icon_state)]_burst" /obj/item/gun/ballistic/automatic/ui_action_click(mob/user, actiontype) if(istype(actiontype, /datum/action/item_action/toggle_firemode)) @@ -56,7 +58,7 @@ to_chat(user, "You switch to [burst_size]-round 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() @@ -88,7 +90,7 @@ /obj/item/gun/ballistic/automatic/c20r/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/gun/ballistic/automatic/wt550 name = "security auto rifle" @@ -154,7 +156,7 @@ /obj/item/gun/ballistic/automatic/m90/Initialize() . = ..() underbarrel = new /obj/item/gun/ballistic/revolver/grenadelauncher(src) - update_icon() + update_appearance() /obj/item/gun/ballistic/automatic/m90/unrestricted pin = /obj/item/firing_pin @@ -162,7 +164,7 @@ /obj/item/gun/ballistic/automatic/m90/unrestricted/Initialize() . = ..() underbarrel = new /obj/item/gun/ballistic/revolver/grenadelauncher/unrestricted(src) - update_icon() + update_appearance() /obj/item/gun/ballistic/automatic/m90/afterattack_secondary(atom/target, mob/living/user, flag, params) underbarrel.afterattack(target, user, flag, params) @@ -198,7 +200,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/tommygun @@ -236,6 +238,7 @@ desc = "A heavily modified 7.12x82mm light machine gun, designated 'L6 SAW'. Has 'Aussec Armoury - 2531' engraved on the receiver below the designation." icon_state = "l6" inhand_icon_state = "l6" + base_icon_state = "l6" w_class = WEIGHT_CLASS_HUGE slot_flags = 0 mag_type = /obj/item/ammo_box/magazine/mm712x82 @@ -277,10 +280,11 @@ cover_open = !cover_open to_chat(user, "You [cover_open ? "open" : "close"] [src]'s cover.") playsound(src, 'sound/weapons/gun/l6/l6_door.ogg', 60, TRUE) - update_icon() + update_appearance() /obj/item/gun/ballistic/automatic/l6_saw/update_icon_state() - inhand_icon_state = "[initial(icon_state)][cover_open ? "open" : "closed"][magazine ? "mag":"nomag"]" + . = ..() + inhand_icon_state = "[base_icon_state][cover_open ? "open" : "closed"][magazine ? "mag":"nomag"]" /obj/item/gun/ballistic/automatic/l6_saw/update_overlays() . = ..() @@ -293,7 +297,7 @@ return else . = ..() - update_icon() + update_appearance() //ATTACK HAND IGNORING PARENT RETURN VALUE /obj/item/gun/ballistic/automatic/l6_saw/attack_hand(mob/user, list/modifiers) diff --git a/code/modules/projectiles/guns/ballistic/laser_gatling.dm b/code/modules/projectiles/guns/ballistic/laser_gatling.dm index a48bd5cbec7..45f07241567 100644 --- a/code/modules/projectiles/guns/ballistic/laser_gatling.dm +++ b/code/modules/projectiles/guns/ballistic/laser_gatling.dm @@ -39,7 +39,7 @@ armed = FALSE 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!") @@ -75,10 +75,8 @@ /obj/item/minigunpack/update_icon_state() - if(armed) - icon_state = "notholstered" - else - icon_state = "holstered" + icon_state = armed ? "notholstered" : "holstered" + return ..() /obj/item/minigunpack/proc/attach_gun(mob/user) if(!gun) @@ -89,7 +87,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/ballistic/revolver.dm b/code/modules/projectiles/guns/ballistic/revolver.dm index ddca6c51197..a31d867857f 100644 --- a/code/modules/projectiles/guns/ballistic/revolver.dm +++ b/code/modules/projectiles/guns/ballistic/revolver.dm @@ -188,8 +188,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 dfcdd96fe8f..14b39533a79 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) @@ -70,7 +70,7 @@ if(.) spread = 36 can_bayonet = FALSE - update_icon() + update_appearance() /* - SKYRAT EDIT REMOVAL /obj/item/gun/ballistic/rifle/boltaction/attack_self(mob/user) diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index 0a9202b7376..51533ec5bad 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -26,7 +26,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 @@ -43,7 +43,7 @@ recharge_newshot(TRUE) if(selfcharge) START_PROCESSING(SSobj, src) - update_icon() + update_appearance() RegisterSignal(src, COMSIG_ITEM_RECHARGED, .proc/instant_recharge) /obj/item/gun/energy/ComponentInitialize() @@ -69,7 +69,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(delta_time) @@ -81,12 +81,12 @@ cell.give(100) 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/can_shoot() var/obj/item/ammo_casing/energy/shot = ammo_type[select] @@ -137,7 +137,7 @@ 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() @@ -145,7 +145,7 @@ var/skip_worn_icon = initial(worn_icon_state) //only build if we aren't using a preset worn icon if(skip_inhand && skip_worn_icon) //if we don't have either, don't do the math. - return + return ..() var/ratio = get_charge_ratio() var/temp_icon_to_use = initial(icon_state) @@ -158,29 +158,33 @@ inhand_icon_state = temp_icon_to_use if(!skip_worn_icon) worn_icon_state = temp_icon_to_use + return ..() /obj/item/gun/energy/update_overlays() . = ..() if(!automatic_charge_overlays) return + var/overlay_icon_state = "[icon_state]_charge" - var/ratio = get_charge_ratio() if(modifystate) var/obj/item/ammo_casing/energy/shot = ammo_type[select] overlay_icon_state += "_[shot.select_name]" . += "[icon_state]_[shot.select_name]" + + var/ratio = get_charge_ratio() if(ratio == 0) . += "[icon_state]_empty" - else - if(!shaded_charge) - var/mutable_appearance/charge_overlay = mutable_appearance(icon, overlay_icon_state) - for(var/i = ratio, i >= 1, i--) - charge_overlay.pixel_x = ammo_x_offset * (i - 1) - charge_overlay.pixel_y = ammo_y_offset * (i - 1) - . += new /mutable_appearance(charge_overlay) - else - . += "[icon_state]_charge[ratio]" + return + if(shaded_charge) + . += "[icon_state]_charge[ratio]" + return + var/mutable_appearance/charge_overlay = mutable_appearance(icon, overlay_icon_state) + for(var/i = ratio, i >= 1, i--) + charge_overlay.pixel_x = ammo_x_offset * (i - 1) + charge_overlay.pixel_y = ammo_y_offset * (i - 1) + . += new /mutable_appearance(charge_overlay) + ///Used by update_icon_state() and update_overlays() /obj/item/gun/energy/proc/get_charge_ratio() @@ -196,7 +200,7 @@ playsound(loc, fire_sound, 50, TRUE, -1) var/obj/item/ammo_casing/energy/shot = ammo_type[select] cell.use(shot.e_cost) - update_icon() + update_appearance() return(FIRELOSS) else user.visible_message("[user] panics and starts choking to death!") @@ -250,4 +254,4 @@ return cell.charge = cell.maxcharge recharge_newshot(no_cyborg_drain = TRUE) - update_icon() + update_appearance() diff --git a/code/modules/projectiles/guns/energy/dueling.dm b/code/modules/projectiles/guns/energy/dueling.dm index bd466ce41c1..2fc965cc18c 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 = loaded_projectile 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 18dfc2a0f6e..da314012344 100644 --- a/code/modules/projectiles/guns/energy/energy_gun.dm +++ b/code/modules/projectiles/guns/energy/energy_gun.dm @@ -116,7 +116,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() @@ -143,11 +143,12 @@ . = ..() 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" diff --git a/code/modules/projectiles/guns/energy/kinetic_accelerator.dm b/code/modules/projectiles/guns/energy/kinetic_accelerator.dm index 748ec85d871..73c8e123fcb 100644 --- a/code/modules/projectiles/guns/energy/kinetic_accelerator.dm +++ b/code/modules/projectiles/guns/energy/kinetic_accelerator.dm @@ -114,7 +114,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) @@ -147,7 +147,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/special.dm b/code/modules/projectiles/guns/energy/special.dm index 16bdf841757..83817a442c8 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -201,6 +201,7 @@ w_class = WEIGHT_CLASS_NORMAL inhand_icon_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 @@ -224,7 +225,8 @@ to_chat(user, "The display says, 'NO CORE INSTALLED'.") /obj/item/gun/energy/wormhole_projector/update_icon_state() - icon_state = inhand_icon_state = "[initial(icon_state)][select]" + . = ..() + icon_state = inhand_icon_state = "[base_icon_state][select]" /obj/item/gun/energy/wormhole_projector/update_ammo_types() . = ..() diff --git a/code/modules/projectiles/guns/magic.dm b/code/modules/projectiles/guns/magic.dm index e501112d6d1..3fe2435b774 100644 --- a/code/modules/projectiles/guns/magic.dm +++ b/code/modules/projectiles/guns/magic.dm @@ -94,4 +94,4 @@ /obj/item/gun/magic/proc/instant_recharge() charges = max_charges recharge_newshot() - update_icon() + update_appearance() diff --git a/code/modules/projectiles/guns/magic/wand.dm b/code/modules/projectiles/guns/magic/wand.dm index 477db8db17c..e7055bb34c3 100644 --- a/code/modules/projectiles/guns/magic/wand.dm +++ b/code/modules/projectiles/guns/magic/wand.dm @@ -4,6 +4,7 @@ ammo_type = /obj/item/ammo_casing/magic icon_state = "nothingwand" inhand_icon_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) @@ -22,7 +23,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) @@ -44,7 +46,7 @@ zap_self(user) else . = ..() - update_icon() + update_appearance() /obj/item/gun/magic/wand/proc/zap_self(mob/living/user) @@ -63,6 +65,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) @@ -100,6 +103,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) @@ -135,6 +139,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 @@ -154,6 +159,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 @@ -171,6 +177,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 @@ -202,6 +209,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 @@ -221,6 +229,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 3d30302a827..4455a12799d 100644 --- a/code/modules/projectiles/guns/misc/blastcannon.dm +++ b/code/modules/projectiles/guns/misc/blastcannon.dm @@ -8,15 +8,13 @@ desc = "A makeshift device used to concentrate a bomb's blast energy to a narrow wave. Small enough to stow in a bag." icon_state = "empty_blastcannon" inhand_icon_state = "blastcannon_empty" + base_icon_state = "blastcannon" w_class = WEIGHT_CLASS_NORMAL force = 10 fire_sound = 'sound/weapons/blastcannon.ogg' item_flags = NONE clumsy_check = FALSE randomspread = FALSE - /// The icon state used when this is loaded with a bomb. - var/icon_state_loaded = "loaded_blastcannon" - /// The TTV this contains that will be used to create the projectile var/obj/item/transfer_valve/bomb /// Additional volume added to the gasmixture used to calculate the bombs power. @@ -60,12 +58,12 @@ user.put_in_hands(bomb) user.visible_message("[user] detaches [bomb] from [src].") bomb = null - update_icon() + update_appearance() return ..() /obj/item/gun/blastcannon/update_icon_state() - . = ..() - icon_state = bomb ? icon_state_loaded : initial(icon_state) + icon_state = "[bomb ? "loaded" : "empty"]_[base_icon_state]" + return ..() /obj/item/gun/blastcannon/attackby(obj/item/transfer_valve/bomb_to_attach, mob/user) if(!istype(bomb_to_attach)) @@ -80,7 +78,7 @@ user.visible_message("[user] attaches [bomb_to_attach] to [src]!") bomb = bomb_to_attach - update_icon() + update_appearance() return TRUE /// Handles the bomb power calculations @@ -113,7 +111,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 diff --git a/code/modules/projectiles/guns/misc/bow.dm b/code/modules/projectiles/guns/misc/bow.dm index ae89913247f..2dcaacb4ff1 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 = "bow" - else - icon_state = "bow_[drawn]" + icon_state = chambered ? "bow_[drawn]" : "bow" /obj/item/gun/ballistic/bow/proc/drop_arrow() drawn = FALSE @@ -32,7 +29,7 @@ if(!chambered) return chambered.forceMove(drop_location()) - update_icon() + update_appearance() /obj/item/gun/ballistic/bow/chamber_round(keep_bullet = FALSE, spin_cylinder, replace_new_round) if(chambered || !magazine) @@ -45,7 +42,7 @@ if(chambered) to_chat(user, "You [drawn ? "release the tension on" : "draw the string on"] [src].") drawn = !drawn - update_icon() + update_appearance() /obj/item/gun/ballistic/bow/afterattack(atom/target, mob/living/user, flag, params, passthrough = FALSE) if(!chambered) @@ -53,11 +50,11 @@ if(!drawn) to_chat(user, "Without drawing the bow, the arrow uselessly falls to the ground.") drop_arrow() - update_icon() + update_appearance() 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/misc/syringe_gun.dm b/code/modules/projectiles/guns/misc/syringe_gun.dm index 18d8ceed1ea..265305206dd 100644 --- a/code/modules/projectiles/guns/misc/syringe_gun.dm +++ b/code/modules/projectiles/guns/misc/syringe_gun.dm @@ -36,7 +36,7 @@ /obj/item/gun/syringe/process_chamber() if(chambered && !chambered.loaded_projectile) //we just fired recharge_newshot() - update_icon() + update_appearance() /obj/item/gun/syringe/examine(mob/user) . = ..() @@ -55,7 +55,7 @@ syringes.Remove(S) to_chat(user, "You unload [S] from \the [src].") - update_icon() + update_appearance() return TRUE @@ -70,7 +70,7 @@ to_chat(user, "You load [A] into \the [src].") syringes += A recharge_newshot() - update_icon() + update_appearance() playsound(loc, load_sound, 40) return TRUE else diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index fd710747d8a..97e90f7d15d 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -421,7 +421,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 ..() @@ -460,7 +460,7 @@ ///Give it the lesser magic icon and tell it to delete itself /obj/structure/closet/decay/proc/unmagify() icon_state = weakened_icon - update_icon() + update_appearance() addtimer(CALLBACK(src, .proc/decay), 15 SECONDS) @@ -551,7 +551,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 c944741b4dd..55b832a9f2d 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 @@ -28,7 +29,7 @@ newdart.pen = pen pen.forceMove(newdart) pen = null - newdart.update_icon() + newdart.update_appearance() /obj/projectile/bullet/reusable/foam_dart/Destroy() @@ -38,6 +39,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 0758aa4d531..aa634d18a95 100644 --- a/code/modules/projectiles/projectile/special/curse.dm +++ b/code/modules/projectiles/projectile/special/curse.dm @@ -5,6 +5,7 @@ /obj/projectile/curse_hand name = "curse hand" icon_state = "cursehand0" + base_icon_state = "cursehand" hitsound = 'sound/effects/curse4.ogg' layer = LARGE_MOB_LAYER damage_type = BURN @@ -18,10 +19,11 @@ /obj/projectile/curse_hand/Initialize(mapload) . = ..() handedness = prob(50) - icon_state = "cursehand[handedness]" + icon_state = "[base_icon_state][handedness]" /obj/projectile/curse_hand/update_icon_state() - icon_state = "[initial(icon_state)][handedness]" + icon_state = "[base_icon_state]0[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 e790d2243d0..69274972a8b 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 @@ -137,7 +138,7 @@ //SKYRAT EDIT ADDITION END if(is_operational) begin_processing() - update_icon() + update_appearance() /obj/machinery/chem_dispenser/Destroy() QDEL_NULL(beaker) @@ -181,12 +182,13 @@ 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() @@ -395,7 +397,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 @@ -467,7 +469,7 @@ beaker = null if(new_beaker) beaker = new_beaker - update_icon() + update_appearance() return TRUE //Converts the pH into a tgui readable color @@ -517,7 +519,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") @@ -541,6 +543,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 @@ -629,6 +632,7 @@ desc = "Contains a large reservoir of the good stuff." icon = 'icons/obj/chemical.dmi' icon_state = "booze_dispenser" + base_icon_state = "booze_dispenser" circuit = /obj/item/circuitboard/machine/chem_dispenser/drinks/beer dispensable_reagents = list( /datum/reagent/consumable/ethanol/beer, @@ -763,6 +767,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 3f77c54be76..5f19e20a117 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -15,6 +15,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 @@ -56,13 +57,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) . = ..() @@ -80,7 +79,7 @@ if(new_beaker) beaker = new_beaker RegisterSignal(beaker.reagents, COMSIG_REAGENTS_REACTION_STEP, .proc/on_reaction_step) - update_icon() + update_appearance() return TRUE /obj/machinery/chem_heater/RefreshParts() @@ -164,7 +163,7 @@ replace_beaker(user, B) to_chat(user, "You add [B] to [src].") updateUsrDialog() - update_icon() + update_appearance() return if(beaker) diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index 42a3b19487b..c76b133881b 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -11,6 +11,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 @@ -91,15 +92,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() . = ..() @@ -131,7 +130,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]!") @@ -169,7 +168,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 42387d78a45..3d0fc7caf5c 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 @@ -55,7 +56,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 8d93a052123..1d3d4692a1e 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 = "mixer0" + base_icon_state = "mixer" use_power = TRUE idle_power_usage = 20 resistance_flags = ACID_PROOF @@ -18,7 +19,7 @@ /obj/machinery/computer/pandemic/Initialize() . = ..() - update_icon() + update_appearance() /obj/machinery/computer/pandemic/Destroy() QDEL_NULL(beaker) @@ -43,7 +44,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) @@ -123,14 +124,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 ? "mixer1_b" : "mixer0_b") - else - icon_state = "mixer[(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() . = ..() @@ -141,7 +140,7 @@ if(beaker) try_put_in_hand(beaker, usr) 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) @@ -214,7 +213,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) @@ -228,7 +227,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 @@ -246,7 +245,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 5f37cbe216e..65a5bea062f 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 @@ -42,7 +43,7 @@ . = ..() holdingitems = list() QDEL_NULL(beaker) - update_icon() + update_appearance() /obj/machinery/reagentgrinder/Destroy() if(beaker) @@ -102,7 +103,7 @@ . = ..() if(A == beaker) beaker = null - update_icon() + update_appearance() if(holdingitems[A]) holdingitems -= A @@ -113,10 +114,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) @@ -126,7 +125,7 @@ beaker = null if(new_beaker) beaker = new_beaker - update_icon() + update_appearance() return TRUE /obj/machinery/reagentgrinder/attackby(obj/item/I, mob/living/user, params) @@ -150,7 +149,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 9c31dd03966..7c67609593d 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/recipes/special.dm b/code/modules/reagents/chemistry/recipes/special.dm index 218f682e1a7..b0db782ac48 100644 --- a/code/modules/reagents/chemistry/recipes/special.dm +++ b/code/modules/reagents/chemistry/recipes/special.dm @@ -314,4 +314,4 @@ GLOBAL_LIST_INIT(medicine_reagents, build_medicine_reagents()) dat += "" dat += "." info = dat.Join("") - update_icon() + update_appearance() diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 36c4982b97c..7105ec60fd5 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -208,23 +208,25 @@ /// Updates the icon of the container when the reagents change. Eats signal args /obj/item/reagent_containers/proc/on_reagent_change(datum/reagents/holder, ...) SIGNAL_HANDLER - update_icon() + update_appearance() return NONE /obj/item/reagent_containers/update_overlays() . = ..() 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('icons/obj/reagentfillings.dmi', "[fill_name][fill_icon_thresholds[1]]") + if(!reagents.total_volume) + return - 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]]" + 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]]") - filling.color = mix_color_from_reagents(reagents.reagent_list) - . += filling + 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 diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index a3b3954941e..7ec830acca5 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -6,14 +6,14 @@ volume = 200 var/blood_type = null var/unique_blood = null - var/labelled = 0 + var/labelled = FALSE fill_icon_thresholds = list(10, 20, 30, 40, 50, 60, 70, 80, 90, 100) /obj/item/reagent_containers/blood/Initialize() . = ..() if(blood_type != null) reagents.add_reagent(unique_blood ? unique_blood : /datum/reagent/blood, 200, list("donor"=null,"viruses"=null,"blood_DNA"=null,"blood_type"=blood_type,"resistances"=null,"trace_chem"=null)) - update_icon() + update_appearance() /// Handles updating the container when the reagents change. /obj/item/reagent_containers/blood/on_reagent_change(datum/reagents/holder, ...) @@ -22,14 +22,13 @@ blood_type = B.data["blood_type"] else blood_type = null - update_pack_name() return ..() -/obj/item/reagent_containers/blood/proc/update_pack_name() +/obj/item/reagent_containers/blood/update_name(updates) + . = ..() if(labelled) return - - name = "blood_pack[blood_type ? " - [blood_type]" : ""]" + name = "blood_pack[blood_type ? " - [blood_type]" : null]" /obj/item/reagent_containers/blood/random icon_state = "random_bloodpack" @@ -78,10 +77,10 @@ if(user.get_active_held_item() != I) return if(t) - labelled = 1 + labelled = TRUE name = "blood pack - [t]" else - labelled = 0 - update_pack_name() + labelled = FALSE + update_name() else return ..() diff --git a/code/modules/reagents/reagent_containers/bottle.dm b/code/modules/reagents/reagent_containers/bottle.dm index a3dc843946d..d40a9f069d4 100644 --- a/code/modules/reagents/reagent_containers/bottle.dm +++ b/code/modules/reagents/reagent_containers/bottle.dm @@ -14,7 +14,7 @@ . = ..() if(!icon_state) icon_state = "bottle" - update_icon() + update_appearance() /obj/item/reagent_containers/glass/bottle/epinephrine name = "epinephrine bottle" diff --git a/code/modules/reagents/reagent_containers/dropper.dm b/code/modules/reagents/reagent_containers/dropper.dm index 67341524849..6667b66f7ba 100644 --- a/code/modules/reagents/reagent_containers/dropper.dm +++ b/code/modules/reagents/reagent_containers/dropper.dm @@ -45,7 +45,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!") @@ -65,7 +65,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 @@ -81,11 +81,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/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index 12ba505dff8..7858a5793ab 100755 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -120,7 +120,7 @@ /obj/item/reagent_containers/glass/beaker/Initialize() . = ..() - update_icon() + update_appearance() /obj/item/reagent_containers/glass/beaker/get_part_rating() return reagents.maximum_volume diff --git a/code/modules/reagents/reagent_containers/hypospray.dm b/code/modules/reagents/reagent_containers/hypospray.dm index 5d6553654d9..103f668bf56 100644 --- a/code/modules/reagents/reagent_containers/hypospray.dm +++ b/code/modules/reagents/reagent_containers/hypospray.dm @@ -78,14 +78,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." inhand_icon_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" @@ -104,6 +103,7 @@ icon_state = "medipen" inhand_icon_state = "medipen" worn_icon_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 = 15 @@ -124,17 +124,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, FALSE, FLOOR_OKAY)) 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() . = ..() @@ -148,6 +146,7 @@ desc = "A rapid way to stimulate your body's adrenaline, allowing for freer movement in restrictive armor." icon_state = "stimpen" inhand_icon_state = "stimpen" + base_icon_state = "stimpen" volume = 20 amount_per_transfer_from_this = 20 list_reagents = list(/datum/reagent/medicine/ephedrine = 10, /datum/reagent/consumable/coffee = 10) @@ -161,6 +160,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" inhand_icon_state = "tbpen" + base_icon_state = "syndipen" volume = 50 amount_per_transfer_from_this = 50 list_reagents = list(/datum/reagent/medicine/stimulants = 50) @@ -170,6 +170,7 @@ desc = "A rapid way to get you out of a tight situation and fast! You'll feel rather drowsy, though." icon_state = "morphen" inhand_icon_state = "morphen" + base_icon_state = "morphen" list_reagents = list(/datum/reagent/medicine/morphine = 10) /obj/item/reagent_containers/hypospray/medipen/oxandrolone @@ -177,6 +178,7 @@ desc = "An autoinjector containing oxandrolone, used to treat severe burns." icon_state = "oxapen" inhand_icon_state = "oxapen" + base_icon_state = "oxapen" list_reagents = list(/datum/reagent/medicine/oxandrolone = 10) /obj/item/reagent_containers/hypospray/medipen/penacid @@ -184,6 +186,7 @@ desc = "An autoinjector containing pentetic acid, used to reduce high levels of radiations and moderate toxins." icon_state = "penacid" inhand_icon_state = "penacid" + base_icon_state = "penacid" list_reagents = list(/datum/reagent/medicine/pen_acid = 10) /obj/item/reagent_containers/hypospray/medipen/salacid @@ -191,6 +194,7 @@ desc = "An autoinjector containing salicylic acid, used to treat severe brute damage." icon_state = "salacid" inhand_icon_state = "salacid" + base_icon_state = "salacid" list_reagents = list(/datum/reagent/medicine/sal_acid = 10) /obj/item/reagent_containers/hypospray/medipen/salbutamol @@ -198,6 +202,7 @@ desc = "An autoinjector containing salbutamol, used to heal oxygen damage quickly." icon_state = "salpen" inhand_icon_state = "salpen" + base_icon_state = "salpen" list_reagents = list(/datum/reagent/medicine/salbutamol = 10) /obj/item/reagent_containers/hypospray/medipen/tuberculosiscure @@ -205,23 +210,24 @@ desc = "Bio Virus Antidote Kit autoinjector. Has a two use system for yourself, and someone else. Inject when infected." icon_state = "tbpen" inhand_icon_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 >= volume) - 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]" /obj/item/reagent_containers/hypospray/medipen/survival name = "survival emergency medipen" desc = "A medipen for surviving in the harsh environments, heals most common damage sources. WARNING: May cause organ damage." icon_state = "stimpen" inhand_icon_state = "stimpen" + base_icon_state = "stimpen" volume = 30 amount_per_transfer_from_this = 30 list_reagents = list( /datum/reagent/medicine/epinephrine = 8, /datum/reagent/medicine/c2/aiuri = 8, /datum/reagent/medicine/c2/libital = 8 ,/datum/reagent/medicine/leporazine = 6) @@ -248,6 +254,7 @@ desc = "Cutting edge bluespace technology allowed Nanotrasen to compact 60u of volume into a single medipen. Contains rare and powerful chemicals used to aid in exploration of very hard enviroments. WARNING: DO NOT MIX WITH EPINEPHRINE OR ATROPINE." icon_state = "luxpen" inhand_icon_state = "atropen" + base_icon_state = "luxpen" volume = 60 amount_per_transfer_from_this = 60 list_reagents = list(/datum/reagent/medicine/salbutamol = 10, /datum/reagent/medicine/c2/penthrite = 10, /datum/reagent/medicine/oxandrolone = 10, /datum/reagent/medicine/sal_acid = 10 ,/datum/reagent/medicine/omnizine = 10 ,/datum/reagent/medicine/leporazine = 10) @@ -257,6 +264,7 @@ desc = "A rapid way to save a person from a critical injury state!" icon_state = "atropen" inhand_icon_state = "atropen" + base_icon_state = "atropen" list_reagents = list(/datum/reagent/medicine/atropine = 10) /obj/item/reagent_containers/hypospray/medipen/snail @@ -264,6 +272,7 @@ desc = "All-purpose snail medicine! Do not use on non-snails!" icon_state = "snail" inhand_icon_state = "snail" + base_icon_state = "snail" list_reagents = list(/datum/reagent/snail = 10) /obj/item/reagent_containers/hypospray/medipen/magillitis @@ -271,6 +280,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" inhand_icon_state = "gorillapen" + base_icon_state = "gorillapen" volume = 5 ignore_flags = 0 reagent_flags = NONE @@ -283,11 +293,13 @@ 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/ekit name = "emergency first-aid autoinjector" desc = "An epinephrine medipen with extra coagulant and antibiotics to help stabilize bad cuts and burns." icon_state = "firstaid" + base_icon_state = "firstaid" volume = 15 amount_per_transfer_from_this = 15 list_reagents = list(/datum/reagent/medicine/epinephrine = 12, /datum/reagent/medicine/coagulant = 2.5, /datum/reagent/medicine/spaceacillin = 0.5) @@ -296,6 +308,7 @@ name = "hypovolemic-response autoinjector" desc = "A medipen designed to stabilize and rapidly reverse severe bloodloss." icon_state = "hypovolemic" + base_icon_state = "hypovolemic" volume = 15 amount_per_transfer_from_this = 15 list_reagents = list(/datum/reagent/medicine/epinephrine = 5, /datum/reagent/medicine/coagulant = 2.5, /datum/reagent/iron = 3.5, /datum/reagent/medicine/salglu_solution = 4) diff --git a/code/modules/reagents/reagent_containers/maunamug.dm b/code/modules/reagents/reagent_containers/maunamug.dm index 67c2286a166..0ce79f72d81 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" @@ -35,7 +36,7 @@ var/max_temp = min(500 + (500 * (0.2 * cell.rating)), 1000) // 373 to 1000 reagents.adjust_thermal_energy(0.4 * cell.maxcharge * reagents.total_volume * delta_time, 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!") @@ -62,13 +63,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) @@ -84,32 +85,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, list/modifiers) 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 db688b616b8..2ce1cf12d74 100644 --- a/code/modules/reagents/reagent_containers/syringes.dm +++ b/code/modules/reagents/reagent_containers/syringes.dm @@ -2,6 +2,7 @@ name = "syringe" desc = "A syringe that can hold up to 15 units." icon = 'icons/obj/syringe.dmi' + base_icon_state = "syringe" inhand_icon_state = "syringe_0" lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi' @@ -138,22 +139,21 @@ /obj/item/reagent_containers/syringe/update_icon_state() var/rounded_vol = get_rounded_vol() icon_state = "[rounded_vol]" - inhand_icon_state = "syringe_[rounded_vol]" + inhand_icon_state = "[base_icon_state]_[rounded_vol]" + return ..() /obj/item/reagent_containers/syringe/update_overlays() . = ..() - var/rounded_vol = get_rounded_vol() if(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 -///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?.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 79f260114d5..25905d7d4c2 100644 --- a/code/modules/reagents/reagent_dispenser.dm +++ b/code/modules/reagents/reagent_dispenser.dm @@ -37,7 +37,7 @@ new_tank.reagents.maximum_volume = reagents.maximum_volume reagents.trans_to(new_tank, reagents.total_volume) new_tank.name = "stationary [name]" - new_tank.update_overlays() + new_tank.update_appearance(UPDATE_OVERLAYS) new_tank.anchored = anchored qdel(src) return FALSE @@ -124,7 +124,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") @@ -248,13 +248,15 @@ /obj/structure/reagent_dispensers/plumbed/storage/update_overlays() . = ..() - if(reagents) - if(reagents.total_volume) - var/mutable_appearance/tank_color = mutable_appearance('icons/obj/chemical_tanks.dmi', "tank_chem_overlay") - tank_color.color = mix_color_from_reagents(reagents.reagent_list) - add_overlay(tank_color) - else - cut_overlays() + if(!reagents) + return + + if(!reagents.total_volume) + return + + var/mutable_appearance/tank_color = mutable_appearance('icons/obj/chemical_tanks.dmi', "tank_chem_overlay") + tank_color.color = mix_color_from_reagents(reagents.reagent_list) + . += tank_color /obj/structure/reagent_dispensers/plumbed/storage/proc/can_be_rotated(mob/user, rotation_type) if(anchored) diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm index 3b1a8433e75..5c83bd2d3c9 100644 --- a/code/modules/recycling/conveyor2.dm +++ b/code/modules/recycling/conveyor2.dm @@ -6,6 +6,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) /obj/machinery/conveyor//SKYRAT EDIT - ICON OVERRIDEN BY AESTHETICS - SEE MODULE icon = 'icons/obj/recycling.dmi' icon_state = "conveyor_map" + base_icon_state = "conveyor" name = "conveyor belt" desc = "A conveyor belt." layer = BELOW_OPEN_DOOR_LAYER @@ -45,7 +46,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) . = ..() if(.) operating = TRUE - update_icon() + update_appearance() // create a conveyor /obj/machinery/conveyor/Initialize(mapload, newdir, newid) @@ -111,15 +112,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 @@ -246,6 +245,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 @@ -259,7 +259,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) @@ -280,25 +280,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 @@ -310,7 +306,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. @@ -333,7 +329,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) /obj/machinery/conveyor_switch/interact(mob/user) add_fingerprint(user) update_position() - update_icon() + update_appearance() update_linked_conveyors() update_linked_switches() @@ -361,7 +357,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) /obj/machinery/conveyor_switch/wrench_act(mob/user, obj/item/I) I.play_tool_sound(src, 50) invert_icon = !invert_icon - update_icon() + update_appearance() to_chat(user, "You set conveyor switch to [invert_icon ? "inverted": "normal"] position.") return TRUE diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm index f50c5b83ca3..b0bfc80bef8 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() RegisterSignal(src, COMSIG_RAT_INTERACT, .proc/on_rat_rummage) return INITIALIZE_HINT_LATELOAD //we need turfs to have air @@ -103,7 +103,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 ..() @@ -169,7 +169,7 @@ log_combat(user, target, "stuffed", addition="into [src]") target.LAssailant = user . = TRUE - update_icon() + update_appearance() /obj/machinery/disposal/relaymove(mob/living/user, direction) attempt_escape(user) @@ -186,7 +186,7 @@ // leave the disposal /obj/machinery/disposal/proc/go_out(mob/user) user.forceMove(loc) - update_icon() + update_appearance() // clumsy monkeys and xenos can only pull the flush lever /obj/machinery/disposal/attack_paw(mob/user, list/modifiers) @@ -195,13 +195,13 @@ if(machine_stat & BROKEN) return flush = !flush - update_icon() + update_appearance() // eject the contents of the disposal unit /obj/machinery/disposal/proc/eject() pipe_eject(src, FALSE, FALSE) - update_icon() + update_appearance() /obj/machinery/disposal/proc/flush() flushing = TRUE @@ -248,7 +248,7 @@ src.transfer_fingerprints_to(stored) stored.set_anchored(FALSE) stored.density = TRUE - stored.update_icon() + stored.update_appearance() for(var/atom/movable/AM in src) //out, out, darned crowbar! AM.forceMove(T) ..() @@ -288,8 +288,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 ..() @@ -324,22 +324,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() @@ -351,7 +351,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 ..() @@ -362,14 +362,17 @@ ..() full_pressure = FALSE pressure_charging = TRUE - update_icon() + update_appearance() + +/obj/machinery/disposal/bin/update_appearance(updates) + . = ..() + if((machine_stat & (BROKEN|NOPOWER)) || panel_open) + luminosity = 0 + return + luminosity = 1 /obj/machinery/disposal/bin/update_overlays() . = ..() - - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) - luminosity = 0 - if(machine_stat & BROKEN) return @@ -381,7 +384,6 @@ if(machine_stat & NOPOWER || panel_open) return - luminosity = 1 //check for items in disposal - occupied light if(contents.len > 0) . += "dispover-full" @@ -446,7 +448,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 e950d2653a0..1e6fb52b8a5 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() - 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) - - else if(ispath(pipe_type, /obj/machinery/disposal/bin)) +/obj/structure/disposalconstruct/update_icon_state() + if(ispath(pipe_type, /obj/machinery/disposal/bin)) // Disposal bins receive special icon treating - if(anchored) - icon_state = "disposal" - else - icon_state = "condisposal" + 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() + . = ..() + if(!is_pipe()) + return + + 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) @@ -144,7 +144,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 70f16f59634..4ee42e3f1ea 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 @@ -45,7 +46,7 @@ /obj/machinery/rnd/bepis/attackby(obj/item/O, mob/user, params) if(default_deconstruction_screwdriver(user, "chamber_open", "chamber", O)) - update_icon() + update_appearance() return if(default_deconstruction_crowbar(O)) return @@ -57,7 +58,7 @@ banked_cash += deposit_value qdel(O) say("Deposited [deposit_value] credits into storage.") - update_icon() + update_appearance() return if(istype(O, /obj/item/card/id)) var/obj/item/card/id/Card = O @@ -92,7 +93,7 @@ var/deposit_value = 0 deposit_value = banking_amount if(deposit_value == 0) - update_icon() + update_appearance() say("Attempting to deposit 0 credits. Aborting.") return deposit_value = clamp(round(deposit_value, 1), 1, 10000) @@ -108,7 +109,7 @@ banked_cash += deposit_value use_power(1000 * power_saver) say("Cash deposit successful. There is [banked_cash] in the chamber.") - update_icon() + update_appearance() return /obj/machinery/rnd/bepis/proc/withdrawcash() @@ -120,7 +121,7 @@ banked_cash -= withdraw_value new /obj/item/holochip(src.loc, withdraw_value) say("Withdrawing [withdraw_value] credits from the chamber.") - update_icon() + update_appearance() return /obj/machinery/rnd/bepis/proc/calcsuccess() @@ -143,7 +144,7 @@ gauss_real = (gaussian(banked_cash, std*inaccuracy_percentage) + positive_cash_offset) //this is the randomized profit value that your experiment expects to give. say("Real: [gauss_real]. Minor: [gauss_minor]. Major: [gauss_major].") flick("chamber_flash",src) - update_icon() + update_appearance() banked_cash = 0 if((gauss_real >= gauss_major) && (SSresearch.techweb_nodes_experimental.len > 0)) //Major Success. say("Experiment concluded with major success. New technology node discovered on technology disc.") @@ -168,20 +169,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) @@ -255,7 +257,7 @@ calcsuccess() use_power(MACHINE_OPERATION * power_saver) //This thing should eat your APC battery if you're not careful. use_power = IDLE_POWER_USE //Machine shuts off after use to prevent spam and look better visually. - update_icon() + update_appearance() if("amount") var/input = text2num(params["amount"]) if(input) @@ -265,7 +267,7 @@ use_power = IDLE_POWER_USE else use_power = ACTIVE_POWER_USE - update_icon() + update_appearance() if("account_reset") if(use_power == IDLE_POWER_USE) return diff --git a/code/modules/research/destructive_analyzer.dm b/code/modules/research/destructive_analyzer.dm index f08b6c7c36e..33625135619 100644 --- a/code/modules/research/destructive_analyzer.dm +++ b/code/modules/research/destructive_analyzer.dm @@ -9,6 +9,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 @@ -41,14 +42,12 @@ Note: Must be placed within 3 tiles of the R&D 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/destroy_item(obj/item/thing, innermode = FALSE) if(QDELETED(thing) || QDELETED(src)) @@ -69,7 +68,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) @@ -124,7 +123,7 @@ 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 /obj/machinery/rnd/destructive_analyzer/ui_interact(mob/user) diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm index 1649da5c0b9..e377e52509f 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 @@ -236,7 +237,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) //////////////////////////////////////////////////////////////////////////////////////////////// @@ -527,11 +528,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 1f20bf0f02f..79cc4acf51c 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 @@ -38,7 +39,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) @@ -107,27 +108,29 @@ /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() . = ..() if((machine_stat & MAINT) || panel_open) . += "maint" + return - else if(!(machine_stat & (NOPOWER|BROKEN))) - if(busy || locked) - . += "red" - if(locked) - . += "bolted" - else - . += "green" + 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) @@ -188,7 +191,7 @@ /obj/machinery/nanite_chamber/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/modules/research/nanites/nanite_chamber_computer.dm b/code/modules/research/nanites/nanite_chamber_computer.dm index da65235772a..f2b155c0e0c 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_program_hub.dm b/code/modules/research/nanites/nanite_program_hub.dm index 656c40390d0..530095d3194 100644 --- a/code/modules/research/nanites/nanite_program_hub.dm +++ b/code/modules/research/nanites/nanite_program_hub.dm @@ -28,7 +28,6 @@ /obj/machinery/nanite_program_hub/update_overlays() . = ..() - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) if((machine_stat & (NOPOWER|MAINT|BROKEN)) || panel_open) return SSvis_overlays.add_vis_overlay(src, icon, "nanite_program_hub_on", layer, plane) diff --git a/code/modules/research/nanites/nanite_programmer.dm b/code/modules/research/nanites/nanite_programmer.dm index 8a76717e552..a5030a2c4f1 100644 --- a/code/modules/research/nanites/nanite_programmer.dm +++ b/code/modules/research/nanites/nanite_programmer.dm @@ -13,7 +13,6 @@ /obj/machinery/nanite_programmer/update_overlays() . = ..() - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) if((machine_stat & (NOPOWER|MAINT|BROKEN)) || panel_open) return SSvis_overlays.add_vis_overlay(src, icon, "nanite_programmer_on", layer, plane) diff --git a/code/modules/research/nanites/nanite_remote.dm b/code/modules/research/nanites/nanite_remote.dm index 8086a20eba9..76f0bec8c16 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 12eebbccde3..cd808a51986 100644 --- a/code/modules/research/nanites/public_chamber.dm +++ b/code/modules/research/nanites/public_chamber.dm @@ -4,6 +4,7 @@ circuit = /obj/item/circuitboard/machine/public_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 @@ -30,7 +31,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)) @@ -88,26 +89,26 @@ /obj/machinery/public_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/public_nanite_chamber/update_overlays() . = ..() if((machine_stat & MAINT) || panel_open) . += "maint" + return + if(machine_stat & (NOPOWER|BROKEN)) + return - else if(!(machine_stat & (NOPOWER|BROKEN))) - if(busy || locked) - . += "red" - if(locked) - . += "bolted" - else - . += "green" + if(busy || locked) + . += "red" + if(locked) + . += "bolted" + return + . += "green" /obj/machinery/public_nanite_chamber/proc/toggle_open(mob/user) if(panel_open) @@ -184,7 +185,7 @@ /obj/machinery/public_nanite_chamber/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/modules/research/server.dm b/code/modules/research/server.dm index 3539b41f622..3c3bb3cc7ff 100644 --- a/code/modules/research/server.dm +++ b/code/modules/research/server.dm @@ -3,6 +3,7 @@ desc = "A computer system running a deep neural network that processes arbitrary information to produce data useable in the development of new technologies. In layman's terms, it makes research points." icon = 'icons/obj/machines/research.dmi' icon_state = "RD-server-on" + base_icon_state = "RD-server" var/heat_health = 100 //Code for point mining here. var/working = TRUE //temperature should break it. @@ -35,11 +36,10 @@ /obj/machinery/rnd/server/update_icon_state() if(machine_stat & EMPED || machine_stat & NOPOWER) - icon_state = "RD-server-off" - else if(research_disabled) - icon_state = "RD-server-halt" - else - icon_state = "RD-server-on" + icon_state = "[base_icon_state]-off" + return ..() + icon_state = "[base_icon_state]-[research_disabled ? "halt" : "on"]" + return ..() /obj/machinery/rnd/server/power_change() . = ..() @@ -51,7 +51,7 @@ working = FALSE else working = TRUE - update_icon() + update_appearance() /obj/machinery/rnd/server/emp_act() . = ..() diff --git a/code/modules/research/xenobiology/vatgrowing/microscope.dm b/code/modules/research/xenobiology/vatgrowing/microscope.dm index 0950ae8b5b1..c4343cb0683 100644 --- a/code/modules/research/xenobiology/vatgrowing/microscope.dm +++ b/code/modules/research/xenobiology/vatgrowing/microscope.dm @@ -78,4 +78,4 @@ current_dish.forceMove(get_turf(src)) current_dish = null . = TRUE - update_icon() + update_appearance() diff --git a/code/modules/research/xenobiology/vatgrowing/petri_dish.dm b/code/modules/research/xenobiology/vatgrowing/petri_dish.dm index 7268c188816..95f490d27a1 100644 --- a/code/modules/research/xenobiology/vatgrowing/petri_dish.dm +++ b/code/modules/research/xenobiology/vatgrowing/petri_dish.dm @@ -43,4 +43,4 @@ /obj/item/petri_dish/proc/deposit_sample(user, datum/biological_sample/deposited_sample) sample = deposited_sample to_chat(user, "You deposit a sample into [src].") - update_icon() + update_appearance() diff --git a/code/modules/research/xenobiology/vatgrowing/vatgrower.dm b/code/modules/research/xenobiology/vatgrowing/vatgrower.dm index c0accc7467c..72f825be363 100644 --- a/code/modules/research/xenobiology/vatgrowing/vatgrower.dm +++ b/code/modules/research/xenobiology/vatgrowing/vatgrower.dm @@ -59,7 +59,7 @@ biological_sample.sample_color = petri.sample.sample_color to_chat(user, "You put some of the sample in the vat!") playsound(src, 'sound/effects/bubbles.ogg', 50, TRUE) - update_icon() + update_appearance() ///Adds text for when there is a sample in the vat /obj/machinery/plumbing/growing_vat/examine(mob/user) @@ -78,7 +78,7 @@ /// Call update icon when reagents change to update the reagent content icons. Eats signal args. /obj/machinery/plumbing/growing_vat/proc/on_reagent_change(datum/reagents/holder, ...) SIGNAL_HANDLER - update_icon() + update_appearance() return NONE ///Adds overlays to show the reagent contents diff --git a/code/modules/ruins/lavalandruin_code/elephantgraveyard.dm b/code/modules/ruins/lavalandruin_code/elephantgraveyard.dm index 5f0dc94ca63..5a93e24ca2a 100644 --- a/code/modules/ruins/lavalandruin_code/elephantgraveyard.dm +++ b/code/modules/ruins/lavalandruin_code/elephantgraveyard.dm @@ -169,7 +169,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) @@ -197,7 +197,7 @@ /obj/structure/closet/crate/grave/bust_open() ..() opened = TRUE - update_icon() + update_appearance() dump_contents() return diff --git a/code/modules/ruins/spaceruin_code/hilbertshotel.dm b/code/modules/ruins/spaceruin_code/hilbertshotel.dm index cf9f7fe8c38..d4aa0a748df 100644 --- a/code/modules/ruins/spaceruin_code/hilbertshotel.dm +++ b/code/modules/ruins/spaceruin_code/hilbertshotel.dm @@ -247,6 +247,7 @@ GLOBAL_VAR_INIT(hhMysteryRoomNumber, rand(1, 999999)) /turf/open/space/bluespace name = "\proper bluespace hyperzone" icon_state = "bluespace" + base_icon_state = "bluespace" baseturfs = /turf/open/space/bluespace flags_1 = NOJAUNT_1 explosion_block = INFINITY @@ -257,7 +258,8 @@ GLOBAL_VAR_INIT(hhMysteryRoomNumber, rand(1, 999999)) update_icon_state() /turf/open/space/bluespace/update_icon_state() - icon_state = "bluespace" + icon_state = base_icon_state + return ..() /turf/open/space/bluespace/Entered(atom/movable/A) . = ..() diff --git a/code/modules/security_levels/keycard_authentication.dm b/code/modules/security_levels/keycard_authentication.dm index 23b2ac0becd..b6493d1849d 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/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! Station-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/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! Station-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/security_levels/security_levels.dm b/code/modules/security_levels/security_levels.dm index 120973bc260..25292b54ce4 100644 --- a/code/modules/security_levels/security_levels.dm +++ b/code/modules/security_levels/security_levels.dm @@ -32,7 +32,7 @@ GLOBAL_VAR_INIT(security_level, SEC_LEVEL_GREEN) GLOB.security_level = SEC_LEVEL_GREEN for(var/obj/machinery/firealarm/FA in GLOB.machines) if(is_station_level(FA.z)) - FA.update_icon() + FA.update_appearance() if(SEC_LEVEL_BLUE) if(GLOB.security_level < SEC_LEVEL_BLUE) minor_announce(CONFIG_GET(string/alert_blue_upto), "Attention! Security level elevated to blue:",1) @@ -45,7 +45,7 @@ GLOBAL_VAR_INIT(security_level, SEC_LEVEL_GREEN) GLOB.security_level = SEC_LEVEL_BLUE for(var/obj/machinery/firealarm/FA in GLOB.machines) if(is_station_level(FA.z)) - FA.update_icon() + FA.update_appearance() if(SEC_LEVEL_RED) if(GLOB.security_level < SEC_LEVEL_RED) minor_announce(CONFIG_GET(string/alert_red_upto), "Attention! Code red!",1) @@ -60,7 +60,7 @@ GLOBAL_VAR_INIT(security_level, SEC_LEVEL_GREEN) for(var/obj/machinery/firealarm/FA in GLOB.machines) if(is_station_level(FA.z)) - FA.update_icon() + FA.update_appearance() for(var/obj/machinery/computer/shuttle/pod/pod in GLOB.machines) pod.locked = FALSE if(SEC_LEVEL_DELTA) @@ -73,7 +73,7 @@ GLOBAL_VAR_INIT(security_level, SEC_LEVEL_GREEN) GLOB.security_level = SEC_LEVEL_DELTA for(var/obj/machinery/firealarm/FA in GLOB.machines) if(is_station_level(FA.z)) - FA.update_icon() + FA.update_appearance() for(var/obj/machinery/computer/shuttle/pod/pod in GLOB.machines) pod.locked = FALSE if(level >= SEC_LEVEL_RED) diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index b6deeec0e63..65f97178afd 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -258,8 +258,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 2f50ba92d68..bf588765fd0 100644 --- a/code/modules/shuttle/shuttle_rotate.dm +++ b/code/modules/shuttle/shuttle_rotate.dm @@ -56,7 +56,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************************************/ diff --git a/code/modules/shuttle/spaceship_navigation_beacon.dm b/code/modules/shuttle/spaceship_navigation_beacon.dm index 87c1b7fa92f..77bd09cf693 100644 --- a/code/modules/shuttle/spaceship_navigation_beacon.dm +++ b/code/modules/shuttle/spaceship_navigation_beacon.dm @@ -9,6 +9,7 @@ desc = "A device that creates a bluespace anchor that allow ships jump near to it." icon = 'icons/obj/abductor.dmi' icon_state = "core" + base_icon_state = "core" use_power = IDLE_POWER_USE idle_power_usage = 0 density = TRUE @@ -30,10 +31,8 @@ // update the icon_state /obj/machinery/spaceship_navigation_beacon/update_icon_state() - if(powered()) - icon_state = "core" - else - icon_state = "core-open" + icon_state = "[base_icon_state][powered() ? null : "-open"]" + return ..() /obj/machinery/spaceship_navigation_beacon/multitool_act(mob/living/user, obj/item/multitool/I) ..() diff --git a/code/modules/shuttle/special.dm b/code/modules/shuttle/special.dm index 0b93156ca39..2e7bf5ea9bc 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 cc90362af41..3b79c9eaf65 100644 --- a/code/modules/spells/spell.dm +++ b/code/modules/spells/spell.dm @@ -77,7 +77,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 @@ -89,7 +89,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 c89d593c848..6829e812b1f 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 b615025d309..d67d7442f93 100644 --- a/code/modules/spells/spell_types/charge.dm +++ b/code/modules/spells/spell_types/charge.dm @@ -89,7 +89,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 2f2a6c41a8d..1002d34ccb5 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 1d6c89f6c90..b7d731b28c4 100644 --- a/code/modules/spells/spell_types/soultap.dm +++ b/code/modules/spells/spell_types/soultap.dm @@ -27,4 +27,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 db2e8120a48..3eab7ca93ac 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 2b707a3edc2..bb1b559a875 100644 --- a/code/modules/station_goals/bsa.dm +++ b/code/modules/station_goals/bsa.dm @@ -275,7 +275,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 8d8b16a3518..18a7fe11cfe 100644 --- a/code/modules/station_goals/shield.dm +++ b/code/modules/station_goals/shield.dm @@ -89,6 +89,7 @@ desc = "" icon = 'icons/obj/machines/satellite.dmi' icon_state = "sat_inactive" + base_icon_state = "sat" anchored = FALSE density = TRUE use_power = FALSE @@ -115,7 +116,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()) @@ -128,7 +129,8 @@ return TRUE /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 2a17315ac20..ce49be05fef 100644 --- a/code/modules/surgery/bodyparts/dismemberment.dm +++ b/code/modules/surgery/bodyparts/dismemberment.dm @@ -236,7 +236,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 @@ -254,7 +254,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 @@ -341,7 +341,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 fcd4ba6796c..a18bf12e4eb 100644 --- a/code/modules/surgery/bodyparts/parts.dm +++ b/code/modules/surgery/bodyparts/parts.dm @@ -126,7 +126,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 @@ -223,7 +223,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 ee5b6c4da53..fc480dfd1be 100644 --- a/code/modules/surgery/implant_removal.dm +++ b/code/modules/surgery/implant_removal.dm @@ -41,7 +41,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 bfcc34d2b37..1a8e3e2a0c7 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 food_reagents = list(/datum/reagent/consumable/nutriment = 5, /datum/reagent/toxin/bad_food = 5) @@ -13,13 +14,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() ..() @@ -36,7 +37,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 ac67dd4d18b..2e4fab3a871 100644 --- a/code/modules/surgery/organs/augments_arms.dm +++ b/code/modules/surgery/organs/augments_arms.dm @@ -17,7 +17,7 @@ if(ispath(active_item)) active_item = new active_item(src) - update_icon() + update_appearance() SetSlotFromZone() items_list = contents.Copy() @@ -31,10 +31,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) . = ..() @@ -51,7 +49,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/Insert(mob/living/carbon/M, special = FALSE, drop_if_replaced = TRUE) . = ..() diff --git a/code/modules/surgery/organs/augments_chest.dm b/code/modules/surgery/organs/augments_chest.dm index 67175891ff1..73ba3743302 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 dce35c2adc1..6ff75f081bc 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_continuous = list("beats", "thumps") attack_verb_simple = list("beat", "thump") var/beat = BEAT_NONE//is this mob having a heatbeat sound played? if so, which? @@ -23,10 +23,8 @@ var/operated = FALSE //whether the heart's been operated on to fix some of its damages /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) ..() @@ -47,18 +45,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() ..() @@ -104,7 +102,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/organ_action/cursed_heart) var/last_pump = 0 diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm index e14c2f388a4..0b27bd7cfc9 100644 --- a/code/modules/vehicles/mecha/_mecha.dm +++ b/code/modules/vehicles/mecha/_mecha.dm @@ -197,7 +197,7 @@ diag_hud_set_mechhealth() diag_hud_set_mechcell() diag_hud_set_mechstat() - update_icon() + update_appearance() /obj/mecha/ComponentInitialize() . = ..() @@ -237,10 +237,12 @@ /obj/vehicle/sealed/mecha/update_icon_state() if((mecha_flags & SILICON_PILOT) && silicon_icon_state) icon_state = silicon_icon_state - else if(LAZYLEN(occupants)) + return ..() + if(LAZYLEN(occupants)) icon_state = base_icon_state - else - icon_state = "[base_icon_state]-open" + return ..() + icon_state = "[base_icon_state]-open" + return ..() /obj/vehicle/sealed/mecha/get_cell() @@ -891,7 +893,7 @@ LAZYSET(occupants, pilot_mob, NONE) pilot_mob.mecha = src pilot_mob.forceMove(src) - update_icon() + update_appearance() ///Handles an actual AI (simple_animal mecha pilot) exiting the mech /obj/vehicle/sealed/mecha/proc/aimob_exit_mech(mob/living/simple_animal/hostile/syndicate/mecha_pilot/pilot_mob) @@ -899,7 +901,7 @@ if(pilot_mob.mecha == src) pilot_mob.mecha = null pilot_mob.forceMove(get_turf(src)) - update_icon() + update_appearance() ///////////////////////////////////// @@ -1104,7 +1106,7 @@ L.reset_perspective() remove_occupant(L) mmi.set_mecha(null) - mmi.update_icon() + mmi.update_appearance() setDir(dir_in) return ..() @@ -1115,7 +1117,7 @@ RegisterSignal(M, COMSIG_MOB_MIDDLECLICKON, .proc/on_middlemouseclick) //For AIs RegisterSignal(M, COMSIG_MOB_SAY, .proc/display_speech_bubble) . = ..() - update_icon() + update_appearance() /obj/vehicle/sealed/mecha/remove_occupant(mob/M) UnregisterSignal(M, COMSIG_LIVING_DEATH) @@ -1129,7 +1131,7 @@ M.client.view_size.resetToDefault() zoom_mode = 0 . = ..() - update_icon() + update_appearance() ///////////////////////// ////// Access stuff ///// diff --git a/code/modules/vehicles/mecha/equipment/weapons/mecha_ammo.dm b/code/modules/vehicles/mecha/equipment/weapons/mecha_ammo.dm index 5f7e5847046..c95977a7fbe 100644 --- a/code/modules/vehicles/mecha/equipment/weapons/mecha_ammo.dm +++ b/code/modules/vehicles/mecha/equipment/weapons/mecha_ammo.dm @@ -12,11 +12,17 @@ var/load_audio = 'sound/weapons/gun/general/mag_bullet_insert.ogg' var/ammo_type -/obj/item/mecha_ammo/proc/update_name() - if(!rounds) - name = "empty ammo box" - desc = "An exosuit ammuniton box that has since been emptied. Please recycle." - icon_state = "empty" +/obj/item/mecha_ammo/update_name() + . = ..() + name = "[rounds ? null : "empty "][initial(name)]" + +/obj/item/mecha_ammo/update_desc() + . = ..() + desc = rounds ? initial(desc) : "An exosuit ammuniton box that has since been emptied. Please recycle." + +/obj/item/mecha_ammo/update_icon_state() + icon_state = rounds ? initial(icon_state) : "empty" + return ..() /obj/item/mecha_ammo/attack_self(mob/user) ..() @@ -35,21 +41,21 @@ . += "There [rounds > 1?"are":"is"] [rounds] [round_term][rounds > 1?"s":""] left." /obj/item/mecha_ammo/incendiary - name = "incendiary ammo" + name = "incendiary ammo box" desc = "A box of incendiary ammunition for use with exosuit weapons." icon_state = "incendiary" rounds = 24 ammo_type = "incendiary" /obj/item/mecha_ammo/scattershot - name = "scattershot ammo" + name = "scattershot ammo box" desc = "A box of scaled-up buckshot, for use in exosuit shotguns." icon_state = "scattershot" rounds = 40 ammo_type = "scattershot" /obj/item/mecha_ammo/lmg - name = "machine gun ammo" + name = "machine gun ammo box" desc = "A box of linked ammunition, designed for the Ultra AC 2 exosuit weapon." icon_state = "lmg" rounds = 300 diff --git a/code/modules/vehicles/mecha/mech_bay.dm b/code/modules/vehicles/mecha/mech_bay.dm index 38ea9d74867..9f1a17469f1 100644 --- a/code/modules/vehicles/mecha/mech_bay.dm +++ b/code/modules/vehicles/mecha/mech_bay.dm @@ -55,17 +55,17 @@ if(!recharging_mech) recharging_mech = locate(/obj/vehicle/sealed/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(recharge_power * delta_time, 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) @@ -103,7 +103,7 @@ if("reconnect") reconnect() . = TRUE - update_icon() + update_appearance() /obj/machinery/computer/mech_bay_power_console/ui_data(mob/user) var/list/data = list() @@ -138,7 +138,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/modules/vehicles/motorized_wheelchair.dm b/code/modules/vehicles/motorized_wheelchair.dm index ac42f3e7f3f..7088a6a6237 100644 --- a/code/modules/vehicles/motorized_wheelchair.dm +++ b/code/modules/vehicles/motorized_wheelchair.dm @@ -60,7 +60,7 @@ /obj/vehicle/ridden/wheelchair/motorized/attack_hand(mob/living/user, list/modifiers) if(!power_cell || !panel_open) return ..() - power_cell.update_icon() + power_cell.update_appearance() to_chat(user, "You remove [power_cell] from [src].") user.put_in_hands(power_cell) power_cell = null diff --git a/code/modules/vehicles/pimpin_ride.dm b/code/modules/vehicles/pimpin_ride.dm index 474d166f49f..6f19d4b99c5 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() AddElement(/datum/element/ridable, /datum/component/riding/vehicle/janicart) if(floorbuffer) @@ -41,7 +41,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!") @@ -50,7 +50,7 @@ qdel(I) to_chat(user, "You upgrade [src] with the floor buffer.") AddElement(/datum/element/cleaning) - update_icon() + update_appearance() else if(mybag) mybag.attackby(I, user) else @@ -71,7 +71,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 646da5e62f7..1d845757c82 100644 --- a/code/modules/vending/_vending.dm +++ b/code/modules/vending/_vending.dm @@ -242,24 +242,26 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C else ..() +/obj/machinery/vending/update_appearance(updates=ALL) + . = ..() + if(machine_stat & BROKEN) + 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" - 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 ..() + icon_state = "[initial(icon_state)][powered() ? null : "-off"]" + return ..() /obj/machinery/vending/update_overlays() . = ..() if(!light_mask) return - - SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays) if(!(machine_stat & BROKEN) && powered()) SSvis_overlays.add_vis_overlay(src, icon, light_mask, EMISSIVE_LAYER, EMISSIVE_PLANE) diff --git a/icons/obj/machines/medical_kiosk.dmi b/icons/obj/machines/medical_kiosk.dmi index 1204db75a468d748d14830be8715d06607331a77..fd8481ac43e66ba8c1bc5f176a1066222b83ef47 100644 GIT binary patch delta 101 zcmV-r0Gj`s5}Fc_uK}5nuuW83iHkEOv#1!zH{{|>D@x2w1+mS5qNzEFl^|gqI7HJL zpO{>dS(b|31dy#TBTRJ+$%aOl*5;?BVYd@gWkG5lE~Ux}u6{1ya039khg0EPa7bjc HQUS>a^`