From 5896e6875266b22c565009b5d45f60ceb981d90a Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Fri, 26 Apr 2024 18:16:24 +1000 Subject: [PATCH] Content update for UI prediction (#27214) * Content update for UI refactor * Big update * Sharing * Remaining content updates * First big update * Prototype updates * AUGH * Fix UI comp ref * Cleanup - Fix predicted message, fix item slots, fix interaction range check. * Fix regressions * Make this predictive idk why it wasn't. * Fix slime merge * Merge conflict * Fix merge --- .../Components/HeadstandComponent.cs | 2 +- .../Components/KillSignComponent.cs | 5 +- Content.Client/Audio/Jukebox/JukeboxSystem.cs | 16 +- .../Extinguisher/FireExtinguisherComponent.cs | 6 +- Content.Client/PDA/PdaBoundUserInterface.cs | 7 +- Content.Client/Paper/PaperComponent.cs | 7 +- .../Power/ActivatableUIRequiresPowerSystem.cs | 21 +++ .../Storage/StorageBoundUserInterface.cs | 19 +- .../Storage/Systems/StorageSystem.cs | 2 +- Content.Client/Strip/StrippableSystem.cs | 2 +- .../Systems/Storage/StorageUIController.cs | 2 +- .../Interaction/InteractionTest.Helpers.cs | 2 +- .../Tests/Power/PowerTest.cs | 4 +- .../Access/Systems/AccessOverriderSystem.cs | 24 +-- .../Access/Systems/AgentIDCardSystem.cs | 4 +- .../Access/Systems/IdCardConsoleSystem.cs | 4 +- .../Components/HeadstandComponent.cs | 2 +- .../Components/KillSignComponent.cs | 5 +- .../Administration/Systems/AdminVerbSystem.cs | 2 +- .../EntitySystems/SpeakOnUIClosedSystem.cs | 1 + .../Ame/EntitySystems/AmeControllerSystem.cs | 8 +- .../Anomaly/AnomalySystem.Generator.cs | 2 +- .../Anomaly/AnomalySystem.Scanner.cs | 7 +- .../Arcade/BlockGame/BlockGame.Ui.cs | 68 ++++--- Content.Server/Arcade/BlockGame/BlockGame.cs | 6 +- .../BlockGame/BlockGameArcadeComponent.cs | 4 +- .../Arcade/BlockGame/BlockGameArcadeSystem.cs | 43 ++--- .../SpaceVillainArcadeSystem.cs | 9 +- .../SpaceVillainGame/SpaceVillainGame.Ui.cs | 3 +- .../Atmos/EntitySystems/GasAnalyzerSystem.cs | 12 +- .../Atmos/EntitySystems/GasTankSystem.cs | 2 +- .../Monitor/Components/AirAlarmComponent.cs | 2 - .../Atmos/Monitor/Systems/AirAlarmSystem.cs | 27 ++- .../EntitySystems/GasPressurePumpSystem.cs | 10 +- .../EntitySystems/GasVolumePumpSystem.cs | 10 +- .../Trinary/EntitySystems/GasFilterSystem.cs | 14 +- .../Trinary/EntitySystems/GasMixerSystem.cs | 12 +- .../Unary/EntitySystems/GasCanisterSystem.cs | 18 +- .../EntitySystems/GasThermoMachineSystem.cs | 8 +- .../Atmos/Portable/SpaceHeaterSystem.cs | 2 +- Content.Server/Audio/Jukebox/JukeboxSystem.cs | 8 +- .../Bed/Cryostorage/CryostorageSystem.cs | 18 +- .../Cargo/Systems/CargoSystem.Bounty.cs | 10 +- .../Cargo/Systems/CargoSystem.Orders.cs | 28 +-- .../Cargo/Systems/CargoSystem.Shuttle.cs | 18 +- .../CartridgeLoader/CartridgeLoaderSystem.cs | 8 +- .../EntitySystems/ChemMasterSystem.cs | 36 +--- .../EntitySystems/ReagentDispenserSystem.cs | 2 +- .../Cloning/CloningConsoleSystem.cs | 6 +- .../Systems/ChameleonClothingSystem.cs | 2 +- .../CommunicationsConsoleSystem.cs | 49 +++--- .../Configurable/ConfigurationSystem.cs | 9 +- Content.Server/Crayon/CrayonSystem.cs | 15 +- .../CrewManifest/CrewManifestSystem.cs | 10 +- .../Systems/CriminalRecordsConsoleSystem.cs | 16 +- .../Systems/SignalTimerSystem.cs | 13 +- .../Systems/NetworkConfiguratorSystem.cs | 69 ++++---- .../Disposal/Mailing/MailingUnitSystem.cs | 6 +- .../Disposal/Tube/DisposalTubeSystem.cs | 15 +- .../Unit/EntitySystems/DisposalUnitSystem.cs | 13 +- .../Systems/DoorElectronicsSystem.cs | 2 +- .../Extinguisher/FireExtinguisherComponent.cs | 2 +- .../ActivatableUIRequiresVisionSystem.cs | 22 +-- Content.Server/Fax/FaxSystem.cs | 21 +-- .../Systems/ForensicScannerSystem.cs | 21 +-- .../Gateway/Systems/GatewaySystem.cs | 8 +- .../Gravity/GravityGeneratorSystem.cs | 19 +- .../HumanoidAppearanceSystem.Modifier.cs | 14 +- .../Instruments/InstrumentComponent.cs | 5 +- .../Instruments/InstrumentSystem.cs | 29 ++- .../Interaction/InteractionSystem.cs | 27 +-- .../Kitchen/EntitySystems/MicrowaveSystem.cs | 8 +- .../EntitySystems/ReagentGrinderSystem.cs | 6 +- .../Labels/Label/HandLabelerSystem.cs | 4 +- Content.Server/Lathe/LatheSystem.cs | 7 +- .../ActivatableUIRequiresLockSystem.cs | 1 + .../MagicMirror/MagicMirrorSystem.cs | 28 ++- .../MassMedia/Systems/NewsSystem.cs | 20 +-- Content.Server/Mech/Systems/MechSystem.cs | 5 +- .../CrewMonitoringConsoleSystem.cs | 4 +- Content.Server/Medical/CryoPodSystem.cs | 7 +- .../Medical/HealthAnalyzerSystem.cs | 10 +- Content.Server/Nuke/NukeSystem.cs | 12 +- Content.Server/NukeOps/WarDeclaratorSystem.cs | 9 +- Content.Server/PAI/PAISystem.cs | 8 +- Content.Server/PDA/PdaSystem.cs | 19 +- Content.Server/PDA/Ringer/RingerSystem.cs | 17 +- Content.Server/Paper/PaperComponent.cs | 2 +- Content.Server/Paper/PaperSystem.cs | 22 +-- .../ParticleAcceleratorSystem.ControlBox.cs | 27 +-- .../ParticleAcceleratorSystem.Parts.cs | 2 +- .../ParticleAcceleratorLimiterWireAction.cs | 3 +- .../ParticleAcceleratorStrengthWireAction.cs | 3 +- .../ParticleAcceleratorToggleWireAction.cs | 8 +- Content.Server/Pinpointer/NavMapSystem.cs | 5 +- Content.Server/Pinpointer/StationMapSystem.cs | 14 +- .../ActivatableUIRequiresPowerComponent.cs | 8 - .../ActivatableUIRequiresPowerSystem.cs | 5 +- .../Power/EntitySystems/ApcSystem.cs | 16 +- .../PowerMonitoringConsoleSystem.cs | 17 +- .../Generator/PortableGeneratorSystem.cs | 17 +- Content.Server/PowerCell/PowerCellSystem.cs | 1 + .../Radio/EntitySystems/RadioDeviceSystem.cs | 12 +- .../Research/Systems/ResearchSystem.Client.cs | 4 +- .../Systems/ResearchSystem.Console.cs | 11 +- .../Systems/DiskConsoleSystem.cs | 2 +- .../SalvageSystem.ExpeditionConsole.cs | 4 +- .../Salvage/SalvageSystem.Magnet.cs | 13 +- .../SensorMonitoringConsoleComponent.cs | 2 +- .../SensorMonitoringConsoleSystem.UI.cs | 22 +-- .../Systems/EmergencyShuttleSystem.Console.cs | 34 ++-- .../Shuttles/Systems/RadarConsoleSystem.cs | 4 +- .../Shuttles/Systems/ShuttleConsoleSystem.cs | 9 +- .../Shuttles/Systems/ShuttleSystem.IFF.cs | 6 +- .../Silicons/Borgs/BorgSystem.Ui.cs | 25 +-- .../Silicons/Laws/SiliconLawSystem.cs | 4 +- .../PowerSolarControlConsoleSystem.cs | 6 +- .../GeneralStationRecordConsoleSystem.cs | 6 +- .../Storage/EntitySystems/StorageSystem.cs | 140 --------------- .../Store/Systems/StoreSystem.Ui.cs | 21 ++- Content.Server/Store/Systems/StoreSystem.cs | 5 +- Content.Server/Strip/StrippableSystem.cs | 10 +- .../SurveillanceCameraMonitorSystem.cs | 12 +- .../Systems/SurveillanceCameraRouterSystem.cs | 14 +- .../Systems/SurveillanceCameraSystem.cs | 16 +- .../ThiefUndeterminedBackpackSystem.cs | 2 +- .../UserInterface/IntrinsicUIComponent.cs | 10 +- .../UserInterface/IntrinsicUISystem.cs | 31 +--- .../VendingMachines/VendingMachineSystem.cs | 4 +- Content.Server/VoiceMask/VoiceMaskSystem.cs | 23 +-- Content.Server/Wires/WiresSystem.cs | 19 +- .../Systems/ArtifactAnalyzerSystem.cs | 5 +- .../Components/SharedHeadstandComponent.cs | 5 +- .../Components/SharedKillSignComponent.cs | 5 +- .../EntitySystems/SolutionTransferSystem.cs | 10 +- .../Containers/ItemSlot/ItemSlotsSystem.cs | 6 +- Content.Shared/Content.Shared.csproj | 3 + .../SharedFireExtinguisherComponent.cs | 2 + .../Interaction/SharedInteractionSystem.cs | 22 ++- Content.Shared/Paper/SharedPaperComponent.cs | 2 + .../ActivatableUIRequiresPowerComponent.cs | 8 + .../EntitySystems/SharedStorageSystem.cs | 166 +++++++++++++++--- Content.Shared/Storage/StorageComponent.cs | 13 -- .../UserInterface/ActivatableUIComponent.cs | 14 +- .../UserInterface/ActivatableUIEvents.cs | 6 +- ...ActivatableUIRequiresPowerCellComponent.cs | 7 +- .../ActivatableUISystem.Power.cs | 22 ++- .../UserInterface/ActivatableUISystem.cs | 49 +++--- .../Catalog/Fills/Paper/manuals.yml | 4 +- .../Entities/Clothing/Back/backpacks.yml | 6 +- .../Entities/Clothing/Back/specific.yml | 8 +- .../Clothing/Belt/base_clothingbelt.yml | 4 +- .../Entities/Clothing/Ears/specific.yml | 2 +- .../Entities/Clothing/Eyes/specific.yml | 2 +- .../Entities/Clothing/Hands/gloves.yml | 2 +- .../Entities/Clothing/Hands/specific.yml | 4 +- .../Entities/Clothing/Head/hats.yml | 6 +- .../Entities/Clothing/Head/specific.yml | 2 +- .../Entities/Clothing/Masks/specific.yml | 2 +- .../Entities/Clothing/Neck/specific.yml | 2 +- .../OuterClothing/base_clothingouter.yml | 4 +- .../Clothing/OuterClothing/specific.yml | 2 +- .../Entities/Clothing/Shoes/magboots.yml | 2 +- .../Entities/Clothing/Shoes/specific.yml | 2 +- .../Entities/Clothing/Uniforms/specific.yml | 4 +- .../Mobs/Cyborgs/base_borg_chassis.yml | 12 +- .../Prototypes/Entities/Mobs/NPCs/animals.yml | 48 ++--- .../Entities/Mobs/NPCs/behonker.yml | 4 +- .../Prototypes/Entities/Mobs/NPCs/pets.yml | 12 +- .../Entities/Mobs/NPCs/revenant.yml | 4 +- .../Prototypes/Entities/Mobs/NPCs/silicon.yml | 4 +- .../Prototypes/Entities/Mobs/NPCs/space.yml | 4 +- .../Entities/Mobs/Player/admin_ghost.yml | 26 +-- .../Entities/Mobs/Player/guardian.yml | 4 +- .../Prototypes/Entities/Mobs/Species/base.yml | 8 +- .../Entities/Mobs/Species/slime.yml | 16 +- .../Objects/Consumable/Drinks/drinks.yml | 4 +- .../Objects/Consumable/Drinks/drinks_cans.yml | 4 +- .../Objects/Consumable/Drinks/drinks_cups.yml | 4 +- .../Consumable/Drinks/drinks_special.yml | 4 +- .../Consumable/Drinks/trash_drinks.yml | 8 +- .../Consumable/Food/Containers/bowl.yml | 4 +- .../Objects/Devices/Electronics/door.yml | 4 +- .../Syndicate_Gadgets/war_declarator.yml | 2 +- .../Objects/Devices/forensic_scanner.yml | 4 +- .../Entities/Objects/Devices/pda.yml | 20 +-- .../Objects/Devices/station_beacon.yml | 4 +- .../Entities/Objects/Devices/station_map.yml | 2 +- .../Fun/Instruments/base_instruments.yml | 8 +- .../Entities/Objects/Fun/candy_bucket.yml | 4 +- .../Entities/Objects/Fun/crayons.yml | 4 +- .../Prototypes/Entities/Objects/Fun/pai.yml | 8 +- .../Entities/Objects/Misc/books.yml | 14 +- .../Objects/Misc/identification_cards.yml | 4 +- .../Entities/Objects/Misc/paper.yml | 16 +- .../Objects/Misc/subdermal_implants.yml | 6 +- .../Objects/Specific/Chapel/bibles.yml | 4 +- .../Entities/Objects/Specific/Chapel/urn.yml | 6 +- .../Objects/Specific/Kitchen/foodcarts.yml | 4 +- .../Entities/Objects/Specific/Mech/mechs.yml | 4 +- .../Medical/handheld_crew_monitor.yml | 2 +- .../Specific/Medical/healthanalyzer.yml | 2 +- .../Objects/Specific/Research/anomaly.yml | 2 +- .../Objects/Specific/Service/barber.yml | 4 +- .../Xenoarchaeology/item_artifacts.yml | 16 +- .../Xenoarchaeology/structure_artifacts.yml | 16 +- .../Entities/Objects/Specific/atmos.yml | 4 +- .../Objects/Specific/chemical-containers.yml | 2 +- .../Objects/Specific/chemistry-bottles.yml | 4 +- .../Objects/Specific/chemistry-vials.yml | 4 +- .../Entities/Objects/Specific/chemistry.yml | 12 +- .../Entities/Objects/Specific/syndicate.yml | 4 +- .../Objects/Tools/access_configurator.yml | 2 +- .../Entities/Objects/Tools/bucket.yml | 4 +- .../Entities/Objects/Tools/cowtools.yml | 4 +- .../Entities/Objects/Tools/gas_tanks.yml | 4 +- .../Entities/Objects/Tools/hand_labeler.yml | 2 +- .../Objects/Tools/handheld_mass_scanner.yml | 4 +- .../Entities/Objects/Tools/jetpacks.yml | 2 +- .../Entities/Objects/Tools/spray_painter.yml | 4 +- .../Entities/Objects/Tools/toolbox.yml | 2 +- .../Entities/Objects/Tools/tools.yml | 16 +- .../Objects/Weapons/Guns/Basic/watergun.yml | 4 +- .../Prototypes/Entities/Objects/base_item.yml | 4 +- .../Dispensers/base_structuredispensers.yml | 4 +- .../Doors/Airlocks/base_structureairlocks.yml | 4 +- .../Structures/Doors/Airlocks/highsec.yml | 4 +- .../Structures/Doors/Firelocks/firelock.yml | 2 +- .../Structures/Doors/Shutter/shutters.yml | 4 +- .../Doors/Windoors/base_structurewindoors.yml | 6 +- .../Structures/Furniture/bookshelf.yml | 4 +- .../Entities/Structures/Furniture/dresser.yml | 4 +- .../Entities/Structures/Furniture/toilet.yml | 4 +- .../Structures/Machines/Computers/arcades.yml | 8 +- .../Machines/Computers/computers.yml | 98 +++++------ .../Machines/Computers/techdiskterminal.yml | 8 +- .../Structures/Machines/Medical/cryo_pod.yml | 4 +- .../Structures/Machines/anomaly_equipment.yml | 8 +- .../Entities/Structures/Machines/bombs.yml | 2 +- .../Structures/Machines/chem_master.yml | 4 +- .../Structures/Machines/fax_machine.yml | 4 +- .../Structures/Machines/flatpacker.yml | 4 +- .../Entities/Structures/Machines/gateway.yml | 4 +- .../Structures/Machines/gravity_generator.yml | 4 +- .../Entities/Structures/Machines/jukebox.yml | 4 +- .../Entities/Structures/Machines/lathe.yml | 8 +- .../Structures/Machines/microwave.yml | 4 +- .../Entities/Structures/Machines/nuke.yml | 4 +- .../Structures/Machines/reagent_grinder.yml | 6 +- .../Entities/Structures/Machines/research.yml | 4 +- .../Entities/Structures/Machines/salvage.yml | 4 +- .../Machines/surveillance_camera_routers.yml | 4 +- .../Structures/Machines/vending_machines.yml | 8 +- .../Machines/wireless_surveillance_camera.yml | 2 +- .../Structures/Piping/Atmospherics/binary.yml | 6 +- .../Piping/Atmospherics/portable.yml | 8 +- .../Piping/Atmospherics/trinary.yml | 4 +- .../Structures/Piping/Atmospherics/unary.yml | 4 +- .../Structures/Piping/Disposal/pipes.yml | 8 +- .../Structures/Piping/Disposal/units.yml | 16 +- .../Power/Generation/PA/control_box.yml | 8 +- .../Structures/Power/Generation/ame.yml | 4 +- .../Power/Generation/portable_generator.yml | 2 +- .../Entities/Structures/Power/apc.yml | 4 +- .../Structures/Specific/Janitor/janicart.yml | 4 +- .../Storage/Canisters/gas_canisters.yml | 2 +- .../Structures/Storage/filing_cabinets.yml | 8 +- .../Entities/Structures/Storage/ore_box.yml | 4 +- .../Structures/Wallmounts/air_alarm.yml | 8 +- .../Structures/Wallmounts/fire_alarm.yml | 4 +- .../Structures/Wallmounts/intercom.yml | 4 +- .../Entities/Structures/Wallmounts/mirror.yml | 4 +- .../Wallmounts/monitors_televisions.yml | 8 +- .../Structures/Wallmounts/noticeboard.yml | 4 +- .../Structures/Wallmounts/station_map.yml | 2 +- .../Wallmounts/surveillance_camera.yml | 4 +- .../Entities/Structures/Wallmounts/timer.yml | 4 +- .../Entities/Structures/cryopod.yml | 4 +- .../XenoArch/Effects/utility_effects.yml | 4 +- 279 files changed, 1308 insertions(+), 1582 deletions(-) create mode 100644 Content.Client/Power/ActivatableUIRequiresPowerSystem.cs delete mode 100644 Content.Server/Power/Components/ActivatableUIRequiresPowerComponent.cs create mode 100644 Content.Shared/Power/Components/ActivatableUIRequiresPowerComponent.cs rename {Content.Server => Content.Shared}/UserInterface/ActivatableUIComponent.cs (87%) rename {Content.Server => Content.Shared}/UserInterface/ActivatableUIRequiresPowerCellComponent.cs (65%) rename {Content.Server => Content.Shared}/UserInterface/ActivatableUISystem.Power.cs (82%) rename {Content.Server => Content.Shared}/UserInterface/ActivatableUISystem.cs (81%) diff --git a/Content.Client/Administration/Components/HeadstandComponent.cs b/Content.Client/Administration/Components/HeadstandComponent.cs index d95e74576b..a4e3bfc5aa 100644 --- a/Content.Client/Administration/Components/HeadstandComponent.cs +++ b/Content.Client/Administration/Components/HeadstandComponent.cs @@ -3,7 +3,7 @@ using Robust.Shared.GameStates; namespace Content.Client.Administration.Components; -[RegisterComponent, NetworkedComponent] +[RegisterComponent] public sealed partial class HeadstandComponent : SharedHeadstandComponent { diff --git a/Content.Client/Administration/Components/KillSignComponent.cs b/Content.Client/Administration/Components/KillSignComponent.cs index 1cf47b93ff..91c44ef3f2 100644 --- a/Content.Client/Administration/Components/KillSignComponent.cs +++ b/Content.Client/Administration/Components/KillSignComponent.cs @@ -3,6 +3,5 @@ using Robust.Shared.GameStates; namespace Content.Client.Administration.Components; -[NetworkedComponent, RegisterComponent] -public sealed partial class KillSignComponent : SharedKillSignComponent -{ } +[RegisterComponent] +public sealed partial class KillSignComponent : SharedKillSignComponent; diff --git a/Content.Client/Audio/Jukebox/JukeboxSystem.cs b/Content.Client/Audio/Jukebox/JukeboxSystem.cs index 53bde82a78..dd4a5bbb9b 100644 --- a/Content.Client/Audio/Jukebox/JukeboxSystem.cs +++ b/Content.Client/Audio/Jukebox/JukeboxSystem.cs @@ -11,6 +11,7 @@ public sealed class JukeboxSystem : SharedJukeboxSystem [Dependency] private readonly IPrototypeManager _protoManager = default!; [Dependency] private readonly AnimationPlayerSystem _animationPlayer = default!; [Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!; + [Dependency] private readonly SharedUserInterfaceSystem _uiSystem = default!; public override void Initialize() { @@ -35,13 +36,10 @@ public sealed class JukeboxSystem : SharedJukeboxSystem var query = AllEntityQuery(); - while (query.MoveNext(out _, out var ui)) + while (query.MoveNext(out var uid, out _, out var ui)) { - if (!ui.OpenInterfaces.TryGetValue(JukeboxUiKey.Key, out var baseBui) || - baseBui is not JukeboxBoundUserInterface bui) - { + if (!_uiSystem.TryGetOpenUi((uid, ui), JukeboxUiKey.Key, out var bui)) continue; - } bui.PopulateMusic(); } @@ -49,15 +47,9 @@ public sealed class JukeboxSystem : SharedJukeboxSystem private void OnJukeboxAfterState(Entity ent, ref AfterAutoHandleStateEvent args) { - if (!TryComp(ent, out UserInterfaceComponent? ui)) + if (!_uiSystem.TryGetOpenUi(ent.Owner, JukeboxUiKey.Key, out var bui)) return; - if (!ui.OpenInterfaces.TryGetValue(JukeboxUiKey.Key, out var baseBui) || - baseBui is not JukeboxBoundUserInterface bui) - { - return; - } - bui.Reload(); } diff --git a/Content.Client/Extinguisher/FireExtinguisherComponent.cs b/Content.Client/Extinguisher/FireExtinguisherComponent.cs index 126c172924..324b05a93d 100644 --- a/Content.Client/Extinguisher/FireExtinguisherComponent.cs +++ b/Content.Client/Extinguisher/FireExtinguisherComponent.cs @@ -3,7 +3,5 @@ using Robust.Shared.GameStates; namespace Content.Client.Extinguisher; -[NetworkedComponent, RegisterComponent] -public sealed partial class FireExtinguisherComponent : SharedFireExtinguisherComponent -{ -} +[RegisterComponent] +public sealed partial class FireExtinguisherComponent : SharedFireExtinguisherComponent; diff --git a/Content.Client/PDA/PdaBoundUserInterface.cs b/Content.Client/PDA/PdaBoundUserInterface.cs index ef9d6e8b9b..07352b512b 100644 --- a/Content.Client/PDA/PdaBoundUserInterface.cs +++ b/Content.Client/PDA/PdaBoundUserInterface.cs @@ -21,7 +21,6 @@ namespace Content.Client.PDA protected override void Open() { base.Open(); - SendMessage(new PdaRequestUpdateInterfaceMessage()); _menu = new PdaMenu(); _menu.OpenCenteredLeft(); _menu.OnClose += Close; @@ -32,17 +31,17 @@ namespace Content.Client.PDA _menu.EjectIdButton.OnPressed += _ => { - SendMessage(new ItemSlotButtonPressedEvent(PdaComponent.PdaIdSlotId)); + SendPredictedMessage(new ItemSlotButtonPressedEvent(PdaComponent.PdaIdSlotId)); }; _menu.EjectPenButton.OnPressed += _ => { - SendMessage(new ItemSlotButtonPressedEvent(PdaComponent.PdaPenSlotId)); + SendPredictedMessage(new ItemSlotButtonPressedEvent(PdaComponent.PdaPenSlotId)); }; _menu.EjectPaiButton.OnPressed += _ => { - SendMessage(new ItemSlotButtonPressedEvent(PdaComponent.PdaPaiSlotId)); + SendPredictedMessage(new ItemSlotButtonPressedEvent(PdaComponent.PdaPaiSlotId)); }; _menu.ActivateMusicButton.OnPressed += _ => diff --git a/Content.Client/Paper/PaperComponent.cs b/Content.Client/Paper/PaperComponent.cs index d197cd3721..1dc827bf7e 100644 --- a/Content.Client/Paper/PaperComponent.cs +++ b/Content.Client/Paper/PaperComponent.cs @@ -1,9 +1,6 @@ using Content.Shared.Paper; -using Robust.Shared.GameStates; namespace Content.Client.Paper; -[NetworkedComponent, RegisterComponent] -public sealed partial class PaperComponent : SharedPaperComponent -{ -} +[RegisterComponent] +public sealed partial class PaperComponent : SharedPaperComponent; diff --git a/Content.Client/Power/ActivatableUIRequiresPowerSystem.cs b/Content.Client/Power/ActivatableUIRequiresPowerSystem.cs new file mode 100644 index 0000000000..60ed8d87b9 --- /dev/null +++ b/Content.Client/Power/ActivatableUIRequiresPowerSystem.cs @@ -0,0 +1,21 @@ +using Content.Shared.Power.Components; +using Content.Shared.UserInterface; +using Content.Shared.Wires; + +namespace Content.Client.Power; + +public sealed class ActivatableUIRequiresPowerSystem : EntitySystem +{ + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnActivate); + } + + private void OnActivate(EntityUid uid, ActivatableUIRequiresPowerComponent component, ActivatableUIOpenAttemptEvent args) + { + // Client can't predict the power properly at the moment so rely upon the server to do it. + args.Cancel(); + } +} diff --git a/Content.Client/Storage/StorageBoundUserInterface.cs b/Content.Client/Storage/StorageBoundUserInterface.cs index f7fdbb8367..899df30f7f 100644 --- a/Content.Client/Storage/StorageBoundUserInterface.cs +++ b/Content.Client/Storage/StorageBoundUserInterface.cs @@ -17,6 +17,14 @@ public sealed class StorageBoundUserInterface : BoundUserInterface _storage = _entManager.System(); } + protected override void Open() + { + base.Open(); + + if (_entManager.TryGetComponent(Owner, out var comp)) + _storage.OpenStorageWindow((Owner, comp)); + } + protected override void Dispose(bool disposing) { base.Dispose(disposing); @@ -25,16 +33,5 @@ public sealed class StorageBoundUserInterface : BoundUserInterface _storage.CloseStorageWindow(Owner); } - - protected override void ReceiveMessage(BoundUserInterfaceMessage message) - { - base.ReceiveMessage(message); - - if (message is StorageModifyWindowMessage) - { - if (_entManager.TryGetComponent(Owner, out var comp)) - _storage.OpenStorageWindow((Owner, comp)); - } - } } diff --git a/Content.Client/Storage/Systems/StorageSystem.cs b/Content.Client/Storage/Systems/StorageSystem.cs index 2728bfa9e8..8bf0dcd981 100644 --- a/Content.Client/Storage/Systems/StorageSystem.cs +++ b/Content.Client/Storage/Systems/StorageSystem.cs @@ -111,7 +111,7 @@ public sealed class StorageSystem : SharedStorageSystem if (!Resolve(entity, ref entity.Comp, false)) return; - if (entity.Comp.OpenInterfaces.GetValueOrDefault(StorageComponent.StorageUiKey.Key) is not { } bui) + if (entity.Comp.ClientOpenInterfaces.GetValueOrDefault(StorageComponent.StorageUiKey.Key) is not { } bui) return; bui.Close(); diff --git a/Content.Client/Strip/StrippableSystem.cs b/Content.Client/Strip/StrippableSystem.cs index c5083d2204..23f38e9d51 100644 --- a/Content.Client/Strip/StrippableSystem.cs +++ b/Content.Client/Strip/StrippableSystem.cs @@ -35,7 +35,7 @@ public sealed class StrippableSystem : SharedStrippableSystem if (!TryComp(uid, out UserInterfaceComponent? uiComp)) return; - foreach (var ui in uiComp.OpenInterfaces.Values) + foreach (var ui in uiComp.ClientOpenInterfaces.Values) { if (ui is StrippableBoundUserInterface stripUi) stripUi.DirtyMenu(); diff --git a/Content.Client/UserInterface/Systems/Storage/StorageUIController.cs b/Content.Client/UserInterface/Systems/Storage/StorageUIController.cs index b865b54dd0..346469d29d 100644 --- a/Content.Client/UserInterface/Systems/Storage/StorageUIController.cs +++ b/Content.Client/UserInterface/Systems/Storage/StorageUIController.cs @@ -262,7 +262,7 @@ public sealed class StorageUIController : UIController, IOnSystemChanged> ConvertAccessHashSetsToList(List>> accessHashsets) { - List> accessList = new List>(); + var accessList = new List>(); - if (accessHashsets != null && accessHashsets.Any()) + if (accessHashsets.Count <= 0) + return accessList; + + foreach (var hashSet in accessHashsets) { - foreach (HashSet> hashSet in accessHashsets) - { - foreach (ProtoId hash in hashSet.ToArray()) - { - accessList.Add(hash); - } - } + accessList.AddRange(hashSet); } return accessList; diff --git a/Content.Server/Access/Systems/AgentIDCardSystem.cs b/Content.Server/Access/Systems/AgentIDCardSystem.cs index bd4d3b3f23..2c4425ec10 100644 --- a/Content.Server/Access/Systems/AgentIDCardSystem.cs +++ b/Content.Server/Access/Systems/AgentIDCardSystem.cs @@ -61,14 +61,14 @@ namespace Content.Server.Access.Systems private void AfterUIOpen(EntityUid uid, AgentIDCardComponent component, AfterActivatableUIOpenEvent args) { - if (!_uiSystem.TryGetUi(uid, AgentIDCardUiKey.Key, out var ui)) + if (!_uiSystem.HasUi(uid, AgentIDCardUiKey.Key)) return; if (!TryComp(uid, out var idCard)) return; var state = new AgentIDCardBoundUserInterfaceState(idCard.FullName ?? "", idCard.JobTitle ?? "", component.Icons); - _uiSystem.SetUiState(ui, state, args.Session); + _uiSystem.SetUiState(uid, AgentIDCardUiKey.Key, state); } private void OnJobChanged(EntityUid uid, AgentIDCardComponent comp, AgentIDCardJobChangedMessage args) diff --git a/Content.Server/Access/Systems/IdCardConsoleSystem.cs b/Content.Server/Access/Systems/IdCardConsoleSystem.cs index db8b9d036e..e680b0c6f4 100644 --- a/Content.Server/Access/Systems/IdCardConsoleSystem.cs +++ b/Content.Server/Access/Systems/IdCardConsoleSystem.cs @@ -41,7 +41,7 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem private void OnWriteToTargetIdMessage(EntityUid uid, IdCardConsoleComponent component, WriteToTargetIdMessage args) { - if (args.Session.AttachedEntity is not { Valid: true } player) + if (args.Actor is not { Valid: true } player) return; TryWriteToTargetId(uid, args.FullName, args.JobTitle, args.AccessList, args.JobPrototype, player, component); @@ -104,7 +104,7 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem Name(targetId)); } - _userInterface.TrySetUiState(uid, IdCardConsoleUiKey.Key, newState); + _userInterface.SetUiState(uid, IdCardConsoleUiKey.Key, newState); } /// diff --git a/Content.Server/Administration/Components/HeadstandComponent.cs b/Content.Server/Administration/Components/HeadstandComponent.cs index 8472b5ad36..2ab097fad4 100644 --- a/Content.Server/Administration/Components/HeadstandComponent.cs +++ b/Content.Server/Administration/Components/HeadstandComponent.cs @@ -3,7 +3,7 @@ using Robust.Shared.GameStates; namespace Content.Server.Administration.Components; -[RegisterComponent, NetworkedComponent] +[RegisterComponent] public sealed partial class HeadstandComponent : SharedHeadstandComponent { diff --git a/Content.Server/Administration/Components/KillSignComponent.cs b/Content.Server/Administration/Components/KillSignComponent.cs index e29ce202dd..11479c32fc 100644 --- a/Content.Server/Administration/Components/KillSignComponent.cs +++ b/Content.Server/Administration/Components/KillSignComponent.cs @@ -3,6 +3,5 @@ using Robust.Shared.GameStates; namespace Content.Server.Administration.Components; -[NetworkedComponent, RegisterComponent] -public sealed partial class KillSignComponent : SharedKillSignComponent -{ } +[RegisterComponent] +public sealed partial class KillSignComponent : SharedKillSignComponent; diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.cs b/Content.Server/Administration/Systems/AdminVerbSystem.cs index f5b237b449..5bb75b4c99 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.cs @@ -463,7 +463,7 @@ namespace Content.Server.Administration.Systems Text = Loc.GetString("configure-verb-get-data-text"), Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/settings.svg.192dpi.png")), Category = VerbCategory.Debug, - Act = () => _uiSystem.TryOpen(args.Target, ConfigurationUiKey.Key, actor.PlayerSession) + Act = () => _uiSystem.OpenUi(args.Target, ConfigurationUiKey.Key, actor.PlayerSession) }; args.Verbs.Add(verb); } diff --git a/Content.Server/Advertise/EntitySystems/SpeakOnUIClosedSystem.cs b/Content.Server/Advertise/EntitySystems/SpeakOnUIClosedSystem.cs index 048f59b8d3..232b4b7eda 100644 --- a/Content.Server/Advertise/EntitySystems/SpeakOnUIClosedSystem.cs +++ b/Content.Server/Advertise/EntitySystems/SpeakOnUIClosedSystem.cs @@ -4,6 +4,7 @@ using Content.Server.UserInterface; using Content.Shared.Advertise; using Robust.Shared.Prototypes; using Robust.Shared.Random; +using ActivatableUIComponent = Content.Shared.UserInterface.ActivatableUIComponent; namespace Content.Server.Advertise; diff --git a/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs b/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs index 5bf78bde85..1b323d6643 100644 --- a/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs +++ b/Content.Server/Ame/EntitySystems/AmeControllerSystem.cs @@ -129,11 +129,11 @@ public sealed class AmeControllerSystem : EntitySystem if (!Resolve(uid, ref controller)) return; - if (!_userInterfaceSystem.TryGetUi(uid, AmeControllerUiKey.Key, out var bui)) + if (!_userInterfaceSystem.HasUi(uid, AmeControllerUiKey.Key)) return; var state = GetUiState(uid, controller); - _userInterfaceSystem.SetUiState(bui, state); + _userInterfaceSystem.SetUiState(uid, AmeControllerUiKey.Key, state); controller.NextUIUpdate = _gameTiming.CurTime + controller.UpdateUIPeriod; } @@ -324,7 +324,7 @@ public sealed class AmeControllerSystem : EntitySystem private void OnUiButtonPressed(EntityUid uid, AmeControllerComponent comp, UiButtonPressedMessage msg) { - var user = msg.Session.AttachedEntity; + var user = msg.Actor; if (!Exists(user)) return; @@ -334,7 +334,7 @@ public sealed class AmeControllerSystem : EntitySystem _ => true, }; - if (!PlayerCanUseController(uid, user!.Value, needsPower, comp)) + if (!PlayerCanUseController(uid, user, needsPower, comp)) return; _audioSystem.PlayPvs(comp.ClickSound, uid, AudioParams.Default.WithVolume(-2f)); diff --git a/Content.Server/Anomaly/AnomalySystem.Generator.cs b/Content.Server/Anomaly/AnomalySystem.Generator.cs index 7aa1a8935f..056a985cbe 100644 --- a/Content.Server/Anomaly/AnomalySystem.Generator.cs +++ b/Content.Server/Anomaly/AnomalySystem.Generator.cs @@ -61,7 +61,7 @@ public sealed partial class AnomalySystem var materialAmount = _material.GetMaterialAmount(uid, component.RequiredMaterial); var state = new AnomalyGeneratorUserInterfaceState(component.CooldownEndTime, materialAmount, component.MaterialPerAnomaly); - _ui.TrySetUiState(uid, AnomalyGeneratorUiKey.Key, state); + _ui.SetUiState(uid, AnomalyGeneratorUiKey.Key, state); } public void TryGeneratorCreateAnomaly(EntityUid uid, AnomalyGeneratorComponent? component = null) diff --git a/Content.Server/Anomaly/AnomalySystem.Scanner.cs b/Content.Server/Anomaly/AnomalySystem.Scanner.cs index bce508903d..39c0d08b55 100644 --- a/Content.Server/Anomaly/AnomalySystem.Scanner.cs +++ b/Content.Server/Anomaly/AnomalySystem.Scanner.cs @@ -31,7 +31,8 @@ public sealed partial class AnomalySystem { if (component.ScannedAnomaly != args.Anomaly) continue; - _ui.TryCloseAll(uid, AnomalyScannerUiKey.Key); + + _ui.CloseUi(uid, AnomalyScannerUiKey.Key); } } @@ -108,7 +109,7 @@ public sealed partial class AnomalySystem Popup.PopupEntity(Loc.GetString("anomaly-scanner-component-scan-complete"), uid); UpdateScannerWithNewAnomaly(uid, args.Args.Target.Value, component); - if (TryComp(args.Args.User, out var actor)) _ui.TryOpen(uid, AnomalyScannerUiKey.Key, actor.PlayerSession); + _ui.OpenUi(uid, AnomalyScannerUiKey.Key, args.User); args.Handled = true; } @@ -123,7 +124,7 @@ public sealed partial class AnomalySystem nextPulse = anomalyComponent.NextPulseTime; var state = new AnomalyScannerUserInterfaceState(GetScannerMessage(component), nextPulse); - _ui.TrySetUiState(uid, AnomalyScannerUiKey.Key, state); + _ui.SetUiState(uid, AnomalyScannerUiKey.Key, state); } public void UpdateScannerWithNewAnomaly(EntityUid scanner, EntityUid anomaly, AnomalyScannerComponent? scannerComp = null, AnomalyComponent? anomalyComp = null) diff --git a/Content.Server/Arcade/BlockGame/BlockGame.Ui.cs b/Content.Server/Arcade/BlockGame/BlockGame.Ui.cs index ef69600783..cd22f1f6d3 100644 --- a/Content.Server/Arcade/BlockGame/BlockGame.Ui.cs +++ b/Content.Server/Arcade/BlockGame/BlockGame.Ui.cs @@ -157,39 +157,37 @@ public sealed partial class BlockGame /// The message to broadcase to all players/spectators. private void SendMessage(BoundUserInterfaceMessage message) { - if (_uiSystem.TryGetUi(_owner, BlockGameUiKey.Key, out var bui)) - _uiSystem.SendUiMessage(bui, message); + _uiSystem.ServerSendUiMessage(_entityManager.GetEntity(message.Entity), BlockGameUiKey.Key, message); } /// /// Handles sending a message to a specific player/spectator. /// /// The message to send to a specific player/spectator. - /// The target recipient. - private void SendMessage(BoundUserInterfaceMessage message, ICommonSession session) + /// The target recipient. + private void SendMessage(BoundUserInterfaceMessage message, EntityUid actor) { - if (_uiSystem.TryGetUi(_owner, BlockGameUiKey.Key, out var bui)) - _uiSystem.TrySendUiMessage(bui, message, session); + _uiSystem.ServerSendUiMessage(_entityManager.GetEntity(message.Entity), BlockGameUiKey.Key, message, actor); } /// /// Handles sending the current state of the game to a player that has just opened the UI. /// - /// The target recipient. - public void UpdateNewPlayerUI(ICommonSession session) + /// The target recipient. + public void UpdateNewPlayerUI(EntityUid actor) { if (_gameOver) { - SendMessage(new BlockGameMessages.BlockGameGameOverScreenMessage(Points, _highScorePlacement?.LocalPlacement, _highScorePlacement?.GlobalPlacement), session); + SendMessage(new BlockGameMessages.BlockGameGameOverScreenMessage(Points, _highScorePlacement?.LocalPlacement, _highScorePlacement?.GlobalPlacement), actor); return; } if (Paused) - SendMessage(new BlockGameMessages.BlockGameSetScreenMessage(BlockGameMessages.BlockGameScreen.Pause, Started), session); + SendMessage(new BlockGameMessages.BlockGameSetScreenMessage(BlockGameMessages.BlockGameScreen.Pause, Started), actor); else - SendMessage(new BlockGameMessages.BlockGameSetScreenMessage(BlockGameMessages.BlockGameScreen.Game, Started), session); + SendMessage(new BlockGameMessages.BlockGameSetScreenMessage(BlockGameMessages.BlockGameScreen.Game, Started), actor); - FullUpdate(session); + FullUpdate(actor); } /// @@ -209,14 +207,14 @@ public sealed partial class BlockGame /// Handles broadcasting the full player-visible game state to a specific player/spectator. /// /// The target recipient. - private void FullUpdate(ICommonSession session) + private void FullUpdate(EntityUid actor) { - UpdateFieldUI(session); - SendNextPieceUpdate(session); - SendHoldPieceUpdate(session); - SendLevelUpdate(session); - SendPointsUpdate(session); - SendHighscoreUpdate(session); + UpdateFieldUI(actor); + SendNextPieceUpdate(actor); + SendHoldPieceUpdate(actor); + SendLevelUpdate(actor); + SendPointsUpdate(actor); + SendHighscoreUpdate(actor); } /// @@ -234,14 +232,13 @@ public sealed partial class BlockGame /// /// Handles broadcasting the current location of all of the blocks in the playfield + the active piece to a specific player/spectator. /// - /// The target recipient. - public void UpdateFieldUI(ICommonSession session) + public void UpdateFieldUI(EntityUid actor) { if (!Started) return; var computedField = ComputeField(); - SendMessage(new BlockGameMessages.BlockGameVisualUpdateMessage(computedField.ToArray(), BlockGameMessages.BlockGameVisualType.GameField), session); + SendMessage(new BlockGameMessages.BlockGameVisualUpdateMessage(computedField.ToArray(), BlockGameMessages.BlockGameVisualType.GameField), actor); } /// @@ -282,10 +279,9 @@ public sealed partial class BlockGame /// /// Broadcasts the state of the next queued piece to a specific viewer. /// - /// The target recipient. - private void SendNextPieceUpdate(ICommonSession session) + private void SendNextPieceUpdate(EntityUid actor) { - SendMessage(new BlockGameMessages.BlockGameVisualUpdateMessage(NextPiece.BlocksForPreview(), BlockGameMessages.BlockGameVisualType.NextBlock), session); + SendMessage(new BlockGameMessages.BlockGameVisualUpdateMessage(NextPiece.BlocksForPreview(), BlockGameMessages.BlockGameVisualType.NextBlock), actor); } /// @@ -302,13 +298,12 @@ public sealed partial class BlockGame /// /// Broadcasts the state of the currently held piece to a specific viewer. /// - /// The target recipient. - private void SendHoldPieceUpdate(ICommonSession session) + private void SendHoldPieceUpdate(EntityUid actor) { if (HeldPiece.HasValue) - SendMessage(new BlockGameMessages.BlockGameVisualUpdateMessage(HeldPiece.Value.BlocksForPreview(), BlockGameMessages.BlockGameVisualType.HoldBlock), session); + SendMessage(new BlockGameMessages.BlockGameVisualUpdateMessage(HeldPiece.Value.BlocksForPreview(), BlockGameMessages.BlockGameVisualType.HoldBlock), actor); else - SendMessage(new BlockGameMessages.BlockGameVisualUpdateMessage(Array.Empty(), BlockGameMessages.BlockGameVisualType.HoldBlock), session); + SendMessage(new BlockGameMessages.BlockGameVisualUpdateMessage(Array.Empty(), BlockGameMessages.BlockGameVisualType.HoldBlock), actor); } /// @@ -322,10 +317,9 @@ public sealed partial class BlockGame /// /// Broadcasts the current game level to a specific viewer. /// - /// The target recipient. - private void SendLevelUpdate(ICommonSession session) + private void SendLevelUpdate(EntityUid actor) { - SendMessage(new BlockGameMessages.BlockGameLevelUpdateMessage(Level), session); + SendMessage(new BlockGameMessages.BlockGameLevelUpdateMessage(Level), actor); } /// @@ -339,10 +333,9 @@ public sealed partial class BlockGame /// /// Broadcasts the current game score to a specific viewer. /// - /// The target recipient. - private void SendPointsUpdate(ICommonSession session) + private void SendPointsUpdate(EntityUid actor) { - SendMessage(new BlockGameMessages.BlockGameScoreUpdateMessage(Points), session); + SendMessage(new BlockGameMessages.BlockGameScoreUpdateMessage(Points), actor); } /// @@ -356,9 +349,8 @@ public sealed partial class BlockGame /// /// Broadcasts the current game high score positions to a specific viewer. /// - /// The target recipient. - private void SendHighscoreUpdate(ICommonSession session) + private void SendHighscoreUpdate(EntityUid actor) { - SendMessage(new BlockGameMessages.BlockGameHighScoreUpdateMessage(_arcadeSystem.GetLocalHighscores(), _arcadeSystem.GetGlobalHighscores()), session); + SendMessage(new BlockGameMessages.BlockGameHighScoreUpdateMessage(_arcadeSystem.GetLocalHighscores(), _arcadeSystem.GetGlobalHighscores()), actor); } } diff --git a/Content.Server/Arcade/BlockGame/BlockGame.cs b/Content.Server/Arcade/BlockGame/BlockGame.cs index 3af1828d56..82063b6443 100644 --- a/Content.Server/Arcade/BlockGame/BlockGame.cs +++ b/Content.Server/Arcade/BlockGame/BlockGame.cs @@ -9,8 +9,8 @@ public sealed partial class BlockGame { [Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IRobustRandom _random = default!; - private readonly ArcadeSystem _arcadeSystem = default!; - private readonly UserInterfaceSystem _uiSystem = default!; + private readonly ArcadeSystem _arcadeSystem; + private readonly UserInterfaceSystem _uiSystem; /// /// What entity is currently hosting this game of NT-BG. @@ -78,7 +78,7 @@ public sealed partial class BlockGame _gameOver = true; if (_entityManager.TryGetComponent(_owner, out var cabinet) - && _entityManager.TryGetComponent(cabinet.Player?.AttachedEntity, out var meta)) + && _entityManager.TryGetComponent(cabinet.Player, out var meta)) { _highScorePlacement = _arcadeSystem.RegisterHighScore(meta.EntityName, Points); SendHighscoreUpdate(); diff --git a/Content.Server/Arcade/BlockGame/BlockGameArcadeComponent.cs b/Content.Server/Arcade/BlockGame/BlockGameArcadeComponent.cs index 5613d91544..75952b0a33 100644 --- a/Content.Server/Arcade/BlockGame/BlockGameArcadeComponent.cs +++ b/Content.Server/Arcade/BlockGame/BlockGameArcadeComponent.cs @@ -13,10 +13,10 @@ public sealed partial class BlockGameArcadeComponent : Component /// /// The player currently playing the active session of NT-BG. /// - public ICommonSession? Player = null; + public EntityUid? Player = null; /// /// The players currently viewing (but not playing) the active session of NT-BG. /// - public readonly List Spectators = new(); + public readonly List Spectators = new(); } diff --git a/Content.Server/Arcade/BlockGame/BlockGameArcadeSystem.cs b/Content.Server/Arcade/BlockGame/BlockGameArcadeSystem.cs index ad65c5cca6..561cad8d7e 100644 --- a/Content.Server/Arcade/BlockGame/BlockGameArcadeSystem.cs +++ b/Content.Server/Arcade/BlockGame/BlockGameArcadeSystem.cs @@ -37,14 +37,12 @@ public sealed class BlockGameArcadeSystem : EntitySystem } } - private void UpdatePlayerStatus(EntityUid uid, ICommonSession session, PlayerBoundUserInterface? bui = null, BlockGameArcadeComponent? blockGame = null) + private void UpdatePlayerStatus(EntityUid uid, EntityUid actor, BlockGameArcadeComponent? blockGame = null) { if (!Resolve(uid, ref blockGame)) return; - if (bui == null && !_uiSystem.TryGetUi(uid, BlockGameUiKey.Key, out bui)) - return; - _uiSystem.TrySendUiMessage(bui, new BlockGameMessages.BlockGameUserStatusMessage(blockGame.Player == session), session); + _uiSystem.ServerSendUiMessage(uid, BlockGameUiKey.Key, new BlockGameMessages.BlockGameUserStatusMessage(blockGame.Player == actor), actor); } private void OnComponentInit(EntityUid uid, BlockGameArcadeComponent component, ComponentInit args) @@ -54,33 +52,21 @@ public sealed class BlockGameArcadeSystem : EntitySystem private void OnAfterUIOpen(EntityUid uid, BlockGameArcadeComponent component, AfterActivatableUIOpenEvent args) { - if (!TryComp(args.User, out var actor)) - return; - if (!_uiSystem.TryGetUi(uid, BlockGameUiKey.Key, out var bui)) - return; - - var session = actor.PlayerSession; - if (!bui.SubscribedSessions.Contains(session)) - return; - if (component.Player == null) - component.Player = session; + component.Player = args.Actor; else - component.Spectators.Add(session); + component.Spectators.Add(args.Actor); - UpdatePlayerStatus(uid, session, bui, component); - component.Game?.UpdateNewPlayerUI(session); + UpdatePlayerStatus(uid, args.Actor, component); + component.Game?.UpdateNewPlayerUI(args.Actor); } private void OnAfterUiClose(EntityUid uid, BlockGameArcadeComponent component, BoundUIClosedEvent args) { - if (args.Session is not { } session) - return; - - if (component.Player != session) + if (component.Player != args.Actor) { - component.Spectators.Remove(session); - UpdatePlayerStatus(uid, session, blockGame: component); + component.Spectators.Remove(args.Actor); + UpdatePlayerStatus(uid, args.Actor, blockGame: component); return; } @@ -88,11 +74,11 @@ public sealed class BlockGameArcadeSystem : EntitySystem if (component.Spectators.Count > 0) { component.Player = component.Spectators[0]; - component.Spectators.Remove(component.Player); - UpdatePlayerStatus(uid, component.Player, blockGame: component); + component.Spectators.Remove(component.Player.Value); + UpdatePlayerStatus(uid, component.Player.Value, blockGame: component); } - UpdatePlayerStatus(uid, temp, blockGame: component); + UpdatePlayerStatus(uid, temp.Value, blockGame: component); } private void OnBlockPowerChanged(EntityUid uid, BlockGameArcadeComponent component, ref PowerChangedEvent args) @@ -100,8 +86,7 @@ public sealed class BlockGameArcadeSystem : EntitySystem if (args.Powered) return; - if (_uiSystem.TryGetUi(uid, BlockGameUiKey.Key, out var bui)) - _uiSystem.CloseAll(bui); + _uiSystem.CloseUi(uid, BlockGameUiKey.Key); component.Player = null; component.Spectators.Clear(); } @@ -112,7 +97,7 @@ public sealed class BlockGameArcadeSystem : EntitySystem return; if (!BlockGameUiKey.Key.Equals(msg.UiKey)) return; - if (msg.Session != component.Player) + if (msg.Actor != component.Player) return; if (msg.PlayerAction == BlockGamePlayerAction.NewGame) diff --git a/Content.Server/Arcade/SpaceVillainGame/SpaceVillainArcadeSystem.cs b/Content.Server/Arcade/SpaceVillainGame/SpaceVillainArcadeSystem.cs index f60d88ebf7..f7758f11f1 100644 --- a/Content.Server/Arcade/SpaceVillainGame/SpaceVillainArcadeSystem.cs +++ b/Content.Server/Arcade/SpaceVillainGame/SpaceVillainArcadeSystem.cs @@ -90,12 +90,10 @@ public sealed partial class SpaceVillainArcadeSystem : EntitySystem _audioSystem.PlayPvs(component.NewGameSound, uid, AudioParams.Default.WithVolume(-4f)); component.Game = new SpaceVillainGame(uid, component, this); - if (_uiSystem.TryGetUi(uid, SpaceVillainArcadeUiKey.Key, out var bui)) - _uiSystem.SendUiMessage(bui, component.Game.GenerateMetaDataMessage()); + _uiSystem.ServerSendUiMessage(uid, SpaceVillainArcadeUiKey.Key, component.Game.GenerateMetaDataMessage()); break; case PlayerAction.RequestData: - if (_uiSystem.TryGetUi(uid, SpaceVillainArcadeUiKey.Key, out bui)) - _uiSystem.SendUiMessage(bui, component.Game.GenerateMetaDataMessage()); + _uiSystem.ServerSendUiMessage(uid, SpaceVillainArcadeUiKey.Key, component.Game.GenerateMetaDataMessage()); break; } } @@ -110,7 +108,6 @@ public sealed partial class SpaceVillainArcadeSystem : EntitySystem if (TryComp(uid, out var power) && power.Powered) return; - if (_uiSystem.TryGetUi(uid, SpaceVillainArcadeUiKey.Key, out var bui)) - _uiSystem.CloseAll(bui); + _uiSystem.CloseUi(uid, SpaceVillainArcadeUiKey.Key); } } diff --git a/Content.Server/Arcade/SpaceVillainGame/SpaceVillainGame.Ui.cs b/Content.Server/Arcade/SpaceVillainGame/SpaceVillainGame.Ui.cs index 890e9888a7..ebcfb8e3f6 100644 --- a/Content.Server/Arcade/SpaceVillainGame/SpaceVillainGame.Ui.cs +++ b/Content.Server/Arcade/SpaceVillainGame/SpaceVillainGame.Ui.cs @@ -9,8 +9,7 @@ public sealed partial class SpaceVillainGame /// private void UpdateUi(EntityUid uid, bool metadata = false) { - if (_uiSystem.TryGetUi(uid, SpaceVillainArcadeUiKey.Key, out var bui)) - _uiSystem.SendUiMessage(bui, metadata ? GenerateMetaDataMessage() : GenerateUpdateMessage()); + _uiSystem.ServerSendUiMessage(uid, SpaceVillainArcadeUiKey.Key, metadata ? GenerateMetaDataMessage() : GenerateUpdateMessage()); } private void UpdateUi(EntityUid uid, string message1, string message2, bool metadata = false) diff --git a/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs b/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs index 1f5ca80935..15e1dde4ec 100644 --- a/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs @@ -118,8 +118,7 @@ namespace Content.Server.Atmos.EntitySystems if (!Resolve(uid, ref component)) return; - if (user != null && TryComp(user, out var actor)) - _userInterface.TryClose(uid, GasAnalyzerUiKey.Key, actor.PlayerSession); + _userInterface.CloseUi(uid, GasAnalyzerUiKey.Key, user); component.Enabled = false; Dirty(uid, component); @@ -132,8 +131,6 @@ namespace Content.Server.Atmos.EntitySystems /// private void OnDisabledMessage(EntityUid uid, GasAnalyzerComponent component, GasAnalyzerDisableMessage message) { - if (message.Session.AttachedEntity is not { Valid: true }) - return; DisableAnalyzer(uid, component); } @@ -142,10 +139,7 @@ namespace Content.Server.Atmos.EntitySystems if (!Resolve(uid, ref component, false)) return; - if (!TryComp(user, out var actor)) - return; - - _userInterface.TryOpen(uid, GasAnalyzerUiKey.Key, actor.PlayerSession); + _userInterface.OpenUi(uid, GasAnalyzerUiKey.Key, user); } /// @@ -242,7 +236,7 @@ namespace Content.Server.Atmos.EntitySystems if (gasMixList.Count == 0) return false; - _userInterface.TrySendUiMessage(uid, GasAnalyzerUiKey.Key, + _userInterface.ServerSendUiMessage(uid, GasAnalyzerUiKey.Key, new GasAnalyzerUserMessage(gasMixList.ToArray(), component.Target != null ? Name(component.Target.Value) : string.Empty, GetNetEntity(component.Target) ?? NetEntity.Invalid, diff --git a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs index dd84756e45..07594820fc 100644 --- a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs @@ -75,7 +75,7 @@ namespace Content.Server.Atmos.EntitySystems public void UpdateUserInterface(Entity ent, bool initialUpdate = false) { var (owner, component) = ent; - _ui.TrySetUiState(owner, SharedGasTankUiKey.Key, + _ui.SetUiState(owner, SharedGasTankUiKey.Key, new GasTankBoundUserInterfaceState { TankPressure = component.Air?.Pressure ?? 0, diff --git a/Content.Server/Atmos/Monitor/Components/AirAlarmComponent.cs b/Content.Server/Atmos/Monitor/Components/AirAlarmComponent.cs index 7030d607a6..93f704fe21 100644 --- a/Content.Server/Atmos/Monitor/Components/AirAlarmComponent.cs +++ b/Content.Server/Atmos/Monitor/Components/AirAlarmComponent.cs @@ -24,8 +24,6 @@ public sealed partial class AirAlarmComponent : Component public readonly Dictionary ScrubberData = new(); public readonly Dictionary SensorData = new(); - public HashSet ActivePlayers = new(); - public bool CanSync = true; /// diff --git a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs index 2922d0796a..881f54512a 100644 --- a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs @@ -223,8 +223,7 @@ public sealed class AirAlarmSystem : EntitySystem private void OnClose(EntityUid uid, AirAlarmComponent component, BoundUIClosedEvent args) { - component.ActivePlayers.Remove(args.Session.UserId); - if (component.ActivePlayers.Count == 0) + if (!_ui.IsUiOpen(uid, SharedAirAlarmInterfaceKey.Key)) RemoveActiveInterface(uid); } @@ -247,9 +246,6 @@ public sealed class AirAlarmSystem : EntitySystem private void OnActivate(EntityUid uid, AirAlarmComponent component, ActivateInWorldEvent args) { - if (!TryComp(args.User, out var actor)) - return; - if (TryComp(uid, out var panel) && panel.Open) { args.Handled = false; @@ -259,10 +255,7 @@ public sealed class AirAlarmSystem : EntitySystem if (!this.IsPowered(uid, EntityManager)) return; - var ui = _ui.GetUiOrNull(uid, SharedAirAlarmInterfaceKey.Key); - if (ui != null) - _ui.OpenUi(ui, actor.PlayerSession); - component.ActivePlayers.Add(actor.PlayerSession.UserId); + _ui.OpenUi(uid, SharedAirAlarmInterfaceKey.Key, args.User); AddActiveInterface(uid); SyncAllDevices(uid); UpdateUI(uid, component); @@ -270,7 +263,7 @@ public sealed class AirAlarmSystem : EntitySystem private void OnResyncAll(EntityUid uid, AirAlarmComponent component, AirAlarmResyncAllDevicesMessage args) { - if (!AccessCheck(uid, args.Session.AttachedEntity, component)) + if (!AccessCheck(uid, args.Actor, component)) { return; } @@ -285,7 +278,7 @@ public sealed class AirAlarmSystem : EntitySystem private void OnUpdateAlarmMode(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateAlarmModeMessage args) { - if (AccessCheck(uid, args.Session.AttachedEntity, component)) + if (AccessCheck(uid, args.Actor, component)) { var addr = string.Empty; if (TryComp(uid, out var netConn)) @@ -309,7 +302,7 @@ public sealed class AirAlarmSystem : EntitySystem private void OnUpdateThreshold(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateAlarmThresholdMessage args) { - if (AccessCheck(uid, args.Session.AttachedEntity, component)) + if (AccessCheck(uid, args.Actor, component)) SetThreshold(uid, args.Address, args.Type, args.Threshold, args.Gas); else UpdateUI(uid, component); @@ -317,7 +310,7 @@ public sealed class AirAlarmSystem : EntitySystem private void OnUpdateDeviceData(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateDeviceDataMessage args) { - if (AccessCheck(uid, args.Session.AttachedEntity, component) + if (AccessCheck(uid, args.Actor, component) && _deviceList.ExistsInDeviceList(uid, args.Address)) { SetDeviceData(uid, args.Address, args.Data); @@ -330,7 +323,7 @@ public sealed class AirAlarmSystem : EntitySystem private void OnCopyDeviceData(EntityUid uid, AirAlarmComponent component, AirAlarmCopyDeviceDataMessage args) { - if (!AccessCheck(uid, args.Session.AttachedEntity, component)) + if (!AccessCheck(uid, args.Actor, component)) { UpdateUI(uid, component); return; @@ -377,7 +370,7 @@ public sealed class AirAlarmSystem : EntitySystem private void OnAtmosAlarm(EntityUid uid, AirAlarmComponent component, AtmosAlarmEvent args) { - if (component.ActivePlayers.Count != 0) + if (_ui.IsUiOpen(uid, SharedAirAlarmInterfaceKey.Key)) { SyncAllDevices(uid); } @@ -571,7 +564,7 @@ public sealed class AirAlarmSystem : EntitySystem /// private void ForceCloseAllInterfaces(EntityUid uid) { - _ui.TryCloseAll(uid, SharedAirAlarmInterfaceKey.Key); + _ui.CloseUi(uid, SharedAirAlarmInterfaceKey.Key); } private void OnAtmosUpdate(EntityUid uid, AirAlarmComponent alarm, ref AtmosDeviceUpdateEvent args) @@ -639,7 +632,7 @@ public sealed class AirAlarmSystem : EntitySystem highestAlarm = AtmosAlarmType.Normal; } - _ui.TrySetUiState( + _ui.SetUiState( uid, SharedAirAlarmInterfaceKey.Key, new AirAlarmUIState(devNet.Address, deviceCount, pressure, temperature, dataToSend, alarm.CurrentMode, alarm.CurrentTab, highestAlarm.Value, alarm.AutoMode)); diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs index af25d04df9..83b7b67ba4 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs @@ -98,7 +98,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems UpdateAppearance(uid, pump); DirtyUI(uid, pump); - _userInterfaceSystem.TryCloseAll(uid, GasPressurePumpUiKey.Key); + _userInterfaceSystem.CloseUi(uid, GasPressurePumpUiKey.Key); } private void OnPumpActivate(EntityUid uid, GasPressurePumpComponent pump, ActivateInWorldEvent args) @@ -108,7 +108,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems if (Transform(uid).Anchored) { - _userInterfaceSystem.TryOpen(uid, GasPressurePumpUiKey.Key, actor.PlayerSession); + _userInterfaceSystem.OpenUi(uid, GasPressurePumpUiKey.Key, actor.PlayerSession); DirtyUI(uid, pump); } else @@ -123,7 +123,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems { pump.Enabled = args.Enabled; _adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium, - $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); + $"{ToPrettyString(args.Actor):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); DirtyUI(uid, pump); UpdateAppearance(uid, pump); } @@ -132,7 +132,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems { pump.TargetPressure = Math.Clamp(args.Pressure, 0f, Atmospherics.MaxOutputPressure); _adminLogger.Add(LogType.AtmosPressureChanged, LogImpact.Medium, - $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa"); + $"{ToPrettyString(args.Actor):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa"); DirtyUI(uid, pump); } @@ -142,7 +142,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems if (!Resolve(uid, ref pump)) return; - _userInterfaceSystem.TrySetUiState(uid, GasPressurePumpUiKey.Key, + _userInterfaceSystem.SetUiState(uid, GasPressurePumpUiKey.Key, new GasPressurePumpBoundUserInterfaceState(EntityManager.GetComponent(uid).EntityName, pump.TargetPressure, pump.Enabled)); } diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs index e4767c4061..cbcd1f4fa3 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs @@ -128,7 +128,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems UpdateAppearance(uid, pump); DirtyUI(uid, pump); - _userInterfaceSystem.TryCloseAll(uid, GasVolumePumpUiKey.Key); + _userInterfaceSystem.CloseUi(uid, GasVolumePumpUiKey.Key); } private void OnPumpActivate(EntityUid uid, GasVolumePumpComponent pump, ActivateInWorldEvent args) @@ -138,7 +138,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems if (Transform(uid).Anchored) { - _userInterfaceSystem.TryOpen(uid, GasVolumePumpUiKey.Key, actor.PlayerSession); + _userInterfaceSystem.OpenUi(uid, GasVolumePumpUiKey.Key, actor.PlayerSession); DirtyUI(uid, pump); } else @@ -153,7 +153,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems { pump.Enabled = args.Enabled; _adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium, - $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); + $"{ToPrettyString(args.Actor):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); DirtyUI(uid, pump); UpdateAppearance(uid, pump); } @@ -162,7 +162,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems { pump.TransferRate = Math.Clamp(args.TransferRate, 0f, pump.MaxTransferRate); _adminLogger.Add(LogType.AtmosVolumeChanged, LogImpact.Medium, - $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the transfer rate on {ToPrettyString(uid):device} to {args.TransferRate}"); + $"{ToPrettyString(args.Actor):player} set the transfer rate on {ToPrettyString(uid):device} to {args.TransferRate}"); DirtyUI(uid, pump); } @@ -171,7 +171,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems if (!Resolve(uid, ref pump)) return; - _userInterfaceSystem.TrySetUiState(uid, GasVolumePumpUiKey.Key, + _userInterfaceSystem.SetUiState(uid, GasVolumePumpUiKey.Key, new GasVolumePumpBoundUserInterfaceState(Name(uid), pump.TransferRate, pump.Enabled)); } diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs index c0c2b930f6..007d304e98 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs @@ -94,7 +94,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems _ambientSoundSystem.SetAmbience(uid, false); DirtyUI(uid, filter); - _userInterfaceSystem.TryCloseAll(uid, GasFilterUiKey.Key); + _userInterfaceSystem.CloseUi(uid, GasFilterUiKey.Key); } private void OnFilterActivate(EntityUid uid, GasFilterComponent filter, ActivateInWorldEvent args) @@ -104,7 +104,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems if (EntityManager.GetComponent(uid).Anchored) { - _userInterfaceSystem.TryOpen(uid, GasFilterUiKey.Key, actor.PlayerSession); + _userInterfaceSystem.OpenUi(uid, GasFilterUiKey.Key, actor.PlayerSession); DirtyUI(uid, filter); } else @@ -120,7 +120,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems if (!Resolve(uid, ref filter)) return; - _userInterfaceSystem.TrySetUiState(uid, GasFilterUiKey.Key, + _userInterfaceSystem.SetUiState(uid, GasFilterUiKey.Key, new GasFilterBoundUserInterfaceState(MetaData(uid).EntityName, filter.TransferRate, filter.Enabled, filter.FilteredGas)); } @@ -136,7 +136,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems { filter.Enabled = args.Enabled; _adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium, - $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); + $"{ToPrettyString(args.Actor):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); DirtyUI(uid, filter); UpdateAppearance(uid, filter); } @@ -145,7 +145,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems { filter.TransferRate = Math.Clamp(args.Rate, 0f, filter.MaxTransferRate); _adminLogger.Add(LogType.AtmosVolumeChanged, LogImpact.Medium, - $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the transfer rate on {ToPrettyString(uid):device} to {args.Rate}"); + $"{ToPrettyString(args.Actor):player} set the transfer rate on {ToPrettyString(uid):device} to {args.Rate}"); DirtyUI(uid, filter); } @@ -158,7 +158,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems { filter.FilteredGas = parsedGas; _adminLogger.Add(LogType.AtmosFilterChanged, LogImpact.Medium, - $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the filter on {ToPrettyString(uid):device} to {parsedGas.ToString()}"); + $"{ToPrettyString(args.Actor):player} set the filter on {ToPrettyString(uid):device} to {parsedGas.ToString()}"); DirtyUI(uid, filter); } else @@ -170,7 +170,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems { filter.FilteredGas = null; _adminLogger.Add(LogType.AtmosFilterChanged, LogImpact.Medium, - $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the filter on {ToPrettyString(uid):device} to none"); + $"{ToPrettyString(args.Actor):player} set the filter on {ToPrettyString(uid):device} to none"); DirtyUI(uid, filter); } } diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs index 4d7fc134c7..4ab8572843 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs @@ -134,7 +134,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems DirtyUI(uid, mixer); UpdateAppearance(uid, mixer); - _userInterfaceSystem.TryCloseAll(uid, GasFilterUiKey.Key); + _userInterfaceSystem.CloseUi(uid, GasFilterUiKey.Key); } private void OnMixerActivate(EntityUid uid, GasMixerComponent mixer, ActivateInWorldEvent args) @@ -144,7 +144,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems if (Transform(uid).Anchored) { - _userInterfaceSystem.TryOpen(uid, GasMixerUiKey.Key, actor.PlayerSession); + _userInterfaceSystem.OpenUi(uid, GasMixerUiKey.Key, actor.PlayerSession); DirtyUI(uid, mixer); } else @@ -160,7 +160,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems if (!Resolve(uid, ref mixer)) return; - _userInterfaceSystem.TrySetUiState(uid, GasMixerUiKey.Key, + _userInterfaceSystem.SetUiState(uid, GasMixerUiKey.Key, new GasMixerBoundUserInterfaceState(EntityManager.GetComponent(uid).EntityName, mixer.TargetPressure, mixer.Enabled, mixer.InletOneConcentration)); } @@ -176,7 +176,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems { mixer.Enabled = args.Enabled; _adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium, - $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); + $"{ToPrettyString(args.Actor):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}"); DirtyUI(uid, mixer); UpdateAppearance(uid, mixer); } @@ -185,7 +185,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems { mixer.TargetPressure = Math.Clamp(args.Pressure, 0f, mixer.MaxTargetPressure); _adminLogger.Add(LogType.AtmosPressureChanged, LogImpact.Medium, - $"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa"); + $"{ToPrettyString(args.Actor):player} set the pressure on {ToPrettyString(uid):device} to {args.Pressure}kPa"); DirtyUI(uid, mixer); } @@ -196,7 +196,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems mixer.InletOneConcentration = nodeOne; mixer.InletTwoConcentration = 1.0f - mixer.InletOneConcentration; _adminLogger.Add(LogType.AtmosRatioChanged, LogImpact.Medium, - $"{EntityManager.ToPrettyString(args.Session.AttachedEntity!.Value):player} set the ratio on {EntityManager.ToPrettyString(uid):device} to {mixer.InletOneConcentration}:{mixer.InletTwoConcentration}"); + $"{EntityManager.ToPrettyString(args.Actor):player} set the ratio on {EntityManager.ToPrettyString(uid):device} to {mixer.InletOneConcentration}:{mixer.InletTwoConcentration}"); DirtyUI(uid, mixer); } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs index bdc9e76538..e279db09aa 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs @@ -96,7 +96,7 @@ public sealed class GasCanisterSystem : EntitySystem tankPressure = tankComponent.Air.Pressure; } - _ui.TrySetUiState(uid, GasCanisterUiKey.Key, + _ui.SetUiState(uid, GasCanisterUiKey.Key, new GasCanisterBoundUserInterfaceState(Name(uid), canister.Air.Pressure, portStatus, tankLabel, tankPressure, canister.ReleasePressure, canister.ReleaseValve, canister.MinReleasePressure, canister.MaxReleasePressure)); @@ -104,19 +104,19 @@ public sealed class GasCanisterSystem : EntitySystem private void OnHoldingTankEjectMessage(EntityUid uid, GasCanisterComponent canister, GasCanisterHoldingTankEjectMessage args) { - if (canister.GasTankSlot.Item == null || args.Session.AttachedEntity == null) + if (canister.GasTankSlot.Item == null) return; var item = canister.GasTankSlot.Item; - _slots.TryEjectToHands(uid, canister.GasTankSlot, args.Session.AttachedEntity); - _adminLogger.Add(LogType.CanisterTankEjected, LogImpact.Medium, $"Player {ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} ejected tank {ToPrettyString(item):tank} from {ToPrettyString(uid):canister}"); + _slots.TryEjectToHands(uid, canister.GasTankSlot, args.Actor); + _adminLogger.Add(LogType.CanisterTankEjected, LogImpact.Medium, $"Player {ToPrettyString(args.Actor):player} ejected tank {ToPrettyString(item):tank} from {ToPrettyString(uid):canister}"); } private void OnCanisterChangeReleasePressure(EntityUid uid, GasCanisterComponent canister, GasCanisterChangeReleasePressureMessage args) { var pressure = Math.Clamp(args.Pressure, canister.MinReleasePressure, canister.MaxReleasePressure); - _adminLogger.Add(LogType.CanisterPressure, LogImpact.Medium, $"{ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} set the release pressure on {ToPrettyString(uid):canister} to {args.Pressure}"); + _adminLogger.Add(LogType.CanisterPressure, LogImpact.Medium, $"{ToPrettyString(args.Actor):player} set the release pressure on {ToPrettyString(uid):canister} to {args.Pressure}"); canister.ReleasePressure = pressure; DirtyUI(uid, canister); @@ -129,14 +129,14 @@ public sealed class GasCanisterSystem : EntitySystem impact = canister.GasTankSlot.HasItem ? LogImpact.Medium : LogImpact.High; var containedGasDict = new Dictionary(); - var containedGasArray = Gas.GetValues(typeof(Gas)); + var containedGasArray = Enum.GetValues(typeof(Gas)); for (int i = 0; i < containedGasArray.Length; i++) { containedGasDict.Add((Gas)i, canister.Air[i]); } - _adminLogger.Add(LogType.CanisterValve, impact, $"{ToPrettyString(args.Session.AttachedEntity.GetValueOrDefault()):player} set the valve on {ToPrettyString(uid):canister} to {args.Valve:valveState} while it contained [{string.Join(", ", containedGasDict)}]"); + _adminLogger.Add(LogType.CanisterValve, impact, $"{ToPrettyString(args.Actor):player} set the valve on {ToPrettyString(uid):canister} to {args.Valve:valveState} while it contained [{string.Join(", ", containedGasDict)}]"); canister.ReleaseValve = args.Valve; DirtyUI(uid, canister); @@ -212,7 +212,7 @@ public sealed class GasCanisterSystem : EntitySystem if (args.Handled) return; - _ui.TryOpen(uid, GasCanisterUiKey.Key, actor.PlayerSession); + _ui.OpenUi(uid, GasCanisterUiKey.Key, actor.PlayerSession); args.Handled = true; } @@ -224,7 +224,7 @@ public sealed class GasCanisterSystem : EntitySystem if (CheckLocked(uid, component, args.User)) return; - _ui.TryOpen(uid, GasCanisterUiKey.Key, actor.PlayerSession); + _ui.OpenUi(uid, GasCanisterUiKey.Key, actor.PlayerSession); args.Handled = true; } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs index 9b61044f03..827ba0bda5 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs @@ -144,7 +144,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnToggleMessage(EntityUid uid, GasThermoMachineComponent thermoMachine, GasThermomachineToggleMessage args) { var powerState = _power.TogglePower(uid); - _adminLogger.Add(LogType.AtmosPowerChanged, $"{ToPrettyString(args.Session.AttachedEntity)} turned {(powerState ? "On" : "Off")} {ToPrettyString(uid)}"); + _adminLogger.Add(LogType.AtmosPowerChanged, $"{ToPrettyString(args.Actor)} turned {(powerState ? "On" : "Off")} {ToPrettyString(uid)}"); DirtyUI(uid, thermoMachine); } @@ -155,7 +155,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems else thermoMachine.TargetTemperature = MathF.Max(args.Temperature, thermoMachine.MinTemperature); thermoMachine.TargetTemperature = MathF.Max(thermoMachine.TargetTemperature, Atmospherics.TCMB); - _adminLogger.Add(LogType.AtmosTemperatureChanged, $"{ToPrettyString(args.Session.AttachedEntity)} set temperature on {ToPrettyString(uid)} to {thermoMachine.TargetTemperature}"); + _adminLogger.Add(LogType.AtmosTemperatureChanged, $"{ToPrettyString(args.Actor)} set temperature on {ToPrettyString(uid)} to {thermoMachine.TargetTemperature}"); DirtyUI(uid, thermoMachine); } @@ -168,8 +168,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (!Resolve(uid, ref powerReceiver)) return; - _userInterfaceSystem.TrySetUiState(uid, ThermomachineUiKey.Key, - new GasThermomachineBoundUserInterfaceState(thermoMachine.MinTemperature, thermoMachine.MaxTemperature, thermoMachine.TargetTemperature, !powerReceiver.PowerDisabled, IsHeater(thermoMachine)), null, ui); + _userInterfaceSystem.SetUiState(uid, ThermomachineUiKey.Key, + new GasThermomachineBoundUserInterfaceState(thermoMachine.MinTemperature, thermoMachine.MaxTemperature, thermoMachine.TargetTemperature, !powerReceiver.PowerDisabled, IsHeater(thermoMachine))); } private void OnExamined(EntityUid uid, GasThermoMachineComponent thermoMachine, ExaminedEvent args) diff --git a/Content.Server/Atmos/Portable/SpaceHeaterSystem.cs b/Content.Server/Atmos/Portable/SpaceHeaterSystem.cs index fff15f696c..cbf63f5404 100644 --- a/Content.Server/Atmos/Portable/SpaceHeaterSystem.cs +++ b/Content.Server/Atmos/Portable/SpaceHeaterSystem.cs @@ -163,7 +163,7 @@ public sealed class SpaceHeaterSystem : EntitySystem { return; } - _userInterfaceSystem.TrySetUiState(uid, SpaceHeaterUiKey.Key, + _userInterfaceSystem.SetUiState(uid, SpaceHeaterUiKey.Key, new SpaceHeaterBoundUserInterfaceState(spaceHeater.MinTemperature, spaceHeater.MaxTemperature, thermoMachine.TargetTemperature, !powerReceiver.PowerDisabled, spaceHeater.Mode, spaceHeater.PowerLevel)); } diff --git a/Content.Server/Audio/Jukebox/JukeboxSystem.cs b/Content.Server/Audio/Jukebox/JukeboxSystem.cs index bfb9b2099a..cc9235e3d7 100644 --- a/Content.Server/Audio/Jukebox/JukeboxSystem.cs +++ b/Content.Server/Audio/Jukebox/JukeboxSystem.cs @@ -5,6 +5,7 @@ using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Audio.Components; using Robust.Shared.Audio.Systems; +using Robust.Shared.Player; using Robust.Shared.Prototypes; using JukeboxComponent = Content.Shared.Audio.Jukebox.JukeboxComponent; @@ -66,8 +67,11 @@ public sealed class JukeboxSystem : SharedJukeboxSystem private void OnJukeboxSetTime(EntityUid uid, JukeboxComponent component, JukeboxSetTimeMessage args) { - var offset = (args.Session.Channel.Ping * 1.5f) / 1000f; - Audio.SetPlaybackPosition(component.AudioStream, args.SongTime + offset); + if (TryComp(args.Actor, out ActorComponent? actorComp)) + { + var offset = actorComp.PlayerSession.Channel.Ping * 1.5f / 1000f; + Audio.SetPlaybackPosition(component.AudioStream, args.SongTime + offset); + } } private void OnPowerChanged(Entity entity, ref PowerChangedEvent args) diff --git a/Content.Server/Bed/Cryostorage/CryostorageSystem.cs b/Content.Server/Bed/Cryostorage/CryostorageSystem.cs index 2e7f8c4235..1369fa20f1 100644 --- a/Content.Server/Bed/Cryostorage/CryostorageSystem.cs +++ b/Content.Server/Bed/Cryostorage/CryostorageSystem.cs @@ -79,9 +79,7 @@ public sealed class CryostorageSystem : SharedCryostorageSystem private void OnRemoveItemBuiMessage(Entity ent, ref CryostorageRemoveItemBuiMessage args) { var (_, comp) = ent; - if (args.Session.AttachedEntity is not { } attachedEntity) - return; - + var attachedEntity = args.Actor; var cryoContained = GetEntity(args.StoredEntity); if (!comp.StoredPlayers.Contains(cryoContained) || !IsInPausedMap(cryoContained)) @@ -114,6 +112,7 @@ public sealed class CryostorageSystem : SharedCryostorageSystem AdminLog.Add(LogType.Action, LogImpact.High, $"{ToPrettyString(attachedEntity):player} removed item {ToPrettyString(entity)} from cryostorage-contained player " + $"{ToPrettyString(cryoContained):player}, stored in cryostorage {ToPrettyString(ent)}"); + _container.TryRemoveFromContainer(entity.Value); _transform.SetCoordinates(entity.Value, Transform(attachedEntity).Coordinates); _hands.PickupOrDrop(attachedEntity, entity.Value); @@ -122,8 +121,8 @@ public sealed class CryostorageSystem : SharedCryostorageSystem private void UpdateCryostorageUIState(Entity ent) { - var state = new CryostorageBuiState(GetAllContainedData(ent).ToList()); - _ui.TrySetUiState(ent, CryostorageUIKey.Key, state); + var state = new CryostorageBuiState(GetAllContainedData(ent)); + _ui.SetUiState(ent.Owner, CryostorageUIKey.Key, state); } private void OnPlayerSpawned(Entity ent, ref PlayerSpawnCompleteEvent args) @@ -293,12 +292,17 @@ public sealed class CryostorageSystem : SharedCryostorageSystem _chatManager.ChatMessageToOne(ChatChannel.Server, msg, msg, uid, false, actor.PlayerSession.Channel); } - private IEnumerable GetAllContainedData(Entity ent) + private List GetAllContainedData(Entity ent) { + var data = new List(); + data.EnsureCapacity(ent.Comp.StoredPlayers.Count); + foreach (var contained in ent.Comp.StoredPlayers) { - yield return GetContainedData(contained); + data.Add(GetContainedData(contained)); } + + return data; } private CryostorageContainedPlayerData GetContainedData(EntityUid uid) diff --git a/Content.Server/Cargo/Systems/CargoSystem.Bounty.cs b/Content.Server/Cargo/Systems/CargoSystem.Bounty.cs index 22e5c67e17..e132e4f12a 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Bounty.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Bounty.cs @@ -52,7 +52,7 @@ public sealed partial class CargoSystem return; var untilNextSkip = bountyDb.NextSkipTime - _timing.CurTime; - _uiSystem.TrySetUiState(uid, CargoConsoleUiKey.Bounty, new CargoBountyConsoleState(bountyDb.Bounties, untilNextSkip)); + _uiSystem.SetUiState(uid, CargoConsoleUiKey.Bounty, new CargoBountyConsoleState(bountyDb.Bounties, untilNextSkip)); } private void OnPrintLabelMessage(EntityUid uid, CargoBountyConsoleComponent component, BountyPrintLabelMessage args) @@ -83,7 +83,7 @@ public sealed partial class CargoSystem if (!TryGetBountyFromId(station, args.BountyId, out var bounty)) return; - if (args.Session.AttachedEntity is not { Valid: true } mob) + if (args.Actor is not { Valid: true } mob) return; if (TryComp(uid, out var accessReaderComponent) && @@ -99,7 +99,7 @@ public sealed partial class CargoSystem FillBountyDatabase(station); db.NextSkipTime = _timing.CurTime + db.SkipDelay; var untilNextSkip = db.NextSkipTime - _timing.CurTime; - _uiSystem.TrySetUiState(uid, CargoConsoleUiKey.Bounty, new CargoBountyConsoleState(db.Bounties, untilNextSkip)); + _uiSystem.SetUiState(uid, CargoConsoleUiKey.Bounty, new CargoBountyConsoleState(db.Bounties, untilNextSkip)); _audio.PlayPvs(component.SkipSound, uid); } @@ -462,10 +462,12 @@ public sealed partial class CargoSystem { if (_station.GetOwningStation(uid) is not { } station || !TryComp(station, out var db)) + { continue; + } var untilNextSkip = db.NextSkipTime - _timing.CurTime; - _uiSystem.TrySetUiState(uid, CargoConsoleUiKey.Bounty, new CargoBountyConsoleState(db.Bounties, untilNextSkip), ui: ui); + _uiSystem.SetUiState((uid, ui), CargoConsoleUiKey.Bounty, new CargoBountyConsoleState(db.Bounties, untilNextSkip)); } } diff --git a/Content.Server/Cargo/Systems/CargoSystem.Orders.cs b/Content.Server/Cargo/Systems/CargoSystem.Orders.cs index 13a1d3d565..63556d2fbd 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Orders.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Orders.cs @@ -102,12 +102,12 @@ namespace Content.Server.Cargo.Systems private void OnApproveOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleApproveOrderMessage args) { - if (args.Session.AttachedEntity is not { Valid: true } player) + if (args.Actor is not { Valid: true } player) return; if (!_accessReaderSystem.IsAllowed(player, uid)) { - ConsolePopup(args.Session, Loc.GetString("cargo-console-order-not-allowed")); + ConsolePopup(args.Actor, Loc.GetString("cargo-console-order-not-allowed")); PlayDenySound(uid, component); return; } @@ -119,7 +119,7 @@ namespace Content.Server.Cargo.Systems !TryComp(station, out StationDataComponent? stationData) || !TryGetOrderDatabase(station, out var orderDatabase)) { - ConsolePopup(args.Session, Loc.GetString("cargo-console-station-not-found")); + ConsolePopup(args.Actor, Loc.GetString("cargo-console-station-not-found")); PlayDenySound(uid, component); return; } @@ -134,7 +134,7 @@ namespace Content.Server.Cargo.Systems // Invalid order if (!_protoMan.HasIndex(order.ProductId)) { - ConsolePopup(args.Session, Loc.GetString("cargo-console-invalid-product")); + ConsolePopup(args.Actor, Loc.GetString("cargo-console-invalid-product")); PlayDenySound(uid, component); return; } @@ -145,7 +145,7 @@ namespace Content.Server.Cargo.Systems // Too many orders, avoid them getting spammed in the UI. if (amount >= capacity) { - ConsolePopup(args.Session, Loc.GetString("cargo-console-too-many")); + ConsolePopup(args.Actor, Loc.GetString("cargo-console-too-many")); PlayDenySound(uid, component); return; } @@ -156,7 +156,7 @@ namespace Content.Server.Cargo.Systems if (cappedAmount != order.OrderQuantity) { order.OrderQuantity = cappedAmount; - ConsolePopup(args.Session, Loc.GetString("cargo-console-snip-snip")); + ConsolePopup(args.Actor, Loc.GetString("cargo-console-snip-snip")); PlayDenySound(uid, component); } @@ -165,7 +165,7 @@ namespace Content.Server.Cargo.Systems // Not enough balance if (cost > bank.Balance) { - ConsolePopup(args.Session, Loc.GetString("cargo-console-insufficient-funds", ("cost", cost))); + ConsolePopup(args.Actor, Loc.GetString("cargo-console-insufficient-funds", ("cost", cost))); PlayDenySound(uid, component); return; } @@ -180,7 +180,7 @@ namespace Content.Server.Cargo.Systems if (ev.FulfillmentEntity == null) { - ConsolePopup(args.Session, Loc.GetString("cargo-console-unfulfilled")); + ConsolePopup(args.Actor, Loc.GetString("cargo-console-unfulfilled")); PlayDenySound(uid, component); return; } @@ -200,7 +200,7 @@ namespace Content.Server.Cargo.Systems ("approverJob", approverJob), ("cost", cost)); _radio.SendRadioMessage(uid, message, component.AnnouncementChannel, uid, escapeMarkup: false); - ConsolePopup(args.Session, Loc.GetString("cargo-console-trade-station", ("destination", MetaData(ev.FulfillmentEntity.Value).EntityName))); + ConsolePopup(args.Actor, Loc.GetString("cargo-console-trade-station", ("destination", MetaData(ev.FulfillmentEntity.Value).EntityName))); // Log order approval _adminLogger.Add(LogType.Action, LogImpact.Low, @@ -271,7 +271,7 @@ namespace Content.Server.Cargo.Systems private void OnAddOrderMessage(EntityUid uid, CargoOrderConsoleComponent component, CargoConsoleAddOrderMessage args) { - if (args.Session.AttachedEntity is not { Valid: true } player) + if (args.Actor is not { Valid: true } player) return; if (args.Amount <= 0) @@ -319,9 +319,9 @@ namespace Content.Server.Cargo.Systems !TryComp(station, out var orderDatabase) || !TryComp(station, out var bankAccount)) return; - if (_uiSystem.TryGetUi(consoleUid, CargoConsoleUiKey.Orders, out var bui)) + if (_uiSystem.HasUi(consoleUid, CargoConsoleUiKey.Orders)) { - _uiSystem.SetUiState(bui, new CargoConsoleInterfaceState( + _uiSystem.SetUiState(consoleUid, CargoConsoleUiKey.Orders, new CargoConsoleInterfaceState( MetaData(station.Value).EntityName, GetOutstandingOrderCount(orderDatabase), orderDatabase.Capacity, @@ -331,9 +331,9 @@ namespace Content.Server.Cargo.Systems } } - private void ConsolePopup(ICommonSession session, string text) + private void ConsolePopup(EntityUid actor, string text) { - _popup.PopupCursor(text, session); + _popup.PopupCursor(text, actor); } private void PlayDenySound(EntityUid uid, CargoOrderConsoleComponent component) diff --git a/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs b/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs index aa2614cdb8..e9f6d00822 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs @@ -54,21 +54,20 @@ public sealed partial class CargoSystem private void UpdatePalletConsoleInterface(EntityUid uid) { - var bui = _uiSystem.GetUi(uid, CargoPalletConsoleUiKey.Sale); if (Transform(uid).GridUid is not EntityUid gridUid) { - _uiSystem.SetUiState(bui, + _uiSystem.SetUiState(uid, CargoPalletConsoleUiKey.Sale, new CargoPalletConsoleInterfaceState(0, 0, false)); return; } GetPalletGoods(gridUid, out var toSell, out var amount); - _uiSystem.SetUiState(bui, + _uiSystem.SetUiState(uid, CargoPalletConsoleUiKey.Sale, new CargoPalletConsoleInterfaceState((int) amount, toSell.Count, true)); } private void OnPalletUIOpen(EntityUid uid, CargoPalletConsoleComponent component, BoundUIOpenedEvent args) { - var player = args.Session.AttachedEntity; + var player = args.Actor; if (player == null) return; @@ -86,7 +85,7 @@ public sealed partial class CargoSystem private void OnPalletAppraise(EntityUid uid, CargoPalletConsoleComponent component, CargoPalletAppraiseMessage args) { - var player = args.Session.AttachedEntity; + var player = args.Actor; if (player == null) return; @@ -108,8 +107,8 @@ public sealed partial class CargoSystem var orders = GetProjectedOrders(station ?? EntityUid.Invalid, orderDatabase, shuttle); var shuttleName = orderDatabase?.Shuttle != null ? MetaData(orderDatabase.Shuttle.Value).EntityName : string.Empty; - if (_uiSystem.TryGetUi(uid, CargoConsoleUiKey.Shuttle, out var bui)) - _uiSystem.SetUiState(bui, new CargoShuttleConsoleBoundUserInterfaceState( + if (_uiSystem.HasUi(uid, CargoConsoleUiKey.Shuttle)) + _uiSystem.SetUiState(uid, CargoConsoleUiKey.Shuttle, new CargoShuttleConsoleBoundUserInterfaceState( station != null ? MetaData(station.Value).EntityName : Loc.GetString("cargo-shuttle-console-station-unknown"), string.IsNullOrEmpty(shuttleName) ? Loc.GetString("cargo-shuttle-console-shuttle-not-found") : shuttleName, orders @@ -314,17 +313,16 @@ public sealed partial class CargoSystem private void OnPalletSale(EntityUid uid, CargoPalletConsoleComponent component, CargoPalletSellMessage args) { - var player = args.Session.AttachedEntity; + var player = args.Actor; if (player == null) return; - var bui = _uiSystem.GetUi(uid, CargoPalletConsoleUiKey.Sale); var xform = Transform(uid); if (xform.GridUid is not EntityUid gridUid) { - _uiSystem.SetUiState(bui, + _uiSystem.SetUiState(uid, CargoPalletConsoleUiKey.Sale, new CargoPalletConsoleInterfaceState(0, 0, false)); return; } diff --git a/Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs b/Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs index 4a76aef911..7896a7822e 100644 --- a/Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs +++ b/Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs @@ -103,12 +103,12 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem if (!Resolve(loaderUid, ref loader)) return; - if (!_userInterfaceSystem.TryGetUi(loaderUid, loader.UiKey, out var ui)) + if (!_userInterfaceSystem.HasUi(loaderUid, loader.UiKey)) return; var programs = GetAvailablePrograms(loaderUid, loader); var state = new CartridgeLoaderUiState(programs, GetNetEntity(loader.ActiveProgram)); - _userInterfaceSystem.SetUiState(ui, state, session); + _userInterfaceSystem.SetUiState(loaderUid, loader.UiKey, state); } /// @@ -127,8 +127,8 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem if (!Resolve(loaderUid, ref loader)) return; - if (_userInterfaceSystem.TryGetUi(loaderUid, loader.UiKey, out var ui)) - _userInterfaceSystem.SetUiState(ui, state, session); + if (_userInterfaceSystem.HasUi(loaderUid, loader.UiKey)) + _userInterfaceSystem.SetUiState(loaderUid, loader.UiKey, state); } /// diff --git a/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs b/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs index ab91044574..289db75981 100644 --- a/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs @@ -80,7 +80,7 @@ namespace Content.Server.Chemistry.EntitySystems chemMaster.Mode, BuildInputContainerInfo(inputContainer), BuildOutputContainerInfo(outputContainer), bufferReagents, bufferCurrentVolume, chemMaster.PillType, chemMaster.PillDosageLimit, updateLabel); - _userInterfaceSystem.TrySetUiState(owner, ChemMasterUiKey.Key, state); + _userInterfaceSystem.SetUiState(owner, ChemMasterUiKey.Key, state); } private void OnSetModeMessage(Entity chemMaster, ref ChemMasterSetModeMessage message) @@ -179,7 +179,7 @@ namespace Content.Server.Chemistry.EntitySystems private void OnCreatePillsMessage(Entity chemMaster, ref ChemMasterCreatePillsMessage message) { - var user = message.Session.AttachedEntity; + var user = message.Actor; var maybeContainer = _itemSlotsSystem.GetItemOrNull(chemMaster, SharedChemMaster.OutputSlotName); if (maybeContainer is not { Valid: true } container || !TryComp(container, out StorageComponent? storage)) @@ -218,18 +218,9 @@ namespace Content.Server.Chemistry.EntitySystems pill.PillType = chemMaster.Comp.PillType; Dirty(item, pill); - if (user.HasValue) - { - // Log pill creation by a user - _adminLogger.Add(LogType.Action, LogImpact.Low, - $"{ToPrettyString(user.Value):user} printed {ToPrettyString(item):pill} {SolutionContainerSystem.ToPrettyString(itemSolution.Comp.Solution)}"); - } - else - { - // Log pill creation by magic? This should never happen... right? - _adminLogger.Add(LogType.Action, LogImpact.Low, - $"Unknown printed {ToPrettyString(item):pill} {SolutionContainerSystem.ToPrettyString(itemSolution.Comp.Solution)}"); - } + // Log pill creation by a user + _adminLogger.Add(LogType.Action, LogImpact.Low, + $"{ToPrettyString(user):user} printed {ToPrettyString(item):pill} {SharedSolutionContainerSystem.ToPrettyString(itemSolution.Comp.Solution)}"); } UpdateUiState(chemMaster); @@ -238,7 +229,7 @@ namespace Content.Server.Chemistry.EntitySystems private void OnOutputToBottleMessage(Entity chemMaster, ref ChemMasterOutputToBottleMessage message) { - var user = message.Session.AttachedEntity; + var user = message.Actor; var maybeContainer = _itemSlotsSystem.GetItemOrNull(chemMaster, SharedChemMaster.OutputSlotName); if (maybeContainer is not { Valid: true } container || !_solutionContainerSystem.TryGetSolution(container, SharedChemMaster.BottleSolutionName, out var soln, out var solution)) @@ -260,18 +251,9 @@ namespace Content.Server.Chemistry.EntitySystems _labelSystem.Label(container, message.Label); _solutionContainerSystem.TryAddSolution(soln.Value, withdrawal); - if (user.HasValue) - { - // Log bottle creation by a user - _adminLogger.Add(LogType.Action, LogImpact.Low, - $"{ToPrettyString(user.Value):user} bottled {ToPrettyString(container):bottle} {SolutionContainerSystem.ToPrettyString(solution)}"); - } - else - { - // Log bottle creation by magic? This should never happen... right? - _adminLogger.Add(LogType.Action, LogImpact.Low, - $"Unknown bottled {ToPrettyString(container):bottle} {SolutionContainerSystem.ToPrettyString(solution)}"); - } + // Log bottle creation by a user + _adminLogger.Add(LogType.Action, LogImpact.Low, + $"{ToPrettyString(user):user} bottled {ToPrettyString(container):bottle} {SharedSolutionContainerSystem.ToPrettyString(solution)}"); UpdateUiState(chemMaster); ClickSound(chemMaster); diff --git a/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs b/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs index d6433da56a..3bcdd4b964 100644 --- a/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs @@ -62,7 +62,7 @@ namespace Content.Server.Chemistry.EntitySystems var inventory = GetInventory(reagentDispenser); var state = new ReagentDispenserBoundUserInterfaceState(outputContainerInfo, GetNetEntity(outputContainer), inventory, reagentDispenser.Comp.DispenseAmount); - _userInterfaceSystem.TrySetUiState(reagentDispenser, ReagentDispenserUiKey.Key, state); + _userInterfaceSystem.SetUiState(reagentDispenser.Owner, ReagentDispenserUiKey.Key, state); } private ContainerInfo? BuildOutputContainerInfo(EntityUid? container) diff --git a/Content.Server/Cloning/CloningConsoleSystem.cs b/Content.Server/Cloning/CloningConsoleSystem.cs index 4176806639..950a6599a8 100644 --- a/Content.Server/Cloning/CloningConsoleSystem.cs +++ b/Content.Server/Cloning/CloningConsoleSystem.cs @@ -135,17 +135,17 @@ namespace Content.Server.Cloning public void UpdateUserInterface(EntityUid consoleUid, CloningConsoleComponent consoleComponent) { - if (!_uiSystem.TryGetUi(consoleUid, CloningConsoleUiKey.Key, out var ui)) + if (!_uiSystem.HasUi(consoleUid, CloningConsoleUiKey.Key)) return; if (!_powerReceiverSystem.IsPowered(consoleUid)) { - _uiSystem.CloseAll(ui); + _uiSystem.CloseUis(consoleUid); return; } var newState = GetUserInterfaceState(consoleComponent); - _uiSystem.SetUiState(ui, newState); + _uiSystem.SetUiState(consoleUid, CloningConsoleUiKey.Key, newState); } public void TryClone(EntityUid uid, EntityUid cloningPodUid, EntityUid scannerUid, CloningPodComponent? cloningPod = null, MedicalScannerComponent? scannerComp = null, CloningConsoleComponent? consoleComponent = null) diff --git a/Content.Server/Clothing/Systems/ChameleonClothingSystem.cs b/Content.Server/Clothing/Systems/ChameleonClothingSystem.cs index 23b772d99c..feb3428884 100644 --- a/Content.Server/Clothing/Systems/ChameleonClothingSystem.cs +++ b/Content.Server/Clothing/Systems/ChameleonClothingSystem.cs @@ -64,7 +64,7 @@ public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem return; var state = new ChameleonBoundUserInterfaceState(component.Slot, component.Default); - _uiSystem.TrySetUiState(uid, ChameleonUiKey.Key, state); + _uiSystem.SetUiState(uid, ChameleonUiKey.Key, state); } /// diff --git a/Content.Server/Communications/CommunicationsConsoleSystem.cs b/Content.Server/Communications/CommunicationsConsoleSystem.cs index 6475e1a6d7..61a18fe3d5 100644 --- a/Content.Server/Communications/CommunicationsConsoleSystem.cs +++ b/Content.Server/Communications/CommunicationsConsoleSystem.cs @@ -82,8 +82,8 @@ namespace Content.Server.Communications comp.UIUpdateAccumulator -= UIUpdateInterval; - if (_uiSystem.TryGetUi(uid, CommunicationsConsoleUiKey.Key, out var ui) && ui.SubscribedSessions.Count > 0) - UpdateCommsConsoleInterface(uid, comp, ui); + if (_uiSystem.IsUiOpen(uid, CommunicationsConsoleUiKey.Key)) + UpdateCommsConsoleInterface(uid, comp); } base.Update(frameTime); @@ -136,11 +136,8 @@ namespace Content.Server.Communications /// /// Updates the UI for a particular comms console. /// - public void UpdateCommsConsoleInterface(EntityUid uid, CommunicationsConsoleComponent comp, PlayerBoundUserInterface? ui = null) + public void UpdateCommsConsoleInterface(EntityUid uid, CommunicationsConsoleComponent comp) { - if (ui == null && !_uiSystem.TryGetUi(uid, CommunicationsConsoleUiKey.Key, out ui)) - return; - var stationUid = _stationSystem.GetOwningStation(uid); List? levels = null; string currentLevel = default!; @@ -168,7 +165,7 @@ namespace Content.Server.Communications } } - _uiSystem.SetUiState(ui, new CommunicationsConsoleInterfaceState( + _uiSystem.SetUiState(uid, CommunicationsConsoleUiKey.Key, new CommunicationsConsoleInterfaceState( CanAnnounce(comp), CanCallOrRecall(comp), levels, @@ -219,12 +216,12 @@ namespace Content.Server.Communications private void OnSelectAlertLevelMessage(EntityUid uid, CommunicationsConsoleComponent comp, CommunicationsConsoleSelectAlertLevelMessage message) { - if (message.Session.AttachedEntity is not { Valid: true } mob) + if (message.Actor is not { Valid: true } mob) return; if (!CanUse(mob, uid)) { - _popupSystem.PopupCursor(Loc.GetString("comms-console-permission-denied"), message.Session, PopupType.Medium); + _popupSystem.PopupCursor(Loc.GetString("comms-console-permission-denied"), message.Actor, PopupType.Medium); return; } @@ -241,7 +238,7 @@ namespace Content.Server.Communications var maxLength = _cfg.GetCVar(CCVars.ChatMaxAnnouncementLength); var msg = SharedChatSystem.SanitizeAnnouncement(message.Message, maxLength); var author = Loc.GetString("comms-console-announcement-unknown-sender"); - if (message.Session.AttachedEntity is { Valid: true } mob) + if (message.Actor is { Valid: true } mob) { if (!CanAnnounce(comp)) { @@ -250,7 +247,7 @@ namespace Content.Server.Communications if (!CanUse(mob, uid)) { - _popupSystem.PopupEntity(Loc.GetString("comms-console-permission-denied"), uid, message.Session); + _popupSystem.PopupEntity(Loc.GetString("comms-console-permission-denied"), uid, message.Actor); return; } @@ -263,7 +260,7 @@ namespace Content.Server.Communications comp.AnnouncementCooldownRemaining = comp.Delay; UpdateCommsConsoleInterface(uid, comp); - var ev = new CommunicationConsoleAnnouncementEvent(uid, comp, msg, message.Session.AttachedEntity); + var ev = new CommunicationConsoleAnnouncementEvent(uid, comp, msg, message.Actor); RaiseLocalEvent(ref ev); // allow admemes with vv @@ -275,15 +272,14 @@ namespace Content.Server.Communications { _chatSystem.DispatchGlobalAnnouncement(msg, title, announcementSound: comp.Sound, colorOverride: comp.Color); - if (message.Session.AttachedEntity != null) - _adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} has sent the following global announcement: {msg}"); - + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(message.Actor):player} has sent the following global announcement: {msg}"); return; } + _chatSystem.DispatchStationAnnouncement(uid, msg, title, colorOverride: comp.Color); - if (message.Session.AttachedEntity != null) - _adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} has sent the following station announcement: {msg}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(message.Actor):player} has sent the following station announcement: {msg}"); + } private void OnBroadcastMessage(EntityUid uid, CommunicationsConsoleComponent component, CommunicationsConsoleBroadcastMessage message) @@ -298,8 +294,7 @@ namespace Content.Server.Communications _deviceNetworkSystem.QueuePacket(uid, null, payload, net.TransmitFrequency); - if (message.Session.AttachedEntity != null) - _adminLogger.Add(LogType.DeviceNetwork, LogImpact.Low, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} has sent the following broadcast: {message.Message:msg}"); + _adminLogger.Add(LogType.DeviceNetwork, LogImpact.Low, $"{ToPrettyString(message.Actor):player} has sent the following broadcast: {message.Message:msg}"); } private void OnCallShuttleMessage(EntityUid uid, CommunicationsConsoleComponent comp, CommunicationsConsoleCallEmergencyShuttleMessage message) @@ -307,12 +302,11 @@ namespace Content.Server.Communications if (!CanCallOrRecall(comp)) return; - if (message.Session.AttachedEntity is not { Valid: true } mob) - return; + var mob = message.Actor; if (!CanUse(mob, uid)) { - _popupSystem.PopupEntity(Loc.GetString("comms-console-permission-denied"), uid, message.Session); + _popupSystem.PopupEntity(Loc.GetString("comms-console-permission-denied"), uid, message.Actor); return; } @@ -320,7 +314,7 @@ namespace Content.Server.Communications RaiseLocalEvent(ref ev); if (ev.Cancelled) { - _popupSystem.PopupEntity(ev.Reason ?? Loc.GetString("comms-console-shuttle-unavailable"), uid, message.Session); + _popupSystem.PopupEntity(ev.Reason ?? Loc.GetString("comms-console-shuttle-unavailable"), uid, message.Actor); return; } @@ -333,17 +327,14 @@ namespace Content.Server.Communications if (!CanCallOrRecall(comp)) return; - if (message.Session.AttachedEntity is not { Valid: true } mob) - return; - - if (!CanUse(mob, uid)) + if (!CanUse(message.Actor, uid)) { - _popupSystem.PopupEntity(Loc.GetString("comms-console-permission-denied"), uid, message.Session); + _popupSystem.PopupEntity(Loc.GetString("comms-console-permission-denied"), uid, message.Actor); return; } _roundEndSystem.CancelRoundEndCountdown(uid); - _adminLogger.Add(LogType.Action, LogImpact.Extreme, $"{ToPrettyString(mob):player} has recalled the shuttle."); + _adminLogger.Add(LogType.Action, LogImpact.Extreme, $"{ToPrettyString(message.Actor):player} has recalled the shuttle."); } } diff --git a/Content.Server/Configurable/ConfigurationSystem.cs b/Content.Server/Configurable/ConfigurationSystem.cs index eb31149eca..2683bf4e09 100644 --- a/Content.Server/Configurable/ConfigurationSystem.cs +++ b/Content.Server/Configurable/ConfigurationSystem.cs @@ -30,10 +30,7 @@ public sealed class ConfigurationSystem : EntitySystem if (!TryComp(args.Used, out ToolComponent? tool) || !tool.Qualities.Contains(component.QualityNeeded)) return; - if (!TryComp(args.User, out ActorComponent? actor)) - return; - - args.Handled = _uiSystem.TryOpen(uid, ConfigurationUiKey.Key, actor.PlayerSession); + args.Handled = _uiSystem.TryOpenUi(uid, ConfigurationUiKey.Key, args.User); } private void OnStartup(EntityUid uid, ConfigurationComponent component, ComponentStartup args) @@ -43,8 +40,8 @@ public sealed class ConfigurationSystem : EntitySystem private void UpdateUi(EntityUid uid, ConfigurationComponent component) { - if (_uiSystem.TryGetUi(uid, ConfigurationUiKey.Key, out var ui)) - _uiSystem.SetUiState(ui, new ConfigurationBoundUserInterfaceState(component.Config)); + if (_uiSystem.HasUi(uid, ConfigurationUiKey.Key)) + _uiSystem.SetUiState(uid, ConfigurationUiKey.Key, new ConfigurationBoundUserInterfaceState(component.Config)); } private void OnUpdate(EntityUid uid, ConfigurationComponent component, ConfigurationUpdatedMessage args) diff --git a/Content.Server/Crayon/CrayonSystem.cs b/Content.Server/Crayon/CrayonSystem.cs index 32bb96e9e2..07a13d8a34 100644 --- a/Content.Server/Crayon/CrayonSystem.cs +++ b/Content.Server/Crayon/CrayonSystem.cs @@ -90,19 +90,14 @@ public sealed class CrayonSystem : SharedCrayonSystem if (args.Handled) return; - if (!TryComp(args.User, out var actor) || - !_uiSystem.TryGetUi(uid, SharedCrayonComponent.CrayonUiKey.Key, out var ui)) + if (!_uiSystem.HasUi(uid, SharedCrayonComponent.CrayonUiKey.Key)) { return; } - _uiSystem.ToggleUi(ui, actor.PlayerSession); - if (ui.SubscribedSessions.Contains(actor.PlayerSession)) - { - // Tell the user interface the selected stuff - _uiSystem.SetUiState(ui, new CrayonBoundUserInterfaceState(component.SelectedState, component.SelectableColor, component.Color)); - } + _uiSystem.TryToggleUi(uid, SharedCrayonComponent.CrayonUiKey.Key, args.User); + _uiSystem.SetUiState(uid, SharedCrayonComponent.CrayonUiKey.Key, new CrayonBoundUserInterfaceState(component.SelectedState, component.SelectableColor, component.Color)); args.Handled = true; } @@ -140,8 +135,8 @@ public sealed class CrayonSystem : SharedCrayonSystem private void OnCrayonDropped(EntityUid uid, CrayonComponent component, DroppedEvent args) { - if (TryComp(args.User, out var actor)) - _uiSystem.TryClose(uid, SharedCrayonComponent.CrayonUiKey.Key, actor.PlayerSession); + // TODO: Use the existing event. + _uiSystem.CloseUi(uid, SharedCrayonComponent.CrayonUiKey.Key, args.User); } private void UseUpCrayon(EntityUid uid, EntityUid user) diff --git a/Content.Server/CrewManifest/CrewManifestSystem.cs b/Content.Server/CrewManifest/CrewManifestSystem.cs index 8b4cbac5c1..e742456015 100644 --- a/Content.Server/CrewManifest/CrewManifestSystem.cs +++ b/Content.Server/CrewManifest/CrewManifestSystem.cs @@ -100,12 +100,12 @@ public sealed class CrewManifestSystem : EntitySystem return; var owningStation = _stationSystem.GetOwningStation(uid); - if (owningStation == null || ev.Session is not { } session) + if (owningStation == null || !TryComp(ev.Actor, out ActorComponent? actorComp)) { return; } - CloseEui(owningStation.Value, session, uid); + CloseEui(owningStation.Value, actorComp.PlayerSession, uid); } /// @@ -136,12 +136,12 @@ public sealed class CrewManifestSystem : EntitySystem { Log.Error( "{User} tried to open crew manifest from wrong UI: {Key}. Correct owned is {ExpectedKey}", - msg.Session, msg.UiKey, component.OwnerKey); + msg.Actor, msg.UiKey, component.OwnerKey); return; } var owningStation = _stationSystem.GetOwningStation(uid); - if (owningStation == null || msg.Session is not { } session) + if (owningStation == null || !TryComp(msg.Actor, out ActorComponent? actorComp)) { return; } @@ -151,7 +151,7 @@ public sealed class CrewManifestSystem : EntitySystem return; } - OpenEui(owningStation.Value, session, uid); + OpenEui(owningStation.Value, actorComp.PlayerSession, uid); } /// diff --git a/Content.Server/CriminalRecords/Systems/CriminalRecordsConsoleSystem.cs b/Content.Server/CriminalRecords/Systems/CriminalRecordsConsoleSystem.cs index fe53ea268c..4389c68c04 100644 --- a/Content.Server/CriminalRecords/Systems/CriminalRecordsConsoleSystem.cs +++ b/Content.Server/CriminalRecords/Systems/CriminalRecordsConsoleSystem.cs @@ -77,7 +77,7 @@ public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleS msg.Status == SecurityStatus.Suspected != (msg.Reason != null)) return; - if (!CheckSelected(ent, msg.Session, out var mob, out var key)) + if (!CheckSelected(ent, msg.Actor, out var mob, out var key)) return; if (!_stationRecords.TryGetRecord(key.Value, out var record) || record.Status == msg.Status) @@ -150,7 +150,7 @@ public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleS private void OnAddHistory(Entity ent, ref CriminalRecordAddHistory msg) { - if (!CheckSelected(ent, msg.Session, out _, out var key)) + if (!CheckSelected(ent, msg.Actor, out _, out var key)) return; var line = msg.Line.Trim(); @@ -167,7 +167,7 @@ public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleS private void OnDeleteHistory(Entity ent, ref CriminalRecordDeleteHistory msg) { - if (!CheckSelected(ent, msg.Session, out _, out var key)) + if (!CheckSelected(ent, msg.Actor, out _, out var key)) return; if (!_criminalRecords.TryDeleteHistory(key.Value, msg.Index)) @@ -185,7 +185,7 @@ public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleS if (!TryComp(owningStation, out var stationRecords)) { - _ui.TrySetUiState(uid, CriminalRecordsConsoleKey.Key, new CriminalRecordsConsoleState()); + _ui.SetUiState(uid, CriminalRecordsConsoleKey.Key, new CriminalRecordsConsoleState()); return; } @@ -201,24 +201,22 @@ public sealed class CriminalRecordsConsoleSystem : SharedCriminalRecordsConsoleS state.SelectedKey = id; } - _ui.TrySetUiState(uid, CriminalRecordsConsoleKey.Key, state); + _ui.SetUiState(uid, CriminalRecordsConsoleKey.Key, state); } /// /// Boilerplate that most actions use, if they require that a record be selected. /// Obviously shouldn't be used for selecting records. /// - private bool CheckSelected(Entity ent, ICommonSession session, + private bool CheckSelected(Entity ent, EntityUid user, [NotNullWhen(true)] out EntityUid? mob, [NotNullWhen(true)] out StationRecordKey? key) { key = null; mob = null; - if (session.AttachedEntity is not { } user) - return false; if (!_access.IsAllowed(user, ent)) { - _popup.PopupEntity(Loc.GetString("criminal-records-permission-denied"), ent, session); + _popup.PopupEntity(Loc.GetString("criminal-records-permission-denied"), ent, user); return false; } diff --git a/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs b/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs index 0e214ee865..14e0c75d96 100644 --- a/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs +++ b/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs @@ -48,9 +48,9 @@ public sealed class SignalTimerSystem : EntitySystem { var time = TryComp(uid, out var active) ? active.TriggerTime : TimeSpan.Zero; - if (_ui.TryGetUi(uid, SignalTimerUiKey.Key, out var bui)) + if (_ui.HasUi(uid, SignalTimerUiKey.Key)) { - _ui.SetUiState(bui, new SignalTimerBoundUserInterfaceState(component.Label, + _ui.SetUiState(uid, SignalTimerUiKey.Key, new SignalTimerBoundUserInterfaceState(component.Label, TimeSpan.FromSeconds(component.Delay).Minutes.ToString("D2"), TimeSpan.FromSeconds(component.Delay).Seconds.ToString("D2"), component.CanEditLabel, @@ -70,9 +70,9 @@ public sealed class SignalTimerSystem : EntitySystem _audio.PlayPvs(signalTimer.DoneSound, uid); _signalSystem.InvokePort(uid, signalTimer.TriggerPort); - if (_ui.TryGetUi(uid, SignalTimerUiKey.Key, out var bui)) + if (_ui.HasUi(uid, SignalTimerUiKey.Key)) { - _ui.SetUiState(bui, new SignalTimerBoundUserInterfaceState(signalTimer.Label, + _ui.SetUiState(uid, SignalTimerUiKey.Key, new SignalTimerBoundUserInterfaceState(signalTimer.Label, TimeSpan.FromSeconds(signalTimer.Delay).Minutes.ToString("D2"), TimeSpan.FromSeconds(signalTimer.Delay).Seconds.ToString("D2"), signalTimer.CanEditLabel, @@ -117,10 +117,7 @@ public sealed class SignalTimerSystem : EntitySystem /// The entity that is interacted with. private bool IsMessageValid(EntityUid uid, BoundUserInterfaceMessage message) { - if (message.Session.AttachedEntity is not { Valid: true } mob) - return false; - - if (!_accessReader.IsAllowed(mob, uid)) + if (!_accessReader.IsAllowed(message.Actor, uid)) return false; return true; diff --git a/Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs b/Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs index 02c6538158..b68f8a594b 100644 --- a/Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs @@ -89,7 +89,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem continue; //The network configurator is a handheld device. There can only ever be an ui session open for the player holding the device. - _uiSystem.TryCloseAll(uid, NetworkConfiguratorUiKey.Configure); + _uiSystem.CloseUi(uid, NetworkConfiguratorUiKey.Configure); } } @@ -215,7 +215,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem private void OnComponentRemoved(EntityUid uid, DeviceListComponent component, ComponentRemove args) { - _uiSystem.TryCloseAll(uid, NetworkConfiguratorUiKey.Configure); + _uiSystem.CloseUi(uid, NetworkConfiguratorUiKey.Configure); } /// @@ -433,7 +433,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem return; - _uiSystem.TryOpen(configuratorUid, NetworkConfiguratorUiKey.Link, actor.PlayerSession); + _uiSystem.OpenUi(configuratorUid, NetworkConfiguratorUiKey.Link, actor.PlayerSession); configurator.DeviceLinkTarget = targetUid; @@ -464,7 +464,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem var sinkAddress = Resolve(sinkUid, ref sinkNetworkComponent, false) ? sinkNetworkComponent.Address : ""; var state = new DeviceLinkUserInterfaceState(sources, sinks, links, sourceAddress, sinkAddress, defaults); - _uiSystem.TrySetUiState(configuratorUid, NetworkConfiguratorUiKey.Link, state); + _uiSystem.SetUiState(configuratorUid, NetworkConfiguratorUiKey.Link, state); } /// @@ -478,7 +478,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem if (Delay(configurator)) return; - if (!targetUid.HasValue || !TryComp(userUid, out ActorComponent? actor) || !AccessCheck(targetUid.Value, userUid, configurator)) + if (!targetUid.HasValue || !AccessCheck(targetUid.Value, userUid, configurator)) return; if (!TryComp(targetUid, out DeviceListComponent? list)) @@ -488,14 +488,13 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem configurator.ActiveDeviceList = targetUid; Dirty(configuratorUid, configurator); - if (!_uiSystem.TryGetUi(configuratorUid, NetworkConfiguratorUiKey.Configure, out var bui)) - return; - - if (_uiSystem.OpenUi(bui, actor.PlayerSession)) - _uiSystem.SetUiState(bui, new DeviceListUserInterfaceState( + if (_uiSystem.TryOpenUi(configuratorUid, NetworkConfiguratorUiKey.Configure, userUid)) + { + _uiSystem.SetUiState(configuratorUid, NetworkConfiguratorUiKey.Configure, new DeviceListUserInterfaceState( _deviceListSystem.GetDeviceList(configurator.ActiveDeviceList.Value) .Select(v => (v.Key, MetaData(v.Value).EntityName)).ToHashSet() )); + } } /// @@ -523,8 +522,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem component.Devices.Remove(invalidDevice); } - if (_uiSystem.TryGetUi(uid, NetworkConfiguratorUiKey.List, out var bui)) - _uiSystem.SetUiState(bui, new NetworkConfiguratorUserInterfaceState(devices)); + _uiSystem.SetUiState(uid, NetworkConfiguratorUiKey.List, new NetworkConfiguratorUserInterfaceState(devices)); } /// @@ -565,10 +563,10 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem /// private void OnRemoveDevice(EntityUid uid, NetworkConfiguratorComponent component, NetworkConfiguratorRemoveDeviceMessage args) { - if (component.Devices.TryGetValue(args.Address, out var removedDevice) && args.Session.AttachedEntity != null) + if (component.Devices.TryGetValue(args.Address, out var removedDevice)) { _adminLogger.Add(LogType.DeviceLinking, LogImpact.Low, - $"{ToPrettyString(args.Session.AttachedEntity.Value):actor} removed buffered device {ToPrettyString(removedDevice):subject} from {ToPrettyString(uid):tool}"); + $"{ToPrettyString(args.Actor):actor} removed buffered device {ToPrettyString(removedDevice):subject} from {ToPrettyString(uid):tool}"); } component.Devices.Remove(args.Address); @@ -583,10 +581,8 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem /// private void OnClearDevice(EntityUid uid, NetworkConfiguratorComponent component, NetworkConfiguratorClearDevicesMessage args) { - if (args.Session.AttachedEntity != null) - _adminLogger.Add(LogType.DeviceLinking, LogImpact.Low, - $"{ToPrettyString(args.Session.AttachedEntity.Value):actor} cleared buffered devices from {ToPrettyString(uid):tool}"); - + _adminLogger.Add(LogType.DeviceLinking, LogImpact.Low, + $"{ToPrettyString(args.Actor):actor} cleared buffered devices from {ToPrettyString(uid):tool}"); ClearDevices(uid, component); UpdateListUiState(uid, component); @@ -609,9 +605,8 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem if (!configurator.ActiveDeviceLink.HasValue || !configurator.DeviceLinkTarget.HasValue) return; - if (args.Session.AttachedEntity != null) - _adminLogger.Add(LogType.DeviceLinking, LogImpact.Low, - $"{ToPrettyString(args.Session.AttachedEntity.Value):actor} cleared links between {ToPrettyString(configurator.ActiveDeviceLink.Value):subject} and {ToPrettyString(configurator.DeviceLinkTarget.Value):subject2} with {ToPrettyString(uid):tool}"); + _adminLogger.Add(LogType.DeviceLinking, LogImpact.Low, + $"{ToPrettyString(args.Actor):actor} cleared links between {ToPrettyString(configurator.ActiveDeviceLink.Value):subject} and {ToPrettyString(configurator.DeviceLinkTarget.Value):subject2} with {ToPrettyString(uid):tool}"); if (HasComp(configurator.ActiveDeviceLink) && HasComp(configurator.DeviceLinkTarget)) { @@ -649,7 +644,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem if (TryComp(configurator.ActiveDeviceLink, out DeviceLinkSourceComponent? activeSource) && TryComp(configurator.DeviceLinkTarget, out DeviceLinkSinkComponent? targetSink)) { _deviceLinkSystem.ToggleLink( - args.Session.AttachedEntity, + args.Actor, configurator.ActiveDeviceLink.Value, configurator.DeviceLinkTarget.Value, args.Source, args.Sink, @@ -660,7 +655,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem else if (TryComp(configurator.DeviceLinkTarget, out DeviceLinkSourceComponent? targetSource) && TryComp(configurator.ActiveDeviceLink, out DeviceLinkSinkComponent? activeSink)) { _deviceLinkSystem.ToggleLink( - args.Session.AttachedEntity, + args.Actor, configurator.DeviceLinkTarget.Value, configurator.ActiveDeviceLink.Value, args.Source, args.Sink, @@ -687,7 +682,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem if (TryComp(configurator.ActiveDeviceLink, out DeviceLinkSourceComponent? activeSource) && TryComp(configurator.DeviceLinkTarget, out DeviceLinkSinkComponent? targetSink)) { _deviceLinkSystem.SaveLinks( - args.Session.AttachedEntity, + args.Actor, configurator.ActiveDeviceLink.Value, configurator.DeviceLinkTarget.Value, args.Links, @@ -705,7 +700,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem else if (TryComp(configurator.DeviceLinkTarget, out DeviceLinkSourceComponent? targetSource) && TryComp(configurator.ActiveDeviceLink, out DeviceLinkSinkComponent? activeSink)) { _deviceLinkSystem.SaveLinks( - args.Session.AttachedEntity, + args.Actor, configurator.DeviceLinkTarget.Value, configurator.ActiveDeviceLink.Value, args.Links, @@ -735,29 +730,25 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem switch (args.ButtonKey) { case NetworkConfiguratorButtonKey.Set: - if (args.Session.AttachedEntity != null) - _adminLogger.Add(LogType.DeviceLinking, LogImpact.Low, - $"{ToPrettyString(args.Session.AttachedEntity.Value):actor} set device links to {ToPrettyString(component.ActiveDeviceList.Value):subject} with {ToPrettyString(uid):tool}"); + _adminLogger.Add(LogType.DeviceLinking, LogImpact.Low, + $"{ToPrettyString(args.Actor):actor} set device links to {ToPrettyString(component.ActiveDeviceList.Value):subject} with {ToPrettyString(uid):tool}"); result = _deviceListSystem.UpdateDeviceList(component.ActiveDeviceList.Value, new HashSet(component.Devices.Values)); break; case NetworkConfiguratorButtonKey.Add: - if (args.Session.AttachedEntity != null) - _adminLogger.Add(LogType.DeviceLinking, LogImpact.Low, - $"{ToPrettyString(args.Session.AttachedEntity.Value):actor} added device links to {ToPrettyString(component.ActiveDeviceList.Value):subject} with {ToPrettyString(uid):tool}"); + _adminLogger.Add(LogType.DeviceLinking, LogImpact.Low, + $"{ToPrettyString(args.Actor):actor} added device links to {ToPrettyString(component.ActiveDeviceList.Value):subject} with {ToPrettyString(uid):tool}"); result = _deviceListSystem.UpdateDeviceList(component.ActiveDeviceList.Value, new HashSet(component.Devices.Values), true); break; case NetworkConfiguratorButtonKey.Clear: - if (args.Session.AttachedEntity != null) - _adminLogger.Add(LogType.DeviceLinking, LogImpact.Low, - $"{ToPrettyString(args.Session.AttachedEntity.Value):actor} cleared device links from {ToPrettyString(component.ActiveDeviceList.Value):subject} with {ToPrettyString(uid):tool}"); + _adminLogger.Add(LogType.DeviceLinking, LogImpact.Low, + $"{ToPrettyString(args.Actor):actor} cleared device links from {ToPrettyString(component.ActiveDeviceList.Value):subject} with {ToPrettyString(uid):tool}"); result = _deviceListSystem.UpdateDeviceList(component.ActiveDeviceList.Value, new HashSet()); break; case NetworkConfiguratorButtonKey.Copy: - if (args.Session.AttachedEntity != null) - _adminLogger.Add(LogType.DeviceLinking, LogImpact.Low, - $"{ToPrettyString(args.Session.AttachedEntity.Value):actor} copied devices from {ToPrettyString(component.ActiveDeviceList.Value):subject} to {ToPrettyString(uid):tool}"); + _adminLogger.Add(LogType.DeviceLinking, LogImpact.Low, + $"{ToPrettyString(args.Actor):actor} copied devices from {ToPrettyString(component.ActiveDeviceList.Value):subject} to {ToPrettyString(uid):tool}"); ClearDevices(uid, component); @@ -783,8 +774,8 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem _ => "error" }; - _popupSystem.PopupCursor(Loc.GetString(resultText), args.Session, PopupType.Medium); - _uiSystem.TrySetUiState( + _popupSystem.PopupCursor(Loc.GetString(resultText), args.Actor, PopupType.Medium); + _uiSystem.SetUiState( uid, NetworkConfiguratorUiKey.Configure, new DeviceListUserInterfaceState( diff --git a/Content.Server/Disposal/Mailing/MailingUnitSystem.cs b/Content.Server/Disposal/Mailing/MailingUnitSystem.cs index 001abad3dc..8e9c9e4ba7 100644 --- a/Content.Server/Disposal/Mailing/MailingUnitSystem.cs +++ b/Content.Server/Disposal/Mailing/MailingUnitSystem.cs @@ -159,8 +159,7 @@ public sealed class MailingUnitSystem : EntitySystem args.Handled = true; UpdateTargetList(uid, component); - if (_userInterfaceSystem.TryGetUi(uid, MailingUnitUiKey.Key, out var bui)) - _userInterfaceSystem.OpenUi(bui, actor.PlayerSession); + _userInterfaceSystem.OpenUi(uid, MailingUnitUiKey.Key, actor.PlayerSession); } /// @@ -178,8 +177,7 @@ public sealed class MailingUnitSystem : EntitySystem return; var state = new MailingUnitBoundUserInterfaceState(component.DisposalUnitInterfaceState, component.Target, component.TargetList, component.Tag); - if (_userInterfaceSystem.TryGetUi(uid, MailingUnitUiKey.Key, out var bui)) - _userInterfaceSystem.SetUiState(bui, state); + _userInterfaceSystem.SetUiState(uid, MailingUnitUiKey.Key, state); } private void OnTargetSelected(EntityUid uid, MailingUnitComponent component, TargetSelectedMessage args) diff --git a/Content.Server/Disposal/Tube/DisposalTubeSystem.cs b/Content.Server/Disposal/Tube/DisposalTubeSystem.cs index 6c0bced53e..f0f6e9142c 100644 --- a/Content.Server/Disposal/Tube/DisposalTubeSystem.cs +++ b/Content.Server/Disposal/Tube/DisposalTubeSystem.cs @@ -101,8 +101,9 @@ namespace Content.Server.Disposal.Tube /// A user interface message from the client. private void OnUiAction(EntityUid uid, DisposalRouterComponent router, SharedDisposalRouterComponent.UiActionMessage msg) { - if (!EntityManager.EntityExists(msg.Session.AttachedEntity)) + if (!EntityManager.EntityExists(msg.Actor)) return; + if (TryComp(uid, out var physBody) && physBody.BodyType != BodyType.Static) return; @@ -279,9 +280,9 @@ namespace Content.Server.Disposal.Tube private void OnOpenTaggerUI(EntityUid uid, DisposalTaggerComponent tagger, BoundUIOpenedEvent args) { - if (_uiSystem.TryGetUi(uid, DisposalTaggerUiKey.Key, out var bui)) + if (_uiSystem.HasUi(uid, DisposalTaggerUiKey.Key)) { - _uiSystem.SetUiState(bui, + _uiSystem.SetUiState(uid, DisposalTaggerUiKey.Key, new DisposalTaggerUserInterfaceState(tagger.Tag)); } } @@ -292,13 +293,9 @@ namespace Content.Server.Disposal.Tube /// Returns a private void UpdateRouterUserInterface(EntityUid uid, DisposalRouterComponent router) { - var bui = _uiSystem.GetUiOrNull(uid, DisposalRouterUiKey.Key); - if (bui == null) - return; - if (router.Tags.Count <= 0) { - _uiSystem.SetUiState(bui, new DisposalRouterUserInterfaceState("")); + _uiSystem.SetUiState(uid, DisposalRouterUiKey.Key, new DisposalRouterUserInterfaceState("")); return; } @@ -312,7 +309,7 @@ namespace Content.Server.Disposal.Tube taglist.Remove(taglist.Length - 2, 2); - _uiSystem.SetUiState(bui, new DisposalRouterUserInterfaceState(taglist.ToString())); + _uiSystem.SetUiState(uid, DisposalRouterUiKey.Key, new DisposalRouterUserInterfaceState(taglist.ToString())); } private void OnAnchorChange(EntityUid uid, DisposalTubeComponent component, ref AnchorStateChangedEvent args) diff --git a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs index ba84546258..21e152c103 100644 --- a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs +++ b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs @@ -219,7 +219,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem #region UI Handlers private void OnUiButtonPressed(EntityUid uid, SharedDisposalUnitComponent component, SharedDisposalUnitComponent.UiButtonPressedMessage args) { - if (args.Session.AttachedEntity is not { Valid: true } player) + if (args.Actor is not { Valid: true } player) { return; } @@ -235,7 +235,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem _adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(player):player} hit flush button on {ToPrettyString(uid)}, it's now {(component.Engaged ? "on" : "off")}"); break; case SharedDisposalUnitComponent.UiButton.Power: - _power.TogglePower(uid, user: args.Session.AttachedEntity); + _power.TogglePower(uid, user: args.Actor); break; default: throw new ArgumentOutOfRangeException($"{ToPrettyString(player):player} attempted to hit a nonexistant button on {ToPrettyString(uid)}"); @@ -268,7 +268,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem } args.Handled = true; - _ui.TryOpen(uid, SharedDisposalUnitComponent.DisposalUnitUiKey.Key, actor.PlayerSession); + _ui.OpenUi(uid, SharedDisposalUnitComponent.DisposalUnitUiKey.Key, actor.PlayerSession); } private void OnAfterInteractUsing(EntityUid uid, SharedDisposalUnitComponent component, AfterInteractUsingEvent args) @@ -597,7 +597,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem var compState = GetState(uid, component); var stateString = Loc.GetString($"disposal-unit-state-{compState}"); var state = new SharedDisposalUnitComponent.DisposalUnitBoundUserInterfaceState(Name(uid), stateString, EstimatedFullPressure(uid, component), powered, component.Engaged); - _ui.TrySetUiState(uid, SharedDisposalUnitComponent.DisposalUnitUiKey.Key, state); + _ui.SetUiState(uid, SharedDisposalUnitComponent.DisposalUnitUiKey.Key, state); var stateUpdatedEvent = new DisposalUnitUIStateUpdatedEvent(state); RaiseLocalEvent(uid, stateUpdatedEvent); @@ -802,10 +802,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem QueueAutomaticEngage(uid, component); - if (TryComp(inserted, out ActorComponent? actor)) - { - _ui.TryClose(uid, SharedDisposalUnitComponent.DisposalUnitUiKey.Key, actor.PlayerSession); - } + _ui.CloseUi(uid, SharedDisposalUnitComponent.DisposalUnitUiKey.Key, inserted); // Maybe do pullable instead? Eh still fine. Joints.RecursiveClearJoints(inserted); diff --git a/Content.Server/Doors/Electronics/Systems/DoorElectronicsSystem.cs b/Content.Server/Doors/Electronics/Systems/DoorElectronicsSystem.cs index 56e8bd50b3..af9ccadd91 100644 --- a/Content.Server/Doors/Electronics/Systems/DoorElectronicsSystem.cs +++ b/Content.Server/Doors/Electronics/Systems/DoorElectronicsSystem.cs @@ -39,7 +39,7 @@ public sealed class DoorElectronicsSystem : EntitySystem } var state = new DoorElectronicsConfigurationState(accesses); - _uiSystem.TrySetUiState(uid, DoorElectronicsConfigurationUiKey.Key, state); + _uiSystem.SetUiState(uid, DoorElectronicsConfigurationUiKey.Key, state); } private void OnChangeConfiguration( diff --git a/Content.Server/Extinguisher/FireExtinguisherComponent.cs b/Content.Server/Extinguisher/FireExtinguisherComponent.cs index fe10b4a574..991fc76c62 100644 --- a/Content.Server/Extinguisher/FireExtinguisherComponent.cs +++ b/Content.Server/Extinguisher/FireExtinguisherComponent.cs @@ -3,7 +3,7 @@ using Robust.Shared.GameStates; namespace Content.Server.Extinguisher; -[NetworkedComponent, RegisterComponent] +[RegisterComponent] [Access(typeof(FireExtinguisherSystem))] public sealed partial class FireExtinguisherComponent : SharedFireExtinguisherComponent { diff --git a/Content.Server/Eye/Blinding/ActivatableUIRequiresVisionSystem.cs b/Content.Server/Eye/Blinding/ActivatableUIRequiresVisionSystem.cs index b51efc2f5e..7b937cf0d8 100644 --- a/Content.Server/Eye/Blinding/ActivatableUIRequiresVisionSystem.cs +++ b/Content.Server/Eye/Blinding/ActivatableUIRequiresVisionSystem.cs @@ -5,6 +5,7 @@ using Content.Shared.Eye.Blinding.Components; using Content.Shared.Eye.Blinding.Systems; using Robust.Shared.Player; using Robust.Server.GameObjects; +using Robust.Shared.Collections; namespace Content.Server.Eye.Blinding; @@ -37,24 +38,19 @@ public sealed class ActivatableUIRequiresVisionSystem : EntitySystem if (!args.Blind) return; - if (!TryComp(uid, out var actor)) - return; + var toClose = new ValueList<(EntityUid Entity, Enum Key)>(); - var uiList = _userInterfaceSystem.GetAllUIsForSession(actor.PlayerSession); - if (uiList == null) - return; - - Queue closeList = new(); // foreach collection modified moment - - foreach (var ui in uiList) + foreach (var bui in _userInterfaceSystem.GetActorUis(uid)) { - if (HasComp(ui.Owner)) - closeList.Enqueue(ui); + if (HasComp(bui.Entity)) + { + toClose.Add(bui); + } } - foreach (var ui in closeList) + foreach (var bui in toClose) { - _userInterfaceSystem.CloseUi(ui, actor.PlayerSession); + _userInterfaceSystem.CloseUi(bui.Entity, bui.Key, uid); } } } diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 3ff139466f..f492595444 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -51,7 +51,7 @@ public sealed class FaxSystem : EntitySystem /// [ValidatePrototypeId] private const string DefaultPaperPrototypeId = "Paper"; - + [ValidatePrototypeId] private const string OfficePaperPrototypeId = "PaperOffice"; @@ -318,7 +318,7 @@ public sealed class FaxSystem : EntitySystem private void OnSendButtonPressed(EntityUid uid, FaxMachineComponent component, FaxSendMessage args) { - Send(uid, component, args.Session.AttachedEntity); + Send(uid, component, args.Actor); } private void OnRefreshButtonPressed(EntityUid uid, FaxMachineComponent component, FaxRefreshMessage args) @@ -358,7 +358,7 @@ public sealed class FaxSystem : EntitySystem component.SendTimeoutRemaining <= 0 && component.InsertingTimeRemaining <= 0; var state = new FaxUiState(component.FaxName, component.KnownFaxes, canSend, canCopy, isPaperInserted, component.DestinationFaxAddress); - _userInterface.TrySetUiState(uid, FaxUiKey.Key, state); + _userInterface.SetUiState(uid, FaxUiKey.Key, state); } /// @@ -410,19 +410,15 @@ public sealed class FaxSystem : EntitySystem prototype = DefaultPaperPrototypeId; var name = Loc.GetString("fax-machine-printed-paper-name"); - + var printout = new FaxPrintout(args.Content, name, prototype); component.PrintingQueue.Enqueue(printout); component.SendTimeoutRemaining += component.SendTimeout; UpdateUserInterface(uid, component); - if (args.Session.AttachedEntity != null) - _adminLogger.Add(LogType.Action, LogImpact.Low, - $"{ToPrettyString(args.Session.AttachedEntity.Value):actor} added print job to {ToPrettyString(uid):tool} with text: {args.Content}"); - else - _adminLogger.Add(LogType.Action, LogImpact.Low, - $"Someone added print job to {ToPrettyString(uid):tool} with text: {args.Content}"); + _adminLogger.Add(LogType.Action, LogImpact.Low, + $"{ToPrettyString(args.Actor):actor} added print job to {ToPrettyString(uid):tool} with text: {args.Content}"); } /// @@ -457,9 +453,8 @@ public sealed class FaxSystem : EntitySystem UpdateUserInterface(uid, component); - if (args.Session.AttachedEntity != null) - _adminLogger.Add(LogType.Action, LogImpact.Low, - $"{ToPrettyString(args.Session.AttachedEntity.Value):actor} added copy job to {ToPrettyString(uid):tool} with text: {ToPrettyString(component.PaperSlot.Item):subject}"); + _adminLogger.Add(LogType.Action, LogImpact.Low, + $"{ToPrettyString(args.Actor):actor} added copy job to {ToPrettyString(uid):tool} with text: {ToPrettyString(component.PaperSlot.Item):subject}"); } /// diff --git a/Content.Server/Forensics/Systems/ForensicScannerSystem.cs b/Content.Server/Forensics/Systems/ForensicScannerSystem.cs index 729b7304fa..5e2a562577 100644 --- a/Content.Server/Forensics/Systems/ForensicScannerSystem.cs +++ b/Content.Server/Forensics/Systems/ForensicScannerSystem.cs @@ -52,8 +52,7 @@ namespace Content.Server.Forensics component.PrintCooldown, component.PrintReadyAt); - if (!_uiSystem.TrySetUiState(uid, ForensicScannerUiKey.Key, state)) - Log.Warning($"{ToPrettyString(uid)} was unable to set UI state."); + _uiSystem.SetUiState(uid, ForensicScannerUiKey.Key, state); } private void OnDoAfter(EntityUid uid, ForensicScannerComponent component, DoAfterEvent args) @@ -163,23 +162,14 @@ namespace Content.Server.Forensics private void OpenUserInterface(EntityUid user, Entity scanner) { - if (!TryComp(user, out var actor)) - return; - UpdateUserInterface(scanner, scanner.Comp); - _uiSystem.TryOpen(scanner, ForensicScannerUiKey.Key, actor.PlayerSession); + _uiSystem.OpenUi(scanner.Owner, ForensicScannerUiKey.Key, user); } private void OnPrint(EntityUid uid, ForensicScannerComponent component, ForensicScannerPrintMessage args) { - if (!args.Session.AttachedEntity.HasValue) - { - Log.Warning($"{ToPrettyString(uid)} got OnPrint without Session.AttachedEntity"); - return; - } - - var user = args.Session.AttachedEntity.Value; + var user = args.Actor; if (_gameTiming.CurTime < component.PrintReadyAt) { @@ -191,7 +181,7 @@ namespace Content.Server.Forensics // Spawn a piece of paper. var printed = EntityManager.SpawnEntity(component.MachineOutput, Transform(uid).Coordinates); - _handsSystem.PickupOrDrop(args.Session.AttachedEntity, printed, checkActionBlocker: false); + _handsSystem.PickupOrDrop(args.Actor, printed, checkActionBlocker: false); if (!HasComp(printed)) { @@ -240,9 +230,6 @@ namespace Content.Server.Forensics private void OnClear(EntityUid uid, ForensicScannerComponent component, ForensicScannerClearMessage args) { - if (!args.Session.AttachedEntity.HasValue) - return; - component.Fingerprints = new(); component.Fibers = new(); component.DNAs = new(); diff --git a/Content.Server/Gateway/Systems/GatewaySystem.cs b/Content.Server/Gateway/Systems/GatewaySystem.cs index 7ebc751dd2..6ed28d71a7 100644 --- a/Content.Server/Gateway/Systems/GatewaySystem.cs +++ b/Content.Server/Gateway/Systems/GatewaySystem.cs @@ -129,7 +129,7 @@ public sealed class GatewaySystem : EntitySystem unlockTime ); - _ui.TrySetUiState(uid, GatewayUiKey.Key, state); + _ui.SetUiState(uid, GatewayUiKey.Key, state); } private void UpdateAppearance(EntityUid uid) @@ -139,12 +139,14 @@ public sealed class GatewaySystem : EntitySystem private void OnOpenPortal(EntityUid uid, GatewayComponent comp, GatewayOpenPortalMessage args) { - if (args.Session.AttachedEntity == null || GetNetEntity(uid) == args.Destination || + if (GetNetEntity(uid) == args.Destination || !comp.Enabled || !comp.Interactable) + { return; + } // if the gateway has an access reader check it before allowing opening - var user = args.Session.AttachedEntity.Value; + var user = args.Actor; if (CheckAccess(user, uid, comp)) return; diff --git a/Content.Server/Gravity/GravityGeneratorSystem.cs b/Content.Server/Gravity/GravityGeneratorSystem.cs index b0c4bb56ff..8e4da75fac 100644 --- a/Content.Server/Gravity/GravityGeneratorSystem.cs +++ b/Content.Server/Gravity/GravityGeneratorSystem.cs @@ -131,13 +131,13 @@ namespace Content.Server.Gravity } private void SetSwitchedOn(EntityUid uid, GravityGeneratorComponent component, bool on, - ApcPowerReceiverComponent? powerReceiver = null, ICommonSession? session = null) + ApcPowerReceiverComponent? powerReceiver = null, EntityUid? user = null) { if (!Resolve(uid, ref powerReceiver)) return; - if (session is { AttachedEntity: { } }) - _adminLogger.Add(LogType.Action, on ? LogImpact.Medium : LogImpact.High, $"{session:player} set ${ToPrettyString(uid):target} to {(on ? "on" : "off")}"); + if (user != null) + _adminLogger.Add(LogType.Action, on ? LogImpact.Medium : LogImpact.High, $"{ToPrettyString(user)} set ${ToPrettyString(uid):target} to {(on ? "on" : "off")}"); component.SwitchedOn = on; UpdatePowerState(component, powerReceiver); @@ -154,7 +154,7 @@ namespace Content.Server.Gravity private void UpdateUI(Entity ent, float chargeRate) { var (_, component, powerReceiver) = ent; - if (!_uiSystem.IsUiOpen(ent, SharedGravityGeneratorComponent.GravityGeneratorUiKey.Key)) + if (!_uiSystem.IsUiOpen(ent.Owner, SharedGravityGeneratorComponent.GravityGeneratorUiKey.Key)) return; var chargeTarget = chargeRate < 0 ? 0 : component.MaxCharge; @@ -189,8 +189,8 @@ namespace Content.Server.Gravity chargeEta ); - _uiSystem.TrySetUiState( - ent, + _uiSystem.SetUiState( + ent.Owner, SharedGravityGeneratorComponent.GravityGeneratorUiKey.Key, state); @@ -209,9 +209,6 @@ namespace Content.Server.Gravity private void OnInteractHand(EntityUid uid, GravityGeneratorComponent component, InteractHandEvent args) { - if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) - return; - ApcPowerReceiverComponent? powerReceiver = default!; if (!Resolve(uid, ref powerReceiver)) return; @@ -220,7 +217,7 @@ namespace Content.Server.Gravity if (!component.Intact || powerReceiver.PowerReceived < component.IdlePowerUse) return; - _uiSystem.TryOpen(uid, SharedGravityGeneratorComponent.GravityGeneratorUiKey.Key, actor.PlayerSession); + _uiSystem.OpenUi(uid, SharedGravityGeneratorComponent.GravityGeneratorUiKey.Key, args.User); component.NeedUIUpdate = true; } @@ -287,7 +284,7 @@ namespace Content.Server.Gravity GravityGeneratorComponent component, SharedGravityGeneratorComponent.SwitchGeneratorMessage args) { - SetSwitchedOn(uid, component, args.On, session:args.Session); + SetSwitchedOn(uid, component, args.On, user: args.Actor); } } } diff --git a/Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.Modifier.cs b/Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.Modifier.cs index 336116e78b..7744d16151 100644 --- a/Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.Modifier.cs +++ b/Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.Modifier.cs @@ -32,8 +32,8 @@ public sealed partial class HumanoidAppearanceSystem Icon = new SpriteSpecifier.Rsi(new("/Textures/Mobs/Customization/reptilian_parts.rsi"), "tail_smooth"), Act = () => { - _uiSystem.TryOpen(uid, HumanoidMarkingModifierKey.Key, actor.PlayerSession); - _uiSystem.TrySetUiState( + _uiSystem.OpenUi(uid, HumanoidMarkingModifierKey.Key, actor.PlayerSession); + _uiSystem.SetUiState( uid, HumanoidMarkingModifierKey.Key, new HumanoidMarkingModifierState(component.MarkingSet, component.Species, @@ -48,8 +48,7 @@ public sealed partial class HumanoidAppearanceSystem private void OnBaseLayersSet(EntityUid uid, HumanoidAppearanceComponent component, HumanoidMarkingModifierBaseLayersSetMessage message) { - if (message.Session is not { } player - || !_adminManager.HasAdminFlag(player, AdminFlags.Fun)) + if (!_adminManager.HasAdminFlag(message.Actor, AdminFlags.Fun)) { return; } @@ -67,7 +66,7 @@ public sealed partial class HumanoidAppearanceSystem if (message.ResendState) { - _uiSystem.TrySetUiState( + _uiSystem.SetUiState( uid, HumanoidMarkingModifierKey.Key, new HumanoidMarkingModifierState(component.MarkingSet, component.Species, @@ -81,8 +80,7 @@ public sealed partial class HumanoidAppearanceSystem private void OnMarkingsSet(EntityUid uid, HumanoidAppearanceComponent component, HumanoidMarkingModifierMarkingSetMessage message) { - if (message.Session is not { } player - || !_adminManager.HasAdminFlag(player, AdminFlags.Fun)) + if (!_adminManager.HasAdminFlag(message.Actor, AdminFlags.Fun)) { return; } @@ -92,7 +90,7 @@ public sealed partial class HumanoidAppearanceSystem if (message.ResendState) { - _uiSystem.TrySetUiState( + _uiSystem.SetUiState( uid, HumanoidMarkingModifierKey.Key, new HumanoidMarkingModifierState(component.MarkingSet, component.Species, diff --git a/Content.Server/Instruments/InstrumentComponent.cs b/Content.Server/Instruments/InstrumentComponent.cs index 1b7913386d..db9dbb375b 100644 --- a/Content.Server/Instruments/InstrumentComponent.cs +++ b/Content.Server/Instruments/InstrumentComponent.cs @@ -1,6 +1,7 @@ using Content.Server.UserInterface; using Content.Shared.Instruments; using Robust.Shared.Player; +using ActivatableUIComponent = Content.Shared.UserInterface.ActivatableUIComponent; namespace Content.Server.Instruments; @@ -16,9 +17,9 @@ public sealed partial class InstrumentComponent : SharedInstrumentComponent [ViewVariables] public uint LastSequencerTick = 0; // TODO Instruments: Make this ECS - public ICommonSession? InstrumentPlayer => + public EntityUid? InstrumentPlayer => _entMan.GetComponentOrNull(Owner)?.CurrentSingleUser - ?? _entMan.GetComponentOrNull(Owner)?.PlayerSession; + ?? _entMan.GetComponentOrNull(Owner)?.PlayerSession.AttachedEntity; } [RegisterComponent] diff --git a/Content.Server/Instruments/InstrumentSystem.cs b/Content.Server/Instruments/InstrumentSystem.cs index 8dd9644e3c..f5a6713886 100644 --- a/Content.Server/Instruments/InstrumentSystem.cs +++ b/Content.Server/Instruments/InstrumentSystem.cs @@ -111,7 +111,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem if (!TryComp(uid, out InstrumentComponent? instrument)) return; - if (args.SenderSession != instrument.InstrumentPlayer) + if (args.SenderSession.AttachedEntity != instrument.InstrumentPlayer) return; instrument.Playing = true; @@ -125,7 +125,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem if (!TryComp(uid, out InstrumentComponent? instrument)) return; - if (args.SenderSession != instrument.InstrumentPlayer) + if (args.SenderSession.AttachedEntity != instrument.InstrumentPlayer) return; Clean(uid, instrument); @@ -142,7 +142,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem if (!TryComp(uid, out InstrumentComponent? instrument)) return; - if (args.SenderSession != instrument.InstrumentPlayer) + if (args.SenderSession.AttachedEntity != instrument.InstrumentPlayer) return; if (master != null) @@ -174,7 +174,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem if (!TryComp(uid, out InstrumentComponent? instrument)) return; - if (args.SenderSession != instrument.InstrumentPlayer) + if (args.SenderSession.AttachedEntity != instrument.InstrumentPlayer) return; if (msg.Channel == RobustMidiEvent.PercussionChannel && !instrument.AllowPercussion) @@ -194,8 +194,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem private void OnBoundUIClosed(EntityUid uid, InstrumentComponent component, BoundUIClosedEvent args) { if (HasComp(uid) - && _bui.TryGetUi(uid, args.UiKey, out var bui) - && bui.SubscribedSessions.Count == 0) + && !_bui.IsUiOpen(uid, args.UiKey)) { RemComp(uid); } @@ -232,7 +231,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem var instrumentQuery = EntityManager.GetEntityQuery(); if (!TryComp(uid, out InstrumentComponent? originInstrument) - || originInstrument.InstrumentPlayer?.AttachedEntity is not {} originPlayer) + || originInstrument.InstrumentPlayer is not {} originPlayer) return Array.Empty<(NetEntity, string)>(); // It's probably faster to get all possible active instruments than all entities in range @@ -247,7 +246,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem continue; // We want to use the instrument player's name. - if (instrument.InstrumentPlayer?.AttachedEntity is not {} playerUid) + if (instrument.InstrumentPlayer is not {} playerUid) continue; // Maybe a bit expensive but oh well GetBands is queued and has a timer anyway. @@ -298,7 +297,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem return; if (!instrument.Playing - || args.SenderSession != instrument.InstrumentPlayer + || args.SenderSession.AttachedEntity != instrument.InstrumentPlayer || instrument.InstrumentPlayer == null || args.SenderSession.AttachedEntity is not { } attached) { @@ -374,8 +373,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem var entity = GetEntity(request.Entity); var nearby = GetBands(entity); - _bui.TrySendUiMessage(entity, request.UiKey, new InstrumentBandResponseBuiMessage(nearby), - request.Session); + _bui.ServerSendUiMessage(entity, request.UiKey, new InstrumentBandResponseBuiMessage(nearby), request.Actor); } _bandRequestQueue.Clear(); @@ -413,7 +411,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem (instrument.BatchesDropped >= MaxMidiBatchesDropped || instrument.LaggedBatches >= MaxMidiLaggedBatches)) { - if (instrument.InstrumentPlayer?.AttachedEntity is {Valid: true} mob) + if (instrument.InstrumentPlayer is {Valid: true} mob) { _stuns.TryParalyze(mob, TimeSpan.FromSeconds(1), true); @@ -423,7 +421,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem // Just in case Clean(uid); - _bui.TryCloseAll(uid, InstrumentUiKey.Key); + _bui.CloseUi(uid, InstrumentUiKey.Key); } instrument.Timer += frameTime; @@ -437,13 +435,12 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem } } - public void ToggleInstrumentUi(EntityUid uid, ICommonSession session, InstrumentComponent? component = null) + public void ToggleInstrumentUi(EntityUid uid, EntityUid actor, InstrumentComponent? component = null) { if (!Resolve(uid, ref component)) return; - if (_bui.TryGetUi(uid, InstrumentUiKey.Key, out var bui)) - _bui.ToggleUi(bui, session); + _bui.TryToggleUi(uid, InstrumentUiKey.Key, actor); } public override bool ResolveInstrument(EntityUid uid, ref SharedInstrumentComponent? component) diff --git a/Content.Server/Interaction/InteractionSystem.cs b/Content.Server/Interaction/InteractionSystem.cs index 203781bcda..4eac7e9ef1 100644 --- a/Content.Server/Interaction/InteractionSystem.cs +++ b/Content.Server/Interaction/InteractionSystem.cs @@ -16,13 +16,6 @@ namespace Content.Server.Interaction [Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; - public override void Initialize() - { - base.Initialize(); - - SubscribeLocalEvent(HandleUserInterfaceRangeCheck); - } - public override bool CanAccessViaStorage(EntityUid user, EntityUid target) { if (Deleted(target)) @@ -37,26 +30,8 @@ namespace Content.Server.Interaction if (storage.Container?.ID != container.ID) return false; - if (!TryComp(user, out ActorComponent? actor)) - return false; - // we don't check if the user can access the storage entity itself. This should be handed by the UI system. - return _uiSystem.SessionHasOpenUi(container.Owner, StorageComponent.StorageUiKey.Key, actor.PlayerSession); - } - - private void HandleUserInterfaceRangeCheck(ref BoundUserInterfaceCheckRangeEvent ev) - { - if (ev.Player.AttachedEntity is not { } user || ev.Result == BoundUserInterfaceRangeResult.Fail) - return; - - if (InRangeUnobstructed(user, ev.Target, ev.UserInterface.InteractionRange)) - { - ev.Result = BoundUserInterfaceRangeResult.Pass; - } - else - { - ev.Result = BoundUserInterfaceRangeResult.Fail; - } + return _uiSystem.IsUiOpen(container.Owner, StorageComponent.StorageUiKey.Key, user); } } } diff --git a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs index 212383c463..fa5c5dad2a 100644 --- a/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs @@ -79,7 +79,7 @@ namespace Content.Server.Kitchen.EntitySystems SubscribeLocalEvent(OnSignalReceived); - SubscribeLocalEvent((u, c, m) => Wzhzhzh(u, c, m.Session.AttachedEntity)); + SubscribeLocalEvent((u, c, m) => Wzhzhzh(u, c, m.Actor)); SubscribeLocalEvent(OnEjectMessage); SubscribeLocalEvent(OnEjectIndex); SubscribeLocalEvent(OnSelectTime); @@ -355,11 +355,7 @@ namespace Content.Server.Kitchen.EntitySystems public void UpdateUserInterfaceState(EntityUid uid, MicrowaveComponent component) { - var ui = _userInterface.GetUiOrNull(uid, MicrowaveUiKey.Key); - if (ui == null) - return; - - _userInterface.SetUiState(ui, new MicrowaveUpdateUserInterfaceState( + _userInterface.SetUiState(uid, MicrowaveUiKey.Key, new MicrowaveUpdateUserInterfaceState( GetNetEntityArray(component.Storage.ContainedEntities.ToArray()), HasComp(uid), component.CurrentCookTimeButtonIndex, diff --git a/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs b/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs index e8ee453986..81001f0932 100644 --- a/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs @@ -127,7 +127,7 @@ namespace Content.Server.Kitchen.EntitySystems _solutionContainersSystem.TryAddSolution(containerSoln.Value, solution); } - _userInterfaceSystem.TrySendUiMessage(uid, ReagentGrinderUiKey.Key, + _userInterfaceSystem.ServerSendUiMessage(uid, ReagentGrinderUiKey.Key, new ReagentGrinderWorkCompleteMessage()); UpdateUiState(uid); @@ -228,7 +228,7 @@ namespace Content.Server.Kitchen.EntitySystems GetNetEntityArray(inputContainer.ContainedEntities.ToArray()), containerSolution?.Contents.ToArray() ); - _userInterfaceSystem.TrySetUiState(uid, ReagentGrinderUiKey.Key, state); + _userInterfaceSystem.SetUiState(uid, ReagentGrinderUiKey.Key, state); } private void OnStartMessage(Entity entity, ref ReagentGrinderStartMessage message) @@ -305,7 +305,7 @@ namespace Content.Server.Kitchen.EntitySystems reagentGrinder.AudioStream = _audioSystem.PlayPvs(sound, uid, AudioParams.Default.WithPitchScale(1 / reagentGrinder.WorkTimeMultiplier)).Value.Entity; //slightly higher pitched - _userInterfaceSystem.TrySendUiMessage(uid, ReagentGrinderUiKey.Key, + _userInterfaceSystem.ServerSendUiMessage(uid, ReagentGrinderUiKey.Key, new ReagentGrinderWorkStartedMessage(program)); } diff --git a/Content.Server/Labels/Label/HandLabelerSystem.cs b/Content.Server/Labels/Label/HandLabelerSystem.cs index dc7b9de0f8..84c41b0db5 100644 --- a/Content.Server/Labels/Label/HandLabelerSystem.cs +++ b/Content.Server/Labels/Label/HandLabelerSystem.cs @@ -90,7 +90,7 @@ namespace Content.Server.Labels private void OnHandLabelerLabelChanged(EntityUid uid, HandLabelerComponent handLabeler, HandLabelerLabelChangedMessage args) { - if (args.Session.AttachedEntity is not {Valid: true} player) + if (args.Actor is not {Valid: true} player) return; var label = args.Label.Trim(); @@ -109,7 +109,7 @@ namespace Content.Server.Labels if (!Resolve(uid, ref handLabeler)) return; - _userInterfaceSystem.TrySetUiState(uid, HandLabelerUiKey.Key, + _userInterfaceSystem.SetUiState(uid, HandLabelerUiKey.Key, new HandLabelerBoundUserInterfaceState(handLabeler.AssignedLabel)); } } diff --git a/Content.Server/Lathe/LatheSystem.cs b/Content.Server/Lathe/LatheSystem.cs index 06d1b463ec..f56737a5a5 100644 --- a/Content.Server/Lathe/LatheSystem.cs +++ b/Content.Server/Lathe/LatheSystem.cs @@ -226,11 +226,10 @@ namespace Content.Server.Lathe if (!Resolve(uid, ref component)) return; - var ui = _uiSys.GetUi(uid, LatheUiKey.Key); var producing = component.CurrentRecipe ?? component.Queue.FirstOrDefault(); var state = new LatheUpdateState(GetAvailableRecipes(uid, component), component.Queue, producing); - _uiSys.SetUiState(ui, state); + _uiSys.SetUiState(uid, LatheUiKey.Key, state); } private void OnGetRecipes(EntityUid uid, TechnologyDatabaseComponent component, LatheGetRecipesEvent args) @@ -337,10 +336,10 @@ namespace Content.Server.Lathe else break; } - if (count > 0 && args.Session.AttachedEntity != null) + if (count > 0) { _adminLogger.Add(LogType.Action, LogImpact.Low, - $"{ToPrettyString(args.Session.AttachedEntity.Value):player} queued {count} {recipe.Name} at {ToPrettyString(uid):lathe}"); + $"{ToPrettyString(args.Actor):player} queued {count} {recipe.Name} at {ToPrettyString(uid):lathe}"); } } TryStartProducing(uid, component); diff --git a/Content.Server/Lock/EntitySystems/ActivatableUIRequiresLockSystem.cs b/Content.Server/Lock/EntitySystems/ActivatableUIRequiresLockSystem.cs index dfe398ebaf..04f8e2eb54 100644 --- a/Content.Server/Lock/EntitySystems/ActivatableUIRequiresLockSystem.cs +++ b/Content.Server/Lock/EntitySystems/ActivatableUIRequiresLockSystem.cs @@ -3,6 +3,7 @@ using Content.Server.Popups; using Content.Shared.UserInterface; using Content.Shared.Lock; using Content.Server.UserInterface; +using ActivatableUISystem = Content.Shared.UserInterface.ActivatableUISystem; namespace Content.Server.Lock.EntitySystems; public sealed class ActivatableUIRequiresLockSystem : EntitySystem diff --git a/Content.Server/MagicMirror/MagicMirrorSystem.cs b/Content.Server/MagicMirror/MagicMirrorSystem.cs index 9ffd9a07a9..188ff40b02 100644 --- a/Content.Server/MagicMirror/MagicMirrorSystem.cs +++ b/Content.Server/MagicMirror/MagicMirrorSystem.cs @@ -32,7 +32,7 @@ public sealed class MagicMirrorSystem : EntitySystem Subs.BuiEvents(MagicMirrorUiKey.Key, subs => { - subs.Event(OnUIClosed); + subs.Event(OnUiClosed); subs.Event(OnMagicMirrorSelect); subs.Event(OnTryMagicMirrorChangeColor); subs.Event(OnTryMagicMirrorAddSlot); @@ -62,10 +62,7 @@ public sealed class MagicMirrorSystem : EntitySystem if (!args.CanReach || args.Target == null) return; - if (!TryComp(args.User, out var actor)) - return; - - if (!_uiSystem.TryOpen(mirror.Owner, MagicMirrorUiKey.Key, actor.PlayerSession)) + if (!_uiSystem.TryOpenUi(mirror.Owner, MagicMirrorUiKey.Key, args.User)) return; UpdateInterface(mirror.Owner, args.Target.Value, mirror.Comp); @@ -79,7 +76,7 @@ public sealed class MagicMirrorSystem : EntitySystem private void OnMagicMirrorSelect(EntityUid uid, MagicMirrorComponent component, MagicMirrorSelectMessage message) { - if (component.Target is not { } target || message.Session.AttachedEntity is not { } user) + if (component.Target is not { } target) return; _doAfterSystem.Cancel(component.DoAfter); @@ -92,7 +89,7 @@ public sealed class MagicMirrorSystem : EntitySystem Marking = message.Marking, }; - _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.SelectSlotTime, doAfter, uid, target: target, used: uid) + _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, message.Actor, component.SelectSlotTime, doAfter, uid, target: target, used: uid) { DistanceThreshold = SharedInteractionSystem.InteractionRange, BreakOnDamage = true, @@ -134,7 +131,7 @@ public sealed class MagicMirrorSystem : EntitySystem private void OnTryMagicMirrorChangeColor(EntityUid uid, MagicMirrorComponent component, MagicMirrorChangeColorMessage message) { - if (component.Target is not { } target || message.Session.AttachedEntity is not { } user) + if (component.Target is not { } target) return; _doAfterSystem.Cancel(component.DoAfter); @@ -147,7 +144,7 @@ public sealed class MagicMirrorSystem : EntitySystem Colors = message.Colors, }; - _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.ChangeSlotTime, doAfter, uid, target: target, used: uid) + _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, message.Actor, component.ChangeSlotTime, doAfter, uid, target: target, used: uid) { BreakOnDamage = true, BreakOnMove = true, @@ -187,7 +184,7 @@ public sealed class MagicMirrorSystem : EntitySystem private void OnTryMagicMirrorRemoveSlot(EntityUid uid, MagicMirrorComponent component, MagicMirrorRemoveSlotMessage message) { - if (component.Target is not { } target || message.Session.AttachedEntity is not { } user) + if (component.Target is not { } target) return; _doAfterSystem.Cancel(component.DoAfter); @@ -199,7 +196,7 @@ public sealed class MagicMirrorSystem : EntitySystem Slot = message.Slot, }; - _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.RemoveSlotTime, doAfter, uid, target: target, used: uid) + _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, message.Actor, component.RemoveSlotTime, doAfter, uid, target: target, used: uid) { DistanceThreshold = SharedInteractionSystem.InteractionRange, BreakOnDamage = true, @@ -243,9 +240,6 @@ public sealed class MagicMirrorSystem : EntitySystem if (component.Target == null) return; - if (message.Session.AttachedEntity == null) - return; - _doAfterSystem.Cancel(component.DoAfter); component.DoAfter = null; @@ -254,7 +248,7 @@ public sealed class MagicMirrorSystem : EntitySystem Category = message.Category, }; - _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, message.Session.AttachedEntity.Value, component.AddSlotTime, doAfter, uid, target: component.Target.Value, used: uid) + _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, message.Actor, component.AddSlotTime, doAfter, uid, target: component.Target.Value, used: uid) { BreakOnDamage = true, BreakOnMove = true, @@ -316,10 +310,10 @@ public sealed class MagicMirrorSystem : EntitySystem humanoid.MarkingSet.PointsLeft(MarkingCategories.FacialHair) + facialHair.Count); component.Target = targetUid; - _uiSystem.TrySetUiState(mirrorUid, MagicMirrorUiKey.Key, state); + _uiSystem.SetUiState(mirrorUid, MagicMirrorUiKey.Key, state); } - private void OnUIClosed(Entity ent, ref BoundUIClosedEvent args) + private void OnUiClosed(Entity ent, ref BoundUIClosedEvent args) { ent.Comp.Target = null; } diff --git a/Content.Server/MassMedia/Systems/NewsSystem.cs b/Content.Server/MassMedia/Systems/NewsSystem.cs index 2b18b57ff8..0fb5d42394 100644 --- a/Content.Server/MassMedia/Systems/NewsSystem.cs +++ b/Content.Server/MassMedia/Systems/NewsSystem.cs @@ -92,15 +92,12 @@ public sealed class NewsSystem : SharedNewsSystem if (msg.ArticleNum >= articles.Count) return; - if (msg.Session.AttachedEntity is not { } actor) - return; - var article = articles[msg.ArticleNum]; - if (CheckDeleteAccess(article, ent, actor)) + if (CheckDeleteAccess(article, ent, msg.Actor)) { _adminLogger.Add( LogType.Chat, LogImpact.Medium, - $"{ToPrettyString(actor):actor} deleted news article {article.Title} by {article.Author}: {article.Content}" + $"{ToPrettyString(msg.Actor):actor} deleted news article {article.Title} by {article.Author}: {article.Content}" ); articles.RemoveAt(msg.ArticleNum); @@ -138,14 +135,11 @@ public sealed class NewsSystem : SharedNewsSystem if (!TryGetArticles(ent, out var articles)) return; - if (msg.Session.AttachedEntity is not { } author) - return; - - if (!_accessReader.FindStationRecordKeys(author, out _)) + if (!_accessReader.FindStationRecordKeys(msg.Actor, out _)) return; string? authorName = null; - if (_idCardSystem.TryFindIdCard(author, out var idCard)) + if (_idCardSystem.TryFindIdCard(msg.Actor, out var idCard)) authorName = idCard.Comp.FullName; var title = msg.Title.Trim(); @@ -164,7 +158,7 @@ public sealed class NewsSystem : SharedNewsSystem _adminLogger.Add( LogType.Chat, LogImpact.Medium, - $"{ToPrettyString(author):actor} created news article {article.Title} by {article.Author}: {article.Content}" + $"{ToPrettyString(msg.Actor):actor} created news article {article.Title} by {article.Author}: {article.Content}" ); articles.Add(article); @@ -248,14 +242,14 @@ public sealed class NewsSystem : SharedNewsSystem private void UpdateWriterUi(Entity ent) { - if (!_ui.TryGetUi(ent, NewsWriterUiKey.Key, out var ui)) + if (!_ui.HasUi(ent, NewsWriterUiKey.Key)) return; if (!TryGetArticles(ent, out var articles)) return; var state = new NewsWriterBoundUserInterfaceState(articles.ToArray(), ent.Comp.PublishEnabled, ent.Comp.NextPublish); - _ui.SetUiState(ui, state); + _ui.SetUiState(ent.Owner, NewsWriterUiKey.Key, state); } private void UpdateReaderUi(Entity ent, EntityUid loaderUid) diff --git a/Content.Server/Mech/Systems/MechSystem.cs b/Content.Server/Mech/Systems/MechSystem.cs index 9e546dc33f..53c6c62cdb 100644 --- a/Content.Server/Mech/Systems/MechSystem.cs +++ b/Content.Server/Mech/Systems/MechSystem.cs @@ -303,15 +303,14 @@ public sealed partial class MechSystem : SharedMechSystem { EquipmentStates = ev.States }; - var ui = _ui.GetUi(uid, MechUiKey.Key); - _ui.SetUiState(ui, state); + _ui.SetUiState(uid, MechUiKey.Key, state); } public override void BreakMech(EntityUid uid, MechComponent? component = null) { base.BreakMech(uid, component); - _ui.TryCloseAll(uid, MechUiKey.Key); + _ui.CloseUi(uid, MechUiKey.Key); _actionBlocker.UpdateCanMove(uid); } diff --git a/Content.Server/Medical/CrewMonitoring/CrewMonitoringConsoleSystem.cs b/Content.Server/Medical/CrewMonitoring/CrewMonitoringConsoleSystem.cs index ff02b9cbdf..a53df6dbae 100644 --- a/Content.Server/Medical/CrewMonitoring/CrewMonitoringConsoleSystem.cs +++ b/Content.Server/Medical/CrewMonitoring/CrewMonitoringConsoleSystem.cs @@ -58,7 +58,7 @@ public sealed class CrewMonitoringConsoleSystem : EntitySystem if (!Resolve(uid, ref component)) return; - if (!_uiSystem.TryGetUi(uid, CrewMonitoringUIKey.Key, out var bui)) + if (!_uiSystem.IsUiOpen(uid, CrewMonitoringUIKey.Key)) return; // The grid must have a NavMapComponent to visualize the map in the UI @@ -69,6 +69,6 @@ public sealed class CrewMonitoringConsoleSystem : EntitySystem // Update all sensors info var allSensors = component.ConnectedSensors.Values.ToList(); - _uiSystem.SetUiState(bui, new CrewMonitoringState(allSensors)); + _uiSystem.SetUiState(uid, CrewMonitoringUIKey.Key, new CrewMonitoringState(allSensors)); } } diff --git a/Content.Server/Medical/CryoPodSystem.cs b/Content.Server/Medical/CryoPodSystem.cs index 02e8cebbe0..71921f44fd 100644 --- a/Content.Server/Medical/CryoPodSystem.cs +++ b/Content.Server/Medical/CryoPodSystem.cs @@ -193,7 +193,8 @@ public sealed partial class CryoPodSystem : SharedCryoPodSystem healthAnalyzer.ScannedEntity = entity.Comp.BodyContainer.ContainedEntity; } - _userInterfaceSystem.TrySendUiMessage( + // TODO: This should be a state my dude + _userInterfaceSystem.ServerSendUiMessage( entity.Owner, HealthAnalyzerUiKey.Key, new HealthAnalyzerScannedUserMessage(GetNetEntity(entity.Comp.BodyContainer.ContainedEntity), @@ -246,7 +247,7 @@ public sealed partial class CryoPodSystem : SharedCryoPodSystem else { RemComp(entity); - _uiSystem.TryCloseAll(entity.Owner, HealthAnalyzerUiKey.Key); + _uiSystem.CloseUi(entity.Owner, HealthAnalyzerUiKey.Key); } UpdateAppearance(entity.Owner, entity.Comp); } @@ -297,7 +298,7 @@ public sealed partial class CryoPodSystem : SharedCryoPodSystem } // if body is ejected - no need to display health-analyzer - _uiSystem.TryCloseAll(cryoPod.Owner, HealthAnalyzerUiKey.Key); + _uiSystem.CloseUi(cryoPod.Owner, HealthAnalyzerUiKey.Key); } #endregion diff --git a/Content.Server/Medical/HealthAnalyzerSystem.cs b/Content.Server/Medical/HealthAnalyzerSystem.cs index 4988608327..7282ea197c 100644 --- a/Content.Server/Medical/HealthAnalyzerSystem.cs +++ b/Content.Server/Medical/HealthAnalyzerSystem.cs @@ -128,10 +128,10 @@ public sealed class HealthAnalyzerSystem : EntitySystem private void OpenUserInterface(EntityUid user, EntityUid analyzer) { - if (!TryComp(user, out var actor) || !_uiSystem.TryGetUi(analyzer, HealthAnalyzerUiKey.Key, out var ui)) + if (!_uiSystem.HasUi(analyzer, HealthAnalyzerUiKey.Key)) return; - _uiSystem.OpenUi(ui, actor.PlayerSession); + _uiSystem.OpenUi(analyzer, HealthAnalyzerUiKey.Key, user); } /// @@ -172,7 +172,7 @@ public sealed class HealthAnalyzerSystem : EntitySystem /// True makes the UI show ACTIVE, False makes the UI show INACTIVE public void UpdateScannedUser(EntityUid healthAnalyzer, EntityUid target, bool scanMode) { - if (!_uiSystem.TryGetUi(healthAnalyzer, HealthAnalyzerUiKey.Key, out var ui)) + if (!_uiSystem.HasUi(healthAnalyzer, HealthAnalyzerUiKey.Key)) return; if (!HasComp(target)) @@ -194,9 +194,7 @@ public sealed class HealthAnalyzerSystem : EntitySystem bleeding = bloodstream.BleedAmount > 0; } - - - _uiSystem.SendUiMessage(ui, new HealthAnalyzerScannedUserMessage( + _uiSystem.ServerSendUiMessage(healthAnalyzer, HealthAnalyzerUiKey.Key, new HealthAnalyzerScannedUserMessage( GetNetEntity(target), bodyTemperature, bloodAmount, diff --git a/Content.Server/Nuke/NukeSystem.cs b/Content.Server/Nuke/NukeSystem.cs index c996f05ec4..b72be0b46c 100644 --- a/Content.Server/Nuke/NukeSystem.cs +++ b/Content.Server/Nuke/NukeSystem.cs @@ -187,7 +187,7 @@ public sealed class NukeSystem : EntitySystem continue; var msg = Loc.GetString("nuke-component-cant-anchor-floor"); - _popups.PopupEntity(msg, uid, args.Session, PopupType.MediumCaution); + _popups.PopupEntity(msg, uid, args.Actor, PopupType.MediumCaution); return; } @@ -243,10 +243,7 @@ public sealed class NukeSystem : EntitySystem else { - if (args.Session.AttachedEntity is not { } user) - return; - - DisarmBombDoafter(uid, user, component); + DisarmBombDoafter(uid, args.Actor, component); } } @@ -366,8 +363,7 @@ public sealed class NukeSystem : EntitySystem if (!Resolve(uid, ref component)) return; - var ui = _ui.GetUiOrNull(uid, NukeUiKey.Key); - if (ui == null) + if (!_ui.HasUi(uid, NukeUiKey.Key)) return; var anchored = Transform(uid).Anchored; @@ -388,7 +384,7 @@ public sealed class NukeSystem : EntitySystem CooldownTime = (int) component.CooldownTime }; - _ui.SetUiState(ui, state); + _ui.SetUiState(uid, NukeUiKey.Key, state); } private void PlayNukeKeypadSound(EntityUid uid, int number, NukeComponent? component = null) diff --git a/Content.Server/NukeOps/WarDeclaratorSystem.cs b/Content.Server/NukeOps/WarDeclaratorSystem.cs index bcc0b9c0ea..a2d74e16b3 100644 --- a/Content.Server/NukeOps/WarDeclaratorSystem.cs +++ b/Content.Server/NukeOps/WarDeclaratorSystem.cs @@ -55,9 +55,6 @@ public sealed class WarDeclaratorSystem : EntitySystem private void OnActivated(Entity ent, ref WarDeclaratorActivateMessage args) { - if (args.Session.AttachedEntity is not {} playerEntity) - return; - var ev = new WarDeclaredEvent(ent.Comp.CurrentStatus, ent); RaiseLocalEvent(ref ev); @@ -75,7 +72,7 @@ public sealed class WarDeclaratorSystem : EntitySystem { var title = Loc.GetString(ent.Comp.SenderTitle); _chat.DispatchGlobalAnnouncement(ent.Comp.Message, title, true, ent.Comp.Sound, ent.Comp.Color); - _adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(playerEntity):player} has declared war with this text: {ent.Comp.Message}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(args.Actor):player} has declared war with this text: {ent.Comp.Message}"); } UpdateUI(ent, ev.Status); @@ -83,8 +80,8 @@ public sealed class WarDeclaratorSystem : EntitySystem private void UpdateUI(Entity ent, WarConditionStatus? status = null) { - _userInterfaceSystem.TrySetUiState( - ent, + _userInterfaceSystem.SetUiState( + ent.Owner, WarDeclaratorUiKey.Key, new WarDeclaratorBoundUserInterfaceState(status, ent.Comp.DisableAt, ent.Comp.ShuttleDisabledTime)); } diff --git a/Content.Server/PAI/PAISystem.cs b/Content.Server/PAI/PAISystem.cs index e9505b5e6f..091afb1557 100644 --- a/Content.Server/PAI/PAISystem.cs +++ b/Content.Server/PAI/PAISystem.cs @@ -102,13 +102,15 @@ public sealed class PAISystem : SharedPAISystem { // Close the instrument interface if it was open // before closing - if (HasComp(uid) && TryComp(uid, out var actor)) + if (HasComp(uid)) { - _instrumentSystem.ToggleInstrumentUi(uid, actor.PlayerSession); + _instrumentSystem.ToggleInstrumentUi(uid, uid); } // Stop instrument - if (TryComp(uid, out var instrument)) _instrumentSystem.Clean(uid, instrument); + if (TryComp(uid, out var instrument)) + _instrumentSystem.Clean(uid, instrument); + if (TryComp(uid, out var metadata)) { var proto = metadata.EntityPrototype; diff --git a/Content.Server/PDA/PdaSystem.cs b/Content.Server/PDA/PdaSystem.cs index a343607196..0b86fe29ed 100644 --- a/Content.Server/PDA/PdaSystem.cs +++ b/Content.Server/PDA/PdaSystem.cs @@ -41,6 +41,7 @@ namespace Content.Server.PDA SubscribeLocalEvent(OnLightToggle); // UI Events: + SubscribeLocalEvent(OnPdaOpen); SubscribeLocalEvent(OnUiMessage); SubscribeLocalEvent(OnUiMessage); SubscribeLocalEvent(OnUiMessage); @@ -145,7 +146,7 @@ namespace Content.Server.PDA if (!Resolve(uid, ref pda, false)) return; - if (!_ui.TryGetUi(uid, PdaUiKey.Key, out var ui)) + if (!_ui.HasUi(uid, PdaUiKey.Key)) return; var address = GetDeviceNetAddress(uid); @@ -182,7 +183,15 @@ namespace Content.Server.PDA hasInstrument, address); - _ui.SetUiState(ui, state); + _ui.SetUiState(uid, PdaUiKey.Key, state); + } + + private void OnPdaOpen(Entity ent, ref BoundUIOpenedEvent args) + { + if (!PdaUiKey.Key.Equals(args.UiKey)) + return; + + UpdatePdaUi(ent.Owner, ent.Comp); } private void OnUiMessage(EntityUid uid, PdaComponent pda, PdaRequestUpdateInterfaceMessage msg) @@ -208,7 +217,7 @@ namespace Content.Server.PDA return; if (HasComp(uid)) - _ringer.ToggleRingerUI(uid, msg.Session); + _ringer.ToggleRingerUI(uid, msg.Actor); } private void OnUiMessage(EntityUid uid, PdaComponent pda, PdaShowMusicMessage msg) @@ -217,7 +226,7 @@ namespace Content.Server.PDA return; if (TryComp(uid, out var instrument)) - _instrument.ToggleInstrumentUi(uid, msg.Session, instrument); + _instrument.ToggleInstrumentUi(uid, msg.Actor, instrument); } private void OnUiMessage(EntityUid uid, PdaComponent pda, PdaShowUplinkMessage msg) @@ -227,7 +236,7 @@ namespace Content.Server.PDA // check if its locked again to prevent malicious clients opening locked uplinks if (TryComp(uid, out var store) && IsUnlocked(uid)) - _store.ToggleUi(msg.Session.AttachedEntity!.Value, uid, store); + _store.ToggleUi(msg.Actor, uid, store); } private void OnUiMessage(EntityUid uid, PdaComponent pda, PdaLockUplinkMessage msg) diff --git a/Content.Server/PDA/Ringer/RingerSystem.cs b/Content.Server/PDA/Ringer/RingerSystem.cs index f95725873a..a10544d696 100644 --- a/Content.Server/PDA/Ringer/RingerSystem.cs +++ b/Content.Server/PDA/Ringer/RingerSystem.cs @@ -81,7 +81,10 @@ namespace Content.Server.PDA.Ringer private void OnSetRingtone(EntityUid uid, RingerComponent ringer, RingerSetRingtoneMessage args) { - ref var lastSetAt = ref CollectionsMarshal.GetValueRefOrAddDefault(_lastSetRingtoneAt, args.Session.UserId, out var exists); + if (!TryComp(args.Actor, out ActorComponent? actorComp)) + return; + + ref var lastSetAt = ref CollectionsMarshal.GetValueRefOrAddDefault(_lastSetRingtoneAt, actorComp.PlayerSession.UserId, out var exists); // Delay on the client is 0.333, 0.25 is still enough and gives some leeway in case of small time differences if (exists && lastSetAt > _gameTiming.CurTime - TimeSpan.FromMilliseconds(250)) @@ -111,7 +114,7 @@ namespace Content.Server.PDA.Ringer // can't keep store open after locking it if (!uplink.Unlocked) - _ui.TryCloseAll(uid, StoreUiKey.Key); + _ui.CloseUi(uid, StoreUiKey.Key); // no saving the code to prevent meta click set on sus guys pda -> wewlad args.Handled = true; @@ -130,7 +133,7 @@ namespace Content.Server.PDA.Ringer return; uplink.Unlocked = false; - _ui.TryCloseAll(uid, StoreUiKey.Key); + _ui.CloseUi(uid, StoreUiKey.Key); } public void RandomizeRingtone(EntityUid uid, RingerComponent ringer, MapInitEvent args) @@ -181,14 +184,12 @@ namespace Content.Server.PDA.Ringer private void UpdateRingerUserInterface(EntityUid uid, RingerComponent ringer, bool isPlaying) { - if (_ui.TryGetUi(uid, RingerUiKey.Key, out var bui)) - _ui.SetUiState(bui, new RingerUpdateState(isPlaying, ringer.Ringtone)); + _ui.SetUiState(uid, RingerUiKey.Key, new RingerUpdateState(isPlaying, ringer.Ringtone)); } - public bool ToggleRingerUI(EntityUid uid, ICommonSession session) + public bool ToggleRingerUI(EntityUid uid, EntityUid actor) { - if (_ui.TryGetUi(uid, RingerUiKey.Key, out var bui)) - _ui.ToggleUi(bui, session); + _ui.TryToggleUi(uid, RingerUiKey.Key, actor); return true; } diff --git a/Content.Server/Paper/PaperComponent.cs b/Content.Server/Paper/PaperComponent.cs index 3cf011e34d..6c379eea2b 100644 --- a/Content.Server/Paper/PaperComponent.cs +++ b/Content.Server/Paper/PaperComponent.cs @@ -3,7 +3,7 @@ using Robust.Shared.GameStates; namespace Content.Server.Paper; -[NetworkedComponent, RegisterComponent] +[RegisterComponent] public sealed partial class PaperComponent : SharedPaperComponent { public PaperAction Mode; diff --git a/Content.Server/Paper/PaperSystem.cs b/Content.Server/Paper/PaperSystem.cs index c582b82e2c..d10d04cfb9 100644 --- a/Content.Server/Paper/PaperSystem.cs +++ b/Content.Server/Paper/PaperSystem.cs @@ -67,11 +67,7 @@ namespace Content.Server.Paper private void BeforeUIOpen(EntityUid uid, PaperComponent paperComp, BeforeActivatableUIOpenEvent args) { paperComp.Mode = PaperAction.Read; - - if (!TryComp(args.User, out var actor)) - return; - - UpdateUserInterface(uid, paperComp, actor.PlayerSession); + UpdateUserInterface(uid, paperComp); } private void OnExamined(EntityUid uid, PaperComponent paperComp, ExaminedEvent args) @@ -108,12 +104,10 @@ namespace Content.Server.Paper { var writeEvent = new PaperWriteEvent(uid, args.User); RaiseLocalEvent(args.Used, ref writeEvent); - if (!TryComp(args.User, out var actor)) - return; paperComp.Mode = PaperAction.Write; - _uiSystem.TryOpen(uid, PaperUiKey.Key, actor.PlayerSession); - UpdateUserInterface(uid, paperComp, actor.PlayerSession); + _uiSystem.OpenUi(uid, PaperUiKey.Key, args.User); + UpdateUserInterface(uid, paperComp); args.Handled = true; return; } @@ -157,9 +151,8 @@ namespace Content.Server.Paper if (TryComp(uid, out var meta)) _metaSystem.SetEntityDescription(uid, "", meta); - if (args.Session.AttachedEntity != null) - _adminLogger.Add(LogType.Chat, LogImpact.Low, - $"{ToPrettyString(args.Session.AttachedEntity.Value):player} has written on {ToPrettyString(uid):entity} the following text: {args.Text}"); + _adminLogger.Add(LogType.Chat, LogImpact.Low, + $"{ToPrettyString(args.Actor):player} has written on {ToPrettyString(uid):entity} the following text: {args.Text}"); _audio.PlayPvs(paperComp.Sound, uid); } @@ -213,13 +206,12 @@ namespace Content.Server.Paper _appearance.SetData(uid, PaperVisuals.Status, status, appearance); } - public void UpdateUserInterface(EntityUid uid, PaperComponent? paperComp = null, ICommonSession? session = null) + public void UpdateUserInterface(EntityUid uid, PaperComponent? paperComp = null) { if (!Resolve(uid, ref paperComp)) return; - if (_uiSystem.TryGetUi(uid, PaperUiKey.Key, out var bui)) - _uiSystem.SetUiState(bui, new PaperBoundUserInterfaceState(paperComp.Content, paperComp.StampedBy, paperComp.Mode), session); + _uiSystem.SetUiState(uid, PaperUiKey.Key, new PaperBoundUserInterfaceState(paperComp.Content, paperComp.StampedBy, paperComp.Mode)); } } diff --git a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.ControlBox.cs b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.ControlBox.cs index 5d373652a9..f3cff9f2e7 100644 --- a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.ControlBox.cs +++ b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.ControlBox.cs @@ -67,7 +67,7 @@ public sealed partial class ParticleAcceleratorSystem FireEmitter(comp.StarboardEmitter!.Value, strength); } - public void SwitchOn(EntityUid uid, ICommonSession? user = null, ParticleAcceleratorControlBoxComponent? comp = null) + public void SwitchOn(EntityUid uid, EntityUid? user = null, ParticleAcceleratorControlBoxComponent? comp = null) { if (!Resolve(uid, ref comp)) return; @@ -77,7 +77,7 @@ public sealed partial class ParticleAcceleratorSystem if (comp.Enabled || !comp.CanBeEnabled) return; - if (user?.AttachedEntity is { } player) + if (user is { } player) _adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(player):player} has turned {ToPrettyString(uid)} on"); comp.Enabled = true; @@ -90,14 +90,14 @@ public sealed partial class ParticleAcceleratorSystem UpdateUI(uid, comp); } - public void SwitchOff(EntityUid uid, ICommonSession? user = null, ParticleAcceleratorControlBoxComponent? comp = null) + public void SwitchOff(EntityUid uid, EntityUid? user = null, ParticleAcceleratorControlBoxComponent? comp = null) { if (!Resolve(uid, ref comp)) return; if (!comp.Enabled) return; - if (user?.AttachedEntity is { } player) + if (user is { } player) _adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(player):player} has turned {ToPrettyString(uid)} off"); comp.Enabled = false; @@ -138,7 +138,7 @@ public sealed partial class ParticleAcceleratorSystem UpdateUI(uid, comp); } - public void SetStrength(EntityUid uid, ParticleAcceleratorPowerState strength, ICommonSession? user = null, ParticleAcceleratorControlBoxComponent? comp = null) + public void SetStrength(EntityUid uid, ParticleAcceleratorPowerState strength, EntityUid? user = null, ParticleAcceleratorControlBoxComponent? comp = null) { if (!Resolve(uid, ref comp)) return; @@ -154,7 +154,7 @@ public sealed partial class ParticleAcceleratorSystem if (strength == comp.SelectedStrength) return; - if (user?.AttachedEntity is { } player) + if (user is { } player) { var impact = strength switch { @@ -235,7 +235,8 @@ public sealed partial class ParticleAcceleratorSystem { if (!Resolve(uid, ref comp)) return; - if (!_uiSystem.TryGetUi(uid, ParticleAcceleratorControlBoxUiKey.Key, out var bui)) + + if (!_uiSystem.HasUi(uid, ParticleAcceleratorControlBoxUiKey.Key)) return; var draw = 0f; @@ -247,7 +248,7 @@ public sealed partial class ParticleAcceleratorSystem receive = powerConsumer.ReceivedPower; } - _uiSystem.SetUiState(bui, new ParticleAcceleratorUIState( + _uiSystem.SetUiState(uid, ParticleAcceleratorControlBoxUiKey.Key, new ParticleAcceleratorUIState( comp.Assembled, comp.Enabled, comp.SelectedStrength, @@ -346,7 +347,7 @@ public sealed partial class ParticleAcceleratorSystem UpdateAppearance(uid, comp); if (!args.Powered) - _uiSystem.TryCloseAll(uid, ParticleAcceleratorControlBoxUiKey.Key); + _uiSystem.CloseUi(uid, ParticleAcceleratorControlBoxUiKey.Key); } private void OnUISetEnableMessage(EntityUid uid, ParticleAcceleratorControlBoxComponent comp, ParticleAcceleratorSetEnableMessage msg) @@ -361,10 +362,10 @@ public sealed partial class ParticleAcceleratorSystem if (msg.Enabled) { if (comp.Assembled) - SwitchOn(uid, msg.Session, comp); + SwitchOn(uid, msg.Actor, comp); } else - SwitchOff(uid, msg.Session, comp); + SwitchOff(uid, msg.Actor, comp); UpdateUI(uid, comp); } @@ -378,7 +379,7 @@ public sealed partial class ParticleAcceleratorSystem if (TryComp(uid, out var apcPower) && !apcPower.Powered) return; - SetStrength(uid, msg.State, msg.Session, comp); + SetStrength(uid, msg.State, msg.Actor, comp); UpdateUI(uid, comp); } @@ -392,7 +393,7 @@ public sealed partial class ParticleAcceleratorSystem if (TryComp(uid, out var apcPower) && !apcPower.Powered) return; - RescanParts(uid, msg.Session, comp); + RescanParts(uid, msg.Actor, comp); UpdateUI(uid, comp); } diff --git a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs index bdbc7b3f5b..99bb0d5cbd 100644 --- a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs +++ b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.Parts.cs @@ -18,7 +18,7 @@ public sealed partial class ParticleAcceleratorSystem SubscribeLocalEvent(BodyTypeChanged); } - public void RescanParts(EntityUid uid, ICommonSession? user = null, ParticleAcceleratorControlBoxComponent? controller = null) + public void RescanParts(EntityUid uid, EntityUid? user = null, ParticleAcceleratorControlBoxComponent? controller = null) { if (!Resolve(uid, ref controller)) return; diff --git a/Content.Server/ParticleAccelerator/Wires/ParticleAcceleratorLimiterWireAction.cs b/Content.Server/ParticleAccelerator/Wires/ParticleAcceleratorLimiterWireAction.cs index 0cbd47c233..0645944a2a 100644 --- a/Content.Server/ParticleAccelerator/Wires/ParticleAcceleratorLimiterWireAction.cs +++ b/Content.Server/ParticleAccelerator/Wires/ParticleAcceleratorLimiterWireAction.cs @@ -48,8 +48,7 @@ public sealed partial class ParticleAcceleratorLimiterWireAction : ComponentWire // Yes, it's a feature that mending this wire WON'T WORK if the strength wire is also cut. // Since that blocks SetStrength(). var paSystem = EntityManager.System(); - var userSession = EntityManager.TryGetComponent(user, out var actor) ? actor.PlayerSession : null; - paSystem.SetStrength(wire.Owner, controller.MaxStrength, userSession, controller); + paSystem.SetStrength(wire.Owner, controller.MaxStrength, user, controller); return true; } diff --git a/Content.Server/ParticleAccelerator/Wires/ParticleAcceleratorStrengthWireAction.cs b/Content.Server/ParticleAccelerator/Wires/ParticleAcceleratorStrengthWireAction.cs index 65fa76ee41..1650960bd3 100644 --- a/Content.Server/ParticleAccelerator/Wires/ParticleAcceleratorStrengthWireAction.cs +++ b/Content.Server/ParticleAccelerator/Wires/ParticleAcceleratorStrengthWireAction.cs @@ -33,7 +33,6 @@ public sealed partial class ParticleAcceleratorStrengthWireAction : ComponentWir public override void Pulse(EntityUid user, Wire wire, ParticleAcceleratorControlBoxComponent controller) { var paSystem = EntityManager.System(); - var userSession = EntityManager.TryGetComponent(user, out var actor) ? actor.PlayerSession : null; - paSystem.SetStrength(wire.Owner, (ParticleAcceleratorPowerState) ((int) controller.SelectedStrength + 1), userSession, controller); + paSystem.SetStrength(wire.Owner, (ParticleAcceleratorPowerState) ((int) controller.SelectedStrength + 1), user, controller); } } diff --git a/Content.Server/ParticleAccelerator/Wires/ParticleAcceleratorToggleWireAction.cs b/Content.Server/ParticleAccelerator/Wires/ParticleAcceleratorToggleWireAction.cs index c43403edd4..40a15d2bc5 100644 --- a/Content.Server/ParticleAccelerator/Wires/ParticleAcceleratorToggleWireAction.cs +++ b/Content.Server/ParticleAccelerator/Wires/ParticleAcceleratorToggleWireAction.cs @@ -23,10 +23,9 @@ public sealed partial class ParticleAcceleratorPowerWireAction : ComponentWireAc public override bool Cut(EntityUid user, Wire wire, ParticleAcceleratorControlBoxComponent controller) { var paSystem = EntityManager.System(); - var userSession = EntityManager.TryGetComponent(user, out var actor) ? actor.PlayerSession : null; controller.CanBeEnabled = false; - paSystem.SwitchOff(wire.Owner, userSession, controller); + paSystem.SwitchOff(wire.Owner, user, controller); return true; } @@ -39,11 +38,10 @@ public sealed partial class ParticleAcceleratorPowerWireAction : ComponentWireAc public override void Pulse(EntityUid user, Wire wire, ParticleAcceleratorControlBoxComponent controller) { var paSystem = EntityManager.System(); - var userSession = EntityManager.TryGetComponent(user, out var actor) ? actor.PlayerSession : null; if (controller.Enabled) - paSystem.SwitchOff(wire.Owner, userSession, controller); + paSystem.SwitchOff(wire.Owner, user, controller); else if (controller.Assembled) - paSystem.SwitchOn(wire.Owner, userSession, controller); + paSystem.SwitchOn(wire.Owner, user, controller); } } diff --git a/Content.Server/Pinpointer/NavMapSystem.cs b/Content.Server/Pinpointer/NavMapSystem.cs index 34c76a1320..0aa6ab1908 100644 --- a/Content.Server/Pinpointer/NavMapSystem.cs +++ b/Content.Server/Pinpointer/NavMapSystem.cs @@ -155,9 +155,6 @@ public sealed partial class NavMapSystem : SharedNavMapSystem private void OnConfigureMessage(Entity ent, ref NavMapBeaconConfigureBuiMessage args) { - if (args.Session.AttachedEntity is not { } user) - return; - if (!TryComp(ent, out var beacon)) return; @@ -167,7 +164,7 @@ public sealed partial class NavMapSystem : SharedNavMapSystem return; _adminLog.Add(LogType.Action, LogImpact.Medium, - $"{ToPrettyString(user):player} configured NavMapBeacon \'{ToPrettyString(ent):entity}\' with text \'{args.Text}\', color {args.Color.ToHexNoAlpha()}, and {(args.Enabled ? "enabled" : "disabled")} it."); + $"{ToPrettyString(args.Actor):player} configured NavMapBeacon \'{ToPrettyString(ent):entity}\' with text \'{args.Text}\', color {args.Color.ToHexNoAlpha()}, and {(args.Enabled ? "enabled" : "disabled")} it."); if (TryComp(ent, out var warpPoint)) { diff --git a/Content.Server/Pinpointer/StationMapSystem.cs b/Content.Server/Pinpointer/StationMapSystem.cs index c9db560fef..b0b3141fb0 100644 --- a/Content.Server/Pinpointer/StationMapSystem.cs +++ b/Content.Server/Pinpointer/StationMapSystem.cs @@ -24,29 +24,23 @@ public sealed class StationMapSystem : EntitySystem private void OnStationMapClosed(EntityUid uid, StationMapComponent component, BoundUIClosedEvent args) { - if (!Equals(args.UiKey, StationMapUiKey.Key) || args.Session.AttachedEntity == null) + if (!Equals(args.UiKey, StationMapUiKey.Key)) return; - RemCompDeferred(args.Session.AttachedEntity.Value); + RemCompDeferred(args.Actor); } private void OnUserParentChanged(EntityUid uid, StationMapUserComponent component, ref EntParentChangedMessage args) { - if (TryComp(uid, out var actor)) - { - _ui.TryClose(component.Map, StationMapUiKey.Key, actor.PlayerSession); - } + _ui.CloseUi(component.Map, StationMapUiKey.Key, uid); } private void OnStationMapOpened(EntityUid uid, StationMapComponent component, BoundUIOpenedEvent args) { - if (args.Session.AttachedEntity == null) - return; - if (!_cell.TryUseActivatableCharge(uid)) return; - var comp = EnsureComp(args.Session.AttachedEntity.Value); + var comp = EnsureComp(args.Actor); comp.Map = uid; } } diff --git a/Content.Server/Power/Components/ActivatableUIRequiresPowerComponent.cs b/Content.Server/Power/Components/ActivatableUIRequiresPowerComponent.cs deleted file mode 100644 index c387457adb..0000000000 --- a/Content.Server/Power/Components/ActivatableUIRequiresPowerComponent.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Content.Server.Power.Components -{ - [RegisterComponent] - public sealed partial class ActivatableUIRequiresPowerComponent : Component - { - } -} - diff --git a/Content.Server/Power/EntitySystems/ActivatableUIRequiresPowerSystem.cs b/Content.Server/Power/EntitySystems/ActivatableUIRequiresPowerSystem.cs index 561b0e71f0..72843a65b8 100644 --- a/Content.Server/Power/EntitySystems/ActivatableUIRequiresPowerSystem.cs +++ b/Content.Server/Power/EntitySystems/ActivatableUIRequiresPowerSystem.cs @@ -4,11 +4,12 @@ using Content.Shared.UserInterface; using JetBrains.Annotations; using Content.Shared.Wires; using Content.Server.UserInterface; +using Content.Shared.Power.Components; +using ActivatableUISystem = Content.Shared.UserInterface.ActivatableUISystem; namespace Content.Server.Power.EntitySystems; -[UsedImplicitly] -internal sealed class ActivatableUIRequiresPowerSystem : EntitySystem +public sealed class ActivatableUIRequiresPowerSystem : EntitySystem { [Dependency] private readonly ActivatableUISystem _activatableUI = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; diff --git a/Content.Server/Power/EntitySystems/ApcSystem.cs b/Content.Server/Power/EntitySystems/ApcSystem.cs index 95b5d74a94..388f65ad2e 100644 --- a/Content.Server/Power/EntitySystems/ApcSystem.cs +++ b/Content.Server/Power/EntitySystems/ApcSystem.cs @@ -66,11 +66,8 @@ public sealed class ApcSystem : EntitySystem //Update the HasAccess var for UI to read private void OnBoundUiOpen(EntityUid uid, ApcComponent component, BoundUIOpenedEvent args) { - if (args.Session.AttachedEntity == null) - return; - // TODO: this should be per-player not stored on the apc - component.HasAccess = _accessReader.IsAllowed(args.Session.AttachedEntity.Value, uid); + component.HasAccess = _accessReader.IsAllowed(args.Actor, uid); UpdateApcState(uid, component); } @@ -81,21 +78,18 @@ public sealed class ApcSystem : EntitySystem if (attemptEv.Cancelled) { _popup.PopupCursor(Loc.GetString("apc-component-on-toggle-cancel"), - args.Session, PopupType.Medium); + args.Actor, PopupType.Medium); return; } - if (args.Session.AttachedEntity == null) - return; - - if (_accessReader.IsAllowed(args.Session.AttachedEntity.Value, uid)) + if (_accessReader.IsAllowed(args.Actor, uid)) { ApcToggleBreaker(uid, component); } else { _popup.PopupCursor(Loc.GetString("apc-component-insufficient-access"), - args.Session, PopupType.Medium); + args.Actor, PopupType.Medium); } } @@ -158,7 +152,7 @@ public sealed class ApcSystem : EntitySystem (int) MathF.Ceiling(battery.CurrentSupply), apc.LastExternalState, battery.CurrentStorage / battery.Capacity); - _ui.TrySetUiState(uid, ApcUiKey.Key, state, ui: ui); + _ui.SetUiState((uid, ui), ApcUiKey.Key, state); } private ApcChargeState CalcChargeState(EntityUid uid, PowerState.Battery battery) diff --git a/Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs b/Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs index 0e20f007d7..be1238fd2b 100644 --- a/Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs +++ b/Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs @@ -286,20 +286,17 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori var query = AllEntityQuery(); while (query.MoveNext(out var ent, out var console)) { - if (!_userInterfaceSystem.TryGetUi(ent, PowerMonitoringConsoleUiKey.Key, out var bui)) + if (!_userInterfaceSystem.IsUiOpen(ent, PowerMonitoringConsoleUiKey.Key)) continue; - foreach (var session in bui.SubscribedSessions) - UpdateUIState(ent, console, session); + UpdateUIState(ent, console); + } } } - public void UpdateUIState(EntityUid uid, PowerMonitoringConsoleComponent component, ICommonSession session) + private void UpdateUIState(EntityUid uid, PowerMonitoringConsoleComponent component) { - if (!_userInterfaceSystem.TryGetUi(uid, PowerMonitoringConsoleUiKey.Key, out var bui)) - return; - var consoleXform = Transform(uid); if (consoleXform?.GridUid == null) @@ -422,15 +419,15 @@ internal sealed partial class PowerMonitoringConsoleSystem : SharedPowerMonitori } // Set the UI state - _userInterfaceSystem.SetUiState(bui, + _userInterfaceSystem.SetUiState(uid, + PowerMonitoringConsoleUiKey.Key, new PowerMonitoringConsoleBoundInterfaceState (totalSources, totalBatteryUsage, totalLoads, allEntries.ToArray(), sourcesForFocus.ToArray(), - loadsForFocus.ToArray()), - session); + loadsForFocus.ToArray())); } private double GetPrimaryPowerValues(EntityUid uid, PowerMonitoringDeviceComponent device, out double powerSupplied, out double powerUsage, out double batteryUsage) diff --git a/Content.Server/Power/Generator/PortableGeneratorSystem.cs b/Content.Server/Power/Generator/PortableGeneratorSystem.cs index a95a3fd423..f7d259b122 100644 --- a/Content.Server/Power/Generator/PortableGeneratorSystem.cs +++ b/Content.Server/Power/Generator/PortableGeneratorSystem.cs @@ -48,30 +48,21 @@ public sealed class PortableGeneratorSystem : SharedPortableGeneratorSystem private void GeneratorSwitchOutputMessage(EntityUid uid, PortableGeneratorComponent component, PortableGeneratorSwitchOutputMessage args) { - if (args.Session.AttachedEntity == null) - return; - var fuelGenerator = Comp(uid); if (fuelGenerator.On) return; - _switchable.Cycle(uid, args.Session.AttachedEntity.Value); + _switchable.Cycle(uid, args.Actor); } private void GeneratorStopMessage(EntityUid uid, PortableGeneratorComponent component, PortableGeneratorStopMessage args) { - if (args.Session.AttachedEntity == null) - return; - - StopGenerator(uid, component, args.Session.AttachedEntity.Value); + StopGenerator(uid, component, args.Actor); } private void GeneratorStartMessage(EntityUid uid, PortableGeneratorComponent component, PortableGeneratorStartMessage args) { - if (args.Session.AttachedEntity == null) - return; - - StartGenerator(uid, component, args.Session.AttachedEntity.Value); + StartGenerator(uid, component, args.Actor); } private void StartGenerator(EntityUid uid, PortableGeneratorComponent component, EntityUid user) @@ -234,7 +225,7 @@ public sealed class PortableGeneratorSystem : SharedPortableGeneratorSystem if (powerSupplier.Net is { IsConnectedNetwork: true } net) networkStats = (net.NetworkNode.LastCombinedLoad, net.NetworkNode.LastCombinedSupply); - _uiSystem.TrySetUiState( + _uiSystem.SetUiState( uid, GeneratorComponentUiKey.Key, new PortableGeneratorComponentBuiState(fuelComp, fuel, clogged, networkStats)); diff --git a/Content.Server/PowerCell/PowerCellSystem.cs b/Content.Server/PowerCell/PowerCellSystem.cs index d4c1faa4c9..f45a01b2e1 100644 --- a/Content.Server/PowerCell/PowerCellSystem.cs +++ b/Content.Server/PowerCell/PowerCellSystem.cs @@ -11,6 +11,7 @@ using Content.Server.Power.EntitySystems; using Content.Server.UserInterface; using Content.Shared.Containers.ItemSlots; using Content.Shared.Popups; +using ActivatableUISystem = Content.Shared.UserInterface.ActivatableUISystem; namespace Content.Server.PowerCell; diff --git a/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs b/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs index d115ec991a..56c5d8e548 100644 --- a/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs +++ b/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs @@ -221,25 +221,25 @@ public sealed class RadioDeviceSystem : EntitySystem private void OnToggleIntercomMic(EntityUid uid, IntercomComponent component, ToggleIntercomMicMessage args) { - if (component.RequiresPower && !this.IsPowered(uid, EntityManager) || args.Session.AttachedEntity is not { } user) + if (component.RequiresPower && !this.IsPowered(uid, EntityManager)) return; - SetMicrophoneEnabled(uid, user, args.Enabled, true); + SetMicrophoneEnabled(uid, args.Actor, args.Enabled, true); UpdateIntercomUi(uid, component); } private void OnToggleIntercomSpeaker(EntityUid uid, IntercomComponent component, ToggleIntercomSpeakerMessage args) { - if (component.RequiresPower && !this.IsPowered(uid, EntityManager) || args.Session.AttachedEntity is not { } user) + if (component.RequiresPower && !this.IsPowered(uid, EntityManager)) return; - SetSpeakerEnabled(uid, user, args.Enabled, true); + SetSpeakerEnabled(uid, args.Actor, args.Enabled, true); UpdateIntercomUi(uid, component); } private void OnSelectIntercomChannel(EntityUid uid, IntercomComponent component, SelectIntercomChannelMessage args) { - if (component.RequiresPower && !this.IsPowered(uid, EntityManager) || args.Session.AttachedEntity is not { }) + if (component.RequiresPower && !this.IsPowered(uid, EntityManager)) return; if (!_protoMan.TryIndex(args.Channel, out _) || !component.SupportedChannels.Contains(args.Channel)) @@ -262,6 +262,6 @@ public sealed class RadioDeviceSystem : EntitySystem var availableChannels = component.SupportedChannels; var selectedChannel = micComp?.BroadcastChannel ?? SharedChatSystem.CommonChannel; var state = new IntercomBoundUIState(micEnabled, speakerEnabled, availableChannels, selectedChannel); - _ui.TrySetUiState(uid, IntercomUiKey.Key, state); + _ui.SetUiState(uid, IntercomUiKey.Key, state); } } diff --git a/Content.Server/Research/Systems/ResearchSystem.Client.cs b/Content.Server/Research/Systems/ResearchSystem.Client.cs index 6bd5300d8f..f8fdba55b7 100644 --- a/Content.Server/Research/Systems/ResearchSystem.Client.cs +++ b/Content.Server/Research/Systems/ResearchSystem.Client.cs @@ -45,7 +45,7 @@ public sealed partial class ResearchSystem if (!this.IsPowered(uid, EntityManager)) return; - _uiSystem.TryToggleUi(uid, ResearchClientUiKey.Key, args.Session); + _uiSystem.TryToggleUi(uid, ResearchClientUiKey.Key, args.Actor); } #endregion @@ -88,7 +88,7 @@ public sealed partial class ResearchSystem var state = new ResearchClientBoundInterfaceState(names.Length, names, GetServerIds(), serverComponent?.Id ?? -1); - _uiSystem.TrySetUiState(uid, ResearchClientUiKey.Key, state); + _uiSystem.SetUiState(uid, ResearchClientUiKey.Key, state); } /// diff --git a/Content.Server/Research/Systems/ResearchSystem.Console.cs b/Content.Server/Research/Systems/ResearchSystem.Console.cs index 9f95fd2517..5358ddefcd 100644 --- a/Content.Server/Research/Systems/ResearchSystem.Console.cs +++ b/Content.Server/Research/Systems/ResearchSystem.Console.cs @@ -20,8 +20,7 @@ public sealed partial class ResearchSystem private void OnConsoleUnlock(EntityUid uid, ResearchConsoleComponent component, ConsoleUnlockTechnologyMessage args) { - if (args.Session.AttachedEntity is not { } ent) - return; + var act = args.Actor; if (!this.IsPowered(uid, EntityManager)) return; @@ -29,13 +28,13 @@ public sealed partial class ResearchSystem if (!PrototypeManager.TryIndex(args.Id, out var technologyPrototype)) return; - if (TryComp(uid, out var access) && !_accessReader.IsAllowed(ent, uid, access)) + if (TryComp(uid, out var access) && !_accessReader.IsAllowed(act, uid, access)) { - _popup.PopupEntity(Loc.GetString("research-console-no-access-popup"), ent); + _popup.PopupEntity(Loc.GetString("research-console-no-access-popup"), act); return; } - if (!UnlockTechnology(uid, args.Id, ent)) + if (!UnlockTechnology(uid, args.Id, act)) return; var message = Loc.GetString("research-console-unlock-technology-radio-broadcast", @@ -68,7 +67,7 @@ public sealed partial class ResearchSystem state = new ResearchConsoleBoundInterfaceState(default); } - _uiSystem.TrySetUiState(uid, ResearchConsoleUiKey.Key, state); + _uiSystem.SetUiState(uid, ResearchConsoleUiKey.Key, state); } private void OnPointsChanged(EntityUid uid, ResearchConsoleComponent component, ref ResearchServerPointsChangedEvent args) diff --git a/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs b/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs index 2064abd8eb..6700247522 100644 --- a/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs +++ b/Content.Server/Research/TechnologyDisk/Systems/DiskConsoleSystem.cs @@ -91,7 +91,7 @@ public sealed class DiskConsoleSystem : EntitySystem totalPoints >= component.PricePerDisk; var state = new DiskConsoleBoundUserInterfaceState(totalPoints, component.PricePerDisk, canPrint); - _ui.TrySetUiState(uid, DiskConsoleUiKey.Key, state); + _ui.SetUiState(uid, DiskConsoleUiKey.Key, state); } private void OnShutdown(EntityUid uid, DiskConsolePrintingComponent component, ComponentShutdown args) diff --git a/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs b/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs index 61636bea7c..d031418476 100644 --- a/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs +++ b/Content.Server/Salvage/SalvageSystem.ExpeditionConsole.cs @@ -56,7 +56,7 @@ public sealed partial class SalvageSystem if (station != component.Owner) continue; - _ui.TrySetUiState(uid, SalvageConsoleUiKey.Expedition, state, ui: uiComp); + _ui.SetUiState((uid, uiComp), SalvageConsoleUiKey.Expedition, state); } } @@ -74,6 +74,6 @@ public sealed partial class SalvageSystem state = new SalvageExpeditionConsoleState(TimeSpan.Zero, false, true, 0, new List()); } - _ui.TrySetUiState(component, SalvageConsoleUiKey.Expedition, state); + _ui.SetUiState(component.Owner, SalvageConsoleUiKey.Expedition, state); } } diff --git a/Content.Server/Salvage/SalvageSystem.Magnet.cs b/Content.Server/Salvage/SalvageSystem.Magnet.cs index e4711a5876..4b7291298b 100644 --- a/Content.Server/Salvage/SalvageSystem.Magnet.cs +++ b/Content.Server/Salvage/SalvageSystem.Magnet.cs @@ -35,11 +35,6 @@ public sealed partial class SalvageSystem private void OnMagnetClaim(EntityUid uid, SalvageMagnetComponent component, ref MagnetClaimOfferEvent args) { - var player = args.Session.AttachedEntity; - - if (player is null) - return; - var station = _station.GetOwningStation(uid); if (!TryComp(station, out SalvageMagnetDataComponent? dataComp) || @@ -177,12 +172,12 @@ public sealed partial class SalvageSystem // Fuck with the seed to mix wrecks and asteroids. seed = (int) (seed / 10f) * 10; - + if (i >= data.Comp.OfferCount / 2) { seed++; } - + data.Comp.Offered.Add(seed); } @@ -216,7 +211,7 @@ public sealed partial class SalvageSystem if (!TryComp(station, out SalvageMagnetDataComponent? dataComp)) return; - _ui.TrySetUiState(entity, SalvageMagnetUiKey.Key, + _ui.SetUiState(entity.Owner, SalvageMagnetUiKey.Key, new SalvageMagnetBoundUserInterfaceState(dataComp.Offered) { Cooldown = dataComp.OfferCooldown, @@ -238,7 +233,7 @@ public sealed partial class SalvageSystem if (station != data.Owner) continue; - _ui.TrySetUiState(magnetUid, SalvageMagnetUiKey.Key, + _ui.SetUiState(magnetUid, SalvageMagnetUiKey.Key, new SalvageMagnetBoundUserInterfaceState(data.Comp.Offered) { Cooldown = data.Comp.OfferCooldown, diff --git a/Content.Server/SensorMonitoring/SensorMonitoringConsoleComponent.cs b/Content.Server/SensorMonitoring/SensorMonitoringConsoleComponent.cs index 63b4d9daef..b5a954f166 100644 --- a/Content.Server/SensorMonitoring/SensorMonitoringConsoleComponent.cs +++ b/Content.Server/SensorMonitoring/SensorMonitoringConsoleComponent.cs @@ -27,7 +27,7 @@ public sealed partial class SensorMonitoringConsoleComponent : Component public TimeSpan RetentionTime = TimeSpan.FromMinutes(1); // UI update tracking stuff. - public HashSet InitialUIStateSent = new(); + public HashSet InitialUIStateSent = new(); public TimeSpan LastUIUpdate; public ValueList RemovedSensors; diff --git a/Content.Server/SensorMonitoring/SensorMonitoringConsoleSystem.UI.cs b/Content.Server/SensorMonitoring/SensorMonitoringConsoleSystem.UI.cs index 26c6b17831..dec3e6c36e 100644 --- a/Content.Server/SensorMonitoring/SensorMonitoringConsoleSystem.UI.cs +++ b/Content.Server/SensorMonitoring/SensorMonitoringConsoleSystem.UI.cs @@ -18,27 +18,26 @@ public sealed partial class SensorMonitoringConsoleSystem private void UpdateConsoleUI(EntityUid uid, SensorMonitoringConsoleComponent comp) { - if (!_userInterface.TryGetUi(uid, SensorMonitoringConsoleUiKey.Key, out var ui)) - return; - - if (ui.SubscribedSessions.Count == 0) + if (!_userInterface.IsUiOpen(uid, SensorMonitoringConsoleUiKey.Key)) + { return; + } ConsoleUIState? fullState = null; SensorMonitoringIncrementalUpdate? incrementalUpdate = null; - foreach (var session in ui.SubscribedSessions) + foreach (var actorUid in _userInterface.GetActors(uid, SensorMonitoringConsoleUiKey.Key)) { - if (comp.InitialUIStateSent.Contains(session)) + if (comp.InitialUIStateSent.Contains(actorUid)) { incrementalUpdate ??= CalculateIncrementalUpdate(); - _userInterface.TrySendUiMessage(ui, incrementalUpdate, session); + _userInterface.ServerSendUiMessage(uid, SensorMonitoringConsoleUiKey.Key, incrementalUpdate, actorUid); } else { fullState ??= CalculateFullState(); - _userInterface.SetUiState(ui, fullState, session); - comp.InitialUIStateSent.Add(session); + _userInterface.SetUiState(uid, SensorMonitoringConsoleUiKey.Key, fullState); + comp.InitialUIStateSent.Add(actorUid); } } @@ -131,9 +130,6 @@ public sealed partial class SensorMonitoringConsoleSystem if (!args.UiKey.Equals(SensorMonitoringConsoleUiKey.Key)) return; - if (args.Session is not { } player) - return; - - component.InitialUIStateSent.Remove(player); + component.InitialUIStateSent.Remove(args.Actor); } } diff --git a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs index 803aa963f3..d45c04cdc2 100644 --- a/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs +++ b/Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs @@ -245,19 +245,18 @@ public sealed partial class EmergencyShuttleSystem private void OnEmergencyRepealAll(EntityUid uid, EmergencyShuttleConsoleComponent component, EmergencyShuttleRepealAllMessage args) { - var player = args.Session.AttachedEntity; - if (player == null) return; + var player = args.Actor; - if (!_reader.FindAccessTags(player.Value).Contains(EmergencyRepealAllAccess)) + if (!_reader.FindAccessTags(player).Contains(EmergencyRepealAllAccess)) { - _popup.PopupCursor(Loc.GetString("emergency-shuttle-console-denied"), player.Value, PopupType.Medium); + _popup.PopupCursor(Loc.GetString("emergency-shuttle-console-denied"), player, PopupType.Medium); return; } if (component.AuthorizedEntities.Count == 0) return; - _logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle early launch REPEAL ALL by {args.Session:user}"); + _logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle early launch REPEAL ALL by {args.Actor:user}"); _chatSystem.DispatchGlobalAnnouncement(Loc.GetString("emergency-shuttle-console-auth-revoked", ("remaining", component.AuthorizationsRequired))); component.AuthorizedEntities.Clear(); UpdateAllEmergencyConsoles(); @@ -265,13 +264,11 @@ public sealed partial class EmergencyShuttleSystem private void OnEmergencyRepeal(EntityUid uid, EmergencyShuttleConsoleComponent component, EmergencyShuttleRepealMessage args) { - var player = args.Session.AttachedEntity; - if (player == null) - return; + var player = args.Actor; - if (!_idSystem.TryFindIdCard(player.Value, out var idCard) || !_reader.IsAllowed(idCard, uid)) + if (!_idSystem.TryFindIdCard(player, out var idCard) || !_reader.IsAllowed(idCard, uid)) { - _popup.PopupCursor(Loc.GetString("emergency-shuttle-console-denied"), player.Value, PopupType.Medium); + _popup.PopupCursor(Loc.GetString("emergency-shuttle-console-denied"), player, PopupType.Medium); return; } @@ -279,7 +276,7 @@ public sealed partial class EmergencyShuttleSystem if (!component.AuthorizedEntities.Remove(MetaData(idCard).EntityName)) return; - _logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle early launch REPEAL by {args.Session:user}"); + _logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle early launch REPEAL by {args.Actor:user}"); var remaining = component.AuthorizationsRequired - component.AuthorizedEntities.Count; _chatSystem.DispatchGlobalAnnouncement(Loc.GetString("emergency-shuttle-console-auth-revoked", ("remaining", remaining))); CheckForLaunch(component); @@ -288,13 +285,11 @@ public sealed partial class EmergencyShuttleSystem private void OnEmergencyAuthorize(EntityUid uid, EmergencyShuttleConsoleComponent component, EmergencyShuttleAuthorizeMessage args) { - var player = args.Session.AttachedEntity; - if (player == null) - return; + var player = args.Actor; - if (!_idSystem.TryFindIdCard(player.Value, out var idCard) || !_reader.IsAllowed(idCard, uid)) + if (!_idSystem.TryFindIdCard(player, out var idCard) || !_reader.IsAllowed(idCard, uid)) { - _popup.PopupCursor(Loc.GetString("emergency-shuttle-console-denied"), args.Session, PopupType.Medium); + _popup.PopupCursor(Loc.GetString("emergency-shuttle-console-denied"), args.Actor, PopupType.Medium); return; } @@ -302,7 +297,7 @@ public sealed partial class EmergencyShuttleSystem if (!component.AuthorizedEntities.Add(MetaData(idCard).EntityName)) return; - _logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle early launch AUTH by {args.Session:user}"); + _logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle early launch AUTH by {args.Actor:user}"); var remaining = component.AuthorizationsRequired - component.AuthorizedEntities.Count; if (remaining > 0) @@ -349,9 +344,10 @@ public sealed partial class EmergencyShuttleSystem auths.Add(auth); } - if (_uiSystem.TryGetUi(uid, EmergencyConsoleUiKey.Key, out var bui)) + if (_uiSystem.HasUi(uid, EmergencyConsoleUiKey.Key)) _uiSystem.SetUiState( - bui, + uid, + EmergencyConsoleUiKey.Key, new EmergencyConsoleBoundUserInterfaceState() { EarlyLaunchTime = EarlyLaunchAuthorized ? _timing.CurTime + TimeSpan.FromSeconds(_consoleAccumulator) : null, diff --git a/Content.Server/Shuttles/Systems/RadarConsoleSystem.cs b/Content.Server/Shuttles/Systems/RadarConsoleSystem.cs index b7f08b4b34..1de20a8734 100644 --- a/Content.Server/Shuttles/Systems/RadarConsoleSystem.cs +++ b/Content.Server/Shuttles/Systems/RadarConsoleSystem.cs @@ -39,7 +39,7 @@ public sealed class RadarConsoleSystem : SharedRadarConsoleSystem angle = Angle.Zero; } - if (_uiSystem.TryGetUi(uid, RadarConsoleUiKey.Key, out var bui)) + if (_uiSystem.HasUi(uid, RadarConsoleUiKey.Key)) { NavInterfaceState state; var docks = _console.GetAllDocks(); @@ -53,7 +53,7 @@ public sealed class RadarConsoleSystem : SharedRadarConsoleSystem state = _console.GetNavState(uid, docks); } - _uiSystem.SetUiState(bui, new NavBoundUserInterfaceState(state)); + _uiSystem.SetUiState(uid, RadarConsoleUiKey.Key, new NavBoundUserInterfaceState(state)); } } } diff --git a/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs b/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs index a4f2c7b4db..89dc114caf 100644 --- a/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs +++ b/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs @@ -136,13 +136,12 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem /// private void OnConsoleUIClose(EntityUid uid, ShuttleConsoleComponent component, BoundUIClosedEvent args) { - if ((ShuttleConsoleUiKey) args.UiKey != ShuttleConsoleUiKey.Key || - args.Session.AttachedEntity is not { } user) + if ((ShuttleConsoleUiKey) args.UiKey != ShuttleConsoleUiKey.Key) { return; } - RemovePilot(user); + RemovePilot(args.Actor); } private void OnConsoleUIOpenAttempt(EntityUid uid, ShuttleConsoleComponent component, @@ -265,9 +264,9 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem new List()); } - if (_ui.TryGetUi(consoleUid, ShuttleConsoleUiKey.Key, out var bui)) + if (_ui.HasUi(consoleUid, ShuttleConsoleUiKey.Key)) { - _ui.SetUiState(bui, new ShuttleBoundUserInterfaceState(navState, mapState, dockState)); + _ui.SetUiState(consoleUid, ShuttleConsoleUiKey.Key, new ShuttleBoundUserInterfaceState(navState, mapState, dockState)); } } diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.IFF.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.IFF.cs index bf265da2e6..ce79466b58 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.IFF.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.IFF.cs @@ -57,7 +57,7 @@ public sealed partial class ShuttleSystem !TryComp(uid, out var xform) || !TryComp(xform.GridUid, out var iff)) { - _uiSystem.TrySetUiState(uid, IFFConsoleUiKey.Key, new IFFConsoleBoundUserInterfaceState() + _uiSystem.SetUiState(uid, IFFConsoleUiKey.Key, new IFFConsoleBoundUserInterfaceState() { AllowedFlags = component.AllowedFlags, Flags = IFFFlags.None, @@ -65,7 +65,7 @@ public sealed partial class ShuttleSystem } else { - _uiSystem.TrySetUiState(uid, IFFConsoleUiKey.Key, new IFFConsoleBoundUserInterfaceState() + _uiSystem.SetUiState(uid, IFFConsoleUiKey.Key, new IFFConsoleBoundUserInterfaceState() { AllowedFlags = component.AllowedFlags, Flags = iff.Flags, @@ -83,7 +83,7 @@ public sealed partial class ShuttleSystem if (xform.GridUid != gridUid) continue; - _uiSystem.TrySetUiState(uid, IFFConsoleUiKey.Key, new IFFConsoleBoundUserInterfaceState() + _uiSystem.SetUiState(uid, IFFConsoleUiKey.Key, new IFFConsoleBoundUserInterfaceState() { AllowedFlags = comp.AllowedFlags, Flags = component.Flags, diff --git a/Content.Server/Silicons/Borgs/BorgSystem.Ui.cs b/Content.Server/Silicons/Borgs/BorgSystem.Ui.cs index 3dcdd78aff..d0e9f80e36 100644 --- a/Content.Server/Silicons/Borgs/BorgSystem.Ui.cs +++ b/Content.Server/Silicons/Borgs/BorgSystem.Ui.cs @@ -28,20 +28,19 @@ public sealed partial class BorgSystem private void OnEjectBrainBuiMessage(EntityUid uid, BorgChassisComponent component, BorgEjectBrainBuiMessage args) { - if (args.Session.AttachedEntity is not { } attachedEntity || component.BrainEntity is not { } brain) + if (component.BrainEntity is not { } brain) return; _adminLog.Add(LogType.Action, LogImpact.Medium, - $"{ToPrettyString(attachedEntity):player} removed brain {ToPrettyString(brain)} from borg {ToPrettyString(uid)}"); + $"{ToPrettyString(args.Actor):player} removed brain {ToPrettyString(brain)} from borg {ToPrettyString(uid)}"); _container.Remove(brain, component.BrainContainer); - _hands.TryPickupAnyHand(attachedEntity, brain); + _hands.TryPickupAnyHand(args.Actor, brain); UpdateUI(uid, component); } private void OnEjectBatteryBuiMessage(EntityUid uid, BorgChassisComponent component, BorgEjectBatteryBuiMessage args) { - if (args.Session.AttachedEntity is not { } attachedEntity || - !TryComp(uid, out var slotComp) || + if (!TryComp(uid, out var slotComp) || !Container.TryGetContainer(uid, slotComp.CellSlotId, out var container) || !container.ContainedEntities.Any()) { @@ -49,14 +48,11 @@ public sealed partial class BorgSystem } var ents = Container.EmptyContainer(container); - _hands.TryPickupAnyHand(attachedEntity, ents.First()); + _hands.TryPickupAnyHand(args.Actor, ents.First()); } private void OnSetNameBuiMessage(EntityUid uid, BorgChassisComponent component, BorgSetNameBuiMessage args) { - if (args.Session.AttachedEntity is not { } attachedEntity) - return; - if (args.Name.Length > HumanoidCharacterProfile.MaxNameLength || args.Name.Length == 0 || string.IsNullOrWhiteSpace(args.Name) || @@ -75,24 +71,21 @@ public sealed partial class BorgSystem if (metaData.EntityName.Equals(name, StringComparison.InvariantCulture)) return; - _adminLog.Add(LogType.Action, LogImpact.High, $"{ToPrettyString(attachedEntity):player} set borg \"{ToPrettyString(uid)}\"'s name to: {name}"); + _adminLog.Add(LogType.Action, LogImpact.High, $"{ToPrettyString(args.Actor):player} set borg \"{ToPrettyString(uid)}\"'s name to: {name}"); _metaData.SetEntityName(uid, name, metaData); } private void OnRemoveModuleBuiMessage(EntityUid uid, BorgChassisComponent component, BorgRemoveModuleBuiMessage args) { - if (args.Session.AttachedEntity is not { } attachedEntity) - return; - var module = GetEntity(args.Module); if (!component.ModuleContainer.Contains(module)) return; _adminLog.Add(LogType.Action, LogImpact.Medium, - $"{ToPrettyString(attachedEntity):player} removed module {ToPrettyString(module)} from borg {ToPrettyString(uid)}"); + $"{ToPrettyString(args.Actor):player} removed module {ToPrettyString(module)} from borg {ToPrettyString(uid)}"); _container.Remove(module, component.ModuleContainer); - _hands.TryPickupAnyHand(attachedEntity, module); + _hands.TryPickupAnyHand(args.Actor, module); UpdateUI(uid, component); } @@ -111,6 +104,6 @@ public sealed partial class BorgSystem } var state = new BorgBuiState(chargePercent, hasBattery); - _ui.TrySetUiState(uid, BorgUiKey.Key, state); + _ui.SetUiState(uid, BorgUiKey.Key, state); } } diff --git a/Content.Server/Silicons/Laws/SiliconLawSystem.cs b/Content.Server/Silicons/Laws/SiliconLawSystem.cs index 010682bc0d..cc1532899d 100644 --- a/Content.Server/Silicons/Laws/SiliconLawSystem.cs +++ b/Content.Server/Silicons/Laws/SiliconLawSystem.cs @@ -93,10 +93,10 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem private void OnBoundUIOpened(EntityUid uid, SiliconLawBoundComponent component, BoundUIOpenedEvent args) { _entityManager.TryGetComponent(uid, out var intrinsicRadio); - HashSet? radioChannels = intrinsicRadio?.Channels; + var radioChannels = intrinsicRadio?.Channels; var state = new SiliconLawBuiState(GetLaws(uid).Laws, radioChannels); - _userInterface.TrySetUiState(args.Entity, SiliconLawsUiKey.Key, state, args.Session); + _userInterface.SetUiState(args.Entity, SiliconLawsUiKey.Key, state); } private void OnPlayerSpawnComplete(EntityUid uid, SiliconLawBoundComponent component, PlayerSpawnCompleteEvent args) diff --git a/Content.Server/Solar/EntitySystems/PowerSolarControlConsoleSystem.cs b/Content.Server/Solar/EntitySystems/PowerSolarControlConsoleSystem.cs index 179cadcfbc..dd3f0c0054 100644 --- a/Content.Server/Solar/EntitySystems/PowerSolarControlConsoleSystem.cs +++ b/Content.Server/Solar/EntitySystems/PowerSolarControlConsoleSystem.cs @@ -35,13 +35,13 @@ namespace Content.Server.Solar.EntitySystems _updateTimer -= 1; var state = new SolarControlConsoleBoundInterfaceState(_powerSolarSystem.TargetPanelRotation, _powerSolarSystem.TargetPanelVelocity, _powerSolarSystem.TotalPanelPower, _powerSolarSystem.TowardsSun); var query = EntityQueryEnumerator(); - while (query.MoveNext(out var uid, out var _, out var uiComp)) + while (query.MoveNext(out var uid, out _, out var uiComp)) { - _uiSystem.TrySetUiState(uid, SolarControlConsoleUiKey.Key, state, ui: uiComp); + _uiSystem.SetUiState((uid, uiComp), SolarControlConsoleUiKey.Key, state); } } } - + private void OnUIMessage(EntityUid uid, SolarControlConsoleComponent component, SolarControlConsoleAdjustMessage msg) { if (double.IsFinite(msg.Rotation)) diff --git a/Content.Server/StationRecords/Systems/GeneralStationRecordConsoleSystem.cs b/Content.Server/StationRecords/Systems/GeneralStationRecordConsoleSystem.cs index 721eff6f2c..a5202285d9 100644 --- a/Content.Server/StationRecords/Systems/GeneralStationRecordConsoleSystem.cs +++ b/Content.Server/StationRecords/Systems/GeneralStationRecordConsoleSystem.cs @@ -57,7 +57,7 @@ public sealed class GeneralStationRecordConsoleSystem : EntitySystem if (!TryComp(owningStation, out var stationRecords)) { - _ui.TrySetUiState(uid, GeneralStationRecordConsoleKey.Key, new GeneralStationRecordConsoleState()); + _ui.SetUiState(uid, GeneralStationRecordConsoleKey.Key, new GeneralStationRecordConsoleState()); return; } @@ -66,7 +66,7 @@ public sealed class GeneralStationRecordConsoleSystem : EntitySystem switch (listing.Count) { case 0: - _ui.TrySetUiState(uid, GeneralStationRecordConsoleKey.Key, new GeneralStationRecordConsoleState()); + _ui.SetUiState(uid, GeneralStationRecordConsoleKey.Key, new GeneralStationRecordConsoleState()); return; case 1: console.ActiveKey = listing.Keys.First(); @@ -80,6 +80,6 @@ public sealed class GeneralStationRecordConsoleSystem : EntitySystem _stationRecords.TryGetRecord(key, out var record, stationRecords); GeneralStationRecordConsoleState newState = new(id, record, listing, console.Filter); - _ui.TrySetUiState(uid, GeneralStationRecordConsoleKey.Key, newState); + _ui.SetUiState(uid, GeneralStationRecordConsoleKey.Key, newState); } } diff --git a/Content.Server/Storage/EntitySystems/StorageSystem.cs b/Content.Server/Storage/EntitySystems/StorageSystem.cs index 390310390e..4b5dd7290c 100644 --- a/Content.Server/Storage/EntitySystems/StorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/StorageSystem.cs @@ -7,10 +7,8 @@ using Content.Shared.Lock; using Content.Shared.Storage; using Content.Shared.Storage.Components; using Content.Shared.Storage.EntitySystems; -using Content.Shared.Timing; using Content.Shared.Verbs; using Robust.Server.GameObjects; -using Robust.Shared.Audio.Systems; using Robust.Shared.Map; using Robust.Shared.Player; using Robust.Shared.Prototypes; @@ -20,133 +18,21 @@ namespace Content.Server.Storage.EntitySystems; public sealed partial class StorageSystem : SharedStorageSystem { - [Dependency] private readonly IAdminManager _admin = default!; [Dependency] private readonly IPrototypeManager _prototype = default!; - [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; - [Dependency] private readonly SharedAudioSystem _audio = default!; - - private const string OpenUiUseDelayID = "storage"; public override void Initialize() { base.Initialize(); - SubscribeLocalEvent>(AddUiVerb); - Subs.BuiEvents(StorageComponent.StorageUiKey.Key, subs => - { - subs.Event(OnBoundUIClosed); - }); SubscribeLocalEvent(OnExploded); SubscribeLocalEvent(OnStorageFillMapInit); } - protected override void OnMapInit(Entity entity, ref MapInitEvent args) - { - base.OnMapInit(entity, ref args); - - if (TryComp(entity, out var useDelay)) - UseDelay.SetLength((entity, useDelay), entity.Comp.OpenUiCooldown, OpenUiUseDelayID); - } - - private void AddUiVerb(EntityUid uid, StorageComponent component, GetVerbsEvent args) - { - var silent = false; - if (!args.CanAccess || !args.CanInteract || TryComp(uid, out var lockComponent) && lockComponent.Locked) - { - // we allow admins to open the storage anyways - if (!_admin.HasAdminFlag(args.User, AdminFlags.Admin)) - return; - - silent = true; - } - - silent |= HasComp(args.User); - - // Get the session for the user - if (!TryComp(args.User, out var actor)) - return; - - // Does this player currently have the storage UI open? - var uiOpen = _uiSystem.SessionHasOpenUi(uid, StorageComponent.StorageUiKey.Key, actor.PlayerSession); - - ActivationVerb verb = new() - { - Act = () => - { - if (uiOpen) - { - _uiSystem.TryClose(uid, StorageComponent.StorageUiKey.Key, actor.PlayerSession); - } - else - { - OpenStorageUI(uid, args.User, component, silent); - } - } - }; - if (uiOpen) - { - verb.Text = Loc.GetString("comp-storage-verb-close-storage"); - verb.Icon = new SpriteSpecifier.Texture( - new("/Textures/Interface/VerbIcons/close.svg.192dpi.png")); - } - else - { - verb.Text = Loc.GetString("comp-storage-verb-open-storage"); - verb.Icon = new SpriteSpecifier.Texture( - new("/Textures/Interface/VerbIcons/open.svg.192dpi.png")); - } - args.Verbs.Add(verb); - } - - private void OnBoundUIClosed(EntityUid uid, StorageComponent storageComp, BoundUIClosedEvent args) - { - if (TryComp(args.Session.AttachedEntity, out var actor) && actor?.PlayerSession != null) - CloseNestedInterfaces(uid, actor.PlayerSession, storageComp); - - // If UI is closed for everyone - if (!_uiSystem.IsUiOpen(uid, args.UiKey)) - { - storageComp.IsUiOpen = false; - UpdateAppearance((uid, storageComp, null)); - - if (storageComp.StorageCloseSound is not null) - Audio.PlayEntity(storageComp.StorageCloseSound, Filter.Pvs(uid, entityManager: EntityManager), uid, true, storageComp.StorageCloseSound.Params); - } - } - private void OnExploded(Entity ent, ref BeforeExplodeEvent args) { args.Contents.AddRange(ent.Comp.Container.ContainedEntities); } - /// - /// Opens the storage UI for an entity - /// - /// The entity to open the UI for - public override void OpenStorageUI(EntityUid uid, EntityUid entity, StorageComponent? storageComp = null, bool silent = false) - { - if (!Resolve(uid, ref storageComp, false) || !TryComp(entity, out ActorComponent? player)) - return; - - // prevent spamming bag open / honkerton honk sound - silent |= TryComp(uid, out var useDelay) && UseDelay.IsDelayed((uid, useDelay), OpenUiUseDelayID); - if (!silent) - { - if (!storageComp.IsUiOpen) - _audio.PlayPvs(storageComp.StorageOpenSound, uid); - if (useDelay != null) - UseDelay.TryResetDelay((uid, useDelay), id: OpenUiUseDelayID); - } - - Log.Debug($"Storage (UID {uid}) \"used\" by player session (UID {player.PlayerSession.AttachedEntity})."); - - var bui = _uiSystem.GetUiOrNull(uid, StorageComponent.StorageUiKey.Key); - if (bui == null) - return; - _uiSystem.OpenUi(bui, player.PlayerSession); - _uiSystem.SendUiMessage(bui, new StorageModifyWindowMessage()); - } - /// public override void PlayPickupAnimation(EntityUid uid, EntityCoordinates initialCoordinates, EntityCoordinates finalCoordinates, Angle initialRotation, EntityUid? user = null) @@ -154,30 +40,4 @@ public sealed partial class StorageSystem : SharedStorageSystem var filter = Filter.Pvs(uid).RemoveWhereAttachedEntity(e => e == user); RaiseNetworkEvent(new PickupAnimationEvent(GetNetEntity(uid), GetNetCoordinates(initialCoordinates), GetNetCoordinates(finalCoordinates), initialRotation), filter); } - - /// - /// If the user has nested-UIs open (e.g., PDA UI open when pda is in a backpack), close them. - /// - /// - public void CloseNestedInterfaces(EntityUid uid, ICommonSession session, StorageComponent? storageComp = null) - { - if (!Resolve(uid, ref storageComp)) - return; - - // for each containing thing - // if it has a storage comp - // ensure unsubscribe from session - // if it has a ui component - // close ui - foreach (var entity in storageComp.Container.ContainedEntities) - { - if (!TryComp(entity, out UserInterfaceComponent? ui)) - continue; - - foreach (var bui in ui.Interfaces.Values) - { - _uiSystem.TryClose(entity, bui.UiKey, session, ui); - } - } - } } diff --git a/Content.Server/Store/Systems/StoreSystem.Ui.cs b/Content.Server/Store/Systems/StoreSystem.Ui.cs index 25f64ba4b6..864fe1185a 100644 --- a/Content.Server/Store/Systems/StoreSystem.Ui.cs +++ b/Content.Server/Store/Systems/StoreSystem.Ui.cs @@ -73,7 +73,7 @@ public sealed partial class StoreSystem if (!Resolve(uid, ref component)) return; - _ui.TryCloseAll(uid, StoreUiKey.Key); + _ui.CloseUi(uid, StoreUiKey.Key); } /// @@ -83,12 +83,13 @@ public sealed partial class StoreSystem /// The store entity itself /// The store component being refreshed. /// - public void UpdateUserInterface(EntityUid? user, EntityUid store, StoreComponent? component = null, PlayerBoundUserInterface? ui = null) + public void UpdateUserInterface(EntityUid? user, EntityUid store, StoreComponent? component = null) { if (!Resolve(store, ref component)) return; - if (ui == null && !_ui.TryGetUi(store, StoreUiKey.Key, out ui)) + // TODO: Why is the state not being set unless this? + if (!_ui.IsUiOpen(store, StoreUiKey.Key)) return; //this is the person who will be passed into logic for all listing filtering. @@ -113,12 +114,12 @@ public sealed partial class StoreSystem // only tell operatives to lock their uplink if it can be locked var showFooter = HasComp(store); var state = new StoreUpdateState(component.LastAvailableListings, allCurrency, showFooter, component.RefundAllowed); - _ui.SetUiState(ui, state); + _ui.SetUiState(store, StoreUiKey.Key, state); } private void OnRequestUpdate(EntityUid uid, StoreComponent component, StoreRequestUpdateInterfaceMessage args) { - UpdateUserInterface(args.Session.AttachedEntity, GetEntity(args.Entity), component); + UpdateUserInterface(args.Actor, GetEntity(args.Entity), component); } private void BeforeActivatableUiOpen(EntityUid uid, StoreComponent component, BeforeActivatableUIOpenEvent args) @@ -139,8 +140,7 @@ public sealed partial class StoreSystem return; } - if (msg.Session.AttachedEntity is not { Valid: true } buyer) - return; + var buyer = msg.Actor; //verify that we can actually buy this listing and it wasn't added if (!ListingHasCategory(listing, component.Categories)) @@ -263,7 +263,7 @@ public sealed partial class StoreSystem $"{ToPrettyString(buyer):player} purchased listing \"{ListingLocalisationHelpers.GetLocalisedNameOrEntityName(listing, _prototypeManager)}\" from {ToPrettyString(uid)}"); listing.PurchaseAmount++; //track how many times something has been purchased - _audio.PlayEntity(component.BuySuccessSound, msg.Session, uid); //cha-ching! + _audio.PlayEntity(component.BuySuccessSound, msg.Actor, uid); //cha-ching! UpdateUserInterface(buyer, uid, component); } @@ -289,8 +289,7 @@ public sealed partial class StoreSystem if (proto.Cash == null || !proto.CanWithdraw) return; - if (msg.Session.AttachedEntity is not { Valid: true } buyer) - return; + var buyer = msg.Actor; FixedPoint2 amountRemaining = msg.Amount; var coordinates = Transform(buyer).Coordinates; @@ -313,7 +312,7 @@ public sealed partial class StoreSystem { // TODO: Remove guardian/holopara - if (args.Session.AttachedEntity is not { Valid: true } buyer) + if (args.Actor is not { Valid: true } buyer) return; if (!IsOnStartingMap(uid, component)) diff --git a/Content.Server/Store/Systems/StoreSystem.cs b/Content.Server/Store/Systems/StoreSystem.cs index 56426e0404..7998c42f53 100644 --- a/Content.Server/Store/Systems/StoreSystem.cs +++ b/Content.Server/Store/Systems/StoreSystem.cs @@ -199,10 +199,9 @@ public sealed partial class StoreSystem : EntitySystem if (component.Balance == new Dictionary() && preset.InitialBalance != null) //if we don't have a value stored, use the preset TryAddCurrency(preset.InitialBalance, uid, component); - var ui = _ui.GetUiOrNull(uid, StoreUiKey.Key); - if (ui != null) + if (_ui.HasUi(uid, StoreUiKey.Key)) { - _ui.SetUiState(ui, new StoreInitializeState(preset.StoreName)); + _ui.SetUiState(uid, StoreUiKey.Key, new StoreInitializeState(preset.StoreName)); } } } diff --git a/Content.Server/Strip/StrippableSystem.cs b/Content.Server/Strip/StrippableSystem.cs index 9447dec417..1dba52a698 100644 --- a/Content.Server/Strip/StrippableSystem.cs +++ b/Content.Server/Strip/StrippableSystem.cs @@ -111,17 +111,15 @@ namespace Content.Server.Strip if (TryComp(user, out var mode) && mode.IsInCombatMode && !openInCombat) return; - if (TryComp(user, out var actor) && HasComp(user)) + if (HasComp(user)) { - if (_userInterfaceSystem.SessionHasOpenUi(strippable, StrippingUiKey.Key, actor.PlayerSession)) - return; - _userInterfaceSystem.TryOpen(strippable, StrippingUiKey.Key, actor.PlayerSession); + _userInterfaceSystem.OpenUi(strippable.Owner, StrippingUiKey.Key, user); } } private void OnStripButtonPressed(Entity strippable, ref StrippingSlotButtonPressed args) { - if (args.Session.AttachedEntity is not { Valid: true } user || + if (args.Actor is not { Valid: true } user || !TryComp(user, out var userHands)) return; @@ -173,7 +171,7 @@ namespace Content.Server.Strip private void OnStripEnsnareMessage(EntityUid uid, EnsnareableComponent component, StrippingEnsnareButtonPressed args) { - if (args.Session.AttachedEntity is not { Valid: true } user) + if (args.Actor is not { Valid: true } user) return; foreach (var entity in component.Container.ContainedEntities) diff --git a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMonitorSystem.cs b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMonitorSystem.cs index f258fbe89c..ca0f59cd14 100644 --- a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMonitorSystem.cs +++ b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMonitorSystem.cs @@ -90,7 +90,7 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem private void OnSubnetRequest(EntityUid uid, SurveillanceCameraMonitorComponent component, SurveillanceCameraMonitorSubnetRequestMessage args) { - if (args.Session.AttachedEntity != null) + if (args.Actor != null) { SetActiveSubnet(uid, args.Subnet, component); } @@ -208,13 +208,9 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem private void OnBoundUiClose(EntityUid uid, SurveillanceCameraMonitorComponent component, BoundUIClosedEvent args) { - if (args.Session.AttachedEntity == null) - { - return; - } - - RemoveViewer(uid, args.Session.AttachedEntity.Value, component); + RemoveViewer(uid, args.Actor, component); } + #endregion private void SendHeartbeat(EntityUid uid, SurveillanceCameraMonitorComponent? monitor = null) @@ -487,6 +483,6 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem } var state = new SurveillanceCameraMonitorUiState(GetNetEntity(monitor.ActiveCamera), monitor.KnownSubnets.Keys.ToHashSet(), monitor.ActiveCameraAddress, monitor.ActiveSubnet, monitor.KnownCameras); - _userInterface.TrySetUiState(uid, SurveillanceCameraMonitorUiKey.Key, state); + _userInterface.SetUiState(uid, SurveillanceCameraMonitorUiKey.Key, state); } } diff --git a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraRouterSystem.cs b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraRouterSystem.cs index ac41723026..d0c2cd78d3 100644 --- a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraRouterSystem.cs +++ b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraRouterSystem.cs @@ -134,14 +134,14 @@ public sealed class SurveillanceCameraRouterSystem : EntitySystem UpdateSetupInterface(uid, component); } - private void OpenSetupInterface(EntityUid uid, EntityUid player, SurveillanceCameraRouterComponent? camera = null, ActorComponent? actor = null) + private void OpenSetupInterface(EntityUid uid, EntityUid player, SurveillanceCameraRouterComponent? camera = null) { - if (!Resolve(uid, ref camera) || !Resolve(player, ref actor)) - return; - if (!_userInterface.TryGetUi(uid, SurveillanceCameraSetupUiKey.Router, out var bui)) + if (!Resolve(uid, ref camera)) + return; + + if (!_userInterface.TryOpenUi(uid, SurveillanceCameraSetupUiKey.Router, player)) return; - _userInterface.OpenUi(bui, actor.PlayerSession); UpdateSetupInterface(uid, camera); } @@ -154,13 +154,13 @@ public sealed class SurveillanceCameraRouterSystem : EntitySystem if (router.AvailableNetworks.Count == 0 || router.SubnetFrequencyId != null) { - _userInterface.TryCloseAll(uid, SurveillanceCameraSetupUiKey.Router); + _userInterface.CloseUi(uid, SurveillanceCameraSetupUiKey.Router); return; } var state = new SurveillanceCameraSetupBoundUiState(router.SubnetName, deviceNet.ReceiveFrequency ?? 0, router.AvailableNetworks, true, router.SubnetFrequencyId != null); - _userInterface.TrySetUiState(uid, SurveillanceCameraSetupUiKey.Router, state); + _userInterface.SetUiState(uid, SurveillanceCameraSetupUiKey.Router, state); } private void SendHeartbeat(EntityUid uid, string origin, string destination, diff --git a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraSystem.cs b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraSystem.cs index 410ba9f754..8dd253269d 100644 --- a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraSystem.cs +++ b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraSystem.cs @@ -196,14 +196,14 @@ public sealed class SurveillanceCameraSystem : EntitySystem UpdateSetupInterface(uid, component); } - private void OpenSetupInterface(EntityUid uid, EntityUid player, SurveillanceCameraComponent? camera = null, ActorComponent? actor = null) + private void OpenSetupInterface(EntityUid uid, EntityUid player, SurveillanceCameraComponent? camera = null) { - if (!Resolve(uid, ref camera) || !Resolve(player, ref actor)) - return; - if (!_userInterface.TryGetUi(uid, SurveillanceCameraSetupUiKey.Camera, out var bui)) + if (!Resolve(uid, ref camera)) + return; + + if (!_userInterface.TryOpenUi(uid, SurveillanceCameraSetupUiKey.Camera, player)) return; - _userInterface.OpenUi(bui, actor.PlayerSession); UpdateSetupInterface(uid, camera); } @@ -216,7 +216,7 @@ public sealed class SurveillanceCameraSystem : EntitySystem if (camera.NameSet && camera.NetworkSet) { - _userInterface.TryCloseAll(uid, SurveillanceCameraSetupUiKey.Camera); + _userInterface.CloseUi(uid, SurveillanceCameraSetupUiKey.Camera); return; } @@ -228,14 +228,14 @@ public sealed class SurveillanceCameraSystem : EntitySystem } else if (!camera.NetworkSet) { - _userInterface.TryCloseAll(uid, SurveillanceCameraSetupUiKey.Camera); + _userInterface.CloseUi(uid, SurveillanceCameraSetupUiKey.Camera); return; } } var state = new SurveillanceCameraSetupBoundUiState(camera.CameraId, deviceNet.ReceiveFrequency ?? 0, camera.AvailableNetworks, camera.NameSet, camera.NetworkSet); - _userInterface.TrySetUiState(uid, SurveillanceCameraSetupUiKey.Camera, state); + _userInterface.SetUiState(uid, SurveillanceCameraSetupUiKey.Camera, state); } // If the camera deactivates for any reason, it must have all viewers removed, diff --git a/Content.Server/Thief/Systems/ThiefUndeterminedBackpackSystem.cs b/Content.Server/Thief/Systems/ThiefUndeterminedBackpackSystem.cs index 9918565328..133876bd75 100644 --- a/Content.Server/Thief/Systems/ThiefUndeterminedBackpackSystem.cs +++ b/Content.Server/Thief/Systems/ThiefUndeterminedBackpackSystem.cs @@ -79,6 +79,6 @@ public sealed class ThiefUndeterminedBackpackSystem : EntitySystem data.Add(i, info); } - _ui.TrySetUiState(uid, ThiefBackpackUIKey.Key, new ThiefBackpackBoundUserInterfaceState(data, MaxSelectedSets)); + _ui.SetUiState(uid, ThiefBackpackUIKey.Key, new ThiefBackpackBoundUserInterfaceState(data, MaxSelectedSets)); } } diff --git a/Content.Server/UserInterface/IntrinsicUIComponent.cs b/Content.Server/UserInterface/IntrinsicUIComponent.cs index 4d3c7ffba9..83936edc8c 100644 --- a/Content.Server/UserInterface/IntrinsicUIComponent.cs +++ b/Content.Server/UserInterface/IntrinsicUIComponent.cs @@ -9,18 +9,12 @@ public sealed partial class IntrinsicUIComponent : Component /// /// List of UIs and their actions that this entity has. /// - [DataField("uis", required: true)] public List UIs = new(); + [DataField("uis", required: true)] public Dictionary UIs = new(); } [DataDefinition] -public partial class IntrinsicUIEntry +public sealed partial class IntrinsicUIEntry { - /// - /// The BUI key that this intrinsic UI should open. - /// - [DataField("key", required: true)] - public Enum? Key { get; private set; } - [DataField("toggleAction", customTypeSerializer: typeof(PrototypeIdSerializer), required: true)] public string? ToggleAction; diff --git a/Content.Server/UserInterface/IntrinsicUISystem.cs b/Content.Server/UserInterface/IntrinsicUISystem.cs index fa725e524a..0f7261865d 100644 --- a/Content.Server/UserInterface/IntrinsicUISystem.cs +++ b/Content.Server/UserInterface/IntrinsicUISystem.cs @@ -18,50 +18,31 @@ public sealed class IntrinsicUISystem : EntitySystem private void OnActionToggle(EntityUid uid, IntrinsicUIComponent component, ToggleIntrinsicUIEvent args) { + if (args.Key == null) + return; + args.Handled = InteractUI(uid, args.Key, component); } private void InitActions(EntityUid uid, IntrinsicUIComponent component, MapInitEvent args) { - foreach (var entry in component.UIs) + foreach (var entry in component.UIs.Values) { _actionsSystem.AddAction(uid, ref entry.ToggleActionEntity, entry.ToggleAction); } } - public bool InteractUI(EntityUid uid, Enum? key, IntrinsicUIComponent? iui = null, ActorComponent? actor = null) + public bool InteractUI(EntityUid uid, Enum key, IntrinsicUIComponent? iui = null, ActorComponent? actor = null) { if (!Resolve(uid, ref iui, ref actor)) return false; - if (key is null) - { - Log.Error($"Entity {ToPrettyString(uid)} has an invalid intrinsic UI."); - } - - var ui = GetUIOrNull(uid, key, iui); - - if (ui is null) - { - Log.Error($"Couldn't get UI {key} on {ToPrettyString(uid)}"); - return false; - } - var attempt = new IntrinsicUIOpenAttemptEvent(uid, key); RaiseLocalEvent(uid, attempt); if (attempt.Cancelled) return false; - _uiSystem.ToggleUi(ui, actor.PlayerSession); - return true; - } - - private PlayerBoundUserInterface? GetUIOrNull(EntityUid uid, Enum? key, IntrinsicUIComponent? component = null) - { - if (!Resolve(uid, ref component)) - return null; - - return key is null ? null : _uiSystem.GetUiOrNull(uid, key); + return _uiSystem.TryToggleUi(uid, key, actor.PlayerSession); } } diff --git a/Content.Server/VendingMachines/VendingMachineSystem.cs b/Content.Server/VendingMachines/VendingMachineSystem.cs index 7c9aed188f..723b9de626 100644 --- a/Content.Server/VendingMachines/VendingMachineSystem.cs +++ b/Content.Server/VendingMachines/VendingMachineSystem.cs @@ -115,7 +115,7 @@ namespace Content.Server.VendingMachines { var state = new VendingMachineInterfaceState(GetAllInventory(uid, component)); - _userInterfaceSystem.TrySetUiState(uid, VendingMachineUiKey.Key, state); + _userInterfaceSystem.SetUiState(uid, VendingMachineUiKey.Key, state); } private void OnInventoryEjectMessage(EntityUid uid, VendingMachineComponent component, VendingMachineEjectMessage args) @@ -123,7 +123,7 @@ namespace Content.Server.VendingMachines if (!this.IsPowered(uid, EntityManager)) return; - if (args.Session.AttachedEntity is not { Valid: true } entity || Deleted(entity)) + if (args.Actor is not { Valid: true } entity || Deleted(entity)) return; AuthorizedVend(uid, entity, args.Type, args.ID, component); diff --git a/Content.Server/VoiceMask/VoiceMaskSystem.cs b/Content.Server/VoiceMask/VoiceMaskSystem.cs index ad9020d324..df972b9a14 100644 --- a/Content.Server/VoiceMask/VoiceMaskSystem.cs +++ b/Content.Server/VoiceMask/VoiceMaskSystem.cs @@ -41,17 +41,14 @@ public sealed partial class VoiceMaskSystem : EntitySystem { if (message.Name.Length > HumanoidCharacterProfile.MaxNameLength || message.Name.Length <= 0) { - _popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-failure"), uid, message.Session, PopupType.SmallCaution); + _popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-failure"), uid, message.Actor, PopupType.SmallCaution); return; } component.VoiceName = message.Name; - if (message.Session.AttachedEntity != null) - _adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} set voice of {ToPrettyString(uid):mask}: {component.VoiceName}"); - else - _adminLogger.Add(LogType.Action, LogImpact.Medium, $"Voice of {ToPrettyString(uid):mask} set: {component.VoiceName}"); + _adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(message.Actor):player} set voice of {ToPrettyString(uid):mask}: {component.VoiceName}"); - _popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-success"), uid, message.Session); + _popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-success"), uid, message.Actor); TrySetLastKnownName(uid, message.Name); @@ -66,7 +63,7 @@ public sealed partial class VoiceMaskSystem : EntitySystem ent.Comp.SpeechVerb = msg.Verb; // verb is only important to metagamers so no need to log as opposed to name - _popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-success"), ent, msg.Session); + _popupSystem.PopupEntity(Loc.GetString("voice-mask-popup-success"), ent, msg.Actor); TrySetLastSpeechVerb(ent, msg.Verb); @@ -94,14 +91,12 @@ public sealed partial class VoiceMaskSystem : EntitySystem ent.Comp.Enabled = !args.IsToggled; } - private void OpenUI(EntityUid player, ActorComponent? actor = null) + private void OpenUI(EntityUid player) { - if (!Resolve(player, ref actor)) - return; - if (!_uiSystem.TryGetUi(player, VoiceMaskUIKey.Key, out var bui)) + if (!_uiSystem.HasUi(player, VoiceMaskUIKey.Key)) return; - _uiSystem.OpenUi(bui, actor.PlayerSession); + _uiSystem.OpenUi(player, VoiceMaskUIKey.Key, player); UpdateUI(player); } @@ -112,7 +107,7 @@ public sealed partial class VoiceMaskSystem : EntitySystem return; } - if (_uiSystem.TryGetUi(owner, VoiceMaskUIKey.Key, out var bui)) - _uiSystem.SetUiState(bui, new VoiceMaskBuiState(component.VoiceName, component.SpeechVerb)); + if (_uiSystem.HasUi(owner, VoiceMaskUIKey.Key)) + _uiSystem.SetUiState(owner, VoiceMaskUIKey.Key, new VoiceMaskBuiState(component.VoiceName, component.SpeechVerb)); } } diff --git a/Content.Server/Wires/WiresSystem.cs b/Content.Server/Wires/WiresSystem.cs index a2deb11fe7..5d31a4d144 100644 --- a/Content.Server/Wires/WiresSystem.cs +++ b/Content.Server/Wires/WiresSystem.cs @@ -17,6 +17,7 @@ using Robust.Server.GameObjects; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; +using ActivatableUISystem = Content.Shared.UserInterface.ActivatableUISystem; namespace Content.Server.Wires; @@ -393,11 +394,11 @@ public sealed class WiresSystem : SharedWiresSystem private void OnWiresActionMessage(EntityUid uid, WiresComponent component, WiresActionMessage args) { - if (args.Session.AttachedEntity == null) + if (args.Actor == null) { return; } - var player = (EntityUid) args.Session.AttachedEntity; + var player = (EntityUid) args.Actor; if (!EntityManager.TryGetComponent(player, out HandsComponent? handsComponent)) { @@ -458,7 +459,7 @@ public sealed class WiresSystem : SharedWiresSystem { if (TryComp(args.User, out ActorComponent? actor)) { - _uiSystem.TryOpen(uid, WiresUiKey.Key, actor.PlayerSession); + _uiSystem.OpenUi(uid, WiresUiKey.Key, actor.PlayerSession); args.Handled = true; } } @@ -468,7 +469,8 @@ public sealed class WiresSystem : SharedWiresSystem { if (args.Open) return; - _uiSystem.TryCloseAll(ent, WiresUiKey.Key); + + _uiSystem.CloseUi(ent.Owner, WiresUiKey.Key); } private void OnAttemptOpenActivatableUI(EntityUid uid, ActivatableUIRequiresPanelComponent component, ActivatableUIOpenAttemptEvent args) @@ -574,18 +576,17 @@ public sealed class WiresSystem : SharedWiresSystem statuses.Sort((a, b) => a.position.CompareTo(b.position)); - _uiSystem.TrySetUiState(uid, WiresUiKey.Key, new WiresBoundUserInterfaceState( + _uiSystem.SetUiState((uid, ui), WiresUiKey.Key, new WiresBoundUserInterfaceState( clientList.ToArray(), statuses.Select(p => new StatusEntry(p.key, p.value)).ToArray(), Loc.GetString(wires.BoardName), wires.SerialNumber, - wires.WireSeed), ui: ui); + wires.WireSeed)); } public void OpenUserInterface(EntityUid uid, ICommonSession player) { - if (_uiSystem.TryGetUi(uid, WiresUiKey.Key, out var ui)) - _uiSystem.OpenUi(ui, player); + _uiSystem.OpenUi(uid, WiresUiKey.Key, player); } /// @@ -629,7 +630,7 @@ public sealed class WiresSystem : SharedWiresSystem if (!args.WiresAccessible) { - _uiSystem.TryCloseAll(uid, WiresUiKey.Key); + _uiSystem.CloseUi(uid, WiresUiKey.Key); } } diff --git a/Content.Server/Xenoarchaeology/Equipment/Systems/ArtifactAnalyzerSystem.cs b/Content.Server/Xenoarchaeology/Equipment/Systems/ArtifactAnalyzerSystem.cs index 2e546dd200..59ca913a39 100644 --- a/Content.Server/Xenoarchaeology/Equipment/Systems/ArtifactAnalyzerSystem.cs +++ b/Content.Server/Xenoarchaeology/Equipment/Systems/ArtifactAnalyzerSystem.cs @@ -223,8 +223,7 @@ public sealed class ArtifactAnalyzerSystem : EntitySystem var state = new AnalysisConsoleUpdateState(GetNetEntity(artifact), analyzerConnected, serverConnected, canScan, canPrint, msg, scanning, paused, active?.StartTime, active?.AccumulatedRunTime, totalTime, points, biasDirection == BiasDirection.Down); - var bui = _ui.GetUi(uid, ArtifactAnalzyerUiKey.Key); - _ui.SetUiState(bui, state); + _ui.SetUiState(uid, ArtifactAnalzyerUiKey.Key, state); } /// @@ -235,7 +234,7 @@ public sealed class ArtifactAnalyzerSystem : EntitySystem /// private void OnServerSelectionMessage(EntityUid uid, AnalysisConsoleComponent component, AnalysisConsoleServerSelectionMessage args) { - _ui.TryOpen(uid, ResearchClientUiKey.Key, args.Session); + _ui.OpenUi(uid, ResearchClientUiKey.Key, args.Actor); } /// diff --git a/Content.Shared/Administration/Components/SharedHeadstandComponent.cs b/Content.Shared/Administration/Components/SharedHeadstandComponent.cs index ebc23c7b05..96a4dfc2dd 100644 --- a/Content.Shared/Administration/Components/SharedHeadstandComponent.cs +++ b/Content.Shared/Administration/Components/SharedHeadstandComponent.cs @@ -1,6 +1,9 @@ -namespace Content.Shared.Administration.Components; +using Robust.Shared.GameStates; + +namespace Content.Shared.Administration.Components; /// /// Flips the target's sprite on it's head, so they do a headstand. /// +[NetworkedComponent] public abstract partial class SharedHeadstandComponent : Component { } diff --git a/Content.Shared/Administration/Components/SharedKillSignComponent.cs b/Content.Shared/Administration/Components/SharedKillSignComponent.cs index 2e6d54ca88..9a95454f72 100644 --- a/Content.Shared/Administration/Components/SharedKillSignComponent.cs +++ b/Content.Shared/Administration/Components/SharedKillSignComponent.cs @@ -1,5 +1,8 @@ -namespace Content.Shared.Administration.Components; +using Robust.Shared.GameStates; +namespace Content.Shared.Administration.Components; + +[NetworkedComponent] public abstract partial class SharedKillSignComponent : Component { diff --git a/Content.Shared/Chemistry/EntitySystems/SolutionTransferSystem.cs b/Content.Shared/Chemistry/EntitySystems/SolutionTransferSystem.cs index 34a64d0edb..3bea79d345 100644 --- a/Content.Shared/Chemistry/EntitySystems/SolutionTransferSystem.cs +++ b/Content.Shared/Chemistry/EntitySystems/SolutionTransferSystem.cs @@ -42,7 +42,7 @@ public sealed class SolutionTransferSystem : EntitySystem var newTransferAmount = FixedPoint2.Clamp(message.Value, ent.Comp.MinimumTransferAmount, ent.Comp.MaximumTransferAmount); ent.Comp.TransferAmount = newTransferAmount; - if (message.Session.AttachedEntity is { Valid: true } user) + if (message.Actor is { Valid: true } user) _popup.PopupClient(Loc.GetString("comp-solution-transfer-set-amount", ("amount", newTransferAmount)), ent, user); } @@ -53,10 +53,9 @@ public sealed class SolutionTransferSystem : EntitySystem if (!args.CanAccess || !args.CanInteract || !comp.CanChangeTransferAmount || args.Hands == null) return; - if (!TryComp(args.User, out var actor)) - return; - // Custom transfer verb + var @event = args; + args.Verbs.Add(new AlternativeVerb() { Text = Loc.GetString("comp-solution-transfer-verb-custom-amount"), @@ -64,8 +63,7 @@ public sealed class SolutionTransferSystem : EntitySystem // TODO: remove server check when bui prediction is a thing Act = () => { - if (_net.IsServer) - _ui.TryOpen(uid, TransferAmountUiKey.Key, actor.PlayerSession); + _ui.OpenUi(uid, TransferAmountUiKey.Key, @event.User); }, Priority = 1 }); diff --git a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs index 83e09b1a6d..914b34d3c1 100644 --- a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs +++ b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs @@ -626,9 +626,9 @@ namespace Content.Shared.Containers.ItemSlots return; if (args.TryEject && slot.HasItem) - TryEjectToHands(uid, slot, args.Session.AttachedEntity, false); - else if (args.TryInsert && !slot.HasItem && args.Session.AttachedEntity is EntityUid user) - TryInsertFromHand(uid, slot, user); + TryEjectToHands(uid, slot, args.Actor, true); + else if (args.TryInsert && !slot.HasItem) + TryInsertFromHand(uid, slot, args.Actor); } #endregion diff --git a/Content.Shared/Content.Shared.csproj b/Content.Shared/Content.Shared.csproj index 4cca399b28..51a80dfd21 100644 --- a/Content.Shared/Content.Shared.csproj +++ b/Content.Shared/Content.Shared.csproj @@ -23,6 +23,9 @@ false + + + diff --git a/Content.Shared/Extinguisher/SharedFireExtinguisherComponent.cs b/Content.Shared/Extinguisher/SharedFireExtinguisherComponent.cs index 53d58f1d80..dbb1f6f2c4 100644 --- a/Content.Shared/Extinguisher/SharedFireExtinguisherComponent.cs +++ b/Content.Shared/Extinguisher/SharedFireExtinguisherComponent.cs @@ -1,8 +1,10 @@ using Robust.Shared.Audio; +using Robust.Shared.GameStates; using Robust.Shared.Serialization; namespace Content.Shared.Extinguisher; +[NetworkedComponent] public abstract partial class SharedFireExtinguisherComponent : Component { [DataField("refillSound")] public SoundSpecifier RefillSound = new SoundPathSpecifier("/Audio/Effects/refill.ogg"); diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index 2eabe14d23..1f421d0e6f 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -76,8 +76,11 @@ namespace Content.Shared.Interaction public override void Initialize() { + SubscribeLocalEvent(HandleUserInterfaceRangeCheck); SubscribeLocalEvent(OnBoundInterfaceInteractAttempt); + SubscribeAllEvent(HandleInteractInventorySlotEvent); + SubscribeLocalEvent(OnRemoveAttempt); SubscribeLocalEvent(OnUnequip); SubscribeLocalEvent(OnUnequipHand); @@ -108,7 +111,9 @@ namespace Content.Shared.Interaction /// private void OnBoundInterfaceInteractAttempt(BoundUserInterfaceMessageAttempt ev) { - if (ev.Sender.AttachedEntity is not { } user || !_actionBlockerSystem.CanInteract(user, ev.Target)) + var user = ev.Actor; + + if (!_actionBlockerSystem.CanInteract(user, ev.Target)) { ev.Cancel(); return; @@ -1145,6 +1150,21 @@ namespace Content.Shared.Interaction RaiseLocalEvent(uidA, new ContactInteractionEvent(uidB.Value)); RaiseLocalEvent(uidB.Value, new ContactInteractionEvent(uidA)); } + + private void HandleUserInterfaceRangeCheck(ref BoundUserInterfaceCheckRangeEvent ev) + { + if (ev.Result == BoundUserInterfaceRangeResult.Fail) + return; + + if (InRangeUnobstructed(ev.Actor, ev.Target, ev.Data.InteractionRange)) + { + ev.Result = BoundUserInterfaceRangeResult.Pass; + } + else + { + ev.Result = BoundUserInterfaceRangeResult.Fail; + } + } } /// diff --git a/Content.Shared/Paper/SharedPaperComponent.cs b/Content.Shared/Paper/SharedPaperComponent.cs index dd87f9f907..f65a599e53 100644 --- a/Content.Shared/Paper/SharedPaperComponent.cs +++ b/Content.Shared/Paper/SharedPaperComponent.cs @@ -1,8 +1,10 @@ using Robust.Shared.Audio; +using Robust.Shared.GameStates; using Robust.Shared.Serialization; namespace Content.Shared.Paper; +[NetworkedComponent] public abstract partial class SharedPaperComponent : Component { /// diff --git a/Content.Shared/Power/Components/ActivatableUIRequiresPowerComponent.cs b/Content.Shared/Power/Components/ActivatableUIRequiresPowerComponent.cs new file mode 100644 index 0000000000..af193c8dfc --- /dev/null +++ b/Content.Shared/Power/Components/ActivatableUIRequiresPowerComponent.cs @@ -0,0 +1,8 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Power.Components; + +[RegisterComponent, NetworkedComponent] +public sealed partial class ActivatableUIRequiresPowerComponent : Component +{ +} diff --git a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs index 3bec0e1d01..4670f2dbf8 100644 --- a/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs @@ -2,9 +2,12 @@ using System.Collections.Frozen; using System.Diagnostics.CodeAnalysis; using System.Linq; using Content.Shared.ActionBlocker; +using Content.Shared.Administration; +using Content.Shared.Administration.Managers; using Content.Shared.Containers.ItemSlots; using Content.Shared.Destructible; using Content.Shared.DoAfter; +using Content.Shared.Ghost; using Content.Shared.Hands.Components; using Content.Shared.Hands.EntitySystems; using Content.Shared.Implants.Components; @@ -29,6 +32,7 @@ using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization; +using Robust.Shared.Utility; namespace Content.Shared.Storage.EntitySystems; @@ -36,6 +40,7 @@ public abstract class SharedStorageSystem : EntitySystem { [Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] protected readonly IRobustRandom Random = default!; + [Dependency] private readonly ISharedAdminManager _admin = default!; [Dependency] protected readonly ActionBlockerSystem ActionBlocker = default!; [Dependency] private readonly EntityLookupSystem _entityLookupSystem = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; @@ -73,6 +78,7 @@ public abstract class SharedStorageSystem : EntitySystem private FrozenDictionary _nextSmallest = FrozenDictionary.Empty; private const string QuickInsertUseDelayID = "quickInsert"; + private const string OpenUiUseDelayID = "storage"; protected readonly List CantFillReasons = []; @@ -86,7 +92,13 @@ public abstract class SharedStorageSystem : EntitySystem _xformQuery = GetEntityQuery(); _prototype.PrototypesReloaded += OnPrototypesReloaded; + Subs.BuiEvents(StorageComponent.StorageUiKey.Key, subs => + { + subs.Event(OnBoundUIClosed); + }); + SubscribeLocalEvent(OnMapInit); + SubscribeLocalEvent>(AddUiVerb); SubscribeLocalEvent(OnStorageGetState); SubscribeLocalEvent(OnStorageHandleState); SubscribeLocalEvent(OnComponentInit, before: new[] { typeof(SharedContainerSystem) }); @@ -121,10 +133,13 @@ public abstract class SharedStorageSystem : EntitySystem UpdatePrototypeCache(); } - protected virtual void OnMapInit(Entity entity, ref MapInitEvent args) + private void OnMapInit(Entity entity, ref MapInitEvent args) { if (TryComp(entity, out var useDelayComp)) + { UseDelay.SetLength((entity, useDelayComp), entity.Comp.QuickInsertCooldown, QuickInsertUseDelayID); + UseDelay.SetLength((entity, useDelayComp), entity.Comp.OpenUiCooldown, OpenUiUseDelayID); + } } private void OnStorageGetState(EntityUid uid, StorageComponent component, ref ComponentGetState args) @@ -139,7 +154,6 @@ public abstract class SharedStorageSystem : EntitySystem args.State = new StorageComponentState() { Grid = new List(component.Grid), - IsUiOpen = component.IsUiOpen, MaxItemSize = component.MaxItemSize, StoredItems = storedItems, SavedLocations = component.SavedLocations @@ -153,7 +167,6 @@ public abstract class SharedStorageSystem : EntitySystem component.Grid.Clear(); component.Grid.AddRange(state.Grid); - component.IsUiOpen = state.IsUiOpen; component.MaxItemSize = state.MaxItemSize; component.StoredItems.Clear(); @@ -205,9 +218,108 @@ public abstract class SharedStorageSystem : EntitySystem UpdateAppearance((uid, storageComp, null)); } - public virtual void UpdateUI(Entity entity) {} + /// + /// If the user has nested-UIs open (e.g., PDA UI open when pda is in a backpack), close them. + /// + private void CloseNestedInterfaces(EntityUid uid, EntityUid actor, StorageComponent? storageComp = null) + { + if (!Resolve(uid, ref storageComp)) + return; - public virtual void OpenStorageUI(EntityUid uid, EntityUid entity, StorageComponent? storageComp = null, bool silent = false) { } + // for each containing thing + // if it has a storage comp + // ensure unsubscribe from session + // if it has a ui component + // close ui + foreach (var entity in storageComp.Container.ContainedEntities) + { + _ui.CloseUis(entity, actor); + } + } + + private void OnBoundUIClosed(EntityUid uid, StorageComponent storageComp, BoundUIClosedEvent args) + { + CloseNestedInterfaces(uid, args.Actor, storageComp); + + // If UI is closed for everyone + if (!_ui.IsUiOpen(uid, args.UiKey)) + { + UpdateAppearance((uid, storageComp, null)); + Audio.PlayPredicted(storageComp.StorageCloseSound, uid, args.Actor); + } + } + + private void AddUiVerb(EntityUid uid, StorageComponent component, GetVerbsEvent args) + { + var silent = false; + if (!args.CanAccess || !args.CanInteract || TryComp(uid, out var lockComponent) && lockComponent.Locked) + { + // we allow admins to open the storage anyways + if (!_admin.HasAdminFlag(args.User, AdminFlags.Admin)) + return; + + silent = true; + } + + silent |= HasComp(args.User); + + // Does this player currently have the storage UI open? + var uiOpen = _ui.IsUiOpen(uid, StorageComponent.StorageUiKey.Key, args.User); + + ActivationVerb verb = new() + { + Act = () => + { + if (uiOpen) + { + _ui.CloseUi(uid, StorageComponent.StorageUiKey.Key, args.User); + } + else + { + OpenStorageUI(uid, args.User, component, silent); + } + } + }; + + if (uiOpen) + { + verb.Text = Loc.GetString("comp-storage-verb-close-storage"); + verb.Icon = new SpriteSpecifier.Texture( + new("/Textures/Interface/VerbIcons/close.svg.192dpi.png")); + } + else + { + verb.Text = Loc.GetString("comp-storage-verb-open-storage"); + verb.Icon = new SpriteSpecifier.Texture( + new("/Textures/Interface/VerbIcons/open.svg.192dpi.png")); + } + args.Verbs.Add(verb); + } + + /// + /// Opens the storage UI for an entity + /// + /// The entity to open the UI for + public void OpenStorageUI(EntityUid uid, EntityUid entity, StorageComponent? storageComp = null, bool silent = false) + { + if (!Resolve(uid, ref storageComp, false)) + return; + + // prevent spamming bag open / honkerton honk sound + silent |= TryComp(uid, out var useDelay) && UseDelay.IsDelayed((uid, useDelay)); + if (!silent) + { + if (!_ui.IsUiOpen(uid, StorageComponent.StorageUiKey.Key)) + Audio.PlayPredicted(storageComp.StorageOpenSound, uid, entity); + + if (useDelay != null) + UseDelay.TryResetDelay((uid, useDelay)); + } + + _ui.OpenUi(uid, StorageComponent.StorageUiKey.Key, entity); + } + + public virtual void UpdateUI(Entity entity) {} private void AddTransferVerbs(EntityUid uid, StorageComponent component, GetVerbsEvent args) { @@ -261,7 +373,16 @@ public abstract class SharedStorageSystem : EntitySystem if (args.Handled || TryComp(uid, out var lockComponent) && lockComponent.Locked) return; - OpenStorageUI(uid, args.User, storageComp); + // Toggle + if (_ui.IsUiOpen(uid, StorageComponent.StorageUiKey.Key, args.User)) + { + _ui.CloseUi(uid, StorageComponent.StorageUiKey.Key, args.User); + } + else + { + OpenStorageUI(uid, args.User, storageComp); + } + args.Handled = true; } @@ -460,8 +581,7 @@ public abstract class SharedStorageSystem : EntitySystem if (!TryComp(uid, out var storageComp)) return; - if (!_ui.TryGetUi(uid, StorageComponent.StorageUiKey.Key, out var bui) || - !bui.SubscribedSessions.Contains(args.SenderSession)) + if (!_ui.IsUiOpen(uid, StorageComponent.StorageUiKey.Key, player)) return; if (!Exists(entity)) @@ -503,8 +623,7 @@ public abstract class SharedStorageSystem : EntitySystem if (!TryComp(storageEnt, out var storageComp)) return; - if (!_ui.TryGetUi(storageEnt, StorageComponent.StorageUiKey.Key, out var bui) || - !bui.SubscribedSessions.Contains(args.SenderSession)) + if (!_ui.IsUiOpen(storageEnt, StorageComponent.StorageUiKey.Key, player)) return; if (!Exists(itemEnt)) @@ -530,8 +649,7 @@ public abstract class SharedStorageSystem : EntitySystem if (!TryComp(storageEnt, out var storageComp)) return; - if (!_ui.TryGetUi(storageEnt, StorageComponent.StorageUiKey.Key, out var bui) || - !bui.SubscribedSessions.Contains(args.SenderSession)) + if (!_ui.IsUiOpen(storageEnt, StorageComponent.StorageUiKey.Key, player)) return; if (!Exists(itemEnt)) @@ -558,8 +676,7 @@ public abstract class SharedStorageSystem : EntitySystem if (!TryComp(storageEnt, out var storageComp)) return; - if (!_ui.TryGetUi(storageEnt, StorageComponent.StorageUiKey.Key, out var bui) || - !bui.SubscribedSessions.Contains(args.SenderSession)) + if (!_ui.IsUiOpen(storageEnt, StorageComponent.StorageUiKey.Key, player)) return; if (!Exists(itemEnt)) @@ -584,11 +701,10 @@ public abstract class SharedStorageSystem : EntitySystem var storage = GetEntity(msg.Storage); var item = GetEntity(msg.Item); - if (!TryComp(storage, out var storageComp)) + if (!HasComp(storage)) return; - if (!_ui.TryGetUi(storage, StorageComponent.StorageUiKey.Key, out var bui) || - !bui.SubscribedSessions.Contains(args.SenderSession)) + if (!_ui.IsUiOpen(storage, StorageComponent.StorageUiKey.Key, player)) return; if (!Exists(item)) @@ -605,11 +721,7 @@ public abstract class SharedStorageSystem : EntitySystem private void OnBoundUIOpen(EntityUid uid, StorageComponent storageComp, BoundUIOpenedEvent args) { - if (!storageComp.IsUiOpen) - { - storageComp.IsUiOpen = true; - UpdateAppearance((uid, storageComp, null)); - } + UpdateAppearance((uid, storageComp, null)); } private void OnEntInserted(Entity entity, ref EntInsertedIntoContainerMessage args) @@ -687,11 +799,13 @@ public abstract class SharedStorageSystem : EntitySystem var capacity = storage.Grid.GetArea(); var used = GetCumulativeItemAreas((uid, storage)); + var isOpen = _ui.IsUiOpen(entity.Owner, StorageComponent.StorageUiKey.Key); + _appearance.SetData(uid, StorageVisuals.StorageUsed, used, appearance); _appearance.SetData(uid, StorageVisuals.Capacity, capacity, appearance); - _appearance.SetData(uid, StorageVisuals.Open, storage.IsUiOpen, appearance); - _appearance.SetData(uid, SharedBagOpenVisuals.BagState, storage.IsUiOpen ? SharedBagState.Open : SharedBagState.Closed, appearance); - _appearance.SetData(uid, StackVisuals.Hide, !storage.IsUiOpen, appearance); + _appearance.SetData(uid, StorageVisuals.Open, isOpen, appearance); + _appearance.SetData(uid, SharedBagOpenVisuals.BagState, isOpen ? SharedBagState.Open : SharedBagState.Closed, appearance); + _appearance.SetData(uid, StackVisuals.Hide, !isOpen, appearance); } /// @@ -1343,8 +1457,6 @@ public abstract class SharedStorageSystem : EntitySystem [Serializable, NetSerializable] protected sealed class StorageComponentState : ComponentState { - public bool IsUiOpen; - public Dictionary StoredItems = new(); public Dictionary> SavedLocations = new(); diff --git a/Content.Shared/Storage/StorageComponent.cs b/Content.Shared/Storage/StorageComponent.cs index 43a93e4b0f..ef682dd4f9 100644 --- a/Content.Shared/Storage/StorageComponent.cs +++ b/Content.Shared/Storage/StorageComponent.cs @@ -19,10 +19,6 @@ namespace Content.Shared.Storage { public static string ContainerId = "storagebase"; - // TODO: This fucking sucks - [ViewVariables(VVAccess.ReadWrite), DataField] - public bool IsUiOpen; - [ViewVariables] public Container Container = default!; @@ -232,15 +228,6 @@ namespace Content.Shared.Storage } } - /// - /// An extra BUI message that either opens, closes, or focuses the storage window based on context. - /// - [Serializable, NetSerializable] - public sealed class StorageModifyWindowMessage : BoundUserInterfaceMessage - { - - } - [NetSerializable] [Serializable] public enum StorageVisuals : byte diff --git a/Content.Server/UserInterface/ActivatableUIComponent.cs b/Content.Shared/UserInterface/ActivatableUIComponent.cs similarity index 87% rename from Content.Server/UserInterface/ActivatableUIComponent.cs rename to Content.Shared/UserInterface/ActivatableUIComponent.cs index cc0e5008e4..74e6134932 100644 --- a/Content.Server/UserInterface/ActivatableUIComponent.cs +++ b/Content.Shared/UserInterface/ActivatableUIComponent.cs @@ -1,16 +1,14 @@ using Content.Shared.Whitelist; -using Robust.Server.GameObjects; -using Robust.Server.Player; -using Robust.Shared.Player; +using Robust.Shared.GameStates; using Robust.Shared.Serialization.TypeSerializers.Implementations; -namespace Content.Server.UserInterface +namespace Content.Shared.UserInterface { - [RegisterComponent] + [RegisterComponent, NetworkedComponent] public sealed partial class ActivatableUIComponent : Component { - [DataField(required: true, customTypeSerializer:typeof(EnumSerializer))] - public Enum? Key { get; set; } + [DataField(required: true, customTypeSerializer: typeof(EnumSerializer))] + public Enum Key { get; set; } = default!; [ViewVariables(VVAccess.ReadWrite)] [DataField] @@ -70,6 +68,6 @@ namespace Content.Server.UserInterface /// NOTE: DO NOT DIRECTLY SET, USE ActivatableUISystem.SetCurrentSingleUser /// [ViewVariables] - public ICommonSession? CurrentSingleUser; + public EntityUid? CurrentSingleUser; } } diff --git a/Content.Shared/UserInterface/ActivatableUIEvents.cs b/Content.Shared/UserInterface/ActivatableUIEvents.cs index 6e6b3f63c6..338673a3ca 100644 --- a/Content.Shared/UserInterface/ActivatableUIEvents.cs +++ b/Content.Shared/UserInterface/ActivatableUIEvents.cs @@ -24,12 +24,12 @@ public sealed class UserOpenActivatableUIAttemptEvent : CancellableEntityEventAr public sealed class AfterActivatableUIOpenEvent : EntityEventArgs { public EntityUid User { get; } - public readonly ICommonSession Session; + public readonly EntityUid Actor; - public AfterActivatableUIOpenEvent(EntityUid who, ICommonSession session) + public AfterActivatableUIOpenEvent(EntityUid who, EntityUid actor) { User = who; - Session = session; + Actor = actor; } } diff --git a/Content.Server/UserInterface/ActivatableUIRequiresPowerCellComponent.cs b/Content.Shared/UserInterface/ActivatableUIRequiresPowerCellComponent.cs similarity index 65% rename from Content.Server/UserInterface/ActivatableUIRequiresPowerCellComponent.cs rename to Content.Shared/UserInterface/ActivatableUIRequiresPowerCellComponent.cs index fdc56f89a0..aa9e561e07 100644 --- a/Content.Server/UserInterface/ActivatableUIRequiresPowerCellComponent.cs +++ b/Content.Shared/UserInterface/ActivatableUIRequiresPowerCellComponent.cs @@ -1,13 +1,12 @@ -using Content.Server.PowerCell; using Content.Shared.PowerCell; -using Content.Shared.UserInterface; +using Robust.Shared.GameStates; -namespace Content.Server.UserInterface; +namespace Content.Shared.UserInterface; /// /// Specifies that the attached entity requires power. /// -[RegisterComponent] +[RegisterComponent, NetworkedComponent] public sealed partial class ActivatableUIRequiresPowerCellComponent : Component { diff --git a/Content.Server/UserInterface/ActivatableUISystem.Power.cs b/Content.Shared/UserInterface/ActivatableUISystem.Power.cs similarity index 82% rename from Content.Server/UserInterface/ActivatableUISystem.Power.cs rename to Content.Shared/UserInterface/ActivatableUISystem.Power.cs index d4dcc91d46..c904224328 100644 --- a/Content.Server/UserInterface/ActivatableUISystem.Power.cs +++ b/Content.Shared/UserInterface/ActivatableUISystem.Power.cs @@ -1,13 +1,11 @@ -using Content.Server.PowerCell; using Content.Shared.PowerCell; -using Content.Shared.UserInterface; using Robust.Shared.Containers; -namespace Content.Server.UserInterface; +namespace Content.Shared.UserInterface; public sealed partial class ActivatableUISystem { - [Dependency] private readonly PowerCellSystem _cell = default!; + [Dependency] private readonly SharedPowerCellSystem _cell = default!; private void InitializePower() { @@ -23,10 +21,9 @@ public sealed partial class ActivatableUISystem _cell.SetPowerCellDrawEnabled(uid, false); if (HasComp(uid) && - TryComp(uid, out var activatable) && - activatable.Key != null) + TryComp(uid, out var activatable)) { - _uiSystem.TryCloseAll(uid, activatable.Key); + _uiSystem.CloseUi(uid, activatable.Key); } } @@ -57,13 +54,13 @@ public sealed partial class ActivatableUISystem /// public void CheckUsage(EntityUid uid, ActivatableUIComponent? active = null, ActivatableUIRequiresPowerCellComponent? component = null, PowerCellDrawComponent? draw = null) { - if (!Resolve(uid, ref component, ref draw, ref active, false) || active.Key == null) + if (!Resolve(uid, ref component, ref draw, ref active, false)) return; - if (_cell.HasCharge(uid, draw.UseRate)) + if (_cell.HasActivatableCharge(uid)) return; - _uiSystem.TryCloseAll(uid, active.Key); + _uiSystem.CloseUi(uid, active.Key); } private void OnBatteryOpenAttempt(EntityUid uid, ActivatableUIRequiresPowerCellComponent component, ActivatableUIOpenAttemptEvent args) @@ -72,10 +69,11 @@ public sealed partial class ActivatableUISystem return; // Check if we have the appropriate drawrate / userate to even open it. - if (args.Cancelled || !_cell.HasCharge(uid, MathF.Max(draw.DrawRate, draw.UseRate), user: args.User)) + if (args.Cancelled || + !_cell.HasActivatableCharge(uid, draw, user: args.User) || + !_cell.HasDrawCharge(uid, draw, user: args.User)) { args.Cancel(); - return; } } } diff --git a/Content.Server/UserInterface/ActivatableUISystem.cs b/Content.Shared/UserInterface/ActivatableUISystem.cs similarity index 81% rename from Content.Server/UserInterface/ActivatableUISystem.cs rename to Content.Shared/UserInterface/ActivatableUISystem.cs index 5f2314df90..bfe8491b15 100644 --- a/Content.Server/UserInterface/ActivatableUISystem.cs +++ b/Content.Shared/UserInterface/ActivatableUISystem.cs @@ -1,23 +1,21 @@ -using Content.Server.Administration.Managers; using Content.Shared.ActionBlocker; +using Content.Shared.Administration.Managers; using Content.Shared.Ghost; using Content.Shared.Hands; using Content.Shared.Hands.Components; using Content.Shared.Interaction; using Content.Shared.Interaction.Events; using Content.Shared.Popups; -using Content.Shared.UserInterface; using Content.Shared.Verbs; -using Robust.Server.GameObjects; using Robust.Shared.Player; -namespace Content.Server.UserInterface; +namespace Content.Shared.UserInterface; public sealed partial class ActivatableUISystem : EntitySystem { - [Dependency] private readonly IAdminManager _adminManager = default!; + [Dependency] private readonly ISharedAdminManager _adminManager = default!; [Dependency] private readonly ActionBlockerSystem _blockerSystem = default!; - [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; + [Dependency] private readonly SharedUserInterfaceSystem _uiSystem = default!; [Dependency] private readonly SharedPopupSystem _popupSystem = default!; public override void Initialize() @@ -49,7 +47,7 @@ public sealed partial class ActivatableUISystem : EntitySystem if (!comp.RequireHands) return; - if (!TryComp(ev.Sender.AttachedEntity, out HandsComponent? hands) || hands.Hands.Count == 0) + if (!TryComp(ev.Actor, out HandsComponent? hands) || hands.Hands.Count == 0) ev.Cancel(); } @@ -128,7 +126,9 @@ public sealed partial class ActivatableUISystem : EntitySystem private void OnUIClose(EntityUid uid, ActivatableUIComponent component, BoundUIClosedEvent args) { - if (args.Session != component.CurrentSingleUser) + var user = args.Actor; + + if (user != component.CurrentSingleUser) return; if (!Equals(args.UiKey, component.Key)) @@ -139,18 +139,12 @@ public sealed partial class ActivatableUISystem : EntitySystem private bool InteractUI(EntityUid user, EntityUid uiEntity, ActivatableUIComponent aui) { - if (!TryComp(user, out ActorComponent? actor)) + if (!_uiSystem.HasUi(uiEntity, aui.Key)) return false; - if (aui.Key == null) - return false; - - if (!_uiSystem.TryGetUi(uiEntity, aui.Key, out var ui)) - return false; - - if (ui.SubscribedSessions.Contains(actor.PlayerSession)) + if (_uiSystem.IsUiOpen(uiEntity, aui.Key, user)) { - _uiSystem.CloseUi(ui, actor.PlayerSession); + _uiSystem.CloseUi(uiEntity, aui.Key, user); return true; } @@ -160,10 +154,10 @@ public sealed partial class ActivatableUISystem : EntitySystem if (aui.RequireHands && !HasComp(user)) return false; - if (aui.AdminOnly && !_adminManager.IsAdmin(actor.PlayerSession)) + if (aui.AdminOnly && !_adminManager.IsAdmin(user)) return false; - if (aui.SingleUser && (aui.CurrentSingleUser != null) && (actor.PlayerSession != aui.CurrentSingleUser)) + if (aui.SingleUser && aui.CurrentSingleUser != null && user != aui.CurrentSingleUser) { string message = Loc.GetString("machine-already-in-use", ("machine", uiEntity)); _popupSystem.PopupEntity(message, uiEntity, user); @@ -171,7 +165,7 @@ public sealed partial class ActivatableUISystem : EntitySystem // If we get here, supposedly, the object is in use. // Check with BUI that it's ACTUALLY in use just in case. // Since this could brick the object if it goes wrong. - if (ui.SubscribedSessions.Count != 0) + if (_uiSystem.IsUiOpen(uiEntity, aui.Key)) return false; } @@ -189,24 +183,25 @@ public sealed partial class ActivatableUISystem : EntitySystem var bae = new BeforeActivatableUIOpenEvent(user); RaiseLocalEvent(uiEntity, bae); - SetCurrentSingleUser(uiEntity, actor.PlayerSession, aui); - _uiSystem.OpenUi(ui, actor.PlayerSession); + SetCurrentSingleUser(uiEntity, user, aui); + _uiSystem.OpenUi(uiEntity, aui.Key, user); //Let the component know a user opened it so it can do whatever it needs to do - var aae = new AfterActivatableUIOpenEvent(user, actor.PlayerSession); + var aae = new AfterActivatableUIOpenEvent(user, user); RaiseLocalEvent(uiEntity, aae); return true; } - public void SetCurrentSingleUser(EntityUid uid, ICommonSession? v, ActivatableUIComponent? aui = null) + public void SetCurrentSingleUser(EntityUid uid, EntityUid? user, ActivatableUIComponent? aui = null) { if (!Resolve(uid, ref aui)) return; + if (!aui.SingleUser) return; - aui.CurrentSingleUser = v; + aui.CurrentSingleUser = user; RaiseLocalEvent(uid, new ActivatableUIPlayerChangedEvent()); } @@ -216,10 +211,10 @@ public sealed partial class ActivatableUISystem : EntitySystem if (!Resolve(uid, ref aui, false)) return; - if (aui.Key == null || !_uiSystem.TryGetUi(uid, aui.Key, out var ui)) + if (!_uiSystem.HasUi(uid, aui.Key)) return; - _uiSystem.CloseAll(ui); + _uiSystem.CloseUi(uid, aui.Key); } private void OnHandDeselected(EntityUid uid, ActivatableUIComponent? aui, HandDeselectedEvent args) diff --git a/Resources/Prototypes/Catalog/Fills/Paper/manuals.yml b/Resources/Prototypes/Catalog/Fills/Paper/manuals.yml index e13070d1ba..4893fa2557 100644 --- a/Resources/Prototypes/Catalog/Fills/Paper/manuals.yml +++ b/Resources/Prototypes/Catalog/Fills/Paper/manuals.yml @@ -19,7 +19,7 @@ key: enum.PaperUiKey.Key - type: UserInterface interfaces: - - key: enum.PaperUiKey.Key - type: PaperBoundUserInterface + enum.PaperUiKey.Key: + type: PaperBoundUserInterface - type: Paper content: book-text-holoparasite-info diff --git a/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml b/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml index a69c770f40..5d9fc64e12 100644 --- a/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml +++ b/Resources/Prototypes/Entities/Clothing/Back/backpacks.yml @@ -23,8 +23,8 @@ ents: [] - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface # to prevent bag open/honk spam - type: UseDelay delay: 0.5 @@ -267,7 +267,7 @@ - type: Sprite sprite: Clothing/Back/Backpacks/syndicate.rsi - type: ExplosionResistance - damageCoefficient: 0.1 + damageCoefficient: 0.1 #Special - type: entity diff --git a/Resources/Prototypes/Entities/Clothing/Back/specific.yml b/Resources/Prototypes/Entities/Clothing/Back/specific.yml index 8af00039b5..fcdecffc8f 100644 --- a/Resources/Prototypes/Entities/Clothing/Back/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Back/specific.yml @@ -14,9 +14,9 @@ default: ClothingBackpack - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key + enum.StorageUiKey.Key: type: StorageBoundUserInterface - - key: enum.ChameleonUiKey.Key + enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface - type: entity @@ -51,8 +51,8 @@ canChangeTransferAmount: true - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: DrawableSolution solution: tank - type: RefillableSolution diff --git a/Resources/Prototypes/Entities/Clothing/Belt/base_clothingbelt.yml b/Resources/Prototypes/Entities/Clothing/Belt/base_clothingbelt.yml index 703730daf3..76af5067ae 100644 --- a/Resources/Prototypes/Entities/Clothing/Belt/base_clothingbelt.yml +++ b/Resources/Prototypes/Entities/Clothing/Belt/base_clothingbelt.yml @@ -36,8 +36,8 @@ ents: [] - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: entity abstract: true diff --git a/Resources/Prototypes/Entities/Clothing/Ears/specific.yml b/Resources/Prototypes/Entities/Clothing/Ears/specific.yml index 093f5e645b..83612ac4b2 100644 --- a/Resources/Prototypes/Entities/Clothing/Ears/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Ears/specific.yml @@ -16,5 +16,5 @@ default: ClothingHeadsetGrey - type: UserInterface interfaces: - - key: enum.ChameleonUiKey.Key + enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface diff --git a/Resources/Prototypes/Entities/Clothing/Eyes/specific.yml b/Resources/Prototypes/Entities/Clothing/Eyes/specific.yml index c04f348287..fa87ed398e 100644 --- a/Resources/Prototypes/Entities/Clothing/Eyes/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Eyes/specific.yml @@ -16,6 +16,6 @@ default: ClothingEyesGlassesSunglasses - type: UserInterface interfaces: - - key: enum.ChameleonUiKey.Key + enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface diff --git a/Resources/Prototypes/Entities/Clothing/Hands/gloves.yml b/Resources/Prototypes/Entities/Clothing/Hands/gloves.yml index 96bdd61f94..02ec58bd67 100644 --- a/Resources/Prototypes/Entities/Clothing/Hands/gloves.yml +++ b/Resources/Prototypes/Entities/Clothing/Hands/gloves.yml @@ -377,7 +377,7 @@ - type: Actions - type: UserInterface interfaces: - - key: enum.MeleeSpeechUiKey.Key + enum.MeleeSpeechUiKey.Key: type: MeleeSpeechBoundUserInterface - type: StaticPrice price: 0 diff --git a/Resources/Prototypes/Entities/Clothing/Hands/specific.yml b/Resources/Prototypes/Entities/Clothing/Hands/specific.yml index e6a5731999..6140bcd8ed 100644 --- a/Resources/Prototypes/Entities/Clothing/Hands/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Hands/specific.yml @@ -19,9 +19,9 @@ - type: FingerprintMask - type: UserInterface interfaces: - - key: enum.ChameleonUiKey.Key + enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface - + - type: entity parent: ClothingHandsChameleon id: ClothingHandsChameleonThief diff --git a/Resources/Prototypes/Entities/Clothing/Head/hats.yml b/Resources/Prototypes/Entities/Clothing/Head/hats.yml index ec0921c512..a844fd724a 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/hats.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/hats.yml @@ -245,7 +245,7 @@ - 0,0,0,0 - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key + enum.StorageUiKey.Key: type: StorageBoundUserInterface - type: ContainerContainer containers: @@ -834,8 +834,8 @@ - 0,0,0,0 - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: ContainerContainer containers: storagebase: !type:Container diff --git a/Resources/Prototypes/Entities/Clothing/Head/specific.yml b/Resources/Prototypes/Entities/Clothing/Head/specific.yml index 1dd36bff94..636f922d85 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/specific.yml @@ -16,5 +16,5 @@ default: ClothingHeadHatBeret - type: UserInterface interfaces: - - key: enum.ChameleonUiKey.Key + enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface diff --git a/Resources/Prototypes/Entities/Clothing/Masks/specific.yml b/Resources/Prototypes/Entities/Clothing/Masks/specific.yml index 0a0fc68469..7f758a27d2 100644 --- a/Resources/Prototypes/Entities/Clothing/Masks/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Masks/specific.yml @@ -18,7 +18,7 @@ - type: IdentityBlocker # need that for default ClothingMaskGas - type: UserInterface interfaces: - - key: enum.ChameleonUiKey.Key + enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface - type: HideLayerClothing slots: diff --git a/Resources/Prototypes/Entities/Clothing/Neck/specific.yml b/Resources/Prototypes/Entities/Clothing/Neck/specific.yml index 1f50dc1ef1..56fddceaad 100644 --- a/Resources/Prototypes/Entities/Clothing/Neck/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Neck/specific.yml @@ -16,5 +16,5 @@ default: ClothingNeckScarfStripedRed - type: UserInterface interfaces: - - key: enum.ChameleonUiKey.Key + enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/base_clothingouter.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/base_clothingouter.yml index 987d3c2f24..e5067e84c5 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/base_clothingouter.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/base_clothingouter.yml @@ -38,8 +38,8 @@ ents: [] - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: StaticPrice price: 70 diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/specific.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/specific.yml index 9be8c22a0a..c3d9bb1224 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/specific.yml @@ -16,5 +16,5 @@ default: ClothingOuterVest - type: UserInterface interfaces: - - key: enum.ChameleonUiKey.Key + enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/magboots.yml b/Resources/Prototypes/Entities/Clothing/Shoes/magboots.yml index 880239b51e..485d530ea5 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/magboots.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/magboots.yml @@ -110,7 +110,7 @@ key: enum.SharedGasTankUiKey.Key - type: UserInterface interfaces: - - key: enum.SharedGasTankUiKey.Key + enum.SharedGasTankUiKey.Key: type: GasTankBoundUserInterface - type: Explosive explosionType: Default diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml index 987eda582e..4ae752345a 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml @@ -185,7 +185,7 @@ default: ClothingShoesColorBlack - type: UserInterface interfaces: - - key: enum.ChameleonUiKey.Key + enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface - type: entity diff --git a/Resources/Prototypes/Entities/Clothing/Uniforms/specific.yml b/Resources/Prototypes/Entities/Clothing/Uniforms/specific.yml index ad02f4aa67..a2c903bac3 100644 --- a/Resources/Prototypes/Entities/Clothing/Uniforms/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Uniforms/specific.yml @@ -38,5 +38,5 @@ default: ClothingUniformJumpsuitColorBlack - type: UserInterface interfaces: - - key: enum.ChameleonUiKey.Key - type: ChameleonBoundUserInterface \ No newline at end of file + enum.ChameleonUiKey.Key: + type: ChameleonBoundUserInterface diff --git a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml index 9907c5f71f..27a19ab899 100644 --- a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml +++ b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml @@ -63,12 +63,12 @@ locPrefix: silicon - type: UserInterface interfaces: - - key: enum.SiliconLawsUiKey.Key - type: SiliconLawBoundUserInterface - - key: enum.BorgUiKey.Key - type: BorgBoundUserInterface - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.SiliconLawsUiKey.Key: + type: SiliconLawBoundUserInterface + enum.BorgUiKey.Key: + type: BorgBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: ActivatableUI key: enum.BorgUiKey.Key - type: SiliconLawBound diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index 819c7beacf..c0a99ec8a0 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -1077,8 +1077,8 @@ - id: FoodMeat - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: DamageStateVisuals states: Alive: @@ -1169,8 +1169,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: Sprite drawdepth: Mobs layers: @@ -2283,8 +2283,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: DamageStateVisuals states: Alive: @@ -2358,8 +2358,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: DamageStateVisuals states: Alive: @@ -2422,8 +2422,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: DamageStateVisuals states: Alive: @@ -2499,8 +2499,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: DamageStateVisuals states: Alive: @@ -2648,8 +2648,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: DamageStateVisuals states: Alive: @@ -2857,8 +2857,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: DamageStateVisuals states: Alive: @@ -2914,8 +2914,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: DamageStateVisuals states: Alive: @@ -3007,8 +3007,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: DamageStateVisuals states: Alive: @@ -3124,8 +3124,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: DamageStateVisuals states: Alive: @@ -3188,8 +3188,8 @@ bloodMaxVolume: 60 - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: DamageStateVisuals states: Alive: diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/behonker.yml b/Resources/Prototypes/Entities/Mobs/NPCs/behonker.yml index 8a10337c94..6aea0e89b0 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/behonker.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/behonker.yml @@ -76,8 +76,8 @@ - id: BikeHorn - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: MobThresholds thresholds: 0: Alive diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml b/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml index 747268466a..f6cf36196f 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/pets.yml @@ -211,8 +211,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: DamageStateVisuals states: Alive: @@ -274,8 +274,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: DamageStateVisuals states: Alive: @@ -373,8 +373,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: DamageStateVisuals states: Alive: diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml b/Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml index 68ebf52dc0..83d3dbd069 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml @@ -75,8 +75,8 @@ softness: 1 - type: UserInterface interfaces: - - key: enum.StoreUiKey.Key - type: StoreBoundUserInterface + enum.StoreUiKey.Key: + type: StoreBoundUserInterface - type: Visibility layer: 2 #ghost vis layer - type: Store diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/silicon.yml b/Resources/Prototypes/Entities/Mobs/NPCs/silicon.yml index 9a4d4ec3aa..c808ed2d21 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/silicon.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/silicon.yml @@ -300,8 +300,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: Sprite layers: - map: ["enum.DamageStateVisualLayers.Base"] diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/space.yml b/Resources/Prototypes/Entities/Mobs/NPCs/space.yml index eeee640225..8cfd199dca 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/space.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/space.yml @@ -171,8 +171,8 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface - type: entity id: MobKangarooSpaceSalvage diff --git a/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml b/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml index af18791fa7..38092e3aa7 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/admin_ghost.yml @@ -34,32 +34,32 @@ - CentralCommand - type: UserInterface interfaces: - - key: enum.SolarControlConsoleUiKey.Key + enum.SolarControlConsoleUiKey.Key: type: SolarControlConsoleBoundUserInterface - - key: enum.CommunicationsConsoleUiKey.Key + enum.CommunicationsConsoleUiKey.Key: type: CommunicationsConsoleBoundUserInterface - - key: enum.RadarConsoleUiKey.Key + enum.RadarConsoleUiKey.Key: type: RadarConsoleBoundUserInterface - - key: enum.CargoConsoleUiKey.Orders + enum.CargoConsoleUiKey.Orders: type: CargoOrderConsoleBoundUserInterface - - key: enum.CrewMonitoringUIKey.Key + enum.CrewMonitoringUIKey.Key: type: CrewMonitoringBoundUserInterface - - key: enum.GeneralStationRecordConsoleKey.Key - # who the fuck named this bruh + enum.GeneralStationRecordConsoleKey.Key: + # who the fuck named this bruh type: GeneralStationRecordConsoleBoundUserInterface - type: IntrinsicUI uis: - - key: enum.SolarControlConsoleUiKey.Key + enum.SolarControlConsoleUiKey.Key: toggleAction: ActionAGhostShowSolar - - key: enum.CommunicationsConsoleUiKey.Key + enum.CommunicationsConsoleUiKey.Key: toggleAction: ActionAGhostShowCommunications - - key: enum.RadarConsoleUiKey.Key + enum.RadarConsoleUiKey.Key: toggleAction: ActionAGhostShowRadar - - key: enum.CargoConsoleUiKey.Orders + enum.CargoConsoleUiKey.Orders: toggleAction: ActionAGhostShowCargo - - key: enum.CrewMonitoringUIKey.Key + enum.CrewMonitoringUIKey.Key: toggleAction: ActionAGhostShowCrewMonitoring - - key: enum.GeneralStationRecordConsoleKey.Key + enum.GeneralStationRecordConsoleKey.Key: toggleAction: ActionAGhostShowStationRecords - type: SolarControlConsole # look ma i AM the computer! - type: CommunicationsConsole diff --git a/Resources/Prototypes/Entities/Mobs/Player/guardian.yml b/Resources/Prototypes/Entities/Mobs/Player/guardian.yml index ae4a370f9d..26c0ae30ec 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/guardian.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/guardian.yml @@ -95,8 +95,8 @@ - type: MeleeSpeech - type: UserInterface interfaces: - - key: enum.MeleeSpeechUiKey.Key - type: MeleeSpeechBoundUserInterface + enum.MeleeSpeechUiKey.Key: + type: MeleeSpeechBoundUserInterface - type: Actions - type: Guardian - type: InteractionPopup diff --git a/Resources/Prototypes/Entities/Mobs/Species/base.yml b/Resources/Prototypes/Entities/Mobs/Species/base.yml index cf04d82b50..01b938ffa8 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/base.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/base.yml @@ -192,11 +192,11 @@ - type: Strippable - type: UserInterface interfaces: - - key: enum.VoiceMaskUIKey.Key + enum.VoiceMaskUIKey.Key: type: VoiceMaskBoundUserInterface - - key: enum.HumanoidMarkingModifierKey.Key + enum.HumanoidMarkingModifierKey.Key: type: HumanoidMarkingModifierBoundUserInterface - - key: enum.StrippingUiKey.Key + enum.StrippingUiKey.Key: type: StrippableBoundUserInterface - type: Puller - type: Speech @@ -372,5 +372,5 @@ requiredLegs: 2 - type: UserInterface interfaces: - - key: enum.HumanoidMarkingModifierKey.Key # sure, this can go here too + enum.HumanoidMarkingModifierKey.Key: # sure, this can go here too type: HumanoidMarkingModifierBoundUserInterface diff --git a/Resources/Prototypes/Entities/Mobs/Species/slime.yml b/Resources/Prototypes/Entities/Mobs/Species/slime.yml index de2f88e59d..081973c3d2 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/slime.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/slime.yml @@ -26,14 +26,14 @@ ents: [] - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface - - key: enum.VoiceMaskUIKey.Key - type: VoiceMaskBoundUserInterface - - key: enum.HumanoidMarkingModifierKey.Key - type: HumanoidMarkingModifierBoundUserInterface - - key: enum.StrippingUiKey.Key - type: StrippableBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface + enum.VoiceMaskUIKey.Key: + type: VoiceMaskBoundUserInterface + enum.HumanoidMarkingModifierKey.Key: + type: HumanoidMarkingModifierBoundUserInterface + enum.StrippingUiKey.Key: + type: StrippableBoundUserInterface # to prevent bag open/honk spam - type: UseDelay delay: 0.5 diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml index e8ae787636..a729eed9c8 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml @@ -33,8 +33,8 @@ solution: drink - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: entity parent: DrinkBase diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml index ca67e51792..5d092673ed 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cans.yml @@ -21,8 +21,8 @@ maxTransferAmount: 15 - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: Sprite state: icon layers: diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cups.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cups.yml index 763c4210ae..156cd5a767 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cups.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_cups.yml @@ -25,8 +25,8 @@ maxTransferAmount: 10 - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: Drink - type: Sprite state: icon diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_special.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_special.yml index 829d68279d..ad2e760141 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_special.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks_special.yml @@ -29,8 +29,8 @@ state: icon - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: PhysicalComposition materialComposition: Steel: 50 diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/trash_drinks.yml b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/trash_drinks.yml index 67154963d1..a6b14d722d 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Drinks/trash_drinks.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Drinks/trash_drinks.yml @@ -39,8 +39,8 @@ solution: drink - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: DamageOnLand damage: types: @@ -122,8 +122,8 @@ solution: drink - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: Damageable damageContainer: Inorganic - type: Destructible diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Food/Containers/bowl.yml b/Resources/Prototypes/Entities/Objects/Consumable/Food/Containers/bowl.yml index 70303cfdff..40cb141af7 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Food/Containers/bowl.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Food/Containers/bowl.yml @@ -37,8 +37,8 @@ canChangeTransferAmount: true - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: Destructible thresholds: - trigger: diff --git a/Resources/Prototypes/Entities/Objects/Devices/Electronics/door.yml b/Resources/Prototypes/Entities/Objects/Devices/Electronics/door.yml index 670b556e35..ada46c5d02 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/Electronics/door.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/Electronics/door.yml @@ -21,5 +21,5 @@ - DoorElectronicsConfigurator - type: UserInterface interfaces: - - key: enum.DoorElectronicsConfigurationUiKey.Key - type: DoorElectronicsBoundUserInterface + enum.DoorElectronicsConfigurationUiKey.Key: + type: DoorElectronicsBoundUserInterface diff --git a/Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/war_declarator.yml b/Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/war_declarator.yml index 08e96d1de2..c0ce4cba18 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/war_declarator.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/war_declarator.yml @@ -18,7 +18,7 @@ key: enum.WarDeclaratorUiKey.Key - type: UserInterface interfaces: - - key: enum.WarDeclaratorUiKey.Key + enum.WarDeclaratorUiKey.Key: type: WarDeclaratorBoundUserInterface - type: WarDeclarator message: war-declarator-default-message diff --git a/Resources/Prototypes/Entities/Objects/Devices/forensic_scanner.yml b/Resources/Prototypes/Entities/Objects/Devices/forensic_scanner.yml index 7436ae7c98..e7c0b14beb 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/forensic_scanner.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/forensic_scanner.yml @@ -20,8 +20,8 @@ closeOnHandDeselect: false - type: UserInterface interfaces: - - key: enum.ForensicScannerUiKey.Key - type: ForensicScannerBoundUserInterface + enum.ForensicScannerUiKey.Key: + type: ForensicScannerBoundUserInterface - type: ForensicScanner - type: GuideHelp guides: diff --git a/Resources/Prototypes/Entities/Objects/Devices/pda.yml b/Resources/Prototypes/Entities/Objects/Devices/pda.yml index 73976b48e0..e1efc03993 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/pda.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/pda.yml @@ -89,16 +89,16 @@ closeOnHandDeselect: false - type: UserInterface interfaces: - - key: enum.PdaUiKey.Key - type: PdaBoundUserInterface - - key: enum.StoreUiKey.Key - type: StoreBoundUserInterface - - key: enum.RingerUiKey.Key - type: RingerBoundUserInterface - - key: enum.InstrumentUiKey.Key - type: InstrumentBoundUserInterface - - key: enum.HealthAnalyzerUiKey.Key - type: HealthAnalyzerBoundUserInterface + enum.PdaUiKey.Key: + type: PdaBoundUserInterface + enum.StoreUiKey.Key: + type: StoreBoundUserInterface + enum.RingerUiKey.Key: + type: RingerBoundUserInterface + enum.InstrumentUiKey.Key: + type: InstrumentBoundUserInterface + enum.HealthAnalyzerUiKey.Key: + type: HealthAnalyzerBoundUserInterface - type: Tag tags: - DoorBumpOpener diff --git a/Resources/Prototypes/Entities/Objects/Devices/station_beacon.yml b/Resources/Prototypes/Entities/Objects/Devices/station_beacon.yml index fa9071d3e9..b4e336b37d 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/station_beacon.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/station_beacon.yml @@ -30,8 +30,8 @@ singleUser: true - type: UserInterface interfaces: - - key: enum.NavMapBeaconUiKey.Key - type: NavMapBeaconBoundUserInterface + enum.NavMapBeaconUiKey.Key: + type: NavMapBeaconBoundUserInterface - type: Item size: Small - type: SubFloorHide diff --git a/Resources/Prototypes/Entities/Objects/Devices/station_map.yml b/Resources/Prototypes/Entities/Objects/Devices/station_map.yml index c37d8935f3..0d2f890a1d 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/station_map.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/station_map.yml @@ -28,7 +28,7 @@ acts: [ "Destruction" ] - type: UserInterface interfaces: - - key: enum.StationMapUiKey.Key + enum.StationMapUiKey.Key: type: StationMapBoundUserInterface - type: entity diff --git a/Resources/Prototypes/Entities/Objects/Fun/Instruments/base_instruments.yml b/Resources/Prototypes/Entities/Objects/Fun/Instruments/base_instruments.yml index 07d918b576..684260b737 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/Instruments/base_instruments.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/Instruments/base_instruments.yml @@ -13,8 +13,8 @@ key: enum.InstrumentUiKey.Key - type: UserInterface interfaces: - - key: enum.InstrumentUiKey.Key - type: InstrumentBoundUserInterface + enum.InstrumentUiKey.Key: + type: InstrumentBoundUserInterface - type: Item size: Normal - type: StaticPrice @@ -51,8 +51,8 @@ acts: ["Destruction"] - type: UserInterface interfaces: - - key: enum.InstrumentUiKey.Key - type: InstrumentBoundUserInterface + enum.InstrumentUiKey.Key: + type: InstrumentBoundUserInterface - type: Fixtures fixtures: fix1: diff --git a/Resources/Prototypes/Entities/Objects/Fun/candy_bucket.yml b/Resources/Prototypes/Entities/Objects/Fun/candy_bucket.yml index d8f11cdea2..63175dc89a 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/candy_bucket.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/candy_bucket.yml @@ -36,8 +36,8 @@ ents: [] - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface # to prevent bag open/honk spam - type: UseDelay delay: 0.5 diff --git a/Resources/Prototypes/Entities/Objects/Fun/crayons.yml b/Resources/Prototypes/Entities/Objects/Fun/crayons.yml index cb755b161a..4aab2efdb9 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/crayons.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/crayons.yml @@ -18,8 +18,8 @@ - type: SpaceGarbage - type: UserInterface interfaces: - - key: enum.CrayonUiKey.Key - type: CrayonBoundUserInterface + enum.CrayonUiKey.Key: + type: CrayonBoundUserInterface - type: Crayon capacity: 15 - type: Food diff --git a/Resources/Prototypes/Entities/Objects/Fun/pai.yml b/Resources/Prototypes/Entities/Objects/Fun/pai.yml index 537562f461..df8f487240 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/pai.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/pai.yml @@ -13,10 +13,10 @@ program: 2 - type: UserInterface interfaces: - - key: enum.InstrumentUiKey.Key - type: InstrumentBoundUserInterface - - key: enum.StationMapUiKey.Key - type: UntrackedStationMapBoundUserInterface + enum.InstrumentUiKey.Key: + type: InstrumentBoundUserInterface + enum.StationMapUiKey.Key: + type: UntrackedStationMapBoundUserInterface - type: Sprite sprite: Objects/Fun/pai.rsi layers: diff --git a/Resources/Prototypes/Entities/Objects/Misc/books.yml b/Resources/Prototypes/Entities/Objects/Misc/books.yml index 78f9edc9c5..e44e981a6c 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/books.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/books.yml @@ -25,8 +25,8 @@ closeOnHandDeselect: false - type: UserInterface interfaces: - - key: enum.PaperUiKey.Key - type: PaperBoundUserInterface + enum.PaperUiKey.Key: + type: PaperBoundUserInterface - type: Tag tags: - Book @@ -49,7 +49,7 @@ color: "#0a2a6b" - state: decor_wingette color: "#082561" - - state: icon_text + - state: icon_text color: gold - state: icon_planet color: "#42b6f5" @@ -361,7 +361,7 @@ description: Each book is unique! What is hidden in this one? components: - type: RandomMetadata - nameSegments: + nameSegments: - book_hint_appearance - book_type - type: RandomSprite @@ -410,7 +410,7 @@ icon_skull: "" icon_text: "" icon_text2: "" - icon_text3: "" + icon_text3: "" overlay: overlay_blood: "" overlay_dirt: Sixteen @@ -451,7 +451,7 @@ - book_story_element_trait - "." storySeparator: "" - + - type: entity parent: BookBase id: BookAtmosDistro @@ -530,4 +530,4 @@ - state: icon_corner color: gold - type: Paper - content: book-text-atmos-vents \ No newline at end of file + content: book-text-atmos-vents diff --git a/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml b/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml index b44b71930f..3de1afe8b8 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml @@ -658,9 +658,9 @@ default: PassengerIDCard - type: UserInterface interfaces: - - key: enum.AgentIDCardUiKey.Key + enum.AgentIDCardUiKey.Key: type: AgentIDCardBoundUserInterface - - key: enum.ChameleonUiKey.Key + enum.ChameleonUiKey.Key: type: ChameleonBoundUserInterface - type: entity diff --git a/Resources/Prototypes/Entities/Objects/Misc/paper.yml b/Resources/Prototypes/Entities/Objects/Misc/paper.yml index 0c52b2381c..08e5e3caaf 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/paper.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/paper.yml @@ -22,8 +22,8 @@ requireHands: false - type: UserInterface interfaces: - - key: enum.PaperUiKey.Key - type: PaperBoundUserInterface + enum.PaperUiKey.Key: + type: PaperBoundUserInterface - type: Item size: Tiny - type: Tag @@ -264,8 +264,8 @@ key: enum.PaperUiKey.Key - type: UserInterface interfaces: - - key: enum.PaperUiKey.Key - type: PaperBoundUserInterface + enum.PaperUiKey.Key: + type: PaperBoundUserInterface - type: entity parent: Paper @@ -695,10 +695,10 @@ key: enum.CargoConsoleUiKey.Orders - type: UserInterface interfaces: - - key: enum.CargoConsoleUiKey.Orders - type: CargoOrderConsoleBoundUserInterface - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.CargoConsoleUiKey.Orders: + type: CargoOrderConsoleBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: MeleeWeapon wideAnimationRotation: 180 damage: diff --git a/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml b/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml index 2336945f17..a0f5e254d5 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml @@ -126,7 +126,7 @@ ents: [ ] - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key + enum.StorageUiKey.Key: type: StorageBoundUserInterface - type: entity @@ -160,8 +160,8 @@ Telecrystal: 0 - type: UserInterface interfaces: - - key: enum.StoreUiKey.Key - type: StoreBoundUserInterface + enum.StoreUiKey.Key: + type: StoreBoundUserInterface - type: entity parent: BaseSubdermalImplant diff --git a/Resources/Prototypes/Entities/Objects/Specific/Chapel/bibles.yml b/Resources/Prototypes/Entities/Objects/Specific/Chapel/bibles.yml index b4f95d81e5..f6b2b0a70c 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Chapel/bibles.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Chapel/bibles.yml @@ -40,8 +40,8 @@ - 0,0,0,1 - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: Tag tags: - Book diff --git a/Resources/Prototypes/Entities/Objects/Specific/Chapel/urn.yml b/Resources/Prototypes/Entities/Objects/Specific/Chapel/urn.yml index 706407b8a6..55a58ef18a 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Chapel/urn.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Chapel/urn.yml @@ -9,11 +9,11 @@ - 0,0,0,1 - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: Sprite sprite: Objects/Specific/Chapel/chaplainurn.rsi state: icon - type: Item size: Normal - sprite: Objects/Specific/Chapel/chaplainurn.rsi \ No newline at end of file + sprite: Objects/Specific/Chapel/chaplainurn.rsi diff --git a/Resources/Prototypes/Entities/Objects/Specific/Kitchen/foodcarts.yml b/Resources/Prototypes/Entities/Objects/Specific/Kitchen/foodcarts.yml index 0894d6a754..ca74dca8a7 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Kitchen/foodcarts.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Kitchen/foodcarts.yml @@ -44,8 +44,8 @@ - type: Appearance - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: Storage maxItemSize: Normal grid: diff --git a/Resources/Prototypes/Entities/Objects/Specific/Mech/mechs.yml b/Resources/Prototypes/Entities/Objects/Specific/Mech/mechs.yml index 6e5362d9bb..dab6f9f20f 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Mech/mechs.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Mech/mechs.yml @@ -39,8 +39,8 @@ doAfterDelay: 10 - type: UserInterface interfaces: - - key: enum.MechUiKey.Key - type: MechBoundUserInterface + enum.MechUiKey.Key: + type: MechBoundUserInterface - type: MeleeWeapon hidden: true attackRate: 0.75 diff --git a/Resources/Prototypes/Entities/Objects/Specific/Medical/handheld_crew_monitor.yml b/Resources/Prototypes/Entities/Objects/Specific/Medical/handheld_crew_monitor.yml index 6dfe039cc0..f30e1cf633 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Medical/handheld_crew_monitor.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Medical/handheld_crew_monitor.yml @@ -20,7 +20,7 @@ closeOnHandDeselect: false - type: UserInterface interfaces: - - key: enum.CrewMonitoringUIKey.Key + enum.CrewMonitoringUIKey.Key: type: CrewMonitoringBoundUserInterface - type: CrewMonitoringConsole - type: DeviceNetwork diff --git a/Resources/Prototypes/Entities/Objects/Specific/Medical/healthanalyzer.yml b/Resources/Prototypes/Entities/Objects/Specific/Medical/healthanalyzer.yml index 64bd04569b..4f8b6f2936 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Medical/healthanalyzer.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Medical/healthanalyzer.yml @@ -20,7 +20,7 @@ closeOnHandDeselect: false - type: UserInterface interfaces: - - key: enum.HealthAnalyzerUiKey.Key + enum.HealthAnalyzerUiKey.Key: type: HealthAnalyzerBoundUserInterface - type: HealthAnalyzer scanningEndSound: diff --git a/Resources/Prototypes/Entities/Objects/Specific/Research/anomaly.yml b/Resources/Prototypes/Entities/Objects/Specific/Research/anomaly.yml index b02c7109d3..4250d9ccdd 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Research/anomaly.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Research/anomaly.yml @@ -13,7 +13,7 @@ inHandsOnly: true - type: UserInterface interfaces: - - key: enum.AnomalyScannerUiKey.Key + enum.AnomalyScannerUiKey.Key: type: AnomalyScannerBoundUserInterface - type: AnomalyScanner - type: GuideHelp diff --git a/Resources/Prototypes/Entities/Objects/Specific/Service/barber.yml b/Resources/Prototypes/Entities/Objects/Specific/Service/barber.yml index e896832e5f..d7b0a566e1 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Service/barber.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Service/barber.yml @@ -13,8 +13,8 @@ closeOnHandDeselect: true - type: UserInterface interfaces: - - key: enum.MagicMirrorUiKey.Key - type: MagicMirrorBoundUserInterface + enum.MagicMirrorUiKey.Key: + type: MagicMirrorBoundUserInterface - type: MeleeWeapon wideAnimationRotation: -135 attackRate: 1 diff --git a/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/item_artifacts.yml b/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/item_artifacts.yml index e5f7a5ec3e..2241cdd4aa 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/item_artifacts.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/item_artifacts.yml @@ -45,14 +45,14 @@ ano01_on: Rainbow - type: UserInterface #needs to be here for certain effects interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface - - key: enum.InstrumentUiKey.Key - type: InstrumentBoundUserInterface - - key: enum.IntercomUiKey.Key - type: IntercomBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface + enum.InstrumentUiKey.Key: + type: InstrumentBoundUserInterface + enum.IntercomUiKey.Key: + type: IntercomBoundUserInterface - type: Appearance - type: Item size: Normal diff --git a/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/structure_artifacts.yml b/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/structure_artifacts.yml index 57b3dab921..4c3dac1816 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/structure_artifacts.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/structure_artifacts.yml @@ -22,14 +22,14 @@ noRot: true - type: UserInterface #needs to be here for certain effects interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface - - key: enum.InstrumentUiKey.Key - type: InstrumentBoundUserInterface - - key: enum.IntercomUiKey.Key - type: IntercomBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface + enum.InstrumentUiKey.Key: + type: InstrumentBoundUserInterface + enum.IntercomUiKey.Key: + type: IntercomBoundUserInterface - type: Reactive groups: Acidic: [Touch] diff --git a/Resources/Prototypes/Entities/Objects/Specific/atmos.yml b/Resources/Prototypes/Entities/Objects/Specific/atmos.yml index 0dc714aba0..acf5f6f240 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/atmos.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/atmos.yml @@ -17,8 +17,8 @@ key: enum.GasAnalyzerUiKey.Key - type: UserInterface interfaces: - - key: enum.GasAnalyzerUiKey.Key - type: GasAnalyzerBoundUserInterface + enum.GasAnalyzerUiKey.Key: + type: GasAnalyzerBoundUserInterface - type: Appearance - type: GenericVisualizer visuals: diff --git a/Resources/Prototypes/Entities/Objects/Specific/chemical-containers.yml b/Resources/Prototypes/Entities/Objects/Specific/chemical-containers.yml index 8034844a82..4bd71f898d 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/chemical-containers.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/chemical-containers.yml @@ -36,7 +36,7 @@ solution: beaker - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key + enum.TransferAmountUiKey.Key: type: TransferAmountBoundUserInterface - type: Drink solution: beaker diff --git a/Resources/Prototypes/Entities/Objects/Specific/chemistry-bottles.yml b/Resources/Prototypes/Entities/Objects/Specific/chemistry-bottles.yml index 6c81fa9466..3005f6b947 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/chemistry-bottles.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/chemistry-bottles.yml @@ -44,8 +44,8 @@ canChangeTransferAmount: true - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: Item size: Tiny sprite: Objects/Specific/Chemistry/beaker.rsi diff --git a/Resources/Prototypes/Entities/Objects/Specific/chemistry-vials.yml b/Resources/Prototypes/Entities/Objects/Specific/chemistry-vials.yml index 65f5fbb5d0..ed36861bb2 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/chemistry-vials.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/chemistry-vials.yml @@ -50,8 +50,8 @@ canChangeTransferAmount: true - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: Item size: Tiny sprite: Objects/Specific/Chemistry/vial.rsi diff --git a/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml b/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml index fdf58dc484..4989320e6f 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/chemistry.yml @@ -45,8 +45,8 @@ solution: beaker - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: Drink solution: beaker - type: Appearance @@ -138,8 +138,8 @@ canChangeTransferAmount: true - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: Drink solution: beaker - type: Appearance @@ -276,8 +276,8 @@ solution: dropper - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: Spillable solution: injector - type: Item diff --git a/Resources/Prototypes/Entities/Objects/Specific/syndicate.yml b/Resources/Prototypes/Entities/Objects/Specific/syndicate.yml index aa17685c24..459beeef18 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/syndicate.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/syndicate.yml @@ -63,8 +63,8 @@ heldPrefix: old-radio - type: UserInterface interfaces: - - key: enum.StoreUiKey.Key - type: StoreBoundUserInterface + enum.StoreUiKey.Key: + type: StoreBoundUserInterface - type: ActivatableUI key: enum.StoreUiKey.Key - type: Store diff --git a/Resources/Prototypes/Entities/Objects/Tools/access_configurator.yml b/Resources/Prototypes/Entities/Objects/Tools/access_configurator.yml index 9a367841c4..b6c7c49855 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/access_configurator.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/access_configurator.yml @@ -62,7 +62,7 @@ doAfter: 0.5 - type: UserInterface interfaces: - - key: enum.AccessOverriderUiKey.Key + enum.AccessOverriderUiKey.Key: type: AccessOverriderBoundUserInterface - type: ActivatableUI key: enum.AccessOverriderUiKey.Key diff --git a/Resources/Prototypes/Entities/Objects/Tools/bucket.yml b/Resources/Prototypes/Entities/Objects/Tools/bucket.yml index 77803a13ec..77c5e54897 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/bucket.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/bucket.yml @@ -35,8 +35,8 @@ canChangeTransferAmount: true - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: MeleeWeapon soundNoDamage: path: "/Audio/Effects/Fluids/splat.ogg" diff --git a/Resources/Prototypes/Entities/Objects/Tools/cowtools.yml b/Resources/Prototypes/Entities/Objects/Tools/cowtools.yml index 295412debc..87959ebef3 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/cowtools.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/cowtools.yml @@ -142,8 +142,8 @@ - type: GasAnalyzer - type: UserInterface interfaces: - - key: enum.GasAnalyzerUiKey.Key - type: GasAnalyzerBoundUserInterface + enum.GasAnalyzerUiKey.Key: + type: GasAnalyzerBoundUserInterface - type: Appearance - type: entity diff --git a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml index 2f281e141a..65942e330e 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/gas_tanks.yml @@ -19,8 +19,8 @@ key: enum.SharedGasTankUiKey.Key - type: UserInterface interfaces: - - key: enum.SharedGasTankUiKey.Key - type: GasTankBoundUserInterface + enum.SharedGasTankUiKey.Key: + type: GasTankBoundUserInterface - type: GasTank outputPressure: 21.3 air: diff --git a/Resources/Prototypes/Entities/Objects/Tools/hand_labeler.yml b/Resources/Prototypes/Entities/Objects/Tools/hand_labeler.yml index 1d9bb47e0e..4b46a93353 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/hand_labeler.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/hand_labeler.yml @@ -17,7 +17,7 @@ inHandsOnly: true - type: UserInterface interfaces: - - key: enum.HandLabelerUiKey.Key + enum.HandLabelerUiKey.Key: type: HandLabelerBoundUserInterface - type: HandLabeler whitelist: diff --git a/Resources/Prototypes/Entities/Objects/Tools/handheld_mass_scanner.yml b/Resources/Prototypes/Entities/Objects/Tools/handheld_mass_scanner.yml index 5647737219..5938193181 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/handheld_mass_scanner.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/handheld_mass_scanner.yml @@ -34,7 +34,7 @@ singleUser: true - type: UserInterface interfaces: - - key: enum.RadarConsoleUiKey.Key + enum.RadarConsoleUiKey.Key: type: RadarConsoleBoundUserInterface - type: StaticPrice price: 150 @@ -69,4 +69,4 @@ name: power-cell-slot-component-slot-name-default startingItem: PowerCellMicroreactor disableEject: true - swap: false \ No newline at end of file + swap: false diff --git a/Resources/Prototypes/Entities/Objects/Tools/jetpacks.yml b/Resources/Prototypes/Entities/Objects/Tools/jetpacks.yml index f40f47115b..04f8b9f9f6 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/jetpacks.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/jetpacks.yml @@ -40,7 +40,7 @@ size: Huge - type: UserInterface interfaces: - - key: enum.SharedGasTankUiKey.Key + enum.SharedGasTankUiKey.Key: type: GasTankBoundUserInterface - type: Clothing sprite: Objects/Tanks/Jetpacks/blue.rsi diff --git a/Resources/Prototypes/Entities/Objects/Tools/spray_painter.yml b/Resources/Prototypes/Entities/Objects/Tools/spray_painter.yml index 903b8d3f90..ad31a6ec02 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/spray_painter.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/spray_painter.yml @@ -13,8 +13,8 @@ key: enum.SprayPainterUiKey.Key - type: UserInterface interfaces: - - key: enum.SprayPainterUiKey.Key - type: SprayPainterBoundUserInterface + enum.SprayPainterUiKey.Key: + type: SprayPainterBoundUserInterface - type: SprayPainter colorPalette: red: '#FF1212FF' diff --git a/Resources/Prototypes/Entities/Objects/Tools/toolbox.yml b/Resources/Prototypes/Entities/Objects/Tools/toolbox.yml index 695725140f..0a0c702324 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/toolbox.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/toolbox.yml @@ -167,5 +167,5 @@ key: enum.ThiefBackpackUIKey.Key - type: UserInterface interfaces: - - key: enum.ThiefBackpackUIKey.Key + enum.ThiefBackpackUIKey.Key: type: ThiefBackpackBoundUserInterface diff --git a/Resources/Prototypes/Entities/Objects/Tools/tools.yml b/Resources/Prototypes/Entities/Objects/Tools/tools.yml index b3103816eb..452a905329 100644 --- a/Resources/Prototypes/Entities/Objects/Tools/tools.yml +++ b/Resources/Prototypes/Entities/Objects/Tools/tools.yml @@ -216,11 +216,11 @@ inHandsOnly: true - type: UserInterface interfaces: - - key: enum.NetworkConfiguratorUiKey.List + enum.NetworkConfiguratorUiKey.List: type: NetworkConfiguratorBoundUserInterface - - key: enum.NetworkConfiguratorUiKey.Configure + enum.NetworkConfiguratorUiKey.Configure: type: NetworkConfiguratorBoundUserInterface - - key: enum.NetworkConfiguratorUiKey.Link + enum.NetworkConfiguratorUiKey.Link: type: NetworkConfiguratorBoundUserInterface - type: Tag tags: @@ -272,11 +272,11 @@ - DoorElectronicsConfigurator - type: UserInterface interfaces: - - key: enum.NetworkConfiguratorUiKey.List + enum.NetworkConfiguratorUiKey.List: type: NetworkConfiguratorBoundUserInterface - - key: enum.NetworkConfiguratorUiKey.Configure + enum.NetworkConfiguratorUiKey.Configure: type: NetworkConfiguratorBoundUserInterface - - key: enum.NetworkConfiguratorUiKey.Link + enum.NetworkConfiguratorUiKey.Link: type: NetworkConfiguratorBoundUserInterface - type: StaticPrice price: 56 @@ -389,8 +389,8 @@ price: 100 - type: UserInterface interfaces: - - key: enum.RcdUiKey.Key - type: RCDMenuBoundUserInterface + enum.RcdUiKey.Key: + type: RCDMenuBoundUserInterface - type: ActivatableUI key: enum.RcdUiKey.Key diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/watergun.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/watergun.yml index e925bdab87..c96a1522d2 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/watergun.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Basic/watergun.yml @@ -34,8 +34,8 @@ canChangeTransferAmount: true - type: UserInterface interfaces: - - key: enum.TransferAmountUiKey.Key - type: TransferAmountBoundUserInterface + enum.TransferAmountUiKey.Key: + type: TransferAmountBoundUserInterface - type: DrawableSolution solution: chamber - type: RefillableSolution diff --git a/Resources/Prototypes/Entities/Objects/base_item.yml b/Resources/Prototypes/Entities/Objects/base_item.yml index 55c4bbd6b7..39bb8c3a2a 100644 --- a/Resources/Prototypes/Entities/Objects/base_item.yml +++ b/Resources/Prototypes/Entities/Objects/base_item.yml @@ -52,8 +52,8 @@ - type: Storage - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: ContainerContainer containers: storagebase: !type:Container diff --git a/Resources/Prototypes/Entities/Structures/Dispensers/base_structuredispensers.yml b/Resources/Prototypes/Entities/Structures/Dispensers/base_structuredispensers.yml index d661009b6d..082f5e0799 100644 --- a/Resources/Prototypes/Entities/Structures/Dispensers/base_structuredispensers.yml +++ b/Resources/Prototypes/Entities/Structures/Dispensers/base_structuredispensers.yml @@ -30,8 +30,8 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.ReagentDispenserUiKey.Key - type: ReagentDispenserBoundUserInterface + enum.ReagentDispenserUiKey.Key: + type: ReagentDispenserBoundUserInterface - type: Anchorable - type: Pullable - type: Damageable diff --git a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml index 8b2ce8ab56..86657eb46e 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/base_structureairlocks.yml @@ -104,8 +104,8 @@ - type: SpawnOnOverload - type: UserInterface interfaces: - - key: enum.WiresUiKey.Key - type: WiresBoundUserInterface + enum.WiresUiKey.Key: + type: WiresBoundUserInterface - type: Airtight noAirWhenFullyAirBlocked: false - type: RadiationBlocker diff --git a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/highsec.yml b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/highsec.yml index 2a8cc0c526..559dca704c 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Airlocks/highsec.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Airlocks/highsec.yml @@ -79,8 +79,8 @@ alwaysRandomize: true - type: UserInterface interfaces: - - key: enum.WiresUiKey.Key - type: WiresBoundUserInterface + enum.WiresUiKey.Key: + type: WiresBoundUserInterface - type: Airtight - type: Occluder - type: Damageable diff --git a/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml b/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml index a5b8a8dc74..fcdb432dce 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Firelocks/firelock.yml @@ -90,7 +90,7 @@ - type: WiresPanel - type: UserInterface interfaces: - - key: enum.WiresUiKey.Key + enum.WiresUiKey.Key: type: WiresBoundUserInterface - type: Physics canCollide: false diff --git a/Resources/Prototypes/Entities/Structures/Doors/Shutter/shutters.yml b/Resources/Prototypes/Entities/Structures/Doors/Shutter/shutters.yml index 1819c9d0ef..dc2acb7927 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Shutter/shutters.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Shutter/shutters.yml @@ -56,8 +56,8 @@ - type: Appearance - type: UserInterface interfaces: - - key: enum.WiresUiKey.Key - type: WiresBoundUserInterface + enum.WiresUiKey.Key: + type: WiresBoundUserInterface - type: Airtight - type: RadiationBlocker resistance: 2 diff --git a/Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml b/Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml index a6515b52c6..1ec6c04ffe 100644 --- a/Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml +++ b/Resources/Prototypes/Entities/Structures/Doors/Windoors/base_structurewindoors.yml @@ -66,7 +66,7 @@ damageContainer: Inorganic damageModifierSet: Glass - type: ExaminableDamage - messages: WindowMessages + messages: WindowMessages - type: RCDDeconstructable cost: 8 delay: 8 @@ -130,8 +130,8 @@ layoutId: Airlock - type: UserInterface interfaces: - - key: enum.WiresUiKey.Key - type: WiresBoundUserInterface + enum.WiresUiKey.Key: + type: WiresBoundUserInterface - type: Appearance - type: WiresVisuals - type: Airtight diff --git a/Resources/Prototypes/Entities/Structures/Furniture/bookshelf.yml b/Resources/Prototypes/Entities/Structures/Furniture/bookshelf.yml index 792f076679..30aa793767 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/bookshelf.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/bookshelf.yml @@ -59,8 +59,8 @@ - Spellbook - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: InteractionOutline - type: ContainerContainer containers: diff --git a/Resources/Prototypes/Entities/Structures/Furniture/dresser.yml b/Resources/Prototypes/Entities/Structures/Furniture/dresser.yml index 2caa4010ca..b79c0e6213 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/dresser.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/dresser.yml @@ -33,8 +33,8 @@ storagebase: !type:Container - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: InteractionOutline - type: Clickable - type: Tag diff --git a/Resources/Prototypes/Entities/Structures/Furniture/toilet.yml b/Resources/Prototypes/Entities/Structures/Furniture/toilet.yml index f02b126248..0824d21ae0 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/toilet.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/toilet.yml @@ -66,8 +66,8 @@ price: 25 - type: UserInterface interfaces: - - key: enum.DisposalUnitUiKey.Key - type: DisposalUnitBoundUserInterface + enum.DisposalUnitUiKey.Key: + type: DisposalUnitBoundUserInterface - type: RatKingRummageable - type: SolutionContainerManager solutions: diff --git a/Resources/Prototypes/Entities/Structures/Machines/Computers/arcades.yml b/Resources/Prototypes/Entities/Structures/Machines/Computers/arcades.yml index 40fa8cf472..6a351d47f0 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/Computers/arcades.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/Computers/arcades.yml @@ -138,9 +138,9 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.SpaceVillainArcadeUiKey.Key + enum.SpaceVillainArcadeUiKey.Key: type: SpaceVillainArcadeBoundUserInterface - - key: enum.WiresUiKey.Key + enum.WiresUiKey.Key: type: WiresBoundUserInterface - type: Computer board: SpaceVillainArcadeComputerCircuitboard @@ -182,9 +182,9 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.BlockGameUiKey.Key + enum.BlockGameUiKey.Key: type: BlockGameBoundUserInterface - - key: enum.WiresUiKey.Key + enum.WiresUiKey.Key: type: WiresBoundUserInterface - type: Computer board: BlockGameArcadeComputerCircuitboard diff --git a/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml b/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml index ef15f73b32..56570697df 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml @@ -31,8 +31,8 @@ key: enum.EmergencyConsoleUiKey.Key - type: UserInterface interfaces: - - key: enum.EmergencyConsoleUiKey.Key - type: EmergencyConsoleBoundUserInterface + enum.EmergencyConsoleUiKey.Key: + type: EmergencyConsoleBoundUserInterface - type: PointLight radius: 1.5 energy: 1.6 @@ -52,8 +52,8 @@ key: enum.ShuttleConsoleUiKey.Key - type: UserInterface interfaces: - - key: enum.ShuttleConsoleUiKey.Key - type: ShuttleConsoleBoundUserInterface + enum.ShuttleConsoleUiKey.Key: + type: ShuttleConsoleBoundUserInterface - type: RadarConsole - type: WorldLoader radius: 256 @@ -211,8 +211,8 @@ key: enum.IFFConsoleUiKey.Key - type: UserInterface interfaces: - - key: enum.IFFConsoleUiKey.Key - type: IFFConsoleBoundUserInterface + enum.IFFConsoleUiKey.Key: + type: IFFConsoleBoundUserInterface - type: Computer board: ComputerIFFCircuitboard @@ -231,8 +231,8 @@ key: enum.IFFConsoleUiKey.Key - type: UserInterface interfaces: - - key: enum.IFFConsoleUiKey.Key - type: IFFConsoleBoundUserInterface + enum.IFFConsoleUiKey.Key: + type: IFFConsoleBoundUserInterface - type: Computer board: ComputerIFFSyndicateCircuitboard @@ -271,8 +271,8 @@ key: enum.PowerMonitoringConsoleUiKey.Key - type: UserInterface interfaces: - - key: enum.PowerMonitoringConsoleUiKey.Key - type: PowerMonitoringConsoleBoundUserInterface + enum.PowerMonitoringConsoleUiKey.Key: + type: PowerMonitoringConsoleBoundUserInterface - type: entity parent: BaseComputer @@ -306,8 +306,8 @@ - type: CriminalRecordsConsole - type: UserInterface interfaces: - - key: enum.CriminalRecordsConsoleKey.Key - type: CriminalRecordsConsoleBoundUserInterface + enum.CriminalRecordsConsoleKey.Key: + type: CriminalRecordsConsoleBoundUserInterface - type: ActivatableUI key: enum.CriminalRecordsConsoleKey.Key - type: Sprite @@ -341,8 +341,8 @@ - type: GeneralStationRecordConsole - type: UserInterface interfaces: - - key: enum.GeneralStationRecordConsoleKey.Key - type: GeneralStationRecordConsoleBoundUserInterface + enum.GeneralStationRecordConsoleKey.Key: + type: GeneralStationRecordConsoleBoundUserInterface - type: ActivatableUI key: enum.GeneralStationRecordConsoleKey.Key - type: PointLight @@ -381,7 +381,7 @@ key: enum.CrewMonitoringUIKey.Key - type: UserInterface interfaces: - - key: enum.CrewMonitoringUIKey.Key + enum.CrewMonitoringUIKey.Key: type: CrewMonitoringBoundUserInterface - type: CrewMonitoringConsole - type: DeviceNetwork @@ -416,10 +416,10 @@ key: enum.ResearchConsoleUiKey.Key - type: UserInterface interfaces: - - key: enum.ResearchConsoleUiKey.Key - type: ResearchConsoleBoundUserInterface - - key: enum.ResearchClientUiKey.Key - type: ResearchClientBoundUserInterface + enum.ResearchConsoleUiKey.Key: + type: ResearchConsoleBoundUserInterface + enum.ResearchClientUiKey.Key: + type: ResearchClientBoundUserInterface - type: ApcPowerReceiver powerLoad: 1000 - type: Computer @@ -464,10 +464,10 @@ key: enum.ArtifactAnalzyerUiKey.Key - type: UserInterface interfaces: - - key: enum.ArtifactAnalzyerUiKey.Key - type: AnalysisConsoleBoundUserInterface - - key: enum.ResearchClientUiKey.Key - type: ResearchClientBoundUserInterface + enum.ArtifactAnalzyerUiKey.Key: + type: AnalysisConsoleBoundUserInterface + enum.ResearchClientUiKey.Key: + type: ResearchClientBoundUserInterface - type: ApcPowerReceiver powerLoad: 1000 - type: Computer @@ -509,8 +509,8 @@ key: enum.IdCardConsoleUiKey.Key - type: UserInterface interfaces: - - key: enum.IdCardConsoleUiKey.Key - type: IdCardConsoleBoundUserInterface + enum.IdCardConsoleUiKey.Key: + type: IdCardConsoleBoundUserInterface - type: CrewManifestViewer ownerKey: enum.IdCardConsoleUiKey.Key - type: Sprite @@ -580,8 +580,8 @@ key: enum.CommunicationsConsoleUiKey.Key - type: UserInterface interfaces: - - key: enum.CommunicationsConsoleUiKey.Key - type: CommunicationsConsoleBoundUserInterface + enum.CommunicationsConsoleUiKey.Key: + type: CommunicationsConsoleBoundUserInterface - type: Computer board: CommsComputerCircuitboard - type: PointLight @@ -644,8 +644,8 @@ key: enum.SolarControlConsoleUiKey.Key - type: UserInterface interfaces: - - key: enum.SolarControlConsoleUiKey.Key - type: SolarControlConsoleBoundUserInterface + enum.SolarControlConsoleUiKey.Key: + type: SolarControlConsoleBoundUserInterface - type: Computer board: SolarControlComputerCircuitboard - type: PointLight @@ -674,8 +674,8 @@ key: enum.RadarConsoleUiKey.Key - type: UserInterface interfaces: - - key: enum.RadarConsoleUiKey.Key - type: RadarConsoleBoundUserInterface + enum.RadarConsoleUiKey.Key: + type: RadarConsoleBoundUserInterface - type: Computer board: RadarConsoleCircuitboard - type: PointLight @@ -704,8 +704,8 @@ key: enum.CargoConsoleUiKey.Shuttle - type: UserInterface interfaces: - - key: enum.CargoConsoleUiKey.Shuttle - type: CargoShuttleConsoleBoundUserInterface + enum.CargoConsoleUiKey.Shuttle: + type: CargoShuttleConsoleBoundUserInterface - type: Computer board: CargoShuttleComputerCircuitboard - type: PointLight @@ -742,8 +742,8 @@ key: enum.CargoConsoleUiKey.Orders - type: UserInterface interfaces: - - key: enum.CargoConsoleUiKey.Orders - type: CargoOrderConsoleBoundUserInterface + enum.CargoConsoleUiKey.Orders: + type: CargoOrderConsoleBoundUserInterface - type: Computer board: CargoRequestComputerCircuitboard - type: PointLight @@ -786,8 +786,8 @@ key: enum.CargoConsoleUiKey.Bounty - type: UserInterface interfaces: - - key: enum.CargoConsoleUiKey.Bounty - type: CargoBountyConsoleBoundUserInterface + enum.CargoConsoleUiKey.Bounty: + type: CargoBountyConsoleBoundUserInterface - type: Computer board: CargoBountyComputerCircuitboard - type: PointLight @@ -837,8 +837,8 @@ key: enum.CloningConsoleUiKey.Key - type: UserInterface interfaces: - - key: enum.CloningConsoleUiKey.Key - type: CloningConsoleBoundUserInterface + enum.CloningConsoleUiKey.Key: + type: CloningConsoleBoundUserInterface - type: Speech speechVerb: Robotic speechSounds: Pai @@ -881,7 +881,7 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.SalvageConsoleUiKey.Expedition + enum.SalvageConsoleUiKey.Expedition: type: SalvageExpeditionConsoleBoundUserInterface - type: Computer board: SalvageExpeditionsComputerCircuitboard @@ -926,8 +926,8 @@ anchored: true - type: UserInterface interfaces: - - key: enum.SurveillanceCameraMonitorUiKey.Key - type: SurveillanceCameraMonitorBoundUserInterface + enum.SurveillanceCameraMonitorUiKey.Key: + type: SurveillanceCameraMonitorBoundUserInterface - type: entity parent: BaseComputer @@ -963,8 +963,8 @@ - type: ActivatableUIRequiresVision - type: UserInterface interfaces: - - key: enum.SurveillanceCameraMonitorUiKey.Key - type: SurveillanceCameraMonitorBoundUserInterface + enum.SurveillanceCameraMonitorUiKey.Key: + type: SurveillanceCameraMonitorBoundUserInterface - type: entity id: ComputerPalletConsole @@ -990,8 +990,8 @@ key: enum.CargoPalletConsoleUiKey.Sale - type: UserInterface interfaces: - - key: enum.CargoPalletConsoleUiKey.Sale - type: CargoPalletConsoleBoundUserInterface + enum.CargoPalletConsoleUiKey.Sale: + type: CargoPalletConsoleBoundUserInterface - type: Computer board: CargoRequestComputerCircuitboard - type: PointLight @@ -1031,8 +1031,8 @@ anchored: true - type: UserInterface interfaces: - - key: enum.NewsWriterUiKey.Key - type: NewsWriterBoundUserInterface + enum.NewsWriterUiKey.Key: + type: NewsWriterBoundUserInterface - type: entity parent: BaseComputer @@ -1064,7 +1064,7 @@ key: enum.SensorMonitoringConsoleUiKey.Key - type: UserInterface interfaces: - - key: enum.SensorMonitoringConsoleUiKey.Key + enum.SensorMonitoringConsoleUiKey.Key: type: SensorMonitoringConsoleBoundUserInterface - type: DeviceNetwork deviceNetId: AtmosDevices diff --git a/Resources/Prototypes/Entities/Structures/Machines/Computers/techdiskterminal.yml b/Resources/Prototypes/Entities/Structures/Machines/Computers/techdiskterminal.yml index df989a7795..dd58b9709d 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/Computers/techdiskterminal.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/Computers/techdiskterminal.yml @@ -19,10 +19,10 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.DiskConsoleUiKey.Key - type: DiskConsoleBoundUserInterface - - key: enum.ResearchClientUiKey.Key - type: ResearchClientBoundUserInterface + enum.DiskConsoleUiKey.Key: + type: DiskConsoleBoundUserInterface + enum.ResearchClientUiKey.Key: + type: ResearchClientBoundUserInterface - type: ExtensionCableReceiver - type: Computer board: TechDiskComputerCircuitboard diff --git a/Resources/Prototypes/Entities/Structures/Machines/Medical/cryo_pod.yml b/Resources/Prototypes/Entities/Structures/Machines/Medical/cryo_pod.yml index 6ac969171e..4cb76ea4b9 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/Medical/cryo_pod.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/Medical/cryo_pod.yml @@ -89,9 +89,9 @@ scanDelay: 0 - type: UserInterface interfaces: - - key: enum.HealthAnalyzerUiKey.Key + enum.HealthAnalyzerUiKey.Key: type: HealthAnalyzerBoundUserInterface - - key: enum.WiresUiKey.Key + enum.WiresUiKey.Key: type: WiresBoundUserInterface - type: ActivatableUI key: enum.HealthAnalyzerUiKey.Key diff --git a/Resources/Prototypes/Entities/Structures/Machines/anomaly_equipment.yml b/Resources/Prototypes/Entities/Structures/Machines/anomaly_equipment.yml index ab09a03fef..8686d88233 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/anomaly_equipment.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/anomaly_equipment.yml @@ -27,8 +27,8 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.ResearchClientUiKey.Key - type: ResearchClientBoundUserInterface + enum.ResearchClientUiKey.Key: + type: ResearchClientBoundUserInterface - type: Machine board: AnomalyVesselCircuitboard - type: PointLight @@ -298,8 +298,8 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.AnomalyGeneratorUiKey.Key - type: AnomalyGeneratorBoundUserInterface + enum.AnomalyGeneratorUiKey.Key: + type: AnomalyGeneratorBoundUserInterface - type: Appearance - type: ActiveRadio channels: diff --git a/Resources/Prototypes/Entities/Structures/Machines/bombs.yml b/Resources/Prototypes/Entities/Structures/Machines/bombs.yml index 89cadab6b1..88e650068e 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/bombs.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/bombs.yml @@ -10,7 +10,7 @@ - type: InteractionOutline - type: UserInterface interfaces: - - key: enum.WiresUiKey.Key + enum.WiresUiKey.Key: type: WiresBoundUserInterface - type: Wires layoutId: Defusable diff --git a/Resources/Prototypes/Entities/Structures/Machines/chem_master.yml b/Resources/Prototypes/Entities/Structures/Machines/chem_master.yml index aee1246021..4e565054b4 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/chem_master.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/chem_master.yml @@ -50,8 +50,8 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.ChemMasterUiKey.Key - type: ChemMasterBoundUserInterface + enum.ChemMasterUiKey.Key: + type: ChemMasterBoundUserInterface - type: ApcPowerReceiver powerLoad: 250 - type: Appearance diff --git a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml index 7e78f66efa..583b5e3548 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml @@ -32,8 +32,8 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.FaxUiKey.Key - type: FaxBoundUi + enum.FaxUiKey.Key: + type: FaxBoundUi - type: ApcPowerReceiver powerLoad: 250 - type: FaxMachine diff --git a/Resources/Prototypes/Entities/Structures/Machines/flatpacker.yml b/Resources/Prototypes/Entities/Structures/Machines/flatpacker.yml index 3244789a02..b4f05cf68a 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/flatpacker.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/flatpacker.yml @@ -58,8 +58,8 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.FlatpackCreatorUIKey.Key - type: FlatpackCreatorBoundUserInterface + enum.FlatpackCreatorUIKey.Key: + type: FlatpackCreatorBoundUserInterface - type: ItemSlots slots: board_slot: diff --git a/Resources/Prototypes/Entities/Structures/Machines/gateway.yml b/Resources/Prototypes/Entities/Structures/Machines/gateway.yml index b6ad9db356..dd01adf6d5 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/gateway.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/gateway.yml @@ -52,6 +52,6 @@ key: enum.GatewayUiKey.Key - type: UserInterface interfaces: - - key: enum.GatewayUiKey.Key - type: GatewayBoundUserInterface + enum.GatewayUiKey.Key: + type: GatewayBoundUserInterface - type: Gateway diff --git a/Resources/Prototypes/Entities/Structures/Machines/gravity_generator.yml b/Resources/Prototypes/Entities/Structures/Machines/gravity_generator.yml index 618538dccb..6ee454c6a9 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/gravity_generator.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/gravity_generator.yml @@ -62,8 +62,8 @@ on: "on" - type: UserInterface interfaces: - - key: enum.GravityGeneratorUiKey.Key - type: GravityGeneratorBoundUserInterface + enum.GravityGeneratorUiKey.Key: + type: GravityGeneratorBoundUserInterface - type: Appearance - type: PointLight radius: 2.5 diff --git a/Resources/Prototypes/Entities/Structures/Machines/jukebox.yml b/Resources/Prototypes/Entities/Structures/Machines/jukebox.yml index 76b8ddd36b..acd8527dbb 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/jukebox.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/jukebox.yml @@ -26,8 +26,8 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.JukeboxUiKey.Key - type: JukeboxBoundUserInterface + enum.JukeboxUiKey.Key: + type: JukeboxBoundUserInterface - type: Damageable damageContainer: Inorganic damageModifierSet: Metallic diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 25c6545286..9ad3214dc3 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -38,10 +38,10 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.LatheUiKey.Key - type: LatheBoundUserInterface - - key: enum.ResearchClientUiKey.Key - type: ResearchClientBoundUserInterface + enum.LatheUiKey.Key: + type: LatheBoundUserInterface + enum.ResearchClientUiKey.Key: + type: ResearchClientBoundUserInterface - type: Transform anchored: true - type: Pullable diff --git a/Resources/Prototypes/Entities/Structures/Machines/microwave.yml b/Resources/Prototypes/Entities/Structures/Machines/microwave.yml index 37b5e50d31..fe4eb14518 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/microwave.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/microwave.yml @@ -44,8 +44,8 @@ range: 200 - type: UserInterface interfaces: - - key: enum.MicrowaveUiKey.Key - type: MicrowaveBoundUserInterface + enum.MicrowaveUiKey.Key: + type: MicrowaveBoundUserInterface - type: Physics - type: Fixtures fixtures: diff --git a/Resources/Prototypes/Entities/Structures/Machines/nuke.yml b/Resources/Prototypes/Entities/Structures/Machines/nuke.yml index f37c42e474..bc4581d7b6 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/nuke.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/nuke.yml @@ -88,8 +88,8 @@ key: enum.NukeUiKey.Key - type: UserInterface interfaces: - - key: enum.NukeUiKey.Key - type: NukeBoundUserInterface + enum.NukeUiKey.Key: + type: NukeBoundUserInterface - type: StaticPrice price: 50000 # YOU STOLE A NUCLEAR FISSION EXPLOSIVE?! - type: CargoSellBlacklist diff --git a/Resources/Prototypes/Entities/Structures/Machines/reagent_grinder.yml b/Resources/Prototypes/Entities/Structures/Machines/reagent_grinder.yml index 773112f6f3..d6e7333313 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/reagent_grinder.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/reagent_grinder.yml @@ -12,8 +12,8 @@ key: enum.ReagentGrinderUiKey.Key - type: UserInterface interfaces: - - key: enum.ReagentGrinderUiKey.Key - type: ReagentGrinderBoundUserInterface + enum.ReagentGrinderUiKey.Key: + type: ReagentGrinderBoundUserInterface - type: Appearance - type: GenericVisualizer visuals: @@ -101,4 +101,4 @@ - type: DrainableSolution solution: output - type: ExaminableSolution - solution: output \ No newline at end of file + solution: output diff --git a/Resources/Prototypes/Entities/Structures/Machines/research.yml b/Resources/Prototypes/Entities/Structures/Machines/research.yml index 948b3f84b2..498759df3c 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/research.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/research.yml @@ -83,8 +83,8 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.ResearchClientUiKey.Key - type: ResearchClientBoundUserInterface + enum.ResearchClientUiKey.Key: + type: ResearchClientBoundUserInterface - type: Appearance - type: GenericVisualizer visuals: diff --git a/Resources/Prototypes/Entities/Structures/Machines/salvage.yml b/Resources/Prototypes/Entities/Structures/Machines/salvage.yml index a17eed5712..cafdc7cef2 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/salvage.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/salvage.yml @@ -28,8 +28,8 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.SalvageMagnetUiKey.Key - type: SalvageMagnetBoundUserInterface + enum.SalvageMagnetUiKey.Key: + type: SalvageMagnetBoundUserInterface - type: Transform noRot: false - type: Appearance diff --git a/Resources/Prototypes/Entities/Structures/Machines/surveillance_camera_routers.yml b/Resources/Prototypes/Entities/Structures/Machines/surveillance_camera_routers.yml index 1eeaec9b7c..904bf46a0b 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/surveillance_camera_routers.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/surveillance_camera_routers.yml @@ -13,7 +13,7 @@ - type: DeviceNetworkRequiresPower - type: UserInterface interfaces: - - key: enum.SurveillanceCameraSetupUiKey.Router + enum.SurveillanceCameraSetupUiKey.Router: type: SurveillanceCameraSetupBoundUi - type: Machine board: SurveillanceCameraRouterCircuitboard @@ -118,7 +118,7 @@ - type: DeviceNetworkRequiresPower - type: UserInterface interfaces: - - key: enum.SurveillanceCameraSetupUiKey.Router + enum.SurveillanceCameraSetupUiKey.Router: type: SurveillanceCameraSetupBoundUi - type: Machine board: SurveillanceCameraWirelessRouterCircuitboard diff --git a/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml b/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml index 6f28b53350..16a5aa55d4 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/vending_machines.yml @@ -60,10 +60,10 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.VendingMachineUiKey.Key - type: VendingMachineBoundUserInterface - - key: enum.WiresUiKey.Key - type: WiresBoundUserInterface + enum.VendingMachineUiKey.Key: + type: VendingMachineBoundUserInterface + enum.WiresUiKey.Key: + type: WiresBoundUserInterface - type: WiresPanel - type: Wires boardName: wires-board-name-vendingmachine diff --git a/Resources/Prototypes/Entities/Structures/Machines/wireless_surveillance_camera.yml b/Resources/Prototypes/Entities/Structures/Machines/wireless_surveillance_camera.yml index d69eb96f62..fc8f31535c 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/wireless_surveillance_camera.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/wireless_surveillance_camera.yml @@ -33,7 +33,7 @@ range: 10 - type: UserInterface interfaces: - - key: enum.SurveillanceCameraSetupUiKey.Camera + enum.SurveillanceCameraSetupUiKey.Camera: type: SurveillanceCameraSetupBoundUi placement: mode: SnapgridCenter diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml index 4bea87f817..fa5804c645 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml @@ -51,8 +51,8 @@ enabled: false - type: UserInterface interfaces: - - key: enum.GasPressurePumpUiKey.Key - type: GasPressurePumpBoundUserInterface + enum.GasPressurePumpUiKey.Key: + type: GasPressurePumpBoundUserInterface - type: Construction graph: GasBinary node: pressurepump @@ -92,7 +92,7 @@ enabled: false - type: UserInterface interfaces: - - key: enum.GasVolumePumpUiKey.Key + enum.GasVolumePumpUiKey.Key: type: GasVolumePumpBoundUserInterface - type: Construction graph: GasBinary diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/portable.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/portable.yml index 316c403d7a..200df727b3 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/portable.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/portable.yml @@ -120,7 +120,7 @@ layer: - MachineLayer - type: ApcPowerReceiver - powerDisabled: true #starts off + powerDisabled: true #starts off - type: Sprite sprite: Structures/Piping/Atmospherics/Portable/portable_sheater.rsi noRot: true @@ -144,8 +144,8 @@ - type: WiresVisuals - type: UserInterface interfaces: - - key: enum.SpaceHeaterUiKey.Key - type: SpaceHeaterBoundUserInterface + enum.SpaceHeaterUiKey.Key: + type: SpaceHeaterBoundUserInterface - type: ActivatableUI inHandsOnly: false key: enum.SpaceHeaterUiKey.Key @@ -195,4 +195,4 @@ suffix: Anchored, Enabled components: - type: ApcPowerReceiver - powerDisabled: false \ No newline at end of file + powerDisabled: false diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/trinary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/trinary.yml index d0f239b338..46eb57c388 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/trinary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/trinary.yml @@ -53,7 +53,7 @@ - type: PipeColorVisuals - type: UserInterface interfaces: - - key: enum.GasFilterUiKey.Key + enum.GasFilterUiKey.Key: type: GasFilterBoundUserInterface - type: GasFilter enabled: false @@ -138,7 +138,7 @@ - type: PipeColorVisuals - type: UserInterface interfaces: - - key: enum.GasMixerUiKey.Key + enum.GasMixerUiKey.Key: type: GasMixerBoundUserInterface - type: GasMixer enabled: false diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml index e046fb831a..c0664602b4 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml @@ -239,8 +239,8 @@ - type: AtmosDevice - type: UserInterface interfaces: - - key: enum.ThermomachineUiKey.Key - type: GasThermomachineBoundUserInterface + enum.ThermomachineUiKey.Key: + type: GasThermomachineBoundUserInterface - type: ActivatableUI inHandsOnly: false key: enum.ThermomachineUiKey.Key diff --git a/Resources/Prototypes/Entities/Structures/Piping/Disposal/pipes.yml b/Resources/Prototypes/Entities/Structures/Piping/Disposal/pipes.yml index 218b532efc..0224105117 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Disposal/pipes.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Disposal/pipes.yml @@ -143,8 +143,8 @@ key: enum.DisposalTaggerUiKey.Key - type: UserInterface interfaces: - - key: enum.DisposalTaggerUiKey.Key - type: DisposalTaggerBoundUserInterface + enum.DisposalTaggerUiKey.Key: + type: DisposalTaggerBoundUserInterface - type: Construction graph: DisposalPipe node: tagger @@ -219,8 +219,8 @@ key: enum.DisposalRouterUiKey.Key - type: UserInterface interfaces: - - key: enum.DisposalRouterUiKey.Key - type: DisposalRouterBoundUserInterface + enum.DisposalRouterUiKey.Key: + type: DisposalRouterBoundUserInterface - type: Fixtures fixtures: fix1: diff --git a/Resources/Prototypes/Entities/Structures/Piping/Disposal/units.yml b/Resources/Prototypes/Entities/Structures/Piping/Disposal/units.yml index 43dc63445c..b4a5f61ffa 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Disposal/units.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Disposal/units.yml @@ -56,8 +56,8 @@ - type: Appearance - type: UserInterface interfaces: - - key: enum.DisposalUnitUiKey.Key - type: DisposalUnitBoundUserInterface + enum.DisposalUnitUiKey.Key: + type: DisposalUnitBoundUserInterface - type: ContainerContainer containers: disposals: !type:Container @@ -79,8 +79,8 @@ - type: DisposalUnit - type: UserInterface interfaces: - - key: enum.DisposalUnitUiKey.Key - type: DisposalUnitBoundUserInterface + enum.DisposalUnitUiKey.Key: + type: DisposalUnitBoundUserInterface - type: RatKingRummageable - type: entity @@ -129,7 +129,7 @@ - type: Appearance - type: UserInterface interfaces: - - key: enum.MailingUnitUiKey.Key - type: DisposalUnitBoundUserInterface - - key: enum.ConfigurationUiKey.Key - type: ConfigurationBoundUserInterface + enum.MailingUnitUiKey.Key: + type: DisposalUnitBoundUserInterface + enum.ConfigurationUiKey.Key: + type: ConfigurationBoundUserInterface diff --git a/Resources/Prototypes/Entities/Structures/Power/Generation/PA/control_box.yml b/Resources/Prototypes/Entities/Structures/Power/Generation/PA/control_box.yml index ca0cebffec..96392ecd00 100644 --- a/Resources/Prototypes/Entities/Structures/Power/Generation/PA/control_box.yml +++ b/Resources/Prototypes/Entities/Structures/Power/Generation/PA/control_box.yml @@ -17,10 +17,10 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.ParticleAcceleratorControlBoxUiKey.Key - type: ParticleAcceleratorBoundUserInterface - - key: enum.WiresUiKey.Key - type: WiresBoundUserInterface + enum.ParticleAcceleratorControlBoxUiKey.Key: + type: ParticleAcceleratorBoundUserInterface + enum.WiresUiKey.Key: + type: WiresBoundUserInterface - type: WiresPanel - type: Wires boardName: wires-board-name-pa diff --git a/Resources/Prototypes/Entities/Structures/Power/Generation/ame.yml b/Resources/Prototypes/Entities/Structures/Power/Generation/ame.yml index c88adca76d..4e4ef8bdbc 100644 --- a/Resources/Prototypes/Entities/Structures/Power/Generation/ame.yml +++ b/Resources/Prototypes/Entities/Structures/Power/Generation/ame.yml @@ -65,8 +65,8 @@ key: enum.AmeControllerUiKey.Key - type: UserInterface interfaces: - - key: enum.AmeControllerUiKey.Key - type: AmeControllerBoundUserInterface + enum.AmeControllerUiKey.Key: + type: AmeControllerBoundUserInterface - type: Appearance - type: GenericVisualizer visuals: diff --git a/Resources/Prototypes/Entities/Structures/Power/Generation/portable_generator.yml b/Resources/Prototypes/Entities/Structures/Power/Generation/portable_generator.yml index dbaacd6abc..d735d9607c 100644 --- a/Resources/Prototypes/Entities/Structures/Power/Generation/portable_generator.yml +++ b/Resources/Prototypes/Entities/Structures/Power/Generation/portable_generator.yml @@ -44,7 +44,7 @@ - type: WiresPanel - type: UserInterface interfaces: - - key: enum.GeneratorComponentUiKey.Key + enum.GeneratorComponentUiKey.Key: type: PortableGeneratorBoundUserInterface - type: ActivatableUI key: enum.GeneratorComponentUiKey.Key diff --git a/Resources/Prototypes/Entities/Structures/Power/apc.yml b/Resources/Prototypes/Entities/Structures/Power/apc.yml index 4df502791f..71e4506495 100644 --- a/Resources/Prototypes/Entities/Structures/Power/apc.yml +++ b/Resources/Prototypes/Entities/Structures/Power/apc.yml @@ -81,8 +81,8 @@ - type: ExtensionCableProvider - type: UserInterface interfaces: - - key: enum.ApcUiKey.Key - type: ApcBoundUserInterface + enum.ApcUiKey.Key: + type: ApcBoundUserInterface - type: ActivatableUI inHandsOnly: false singleUser: true diff --git a/Resources/Prototypes/Entities/Structures/Specific/Janitor/janicart.yml b/Resources/Prototypes/Entities/Structures/Specific/Janitor/janicart.yml index 2591b3f340..9fd05beaee 100644 --- a/Resources/Prototypes/Entities/Structures/Specific/Janitor/janicart.yml +++ b/Resources/Prototypes/Entities/Structures/Specific/Janitor/janicart.yml @@ -313,8 +313,8 @@ fillBaseName: cart_water- - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: Drink solution: bucket - type: ContainerContainer diff --git a/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml b/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml index cd44f5f585..b38ef61791 100644 --- a/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml +++ b/Resources/Prototypes/Entities/Structures/Storage/Canisters/gas_canisters.yml @@ -36,7 +36,7 @@ 3: { state: can-o3, shader: "unshaded" } - type: UserInterface interfaces: - - key: enum.GasCanisterUiKey.Key + enum.GasCanisterUiKey.Key: type: GasCanisterBoundUserInterface - type: Destructible thresholds: diff --git a/Resources/Prototypes/Entities/Structures/Storage/filing_cabinets.yml b/Resources/Prototypes/Entities/Structures/Storage/filing_cabinets.yml index d341c017a7..08db462be0 100644 --- a/Resources/Prototypes/Entities/Structures/Storage/filing_cabinets.yml +++ b/Resources/Prototypes/Entities/Structures/Storage/filing_cabinets.yml @@ -24,8 +24,8 @@ map: ["openLayer"] - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: Transform noRot: true - type: Fixtures @@ -113,8 +113,8 @@ - type: Appearance - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: Transform noRot: true - type: Fixtures diff --git a/Resources/Prototypes/Entities/Structures/Storage/ore_box.yml b/Resources/Prototypes/Entities/Structures/Storage/ore_box.yml index 961d7854c0..b26bb2c954 100644 --- a/Resources/Prototypes/Entities/Structures/Storage/ore_box.yml +++ b/Resources/Prototypes/Entities/Structures/Storage/ore_box.yml @@ -60,8 +60,8 @@ - Ore - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: ContainerContainer containers: storagebase: !type:Container diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml index 62f2000593..7f306bbf94 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/air_alarm.yml @@ -57,10 +57,10 @@ - type: InteractionOutline - type: UserInterface interfaces: - - key: enum.SharedAirAlarmInterfaceKey.Key - type: AirAlarmBoundUserInterface - - key: enum.WiresUiKey.Key - type: WiresBoundUserInterface + enum.SharedAirAlarmInterfaceKey.Key: + type: AirAlarmBoundUserInterface + enum.WiresUiKey.Key: + type: WiresBoundUserInterface - type: WiresPanel - type: Wires boardName: wires-board-name-airalarm diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml index 05988fbc21..3088e0a001 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/fire_alarm.yml @@ -60,8 +60,8 @@ delta: fire_3 - type: UserInterface interfaces: - - key: enum.WiresUiKey.Key - type: WiresBoundUserInterface + enum.WiresUiKey.Key: + type: WiresBoundUserInterface - type: WiresPanel - type: Wires boardName: wires-board-name-firealarm diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/intercom.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/intercom.yml index 037a89a988..2cf77d843c 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/intercom.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/intercom.yml @@ -63,9 +63,9 @@ key: enum.IntercomUiKey.Key - type: UserInterface interfaces: - - key: enum.IntercomUiKey.Key + enum.IntercomUiKey.Key: type: IntercomBoundUserInterface - - key: enum.WiresUiKey.Key + enum.WiresUiKey.Key: type: WiresBoundUserInterface - type: Construction graph: Intercom diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/mirror.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/mirror.yml index b524f099bf..d02bce020d 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/mirror.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/mirror.yml @@ -16,5 +16,5 @@ key: enum.MagicMirrorUiKey.Key - type: UserInterface interfaces: - - key: enum.MagicMirrorUiKey.Key - type: MagicMirrorBoundUserInterface + enum.MagicMirrorUiKey.Key: + type: MagicMirrorBoundUserInterface diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/monitors_televisions.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/monitors_televisions.yml index 451495f58d..408ab6b67c 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/monitors_televisions.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/monitors_televisions.yml @@ -110,8 +110,8 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.SurveillanceCameraMonitorUiKey.Key - type: SurveillanceCameraMonitorBoundUserInterface + enum.SurveillanceCameraMonitorUiKey.Key: + type: SurveillanceCameraMonitorBoundUserInterface # Wall Televisions @@ -169,8 +169,8 @@ - type: ActivatableUIRequiresPower - type: UserInterface interfaces: - - key: enum.SurveillanceCameraMonitorUiKey.Key - type: SurveillanceCameraMonitorBoundUserInterface + enum.SurveillanceCameraMonitorUiKey.Key: + type: SurveillanceCameraMonitorBoundUserInterface - type: PointLight radius: 1.5 energy: 1.6 diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/noticeboard.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/noticeboard.yml index 421ab93be9..f2315583e3 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/noticeboard.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/noticeboard.yml @@ -50,8 +50,8 @@ - Write - type: UserInterface interfaces: - - key: enum.StorageUiKey.Key - type: StorageBoundUserInterface + enum.StorageUiKey.Key: + type: StorageBoundUserInterface - type: ContainerContainer containers: storagebase: !type:Container diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/station_map.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/station_map.yml index d1df619b7a..2ae5040910 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/station_map.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/station_map.yml @@ -86,7 +86,7 @@ acts: [ "Destruction" ] - type: UserInterface interfaces: - - key: enum.StationMapUiKey.Key + enum.StationMapUiKey.Key: type: StationMapBoundUserInterface - type: entity diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/surveillance_camera.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/surveillance_camera.yml index dfbe99b2d2..2ac81b463a 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/surveillance_camera.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/surveillance_camera.yml @@ -42,9 +42,9 @@ InUse: camera_in_use - type: UserInterface interfaces: - - key: enum.SurveillanceCameraSetupUiKey.Camera + enum.SurveillanceCameraSetupUiKey.Camera: type: SurveillanceCameraSetupBoundUi - - key: enum.WiresUiKey.Key + enum.WiresUiKey.Key: type: WiresBoundUserInterface - type: StaticPrice price: 200 diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/timer.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/timer.yml index 0c284eec7a..dd7eb5bea8 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/timer.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/timer.yml @@ -32,8 +32,8 @@ key: enum.SignalTimerUiKey.Key - type: UserInterface interfaces: - - key: enum.SignalTimerUiKey.Key - type: SignalTimerBoundUserInterface + enum.SignalTimerUiKey.Key: + type: SignalTimerBoundUserInterface - type: ApcPowerReceiver powerLoad: 100 - type: Electrified diff --git a/Resources/Prototypes/Entities/Structures/cryopod.yml b/Resources/Prototypes/Entities/Structures/cryopod.yml index 9063e8b138..bdb8862a82 100644 --- a/Resources/Prototypes/Entities/Structures/cryopod.yml +++ b/Resources/Prototypes/Entities/Structures/cryopod.yml @@ -12,8 +12,8 @@ map: ["base"] - type: UserInterface interfaces: - - key: enum.CryostorageUIKey.Key - type: CryostorageBoundUserInterface + enum.CryostorageUIKey.Key: + type: CryostorageBoundUserInterface - type: ActivatableUI key: enum.CryostorageUIKey.Key - type: AccessReader diff --git a/Resources/Prototypes/XenoArch/Effects/utility_effects.yml b/Resources/Prototypes/XenoArch/Effects/utility_effects.yml index 911c1c2e88..84df09af33 100644 --- a/Resources/Prototypes/XenoArch/Effects/utility_effects.yml +++ b/Resources/Prototypes/XenoArch/Effects/utility_effects.yml @@ -214,8 +214,8 @@ permanentComponents: - type: UserInterface interfaces: - - key: enum.SignalLinkerUiKey.Key - type: SignalPortSelectorBoundUserInterface + enum.SignalLinkerUiKey.Key: + type: SignalPortSelectorBoundUserInterface - type: ToolTileCompatible - type: Tool qualities: