]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Content update for NetEntities (#18935)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Sun, 10 Sep 2023 23:42:41 +0000 (09:42 +1000)
committerGitHub <noreply@github.com>
Sun, 10 Sep 2023 23:42:41 +0000 (09:42 +1000)
526 files changed:
Content.Client/Actions/ActionsSystem.cs
Content.Client/Administration/AdminNameOverlay.cs
Content.Client/Administration/Systems/AdminVerbSystem.cs
Content.Client/Administration/UI/CustomControls/PlayerListControl.xaml.cs
Content.Client/Administration/UI/ManageSolutions/EditSolutionsEui.cs
Content.Client/Administration/UI/SetOutfit/SetOutfitEui.cs
Content.Client/Administration/UI/SpawnExplosion/SpawnExplosionEui.cs
Content.Client/Administration/UI/Tabs/AdminbusTab/LoadBlueprintsWindow.xaml.cs
Content.Client/Administration/UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs
Content.Client/Administration/UI/Tabs/AtmosTab/SetTemperatureWindow.xaml.cs
Content.Client/Administration/UI/Tabs/PlayerTab/PlayerTab.xaml.cs
Content.Client/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs
Content.Client/Atmos/EntitySystems/GasTileOverlaySystem.cs
Content.Client/Atmos/UI/GasAnalyzerWindow.xaml.cs
Content.Client/Beam/BeamSystem.cs
Content.Client/Bql/ToolshedVisualizeWindow.xaml.cs
Content.Client/Buckle/BuckleSystem.cs
Content.Client/Camera/CameraRecoilSystem.cs
Content.Client/CardboardBox/CardboardBoxSystem.cs
Content.Client/CartridgeLoader/CartridgeLoaderBoundUserInterface.cs
Content.Client/CharacterInfo/CharacterInfoSystem.cs
Content.Client/Clothing/ClientClothingSystem.cs
Content.Client/Construction/ConstructionGhostComponent.cs
Content.Client/Construction/ConstructionPlacementHijack.cs
Content.Client/Construction/ConstructionSystem.cs
Content.Client/ContextMenu/UI/EntityMenuElement.cs
Content.Client/ContextMenu/UI/EntityMenuUIController.cs
Content.Client/CrewManifest/CrewManifestSystem.cs
Content.Client/Decals/DecalPlacementSystem.cs
Content.Client/Decals/DecalSystem.cs
Content.Client/Disposal/Systems/DisposalUnitSystem.cs
Content.Client/DragDrop/DragDropSystem.cs
Content.Client/Effects/ColorFlashEffectSystem.cs
Content.Client/Examine/ExamineSystem.cs
Content.Client/Explosion/ExplosionOverlaySystem.cs
Content.Client/Fax/AdminUI/AdminFaxEui.cs
Content.Client/Fluids/PuddleDebugOverlaySystem.cs
Content.Client/GameTicking/Managers/ClientGameTicker.cs
Content.Client/Gameplay/GameplayStateBase.cs
Content.Client/Gateway/UI/GatewayBoundUserInterface.cs
Content.Client/Gateway/UI/GatewayWindow.xaml.cs
Content.Client/Hands/Systems/HandsSystem.cs
Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs
Content.Client/Humanoid/HumanoidAppearanceSystem.cs
Content.Client/Instruments/InstrumentSystem.cs
Content.Client/Instruments/UI/BandMenu.xaml.cs
Content.Client/Instruments/UI/InstrumentBoundUserInterface.cs
Content.Client/Inventory/ClientInventorySystem.cs
Content.Client/Items/Systems/ItemSystem.cs
Content.Client/Kitchen/UI/GrinderMenu.xaml.cs
Content.Client/Kitchen/UI/MicrowaveBoundUserInterface.cs
Content.Client/Kitchen/UI/ReagentGrinderBoundUserInterface.cs
Content.Client/LateJoin/LateJoinGui.cs
Content.Client/Light/RgbLightControllerSystem.cs
Content.Client/Maps/GridDraggingSystem.cs
Content.Client/MassMedia/Ui/NewsWriteBoundUserInterface.cs
Content.Client/Mech/Ui/Equipment/MechGrabberUi.cs
Content.Client/Mech/Ui/Equipment/MechGrabberUiFragment.xaml.cs
Content.Client/Mech/Ui/Equipment/MechSoundboardUi.cs
Content.Client/Mech/Ui/MechBoundUserInterface.cs
Content.Client/Medical/CrewMonitoring/CrewMonitoringWindow.xaml.cs
Content.Client/NPC/HTN/HTNSystem.cs
Content.Client/NPC/NPCSteeringSystem.cs
Content.Client/NPC/PathfindingSystem.cs
Content.Client/NodeContainer/NodeGroupSystem.cs
Content.Client/NodeContainer/NodeVisualizationOverlay.cs
Content.Client/Pointing/PointingSystem.cs
Content.Client/Popups/PopupSystem.cs
Content.Client/Projectiles/ProjectileSystem.cs
Content.Client/Radiation/Overlays/RadiationDebugOverlay.cs
Content.Client/Radiation/Systems/GeigerSystem.cs
Content.Client/Radiation/Systems/RadiationSystem.cs
Content.Client/Replay/Spectator/ReplaySpectatorSystem.Movement.cs
Content.Client/Replay/Spectator/ReplaySpectatorSystem.Position.cs
Content.Client/Replay/Spectator/ReplaySpectatorSystem.Spectate.cs
Content.Client/RoundEnd/RoundEndSummaryWindow.cs
Content.Client/Salvage/FultonSystem.cs
Content.Client/Shuttles/BUI/RadarConsoleBoundUserInterface.cs
Content.Client/Shuttles/BUI/ShuttleConsoleBoundUserInterface.cs
Content.Client/Shuttles/Systems/ShuttleConsoleSystem.cs
Content.Client/Shuttles/Systems/ShuttleSystem.EmergencyConsole.cs
Content.Client/Shuttles/UI/DockingControl.cs
Content.Client/Shuttles/UI/RadarControl.cs
Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml.cs
Content.Client/Silicons/Borgs/BorgBoundUserInterface.cs
Content.Client/Spawners/TimedDespawnSystem.cs
Content.Client/Station/StationSystem.cs
Content.Client/StationRecords/GeneralStationRecordConsoleBoundUserInterface.cs
Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs
Content.Client/StationRecords/StationRecordsSystem.cs [new file with mode: 0644]
Content.Client/Storage/StorageBoundUserInterface.cs
Content.Client/Storage/Systems/StorageSystem.cs
Content.Client/Storage/UI/StorageWindow.cs
Content.Client/SurveillanceCamera/UI/SurveillanceCameraMonitorBoundUi.cs
Content.Client/Tabletop/TabletopSystem.cs
Content.Client/UserInterface/Systems/Actions/ActionUIController.cs
Content.Client/UserInterface/Systems/Chat/ChatUIController.cs
Content.Client/UserInterface/Systems/Ghost/Controls/GhostTargetWindow.xaml.cs
Content.Client/UserInterface/Systems/Ghost/Controls/Roles/MakeGhostRoleEui.cs
Content.Client/UserInterface/Systems/Ghost/GhostUIController.cs
Content.Client/UserInterface/Systems/Inventory/InventoryUIController.cs
Content.Client/Vehicle/VehicleSystem.cs
Content.Client/Verbs/UI/VerbMenuElement.cs
Content.Client/Verbs/UI/VerbMenuUIController.cs
Content.Client/Verbs/VerbSystem.cs
Content.Client/Weapons/Melee/MeleeWeaponSystem.cs
Content.Client/Weapons/Misc/TetherGunSystem.cs
Content.Client/Weapons/Ranged/Systems/GunSystem.Ballistic.cs
Content.Client/Weapons/Ranged/Systems/GunSystem.ChamberMagazine.cs
Content.Client/Weapons/Ranged/Systems/GunSystem.Revolver.cs
Content.Client/Weapons/Ranged/Systems/GunSystem.cs
Content.Client/Xenoarchaeology/Ui/AnalysisConsoleMenu.xaml.cs
Content.IntegrationTests/Pair/TestMapData.cs
Content.IntegrationTests/Pair/TestPair.Helpers.cs
Content.IntegrationTests/Tests/Actions/ActionsAddedTest.cs
Content.IntegrationTests/Tests/Chemistry/DispenserTest.cs
Content.IntegrationTests/Tests/ClickableTest.cs
Content.IntegrationTests/Tests/Climbing/ClimbingTest.cs
Content.IntegrationTests/Tests/Construction/Interaction/ComputerContruction.cs
Content.IntegrationTests/Tests/Construction/Interaction/CraftingTests.cs
Content.IntegrationTests/Tests/Construction/Interaction/GrilleWindowConstruction.cs
Content.IntegrationTests/Tests/Construction/Interaction/MachineConstruction.cs
Content.IntegrationTests/Tests/Construction/Interaction/PanelScrewing.cs
Content.IntegrationTests/Tests/Construction/Interaction/WallConstruction.cs
Content.IntegrationTests/Tests/Construction/Interaction/WindowConstruction.cs
Content.IntegrationTests/Tests/Construction/Interaction/WindowRepair.cs
Content.IntegrationTests/Tests/ContainerOcclusionTest.cs
Content.IntegrationTests/Tests/DoAfter/DoAfterCancellationTests.cs
Content.IntegrationTests/Tests/DoAfter/DoAfterServerTest.cs
Content.IntegrationTests/Tests/EntityTest.cs
Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs
Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs
Content.IntegrationTests/Tests/Interaction/InteractionTest.Helpers.cs
Content.IntegrationTests/Tests/Interaction/InteractionTest.cs
Content.IntegrationTests/Tests/Interaction/InteractionTestSystem.cs
Content.IntegrationTests/Tests/Interaction/MovementTest.cs
Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs
Content.IntegrationTests/Tests/Payload/ModularGrenadeTests.cs
Content.IntegrationTests/Tests/Slipping/SlippingTest.cs
Content.IntegrationTests/Tests/Tiles/TileConstructionTests.cs
Content.Server/Access/Systems/AccessOverriderSystem.cs
Content.Server/Access/Systems/AgentIDCardSystem.cs
Content.Server/Administration/Commands/AddBodyPartCommand.cs
Content.Server/Administration/Commands/AddEntityStorageCommand.cs
Content.Server/Administration/Commands/AddMechanismCommand.cs
Content.Server/Administration/Commands/AddPolymorphActionCommand.cs
Content.Server/Administration/Commands/AddReagent.cs
Content.Server/Administration/Commands/ClearBluespaceLockerLinks.cs
Content.Server/Administration/Commands/DirtyCommand.cs
Content.Server/Administration/Commands/LinkBluespaceLocker.cs
Content.Server/Administration/Commands/OSay.cs
Content.Server/Administration/Commands/RemoveBodyPartCommand.cs
Content.Server/Administration/Commands/RemoveEntityStorageCommand.cs
Content.Server/Administration/Commands/RemoveMechanismCommand.cs
Content.Server/Administration/Commands/SetSolutionCapacity.cs
Content.Server/Administration/Commands/SetSolutionTemperature.cs
Content.Server/Administration/Commands/SetSolutionThermalEnergy.cs
Content.Server/Administration/Commands/VariantizeCommand.cs
Content.Server/Administration/Systems/AdminSystem.cs
Content.Server/Administration/UI/EditSolutionsEui.cs
Content.Server/Administration/UI/SetOutfitEui.cs
Content.Server/Ame/EntitySystems/AmeControllerSystem.cs
Content.Server/Animals/Systems/UdderSystem.cs
Content.Server/Anomaly/AnomalySystem.Commands.cs
Content.Server/Anomaly/AnomalySystem.Scanner.cs
Content.Server/Atmos/Commands/AddAtmosCommand.cs
Content.Server/Atmos/Commands/AddGasCommand.cs
Content.Server/Atmos/Commands/DeleteGasCommand.cs
Content.Server/Atmos/Commands/FillGasCommand.cs
Content.Server/Atmos/Commands/RemoveGasCommand.cs
Content.Server/Atmos/Commands/SetAtmosTemperatureCommand.cs
Content.Server/Atmos/Commands/SetTemperatureCommand.cs
Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs
Content.Server/Atmos/EntitySystems/AtmosphereSystem.Commands.cs
Content.Server/Atmos/EntitySystems/GasAnalyzerSystem.cs
Content.Server/Atmos/EntitySystems/GasTankSystem.cs
Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs
Content.Server/Beam/BeamSystem.cs
Content.Server/Body/Commands/AddHandCommand.cs
Content.Server/Body/Commands/AttachBodyPartCommand.cs
Content.Server/Body/Systems/InternalsSystem.cs
Content.Server/Botany/Systems/BotanySwabSystem.cs
Content.Server/Camera/CameraRecoilSystem.cs
Content.Server/CardboardBox/CardboardBoxSystem.cs
Content.Server/Cargo/Systems/CargoSystem.Orders.cs
Content.Server/Cargo/Systems/CargoSystem.Shuttle.cs
Content.Server/Cargo/Systems/PricingSystem.cs
Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs
Content.Server/CartridgeLoader/Cartridges/CrewManifestCartridgeSystem.cs
Content.Server/CartridgeLoader/Cartridges/NotekeeperCartridgeSystem.cs
Content.Server/CharacterInfo/CharacterInfoSystem.cs
Content.Server/Chat/Managers/ChatManager.cs
Content.Server/Chat/Systems/ChatSystem.cs
Content.Server/Chemistry/EntitySystems/ChemistrySystem.Injector.cs
Content.Server/Chunking/ChunkingSystem.cs
Content.Server/Climbing/ClimbSystem.cs
Content.Server/Cloning/CloningConsoleSystem.cs
Content.Server/Communications/CommsHackerSystem.cs
Content.Server/Communications/CommunicationsConsoleSystem.cs
Content.Server/Configurable/ConfigurationSystem.cs
Content.Server/Construction/Commands/FixRotationsCommand.cs
Content.Server/Construction/Commands/TileReplaceCommand.cs
Content.Server/Construction/Commands/TileWallsCommand.cs
Content.Server/Construction/ConstructionSystem.Initial.cs
Content.Server/Construction/ConstructionSystem.Interactions.cs
Content.Server/Construction/PartExchangerSystem.cs
Content.Server/Crayon/CrayonSystem.cs
Content.Server/CrewManifest/CrewManifestSystem.cs
Content.Server/Damage/Commands/GodModeCommand.cs
Content.Server/Damage/Commands/HurtCommand.cs
Content.Server/Decals/Commands/AddDecalCommand.cs
Content.Server/Decals/Commands/EditDecalCommand.cs
Content.Server/Decals/Commands/RemoveDecalCommand.cs
Content.Server/Decals/DecalSystem.cs
Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs
Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs
Content.Server/Disposal/Mailing/MailingUnitSystem.cs
Content.Server/Disposal/Tube/DisposalTubeSystem.cs
Content.Server/Disposal/TubeConnectionsCommand.cs
Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs
Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs
Content.Server/Effects/ColorFlashEffectSystem.cs
Content.Server/Electrocution/ElectrocuteCommand.cs
Content.Server/Engineering/EntitySystems/DisassembleOnAltVerbSystem.cs
Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs
Content.Server/Ensnaring/EnsnareableSystem.Ensnaring.cs
Content.Server/Examine/ExamineSystem.cs
Content.Server/Explosion/EntitySystems/ExplosionSystem.TileFill.cs
Content.Server/Explosion/EntitySystems/ExplosionSystem.Visuals.cs
Content.Server/Explosion/EntitySystems/TriggerSystem.cs
Content.Server/Fax/AdminUI/AdminFaxEui.cs
Content.Server/Fluids/EntitySystems/DrainSystem.cs
Content.Server/Fluids/EntitySystems/PuddleDebugDebugOverlaySystem.cs
Content.Server/Fluids/EntitySystems/PuddleSystem.Spillable.cs
Content.Server/Forensics/Systems/ForensicPadSystem.cs
Content.Server/Forensics/Systems/ForensicScannerSystem.cs
Content.Server/GameTicking/Commands/JoinGameCommand.cs
Content.Server/GameTicking/GameTicker.GameRule.cs
Content.Server/GameTicking/GameTicker.RoundFlow.cs
Content.Server/Gateway/Systems/GatewaySystem.cs
Content.Server/Ghost/GhostSystem.cs
Content.Server/Ghost/Roles/MakeGhostRoleCommand.cs
Content.Server/Ghost/Roles/UI/MakeGhostRoleEui.cs
Content.Server/Guardian/GuardianSystem.cs
Content.Server/Hands/Systems/HandsSystem.cs
Content.Server/Implants/ImplanterSystem.cs
Content.Server/Instruments/InstrumentSystem.cs
Content.Server/Interaction/InteractionSystem.cs
Content.Server/Kitchen/EntitySystems/KitchenSpikeSystem.cs
Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs
Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs
Content.Server/Kitchen/EntitySystems/SharpSystem.cs
Content.Server/Lathe/LatheSystem.cs
Content.Server/Light/EntitySystems/PoweredLightSystem.cs
Content.Server/Magic/MagicSystem.cs
Content.Server/Maps/GridDraggingSystem.cs
Content.Server/MassMedia/Systems/NewsSystem.cs
Content.Server/Mech/Equipment/EntitySystems/MechGrabberSystem.cs
Content.Server/Mech/Systems/MechEquipmentSystem.cs
Content.Server/Mech/Systems/MechSystem.cs
Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs
Content.Server/Medical/CrewMonitoring/CrewMonitoringConsoleSystem.cs
Content.Server/Medical/CryoPodSystem.cs
Content.Server/Medical/DefibrillatorSystem.cs
Content.Server/Medical/HealingSystem.cs
Content.Server/Medical/HealthAnalyzerSystem.cs
Content.Server/Medical/Stethoscope/StethoscopeSystem.cs
Content.Server/Medical/SuitSensors/SuitSensorSystem.cs
Content.Server/Mind/Commands/MakeSentientCommand.cs
Content.Server/Mind/Commands/RenameCommand.cs
Content.Server/NPC/HTN/HTNSystem.cs
Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs
Content.Server/NPC/Pathfinding/PathfindingSystem.cs
Content.Server/NPC/Systems/NPCSteeringSystem.cs
Content.Server/Ninja/Systems/BatteryDrainerSystem.cs
Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs
Content.Server/Nuke/Commands/SendNukeCodesCommand.cs
Content.Server/Nuke/Commands/ToggleNukeCommand.cs
Content.Server/Nuke/NukeSystem.cs
Content.Server/Nutrition/EntitySystems/DrinkSystem.cs
Content.Server/Nutrition/EntitySystems/FoodSystem.cs
Content.Server/Nutrition/EntitySystems/SmokingSystem.Vape.cs
Content.Server/PDA/PdaSystem.cs
Content.Server/PDA/Ringer/RingerSystem.cs
Content.Server/Paper/PaperSystem.cs
Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorSystem.ControlBox.cs
Content.Server/Pointing/EntitySystems/PointingSystem.cs
Content.Server/Popups/PopupSystem.cs
Content.Server/Power/EntitySystems/PowerMonitoringConsoleSystem.cs
Content.Server/Power/Generator/PortableGeneratorSystem.cs
Content.Server/Power/SetBatteryPercentCommand.cs
Content.Server/Projectiles/ProjectileSystem.cs
Content.Server/Radiation/Systems/GeigerSystem.cs
Content.Server/Radiation/Systems/RadiationSystem.Debug.cs
Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs
Content.Server/Radio/EntitySystems/RadioSystem.cs
Content.Server/Resist/EscapeInventorySystem.cs
Content.Server/Resist/ResistLockerSystem.cs
Content.Server/Revenant/EntitySystems/RevenantSystem.Abilities.cs
Content.Server/Salvage/FultonSystem.cs
Content.Server/SensorMonitoring/SensorMonitoringConsoleSystem.UI.cs
Content.Server/Sericulture/SericultureSystem.cs
Content.Server/Shuttles/Commands/DockCommand.cs
Content.Server/Shuttles/Systems/DockingSystem.AutoDock.cs
Content.Server/Shuttles/Systems/DockingSystem.cs
Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs
Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
Content.Server/Shuttles/Systems/RadarConsoleSystem.cs
Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs
Content.Server/Silicons/Borgs/BorgSystem.Ui.cs
Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs
Content.Server/Singularity/Events/EntityConsumedByEventHorizonEvent.cs
Content.Server/Singularity/Events/EventHorizonConsumedEntityEvent.cs
Content.Server/SprayPainter/SprayPainterSystem.cs
Content.Server/Station/Systems/StationJobsSystem.cs
Content.Server/Station/Systems/StationSystem.cs
Content.Server/StationRecords/Components/GeneralStationRecordConsoleComponent.cs
Content.Server/StationRecords/Components/StationRecordsComponent.cs
Content.Server/StationRecords/StationRecordSet.cs
Content.Server/StationRecords/Systems/GeneralStationRecordConsoleSystem.cs
Content.Server/StationRecords/Systems/StationRecordsSystem.cs
Content.Server/Sticky/Systems/StickySystem.cs
Content.Server/Storage/EntitySystems/BluespaceLockerSystem.cs
Content.Server/Storage/EntitySystems/StorageSystem.cs
Content.Server/Store/Systems/StoreSystem.Command.cs
Content.Server/Store/Systems/StoreSystem.Ui.cs
Content.Server/Store/Systems/StoreSystem.cs
Content.Server/Strip/StrippableSystem.cs
Content.Server/SurveillanceCamera/Systems/SurveillanceCameraMonitorSystem.cs
Content.Server/Tabletop/TabletopSystem.Session.cs
Content.Server/Tabletop/TabletopSystem.cs
Content.Server/Teleportation/HandTeleporterSystem.cs
Content.Server/Tools/ToolSystem.LatticeCutting.cs
Content.Server/Tools/ToolSystem.TilePrying.cs
Content.Server/Toolshed/Commands/Verbs/RunVerbAsCommand.cs
Content.Server/Toolshed/Commands/VisualizeCommand.cs
Content.Server/Verbs/VerbSystem.cs
Content.Server/VoiceMask/VoiceMaskSystem.cs
Content.Server/Weapons/Melee/MeleeWeaponSystem.cs
Content.Server/Weapons/Ranged/Systems/GunSystem.cs
Content.Server/Wires/WiresSystem.cs
Content.Server/Xenoarchaeology/Equipment/Systems/ArtifactAnalyzerSystem.cs
Content.Server/Xenoarchaeology/XenoArtifacts/ArtifactSystem.Commands.cs
Content.Shared/Access/Components/AccessReaderComponent.cs
Content.Shared/Access/Systems/AccessReaderSystem.cs
Content.Shared/Actions/ActionEvents.cs
Content.Shared/Actions/ActionsComponent.cs
Content.Shared/Actions/BaseActionComponent.cs
Content.Shared/Actions/EntityTargetActionComponent.cs
Content.Shared/Actions/InstantActionComponent.cs
Content.Shared/Actions/SharedActionsSystem.cs
Content.Shared/Actions/WorldTargetActionComponent.cs
Content.Shared/Administration/EditSolutionsEuiState.cs
Content.Shared/Administration/PlayerInfo.cs
Content.Shared/Administration/SetOutfitEuiState.cs
Content.Shared/Atmos/Components/GasAnalyzerComponent.cs
Content.Shared/Atmos/EntitySystems/SharedAtmosDebugOverlaySystem.cs
Content.Shared/Atmos/EntitySystems/SharedGasTileOverlaySystem.cs
Content.Shared/Beam/Components/SharedBeamComponent.cs
Content.Shared/Body/Organ/OrganComponentState.cs
Content.Shared/Body/Organ/OrganSlot.cs
Content.Shared/Body/Part/BodyPartComponentState.cs
Content.Shared/Body/Part/BodyPartSlot.cs
Content.Shared/Body/Systems/SharedBodySystem.Body.cs
Content.Shared/Body/Systems/SharedBodySystem.Organs.cs
Content.Shared/Body/Systems/SharedBodySystem.Parts.cs
Content.Shared/Bql/ToolshedVisualizeEuiState.cs
Content.Shared/Buckle/Components/BuckleComponent.cs
Content.Shared/Buckle/Components/StrapComponent.cs
Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs
Content.Shared/Buckle/SharedBuckleSystem.Strap.cs
Content.Shared/Camera/SharedCameraRecoilSystem.cs
Content.Shared/CardboardBox/Components/CardboardBoxComponent.cs
Content.Shared/CartridgeLoader/CartridgeLoaderComponent.cs
Content.Shared/CartridgeLoader/CartridgeLoaderUiMessage.cs
Content.Shared/CartridgeLoader/CartridgeLoaderUiState.cs
Content.Shared/CartridgeLoader/CartridgeUiMessage.cs
Content.Shared/CartridgeLoader/Cartridges/NotekeeperUiState.cs
Content.Shared/CartridgeLoader/SharedCartridgeLoaderSystem.cs
Content.Shared/CharacterInfo/SharedCharacterInfoSystem.cs
Content.Shared/Chat/MsgChatMessage.cs
Content.Shared/Climbing/BonkSystem.cs
Content.Shared/Clothing/EntitySystems/ToggleableClothingSystem.cs
Content.Shared/Construction/Events.cs
Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs
Content.Shared/CrewManifest/SharedCrewManifestSystem.cs
Content.Shared/Cuffs/SharedCuffableSystem.cs
Content.Shared/Decals/DecalChunkUpdateEvent.cs
Content.Shared/Decals/SharedDecalSystem.cs
Content.Shared/DeviceNetwork/Components/DeviceListComponent.cs
Content.Shared/DeviceNetwork/Components/NetworkConfiguratorComponent.cs
Content.Shared/DeviceNetwork/Systems/SharedDeviceListSystem.cs
Content.Shared/DeviceNetwork/Systems/SharedNetworkConfiguratorSystem.cs
Content.Shared/Devour/SharedDevourSystem.cs
Content.Shared/Disposal/SharedDisposalUnitSystem.cs
Content.Shared/DoAfter/DoAfter.cs
Content.Shared/DoAfter/DoAfterArgs.cs
Content.Shared/DoAfter/DoAfterComponent.cs
Content.Shared/DoAfter/SharedDoAfterSystem.Update.cs
Content.Shared/DoAfter/SharedDoAfterSystem.cs
Content.Shared/Doors/Components/DoorComponent.cs
Content.Shared/Doors/Systems/SharedDoorSystem.cs
Content.Shared/DragDrop/DragDropRequestEvent.cs
Content.Shared/Effects/ColorFlashEffectEvent.cs
Content.Shared/Examine/ExamineSystemMessages.cs
Content.Shared/Examine/ExamineSystemShared.cs
Content.Shared/Explosion/ExplosionVisualsComponent.cs
Content.Shared/Fax/AdminFaxEui.cs
Content.Shared/Fluids/SharedPuddleDebugOverlaySystem.cs
Content.Shared/Follower/Components/FollowedComponent.cs
Content.Shared/Follower/FollowerSystem.cs
Content.Shared/GameTicking/SharedGameTicker.cs
Content.Shared/Gateway/GatewayUi.cs
Content.Shared/Ghost/Roles/MakeGhostRoleEuiState.cs
Content.Shared/Ghost/Roles/SharedGhostRoleSystem.cs
Content.Shared/Ghost/SharedGhostSystem.cs
Content.Shared/Hands/EntitySystems/SharedHandsSystem.Drop.cs
Content.Shared/Hands/EntitySystems/SharedHandsSystem.Interactions.cs
Content.Shared/Hands/EntitySystems/SharedHandsSystem.Pickup.cs
Content.Shared/Hands/HandEvents.cs
Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs
Content.Shared/Implants/SharedImplanterSystem.cs
Content.Shared/Instruments/SharedInstrumentComponent.cs
Content.Shared/Instruments/UI/InstrumentBoundUserInterfaceMessages.cs
Content.Shared/Interaction/Components/InteractionRelayComponent.cs
Content.Shared/Interaction/Helpers/SharedUnoccludedExtensions.cs
Content.Shared/Interaction/SharedInteractionSystem.Relay.cs
Content.Shared/Interaction/SharedInteractionSystem.cs
Content.Shared/Inventory/Events/InventoryEquipActEvent.cs
Content.Shared/Inventory/InventorySystem.Equip.cs
Content.Shared/Item/ItemComponent.cs
Content.Shared/Kitchen/Components/SharedMicrowave.cs
Content.Shared/Kitchen/SharedReagentGrinder.cs
Content.Shared/Maps/SharedGridDraggingSystem.cs
Content.Shared/MassMedia/Components/SharedNewsWriteComponent.cs
Content.Shared/MassMedia/Systems/SharedNewsSystem.cs
Content.Shared/Mech/Components/MechComponent.cs
Content.Shared/Mech/Components/MechPilotComponent.cs
Content.Shared/Mech/EntitySystems/SharedMechSystem.cs
Content.Shared/Mech/Equipment/Systems/MechSoundboardSystem.cs
Content.Shared/Mech/MechUI.cs
Content.Shared/Medical/SuitSensor/SharedSuitSensor.cs
Content.Shared/MedicalScanner/HealthAnalyzerScannedUserMessage.cs
Content.Shared/Movement/Systems/SharedJetpackSystem.cs
Content.Shared/Movement/Systems/SharedMoverController.Input.cs
Content.Shared/NPC/Events/HTNMessage.cs
Content.Shared/NPC/Events/NPCSteeringDebugEvent.cs
Content.Shared/NPC/Events/PathBreadcrumbsMessage.cs
Content.Shared/NPC/Events/PathPolysRefreshMessage.cs
Content.Shared/NPC/PathPoly.cs
Content.Shared/NodeContainer/NodeVis.cs
Content.Shared/PDA/PdaUpdateState.cs
Content.Shared/Physics/PreventCollideComponent.cs
Content.Shared/Physics/SharedPreventCollideSystem.cs
Content.Shared/Placeable/ItemPlacerComponent.cs
Content.Shared/Placeable/ItemPlacerSystem.cs
Content.Shared/Pointing/PointingEvents.cs
Content.Shared/Popups/SharedPopupSystem.cs
Content.Shared/Projectiles/SharedProjectileSystem.cs
Content.Shared/Pulling/Components/PullableComponent.cs
Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs
Content.Shared/RCD/Systems/RCDSystem.cs
Content.Shared/Radiation/Components/GeigerComponent.cs
Content.Shared/Radiation/Events/OnRadiationOverlayUpdateEvent.cs
Content.Shared/Radiation/RadiationRay.cs
Content.Shared/Research/Systems/SharedResearchStealerSystem.cs
Content.Shared/Salvage/Fulton/SharedFultonSystem.cs
Content.Shared/Shuttles/BUIStates/RadarConsoleBoundInterfaceState.cs
Content.Shared/Shuttles/BUIStates/ShuttleConsoleBoundInterfaceState.cs
Content.Shared/Shuttles/Events/AutodockRequestMessage.cs
Content.Shared/Shuttles/Events/EmergencyShuttlePositionMessage.cs
Content.Shared/Shuttles/Events/ShuttleConsoleFTLRequestMessage.cs
Content.Shared/Shuttles/Events/StopAutodockRequestMessage.cs
Content.Shared/Shuttles/Events/UndockRequestMessage.cs
Content.Shared/Shuttles/Systems/SharedShuttleConsoleSystem.cs
Content.Shared/Silicons/Borgs/BorgUI.cs
Content.Shared/Silicons/Borgs/Components/BorgChassisComponent.cs
Content.Shared/Station/StationsUpdatedEvent.cs
Content.Shared/StationRecords/SharedGeneralStationRecordConsoleSystem.cs
Content.Shared/StationRecords/SharedStationRecordsSystem.cs [new file with mode: 0644]
Content.Shared/StationRecords/StationRecordKey.cs
Content.Shared/StationRecords/StationRecordKeyStorageComponent.cs
Content.Shared/StationRecords/StationRecordKeyStorageSystem.cs
Content.Shared/StepTrigger/Components/StepTriggerComponent.cs
Content.Shared/StepTrigger/Systems/StepTriggerSystem.cs
Content.Shared/Storage/Components/BinComponent.cs
Content.Shared/Storage/EntitySystems/BinSystem.cs
Content.Shared/Storage/EntitySystems/DumpableSystem.cs
Content.Shared/Storage/Events.cs
Content.Shared/Storage/SharedStorageComponent.cs
Content.Shared/SurveillanceCamera/SharedSurveillanceCameraMonitorSystem.cs
Content.Shared/Tabletop/Events/TabletopDraggingPlayerChangedEvent.cs
Content.Shared/Tabletop/Events/TabletopMoveEvent.cs
Content.Shared/Tabletop/Events/TabletopPlayEvent.cs
Content.Shared/Tabletop/Events/TabletopStopPlayingEvent.cs
Content.Shared/Tabletop/SharedTabletopSystem.cs
Content.Shared/Teleportation/Components/LinkedEntityComponent.cs
Content.Shared/Teleportation/Components/PortalTimeoutComponent.cs
Content.Shared/Teleportation/Systems/LinkedEntitySystem.cs
Content.Shared/Teleportation/Systems/SharedPortalSystem.cs
Content.Shared/Throwing/ThrownItemComponent.cs
Content.Shared/Throwing/ThrownItemSystem.cs
Content.Shared/Tools/Systems/SharedToolSystem.cs
Content.Shared/Vehicle/Components/RiderComponent.cs
Content.Shared/Vehicle/SharedVehicleSystem.Rider.cs
Content.Shared/VendingMachines/SharedVendingMachineSystem.Restock.cs
Content.Shared/Verbs/SharedVerbSystem.cs
Content.Shared/Verbs/Verb.cs
Content.Shared/Verbs/VerbEvents.cs
Content.Shared/Weapons/Melee/Events/AttackEvent.cs
Content.Shared/Weapons/Melee/Events/DisarmAttackEvent.cs
Content.Shared/Weapons/Melee/Events/HeavyAttackEvent.cs
Content.Shared/Weapons/Melee/Events/LightAttackEvent.cs
Content.Shared/Weapons/Melee/Events/MeleeLungeEvent.cs
Content.Shared/Weapons/Melee/Events/StopAttackEvent.cs
Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs
Content.Shared/Weapons/Misc/SharedTetherGunSystem.cs
Content.Shared/Weapons/Ranged/Components/BallisticAmmoProviderComponent.cs
Content.Shared/Weapons/Ranged/Events/MuzzleFlashEvent.cs
Content.Shared/Weapons/Ranged/Events/RequestShootEvent.cs
Content.Shared/Weapons/Ranged/Events/RequestStopShootEvent.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Revolver.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs
Content.Shared/Wieldable/WieldableSystem.cs
Content.Shared/Xenoarchaeology/Equipment/SharedArtifactAnalyzer.cs

index 2d9b777abd767510600805d8ddf54da69809808a..c95ce2d526a49c9029a0aaf179e6c0f836562b00 100644 (file)
@@ -67,12 +67,12 @@ namespace Content.Client.Actions
                 return;
 
             component.Actions.Clear();
-            component.Actions.UnionWith(state.Actions);
+            component.Actions.UnionWith(GetEntitySet(state.Actions));
 
             _actionHoldersQueue.Enqueue(uid);
         }
 
-        protected override void AddActionInternal(EntityUid holderId, EntityUid actionId, IContainer container, ActionsComponent holder)
+        protected override void AddActionInternal(EntityUid holderId, EntityUid actionId, BaseContainer container, ActionsComponent holder)
         {
             // Sometimes the client receives actions from the server, before predicting that newly added components will add
             // their own shared actions. Just in case those systems ever decided to directly access action properties (e.g.,
@@ -87,7 +87,7 @@ namespace Content.Client.Actions
             }
         }
 
-        public override void AddAction(EntityUid holderId, EntityUid actionId, EntityUid? provider, ActionsComponent? holder = null, BaseActionComponent? action = null, bool dirty = true, IContainer? actionContainer = null)
+        public override void AddAction(EntityUid holderId, EntityUid actionId, EntityUid? provider, ActionsComponent? holder = null, BaseActionComponent? action = null, bool dirty = true, BaseContainer? actionContainer = null)
         {
             if (!Resolve(holderId, ref holder, false))
                 return;
@@ -195,7 +195,7 @@ namespace Content.Client.Actions
             }
             else
             {
-                var request = new RequestPerformActionEvent(actionId);
+                var request = new RequestPerformActionEvent(GetNetEntity(actionId));
                 EntityManager.RaisePredictiveEvent(request);
             }
         }
index 8afee7f3669c33e5f29039d100e0599b163a16cd..c21ba2e32cadc6f5718ad1780d4d47518fe7edc1 100644 (file)
@@ -35,20 +35,21 @@ namespace Content.Client.Administration
 
             foreach (var playerInfo in _system.PlayerList)
             {
+                var entity = _entityManager.GetEntity(playerInfo.NetEntity);
+
                 // Otherwise the entity can not exist yet
-                if (!_entityManager.EntityExists(playerInfo.EntityUid))
+                if (entity == null || !_entityManager.EntityExists(entity))
                 {
                     continue;
                 }
-                var entity = playerInfo.EntityUid.Value;
 
                 // if not on the same map, continue
-                if (_entityManager.GetComponent<TransformComponent>(entity).MapID != _eyeManager.CurrentMap)
+                if (_entityManager.GetComponent<TransformComponent>(entity.Value).MapID != _eyeManager.CurrentMap)
                 {
                     continue;
                 }
 
-                var aabb = _entityLookup.GetWorldAABB(entity);
+                var aabb = _entityLookup.GetWorldAABB(entity.Value);
 
                 // if not on screen, continue
                 if (!aabb.Intersects(in viewport))
index e37b51af52622c1260596f9563cf0ce97a7088ef..d08ebc0fcefa1cf6ae95581c532bcbd099942d4e 100644 (file)
@@ -24,12 +24,14 @@ namespace Content.Client.Administration.Systems
             // View variables verbs
             if (_clientConGroupController.CanViewVar())
             {
-                Verb verb = new();
-                verb.Category = VerbCategory.Debug;
-                verb.Text = "View Variables";
-                verb.Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/vv.svg.192dpi.png"));
-                verb.Act = () => _clientConsoleHost.ExecuteCommand($"vv {args.Target}");
-                verb.ClientExclusive = true; // opening VV window is client-side. Don't ask server to run this verb.
+                Verb verb = new()
+                {
+                    Category = VerbCategory.Debug,
+                    Text = "View Variables",
+                    Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/vv.svg.192dpi.png")),
+                    Act = () => _clientConsoleHost.ExecuteCommand($"vv {GetNetEntity(args.Target)}"),
+                    ClientExclusive = true // opening VV window is client-side. Don't ask server to run this verb.
+                };
                 args.Verbs.Add(verb);
             }
         }
index d5367dfa99580826b13afd2a6fc48c95c5710d9c..6142e3a83181a34d8d5d1898aaafb327cacf5b96 100644 (file)
@@ -18,7 +18,6 @@ namespace Content.Client.Administration.UI.CustomControls
     public sealed partial class PlayerListControl : BoxContainer
     {
         private readonly AdminSystem _adminSystem;
-        private readonly VerbSystem _verbSystem;
 
         private List<PlayerInfo> _playerList = new();
         private readonly List<PlayerInfo> _sortedPlayerList = new();
@@ -29,11 +28,14 @@ namespace Content.Client.Administration.UI.CustomControls
         public Func<PlayerInfo, string, string>? OverrideText;
         public Comparison<PlayerInfo>? Comparison;
 
+        private IEntityManager _entManager;
+        private IUserInterfaceManager _uiManager;
+
         public PlayerListControl()
         {
-            _adminSystem = EntitySystem.Get<AdminSystem>();
-            _verbSystem = EntitySystem.Get<VerbSystem>();
-            IoCManager.InjectDependencies(this);
+            _entManager = IoCManager.Resolve<IEntityManager>();
+            _uiManager = IoCManager.Resolve<IUserInterfaceManager>();
+            _adminSystem = _entManager.System<AdminSystem>();
             RobustXamlLoader.Load(this);
             // Fill the Option data
             PlayerListContainer.ItemPressed += PlayerListItemPressed;
@@ -56,9 +58,9 @@ namespace Content.Client.Administration.UI.CustomControls
                 if (OverrideText != null && args.Button.Children.FirstOrDefault()?.Children?.FirstOrDefault() is Label label)
                     label.Text = GetText(selectedPlayer);
             }
-            else if (args.Event.Function == EngineKeyFunctions.UseSecondary && selectedPlayer.EntityUid != null)
+            else if (args.Event.Function == EngineKeyFunctions.UseSecondary && selectedPlayer.NetEntity != null)
             {
-                IoCManager.Resolve<IUserInterfaceManager>().GetUIController<VerbMenuUIController>().OpenVerbMenu(selectedPlayer.EntityUid.Value);
+                _uiManager.GetUIController<VerbMenuUIController>().OpenVerbMenu(_entManager.GetEntity(selectedPlayer.NetEntity.Value));
             }
         }
 
index 4bee78fa090dd1d038802fac162014a6c98c5a6b..2e1b4dcf34110d04fd6da6361ef1788cde03cec1 100644 (file)
@@ -12,9 +12,11 @@ namespace Content.Client.Administration.UI.ManageSolutions
     public sealed class EditSolutionsEui : BaseEui
     {
         private readonly EditSolutionsWindow _window;
+        private IEntityManager _entManager;
 
         public EditSolutionsEui()
         {
+            _entManager = IoCManager.Resolve<IEntityManager>();
             _window = new EditSolutionsWindow();
             _window.OnClose += () => SendMessage(new CloseEuiMessage());
         }
@@ -34,7 +36,7 @@ namespace Content.Client.Administration.UI.ManageSolutions
         public override void HandleState(EuiStateBase baseState)
         {
             var state = (EditSolutionsEuiState) baseState;
-            _window.SetTargetEntity(state.Target);
+            _window.SetTargetEntity(_entManager.GetEntity(state.Target));
             _window.UpdateSolutions(state.Solutions);
             _window.UpdateReagents();
         }
index c2771165267166f73f16d05e7c4497e52cf3ef12..7987d464d7479dd76a57a2c9a3576f19bc112c9b 100644 (file)
@@ -9,8 +9,11 @@ namespace Content.Client.Administration.UI.SetOutfit
     public sealed class SetOutfitEui : BaseEui
     {
         private readonly SetOutfitMenu _window;
+        private IEntityManager _entManager;
+
         public SetOutfitEui()
         {
+            _entManager = IoCManager.Resolve<IEntityManager>();
             _window = new SetOutfitMenu();
             _window.OnClose += OnClosed;
         }
@@ -34,7 +37,7 @@ namespace Content.Client.Administration.UI.SetOutfit
         public override void HandleState(EuiStateBase state)
         {
             var outfitState = (SetOutfitEuiState) state;
-            _window.TargetEntityId = outfitState.TargetEntityId;
+            _window.TargetEntityId = _entManager.GetEntity(outfitState.TargetNetEntity);
 
         }
     }
index 5413b953f8b12d94004a2748d0ea6b4049719743..3a8270afb8712c87d07b0167785a0120b1c246b2 100644 (file)
@@ -10,6 +10,7 @@ namespace Content.Client.Administration.UI.SpawnExplosion;
 [UsedImplicitly]
 public sealed class SpawnExplosionEui : BaseEui
 {
+    [Dependency] private readonly EntityManager _entManager = default!;
     [Dependency] private readonly IOverlayManager _overlayManager = default!;
 
     private readonly SpawnExplosionWindow _window;
@@ -69,7 +70,14 @@ public sealed class SpawnExplosionEui : BaseEui
             _overlayManager.AddOverlay(_debugOverlay);
         }
 
-        _debugOverlay.Tiles = data.Explosion.Tiles;
+        var tiles = new Dictionary<EntityUid, Dictionary<int, List<Vector2i>>>();
+        _debugOverlay.Tiles.Clear();
+
+        foreach (var (nent, det) in data.Explosion.Tiles)
+        {
+            tiles[_entManager.GetEntity(nent)] = det;
+        }
+
         _debugOverlay.SpaceTiles = data.Explosion.SpaceTiles;
         _debugOverlay.Intensity = data.Explosion.Intensity;
         _debugOverlay.Slope = data.Slope;
index 0cc3294df16f6ab91f970926f1d6438a8bd2caa3..770a244a19ced19ba7d30ef6f68a5dd469909bad 100644 (file)
@@ -104,7 +104,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
         private void OnTeleportButtonPressed(BaseButton.ButtonEventArgs obj)
         {
             IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
-                $"tp {XCoordinate.Value} {YCoordinate.Value} {MapOptions.SelectedId}");
+                $"tp {XCoordinate.Value} {YCoordinate.Value} {new NetEntity(MapOptions.SelectedId)}");
         }
 
         private void OnSubmitButtonPressed(BaseButton.ButtonEventArgs obj)
@@ -112,7 +112,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
             if (MapPath.Text.Length == 0) return;
 
             IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
-                $"loadbp {MapOptions.SelectedId} \"{MapPath.Text}\" {XCoordinate.Value} {YCoordinate.Value} {RotationSpin.Value}");
+                $"loadbp {new NetEntity(MapOptions.SelectedId)} \"{MapPath.Text}\" {XCoordinate.Value} {YCoordinate.Value} {RotationSpin.Value}");
         }
     }
 }
index 51ac027901e7ae35ce32f35255a040469993fd06..2f643caae28977cdfcc238b58646a4b6ecf9028e 100644 (file)
@@ -38,8 +38,9 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
             if (_data == null)
                 return;
             var dataList = _data.ToList();
+            var entManager = IoCManager.Resolve<IEntityManager>();
             var selectedGrid = dataList[GridOptions.SelectedId].Owner;
-            IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {selectedGrid}");
+            IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {entManager.GetNetEntity(selectedGrid)}");
         }
     }
 }
index c49cb0251186947a1aa91bd880cc6e356663a108..ca0efbbc7c5534cde18af31c0da4bdd79d9b6715 100644 (file)
@@ -47,7 +47,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
 
             var selectedGrid = _data[GridOptions.SelectedId];
             IoCManager.Resolve<IClientConsoleHost>()
-                .ExecuteCommand($"settemp {TileXSpin.Value} {TileYSpin.Value} {selectedGrid} {TemperatureSpin.Value}");
+                .ExecuteCommand($"settemp {TileXSpin.Value} {TileYSpin.Value} {IoCManager.Resolve<IEntityManager>().GetNetEntity(selectedGrid)} {TemperatureSpin.Value}");
         }
     }
 }
index 7ece83d1cf0015bddd52bba5f69b80c4622dc5f9..91a453e416d699cb398fd48a4950d94791c1933d 100644 (file)
@@ -18,6 +18,7 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
         private const string ArrowDown = "↓";
         private readonly Color _altColor = Color.FromHex("#292B38");
         private readonly Color _defaultColor = Color.FromHex("#2F2F3B");
+        private IEntityManager _entManager;
         private readonly AdminSystem _adminSystem;
         private IReadOnlyList<PlayerInfo> _players = new List<PlayerInfo>();
 
@@ -29,7 +30,8 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
 
         public PlayerTab()
         {
-            _adminSystem = EntitySystem.Get<AdminSystem>();
+            _entManager = IoCManager.Resolve<IEntityManager>();
+            _adminSystem = _entManager.System<AdminSystem>();
             RobustXamlLoader.Load(this);
             RefreshPlayerList(_adminSystem.PlayerList);
 
@@ -119,7 +121,7 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
                     player.Antag ? "YES" : "NO",
                     new StyleBoxFlat(useAltColor ? _altColor : _defaultColor),
                     player.Connected);
-                entry.PlayerUid = player.EntityUid;
+                entry.PlayerUid = _entManager.GetEntity(player.NetEntity);
                 entry.OnPressed += args => OnEntryPressed?.Invoke(args);
                 PlayerList.AddChild(entry);
 
index db8421d8ccc989c6fcb3248f7787b34d46181f64..c849abf70efb1f2ed31c011218cf24c2eb416b51 100644 (file)
@@ -56,7 +56,7 @@ namespace Content.Client.Atmos.EntitySystems
 
         private void HandleAtmosDebugOverlayMessage(AtmosDebugOverlayMessage message)
         {
-            _tileData[message.GridId] = message;
+            _tileData[GetEntity(message.GridId)] = message;
         }
 
         private void HandleAtmosDebugOverlayDisableMessage(AtmosDebugOverlayDisableMessage ev)
index ddb0a340855f573283d9ef771391a115840487f9..78185ce6b0e679f9599e38dcf4595cfd1c59a8ac 100644 (file)
@@ -65,8 +65,10 @@ namespace Content.Client.Atmos.EntitySystems
 
         private void HandleGasOverlayUpdate(GasOverlayUpdateEvent ev)
         {
-            foreach (var (grid, removedIndicies) in ev.RemovedChunks)
+            foreach (var (nent, removedIndicies) in ev.RemovedChunks)
             {
+                var grid = GetEntity(nent);
+
                 if (!TryComp(grid, out GasTileOverlayComponent? comp))
                     continue;
 
@@ -76,8 +78,10 @@ namespace Content.Client.Atmos.EntitySystems
                 }
             }
 
-            foreach (var (grid, gridData) in ev.UpdatedChunks)
+            foreach (var (nent, gridData) in ev.UpdatedChunks)
             {
+                var grid = GetEntity(nent);
+
                 if (!TryComp(grid, out GasTileOverlayComponent? comp))
                     continue;
 
index 33c3e8644ef3755621aaf6bc25bfcc9da42a3503..48c3b6f978aeaba5d7276bcb4c247f121710191c 100644 (file)
@@ -68,7 +68,7 @@ namespace Content.Client.Atmos.UI
                     _ => GridIcon.OverrideDirection
                 };
 
-                GridIcon.SetEntity(msg.DeviceUid);
+                GridIcon.SetEntity(IoCManager.Resolve<IEntityManager>().GetEntity(msg.DeviceUid));
                 LeftPanel.RemoveAllChildren();
                 MiddlePanel.RemoveAllChildren();
                 RightPanel.RemoveAllChildren();
index c221e79769fc473b360a048b41d7c584a4c87cd9..4749d4d29b80938b1d60953db1682f555ef673f9 100644 (file)
@@ -17,7 +17,9 @@ public sealed class BeamSystem : SharedBeamSystem
     //TODO: Sometime in the future this needs to be replaced with tiled sprites
     private void BeamVisualizerMessage(BeamVisualizerEvent args)
     {
-        if (TryComp<SpriteComponent>(args.Beam, out var sprites))
+        var beam = GetEntity(args.Beam);
+
+        if (TryComp<SpriteComponent>(beam, out var sprites))
         {
             sprites.Rotation = args.UserAngle;
 
index 0265e3343eef7ab39e6f052a252b1466c45b1794..55ee029a91c92265792ecced1bfe0a872e0f5c3c 100644 (file)
@@ -23,7 +23,7 @@ internal sealed partial class ToolshedVisualizeWindow : DefaultWindow
 
     protected override Vector2 ContentsMinimumSize => new(500, 700);
 
-    public void Update((string name, EntityUid entity)[] entities)
+    public void Update((string name, NetEntity entity)[] entities)
     {
         StatusLabel.Text = _loc.GetString("ui-bql-results-status", ("count", entities.Length));
         ItemList.RemoveAllChildren();
index 70960d06a2bd2aa9641d530e93cd6d1ce47b3aec..24f12a791585af512005ad71b9c5e5b1f9ec9963 100644 (file)
@@ -25,8 +25,8 @@ internal sealed class BuckleSystem : SharedBuckleSystem
             return;
 
         component.Buckled = state.Buckled;
-        component.BuckledTo = state.BuckledTo;
-        component.LastEntityBuckledTo = state.LastEntityBuckledTo;
+        component.BuckledTo = EnsureEntity<BuckleComponent>(state.BuckledTo, uid);
+        component.LastEntityBuckledTo = EnsureEntity<BuckleComponent>(state.LastEntityBuckledTo, uid);
         component.DontCollide = state.DontCollide;
 
         ActionBlockerSystem.UpdateCanMove(uid);
index a5dc7e6ecd9c997980a4526c2a0582dcf41cbb70..65a3fc71c70957278a417eb624d8a8089a712620 100644 (file)
@@ -13,7 +13,7 @@ public sealed class CameraRecoilSystem : SharedCameraRecoilSystem
 
     private void OnCameraKick(CameraKickEvent ev)
     {
-        KickCamera(ev.Euid, ev.Recoil);
+        KickCamera(GetEntity(ev.NetEntity), ev.Recoil);
     }
 
     public override void KickCamera(EntityUid uid, Vector2 recoil, CameraRecoilComponent? component = null)
index a4a273eacad050d3a231dfc2d6cb5e22bee5314a..3c870f6e6ec17091bc1d14e823afcabd163980e4 100644 (file)
@@ -19,12 +19,14 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
 
     private void OnBoxEffect(PlayBoxEffectMessage msg)
     {
-        if (!TryComp<CardboardBoxComponent>(msg.Source, out var box))
+        var source = GetEntity(msg.Source);
+
+        if (!TryComp<CardboardBoxComponent>(source, out var box))
             return;
 
         var xformQuery = GetEntityQuery<TransformComponent>();
 
-        if (!xformQuery.TryGetComponent(msg.Source, out var xform))
+        if (!xformQuery.TryGetComponent(source, out var xform))
             return;
 
         var sourcePos = xform.MapPosition;
@@ -32,12 +34,13 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
         //Any mob that can move should be surprised?
         //God mind rework needs to come faster so it can just check for mind
         //TODO: Replace with Mind Query when mind rework is in.
-        var mobMoverEntities = new HashSet<EntityUid>();
+        var mobMoverEntities = new List<EntityUid>();
+        var mover = GetEntity(msg.Mover);
 
         //Filter out entities in range to see that they're a mob and add them to the mobMoverEntities hash for faster lookup
         foreach (var moverComp in _entityLookup.GetComponentsInRange<MobMoverComponent>(xform.Coordinates, box.Distance))
         {
-            if (moverComp.Owner == msg.Mover)
+            if (moverComp.Owner == mover)
                 continue;
 
             mobMoverEntities.Add(moverComp.Owner);
@@ -57,5 +60,6 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
             sprite.Offset = new Vector2(0, 1);
             entTransform.AttachParent(mob);
         }
+
     }
 }
index 3ae61b182e49811990c6852752402e582ff56364..e4d6a9fb8bd2bf9a035420367367607a3c70611e 100644 (file)
@@ -17,8 +17,11 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
     [ViewVariables]
     private Control? _activeUiFragment;
 
+    private IEntityManager _entManager;
+
     protected CartridgeLoaderBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
     {
+        _entManager = IoCManager.Resolve<IEntityManager>();
     }
 
     protected override void UpdateState(BoundUserInterfaceState state)
@@ -31,13 +34,16 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
             return;
         }
 
-        var programs = GetCartridgeComponents(loaderUiState.Programs);
+        // TODO move this to a component state and ensure the net ids.
+        var programs = GetCartridgeComponents(_entManager.GetEntityList(loaderUiState.Programs));
         UpdateAvailablePrograms(programs);
 
-        _activeProgram = loaderUiState.ActiveUI;
+        var activeUI = _entManager.GetEntity(loaderUiState.ActiveUI);
+
+        _activeProgram = activeUI;
 
-        var ui = RetrieveCartridgeUI(loaderUiState.ActiveUI);
-        var comp = RetrieveCartridgeComponent(loaderUiState.ActiveUI);
+        var ui = RetrieveCartridgeUI(activeUI);
+        var comp = RetrieveCartridgeComponent(activeUI);
         var control = ui?.GetUIFragmentRoot();
 
         //Prevent the same UI fragment from getting disposed and attached multiple times
@@ -60,7 +66,7 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
 
     protected void ActivateCartridge(EntityUid cartridgeUid)
     {
-        var message = new CartridgeLoaderUiMessage(cartridgeUid, CartridgeUiMessageAction.Activate);
+        var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(cartridgeUid), CartridgeUiMessageAction.Activate);
         SendMessage(message);
     }
 
@@ -69,19 +75,19 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
         if (!_activeProgram.HasValue)
             return;
 
-        var message = new CartridgeLoaderUiMessage(_activeProgram.Value, CartridgeUiMessageAction.Deactivate);
+        var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(_activeProgram.Value), CartridgeUiMessageAction.Deactivate);
         SendMessage(message);
     }
 
     protected void InstallCartridge(EntityUid cartridgeUid)
     {
-        var message = new CartridgeLoaderUiMessage(cartridgeUid, CartridgeUiMessageAction.Install);
+        var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(cartridgeUid), CartridgeUiMessageAction.Install);
         SendMessage(message);
     }
 
     protected void UninstallCartridge(EntityUid cartridgeUid)
     {
-        var message = new CartridgeLoaderUiMessage(cartridgeUid, CartridgeUiMessageAction.Uninstall);
+        var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(cartridgeUid), CartridgeUiMessageAction.Uninstall);
         SendMessage(message);
     }
 
@@ -126,7 +132,7 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
 
     private void SendCartridgeUiReadyEvent(EntityUid cartridgeUid)
     {
-        var message = new CartridgeLoaderUiMessage(cartridgeUid, CartridgeUiMessageAction.UIReady);
+        var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(cartridgeUid), CartridgeUiMessageAction.UIReady);
         SendMessage(message);
     }
 
index cab9ef7c2f1c1caddad3dc82acf0822eee0a8b27..cd96085d3142fdb1e8e35710ef99ff3297961f11 100644 (file)
@@ -30,7 +30,7 @@ public sealed class CharacterInfoSystem : EntitySystem
             return;
         }
 
-        RaiseNetworkEvent(new RequestCharacterInfoEvent(entity.Value));
+        RaiseNetworkEvent(new RequestCharacterInfoEvent(GetNetEntity(entity.Value)));
     }
 
     private void OnPlayerAttached(PlayerAttachSysMessage msg)
@@ -43,7 +43,9 @@ public sealed class CharacterInfoSystem : EntitySystem
 
     private void OnCharacterInfoEvent(CharacterInfoEvent msg, EntitySessionEventArgs args)
     {
-        var data = new CharacterData(msg.EntityUid, msg.JobTitle, msg.Objectives, msg.Briefing, Name(msg.EntityUid));
+        var entity = GetEntity(msg.NetEntity);
+        var data = new CharacterData(entity, msg.JobTitle, msg.Objectives, msg.Briefing, Name(entity));
+
         OnCharacterUpdate?.Invoke(data);
     }
 
index f4489b7f74fa2e96e4583f71015e47a9cd0f8805..b16e14d65355797af7981afbf797c53304a93e19 100644 (file)
@@ -169,10 +169,12 @@ public sealed class ClientClothingSystem : ClothingSystem
 
     private void OnVisualsChanged(EntityUid uid, InventoryComponent component, VisualsChangedEvent args)
     {
-        if (!TryComp(args.Item, out ClothingComponent? clothing) || clothing.InSlot == null)
+        var item = GetEntity(args.Item);
+
+        if (!TryComp(item, out ClothingComponent? clothing) || clothing.InSlot == null)
             return;
 
-        RenderEquipment(uid, args.Item, clothing.InSlot, component, null, clothing);
+        RenderEquipment(uid, item, clothing.InSlot, component, null, clothing);
     }
 
     private void OnDidUnequip(EntityUid uid, SpriteComponent component, DidUnequipEvent args)
index 3c983094f54f909727d8421d7f6c55748ac394e2..8f4fe3867e87283efc166565d050bbcd7cce771a 100644 (file)
@@ -8,6 +8,5 @@ namespace Content.Client.Construction
     public sealed partial class ConstructionGhostComponent : Component
     {
         [ViewVariables] public ConstructionPrototype? Prototype { get; set; }
-        [ViewVariables] public int GhostId { get; set; }
     }
 }
index e2e6ab66924705e5e5a6f6231041b294bb159748..dc5d7bf342ffcfb0723eeb7233104bc003629e1d 100644 (file)
@@ -1,12 +1,7 @@
-using System.Collections.Generic;
-using System.Linq;
-using Content.Shared.Construction;
+using System.Linq;
 using Content.Shared.Construction.Prototypes;
-using Robust.Client.Graphics;
 using Robust.Client.Placement;
 using Robust.Client.Utility;
-using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
 using Robust.Shared.Map;
 
 namespace Content.Client.Construction
@@ -39,9 +34,9 @@ namespace Content.Client.Construction
         /// <inheritdoc />
         public override bool HijackDeletion(EntityUid entity)
         {
-            if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out ConstructionGhostComponent? ghost))
+            if (IoCManager.Resolve<IEntityManager>().HasComponent<ConstructionGhostComponent>(entity))
             {
-                _constructionSystem.ClearGhost(ghost.GhostId);
+                _constructionSystem.ClearGhost(entity.GetHashCode());
             }
             return true;
         }
index 18790ed00ee64391b2d30e77d91c301e038c00b3..98d2dfd414d7f1a798165a92a90029e7654ae759 100644 (file)
@@ -27,11 +27,9 @@ namespace Content.Client.Construction
         [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
         [Dependency] private readonly PopupSystem _popupSystem = default!;
 
-        private readonly Dictionary<int, ConstructionGhostComponent> _ghosts = new();
+        private readonly Dictionary<int, EntityUid> _ghosts = new();
         private readonly Dictionary<string, ConstructionGuide> _guideCache = new();
 
-        private int _nextId;
-
         public bool CraftingEnabled { get; private set; }
 
         /// <inheritdoc />
@@ -39,6 +37,7 @@ namespace Content.Client.Construction
         {
             base.Initialize();
 
+            UpdatesOutsidePrediction = true;
             SubscribeLocalEvent<PlayerAttachSysMessage>(HandlePlayerAttached);
             SubscribeNetworkEvent<AckStructureConstructionMessage>(HandleAckStructure);
             SubscribeNetworkEvent<ResponseConstructionGuide>(OnConstructionGuideReceived);
@@ -107,6 +106,7 @@ namespace Content.Client.Construction
 
         private void HandleAckStructure(AckStructureConstructionMessage msg)
         {
+            // We get sent a NetEntity but it actually corresponds to our local Entity.
             ClearGhost(msg.GhostId);
         }
 
@@ -150,13 +150,13 @@ namespace Content.Client.Construction
 
         private bool HandleUse(in PointerInputCmdHandler.PointerInputCmdArgs args)
         {
-            if (!args.EntityUid.IsValid() || !args.EntityUid.IsClientSide())
+            if (!args.EntityUid.IsValid() || !IsClientSide(args.EntityUid))
                 return false;
 
-            if (!EntityManager.TryGetComponent<ConstructionGhostComponent?>(args.EntityUid, out var ghostComp))
+            if (!HasComp<ConstructionGhostComponent>(args.EntityUid))
                 return false;
 
-            TryStartConstruction(ghostComp.GhostId);
+            TryStartConstruction(args.EntityUid);
             return true;
         }
 
@@ -196,9 +196,8 @@ namespace Content.Client.Construction
             ghost = EntityManager.SpawnEntity("constructionghost", loc);
             var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value);
             comp.Prototype = prototype;
-            comp.GhostId = _nextId++;
             EntityManager.GetComponent<TransformComponent>(ghost.Value).LocalRotation = dir.ToAngle();
-            _ghosts.Add(comp.GhostId, comp);
+            _ghosts.Add(ghost.Value.Id, ghost.Value);
             var sprite = EntityManager.GetComponent<SpriteComponent>(ghost.Value);
             sprite.Color = new Color(48, 255, 48, 128);
 
@@ -247,23 +246,25 @@ namespace Content.Client.Construction
         {
             foreach (var ghost in _ghosts)
             {
-                if (EntityManager.GetComponent<TransformComponent>(ghost.Value.Owner).Coordinates.Equals(loc)) return true;
+                if (EntityManager.GetComponent<TransformComponent>(ghost.Value).Coordinates.Equals(loc))
+                    return true;
             }
 
             return false;
         }
 
-        public void TryStartConstruction(int ghostId)
+        public void TryStartConstruction(EntityUid ghostId, ConstructionGhostComponent? ghostComp = null)
         {
-            var ghost = _ghosts[ghostId];
+            if (!Resolve(ghostId, ref ghostComp))
+                return;
 
-            if (ghost.Prototype == null)
+            if (ghostComp.Prototype == null)
             {
                 throw new ArgumentException($"Can't start construction for a ghost with no prototype. Ghost id: {ghostId}");
             }
 
-            var transform = EntityManager.GetComponent<TransformComponent>(ghost.Owner);
-            var msg = new TryStartStructureConstructionMessage(transform.Coordinates, ghost.Prototype.ID, transform.LocalRotation, ghostId);
+            var transform = EntityManager.GetComponent<TransformComponent>(ghostId);
+            var msg = new TryStartStructureConstructionMessage(GetNetCoordinates(transform.Coordinates), ghostComp.Prototype.ID, transform.LocalRotation, ghostId.Id);
             RaiseNetworkEvent(msg);
         }
 
@@ -280,11 +281,11 @@ namespace Content.Client.Construction
         /// </summary>
         public void ClearGhost(int ghostId)
         {
-            if (_ghosts.TryGetValue(ghostId, out var ghost))
-            {
-                EntityManager.QueueDeleteEntity(ghost.Owner);
-                _ghosts.Remove(ghostId);
-            }
+            if (!_ghosts.TryGetValue(ghostId, out var ghost))
+                return;
+
+            EntityManager.QueueDeleteEntity(ghost);
+            _ghosts.Remove(ghostId);
         }
 
         /// <summary>
@@ -292,9 +293,9 @@ namespace Content.Client.Construction
         /// </summary>
         public void ClearAllGhosts()
         {
-            foreach (var (_, ghost) in _ghosts)
+            foreach (var ghost in _ghosts.Values)
             {
-                EntityManager.QueueDeleteEntity(ghost.Owner);
+                EntityManager.QueueDeleteEntity(ghost);
             }
 
             _ghosts.Clear();
index b16559b58f0ca5e694b69515a178d05a4ca39c4e..cdd171a6e7d7240015c4bcb57a0cb4d7dd0a7462 100644 (file)
@@ -49,7 +49,8 @@ namespace Content.Client.ContextMenu.UI
 
         private string? SearchPlayerName(EntityUid entity)
         {
-            return _adminSystem.PlayerList.FirstOrDefault(player => player.EntityUid == entity)?.Username;
+            var netEntity = _entityManager.GetNetEntity(entity);
+            return _adminSystem.PlayerList.FirstOrDefault(player => player.NetEntity == netEntity)?.Username;
         }
 
         /// <summary>
@@ -77,12 +78,12 @@ namespace Content.Client.ContextMenu.UI
             var representation = _entityManager.ToPrettyString(entity);
 
             var name = representation.Name;
-            var id = representation.Uid;
+            var id = representation.Uid.ToString();
             var prototype = representation.Prototype;
             var playerName = representation.Session?.Name ?? SearchPlayerName(entity);
             var deleted = representation.Deleted;
 
-            return $"{name} ({id}{(prototype != null ? $", {prototype}" : "")}{(playerName != null ? $", {playerName}" : "")}){(deleted ? "D" : "")}";
+            return $"{name} ({id} / {_entityManager.GetNetEntity(entity).ToString()}{(prototype != null ? $", {prototype}" : "")}{(playerName != null ? $", {playerName}" : "")}){(deleted ? "D" : "")}";
         }
 
         private string GetEntityDescription(EntityUid entity)
index 6ca8d95db7d48db49f908e63f9169c336f2199d5..03d5a9486b4e4ea58e222c26c8cd90c43000082b 100644 (file)
@@ -133,8 +133,16 @@ namespace Content.Client.ContextMenu.UI
                 var func = args.Function;
                 var funcId = _inputManager.NetworkBindMap.KeyFunctionID(func);
 
-                var message = new FullInputCmdMessage(_gameTiming.CurTick, _gameTiming.TickFraction, funcId,
-                    BoundKeyState.Down, _entityManager.GetComponent<TransformComponent>(entity.Value).Coordinates, args.PointerLocation, entity.Value);
+                var message = new ClientFullInputCmdMessage(
+                    _gameTiming.CurTick,
+                    _gameTiming.TickFraction,
+                    funcId)
+                {
+                    State = BoundKeyState.Down,
+                    Coordinates = _entityManager.GetComponent<TransformComponent>(entity.Value).Coordinates,
+                    ScreenCoordinates = args.PointerLocation,
+                    Uid = entity.Value,
+                };
 
                 var session = _playerManager.LocalPlayer?.Session;
                 if (session != null)
index d821117f6b8beba9116c93c0c2ef5ec12ff0de17..05f27620c41de62f52b895c66860049700a88597 100644 (file)
@@ -30,10 +30,10 @@ public sealed class CrewManifestSystem : EntitySystem
     /// <summary>
     ///     Requests a crew manifest from the server.
     /// </summary>
-    /// <param name="uid">EntityUid of the entity we're requesting the crew manifest from.</param>
-    public void RequestCrewManifest(EntityUid uid)
+    /// <param name="netEntity">EntityUid of the entity we're requesting the crew manifest from.</param>
+    public void RequestCrewManifest(NetEntity netEntity)
     {
-        RaiseNetworkEvent(new RequestCrewManifestMessage(uid));
+        RaiseNetworkEvent(new RequestCrewManifestMessage(netEntity));
     }
 
     private void OnPrototypesReload(PrototypesReloadedEventArgs _)
index 03248f4355ea7e89b57ccb9f191667bd89b52e7e..c97f8281a170838c410343375cb02a5ff5368f62 100644 (file)
@@ -70,7 +70,7 @@ public sealed class DecalPlacementSystem : EntitySystem
                     return false;
 
                 var decal = new Decal(coords.Position, _decalId, _decalColor, _decalAngle, _zIndex, _cleanable);
-                RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, coords));
+                RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, GetNetCoordinates(coords)));
 
                 return true;
             },
@@ -90,7 +90,7 @@ public sealed class DecalPlacementSystem : EntitySystem
 
                 _erasing = true;
 
-                RaiseNetworkEvent(new RequestDecalRemovalEvent(coords));
+                RaiseNetworkEvent(new RequestDecalRemovalEvent(GetNetCoordinates(coords)));
 
                 return true;
             }, (session, coords, uid) =>
@@ -128,7 +128,7 @@ public sealed class DecalPlacementSystem : EntitySystem
         args.Target = args.Target.Offset(new Vector2(-0.5f, -0.5f));
 
         var decal = new Decal(args.Target.Position, args.DecalId, args.Color, Angle.FromDegrees(args.Rotation), args.ZIndex, args.Cleanable);
-        RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, args.Target));
+        RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, GetNetCoordinates(args.Target)));
     }
 
     private void OnFillSlot(FillActionSlotEvent ev)
index 159efced01a7a2f38ca560eef3d9f118b02346ff..66b30545dad1348237fdcdb6a4655e4a18af9852 100644 (file)
@@ -92,13 +92,16 @@ namespace Content.Client.Decals
 
         private void OnChunkUpdate(DecalChunkUpdateEvent ev)
         {
-            foreach (var (gridId, updatedGridChunks) in ev.Data)
+            foreach (var (netGrid, updatedGridChunks) in ev.Data)
             {
-                if (updatedGridChunks.Count == 0) continue;
+                if (updatedGridChunks.Count == 0)
+                    continue;
+
+                var gridId = GetEntity(netGrid);
 
                 if (!TryComp(gridId, out DecalGridComponent? gridComp))
                 {
-                    Logger.Error($"Received decal information for an entity without a decal component: {ToPrettyString(gridId)}");
+                    Log.Error($"Received decal information for an entity without a decal component: {ToPrettyString(gridId)}");
                     continue;
                 }
 
@@ -106,13 +109,16 @@ namespace Content.Client.Decals
             }
 
             // Now we'll cull old chunks out of range as the server will send them to us anyway.
-            foreach (var (gridId, chunks) in ev.RemovedChunks)
+            foreach (var (netGrid, chunks) in ev.RemovedChunks)
             {
-                if (chunks.Count == 0) continue;
+                if (chunks.Count == 0)
+                    continue;
+
+                var gridId = GetEntity(netGrid);
 
                 if (!TryComp(gridId, out DecalGridComponent? gridComp))
                 {
-                    Logger.Error($"Received decal information for an entity without a decal component: {ToPrettyString(gridId)}");
+                    Log.Error($"Received decal information for an entity without a decal component: {ToPrettyString(gridId)}");
                     continue;
                 }
 
index 6c9aea8b9f1372b335f8975045780e1485b9578a..d10101754cc783ce0eb18df31c7a4d2dc5ec83b9 100644 (file)
@@ -46,7 +46,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
         component.Powered = state.Powered;
         component.Engaged = state.Engaged;
         component.RecentlyEjected.Clear();
-        component.RecentlyEjected.AddRange(state.RecentlyEjected);
+        component.RecentlyEjected.AddRange(EnsureEntityList<DisposalUnitComponent>(state.RecentlyEjected, uid));
     }
 
     public override bool HasDisposals(EntityUid? uid)
index 84bc63a3b6728bb98c276e266d112181989186aa..23bd662d827cf5bebf647774c9fbbee2e2953874 100644 (file)
@@ -193,27 +193,29 @@ public sealed class DragDropSystem : SharedDragDropSystem
         // the mouse, canceling the drag, but just being cautious)
         EndDrag();
 
+        var entity = args.EntityUid;
+
         // possibly initiating a drag
         // check if the clicked entity is draggable
-        if (!Exists(args.EntityUid))
+        if (!Exists(entity))
         {
             return false;
         }
 
         // check if the entity is reachable
-        if (!_interactionSystem.InRangeUnobstructed(dragger, args.EntityUid))
+        if (!_interactionSystem.InRangeUnobstructed(dragger, entity))
         {
             return false;
         }
 
         var ev = new CanDragEvent();
 
-        RaiseLocalEvent(args.EntityUid, ref ev);
+        RaiseLocalEvent(entity, ref ev);
 
         if (ev.Handled != true)
             return false;
 
-        _draggedEntity = args.EntityUid;
+        _draggedEntity = entity;
         _state = DragState.MouseDown;
         _mouseDownScreenPos = _inputManager.MouseScreenPosition;
         _mouseDownTime = 0;
@@ -309,14 +311,32 @@ public sealed class DragDropSystem : SharedDragDropSystem
                     // adjust the timing info based on the current tick so it appears as if it happened now
                     var replayMsg = savedValue.OriginalMessage;
 
-                    var adjustedInputMsg = new FullInputCmdMessage(args.OriginalMessage.Tick,
-                        args.OriginalMessage.SubTick,
-                        replayMsg.InputFunctionId, replayMsg.State, replayMsg.Coordinates, replayMsg.ScreenCoordinates,
-                        replayMsg.Uid);
+                    switch (replayMsg)
+                    {
+                        case ClientFullInputCmdMessage clientInput:
+                            replayMsg = new ClientFullInputCmdMessage(args.OriginalMessage.Tick,
+                                args.OriginalMessage.SubTick,
+                                replayMsg.InputFunctionId)
+                            {
+                                State = replayMsg.State,
+                                Coordinates = clientInput.Coordinates,
+                                ScreenCoordinates = clientInput.ScreenCoordinates,
+                                Uid = clientInput.Uid,
+                            };
+                            break;
+                        case FullInputCmdMessage fullInput:
+                            replayMsg = new FullInputCmdMessage(args.OriginalMessage.Tick,
+                                args.OriginalMessage.SubTick,
+                                replayMsg.InputFunctionId, replayMsg.State, fullInput.Coordinates, fullInput.ScreenCoordinates,
+                                fullInput.Uid);
+                            break;
+                        default:
+                            throw new ArgumentOutOfRangeException();
+                    }
 
                     if (savedValue.Session != null)
                     {
-                        _inputSystem.HandleInputCommand(savedValue.Session, EngineKeyFunctions.Use, adjustedInputMsg,
+                        _inputSystem.HandleInputCommand(savedValue.Session, EngineKeyFunctions.Use, replayMsg,
                             true);
                     }
 
@@ -340,10 +360,11 @@ public sealed class DragDropSystem : SharedDragDropSystem
         }
 
         IEnumerable<EntityUid> entities;
+        var coords = args.Coordinates;
 
         if (_stateManager.CurrentState is GameplayState screen)
         {
-            entities = screen.GetClickableEntities(args.Coordinates);
+            entities = screen.GetClickableEntities(coords);
         }
         else
         {
@@ -371,7 +392,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
             }
 
             // tell the server about the drop attempt
-            RaiseNetworkEvent(new DragDropRequestEvent(_draggedEntity.Value, entity));
+            RaiseNetworkEvent(new DragDropRequestEvent(GetNetEntity(_draggedEntity.Value), GetNetEntity(entity)));
             EndDrag();
             return true;
         }
index dca675b8dfbe72565a5ad803df94d72827c30bd3..34acb7f370f93eb958508936af2dc87f0e429af5 100644 (file)
@@ -31,7 +31,7 @@ public sealed class ColorFlashEffectSystem : SharedColorFlashEffectSystem
         if (!_timing.IsFirstTimePredicted)
             return;
 
-        OnColorFlashEffect(new ColorFlashEffectEvent(color, entities));
+        OnColorFlashEffect(new ColorFlashEffectEvent(color, GetNetEntityList(entities)));
     }
 
     private void OnEffectAnimationCompleted(EntityUid uid, ColorFlashEffectComponent component, AnimationCompletedEvent args)
@@ -77,8 +77,10 @@ public sealed class ColorFlashEffectSystem : SharedColorFlashEffectSystem
     {
         var color = ev.Color;
 
-        foreach (var ent in ev.Entities)
+        foreach (var nent in ev.Entities)
         {
+            var ent = GetEntity(nent);
+
             if (Deleted(ent))
             {
                 continue;
index 9b55b6228145ef9086d5d9ab290845ef9d6e41d8..914ec215274cd89a735a50349eb2f54539edf1d2 100644 (file)
@@ -110,19 +110,21 @@ namespace Content.Client.Examine
 
         private bool HandleExamine(in PointerInputCmdHandler.PointerInputCmdArgs args)
         {
-            if (!args.EntityUid.IsValid() || !EntityManager.EntityExists(args.EntityUid))
+            var entity = args.EntityUid;
+
+            if (!args.EntityUid.IsValid() || !EntityManager.EntityExists(entity))
             {
                 return false;
             }
 
             _playerEntity = _playerManager.LocalPlayer?.ControlledEntity ?? default;
 
-            if (_playerEntity == default || !CanExamine(_playerEntity, args.EntityUid))
+            if (_playerEntity == default || !CanExamine(_playerEntity, entity))
             {
                 return false;
             }
 
-            DoExamine(args.EntityUid);
+            DoExamine(entity);
             return true;
         }
 
@@ -157,8 +159,10 @@ namespace Content.Client.Examine
             // Tooltips coming in from the server generally prioritize
             // opening at the old tooltip rather than the cursor/another entity,
             // since there's probably one open already if it's coming in from the server.
-            OpenTooltip(player.Value, ev.EntityUid, ev.CenterAtCursor, ev.OpenAtOldTooltip, ev.KnowTarget);
-            UpdateTooltipInfo(player.Value, ev.EntityUid, ev.Message, ev.Verbs);
+            var entity = GetEntity(ev.EntityUid);
+
+            OpenTooltip(player.Value, entity, ev.CenterAtCursor, ev.OpenAtOldTooltip, ev.KnowTarget);
+            UpdateTooltipInfo(player.Value, entity, ev.Message, ev.Verbs);
         }
 
         public override void SendExamineTooltip(EntityUid player, EntityUid target, FormattedMessage message, bool getVerbs, bool centerAtCursor)
@@ -358,12 +362,10 @@ namespace Content.Client.Examine
             FormattedMessage message;
 
             // Basically this just predicts that we can't make out the entity if we have poor vision.
-            var canSeeClearly = true;
-            if (HasComp<BlurryVisionComponent>(playerEnt))
-                canSeeClearly = false;
+            var canSeeClearly = !HasComp<BlurryVisionComponent>(playerEnt);
 
             OpenTooltip(playerEnt.Value, entity, centeredOnCursor, false, knowTarget: canSeeClearly);
-            if (entity.IsClientSide()
+            if (IsClientSide(entity)
                 || _client.RunLevel == ClientRunLevel.SinglePlayerGame) // i.e. a replay
             {
                 message = GetExamineText(entity, playerEnt);
@@ -376,7 +378,7 @@ namespace Content.Client.Examine
                     _idCounter += 1;
                 if (_idCounter == int.MaxValue)
                     _idCounter = 0;
-                RaiseNetworkEvent(new ExamineSystemMessages.RequestExamineInfoMessage(entity, _idCounter, true));
+                RaiseNetworkEvent(new ExamineSystemMessages.RequestExamineInfoMessage(GetNetEntity(entity), _idCounter, true));
             }
 
             RaiseLocalEvent(entity, new ClientExaminedEvent(entity, playerEnt.Value));
index d182c0be2d3673eea3df6b90fdfb9b6c321ae3ec..289d2172020273e15338ae72eda5b443b8274701 100644 (file)
@@ -4,6 +4,7 @@ using Robust.Client.Graphics;
 using Robust.Client.ResourceManagement;
 using Robust.Shared.GameStates;
 using Robust.Shared.Prototypes;
+using Robust.Shared.Utility;
 
 namespace Content.Client.Explosion;
 
@@ -39,7 +40,13 @@ public sealed class ExplosionOverlaySystem : EntitySystem
 
         component.Epicenter = state.Epicenter;
         component.SpaceTiles = state.SpaceTiles;
-        component.Tiles = state.Tiles;
+        component.Tiles.Clear();
+
+        foreach (var (nent, data) in state.Tiles)
+        {
+            component.Tiles[GetEntity(nent)] = data;
+        }
+
         component.Intensity = state.Intensity;
         component.ExplosionType = state.ExplosionType;
         component.SpaceMatrix = state.SpaceMatrix;
index 695c68e60ddceacc873563be4737018482c93d78..239f0ecc9394d7167ef1a6199f128e1038fddcd2 100644 (file)
@@ -8,14 +8,16 @@ namespace Content.Client.Fax.AdminUI;
 [UsedImplicitly]
 public sealed class AdminFaxEui : BaseEui
 {
+    private IEntityManager _entManager;
     private readonly AdminFaxWindow _window;
 
     public AdminFaxEui()
     {
+        _entManager = IoCManager.Resolve<IEntityManager>();
         _window = new AdminFaxWindow();
         _window.OnClose += () => SendMessage(new AdminFaxEuiMsg.Close());
-        _window.OnFollowFax += uid => SendMessage(new AdminFaxEuiMsg.Follow(uid));
-        _window.OnMessageSend += args => SendMessage(new AdminFaxEuiMsg.Send(args.uid, args.title,
+        _window.OnFollowFax += uid => SendMessage(new AdminFaxEuiMsg.Follow(_entManager.GetNetEntity(uid)));
+        _window.OnMessageSend += args => SendMessage(new AdminFaxEuiMsg.Send(_entManager.GetNetEntity(args.uid), args.title,
                     args.stampedBy, args.message, args.stampSprite, args.stampColor));
     }
 
index 345e4b7fa64e8f0d0e93c3006cb4667d6b3ae3f3..cec372cb0b3468e65e1bba7251797b1552856edf 100644 (file)
@@ -20,7 +20,7 @@ public sealed class PuddleDebugOverlaySystem : SharedPuddleDebugOverlaySystem
 
     private void RenderDebugData(PuddleOverlayDebugMessage message)
     {
-        TileData[message.GridUid] = message;
+        TileData[GetEntity(message.GridUid)] = message;
         if (_overlay != null)
             return;
 
index 7c94a60aadab6f221fbdf18107a35cd9786d922c..dd07f78d94a8f5aced0a28811e5a82ecb34a3766 100644 (file)
@@ -22,8 +22,8 @@ namespace Content.Client.GameTicking.Managers
         [Dependency] private readonly SharedAudioSystem _audio = default!;
 
         [ViewVariables] private bool _initialized;
-        private Dictionary<EntityUid, Dictionary<string, uint?>>  _jobsAvailable = new();
-        private Dictionary<EntityUid, string> _stationNames = new();
+        private Dictionary<NetEntity, Dictionary<string, uint?>>  _jobsAvailable = new();
+        private Dictionary<NetEntity, string> _stationNames = new();
 
         /// <summary>
         /// The current round-end window. Could be used to support re-opening the window after closing it.
@@ -41,14 +41,14 @@ namespace Content.Client.GameTicking.Managers
         [ViewVariables] public TimeSpan RoundStartTimeSpan { get; private set; }
         [ViewVariables] public new bool Paused { get; private set; }
 
-        [ViewVariables] public IReadOnlyDictionary<EntityUid, Dictionary<string, uint?>> JobsAvailable => _jobsAvailable;
-        [ViewVariables] public IReadOnlyDictionary<EntityUid, string> StationNames => _stationNames;
+        [ViewVariables] public IReadOnlyDictionary<NetEntity, Dictionary<string, uint?>> JobsAvailable => _jobsAvailable;
+        [ViewVariables] public IReadOnlyDictionary<NetEntity, string> StationNames => _stationNames;
 
         public event Action? InfoBlobUpdated;
         public event Action? LobbyStatusUpdated;
         public event Action? LobbySongUpdated;
         public event Action? LobbyLateJoinStatusUpdated;
-        public event Action<IReadOnlyDictionary<EntityUid, Dictionary<string, uint?>>>? LobbyJobsAvailableUpdated;
+        public event Action<IReadOnlyDictionary<NetEntity, Dictionary<string, uint?>>>? LobbyJobsAvailableUpdated;
 
         public override void Initialize()
         {
@@ -89,8 +89,18 @@ namespace Content.Client.GameTicking.Managers
 
         private void UpdateJobsAvailable(TickerJobsAvailableEvent message)
         {
-            _jobsAvailable = message.JobsAvailableByStation;
-            _stationNames = message.StationNames;
+            foreach (var (job, data) in message.JobsAvailableByStation)
+            {
+                _jobsAvailable.Clear();
+                _jobsAvailable[job] = data;
+            }
+
+            _stationNames.Clear();
+            foreach (var weh in message.StationNames)
+            {
+                _stationNames[weh.Key] = weh.Value;
+            }
+
             LobbyJobsAvailableUpdated?.Invoke(JobsAvailable);
         }
 
index bd9d7b44997f1319c1cf54b9f24e30a23c59585e..87fe257cd0837122baaad1401dce2e97d14c17ac 100644 (file)
@@ -174,9 +174,13 @@ namespace Content.Client.Gameplay
                     EntityCoordinates.FromMap(_mapManager, mousePosWorld);
             }
 
-            var message = new FullInputCmdMessage(_timing.CurTick, _timing.TickFraction, funcId, kArgs.State,
-                coordinates , kArgs.PointerLocation,
-                entityToClick ?? default); // TODO make entityUid nullable
+            var message = new ClientFullInputCmdMessage(_timing.CurTick, _timing.TickFraction, funcId)
+            {
+                State = kArgs.State,
+                Coordinates = coordinates,
+                ScreenCoordinates = kArgs.PointerLocation,
+                Uid = entityToClick ?? default,
+            }; // TODO make entityUid nullable
 
             // client side command handlers will always be sent the local player session.
             var session = _playerManager.LocalPlayer?.Session;
index 9478f0ab452579e906642bf74ee6a252b2f80fb6..53b23272d42b2b511ca2ed34898c47eeea1ee927 100644 (file)
@@ -20,7 +20,7 @@ public sealed class GatewayBoundUserInterface : BoundUserInterface
         _window = new GatewayWindow();
         _window.OpenPortal += destination =>
         {
-            SendMessage(new GatewayOpenPortalMessage(destination));
+            SendMessage(new GatewayOpenPortalMessage(EntMan.GetNetEntity(destination)));
         };
         _window.OnClose += Close;
         _window?.OpenCentered();
index b070cf3176eddcad5527d0fe719e8e7c12f6a495..c20b5e1a7034ed2c0338c80e0e17910c329edde9 100644 (file)
@@ -16,10 +16,11 @@ namespace Content.Client.Gateway.UI;
 public sealed partial class GatewayWindow : FancyWindow,
     IComputerWindow<EmergencyConsoleBoundUserInterfaceState>
 {
+    private readonly IEntityManager _entManager;
     private readonly IGameTiming _timing;
 
     public event Action<EntityUid>? OpenPortal;
-    private List<(EntityUid, string, TimeSpan, bool)> _destinations = default!;
+    private List<(NetEntity, string, TimeSpan, bool)> _destinations = default!;
     private EntityUid? _current;
     private TimeSpan _nextClose;
     private TimeSpan _lastOpen;
@@ -29,13 +30,15 @@ public sealed partial class GatewayWindow : FancyWindow,
     public GatewayWindow()
     {
         RobustXamlLoader.Load(this);
-        _timing = IoCManager.Resolve<IGameTiming>();
+        var dependencies = IoCManager.Instance!;
+        _entManager = dependencies.Resolve<IEntityManager>();
+        _timing = dependencies.Resolve<IGameTiming>();
     }
 
     public void UpdateState(GatewayBoundUserInterfaceState state)
     {
         _destinations = state.Destinations;
-        _current = state.Current;
+        _current = _entManager.GetEntity(state.Current);
         _nextClose = state.NextClose;
         _lastOpen = state.LastOpen;
 
@@ -64,7 +67,7 @@ public sealed partial class GatewayWindow : FancyWindow,
         var now = _timing.CurTime;
         foreach (var dest in _destinations)
         {
-            var uid = dest.Item1;
+            var uid = _entManager.GetEntity(dest.Item1);
             var name = dest.Item2;
             var nextReady = dest.Item3;
             var busy = dest.Item4;
@@ -101,7 +104,7 @@ public sealed partial class GatewayWindow : FancyWindow,
                 OpenPortal?.Invoke(uid);
             };
 
-            if (uid == state.Current)
+            if (uid == _entManager.GetEntity(state.Current))
             {
                 openButton.AddStyleClass(StyleBase.ButtonCaution);
             }
index d8cc822cbd5c325d68770c99b4febec1880100ba..773ec1491f82520b1199831540c0a682bf6ea2d4 100644 (file)
@@ -124,7 +124,7 @@ namespace Content.Client.Hands.Systems
         #region PickupAnimation
         private void HandlePickupAnimation(PickupAnimationEvent msg)
         {
-            PickupAnimation(msg.ItemUid, msg.InitialPosition, msg.FinalPosition, msg.InitialAngle);
+            PickupAnimation(GetEntity(msg.ItemUid), GetCoordinates(msg.InitialPosition), msg.FinalPosition, msg.InitialAngle);
         }
 
         public override void PickupAnimation(EntityUid item, EntityCoordinates initialPosition, Vector2 finalPosition, Angle initialAngle,
@@ -382,7 +382,7 @@ namespace Content.Client.Hands.Systems
             // update hands visuals if this item is in a hand (rather then inventory or other container).
             if (component.Hands.TryGetValue(args.ContainerId, out var hand))
             {
-                UpdateHandVisuals(uid, args.Item, hand, component);
+                UpdateHandVisuals(uid, GetEntity(args.Item), hand, component);
             }
         }
         #endregion
index 2f5431e935e7f4d282036455cf89ce3da27f1996..a2f1a4dc5ac9f43e33aa2dc2c1591646de1bdf8c 100644 (file)
@@ -24,13 +24,16 @@ namespace Content.Client.HealthAnalyzer.UI
         {
             var text = new StringBuilder();
             var entities = IoCManager.Resolve<IEntityManager>();
+            var target = entities.GetEntity(msg.TargetEntity);
 
-            if (msg.TargetEntity != null && entities.TryGetComponent<DamageableComponent>(msg.TargetEntity, out var damageable))
+            if (msg.TargetEntity != null && entities.TryGetComponent<DamageableComponent>(target, out var damageable))
             {
                 string entityName = "Unknown";
                 if (msg.TargetEntity != null &&
-                    entities.TryGetComponent<MetaDataComponent>(msg.TargetEntity.Value, out var metaData))
-                    entityName = Identity.Name(msg.TargetEntity.Value, entities);
+                    entities.HasComponent<MetaDataComponent>(target.Value))
+                {
+                    entityName = Identity.Name(target.Value, entities);
+                }
 
                 IReadOnlyDictionary<string, FixedPoint2> damagePerGroup = damageable.DamagePerGroup;
                 IReadOnlyDictionary<string, FixedPoint2> damagePerType = damageable.Damage.DamageDict;
index 05c9f2eb523fcafa34027ace4d247c9af9b0cb98..76f1aaaec8a54ad5b3fe109e40b5263ebdad7c4b 100644 (file)
@@ -197,7 +197,7 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
             profile.Appearance.EyeColor,
             _markingManager);
 
-        DebugTools.Assert(uid.IsClientSide());
+        DebugTools.Assert(IsClientSide(uid));
 
         var state = new HumanoidAppearanceState(markings,
             new(),
index 02e3cf0da3cce51ecabc06046b536f504fb75b0c..0b969b6efde30ba3dbf16e982997d9db236102da 100644 (file)
@@ -54,10 +54,10 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
 
     public void SetMaster(EntityUid uid, EntityUid? masterUid)
     {
-        if (!TryComp(uid, out InstrumentComponent? instrument))
+        if (!HasComp<InstrumentComponent>(uid))
             return;
 
-        RaiseNetworkEvent(new InstrumentSetMasterEvent(uid, masterUid));
+        RaiseNetworkEvent(new InstrumentSetMasterEvent(GetNetEntity(uid), GetNetEntity(masterUid)));
     }
 
     public void SetFilteredChannel(EntityUid uid, int channel, bool value)
@@ -68,7 +68,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
         if(value)
             instrument.Renderer?.SendMidiEvent(RobustMidiEvent.AllNotesOff((byte)channel, 0), false);
 
-        RaiseNetworkEvent(new InstrumentSetFilteredChannelEvent(uid, channel, value));
+        RaiseNetworkEvent(new InstrumentSetFilteredChannelEvent(GetNetEntity(uid), channel, value));
     }
 
     public override void SetupRenderer(EntityUid uid, bool fromStateChange, SharedInstrumentComponent? component = null)
@@ -109,7 +109,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
 
         if (!fromStateChange)
         {
-            RaiseNetworkEvent(new InstrumentStartMidiEvent(uid));
+            RaiseNetworkEvent(new InstrumentStartMidiEvent(GetNetEntity(uid)));
         }
     }
 
@@ -189,7 +189,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
 
         if (!fromStateChange && _netManager.IsConnected)
         {
-            RaiseNetworkEvent(new InstrumentStopMidiEvent(uid));
+            RaiseNetworkEvent(new InstrumentStopMidiEvent(GetNetEntity(uid)));
         }
     }
 
@@ -282,7 +282,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
 
     private void OnMidiEventRx(InstrumentMidiEventEvent midiEv)
     {
-        var uid = midiEv.Uid;
+        var uid = GetEntity(midiEv.Uid);
 
         if (!TryComp(uid, out InstrumentComponent? instrument))
             return;
@@ -354,12 +354,12 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
 
     private void OnMidiStart(InstrumentStartMidiEvent ev)
     {
-        SetupRenderer(ev.Uid, true);
+        SetupRenderer(GetEntity(ev.Uid), true);
     }
 
     private void OnMidiStop(InstrumentStopMidiEvent ev)
     {
-        EndRenderer(ev.Uid, true);
+        EndRenderer(GetEntity(ev.Uid), true);
     }
 
     public override void Update(float frameTime)
@@ -425,7 +425,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
             if (eventCount == 0)
                 continue;
 
-            RaiseNetworkEvent(new InstrumentMidiEventEvent(uid, events));
+            RaiseNetworkEvent(new InstrumentMidiEventEvent(GetNetEntity(uid), events));
 
             instrument.SentWithinASec += eventCount;
 
index a225fcdfd6e364f1193b9ff67565bf4860523a72..5fb293a194d766d5789cafc5a27fd1136c837fe8 100644 (file)
@@ -32,12 +32,13 @@ public sealed partial class BandMenu : DefaultWindow
         Timer.Spawn(0, Close);
     }
 
-    public void Populate((EntityUid, string)[] nearby)
+    public void Populate((NetEntity, string)[] nearby, IEntityManager entManager)
     {
         BandList.Clear();
 
-        foreach (var (uid, name) in nearby)
+        foreach (var (nent, name) in nearby)
         {
+            var uid = entManager.GetEntity(nent);
             var item = BandList.AddItem(name, null, true, uid);
             item.Selected = _owner.Instrument?.Master == uid;
         }
index d88eb94130461812aa0e4142fcb5ad99dfa5ff6b..2a846ff708a6f7de23e8f6ceec281ee845f4867e 100644 (file)
@@ -10,15 +10,15 @@ namespace Content.Client.Instruments.UI
 {
     public sealed class InstrumentBoundUserInterface : BoundUserInterface
     {
-        [Dependency] public readonly IEntityManager Entities = default!;
+        public IEntityManager Entities => EntMan;
         [Dependency] public readonly IMidiManager MidiManager = default!;
         [Dependency] public readonly IFileDialogManager FileDialogManager = default!;
         [Dependency] public readonly IPlayerManager PlayerManager = default!;
         [Dependency] public readonly ILocalizationManager Loc = default!;
 
-        public readonly InstrumentSystem Instruments = default!;
-        public readonly ActionBlockerSystem ActionBlocker = default!;
-        public readonly SharedInteractionSystem Interactions = default!;
+        public readonly InstrumentSystem Instruments;
+        public readonly ActionBlockerSystem ActionBlocker;
+        public readonly SharedInteractionSystem Interactions;
 
         [ViewVariables] private InstrumentMenu? _instrumentMenu;
         [ViewVariables] private BandMenu? _bandMenu;
@@ -40,7 +40,7 @@ namespace Content.Client.Instruments.UI
             switch (message)
             {
                 case InstrumentBandResponseBuiMessage bandRx:
-                    _bandMenu?.Populate(bandRx.Nearby);
+                    _bandMenu?.Populate(bandRx.Nearby, EntMan);
                     break;
                 default:
                     break;
index 5813d69524b33d60f16ca15207a180286984e8b2..e74df5d570d337c815451dcce35807e249112bef 100644 (file)
@@ -282,7 +282,7 @@ namespace Content.Client.Inventory
                 return;
 
             EntityManager.RaisePredictiveEvent(
-                new InteractInventorySlotEvent(item.Value, altInteract: false));
+                new InteractInventorySlotEvent(GetNetEntity(item.Value), altInteract: false));
         }
 
         public void UIInventoryAltActivateItem(string slot, EntityUid uid)
@@ -290,7 +290,7 @@ namespace Content.Client.Inventory
             if (!TryGetSlotEntity(uid, slot, out var item))
                 return;
 
-            EntityManager.RaisePredictiveEvent(new InteractInventorySlotEvent(item.Value, altInteract: true));
+            EntityManager.RaisePredictiveEvent(new InteractInventorySlotEvent(GetNetEntity(item.Value), altInteract: true));
         }
 
         public sealed class SlotData
index 7ddc7d6c6d22a545ba1c06459ce5aebdda3e4c16..e406ba2b5574639d6d2d5a73d9c8ee0716397cf1 100644 (file)
@@ -44,7 +44,7 @@ public sealed class ItemSystem : SharedItemSystem
     {
         // if the item is in a container, it might be equipped to hands or inventory slots --> update visuals.
         if (Container.TryGetContainingContainer(uid, out var container))
-            RaiseLocalEvent(container.Owner, new VisualsChangedEvent(uid, container.ID));
+            RaiseLocalEvent(container.Owner, new VisualsChangedEvent(GetNetEntity(uid), container.ID));
     }
 
     /// <summary>
index 79f212bbf6e033ac64ba379942fbefc10513b06c..1822dd7fff05cddb60bc91add3392103d34e3d9f 100644 (file)
@@ -57,7 +57,9 @@ namespace Content.Client.Kitchen.UI
             ChamberContentBox.EjectButton.Disabled = state.ChamberContents.Length <= 0;
             GrindButton.Disabled = !state.CanGrind || !state.Powered;
             JuiceButton.Disabled = !state.CanJuice || !state.Powered;
-            RefreshContentsDisplay(state.ReagentQuantities, state.ChamberContents, state.HasBeakerIn);
+
+            // TODO move this to a component state and ensure the net ids.
+            RefreshContentsDisplay(state.ReagentQuantities, _entityManager.GetEntityArray(state.ChamberContents), state.HasBeakerIn);
         }
 
         public void HandleMessage(BoundUserInterfaceMessage message)
index 968d9f30a2dae31af9d612b9d3519406c78ee6d4..deadff91fc49671a0a4195426b8d156711f6a048 100644 (file)
@@ -20,8 +20,11 @@ namespace Content.Client.Kitchen.UI
         [ViewVariables]
         private readonly Dictionary<int, ReagentQuantity> _reagents = new();
 
+        private IEntityManager _entManager;
+
         public MicrowaveBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
         {
+            _entManager = IoCManager.Resolve<IEntityManager>();
         }
 
         protected override void Open()
@@ -34,7 +37,7 @@ namespace Content.Client.Kitchen.UI
             _menu.EjectButton.OnPressed += _ => SendMessage(new MicrowaveEjectMessage());
             _menu.IngredientsList.OnItemSelected += args =>
             {
-                SendMessage(new MicrowaveEjectSolidIndexedMessage(_solids[args.ItemIndex]));
+                SendMessage(new MicrowaveEjectSolidIndexedMessage(EntMan.GetNetEntity(_solids[args.ItemIndex])));
             };
 
             _menu.OnCookTimeSelected += (args, buttonIndex) =>
@@ -57,7 +60,6 @@ namespace Content.Client.Kitchen.UI
             _menu?.Dispose();
         }
 
-
         protected override void UpdateState(BoundUserInterfaceState state)
         {
             base.UpdateState(state);
@@ -67,7 +69,9 @@ namespace Content.Client.Kitchen.UI
             }
 
             _menu?.ToggleBusyDisableOverlayPanel(cState.IsMicrowaveBusy);
-            RefreshContentsDisplay(cState.ContainedSolids);
+
+            // TODO move this to a component state and ensure the net ids.
+            RefreshContentsDisplay(_entManager.GetEntityArray(cState.ContainedSolids));
 
             if (_menu == null) return;
 
index c8c978d3135dd47065eea3f5b59f194f3231e88a..39b85c261b38ca908ccd8a06abe349772d4e6f68 100644 (file)
@@ -74,7 +74,7 @@ namespace Content.Client.Kitchen.UI
 
         public void EjectChamberContent(EntityUid uid)
         {
-            SendMessage(new ReagentGrinderEjectChamberContentMessage(uid));
+            SendMessage(new ReagentGrinderEjectChamberContentMessage(EntMan.GetNetEntity(uid)));
         }
     }
 }
index d2b4103140e499ac48fdd66fb29cd2455127faea..dd8281ecbf5b3721cb2c508ef664ec01076bc5e9 100644 (file)
@@ -23,17 +23,18 @@ namespace Content.Client.LateJoin
         [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
         [Dependency] private readonly IClientConsoleHost _consoleHost = default!;
         [Dependency] private readonly IConfigurationManager _configManager = default!;
+        [Dependency] private readonly IEntityManager _entManager = default!;
         [Dependency] private readonly IEntitySystemManager _entitySystem = default!;
         [Dependency] private readonly JobRequirementsManager _jobRequirements = default!;
 
-        public event Action<(EntityUid, string)> SelectedId;
+        public event Action<(NetEntity, string)> SelectedId;
 
         private readonly ClientGameTicker _gameTicker;
         private readonly SpriteSystem _sprites;
         private readonly CrewManifestSystem _crewManifest;
 
-        private readonly Dictionary<EntityUid, Dictionary<string, JobButton>> _jobButtons = new();
-        private readonly Dictionary<EntityUid, Dictionary<string, BoxContainer>> _jobCategories = new();
+        private readonly Dictionary<NetEntity, Dictionary<string, JobButton>> _jobButtons = new();
+        private readonly Dictionary<NetEntity, Dictionary<string, BoxContainer>> _jobCategories = new();
         private readonly List<ScrollContainer> _jobLists = new();
 
         private readonly Control _base;
@@ -281,7 +282,7 @@ namespace Content.Client.LateJoin
             }
         }
 
-        private void JobsAvailableUpdated(IReadOnlyDictionary<EntityUid, Dictionary<string, uint?>> _)
+        private void JobsAvailableUpdated(IReadOnlyDictionary<NetEntity, Dictionary<string, uint?>> _)
         {
             RebuildUI();
         }
index 405cf3d0188b5c51929b3bad2b16c742abef7df0..ccea86013d5613a0ad6ad4746b44ea4bf0ac8f52 100644 (file)
@@ -205,7 +205,7 @@ namespace Content.Client.Light
         public static Color GetCurrentRgbColor(TimeSpan curTime, TimeSpan offset, RgbLightControllerComponent rgb)
         {
             return Color.FromHsv(new Vector4(
-                (float) (((curTime.TotalSeconds - offset.TotalSeconds) * rgb.CycleRate + Math.Abs(rgb.Owner.GetHashCode() * 0.1)) % 1),
+                (float) (((curTime.TotalSeconds - offset.TotalSeconds) * rgb.CycleRate + Math.Abs(rgb.Owner.Id * 0.1)) % 1),
                 1.0f,
                 1.0f,
                 1.0f
index dcf74557eecf3902b34505cad5476ad287d0dad7..16357c8983872092f2c89212b8b3c092fba6c10d 100644 (file)
@@ -47,11 +47,11 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
         _dragging = grid;
         _localPosition = localPosition;
 
-        if (TryComp<PhysicsComponent>(grid, out var body))
+        if (HasComp<PhysicsComponent>(grid))
         {
             RaiseNetworkEvent(new GridDragVelocityRequest()
             {
-                Grid = grid,
+                Grid = GetNetEntity(grid),
                 LinearVelocity = Vector2.Zero
             });
         }
@@ -69,7 +69,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
             var distance = _lastMousePosition.Value.Position - xform.WorldPosition;
             RaiseNetworkEvent(new GridDragVelocityRequest()
             {
-                Grid = _dragging.Value,
+                Grid = GetNetEntity(_dragging.Value),
                 LinearVelocity = distance.LengthSquared() > 0f ? (distance / (float) tickTime.TotalSeconds) * 0.25f : Vector2.Zero,
             });
         }
@@ -125,7 +125,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
 
         RaiseNetworkEvent(new GridDragRequestPosition()
         {
-            Grid = _dragging.Value,
+            Grid = GetNetEntity(_dragging.Value),
             WorldPosition = requestedGridOrigin,
         });
     }
index 1ec19ad4119cab3d9a718b10b11de6586189d474..975dfa3f8189cf3802ec85daef03d91ed9f179a4 100644 (file)
@@ -67,20 +67,14 @@ namespace Content.Client.MassMedia.Ui
 
             var stringContent = Rope.Collapse(_menu.ContentInput.TextRope);
 
-            if (stringContent == null || stringContent.Length == 0) return;
-            if (_gameTicker == null) return;
+            if (stringContent == null || stringContent.Length == 0)
+                return;
 
-            NewsArticle article = new NewsArticle();
             var stringName = _menu.NameInput.Text;
             var name = (stringName.Length <= 25 ? stringName.Trim() : $"{stringName.Trim().Substring(0, 25)}...");
-            article.Name = name;
-            article.Content = stringContent;
-            article.ShareTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan);
-
             _menu.ContentInput.TextRope = new Rope.Leaf(string.Empty);
             _menu.NameInput.Text = string.Empty;
-
-            SendMessage(new NewsWriteShareMessage(article));
+            SendMessage(new NewsWriteShareMessage(name, stringContent));
         }
 
         private void OnDeleteButtonPressed(int articleNum)
index 49bac300e402dc11fb0332483c27d0775a775cd9..4bb9961fc47fe8aae9c06f06367ae41320c18505 100644 (file)
@@ -20,9 +20,11 @@ public sealed partial class MechGrabberUi : UIFragment
             return;
 
         _fragment = new MechGrabberUiFragment();
+
         _fragment.OnEjectAction += e =>
         {
-            userInterface.SendMessage(new MechGrabberEjectMessage(fragmentOwner.Value, e));
+            var entManager = IoCManager.Resolve<IEntityManager>();
+            userInterface.SendMessage(new MechGrabberEjectMessage(entManager.GetNetEntity(fragmentOwner.Value), entManager.GetNetEntity(e)));
         };
     }
 
index 8fc04d6460efeeb2fc85ed1c34356435fa0891ab..94f86e74a02b3e50d4ea96e5b6393f5cf21cd630 100644 (file)
@@ -23,7 +23,7 @@ public sealed partial class MechGrabberUiFragment : BoxContainer
         SpaceLabel.Text = $"{state.Contents.Count}/{state.MaxContents}";
         for (var i = 0; i < state.Contents.Count; i++)
         {
-            var ent = state.Contents[i];
+            var ent = _entity.GetEntity(state.Contents[i]);
 
             if (!_entity.TryGetComponent<MetaDataComponent>(ent, out var meta))
                 continue;
index d4f12db454c0998a9a627a908b9175a239b8a70e..e44e86140947ce2c806da90f1efd0b9192725886 100644 (file)
@@ -22,7 +22,8 @@ public sealed partial class MechSoundboardUi : UIFragment
         _fragment = new MechSoundboardUiFragment();
         _fragment.OnPlayAction += sound =>
         {
-            userInterface.SendMessage(new MechSoundboardPlayMessage(fragmentOwner.Value, sound));
+            // TODO: IDK dog
+            userInterface.SendMessage(new MechSoundboardPlayMessage(IoCManager.Resolve<IEntityManager>().GetNetEntity(fragmentOwner.Value), sound));
         };
     }
 
index 62b4fdf250d0f824ff3e9840e426044bb689b0b4..4172bdc90f1b9985b0363c425b82c78aabb8fe01 100644 (file)
@@ -27,7 +27,7 @@ public sealed class MechBoundUserInterface : BoundUserInterface
 
         _menu.OnRemoveButtonPressed += uid =>
         {
-            SendMessage(new MechEquipmentRemoveMessage(uid));
+            SendMessage(new MechEquipmentRemoveMessage(EntMan.GetNetEntity(uid)));
         };
     }
 
@@ -54,7 +54,7 @@ public sealed class MechBoundUserInterface : BoundUserInterface
                 continue;
             foreach (var (attached, estate) in state.EquipmentStates)
             {
-                if (ent == attached)
+                if (ent == EntMan.GetEntity(attached))
                     ui.UpdateState(estate);
             }
         }
index 40da258a4be1bf8fb63cbf7af79ed92409408fdf..ff08af6bb6b83f5da52d3dd0f4d805749738210c 100644 (file)
@@ -64,15 +64,18 @@ namespace Content.Client.Medical.CrewMonitoring
             // add a row for each sensor
             foreach (var sensor in stSensors.OrderBy(a => a.Name))
             {
+                var sensorEntity = _entManager.GetEntity(sensor.SuitSensorUid);
+                var coordinates = _entManager.GetCoordinates(sensor.Coordinates);
+
                 // add button with username
                 var nameButton = new CrewMonitoringButton()
                 {
-                    SuitSensorUid = sensor.SuitSensorUid,
-                    Coordinates = sensor.Coordinates,
+                    SuitSensorUid = sensorEntity,
+                    Coordinates = coordinates,
                     Text = sensor.Name,
                     Margin = new Thickness(5f, 5f),
                 };
-                if (sensor.SuitSensorUid == _trackedButton?.SuitSensorUid)
+                if (sensorEntity == _trackedButton?.SuitSensorUid)
                     nameButton.AddStyleClass(StyleNano.StyleClassButtonColorGreen);
                 SetColorLabel(nameButton.Label, sensor.TotalDamage, sensor.IsAlive);
                 SensorsTable.AddChild(nameButton);
@@ -113,10 +116,10 @@ namespace Content.Client.Medical.CrewMonitoring
                 SensorsTable.AddChild(box);
                 _rowsContent.Add(box);
 
-                if (sensor.Coordinates != null && NavMap.Visible)
+                if (coordinates != null && NavMap.Visible)
                 {
-                    NavMap.TrackedCoordinates.TryAdd(sensor.Coordinates.Value,
-                        (true, sensor.SuitSensorUid == _trackedButton?.SuitSensorUid ? StyleNano.PointGreen : StyleNano.PointRed));
+                    NavMap.TrackedCoordinates.TryAdd(coordinates.Value,
+                        (true, sensorEntity == _trackedButton?.SuitSensorUid ? StyleNano.PointGreen : StyleNano.PointRed));
 
                     nameButton.OnButtonUp += args =>
                     {
@@ -124,8 +127,8 @@ namespace Content.Client.Medical.CrewMonitoring
                             //Make previous point red
                             NavMap.TrackedCoordinates[_trackedButton.Coordinates.Value] = (true, StyleNano.PointRed);
 
-                        NavMap.TrackedCoordinates[sensor.Coordinates.Value] = (true, StyleNano.PointGreen);
-                        NavMap.CenterToCoordinates(sensor.Coordinates.Value);
+                        NavMap.TrackedCoordinates[coordinates.Value] = (true, StyleNano.PointGreen);
+                        NavMap.CenterToCoordinates(coordinates.Value);
 
                         nameButton.AddStyleClass(StyleNano.StyleClassButtonColorGreen);
                         if (_trackedButton != null)
@@ -145,7 +148,7 @@ namespace Content.Client.Medical.CrewMonitoring
 
         private BoxContainer GetPositionBox(SuitSensorStatus sensor, Vector2 monitorCoordsInStationSpace, bool snap, float precision)
         {
-            EntityCoordinates? coordinates = sensor.Coordinates;
+            EntityCoordinates? coordinates = _entManager.GetCoordinates(sensor.Coordinates);
             var box = new BoxContainer() { Orientation = LayoutOrientation.Horizontal };
 
             if (coordinates == null || _stationUid == null)
index f12dfaf33b2fff5f09157f70b1a322cf48b5d730..7ea914b8c31f1a46a8d0e5eca1be8e869a95ff24 100644 (file)
@@ -46,7 +46,7 @@ public sealed class HTNSystem : EntitySystem
 
     private void OnHTNMessage(HTNMessage ev)
     {
-        if (!TryComp<HTNComponent>(ev.Uid, out var htn))
+        if (!TryComp<HTNComponent>(GetEntity(ev.Uid), out var htn))
             return;
 
         htn.DebugText = ev.Text;
index c647c026c1e26b0f2d31d953346d995618f8efe7..271632d0184602a0bb54d6b9fb6afae3212fc306 100644 (file)
@@ -61,10 +61,12 @@ public sealed class NPCSteeringSystem : SharedNPCSteeringSystem
 
         foreach (var data in ev.Data)
         {
-            if (!Exists(data.EntityUid))
+            var entity = GetEntity(data.EntityUid);
+
+            if (!Exists(entity))
                 continue;
 
-            var comp = EnsureComp<NPCSteeringComponent>(data.EntityUid);
+            var comp = EnsureComp<NPCSteeringComponent>(entity);
             comp.Direction = data.Direction;
             comp.DangerMap = data.Danger;
             comp.InterestMap = data.Interest;
index ea50725b4fb5e263a298ce06ffd3733402974853..518c1f32aaeaa72b444541ffe4f478debd99fd79 100644 (file)
@@ -60,8 +60,8 @@ namespace Content.Client.NPC
         private PathfindingDebugMode _modes = PathfindingDebugMode.None;
 
         // It's debug data IDC if it doesn't support snapshots I just want something fast.
-        public Dictionary<EntityUid, Dictionary<Vector2i, List<PathfindingBreadcrumb>>> Breadcrumbs = new();
-        public Dictionary<EntityUid, Dictionary<Vector2i, Dictionary<Vector2i, List<DebugPathPoly>>>> Polys = new();
+        public Dictionary<NetEntity, Dictionary<Vector2i, List<PathfindingBreadcrumb>>> Breadcrumbs = new();
+        public Dictionary<NetEntity, Dictionary<Vector2i, Dictionary<Vector2i, List<DebugPathPoly>>>> Polys = new();
         public readonly List<(TimeSpan Time, PathRouteMessage Message)> Routes = new();
 
         public override void Initialize()
@@ -184,7 +184,9 @@ namespace Content.Client.NPC
 
                 foreach (var grid in _mapManager.FindGridsIntersecting(mouseWorldPos.MapId, aabb))
                 {
-                    if (found || !_system.Breadcrumbs.TryGetValue(grid.Owner, out var crumbs) || !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
+                    var netGrid = _entManager.GetNetEntity(grid.Owner);
+
+                    if (found || !_system.Breadcrumbs.TryGetValue(netGrid, out var crumbs) || !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
                         continue;
 
                     var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
@@ -257,7 +259,7 @@ namespace Content.Client.NPC
                 if (!_mapManager.TryFindGridAt(mouseWorldPos, out var gridUid, out var grid) || !xformQuery.TryGetComponent(gridUid, out var gridXform))
                     return;
 
-                if (!_system.Polys.TryGetValue(gridUid, out var data))
+                if (!_system.Polys.TryGetValue(_entManager.GetNetEntity(gridUid), out var data))
                     return;
 
                 var tileRef = grid.GetTileRef(mouseWorldPos);
@@ -333,7 +335,9 @@ namespace Content.Client.NPC
             {
                 foreach (var grid in _mapManager.FindGridsIntersecting(mouseWorldPos.MapId, aabb))
                 {
-                    if (!_system.Breadcrumbs.TryGetValue(grid.Owner, out var crumbs) ||
+                    var netGrid = _entManager.GetNetEntity(grid.Owner);
+
+                    if (!_system.Breadcrumbs.TryGetValue(netGrid, out var crumbs) ||
                         !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
                     {
                         continue;
@@ -390,7 +394,9 @@ namespace Content.Client.NPC
             {
                 foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, aabb))
                 {
-                    if (!_system.Polys.TryGetValue(grid.Owner, out var data) ||
+                    var netGrid = _entManager.GetNetEntity(grid.Owner);
+
+                    if (!_system.Polys.TryGetValue(netGrid, out var data) ||
                         !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
                         continue;
 
@@ -424,7 +430,9 @@ namespace Content.Client.NPC
             {
                 foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, aabb))
                 {
-                    if (!_system.Polys.TryGetValue(grid.Owner, out var data) ||
+                    var netGrid = _entManager.GetNetEntity(grid.Owner);
+
+                    if (!_system.Polys.TryGetValue(netGrid, out var data) ||
                         !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
                         continue;
 
@@ -450,10 +458,10 @@ namespace Content.Client.NPC
                                     Color color;
                                     Vector2 neighborPos;
 
-                                    if (neighborPoly.EntityId != poly.GraphUid)
+                                    if (neighborPoly.NetEntity != poly.GraphUid)
                                     {
                                         color = Color.Green;
-                                        var neighborMap = neighborPoly.ToMap(_entManager);
+                                        var neighborMap = _entManager.GetCoordinates(neighborPoly).ToMap(_entManager);
 
                                         if (neighborMap.MapId != args.MapId)
                                             continue;
@@ -478,7 +486,9 @@ namespace Content.Client.NPC
             {
                 foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, args.WorldBounds))
                 {
-                    if (!_system.Breadcrumbs.TryGetValue(grid.Owner, out var crumbs) ||
+                    var netGrid = _entManager.GetNetEntity(grid.Owner);
+
+                    if (!_system.Breadcrumbs.TryGetValue(netGrid, out var crumbs) ||
                         !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
                         continue;
 
@@ -506,7 +516,7 @@ namespace Content.Client.NPC
                 {
                     foreach (var node in route.Message.Path)
                     {
-                        if (!_entManager.TryGetComponent<TransformComponent>(node.GraphUid, out var graphXform))
+                        if (!_entManager.TryGetComponent<TransformComponent>(_entManager.GetEntity(node.GraphUid), out var graphXform))
                             continue;
 
                         worldHandle.SetTransform(graphXform.WorldMatrix);
@@ -525,12 +535,14 @@ namespace Content.Client.NPC
 
                     foreach (var (node, cost) in route.Message.Costs)
                     {
-                        if (matrix != node.GraphUid)
+                        var graph = _entManager.GetEntity(node.GraphUid);
+
+                        if (matrix != graph)
                         {
-                            if (!_entManager.TryGetComponent<TransformComponent>(node.GraphUid, out var graphXform))
+                            if (!_entManager.TryGetComponent<TransformComponent>(graph, out var graphXform))
                                 continue;
 
-                            matrix = node.GraphUid;
+                            matrix = graph;
                             worldHandle.SetTransform(graphXform.WorldMatrix);
                         }
 
index 4afc5ffc480799bb1f298533db9b48dbffd2d19b..0a3d7ddad02677e980521c0dbfd249799473a6e4 100644 (file)
@@ -69,7 +69,7 @@ namespace Content.Client.NodeContainer
 
             Entities = Groups.Values
                 .SelectMany(g => g.Nodes, (data, nodeData) => (data, nodeData))
-                .GroupBy(n => n.nodeData.Entity)
+                .GroupBy(n => GetEntity(n.nodeData.Entity))
                 .ToDictionary(g => g.Key, g => g.ToArray());
 
             NodeLookup = Groups.Values
index 43e3c12a72b709e2a18cc2e86ac6d61af7e578c5..85198f01d0cf24e774e118d525d24cd592d4b99d 100644 (file)
@@ -77,7 +77,7 @@ namespace Content.Client.NodeContainer
             var node = _system.NodeLookup[(groupId, nodeId)];
 
 
-            var xform = _entityManager.GetComponent<TransformComponent>(node.Entity);
+            var xform = _entityManager.GetComponent<TransformComponent>(_entityManager.GetEntity(node.Entity));
             if (!_mapManager.TryGetGrid(xform.GridUid, out var grid))
                 return;
             var gridTile = grid.TileIndicesFor(xform.Coordinates);
index f8bae5664bd30045090534ea0e208638eda26da6..82b12fbf36a69176498e7b8664ca722b7d6ceb0e 100644 (file)
@@ -31,7 +31,7 @@ public sealed class PointingSystem : SharedPointingSystem
 
     private void AddPointingVerb(GetVerbsEvent<Verb> args)
     {
-        if (args.Target.IsClientSide())
+        if (IsClientSide(args.Target))
             return;
 
         // Really this could probably be a properly predicted event, but that requires reworking pointing. For now
@@ -57,7 +57,7 @@ public sealed class PointingSystem : SharedPointingSystem
             Text = Loc.GetString("pointing-verb-get-data-text"),
             Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/point.svg.192dpi.png")),
             ClientExclusive = true,
-            Act = () => RaiseNetworkEvent(new PointingAttemptEvent(args.Target))
+            Act = () => RaiseNetworkEvent(new PointingAttemptEvent(GetNetEntity(args.Target)))
         };
 
         args.Verbs.Add(verb);
index d8d3f079c5112d60d4585bfb11cc25d3b5c46a0a..63b8d7f6df565e1dbaf5559400051ee7073618ae 100644 (file)
@@ -61,9 +61,9 @@ namespace Content.Client.Popups
             if (recordReplay && _replayRecording.IsRecording)
             {
                 if (entity != null)
-                    _replayRecording.RecordClientMessage(new PopupEntityEvent(message, type, entity.Value));
+                    _replayRecording.RecordClientMessage(new PopupEntityEvent(message, type, GetNetEntity(entity.Value)));
                 else
-                    _replayRecording.RecordClientMessage(new PopupCoordinatesEvent(message, type, coordinates));
+                    _replayRecording.RecordClientMessage(new PopupCoordinatesEvent(message, type, GetNetCoordinates(coordinates)));
             }
 
             var label = new WorldPopupLabel(coordinates)
@@ -170,13 +170,15 @@ namespace Content.Client.Popups
 
         private void OnPopupCoordinatesEvent(PopupCoordinatesEvent ev)
         {
-            PopupMessage(ev.Message, ev.Type, ev.Coordinates, null, false);
+            PopupMessage(ev.Message, ev.Type, GetCoordinates(ev.Coordinates), null, false);
         }
 
         private void OnPopupEntityEvent(PopupEntityEvent ev)
         {
-            if (TryComp(ev.Uid, out TransformComponent? transform))
-                PopupMessage(ev.Message, ev.Type, transform.Coordinates, ev.Uid, false);
+            var entity = GetEntity(ev.Uid);
+
+            if (TryComp(entity, out TransformComponent? transform))
+                PopupMessage(ev.Message, ev.Type, transform.Coordinates, entity, false);
         }
 
         private void OnRoundRestart(RoundRestartCleanupEvent ev)
index 20be44792f69cbdf4e7472a43e1a634589079a70..07da813045faf177f7881c2660a599385e4d5175 100644 (file)
@@ -19,10 +19,12 @@ public sealed class ProjectileSystem : SharedProjectileSystem
 
     private void OnProjectileImpact(ImpactEffectEvent ev)
     {
-        if (Deleted(ev.Coordinates.EntityId))
+        var coords = GetCoordinates(ev.Coordinates);
+
+        if (Deleted(coords.EntityId))
             return;
 
-        var ent = Spawn(ev.Prototype, ev.Coordinates);
+        var ent = Spawn(ev.Prototype, coords);
 
         if (TryComp<SpriteComponent>(ent, out var sprite))
         {
index 96fbb5dca82e11cb9b591190b853067909b9eaca..8c721fa7771d1fdf18ef8e1c7a2577262a5ea465 100644 (file)
@@ -59,8 +59,10 @@ public sealed class RadiationDebugOverlay : Overlay
                 handle.DrawString(_font, screenCenter, ray.Rads.ToString("F2"), 2f, Color.White);
             }
 
-            foreach (var (gridUid, blockers) in ray.Blockers)
+            foreach (var (netGrid, blockers) in ray.Blockers)
             {
+                var gridUid = _entityManager.GetEntity(netGrid);
+
                 if (!_mapManager.TryGetGrid(gridUid, out var grid))
                     continue;
 
@@ -82,8 +84,10 @@ public sealed class RadiationDebugOverlay : Overlay
 
         var handle = args.ScreenHandle;
         var query = _entityManager.GetEntityQuery<TransformComponent>();
-        foreach (var (gridUid, resMap) in resistance)
+        foreach (var (netGrid, resMap) in resistance)
         {
+            var gridUid = _entityManager.GetEntity(netGrid);
+
             if (!_mapManager.TryGetGrid(gridUid, out var grid))
                 continue;
             if (query.TryGetComponent(gridUid, out var trs) && trs.MapID != args.MapId)
@@ -119,8 +123,10 @@ public sealed class RadiationDebugOverlay : Overlay
                 continue;
             }
 
-            foreach (var (gridUid, blockers) in ray.Blockers)
+            foreach (var (netGrid, blockers) in ray.Blockers)
             {
+                var gridUid = _entityManager.GetEntity(netGrid);
+
                 if (!_mapManager.TryGetGrid(gridUid, out var grid))
                     continue;
                 var (destTile, _) = blockers.Last();
index d7401dce7e68fe455499e933c30c65605a5530aa..7a193d4a751ac3c239c6d39a5a3bcc8a1be3a809 100644 (file)
@@ -26,7 +26,7 @@ public sealed class GeigerSystem : SharedGeigerSystem
         component.CurrentRadiation = state.CurrentRadiation;
         component.DangerLevel = state.DangerLevel;
         component.IsEnabled = state.IsEnabled;
-        component.User = state.User;
+        component.User = EnsureEntity<GeigerComponent>(state.User, uid);
         component.UiUpdateNeeded = true;
     }
 
index 9288c606526dbab2a9a54cbcf9bb759b00ed4c23..929ad6aa4ac58e79b6828aa487aaf8e974238728 100644 (file)
@@ -10,7 +10,7 @@ public sealed class RadiationSystem : EntitySystem
     [Dependency] private readonly IOverlayManager _overlayMan = default!;
 
     public List<RadiationRay>? Rays;
-    public Dictionary<EntityUid, Dictionary<Vector2i, float>>? ResistanceGrids;
+    public Dictionary<NetEntity, Dictionary<Vector2i, float>>? ResistanceGrids;
 
     public override void Initialize()
     {
@@ -40,15 +40,13 @@ public sealed class RadiationSystem : EntitySystem
 
         var str = $"Radiation update: {ev.ElapsedTimeMs}ms with. Receivers: {ev.ReceiversCount}, " +
                   $"Sources: {ev.SourcesCount}, Rays: {ev.Rays.Count}";
-        Logger.Info(str);
+        Log.Info(str);
 
         Rays = ev.Rays;
     }
 
     private void OnResistanceUpdate(OnRadiationOverlayResistanceUpdateEvent ev)
     {
-        if (!_overlayMan.TryGetOverlay(out RadiationDebugOverlay? overlay))
-            return;
         ResistanceGrids = ev.Grids;
     }
 }
index 2b72d2563b89ffde109fc961a3b65b159cff932d..3bb2afe1221869ca255b6b1c53ec4cfdab1282b9 100644 (file)
@@ -55,7 +55,7 @@ public sealed partial class ReplaySpectatorSystem
             return;
         }
 
-        if (!player.IsClientSide() || !HasComp<ReplaySpectatorComponent>(player))
+        if (!IsClientSide(player) || !HasComp<ReplaySpectatorComponent>(player))
         {
             // Player is trying to move -> behave like the ghost-on-move component.
             SpawnSpectatorGhost(new EntityCoordinates(player, default), true);
@@ -113,12 +113,9 @@ public sealed partial class ReplaySpectatorSystem
             _dir = dir;
         }
 
-        public override bool HandleCmdMessage(ICommonSession? session, InputCmdMessage message)
+        public override bool HandleCmdMessage(IEntityManager entManager, ICommonSession? session, IFullInputCmdMessage message)
         {
-            if (message is not FullInputCmdMessage full)
-                return false;
-
-            if (full.State == BoundKeyState.Down)
+            if (message.State == BoundKeyState.Down)
                 _sys.Direction |= _dir;
             else
                 _sys.Direction &= ~_dir;
index 04fd35da11b38067d30b97d40fa42b6271ef1a18..66768e9fda25274d2e007c4813758bd629a87bf7 100644 (file)
@@ -167,7 +167,7 @@ public sealed partial class ReplaySpectatorSystem
 
     private void OnDetached(EntityUid uid, ReplaySpectatorComponent component, PlayerDetachedEvent args)
     {
-        if (uid.IsClientSide())
+        if (IsClientSide(uid))
             QueueDel(uid);
         else
             RemCompDeferred(uid, component);
index 09325a7a36fc76fd4efeccbe2966f9c6ae1f76c9..f3475c5479c05fe204426cd9a3ad98150103c59f 100644 (file)
@@ -51,7 +51,7 @@ public sealed partial class ReplaySpectatorSystem
         if (old == null)
             return;
 
-        if (old.Value.IsClientSide())
+        if (IsClientSide(old.Value))
             Del(old.Value);
         else
             RemComp<ReplaySpectatorComponent>(old.Value);
@@ -77,7 +77,7 @@ public sealed partial class ReplaySpectatorSystem
 
         if (old != null)
         {
-            if (old.Value.IsClientSide())
+            if (IsClientSide(old.Value))
                 QueueDel(old.Value);
             else
                 RemComp<ReplaySpectatorComponent>(old.Value);
@@ -100,12 +100,14 @@ public sealed partial class ReplaySpectatorSystem
             return;
         }
 
-        if (!EntityUid.TryParse(args[0], out var uid))
+        if (!NetEntity.TryParse(args[0], out var netEntity))
         {
             shell.WriteError(Loc.GetString("cmd-parse-failure-uid", ("arg", args[0])));
             return;
         }
 
+        var uid = GetEntity(netEntity);
+
         if (!Exists(uid))
         {
             shell.WriteError(Loc.GetString("cmd-parse-failure-entity-exist", ("arg", args[0])));
@@ -120,7 +122,7 @@ public sealed partial class ReplaySpectatorSystem
         if (args.Length != 1)
             return CompletionResult.Empty;
 
-        return CompletionResult.FromHintOptions(CompletionHelper.EntityUids(args[0],
+        return CompletionResult.FromHintOptions(CompletionHelper.NetEntities(args[0],
             EntityManager), Loc.GetString("cmd-replay-spectate-hint"));
     }
 }
index 454027597c6c311fefa534e1b1d2b11901950ab5..b12ebe1807c9dd21813eb04964ad782a6e643bce 100644 (file)
@@ -125,7 +125,9 @@ namespace Content.Client.RoundEnd
                     VerticalExpand = true,
                 };
 
-                if (_entityManager.HasComponent<SpriteComponent>(playerInfo.PlayerEntityUid))
+                var playerUid = _entityManager.GetEntity(playerInfo.PlayerNetEntity);
+
+                if (_entityManager.HasComponent<SpriteComponent>(playerUid))
                 {
                     var spriteView = new SpriteView
                     {
@@ -134,7 +136,7 @@ namespace Content.Client.RoundEnd
                         SetSize = new Vector2(32, 32),
                         VerticalExpand = true,
                     };
-                    spriteView.SetEntity(playerInfo.PlayerEntityUid);
+                    spriteView.SetEntity(playerUid);
                     hBox.AddChild(spriteView);
                 }
 
index 1ecebdfdf8dbcde659767cc369090ada7d11c9ca..05e7dd12d98a937e07ac8238e2de0fc2fa042880 100644 (file)
@@ -63,15 +63,18 @@ public sealed class FultonSystem : SharedFultonSystem
 
     private void OnFultonMessage(FultonAnimationMessage ev)
     {
-        if (Deleted(ev.Entity) || !TryComp<SpriteComponent>(ev.Entity, out var entSprite))
+        var entity = GetEntity(ev.Entity);
+        var coordinates = GetCoordinates(ev.Coordinates);
+
+        if (Deleted(entity) || !TryComp<SpriteComponent>(entity, out var entSprite))
             return;
 
-        var animationEnt = Spawn(null, ev.Coordinates);
+        var animationEnt = Spawn(null, coordinates);
         // TODO: Spawn fulton layer
         var sprite = AddComp<SpriteComponent>(animationEnt);
         _serManager.CopyTo(entSprite, ref sprite, notNullableOverride: true);
 
-        if (TryComp<AppearanceComponent>(ev.Entity, out var entAppearance))
+        if (TryComp<AppearanceComponent>(entity, out var entAppearance))
         {
             var appearance = AddComp<AppearanceComponent>(animationEnt);
             _serManager.CopyTo(entAppearance, ref appearance, notNullableOverride: true);
index e8cc64a00be5795513a2be62b6019a541467dd6d..41db4bb0b421218ee74fa1ae99c9deccc2fc14ec 100644 (file)
@@ -38,7 +38,7 @@ public sealed class RadarConsoleBoundUserInterface : BoundUserInterface
         base.UpdateState(state);
         if (state is not RadarConsoleBoundInterfaceState cState) return;
 
-        _window?.SetMatrix(cState.Coordinates, cState.Angle);
+        _window?.SetMatrix(EntMan.GetCoordinates(cState.Coordinates), cState.Angle);
         _window?.UpdateState(cState);
     }
 }
index b9700976412a9e4907d99b8a7e8730b36d386066..1df8416ad7fc6d67e5fd2c60762a2b4dbc2e9b57 100644 (file)
@@ -28,7 +28,7 @@ public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
         _window.OnClose += OnClose;
     }
 
-    private void OnDestinationPressed(EntityUid obj)
+    private void OnDestinationPressed(NetEntity obj)
     {
         SendMessage(new ShuttleConsoleFTLRequestMessage()
         {
@@ -51,17 +51,17 @@ public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
         }
     }
 
-    private void OnStopAutodockPressed(EntityUid obj)
+    private void OnStopAutodockPressed(NetEntity obj)
     {
         SendMessage(new StopAutodockRequestMessage() { DockEntity = obj });
     }
 
-    private void OnAutodockPressed(EntityUid obj)
+    private void OnAutodockPressed(NetEntity obj)
     {
         SendMessage(new AutodockRequestMessage() { DockEntity = obj });
     }
 
-    private void OnUndockPressed(EntityUid obj)
+    private void OnUndockPressed(NetEntity obj)
     {
         SendMessage(new UndockRequestMessage() { DockEntity = obj });
     }
@@ -71,7 +71,7 @@ public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
         base.UpdateState(state);
         if (state is not ShuttleConsoleBoundInterfaceState cState) return;
 
-        _window?.SetMatrix(cState.Coordinates, cState.Angle);
+        _window?.SetMatrix(EntMan.GetCoordinates(cState.Coordinates), cState.Angle);
         _window?.UpdateState(cState);
     }
 }
index f18f27ccd2f8273dc768044b990de2718dc1b506..20fff4acfad2c2c6fa5bc73b48a2402d4264b2d3 100644 (file)
@@ -44,8 +44,9 @@ namespace Content.Client.Shuttles.Systems
         {
             if (args.Current is not PilotComponentState state) return;
 
-            var console = state.Console.GetValueOrDefault();
-            if (!console.IsValid())
+            var console = EnsureEntity<PilotComponent>(state.Console, uid);
+
+            if (console == null)
             {
                 component.Console = null;
                 _input.Contexts.SetActiveContext("human");
index db3f8f5b585bf4179f7cc672991bd3506f97d7b9..7086fd05411f10d218bc9b785c9fb3b0388039bb 100644 (file)
@@ -47,7 +47,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
     {
         if (_overlay == null) return;
 
-        _overlay.StationUid = ev.StationUid;
+        _overlay.StationUid = GetEntity(ev.StationUid);
         _overlay.Position = ev.Position;
     }
 }
index 93c72921bb7296cd61186d6f9f5c5d19f1b9d354..e477b5a1a22609988f1ece0b3ab4a02fd23583db 100644 (file)
@@ -32,7 +32,7 @@ public class DockingControl : Control
     private int ScaledMinimapRadius => (int) (MapGridControl.UIDisplayRadius * UIScale);
     private float MinimapScale => _range != 0 ? ScaledMinimapRadius / _range : 0f;
 
-    public EntityUid? ViewedDock;
+    public NetEntity? ViewedDock;
     public EntityUid? GridEntity;
 
     public EntityCoordinates? Coordinates;
@@ -41,7 +41,7 @@ public class DockingControl : Control
     /// <summary>
     /// Stored by GridID then by docks
     /// </summary>
-    public Dictionary<EntityUid, List<DockingInterfaceState>> Docks = new();
+    public Dictionary<NetEntity, List<DockingInterfaceState>> Docks = new();
 
     public DockingControl()
     {
@@ -204,7 +204,7 @@ public class DockingControl : Control
             }
 
             // Draw any docks on that grid
-            if (Docks.TryGetValue(grid.Owner, out var gridDocks))
+            if (Docks.TryGetValue(_entManager.GetNetEntity(grid.Owner), out var gridDocks))
             {
                 foreach (var dock in gridDocks)
                 {
index 4b614cb4d9469be1aaf97c68ce3c26af70329b94..fa411ca9ba3bec59a2074922f9b9e4ade9167174 100644 (file)
@@ -124,7 +124,7 @@ public sealed class RadarControl : MapGridControl
         foreach (var state in ls.Docks)
         {
             var coordinates = state.Coordinates;
-            var grid = _docks.GetOrNew(coordinates.EntityId);
+            var grid = _docks.GetOrNew(_entManager.GetEntity(coordinates.NetEntity));
             grid.Add(state);
         }
     }
@@ -324,7 +324,7 @@ public sealed class RadarControl : MapGridControl
         {
             foreach (var state in docks)
             {
-                var ent = state.Entity;
+                var ent = _entManager.GetEntity(state.Entity);
                 var position = state.Coordinates.Position;
                 var uiPosition = matrix.Transform(position);
 
index 61f861bbc765951192b4b4b244a505896ef9f0c0..828b98868fc6632d3fb473a0835b15a80c3cbf40 100644 (file)
@@ -22,7 +22,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
     private readonly IEntityManager _entManager;
     private readonly IGameTiming _timing;
 
-    private EntityUid? _shuttleUid;
+    private EntityUid? _shuttleEntity;
 
     /// <summary>
     /// Currently selected dock button for camera.
@@ -32,19 +32,19 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
     /// <summary>
     /// Stored by grid entityid then by states
     /// </summary>
-    private readonly Dictionary<EntityUid, List<DockingInterfaceState>> _docks = new();
+    private readonly Dictionary<NetEntity, List<DockingInterfaceState>> _docks = new();
 
-    private readonly Dictionary<BaseButton, EntityUid> _destinations = new();
+    private readonly Dictionary<BaseButton, NetEntity> _destinations = new();
 
     /// <summary>
     /// Next FTL state change.
     /// </summary>
     public TimeSpan FTLTime;
 
-    public Action<EntityUid>? UndockPressed;
-    public Action<EntityUid>? StartAutodockPressed;
-    public Action<EntityUid>? StopAutodockPressed;
-    public Action<EntityUid>? DestinationPressed;
+    public Action<NetEntity>? UndockPressed;
+    public Action<NetEntity>? StartAutodockPressed;
+    public Action<NetEntity>? StopAutodockPressed;
+    public Action<NetEntity>? DestinationPressed;
 
     public ShuttleConsoleWindow()
     {
@@ -89,7 +89,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
 
     public void SetMatrix(EntityCoordinates? coordinates, Angle? angle)
     {
-        _shuttleUid = coordinates?.EntityId;
+        _shuttleEntity = coordinates?.EntityId;
         RadarScreen.SetMatrix(coordinates, angle);
     }
 
@@ -101,7 +101,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
         MaxRadarRange.Text = $"{scc.MaxRange:0}";
     }
 
-    private void UpdateFTL(List<(EntityUid Entity, string Destination, bool Enabled)> destinations, FTLState state, TimeSpan time)
+    private void UpdateFTL(List<(NetEntity Entity, string Destination, bool Enabled)> destinations, FTLState state, TimeSpan time)
     {
         HyperspaceDestinations.DisposeAllChildren();
         _destinations.Clear();
@@ -183,14 +183,15 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
 
         foreach (var dock in docks)
         {
-            var grid = _docks.GetOrNew(dock.Coordinates.EntityId);
+            var grid = _docks.GetOrNew(dock.Coordinates.NetEntity);
             grid.Add(dock);
         }
 
         DockPorts.DisposeAllChildren();
         DockingScreen.Docks = _docks;
+        var shuttleNetEntity = _entManager.GetNetEntity(_shuttleEntity);
 
-        if (_shuttleUid != null && _docks.TryGetValue(_shuttleUid.Value, out var gridDocks))
+        if (shuttleNetEntity != null && _docks.TryGetValue(shuttleNetEntity.Value, out var gridDocks))
         {
             var index = 1;
 
@@ -233,7 +234,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
 
     private void OnDockMouseEntered(GUIMouseHoverEventArgs obj, DockingInterfaceState state)
     {
-        RadarScreen.HighlightedDock = state.Entity;
+        RadarScreen.HighlightedDock = _entManager.GetEntity(state.Entity);
     }
 
     private void OnDockMouseExited(GUIMouseHoverEventArgs obj, DockingInterfaceState state)
@@ -246,8 +247,6 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
     /// </summary>
     private void OnDockToggled(BaseButton.ButtonEventArgs obj, DockingInterfaceState state)
     {
-        var ent = state.Entity;
-
         if (_selectedDock != null)
         {
             // If it got untoggled via other means then we'll stop viewing the old dock.
@@ -274,9 +273,9 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
         }
         else
         {
-            if (_shuttleUid != null)
+            if (_shuttleEntity != null)
             {
-                DockingScreen.Coordinates = state.Coordinates;
+                DockingScreen.Coordinates = _entManager.GetCoordinates(state.Coordinates);
                 DockingScreen.Angle = state.Angle;
             }
             else
@@ -288,9 +287,9 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
             UndockButton.Disabled = false;
             RadarScreen.Visible = false;
             DockingScreen.Visible = true;
-            DockingScreen.ViewedDock = ent;
-            StartAutodockPressed?.Invoke(ent);
-            DockingScreen.GridEntity = _shuttleUid;
+            DockingScreen.ViewedDock = state.Entity;
+            StartAutodockPressed?.Invoke(state.Entity);
+            DockingScreen.GridEntity = _shuttleEntity;
             _selectedDock = obj.Button;
         }
     }
@@ -310,13 +309,13 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
     {
         base.Draw(handle);
 
-        if (!_entManager.TryGetComponent<PhysicsComponent>(_shuttleUid, out var gridBody) ||
-            !_entManager.TryGetComponent<TransformComponent>(_shuttleUid, out var gridXform))
+        if (!_entManager.TryGetComponent<PhysicsComponent>(_shuttleEntity, out var gridBody) ||
+            !_entManager.TryGetComponent<TransformComponent>(_shuttleEntity, out var gridXform))
         {
             return;
         }
 
-        if (_entManager.TryGetComponent<MetaDataComponent>(_shuttleUid, out var metadata) && metadata.EntityPaused)
+        if (_entManager.TryGetComponent<MetaDataComponent>(_shuttleEntity, out var metadata) && metadata.EntityPaused)
         {
             FTLTime += _timing.FrameTime;
         }
index 1d8bd06d9e57c17198d8b265ff7dc06586fc400a..3cc2a35d79514544384e94865ee86cd7e4f6658e 100644 (file)
@@ -39,7 +39,7 @@ public sealed class BorgBoundUserInterface : BoundUserInterface
 
         _menu.RemoveModuleButtonPressed += module =>
         {
-            SendMessage(new BorgRemoveModuleBuiMessage(module));
+            SendMessage(new BorgRemoveModuleBuiMessage(EntMan.GetNetEntity(module)));
         };
 
         _menu.OnClose += Close;
index e899eff09926d50d18e3c56e5034dd93c44ca68f..14e34dce44e88604ed67cad7b736477e24e54db6 100644 (file)
@@ -6,6 +6,6 @@ public sealed class TimedDespawnSystem : SharedTimedDespawnSystem
 {
     protected override bool CanDelete(EntityUid uid)
     {
-        return uid.IsClientSide();
+        return IsClientSide(uid);
     }
 }
index 85c9272066c0521a50e6cb1f020bcbe3b0a640e6..737a12aa600d3de963c6d37ec1cd93480f22c898 100644 (file)
@@ -27,6 +27,7 @@ public sealed class StationSystem : EntitySystem
     private void StationsUpdated(StationsUpdatedEvent ev)
     {
         _stations.Clear();
-        _stations.UnionWith(ev.Stations);
+        // TODO this needs to be dona in component states and with the Ensure() methods
+        _stations.UnionWith(GetEntitySet(ev.Stations));
     }
 }
index 0743312e1194b630b8fe3e54f69ef88123d3d87b..f888f7e80a810aa29425f47692aab057ae63a996 100644 (file)
@@ -26,7 +26,7 @@ public sealed class GeneralStationRecordConsoleBoundUserInterface : BoundUserInt
 
     private void OnKeySelected(StationRecordKey? key)
     {
-        SendMessage(new SelectGeneralStationRecord(key));
+        SendMessage(new SelectGeneralStationRecord(EntMan.System<SharedStationRecordsSystem>().Convert(key)));
     }
 
     private void OnFiltersChanged(
index 89c5048f33144a56cd7c7fedbebc833b90b150a8..b629773708bb70cb405a40c6ab63237d9cf9dc00 100644 (file)
@@ -123,7 +123,7 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
             RecordContainer.RemoveAllChildren();
         }
     }
-    private void PopulateRecordListing(Dictionary<StationRecordKey, string> listing, StationRecordKey? selected)
+    private void PopulateRecordListing(Dictionary<(NetEntity, uint), string> listing, (NetEntity, uint)? selected)
     {
         RecordListing.Clear();
         RecordListing.ClearSelected();
@@ -134,7 +134,7 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
         {
             var item = RecordListing.AddItem(name);
             item.Metadata = key;
-            if (selected != null && key.ID == selected.Value.ID)
+            if (selected != null && key.Item1 == selected.Value.Item1 && key.Item2 == selected.Value.Item2)
             {
                 item.Selected = true;
             }
diff --git a/Content.Client/StationRecords/StationRecordsSystem.cs b/Content.Client/StationRecords/StationRecordsSystem.cs
new file mode 100644 (file)
index 0000000..92ec076
--- /dev/null
@@ -0,0 +1,7 @@
+using Content.Shared.StationRecords;
+
+namespace Content.Client.StationRecords;
+
+public sealed class StationRecordsSystem : SharedStationRecordsSystem
+{
+}
index bd83670b3cf9d6f819f558eb1367fc594c68a8bc..25024aa8c5295c880cc1edb95bda39b341b7987a 100644 (file)
@@ -54,7 +54,7 @@ namespace Content.Client.Storage
 
             if (args.Event.Function == EngineKeyFunctions.UIClick)
             {
-                SendMessage(new StorageInteractWithItemEvent(entity));
+                SendMessage(new StorageInteractWithItemEvent(EntMan.GetNetEntity(entity)));
             }
             else if (EntMan.EntityExists(entity))
             {
@@ -76,11 +76,11 @@ namespace Content.Client.Storage
             else if (args.Function == ContentKeyFunctions.ActivateItemInWorld)
             {
                 EntMan.EntityNetManager?.SendSystemNetworkMessage(
-                    new InteractInventorySlotEvent(entity, altInteract: false));
+                    new InteractInventorySlotEvent(EntMan.GetNetEntity(entity), altInteract: false));
             }
             else if (args.Function == ContentKeyFunctions.AltActivateItemInWorld)
             {
-                EntMan.RaisePredictiveEvent(new InteractInventorySlotEvent(entity, altInteract: true));
+                EntMan.RaisePredictiveEvent(new InteractInventorySlotEvent(EntMan.GetNetEntity(entity), altInteract: true));
             }
             else
             {
index 145a7dd9f0db204ae2a802d6e22dbd53ef6e986d..27fbfe651e68cd094fffb790f2fb69b3be2e97a3 100644 (file)
@@ -19,18 +19,20 @@ public sealed class StorageSystem : EntitySystem
     /// <param name="msg"></param>
     public void HandleAnimatingInsertingEntities(AnimateInsertingEntitiesEvent msg)
     {
-        if (!TryComp(msg.Storage, out ClientStorageComponent? storage))
+        var store = GetEntity(msg.Storage);
+
+        if (!HasComp<ClientStorageComponent>(store))
             return;
 
-        TryComp(msg.Storage, out TransformComponent? transformComp);
+        TryComp(store, out TransformComponent? transformComp);
 
         for (var i = 0; msg.StoredEntities.Count > i; i++)
         {
-            var entity = msg.StoredEntities[i];
+            var entity = GetEntity(msg.StoredEntities[i]);
             var initialPosition = msg.EntityPositions[i];
             if (EntityManager.EntityExists(entity) && transformComp != null)
             {
-                ReusableAnimations.AnimateEntityPickup(entity, initialPosition, transformComp.LocalPosition, msg.EntityAngles[i], EntityManager);
+                ReusableAnimations.AnimateEntityPickup(entity, GetCoordinates(initialPosition), transformComp.LocalPosition, msg.EntityAngles[i], EntityManager);
             }
         }
     }
index aee8b86c7a147e9b7c62b5d79c9d2b324dd2cc04..1819f65860f07e5965af8a1c63f0f5510ea986c9 100644 (file)
@@ -88,7 +88,7 @@ namespace Content.Client.Storage.UI
         /// </summary>
         public void BuildEntityList(StorageBoundUserInterfaceState state)
         {
-            var list = state.StoredEntities.ConvertAll(uid => new EntityListData(uid));
+            var list = state.StoredEntities.ConvertAll(nent => new EntityListData(_entityManager.GetEntity(nent)));
             EntityList.PopulateList(list);
 
             //Sets information about entire storage container current capacity
index 2213eb832dc685226f51753f1754b37d289393e6..9132dd6ed5f82b4255044453d49ae787b69843f3 100644 (file)
@@ -80,7 +80,9 @@ public sealed class SurveillanceCameraMonitorBoundUserInterface : BoundUserInter
             return;
         }
 
-        if (cast.ActiveCamera == null)
+        var active = EntMan.GetEntity(cast.ActiveCamera);
+
+        if (active == null)
         {
             _window.UpdateState(null, cast.Subnets, cast.ActiveAddress, cast.ActiveSubnet, cast.Cameras);
 
@@ -95,17 +97,17 @@ public sealed class SurveillanceCameraMonitorBoundUserInterface : BoundUserInter
         {
             if (_currentCamera == null)
             {
-                _eyeLerpingSystem.AddEye(cast.ActiveCamera.Value);
-                _currentCamera = cast.ActiveCamera;
+                _eyeLerpingSystem.AddEye(active.Value);
+                _currentCamera = active;
             }
-            else if (_currentCamera != cast.ActiveCamera)
+            else if (_currentCamera != active)
             {
                 _eyeLerpingSystem.RemoveEye(_currentCamera.Value);
-                _eyeLerpingSystem.AddEye(cast.ActiveCamera.Value);
-                _currentCamera = cast.ActiveCamera;
+                _eyeLerpingSystem.AddEye(active.Value);
+                _currentCamera = active;
             }
 
-            if (EntMan.TryGetComponent<EyeComponent>(cast.ActiveCamera, out var eye))
+            if (EntMan.TryGetComponent<EyeComponent>(active, out var eye))
             {
                 _window.UpdateState(eye.Eye, cast.Subnets, cast.ActiveAddress, cast.ActiveSubnet, cast.Cameras);
             }
index ee0f9646c503fc8c420a457598aa3c702d61e6ae..d43111f39c1cdecd59f13dbb4322c168de10debb 100644 (file)
@@ -109,7 +109,7 @@ namespace Content.Client.Tabletop
             // Only send new position to server when Delay is reached
             if (_timePassed >= Delay && _table != null)
             {
-                RaisePredictiveEvent(new TabletopMoveEvent(_draggedEntity.Value, clampedCoords, _table.Value));
+                RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), clampedCoords, GetNetEntity(_table.Value)));
                 _timePassed -= Delay;
             }
         }
@@ -125,15 +125,15 @@ namespace Content.Client.Tabletop
             // Close the currently opened window, if it exists
             _window?.Close();
 
-            _table = msg.TableUid;
+            _table = GetEntity(msg.TableUid);
 
             // Get the camera entity that the server has created for us
-            var camera = msg.CameraUid;
+            var camera = GetEntity(msg.CameraUid);
 
             if (!EntityManager.TryGetComponent<EyeComponent>(camera, out var eyeComponent))
             {
                 // If there is no eye, print error and do not open any window
-                Logger.Error("Camera entity does not have eye component!");
+                Log.Error("Camera entity does not have eye component!");
                 return;
             }
 
@@ -159,7 +159,7 @@ namespace Content.Client.Tabletop
         {
             if (_table != null)
             {
-                RaiseNetworkEvent(new TabletopStopPlayingEvent(_table.Value));
+                RaiseNetworkEvent(new TabletopStopPlayingEvent(GetNetEntity(_table.Value)));
             }
 
             StopDragging();
@@ -182,9 +182,11 @@ namespace Content.Client.Tabletop
         {
             if (_draggedEntity != null && _table != null)
             {
-                var ev = new TabletopRequestTakeOut();
-                ev.Entity = _draggedEntity.Value;
-                ev.TableUid = _table.Value;
+                var ev = new TabletopRequestTakeOut
+                {
+                    Entity = GetNetEntity(_draggedEntity.Value),
+                    TableUid = GetNetEntity(_table.Value)
+                };
                 RaiseNetworkEvent(ev);
             }
             return false;
@@ -196,8 +198,10 @@ namespace Content.Client.Tabletop
             if (_playerManager.LocalPlayer is not {ControlledEntity: { } playerEntity})
                 return false;
 
+            var entity = args.EntityUid;
+
             // Return if can not see table or stunned/no hands
-            if (!CanSeeTable(playerEntity, _table) || !CanDrag(playerEntity, args.EntityUid, out _))
+            if (!CanSeeTable(playerEntity, _table) || !CanDrag(playerEntity, entity, out _))
             {
                 return false;
             }
@@ -208,7 +212,7 @@ namespace Content.Client.Tabletop
                 return false;
             }
 
-            StartDragging(args.EntityUid, viewport);
+            StartDragging(entity, viewport);
             return true;
         }
 
@@ -247,7 +251,7 @@ namespace Content.Client.Tabletop
         /// <param name="viewport">The viewport in which we are dragging.</param>
         private void StartDragging(EntityUid draggedEntity, ScalingViewport viewport)
         {
-            RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(draggedEntity, true));
+            RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(GetNetEntity(draggedEntity), true));
 
             _draggedEntity = draggedEntity;
             _viewport = viewport;
@@ -262,8 +266,8 @@ namespace Content.Client.Tabletop
             // Set the dragging player on the component to noone
             if (broadcast && _draggedEntity != null && EntityManager.HasComponent<TabletopDraggableComponent>(_draggedEntity.Value))
             {
-                RaisePredictiveEvent(new TabletopMoveEvent(_draggedEntity.Value, Transform(_draggedEntity.Value).MapPosition, _table!.Value));
-                RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(_draggedEntity.Value, false));
+                RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transform(_draggedEntity.Value).MapPosition, GetNetEntity(_table!.Value)));
+                RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(GetNetEntity(_draggedEntity.Value), false));
             }
 
             _draggedEntity = null;
index 7e288070b0c589d52f9f601b457169bfbcf26aa6..3e9a01e77063bdfc80f8c503e0a4b21a38b5b01d 100644 (file)
@@ -240,7 +240,7 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
             _actionsSystem.PerformAction(user, actionComp, actionId, action, action.Event, _timing.CurTime);
         }
         else
-            EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(actionId, coords));
+            EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(EntityManager.GetNetEntity(actionId), EntityManager.GetNetCoordinates(coords)));
 
         if (!action.Repeat)
             StopTargeting();
@@ -253,7 +253,9 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
         if (_actionsSystem == null)
             return false;
 
-        if (!_actionsSystem.ValidateEntityTarget(user, args.EntityUid, action))
+        var entity = args.EntityUid;
+
+        if (!_actionsSystem.ValidateEntityTarget(user, entity, action))
         {
             if (action.DeselectOnMiss)
                 StopTargeting();
@@ -265,14 +267,14 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
         {
             if (action.Event != null)
             {
-                action.Event.Target = args.EntityUid;
+                action.Event.Target = entity;
                 action.Event.Performer = user;
             }
 
             _actionsSystem.PerformAction(user, actionComp, actionId, action, action.Event, _timing.CurTime);
         }
         else
-            EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(actionId, args.EntityUid));
+            EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(EntityManager.GetNetEntity(actionId), EntityManager.GetNetEntity(args.EntityUid)));
 
         if (!action.Repeat)
             StopTargeting();
@@ -741,9 +743,11 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
     {
         if (_actionsSystem != null && _actionsSystem.TryGetActionData(_menuDragHelper.Dragged?.ActionId, out var action))
         {
-            if (action.EntityIcon != null)
+            var entIcon = action.EntityIcon;
+
+            if (entIcon != null)
             {
-                _dragShadow.Texture = EntityManager.GetComponent<SpriteComponent>(action.EntityIcon.Value).Icon?
+                _dragShadow.Texture = EntityManager.GetComponent<SpriteComponent>(entIcon.Value).Icon?
                     .GetFrame(RSI.State.Direction.South, 0);
             }
             else if (action.Icon != null)
@@ -958,11 +962,13 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
         SelectingTargetFor = actionId;
 
         // override "held-item" overlay
+        var provider = action.Provider;
+
         if (action.TargetingIndicator && _overlays.TryGetOverlay<ShowHandItemOverlay>(out var handOverlay))
         {
             if (action.ItemIconStyle == ItemActionIconStyle.BigItem && action.Provider != null)
             {
-                handOverlay.EntityOverride = action.Provider;
+                handOverlay.EntityOverride = provider;
             }
             else if (action.Toggled && action.IconOn != null)
                 handOverlay.IconOverride = _spriteSystem.Frame0(action.IconOn);
@@ -979,9 +985,10 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
             return;
 
         Func<EntityUid, bool>? predicate = null;
+        var attachedEnt = entityAction.AttachedEntity;
 
         if (!entityAction.CanTargetSelf)
-            predicate = e => e != entityAction.AttachedEntity;
+            predicate = e => e != attachedEnt;
 
         var range = entityAction.CheckCanAccess ? action.Range : -1;
 
index 50431a7c575f6daa2d7c89b8a7d62ea24a6a586f..0451a4a3aa09bef34d6c47debfc2149e7046a239 100644 (file)
@@ -41,7 +41,6 @@ public sealed class ChatUIController : UIController
     [Dependency] private readonly IClientAdminManager _admin = default!;
     [Dependency] private readonly IChatManager _manager = default!;
     [Dependency] private readonly IConfigurationManager _config = default!;
-    [Dependency] private readonly IEntityManager _entities = default!;
     [Dependency] private readonly IEyeManager _eye = default!;
     [Dependency] private readonly IInputManager _input = default!;
     [Dependency] private readonly IClientNetManager _net = default!;
@@ -390,7 +389,9 @@ public sealed class ChatUIController : UIController
 
     private void AddSpeechBubble(ChatMessage msg, SpeechBubble.SpeechType speechType)
     {
-        if (!_entities.EntityExists(msg.SenderEntity))
+        var ent = EntityManager.GetEntity(msg.SenderEntity);
+
+        if (!EntityManager.EntityExists(ent))
         {
             _sawmill.Debug("Got local chat message with invalid sender entity: {0}", msg.SenderEntity);
             return;
@@ -401,14 +402,14 @@ public sealed class ChatUIController : UIController
 
         foreach (var message in messages)
         {
-            EnqueueSpeechBubble(msg.SenderEntity, message, speechType);
+            EnqueueSpeechBubble(ent, message, speechType);
         }
     }
 
     private void CreateSpeechBubble(EntityUid entity, SpeechBubbleData speechData)
     {
         var bubble =
-            SpeechBubble.CreateSpeechBubble(speechData.Type, speechData.Message, entity, _eye, _manager, _entities);
+            SpeechBubble.CreateSpeechBubble(speechData.Type, speechData.Message, entity, _eye, _manager, EntityManager);
 
         bubble.OnDied += SpeechBubbleDied;
 
@@ -445,7 +446,7 @@ public sealed class ChatUIController : UIController
     private void EnqueueSpeechBubble(EntityUid entity, string contents, SpeechBubble.SpeechType speechType)
     {
         // Don't enqueue speech bubbles for other maps. TODO: Support multiple viewports/maps?
-        if (_entities.GetComponent<TransformComponent>(entity).MapID != _eye.CurrentMap)
+        if (EntityManager.GetComponent<TransformComponent>(entity).MapID != _eye.CurrentMap)
             return;
 
         if (!_queuedSpeechBubbles.TryGetValue(entity, out var queueData))
@@ -562,7 +563,7 @@ public sealed class ChatUIController : UIController
 
         foreach (var (entity, queueData) in _queuedSpeechBubbles.ShallowClone())
         {
-            if (!_entities.EntityExists(entity))
+            if (!EntityManager.EntityExists(entity))
             {
                 _queuedSpeechBubbles.Remove(entity);
                 continue;
@@ -593,14 +594,14 @@ public sealed class ChatUIController : UIController
         var predicate = static (EntityUid uid, (EntityUid compOwner, EntityUid? attachedEntity) data)
             => uid == data.compOwner || uid == data.attachedEntity;
         var playerPos = player != null
-            ? _entities.GetComponent<TransformComponent>(player.Value).MapPosition
+            ? EntityManager.GetComponent<TransformComponent>(player.Value).MapPosition
             : MapCoordinates.Nullspace;
 
         var occluded = player != null && _examine.IsOccluded(player.Value);
 
         foreach (var (ent, bubs) in _activeSpeechBubbles)
         {
-            if (_entities.Deleted(ent))
+            if (EntityManager.Deleted(ent))
             {
                 SetBubbles(bubs, false);
                 continue;
@@ -612,7 +613,7 @@ public sealed class ChatUIController : UIController
                 continue;
             }
 
-            var otherPos = _entities.GetComponent<TransformComponent>(ent).MapPosition;
+            var otherPos = EntityManager.GetComponent<TransformComponent>(ent).MapPosition;
 
             if (occluded && !ExamineSystemShared.InRangeUnOccluded(
                     playerPos,
index 314e77fb0af78b5cff8c08071836cf1d0e182e94..1417b4777178f8605671933578235e15c4a27e92 100644 (file)
@@ -20,7 +20,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls
             RobustXamlLoader.Load(this);
         }
 
-        public void UpdateWarps(IEnumerable<GhostWarp> warps)
+        public void UpdateWarps(IEnumerable<GhostWarp> warps, IEntityManager entManager)
         {
             // Server COULD send these sorted but how about we just use the client to do it instead
             _warps = warps
@@ -33,7 +33,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls
                         ? Loc.GetString("ghost-target-window-current-button", ("name", w.DisplayName))
                         : w.DisplayName;
 
-                    return (name, w.Entity);
+                    return (name, entManager.GetEntity(w.Entity));
                 })
                 .ToList();
         }
index a6d27a7793428b46b7b0d189bf70cd5215ff780c..1f41edb931ab9e14e7859829988a61e35cddffa1 100644 (file)
@@ -11,6 +11,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
     [UsedImplicitly]
     public sealed class MakeGhostRoleEui : BaseEui
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
         [Dependency] private readonly IPlayerManager _playerManager = default!;
         [Dependency] private readonly IClientConsoleHost _consoleHost = default!;
 
@@ -32,7 +33,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
                 return;
             }
 
-            _window.SetEntity(uiState.EntityUid);
+            _window.SetEntity(_entManager.GetEntity(uiState.EntityUid));
         }
 
         public override void Opened()
index d45ff4ee9e4dd1e11ef64132d9222c6263b735da..709b7c553c7c8f22e0c7ccc93fa649cacbf5feba 100644 (file)
@@ -96,7 +96,7 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
         if (Gui?.TargetWindow is not { } window)
             return;
 
-        window.UpdateWarps(msg.Warps);
+        window.UpdateWarps(msg.Warps, EntityManager);
         window.Populate();
     }
 
@@ -107,7 +107,7 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
 
     private void OnWarpClicked(EntityUid player)
     {
-        var msg = new GhostWarpToTargetRequestEvent(player);
+        var msg = new GhostWarpToTargetRequestEvent(EntityManager.GetNetEntity(player));
         _net.SendSystemNetworkMessage(msg);
     }
 
index 23b6a026ef693e27849af45b70e0ed21e1303d55..7b71cc28df389c4c6e86b42522f2b67d32ce87b6 100644 (file)
@@ -27,6 +27,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
 
     [UISystemDependency] private readonly ClientInventorySystem _inventorySystem = default!;
     [UISystemDependency] private readonly HandsSystem _handsSystem = default!;
+    [UISystemDependency] private readonly ContainerSystem _container = default!;
 
     private EntityUid? _playerUid;
     private InventorySlotsComponent? _playerInventory;
@@ -281,7 +282,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
         var hoverEntity = _entities.SpawnEntity("hoverentity", MapCoordinates.Nullspace);
         var hoverSprite = _entities.GetComponent<SpriteComponent>(hoverEntity);
         var fits = _inventorySystem.CanEquip(player.Value, held, control.SlotName, out _, slotDef) &&
-                   container.CanInsert(held, _entities);
+                   _container.CanInsert(held, container);
 
         hoverSprite.CopyFrom(sprite);
         hoverSprite.Color = fits ? new Color(0, 255, 0, 127) : new Color(255, 0, 0, 127);
index 007ce34ff0e78a41382c748a8f8169af0bf0243c..4cc4b8732e98c8ae18e845fddc55ffe56f3fbf1a 100644 (file)
@@ -36,10 +36,12 @@ public sealed class VehicleSystem : SharedVehicleSystem
         if (args.Current is not RiderComponentState state)
             return;
 
+        var entity = EnsureEntity<RiderComponent>(state.Entity, uid);
+
         if (TryComp(uid, out EyeComponent? eyeComp) && eyeComp.Target == component.Vehicle)
-            eyeComp.Target = state.Entity;
+            eyeComp.Target = entity;
 
-        component.Vehicle = state.Entity;
+        component.Vehicle = entity;
     }
 
     private void OnVehicleAppearanceChange(EntityUid uid, VehicleComponent component, ref AppearanceChangeEvent args)
index d124ca6da45ce5064aa002d0e86e5c39da008fe0..0cb6e15147e3c4a5057f33b9baf6cd963f8847ef 100644 (file)
@@ -51,7 +51,7 @@ namespace Content.Client.Verbs.UI
                     OverrideDirection = Direction.South,
                     SetSize = new Vector2(ElementHeight, ElementHeight),
                 };
-                spriteView.SetEntity(verb.IconEntity.Value);
+                spriteView.SetEntity(entManager.GetEntity(verb.IconEntity.Value));
 
                 Icon.AddChild(spriteView);
                 return;
index 6ede75f33b05508bbf2bfa4db8c7ab0d54bce7bd..08a16b49fd0d83b812a0044cc0491016b553bf8b 100644 (file)
@@ -82,7 +82,7 @@ namespace Content.Client.Verbs.UI
 
             // Add indicator that some verbs may be missing.
             // I long for the day when verbs will all be predicted and this becomes unnecessary.
-            if (!target.IsClientSide())
+            if (!EntityManager.IsClientSide(target))
             {
                 _context.AddElement(menu, new ContextMenuElement(Loc.GetString("verb-system-waiting-on-server-text")));
             }
@@ -244,7 +244,7 @@ namespace Content.Client.Verbs.UI
 
         private void HandleVerbsResponse(VerbsResponseEvent msg)
         {
-            if (OpenMenu == null || !OpenMenu.Visible || CurrentTarget != msg.Entity)
+            if (OpenMenu == null || !OpenMenu.Visible || CurrentTarget != EntityManager.GetEntity(msg.Entity))
                 return;
 
             AddServerVerbs(msg.Verbs, OpenMenu);
index 1fcd7fd1843826be3e9828fb0e833eb1e3230005..e71da351b94a45b085f6da024cc656e7bd9857f2 100644 (file)
@@ -180,9 +180,9 @@ namespace Content.Client.Verbs
         public SortedSet<Verb> GetVerbs(EntityUid target, EntityUid user, List<Type> verbTypes,
             bool force = false)
         {
-            if (!target.IsClientSide())
+            if (!IsClientSide(target))
             {
-                RaiseNetworkEvent(new RequestServerVerbsEvent(target, verbTypes, adminRequest: force));
+                RaiseNetworkEvent(new RequestServerVerbsEvent(GetNetEntity(target), verbTypes, adminRequest: force));
             }
 
             // Some admin menu interactions will try get verbs for entities that have not yet been sent to the player.
@@ -214,11 +214,11 @@ namespace Content.Client.Verbs
                 return;
             }
 
-            if (verb.ClientExclusive || target.IsClientSide())
+            if (verb.ClientExclusive || IsClientSide(target))
                 // is this a client exclusive (gui) verb?
                 ExecuteVerb(verb, user.Value, target);
             else
-                EntityManager.RaisePredictiveEvent(new ExecuteVerbEvent(target, verb));
+                EntityManager.RaisePredictiveEvent(new ExecuteVerbEvent(GetNetEntity(target), verb));
         }
 
         private void HandleVerbResponse(VerbsResponseEvent msg)
index 2ae6dbdbf4ec91a1255232c6a1c6d748669b29d8..5770af23aa5e97338048dafbdbefa17f549f4f7a 100644 (file)
@@ -74,7 +74,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
         {
             if (weapon.Attacking)
             {
-                RaisePredictiveEvent(new StopAttackEvent(weaponUid));
+                RaisePredictiveEvent(new StopAttackEvent(GetNetEntity(weaponUid)));
             }
         }
 
@@ -126,7 +126,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
                     target = screen.GetClickedEntity(mousePos);
                 }
 
-                EntityManager.RaisePredictiveEvent(new DisarmAttackEvent(target, coordinates));
+                EntityManager.RaisePredictiveEvent(new DisarmAttackEvent(GetNetEntity(target), GetNetCoordinates(coordinates)));
                 return;
             }
 
@@ -152,7 +152,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
                 target = screen.GetClickedEntity(mousePos);
             }
 
-            RaisePredictiveEvent(new LightAttackEvent(target, weaponUid, coordinates));
+            RaisePredictiveEvent(new LightAttackEvent(GetNetEntity(target), GetNetEntity(weaponUid), GetNetCoordinates(coordinates)));
         }
     }
 
@@ -182,15 +182,17 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
             return false;
         }
 
+        var target = GetEntity(ev.Target);
+
         // They need to either have hands...
-        if (!HasComp<HandsComponent>(ev.Target!.Value))
+        if (!HasComp<HandsComponent>(target!.Value))
         {
             // or just be able to be shoved over.
-            if (TryComp<StatusEffectsComponent>(ev.Target!.Value, out var status) && status.AllowedEffects.Contains("KnockedDown"))
+            if (TryComp<StatusEffectsComponent>(target, out var status) && status.AllowedEffects.Contains("KnockedDown"))
                 return true;
 
-            if (Timing.IsFirstTimePredicted && HasComp<MobStateComponent>(ev.Target.Value))
-                PopupSystem.PopupEntity(Loc.GetString("disarm-action-disarmable", ("targetName", ev.Target.Value)), ev.Target.Value);
+            if (Timing.IsFirstTimePredicted && HasComp<MobStateComponent>(target.Value))
+                PopupSystem.PopupEntity(Loc.GetString("disarm-action-disarmable", ("targetName", target.Value)), target.Value);
 
             return false;
         }
@@ -222,14 +224,16 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
 
         // This should really be improved. GetEntitiesInArc uses pos instead of bounding boxes.
         // Server will validate it with InRangeUnobstructed.
-        var entities = ArcRayCast(userPos, direction.ToWorldAngle(), component.Angle, distance, userXform.MapID, user).ToList();
-        RaisePredictiveEvent(new HeavyAttackEvent(meleeUid, entities.GetRange(0, Math.Min(MaxTargets, entities.Count)), coordinates));
+        var entities = GetNetEntityList(ArcRayCast(userPos, direction.ToWorldAngle(), component.Angle, distance, userXform.MapID, user).ToList());
+        RaisePredictiveEvent(new HeavyAttackEvent(GetNetEntity(meleeUid), entities.GetRange(0, Math.Min(MaxTargets, entities.Count)), GetNetCoordinates(coordinates)));
     }
 
     private void OnMeleeLunge(MeleeLungeEvent ev)
     {
+        var ent = GetEntity(ev.Entity);
+
         // Entity might not have been sent by PVS.
-        if (Exists(ev.Entity))
-            DoLunge(ev.Entity, ev.Angle, ev.LocalPos, ev.Animation);
+        if (Exists(ent))
+            DoLunge(ent, ev.Angle, ev.LocalPos, ev.Animation);
     }
 }
index 2063fa6cf192d129a91ceeae994aaa44bea95b30..dd8f283cbf5aaca8c6658c7bdef53b93a0aab47a 100644 (file)
@@ -91,7 +91,7 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
 
         RaisePredictiveEvent(new RequestTetherMoveEvent()
         {
-            Coordinates = coords
+            Coordinates = GetNetCoordinates(coords)
         });
     }
 
index 6c203f76763996d5ce6834e29e50b8df72e8083c..e0d4fa8e84d44b5cee429a6da709e865772c4597 100644 (file)
@@ -43,7 +43,7 @@ public sealed partial class GunSystem
             EnsureShootable(ent.Value);
         }
 
-        if (ent != null && ent.Value.IsClientSide())
+        if (ent != null && IsClientSide(ent.Value))
             Del(ent.Value);
 
         var cycledEvent = new GunCycledEvent();
index 0f1595010f53425ef4b3092a29c3ffaeddad1b15..52c2caaa3ad622d9a8776cae563ce6696944e49f 100644 (file)
@@ -47,7 +47,7 @@ public sealed partial class GunSystem
 
         // This is dirty af. Prediction moment.
         // We may be predicting spawning entities and the engine just removes them from the container so we'll just delete them.
-        if (removedArgs.Entity.IsClientSide())
+        if (IsClientSide(removedArgs.Entity))
             QueueDel(args.Entity);
 
         // AFAIK the only main alternative is having some client-specific handling via a bool or otherwise for the state.
index 93e8266169a9d938b4e99a5e38c7ebeb2933488f..33a4042daff56a9ba18022c38cdf72b5b42c0efd 100644 (file)
@@ -16,10 +16,12 @@ public sealed partial class GunSystem
 
     private void OnRevolverEntRemove(EntityUid uid, RevolverAmmoProviderComponent component, EntRemovedFromContainerMessage args)
     {
-        if (args.Container.ID != RevolverContainer) return;
+        if (args.Container.ID != RevolverContainer)
+            return;
 
         // See ChamberMagazineAmmoProvider
-        if (!args.Entity.IsClientSide()) return;
+        if (!IsClientSide(args.Entity))
+            return;
 
         QueueDel(args.Entity);
     }
index 4ecd72561f75734434b37f80ac5e2d264093d4a6..422d97c5b2185ab14bac0b159a8062b3fb8c8e87 100644 (file)
@@ -16,6 +16,7 @@ using Robust.Client.Player;
 using Robust.Shared.Animations;
 using Robust.Shared.Input;
 using Robust.Shared.Map;
+using Robust.Shared.Prototypes;
 using Robust.Shared.Utility;
 using SharedGunSystem = Content.Shared.Weapons.Ranged.Systems.SharedGunSystem;
 
@@ -30,6 +31,9 @@ public sealed partial class GunSystem : SharedGunSystem
     [Dependency] private readonly InputSystem _inputSystem = default!;
     [Dependency] private readonly SharedCameraRecoilSystem _recoil = default!;
 
+    [ValidatePrototypeId<EntityPrototype>]
+    public const string HitscanProto = "HitscanEffect";
+
     public bool SpreadOverlay
     {
         get => _spreadOverlay;
@@ -76,7 +80,7 @@ public sealed partial class GunSystem : SharedGunSystem
 
     private void OnMuzzleFlash(MuzzleFlashEvent args)
     {
-        CreateEffect(args.Uid, args);
+        CreateEffect(GetEntity(args.Uid), args);
     }
 
     private void OnHitscan(HitscanEvent ev)
@@ -84,13 +88,15 @@ public sealed partial class GunSystem : SharedGunSystem
         // ALL I WANT IS AN ANIMATED EFFECT
         foreach (var a in ev.Sprites)
         {
-            if (a.Sprite is not SpriteSpecifier.Rsi rsi ||
-                Deleted(a.coordinates.EntityId))
-            {
+            if (a.Sprite is not SpriteSpecifier.Rsi rsi)
+                continue;
+
+            var coords = GetCoordinates(a.coordinates);
+
+            if (Deleted(coords.EntityId))
                 continue;
-            }
 
-            var ent = Spawn("HitscanEffect", a.coordinates);
+            var ent = Spawn(HitscanProto, coords);
             var sprite = Comp<SpriteComponent>(ent);
             var xform = Transform(ent);
             xform.LocalRotation = a.angle;
@@ -144,7 +150,7 @@ public sealed partial class GunSystem : SharedGunSystem
         if (_inputSystem.CmdStates.GetState(useKey) != BoundKeyState.Down)
         {
             if (gun.ShotCounter != 0)
-                EntityManager.RaisePredictiveEvent(new RequestStopShootEvent { Gun = gunUid });
+                EntityManager.RaisePredictiveEvent(new RequestStopShootEvent { Gun = GetNetEntity(gunUid) });
             return;
         }
 
@@ -156,7 +162,7 @@ public sealed partial class GunSystem : SharedGunSystem
         if (mousePos.MapId == MapId.Nullspace)
         {
             if (gun.ShotCounter != 0)
-                EntityManager.RaisePredictiveEvent(new RequestStopShootEvent { Gun = gunUid });
+                EntityManager.RaisePredictiveEvent(new RequestStopShootEvent { Gun = GetNetEntity(gunUid) });
 
             return;
         }
@@ -168,8 +174,8 @@ public sealed partial class GunSystem : SharedGunSystem
 
         EntityManager.RaisePredictiveEvent(new RequestShootEvent
         {
-            Coordinates = coordinates,
-            Gun = gunUid,
+            Coordinates = GetNetCoordinates(coordinates),
+            Gun = GetNetEntity(gunUid),
         });
     }
 
@@ -188,7 +194,7 @@ public sealed partial class GunSystem : SharedGunSystem
             if (throwItems)
             {
                 Recoil(user, direction, gun.CameraRecoilScalar);
-                if (ent!.Value.IsClientSide())
+                if (IsClientSide(ent!.Value))
                     Del(ent.Value);
                 else
                     RemoveShootable(ent.Value);
@@ -214,7 +220,7 @@ public sealed partial class GunSystem : SharedGunSystem
                         Audio.PlayPredicted(gun.SoundEmpty, gunUid, user);
                     }
 
-                    if (ent!.Value.IsClientSide())
+                    if (IsClientSide(ent!.Value))
                         Del(ent.Value);
 
                     break;
@@ -222,7 +228,7 @@ public sealed partial class GunSystem : SharedGunSystem
                     MuzzleFlash(gunUid, newAmmo, user);
                     Audio.PlayPredicted(gun.SoundGunshot, gunUid, user);
                     Recoil(user, direction, gun.CameraRecoilScalar);
-                    if (ent!.Value.IsClientSide())
+                    if (IsClientSide(ent!.Value))
                         Del(ent.Value);
                     else
                         RemoveShootable(ent.Value);
index 75ba43df2fd6ba6c6986bd339713ef2bb8e119cf..1a8ba6c8c928969bb4d9aa4e3fb27c8adee02dd3 100644 (file)
@@ -71,7 +71,7 @@ public sealed partial class AnalysisConsoleMenu : FancyWindow
             return;
         }
 
-        UpdateArtifactIcon(state.Artifact);
+        UpdateArtifactIcon(_ent.GetEntity(state.Artifact));
 
         if (state.ScanReport == null)
         {
index 62fefd8722fe6463daad015dcd0826dc56359459..bdf12080388cef2e0cabc2ebced781eca7a4cbd2 100644 (file)
@@ -16,4 +16,9 @@ public sealed class TestMapData
     public EntityCoordinates GridCoords { get; set; }
     public MapCoordinates MapCoords { get; set; }
     public TileRef Tile { get; set; }
+
+    // Client-side uids
+    public EntityUid CMapUid { get; set; }
+    public EntityUid CGridUid { get; set; }
+    public EntityCoordinates CGridCoords { get; set; }
 }
\ No newline at end of file
index fc48bfec30bd49841587a3fc27fb5815800f5a3e..1478a4c7d279a98acd7e7972a240dc70f30f375e 100644 (file)
@@ -1,6 +1,8 @@
 #nullable enable
 using System.Linq;
+using Robust.Shared.GameObjects;
 using Robust.Shared.Map;
+using Robust.UnitTesting;
 
 namespace Content.IntegrationTests.Pair;
 
@@ -16,6 +18,7 @@ public sealed partial class TestPair
         var tileDefinitionManager = Server.ResolveDependency<ITileDefinitionManager>();
 
         var mapData = new TestMapData();
+        TestMap = mapData;
         await Server.WaitPost(() =>
         {
             mapData.MapId = Server.MapMan.CreateMap();
@@ -29,11 +32,48 @@ public sealed partial class TestPair
             mapData.MapCoords = new MapCoordinates(0, 0, mapData.MapId);
             mapData.Tile = mapData.MapGrid.GetAllTiles().First();
         });
-        
-        if (Settings.Connected)
-            await RunTicksSync(10);
 
-        TestMap = mapData;
+        if (!Settings.Connected)
+            return mapData;
+
+        await RunTicksSync(10);
+        mapData.CMapUid = ToClientUid(mapData.MapUid);
+        mapData.CGridUid = ToClientUid(mapData.GridUid);
+        mapData.CGridCoords = new EntityCoordinates(mapData.CGridUid, 0, 0);
+
         return mapData;
     }
-}
\ No newline at end of file
+
+    /// <summary>
+    /// Convert a client-side uid into a server-side uid
+    /// </summary>
+    public EntityUid ToServerUid(EntityUid uid) => ConvertUid(uid, Client, Server);
+
+    /// <summary>
+    /// Convert a server-side uid into a client-side uid
+    /// </summary>
+    public EntityUid ToClientUid(EntityUid uid) => ConvertUid(uid, Server, Client);
+
+    private static EntityUid ConvertUid(
+        EntityUid uid,
+        RobustIntegrationTest.IntegrationInstance source,
+        RobustIntegrationTest.IntegrationInstance destination)
+    {
+        if (!uid.IsValid())
+            return EntityUid.Invalid;
+
+        if (!source.EntMan.TryGetComponent<MetaDataComponent>(uid, out var meta))
+        {
+            Assert.Fail($"Failed to resolve MetaData while converting the EntityUid for entity {uid}");
+            return EntityUid.Invalid;
+        }
+
+        if (!destination.EntMan.TryGetEntity(meta.NetEntity, out var otherUid))
+        {
+            Assert.Fail($"Failed to resolve net ID while converting the EntityUid entity {source.EntMan.ToPrettyString(uid)}");
+            return EntityUid.Invalid;
+        }
+
+        return otherUid.Value;
+    }
+}
index c61fa8974fb868f74df1902097ad229af580f1d3..01f8bdd9387f2c4dc9141af87e7095797410acb6 100644 (file)
@@ -3,6 +3,8 @@ using Content.Shared.Actions;
 using Content.Shared.CombatMode;
 using Robust.Server.Player;
 using Robust.Shared.GameObjects;
+using Robust.Shared.Players;
+using PlayerManager = Robust.Client.Player.PlayerManager;
 
 namespace Content.IntegrationTests.Tests.Actions;
 
@@ -23,30 +25,32 @@ public sealed class ActionsAddedTest
         var client = pair.Client;
         var sEntMan = server.ResolveDependency<IEntityManager>();
         var cEntMan = client.ResolveDependency<IEntityManager>();
-        var session = server.ResolveDependency<IPlayerManager>().ServerSessions.Single();
+        var clientSession = client.ResolveDependency<Robust.Client.Player.IPlayerManager>().LocalPlayer?.Session;
+        var serverSession = server.ResolveDependency<IPlayerManager>().ServerSessions.Single();
         var sActionSystem = server.System<SharedActionsSystem>();
         var cActionSystem = client.System<SharedActionsSystem>();
 
         // Dummy ticker is disabled - client should be in control of a normal mob.
-        Assert.NotNull(session.AttachedEntity);
-        var ent = session.AttachedEntity!.Value;
-        Assert.That(sEntMan.EntityExists(ent));
-        Assert.That(cEntMan.EntityExists(ent));
-        Assert.That(sEntMan.HasComponent<ActionsComponent>(ent));
-        Assert.That(cEntMan.HasComponent<ActionsComponent>(ent));
-        Assert.That(sEntMan.HasComponent<CombatModeComponent>(ent));
-        Assert.That(cEntMan.HasComponent<CombatModeComponent>(ent));
+        Assert.NotNull(serverSession.AttachedEntity);
+        var serverEnt = serverSession.AttachedEntity!.Value;
+        var clientEnt = clientSession!.AttachedEntity!.Value;
+        Assert.That(sEntMan.EntityExists(serverEnt));
+        Assert.That(cEntMan.EntityExists(clientEnt));
+        Assert.That(sEntMan.HasComponent<ActionsComponent>(serverEnt));
+        Assert.That(cEntMan.HasComponent<ActionsComponent>(clientEnt));
+        Assert.That(sEntMan.HasComponent<CombatModeComponent>(serverEnt));
+        Assert.That(cEntMan.HasComponent<CombatModeComponent>(clientEnt));
 
-        var sComp = sEntMan.GetComponent<ActionsComponent>(ent);
-        var cComp = cEntMan.GetComponent<ActionsComponent>(ent);
+        var sComp = sEntMan.GetComponent<ActionsComponent>(serverEnt);
+        var cComp = cEntMan.GetComponent<ActionsComponent>(clientEnt);
 
         // Mob should have a combat-mode action.
         // This action should have a non-null event both on the server & client.
         var evType = typeof(ToggleCombatActionEvent);
 
-        var sActions = sActionSystem.GetActions(ent).Where(
+        var sActions = sActionSystem.GetActions(serverEnt).Where(
             x => x.Comp is InstantActionComponent act && act.Event?.GetType() == evType).ToArray();
-        var cActions = cActionSystem.GetActions(ent).Where(
+        var cActions = cActionSystem.GetActions(clientEnt).Where(
             x => x.Comp is InstantActionComponent act && act.Event?.GetType() == evType).ToArray();
 
         Assert.That(sActions.Length, Is.EqualTo(1));
index affb43db3ecaa638a16c5735f742193a753a7a43..13a0bee28e7561f88900034e7a0411053581b00a 100644 (file)
@@ -29,7 +29,7 @@ public sealed class DispenserTest : InteractionTest
 
         // Beaker is back in the player's hands
         Assert.That(Hands.ActiveHandEntity, Is.Not.Null);
-        AssertPrototype("Beaker", Hands.ActiveHandEntity);
+        AssertPrototype("Beaker", SEntMan.GetNetEntity(Hands.ActiveHandEntity));
 
         // Re-insert the beaker
         await Interact();
@@ -40,6 +40,6 @@ public sealed class DispenserTest : InteractionTest
         await ClickControl<ReagentDispenserWindow>(nameof(ReagentDispenserWindow.EjectButton));
         await RunTicks(5);
         Assert.That(Hands.ActiveHandEntity, Is.Not.Null);
-        AssertPrototype("Beaker", Hands.ActiveHandEntity);
+        AssertPrototype("Beaker", SEntMan.GetNetEntity(Hands.ActiveHandEntity));
     }
 }
index 8a0725ddaa87d6d8ae5d1c87e0a3c12d2effa9aa..76085381852df7ee155c77965a5a99c80f8e75b5 100644 (file)
@@ -47,7 +47,7 @@ namespace Content.IntegrationTests.Tests
             await using var pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true });
             var server = pair.Server;
             var client = pair.Client;
-            EntityUid entity = default;
+
             var clientEntManager = client.ResolveDependency<IEntityManager>();
             var serverEntManager = server.ResolveDependency<IEntityManager>();
             var eyeManager = client.ResolveDependency<IEyeManager>();
@@ -56,35 +56,38 @@ namespace Content.IntegrationTests.Tests
             var eye = client.ResolveDependency<IEyeManager>().CurrentEye;
 
             var testMap = await pair.CreateTestMap();
+
+            EntityUid serverEnt = default;
+
             await server.WaitPost(() =>
             {
-                var ent = serverEntManager.SpawnEntity(prototype, testMap.GridCoords);
-                serverEntManager.System<SharedTransformSystem>().SetWorldRotation(ent, angle);
-                entity = ent;
+                serverEnt = serverEntManager.SpawnEntity(prototype, testMap.GridCoords);
+                serverEntManager.System<SharedTransformSystem>().SetWorldRotation(serverEnt, angle);
             });
 
             // Let client sync up.
             await pair.RunTicksSync(5);
 
             var hit = false;
+            var clientEnt = clientEntManager.GetEntity(serverEntManager.GetNetEntity(serverEnt));
 
             await client.WaitPost(() =>
             {
-                var sprite = spriteQuery.GetComponent(entity);
+                var sprite = spriteQuery.GetComponent(clientEnt);
                 sprite.Scale = new Vector2(scale, scale);
 
                 // these tests currently all assume player eye is 0
                 eyeManager.CurrentEye.Rotation = 0;
 
-                var pos = clientEntManager.System<SharedTransformSystem>().GetWorldPosition(entity);
-                var clickable = clientEntManager.GetComponent<ClickableComponent>(entity);
+                var pos = clientEntManager.System<SharedTransformSystem>().GetWorldPosition(clientEnt);
+                var clickable = clientEntManager.GetComponent<ClickableComponent>(clientEnt);
 
-                hit = clickable.CheckClick(sprite, xformQuery.GetComponent(entity), xformQuery, new Vector2(clickPosX, clickPosY) + pos, eye, out _, out _, out _);
+                hit = clickable.CheckClick(sprite, xformQuery.GetComponent(clientEnt), xformQuery, new Vector2(clickPosX, clickPosY) + pos, eye, out _, out _, out _);
             });
 
             await server.WaitPost(() =>
             {
-                serverEntManager.DeleteEntity(entity);
+                serverEntManager.DeleteEntity(serverEnt);
             });
 
             await pair.CleanReturnAsync();
index e909775793d08a1d5f7a5bd8369acaf9b2f3773a..f6bcc6e12916a355f870a5d7f0f0cd9f28bf58c9 100644 (file)
@@ -29,7 +29,7 @@ public sealed class ClimbingTest : MovementTest
 
         // Try to start climbing
         var sys = SEntMan.System<ClimbSystem>();
-        await Server.WaitPost(() => sys.TryClimb(Player, Player, Target.Value, out _));
+        await Server.WaitPost(() => sys.TryClimb(SEntMan.GetEntity(Player), SEntMan.GetEntity(Player), SEntMan.GetEntity(Target.Value), out _));
         await AwaitDoAfters();
 
         // Player should now be climbing
@@ -56,7 +56,7 @@ public sealed class ClimbingTest : MovementTest
         Assert.That(Delta(), Is.LessThan(0));
 
         // Start climbing
-        await Server.WaitPost(() => sys.TryClimb(Player, Player, Target.Value, out _));
+        await Server.WaitPost(() => sys.TryClimb(SEntMan.GetEntity(Player), SEntMan.GetEntity(Player), SEntMan.GetEntity(Target.Value), out _));
         await AwaitDoAfters();
 
         Assert.Multiple(() =>
index 87f3c06c12bf3c4d1683875f8fbbd837e0088da6..1cf0135d7a7b852be8e989822a6ec955e5cd609d 100644 (file)
@@ -17,7 +17,9 @@ public sealed class ComputerConstruction : InteractionTest
 
         // Initial interaction (ghost turns into real entity)
         await Interact(Steel, 5);
-        AssertPrototype(ComputerFrame);
+        ClientAssertPrototype(ComputerFrame, ClientTarget);
+        Target = CTestSystem.Ghosts[ClientTarget!.Value.GetHashCode()];
+        ClientTarget = null;
 
         // Perform construction steps
         await Interact(
@@ -29,7 +31,7 @@ public sealed class ComputerConstruction : InteractionTest
             Screw);
 
         // Construction finished, target entity was replaced with a new one:
-        AssertPrototype(ComputerId);
+        AssertPrototype(ComputerId, Target);
     }
 
     [Test]
index 5c48703dff638ed658c08bd461b0cbe448613c85..c49e20981e31f3dd882590e8b7238fe61ceece83 100644 (file)
@@ -1,5 +1,6 @@
 using System.Linq;
 using Content.IntegrationTests.Tests.Interaction;
+using Content.Shared.DoAfter;
 using Content.Shared.Stacks;
 using Robust.Shared.Containers;
 
@@ -40,7 +41,7 @@ public sealed class CraftingTests : InteractionTest
     {
         // Spawn a full tack of rods in the user's hands.
         await PlaceInHands(Rod, 10);
-        await SpawnEntity((Cable, 10), PlayerCoords);
+        await SpawnEntity((Cable, 10), SEntMan.GetCoordinates(PlayerCoords));
 
         // Attempt (and fail) to craft without glass.
         await CraftItem(Spear, shouldSucceed: false);
@@ -69,9 +70,10 @@ public sealed class CraftingTests : InteractionTest
     [Test]
     public async Task CancelCraft()
     {
-        var rods = await SpawnEntity((Rod, 10), TargetCoords);
-        var wires = await SpawnEntity((Cable, 10), TargetCoords);
-        var shard = await SpawnEntity(ShardGlass, TargetCoords);
+        var serverTargetCoords = SEntMan.GetCoordinates(TargetCoords);
+        var rods = await SpawnEntity((Rod, 10), serverTargetCoords);
+        var wires = await SpawnEntity((Cable, 10), serverTargetCoords);
+        var shard = await SpawnEntity(ShardGlass, serverTargetCoords);
 
         var rodStack = SEntMan.GetComponent<StackComponent>(rods);
         var wireStack = SEntMan.GetComponent<StackComponent>(wires);
@@ -86,7 +88,7 @@ public sealed class CraftingTests : InteractionTest
         });
 
 #pragma warning disable CS4014 // Legacy construction code uses DoAfterAwait. If we await it we will be waiting forever.
-        await Server.WaitPost(() => SConstruction.TryStartItemConstruction(Spear, Player));
+        await Server.WaitPost(() => SConstruction.TryStartItemConstruction(Spear, SEntMan.GetEntity(Player)));
 #pragma warning restore CS4014
         await RunTicks(1);
 
@@ -116,7 +118,7 @@ public sealed class CraftingTests : InteractionTest
 
         // Re-attempt the do-after
 #pragma warning disable CS4014 // Legacy construction code uses DoAfterAwait. See above.
-        await Server.WaitPost(() => SConstruction.TryStartItemConstruction(Spear, Player));
+        await Server.WaitPost(() => SConstruction.TryStartItemConstruction(Spear, SEntMan.GetEntity(Player)));
 #pragma warning restore CS4014
         await RunTicks(1);
 
index 1a2f4bcda140058f6754e4bfa146e50b0de8a12d..0de39d27577f22b4d9e4bee5fe4867445702dfa9 100644 (file)
@@ -18,14 +18,16 @@ public sealed class GrilleWindowConstruction : InteractionTest
         // Construct Grille
         await StartConstruction(Grille);
         await Interact(Rod, 10);
-        AssertPrototype(Grille);
+        ClientAssertPrototype(Grille, ClientTarget);
 
+        Target = CTestSystem.Ghosts[ClientTarget!.Value.GetHashCode()];
         var grille = Target;
 
         // Construct Window
         await StartConstruction(Window);
         await Interact(Glass, 10);
-        AssertPrototype(Window);
+        ClientAssertPrototype(Window, ClientTarget);
+        Target = CTestSystem.Ghosts[ClientTarget!.Value.GetHashCode()];
 
         // Deconstruct Window
         await Interact(Screw, Wrench);
@@ -50,7 +52,7 @@ public sealed class GrilleWindowConstruction : InteractionTest
         await Client.WaitPost(() =>
         {
             var proto = ProtoMan.Index<ConstructionPrototype>(second);
-            Assert.That(CConSys.TrySpawnGhost(proto, TargetCoords, Direction.South, out _), Is.False);
+            Assert.That(CConSys.TrySpawnGhost(proto, CEntMan.GetCoordinates(TargetCoords), Direction.South, out _), Is.False);
         });
     }
 }
index 0382912ccbbc113208f6f2e296b3a927fe3e5fcb..17630405a4538128d833d260e97ebe548253eaed 100644 (file)
@@ -15,7 +15,8 @@ public sealed class MachineConstruction : InteractionTest
     {
         await StartConstruction(MachineFrame);
         await Interact(Steel, 5);
-        AssertPrototype(Unfinished);
+        ClientAssertPrototype(Unfinished, ClientTarget);
+        Target = CTestSystem.Ghosts[ClientTarget!.Value.GetHashCode()];
         await Interact(Wrench, Cable);
         AssertPrototype(MachineFrame);
         await Interact(ProtolatheBoard, Bin1, Bin1, Manipulator1, Manipulator1, Beaker, Beaker, Screw);
@@ -61,9 +62,10 @@ public sealed class MachineConstruction : InteractionTest
     {
         // Partially deconstruct a protolathe.
         await SpawnTarget(Protolathe);
+        var serverTarget = SEntMan.GetEntity(Target!.Value);
 
         // Initially has all quality-1 parts.
-        foreach (var part in SConstruction.GetAllParts(Target!.Value))
+        foreach (var part in SConstruction.GetAllParts(serverTarget))
         {
             Assert.That(part.Rating, Is.EqualTo(1));
         }
@@ -78,7 +80,7 @@ public sealed class MachineConstruction : InteractionTest
         AssertPrototype(Protolathe);
 
         // Query now returns higher quality parts.
-        foreach (var part in SConstruction.GetAllParts(Target!.Value))
+        foreach (var part in SConstruction.GetAllParts(SEntMan.GetEntity(Target!.Value)))
         {
             Assert.That(part.Rating, Is.EqualTo(4));
         }
index 2f69f3abea5b0a62b02ecaf64413f1463474c241..b6d960e28821af432b168309946e489e30b85983 100644 (file)
@@ -1,4 +1,6 @@
+using System.Linq;
 using Content.IntegrationTests.Tests.Interaction;
+using Content.Shared.DoAfter;
 using Content.Shared.Wires;
 
 namespace Content.IntegrationTests.Tests.Construction.Interaction;
index 05cf8cac1b88a0d07e341f02f8880058554726f7..67a2f8025dc087041ea8040944df68fc366ac8e2 100644 (file)
@@ -14,7 +14,8 @@ public sealed class WallConstruction : InteractionTest
         await StartConstruction(Wall);
         await Interact(Steel, 2);
         Assert.That(Hands.ActiveHandEntity, Is.Null);
-        AssertPrototype(Girder);
+        ClientAssertPrototype(Girder, ClientTarget);
+        Target = CTestSystem.Ghosts[ClientTarget!.Value.GetHashCode()];
         await Interact(Steel, 2);
         Assert.That(Hands.ActiveHandEntity, Is.Null);
         AssertPrototype(WallSolid);
index 2be202027754dc82a030824114d12ac3c9139f81..46bb892ed99acce4bc44f70fb11efb12345d9f95 100644 (file)
@@ -12,7 +12,7 @@ public sealed class WindowConstruction : InteractionTest
     {
         await StartConstruction(Window);
         await Interact(Glass, 5);
-        AssertPrototype(Window);
+        ClientAssertPrototype(Window, ClientTarget);
     }
 
     [Test]
@@ -29,7 +29,7 @@ public sealed class WindowConstruction : InteractionTest
     {
         await StartConstruction(RWindow);
         await Interact(RGlass, 5);
-        AssertPrototype(RWindow);
+        ClientAssertPrototype(RWindow, ClientTarget);
     }
 
     [Test]
index e04fbfd1429841ad6a111c1d454fa82e419016f9..0bcc935fde3463397df9374a81b8076082d2fb2a 100644 (file)
@@ -19,7 +19,7 @@ public sealed class WindowRepair : InteractionTest
         var damageType = Server.ResolveDependency<IPrototypeManager>().Index<DamageTypePrototype>("Blunt");
         var damage = new DamageSpecifier(damageType, FixedPoint2.New(10));
         Assert.That(comp.Damage.Total, Is.EqualTo(FixedPoint2.Zero));
-        await Server.WaitPost(() => sys.TryChangeDamage(Target, damage, ignoreResistances: true));
+        await Server.WaitPost(() => sys.TryChangeDamage(SEntMan.GetEntity(Target), damage, ignoreResistances: true));
         await RunTicks(5);
         Assert.That(comp.Damage.Total, Is.GreaterThan(FixedPoint2.Zero));
 
index a4af17c34617e7de65211eacbf5620394adf5bfd..c61a70faf0b5bffd7144c87c21deb31cc508a4eb 100644 (file)
@@ -35,32 +35,34 @@ namespace Content.IntegrationTests.Tests
         public async Task TestA()
         {
             await using var pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true });
-            var s = pair.Server;
-            var c = pair.Client;
+            var server = pair.Server;
+            var client = pair.Client;
 
-            var cEntities = c.ResolveDependency<IEntityManager>();
-            var ent = s.ResolveDependency<IEntityManager>();
+            var clientEntManager = client.ResolveDependency<IEntityManager>();
+            var serverEntManager = server.ResolveDependency<IEntityManager>();
 
             EntityUid dummy = default;
-            var mapManager = s.ResolveDependency<IMapManager>();
+            var mapManager = server.ResolveDependency<IMapManager>();
             var mapId = mapManager.CreateMap();
 
-            await s.WaitPost(() =>
+            await server.WaitPost(() =>
             {
                 var pos = new MapCoordinates(Vector2.Zero, mapId);
-                var entStorage = ent.EntitySysManager.GetEntitySystem<EntityStorageSystem>();
-                var container = ent.SpawnEntity("ContainerOcclusionA", pos);
-                dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
+                var entStorage = serverEntManager.EntitySysManager.GetEntitySystem<EntityStorageSystem>();
+                var container = serverEntManager.SpawnEntity("ContainerOcclusionA", pos);
+                dummy = serverEntManager.SpawnEntity("ContainerOcclusionDummy", pos);
 
                 entStorage.Insert(dummy, container);
             });
 
             await pair.RunTicksSync(5);
 
-            await c.WaitAssertion(() =>
+            var clientEnt = clientEntManager.GetEntity(serverEntManager.GetNetEntity(dummy));
+
+            await client.WaitAssertion(() =>
             {
-                var sprite = cEntities.GetComponent<SpriteComponent>(dummy);
-                var light = cEntities.GetComponent<PointLightComponent>(dummy);
+                var sprite = clientEntManager.GetComponent<SpriteComponent>(clientEnt);
+                var light = clientEntManager.GetComponent<PointLightComponent>(clientEnt);
                 Assert.Multiple(() =>
                 {
                     Assert.That(sprite.ContainerOccluded);
@@ -75,32 +77,34 @@ namespace Content.IntegrationTests.Tests
         public async Task TestB()
         {
             await using var pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true });
-            var s = pair.Server;
-            var c = pair.Client;
+            var server = pair.Server;
+            var client = pair.Client;
 
-            var cEntities = c.ResolveDependency<IEntityManager>();
-            var ent = s.ResolveDependency<IEntityManager>();
+            var clientEntManager = client.ResolveDependency<IEntityManager>();
+            var serverEntManager = server.ResolveDependency<IEntityManager>();
 
             EntityUid dummy = default;
-            var mapManager = s.ResolveDependency<IMapManager>();
+            var mapManager = server.ResolveDependency<IMapManager>();
             var mapId = mapManager.CreateMap();
 
-            await s.WaitPost(() =>
+            await server.WaitPost(() =>
             {
                 var pos = new MapCoordinates(Vector2.Zero, mapId);
-                var entStorage = ent.EntitySysManager.GetEntitySystem<EntityStorageSystem>();
-                var container = ent.SpawnEntity("ContainerOcclusionB", pos);
-                dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
+                var entStorage = serverEntManager.EntitySysManager.GetEntitySystem<EntityStorageSystem>();
+                var container = serverEntManager.SpawnEntity("ContainerOcclusionB", pos);
+                dummy = serverEntManager.SpawnEntity("ContainerOcclusionDummy", pos);
 
                 entStorage.Insert(dummy, container);
             });
 
             await pair.RunTicksSync(5);
 
-            await c.WaitAssertion(() =>
+            var clientEnt = clientEntManager.GetEntity(serverEntManager.GetNetEntity(dummy));
+
+            await client.WaitAssertion(() =>
             {
-                var sprite = cEntities.GetComponent<SpriteComponent>(dummy);
-                var light = cEntities.GetComponent<PointLightComponent>(dummy);
+                var sprite = clientEntManager.GetComponent<SpriteComponent>(clientEnt);
+                var light = clientEntManager.GetComponent<PointLightComponent>(clientEnt);
                 Assert.Multiple(() =>
                 {
                     Assert.That(sprite.ContainerOccluded, Is.False);
@@ -115,23 +119,23 @@ namespace Content.IntegrationTests.Tests
         public async Task TestAb()
         {
             await using var pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true });
-            var s = pair.Server;
-            var c = pair.Client;
+            var server = pair.Server;
+            var client = pair.Client;
 
-            var cEntities = c.ResolveDependency<IEntityManager>();
-            var ent = s.ResolveDependency<IEntityManager>();
+            var clientEntManager = client.ResolveDependency<IEntityManager>();
+            var serverEntManager = server.ResolveDependency<IEntityManager>();
 
             EntityUid dummy = default;
-            var mapManager = s.ResolveDependency<IMapManager>();
+            var mapManager = server.ResolveDependency<IMapManager>();
             var mapId = mapManager.CreateMap();
 
-            await s.WaitPost(() =>
+            await server.WaitPost(() =>
             {
                 var pos = new MapCoordinates(Vector2.Zero, mapId);
-                var entStorage = ent.EntitySysManager.GetEntitySystem<EntityStorageSystem>();
-                var containerA = ent.SpawnEntity("ContainerOcclusionA", pos);
-                var containerB = ent.SpawnEntity("ContainerOcclusionB", pos);
-                dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
+                var entStorage = serverEntManager.EntitySysManager.GetEntitySystem<EntityStorageSystem>();
+                var containerA = serverEntManager.SpawnEntity("ContainerOcclusionA", pos);
+                var containerB = serverEntManager.SpawnEntity("ContainerOcclusionB", pos);
+                dummy = serverEntManager.SpawnEntity("ContainerOcclusionDummy", pos);
 
                 entStorage.Insert(containerB, containerA);
                 entStorage.Insert(dummy, containerB);
@@ -139,10 +143,12 @@ namespace Content.IntegrationTests.Tests
 
             await pair.RunTicksSync(5);
 
-            await c.WaitAssertion(() =>
+            var clientEnt = clientEntManager.GetEntity(serverEntManager.GetNetEntity(dummy));
+
+            await client.WaitAssertion(() =>
             {
-                var sprite = cEntities.GetComponent<SpriteComponent>(dummy);
-                var light = cEntities.GetComponent<PointLightComponent>(dummy);
+                var sprite = clientEntManager.GetComponent<SpriteComponent>(clientEnt);
+                var light = clientEntManager.GetComponent<PointLightComponent>(clientEnt);
                 Assert.Multiple(() =>
                 {
                     Assert.That(sprite.ContainerOccluded);
index 16255d077393790fd60bb1e25704853fd62e0b04..5522ce8c54b8d66dd236edc1a7def6e9ffaa2ed2 100644 (file)
@@ -3,6 +3,8 @@ using Content.IntegrationTests.Tests.Construction.Interaction;
 using Content.IntegrationTests.Tests.Interaction;
 using Content.IntegrationTests.Tests.Weldable;
 using Content.Shared.Tools.Components;
+using Content.Server.Tools.Components;
+using Content.Shared.DoAfter;
 
 namespace Content.IntegrationTests.Tests.DoAfter;
 
@@ -50,10 +52,10 @@ public sealed class DoAfterCancellationTests : InteractionTest
         await StartConstruction(WallConstruction.Wall);
         await Interact(Steel, 5, awaitDoAfters: false);
         await CancelDoAfters();
-        Assert.That(Target.HasValue && Target.Value.IsClientSide());
 
         await Interact(Steel, 5);
-        AssertPrototype(WallConstruction.Girder);
+        ClientAssertPrototype(WallConstruction.Girder, ClientTarget);
+        Target = CTestSystem.Ghosts[ClientTarget!.Value.GetHashCode()];
         await Interact(Steel, 5, awaitDoAfters: false);
         await CancelDoAfters();
         AssertPrototype(WallConstruction.Girder);
@@ -84,7 +86,7 @@ public sealed class DoAfterCancellationTests : InteractionTest
         await AssertTile(Floor);
 
         // Second DoAfter cancels the first.
-        await Server.WaitPost(() => InteractSys.UserInteraction(Player, TargetCoords, Target));
+        await Server.WaitPost(() => InteractSys.UserInteraction(SEntMan.GetEntity(Player), SEntMan.GetCoordinates(TargetCoords), SEntMan.GetEntity(Target)));
         Assert.That(ActiveDoAfters.Count(), Is.EqualTo(0));
         await AssertTile(Floor);
 
@@ -112,7 +114,7 @@ public sealed class DoAfterCancellationTests : InteractionTest
 
         // Second DoAfter cancels the first.
         // Not using helper, because it runs too many ticks & causes the do-after to finish.
-        await Server.WaitPost(() => InteractSys.UserInteraction(Player, TargetCoords, Target));
+        await Server.WaitPost(() => InteractSys.UserInteraction(SEntMan.GetEntity(Player), SEntMan.GetCoordinates(TargetCoords), SEntMan.GetEntity(Target)));
         Assert.Multiple(() =>
         {
             Assert.That(ActiveDoAfters.Count(), Is.EqualTo(0));
@@ -135,7 +137,7 @@ public sealed class DoAfterCancellationTests : InteractionTest
             Assert.That(ActiveDoAfters.Count(), Is.EqualTo(1));
             Assert.That(comp.IsWelded, Is.True);
         });
-        await Server.WaitPost(() => InteractSys.UserInteraction(Player, TargetCoords, Target));
+        await Server.WaitPost(() => InteractSys.UserInteraction(SEntMan.GetEntity(Player), SEntMan.GetCoordinates(TargetCoords), SEntMan.GetEntity(Target)));
         Assert.Multiple(() =>
         {
             Assert.That(ActiveDoAfters.Count(), Is.EqualTo(0));
index 252cd5e04be0983c30114dd663ac654cc665f924..45c2759aa6e8aa285e86c5b3353b86eb460ecb93 100644 (file)
@@ -73,7 +73,7 @@ namespace Content.IntegrationTests.Tests.DoAfter
             {
                 var tickTime = 1.0f / timing.TickRate;
                 var mob = entityManager.SpawnEntity("DoAfterDummy", MapCoordinates.Nullspace);
-                var args = new DoAfterArgs(mob, tickTime / 2, ev, null) { Broadcast = true };
+                var args = new DoAfterArgs(entityManager, mob, tickTime / 2, ev, null) { Broadcast = true };
 #pragma warning disable NUnit2045 // Interdependent assertions.
                 Assert.That(doAfterSystem.TryStartDoAfter(args));
                 Assert.That(ev.Cancelled, Is.False);
@@ -101,7 +101,7 @@ namespace Content.IntegrationTests.Tests.DoAfter
                 var tickTime = 1.0f / timing.TickRate;
 
                 var mob = entityManager.SpawnEntity("DoAfterDummy", MapCoordinates.Nullspace);
-                var args = new DoAfterArgs(mob, tickTime * 2, ev, null) { Broadcast = true };
+                var args = new DoAfterArgs(entityManager, mob, tickTime * 2, ev, null) { Broadcast = true };
 
                 if (!doAfterSystem.TryStartDoAfter(args, out var id))
                 {
index d1430cbe290b7d6f231c49cdbf98105a9eec7c49..453796b9165b7785730d01a0c2ad3be2eabc8b28 100644 (file)
@@ -42,6 +42,8 @@ namespace Content.IntegrationTests.Tests
                 {
                     var mapId = mapManager.CreateMap();
                     var grid = mapManager.CreateGrid(mapId);
+                    // TODO: Fix this better in engine.
+                    grid.SetTile(Vector2i.Zero, new Tile(1));
                     var coord = new EntityCoordinates(grid.Owner, 0, 0);
                     entityMan.SpawnEntity(protoId, coord);
                 }
@@ -57,7 +59,7 @@ namespace Content.IntegrationTests.Tests
                     var query = entityMan.AllEntityQueryEnumerator<TComp>();
                     while (query.MoveNext(out var uid, out var meta))
                         yield return (uid, meta);
-                };
+                }
 
                 var entityMetas = Query<MetaDataComponent>(entityMan).ToList();
                 foreach (var (uid, meta) in entityMetas)
index 55daeed4306d2a4fdc8cfca8bfb670efe465c047..1d5dd6d34e21bc4a945b12abc71d7cc8f183fb4c 100644 (file)
@@ -84,8 +84,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
                 Assert.That(cuffed.CuffedHandCount, Is.GreaterThan(0), "Handcuffing a player did not result in their hands being cuffed");
 
                 // Test to ensure a player with 4 hands will still only have 2 hands cuffed
-                AddHand(human, host);
-                AddHand(human, host);
+                AddHand(entityManager.GetNetEntity(human), host);
+                AddHand(entityManager.GetNetEntity(human), host);
 
                 Assert.Multiple(() =>
                 {
@@ -101,7 +101,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
             await pair.CleanReturnAsync();
         }
 
-        private static void AddHand(EntityUid to, IServerConsoleHost host)
+        private static void AddHand(NetEntity to, IServerConsoleHost host)
         {
             host.ExecuteCommand(null, $"addhand {to}");
         }
index 402569981ae5d1620d4f016f2dc480e2ed4d8542..b05f2732651b746d419658d79b6849ff3e3f59d2 100644 (file)
@@ -341,7 +341,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
             EntityUid target = default;
             EntityUid item = default;
             EntityUid containerEntity = default;
-            IContainer container = null;
+            BaseContainer container = null;
 
             await server.WaitAssertion(() =>
             {
index abbfa1a2b045ca011527414b65f86975baaa9041..530970407caf6183c3ff3b9d05351f073b07e508 100644 (file)
@@ -13,7 +13,9 @@ using Content.Server.Gravity;
 using Content.Server.Power.Components;
 using Content.Server.Tools.Components;
 using Content.Shared.Atmos;
+using Content.Shared.Construction;
 using Content.Shared.Construction.Prototypes;
+using Content.Shared.DoAfter;
 using Content.Shared.Gravity;
 using Content.Shared.Item;
 using Robust.Client.GameObjects;
@@ -40,13 +42,15 @@ public abstract partial class InteractionTest
 
         await Client.WaitPost(() =>
         {
-            Assert.That(CConSys.TrySpawnGhost(proto, TargetCoords, Direction.South, out Target),
+            Assert.That(CConSys.TrySpawnGhost(proto, CEntMan.GetCoordinates(TargetCoords), Direction.South, out var clientTarget),
                 Is.EqualTo(shouldSucceed));
 
             if (!shouldSucceed)
                 return;
-            var comp = CEntMan.GetComponent<ConstructionGhostComponent>(Target!.Value);
-            ConstructionGhostId = comp.GhostId;
+
+            var comp = CEntMan.GetComponent<ConstructionGhostComponent>(clientTarget!.Value);
+            ClientTarget = clientTarget;
+            ConstructionGhostId = comp.Owner.Id;
         });
 
         await RunTicks(1);
@@ -61,7 +65,7 @@ public abstract partial class InteractionTest
 
         // Please someone purge async construction code
         Task<bool> task = default!;
-        await Server.WaitPost(() => task = SConstruction.TryStartItemConstruction(prototype, Player));
+        await Server.WaitPost(() => task = SConstruction.TryStartItemConstruction(prototype, SEntMan.GetEntity(Player)));
 
         Task? tickTask = null;
         while (!task.IsCompleted)
@@ -86,10 +90,10 @@ public abstract partial class InteractionTest
     [MemberNotNull(nameof(Target))]
     protected async Task SpawnTarget(string prototype)
     {
-        Target = EntityUid.Invalid;
+        Target = NetEntity.Invalid;
         await Server.WaitPost(() =>
         {
-            Target = SEntMan.SpawnEntity(prototype, TargetCoords);
+            Target = SEntMan.GetNetEntity(SEntMan.SpawnEntity(prototype, SEntMan.GetCoordinates(TargetCoords)));
         });
 
         await RunTicks(5);
@@ -102,8 +106,9 @@ public abstract partial class InteractionTest
     protected async Task StartDeconstruction(string prototype)
     {
         await SpawnTarget(prototype);
-        Assert.That(SEntMan.TryGetComponent(Target, out ConstructionComponent? comp));
-        await Server.WaitPost(() => SConstruction.SetPathfindingTarget(Target!.Value, comp!.DeconstructionNode, comp));
+        var serverTarget = SEntMan.GetEntity(Target);
+        Assert.That(SEntMan.TryGetComponent(serverTarget, out ConstructionComponent? comp));
+        await Server.WaitPost(() => SConstruction.SetPathfindingTarget(serverTarget!.Value, comp!.DeconstructionNode, comp));
         await RunTicks(5);
     }
 
@@ -116,7 +121,7 @@ public abstract partial class InteractionTest
         {
             await Server.WaitPost(() =>
             {
-                Assert.That(HandSys.TryDrop(Player, null, false, true, Hands));
+                Assert.That(HandSys.TryDrop(SEntMan.GetEntity(Player), null, false, true, Hands));
                 SEntMan.DeleteEntity(held);
                 SLogger.Debug($"Deleting held entity");
             });
@@ -161,16 +166,18 @@ public abstract partial class InteractionTest
         }
 
         // spawn and pick up the new item
-        var item = await SpawnEntity(entity, PlayerCoords);
+        var item = await SpawnEntity(entity, SEntMan.GetCoordinates(PlayerCoords));
         WelderComponent? welder = null;
 
         await Server.WaitPost(() =>
         {
-            Assert.That(HandSys.TryPickup(Player, item, Hands.ActiveHand, false, false, false, Hands));
+            var playerEnt = SEntMan.GetEntity(Player);
+
+            Assert.That(HandSys.TryPickup(playerEnt, item, Hands.ActiveHand, false, false, false, Hands));
 
             // turn on welders
             if (enableWelder && SEntMan.TryGetComponent(item, out welder) && !welder.Lit)
-                Assert.That(ToolSys.TryTurnWelderOn(item, Player, welder));
+                Assert.That(ToolSys.TryTurnWelderOn(item, playerEnt, welder));
         });
 
         await RunTicks(1);
@@ -184,9 +191,9 @@ public abstract partial class InteractionTest
     /// <summary>
     /// Pick up an entity. Defaults to just deleting the previously held entity.
     /// </summary>
-    protected async Task Pickup(EntityUid? uid = null, bool deleteHeld = true)
+    protected async Task Pickup(NetEntity? entity = null, bool deleteHeld = true)
     {
-        uid ??= Target;
+        entity ??= Target;
 
         if (Hands.ActiveHand == null)
         {
@@ -197,15 +204,17 @@ public abstract partial class InteractionTest
         if (deleteHeld)
             await DeleteHeldEntity();
 
+        var uid = SEntMan.GetEntity(entity);
+
         if (!SEntMan.TryGetComponent(uid, out ItemComponent? item))
         {
-            Assert.Fail($"Entity {uid} is not an item");
+            Assert.Fail($"Entity {entity} is not an item");
             return;
         }
 
         await Server.WaitPost(() =>
         {
-            Assert.That(HandSys.TryPickup(Player, uid!.Value, Hands.ActiveHand, false, false, false, Hands, item));
+            Assert.That(HandSys.TryPickup(SEntMan.GetEntity(Player), uid.Value, Hands.ActiveHand, false, false, false, Hands, item));
         });
 
         await RunTicks(1);
@@ -225,7 +234,7 @@ public abstract partial class InteractionTest
 
         await Server.WaitPost(() =>
         {
-            Assert.That(HandSys.TryDrop(Player, handsComp: Hands));
+            Assert.That(HandSys.TryDrop(SEntMan.GetEntity(Player), handsComp: Hands));
         });
 
         await RunTicks(1);
@@ -247,7 +256,7 @@ public abstract partial class InteractionTest
 
         await Server.WaitPost(() =>
         {
-            InteractSys.UserInteraction(Player, SEntMan.GetComponent<TransformComponent>(target).Coordinates, target);
+            InteractSys.UserInteraction(SEntMan.GetEntity(Player), SEntMan.GetComponent<TransformComponent>(target).Coordinates, target);
         });
     }
 
@@ -274,7 +283,7 @@ public abstract partial class InteractionTest
         // (e.g., servers attempt to assemble construction examine hints).
         if (Target != null)
         {
-            await Client.WaitPost(() => ExamineSys.DoExamine(Target.Value));
+            await Client.WaitPost(() => ExamineSys.DoExamine(CEntMan.GetEntity(Target.Value)));
         }
 
         await PlaceInHands(entity);
@@ -286,16 +295,19 @@ public abstract partial class InteractionTest
     /// </summary>
     protected async Task Interact(bool shouldSucceed = true, bool awaitDoAfters = true)
     {
-        if (Target == null || !Target.Value.IsClientSide())
+        var clientTarget = ClientTarget;
+
+        if ((clientTarget?.IsValid() != true || CEntMan.Deleted(clientTarget)) && (Target == null || Target.Value.IsValid()))
         {
-            await Server.WaitPost(() => InteractSys.UserInteraction(Player, TargetCoords, Target));
+            await Server.WaitPost(() => InteractSys.UserInteraction(SEntMan.GetEntity(Player), SEntMan.GetCoordinates(TargetCoords), SEntMan.GetEntity(Target)));
             await RunTicks(1);
         }
         else
         {
             // The entity is client-side, so attempt to start construction
-            var ghost = CEntMan.GetComponent<ConstructionGhostComponent>(Target.Value);
-            await Client.WaitPost(() => CConSys.TryStartConstruction(ghost.GhostId));
+            var clientEnt = ClientTarget ?? CEntMan.GetEntity(Target);
+
+            await Client.WaitPost(() => CConSys.TryStartConstruction(clientEnt!.Value));
             await RunTicks(5);
         }
 
@@ -366,7 +378,7 @@ public abstract partial class InteractionTest
         {
             foreach (var doAfter in doAfters)
             {
-                DoAfterSys.Cancel(Player, doAfter.Index, DoAfters);
+                DoAfterSys.Cancel(SEntMan.GetEntity(Player), doAfter.Index, DoAfters);
             }
         });
 
@@ -386,34 +398,33 @@ public abstract partial class InteractionTest
     /// </summary>
     protected async Task CheckTargetChange(bool shouldSucceed)
     {
-        EntityUid newTarget = default;
         if (Target == null)
             return;
-        var target = Target.Value;
 
+        var target = Target.Value;
         await RunTicks(5);
 
-        if (target.IsClientSide())
+        if (ClientTarget != null && CEntMan.IsClientSide(ClientTarget.Value))
         {
-            Assert.That(CEntMan.Deleted(target), Is.EqualTo(shouldSucceed),
+            Assert.That(CEntMan.Deleted(ClientTarget.Value), Is.EqualTo(shouldSucceed),
                 $"Construction ghost was {(shouldSucceed ? "not deleted" : "deleted")}.");
 
             if (shouldSucceed)
             {
-                Assert.That(CTestSystem.Ghosts.TryGetValue(ConstructionGhostId, out newTarget),
+                Assert.That(CTestSystem.Ghosts.TryGetValue(ConstructionGhostId, out var newWeh),
                     $"Failed to get construction entity from ghost Id");
 
-                await Client.WaitPost(() => CLogger.Debug($"Construction ghost {ConstructionGhostId} became entity {newTarget}"));
-                Target = newTarget;
+                await Client.WaitPost(() => CLogger.Debug($"Construction ghost {ConstructionGhostId} became entity {newWeh}"));
+                Target = newWeh;
             }
         }
 
-        if (STestSystem.EntChanges.TryGetValue(Target.Value, out newTarget))
+        if (STestSystem.EntChanges.TryGetValue(Target.Value, out var newServerWeh))
         {
             await Server.WaitPost(
-                () => SLogger.Debug($"Construction entity {Target.Value} changed to {newTarget}"));
+                () => SLogger.Debug($"Construction entity {Target.Value} changed to {newServerWeh}"));
 
-            Target = newTarget;
+            Target = newServerWeh;
         }
 
         if (Target != target)
@@ -422,7 +433,7 @@ public abstract partial class InteractionTest
 
     #region Asserts
 
-    protected void AssertPrototype(string? prototype, EntityUid? target = null)
+    protected void ClientAssertPrototype(string? prototype, NetEntity? target = null)
     {
         target ??= Target;
         if (target == null)
@@ -431,11 +442,17 @@ public abstract partial class InteractionTest
             return;
         }
 
-        var meta = SEntMan.GetComponent<MetaDataComponent>(target.Value);
+        var meta = SEntMan.GetComponent<MetaDataComponent>(SEntMan.GetEntity(target.Value));
         Assert.That(meta.EntityPrototype?.ID, Is.EqualTo(prototype));
     }
 
-    protected void AssertAnchored(bool anchored = true, EntityUid? target = null)
+    protected void ClientAssertPrototype(string? prototype, EntityUid? target)
+    {
+        var netEnt = CTestSystem.Ghosts[target.GetHashCode()];
+        AssertPrototype(prototype, netEnt);
+    }
+
+    protected void AssertPrototype(string? prototype, NetEntity? target = null)
     {
         target ??= Target;
         if (target == null)
@@ -444,8 +461,21 @@ public abstract partial class InteractionTest
             return;
         }
 
-        var sXform = SEntMan.GetComponent<TransformComponent>(target.Value);
-        var cXform = CEntMan.GetComponent<TransformComponent>(target.Value);
+        var meta = SEntMan.GetComponent<MetaDataComponent>(SEntMan.GetEntity(target.Value));
+        Assert.That(meta.EntityPrototype?.ID, Is.EqualTo(prototype));
+    }
+
+    protected void AssertAnchored(bool anchored = true, NetEntity? target = null)
+    {
+        target ??= Target;
+        if (target == null)
+        {
+            Assert.Fail("No target specified");
+            return;
+        }
+
+        var sXform = SEntMan.GetComponent<TransformComponent>(SEntMan.GetEntity(target.Value));
+        var cXform = CEntMan.GetComponent<TransformComponent>(CEntMan.GetEntity(target.Value));
 
         Assert.Multiple(() =>
         {
@@ -454,7 +484,7 @@ public abstract partial class InteractionTest
         });
     }
 
-    protected void AssertDeleted(bool deleted = true, EntityUid? target = null)
+    protected void AssertDeleted(bool deleted = true, NetEntity? target = null)
     {
         target ??= Target;
         if (target == null)
@@ -465,15 +495,15 @@ public abstract partial class InteractionTest
 
         Assert.Multiple(() =>
         {
-            Assert.That(SEntMan.Deleted(target), Is.EqualTo(deleted));
-            Assert.That(CEntMan.Deleted(target), Is.EqualTo(deleted));
+            Assert.That(SEntMan.Deleted(SEntMan.GetEntity(target)), Is.EqualTo(deleted));
+            Assert.That(CEntMan.Deleted(CEntMan.GetEntity(target)), Is.EqualTo(deleted));
         });
     }
 
     /// <summary>
     /// Assert whether or not the target has the given component.
     /// </summary>
-    protected void AssertComp<T>(bool hasComp = true, EntityUid? target = null)
+    protected void AssertComp<T>(bool hasComp = true, NetEntity? target = null)
     {
         target ??= Target;
         if (target == null)
@@ -482,24 +512,25 @@ public abstract partial class InteractionTest
             return;
         }
 
-        Assert.That(SEntMan.HasComponent<T>(target), Is.EqualTo(hasComp));
+        Assert.That(SEntMan.HasComponent<T>(SEntMan.GetEntity(target)), Is.EqualTo(hasComp));
     }
 
     /// <summary>
     /// Check that the tile at the target position matches some prototype.
     /// </summary>
-    protected async Task AssertTile(string? proto, EntityCoordinates? coords = null)
+    protected async Task AssertTile(string? proto, NetCoordinates? coords = null)
     {
         var targetTile = proto == null
             ? Tile.Empty
             : new Tile(TileMan[proto].TileId);
 
         var tile = Tile.Empty;
-        var pos = (coords ?? TargetCoords).ToMap(SEntMan, Transform);
+        var serverCoords = SEntMan.GetCoordinates(coords ?? TargetCoords);
+        var pos = serverCoords.ToMap(SEntMan, Transform);
         await Server.WaitPost(() =>
         {
             if (MapMan.TryFindGridAt(pos, out _, out var grid))
-                tile = grid.GetTileRef(coords ?? TargetCoords).Tile;
+                tile = grid.GetTileRef(serverCoords).Tile;
         });
 
         Assert.That(tile.TypeId, Is.EqualTo(targetTile.TypeId));
@@ -541,11 +572,12 @@ public abstract partial class InteractionTest
             foreach (var ent in entities)
             {
                 var transform = xformQuery.GetComponent(ent);
+                var netEnt = SEntMan.GetNetEntity(ent);
 
                 if (ent == transform.MapUid
                     || ent == transform.GridUid
-                    || ent == Player
-                    || ent == Target)
+                    || netEnt == Player
+                    || netEnt == Target)
                 {
                     toRemove.Add(ent);
                 }
@@ -646,31 +678,31 @@ public abstract partial class InteractionTest
     /// <summary>
     /// Convenience method to get components on the target. Returns SERVER-SIDE components.
     /// </summary>
-    protected T Comp<T>(EntityUid? target = null) where T : IComponent
+    protected T Comp<T>(NetEntity? target = null) where T : IComponent
     {
         target ??= Target;
         if (target == null)
             Assert.Fail("No target specified");
 
-        return SEntMan.GetComponent<T>(target!.Value);
+        return SEntMan.GetComponent<T>(SEntMan.GetEntity(target!.Value));
     }
 
     /// <summary>
     /// Set the tile at the target position to some prototype.
     /// </summary>
-    protected async Task SetTile(string? proto, EntityCoordinates? coords = null, MapGridComponent? grid = null)
+    protected async Task SetTile(string? proto, NetCoordinates? coords = null, MapGridComponent? grid = null)
     {
         var tile = proto == null
             ? Tile.Empty
             : new Tile(TileMan[proto].TileId);
 
-        var pos = (coords ?? TargetCoords).ToMap(SEntMan, Transform);
+        var pos = SEntMan.GetCoordinates(coords ?? TargetCoords).ToMap(SEntMan, Transform);
 
         await Server.WaitPost(() =>
         {
             if (grid != null || MapMan.TryFindGridAt(pos, out var gridUid, out grid))
             {
-                grid.SetTile(coords ?? TargetCoords, tile);
+                grid.SetTile(SEntMan.GetCoordinates(coords ?? TargetCoords), tile);
                 return;
             }
 
@@ -681,7 +713,7 @@ public abstract partial class InteractionTest
             gridUid = grid.Owner;
             var gridXform = SEntMan.GetComponent<TransformComponent>(gridUid);
             Transform.SetWorldPosition(gridXform, pos.Position);
-            grid.SetTile(coords ?? TargetCoords, tile);
+            grid.SetTile(SEntMan.GetCoordinates(coords ?? TargetCoords), tile);
 
             if (!MapMan.TryFindGridAt(pos, out _, out grid))
                 Assert.Fail("Failed to create grid?");
@@ -743,7 +775,7 @@ public abstract partial class InteractionTest
         await RunTicks(15);
     }
 
-    protected bool TryGetBui(Enum key, [NotNullWhen(true)] out BoundUserInterface? bui, EntityUid? target = null, bool shouldSucceed = true)
+    protected bool TryGetBui(Enum key, [NotNullWhen(true)] out BoundUserInterface? bui, NetEntity? target = null, bool shouldSucceed = true)
     {
         bui = null;
         target ??= Target;
@@ -753,17 +785,19 @@ public abstract partial class InteractionTest
             return false;
         }
 
-        if (!CEntMan.TryGetComponent<ClientUserInterfaceComponent>(target, out var ui))
+        var clientTarget = CEntMan.GetEntity(target);
+
+        if (!CEntMan.TryGetComponent<ClientUserInterfaceComponent>(clientTarget, out var ui))
         {
             if (shouldSucceed)
-                Assert.Fail($"Entity {SEntMan.ToPrettyString(target.Value)} does not have a bui component");
+                Assert.Fail($"Entity {SEntMan.ToPrettyString(SEntMan.GetEntity(target.Value))} does not have a bui component");
             return false;
         }
 
         if (!ui.OpenInterfaces.TryGetValue(key, out bui))
         {
             if (shouldSucceed)
-                Assert.Fail($"Entity {SEntMan.ToPrettyString(target.Value)} does not have an open bui with key {key.GetType()}.{key}.");
+                Assert.Fail($"Entity {SEntMan.ToPrettyString(SEntMan.GetEntity(target.Value))} does not have an open bui with key {key.GetType()}.{key}.");
             return false;
         }
 
@@ -909,7 +943,7 @@ public abstract partial class InteractionTest
 
     #region Power
 
-    protected void ToggleNeedPower(EntityUid? target = null)
+    protected void ToggleNeedPower(NetEntity? target = null)
     {
         var comp = Comp<ApcPowerReceiverComponent>(target);
         comp.NeedsPower = !comp.NeedsPower;
@@ -963,8 +997,8 @@ public abstract partial class InteractionTest
     protected async Task PressKey(
         BoundKeyFunction key,
         int ticks = 1,
-        EntityCoordinates? coordinates = null,
-        EntityUid cursorEntity = default)
+        NetCoordinates? coordinates = null,
+        NetEntity cursorEntity = default)
     {
         await SetKey(key, BoundKeyState.Down, coordinates, cursorEntity);
         await RunTicks(ticks);
@@ -978,15 +1012,20 @@ public abstract partial class InteractionTest
     protected async Task SetKey(
         BoundKeyFunction key,
         BoundKeyState state,
-        EntityCoordinates? coordinates = null,
-        EntityUid cursorEntity = default)
+        NetCoordinates? coordinates = null,
+        NetEntity cursorEntity = default)
     {
         var coords = coordinates ?? TargetCoords;
         ScreenCoordinates screen = default;
 
         var funcId = InputManager.NetworkBindMap.KeyFunctionID(key);
-        var message = new FullInputCmdMessage(CTiming.CurTick, CTiming.TickFraction, funcId, state,
-            coords, screen, cursorEntity);
+        var message = new ClientFullInputCmdMessage(CTiming.CurTick, CTiming.TickFraction, funcId)
+        {
+            State = state,
+            Coordinates = CEntMan.GetCoordinates(coords),
+            ScreenCoordinates = screen,
+            Uid = CEntMan.GetEntity(cursorEntity),
+        };
 
         await Client.WaitPost(() => InputSystem.HandleInputCommand(ClientSession, key, message));
     }
index ce2c4b698170b893dff26e3172c735e9a5032469..a3119a1c30cf061abb6f2c78de068aee066b88a6 100644 (file)
@@ -53,22 +53,24 @@ public abstract partial class InteractionTest
     /// Target coordinates. Note that this does not necessarily correspond to the position of the <see cref="Target"/>
     /// entity.
     /// </summary>
-    protected EntityCoordinates TargetCoords;
+    protected NetCoordinates TargetCoords;
 
     /// <summary>
     /// Initial player coordinates. Note that this does not necessarily correspond to the position of the
     /// <see cref="Player"/> entity.
     /// </summary>
-    protected EntityCoordinates PlayerCoords;
+    protected NetCoordinates PlayerCoords;
 
     /// <summary>
     /// The player entity that performs all these interactions. Defaults to an admin-observer with 1 hand.
     /// </summary>
-    protected EntityUid Player;
+    protected NetEntity Player;
 
     protected ICommonSession ClientSession = default!;
     protected IPlayerSession ServerSession = default!;
 
+    public EntityUid? ClientTarget;
+
     /// <summary>
     /// The current target entity. This is the default entity for various helper functions.
     /// </summary>
@@ -77,7 +79,7 @@ public abstract partial class InteractionTest
     /// interactions often swap out entities, and there are helper methods that attempt to automatically upddate
     /// the target entity. See <see cref="CheckTargetChange"/>
     /// </remarks>
-    protected EntityUid? Target;
+    protected NetEntity? Target;
 
     /// <summary>
     /// When attempting to start construction, this is the client-side ID of the construction ghost.
@@ -174,8 +176,8 @@ public abstract partial class InteractionTest
 
         // Setup map.
         await Pair.CreateTestMap();
-        PlayerCoords = MapData.GridCoords.Offset(new Vector2(0.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan);
-        TargetCoords = MapData.GridCoords.Offset(new Vector2(1.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan);
+        PlayerCoords = SEntMan.GetNetCoordinates(MapData.GridCoords.Offset(new Vector2(0.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan));
+        TargetCoords = SEntMan.GetNetCoordinates(MapData.GridCoords.Offset(new Vector2(1.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan));
         await SetTile(Plating, grid: MapData.MapGrid);
 
         // Get player data
@@ -195,15 +197,16 @@ public abstract partial class InteractionTest
             SEntMan.System<SharedMindSystem>().WipeMind(ServerSession.ContentData()?.Mind);
 
             old = cPlayerMan.LocalPlayer.ControlledEntity;
-            Player = SEntMan.SpawnEntity(PlayerPrototype, PlayerCoords);
-            Actor.Attach(Player, ServerSession);
-            Hands = SEntMan.GetComponent<HandsComponent>(Player);
-            DoAfters = SEntMan.GetComponent<DoAfterComponent>(Player);
+            Player = SEntMan.GetNetEntity(SEntMan.SpawnEntity(PlayerPrototype, SEntMan.GetCoordinates(PlayerCoords)));
+            var serverPlayerEnt = SEntMan.GetEntity(Player);
+            Actor.Attach(serverPlayerEnt, ServerSession);
+            Hands = SEntMan.GetComponent<HandsComponent>(serverPlayerEnt);
+            DoAfters = SEntMan.GetComponent<DoAfterComponent>(serverPlayerEnt);
         });
 
         // Check player got attached.
         await RunTicks(5);
-        Assert.That(cPlayerMan.LocalPlayer.ControlledEntity, Is.EqualTo(Player));
+        Assert.That(CEntMan.GetNetEntity(cPlayerMan.LocalPlayer.ControlledEntity), Is.EqualTo(Player));
 
         // Delete old player entity.
         await Server.WaitPost(() =>
@@ -216,7 +219,7 @@ public abstract partial class InteractionTest
         await Server.WaitPost(() =>
         {
             var bodySystem = SEntMan.System<BodySystem>();
-            var hands = bodySystem.GetBodyChildrenOfType(Player, BodyPartType.Hand).ToArray();
+            var hands = bodySystem.GetBodyChildrenOfType(SEntMan.GetEntity(Player), BodyPartType.Hand).ToArray();
 
             for (var i = 1; i < hands.Length; i++)
             {
@@ -229,8 +232,8 @@ public abstract partial class InteractionTest
         await Pair.ReallyBeIdle(5);
         Assert.Multiple(() =>
         {
-            Assert.That(cPlayerMan.LocalPlayer.ControlledEntity, Is.EqualTo(Player));
-            Assert.That(sPlayerMan.GetSessionByUserId(ClientSession.UserId).AttachedEntity, Is.EqualTo(Player));
+            Assert.That(CEntMan.GetNetEntity(cPlayerMan.LocalPlayer.ControlledEntity), Is.EqualTo(Player));
+            Assert.That(sPlayerMan.GetSessionByUserId(ClientSession.UserId).AttachedEntity, Is.EqualTo(SEntMan.GetEntity(Player)));
         });
     }
 
index 810a0c24cc2d3d0801030ccae8c496ef6f3fd4d3..797f77e721024d558cea168b5eadf15ad6cdce91 100644 (file)
@@ -12,8 +12,8 @@ namespace Content.IntegrationTests.Tests.Interaction;
 /// </summary>
 public sealed class InteractionTestSystem : EntitySystem
 {
-    public Dictionary<int, EntityUid> Ghosts = new();
-    public Dictionary<EntityUid, EntityUid> EntChanges = new();
+    public Dictionary<int, NetEntity> Ghosts = new();
+    public Dictionary<NetEntity, NetEntity> EntChanges = new();
 
     public override void Initialize()
     {
@@ -23,7 +23,8 @@ public sealed class InteractionTestSystem : EntitySystem
 
     private void OnEntChange(ConstructionChangeEntityEvent ev)
     {
-        EntChanges[ev.Old] = ev.New;
+        Assert.That(!IsClientSide(ev.Old) && !IsClientSide(ev.New));
+        EntChanges[GetNetEntity(ev.Old)] = GetNetEntity(ev.New);
     }
 
     private void OnAck(AckStructureConstructionMessage ev)
index 178439d8e29cbab30e4db809b4a2441f80be7b81..553b031c2b7112bca21cb2e707eda5df21ba6651 100644 (file)
@@ -27,16 +27,18 @@ public abstract class MovementTest : InteractionTest
     public override async Task Setup()
     {
         await base.Setup();
+        var pCoords = SEntMan.GetCoordinates(PlayerCoords);
+
         for (var i = -Tiles; i <= Tiles; i++)
         {
-            await SetTile(Plating, PlayerCoords.Offset(new Vector2(i, 0)), MapData.MapGrid);
+            await SetTile(Plating, SEntMan.GetNetCoordinates(pCoords.Offset(new Vector2(i, 0))), MapData.MapGrid);
         }
         AssertGridCount(1);
 
         if (AddWalls)
         {
-            await SpawnEntity("WallSolid", PlayerCoords.Offset(new Vector2(-Tiles, 0)));
-            await SpawnEntity("WallSolid", PlayerCoords.Offset(new Vector2(Tiles, 0)));
+            await SpawnEntity("WallSolid", pCoords.Offset(new Vector2(-Tiles, 0)));
+            await SpawnEntity("WallSolid", pCoords.Offset(new Vector2(Tiles, 0)));
         }
 
         await AddGravity();
@@ -46,7 +48,7 @@ public abstract class MovementTest : InteractionTest
     /// <summary>
     ///     Get the relative horizontal between two entities. Defaults to using the target & player entity.
     /// </summary>
-    protected float Delta(EntityUid? target = null, EntityUid? other = null)
+    protected float Delta(NetEntity? target = null, NetEntity? other = null)
     {
         target ??= Target;
         if (target == null)
@@ -55,7 +57,7 @@ public abstract class MovementTest : InteractionTest
             return 0;
         }
 
-        var delta = Transform.GetWorldPosition(target.Value) - Transform.GetWorldPosition(other ?? Player);
+        var delta = Transform.GetWorldPosition(SEntMan.GetEntity(target.Value)) - Transform.GetWorldPosition(SEntMan.GetEntity(other ?? Player));
         return delta.X;
     }
 }
index e6ddd1a90c45480f6f3bee480bc02e2bd256ba1d..ec60af5d4232ce09c30b4123caa687e62d02f003 100644 (file)
@@ -77,7 +77,7 @@ namespace Content.IntegrationTests.Tests.Networking
 
             await client.WaitPost(() =>
             {
-                clientComponent = cEntityManager.GetComponent<PredictionTestComponent>(serverEnt);
+                clientComponent = cEntityManager.GetComponent<PredictionTestComponent>(cEntityManager.GetEntity(sEntityManager.GetNetEntity(serverEnt)));
             });
 
             var baseTick = sGameTiming.CurTick.Value;
@@ -110,7 +110,7 @@ namespace Content.IntegrationTests.Tests.Networking
                 Assert.That(clientComponent.Foo, Is.False);
                 await client.WaitPost(() =>
                 {
-                    cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, true));
+                    cEntityManager.RaisePredictiveEvent(new SetFooMessage(sEntityManager.GetNetEntity(serverEnt), true));
                 });
                 Assert.That(clientComponent.Foo, Is.True);
 
@@ -190,7 +190,7 @@ namespace Content.IntegrationTests.Tests.Networking
                 // Send event to server to change flag again, this time to disable it..
                 await client.WaitPost(() =>
                 {
-                    cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, false));
+                    cEntityManager.RaisePredictiveEvent(new SetFooMessage(sEntityManager.GetNetEntity(serverEnt), false));
 
                     Assert.That(clientComponent.Foo, Is.False);
                 });
@@ -270,7 +270,7 @@ namespace Content.IntegrationTests.Tests.Networking
                 // Send first event to disable the flag (reminder: it never got accepted by the server).
                 await client.WaitPost(() =>
                 {
-                    cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, false));
+                    cEntityManager.RaisePredictiveEvent(new SetFooMessage(sEntityManager.GetNetEntity(serverEnt), false));
 
                     Assert.That(clientComponent.Foo, Is.False);
                 });
@@ -298,7 +298,7 @@ namespace Content.IntegrationTests.Tests.Networking
                 // Send another event, to re-enable it.
                 await client.WaitPost(() =>
                 {
-                    cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, true));
+                    cEntityManager.RaisePredictiveEvent(new SetFooMessage(sEntityManager.GetNetEntity(serverEnt), true));
 
                     Assert.That(clientComponent.Foo, Is.True);
                 });
@@ -406,12 +406,14 @@ namespace Content.IntegrationTests.Tests.Networking
 
             private void HandleMessage(SetFooMessage message, EntitySessionEventArgs args)
             {
-                var component = EntityManager.GetComponent<PredictionTestComponent>(message.Uid);
+                var uid = GetEntity(message.Uid);
+
+                var component = EntityManager.GetComponent<PredictionTestComponent>(uid);
                 var old = component.Foo;
                 if (Allow)
                 {
                     component.Foo = message.NewFoo;
-                    Dirty(message.Uid, component);
+                    Dirty(uid, component);
                 }
 
                 EventTriggerList.Add((_gameTiming.CurTick, _gameTiming.IsFirstTimePredicted, old, component.Foo, message.NewFoo));
@@ -420,13 +422,13 @@ namespace Content.IntegrationTests.Tests.Networking
 
         public sealed class SetFooMessage : EntityEventArgs
         {
-            public SetFooMessage(EntityUid uid, bool newFoo)
+            public SetFooMessage(NetEntity uid, bool newFoo)
             {
                 Uid = uid;
                 NewFoo = newFoo;
             }
 
-            public EntityUid Uid { get; }
+            public NetEntity Uid { get; }
             public bool NewFoo { get; }
         }
     }
index 7dafdf551cc1b689d3fd20f276aae55b83b10512..65f4a9d488af9092ee9e39205429885b10e445b2 100644 (file)
@@ -18,7 +18,7 @@ public sealed class ModularGrenadeTests : InteractionTest
     {
         await PlaceInHands(Steel, 5);
         await CraftItem("ModularGrenadeRecipe");
-        Target = await FindEntity("ModularGrenade");
+        Target = SEntMan.GetNetEntity(await FindEntity("ModularGrenade"));
 
         await Drop();
         await Interact(Cable);
index 53ae1e63b487b488422f5356e6359ab680faa6a3..d64961b0becb73fc28399e8ddad432915009a229 100644 (file)
@@ -34,7 +34,7 @@ public sealed class SlippingTest : MovementTest
         // Player is to the left of the banana peel and has not slipped.
 #pragma warning disable NUnit2045
         Assert.That(Delta(), Is.GreaterThan(0.5f));
-        Assert.That(sys.Slipped, Does.Not.Contain(Player));
+        Assert.That(sys.Slipped, Does.Not.Contain(SEntMan.GetEntity(Player)));
 #pragma warning restore NUnit2045
 
         // Walking over the banana slowly does not trigger a slip.
@@ -42,14 +42,14 @@ public sealed class SlippingTest : MovementTest
         await Move(DirectionFlag.East, 1f);
 #pragma warning disable NUnit2045
         Assert.That(Delta(), Is.LessThan(0.5f));
-        Assert.That(sys.Slipped, Does.Not.Contain(Player));
+        Assert.That(sys.Slipped, Does.Not.Contain(SEntMan.GetEntity(Player)));
 #pragma warning restore NUnit2045
         AssertComp<KnockedDownComponent>(false, Player);
 
         // Moving at normal speeds does trigger a slip.
         await SetKey(EngineKeyFunctions.Walk, BoundKeyState.Up);
         await Move(DirectionFlag.West, 1f);
-        Assert.That(sys.Slipped, Does.Contain(Player));
+        Assert.That(sys.Slipped, Does.Contain(SEntMan.GetEntity(Player)));
         AssertComp<KnockedDownComponent>(true, Player);
     }
 }
index c4b09a8aa46c460c1fdbaec5d7193e5eab02ecc4..0a2af88887a8f85b522d93f81fd3ae2a56e9a6bc 100644 (file)
@@ -42,7 +42,7 @@ public sealed class TileConstructionTests : InteractionTest
 
         // Place Lattice
         var oldPos = TargetCoords;
-        TargetCoords = new EntityCoordinates(MapData.MapUid, 1, 0);
+        TargetCoords = SEntMan.GetNetCoordinates(new EntityCoordinates(MapData.MapUid, 1, 0));
         await Interact(Rod);
         TargetCoords = oldPos;
         await AssertTile(Lattice);
@@ -75,7 +75,7 @@ public sealed class TileConstructionTests : InteractionTest
 
         // Space -> Lattice
         var oldPos = TargetCoords;
-        TargetCoords = new EntityCoordinates(MapData.MapUid, 1, 0);
+        TargetCoords = SEntMan.GetNetCoordinates(new EntityCoordinates(MapData.MapUid, 1, 0));
         await Interact(Rod);
         TargetCoords = oldPos;
         await AssertTile(Lattice);
index e8fc837a7c31cf4ba2ef3339a7a4b161fa446f98..a41c0839da1dd93ed177643ac48464282ecfea59 100644 (file)
@@ -46,7 +46,7 @@ public sealed class AccessOverriderSystem : SharedAccessOverriderSystem
         if (!_interactionSystem.InRangeUnobstructed(args.User, (EntityUid) args.Target))
             return;
 
-        var doAfterEventArgs = new DoAfterArgs(args.User, component.DoAfterTime, new AccessOverriderDoAfterEvent(), uid, target: args.Target, used: uid)
+        var doAfterEventArgs = new DoAfterArgs(EntityManager, args.User, component.DoAfterTime, new AccessOverriderDoAfterEvent(), uid, target: args.Target, used: uid)
         {
             BreakOnTargetMove = true,
             BreakOnUserMove = true,
index 1b5037e8d519dd666ab932225e76dfaac8384b0e..b0772fcc32b200b18189e3614edf83048e0a5815 100644 (file)
@@ -66,7 +66,7 @@ namespace Content.Server.Access.Systems
                 return;
 
             var state = new AgentIDCardBoundUserInterfaceState(idCard.FullName ?? "", idCard.JobTitle ?? "", component.Icons);
-            UserInterfaceSystem.SetUiState(ui, state, args.Session);
+            _uiSystem.SetUiState(ui, state, args.Session);
         }
 
         private void OnJobChanged(EntityUid uid, AgentIDCardComponent comp, AgentIDCardJobChangedMessage args)
index 53af89bf9d2d106eaac36a80bf79fa8999c52152..235a1ed871b9fa7b0f5a435257c12f1926a53d2e 100644 (file)
@@ -7,6 +7,8 @@ namespace Content.Server.Administration.Commands
     [AdminCommand(AdminFlags.Admin)]
     public sealed class AddBodyPartCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "addbodypart";
         public string Description => "Adds a given entity to a containing body.";
         public string Help => "Usage: addbodypart <entity uid> <body uid> <part slot>";
@@ -19,20 +21,21 @@ namespace Content.Server.Administration.Commands
                 return;
             }
 
-            if (!EntityUid.TryParse(args[0], out var childId))
+            if (!NetEntity.TryParse(args[0], out var childNetId))
             {
                 shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
                 return;
             }
 
-            if (!EntityUid.TryParse(args[1], out var parentId))
+            if (!NetEntity.TryParse(args[1], out var parentNetId))
             {
                 shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
                 return;
             }
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
-            var bodySystem = entityManager.System<BodySystem>();
+            var childId = _entManager.GetEntity(childNetId);
+            var parentId = _entManager.GetEntity(parentNetId);
+            var bodySystem = _entManager.System<BodySystem>();
 
             if (bodySystem.TryCreatePartSlotAndAttach(parentId, args[2], childId))
             {
index c91ed6512e13d9539971875336097c859871225b..4c562d606d441fd1ff0140565e4de316fa2277e0 100644 (file)
@@ -8,6 +8,8 @@ namespace Content.Server.Administration.Commands
     [AdminCommand(AdminFlags.Admin)]
     public sealed class AddEntityStorageCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "addstorage";
         public string Description => "Adds a given entity to a containing storage.";
         public string Help => "Usage: addstorage <entity uid> <storage uid>";
@@ -20,24 +22,22 @@ namespace Content.Server.Administration.Commands
                 return;
             }
 
-            if (!EntityUid.TryParse(args[0], out var entityUid))
+            if (!NetEntity.TryParse(args[0], out var entityUidNet) || !_entManager.TryGetEntity(entityUidNet, out var entityUid))
             {
                 shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
                 return;
             }
 
-            if (!EntityUid.TryParse(args[1], out var storageUid))
+            if (!NetEntity.TryParse(args[1], out var storageUidNet) || !_entManager.TryGetEntity(storageUidNet, out var storageUid))
             {
                 shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
                 return;
             }
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
-
-            if (entityManager.HasComponent<EntityStorageComponent>(storageUid) &&
-                entityManager.EntitySysManager.TryGetEntitySystem<EntityStorageSystem>(out var storageSys))
+            if (_entManager.HasComponent<EntityStorageComponent>(storageUid) &&
+                _entManager.EntitySysManager.TryGetEntitySystem<EntityStorageSystem>(out var storageSys))
             {
-                storageSys.Insert(entityUid, storageUid);
+                storageSys.Insert(entityUid.Value, storageUid.Value);
             }
             else
             {
index 73ec8ffd813ee5d8f1db287ed1134869428d17db..0f7a442bb13152aca3adf38040cc1053099d8054 100644 (file)
@@ -7,6 +7,8 @@ namespace Content.Server.Administration.Commands
     [AdminCommand(AdminFlags.Admin)]
     public sealed class AddMechanismCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "addmechanism";
         public string Description => "Adds a given entity to a containing body.";
         public string Help => "Usage: addmechanism <entity uid> <bodypart uid>";
@@ -19,20 +21,19 @@ namespace Content.Server.Administration.Commands
                 return;
             }
 
-            if (!EntityUid.TryParse(args[0], out var organId))
+            if (!NetEntity.TryParse(args[0], out var organIdNet) || !_entManager.TryGetEntity(organIdNet, out var organId))
             {
                 shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
                 return;
             }
 
-            if (!EntityUid.TryParse(args[1], out var partId))
+            if (!NetEntity.TryParse(args[1], out var partIdNet) || !_entManager.TryGetEntity(partIdNet, out var partId))
             {
                 shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
                 return;
             }
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
-            var bodySystem = entityManager.System<BodySystem>();
+            var bodySystem = _entManager.System<BodySystem>();
 
             if (bodySystem.AddOrganToFirstValidSlot(organId, partId))
             {
index 40544327a9fe2f011a8075284b75839ea8a55b06..6223df7a6cb0117deca277ebd4ea64bac8d0fc99 100644 (file)
@@ -8,6 +8,8 @@ namespace Content.Server.Administration.Commands;
 [AdminCommand(AdminFlags.Fun)]
 public sealed class AddPolymorphActionCommand : IConsoleCommand
 {
+    [Dependency] private readonly IEntityManager _entityManager = default!;
+
     public string Command => "addpolymorphaction";
 
     public string Description => Loc.GetString("add-polymorph-action-command-description");
@@ -22,16 +24,15 @@ public sealed class AddPolymorphActionCommand : IConsoleCommand
             return;
         }
 
-        if (!EntityUid.TryParse(args[0], out var entityUid))
+        if (!NetEntity.TryParse(args[0], out var entityUidNet) || !_entityManager.TryGetEntity(entityUidNet, out var entityUid))
         {
             shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
             return;
         }
 
-        var entityManager = IoCManager.Resolve<IEntityManager>();
-        var polySystem = entityManager.EntitySysManager.GetEntitySystem<PolymorphSystem>();
+        var polySystem = _entityManager.EntitySysManager.GetEntitySystem<PolymorphSystem>();
 
-        entityManager.EnsureComponent<PolymorphableComponent>(entityUid);
-        polySystem.CreatePolymorphAction(args[1], entityUid);
+        _entityManager.EnsureComponent<PolymorphableComponent>(entityUid.Value);
+        polySystem.CreatePolymorphAction(args[1], entityUid.Value);
     }
 }
index 795de6f91f0e9df46f246eb3f48f48623031d67d..f18dd3e99d3fa3251edff477d6377d7dd44073c2 100644 (file)
@@ -14,6 +14,9 @@ namespace Content.Server.Administration.Commands
     [AdminCommand(AdminFlags.Admin)]
     public sealed class AddReagent : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+        [Dependency] private readonly IPrototypeManager _protomanager = default!;
+
         public string Command => "addreagent";
         public string Description => "Add (or remove) some amount of reagent from some solution.";
         public string Help => $"Usage: {Command} <target> <solution> <reagent> <quantity>";
@@ -26,13 +29,13 @@ namespace Content.Server.Administration.Commands
                 return;
             }
 
-            if (!EntityUid.TryParse(args[0], out var uid))
+            if (!NetEntity.TryParse(args[0], out var uidNet) || !_entManager.TryGetEntity(uidNet, out var uid))
             {
                 shell.WriteLine($"Invalid entity id.");
                 return;
             }
 
-            if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent? man))
+            if (!_entManager.TryGetComponent(uid, out SolutionContainerManagerComponent? man))
             {
                 shell.WriteLine($"Entity does not have any solutions.");
                 return;
@@ -46,7 +49,7 @@ namespace Content.Server.Administration.Commands
             }
             var solution = man.Solutions[args[1]];
 
-            if (!IoCManager.Resolve<IPrototypeManager>().HasIndex<ReagentPrototype>(args[2]))
+            if (!_protomanager.HasIndex<ReagentPrototype>(args[2]))
             {
                 shell.WriteLine($"Unknown reagent prototype");
                 return;
@@ -60,9 +63,9 @@ namespace Content.Server.Administration.Commands
             var quantity = FixedPoint2.New(MathF.Abs(quantityFloat));
 
             if (quantityFloat > 0)
-                EntitySystem.Get<SolutionContainerSystem>().TryAddReagent(uid, solution, args[2], quantity, out var _);
+                _entManager.System<SolutionContainerSystem>().TryAddReagent(uid.Value, solution, args[2], quantity, out _);
             else
-                EntitySystem.Get<SolutionContainerSystem>().RemoveReagent(uid, solution, args[2], quantity);
+                _entManager.System<SolutionContainerSystem>().RemoveReagent(uid.Value, solution, args[2], quantity);
         }
     }
 }
index a0c04da38ef7909761c848466093fdf292919a17..7d7e0ab6ce9fc473dab73f105351c7e16123432d 100644 (file)
@@ -7,6 +7,8 @@ namespace Content.Server.Administration.Commands;
 [AdminCommand(AdminFlags.Admin)]
 public sealed class ClearBluespaceLockerLinks : IConsoleCommand
 {
+    [Dependency] private readonly IEntityManager _entityManager = default!;
+
     public string Command => "clearbluespacelockerlinks";
     public string Description => "Removes the bluespace links of the given uid. Does not remove links this uid is the target of.";
     public string Help => "Usage: clearbluespacelockerlinks <storage uid>";
@@ -19,15 +21,12 @@ public sealed class ClearBluespaceLockerLinks : IConsoleCommand
             return;
         }
 
-        if (!EntityUid.TryParse(args[0], out var entityUid))
+        if (!NetEntity.TryParse(args[0], out var entityUidNet) || !_entityManager.TryGetEntity(entityUidNet, out var entityUid))
         {
             shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
             return;
         }
 
-        var entityManager = IoCManager.Resolve<IEntityManager>();
-
-        if (entityManager.TryGetComponent<BluespaceLockerComponent>(entityUid, out var originComponent))
-            entityManager.RemoveComponent(entityUid, originComponent);
+        _entityManager.RemoveComponent<BluespaceLockerComponent>(entityUid.Value);
     }
 }
index daf25fc6cc7caec0a8a89f82b01fa102a27fda51..0ed8689d7fcddcad76dc467fff4d7f2e9e9ca208 100644 (file)
@@ -6,28 +6,29 @@ namespace Content.Server.Administration.Commands;
 [AdminCommand(AdminFlags.Debug)]
 public sealed class DirtyCommand : IConsoleCommand
 {
+    [Dependency] private readonly IEntityManager _entManager = default!;
+
     public string Command => "dirty";
     public string Description => "Marks all components on an entity as dirty, if not specified, dirties everything";
     public string Help => $"Usage: {Command} [entityUid]";
 
     public async void Execute(IConsoleShell shell, string argStr, string[] args)
     {
-        var entityManager = IoCManager.Resolve<IEntityManager>();
         switch (args.Length)
         {
             case 0:
-                foreach (var entity in entityManager.GetEntities())
+                foreach (var entity in _entManager.GetEntities())
                 {
-                    DirtyAll(entityManager, entity);
+                    DirtyAll(_entManager, entity);
                 }
                 break;
             case 1:
-                if (!EntityUid.TryParse(args[0], out var parsedTarget))
+                if (!NetEntity.TryParse(args[0], out var parsedTarget))
                 {
                     shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
                     return;
                 }
-                DirtyAll(entityManager, parsedTarget);
+                DirtyAll(_entManager, _entManager.GetEntity(parsedTarget));
                 break;
             default:
                 shell.WriteLine(Loc.GetString("shell-wrong-arguments-number"));
index 59d16745dd37d4b9b9f398eca1cdd91fbbf2bf0d..d2f7e4de1591e65145a7ae650926df5c7a76858f 100644 (file)
@@ -7,6 +7,8 @@ namespace Content.Server.Administration.Commands;
 [AdminCommand(AdminFlags.Admin)]
 public sealed class LinkBluespaceLocker : IConsoleCommand
 {
+    [Dependency] private readonly IEntityManager _entManager = default!;
+
     public string Command => "linkbluespacelocker";
     public string Description => "Links an entity, the target, to another as a bluespace locker target.";
     public string Help => "Usage: linkbluespacelocker <two-way link> <origin storage uid> <target storage uid>";
@@ -19,44 +21,42 @@ public sealed class LinkBluespaceLocker : IConsoleCommand
             return;
         }
 
-        if (!Boolean.TryParse(args[0], out var bidirectional))
+        if (!bool.TryParse(args[0], out var bidirectional))
         {
             shell.WriteError(Loc.GetString("shell-invalid-bool"));
             return;
         }
 
-        if (!EntityUid.TryParse(args[1], out var originUid))
+        if (!NetEntity.TryParse(args[1], out var originUidNet) || !_entManager.TryGetEntity(originUidNet, out var originUid))
         {
             shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
             return;
         }
 
-        if (!EntityUid.TryParse(args[2], out var targetUid))
+        if (!NetEntity.TryParse(args[2], out var targetUidNet) || !_entManager.TryGetEntity(targetUidNet, out var targetUid))
         {
             shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
             return;
         }
 
-        var entityManager = IoCManager.Resolve<IEntityManager>();
-
-        if (!entityManager.TryGetComponent<EntityStorageComponent>(originUid, out var originComponent))
+        if (!_entManager.HasComponent<EntityStorageComponent>(originUid))
         {
             shell.WriteError(Loc.GetString("shell-entity-with-uid-lacks-component", ("uid", originUid), ("componentName", nameof(EntityStorageComponent))));
             return;
         }
 
-        if (!entityManager.TryGetComponent<EntityStorageComponent>(targetUid, out var targetComponent))
+        if (!_entManager.HasComponent<EntityStorageComponent>(targetUid))
         {
             shell.WriteError(Loc.GetString("shell-entity-with-uid-lacks-component", ("uid", targetUid), ("componentName", nameof(EntityStorageComponent))));
             return;
         }
 
-        entityManager.EnsureComponent<BluespaceLockerComponent>(originUid, out var originBluespaceComponent);
-        originBluespaceComponent.BluespaceLinks.Add(targetUid);
-        entityManager.EnsureComponent<BluespaceLockerComponent>(targetUid, out var targetBluespaceComponent);
+        _entManager.EnsureComponent<BluespaceLockerComponent>(originUid.Value, out var originBluespaceComponent);
+        originBluespaceComponent.BluespaceLinks.Add(targetUid.Value);
+        _entManager.EnsureComponent<BluespaceLockerComponent>(targetUid.Value, out var targetBluespaceComponent);
         if (bidirectional)
         {
-            targetBluespaceComponent.BluespaceLinks.Add(originUid);
+            targetBluespaceComponent.BluespaceLinks.Add(originUid.Value);
         }
         else if (targetBluespaceComponent.BluespaceLinks.Count == 0)
         {
index e89bd5688185794f1201baabffb3e2d340ceefb8..2f17bd9d70aa17615a45f6cd1ae632b8945a6254 100644 (file)
@@ -46,7 +46,7 @@ public sealed class OSay : LocalizedCommands
 
         var chatType = (InGameICChatType) Enum.Parse(typeof(InGameICChatType), args[1]);
 
-        if (!EntityUid.TryParse(args[0], out var source) || !_entityManager.EntityExists(source))
+        if (!NetEntity.TryParse(args[0], out var sourceNet) || !_entityManager.TryGetEntity(sourceNet, out var source) || !_entityManager.EntityExists(source))
         {
             shell.WriteLine(Loc.GetString("osay-command-error-euid", ("arg", args[0])));
             return;
@@ -56,7 +56,7 @@ public sealed class OSay : LocalizedCommands
         if (string.IsNullOrEmpty(message))
             return;
 
-        _entityManager.System<ChatSystem>().TrySendInGameICMessage(source, message, chatType, false);
-        _adminLogger.Add(LogType.Action, LogImpact.Low, $"{(shell.Player != null ? shell.Player.Name : "An administrator")} forced {_entityManager.ToPrettyString(source)} to {args[1]}: {message}");
+        _entityManager.System<ChatSystem>().TrySendInGameICMessage(source.Value, message, chatType, false);
+        _adminLogger.Add(LogType.Action, LogImpact.Low, $"{(shell.Player != null ? shell.Player.Name : "An administrator")} forced {_entityManager.ToPrettyString(source.Value)} to {args[1]}: {message}");
     }
 }
index fbfa62ad6aea430464bc1cb33e71c7141f574b1b..179f75d62db5f4f429eb11f4787a1c48f0fe94fa 100644 (file)
@@ -7,6 +7,8 @@ namespace Content.Server.Administration.Commands
     [AdminCommand(AdminFlags.Admin)]
     public sealed class RemoveBodyPartCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "rmbodypart";
         public string Description => "Removes a given entity from it's containing body, if any.";
         public string Help => "Usage: rmbodypart <uid>";
@@ -19,18 +21,17 @@ namespace Content.Server.Administration.Commands
                 return;
             }
 
-            if (!EntityUid.TryParse(args[0], out var entityUid))
+            if (!NetEntity.TryParse(args[0], out var entityUidNet) || !_entManager.TryGetEntity(entityUidNet, out var entityUid))
             {
                 shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
                 return;
             }
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
-            var bodySystem = entityManager.System<BodySystem>();
+            var bodySystem = _entManager.System<BodySystem>();
 
             if (bodySystem.DropPart(entityUid))
             {
-                shell.WriteLine($"Removed body part {entityManager.ToPrettyString(entityUid)}.");
+                shell.WriteLine($"Removed body part {_entManager.ToPrettyString(entityUid.Value)}.");
             }
             else
             {
index 990fc1dd0eba8a8c1b82cf67bda397f8ece4c8f4..48663f579d62a43a422f5519be56ce5013fc6fd2 100644 (file)
@@ -8,6 +8,8 @@ namespace Content.Server.Administration.Commands
     [AdminCommand(AdminFlags.Admin)]
     public sealed class RemoveEntityStorageCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "rmstorage";
         public string Description => "Removes a given entity from it's containing storage, if any.";
         public string Help => "Usage: rmstorage <uid>";
@@ -20,22 +22,23 @@ namespace Content.Server.Administration.Commands
                 return;
             }
 
-            if (!EntityUid.TryParse(args[0], out var entityUid))
+            if (!NetEntity.TryParse(args[0], out var entityNet) || !_entManager.TryGetEntity(entityNet, out var entityUid))
             {
                 shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
                 return;
             }
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
+            if (!_entManager.EntitySysManager.TryGetEntitySystem<EntityStorageSystem>(out var entstorage))
+                return;
 
-            if (!entityManager.EntitySysManager.TryGetEntitySystem<EntityStorageSystem>(out var entstorage)) return;
-            if (!entityManager.TryGetComponent<TransformComponent>(entityUid, out var transform)) return;
+            if (!_entManager.TryGetComponent<TransformComponent>(entityUid, out var transform))
+                return;
 
             var parent = transform.ParentUid;
 
-            if (entityManager.TryGetComponent<EntityStorageComponent>(parent, out var storage))
+            if (_entManager.TryGetComponent<EntityStorageComponent>(parent, out var storage))
             {
-                entstorage.Remove(entityUid, storage.Owner, storage);
+                entstorage.Remove(entityUid.Value, storage.Owner, storage);
             }
             else
             {
index 37ccc97fdd451389b04f5208b66a1e5ef968c110..cabf6c582b610158910e245d1ba6423a41bcfab4 100644 (file)
@@ -7,6 +7,8 @@ namespace Content.Server.Administration.Commands
     [AdminCommand(AdminFlags.Admin)]
     public sealed class RemoveMechanismCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "rmmechanism";
         public string Description => "Removes a given entity from it's containing bodypart, if any.";
         public string Help => "Usage: rmmechanism <uid>";
@@ -19,18 +21,17 @@ namespace Content.Server.Administration.Commands
                 return;
             }
 
-            if (!EntityUid.TryParse(args[0], out var entityUid))
+            if (!NetEntity.TryParse(args[0], out var entityNet) || !_entManager.TryGetEntity(entityNet, out var entityUid))
             {
                 shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
                 return;
             }
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
-            var bodySystem = entityManager.System<BodySystem>();
+            var bodySystem = _entManager.System<BodySystem>();
 
             if (bodySystem.DropOrgan(entityUid))
             {
-                shell.WriteLine($"Removed organ {entityManager.ToPrettyString(entityUid)}");
+                shell.WriteLine($"Removed organ {_entManager.ToPrettyString(entityUid.Value)}");
             }
             else
             {
index 983d89e3d9a4955d34273d4579b87253f5d6f16f..0c439227ff9ec73083ae67c5c1354f818cb6f3ac 100644 (file)
@@ -9,6 +9,8 @@ namespace Content.Server.Administration.Commands
     [AdminCommand(AdminFlags.Fun)]
     public sealed class SetSolutionCapacity : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "setsolutioncapacity";
         public string Description => "Set the capacity (maximum volume) of some solution.";
         public string Help => $"Usage: {Command} <target> <solution> <new capacity>";
@@ -21,13 +23,13 @@ namespace Content.Server.Administration.Commands
                 return;
             }
 
-            if (!EntityUid.TryParse(args[0], out var uid))
+            if (!NetEntity.TryParse(args[0], out var uidNet))
             {
                 shell.WriteLine($"Invalid entity id.");
                 return;
             }
 
-            if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent? man))
+            if (!_entManager.TryGetEntity(uidNet, out var uid) || !_entManager.TryGetComponent(uid, out SolutionContainerManagerComponent? man))
             {
                 shell.WriteLine($"Entity does not have any solutions.");
                 return;
@@ -54,7 +56,7 @@ namespace Content.Server.Administration.Commands
             }
 
             var quantity = FixedPoint2.New(quantityFloat);
-            EntitySystem.Get<SolutionContainerSystem>().SetCapacity(uid, solution, quantity);
+            _entManager.System<SolutionContainerSystem>().SetCapacity(uid.Value, solution, quantity);
         }
     }
 }
index fe6fbcb053d53055414be1e8bd337a9694e5b18c..6c6c618d17a24b335c5764f2ff46912266e03696 100644 (file)
@@ -8,6 +8,8 @@ namespace Content.Server.Administration.Commands
     [AdminCommand(AdminFlags.Fun)]
     public sealed class SetSolutionTemperature : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "setsolutiontemperature";
         public string Description => "Set the temperature of some solution.";
         public string Help => $"Usage: {Command} <target> <solution> <new temperature>";
@@ -20,13 +22,13 @@ namespace Content.Server.Administration.Commands
                 return;
             }
 
-            if (!EntityUid.TryParse(args[0], out var uid))
+            if (!NetEntity.TryParse(args[0], out var uidNet) || !_entManager.TryGetEntity(uidNet, out var uid))
             {
                 shell.WriteLine($"Invalid entity id.");
                 return;
             }
 
-            if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent? man))
+            if (!_entManager.TryGetComponent(uid, out SolutionContainerManagerComponent? man))
             {
                 shell.WriteLine($"Entity does not have any solutions.");
                 return;
@@ -52,7 +54,7 @@ namespace Content.Server.Administration.Commands
                 return;
             }
 
-            EntitySystem.Get<SolutionContainerSystem>().SetTemperature(uid, solution, quantity);
+            _entManager.System<SolutionContainerSystem>().SetTemperature(uid.Value, solution, quantity);
         }
     }
 }
index 6c65a9c2b6b971b94ee493d441d85c96ecad6c25..07b51016cc9161405253d55fd3cd377feacd5049 100644 (file)
@@ -8,6 +8,8 @@ namespace Content.Server.Administration.Commands
     [AdminCommand(AdminFlags.Fun)]
     public sealed class SetSolutionThermalEnergy : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "setsolutionthermalenergy";
         public string Description => "Set the thermal energy of some solution.";
         public string Help => $"Usage: {Command} <target> <solution> <new thermal energy>";
@@ -20,13 +22,13 @@ namespace Content.Server.Administration.Commands
                 return;
             }
 
-            if (!EntityUid.TryParse(args[0], out var uid))
+            if (!NetEntity.TryParse(args[0], out var uidNet) || !_entManager.TryGetEntity(uidNet, out var uid))
             {
                 shell.WriteLine($"Invalid entity id.");
                 return;
             }
 
-            if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent? man))
+            if (!_entManager.TryGetComponent(uid, out SolutionContainerManagerComponent? man))
             {
                 shell.WriteLine($"Entity does not have any solutions.");
                 return;
@@ -53,13 +55,14 @@ namespace Content.Server.Administration.Commands
                     shell.WriteLine($"Cannot set the thermal energy of a solution with 0 heat capacity to a non-zero number.");
                     return;
                 }
-            } else if(quantity <= 0.0f)
+            }
+            else if(quantity <= 0.0f)
             {
                 shell.WriteLine($"Cannot set the thermal energy of a solution with heat capacity to a non-positive number.");
                 return;
             }
 
-            EntitySystem.Get<SolutionContainerSystem>().SetThermalEnergy(uid, solution, quantity);
+            _entManager.System<SolutionContainerSystem>().SetThermalEnergy(uid.Value, solution, quantity);
         }
     }
 }
index 11141640e9d236787940b524c24828440a26a409..1b5cbbd4d505b74c025ccd6c30aaa4dbf8e0ebfe 100644 (file)
@@ -10,6 +10,9 @@ namespace Content.Server.Administration.Commands;
 [AdminCommand(AdminFlags.Mapping)]
 public sealed class VariantizeCommand : IConsoleCommand
 {
+    [Dependency] private readonly IEntityManager _entManager = default!;
+    [Dependency] private readonly IRobustRandom _random = default!;
+
     public string Command => "variantize";
 
     public string Description => Loc.GetString("variantize-command-description");
@@ -24,16 +27,13 @@ public sealed class VariantizeCommand : IConsoleCommand
             return;
         }
 
-        var entMan = IoCManager.Resolve<IEntityManager>();
-        var random = IoCManager.Resolve<IRobustRandom>();
-
-        if (!EntityUid.TryParse(args[0], out var euid))
+        if (!NetEntity.TryParse(args[0], out var euidNet) || !_entManager.TryGetEntity(euidNet, out var euid))
         {
             shell.WriteError($"Failed to parse euid '{args[0]}'.");
             return;
         }
 
-        if (!entMan.TryGetComponent(euid, out MapGridComponent? gridComp))
+        if (!_entManager.TryGetComponent(euid, out MapGridComponent? gridComp))
         {
             shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
             return;
@@ -42,7 +42,7 @@ public sealed class VariantizeCommand : IConsoleCommand
         foreach (var tile in gridComp.GetAllTiles())
         {
             var def = tile.GetContentTileDefinition();
-            var newTile = new Tile(tile.Tile.TypeId, tile.Tile.Flags, def.PickVariant(random));
+            var newTile = new Tile(tile.Tile.TypeId, tile.Tile.Flags, def.PickVariant(_random));
             gridComp.SetTile(tile.GridIndices, newTile);
         }
     }
index 03cf10206a5f3fb38e928b0a918fa2cb53c228bd..d54a7a2092a63085567ad4aa15ed8e9dc1e86d92 100644 (file)
@@ -183,7 +183,7 @@ namespace Content.Server.Administration.Systems
 
             var connected = session != null && session.Status is SessionStatus.Connected or SessionStatus.InGame;
 
-            return new PlayerInfo(name, entityName, identityName, startingRole, antag, session?.AttachedEntity, data.UserId,
+            return new PlayerInfo(name, entityName, identityName, startingRole, antag, GetNetEntity(session?.AttachedEntity), data.UserId,
                 connected, _roundActivePlayers.Contains(data.UserId));
         }
     }
index cb5ce8fbfa736118fa709d69f98d0d2dc7f14551..5fa386aae7477efce29feecc993c80138197f103 100644 (file)
@@ -1,3 +1,4 @@
+using Content.Server.Administration.Systems;
 using Content.Server.Chemistry.Components.SolutionManager;
 using Content.Server.EUI;
 using Content.Shared.Administration;
@@ -30,13 +31,13 @@ namespace Content.Server.Administration.UI
         public override void Closed()
         {
             base.Closed();
-            EntitySystem.Get<Systems.AdminVerbSystem>().OnEditSolutionsEuiClosed(Player);
+            _entityManager.System<AdminVerbSystem>().OnEditSolutionsEuiClosed(Player);
         }
 
         public override EuiStateBase GetNewState()
         {
             var solutions = _entityManager.GetComponentOrNull<SolutionContainerManagerComponent>(Target)?.Solutions;
-            return new EditSolutionsEuiState(Target, solutions);
+            return new EditSolutionsEuiState(_entityManager.GetNetEntity(Target), solutions);
         }
     }
 }
index 37b98568d35b19859954da3b18050243054d7747..6243657c3253143814d3c305259797629ef071b0 100644 (file)
@@ -10,6 +10,7 @@ namespace Content.Server.Administration.UI
     public sealed class SetOutfitEui : BaseEui
     {
         [Dependency] private readonly IAdminManager _adminManager = default!;
+        [Dependency] private readonly IEntityManager _entManager = default!;
         private readonly EntityUid _target;
 
         public SetOutfitEui(EntityUid entity)
@@ -30,7 +31,7 @@ namespace Content.Server.Administration.UI
         {
             return new SetOutfitEuiState
             {
-                TargetEntityId = _target
+                TargetNetEntity = _entManager.GetNetEntity(_target)
             };
         }
 
index b1ea16be7f86728e812c2503df5211857f35eeda..00e6c01064844fecab732f7a3367486f333ad1bd 100644 (file)
@@ -94,7 +94,7 @@ public sealed class AmeControllerSystem : EntitySystem
             return;
 
         var state = GetUiState(uid, controller);
-        UserInterfaceSystem.SetUiState(bui, state);
+        _userInterfaceSystem.SetUiState(bui, state);
     }
 
     private AmeControllerBoundUserInterfaceState GetUiState(EntityUid uid, AmeControllerComponent controller)
index ecbb4210d7c946e7fcb2d02b02cf655dc29c12c0..b57eeaf299ada4158a1a6f633b4f1687a6ba191a 100644 (file)
@@ -66,7 +66,7 @@ namespace Content.Server.Animals.Systems
             if (!Resolve(uid, ref udder))
                 return;
 
-            var doargs = new DoAfterArgs(userUid, 5, new MilkingDoAfterEvent(), uid, uid, used: containerUid)
+            var doargs = new DoAfterArgs(EntityManager, userUid, 5, new MilkingDoAfterEvent(), uid, uid, used: containerUid)
             {
                 BreakOnUserMove = true,
                 BreakOnDamage = true,
index 91056976a550475d13dd48e5debf56583131c916..b1a7c4443976e718c05e58f31e58d48888a155f2 100644 (file)
@@ -26,13 +26,13 @@ public sealed partial class AnomalySystem
         if (args.Length != 1)
             shell.WriteError("Argument length must be 1");
 
-        if (!EntityUid.TryParse(args[0], out var uid))
+        if (!NetEntity.TryParse(args[0], out var uidNet) || !TryGetEntity(uidNet, out var uid))
             return;
 
         if (!TryComp<AnomalyComponent>(uid, out var anomaly))
             return;
 
-        DoAnomalyPulse(uid, anomaly);
+        DoAnomalyPulse(uid.Value, anomaly);
     }
 
     [AdminCommand(AdminFlags.Fun)]
@@ -41,13 +41,13 @@ public sealed partial class AnomalySystem
         if (args.Length != 1)
             shell.WriteError("Argument length must be 1");
 
-        if (!EntityUid.TryParse(args[0], out var uid))
+        if (!NetEntity.TryParse(args[0], out var uidNet) || !TryGetEntity(uidNet, out var uid))
             return;
 
         if (!HasComp<AnomalyComponent>(uid))
             return;
 
-        StartSupercriticalEvent(uid);
+        StartSupercriticalEvent(uid.Value);
     }
 
     private CompletionResult GetAnomalyCompletion(IConsoleShell shell, string[] args)
index 37c4384f2f3ce5a48a3bc25ec1114195f4fd5fdc..caff031ace9768acbf72f3f720de93ba0bf11575 100644 (file)
@@ -79,7 +79,7 @@ public sealed partial class AnomalySystem
         if (!HasComp<AnomalyComponent>(target))
             return;
 
-        _doAfter.TryStartDoAfter(new DoAfterArgs(args.User, component.ScanDoAfterDuration, new ScannerDoAfterEvent(), uid, target: target, used: uid)
+        _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.ScanDoAfterDuration, new ScannerDoAfterEvent(), uid, target: target, used: uid)
         {
             DistanceThreshold = 2f
         });
index 7a13eef6d20b8c2e706b9a0e89232c8d5269bcbc..d943b5bf0667f2ae93749af00d5e734dbee4da30 100644 (file)
@@ -24,29 +24,27 @@ namespace Content.Server.Atmos.Commands
                 return;
             }
 
-            var entMan = IoCManager.Resolve<IEntityManager>();
-
-            if (!EntityUid.TryParse(args[0], out var euid))
+            if (!NetEntity.TryParse(args[0], out var eNet) || !_entities.TryGetEntity(eNet, out var euid))
             {
                 shell.WriteError($"Failed to parse euid '{args[0]}'.");
                 return;
             }
 
-            if (!entMan.HasComponent<MapGridComponent>(euid))
+            if (!_entities.HasComponent<MapGridComponent>(euid))
             {
                 shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
                 return;
             }
 
-            var atmos = entMan.EntitySysManager.GetEntitySystem<AtmosphereSystem>();
+            var atmos = _entities.EntitySysManager.GetEntitySystem<AtmosphereSystem>();
 
-            if (atmos.HasAtmosphere(euid))
+            if (atmos.HasAtmosphere(euid.Value))
             {
                 shell.WriteLine("Grid already has an atmosphere.");
                 return;
             }
 
-            _entities.AddComponent<GridAtmosphereComponent>(euid);
+            _entities.AddComponent<GridAtmosphereComponent>(euid.Value);
 
             shell.WriteLine($"Added atmosphere to grid {euid}.");
         }
index 2c4eb8785cfd5d65e7badf96d9eb21965bd16f48..3dccf39023d571d638be1013a9cfe93cf253f98e 100644 (file)
@@ -11,28 +11,34 @@ namespace Content.Server.Atmos.Commands
     [AdminCommand(AdminFlags.Debug)]
     public sealed class AddGasCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "addgas";
         public string Description => "Adds gas at a certain position.";
         public string Help => "addgas <X> <Y> <GridEid> <Gas> <moles>";
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            if (args.Length < 5) return;
+            if (args.Length < 5)
+                return;
 
-            if(!int.TryParse(args[0], out var x)
-               || !int.TryParse(args[1], out var y)
-               || !EntityUid.TryParse(args[2], out var euid)
-               || !(AtmosCommandUtils.TryParseGasID(args[3], out var gasId))
-               || !float.TryParse(args[4], out var moles)) return;
+            if (!int.TryParse(args[0], out var x)
+                || !int.TryParse(args[1], out var y)
+                || !NetEntity.TryParse(args[2], out var netEnt)
+                || !_entManager.TryGetEntity(netEnt, out var euid)
+                || !(AtmosCommandUtils.TryParseGasID(args[3], out var gasId))
+                || !float.TryParse(args[4], out var moles))
+            {
+                return;
+            }
 
-            var entMan = IoCManager.Resolve<IEntityManager>();
-            if (!entMan.HasComponent<MapGridComponent>(euid))
+            if (!_entManager.HasComponent<MapGridComponent>(euid))
             {
                 shell.WriteError($"Euid '{euid}' does not exist or is not a grid.");
                 return;
             }
 
-            var atmosphereSystem = entMan.EntitySysManager.GetEntitySystem<AtmosphereSystem>();
+            var atmosphereSystem = _entManager.EntitySysManager.GetEntitySystem<AtmosphereSystem>();
             var indices = new Vector2i(x, y);
             var tile = atmosphereSystem.GetTileMixture(euid, null, indices, true);
 
index b38b15cec3cb8e1f3076414392d3988dea1a19be..0f0c399b11a4b8dec3eb5902c7b27b717024d6dd 100644 (file)
@@ -11,6 +11,9 @@ namespace Content.Server.Atmos.Commands
     [AdminCommand(AdminFlags.Debug)]
     public sealed class DeleteGasCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+        [Dependency] private readonly IMapManager _mapManager = default!;
+
         public string Command => "deletegas";
         public string Description => "Removes all gases from a grid, or just of one type if specified.";
         public string Help => $"Usage: {Command} <GridId> <Gas> / {Command} <GridId> / {Command} <Gas> / {Command}";
@@ -21,8 +24,6 @@ namespace Content.Server.Atmos.Commands
             EntityUid? gridId;
             Gas? gas = null;
 
-            var entMan = IoCManager.Resolve<IEntityManager>();
-
             switch (args.Length)
             {
                 case 0:
@@ -39,7 +40,7 @@ namespace Content.Server.Atmos.Commands
                         return;
                     }
 
-                    gridId = entMan.GetComponent<TransformComponent>(playerEntity).GridUid;
+                    gridId = _entManager.GetComponent<TransformComponent>(playerEntity).GridUid;
 
                     if (gridId == null)
                     {
@@ -51,7 +52,7 @@ namespace Content.Server.Atmos.Commands
                 }
                 case 1:
                 {
-                    if (!EntityUid.TryParse(args[0], out var number))
+                    if (!NetEntity.TryParse(args[0], out var numberEnt) || !_entManager.TryGetEntity(numberEnt, out var number))
                     {
                         // Argument is a gas
                         if (player == null)
@@ -66,7 +67,7 @@ namespace Content.Server.Atmos.Commands
                             return;
                         }
 
-                        gridId = entMan.GetComponent<TransformComponent>(playerEntity).GridUid;
+                        gridId = _entManager.GetComponent<TransformComponent>(playerEntity).GridUid;
 
                         if (gridId == null)
                         {
@@ -90,7 +91,7 @@ namespace Content.Server.Atmos.Commands
                 }
                 case 2:
                 {
-                    if (!EntityUid.TryParse(args[0], out var first))
+                    if (!NetEntity.TryParse(args[0], out var firstNet) || !_entManager.TryGetEntity(firstNet, out var first))
                     {
                         shell.WriteLine($"{args[0]} is not a valid integer for a grid id.");
                         return;
@@ -119,15 +120,13 @@ namespace Content.Server.Atmos.Commands
                     return;
             }
 
-            var mapManager = IoCManager.Resolve<IMapManager>();
-
-            if (!mapManager.TryGetGrid(gridId, out _))
+            if (!_mapManager.TryGetGrid(gridId, out _))
             {
                 shell.WriteLine($"No grid exists with id {gridId}");
                 return;
             }
 
-            var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
+            var atmosphereSystem = _entManager.System<AtmosphereSystem>();
 
             var tiles = 0;
             var moles = 0f;
@@ -136,7 +135,8 @@ namespace Content.Server.Atmos.Commands
             {
                 foreach (var tile in atmosphereSystem.GetAllMixtures(gridId.Value, true))
                 {
-                    if (tile.Immutable) continue;
+                    if (tile.Immutable)
+                        continue;
 
                     tiles++;
                     moles += tile.TotalMoles;
@@ -148,7 +148,8 @@ namespace Content.Server.Atmos.Commands
             {
                 foreach (var tile in atmosphereSystem.GetAllMixtures(gridId.Value, true))
                 {
-                    if (tile.Immutable) continue;
+                    if (tile.Immutable)
+                        continue;
 
                     tiles++;
                     moles += tile.TotalMoles;
index c4befa851050f385e7beb31b04d290cb7f342155..b6db46abed457552a4baf3d24e23121cf5b94733 100644 (file)
@@ -10,26 +10,33 @@ namespace Content.Server.Atmos.Commands
     [AdminCommand(AdminFlags.Debug)]
     public sealed class FillGas : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+        [Dependency] private readonly IMapManager _mapManager = default!;
+
         public string Command => "fillgas";
         public string Description => "Adds gas to all tiles in a grid.";
         public string Help => "fillgas <GridEid> <Gas> <moles>";
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            if (args.Length < 3) return;
-            if(!EntityUid.TryParse(args[0], out var gridId)
-               || !(AtmosCommandUtils.TryParseGasID(args[1], out var gasId))
-               || !float.TryParse(args[2], out var moles)) return;
+            if (args.Length < 3)
+                return;
 
-            var mapMan = IoCManager.Resolve<IMapManager>();
+            if (!NetEntity.TryParse(args[0], out var gridIdNet)
+                || !_entManager.TryGetEntity(gridIdNet, out var gridId)
+                || !(AtmosCommandUtils.TryParseGasID(args[1], out var gasId))
+                || !float.TryParse(args[2], out var moles))
+            {
+                return;
+            }
 
-            if (!mapMan.TryGetGrid(gridId, out var grid))
+            if (!_mapManager.TryGetGrid(gridId, out var grid))
             {
                 shell.WriteLine("Invalid grid ID.");
                 return;
             }
 
-            var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
+            var atmosphereSystem = _entManager.System<AtmosphereSystem>();
 
             foreach (var tile in atmosphereSystem.GetAllMixtures(grid.Owner, true))
             {
index 29b9a1cc766b94d138a627aa3d2737e76d95e274..aeea1119f41972d7097192315b0c0bfc8e608b2e 100644 (file)
@@ -9,20 +9,28 @@ namespace Content.Server.Atmos.Commands
     [AdminCommand(AdminFlags.Debug)]
     public sealed class RemoveGasCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "removegas";
         public string Description => "Removes an amount of gases.";
         public string Help => "removegas <X> <Y> <GridId> <amount> <ratio>\nIf <ratio> is true, amount will be treated as the ratio of gas to be removed.";
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            if (args.Length < 5) return;
-            if(!int.TryParse(args[0], out var x)
+            if (args.Length < 5)
+                return;
+
+            if (!int.TryParse(args[0], out var x)
                || !int.TryParse(args[1], out var y)
-               || !EntityUid.TryParse(args[2], out var id)
+               || !NetEntity.TryParse(args[2], out var idNet)
+               || !_entManager.TryGetEntity(idNet, out var id)
                || !float.TryParse(args[3], out var amount)
-               || !bool.TryParse(args[4], out var ratio)) return;
+               || !bool.TryParse(args[4], out var ratio))
+            {
+                return;
+            }
 
-            var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
+            var atmosphereSystem = _entManager.System<AtmosphereSystem>();
             var indices = new Vector2i(x, y);
             var tile = atmosphereSystem.GetTileMixture(id, null, indices, true);
 
index d146655a524a0ada6a12e7e41142ec3d6df07354..1d7e306d5491d3fddcc0965d9f02d49f6686693c 100644 (file)
@@ -10,17 +10,23 @@ namespace Content.Server.Atmos.Commands
     [AdminCommand(AdminFlags.Debug)]
     public sealed class SetAtmosTemperatureCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+        [Dependency] private readonly IMapManager _mapManager = default!;
+
         public string Command => "setatmostemp";
         public string Description => "Sets a grid's temperature (in kelvin).";
         public string Help => "Usage: setatmostemp <GridId> <Temperature>";
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            if (args.Length < 2) return;
-            if(!EntityUid.TryParse(args[0], out var gridId)
-               || !float.TryParse(args[1], out var temperature)) return;
+            if (args.Length < 2)
+                return;
 
-            var mapMan = IoCManager.Resolve<IMapManager>();
+            if (!_entManager.TryParseNetEntity(args[0], out var gridId)
+                || !float.TryParse(args[1], out var temperature))
+            {
+                return;
+            }
 
             if (temperature < Atmospherics.TCMB)
             {
@@ -28,13 +34,13 @@ namespace Content.Server.Atmos.Commands
                 return;
             }
 
-            if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
+            if (!gridId.Value.IsValid() || !_mapManager.TryGetGrid(gridId, out var gridComp))
             {
                 shell.WriteLine("Invalid grid ID.");
                 return;
             }
 
-            var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
+            var atmosphereSystem = _entManager.System<AtmosphereSystem>();
 
             var tiles = 0;
             foreach (var tile in atmosphereSystem.GetAllMixtures(gridComp.Owner, true))
index a668278fe1b8585bd96554a7cfb5001c1c9c5f65..e6dcbdb4cfa979a85fd87c56d92e53c6155e4cc7 100644 (file)
@@ -22,11 +22,17 @@ namespace Content.Server.Atmos.Commands
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
-            if (args.Length < 4) return;
-            if(!int.TryParse(args[0], out var x)
-               || !int.TryParse(args[1], out var y)
-               || !EntityUid.TryParse(args[2], out var gridId)
-               || !float.TryParse(args[3], out var temperature)) return;
+            if (args.Length < 4)
+                return;
+
+            if (!int.TryParse(args[0], out var x)
+                || !int.TryParse(args[1], out var y)
+                || !NetEntity.TryParse(args[2], out var gridIdNet)
+                || !_entities.TryGetEntity(gridIdNet, out var gridId)
+                || !float.TryParse(args[3], out var temperature))
+            {
+                return;
+            }
 
             if (temperature < Atmospherics.TCMB)
             {
index 7d00634e4a888ffe0d4b3f2dc2abbbc5d9d36427..8b1c425d89ad14b28a9c50b3b72cd72eea47e746 100644 (file)
@@ -161,7 +161,7 @@ namespace Content.Server.Atmos.EntitySystems
                         }
                     }
 
-                    RaiseNetworkEvent(new AtmosDebugOverlayMessage(grid.Owner, baseTile, debugOverlayContent), session.ConnectedClient);
+                    RaiseNetworkEvent(new AtmosDebugOverlayMessage(GetNetEntity(grid.Owner), baseTile, debugOverlayContent), session.ConnectedClient);
                 }
             }
         }
index d8c99f0f7a81298b994b85f13f927977fa5973df..75caab93f054e2c65dc7d04abcf67e6ce65741c6 100644 (file)
@@ -67,7 +67,7 @@ public sealed partial class AtmosphereSystem
 
        foreach (var arg in args)
        {
-           if(!EntityUid.TryParse(arg, out var euid))
+           if (!NetEntity.TryParse(arg, out var netEntity) || !TryGetEntity(netEntity, out var euid))
            {
                shell.WriteError($"Failed to parse euid '{arg}'.");
                return;
@@ -85,7 +85,7 @@ public sealed partial class AtmosphereSystem
                continue;
            }
 
-           var transform = Transform(euid);
+           var transform = Transform(euid.Value);
 
            foreach (var (indices, tileMain) in gridAtmosphere.Tiles)
            {
index 29ff78791333794941649b2d20e71653dbccda2b..0d7ad48f888e8d9cb4ed27d852c6f07bac505c48 100644 (file)
@@ -229,7 +229,7 @@ namespace Content.Server.Atmos.EntitySystems
             _userInterface.TrySendUiMessage(uid, GasAnalyzerUiKey.Key,
                 new GasAnalyzerUserMessage(gasMixList.ToArray(),
                     component.Target != null ? Name(component.Target.Value) : string.Empty,
-                    component.Target ?? EntityUid.Invalid,
+                    GetNetEntity(component.Target) ?? NetEntity.Invalid,
                     deviceFlipped));
             return true;
         }
index dcfcdf3331b7921cbe5cd491c0ce314c00d56a34..03286f08abcb783f75fb25404a7fb7fb3caa0cd7 100644 (file)
@@ -77,7 +77,6 @@ namespace Content.Server.Atmos.EntitySystems
 
         public void UpdateUserInterface(GasTankComponent component, bool initialUpdate = false)
         {
-            var internals = GetInternalsComponent(component);
             _ui.TrySetUiState(component.Owner, SharedGasTankUiKey.Key,
                 new GasTankBoundUserInterfaceState
                 {
index 836d3ba9bf0a5a79ac388b18b3083b0fbfbd4298..c229ef50c9adae325371ce7e2ff63f1d0ce1ddec 100644 (file)
@@ -15,7 +15,6 @@ using Robust.Server.Player;
 using Robust.Shared;
 using Robust.Shared.Configuration;
 using Robust.Shared.Enums;
-using Robust.Shared.GameStates;
 using Robust.Shared.Map;
 using Robust.Shared.Threading;
 using Robust.Shared.Timing;
@@ -36,15 +35,15 @@ namespace Content.Server.Atmos.EntitySystems
         [Robust.Shared.IoC.Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
         [Robust.Shared.IoC.Dependency] private readonly ChunkingSystem _chunkingSys = default!;
 
-        private readonly Dictionary<IPlayerSession, Dictionary<EntityUid, HashSet<Vector2i>>> _lastSentChunks = new();
+        private readonly Dictionary<IPlayerSession, Dictionary<NetEntity, HashSet<Vector2i>>> _lastSentChunks = new();
 
         // Oh look its more duplicated decal system code!
         private ObjectPool<HashSet<Vector2i>> _chunkIndexPool =
             new DefaultObjectPool<HashSet<Vector2i>>(
                 new DefaultPooledObjectPolicy<HashSet<Vector2i>>(), 64);
-        private ObjectPool<Dictionary<EntityUid, HashSet<Vector2i>>> _chunkViewerPool =
-            new DefaultObjectPool<Dictionary<EntityUid, HashSet<Vector2i>>>(
-                new DefaultPooledObjectPolicy<Dictionary<EntityUid, HashSet<Vector2i>>>(), 64);
+        private ObjectPool<Dictionary<NetEntity, HashSet<Vector2i>>> _chunkViewerPool =
+            new DefaultObjectPool<Dictionary<NetEntity, HashSet<Vector2i>>>(
+                new DefaultPooledObjectPolicy<Dictionary<NetEntity, HashSet<Vector2i>>>(), 64);
 
         /// <summary>
         ///     Overlay update interval, in seconds.
@@ -294,22 +293,21 @@ namespace Content.Server.Atmos.EntitySystems
 
         private void UpdatePlayer(IPlayerSession playerSession, GameTick curTick)
         {
-            var xformQuery = GetEntityQuery<TransformComponent>();
-            var chunksInRange = _chunkingSys.GetChunksForSession(playerSession, ChunkSize, xformQuery, _chunkIndexPool, _chunkViewerPool);
+            var chunksInRange = _chunkingSys.GetChunksForSession(playerSession, ChunkSize, _chunkIndexPool, _chunkViewerPool);
             var previouslySent = _lastSentChunks[playerSession];
 
             var ev = new GasOverlayUpdateEvent();
 
-            foreach (var (grid, oldIndices) in previouslySent)
+            foreach (var (netGrid, oldIndices) in previouslySent)
             {
                 // Mark the whole grid as stale and flag for removal.
-                if (!chunksInRange.TryGetValue(grid, out var chunks))
+                if (!chunksInRange.TryGetValue(netGrid, out var chunks))
                 {
-                    previouslySent.Remove(grid);
+                    previouslySent.Remove(netGrid);
 
                     // If grid was deleted then don't worry about sending it to the client.
-                    if (_mapManager.IsGrid(grid))
-                        ev.RemovedChunks[grid] = oldIndices;
+                    if (!TryGetEntity(netGrid, out var gridId) || !_mapManager.IsGrid(gridId.Value))
+                        ev.RemovedChunks[netGrid] = oldIndices;
                     else
                     {
                         oldIndices.Clear();
@@ -330,19 +328,19 @@ namespace Content.Server.Atmos.EntitySystems
                 if (old.Count == 0)
                     _chunkIndexPool.Return(old);
                 else
-                    ev.RemovedChunks.Add(grid, old);
+                    ev.RemovedChunks.Add(netGrid, old);
             }
 
-            foreach (var (grid, gridChunks) in chunksInRange)
+            foreach (var (netGrid, gridChunks) in chunksInRange)
             {
                 // Not all grids have atmospheres.
-                if (!TryComp(grid, out GasTileOverlayComponent? overlay))
+                if (!TryGetEntity(netGrid, out var grid) || !TryComp(grid, out GasTileOverlayComponent? overlay))
                     continue;
 
                 List<GasOverlayChunk> dataToSend = new();
-                ev.UpdatedChunks[grid] = dataToSend;
+                ev.UpdatedChunks[netGrid] = dataToSend;
 
-                previouslySent.TryGetValue(grid, out var previousChunks);
+                previouslySent.TryGetValue(netGrid, out var previousChunks);
 
                 foreach (var index in gridChunks)
                 {
@@ -359,7 +357,7 @@ namespace Content.Server.Atmos.EntitySystems
                     dataToSend.Add(value);
                 }
 
-                previouslySent[grid] = gridChunks;
+                previouslySent[netGrid] = gridChunks;
                 if (previousChunks != null)
                 {
                     previousChunks.Clear();
index f53f3361b4b78502e552815bd609b8ea7dad535c..a9f994ed5609d1065006e89721f833a8a937a010 100644 (file)
@@ -96,7 +96,7 @@ public sealed class BeamSystem : SharedBeamSystem
 
         var distanceLength = distanceCorrection.Length();
 
-        var beamVisualizerEvent = new BeamVisualizerEvent(ent, distanceLength, userAngle, bodyState, shader);
+        var beamVisualizerEvent = new BeamVisualizerEvent(GetNetEntity(ent), distanceLength, userAngle, bodyState, shader);
         RaiseNetworkEvent(beamVisualizerEvent);
 
         if (controller != null)
@@ -119,7 +119,7 @@ public sealed class BeamSystem : SharedBeamSystem
             beamSpawnPos = beamSpawnPos.Offset(calculatedDistance.Normalized());
             var newEnt = Spawn(prototype, beamSpawnPos);
 
-            var ev = new BeamVisualizerEvent(newEnt, distanceLength, userAngle, bodyState, shader);
+            var ev = new BeamVisualizerEvent(GetNetEntity(newEnt), distanceLength, userAngle, bodyState, shader);
             RaiseNetworkEvent(ev);
         }
 
index 7b78304756ab152a47de2c1b1f8c94499f376c18..bdb07ca7e1b7d358d908a6f8721eeed801b28ead 100644 (file)
@@ -14,6 +14,10 @@ namespace Content.Server.Body.Commands
     [AdminCommand(AdminFlags.Fun)]
     sealed class AddHandCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+        [Dependency] private readonly IPrototypeManager _protoManager = default!;
+        [Dependency] private readonly IRobustRandom _random = default!;
+
         [ValidatePrototypeId<EntityPrototype>]
         public const string DefaultHandPrototype = "LeftHandHuman";
 
@@ -25,9 +29,6 @@ namespace Content.Server.Body.Commands
         {
             var player = shell.Player as IPlayerSession;
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
-            var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
-
             EntityUid entity;
             EntityUid hand;
 
@@ -48,21 +49,21 @@ namespace Content.Server.Body.Commands
                     }
 
                     entity = player.AttachedEntity.Value;
-                    hand = entityManager.SpawnEntity(DefaultHandPrototype, entityManager.GetComponent<TransformComponent>(entity).Coordinates);
+                    hand = _entManager.SpawnEntity(DefaultHandPrototype, _entManager.GetComponent<TransformComponent>(entity).Coordinates);
                     break;
                 }
                 case 1:
                 {
-                    if (EntityUid.TryParse(args[0], out var uid))
+                    if (NetEntity.TryParse(args[0], out var uidNet) && _entManager.TryGetEntity(uidNet, out var uid))
                     {
-                        if (!entityManager.EntityExists(uid))
+                        if (!_entManager.EntityExists(uid))
                         {
                             shell.WriteLine($"No entity found with uid {uid}");
                             return;
                         }
 
-                        entity = uid;
-                        hand = entityManager.SpawnEntity(DefaultHandPrototype, entityManager.GetComponent<TransformComponent>(entity).Coordinates);
+                        entity = uid.Value;
+                        hand = _entManager.SpawnEntity(DefaultHandPrototype, _entManager.GetComponent<TransformComponent>(entity).Coordinates);
                     }
                     else
                     {
@@ -79,34 +80,34 @@ namespace Content.Server.Body.Commands
                         }
 
                         entity = player.AttachedEntity.Value;
-                        hand = entityManager.SpawnEntity(args[0], entityManager.GetComponent<TransformComponent>(entity).Coordinates);
+                        hand = _entManager.SpawnEntity(args[0], _entManager.GetComponent<TransformComponent>(entity).Coordinates);
                     }
 
                     break;
                 }
                 case 2:
                 {
-                    if (!EntityUid.TryParse(args[0], out var uid))
+                    if (!NetEntity.TryParse(args[0], out var netEnt) || !_entManager.TryGetEntity(netEnt, out var uid))
                     {
                         shell.WriteLine($"{args[0]} is not a valid entity uid.");
                         return;
                     }
 
-                    if (!entityManager.EntityExists(uid))
+                    if (!_entManager.EntityExists(uid))
                     {
                         shell.WriteLine($"No entity exists with uid {uid}.");
                         return;
                     }
 
-                    entity = uid;
+                    entity = uid.Value;
 
-                    if (!prototypeManager.HasIndex<EntityPrototype>(args[1]))
+                    if (!_protoManager.HasIndex<EntityPrototype>(args[1]))
                     {
                         shell.WriteLine($"No hand entity exists with id {args[1]}.");
                         return;
                     }
 
-                    hand = entityManager.SpawnEntity(args[1], entityManager.GetComponent<TransformComponent>(entity).Coordinates);
+                    hand = _entManager.SpawnEntity(args[1], _entManager.GetComponent<TransformComponent>(entity).Coordinates);
 
                     break;
                 }
@@ -117,22 +118,21 @@ namespace Content.Server.Body.Commands
                 }
             }
 
-            if (!entityManager.TryGetComponent(entity, out BodyComponent? body) || body.Root == null)
+            if (!_entManager.TryGetComponent(entity, out BodyComponent? body) || body.Root == null)
             {
-                var random = IoCManager.Resolve<IRobustRandom>();
-                var text = $"You have no body{(random.Prob(0.2f) ? " and you must scream." : ".")}";
+                var text = $"You have no body{(_random.Prob(0.2f) ? " and you must scream." : ".")}";
 
                 shell.WriteLine(text);
                 return;
             }
 
-            if (!entityManager.TryGetComponent(hand, out BodyPartComponent? part))
+            if (!_entManager.TryGetComponent(hand, out BodyPartComponent? part))
             {
                 shell.WriteLine($"Hand entity {hand} does not have a {nameof(BodyPartComponent)} component.");
                 return;
             }
 
-            var bodySystem = entityManager.System<BodySystem>();
+            var bodySystem = _entManager.System<BodySystem>();
 
             var attachAt = bodySystem.GetBodyChildrenOfType(entity, BodyPartType.Arm, body).FirstOrDefault();
             if (attachAt == default)
@@ -142,11 +142,11 @@ namespace Content.Server.Body.Commands
 
             if (!bodySystem.TryCreatePartSlotAndAttach(attachAt.Id, slotId, hand, attachAt.Component, part))
             {
-                shell.WriteError($"Couldn't create a slot with id {slotId} on entity {entityManager.ToPrettyString(entity)}");
+                shell.WriteError($"Couldn't create a slot with id {slotId} on entity {_entManager.ToPrettyString(entity)}");
                 return;
             }
 
-            shell.WriteLine($"Added hand to entity {entityManager.GetComponent<MetaDataComponent>(entity).EntityName}");
+            shell.WriteLine($"Added hand to entity {_entManager.GetComponent<MetaDataComponent>(entity).EntityName}");
         }
     }
 }
index de52cf633a635242aea1d6c2866be7297bea6518..9a80a200e08e25baebe135d8970bde448244733d 100644 (file)
@@ -12,6 +12,8 @@ namespace Content.Server.Body.Commands
     [AdminCommand(AdminFlags.Fun)]
     public sealed class AttachBodyPartCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "attachbodypart";
         public string Description => "Attaches a body part to you or someone else.";
         public string Help => $"{Command} <partEntityUid> / {Command} <entityUid> <partEntityUid>";
@@ -19,10 +21,9 @@ namespace Content.Server.Body.Commands
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
             var player = shell.Player as IPlayerSession;
-            var entityManager = IoCManager.Resolve<IEntityManager>();
 
             EntityUid bodyId;
-            EntityUid partUid;
+            EntityUid? partUid;
 
             switch (args.Length)
             {
@@ -39,7 +40,7 @@ namespace Content.Server.Body.Commands
                         return;
                     }
 
-                    if (!EntityUid.TryParse(args[0], out partUid))
+                    if (!NetEntity.TryParse(args[0], out var partNet) || !_entManager.TryGetEntity(partNet, out partUid))
                     {
                         shell.WriteLine($"{args[0]} is not a valid entity uid.");
                         return;
@@ -49,53 +50,53 @@ namespace Content.Server.Body.Commands
 
                     break;
                 case 2:
-                    if (!EntityUid.TryParse(args[0], out var entityUid))
+                    if (!NetEntity.TryParse(args[0], out var entityNet) || !_entManager.TryGetEntity(entityNet, out var entityUid))
                     {
                         shell.WriteLine($"{args[0]} is not a valid entity uid.");
                         return;
                     }
 
-                    if (!EntityUid.TryParse(args[1], out partUid))
+                    if (!NetEntity.TryParse(args[1], out partNet) || !_entManager.TryGetEntity(partNet, out partUid))
                     {
                         shell.WriteLine($"{args[1]} is not a valid entity uid.");
                         return;
                     }
 
-                    if (!entityManager.EntityExists(entityUid))
+                    if (!_entManager.EntityExists(entityUid))
                     {
                         shell.WriteLine($"{entityUid} is not a valid entity.");
                         return;
                     }
 
-                    bodyId = entityUid;
+                    bodyId = entityUid.Value;
                     break;
                 default:
                     shell.WriteLine(Help);
                     return;
             }
 
-            if (!entityManager.TryGetComponent(bodyId, out BodyComponent? body))
+            if (!_entManager.TryGetComponent(bodyId, out BodyComponent? body))
             {
-                shell.WriteLine($"Entity {entityManager.GetComponent<MetaDataComponent>(bodyId).EntityName} with uid {bodyId} does not have a {nameof(BodyComponent)}.");
+                shell.WriteLine($"Entity {_entManager.GetComponent<MetaDataComponent>(bodyId).EntityName} with uid {bodyId} does not have a {nameof(BodyComponent)}.");
                 return;
             }
 
-            if (!entityManager.EntityExists(partUid))
+            if (!_entManager.EntityExists(partUid))
             {
                 shell.WriteLine($"{partUid} is not a valid entity.");
                 return;
             }
 
-            if (!entityManager.TryGetComponent(partUid, out BodyPartComponent? part))
+            if (!_entManager.TryGetComponent(partUid, out BodyPartComponent? part))
             {
-                shell.WriteLine($"Entity {entityManager.GetComponent<MetaDataComponent>(partUid).EntityName} with uid {args[0]} does not have a {nameof(BodyPartComponent)}.");
+                shell.WriteLine($"Entity {_entManager.GetComponent<MetaDataComponent>(partUid.Value).EntityName} with uid {args[0]} does not have a {nameof(BodyPartComponent)}.");
                 return;
             }
 
-            var bodySystem = entityManager.System<BodySystem>();
+            var bodySystem = _entManager.System<BodySystem>();
             if (bodySystem.BodyHasChild(bodyId, partUid, body, part))
             {
-                shell.WriteLine($"Body part {entityManager.GetComponent<MetaDataComponent>(partUid).EntityName} with uid {partUid} is already attached to entity {entityManager.GetComponent<MetaDataComponent>(bodyId).EntityName} with uid {bodyId}");
+                shell.WriteLine($"Body part {_entManager.GetComponent<MetaDataComponent>(partUid.Value).EntityName} with uid {partUid} is already attached to entity {_entManager.GetComponent<MetaDataComponent>(bodyId).EntityName} with uid {bodyId}");
                 return;
             }
 
@@ -113,12 +114,12 @@ namespace Content.Server.Body.Commands
 
                 if (!bodySystem.TryCreatePartSlotAndAttach(attachAt.Id, slotId, partUid, attachAt.Component, part))
                 {
-                    shell.WriteError($"Could not create slot {slotId} on entity {entityManager.ToPrettyString(bodyId)}");
+                    shell.WriteError($"Could not create slot {slotId} on entity {_entManager.ToPrettyString(bodyId)}");
                     return;
                 }
             }
 
-            shell.WriteLine($"Attached part {entityManager.ToPrettyString(partUid)} to {entityManager.ToPrettyString(bodyId)}");
+            shell.WriteLine($"Attached part {_entManager.ToPrettyString(partUid.Value)} to {_entManager.ToPrettyString(bodyId)}");
         }
     }
 }
index 08dbfacbc23cb36493da89dbe8e2d1fcfbbf2933..3e8e2307e3d8c2a9f37d7ae5ff818778b186731d 100644 (file)
@@ -105,7 +105,7 @@ public sealed class InternalsSystem : EntitySystem
         var isUser = user == target;
         var delay = !isUser ? internals.Delay : 1.0f;
 
-        _doAfter.TryStartDoAfter(new DoAfterArgs(user, delay, new InternalsDoAfterEvent(), target, target: target)
+        _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, delay, new InternalsDoAfterEvent(), target, target: target)
         {
             BreakOnUserMove = true,
             BreakOnDamage = true,
index 5e5bff0f5cd873fb476c2eca77b03f5f0abe1d81..8f300c94486151251974a90ad89e5a5e6fdae122 100644 (file)
@@ -44,7 +44,7 @@ public sealed class BotanySwabSystem : EntitySystem
         if (args.Target == null || !args.CanReach || !HasComp<PlantHolderComponent>(args.Target))
             return;
 
-        _doAfterSystem.TryStartDoAfter(new DoAfterArgs(args.User, swab.SwabDelay, new BotanySwabDoAfterEvent(), uid, target: args.Target, used: uid)
+        _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, swab.SwabDelay, new BotanySwabDoAfterEvent(), uid, target: args.Target, used: uid)
         {
             Broadcast = true,
             BreakOnTargetMove = true,
index 0022ce3214fdbad68f474d6af431078a2b71ed22..ddf47fca794c75c486fc553768279412503269a2 100644 (file)
@@ -8,8 +8,9 @@ public sealed class CameraRecoilSystem : SharedCameraRecoilSystem
 {
     public override void KickCamera(EntityUid euid, Vector2 kickback, CameraRecoilComponent? component = null)
     {
-        if (!Resolve(euid, ref component, false)) return;
+        if (!Resolve(euid, ref component, false))
+            return;
 
-        RaiseNetworkEvent(new CameraKickEvent(euid, kickback), euid);
+        RaiseNetworkEvent(new CameraKickEvent(GetNetEntity(euid), kickback), euid);
     }
 }
index b3f2aa561c2470822bbd8590bd1579e178aa9e71..df9743a21a62edfaddf655d913068c3a505ff6ad 100644 (file)
@@ -73,7 +73,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
         {
             if (_timing.CurTime > component.EffectCooldown)
             {
-                RaiseNetworkEvent(new PlayBoxEffectMessage(uid, component.Mover.Value));
+                RaiseNetworkEvent(new PlayBoxEffectMessage(GetNetEntity(uid), GetNetEntity(component.Mover.Value)));
                 _audio.PlayPvs(component.EffectSound, uid);
                 component.EffectCooldown = _timing.CurTime + component.CooldownDuration;
             }
index 6f98b67224669135b2125479e8706b044739d97c..9ea054b62832430319375754a388eabcfdbf18cf 100644 (file)
@@ -215,13 +215,15 @@ namespace Content.Server.Cargo.Systems
                 !TryComp<StationBankAccountComponent>(station, out var bankAccount)) return;
 
             if (_uiSystem.TryGetUi(consoleUid, CargoConsoleUiKey.Orders, out var bui))
-                UserInterfaceSystem.SetUiState(bui, new CargoConsoleInterfaceState(
+            {
+                _uiSystem.SetUiState(bui, new CargoConsoleInterfaceState(
                     MetaData(station.Value).EntityName,
                     GetOutstandingOrderCount(orderDatabase),
                     orderDatabase.Capacity,
                     bankAccount.Balance,
                     orderDatabase.Orders
                 ));
+            }
         }
 
         private void ConsolePopup(ICommonSession session, string text)
index ac208df187981958976a14209529177233ea5e63..80e7cf71e092cecc6b9f66bdd1c672185f15fe62 100644 (file)
@@ -95,12 +95,12 @@ public sealed partial class CargoSystem
         var bui = _uiSystem.GetUi(uid, CargoPalletConsoleUiKey.Sale);
         if (Transform(uid).GridUid is not EntityUid gridUid)
         {
-            UserInterfaceSystem.SetUiState(bui,
+            _uiSystem.SetUiState(bui,
             new CargoPalletConsoleInterfaceState(0, 0, false));
             return;
         }
         GetPalletGoods(gridUid, out var toSell, out var amount);
-        UserInterfaceSystem.SetUiState(bui,
+        _uiSystem.SetUiState(bui,
             new CargoPalletConsoleInterfaceState((int) amount, toSell.Count, true));
     }
 
@@ -147,7 +147,7 @@ public sealed partial class CargoSystem
         var shuttleName = orderDatabase?.Shuttle != null ? MetaData(orderDatabase.Shuttle.Value).EntityName : string.Empty;
 
         if (_uiSystem.TryGetUi(uid, CargoConsoleUiKey.Shuttle, out var bui))
-            UserInterfaceSystem.SetUiState(bui, new CargoShuttleConsoleBoundUserInterfaceState(
+            _uiSystem.SetUiState(bui, 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
@@ -324,7 +324,7 @@ public sealed partial class CargoSystem
         var bui = _uiSystem.GetUi(uid, CargoPalletConsoleUiKey.Sale);
         if (Transform(uid).GridUid is not EntityUid gridUid)
         {
-            UserInterfaceSystem.SetUiState(bui,
+            _uiSystem.SetUiState(bui,
             new CargoPalletConsoleInterfaceState(0, 0, false));
             return;
         }
index 1f6d941b6b746ce9c002b9d3c26802a6ef4c8a76..d1f6684bc3bee5f9b7dc111f8e3c103e85083b43 100644 (file)
@@ -51,7 +51,7 @@ public sealed class PricingSystem : EntitySystem
 
         foreach (var gid in args)
         {
-            if (!EntityUid.TryParse(gid, out var gridId) || !gridId.IsValid())
+            if (!EntityManager.TryParseNetEntity(gid, out var gridId) || !gridId.Value.IsValid())
             {
                 shell.WriteError($"Invalid grid ID \"{gid}\".");
                 continue;
@@ -90,7 +90,7 @@ public sealed class PricingSystem : EntitySystem
 
         if (!TryComp<BodyComponent>(uid, out var body) || !TryComp<MobStateComponent>(uid, out var state))
         {
-            Logger.ErrorS("pricing", $"Tried to get the mob price of {ToPrettyString(uid)}, which has no {nameof(BodyComponent)} and no {nameof(MobStateComponent)}.");
+            Log.Error($"Tried to get the mob price of {ToPrettyString(uid)}, which has no {nameof(BodyComponent)} and no {nameof(MobStateComponent)}.");
             return;
         }
 
index 42f065a4c2b458f04c7c877beffa2f612a44cb79..c9ae2f6c802814a6045fbc7bb435b9009621e279 100644 (file)
@@ -1,4 +1,7 @@
-using Content.Server.DeviceNetwork.Systems;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using Content.Server.DeviceNetwork.Systems;
+using Content.Server.PDA;
 using Content.Shared.CartridgeLoader;
 using Content.Shared.Interaction;
 using Robust.Server.Containers;
@@ -6,7 +9,6 @@ using Robust.Server.GameObjects;
 using Robust.Server.Player;
 using Robust.Shared.Containers;
 using Robust.Shared.Map;
-using System.Diagnostics.CodeAnalysis;
 
 namespace Content.Server.CartridgeLoader;
 
@@ -14,8 +16,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
 {
     [Dependency] private readonly ContainerSystem _containerSystem = default!;
     [Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
-
-    private const string ContainerName = "program-container";
+    [Dependency] private readonly PdaSystem _pda = default!;
 
     public override void Initialize()
     {
@@ -29,6 +30,66 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
         SubscribeLocalEvent<CartridgeLoaderComponent, CartridgeUiMessage>(OnUiMessage);
     }
 
+    public IReadOnlyList<EntityUid> GetInstalled(EntityUid uid, ContainerManagerComponent? comp = null)
+    {
+        if (_containerSystem.TryGetContainer(uid, InstalledContainerId, out var container, comp))
+            return container.ContainedEntities;
+
+        return Array.Empty<EntityUid>();
+    }
+
+    public bool TryGetProgram<T>(
+        EntityUid uid,
+        [NotNullWhen(true)] out EntityUid? programUid,
+        [NotNullWhen(true)] out T? program,
+        bool installedOnly = false,
+        CartridgeLoaderComponent? loader = null,
+        ContainerManagerComponent? containerManager = null)
+    {
+        program = default;
+        programUid = null;
+
+        if (!_containerSystem.TryGetContainer(uid, InstalledContainerId, out var container, containerManager))
+            return false;
+
+        foreach (var prog in container.ContainedEntities)
+        {
+            if (!TryComp(prog, out program))
+                continue;
+
+            programUid = prog;
+            return true;
+        }
+
+        if (installedOnly)
+            return false;
+
+        if (!Resolve(uid, ref loader) || !TryComp(loader.CartridgeSlot.Item, out program))
+            return false;
+
+        programUid = loader.CartridgeSlot.Item;
+        return true;
+    }
+
+    public bool TryGetProgram<T>(
+        EntityUid uid,
+        [NotNullWhen(true)] out EntityUid? programUid,
+        bool installedOnly = false,
+        CartridgeLoaderComponent? loader = null,
+        ContainerManagerComponent? containerManager = null)
+    {
+        return TryGetProgram<T>(uid, out programUid, out _, installedOnly, loader, containerManager);
+    }
+
+    public bool HasProgram<T>(
+        EntityUid uid,
+        bool installedOnly = false,
+        CartridgeLoaderComponent? loader = null,
+        ContainerManagerComponent? containerManager = null)
+    {
+        return TryGetProgram<T>(uid, out _, out _, installedOnly, loader, containerManager);
+    }
+
     /// <summary>
     /// Updates the cartridge loaders ui state.
     /// </summary>
@@ -37,16 +98,17 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
     /// and use this method to update its state so the cartridge loaders state can be added to it.
     /// </remarks>
     /// <seealso cref="PDA.PdaSystem.UpdatePdaUserInterface"/>
-    public void UpdateUiState(EntityUid loaderUid, CartridgeLoaderUiState state, IPlayerSession? session = default!, CartridgeLoaderComponent? loader = default!)
+    public void UpdateUiState(EntityUid loaderUid, IPlayerSession? session, CartridgeLoaderComponent? loader)
     {
         if (!Resolve(loaderUid, ref loader))
             return;
 
-        state.ActiveUI = loader.ActiveProgram;
-        state.Programs = GetAvailablePrograms(loaderUid, loader);
+        if (!_userInterfaceSystem.TryGetUi(loaderUid, loader.UiKey, out var ui))
+            return;
 
-        if (_userInterfaceSystem.TryGetUi(loaderUid, loader.UiKey, out var ui))
-            UserInterfaceSystem.SetUiState(ui, state, session);
+        var programs = GetAvailablePrograms(loaderUid, loader);
+        var state = new CartridgeLoaderUiState(programs, GetNetEntity(loader.ActiveProgram));
+        _userInterfaceSystem.SetUiState(ui, state, session);
     }
 
     /// <summary>
@@ -66,7 +128,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
             return;
 
         if (_userInterfaceSystem.TryGetUi(loaderUid, loader.UiKey, out var ui))
-            UserInterfaceSystem.SetUiState(ui, state, session);
+            _userInterfaceSystem.SetUiState(ui, state, session);
     }
 
     /// <summary>
@@ -75,21 +137,18 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
     /// <param name="uid">The cartridge loaders uid</param>
     /// <param name="loader">The cartridge loader component</param>
     /// <returns>A list of all the available program entity ids</returns>
-    public List<EntityUid> GetAvailablePrograms(EntityUid uid, CartridgeLoaderComponent? loader = default!)
+    public List<NetEntity> GetAvailablePrograms(EntityUid uid, CartridgeLoaderComponent? loader = default!)
     {
         if (!Resolve(uid, ref loader))
-            return new List<EntityUid>();
-
-        //Don't count a cartridge that has already been installed as available to avoid confusion
-        if (loader.CartridgeSlot.HasItem && TryFindInstalled(Prototype(loader.CartridgeSlot.Item!.Value)?.ID, loader, out _))
-            return loader.InstalledPrograms;
+            return new List<NetEntity>();
 
-        var available = new List<EntityUid>();
-        available.AddRange(loader.InstalledPrograms);
+        var available = GetNetEntityList(GetInstalled(uid));
 
-        if (loader.CartridgeSlot.HasItem)
-            available.Add(loader.CartridgeSlot.Item!.Value);
+        if (loader.CartridgeSlot.Item is not { } cartridge)
+            return available;
 
+        // TODO exclude duplicate programs. Or something I dunno I CBF fixing this mess.
+        available.Add(GetNetEntity(cartridge));
         return available;
     }
 
@@ -102,11 +161,13 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
     /// <returns>Whether installing the cartridge was successful</returns>
     public bool InstallCartridge(EntityUid loaderUid, EntityUid cartridgeUid, CartridgeLoaderComponent? loader = default!)
     {
-        if (!Resolve(loaderUid, ref loader) || loader.InstalledPrograms.Count >= loader.DiskSpace)
+        if (!Resolve(loaderUid, ref loader))
             return false;
 
         //This will eventually be replaced by serializing and deserializing the cartridge to copy it when something needs
         //the data on the cartridge to carry over when installing
+
+        // For anyone stumbling onto this: Do not do this or I will cut you.
         var prototypeId = Prototype(cartridgeUid)?.ID;
         return prototypeId != null && InstallProgram(loaderUid, prototypeId, loader: loader);
     }
@@ -121,16 +182,16 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
     /// <returns>Whether installing the cartridge was successful</returns>
     public bool InstallProgram(EntityUid loaderUid, string prototype, bool deinstallable = true, CartridgeLoaderComponent? loader = default!)
     {
-        if (!Resolve(loaderUid, ref loader) || loader.InstalledPrograms.Count >= loader.DiskSpace)
+        if (!Resolve(loaderUid, ref loader))
             return false;
 
-        if (!_containerSystem.TryGetContainer(loaderUid, ContainerName, out var container))
+        if (!_containerSystem.TryGetContainer(loaderUid, InstalledContainerId, out var container))
             return false;
 
-        //Prevent installing cartridges that have already been installed
-        if (TryFindInstalled(prototype, loader, out _))
+        if (container.Count >= loader.DiskSpace)
             return false;
 
+        // TODO cancel duplicate program installations
         var ev = new ProgramInstallationAttempt(loaderUid, prototype);
         RaiseLocalEvent(ref ev);
 
@@ -138,32 +199,15 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
             return false;
 
         var installedProgram = Spawn(prototype, new EntityCoordinates(loaderUid, 0, 0));
-        container?.Insert(installedProgram);
+        container.Insert(installedProgram);
 
         UpdateCartridgeInstallationStatus(installedProgram, deinstallable ? InstallationStatus.Installed : InstallationStatus.Readonly);
-        loader.InstalledPrograms.Add(installedProgram);
 
         RaiseLocalEvent(installedProgram, new CartridgeAddedEvent(loaderUid));
         UpdateUserInterfaceState(loaderUid, loader);
         return true;
     }
 
-    /// <summary>
-    /// Uninstalls a program using its prototype
-    /// </summary>
-    /// <param name="loaderUid">The cartridge loader uid</param>
-    /// <param name="prototype">The prototype name of the program to be uninstalled</param>
-    /// <param name="loader">The cartridge loader component</param>
-    /// <returns>Whether uninstalling the program was successful</returns>
-    public bool UninstallProgram(EntityUid loaderUid, string prototype, CartridgeLoaderComponent? loader = default!)
-    {
-        if (!Resolve(loaderUid, ref loader))
-            return false;
-
-        return TryFindInstalled(prototype, loader, out var programUid) &&
-               UninstallProgram(loaderUid, programUid.Value, loader);
-    }
-
     /// <summary>
     /// Uninstalls a program using its uid
     /// </summary>
@@ -173,14 +217,16 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
     /// <returns>Whether uninstalling the program was successful</returns>
     public bool UninstallProgram(EntityUid loaderUid, EntityUid programUid, CartridgeLoaderComponent? loader = default!)
     {
-        if (!Resolve(loaderUid, ref loader) || !ContainsCartridge(programUid, loader, true))
+        if (!Resolve(loaderUid, ref loader))
+            return false;
+
+        if (!GetInstalled(loaderUid).Contains(programUid))
             return false;
 
         if (loader.ActiveProgram == programUid)
             loader.ActiveProgram = null;
 
         loader.BackgroundPrograms.Remove(programUid);
-        loader.InstalledPrograms.Remove(programUid);
         EntityManager.QueueDeleteEntity(programUid);
         UpdateUserInterfaceState(loaderUid, loader);
         return true;
@@ -194,7 +240,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
         if (!Resolve(loaderUid, ref loader))
             return;
 
-        if (!ContainsCartridge(programUid, loader))
+        if (!HasProgram(loaderUid, programUid, loader))
             return;
 
         if (loader.ActiveProgram.HasValue)
@@ -215,7 +261,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
         if (!Resolve(loaderUid, ref loader))
             return;
 
-        if (!ContainsCartridge(programUid, loader) || loader.ActiveProgram != programUid)
+        if (!HasProgram(loaderUid, programUid, loader) || loader.ActiveProgram != programUid)
             return;
 
         if (!loader.BackgroundPrograms.Contains(programUid))
@@ -236,7 +282,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
         if (!Resolve(loaderUid, ref loader))
             return;
 
-        if (!ContainsCartridge(cartridgeUid, loader))
+        if (!HasProgram(loaderUid, cartridgeUid, loader))
             return;
 
         if (loader.ActiveProgram != cartridgeUid)
@@ -253,7 +299,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
         if (!Resolve(loaderUid, ref loader))
             return;
 
-        if (!ContainsCartridge(cartridgeUid, loader))
+        if (!HasProgram(loaderUid, cartridgeUid, loader))
             return;
 
         if (loader.ActiveProgram != cartridgeUid)
@@ -264,12 +310,18 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
 
     protected override void OnItemInserted(EntityUid uid, CartridgeLoaderComponent loader, EntInsertedIntoContainerMessage args)
     {
+        if (args.Container.ID != InstalledContainerId && args.Container.ID != loader.CartridgeSlot.ID)
+            return;
+
         RaiseLocalEvent(args.Entity, new CartridgeAddedEvent(uid));
         base.OnItemInserted(uid, loader, args);
     }
 
     protected override void OnItemRemoved(EntityUid uid, CartridgeLoaderComponent loader, EntRemovedFromContainerMessage args)
     {
+        if (args.Container.ID != InstalledContainerId && args.Container.ID != loader.CartridgeSlot.ID)
+            return;
+
         var deactivate = loader.BackgroundPrograms.Remove(args.Entity);
 
         if (loader.ActiveProgram == args.Entity)
@@ -283,6 +335,8 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
 
         RaiseLocalEvent(args.Entity, new CartridgeRemovedEvent(uid));
         base.OnItemRemoved(uid, loader, args);
+
+        _pda.UpdatePdaUi(uid);
     }
 
     /// <summary>
@@ -290,6 +344,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
     /// </summary>
     private void OnMapInit(EntityUid uid, CartridgeLoaderComponent component, MapInitEvent args)
     {
+        // TODO remove this and use container fill.
         foreach (var prototype in component.PreinstalledPrograms)
         {
             InstallProgram(uid, prototype, deinstallable: false);
@@ -308,19 +363,21 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
 
     private void OnLoaderUiMessage(EntityUid loaderUid, CartridgeLoaderComponent component, CartridgeLoaderUiMessage message)
     {
+        var cartridge = GetEntity(message.CartridgeUid);
+
         switch (message.Action)
         {
             case CartridgeUiMessageAction.Activate:
-                ActivateProgram(loaderUid, message.CartridgeUid, component);
+                ActivateProgram(loaderUid, cartridge, component);
                 break;
             case CartridgeUiMessageAction.Deactivate:
-                DeactivateProgram(loaderUid, message.CartridgeUid, component);
+                DeactivateProgram(loaderUid, cartridge, component);
                 break;
             case CartridgeUiMessageAction.Install:
-                InstallCartridge(loaderUid, message.CartridgeUid, component);
+                InstallCartridge(loaderUid, cartridge, component);
                 break;
             case CartridgeUiMessageAction.Uninstall:
-                UninstallProgram(loaderUid, message.CartridgeUid, component);
+                UninstallProgram(loaderUid, cartridge, component);
                 break;
             case CartridgeUiMessageAction.UIReady:
                 if (component.ActiveProgram.HasValue)
@@ -337,7 +394,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
     private void OnUiMessage(EntityUid uid, CartridgeLoaderComponent component, CartridgeUiMessage args)
     {
         var cartridgeEvent = args.MessageEvent;
-        cartridgeEvent.LoaderUid = uid;
+        cartridgeEvent.LoaderUid = GetNetEntity(uid);
 
         RelayEvent(component, cartridgeEvent, true);
     }
@@ -367,24 +424,6 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
         }
     }
 
-    /// <summary>
-    /// Searches for a program by its prototype name in the list of installed programs
-    /// </summary>
-    private bool TryFindInstalled(string? prototype, CartridgeLoaderComponent loader, [NotNullWhen(true)] out EntityUid? programUid)
-    {
-        foreach (var program in loader.InstalledPrograms)
-        {
-            if (Prototype(program)?.ID == prototype)
-            {
-                programUid = program;
-                return true;
-            }
-        }
-
-        programUid = default;
-        return false;
-    }
-
     /// <summary>
     /// Shortcut for updating the loaders user interface state without passing in a subtype of <see cref="CartridgeLoaderUiState"/>
     /// like the <see cref="PDA.PdaSystem"/> does when updating its ui state
@@ -392,7 +431,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
     /// <seealso cref="PDA.PdaSystem.UpdatePdaUserInterface"/>
     private void UpdateUserInterfaceState(EntityUid loaderUid, CartridgeLoaderComponent loader)
     {
-        UpdateUiState(loaderUid, new CartridgeLoaderUiState(), null, loader);
+        UpdateUiState(loaderUid, null, loader);
     }
 
     private void UpdateCartridgeInstallationStatus(EntityUid cartridgeUid, InstallationStatus installationStatus, CartridgeComponent? cartridgeComponent = default!)
@@ -400,13 +439,13 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
         if (Resolve(cartridgeUid, ref cartridgeComponent))
         {
             cartridgeComponent.InstallationStatus = installationStatus;
-            Dirty(cartridgeComponent);
+            Dirty(cartridgeUid, cartridgeComponent);
         }
     }
 
-    private static bool ContainsCartridge(EntityUid cartridgeUid, CartridgeLoaderComponent loader, bool onlyInstalled = false)
+    private bool HasProgram(EntityUid loader, EntityUid program, CartridgeLoaderComponent component)
     {
-        return !onlyInstalled && loader.CartridgeSlot.Item?.Equals(cartridgeUid) == true || loader.InstalledPrograms.Contains(cartridgeUid);
+        return component.CartridgeSlot.Item == program || GetInstalled(loader).Contains(program);
     }
 }
 
index 49fb2e17320474584711be16c34e1c552462f283..fca29a401327bf5e8530f55603f95026a317676d 100644 (file)
@@ -4,6 +4,7 @@ using Content.Shared.CartridgeLoader;
 using Content.Shared.CartridgeLoader.Cartridges;
 using Content.Shared.CCVar;
 using Robust.Shared.Configuration;
+using Robust.Shared.Containers;
 using Robust.Shared.Prototypes;
 
 namespace Content.Server.CartridgeLoader.Cartridges;
@@ -41,7 +42,7 @@ public sealed class CrewManifestCartridgeSystem : EntitySystem
     /// </remarks>
     private void OnUiMessage(EntityUid uid, CrewManifestCartridgeComponent component, CartridgeMessageEvent args)
     {
-        UpdateUiState(uid, args.LoaderUid, component);
+        UpdateUiState(uid, GetEntity(args.LoaderUid), component);
     }
 
     /// <summary>
@@ -78,14 +79,17 @@ public sealed class CrewManifestCartridgeSystem : EntitySystem
     {
         _unsecureViewersAllowed = unsecureViewersAllowed;
 
-        var allCartridgeLoaders = AllEntityQuery<CartridgeLoaderComponent>();
-
-        while (allCartridgeLoaders.MoveNext(out EntityUid loaderUid, out CartridgeLoaderComponent? comp))
+        var allCartridgeLoaders = AllEntityQuery<CartridgeLoaderComponent, ContainerManagerComponent>();
+        while (allCartridgeLoaders.MoveNext(out var loaderUid, out var comp, out var cont))
         {
             if (_unsecureViewersAllowed)
-                _cartridgeLoader?.InstallProgram(loaderUid, CartridgePrototypeName, false, comp);
-            else
-                _cartridgeLoader?.UninstallProgram(loaderUid, CartridgePrototypeName, comp);
+            {
+                _cartridgeLoader.InstallProgram(loaderUid, CartridgePrototypeName, false, comp);
+                return;
+            }
+
+            if (_cartridgeLoader.TryGetProgram<CrewManifestCartridgeComponent>(loaderUid, out var program, true, comp, cont))
+                _cartridgeLoader.UninstallProgram(loaderUid, program.Value, comp);
         }
     }
 
index 92c6ea6d76134d2d0e218ac91dd9428d659b3f7b..287f68240241a859c7bdb3667e86c639afe27da1 100644 (file)
@@ -42,7 +42,7 @@ public sealed class NotekeeperCartridgeSystem : EntitySystem
             component.Notes.Remove(message.Note);
         }
 
-        UpdateUiState(uid, args.LoaderUid, component);
+        UpdateUiState(uid, GetEntity(args.LoaderUid), component);
     }
 
 
index 5790e4f376ae49a822747dbf22d794a3ba262779..602f9e8af0f21b9c97a813fe0f66eb8cef662be9 100644 (file)
@@ -22,7 +22,7 @@ public sealed class CharacterInfoSystem : EntitySystem
     private void OnRequestCharacterInfoEvent(RequestCharacterInfoEvent msg, EntitySessionEventArgs args)
     {
         if (!args.SenderSession.AttachedEntity.HasValue
-            || args.SenderSession.AttachedEntity != msg.EntityUid)
+            || args.SenderSession.AttachedEntity != GetEntity(msg.NetEntity))
             return;
 
         var entity = args.SenderSession.AttachedEntity.Value;
@@ -51,6 +51,6 @@ public sealed class CharacterInfoSystem : EntitySystem
             briefing = _roles.MindGetBriefing(mindId);
         }
 
-        RaiseNetworkEvent(new CharacterInfoEvent(entity, jobTitle, conditions, briefing), args.SenderSession);
+        RaiseNetworkEvent(new CharacterInfoEvent(GetNetEntity(entity), jobTitle, conditions, briefing), args.SenderSession);
     }
 }
index cecd08a7c6b382d569cfb46452034e5ce1d0253b..aa055e44914f0b4662345971151b14894728f5ad 100644 (file)
@@ -242,7 +242,7 @@ namespace Content.Server.Chat.Managers
 
         public void ChatMessageToOne(ChatChannel channel, string message, string wrappedMessage, EntityUid source, bool hideChat, INetChannel client, Color? colorOverride = null, bool recordReplay = false, string? audioPath = null, float audioVolume = 0)
         {
-            var msg = new ChatMessage(channel, message, wrappedMessage, source, hideChat, colorOverride, audioPath, audioVolume);
+            var msg = new ChatMessage(channel, message, wrappedMessage, _entityManager.GetNetEntity(source), hideChat, colorOverride, audioPath, audioVolume);
             _netManager.ServerSendMessage(new MsgChatMessage() { Message = msg }, client);
 
             if (!recordReplay)
@@ -260,7 +260,7 @@ namespace Content.Server.Chat.Managers
 
         public void ChatMessageToMany(ChatChannel channel, string message, string wrappedMessage, EntityUid source, bool hideChat, bool recordReplay, List<INetChannel> clients, Color? colorOverride = null, string? audioPath = null, float audioVolume = 0)
         {
-            var msg = new ChatMessage(channel, message, wrappedMessage, source, hideChat, colorOverride, audioPath, audioVolume);
+            var msg = new ChatMessage(channel, message, wrappedMessage, _entityManager.GetNetEntity(source), hideChat, colorOverride, audioPath, audioVolume);
             _netManager.ServerSendToMany(new MsgChatMessage() { Message = msg }, clients);
 
             if (!recordReplay)
@@ -290,7 +290,7 @@ namespace Content.Server.Chat.Managers
 
         public void ChatMessageToAll(ChatChannel channel, string message, string wrappedMessage, EntityUid source, bool hideChat, bool recordReplay, Color? colorOverride = null,  string? audioPath = null, float audioVolume = 0)
         {
-            var msg = new ChatMessage(channel, message, wrappedMessage, source, hideChat, colorOverride, audioPath, audioVolume);
+            var msg = new ChatMessage(channel, message, wrappedMessage, _entityManager.GetNetEntity(source), hideChat, colorOverride, audioPath, audioVolume);
             _netManager.ServerSendToAll(new MsgChatMessage() { Message = msg });
 
             if (!recordReplay)
index 5d2706522991de2fd5ee5e77a877564dc5d99aa4..acc375b8b11d59d0c015af35df652add0a4a51e9 100644 (file)
@@ -484,7 +484,7 @@ public sealed partial class ChatSystem : SharedChatSystem
                 _chatManager.ChatMessageToOne(ChatChannel.Whisper, obfuscatedMessage, wrappedUnknownMessage, source, false, session.ConnectedClient);
         }
 
-        _replay.RecordServerMessage(new ChatMessage(ChatChannel.Whisper, message, wrappedMessage, source, MessageRangeHideChatForReplay(range)));
+        _replay.RecordServerMessage(new ChatMessage(ChatChannel.Whisper, message, wrappedMessage, GetNetEntity(source), MessageRangeHideChatForReplay(range)));
 
         var ev = new EntitySpokeEvent(source, message, channel, obfuscatedMessage);
         RaiseLocalEvent(source, ev, true);
@@ -651,7 +651,7 @@ public sealed partial class ChatSystem : SharedChatSystem
             _chatManager.ChatMessageToOne(channel, message, wrappedMessage, source, entHideChat, session.ConnectedClient);
         }
 
-        _replay.RecordServerMessage(new ChatMessage(channel, message, wrappedMessage, source, MessageRangeHideChatForReplay(range)));
+        _replay.RecordServerMessage(new ChatMessage(channel, message, wrappedMessage, GetNetEntity(source), MessageRangeHideChatForReplay(range)));
     }
 
     /// <summary>
index f3bac645d766c843b68821c077ac6f838a7173b5..eb4c274c9405badf8a9441dc8ee523c8671ab739 100644 (file)
@@ -259,7 +259,7 @@ public sealed partial class ChemistrySystem
                 _adminLogger.Add(LogType.Ingestion, $"{EntityManager.ToPrettyString(user):user} is attempting to inject themselves with a solution {SolutionContainerSystem.ToPrettyString(solution):solution}.");
         }
 
-        _doAfter.TryStartDoAfter(new DoAfterArgs(user, actualDelay, new InjectorDoAfterEvent(), injector, target: target, used: injector)
+        _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, actualDelay, new InjectorDoAfterEvent(), injector, target: target, used: injector)
         {
             BreakOnUserMove = true,
             BreakOnDamage = true,
index f04a720fc93e7415ba716e5e9e10862c64a7681e..f204b5cf7290d411d6ec91a7c1cd2b87e3961d2f 100644 (file)
@@ -20,11 +20,14 @@ public sealed class ChunkingSystem : EntitySystem
     [Dependency] private readonly IMapManager _mapManager = default!;
     [Dependency] private readonly SharedTransformSystem _transform = default!;
 
+    private EntityQuery<TransformComponent> _xformQuery;
+
     private Box2 _baseViewBounds;
 
     public override void Initialize()
     {
         base.Initialize();
+        _xformQuery = GetEntityQuery<TransformComponent>();
         _configurationManager.OnValueChanged(CVars.NetMaxUpdateRange, OnPvsRangeChanged, true);
     }
 
@@ -36,16 +39,15 @@ public sealed class ChunkingSystem : EntitySystem
 
     private void OnPvsRangeChanged(float value) => _baseViewBounds = Box2.UnitCentered.Scale(value);
 
-    public Dictionary<EntityUid, HashSet<Vector2i>> GetChunksForSession(
+    public Dictionary<NetEntity, HashSet<Vector2i>> GetChunksForSession(
         IPlayerSession session,
         int chunkSize,
-        EntityQuery<TransformComponent> xformQuery,
         ObjectPool<HashSet<Vector2i>> indexPool,
-        ObjectPool<Dictionary<EntityUid, HashSet<Vector2i>>> viewerPool,
+        ObjectPool<Dictionary<NetEntity, HashSet<Vector2i>>> viewerPool,
         float? viewEnlargement = null)
     {
         var viewers = GetSessionViewers(session);
-        var chunks = GetChunksForViewers(viewers, chunkSize, indexPool, viewerPool, viewEnlargement ?? chunkSize, xformQuery);
+        var chunks = GetChunksForViewers(viewers, chunkSize, indexPool, viewerPool, viewEnlargement ?? chunkSize);
         return chunks;
     }
 
@@ -65,37 +67,38 @@ public sealed class ChunkingSystem : EntitySystem
         return viewers;
     }
 
-    private Dictionary<EntityUid, HashSet<Vector2i>> GetChunksForViewers(
+    private Dictionary<NetEntity, HashSet<Vector2i>> GetChunksForViewers(
         HashSet<EntityUid> viewers,
         int chunkSize,
         ObjectPool<HashSet<Vector2i>> indexPool,
-        ObjectPool<Dictionary<EntityUid, HashSet<Vector2i>>> viewerPool,
-        float viewEnlargement,
-        EntityQuery<TransformComponent> xformQuery)
+        ObjectPool<Dictionary<NetEntity, HashSet<Vector2i>>> viewerPool,
+        float viewEnlargement)
     {
-        Dictionary<EntityUid, HashSet<Vector2i>> chunks = viewerPool.Get();
+        var chunks = viewerPool.Get();
         DebugTools.Assert(chunks.Count == 0);
 
         foreach (var viewerUid in viewers)
         {
-            if (!xformQuery.TryGetComponent(viewerUid, out var xform))
+            if (!_xformQuery.TryGetComponent(viewerUid, out var xform))
             {
-                Log.Error($"Player has deleted viewer entities? Viewers: {string.Join(", ", viewers.Select(x => ToPrettyString(x)))}");
+                Log.Error($"Player has deleted viewer entities? Viewers: {string.Join(", ", viewers.Select(ToPrettyString))}");
                 continue;
             }
 
-            var pos = _transform.GetWorldPosition(xform, xformQuery);
+            var pos = _transform.GetWorldPosition(xform);
             var bounds = _baseViewBounds.Translated(pos).Enlarged(viewEnlargement);
 
             foreach (var grid in _mapManager.FindGridsIntersecting(xform.MapID, bounds, true))
             {
-                if (!chunks.TryGetValue(grid.Owner, out var set))
+                var netGrid = GetNetEntity(grid.Owner);
+
+                if (!chunks.TryGetValue(netGrid, out var set))
                 {
-                    chunks[grid.Owner] = set = indexPool.Get();
+                    chunks[netGrid] = set = indexPool.Get();
                     DebugTools.Assert(set.Count == 0);
                 }
 
-                var enumerator = new ChunkIndicesEnumerator(_transform.GetInvWorldMatrix(grid.Owner, xformQuery).TransformBox(bounds), chunkSize);
+                var enumerator = new ChunkIndicesEnumerator(_transform.GetInvWorldMatrix(grid.Owner).TransformBox(bounds), chunkSize);
 
                 while (enumerator.MoveNext(out var indices))
                 {
index 539463eed4030e243b8e312175920ac53af7f33e..08830fc89c01004d86fb7f0ca40079253046db73 100644 (file)
@@ -128,7 +128,7 @@ public sealed class ClimbSystem : SharedClimbSystem
         if (climbing.IsClimbing)
             return true;
 
-        var args = new DoAfterArgs(user, comp.ClimbDelay, new ClimbDoAfterEvent(), entityToMove, target: climbable, used: entityToMove)
+        var args = new DoAfterArgs(EntityManager, user, comp.ClimbDelay, new ClimbDoAfterEvent(), entityToMove, target: climbable, used: entityToMove)
         {
             BreakOnTargetMove = true,
             BreakOnUserMove = true,
index aea0532bfc0a3930fb8339d72eb5058b15bbbbd1..29f42bf6c216cd92f623df54d0de36aba68a1be3 100644 (file)
@@ -145,7 +145,7 @@ namespace Content.Server.Cloning
             }
 
             var newState = GetUserInterfaceState(consoleComponent);
-            UserInterfaceSystem.SetUiState(ui, newState);
+            _uiSystem.SetUiState(ui, newState);
         }
 
         public void TryClone(EntityUid uid, EntityUid cloningPodUid, EntityUid scannerUid, CloningPodComponent? cloningPod = null, MedicalScannerComponent? scannerComp = null, CloningConsoleComponent? consoleComponent = null)
index 6ef9e1b1bba1ced108fc97349420bc437f1ac15a..95cad6eb97411f97aa52686d017acb7a711fbb49 100644 (file)
@@ -38,7 +38,7 @@ public sealed class CommsHackerSystem : SharedCommsHackerSystem
         if (!_gloves.AbilityCheck(uid, args, out var target))
             return;
 
-        var doAfterArgs = new DoAfterArgs(uid, comp.Delay, new TerrorDoAfterEvent(), target: target, used: uid, eventTarget: uid)
+        var doAfterArgs = new DoAfterArgs(EntityManager, uid, comp.Delay, new TerrorDoAfterEvent(), target: target, used: uid, eventTarget: uid)
         {
             BreakOnDamage = true,
             BreakOnUserMove = true,
index b78389b57d4741f60236b8e99384b769d282f77a..b7ad536816a95cbe6d275a71d973b2a82449e2e0 100644 (file)
@@ -31,6 +31,7 @@ namespace Content.Server.Communications
         [Dependency] private readonly PopupSystem _popupSystem = default!;
         [Dependency] private readonly RoundEndSystem _roundEndSystem = default!;
         [Dependency] private readonly StationSystem _stationSystem = default!;
+        [Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
         [Dependency] private readonly IConfigurationManager _cfg = default!;
         [Dependency] private readonly IAdminLogManager _adminLogger = default!;
 
@@ -151,7 +152,7 @@ namespace Content.Server.Communications
             }
 
             if (comp.UserInterface is not null)
-                UserInterfaceSystem.SetUiState(comp.UserInterface, new CommunicationsConsoleInterfaceState(
+                _uiSystem.SetUiState(comp.UserInterface, new CommunicationsConsoleInterfaceState(
                     CanAnnounce(comp),
                     CanCallOrRecall(comp),
                     levels,
index cfe580f3914d94717e744cec8f8390162a9cf92d..c134c1a87d9809568f3cfa72f242a448c35b7569 100644 (file)
@@ -43,7 +43,7 @@ public sealed class ConfigurationSystem : EntitySystem
     private void UpdateUi(EntityUid uid, ConfigurationComponent component)
     {
         if (_uiSystem.TryGetUi(uid, ConfigurationUiKey.Key, out var ui))
-            UserInterfaceSystem.SetUiState(ui, new ConfigurationBoundUserInterfaceState(component.Config));
+            _uiSystem.SetUiState(ui, new ConfigurationBoundUserInterfaceState(component.Config));
     }
 
     private void OnUpdate(EntityUid uid, ConfigurationComponent component, ConfigurationUpdatedMessage args)
index 307f0159a99be5076dce5b6e89dd7b23e66ed87d..02429fcaa621de86647097d5a370380ea8524e04 100644 (file)
@@ -10,8 +10,11 @@ using Robust.Shared.Map;
 namespace Content.Server.Construction.Commands
 {
     [AdminCommand(AdminFlags.Mapping)]
-    sealed class FixRotationsCommand : IConsoleCommand
+    public sealed class FixRotationsCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+        [Dependency] private readonly IMapManager _mapManager = default!;
+
         // ReSharper disable once StringLiteralTypo
         public string Command => "fixrotations";
         public string Description => "Sets the rotation of all occluders, low walls and windows to south.";
@@ -20,9 +23,8 @@ namespace Content.Server.Construction.Commands
         public void Execute(IConsoleShell shell, string argsOther, string[] args)
         {
             var player = shell.Player as IPlayerSession;
-            var entityManager = IoCManager.Resolve<IEntityManager>();
             EntityUid? gridId;
-            var xformQuery = entityManager.GetEntityQuery<TransformComponent>();
+            var xformQuery = _entManager.GetEntityQuery<TransformComponent>();
 
             switch (args.Length)
             {
@@ -36,7 +38,7 @@ namespace Content.Server.Construction.Commands
                     gridId = xformQuery.GetComponent(playerEntity).GridUid;
                     break;
                 case 1:
-                    if (!EntityUid.TryParse(args[0], out var id))
+                    if (!NetEntity.TryParse(args[0], out var idNet) || !_entManager.TryGetEntity(idNet, out var id))
                     {
                         shell.WriteError($"{args[0]} is not a valid entity.");
                         return;
@@ -49,25 +51,24 @@ namespace Content.Server.Construction.Commands
                     return;
             }
 
-            var mapManager = IoCManager.Resolve<IMapManager>();
-            if (!mapManager.TryGetGrid(gridId, out var grid))
+            if (!_mapManager.TryGetGrid(gridId, out var grid))
             {
                 shell.WriteError($"No grid exists with id {gridId}");
                 return;
             }
 
-            if (!entityManager.EntityExists(grid.Owner))
+            if (!_entManager.EntityExists(grid.Owner))
             {
                 shell.WriteError($"Grid {gridId} doesn't have an associated grid entity.");
                 return;
             }
 
             var changed = 0;
-            var tagSystem = entityManager.EntitySysManager.GetEntitySystem<TagSystem>();
+            var tagSystem = _entManager.EntitySysManager.GetEntitySystem<TagSystem>();
 
             foreach (var child in xformQuery.GetComponent(grid.Owner).ChildEntities)
             {
-                if (!entityManager.EntityExists(child))
+                if (!_entManager.EntityExists(child))
                 {
                     continue;
                 }
@@ -76,14 +77,14 @@ namespace Content.Server.Construction.Commands
 
                 // Occluders should only count if the state of it right now is enabled.
                 // This prevents issues with edge firelocks.
-                if (entityManager.TryGetComponent<OccluderComponent>(child, out var occluder))
+                if (_entManager.TryGetComponent<OccluderComponent>(child, out var occluder))
                 {
                     valid |= occluder.Enabled;
                 }
                 // low walls & grilles
-                valid |= entityManager.HasComponent<SharedCanBuildWindowOnTopComponent>(child);
+                valid |= _entManager.HasComponent<SharedCanBuildWindowOnTopComponent>(child);
                 // cables
-                valid |= entityManager.HasComponent<CableComponent>(child);
+                valid |= _entManager.HasComponent<CableComponent>(child);
                 // anything else that might need this forced
                 valid |= tagSystem.HasTag(child, "ForceFixRotations");
                 // override
index c730c81f8d8cb18d0c8843e399b7c68597fe3885..7de6c510d499bffbd7f1b91da2a1abe6df80479e 100644 (file)
@@ -9,6 +9,10 @@ namespace Content.Server.Construction.Commands;
 [AdminCommand(AdminFlags.Mapping)]
 sealed class TileReplaceCommand : IConsoleCommand
 {
+    [Dependency] private readonly IEntityManager _entManager = default!;
+    [Dependency] private readonly IMapManager _mapManager = default!;
+    [Dependency] private readonly ITileDefinitionManager _tileDef = default!;
+
     // ReSharper disable once StringLiteralTypo
     public string Command => "tilereplace";
     public string Description => "Replaces one tile with another.";
@@ -17,7 +21,6 @@ sealed class TileReplaceCommand : IConsoleCommand
     public void Execute(IConsoleShell shell, string argStr, string[] args)
     {
         var player = shell.Player as IPlayerSession;
-        var entityManager = IoCManager.Resolve<IEntityManager>();
         EntityUid? gridId;
         string tileIdA;
         string tileIdB;
@@ -31,12 +34,13 @@ sealed class TileReplaceCommand : IConsoleCommand
                     return;
                 }
 
-                gridId = entityManager.GetComponent<TransformComponent>(playerEntity).GridUid;
+                gridId = _entManager.GetComponent<TransformComponent>(playerEntity).GridUid;
                 tileIdA = args[0];
                 tileIdB = args[1];
                 break;
             case 3:
-                if (!EntityUid.TryParse(args[0], out var id))
+                if (!NetEntity.TryParse(args[0], out var idNet) ||
+                    !_entManager.TryGetEntity(idNet, out var id))
                 {
                     shell.WriteLine($"{args[0]} is not a valid entity.");
                     return;
@@ -51,18 +55,16 @@ sealed class TileReplaceCommand : IConsoleCommand
                 return;
         }
 
-        var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
-        var tileA = tileDefinitionManager[tileIdA];
-        var tileB = tileDefinitionManager[tileIdB];
+        var tileA = _tileDef[tileIdA];
+        var tileB = _tileDef[tileIdB];
 
-        var mapManager = IoCManager.Resolve<IMapManager>();
-        if (!mapManager.TryGetGrid(gridId, out var grid))
+        if (!_mapManager.TryGetGrid(gridId, out var grid))
         {
             shell.WriteLine($"No grid exists with id {gridId}");
             return;
         }
 
-        if (!entityManager.EntityExists(grid.Owner))
+        if (!_entManager.EntityExists(grid.Owner))
         {
             shell.WriteLine($"Grid {gridId} doesn't have an associated grid entity.");
             return;
index af079405d2fee883b4339506cc281b46afbf07e3..e91935036487692d706cee498dc74644db16e672 100644 (file)
@@ -11,6 +11,10 @@ namespace Content.Server.Construction.Commands
     [AdminCommand(AdminFlags.Mapping)]
     sealed class TileWallsCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+        [Dependency] private readonly IMapManager _mapManager = default!;
+        [Dependency] private readonly ITileDefinitionManager _tileDefManager = default!;
+
         // ReSharper disable once StringLiteralTypo
         public string Command => "tilewalls";
         public string Description => "Puts an underplating tile below every wall on a grid.";
@@ -25,7 +29,6 @@ namespace Content.Server.Construction.Commands
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
             var player = shell.Player as IPlayerSession;
-            var entityManager = IoCManager.Resolve<IEntityManager>();
             EntityUid? gridId;
 
             switch (args.Length)
@@ -37,10 +40,10 @@ namespace Content.Server.Construction.Commands
                         return;
                     }
 
-                    gridId = entityManager.GetComponent<TransformComponent>(playerEntity).GridUid;
+                    gridId = _entManager.GetComponent<TransformComponent>(playerEntity).GridUid;
                     break;
                 case 1:
-                    if (!EntityUid.TryParse(args[0], out var id))
+                    if (!NetEntity.TryParse(args[0], out var idNet) || !_entManager.TryGetEntity(idNet, out var id))
                     {
                         shell.WriteLine($"{args[0]} is not a valid entity.");
                         return;
@@ -53,27 +56,25 @@ namespace Content.Server.Construction.Commands
                     return;
             }
 
-            var mapManager = IoCManager.Resolve<IMapManager>();
-            if (!mapManager.TryGetGrid(gridId, out var grid))
+            if (!_mapManager.TryGetGrid(gridId, out var grid))
             {
                 shell.WriteLine($"No grid exists with id {gridId}");
                 return;
             }
 
-            if (!entityManager.EntityExists(grid.Owner))
+            if (!_entManager.EntityExists(grid.Owner))
             {
                 shell.WriteLine($"Grid {gridId} doesn't have an associated grid entity.");
                 return;
             }
 
-            var tileDefinitionManager = IoCManager.Resolve<ITileDefinitionManager>();
-            var tagSystem = entityManager.EntitySysManager.GetEntitySystem<TagSystem>();
-            var underplating = tileDefinitionManager[TilePrototypeId];
+            var tagSystem = _entManager.EntitySysManager.GetEntitySystem<TagSystem>();
+            var underplating = _tileDefManager[TilePrototypeId];
             var underplatingTile = new Tile(underplating.TileId);
             var changed = 0;
-            foreach (var child in entityManager.GetComponent<TransformComponent>(grid.Owner).ChildEntities)
+            foreach (var child in _entManager.GetComponent<TransformComponent>(grid.Owner).ChildEntities)
             {
-                if (!entityManager.EntityExists(child))
+                if (!_entManager.EntityExists(child))
                 {
                     continue;
                 }
@@ -83,7 +84,7 @@ namespace Content.Server.Construction.Commands
                     continue;
                 }
 
-                var childTransform = entityManager.GetComponent<TransformComponent>(child);
+                var childTransform = _entManager.GetComponent<TransformComponent>(child);
 
                 if (!childTransform.Anchored)
                 {
@@ -91,7 +92,7 @@ namespace Content.Server.Construction.Commands
                 }
 
                 var tile = grid.GetTileRef(childTransform.Coordinates);
-                var tileDef = (ContentTileDefinition) tileDefinitionManager[tile.Tile.TypeId];
+                var tileDef = (ContentTileDefinition) _tileDefManager[tile.Tile.TypeId];
 
                 if (tileDef.ID == TilePrototypeId)
                 {
index 2284ade6bd21f3c4c9b506a07511e74dd9241e75..5c2aecb548aa834747e7e95e5cf1d0663c492b7d 100644 (file)
@@ -247,7 +247,7 @@ namespace Content.Server.Construction
                 return null;
             }
 
-            var doAfterArgs = new DoAfterArgs(user, doAfterTime, new AwaitedDoAfterEvent(), null)
+            var doAfterArgs = new DoAfterArgs(EntityManager, user, doAfterTime, new AwaitedDoAfterEvent(), null)
             {
                 BreakOnDamage = true,
                 BreakOnTargetMove = false,
@@ -432,9 +432,11 @@ namespace Content.Server.Construction
                 _beingBuilt[args.SenderSession] = newSet;
             }
 
+            var location = GetCoordinates(ev.Location);
+
             foreach (var condition in constructionPrototype.Conditions)
             {
-                if (!condition.Condition(user, ev.Location, ev.Angle.GetCardinalDir()))
+                if (!condition.Condition(user, location, ev.Angle.GetCardinalDir()))
                 {
                     Cleanup();
                     return;
@@ -453,7 +455,7 @@ namespace Content.Server.Construction
                 return;
             }
 
-            var mapPos = ev.Location.ToMap(EntityManager);
+            var mapPos = location.ToMap(EntityManager);
             var predicate = GetPredicate(constructionPrototype.CanBuildInImpassable, mapPos);
 
             if (!_interactionSystem.InRangeUnobstructed(user, mapPos, predicate: predicate))
@@ -515,11 +517,11 @@ namespace Content.Server.Construction
             var xform = Transform(structure);
             var wasAnchored = xform.Anchored;
             xform.Anchored = false;
-            xform.Coordinates = ev.Location;
+            xform.Coordinates = GetCoordinates(ev.Location);
             xform.LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.Zero;
             xform.Anchored = wasAnchored;
 
-            RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack, structure));
+            RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack, GetNetEntity(structure)));
             _adminLogger.Add(LogType.Construction, LogImpact.Low, $"{ToPrettyString(user):player} has turned a {ev.PrototypeName} construction ghost into {ToPrettyString(structure)} at {Transform(structure).Coordinates}");
             Cleanup();
         }
index 3336736fac8cef180f18c56b4e098222a1c0eea5..e6c0f039b021478e1561407c2df8941666339346 100644 (file)
@@ -240,7 +240,7 @@ namespace Content.Server.Construction
                     interactDoAfter.User,
                     interactDoAfter.Used!.Value,
                     uid,
-                    interactDoAfter.ClickLocation);
+                    GetCoordinates(interactDoAfter.ClickLocation));
 
                 doAfterState = DoAfterState.Completed;
             }
@@ -281,9 +281,9 @@ namespace Content.Server.Construction
                     // If we still haven't completed this step's DoAfter...
                     if (doAfterState == DoAfterState.None && insertStep.DoAfter > 0)
                     {
-                        var doAfterEv = new ConstructionInteractDoAfterEvent(interactUsing);
+                        var doAfterEv = new ConstructionInteractDoAfterEvent(EntityManager, interactUsing);
 
-                        var doAfterEventArgs = new DoAfterArgs(interactUsing.User, step.DoAfter, doAfterEv, uid, uid, interactUsing.Used)
+                        var doAfterEventArgs = new DoAfterArgs(EntityManager, interactUsing.User, step.DoAfter, doAfterEv, uid, uid, interactUsing.Used)
                         {
                             BreakOnDamage = false,
                             BreakOnTargetMove = true,
@@ -367,7 +367,7 @@ namespace Content.Server.Construction
                         uid,
                         TimeSpan.FromSeconds(toolInsertStep.DoAfter),
                         new [] { toolInsertStep.Tool },
-                        new ConstructionInteractDoAfterEvent(interactUsing),
+                        new ConstructionInteractDoAfterEvent(EntityManager, interactUsing),
                         out var doAfter);
 
                     return result && doAfter != null ? HandleResult.DoAfter : HandleResult.False;
index f5d7a4c35456fceb641e6e3ceb7a46b73639bacd..a4030a70d4cb84dec268487b720b8659fd6a4e99 100644 (file)
@@ -170,7 +170,7 @@ public sealed class PartExchangerSystem : EntitySystem
 
         component.AudioStream = _audio.PlayPvs(component.ExchangeSound, uid);
 
-        _doAfter.TryStartDoAfter(new DoAfterArgs(args.User, component.ExchangeDuration, new ExchangerDoAfterEvent(), uid, target: args.Target, used: uid)
+        _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.ExchangeDuration, new ExchangerDoAfterEvent(), uid, target: args.Target, used: uid)
         {
             BreakOnDamage = true,
             BreakOnUserMove = true
index fd684f53d7cfcf2411dbb3f9238631f259c3675b..7cc2c20d897e22f1793fa23f297b9204fea45ff2 100644 (file)
@@ -99,7 +99,7 @@ public sealed class CrayonSystem : SharedCrayonSystem
         if (component.UserInterface?.SubscribedSessions.Contains(actor.PlayerSession) == true)
         {
             // Tell the user interface the selected stuff
-            UserInterfaceSystem.SetUiState(component.UserInterface, new CrayonBoundUserInterfaceState(component.SelectedState, component.SelectableColor, component.Color));
+            _uiSystem.SetUiState(component.UserInterface, new CrayonBoundUserInterfaceState(component.SelectedState, component.SelectableColor, component.Color));
         }
 
         args.Handled = true;
index 23cd9c88ea662fd6911c1bcafc84a21e8f18c711..9471c88c9eaa146617ee50ffffc020f8ca4cbfbe 100644 (file)
@@ -65,7 +65,7 @@ public sealed class CrewManifestSystem : EntitySystem
             return;
         }
 
-        OpenEui(message.Id, sessionCast);
+        OpenEui(GetEntity(message.Id), sessionCast);
     }
 
     // Not a big fan of this one. Rebuilds the crew manifest every time
@@ -213,15 +213,7 @@ public sealed class CrewManifestSystem : EntitySystem
         }
 
         entries.Entries = entries.Entries.OrderBy(e => e.JobTitle).ThenBy(e => e.Name).ToList();
-
-        if (_cachedEntries.ContainsKey(station))
-        {
-            _cachedEntries[station] = entries;
-        }
-        else
-        {
-            _cachedEntries.Add(station, entries);
-        }
+        _cachedEntries[station] = entries;
     }
 }
 
@@ -247,7 +239,7 @@ public sealed class CrewManifestCommand : IConsoleCommand
             return;
         }
 
-        if (!EntityUid.TryParse(args[0], out var uid))
+        if (!NetEntity.TryParse(args[0], out var uidNet) || !_entityManager.TryGetEntity(uidNet, out var uid))
         {
             shell.WriteLine($"{args[0]} is not a valid entity UID.");
             return;
@@ -261,7 +253,7 @@ public sealed class CrewManifestCommand : IConsoleCommand
 
         var crewManifestSystem = _entityManager.System<CrewManifestSystem>();
 
-        crewManifestSystem.OpenEui(uid, session);
+        crewManifestSystem.OpenEui(uid.Value, session);
     }
 
     public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
index d5d3d32b59974fc8719d0d68831ef1ae26e72fbe..92a0e53f0f0b0778e361ae95fe1b0b57525a7171 100644 (file)
@@ -10,6 +10,8 @@ namespace Content.Server.Damage.Commands
     [AdminCommand(AdminFlags.Admin)]
     public sealed class GodModeCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "godmode";
         public string Description => "Makes your entity or another invulnerable to almost anything. May have irreversible changes.";
         public string Help => $"Usage: {Command} / {Command} <entityUid>";
@@ -19,8 +21,6 @@ namespace Content.Server.Damage.Commands
             var player = shell.Player as IPlayerSession;
             EntityUid entity;
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
-
             switch (args.Length)
             {
                 case 0:
@@ -39,29 +39,29 @@ namespace Content.Server.Damage.Commands
                     entity = player.AttachedEntity.Value;
                     break;
                 case 1:
-                    if (!EntityUid.TryParse(args[0], out var id))
+                    if (!NetEntity.TryParse(args[0], out var idNet) || !_entManager.TryGetEntity(idNet, out var id))
                     {
                         shell.WriteLine($"{args[0]} isn't a valid entity id.");
                         return;
                     }
 
-                    if (!entityManager.EntityExists(id))
+                    if (!_entManager.EntityExists(id))
                     {
                         shell.WriteLine($"No entity found with id {id}.");
                         return;
                     }
 
-                    entity = id;
+                    entity = id.Value;
                     break;
                 default:
                     shell.WriteLine(Help);
                     return;
             }
 
-            var godmodeSystem = EntitySystem.Get<SharedGodmodeSystem>();
+            var godmodeSystem = _entManager.System<SharedGodmodeSystem>();
             var enabled = godmodeSystem.ToggleGodmode(entity);
 
-            var name = entityManager.GetComponent<MetaDataComponent>(entity).EntityName;
+            var name = _entManager.GetComponent<MetaDataComponent>(entity).EntityName;
 
             shell.WriteLine(enabled
                 ? $"Enabled godmode for entity {name} with id {entity}"
index 8e00ad14b2a7fb43205cdb1556a1950ff8dea26d..af9c1ee8fc3130eefe162c26034a59e848d5a24e 100644 (file)
@@ -13,15 +13,13 @@ namespace Content.Server.Damage.Commands
     [AdminCommand(AdminFlags.Fun)]
     sealed class DamageCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+        [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
+
         public string Command => "damage";
         public string Description => Loc.GetString("damage-command-description");
         public string Help => Loc.GetString("damage-command-help", ("command", Command));
 
-        private readonly IPrototypeManager _prototypeManager = default!;
-        public DamageCommand() {
-            _prototypeManager = IoCManager.Resolve<IPrototypeManager>();
-        }
-
         public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
         {
             if (args.Length == 1)
@@ -75,28 +73,27 @@ namespace Content.Server.Damage.Commands
                 func = (entity, ignoreResistances) =>
                 {
                     var damage = new DamageSpecifier(damageGroup, amount);
-                    EntitySystem.Get<DamageableSystem>().TryChangeDamage(entity, damage, ignoreResistances);
+                    _entManager.System<DamageableSystem>().TryChangeDamage(entity, damage, ignoreResistances);
                 };
 
                 return true;
             }
             // Fall back to DamageType
-            else if (_prototypeManager.TryIndex<DamageTypePrototype>(args[0], out var damageType))
+
+            if (_prototypeManager.TryIndex<DamageTypePrototype>(args[0], out var damageType))
             {
                 func = (entity, ignoreResistances) =>
                 {
                     var damage = new DamageSpecifier(damageType, amount);
-                    EntitySystem.Get<DamageableSystem>().TryChangeDamage(entity, damage, ignoreResistances);
+                    _entManager.System<DamageableSystem>().TryChangeDamage(entity, damage, ignoreResistances);
                 };
                 return true;
 
             }
-            else
-            {
-                shell.WriteLine(Loc.GetString("damage-command-error-type", ("arg", args[0])));
-                func = null;
-                return false;
-            }
+
+            shell.WriteLine(Loc.GetString("damage-command-error-type", ("arg", args[0])));
+            func = null;
+            return false;
         }
 
         public void Execute(IConsoleShell shell, string argStr, string[] args)
@@ -107,11 +104,11 @@ namespace Content.Server.Damage.Commands
                 return;
             }
 
-            EntityUid target;
-            var entMan = IoCManager.Resolve<IEntityManager>();
+            EntityUid? target;
+
             if (args.Length == 4)
             {
-                if (!EntityUid.TryParse(args[3], out target) || !entMan.EntityExists(target))
+                if (!_entManager.TryParseNetEntity(args[3], out target) || !_entManager.EntityExists(target))
                 {
                     shell.WriteLine(Loc.GetString("damage-command-error-euid", ("arg", args[3])));
                     return;
@@ -127,7 +124,7 @@ namespace Content.Server.Damage.Commands
                 return;
             }
 
-            if (!TryParseDamageArgs(shell, target, args, out var damageFunc))
+            if (!TryParseDamageArgs(shell, target.Value, args, out var damageFunc))
                 return;
 
             bool ignoreResistances;
@@ -144,7 +141,7 @@ namespace Content.Server.Damage.Commands
                 ignoreResistances = false;
             }
 
-            damageFunc(target, ignoreResistances);
+            damageFunc(target.Value, ignoreResistances);
         }
     }
 }
index be57d9178665e7b5c857f55bfd6849e11d71a1a1..b780f0686ddafd57cc59b2be50fb0c85cb7a9fd6 100644 (file)
@@ -12,6 +12,10 @@ namespace Content.Server.Decals.Commands
     [AdminCommand(AdminFlags.Mapping)]
     public sealed class AddDecalCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+        [Dependency] private readonly IMapManager _mapManager = default!;
+        [Dependency] private readonly IPrototypeManager _protoManager = default!;
+
         public string Command => "adddecal";
         public string Description => "Creates a decal on the map";
         public string Help => $"{Command} <id> <x position> <y position> <gridId> [angle=<angle> zIndex=<zIndex> color=<color>]";
@@ -23,7 +27,7 @@ namespace Content.Server.Decals.Commands
                 return;
             }
 
-            if (!IoCManager.Resolve<IPrototypeManager>().HasIndex<DecalPrototype>(args[0]))
+            if (!_protoManager.HasIndex<DecalPrototype>(args[0]))
             {
                 shell.WriteError($"Cannot find decalprototype '{args[0]}'.");
             }
@@ -40,8 +44,9 @@ namespace Content.Server.Decals.Commands
                 return;
             }
 
-            var mapManager = IoCManager.Resolve<IMapManager>();
-            if (!EntityUid.TryParse(args[3], out var gridIdRaw) || !mapManager.TryGetGrid(gridIdRaw, out var grid))
+            if (!NetEntity.TryParse(args[3], out var gridIdNet) ||
+                !_entManager.TryGetEntity(gridIdNet, out var gridIdRaw) ||
+                !_mapManager.TryGetGrid(gridIdRaw, out var grid))
             {
                 shell.WriteError($"Failed parsing gridId '{args[3]}'.");
                 return;
@@ -101,7 +106,7 @@ namespace Content.Server.Decals.Commands
                 }
             }
 
-            if(EntitySystem.Get<DecalSystem>().TryAddDecal(args[0], coordinates, out var uid, color, rotation, zIndex))
+            if (_entManager.System<DecalSystem>().TryAddDecal(args[0], coordinates, out var uid, color, rotation, zIndex))
             {
                 shell.WriteLine($"Successfully created decal {uid}.");
             }
index a300d218500dd5489157898baec18a0a42b22afd..baaef1f3f6425a6e9fb7ebf95cef252c96d26f06 100644 (file)
@@ -9,6 +9,9 @@ namespace Content.Server.Decals;
 [AdminCommand(AdminFlags.Mapping)]
 public sealed class EditDecalCommand : IConsoleCommand
 {
+    [Dependency] private readonly IEntityManager _entManager = default!;
+    [Dependency] private readonly IMapManager _mapManager = default!;
+
     public string Command => "editdecal";
     public string Description => "Edits a decal.";
     public string Help => $@"{Command} <gridId> <uid> <mode>\n
@@ -28,7 +31,7 @@ Possible modes are:\n
             return;
         }
 
-        if (!EntityUid.TryParse(args[0], out var gridId))
+        if (!NetEntity.TryParse(args[0], out var gridIdNet) || !_entManager.TryGetEntity(gridIdNet, out var gridId))
         {
             shell.WriteError($"Failed parsing gridId '{args[3]}'.");
             return;
@@ -40,13 +43,13 @@ Possible modes are:\n
             return;
         }
 
-        if (!IoCManager.Resolve<IMapManager>().GridExists(gridId))
+        if (!_mapManager.GridExists(gridId))
         {
             shell.WriteError($"No grid with gridId {gridId} exists.");
             return;
         }
 
-        var decalSystem = EntitySystem.Get<DecalSystem>();
+        var decalSystem = _entManager.System<DecalSystem>();
         switch (args[2].ToLower())
         {
             case "position":
@@ -62,7 +65,7 @@ Possible modes are:\n
                     return;
                 }
 
-                if (!decalSystem.SetDecalPosition(gridId, uid, new(gridId, new Vector2(x, y))))
+                if (!decalSystem.SetDecalPosition(gridId.Value, uid, new(gridId.Value, new Vector2(x, y))))
                 {
                     shell.WriteError("Failed changing decalposition.");
                 }
@@ -80,7 +83,7 @@ Possible modes are:\n
                     return;
                 }
 
-                if (!decalSystem.SetDecalColor(gridId, uid, color))
+                if (!decalSystem.SetDecalColor(gridId.Value, uid, color))
                 {
                     shell.WriteError("Failed changing decal color.");
                 }
@@ -92,7 +95,7 @@ Possible modes are:\n
                     return;
                 }
 
-                if (!decalSystem.SetDecalId(gridId, uid, args[3]))
+                if (!decalSystem.SetDecalId(gridId.Value, uid, args[3]))
                 {
                     shell.WriteError("Failed changing decal id.");
                 }
@@ -110,7 +113,7 @@ Possible modes are:\n
                     return;
                 }
 
-                if (!decalSystem.SetDecalRotation(gridId, uid, Angle.FromDegrees(degrees)))
+                if (!decalSystem.SetDecalRotation(gridId.Value, uid, Angle.FromDegrees(degrees)))
                 {
                     shell.WriteError("Failed changing decal rotation.");
                 }
@@ -128,7 +131,7 @@ Possible modes are:\n
                     return;
                 }
 
-                if (!decalSystem.SetDecalZIndex(gridId, uid, zIndex))
+                if (!decalSystem.SetDecalZIndex(gridId.Value, uid, zIndex))
                 {
                     shell.WriteError("Failed changing decal zIndex.");
                 }
@@ -146,7 +149,7 @@ Possible modes are:\n
                     return;
                 }
 
-                if (!decalSystem.SetDecalCleanable(gridId, uid, cleanable))
+                if (!decalSystem.SetDecalCleanable(gridId.Value, uid, cleanable))
                 {
                     shell.WriteError("Failed changing decal cleanable flag.");
                 }
index 3c7d44d5c480a7f39d76e8b9f522f1ba6c9680e8..771c66fbbd51d8638900b735f45f1936c14e6215 100644 (file)
@@ -2,12 +2,16 @@ using Content.Server.Administration;
 using Content.Shared.Administration;
 using Robust.Shared.Console;
 using Robust.Shared.Map;
+using SQLitePCL;
 
 namespace Content.Server.Decals.Commands
 {
     [AdminCommand(AdminFlags.Mapping)]
     public sealed class RemoveDecalCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+        [Dependency] private readonly IMapManager _mapManager = default!;
+
         public string Command => "rmdecal";
         public string Description => "removes a decal";
         public string Help => $"{Command} <uid> <gridId>";
@@ -25,14 +29,16 @@ namespace Content.Server.Decals.Commands
                 return;
             }
 
-            if (!EntityUid.TryParse(args[1], out var rawGridId) ||
-                !IoCManager.Resolve<IMapManager>().GridExists(rawGridId))
+            if (!NetEntity.TryParse(args[1], out var rawGridIdNet) ||
+                !_entManager.TryGetEntity(rawGridIdNet, out var rawGridId) ||
+                !_mapManager.GridExists(rawGridId))
             {
                 shell.WriteError("Failed parsing gridId.");
+                return;
             }
 
-            var decalSystem = EntitySystem.Get<DecalSystem>();
-            if (decalSystem.RemoveDecal(rawGridId, uid))
+            var decalSystem = _entManager.System<DecalSystem>();
+            if (decalSystem.RemoveDecal(rawGridId.Value, uid))
             {
                 shell.WriteLine($"Successfully removed decal {uid}.");
                 return;
index e76ca2506961ab775680cd93dfb8a39475258fd7..6f40ebae3a3d17aa5a7c3a2e319cb41d4305e7f9 100644 (file)
@@ -1,4 +1,3 @@
-using System.Diagnostics.CodeAnalysis;
 using System.Linq;
 using System.Numerics;
 using System.Threading.Tasks;
@@ -14,7 +13,6 @@ using Robust.Server.Player;
 using Robust.Shared;
 using Robust.Shared.Configuration;
 using Robust.Shared.Enums;
-using Robust.Shared.GameStates;
 using Robust.Shared.Map;
 using Robust.Shared.Threading;
 using Robust.Shared.Timing;
@@ -34,8 +32,8 @@ namespace Content.Server.Decals
         [Dependency] private readonly IGameTiming _timing = default!;
         [Dependency] private readonly IAdminLogManager _adminLogger = default!;
 
-        private readonly Dictionary<EntityUid, HashSet<Vector2i>> _dirtyChunks = new();
-        private readonly Dictionary<IPlayerSession, Dictionary<EntityUid, HashSet<Vector2i>>> _previousSentChunks = new();
+        private readonly Dictionary<NetEntity, HashSet<Vector2i>> _dirtyChunks = new();
+        private readonly Dictionary<IPlayerSession, Dictionary<NetEntity, HashSet<Vector2i>>> _previousSentChunks = new();
         private static readonly Vector2 _boundsMinExpansion = new(0.01f, 0.01f);
         private static readonly Vector2 _boundsMaxExpansion = new(1.01f, 1.01f);
 
@@ -44,9 +42,9 @@ namespace Content.Server.Decals
             new DefaultObjectPool<HashSet<Vector2i>>(
                 new DefaultPooledObjectPolicy<HashSet<Vector2i>>(), 64);
 
-        private ObjectPool<Dictionary<EntityUid, HashSet<Vector2i>>> _chunkViewerPool =
-            new DefaultObjectPool<Dictionary<EntityUid, HashSet<Vector2i>>>(
-                new DefaultPooledObjectPolicy<Dictionary<EntityUid, HashSet<Vector2i>>>(), 64);
+        private ObjectPool<Dictionary<NetEntity, HashSet<Vector2i>>> _chunkViewerPool =
+            new DefaultObjectPool<Dictionary<NetEntity, HashSet<Vector2i>>>(
+                new DefaultPooledObjectPolicy<Dictionary<NetEntity, HashSet<Vector2i>>>(), 64);
 
         public override void Initialize()
         {
@@ -203,10 +201,12 @@ namespace Content.Server.Decals
             if (!_adminManager.HasAdminFlag(session, AdminFlags.Spawn))
                 return;
 
-            if (!ev.Coordinates.IsValid(EntityManager))
+            var coordinates = GetCoordinates(ev.Coordinates);
+
+            if (!coordinates.IsValid(EntityManager))
                 return;
 
-            if (!TryAddDecal(ev.Decal, ev.Coordinates, out _))
+            if (!TryAddDecal(ev.Decal, coordinates, out _))
                 return;
 
             if (eventArgs.SenderSession.AttachedEntity != null)
@@ -230,10 +230,12 @@ namespace Content.Server.Decals
             if (!_adminManager.HasAdminFlag(session, AdminFlags.Spawn))
                 return;
 
-            if (!ev.Coordinates.IsValid(EntityManager))
+            var coordinates = GetCoordinates(ev.Coordinates);
+
+            if (!coordinates.IsValid(EntityManager))
                 return;
 
-            var gridId = ev.Coordinates.GetGridUid(EntityManager);
+            var gridId = coordinates.GetGridUid(EntityManager);
 
             if (gridId == null)
                 return;
@@ -256,8 +258,9 @@ namespace Content.Server.Decals
             }
         }
 
-        protected override void DirtyChunk(EntityUid id, Vector2i chunkIndices, DecalChunk chunk)
+        protected override void DirtyChunk(EntityUid uid, Vector2i chunkIndices, DecalChunk chunk)
         {
+            var id = GetNetEntity(uid);
             chunk.LastModified = _timing.CurTick;
             if(!_dirtyChunks.ContainsKey(id))
                 _dirtyChunks[id] = new HashSet<Vector2i>();
@@ -409,8 +412,8 @@ namespace Content.Server.Decals
 
             foreach (var ent in _dirtyChunks.Keys)
             {
-                if (TryComp(ent, out DecalGridComponent? decals))
-                    Dirty(decals);
+                if (TryGetEntity(ent, out var uid) && TryComp(uid, out DecalGridComponent? decals))
+                    Dirty(uid.Value, decals);
             }
 
             if (!PvsEnabled)
@@ -431,8 +434,7 @@ namespace Content.Server.Decals
 
         public void UpdatePlayer(IPlayerSession player)
         {
-            var xformQuery = GetEntityQuery<TransformComponent>();
-            var chunksInRange = _chunking.GetChunksForSession(player, ChunkSize, xformQuery, _chunkIndexPool, _chunkViewerPool);
+            var chunksInRange = _chunking.GetChunksForSession(player, ChunkSize, _chunkIndexPool, _chunkViewerPool);
             var staleChunks = _chunkViewerPool.Get();
             var previouslySent = _previousSentChunks[player];
 
@@ -440,16 +442,16 @@ namespace Content.Server.Decals
             // Then, remove them from previousSentChunks (for stuff like grids out of range)
             // and also mark them as stale for networking.
 
-            foreach (var (gridId, oldIndices) in previouslySent)
+            foreach (var (netGrid, oldIndices) in previouslySent)
             {
                 // Mark the whole grid as stale and flag for removal.
-                if (!chunksInRange.TryGetValue(gridId, out var chunks))
+                if (!chunksInRange.TryGetValue(netGrid, out var chunks))
                 {
-                    previouslySent.Remove(gridId);
+                    previouslySent.Remove(netGrid);
 
                     // Was the grid deleted?
-                    if (MapManager.IsGrid(gridId))
-                        staleChunks[gridId] = oldIndices;
+                    if (!TryGetEntity(netGrid, out var gridId) || !MapManager.IsGrid(gridId.Value))
+                        staleChunks[netGrid] = oldIndices;
                     else
                     {
                         // If grid was deleted then don't worry about telling the client to delete the chunk.
@@ -465,7 +467,9 @@ namespace Content.Server.Decals
                 // Get individual stale chunks.
                 foreach (var chunk in oldIndices)
                 {
-                    if (chunks.Contains(chunk)) continue;
+                    if (chunks.Contains(chunk))
+                        continue;
+
                     elmo.Add(chunk);
                 }
 
@@ -475,16 +479,16 @@ namespace Content.Server.Decals
                     continue;
                 }
 
-                staleChunks.Add(gridId, elmo);
+                staleChunks.Add(netGrid, elmo);
             }
 
             var updatedChunks = _chunkViewerPool.Get();
-            foreach (var (gridId, gridChunks) in chunksInRange)
+            foreach (var (netGrid, gridChunks) in chunksInRange)
             {
                 var newChunks = _chunkIndexPool.Get();
-                _dirtyChunks.TryGetValue(gridId, out var dirtyChunks);
+                _dirtyChunks.TryGetValue(netGrid, out var dirtyChunks);
 
-                if (!previouslySent.TryGetValue(gridId, out var previousChunks))
+                if (!previouslySent.TryGetValue(netGrid, out var previousChunks))
                     newChunks.UnionWith(gridChunks);
                 else
                 {
@@ -498,19 +502,19 @@ namespace Content.Server.Decals
                     _chunkIndexPool.Return(previousChunks);
                 }
 
-                previouslySent[gridId] = gridChunks;
+                previouslySent[netGrid] = gridChunks;
 
                 if (newChunks.Count == 0)
                     _chunkIndexPool.Return(newChunks);
                 else
-                    updatedChunks[gridId] = newChunks;
+                    updatedChunks[netGrid] = newChunks;
             }
 
             //send all gridChunks to client
             SendChunkUpdates(player, updatedChunks, staleChunks);
         }
 
-        private void ReturnToPool(Dictionary<EntityUid, HashSet<Vector2i>> chunks)
+        private void ReturnToPool(Dictionary<NetEntity, HashSet<Vector2i>> chunks)
         {
             foreach (var (_, previous) in chunks)
             {
@@ -524,12 +528,14 @@ namespace Content.Server.Decals
 
         private void SendChunkUpdates(
             IPlayerSession session,
-            Dictionary<EntityUid, HashSet<Vector2i>> updatedChunks,
-            Dictionary<EntityUid, HashSet<Vector2i>> staleChunks)
+            Dictionary<NetEntity, HashSet<Vector2i>> updatedChunks,
+            Dictionary<NetEntity, HashSet<Vector2i>> staleChunks)
         {
-            var updatedDecals = new Dictionary<EntityUid, Dictionary<Vector2i, DecalChunk>>();
-            foreach (var (gridId, chunks) in updatedChunks)
+            var updatedDecals = new Dictionary<NetEntity, Dictionary<Vector2i, DecalChunk>>();
+            foreach (var (netGrid, chunks) in updatedChunks)
             {
+                var gridId = GetEntity(netGrid);
+
                 var collection = ChunkCollection(gridId);
                 if (collection == null)
                     continue;
@@ -542,7 +548,7 @@ namespace Content.Server.Decals
                             ? chunk
                             : new());
                 }
-                updatedDecals[gridId] = gridChunks;
+                updatedDecals[netGrid] = gridChunks;
             }
 
             if (updatedDecals.Count != 0 || staleChunks.Count != 0)
index c42e1e5a5a3430ca8699b54ffa418677d2ceff1b..3a7fd6bec996ce830a50c76d2c87e09c01dd7a6f 100644 (file)
@@ -40,7 +40,7 @@ public sealed class SignalTimerSystem : EntitySystem
 
         if (_ui.TryGetUi(uid, SignalTimerUiKey.Key, out var bui))
         {
-            UserInterfaceSystem.SetUiState(bui, new SignalTimerBoundUserInterfaceState(component.Label,
+            _ui.SetUiState(bui, new SignalTimerBoundUserInterfaceState(component.Label,
                 TimeSpan.FromSeconds(component.Delay).Minutes.ToString("D2"),
                 TimeSpan.FromSeconds(component.Delay).Seconds.ToString("D2"),
                 component.CanEditLabel,
@@ -60,7 +60,7 @@ public sealed class SignalTimerSystem : EntitySystem
 
         if (_ui.TryGetUi(uid, SignalTimerUiKey.Key, out var bui))
         {
-            UserInterfaceSystem.SetUiState(bui, new SignalTimerBoundUserInterfaceState(signalTimer.Label,
+            _ui.SetUiState(bui, new SignalTimerBoundUserInterfaceState(signalTimer.Label,
                 TimeSpan.FromSeconds(signalTimer.Delay).Minutes.ToString("D2"),
                 TimeSpan.FromSeconds(signalTimer.Delay).Seconds.ToString("D2"),
                 signalTimer.CanEditLabel,
index 9bbdc890a7689ec81cbe677212dc2cf532f3cf87..c250761687119c28012847531c84a879f59cd79e 100644 (file)
@@ -473,7 +473,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem
             return;
 
         if (_uiSystem.OpenUi(bui, actor.PlayerSession))
-            UserInterfaceSystem.SetUiState(bui, new DeviceListUserInterfaceState(
+            _uiSystem.SetUiState(bui, new DeviceListUserInterfaceState(
                 _deviceListSystem.GetDeviceList(configurator.ActiveDeviceList.Value)
                     .Select(v => (v.Key, MetaData(v.Value).EntityName)).ToHashSet()
             ));
@@ -505,7 +505,7 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem
         }
 
         if (_uiSystem.TryGetUi(uid, NetworkConfiguratorUiKey.List, out var bui))
-            UserInterfaceSystem.SetUiState(bui, new NetworkConfiguratorUserInterfaceState(devices));
+            _uiSystem.SetUiState(bui, new NetworkConfiguratorUserInterfaceState(devices));
     }
 
     /// <summary>
index 4dea3d23e143c7d6752047dfc3df9a6e14385472..7993ccc07d5d886c9f8a500df9b06006da3b82cd 100644 (file)
@@ -177,7 +177,7 @@ public sealed class MailingUnitSystem : EntitySystem
 
         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(bui, state);
     }
 
     private void OnTargetSelected(EntityUid uid, MailingUnitComponent component, TargetSelectedMessage args)
index cf819dfd78f9e880b1c3bf285d88c16393a6c4f8..477a167fa27c54c8313a0f443d055f5c569f4316 100644 (file)
@@ -325,8 +325,9 @@ namespace Content.Server.Disposal.Tube
                 args.Cancel();
             }
 
-            if (_uiSystem.TryGetUi(uid, SharedDisposalTaggerComponent.DisposalTaggerUiKey.Key, out var bui))
-                UserInterfaceSystem.SetUiState(bui, new SharedDisposalTaggerComponent.DisposalTaggerUserInterfaceState(tagger.Tag));
+            if (_uiSystem.TryGetUi(uid, DisposalTaggerUiKey.Key, out var bui))
+                _uiSystem.SetUiState(bui,
+                    new DisposalTaggerUserInterfaceState(tagger.Tag));
         }
 
         /// <summary>
@@ -335,11 +336,11 @@ namespace Content.Server.Disposal.Tube
         /// <returns>Returns a <see cref="SharedDisposalRouterComponent.DisposalRouterUserInterfaceState"/></returns>
         private void UpdateRouterUserInterface(EntityUid uid, DisposalRouterComponent router)
         {
-            var bui = _uiSystem.GetUiOrNull(uid, SharedDisposalTaggerComponent.DisposalTaggerUiKey.Key);
+            var bui = _uiSystem.GetUiOrNull(uid, DisposalTaggerUiKey.Key);
             if (router.Tags.Count <= 0)
             {
                 if (bui is not null)
-                    UserInterfaceSystem.SetUiState(bui, new SharedDisposalTaggerComponent.DisposalTaggerUserInterfaceState(""));
+                    _uiSystem.SetUiState(bui, new DisposalTaggerUserInterfaceState(""));
                 return;
             }
 
@@ -354,7 +355,7 @@ namespace Content.Server.Disposal.Tube
             taglist.Remove(taglist.Length - 2, 2);
 
             if (bui is not null)
-                UserInterfaceSystem.SetUiState(bui, new SharedDisposalTaggerComponent.DisposalTaggerUserInterfaceState(taglist.ToString()));
+                _uiSystem.SetUiState(bui, new DisposalTaggerUserInterfaceState(taglist.ToString()));
         }
 
         private void OnAnchorChange(EntityUid uid, DisposalTubeComponent component, ref AnchorStateChangedEvent args)
index 98f8a2bfe00c2c738f73ab67f2920beeac78f980..7895dcbca665727101b74af8b947fa6901dd828f 100644 (file)
@@ -31,7 +31,7 @@ namespace Content.Server.Disposal
                 return;
             }
 
-            if (!EntityUid.TryParse(args[0], out var id))
+            if (!NetEntity.TryParse(args[0], out var idNet) || !_entities.TryGetEntity(idNet, out var id))
             {
                 shell.WriteLine(Loc.GetString("shell-invalid-entity-uid",("uid", args[0])));
                 return;
@@ -51,7 +51,7 @@ namespace Content.Server.Disposal
                 return;
             }
 
-            _entities.System<DisposalTubeSystem>().PopupDirections(id, tube, player.AttachedEntity.Value);
+            _entities.System<DisposalTubeSystem>().PopupDirections(id.Value, tube, player.AttachedEntity.Value);
         }
     }
 }
index 83e079746ea6f53d1ee0f672d98e1d49b0a4e4a3..3edc2a5fa7839265ada0492656b367fa9e2049f4 100644 (file)
@@ -57,7 +57,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
             if (!Resolve(uid, ref holder))
                 return false;
 
-            if (!holder.Container.CanInsert(toInsert))
+            if (!_containerSystem.CanInsert(toInsert, holder.Container))
             {
                 return false;
             }
index e97215f64619576a8af4d4e9e9af57c734110822..41db7b1dd898884a926469e8ef1cd06db7187478 100644 (file)
@@ -96,7 +96,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
             component.NextFlush,
             component.Powered,
             component.Engaged,
-            component.RecentlyEjected);
+            GetNetEntityList(component.RecentlyEjected));
     }
 
     private void OnUnpaused(EntityUid uid, SharedDisposalUnitComponent component, ref EntityUnpausedEvent args)
@@ -499,7 +499,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
 
         // Can't check if our target AND disposals moves currently so we'll just check target.
         // if you really want to check if disposals moves then add a predicate.
-        var doAfterArgs = new DoAfterArgs(userId.Value, delay, new DisposalDoAfterEvent(), unitId, target: toInsertId, used: unitId)
+        var doAfterArgs = new DoAfterArgs(EntityManager, userId.Value, delay, new DisposalDoAfterEvent(), unitId, target: toInsertId, used: unitId)
         {
             BreakOnDamage = true,
             BreakOnTargetMove = true,
@@ -753,10 +753,10 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
 
     public override bool CanInsert(EntityUid uid, SharedDisposalUnitComponent component, EntityUid entity)
     {
-        if (!base.CanInsert(uid, component, entity) || component is not SharedDisposalUnitComponent serverComp)
+        if (!base.CanInsert(uid, component, entity))
             return false;
 
-        return serverComp.Container.CanInsert(entity);
+        return _containerSystem.CanInsert(entity, component.Container);
     }
 
     /// <summary>
index b3cc66a4412b4129453f93d916b55bf0d3e8a608..2d2913465783467da68c1652a5dc45c7645c7bfd 100644 (file)
@@ -7,6 +7,6 @@ public sealed class ColorFlashEffectSystem : SharedColorFlashEffectSystem
 {
     public override void RaiseEffect(Color color, List<EntityUid> entities, Filter filter)
     {
-        RaiseNetworkEvent(new ColorFlashEffectEvent(color, entities), filter);
+        RaiseNetworkEvent(new ColorFlashEffectEvent(color, GetNetEntityList(entities)), filter);
     }
 }
index af8b3e5a5ee21f1566214252cbe467123a362978..75eb64c1bb8c4b3d7d3989d542170fc082af9d6f 100644 (file)
@@ -8,6 +8,8 @@ namespace Content.Server.Electrocution
     [AdminCommand(AdminFlags.Fun)]
     public sealed class ElectrocuteCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "electrocute";
         public string Description => Loc.GetString("electrocute-command-description");
         public string Help => $"{Command} <uid> <seconds> <damage>";
@@ -24,15 +26,15 @@ namespace Content.Server.Electrocution
                 return;
             }
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
-
-            if (!EntityUid.TryParse(args[0], out var uid) || !entityManager.EntityExists(uid))
+            if (!NetEntity.TryParse(args[0], out var uidNet) ||
+                !_entManager.TryGetEntity(uidNet, out var uid) ||
+                !_entManager.EntityExists(uid))
             {
                 shell.WriteError($"Invalid entity specified!");
                 return;
             }
 
-            if (!entityManager.EntitySysManager.GetEntitySystem<StatusEffectsSystem>().CanApplyEffect(uid, ElectrocutionStatusEffect))
+            if (!_entManager.EntitySysManager.GetEntitySystem<StatusEffectsSystem>().CanApplyEffect(uid.Value, ElectrocutionStatusEffect))
             {
                 shell.WriteError(Loc.GetString("electrocute-command-entity-cannot-be-electrocuted"));
                 return;
@@ -48,8 +50,8 @@ namespace Content.Server.Electrocution
                 damage = 10;
             }
 
-            entityManager.EntitySysManager.GetEntitySystem<ElectrocutionSystem>()
-                .TryDoElectrocution(uid, null, damage, TimeSpan.FromSeconds(seconds), refresh: true, ignoreInsulation: true);
+            _entManager.EntitySysManager.GetEntitySystem<ElectrocutionSystem>()
+                .TryDoElectrocution(uid.Value, null, damage, TimeSpan.FromSeconds(seconds), refresh: true, ignoreInsulation: true);
         }
     }
 }
index 91bf49b7ec9b0fc035ba2445ca75a45aeb8bd0a2..3085af0cdce96dad769bb53f924d4cf088e21dec 100644 (file)
@@ -42,7 +42,7 @@ namespace Content.Server.Engineering.EntitySystems
 
             if (component.DoAfterTime > 0 && TryGet<SharedDoAfterSystem>(out var doAfterSystem))
             {
-                var doAfterArgs = new DoAfterArgs(user, component.DoAfterTime, new AwaitedDoAfterEvent(), null)
+                var doAfterArgs = new DoAfterArgs(EntityManager, user, component.DoAfterTime, new AwaitedDoAfterEvent(), null)
                 {
                     BreakOnUserMove = true,
                 };
index 2367789b99b454f8fc560208464ff3898f145065..4893552c2c0cbc1c7b2216e03db72cd91582d935 100644 (file)
@@ -45,7 +45,7 @@ namespace Content.Server.Engineering.EntitySystems
 
             if (component.DoAfterTime > 0)
             {
-                var doAfterArgs = new DoAfterArgs(args.User, component.DoAfterTime, new AwaitedDoAfterEvent(), null)
+                var doAfterArgs = new DoAfterArgs(EntityManager, args.User, component.DoAfterTime, new AwaitedDoAfterEvent(), null)
                 {
                     BreakOnUserMove = true,
                 };
index 1359e1d5505dd285437df3802cd8e035ca07b3c0..bb1690c93505492516578a01a1e9cf4bf0e73b2b 100644 (file)
@@ -98,7 +98,7 @@ public sealed partial class EnsnareableSystem
         var freeTime = user == target ? component.BreakoutTime : component.FreeTime;
         var breakOnMove = !component.CanMoveBreakout;
 
-        var doAfterEventArgs = new DoAfterArgs(user, freeTime, new EnsnareableDoAfterEvent(), target, target: target, used: ensnare)
+        var doAfterEventArgs = new DoAfterArgs(EntityManager, user, freeTime, new EnsnareableDoAfterEvent(), target, target: target, used: ensnare)
         {
             BreakOnUserMove = breakOnMove,
             BreakOnTargetMove = breakOnMove,
index d50f0cafdcda953a3f3ccd99608d0b1f66266bd9..98aa806885d06dc33d4afeb52a3e6b4d910506fc 100644 (file)
@@ -38,7 +38,7 @@ namespace Content.Server.Examine
                 verbs = _verbSystem.GetLocalVerbs(target, player, typeof(ExamineVerb));
 
             var ev = new ExamineSystemMessages.ExamineInfoResponseMessage(
-                target, 0, message, verbs?.ToList(), centerAtCursor
+                GetNetEntity(target), 0, message, verbs?.ToList(), centerAtCursor
             );
 
             RaiseNetworkEvent(ev, session.ConnectedClient);
@@ -49,29 +49,30 @@ namespace Content.Server.Examine
             var player = (IPlayerSession) eventArgs.SenderSession;
             var session = eventArgs.SenderSession;
             var channel = player.ConnectedClient;
+            var entity = GetEntity(request.NetEntity);
 
             if (session.AttachedEntity is not {Valid: true} playerEnt
-                || !EntityManager.EntityExists(request.EntityUid))
+                || !EntityManager.EntityExists(entity))
             {
                 RaiseNetworkEvent(new ExamineSystemMessages.ExamineInfoResponseMessage(
-                    request.EntityUid, request.Id, _entityNotFoundMessage), channel);
+                    request.NetEntity, request.Id, _entityNotFoundMessage), channel);
                 return;
             }
 
-            if (!CanExamine(playerEnt, request.EntityUid))
+            if (!CanExamine(playerEnt, entity))
             {
                 RaiseNetworkEvent(new ExamineSystemMessages.ExamineInfoResponseMessage(
-                    request.EntityUid, request.Id, _entityOutOfRangeMessage, knowTarget: false), channel);
+                    request.NetEntity, request.Id, _entityOutOfRangeMessage, knowTarget: false), channel);
                 return;
             }
 
             SortedSet<Verb>? verbs = null;
             if (request.GetVerbs)
-                verbs = _verbSystem.GetLocalVerbs(request.EntityUid, playerEnt, typeof(ExamineVerb));
+                verbs = _verbSystem.GetLocalVerbs(entity, playerEnt, typeof(ExamineVerb));
 
-            var text = GetExamineText(request.EntityUid, player.AttachedEntity);
+            var text = GetExamineText(entity, player.AttachedEntity);
             RaiseNetworkEvent(new ExamineSystemMessages.ExamineInfoResponseMessage(
-                request.EntityUid, request.Id, text, verbs?.ToList()), channel);
+                request.NetEntity, request.Id, text, verbs?.ToList()), channel);
         }
     }
 }
index fc16c9daa4a155d091e129fd4fd8d1b5d352dedc..65ca6e782ca672dbc56e723d224315997f8cd698 100644 (file)
@@ -331,12 +331,12 @@ public sealed partial class ExplosionSystem : EntitySystem
 
         var (area, iterationIntensity, spaceData, gridData, spaceMatrix) = results.Value;
 
-        Logger.Info($"Generated explosion preview with {area} tiles in {stopwatch.Elapsed.TotalMilliseconds}ms");
+        Log.Info($"Generated explosion preview with {area} tiles in {stopwatch.Elapsed.TotalMilliseconds}ms");
 
-        Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> tileLists = new();
+        Dictionary<NetEntity, Dictionary<int, List<Vector2i>>> tileLists = new();
         foreach (var (grid, data) in gridData)
         {
-            tileLists.Add(grid, data.TileLists);
+            tileLists.Add(GetNetEntity(grid), data.TileLists);
         }
 
         return new ExplosionVisualsState(
index 5d3adff1c2332f9d7263d18967dd67885e8e8f45..08374d739245af6e3eb8eecb4576d57a019737e9 100644 (file)
@@ -15,12 +15,18 @@ public sealed partial class ExplosionSystem : EntitySystem
 
     private void OnGetState(EntityUid uid, ExplosionVisualsComponent component, ref ComponentGetState args)
     {
+        Dictionary<NetEntity, Dictionary<int, List<Vector2i>>> tileLists = new();
+        foreach (var (grid, data) in component.Tiles)
+        {
+            tileLists.Add(GetNetEntity(grid), data);
+        }
+
         args.State = new ExplosionVisualsState(
             component.Epicenter,
             component.ExplosionType,
             component.Intensity,
             component.SpaceTiles,
-            component.Tiles,
+            tileLists,
             component.SpaceMatrix,
             component.SpaceTileSize);
     }
index e5d8f69850bc270c023ab1d9131bb3092a9e5db8..427edf21e31969a3bcb80fc2781a28887b4e1f03 100644 (file)
@@ -236,7 +236,7 @@ namespace Content.Server.Explosion.EntitySystems
             if (user != null)
             {
                 // Check if entity is bomb/mod. grenade/etc
-                if (_container.TryGetContainer(uid, "payload", out IContainer? container) &&
+                if (_container.TryGetContainer(uid, "payload", out BaseContainer? container) &&
                     container.ContainedEntities.Count > 0 &&
                     TryComp(container.ContainedEntities[0], out ChemicalPayloadComponent? chemicalPayloadComponent))
                 {
index 77b570bc0a1923410c627a6f6724c1ac3e1ac6f2..c8be6618e45eda64489d442a7d3f804e00fcd503 100644 (file)
@@ -32,7 +32,7 @@ public sealed class AdminFaxEui : BaseEui
         var entries = new List<AdminFaxEntry>();
         while (faxes.MoveNext(out var uid, out var fax, out var device))
         {
-            entries.Add(new AdminFaxEntry(uid, fax.FaxName, device.Address));
+            entries.Add(new AdminFaxEntry(_entityManager.GetNetEntity(uid), fax.FaxName, device.Address));
         }
         return new AdminFaxEuiState(entries);
     }
@@ -49,14 +49,14 @@ public sealed class AdminFaxEui : BaseEui
                     !_entityManager.HasComponent<GhostComponent>(Player.AttachedEntity.Value))
                     return;
 
-                _followerSystem.StartFollowingEntity(Player.AttachedEntity.Value, followData.TargetFax);
+                _followerSystem.StartFollowingEntity(Player.AttachedEntity.Value, _entityManager.GetEntity(followData.TargetFax));
                 break;
             }
             case AdminFaxEuiMsg.Send sendData:
             {
                 var printout = new FaxPrintout(sendData.Content, sendData.Title, null, sendData.StampState,
                         new() { new StampDisplayInfo { StampedName = sendData.From, StampedColor = sendData.StampColor } });
-                _faxSystem.Receive(sendData.Target, printout);
+                _faxSystem.Receive(_entityManager.GetEntity(sendData.Target), printout);
                 break;
             }
         }
index 425e21153c588ff516c3f3aecdab251672117dd2..d067a64e13eb47ffa1c4388d3b42b08270595add 100644 (file)
@@ -228,7 +228,7 @@ public sealed class DrainSystem : SharedDrainSystem
         _audioSystem.PlayPvs(component.PlungerSound, uid);
 
 
-        var doAfterArgs = new DoAfterArgs(args.User, component.UnclogDuration, new DrainDoAfterEvent(),uid, args.Target, args.Used)
+        var doAfterArgs = new DoAfterArgs(EntityManager, args.User, component.UnclogDuration, new DrainDoAfterEvent(),uid, args.Target, args.Used)
         {
             BreakOnTargetMove = true,
             BreakOnUserMove = true,
index b09d74c4d0c7ea4695b3c9b743b6b0ab03830e53..ec4fb3b399f9e689ac6aabc24176998c66abcdab 100644 (file)
@@ -79,7 +79,7 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst
                     data.Add(new PuddleDebugOverlayData(pos, vol));
                 }
 
-                RaiseNetworkEvent(new PuddleOverlayDebugMessage(gridUid, data.ToArray()));
+                RaiseNetworkEvent(new PuddleOverlayDebugMessage(GetNetEntity(gridUid), data.ToArray()));
             }
         }
 
index 94283bd745083f156c5948c97b4306f431718f9e..ff12aed729885e21ffc3fab9808ec7bfb5d2cff1 100644 (file)
@@ -181,7 +181,7 @@ public sealed partial class PuddleSystem
         {
             verb.Act = () =>
             {
-                _doAfterSystem.TryStartDoAfter(new DoAfterArgs(args.User, component.SpillDelay ?? 0, new SpillDoAfterEvent(), uid, target: uid)
+                _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.SpillDelay ?? 0, new SpillDoAfterEvent(), uid, target: uid)
                 {
                     BreakOnTargetMove = true,
                     BreakOnUserMove = true,
index b82d5903e772772a6781036728d898cfe6879e03..ad39817f8b0bbb5c5ab81f82b8da2b7599fa7ff2 100644 (file)
@@ -81,7 +81,7 @@ namespace Content.Server.Forensics
         {
             var ev = new ForensicPadDoAfterEvent(sample);
 
-            var doAfterEventArgs = new DoAfterArgs(user, pad.ScanDelay, ev, used, target: target, used: used)
+            var doAfterEventArgs = new DoAfterArgs(EntityManager, user, pad.ScanDelay, ev, used, target: target, used: used)
             {
                 BreakOnTargetMove = true,
                 BreakOnUserMove = true,
index 247236217d924aa8ba788ac2906af7a2179570d0..117717fca46f1f8adb39edf3a6e3965518d5f547 100644 (file)
@@ -91,7 +91,7 @@ namespace Content.Server.Forensics
         /// </remarks>
         private void StartScan(EntityUid uid, ForensicScannerComponent component, EntityUid user, EntityUid target)
         {
-            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(user, component.ScanDelay, new ForensicScannerDoAfterEvent(), uid, target: target, used: uid)
+            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.ScanDelay, new ForensicScannerDoAfterEvent(), uid, target: target, used: uid)
             {
                 BreakOnTargetMove = true,
                 BreakOnUserMove = true,
@@ -107,7 +107,7 @@ namespace Content.Server.Forensics
             var verb = new UtilityVerb()
             {
                 Act = () => StartScan(uid, component, args.User, args.Target),
-                IconEntity = uid,
+                IconEntity = GetNetEntity(uid),
                 Text = Loc.GetString("forensic-scanner-verb-text"),
                 Message = Loc.GetString("forensic-scanner-verb-message")
             };
index acb211d8bd8d4d54ed0f323f26a835588e478c5c..366e6c4e772bcd3cddc680b75fa5ee2ca23d42f4 100644 (file)
@@ -11,6 +11,7 @@ namespace Content.Server.GameTicking.Commands
     [AnyCommand]
     sealed class JoinGameCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
         [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
 
         public string Command => "joingame";
@@ -36,9 +37,8 @@ namespace Content.Server.GameTicking.Commands
                 return;
             }
 
-            var ticker = EntitySystem.Get<GameTicker>();
-            var stationSystem = EntitySystem.Get<StationSystem>();
-            var stationJobs = EntitySystem.Get<StationJobsSystem>();
+            var ticker = _entManager.System<GameTicker>();
+            var stationJobs = _entManager.System<StationJobsSystem>();
 
             if (ticker.PlayerGameStatuses.TryGetValue(player.UserId, out var status) && status == PlayerGameStatus.JoinedGame)
             {
@@ -61,7 +61,7 @@ namespace Content.Server.GameTicking.Commands
                     shell.WriteError(Loc.GetString("shell-argument-must-be-number"));
                 }
 
-                var station = new EntityUid(sid);
+                var station = _entManager.GetEntity(new NetEntity(sid));
                 var jobPrototype = _prototypeManager.Index<JobPrototype>(id);
                 if(stationJobs.TryGetJobSlot(station, jobPrototype, out var slots) == false || slots == 0)
                 {
index 31a37f85a32f629f5b9c82c0f6befcba98b3c8fb..82e2872914e3b415cf5b83c1cb3e745ae886354e 100644 (file)
@@ -247,10 +247,10 @@ public sealed partial class GameTicker
 
         foreach (var rule in args)
         {
-            if (!EntityUid.TryParse(rule, out var ruleEnt))
+            if (!NetEntity.TryParse(rule, out var ruleEntNet) || !TryGetEntity(ruleEntNet, out var ruleEnt))
                 continue;
 
-            EndGameRule(ruleEnt);
+            EndGameRule(ruleEnt.Value);
         }
     }
 
index 7643a28961eeacb22a5553434571f5d484fc746b..df2aafa90119fc809250e6c5182758d4361df2ac 100644 (file)
@@ -373,7 +373,7 @@ namespace Content.Server.GameTicking
                     PlayerOOCName = contentPlayerData?.Name ?? "(IMPOSSIBLE: REGISTERED MIND WITH NO OWNER)",
                     // Character name takes precedence over current entity name
                     PlayerICName = playerIcName,
-                    PlayerEntityUid = entity,
+                    PlayerNetEntity = GetNetEntity(entity),
                     Role = antag
                         ? roles.First(role => role.Antagonist).Name
                         : roles.FirstOrDefault().Name ?? Loc.GetString("game-ticker-unknown-role"),
index 3613f6734e0b0ae51be93336a7ba49af125558c4..21cb58c3bd205c20a3a04dab2310fefc412df363 100644 (file)
@@ -66,18 +66,18 @@ public sealed class GatewaySystem : EntitySystem
 
     private void UpdateUserInterface(EntityUid uid, GatewayComponent comp)
     {
-        var destinations = new List<(EntityUid, String, TimeSpan, bool)>();
+        var destinations = new List<(NetEntity, String, TimeSpan, bool)>();
         foreach (var destUid in comp.Destinations)
         {
             var dest = Comp<GatewayDestinationComponent>(destUid);
             if (!dest.Enabled)
                 continue;
 
-            destinations.Add((destUid, dest.Name, dest.NextReady, HasComp<PortalComponent>(destUid)));
+            destinations.Add((GetNetEntity(destUid), dest.Name, dest.NextReady, HasComp<PortalComponent>(destUid)));
         }
 
         GetDestination(uid, out var current);
-        var state = new GatewayBoundUserInterfaceState(destinations, current, comp.NextClose, comp.LastOpen);
+        var state = new GatewayBoundUserInterfaceState(destinations, GetNetEntity(current), comp.NextClose, comp.LastOpen);
         _ui.TrySetUiState(uid, GatewayUiKey.Key, state);
     }
 
@@ -89,15 +89,17 @@ public sealed class GatewaySystem : EntitySystem
     private void OnOpenPortal(EntityUid uid, GatewayComponent comp, GatewayOpenPortalMessage args)
     {
         // can't link if portal is already open on either side, the destination is invalid or on cooldown
+        var desto = GetEntity(args.Destination);
+
         if (HasComp<PortalComponent>(uid) ||
-            HasComp<PortalComponent>(args.Destination) ||
-            !TryComp<GatewayDestinationComponent>(args.Destination, out var dest) ||
+            HasComp<PortalComponent>(desto) ||
+            !TryComp<GatewayDestinationComponent>(desto, out var dest) ||
             !dest.Enabled ||
             _timing.CurTime < dest.NextReady)
             return;
 
         // TODO: admin log???
-        OpenPortal(uid, comp, args.Destination, dest);
+        OpenPortal(uid, comp, desto, dest);
     }
 
     private void OpenPortal(EntityUid uid, GatewayComponent comp, EntityUid dest, GatewayDestinationComponent destComp)
index c7941fa7a5e2c448413c72d445e655488412e9d7..0201de79adda4725cc989ffe7a5a73a8b43db359 100644 (file)
@@ -189,7 +189,7 @@ namespace Content.Server.Ghost
             if (args.SenderSession.AttachedEntity is not {Valid: true} entity ||
                 !EntityManager.HasComponent<GhostComponent>(entity))
             {
-                Logger.Warning($"User {args.SenderSession.Name} sent a {nameof(GhostWarpsRequestEvent)} without being a ghost.");
+                Log.Warning($"User {args.SenderSession.Name} sent a {nameof(GhostWarpsRequestEvent)} without being a ghost.");
                 return;
             }
 
@@ -204,7 +204,7 @@ namespace Content.Server.Ghost
                 !ghost.CanReturnToBody ||
                 !EntityManager.TryGetComponent(attached, out ActorComponent? actor))
             {
-                Logger.Warning($"User {args.SenderSession.Name} sent an invalid {nameof(GhostReturnToBodyRequest)}");
+                Log.Warning($"User {args.SenderSession.Name} sent an invalid {nameof(GhostReturnToBodyRequest)}");
                 return;
             }
 
@@ -216,25 +216,27 @@ namespace Content.Server.Ghost
             if (args.SenderSession.AttachedEntity is not {Valid: true} attached ||
                 !EntityManager.TryGetComponent(attached, out GhostComponent? ghost))
             {
-                Logger.Warning($"User {args.SenderSession.Name} tried to warp to {msg.Target} without being a ghost.");
+                Log.Warning($"User {args.SenderSession.Name} tried to warp to {msg.Target} without being a ghost.");
                 return;
             }
 
-            if (!EntityManager.EntityExists(msg.Target))
+            var target = GetEntity(msg.Target);
+
+            if (!EntityManager.EntityExists(target))
             {
-                Logger.Warning($"User {args.SenderSession.Name} tried to warp to an invalid entity id: {msg.Target}");
+                Log.Warning($"User {args.SenderSession.Name} tried to warp to an invalid entity id: {msg.Target}");
                 return;
             }
 
-            if (TryComp(msg.Target, out WarpPointComponent? warp) && warp.Follow
-                || HasComp<MobStateComponent>(msg.Target))
+            if (TryComp(target, out WarpPointComponent? warp) && warp.Follow
+                || HasComp<MobStateComponent>(target))
             {
-                 _followerSystem.StartFollowingEntity(ghost.Owner, msg.Target);
+                 _followerSystem.StartFollowingEntity(attached, target);
                  return;
             }
 
-            var xform = Transform(ghost.Owner);
-            xform.Coordinates = Transform(msg.Target).Coordinates;
+            var xform = Transform(attached);
+            xform.Coordinates = Transform(target).Coordinates;
             xform.AttachToGridOrMap();
             if (TryComp(attached, out PhysicsComponent? physics))
                 _physics.SetLinearVelocity(attached, Vector2.Zero, body: physics);
@@ -250,11 +252,13 @@ namespace Content.Server.Ghost
 
         private IEnumerable<GhostWarp> GetLocationWarps()
         {
-            foreach (var warp in EntityManager.EntityQuery<WarpPointComponent>(true))
+            var allQuery = AllEntityQuery<WarpPointComponent>();
+
+            while (allQuery.MoveNext(out var uid, out var warp))
             {
                 if (warp.Location != null)
                 {
-                    yield return new GhostWarp(warp.Owner, warp.Location, true);
+                    yield return new GhostWarp(GetNetEntity(uid), warp.Location, true);
                 }
             }
         }
@@ -273,7 +277,7 @@ namespace Content.Server.Ghost
                     var playerInfo = $"{EntityManager.GetComponent<MetaDataComponent>(attached).EntityName} ({jobName})";
 
                     if (_mobState.IsAlive(attached) || _mobState.IsCritical(attached))
-                        yield return new GhostWarp(attached, playerInfo, false);
+                        yield return new GhostWarp(GetNetEntity(attached), playerInfo, false);
                 }
             }
         }
index b26738d976a206713ddfdc4b2bcb1e5ca04247d4..45c577de225afd4e10f7efa1ab1fab752380b22f 100644 (file)
@@ -9,6 +9,8 @@ namespace Content.Server.Ghost.Roles
     [AdminCommand(AdminFlags.Admin)]
     public sealed class MakeGhostRoleCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "makeghostrole";
         public string Description => "Turns an entity into a ghost role.";
         public string Help => $"Usage: {Command} <entity uid> <name> <description> [<rules>]";
@@ -21,21 +23,19 @@ namespace Content.Server.Ghost.Roles
                 return;
             }
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
-
-            if (!EntityUid.TryParse(args[0], out var uid))
+            if (!NetEntity.TryParse(args[0], out var uidNet) || !_entManager.TryGetEntity(uidNet, out var uid))
             {
                 shell.WriteLine($"{args[0]} is not a valid entity uid.");
                 return;
             }
 
-            if (!entityManager.TryGetComponent(uid, out MetaDataComponent? metaData))
+            if (!_entManager.TryGetComponent(uid, out MetaDataComponent? metaData))
             {
                 shell.WriteLine($"No entity found with uid {uid}");
                 return;
             }
 
-            if (entityManager.TryGetComponent(uid, out MindContainerComponent? mind) &&
+            if (_entManager.TryGetComponent(uid, out MindContainerComponent? mind) &&
                 mind.HasMind)
             {
                 shell.WriteLine($"Entity {metaData.EntityName} with id {uid} already has a mind.");
@@ -46,20 +46,20 @@ namespace Content.Server.Ghost.Roles
             var description = args[2];
             var rules = args.Length >= 4 ? args[3] : Loc.GetString("ghost-role-component-default-rules");
 
-            if (entityManager.TryGetComponent(uid, out GhostRoleComponent? ghostRole))
+            if (_entManager.TryGetComponent(uid, out GhostRoleComponent? ghostRole))
             {
                 shell.WriteLine($"Entity {metaData.EntityName} with id {uid} already has a {nameof(GhostRoleComponent)}");
                 return;
             }
 
-            if (entityManager.TryGetComponent(uid, out GhostTakeoverAvailableComponent? takeOver))
+            if (_entManager.HasComponent<GhostTakeoverAvailableComponent>(uid))
             {
                 shell.WriteLine($"Entity {metaData.EntityName} with id {uid} already has a {nameof(GhostTakeoverAvailableComponent)}");
                 return;
             }
 
-            ghostRole = entityManager.AddComponent<GhostRoleComponent>(uid);
-            entityManager.AddComponent<GhostTakeoverAvailableComponent>(uid);
+            ghostRole = _entManager.AddComponent<GhostRoleComponent>(uid.Value);
+            _entManager.AddComponent<GhostTakeoverAvailableComponent>(uid.Value);
             ghostRole.RoleName = name;
             ghostRole.RoleDescription = description;
             ghostRole.RoleRules = rules;
index c2f46f7c7955b514b9460381e4b75a9978a159c4..ff1967f96659c5c8ef89788ed3dca43a147875d3 100644 (file)
@@ -6,6 +6,8 @@ namespace Content.Server.Ghost.Roles.UI
 {
     public sealed class MakeGhostRoleEui : BaseEui
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public MakeGhostRoleEui(EntityUid entityUid)
         {
             EntityUid = entityUid;
@@ -15,14 +17,14 @@ namespace Content.Server.Ghost.Roles.UI
 
         public override EuiStateBase GetNewState()
         {
-            return new MakeGhostRoleEuiState(EntityUid);
+            return new MakeGhostRoleEuiState(_entManager.GetNetEntity(EntityUid));
         }
 
         public override void Closed()
         {
             base.Closed();
 
-            EntitySystem.Get<GhostRoleSystem>().CloseMakeGhostRoleEui(Player);
+            _entManager.System<GhostRoleSystem>().CloseMakeGhostRoleEui(Player);
         }
     }
 }
index 0cfcbe032e9407aa2d2a99c1f36021afd4e13fa8..4283869a25de247a2f3875becd5bc994260658d7 100644 (file)
@@ -167,7 +167,7 @@ namespace Content.Server.Guardian
                 return;
             }
 
-            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(user, component.InjectionDelay, new GuardianCreatorDoAfterEvent(), injector, target: target, used: injector)
+            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.InjectionDelay, new GuardianCreatorDoAfterEvent(), injector, target: target, used: injector)
             {
                 BreakOnTargetMove = true,
                 BreakOnUserMove = true
index 9a72d312076e16ad895fbf1f66b1866d34252db7..b746eea6ec0a2f9ce5e37d4f9ca3d93fd23ca068 100644 (file)
@@ -105,7 +105,7 @@ namespace Content.Server.Hands.Systems
             if (exclude != null)
                 filter = filter.RemoveWhereAttachedEntity(entity => entity == exclude);
 
-            RaiseNetworkEvent(new PickupAnimationEvent(item, initialPosition, finalPosition, initialAngle), filter);
+            RaiseNetworkEvent(new PickupAnimationEvent(GetNetEntity(item), GetNetCoordinates(initialPosition), finalPosition, initialAngle), filter);
         }
 
         protected override void HandleEntityRemoved(EntityUid uid, HandsComponent hands, EntRemovedFromContainerMessage args)
@@ -178,7 +178,7 @@ namespace Content.Server.Hands.Systems
         #endregion
 
         #region interactions
-        private bool HandleThrowItem(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
+        private bool HandleThrowItem(ICommonSession? session, EntityCoordinates coordinates, EntityUid entity)
         {
             if (session is not IPlayerSession playerSession)
                 return false;
@@ -201,7 +201,7 @@ namespace Content.Server.Hands.Systems
                 throwEnt = splitStack.Value;
             }
 
-            var direction = coords.ToMapPos(EntityManager) - Transform(player).WorldPosition;
+            var direction = coordinates.ToMapPos(EntityManager) - Transform(player).WorldPosition;
             if (direction == Vector2.Zero)
                 return true;
 
index 1ebf3a1d5ee686901378dfd67d1cf1fb3f2fd93e..db5602a2bb9f37adb12e6c7aa560a3f7576b9ab5 100644 (file)
@@ -69,7 +69,7 @@ public sealed partial class ImplanterSystem : SharedImplanterSystem
     /// <param name="implanter">The implanter being used</param>
     public void TryImplant(ImplanterComponent component, EntityUid user, EntityUid target, EntityUid implanter)
     {
-        var args = new DoAfterArgs(user, component.ImplantTime, new ImplantEvent(), implanter, target: target, used: implanter)
+        var args = new DoAfterArgs(EntityManager, user, component.ImplantTime, new ImplantEvent(), implanter, target: target, used: implanter)
         {
             BreakOnUserMove = true,
             BreakOnTargetMove = true,
@@ -96,7 +96,7 @@ public sealed partial class ImplanterSystem : SharedImplanterSystem
     //TODO: Remove when surgery is in
     public void TryDraw(ImplanterComponent component, EntityUid user, EntityUid target, EntityUid implanter)
     {
-        var args = new DoAfterArgs(user, component.DrawTime, new DrawEvent(), implanter, target: target, used: implanter)
+        var args = new DoAfterArgs(EntityManager, user, component.DrawTime, new DrawEvent(), implanter, target: target, used: implanter)
         {
             BreakOnUserMove = true,
             BreakOnTargetMove = true,
index f1415ba388d3a6a81b74db7dac3ba63e8fc5bd3d..70947069508525f36aa31c66c86c2bd839f72e12 100644 (file)
@@ -61,13 +61,13 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
     [AdminCommand(AdminFlags.Fun)]
     private void AddToBandCommand(IConsoleShell shell, string _, string[] args)
     {
-        if (!EntityUid.TryParse(args[0], out var firstUid))
+        if (!NetEntity.TryParse(args[0], out var firstUidNet) || !TryGetEntity(firstUidNet, out var firstUid))
         {
             shell.WriteError($"Cannot parse first Uid");
             return;
         }
 
-        if (!EntityUid.TryParse(args[1], out var secondUid))
+        if (!NetEntity.TryParse(args[1], out var secondUidNet) || !TryGetEntity(secondUidNet, out var secondUid))
         {
             shell.WriteError($"Cannot parse second Uid");
             return;
@@ -79,15 +79,15 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
             return;
         }
 
-        var otherInstrument = Comp<InstrumentComponent>(secondUid);
+        var otherInstrument = Comp<InstrumentComponent>(secondUid.Value);
         otherInstrument.Playing = true;
         otherInstrument.Master = firstUid;
-        Dirty(secondUid, otherInstrument);
+        Dirty(secondUid.Value, otherInstrument);
     }
 
     private void OnMidiStart(InstrumentStartMidiEvent msg, EntitySessionEventArgs args)
     {
-        var uid = msg.Uid;
+        var uid = GetEntity(msg.Uid);
 
         if (!TryComp(uid, out InstrumentComponent? instrument))
             return;
@@ -101,7 +101,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
 
     private void OnMidiStop(InstrumentStopMidiEvent msg, EntitySessionEventArgs args)
     {
-        var uid = msg.Uid;
+        var uid = GetEntity(msg.Uid);
 
         if (!TryComp(uid, out InstrumentComponent? instrument))
             return;
@@ -114,8 +114,8 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
 
     private void OnMidiSetMaster(InstrumentSetMasterEvent msg, EntitySessionEventArgs args)
     {
-        var uid = msg.Uid;
-        var master = msg.Master;
+        var uid = GetEntity(msg.Uid);
+        var master = GetEntity(msg.Master);
 
         if (!HasComp<ActiveInstrumentComponent>(uid))
             return;
@@ -150,7 +150,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
 
     private void OnMidiSetFilteredChannel(InstrumentSetFilteredChannelEvent msg, EntitySessionEventArgs args)
     {
-        var uid = msg.Uid;
+        var uid = GetEntity(msg.Uid);
 
         if (!TryComp(uid, out InstrumentComponent? instrument))
             return;
@@ -166,7 +166,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
         if (msg.Value)
         {
             // Prevent stuck notes when turning off a channel... Shrimple.
-            RaiseNetworkEvent(new InstrumentMidiEventEvent(uid, new []{RobustMidiEvent.AllNotesOff((byte)msg.Channel, 0)}));
+            RaiseNetworkEvent(new InstrumentMidiEventEvent(msg.Uid, new []{RobustMidiEvent.AllNotesOff((byte)msg.Channel, 0)}));
         }
 
         Dirty(uid, instrument);
@@ -215,19 +215,19 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
         _bandRequestQueue.Add(args);
     }
 
-    public (EntityUid, string)[] GetBands(EntityUid uid)
+    public (NetEntity, string)[] GetBands(EntityUid uid)
     {
         var metadataQuery = EntityManager.GetEntityQuery<MetaDataComponent>();
 
         if (Deleted(uid, metadataQuery))
-            return Array.Empty<(EntityUid, string)>();
+            return Array.Empty<(NetEntity, string)>();
 
-        var list = new ValueList<(EntityUid, string)>();
+        var list = new ValueList<(NetEntity, string)>();
         var instrumentQuery = EntityManager.GetEntityQuery<InstrumentComponent>();
 
         if (!TryComp(uid, out InstrumentComponent? originInstrument)
             || originInstrument.InstrumentPlayer?.AttachedEntity is not {} originPlayer)
-            return Array.Empty<(EntityUid, string)>();
+            return Array.Empty<(NetEntity, string)>();
 
         // It's probably faster to get all possible active instruments than all entities in range
         var activeEnumerator = EntityManager.EntityQueryEnumerator<ActiveInstrumentComponent>();
@@ -254,7 +254,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
                 || !metadataQuery.TryGetComponent(entity, out var metadata))
                 continue;
 
-            list.Add((entity, $"{playerMetadata.EntityName} - {metadata.EntityName}"));
+            list.Add((GetNetEntity(entity), $"{playerMetadata.EntityName} - {metadata.EntityName}"));
         }
 
         return list.ToArray();
@@ -267,10 +267,12 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
 
         if (instrument.Playing)
         {
+            var netUid = GetNetEntity(uid);
+
             // Reset puppet instruments too.
-            RaiseNetworkEvent(new InstrumentMidiEventEvent(uid, new[]{RobustMidiEvent.SystemReset(0)}));
+            RaiseNetworkEvent(new InstrumentMidiEventEvent(netUid, new[]{RobustMidiEvent.SystemReset(0)}));
 
-            RaiseNetworkEvent(new InstrumentStopMidiEvent(uid));
+            RaiseNetworkEvent(new InstrumentStopMidiEvent(netUid));
         }
 
         instrument.Playing = false;
@@ -284,7 +286,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
 
     private void OnMidiEventRx(InstrumentMidiEventEvent msg, EntitySessionEventArgs args)
     {
-        var uid = msg.Uid;
+        var uid = GetEntity(msg.Uid);
 
         if (!TryComp(uid, out InstrumentComponent? instrument))
             return;
@@ -292,8 +294,10 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
         if (!instrument.Playing
             || args.SenderSession != instrument.InstrumentPlayer
             || instrument.InstrumentPlayer == null
-            || args.SenderSession.AttachedEntity is not {} attached)
+            || args.SenderSession.AttachedEntity is not { } attached)
+        {
             return;
+        }
 
         var send = true;
 
@@ -361,8 +365,10 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
 
             foreach (var request in _bandRequestQueue)
             {
-                var nearby = GetBands(request.Entity);
-                _bui.TrySendUiMessage(request.Entity, request.UiKey, new InstrumentBandResponseBuiMessage(nearby),
+                var entity = GetEntity(request.Entity);
+
+                var nearby = GetBands(entity);
+                _bui.TrySendUiMessage(entity, request.UiKey, new InstrumentBandResponseBuiMessage(nearby),
                     (IPlayerSession)request.Session);
             }
 
index f887e565a918cb4babb1c783204b593daefe1aca..30eeb6e9462dd925a30777b39b4f1bc1ff6ba1a9 100644 (file)
@@ -63,34 +63,37 @@ namespace Content.Server.Interaction
 
         private void HandleDragDropRequestEvent(DragDropRequestEvent msg, EntitySessionEventArgs args)
         {
-            if (Deleted(msg.Dragged) || Deleted(msg.Target))
+            var dragged = GetEntity(msg.Dragged);
+            var target = GetEntity(msg.Target);
+
+            if (Deleted(dragged) || Deleted(target))
                 return;
 
             var user = args.SenderSession.AttachedEntity;
 
-            if (user == null || !_actionBlockerSystem.CanInteract(user.Value, msg.Target))
+            if (user == null || !_actionBlockerSystem.CanInteract(user.Value, target))
                 return;
 
             // must be in range of both the target and the object they are drag / dropping
             // Client also does this check but ya know we gotta validate it.
-            if (!InRangeUnobstructed(user.Value, msg.Dragged, popup: true)
-                || !InRangeUnobstructed(user.Value, msg.Target, popup: true))
+            if (!InRangeUnobstructed(user.Value, dragged, popup: true)
+                || !InRangeUnobstructed(user.Value, target, popup: true))
             {
                 return;
             }
 
-            var dragArgs = new DragDropDraggedEvent(user.Value, msg.Target);
+            var dragArgs = new DragDropDraggedEvent(user.Value, target);
 
             // trigger dragdrops on the dropped entity
-            RaiseLocalEvent(msg.Dragged, ref dragArgs);
+            RaiseLocalEvent(dragged, ref dragArgs);
 
             if (dragArgs.Handled)
                 return;
 
-            var dropArgs = new DragDropTargetEvent(user.Value, msg.Dragged);
+            var dropArgs = new DragDropTargetEvent(user.Value, dragged);
 
             // trigger dragdrops on the target entity (what you are dropping onto)
-            RaiseLocalEvent(msg.Target, ref dropArgs);
+            RaiseLocalEvent(GetEntity(msg.Target), ref dropArgs);
         }
 
         #endregion
index 65342ca3e11ed64d381fb69623538945faef3ad0..04a224a3a749d28febd1e5f9ba976666489ac364 100644 (file)
@@ -252,7 +252,7 @@ namespace Content.Server.Kitchen.EntitySystems
             butcherable.BeingButchered = true;
             component.InUse = true;
 
-            var doAfterArgs = new DoAfterArgs(userUid, component.SpikeDelay + butcherable.ButcherDelay, new SpikeDoAfterEvent(), uid, target: victimUid, used: uid)
+            var doAfterArgs = new DoAfterArgs(EntityManager, userUid, component.SpikeDelay + butcherable.ButcherDelay, new SpikeDoAfterEvent(), uid, target: victimUid, used: uid)
             {
                 BreakOnTargetMove = true,
                 BreakOnUserMove = true,
index cee2e6ce491985aea41b6c65277b3c4f265752c7..878a14ef730ced00462b44b7fe096a4c6e22a15b 100644 (file)
@@ -288,8 +288,8 @@ namespace Content.Server.Kitchen.EntitySystems
             if (ui == null)
                 return;
 
-            UserInterfaceSystem.SetUiState(ui, new MicrowaveUpdateUserInterfaceState(
-                component.Storage.ContainedEntities.ToArray(),
+            _userInterface.SetUiState(ui, new MicrowaveUpdateUserInterfaceState(
+                GetNetEntityArray(component.Storage.ContainedEntities.ToArray()),
                 HasComp<ActiveMicrowaveComponent>(uid),
                 component.CurrentCookTimeButtonIndex,
                 component.CurrentCookTimerTime
@@ -482,7 +482,7 @@ namespace Content.Server.Kitchen.EntitySystems
             if (!HasContents(component) || HasComp<ActiveMicrowaveComponent>(uid))
                 return;
 
-            component.Storage.Remove(args.EntityID);
+            component.Storage.Remove(EntityManager.GetEntity(args.EntityID));
             UpdateUserInterfaceState(uid, component);
         }
 
index 4198e6d703277ef472ffc1e7b6f6b3f03eea85b3..68d9577dd6508036353e196bc98f58e1f5d270e6 100644 (file)
@@ -206,7 +206,7 @@ namespace Content.Server.Kitchen.EntitySystems
                 this.IsPowered(uid, EntityManager),
                 canJuice,
                 canGrind,
-                inputContainer.ContainedEntities.Select(item => item).ToArray(),
+                GetNetEntityArray(inputContainer.ContainedEntities.ToArray()),
                 containerSolution?.Contents.ToArray()
             );
             _userInterfaceSystem.TrySetUiState(uid, ReagentGrinderUiKey.Key, state);
@@ -242,10 +242,11 @@ namespace Content.Server.Kitchen.EntitySystems
                 return;
 
             var inputContainer = _containerSystem.EnsureContainer<Container>(uid, SharedReagentGrinder.InputContainerId);
+            var ent = GetEntity(message.EntityId);
 
-            if (inputContainer.Remove(message.EntityId))
+            if (inputContainer.Remove(ent))
             {
-                message.EntityId.RandomOffset(0.4f);
+                ent.RandomOffset(0.4f);
                 ClickSound(uid, reagentGrinder);
                 UpdateUiState(uid);
             }
index 4ebc6fe74d1fee3f56e6e02dfde85729df4bea81..f270fe76d2cc168259d40250a69f50f4c1167c86 100644 (file)
@@ -66,7 +66,7 @@ public sealed class SharpSystem : EntitySystem
             return;
 
         var doAfter =
-            new DoAfterArgs(user, sharp.ButcherDelayModifier * butcher.ButcherDelay, new SharpDoAfterEvent(), knife, target: target, used: knife)
+            new DoAfterArgs(EntityManager, user, sharp.ButcherDelayModifier * butcher.ButcherDelay, new SharpDoAfterEvent(), knife, target: target, used: knife)
             {
                 BreakOnTargetMove = true,
                 BreakOnUserMove = true,
index 808292416cf14ba415083c2c9095fc70213eee7b..9761ae57657fc7ae35fe331f6ecd8e49a84f6c58 100644 (file)
@@ -224,7 +224,7 @@ namespace Content.Server.Lathe
             var producing = component.CurrentRecipe ?? component.Queue.FirstOrDefault();
 
             var state = new LatheUpdateState(GetAvailableRecipes(uid, component), component.Queue, producing);
-            UserInterfaceSystem.SetUiState(ui, state);
+            _uiSys.SetUiState(ui, state);
         }
 
         private void OnGetRecipes(EntityUid uid, TechnologyDatabaseComponent component, LatheGetRecipesEvent args)
index 144190cf8e0bae00fb303a07851e96a83890f865..b84a2688e57afc9c78d09cbaf9093d7d2568923e 100644 (file)
@@ -138,7 +138,7 @@ namespace Content.Server.Light.EntitySystems
             }
 
             // removing a working bulb, so require a delay
-            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(userUid, light.EjectBulbDelay, new PoweredLightDoAfterEvent(), uid, target: uid)
+            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, userUid, light.EjectBulbDelay, new PoweredLightDoAfterEvent(), uid, target: uid)
             {
                 BreakOnUserMove = true,
                 BreakOnDamage = true,
index 1632b654b901636df057f9bf8683bbd8d68893cb..c4ed74604d5e98088ad267e03ef35e395aee51d3 100644 (file)
@@ -96,7 +96,7 @@ public sealed class MagicSystem : EntitySystem
 
     private void AttemptLearn(EntityUid uid, SpellbookComponent component, UseInHandEvent args)
     {
-        var doAfterEventArgs = new DoAfterArgs(args.User, component.LearnTime, new SpellbookDoAfterEvent(), uid, target: uid)
+        var doAfterEventArgs = new DoAfterArgs(EntityManager, args.User, component.LearnTime, new SpellbookDoAfterEvent(), uid, target: uid)
         {
             BreakOnTargetMove = true,
             BreakOnUserMove = true,
index eef3e568498d2296eb4c214b69d02f3eda88577f..90770af1ad229b84e8005d2e333f7280ac50507b 100644 (file)
@@ -50,24 +50,34 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
 
     private void OnRequestVelocity(GridDragVelocityRequest ev, EntitySessionEventArgs args)
     {
+        var grid = GetEntity(ev.Grid);
+
         if (args.SenderSession is not IPlayerSession playerSession ||
             !_admin.CanCommand(playerSession, CommandName) ||
-            !Exists(ev.Grid) ||
-            Deleted(ev.Grid)) return;
+            !Exists(grid) ||
+            Deleted(grid))
+        {
+            return;
+        }
 
-        var gridBody = Comp<PhysicsComponent>(ev.Grid);
-        _physics.SetLinearVelocity(ev.Grid, ev.LinearVelocity, body: gridBody);
-        _physics.SetAngularVelocity(ev.Grid, 0f, body: gridBody);
+        var gridBody = Comp<PhysicsComponent>(grid);
+        _physics.SetLinearVelocity(grid, ev.LinearVelocity, body: gridBody);
+        _physics.SetAngularVelocity(grid, 0f, body: gridBody);
     }
 
     private void OnRequestDrag(GridDragRequestPosition msg, EntitySessionEventArgs args)
     {
+        var grid = GetEntity(msg.Grid);
+
         if (args.SenderSession is not IPlayerSession playerSession ||
             !_admin.CanCommand(playerSession, CommandName) ||
-            !Exists(msg.Grid) ||
-            Deleted(msg.Grid)) return;
+            !Exists(grid) ||
+            Deleted(grid))
+        {
+            return;
+        }
 
-        var gridXform = Transform(msg.Grid);
+        var gridXform = Transform(grid);
 
         gridXform.WorldPosition = msg.WorldPosition;
     }
index 43d6545100c695ce484c0319e419c85a7140cb23..f5b17fefb898446b579830d3074c8cf75f284a22 100644 (file)
@@ -13,9 +13,13 @@ using Content.Server.CartridgeLoader.Cartridges;
 using Content.Shared.CartridgeLoader;
 using Content.Shared.CartridgeLoader.Cartridges;
 using Content.Server.CartridgeLoader;
+using Content.Server.GameTicking;
 using Robust.Shared.Timing;
 using Content.Server.Popups;
+using Content.Server.StationRecords.Systems;
 using Content.Shared.Database;
+using Robust.Shared.Containers;
+using Robust.Shared.Utility;
 
 namespace Content.Server.MassMedia.Systems;
 
@@ -24,14 +28,15 @@ public sealed class NewsSystem : EntitySystem
     [Dependency] private readonly IGameTiming _timing = default!;
     [Dependency] private readonly UserInterfaceSystem _ui = default!;
     [Dependency] private readonly RingerSystem _ringer = default!;
-    [Dependency] private readonly CartridgeLoaderSystem? _cartridgeLoaderSystem = default!;
+    [Dependency] private readonly CartridgeLoaderSystem _cartridgeLoaderSystem = default!;
     [Dependency] private readonly SharedAudioSystem _audio = default!;
     [Dependency] private readonly PopupSystem _popup = default!;
     [Dependency] private readonly IAdminLogManager _adminLogger = default!;
-
+    [Dependency] private readonly GameTicker _ticker = default!;
     [Dependency] private readonly AccessReaderSystem _accessReader = default!;
+    [Dependency] private readonly StationRecordsSystem _stationRecords = default!;
 
-
+    // TODO remove this. Dont store data on systems
     private readonly List<NewsArticle> _articles = new List<NewsArticle>();
 
     public override void Initialize()
@@ -103,45 +108,51 @@ public sealed class NewsSystem : EntitySystem
         if (message.Action == NewsReadUiAction.NotificationSwith)
             component.NotificationOn = !component.NotificationOn;
 
-        UpdateReadUi(uid, args.LoaderUid, component);
+        UpdateReadUi(uid, GetEntity(args.LoaderUid), component);
     }
 
     public void OnWriteUiShareMessage(EntityUid uid, NewsWriteComponent component, NewsWriteShareMessage msg)
     {
-        var article = msg.Article;
+        // dont blindly trust input from clients.
+        if (msg.Session.AttachedEntity is not {} author)
+            return;
+
+        if (!_accessReader.FindAccessItemsInventory(author, out var items))
+            return;
 
-        var author = msg.Session.AttachedEntity;
-        if (author.HasValue
-            && _accessReader.FindAccessItemsInventory(author.Value, out var items)
-            && _accessReader.FindStationRecordKeys(author.Value, out var stationRecordKeys, items))
+        if (!_accessReader.FindStationRecordKeys(author, out var stationRecordKeys, items))
+            return;
+
+        string? authorName = null;
+        foreach (var item in items)
         {
-            article.AuthorStationRecordKeyIds = stationRecordKeys;
+            // ID Card
+            if (TryComp(item, out IdCardComponent? id))
+            {
+                authorName = id.FullName;
+                break;
+            }
 
-            foreach (var item in items)
+            if (TryComp(item, out PdaComponent? pda)
+                     && pda.ContainedId != null
+                     && TryComp(pda.ContainedId, out id))
             {
-                // ID Card
-                if (TryComp(item, out IdCardComponent? id))
-                {
-                    article.Author = id.FullName;
-                    break;
-                }
-                // PDA
-                else if (TryComp(item, out PdaComponent? pda)
-                    && pda.ContainedId != null
-                    && TryComp(pda.ContainedId, out id))
-                {
-                    article.Author = id.FullName;
-                    break;
-                }
+                authorName = id.FullName;
+                break;
             }
         }
 
-        _audio.PlayPvs(component.ConfirmSound, uid);
+        NewsArticle article = new NewsArticle
+        {
+            Author = authorName,
+            Name = (msg.Name.Length <= 25 ? msg.Name.Trim() : $"{msg.Name.Trim().Substring(0, 25)}..."),
+            Content = msg.Content,
+            ShareTime = _ticker.RoundDuration()
 
-        if (author != null)
-            _adminLogger.Add(LogType.Chat, LogImpact.Medium, $"{ToPrettyString(author.Value):actor} created news article {article.Name} by {article.Author}: {article.Content}");
-        else
-            _adminLogger.Add(LogType.Chat, LogImpact.Medium, $"{msg.Session.Name:actor} created news article {article.Name}: {article.Content}");
+        };
+
+        _audio.PlayPvs(component.ConfirmSound, uid);
+        _adminLogger.Add(LogType.Chat, LogImpact.Medium, $"{ToPrettyString(author):actor} created news article {article.Name} by {article.Author}: {article.Content}");
         _articles.Add(article);
 
         component.ShareAvalible = false;
@@ -192,18 +203,15 @@ public sealed class NewsSystem : EntitySystem
 
     private void TryNotify()
     {
-        var query = EntityQueryEnumerator<CartridgeLoaderComponent, RingerComponent>();
+        var query = EntityQueryEnumerator<CartridgeLoaderComponent, RingerComponent, ContainerManagerComponent>();
 
-        while (query.MoveNext(out var owner, out var comp, out var ringer))
+        while (query.MoveNext(out var uid, out var comp, out var ringer, out var cont))
         {
-            foreach (var app in comp.InstalledPrograms)
-            {
-                if (EntityManager.TryGetComponent<NewsReadCartridgeComponent>(app, out var cartridge) && cartridge.NotificationOn)
-                {
-                    _ringer.RingerPlayRingtone(owner, ringer);
-                    break;
-                }
-            }
+            if (!_cartridgeLoaderSystem.HasProgram<NewsReadCartridgeComponent>(uid, false, comp, cont))
+                continue;
+
+            _ringer.RingerPlayRingtone(uid, ringer);
+            break;
         }
     }
 
@@ -242,9 +250,11 @@ public sealed class NewsSystem : EntitySystem
         {
             return true;
         }
+
+        var conv = _stationRecords.Convert(articleToDelete.AuthorStationRecordKeyIds);
         if (user.HasValue
             && _accessReader.FindStationRecordKeys(user.Value, out var recordKeys)
-            && recordKeys.Intersect(articleToDelete.AuthorStationRecordKeyIds).Any())
+            && recordKeys.Intersect(conv).Any())
         {
             return true;
         }
index 84f60573b1720fedd4474f08b048a3bbde58b34e..499f833ac83eded7059b384934b5ec8bccfdbfd0 100644 (file)
@@ -56,10 +56,12 @@ public sealed class MechGrabberSystem : EntitySystem
         if (!_interaction.InRangeUnobstructed(mech, targetCoords))
             return;
 
-        if (!component.ItemContainer.Contains(msg.Item))
+        var item = GetEntity(msg.Item);
+
+        if (!component.ItemContainer.Contains(item))
             return;
 
-        RemoveItem(uid, mech, msg.Item, component);
+        RemoveItem(uid, mech, item, component);
     }
 
     /// <summary>
@@ -77,11 +79,11 @@ public sealed class MechGrabberSystem : EntitySystem
         component.ItemContainer.Remove(toRemove);
         var mechxform = Transform(mech);
         var xform = Transform(toRemove);
-        xform.AttachToGridOrMap();
+        _transform.AttachToGridOrMap(toRemove, xform);
+        var (mechPos, mechRot) = _transform.GetWorldPositionRotation(mechxform);
 
-        var offset = _transform.GetWorldPosition(mechxform) + _transform.GetWorldRotation(mechxform).RotateVec(component.DepositOffset);
-        _transform.SetWorldPosition(xform, offset);
-        _transform.SetWorldRotation(xform, Angle.Zero);
+        var offset = mechPos + mechRot.RotateVec(component.DepositOffset);
+        _transform.SetWorldPositionRotation(xform, offset, Angle.Zero);
         _mech.UpdateUserInterface(mech);
     }
 
@@ -113,10 +115,10 @@ public sealed class MechGrabberSystem : EntitySystem
     {
         var state = new MechGrabberUiState
         {
-            Contents = component.ItemContainer.ContainedEntities.ToList(),
+            Contents = GetNetEntityList(component.ItemContainer.ContainedEntities.ToList()),
             MaxContents = component.MaxContents
         };
-        args.States.Add(uid, state);
+        args.States.Add(GetNetEntity(uid), state);
     }
 
     private void OnInteract(EntityUid uid, MechGrabberComponent component, InteractNoHandEvent args)
@@ -148,7 +150,7 @@ public sealed class MechGrabberSystem : EntitySystem
 
         args.Handled = true;
         component.AudioStream = _audio.PlayPvs(component.GrabSound, uid);
-        _doAfter.TryStartDoAfter(new DoAfterArgs(args.User, component.GrabDelay, new GrabberDoAfterEvent(), uid, target: target, used: uid)
+        _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.GrabDelay, new GrabberDoAfterEvent(), uid, target: target, used: uid)
         {
             BreakOnTargetMove = true,
             BreakOnUserMove = true
index 71b31b6f3006ac17850582a17193715ec67f63e7..5191f53004e84c6a457663d398ed3e041b02ef9c 100644 (file)
@@ -45,7 +45,7 @@ public sealed class MechEquipmentSystem : EntitySystem
 
         _popup.PopupEntity(Loc.GetString("mech-equipment-begin-install", ("item", uid)), mech);
 
-        var doAfterEventArgs = new DoAfterArgs(args.User, component.InstallDuration, new InsertEquipmentEvent(), uid, target: mech, used: uid)
+        var doAfterEventArgs = new DoAfterArgs(EntityManager, args.User, component.InstallDuration, new InsertEquipmentEvent(), uid, target: mech, used: uid)
         {
             BreakOnTargetMove = true,
             BreakOnUserMove = true
index 453b471df66e9aaa8247797c3ea66cb04f554127..8c34f875bfe00357f4e0655ac683846a3bb445e7 100644 (file)
@@ -93,7 +93,7 @@ public sealed partial class MechSystem : SharedMechSystem
 
         if (TryComp<ToolComponent>(args.Used, out var tool) && tool.Qualities.Contains("Prying") && component.BatterySlot.ContainedEntity != null)
         {
-            var doAfterEventArgs = new DoAfterArgs(args.User, component.BatteryRemovalDelay, new RemoveBatteryEvent(), uid, target: uid, used: args.Target)
+            var doAfterEventArgs = new DoAfterArgs(EntityManager, args.User, component.BatteryRemovalDelay, new RemoveBatteryEvent(), uid, target: uid, used: args.Target)
             {
                 BreakOnTargetMove = true,
                 BreakOnUserMove = true,
@@ -146,13 +146,15 @@ public sealed partial class MechSystem : SharedMechSystem
 
     private void OnRemoveEquipmentMessage(EntityUid uid, MechComponent component, MechEquipmentRemoveMessage args)
     {
-        if (!Exists(args.Equipment) || Deleted(args.Equipment))
+        var equip = GetEntity(args.Equipment);
+
+        if (!Exists(equip) || Deleted(equip))
             return;
 
-        if (!component.EquipmentContainer.ContainedEntities.Contains(args.Equipment))
+        if (!component.EquipmentContainer.ContainedEntities.Contains(equip))
             return;
 
-        RemoveEquipment(uid, args.Equipment, component);
+        RemoveEquipment(uid, equip, component);
     }
 
     private void OnOpenUi(EntityUid uid, MechComponent component, MechOpenUiEvent args)
@@ -179,7 +181,7 @@ public sealed partial class MechSystem : SharedMechSystem
                 Text = Loc.GetString("mech-verb-enter"),
                 Act = () =>
                 {
-                    var doAfterEventArgs = new DoAfterArgs(args.User, component.EntryDelay, new MechEntryEvent(), uid, target: uid)
+                    var doAfterEventArgs = new DoAfterArgs(EntityManager, args.User, component.EntryDelay, new MechEntryEvent(), uid, target: uid)
                     {
                         BreakOnUserMove = true,
                     };
@@ -209,7 +211,7 @@ public sealed partial class MechSystem : SharedMechSystem
                         return;
                     }
 
-                    var doAfterEventArgs = new DoAfterArgs(args.User, component.ExitDelay, new MechExitEvent(), uid, target: uid)
+                    var doAfterEventArgs = new DoAfterArgs(EntityManager, args.User, component.ExitDelay, new MechExitEvent(), uid, target: uid)
                     {
                         BreakOnUserMove = true,
                         BreakOnTargetMove = true,
@@ -282,9 +284,11 @@ public sealed partial class MechSystem : SharedMechSystem
     {
         var ev = new MechEquipmentUiMessageRelayEvent(args);
         var allEquipment = new List<EntityUid>(component.EquipmentContainer.ContainedEntities);
+        var argEquip = GetEntity(args.Equipment);
+
         foreach (var equipment in allEquipment)
         {
-            if (args.Equipment == equipment)
+            if (argEquip == equipment)
                 RaiseLocalEvent(equipment, ev);
         }
     }
@@ -307,7 +311,7 @@ public sealed partial class MechSystem : SharedMechSystem
             EquipmentStates = ev.States
         };
         var ui = _ui.GetUi(uid, MechUiKey.Key);
-        UserInterfaceSystem.SetUiState(ui, state);
+        _ui.SetUiState(ui, state);
     }
 
     public override void BreakMech(EntityUid uid, MechComponent? component = null)
index 880f702d1cb7de778498556094d5efd8c3460422..40637c5362b936d91a4b6c4fafacca3dd5c5a002 100644 (file)
@@ -152,7 +152,7 @@ namespace Content.Server.Medical.BiomassReclaimer
             if (!HasComp<MobStateComponent>(args.Used) || !CanGib(uid, args.Used, component))
                 return;
 
-            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(args.User, 7f, new ReclaimerDoAfterEvent(), uid, target: args.Target, used: args.Used)
+            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, 7f, new ReclaimerDoAfterEvent(), uid, target: args.Target, used: args.Used)
             {
                 BreakOnTargetMove = true,
                 BreakOnUserMove = true,
index 3b73ce80c480fe5a03bad5304509f03bf0089a89..ed650704361a7c7040842b0fcad22466706432a5 100644 (file)
@@ -59,7 +59,7 @@ namespace Content.Server.Medical.CrewMonitoring
 
             // update all sensors info
             var allSensors = component.ConnectedSensors.Values.ToList();
-            UserInterfaceSystem.SetUiState(bui, new CrewMonitoringState(allSensors, component.Snap, component.Precision));
+            _uiSystem.SetUiState(bui, new CrewMonitoringState(allSensors, component.Snap, component.Precision));
         }
     }
 }
index 57f1799fad1989f93cb7971b7aed9dcf9d34eb1a..ddd29d26a2c90fa17fe67f5a6489c34851062879 100644 (file)
@@ -134,7 +134,7 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
         if (cryoPodComponent.BodyContainer.ContainedEntity != null)
             return;
 
-        var doAfterArgs = new DoAfterArgs(args.User, cryoPodComponent.EntryDelay, new CryoPodDragFinished(), uid, target: args.Dragged, used: uid)
+        var doAfterArgs = new DoAfterArgs(EntityManager, args.User, cryoPodComponent.EntryDelay, new CryoPodDragFinished(), uid, target: args.Dragged, used: uid)
         {
             BreakOnDamage = true,
             BreakOnTargetMove = true,
@@ -184,8 +184,8 @@ public sealed partial class CryoPodSystem: SharedCryoPodSystem
         _userInterfaceSystem.TrySendUiMessage(
             uid,
             HealthAnalyzerUiKey.Key,
-            new HealthAnalyzerScannedUserMessage(cryoPodComponent.BodyContainer.ContainedEntity,
-            temp != null ? temp.CurrentTemperature : 0, bloodstream != null ? bloodstream.BloodSolution.FillFraction : 0));
+            new HealthAnalyzerScannedUserMessage(GetNetEntity(cryoPodComponent.BodyContainer.ContainedEntity),
+            temp?.CurrentTemperature ?? 0, bloodstream != null ? bloodstream.BloodSolution.FillFraction : 0));
     }
 
     private void OnInteractUsing(EntityUid uid, CryoPodComponent cryoPodComponent, InteractUsingEvent args)
index f86f6b24b3fa96272ac6c3585cdc18ce2b07b0c8..d80d8bdb65050ece141471e4653fb31c64d23790 100644 (file)
@@ -177,7 +177,7 @@ public sealed class DefibrillatorSystem : EntitySystem
             return false;
 
         _audio.PlayPvs(component.ChargeSound, uid);
-        return _doAfter.TryStartDoAfter(new DoAfterArgs(user, component.DoAfterDuration, new DefibrillatorZapDoAfterEvent(),
+        return _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.DoAfterDuration, new DefibrillatorZapDoAfterEvent(),
             uid, target, uid)
             {
                 BlockDuplicate = true,
index 35d70209b5cb23d65e4d155006b361ad0f910dd5..2e04e1b03cbfaad0727df235ff8785ebcef4f991 100644 (file)
@@ -187,7 +187,7 @@ public sealed class HealingSystem : EntitySystem
             : component.Delay * GetScaledHealingPenalty(user, component);
 
         var doAfterEventArgs =
-            new DoAfterArgs(user, delay, new HealingDoAfterEvent(), target, target: target, used: uid)
+            new DoAfterArgs(EntityManager, user, delay, new HealingDoAfterEvent(), target, target: target, used: uid)
             {
                 //Raise the event on the target if it's not self, otherwise raise it on self.
                 BreakOnUserMove = true,
index 7e07e4ac9765fb50bd994b8c43ac85d760dc9ee3..79d55e8068c2d8b535584cd5b83d7f179c769e47 100644 (file)
@@ -32,7 +32,7 @@ namespace Content.Server.Medical
 
             _audio.PlayPvs(healthAnalyzer.ScanningBeginSound, uid);
 
-            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(args.User, healthAnalyzer.ScanDelay, new HealthAnalyzerDoAfterEvent(), uid, target: args.Target, used: uid)
+            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, healthAnalyzer.ScanDelay, new HealthAnalyzerDoAfterEvent(), uid, target: args.Target, used: uid)
             {
                 BreakOnTargetMove = true,
                 BreakOnUserMove = true,
@@ -75,7 +75,7 @@ namespace Content.Server.Medical
 
             OpenUserInterface(user, healthAnalyzer);
 
-            _uiSystem.SendUiMessage(healthAnalyzer.UserInterface, new HealthAnalyzerScannedUserMessage(target, temp != null ? temp.CurrentTemperature : float.NaN,
+            _uiSystem.SendUiMessage(healthAnalyzer.UserInterface, new HealthAnalyzerScannedUserMessage(GetNetEntity(target), temp != null ? temp.CurrentTemperature : float.NaN,
                 bloodstream != null ? bloodstream.BloodSolution.FillFraction : float.NaN));
         }
     }
index 9f28d44d59c167644d7a3d0335e0210df1a05d00..9521c14f2e3314eacf7ea760b3567ba04bafc2f6 100644 (file)
@@ -105,7 +105,7 @@ namespace Content.Server.Medical.Stethoscope
         // construct the doafter and start it
         private void StartListening(EntityUid scope, EntityUid user, EntityUid target, StethoscopeComponent comp)
         {
-            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(user, comp.Delay, new StethoscopeDoAfterEvent(), scope, target: target, used: scope)
+            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, user, comp.Delay, new StethoscopeDoAfterEvent(), scope, target: target, used: scope)
             {
                 BreakOnTargetMove = true,
                 BreakOnUserMove = true,
index 597b64764645f0be8fcf1f9a740e7c510b86fc62..3871852a11915b656c5f18f94f5d7462ef187bab 100644 (file)
@@ -321,7 +321,7 @@ namespace Content.Server.Medical.SuitSensors
                 totalDamage = damageable.TotalDamage.Int();
 
             // finally, form suit sensor status
-            var status = new SuitSensorStatus(uid, userName, userJob);
+            var status = new SuitSensorStatus(GetNetEntity(uid), userName, userJob);
             switch (sensor.Mode)
             {
                 case SuitSensorMode.SensorBinary:
@@ -353,7 +353,7 @@ namespace Content.Server.Medical.SuitSensors
                         coordinates = EntityCoordinates.Invalid;
                     }
 
-                    status.Coordinates = coordinates;
+                    status.Coordinates = GetNetCoordinates(coordinates);
                     break;
             }
 
@@ -404,11 +404,11 @@ namespace Content.Server.Medical.SuitSensors
             payload.TryGetValue(SuitSensorConstants.NET_TOTAL_DAMAGE, out int? totalDamage);
             payload.TryGetValue(SuitSensorConstants.NET_COORDINATES, out EntityCoordinates? cords);
 
-            var status = new SuitSensorStatus(suitSensorUid, name, job)
+            var status = new SuitSensorStatus(GetNetEntity(suitSensorUid), name, job)
             {
                 IsAlive = isAlive.Value,
                 TotalDamage = totalDamage,
-                Coordinates = cords,
+                Coordinates = GetNetCoordinates(cords),
             };
             return status;
         }
index 04907962a00a1d3f1210c1f8ff72cea6a6b7dafe..5e19d135b6fd7b7ca057f666509b1de2310c480e 100644 (file)
@@ -12,6 +12,8 @@ namespace Content.Server.Mind.Commands
     [AdminCommand(AdminFlags.Admin)]
     public sealed class MakeSentientCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "makesentient";
         public string Description => "Makes an entity sentient (able to be controlled by a player)";
         public string Help => "makesentient <entity id>";
@@ -24,21 +26,19 @@ namespace Content.Server.Mind.Commands
                 return;
             }
 
-            if (!EntityUid.TryParse(args[0], out var entId))
+            if (!NetEntity.TryParse(args[0], out var entNet) || !_entManager.TryGetEntity(entNet, out var entId))
             {
                 shell.WriteLine("Invalid argument.");
                 return;
             }
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
-
-            if (!entityManager.EntityExists(entId))
+            if (!_entManager.EntityExists(entId))
             {
                 shell.WriteLine("Invalid entity specified!");
                 return;
             }
 
-            MakeSentient(entId, entityManager, true, true);
+            MakeSentient(entId.Value, _entManager, true, true);
         }
 
         public static void MakeSentient(EntityUid uid, IEntityManager entityManager, bool allowMovement = true, bool allowSpeech = true)
index cbe8be239ddbd74daa0799e82ea39a95f1d50a1b..afdd1caf9b88882d3f74fcca408d2ed6bc28db9e 100644 (file)
@@ -1,3 +1,4 @@
+using System.Diagnostics.CodeAnalysis;
 using Content.Server.Access.Systems;
 using Content.Server.Administration;
 using Content.Server.Administration.Systems;
@@ -17,6 +18,9 @@ namespace Content.Server.Mind.Commands;
 [AdminCommand(AdminFlags.VarEdit)]
 public sealed class RenameCommand : IConsoleCommand
 {
+    [Dependency] private readonly IEntityManager _entManager = default!;
+    [Dependency] private readonly IPlayerManager _playerManager = default!;
+
     public string Command => "rename";
     public string Description => "Renames an entity and its cloner entries, ID cards, and PDAs.";
     public string Help => "rename <Username|EntityUid> <New character name>";
@@ -36,53 +40,53 @@ public sealed class RenameCommand : IConsoleCommand
             return;
         }
 
-        var entMan = IoCManager.Resolve<IEntityManager>();
-
-        if (!TryParseUid(args[0], shell, entMan, out var entityUid))
+        if (!TryParseUid(args[0], shell, _entManager, out var entityUid))
             return;
 
         // Metadata
-        var metadata = entMan.GetComponent<MetaDataComponent>(entityUid);
+        var metadata = _entManager.GetComponent<MetaDataComponent>(entityUid.Value);
         var oldName = metadata.EntityName;
-        entMan.System<MetaDataSystem>().SetEntityName(entityUid, name, metadata);
+        _entManager.System<MetaDataSystem>().SetEntityName(entityUid.Value, name, metadata);
 
-        var minds = entMan.System<SharedMindSystem>();
+        var minds = _entManager.System<SharedMindSystem>();
 
-        if (minds.TryGetMind(entityUid, out var mindId, out var mind))
+        if (minds.TryGetMind(entityUid.Value, out var mindId, out var mind))
         {
             // Mind
             mind.CharacterName = name;
         }
 
         // Id Cards
-        if (entMan.TrySystem<IdCardSystem>(out var idCardSystem))
+        if (_entManager.TrySystem<IdCardSystem>(out var idCardSystem))
         {
-            if (idCardSystem.TryFindIdCard(entityUid, out var idCard))
+            if (idCardSystem.TryFindIdCard(entityUid.Value, out var idCard))
             {
                 idCardSystem.TryChangeFullName(idCard.Owner, name, idCard);
 
                 // Records
                 // This is done here because ID cards are linked to station records
-                if (entMan.TrySystem<StationRecordsSystem>(out var recordsSystem)
-                    && entMan.TryGetComponent(idCard.Owner, out StationRecordKeyStorageComponent? keyStorage)
+                if (_entManager.TrySystem<StationRecordsSystem>(out var recordsSystem)
+                    && _entManager.TryGetComponent(idCard.Owner, out StationRecordKeyStorageComponent? keyStorage)
                     && keyStorage.Key != null)
                 {
-                    if (recordsSystem.TryGetRecord<GeneralStationRecord>(keyStorage.Key.Value.OriginStation,
+                    var origin = keyStorage.Key.Value.OriginStation;
+
+                    if (recordsSystem.TryGetRecord<GeneralStationRecord>(origin,
                             keyStorage.Key.Value,
                             out var generalRecord))
                     {
                         generalRecord.Name = name;
                     }
 
-                    recordsSystem.Synchronize(keyStorage.Key.Value.OriginStation);
+                    recordsSystem.Synchronize(origin);
                 }
             }
         }
 
         // PDAs
-        if (entMan.TrySystem<PdaSystem>(out var pdaSystem))
+        if (_entManager.TrySystem<PdaSystem>(out var pdaSystem))
         {
-            var query = entMan.EntityQueryEnumerator<PdaComponent>();
+            var query = _entManager.EntityQueryEnumerator<PdaComponent>();
             while (query.MoveNext(out var uid, out var pda))
             {
                 if (pda.OwnerName == oldName)
@@ -93,21 +97,20 @@ public sealed class RenameCommand : IConsoleCommand
         }
 
         // Admin Overlay
-        if (entMan.TrySystem<AdminSystem>(out var adminSystem)
-            && entMan.TryGetComponent<ActorComponent>(entityUid, out var actorComp))
+        if (_entManager.TrySystem<AdminSystem>(out var adminSystem)
+            && _entManager.TryGetComponent<ActorComponent>(entityUid, out var actorComp))
         {
             adminSystem.UpdatePlayerList(actorComp.PlayerSession);
         }
     }
 
-    private static bool TryParseUid(string str, IConsoleShell shell,
-        IEntityManager entMan, out EntityUid entityUid)
+    private bool TryParseUid(string str, IConsoleShell shell,
+        IEntityManager entMan, [NotNullWhen(true)] out EntityUid? entityUid)
     {
-        if (EntityUid.TryParse(str, out entityUid) && entMan.EntityExists(entityUid))
+        if (NetEntity.TryParse(str, out var entityUidNet) && _entManager.TryGetEntity(entityUidNet, out entityUid) && entMan.EntityExists(entityUid))
             return true;
 
-        var playerMan = IoCManager.Resolve<IPlayerManager>();
-        if (playerMan.TryGetSessionByUsername(str, out var session) && session.AttachedEntity.HasValue)
+        if (_playerManager.TryGetSessionByUsername(str, out var session) && session.AttachedEntity.HasValue)
         {
             entityUid = session.AttachedEntity.Value;
             return true;
@@ -117,6 +120,8 @@ public sealed class RenameCommand : IConsoleCommand
             shell.WriteError("Can't find username/uid: " + str);
         else
             shell.WriteError(str + " does not have an entity.");
+
+        entityUid = EntityUid.Invalid;
         return false;
     }
 }
index b557ff3d4dcfeb5054baac37c2b83e1814cfa801..6fa9af0ccdf72f1e4f791ce3594d219bd1196aef 100644 (file)
@@ -231,7 +231,7 @@ public sealed class HTNSystem : EntitySystem
 
                         RaiseNetworkEvent(new HTNMessage()
                         {
-                            Uid = uid,
+                            Uid = GetNetEntity(uid),
                             Text = text.ToString(),
                         }, session.ConnectedClient);
                     }
index ca970815b63e5e0babbac3a0a20688d804afd6eb..a173cb7942e2f1aff8a06316867f648cfcebe86f 100644 (file)
@@ -465,6 +465,14 @@ public sealed partial class PathfindingSystem
                         continue;
                     }
 
+                    var xform = xformQuery.GetComponent(ent);
+
+                    if (xform.ParentUid != grid.Owner ||
+                        grid.LocalToTile(xform.Coordinates) != tilePos)
+                    {
+                        continue;
+                    }
+
                     tileEntities.Add(ent);
                 }
 
index 06ff9faa6961aba20fa494d0ffa9dfb0fc497080..d8ecebc12cab0905bc585aaec426018be1e41a13 100644 (file)
@@ -495,16 +495,16 @@ namespace Content.Server.NPC.Pathfinding
         private DebugPathPoly GetDebugPoly(PathPoly poly)
         {
             // Create fake neighbors for it
-            var neighbors = new List<EntityCoordinates>(poly.Neighbors.Count);
+            var neighbors = new List<NetCoordinates>(poly.Neighbors.Count);
 
             foreach (var neighbor in poly.Neighbors)
             {
-                neighbors.Add(neighbor.Coordinates);
+                neighbors.Add(GetNetCoordinates(neighbor.Coordinates));
             }
 
             return new DebugPathPoly()
             {
-                GraphUid = poly.GraphUid,
+                GraphUid = GetNetEntity(poly.GraphUid),
                 ChunkOrigin = poly.ChunkOrigin,
                 TileIndex = poly.TileIndex,
                 Box = poly.Box,
@@ -579,12 +579,14 @@ namespace Content.Server.NPC.Pathfinding
 
             foreach (var comp in EntityQuery<GridPathfindingComponent>(true))
             {
-                msg.Breadcrumbs.Add(comp.Owner, new Dictionary<Vector2i, List<PathfindingBreadcrumb>>(comp.Chunks.Count));
+                var netGrid = GetNetEntity(comp.Owner);
+
+                msg.Breadcrumbs.Add(netGrid, new Dictionary<Vector2i, List<PathfindingBreadcrumb>>(comp.Chunks.Count));
 
                 foreach (var chunk in comp.Chunks)
                 {
                     var data = GetCrumbs(chunk.Value);
-                    msg.Breadcrumbs[comp.Owner].Add(chunk.Key, data);
+                    msg.Breadcrumbs[netGrid].Add(chunk.Key, data);
                 }
             }
 
@@ -626,12 +628,14 @@ namespace Content.Server.NPC.Pathfinding
 
             foreach (var comp in EntityQuery<GridPathfindingComponent>(true))
             {
-                msg.Polys.Add(comp.Owner, new Dictionary<Vector2i, Dictionary<Vector2i, List<DebugPathPoly>>>(comp.Chunks.Count));
+                var netGrid = GetNetEntity(comp.Owner);
+
+                msg.Polys.Add(netGrid, new Dictionary<Vector2i, Dictionary<Vector2i, List<DebugPathPoly>>>(comp.Chunks.Count));
 
                 foreach (var chunk in comp.Chunks)
                 {
                     var data = GetPolys(chunk.Value);
-                    msg.Polys[comp.Owner].Add(chunk.Key, data);
+                    msg.Polys[netGrid].Add(chunk.Key, data);
                 }
             }
 
@@ -646,7 +650,7 @@ namespace Content.Server.NPC.Pathfinding
             var msg = new PathBreadcrumbsRefreshMessage()
             {
                 Origin = chunk.Origin,
-                GridUid = gridUid,
+                GridUid = GetNetEntity(gridUid),
                 Data = GetCrumbs(chunk),
             };
 
@@ -680,7 +684,7 @@ namespace Content.Server.NPC.Pathfinding
             var msg = new PathPolysRefreshMessage()
             {
                 Origin = chunk.Origin,
-                GridUid = gridUid,
+                GridUid = GetNetEntity(gridUid),
                 Polys = data,
             };
 
index 8d6f640955cd40b21aad9dd3c40c86baef291bf9..62fd13fc9fb749470842bd7debc70bbfde27104d 100644 (file)
@@ -268,7 +268,7 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
                 var (uid, steering, mover, _) = npcs[i];
 
                 data.Add(new NPCSteeringDebugData(
-                    uid,
+                    GetNetEntity(uid),
                     mover.CurTickSprintMovement,
                     steering.Interest,
                     steering.Danger,
index 1910969f190feb58fe2248912080a8ccd2eaa354..d5871c147df9e5be89cb285a199f8eb27a59426f 100644 (file)
@@ -45,7 +45,7 @@ public sealed class BatteryDrainerSystem : SharedBatteryDrainerSystem
             return;
         }
 
-        var doAfterArgs = new DoAfterArgs(uid, comp.DrainTime, new DrainDoAfterEvent(), target: target, eventTarget: uid)
+        var doAfterArgs = new DoAfterArgs(EntityManager, uid, comp.DrainTime, new DrainDoAfterEvent(), target: target, eventTarget: uid)
         {
             BreakOnUserMove = true,
             MovementThreshold = 0.5f,
index 2f53bff7ad451c8aca9e9715a301c9beb9ae3da7..e4bd303150b8f44f48e347b07a705fa66c1189f8 100644 (file)
@@ -409,7 +409,7 @@ namespace Content.Server.NodeContainer.EntitySystems
             RaiseNetworkEvent(msg, player.ConnectedClient);
         }
 
-        private static NodeVis.GroupData VisMakeGroupState(BaseNodeGroup group)
+        private NodeVis.GroupData VisMakeGroupState(BaseNodeGroup group)
         {
             return new()
             {
@@ -421,7 +421,7 @@ namespace Content.Server.NodeContainer.EntitySystems
                     Name = n.Name,
                     NetId = n.NetId,
                     Reachable = n.ReachableNodes.Select(r => r.NetId).ToArray(),
-                    Entity = n.Owner,
+                    Entity = GetNetEntity(n.Owner),
                     Type = n.GetType().Name
                 }).ToArray(),
                 DebugData = group.GetDebugData()
index fccfbe7c6b04d6365dc6fd3cc8f1ea67be27e7e3..55dca4f70d895fd1c0a542e098d829840b866738 100644 (file)
@@ -18,11 +18,6 @@ namespace Content.Server.Nuke.Commands
 
         [Dependency] private readonly IEntityManager _entityManager = default!;
 
-        public SendNukeCodesCommand()
-        {
-            IoCManager.InjectDependencies(this);
-        }
-
         public void Execute(IConsoleShell shell, string argStr, string[] args)
         {
             if (args.Length != 1)
@@ -31,13 +26,13 @@ namespace Content.Server.Nuke.Commands
                 return;
             }
 
-            if (!EntityUid.TryParse(args[0], out var uid))
+            if (!NetEntity.TryParse(args[0], out var uidNet) || !_entityManager.TryGetEntity(uidNet, out var uid))
             {
                 shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
                 return;
             }
 
-            _entityManager.System<NukeCodePaperSystem>().SendNukeCodes(uid);
+            _entityManager.System<NukeCodePaperSystem>().SendNukeCodes(uid.Value);
         }
 
         public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
index 6caafc13c417d93d4043b62569b13b1f7a93a666..e499afb225e6effac6866280c918a162cbc85139 100644 (file)
@@ -16,12 +16,12 @@ public sealed class ToggleNukeCommand : LocalizedCommands
 
     public override void Execute(IConsoleShell shell, string argStr, string[] args)
     {
-        EntityUid bombUid;
+        EntityUid? bombUid = null;
         NukeComponent? bomb = null;
 
         if (args.Length >= 2)
         {
-            if (!EntityUid.TryParse(args[1], out bombUid))
+            if (!_entManager.TryParseNetEntity(args[1], out bombUid))
             {
                 shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
                 return;
@@ -31,12 +31,13 @@ public sealed class ToggleNukeCommand : LocalizedCommands
         {
             var query = _entManager.EntityQueryEnumerator<NukeComponent>();
 
-            while (query.MoveNext(out bombUid, out bomb))
+            while (query.MoveNext(out var bomba, out bomb))
             {
+                bombUid = bomba;
                 break;
             }
 
-            if (bomb == null)
+            if (bombUid == null)
             {
                 shell.WriteError(Loc.GetString("cmd-nukearm-not-found"));
                 return;
@@ -53,10 +54,10 @@ public sealed class ToggleNukeCommand : LocalizedCommands
                 return;
             }
 
-            nukeSys.SetRemainingTime(bombUid, timer, bomb);
+            nukeSys.SetRemainingTime(bombUid.Value, timer, bomb);
         }
 
-        nukeSys.ToggleBomb(bombUid, bomb);
+        nukeSys.ToggleBomb(bombUid.Value, bomb);
     }
 
     public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
index 6adbd7ffc85b48bf8766a732c44125a758ad653c..97c3b6c94f494f9c3fbd2e3072e06240a56102ab 100644 (file)
@@ -377,7 +377,7 @@ public sealed class NukeSystem : EntitySystem
             CooldownTime = (int) component.CooldownTime
         };
 
-        UserInterfaceSystem.SetUiState(ui, state);
+        _ui.SetUiState(ui, state);
     }
 
     private void PlayNukeKeypadSound(EntityUid uid, int number, NukeComponent? component = null)
@@ -568,7 +568,7 @@ public sealed class NukeSystem : EntitySystem
 
     private void DisarmBombDoafter(EntityUid uid, EntityUid user, NukeComponent nuke)
     {
-        var doAfter = new DoAfterArgs(user, nuke.DisarmDoafterLength, new NukeDisarmDoAfterEvent(), uid, target: uid)
+        var doAfter = new DoAfterArgs(EntityManager, user, nuke.DisarmDoafterLength, new NukeDisarmDoAfterEvent(), uid, target: uid)
         {
             BreakOnDamage = true,
             BreakOnTargetMove = true,
index 980c08d4bcd2ab6021f8ec448137690e748158c5..1aff7e1e9ba7dbdf7502e62ab6a662cf213051fa 100644 (file)
@@ -311,7 +311,7 @@ public sealed class DrinkSystem : EntitySystem
 
         var flavors = _flavorProfile.GetLocalizedFlavorsMessage(user, drinkSolution);
 
-        var doAfterEventArgs = new DoAfterArgs(
+        var doAfterEventArgs = new DoAfterArgs(EntityManager,
             user,
             forceDrink ? drink.ForceFeedDelay : drink.Delay,
             new ConsumeDoAfterEvent(drinkSolution.Name, flavors),
index 6c522a8b28331ff27a0518ac35419132b0babc14..67e19ae17d604a01b31cf3feff5c4fa6f0f87103 100644 (file)
@@ -170,7 +170,7 @@ namespace Content.Server.Nutrition.EntitySystems
                 _adminLogger.Add(LogType.Ingestion, LogImpact.Low, $"{ToPrettyString(target):target} is eating {ToPrettyString(food):food} {SolutionContainerSystem.ToPrettyString(foodSolution)}");
             }
 
-            var doAfterArgs = new DoAfterArgs(
+            var doAfterArgs = new DoAfterArgs(EntityManager,
                 user,
                 forceFeed ? foodComp.ForceFeedDelay : foodComp.Delay,
                 new ConsumeDoAfterEvent(foodSolution.Name, flavors),
index 5b1ced8b188d1cf112c17e5db5612d74253d2c56..4dd9aff9ac8bb4393b82d484eb1fac2f2f4e1ed9 100644 (file)
@@ -113,7 +113,7 @@ namespace Content.Server.Nutrition.EntitySystems
             if (!exploded)
             {
                 var vapeDoAfterEvent = new VapeDoAfterEvent(solution, forced);
-                _doAfterSystem.TryStartDoAfter(new DoAfterArgs(args.User, delay, vapeDoAfterEvent, uid, target: args.Target, used: uid)
+                _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, delay, vapeDoAfterEvent, uid, target: args.Target, used: uid)
                 {
                     BreakOnTargetMove = true,
                     BreakOnUserMove = false,
index e1650f19b3592e014ae2998bbb42ff55e28ab1a7..ae0fc1e1dc530678fa1265f0f2d9b91ca8f60f5c 100644 (file)
@@ -12,6 +12,7 @@ using Content.Server.Station.Systems;
 using Content.Server.Store.Components;
 using Content.Server.Store.Systems;
 using Content.Shared.Access.Components;
+using Content.Shared.CartridgeLoader;
 using Content.Shared.Light.Components;
 using Content.Shared.PDA;
 using Robust.Server.GameObjects;
@@ -67,6 +68,13 @@ namespace Content.Server.PDA
 
         protected override void OnItemRemoved(EntityUid uid, PdaComponent pda, EntRemovedFromContainerMessage args)
         {
+            if (args.Container.ID != pda.IdSlot.ID && args.Container.ID != pda.PenSlot.ID)
+                return;
+
+            // TODO: This is super cursed just use compstates please.
+            if (MetaData(uid).EntityLifeStage >= EntityLifeStage.Terminating)
+                return;
+
             base.OnItemRemoved(uid, pda, args);
             UpdatePdaUi(uid, pda);
         }
@@ -105,9 +113,12 @@ namespace Content.Server.PDA
         /// <summary>
         /// Send new UI state to clients, call if you modify something like uplink.
         /// </summary>
-        public void UpdatePdaUi(EntityUid uid, PdaComponent pda)
+        public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null)
         {
-            if (!_ui.TryGetUi(uid, PdaUiKey.Key, out _))
+            if (!Resolve(uid, ref pda, false))
+                return;
+
+            if (!_ui.TryGetUi(uid, PdaUiKey.Key, out var ui))
                 return;
 
             var address = GetDeviceNetAddress(uid);
@@ -119,8 +130,15 @@ namespace Content.Server.PDA
             // TODO: Update the level and name of the station with each call to UpdatePdaUi is only needed for latejoin players.
             // TODO: If someone can implement changing the level and name of the station when changing the PDA grid, this can be removed.
 
+            // TODO don't make this depend on cartridge loader!?!?
+            if (!TryComp(uid, out CartridgeLoaderComponent? loader))
+                return;
+
+            var programs = _cartridgeLoader.GetAvailablePrograms(uid, loader);
             var id = CompOrNull<IdCardComponent>(pda.ContainedId);
             var state = new PdaUpdateState(
+                programs,
+                GetNetEntity(loader.ActiveProgram),
                 pda.FlashlightOn,
                 pda.PenSlot.HasItem,
                 new PdaIdInfoText
@@ -136,7 +154,7 @@ namespace Content.Server.PDA
                 hasInstrument,
                 address);
 
-            _cartridgeLoader?.UpdateUiState(uid, state);
+            _ui.SetUiState(ui, state);
         }
 
         private void OnUiMessage(EntityUid uid, PdaComponent pda, PdaRequestUpdateInterfaceMessage msg)
index b132fa761f10666eb6e8af1c64043dd30fbb451c..2145dae3266ed9d87e499fbd33acfd352d16e208 100644 (file)
@@ -164,7 +164,7 @@ namespace Content.Server.PDA.Ringer
         private void UpdateRingerUserInterface(EntityUid uid, RingerComponent ringer)
         {
             if (_ui.TryGetUi(uid, RingerUiKey.Key, out var bui))
-                UserInterfaceSystem.SetUiState(bui, new RingerUpdateState(HasComp<ActiveRingerComponent>(uid), ringer.Ringtone));
+                _ui.SetUiState(bui, new RingerUpdateState(HasComp<ActiveRingerComponent>(uid), ringer.Ringtone));
         }
 
         public bool ToggleRingerUI(EntityUid uid, IPlayerSession session)
index e3c4e4091b393f18dfbef5d8c90ebc5c912e3512..f38013e14d11db099de6ff66c41be1a4049f8f68 100644 (file)
@@ -213,7 +213,7 @@ namespace Content.Server.Paper
                 return;
 
             if (_uiSystem.TryGetUi(uid, PaperUiKey.Key, out var bui))
-                UserInterfaceSystem.SetUiState(bui, new PaperBoundUserInterfaceState(paperComp.Content, paperComp.StampedBy, paperComp.Mode), session);
+                _uiSystem.SetUiState(bui, new PaperBoundUserInterfaceState(paperComp.Content, paperComp.StampedBy, paperComp.Mode), session);
         }
     }
 
index 489038af12782a772b76674e47ab841717138ab2..20ed27696706dcb283d9093002454fe7be1715ce 100644 (file)
@@ -233,7 +233,7 @@ public sealed partial class ParticleAcceleratorSystem
             receive = powerConsumer.ReceivedPower;
         }
 
-        UserInterfaceSystem.SetUiState(bui, new ParticleAcceleratorUIState(
+        _uiSystem.SetUiState(bui, new ParticleAcceleratorUIState(
             comp.Assembled,
             comp.Enabled,
             comp.SelectedStrength,
index 5d96b4c5bb238b4f667484efc2a7952a7924323a..9d1eb466fcfec4e0667cd05109a82bec93f91b2f 100644 (file)
@@ -65,6 +65,8 @@ namespace Content.Server.Pointing.EntitySystems
         private void SendMessage(EntityUid source, IEnumerable<ICommonSession> viewers, EntityUid pointed, string selfMessage,
             string viewerMessage, string? viewerPointedAtMessage = null)
         {
+            var netSource = GetNetEntity(source);
+
             foreach (var viewer in viewers)
             {
                 if (viewer.AttachedEntity is not {Valid: true} viewerEntity)
@@ -78,10 +80,10 @@ namespace Content.Server.Pointing.EntitySystems
                         ? viewerPointedAtMessage
                         : viewerMessage;
 
-                RaiseNetworkEvent(new PopupEntityEvent(message, PopupType.Small, source), viewerEntity);
+                RaiseNetworkEvent(new PopupEntityEvent(message, PopupType.Small, netSource), viewerEntity);
             }
 
-            _replay.RecordServerMessage(new PopupEntityEvent(viewerMessage, PopupType.Small, source));
+            _replay.RecordServerMessage(new PopupEntityEvent(viewerMessage, PopupType.Small, netSource));
         }
 
         public bool InRange(EntityUid pointer, EntityCoordinates coordinates)
@@ -100,13 +102,13 @@ namespace Content.Server.Pointing.EntitySystems
         {
             if (session?.AttachedEntity is not { } player)
             {
-                Logger.Warning($"Player {session} attempted to point without any attached entity");
+                Log.Warning($"Player {session} attempted to point without any attached entity");
                 return false;
             }
 
             if (!coords.IsValid(EntityManager))
             {
-                Logger.Warning($"Player {ToPrettyString(player)} attempted to point at invalid coordinates: {coords}");
+                Log.Warning($"Player {ToPrettyString(player)} attempted to point at invalid coordinates: {coords}");
                 return false;
             }
 
@@ -247,10 +249,12 @@ namespace Content.Server.Pointing.EntitySystems
 
         private void OnPointAttempt(PointingAttemptEvent ev, EntitySessionEventArgs args)
         {
-            if (TryComp(ev.Target, out TransformComponent? xform))
-                TryPoint(args.SenderSession, xform.Coordinates, ev.Target);
+            var target = GetEntity(ev.Target);
+
+            if (TryComp(target, out TransformComponent? xform))
+                TryPoint(args.SenderSession, xform.Coordinates, target);
             else
-                Logger.Warning($"User {args.SenderSession} attempted to point at a non-existent entity uid: {ev.Target}");
+                Log.Warning($"User {args.SenderSession} attempted to point at a non-existent entity uid: {ev.Target}");
         }
 
         public override void Shutdown()
index 9c4b0ae082a5ed5d5176120381b912a225f20259..407d2c49aa4df563ff257397655215a80677b8d7 100644 (file)
@@ -31,37 +31,37 @@ namespace Content.Server.Popups
 
         public override void PopupCoordinates(string message, EntityCoordinates coordinates, Filter filter, bool replayRecord, PopupType type = PopupType.Small)
         {
-            RaiseNetworkEvent(new PopupCoordinatesEvent(message, type, coordinates), filter, replayRecord);
+            RaiseNetworkEvent(new PopupCoordinatesEvent(message, type, GetNetCoordinates(coordinates)), filter, replayRecord);
         }
 
         public override void PopupCoordinates(string message, EntityCoordinates coordinates, PopupType type = PopupType.Small)
         {
             var mapPos = coordinates.ToMap(EntityManager);
             var filter = Filter.Empty().AddPlayersByPvs(mapPos, entManager: EntityManager, playerMan: _player, cfgMan: _cfg);
-            RaiseNetworkEvent(new PopupCoordinatesEvent(message, type, coordinates), filter);
+            RaiseNetworkEvent(new PopupCoordinatesEvent(message, type, GetNetCoordinates(coordinates)), filter);
         }
 
         public override void PopupCoordinates(string message, EntityCoordinates coordinates, ICommonSession recipient, PopupType type = PopupType.Small)
         {
-            RaiseNetworkEvent(new PopupCoordinatesEvent(message, type, coordinates), recipient);
+            RaiseNetworkEvent(new PopupCoordinatesEvent(message, type, GetNetCoordinates(coordinates)), recipient);
         }
 
         public override void PopupCoordinates(string message, EntityCoordinates coordinates, EntityUid recipient, PopupType type = PopupType.Small)
         {
             if (TryComp(recipient, out ActorComponent? actor))
-                RaiseNetworkEvent(new PopupCoordinatesEvent(message, type, coordinates), actor.PlayerSession);
+                RaiseNetworkEvent(new PopupCoordinatesEvent(message, type, GetNetCoordinates(coordinates)), actor.PlayerSession);
         }
 
         public override void PopupEntity(string message, EntityUid uid, PopupType type = PopupType.Small)
         {
             var filter = Filter.Empty().AddPlayersByPvs(uid, entityManager:EntityManager, playerMan: _player, cfgMan: _cfg);
-            RaiseNetworkEvent(new PopupEntityEvent(message, type, uid), filter);
+            RaiseNetworkEvent(new PopupEntityEvent(message, type, GetNetEntity(uid)), filter);
         }
 
         public override void PopupEntity(string message, EntityUid uid, EntityUid recipient, PopupType type=PopupType.Small)
         {
             if (TryComp(recipient, out ActorComponent? actor))
-                RaiseNetworkEvent(new PopupEntityEvent(message, type, uid), actor.PlayerSession);
+                RaiseNetworkEvent(new PopupEntityEvent(message, type, GetNetEntity(uid)), actor.PlayerSession);
         }
 
         public override void PopupClient(string message, EntityUid uid, EntityUid recipient, PopupType type = PopupType.Small)
@@ -72,12 +72,12 @@ namespace Content.Server.Popups
 
         public override void PopupEntity(string message, EntityUid uid, ICommonSession recipient, PopupType type = PopupType.Small)
         {
-            RaiseNetworkEvent(new PopupEntityEvent(message, type, uid), recipient);
+            RaiseNetworkEvent(new PopupEntityEvent(message, type, GetNetEntity(uid)), recipient);
         }
 
         public override void PopupEntity(string message, EntityUid uid, Filter filter, bool recordReplay, PopupType type = PopupType.Small)
         {
-            RaiseNetworkEvent(new PopupEntityEvent(message, type, uid), filter, recordReplay);
+            RaiseNetworkEvent(new PopupEntityEvent(message, type, GetNetEntity(uid)), filter, recordReplay);
         }
     }
 }
index 07e1a62eedb43a16a95d366fbaa3af315481b449..6bf4e69334b9606cd29418e5466c7436a4656ae1 100644 (file)
@@ -100,7 +100,7 @@ internal sealed class PowerMonitoringConsoleSystem : EntitySystem
 
         // Actually set state.
         if (_userInterfaceSystem.TryGetUi(target, PowerMonitoringConsoleUiKey.Key, out var bui))
-            UserInterfaceSystem.SetUiState(bui, new PowerMonitoringConsoleBoundInterfaceState(totalSources, totalLoads, sources.ToArray(), loads.ToArray()));
+            _userInterfaceSystem.SetUiState(bui, new PowerMonitoringConsoleBoundInterfaceState(totalSources, totalLoads, sources.ToArray(), loads.ToArray()));
     }
 
     private int CompareLoadOrSources(PowerMonitoringConsoleEntry x, PowerMonitoringConsoleEntry y)
index d2ac6973fd771fa0708bfb7914ead9e5afd375b1..416f509978a1087d0d0ec0bcac75134e5c24cd46 100644 (file)
@@ -72,7 +72,7 @@ public sealed class PortableGeneratorSystem : SharedPortableGeneratorSystem
         if (fuelGenerator.On || !Transform(uid).Anchored)
             return;
 
-        _doAfter.TryStartDoAfter(new DoAfterArgs(user, component.StartTime, new GeneratorStartedEvent(), uid, uid)
+        _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.StartTime, new GeneratorStartedEvent(), uid, uid)
         {
             BreakOnDamage = true, BreakOnTargetMove = true, BreakOnUserMove = true, RequireCanInteract = true,
             NeedHand = true
index 5fd39ceb67ebb880b17f28117519fd545825c75a..775ca412d3e98448f9e6ad641ef57f897a99f65d 100644 (file)
@@ -8,6 +8,8 @@ namespace Content.Server.Power
     [AdminCommand(AdminFlags.Debug)]
     public sealed class SetBatteryPercentCommand : IConsoleCommand
     {
+        [Dependency] private readonly IEntityManager _entManager = default!;
+
         public string Command => "setbatterypercent";
         public string Description => "Drains or recharges a battery by entity uid and percentage, i.e.: forall with Battery do setbatterypercent $ID 0";
         public string Help => $"{Command} <id> <percent>";
@@ -20,7 +22,7 @@ namespace Content.Server.Power
                 return;
             }
 
-            if (!EntityUid.TryParse(args[0], out var id))
+            if (!NetEntity.TryParse(args[0], out var netEnt) || !_entManager.TryGetEntity(netEnt, out var id))
             {
                 shell.WriteLine($"{args[0]} is not a valid entity id.");
                 return;
@@ -32,9 +34,7 @@ namespace Content.Server.Power
                 return;
             }
 
-            var entityManager = IoCManager.Resolve<IEntityManager>();
-
-            if (!entityManager.TryGetComponent<BatteryComponent>(id, out var battery))
+            if (!_entManager.TryGetComponent<BatteryComponent>(id, out var battery))
             {
                 shell.WriteLine($"No battery found with id {id}.");
                 return;
index 41c7a04dc22b5fb06799ad3f3ba4d251874b3c13..61d67a469b520e86e12cefd2115a267401db27c6 100644 (file)
@@ -78,7 +78,7 @@ public sealed class ProjectileSystem : SharedProjectileSystem
 
         if (component.ImpactEffect != null && TryComp<TransformComponent>(uid, out var xform))
         {
-            RaiseNetworkEvent(new ImpactEffectEvent(component.ImpactEffect, xform.Coordinates), Filter.Pvs(xform.Coordinates, entityMan: EntityManager));
+            RaiseNetworkEvent(new ImpactEffectEvent(component.ImpactEffect, GetNetCoordinates(xform.Coordinates)), Filter.Pvs(xform.Coordinates, entityMan: EntityManager));
         }
     }
 }
index fdbb6e353ccd0f97e86cef382f1ea675c45fa806..050b1698192cb5f4f4400581c5d0fe9a94ca03d1 100644 (file)
@@ -93,7 +93,7 @@ public sealed class GeigerSystem : SharedGeigerSystem
             CurrentRadiation = component.CurrentRadiation,
             DangerLevel = component.DangerLevel,
             IsEnabled = component.IsEnabled,
-            User = component.User
+            User = GetNetEntity(component.User)
         };
     }
 
index bd422663f2ed989cbc7cbde47b6d03a217a92aa6..97f2e485ca3cfbb3e7da6c29a99dc4a0e9c606af 100644 (file)
@@ -56,18 +56,14 @@ public partial class RadiationSystem
         if (_debugSessions.Count == 0)
             return;
 
-        var query = GetEntityQuery<RadiationGridResistanceComponent>();
-        var dict = new Dictionary<EntityUid, Dictionary<Vector2i, float>>();
+        var dict = new Dictionary<NetEntity, Dictionary<Vector2i, float>>();
 
-        var gridQuery = AllEntityQuery<MapGridComponent>();
+        var gridQuery = AllEntityQuery<MapGridComponent, RadiationGridResistanceComponent>();
 
-        while (gridQuery.MoveNext(out var gridUid, out var grid))
+        while (gridQuery.MoveNext(out var gridUid, out _, out var resistance))
         {
-            if (!query.TryGetComponent(gridUid, out var resistance))
-                continue;
-
             var resMap = resistance.ResistancePerTile;
-            dict.Add(gridUid, resMap);
+            dict.Add(GetNetEntity(gridUid), resMap);
         }
 
         var ev = new OnRadiationOverlayResistanceUpdateEvent(dict);
index 8edb6c145565fc84bc467a1848dc20a824cb3261..719b3fc1ca0c0d354705c282a4de4228d107d448 100644 (file)
@@ -122,7 +122,7 @@ public partial class RadiationSystem
         // create a new radiation ray from source to destination
         // at first we assume that it doesn't hit any radiation blockers
         // and has only distance penalty
-        var ray = new RadiationRay(mapId, sourceUid, sourceWorld, destUid, destWorld, rads);
+        var ray = new RadiationRay(mapId, GetNetEntity(sourceUid), sourceWorld, GetNetEntity(destUid), destWorld, rads);
 
         // if source and destination on the same grid it's possible that
         // between them can be another grid (ie. shuttle in center of donut station)
@@ -214,7 +214,7 @@ public partial class RadiationSystem
 
         // save data for debug if needed
         if (saveVisitedTiles && blockers.Count > 0)
-            ray.Blockers.Add(gridUid, blockers);
+            ray.Blockers.Add(GetNetEntity(gridUid), blockers);
 
         return ray;
     }
index 86c05b478b161a3aa9237c89fd359ae15bc5a8c1..c4f66a0cd9c23249623c7f1a76b013f12d3e1be8 100644 (file)
@@ -87,7 +87,7 @@ public sealed class RadioSystem : EntitySystem
             ChatChannel.Radio,
             message,
             wrappedMessage,
-            EntityUid.Invalid);
+            NetEntity.Invalid);
         var chatMsg = new MsgChatMessage { Message = chat };
         var ev = new RadioReceiveEvent(message, messageSource, channel, chatMsg);
 
index 77a837587a943f7f5ba3f4873bce4afe0c9a0f42..64f3baf9c7c233d86deaa19734ab8cecd8e80d20 100644 (file)
@@ -69,7 +69,7 @@ public sealed class EscapeInventorySystem : EntitySystem
         if (component.IsEscaping)
             return;
 
-        var doAfterEventArgs = new DoAfterArgs(user, component.BaseResistTime * multiplier, new EscapeInventoryEvent(), user, target: container)
+        var doAfterEventArgs = new DoAfterArgs(EntityManager, user, component.BaseResistTime * multiplier, new EscapeInventoryEvent(), user, target: container)
         {
             BreakOnTargetMove = false,
             BreakOnUserMove = true,
index 58b898ac960f25edaabb348f30f33e3adf8bae61..7a17a2eba1994c9870765ee10e4b27509e53de6f 100644 (file)
@@ -45,7 +45,7 @@ public sealed class ResistLockerSystem : EntitySystem
         if (!Resolve(target, ref storageComponent, ref resistLockerComponent))
             return;
 
-        var doAfterEventArgs = new DoAfterArgs(user, resistLockerComponent.ResistTime, new ResistLockerDoAfterEvent(), target, target: target)
+        var doAfterEventArgs = new DoAfterArgs(EntityManager, user, resistLockerComponent.ResistTime, new ResistLockerDoAfterEvent(), target, target: target)
         {
             BreakOnTargetMove = false,
             BreakOnUserMove = true,
index a9f32f66152b80215362cf67c0c70b8876af06aa..b3caced0daf72c1a589db55d16462f1d9e7b06a9 100644 (file)
@@ -82,7 +82,7 @@ public sealed partial class RevenantSystem
 
     private void BeginSoulSearchDoAfter(EntityUid uid, EntityUid target, RevenantComponent revenant)
     {
-        var searchDoAfter = new DoAfterArgs(uid, revenant.SoulSearchDuration, new SoulEvent(), uid, target: target)
+        var searchDoAfter = new DoAfterArgs(EntityManager, uid, revenant.SoulSearchDuration, new SoulEvent(), uid, target: target)
         {
             BreakOnUserMove = true,
             BreakOnDamage = true,
@@ -136,7 +136,7 @@ public sealed partial class RevenantSystem
             return;
         }
 
-        var doAfter = new DoAfterArgs(uid, revenant.HarvestDebuffs.X, new HarvestEvent(), uid, target: target)
+        var doAfter = new DoAfterArgs(EntityManager, uid, revenant.HarvestDebuffs.X, new HarvestEvent(), uid, target: target)
         {
             DistanceThreshold = 2,
             BreakOnUserMove = true,
index fab0709fd9b940f1d98fa221b04ea40c46bef3f3..23145cc1a8e03319a877d04cfc61d46215d96c56 100644 (file)
@@ -55,6 +55,7 @@ public sealed class FultonSystem : SharedFultonSystem
             !_container.IsEntityOrParentInContainer(component.Beacon.Value, xform: beaconXform))
         {
             var xform = Transform(uid);
+            var metadata = MetaData(uid);
             var oldCoords = xform.Coordinates;
             var offset = _random.NextVector2(1.5f);
             var localPos = TransformSystem.GetInvWorldMatrix(beaconXform.ParentUid)
@@ -64,8 +65,8 @@ public sealed class FultonSystem : SharedFultonSystem
 
             RaiseNetworkEvent(new FultonAnimationMessage()
             {
-                Entity = uid,
-                Coordinates = oldCoords,
+                Entity = GetNetEntity(uid, metadata),
+                Coordinates = GetNetCoordinates(oldCoords, metadata),
             });
         }
 
index e08e9fed6cc90aaf197aff638b2b46d5d4171761..a09badcd59599f4c13d20c6e92c7d32a21cb419e 100644 (file)
@@ -36,7 +36,7 @@ public sealed partial class SensorMonitoringConsoleSystem
             else
             {
                 fullState ??= CalculateFullState();
-                UserInterfaceSystem.SetUiState(ui, fullState, session);
+                _userInterface.SetUiState(ui, fullState, session);
                 comp.InitialUIStateSent.Add(session);
             }
         }
index 011e225c282b8c1dbb7146d6e912123bd6182515..c100d3d4a5f97548096d7f1e21f4e56c531fe761 100644 (file)
@@ -45,7 +45,7 @@ public sealed partial class SericultureSystem : EntitySystem
             return;
         }
 
-        var doAfter = new DoAfterArgs(uid, comp.ProductionLength, new SericultureDoAfterEvent(), uid)
+        var doAfter = new DoAfterArgs(EntityManager, uid, comp.ProductionLength, new SericultureDoAfterEvent(), uid)
         {
             BreakOnUserMove = true,
             BlockDuplicate = true,
index 7a621c2b80c65b3186027bf4a67ae1ca5e7da62f..5f287e0397060f3e61debab394680d7b368d51eb 100644 (file)
@@ -22,13 +22,13 @@ public sealed class DockCommand : IConsoleCommand
             return;
         }
 
-        if (!EntityUid.TryParse(args[0], out var airlock1))
+        if (!NetEntity.TryParse(args[0], out var airlock1Net) || !_entManager.TryGetEntity(airlock1Net, out var airlock1))
         {
             shell.WriteError(Loc.GetString("cmd-dock-invalid", ("entity", args[0])));
             return;
         }
 
-        if (!EntityUid.TryParse(args[1], out var airlock2))
+        if (!NetEntity.TryParse(args[1], out var airlock2Net) || !_entManager.TryGetEntity(airlock2Net, out var airlock2))
         {
             shell.WriteError(Loc.GetString("cmd-dock-invalid", ("entity", args[1])));
             return;
@@ -47,7 +47,7 @@ public sealed class DockCommand : IConsoleCommand
         }
 
         var dockSystem = _entManager.System<DockingSystem>();
-        dockSystem.Dock(airlock1, dock1, airlock2, dock2);
+        dockSystem.Dock(airlock1.Value, dock1, airlock2.Value, dock2);
 
         if (dock1.DockedWith == airlock2)
         {
index 1a18cd2cb3267c34a03aca16b8d539e550905d88..439367a0805a56a4b3d95871bab01315a491cdc2 100644 (file)
@@ -65,7 +65,7 @@ public sealed partial class DockingSystem
             if ((worldPos - otherWorldPos).Length() < comp.Radius)
                 continue;
 
-            _sawmill.Debug($"Removed RecentlyDocked from {ToPrettyString(uid)} and {ToPrettyString(comp.LastDocked)}");
+            Log.Debug($"Removed RecentlyDocked from {ToPrettyString(uid)} and {ToPrettyString(comp.LastDocked)}");
             RemComp<RecentlyDockedComponent>(uid);
             RemComp<RecentlyDockedComponent>(comp.LastDocked);
         }
@@ -73,48 +73,52 @@ public sealed partial class DockingSystem
 
     private void OnRequestUndock(EntityUid uid, ShuttleConsoleComponent component, UndockRequestMessage args)
     {
-        _sawmill.Debug($"Received undock request for {ToPrettyString(args.DockEntity)}");
+        var dork = GetEntity(args.DockEntity);
+
+        Log.Debug($"Received undock request for {ToPrettyString(dork)}");
 
         // TODO: Validation
-        if (!TryComp<DockingComponent>(args.DockEntity, out var dock) ||
+        if (!TryComp<DockingComponent>(dork, out var dock) ||
             !dock.Docked ||
             HasComp<PreventPilotComponent>(Transform(uid).GridUid))
         {
             return;
         }
 
-        Undock(args.DockEntity, dock);
+        Undock(dork, dock);
     }
 
     private void OnRequestAutodock(EntityUid uid, ShuttleConsoleComponent component, AutodockRequestMessage args)
     {
-        _sawmill.Debug($"Received autodock request for {ToPrettyString(args.DockEntity)}");
+        var dork = GetEntity(args.DockEntity);
+        Log.Debug($"Received autodock request for {ToPrettyString(dork)}");
         var player = args.Session.AttachedEntity;
 
         if (player == null ||
-            !HasComp<DockingComponent>(args.DockEntity) ||
+            !HasComp<DockingComponent>(dork) ||
             HasComp<PreventPilotComponent>(Transform(uid).GridUid))
         {
             return;
         }
 
         // TODO: Validation
-        var comp = EnsureComp<AutoDockComponent>(args.DockEntity);
+        var comp = EnsureComp<AutoDockComponent>(dork);
         comp.Requesters.Add(player.Value);
     }
 
     private void OnRequestStopAutodock(EntityUid uid, ShuttleConsoleComponent component, StopAutodockRequestMessage args)
     {
-        _sawmill.Debug($"Received stop autodock request for {ToPrettyString(args.DockEntity)}");
+        var dork = GetEntity(args.DockEntity);
+        Log.Debug($"Received stop autodock request for {ToPrettyString(dork)}");
 
         var player = args.Session.AttachedEntity;
 
         // TODO: Validation
-        if (player == null || !TryComp<AutoDockComponent>(args.DockEntity, out var comp)) return;
+        if (player == null || !TryComp<AutoDockComponent>(dork, out var comp)) return;
 
         comp.Requesters.Remove(player.Value);
 
         if (comp.Requesters.Count == 0)
-            RemComp<AutoDockComponent>(args.DockEntity);
+            RemComp<AutoDockComponent>(dork);
     }
 }
index 16b62378834591d00eb7ab5a4cc52049576c9c12..a00a9e0f585cb67e1269d0529a4b1d752b31e10e 100644 (file)
@@ -28,7 +28,6 @@ namespace Content.Server.Shuttles.Systems
         [Dependency] private readonly SharedPhysicsSystem _physics = default!;
         [Dependency] private readonly SharedTransformSystem _transform = default!;
 
-        private ISawmill _sawmill = default!;
         private const string DockingFixture = "docking";
         private const string DockingJoint = "docking";
         private const float DockingRadius = 0.20f;
@@ -36,7 +35,6 @@ namespace Content.Server.Shuttles.Systems
         public override void Initialize()
         {
             base.Initialize();
-            _sawmill = Logger.GetSawmill("docking");
             SubscribeLocalEvent<DockingComponent, ComponentStartup>(OnStartup);
             SubscribeLocalEvent<DockingComponent, ComponentShutdown>(OnShutdown);
             SubscribeLocalEvent<DockingComponent, AnchorStateChangedEvent>(OnAnchorChange);
@@ -114,7 +112,7 @@ namespace Content.Server.Shuttles.Systems
                     if (otherDockingFixture == null)
                     {
                         DebugTools.Assert(false);
-                        _sawmill.Error($"Found null docking fixture on {ent}");
+                        Log.Error($"Found null docking fixture on {ent}");
                         continue;
                     }
 
@@ -159,7 +157,7 @@ namespace Content.Server.Shuttles.Systems
                 !TryComp(dockBUid, out DockingComponent? dockB))
             {
                 DebugTools.Assert(false);
-                _sawmill.Error($"Tried to cleanup {dockAUid} but not docked?");
+                Log.Error($"Tried to cleanup {dockAUid} but not docked?");
 
                 dockA.DockedWith = null;
                 if (dockA.DockJoint != null)
@@ -288,7 +286,7 @@ namespace Content.Server.Shuttles.Systems
                 (dockAUid, dockBUid) = (dockBUid, dockAUid);
             }
 
-            _sawmill.Debug($"Docking between {dockAUid} and {dockBUid}");
+            Log.Debug($"Docking between {dockAUid} and {dockBUid}");
 
             // https://gamedev.stackexchange.com/questions/98772/b2distancejoint-with-frequency-equal-to-0-vs-b2weldjoint
 
index d0d8b9ff7b6daf11c818ecc8ab3530e8620594d5..0603ff75022fe81be8c7ceb00d02376bf8907b79 100644 (file)
@@ -340,7 +340,7 @@ public sealed partial class EmergencyShuttleSystem
         }
 
         if (_uiSystem.TryGetUi(uid, EmergencyConsoleUiKey.Key, out var bui))
-            UserInterfaceSystem.SetUiState(
+            _uiSystem.SetUiState(
                 bui,
                 new EmergencyConsoleBoundUserInterfaceState()
                 {
index a6bdc043a9430b9f8c8c8df3f5531cf82f30c052..1a1debc9e3bd3c914ffe134c07bd9ef7ddf459f0 100644 (file)
@@ -165,7 +165,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
 
         RaiseNetworkEvent(new EmergencyShuttlePositionMessage()
         {
-            StationUid = targetGrid,
+            StationUid = GetNetEntity(targetGrid),
             Position = config.Area,
         });
     }
index a52c40cb2c911c0500a0f52f6b3e7321009f95ee..a8d380541b7c56622c912b70af877efb65d8ee79 100644 (file)
@@ -45,9 +45,9 @@ public sealed class RadarConsoleSystem : SharedRadarConsoleSystem
         }
 
         if (_uiSystem.TryGetUi(uid, RadarConsoleUiKey.Key, out var bui))
-            UserInterfaceSystem.SetUiState(bui, new RadarConsoleBoundInterfaceState(
+            _uiSystem.SetUiState(bui, new RadarConsoleBoundInterfaceState(
                 component.MaxRange,
-                coordinates,
+                GetNetCoordinates(coordinates),
                 angle,
                 new List<DockingInterfaceState>()
             ));
index fd814530ae7aa06aa76f82054d315f468563202b..04b53a505ad5b4f4509eff377e1cb91f1c8b5562 100644 (file)
@@ -74,7 +74,9 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
     private void OnDestinationMessage(EntityUid uid, ShuttleConsoleComponent component,
         ShuttleConsoleFTLRequestMessage args)
     {
-        if (!TryComp<FTLDestinationComponent>(args.Destination, out var dest))
+        var destination = GetEntity(args.Destination);
+
+        if (!TryComp<FTLDestinationComponent>(destination, out var dest))
         {
             return;
         }
@@ -118,14 +120,14 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
             return;
         }
 
-        var dock = HasComp<MapComponent>(args.Destination) && HasComp<MapGridComponent>(args.Destination);
+        var dock = HasComp<MapComponent>(destination) && HasComp<MapGridComponent>(destination);
         var tagEv = new FTLTagEvent();
         RaiseLocalEvent(xform.GridUid.Value, ref tagEv);
 
         var ev = new ShuttleConsoleFTLTravelStartEvent(uid);
         RaiseLocalEvent(ref ev);
 
-        _shuttle.FTLTravel(xform.GridUid.Value, shuttle, args.Destination, dock: dock, priorityTag: tagEv.Tag);
+        _shuttle.FTLTravel(xform.GridUid.Value, shuttle, destination, dock: dock, priorityTag: tagEv.Tag);
     }
 
     private void OnDock(DockEvent ev)
@@ -225,7 +227,7 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
 
     private void OnGetState(EntityUid uid, PilotComponent component, ref ComponentGetState args)
     {
-        args.State = new PilotComponentState(component.Console);
+        args.State = new PilotComponentState(GetNetEntity(component.Console));
     }
 
     /// <summary>
@@ -244,9 +246,9 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
 
             var state = new DockingInterfaceState()
             {
-                Coordinates = xform.Coordinates,
+                Coordinates = GetNetCoordinates(xform.Coordinates),
                 Angle = xform.LocalRotation,
-                Entity = uid,
+                Entity = GetNetEntity(uid),
                 Connected = comp.Docked,
                 Color = comp.RadarColor,
                 HighlightedColor = comp.HighlightedRadarColor,
@@ -275,7 +277,7 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
 
         var shuttleGridUid = consoleXform?.GridUid;
 
-        var destinations = new List<(EntityUid, string, bool)>();
+        var destinations = new List<(NetEntity, string, bool)>();
         var ftlState = FTLState.Available;
         var ftlTime = TimeSpan.Zero;
 
@@ -324,22 +326,24 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
                     canTravel = false;
                 }
 
-                destinations.Add((destUid, name, canTravel));
+                destinations.Add((GetNetEntity(destUid), name, canTravel));
             }
         }
 
         docks ??= GetAllDocks();
 
         if (_ui.TryGetUi(consoleUid, ShuttleConsoleUiKey.Key, out var bui))
-            UserInterfaceSystem.SetUiState(bui, new ShuttleConsoleBoundInterfaceState(
+        {
+            _ui.SetUiState(bui, new ShuttleConsoleBoundInterfaceState(
                 ftlState,
                 ftlTime,
                 destinations,
                 range,
-                consoleXform?.Coordinates,
+                GetNetCoordinates(consoleXform?.Coordinates),
                 consoleXform?.LocalRotation,
                 docks
             ));
+        }
     }
 
     public override void Update(float frameTime)
index aefe91b07c21bae54595549dc5e5694f15b0b0cc..ad2622af5091d4c1a5f4a90f89a6183a64d6d484 100644 (file)
@@ -84,13 +84,15 @@ public sealed partial class BorgSystem
         if (args.Session.AttachedEntity is not { } attachedEntity)
             return;
 
-        if (!component.ModuleContainer.Contains(args.Module))
+        var module = GetEntity(args.Module);
+
+        if (!component.ModuleContainer.Contains(module))
             return;
 
         _adminLog.Add(LogType.Action, LogImpact.Medium,
-            $"{ToPrettyString(attachedEntity):player} removed module {ToPrettyString(args.Module)} from borg {ToPrettyString(uid)}");
-        component.ModuleContainer.Remove(args.Module);
-        _hands.TryPickupAnyHand(attachedEntity, args.Module);
+            $"{ToPrettyString(attachedEntity):player} removed module {ToPrettyString(module)} from borg {ToPrettyString(uid)}");
+        component.ModuleContainer.Remove(module);
+        _hands.TryPickupAnyHand(attachedEntity, module);
 
         UpdateUI(uid, component);
     }
index 69d1fd7c3412f928e82c363b8986292babdc67c8..fd9eb3e8c62aa30b5a4dfa875a97e66ca1934312 100644 (file)
@@ -120,7 +120,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
     /// <summary>
     /// Makes an event horizon consume a given entity.
     /// </summary>
-    public void ConsumeEntity(EntityUid hungry, EntityUid morsel, EventHorizonComponent eventHorizon, IContainer? outerContainer = null)
+    public void ConsumeEntity(EntityUid hungry, EntityUid morsel, EventHorizonComponent eventHorizon, BaseContainer? outerContainer = null)
     {
         if (!EntityManager.IsQueuedForDeletion(morsel) // I saw it log twice a few times for some reason?
         && (HasComp<MindContainerComponent>(morsel)
@@ -140,7 +140,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
     /// <summary>
     /// Makes an event horizon attempt to consume a given entity.
     /// </summary>
-    public bool AttemptConsumeEntity(EntityUid hungry, EntityUid morsel, EventHorizonComponent eventHorizon, IContainer? outerContainer = null)
+    public bool AttemptConsumeEntity(EntityUid hungry, EntityUid morsel, EventHorizonComponent eventHorizon, BaseContainer? outerContainer = null)
     {
         if (!CanConsumeEntity(hungry, morsel, eventHorizon))
             return false;
@@ -192,7 +192,7 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
     /// Excludes the event horizon itself.
     /// All immune entities within the container will be dumped to a given container or the map/grid if that is impossible.
     /// </summary>
-    public void ConsumeEntitiesInContainer(EntityUid hungry, IContainer container, EventHorizonComponent eventHorizon, IContainer? outerContainer = null)
+    public void ConsumeEntitiesInContainer(EntityUid hungry, BaseContainer container, EventHorizonComponent eventHorizon, BaseContainer? outerContainer = null)
     {
         // Removing the immune entities from the container needs to be deferred until after iteration or the iterator raises an error.
         List<EntityUid> immune = new();
index 84e8a8ff2b8a866d7081b64734c95cfeddc9721c..ce5184c7174ca83a71317ba8ea0886d5c3b325c6 100644 (file)
@@ -8,7 +8,7 @@ namespace Content.Server.Singularity.Events;
 /// </summary>
 [ByRefEvent]
 public readonly record struct EntityConsumedByEventHorizonEvent
-(EntityUid entity, EntityUid eventHorizonUid, EventHorizonComponent eventHorizon, IContainer? container)
+(EntityUid entity, EntityUid eventHorizonUid, EventHorizonComponent eventHorizon, BaseContainer? container)
 {
     /// <summary>
     /// The entity being consumed by the event horizon.
@@ -29,5 +29,5 @@ public readonly record struct EntityConsumedByEventHorizonEvent
     /// The innermost container of the entity being consumed by the event horizon that is not also in the process of being consumed by the event horizon.
     /// Used to correctly dump out the contents containers that are consumed by the event horizon.
     /// </summary>
-    public readonly IContainer? Container = container;
+    public readonly BaseContainer? Container = container;
 }
index 19342195177acd6ecf67b039e6aab79d4d70a5b0..d71b1da7e7bcde2c5978cf4ee5b52eee617f160f 100644 (file)
@@ -8,7 +8,7 @@ namespace Content.Server.Singularity.Events;
 /// </summary>
 [ByRefEvent]
 public readonly record struct EventHorizonConsumedEntityEvent
-(EntityUid entity, EntityUid eventHorizonUid, EventHorizonComponent eventHorizon, IContainer? container)
+(EntityUid entity, EntityUid eventHorizonUid, EventHorizonComponent eventHorizon, BaseContainer? container)
 {
     /// <summary>
     /// The entity being consumed by the event horizon.
@@ -29,5 +29,5 @@ public readonly record struct EventHorizonConsumedEntityEvent
     /// The innermost container of the entity being consumed by the event horizon that is not also in the process of being consumed by the event horizon.
     /// Used to correctly dump out the contents containers that are consumed by the event horizon.
     /// </summary>
-    public readonly IContainer? Container = container;
+    public readonly BaseContainer? Container = container;
 }
index 7fe6ecfb372a485d373d3c993309e1bd6da4c360..1b44b7b0ba0e11dc5b26c89308b542510879bac1 100644 (file)
@@ -108,7 +108,7 @@ public sealed class SprayPainterSystem : SharedSprayPainterSystem
             }
             component.IsSpraying = true;
 
-            var doAfterEventArgs = new DoAfterArgs(args.User, component.AirlockSprayTime, new SprayPainterDoAfterEvent(sprite, null), uid, target: target, used: uid)
+            var doAfterEventArgs = new DoAfterArgs(EntityManager, args.User, component.AirlockSprayTime, new SprayPainterDoAfterEvent(sprite, null), uid, target: target, used: uid)
             {
                 BreakOnTargetMove = true,
                 BreakOnUserMove = true,
@@ -129,7 +129,7 @@ public sealed class SprayPainterSystem : SharedSprayPainterSystem
             if(!component.ColorPalette.TryGetValue(component.PickedColor, out var color))
                 return;
 
-            var doAfterEventArgs = new DoAfterArgs(args.User, component.PipeSprayTime, new SprayPainterDoAfterEvent(null, color), uid, target, uid)
+            var doAfterEventArgs = new DoAfterArgs(EntityManager, args.User, component.PipeSprayTime, new SprayPainterDoAfterEvent(null, color), uid, target, uid)
             {
                 BreakOnTargetMove = true,
                 BreakOnUserMove = true,
index 3f52d6810bb5d80dd6d0a99e3790894e7fdd9cd6..2709bc2072b1ffbcc8464697340d6dabf6162fd7 100644 (file)
@@ -450,7 +450,7 @@ public sealed partial class StationJobsSystem : EntitySystem
 
     private bool _availableJobsDirty;
 
-    private TickerJobsAvailableEvent _cachedAvailableJobs = new (new Dictionary<EntityUid, string>(), new Dictionary<EntityUid, Dictionary<string, uint?>>());
+    private TickerJobsAvailableEvent _cachedAvailableJobs = new (new Dictionary<NetEntity, string>(), new Dictionary<NetEntity, Dictionary<string, uint?>>());
 
     /// <summary>
     /// Assembles an event from the current available-to-play jobs.
@@ -461,18 +461,19 @@ public sealed partial class StationJobsSystem : EntitySystem
     {
         // If late join is disallowed, return no available jobs.
         if (_gameTicker.DisallowLateJoin)
-            return new TickerJobsAvailableEvent(new Dictionary<EntityUid, string>(), new Dictionary<EntityUid, Dictionary<string, uint?>>());
+            return new TickerJobsAvailableEvent(new Dictionary<NetEntity, string>(), new Dictionary<NetEntity, Dictionary<string, uint?>>());
 
-        var jobs = new Dictionary<EntityUid, Dictionary<string, uint?>>();
-        var stationNames = new Dictionary<EntityUid, string>();
+        var jobs = new Dictionary<NetEntity, Dictionary<string, uint?>>();
+        var stationNames = new Dictionary<NetEntity, string>();
 
         var query = EntityQueryEnumerator<StationJobsComponent>();
 
         while (query.MoveNext(out var station, out var comp))
         {
+            var netStation = GetNetEntity(station);
             var list = comp.JobList.ToDictionary(x => x.Key, x => x.Value);
-            jobs.Add(station, list);
-            stationNames.Add(station, Name(station));
+            jobs.Add(netStation, list);
+            stationNames.Add(netStation, Name(station));
         }
         return new TickerJobsAvailableEvent(stationNames, jobs);
     }
index 182cbb5a481454c60890ed49aaa86111aa3986b9..8fdf103cd70648e2ed05c15268fea8791fe64c63 100644 (file)
@@ -85,7 +85,7 @@ public sealed class StationSystem : EntitySystem
     {
         if (e.NewStatus == SessionStatus.Connected)
         {
-            RaiseNetworkEvent(new StationsUpdatedEvent(GetStationsSet()), e.Session);
+            RaiseNetworkEvent(new StationsUpdatedEvent(GetNetEntitySet(GetStationsSet())), e.Session);
         }
     }
 
@@ -93,7 +93,7 @@ public sealed class StationSystem : EntitySystem
 
     private void OnStationAdd(EntityUid uid, StationDataComponent component, ComponentStartup args)
     {
-        RaiseNetworkEvent(new StationsUpdatedEvent(GetStationsSet()), Filter.Broadcast());
+        RaiseNetworkEvent(new StationsUpdatedEvent(GetNetEntitySet(GetStationsSet())), Filter.Broadcast());
 
         var metaData = MetaData(uid);
         RaiseLocalEvent(new StationInitializedEvent(uid));
@@ -108,7 +108,7 @@ public sealed class StationSystem : EntitySystem
             RemComp<StationMemberComponent>(grid);
         }
 
-        RaiseNetworkEvent(new StationsUpdatedEvent(GetStationsSet()), Filter.Broadcast());
+        RaiseNetworkEvent(new StationsUpdatedEvent(GetNetEntitySet(GetStationsSet())), Filter.Broadcast());
     }
 
     private void OnPreGameMapLoad(PreGameMapLoad ev)
index 076ab447833940c6d06b1e17f5fbce01ac2fd550..e5b7f7a260b4e830f737bb4d3d244faf5ea6c0c8 100644 (file)
@@ -5,6 +5,6 @@ namespace Content.Server.StationRecords;
 [RegisterComponent]
 public sealed partial class GeneralStationRecordConsoleComponent : Component
 {
-    public StationRecordKey? ActiveKey { get; set; }
+    public (NetEntity, uint)? ActiveKey { get; set; }
     public GeneralStationRecordsFilter? Filter { get; set; }
 }
index aab272e8141842d8433d49a033b060492125a546..4ea65522f4b9602cd5a1086324c2dc57248869a1 100644 (file)
@@ -9,5 +9,6 @@ public sealed partial class StationRecordsComponent : Component
     // Every single record in this station, by key.
     // Essentially a columnar database, but I really suck
     // at implementing that so
-    [ViewVariables] public readonly StationRecordSet Records = new();
+    [IncludeDataField]
+    public StationRecordSet Records = new();
 }
index bc0bc5a42706ea683297b4e88b1b04e50c4c7286..2f6b220a783215757dc14adb6d758505993bb635 100644 (file)
@@ -1,6 +1,7 @@
 using System.Diagnostics.CodeAnalysis;
 using System.Linq;
 using Content.Shared.StationRecords;
+using Robust.Shared.Utility;
 
 namespace Content.Server.StationRecords;
 
@@ -9,15 +10,20 @@ namespace Content.Server.StationRecords;
 ///     Keyed by StationRecordKey, which should be obtained from
 ///     an entity that stores a reference to it.
 /// </summary>
-public sealed class StationRecordSet
+[DataDefinition]
+public sealed partial class StationRecordSet
 {
+    [DataField("currentRecordId")]
     private uint _currentRecordId;
 
-    private HashSet<StationRecordKey> _keys = new();
+    // TODO add custom type serializer so that keys don't have to be written twice.
+    [DataField("keys")]
+    public HashSet<StationRecordKey> Keys = new();
 
+    [DataField("recentlyAccessed")]
     private HashSet<StationRecordKey> _recentlyAccessed = new();
 
-    [ViewVariables]
+    [DataField("tables")] // TODO ensure all of this data is serializable.
     private Dictionary<Type, Dictionary<StationRecordKey, object>> _tables = new();
 
     /// <summary>
@@ -46,16 +52,17 @@ public sealed class StationRecordSet
     }
 
     /// <summary>
-    ///     Add a new record into this set of entries.
+    ///     Add an entry into a record.
     /// </summary>
-    /// <param name="station">Station that we're adding the record for.</param>
-    /// <returns>A key that represents the record in this set.</returns>
-    public StationRecordKey AddRecord(EntityUid station)
+    /// <param name="entry">Entry to add.</param>
+    /// <typeparam name="T">Type of the entry that's being added.</typeparam>
+    public StationRecordKey AddRecordEntry<T>(EntityUid station, T entry)
     {
-        var key = new StationRecordKey(_currentRecordId++, station);
-
-        _keys.Add(key);
+        if (entry == null)
+            return StationRecordKey.Invalid;
 
+        var key = new StationRecordKey(_currentRecordId++, station);
+        AddRecordEntry(key, entry);
         return key;
     }
 
@@ -67,18 +74,11 @@ public sealed class StationRecordSet
     /// <typeparam name="T">Type of the entry that's being added.</typeparam>
     public void AddRecordEntry<T>(StationRecordKey key, T entry)
     {
-        if (!_keys.Contains(key) || entry == null)
-        {
+        if (entry == null)
             return;
-        }
-
-        if (!_tables.TryGetValue(typeof(T), out var table))
-        {
-            table = new();
-            _tables.Add(typeof(T), table);
-        }
 
-        table.Add(key, entry);
+        if (Keys.Add(key))
+            _tables.GetOrNew(typeof(T))[key] = entry;
     }
 
     /// <summary>
@@ -92,7 +92,7 @@ public sealed class StationRecordSet
     {
         entry = default;
 
-        if (!_keys.Contains(key)
+        if (!Keys.Contains(key)
             || !_tables.TryGetValue(typeof(T), out var table)
             || !table.TryGetValue(key, out var entryObject))
         {
@@ -113,7 +113,7 @@ public sealed class StationRecordSet
     /// <returns>True if the entry exists, false otherwise.</returns>
     public bool HasRecordEntry<T>(StationRecordKey key)
     {
-        return _keys.Contains(key)
+        return Keys.Contains(key)
                && _tables.TryGetValue(typeof(T), out var table)
                && table.ContainsKey(key);
     }
@@ -142,7 +142,7 @@ public sealed class StationRecordSet
     /// <returns>True if successful, false otherwise.</returns>
     public bool RemoveAllRecords(StationRecordKey key)
     {
-        if (!_keys.Remove(key))
+        if (!Keys.Remove(key))
         {
             return false;
         }
index 6f3a2a5fa127b51ce64fa764b9a0060429fbcb51..ea8eed84459017c293e9dc7441a0e547cfba0cd4 100644 (file)
@@ -63,7 +63,7 @@ public sealed class GeneralStationRecordConsoleSystem : EntitySystem
         var consoleRecords =
             _stationRecordsSystem.GetRecordsOfType<GeneralStationRecord>(owningStation.Value, stationRecordsComponent);
 
-        var listing = new Dictionary<StationRecordKey, string>();
+        var listing = new Dictionary<(NetEntity, uint), string>();
 
         foreach (var pair in consoleRecords)
         {
@@ -72,7 +72,7 @@ public sealed class GeneralStationRecordConsoleSystem : EntitySystem
                 continue;
             }
 
-            listing.Add(pair.Item1, pair.Item2.Name);
+            listing.Add(_stationRecordsSystem.Convert(pair.Item1), pair.Item2.Name);
         }
 
         if (listing.Count == 0)
@@ -89,7 +89,7 @@ public sealed class GeneralStationRecordConsoleSystem : EntitySystem
         GeneralStationRecord? record = null;
         if (console.ActiveKey != null)
         {
-            _stationRecordsSystem.TryGetRecord(owningStation.Value, console.ActiveKey.Value, out record,
+            _stationRecordsSystem.TryGetRecord(owningStation.Value, _stationRecordsSystem.Convert(console.ActiveKey.Value), out record,
                 stationRecordsComponent);
         }
 
index f98bc67c3388020a059f0ca5769ec7a492384066..c70e1d0d9a9f276d0875e725082c6faffff8f7a7 100644 (file)
@@ -1,11 +1,7 @@
 using System.Diagnostics.CodeAnalysis;
-using System.Linq;
 using Content.Server.GameTicking;
-using Content.Server.Station.Systems;
-using Content.Shared.Access.Components;
 using Content.Server.Forensics;
 using Content.Shared.Inventory;
-using Content.Shared.Nuke;
 using Content.Shared.PDA;
 using Content.Shared.Preferences;
 using Content.Shared.Roles;
@@ -34,7 +30,7 @@ namespace Content.Server.StationRecords.Systems;
 ///     depend on this general record being created. This is subject
 ///     to change.
 /// </summary>
-public sealed class StationRecordsSystem : EntitySystem
+public sealed class StationRecordsSystem : SharedStationRecordsSystem
 {
     [Dependency] private readonly InventorySystem _inventorySystem = default!;
     [Dependency] private readonly StationRecordKeyStorageSystem _keyStorageSystem = default!;
@@ -131,8 +127,9 @@ public sealed class StationRecordsSystem : EntitySystem
             DNA = dna
         };
 
-        var key = AddRecord(station, records);
-        AddRecordEntry(key, record, records);
+        var key = AddRecordEntry(station, record);
+        if (!key.IsValid())
+            return;
 
         if (idUid != null)
         {
@@ -148,7 +145,7 @@ public sealed class StationRecordsSystem : EntitySystem
             }
         }
 
-        RaiseLocalEvent(new AfterGeneralRecordCreatedEvent(key, record, profile));
+        RaiseLocalEvent(new AfterGeneralRecordCreatedEvent(station, key, record, profile));
     }
 
     /// <summary>
@@ -160,13 +157,10 @@ public sealed class StationRecordsSystem : EntitySystem
     /// <returns>True if the record was removed, false otherwise.</returns>
     public bool RemoveRecord(EntityUid station, StationRecordKey key, StationRecordsComponent? records = null)
     {
-        if (station != key.OriginStation || !Resolve(station, ref records))
-        {
+        if (!Resolve(station, ref records))
             return false;
-        }
-
-        RaiseLocalEvent(new RecordRemovedEvent(key));
 
+        RaiseLocalEvent(new RecordRemovedEvent(station, key));
         return records.Records.RemoveAllRecords(key);
     }
 
@@ -185,10 +179,8 @@ public sealed class StationRecordsSystem : EntitySystem
     {
         entry = default;
 
-        if (key.OriginStation != station || !Resolve(station, ref records))
-        {
+        if (!Resolve(station, ref records))
             return false;
-        }
 
         return records.Records.TryGetRecordEntry(key, out entry);
     }
@@ -210,43 +202,20 @@ public sealed class StationRecordsSystem : EntitySystem
         return records.Records.GetRecordsOfType<T>();
     }
 
-    /// <summary>
-    ///     Adds a record to a station's record set.
-    /// </summary>
-    /// <param name="station">The station to add a record to.</param>
-    /// <param name="records">Station records component.</param>
-    /// <returns>
-    ///     A station record key, which can be used to add and get records.
-    /// </returns>
-    /// <exception cref="ArgumentException">
-    ///     Occurs when the entity given does not have a station records component.
-    /// </exception>
-    public StationRecordKey AddRecord(EntityUid station, StationRecordsComponent? records)
-    {
-        if (!Resolve(station, ref records))
-        {
-            throw new ArgumentException($"Could not retrieve a {nameof(StationRecordsComponent)} from entity {station}");
-        }
-
-        return records.Records.AddRecord(station);
-    }
-
     /// <summary>
     ///     Adds a record entry to a station's record set.
     /// </summary>
-    /// <param name="key">The key to add the record to.</param>
+    /// <param name="station">The station to add the record to.</param>
     /// <param name="record">The record to add.</param>
     /// <param name="records">Station records component.</param>
     /// <typeparam name="T">The type of record to add.</typeparam>
-    public void AddRecordEntry<T>(StationRecordKey key, T record,
+    public StationRecordKey AddRecordEntry<T>(EntityUid station, T record,
         StationRecordsComponent? records = null)
     {
-        if (!Resolve(key.OriginStation, ref records))
-        {
-            return;
-        }
+        if (!Resolve(station, ref records))
+            return StationRecordKey.Invalid;
 
-        records.Records.AddRecordEntry(key, record);
+        return records.Records.AddRecordEntry(station, record);
     }
 
     /// <summary>
@@ -263,7 +232,7 @@ public sealed class StationRecordsSystem : EntitySystem
 
         foreach (var key in records.Records.GetRecentlyAccessed())
         {
-            RaiseLocalEvent(new RecordModifiedEvent(key));
+            RaiseLocalEvent(new RecordModifiedEvent(station, key));
         }
 
         records.Records.ClearRecentlyAccessed();
@@ -278,6 +247,7 @@ public sealed class StationRecordsSystem : EntitySystem
 /// </summary>
 public sealed class AfterGeneralRecordCreatedEvent : EntityEventArgs
 {
+    public readonly EntityUid Station;
     public StationRecordKey Key { get; }
     public GeneralStationRecord Record { get; }
     /// <summary>
@@ -287,8 +257,10 @@ public sealed class AfterGeneralRecordCreatedEvent : EntityEventArgs
     /// </summary>
     public HumanoidCharacterProfile? Profile { get; }
 
-    public AfterGeneralRecordCreatedEvent(StationRecordKey key, GeneralStationRecord record, HumanoidCharacterProfile? profile)
+    public AfterGeneralRecordCreatedEvent(EntityUid station, StationRecordKey key, GeneralStationRecord record,
+        HumanoidCharacterProfile? profile)
     {
+        Station = station;
         Key = key;
         Record = record;
         Profile = profile;
@@ -303,10 +275,12 @@ public sealed class AfterGeneralRecordCreatedEvent : EntityEventArgs
 /// </summary>
 public sealed class RecordRemovedEvent : EntityEventArgs
 {
+    public readonly EntityUid Station;
     public StationRecordKey Key { get; }
 
-    public RecordRemovedEvent(StationRecordKey key)
+    public RecordRemovedEvent(EntityUid station, StationRecordKey key)
     {
+        Station = station;
         Key = key;
     }
 }
@@ -318,10 +292,12 @@ public sealed class RecordRemovedEvent : EntityEventArgs
 /// </summary>
 public sealed class RecordModifiedEvent : EntityEventArgs
 {
+    public readonly EntityUid Station;
     public StationRecordKey Key { get; }
 
-    public RecordModifiedEvent(StationRecordKey key)
+    public RecordModifiedEvent(EntityUid station, StationRecordKey key)
     {
+        Station = station;
         Key = key;
     }
 }
index 8d89d20615524ff1d7a4bae5de296a715e6852cd..330b878c05a8364f759d339a1dca2217d9ab1803 100644 (file)
@@ -86,7 +86,7 @@ public sealed class StickySystem : EntitySystem
             component.Stick = true;
 
             // start sticking object to target
-            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(user, delay, new StickyDoAfterEvent(), uid, target: target, used: uid)
+            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, user, delay, new StickyDoAfterEvent(), uid, target: target, used: uid)
             {
                 BreakOnTargetMove = true,
                 BreakOnUserMove = true,
@@ -133,7 +133,7 @@ public sealed class StickySystem : EntitySystem
             component.Stick = false;
 
             // start unsticking object
-            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(user, delay, new StickyDoAfterEvent(), uid, target: uid)
+            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, user, delay, new StickyDoAfterEvent(), uid, target: uid)
             {
                 BreakOnTargetMove = true,
                 BreakOnUserMove = true,
index cd832f8f312f765083a3b7990fe1db01607fdfb7..805eabb3573c23402e32859dd5cfef805fe192f7 100644 (file)
@@ -284,7 +284,7 @@ public sealed class BluespaceLockerSystem : EntitySystem
         {
             EnsureComp<DoAfterComponent>(uid);
 
-            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(uid, component.BehaviorProperties.Delay, new BluespaceLockerDoAfterEvent(), uid));
+            _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, uid, component.BehaviorProperties.Delay, new BluespaceLockerDoAfterEvent(), uid));
             return;
         }
 
index 530aa726eb152e185e56e9c8c2a2c315bcfd12b6..99ed0e17d95bf9eac60eec0592322cda84524bc5 100644 (file)
@@ -151,7 +151,7 @@ namespace Content.Server.Storage.EntitySystems
                 UtilityVerb verb = new()
                 {
                     Text = Loc.GetString("storage-component-transfer-verb"),
-                    IconEntity = args.Using,
+                    IconEntity = GetNetEntity(args.Using),
                     Act = () => TransferEntities(uid, args.Target, component, lockComponent, targetStorage, targetLock)
                 };
 
@@ -218,7 +218,7 @@ namespace Content.Server.Storage.EntitySystems
             // The last half of the if is because carpets exist and this is terrible
             if (storageComp.AreaInsert && (args.Target == null || !HasComp<ItemComponent>(args.Target.Value)))
             {
-                var validStorables = new List<EntityUid>();
+                var validStorables = new List<NetEntity>();
                 var itemQuery = GetEntityQuery<ItemComponent>();
 
                 foreach (var entity in _entityLookupSystem.GetEntitiesInRange(args.ClickLocation, storageComp.AreaInsertRadius, LookupFlags.Dynamic | LookupFlags.Sundries))
@@ -231,13 +231,13 @@ namespace Content.Server.Storage.EntitySystems
                         continue;
                     }
 
-                    validStorables.Add(entity);
+                    validStorables.Add(GetNetEntity(entity));
                 }
 
                 //If there's only one then let's be generous
                 if (validStorables.Count > 1)
                 {
-                    var doAfterArgs = new DoAfterArgs(args.User, 0.2f * validStorables.Count, new AreaPickupDoAfterEvent(validStorables), uid, target: uid)
+                    var doAfterArgs = new DoAfterArgs(EntityManager, args.User, 0.2f * validStorables.Count, new AreaPickupDoAfterEvent(validStorables), uid, target: uid)
                     {
                         BreakOnDamage = true,
                         BreakOnUserMove = true,
@@ -273,9 +273,9 @@ namespace Content.Server.Storage.EntitySystems
 
                     if (PlayerInsertEntityInWorld(uid, args.User, target, storageComp))
                     {
-                        RaiseNetworkEvent(new AnimateInsertingEntitiesEvent(uid,
-                            new List<EntityUid> { target },
-                            new List<EntityCoordinates> { position },
+                        RaiseNetworkEvent(new AnimateInsertingEntitiesEvent(GetNetEntity(uid),
+                            new List<NetEntity> { GetNetEntity(target) },
+                            new List<NetCoordinates> { GetNetCoordinates(position) },
                             new List<Angle> { transformOwner.LocalRotation }));
                     }
                 }
@@ -294,8 +294,10 @@ namespace Content.Server.Storage.EntitySystems
             var xformQuery = GetEntityQuery<TransformComponent>();
             xformQuery.TryGetComponent(uid, out var xform);
 
-            foreach (var entity in args.Entities)
+            foreach (var nent in args.Entities)
             {
+                var entity = GetEntity(nent);
+
                 // Check again, situation may have changed for some entities, but we'll still pick up any that are valid
                 if (_containerSystem.IsEntityInContainer(entity)
                     || entity == args.Args.User
@@ -329,7 +331,7 @@ namespace Content.Server.Storage.EntitySystems
             if (successfullyInserted.Count > 0)
             {
                 _audio.PlayPvs(component.StorageInsertSound, uid);
-                RaiseNetworkEvent(new AnimateInsertingEntitiesEvent(uid, successfullyInserted, successfullyInsertedPositions, successfullyInsertedAngles));
+                RaiseNetworkEvent(new AnimateInsertingEntitiesEvent(GetNetEntity(uid), GetNetEntityList(successfullyInserted), GetNetCoordinatesList(successfullyInsertedPositions), successfullyInsertedAngles));
             }
 
             args.Handled = true;
@@ -359,13 +361,15 @@ namespace Content.Server.Storage.EntitySystems
             if (args.Session.AttachedEntity is not EntityUid player)
                 return;
 
-            if (!Exists(args.InteractedItemUID))
+            var interacted = GetEntity(args.InteractedItemUID);
+
+            if (!Exists(interacted))
             {
-                Log.Error($"Player {args.Session} interacted with non-existent item {args.InteractedItemUID} stored in {ToPrettyString(uid)}");
+                Log.Error($"Player {args.Session} interacted with non-existent item {interacted} stored in {ToPrettyString(uid)}");
                 return;
             }
 
-            if (!_actionBlockerSystem.CanInteract(player, args.InteractedItemUID) || storageComp.Storage == null || !storageComp.Storage.Contains(args.InteractedItemUID))
+            if (!_actionBlockerSystem.CanInteract(player, interacted) || storageComp.Storage == null || !storageComp.Storage.Contains(interacted))
                 return;
 
             // Does the player have hands?
@@ -375,14 +379,14 @@ namespace Content.Server.Storage.EntitySystems
             // If the user's active hand is empty, try pick up the item.
             if (hands.ActiveHandEntity == null)
             {
-                if (_sharedHandsSystem.TryPickupAnyHand(player, args.InteractedItemUID, handsComp: hands)
+                if (_sharedHandsSystem.TryPickupAnyHand(player, interacted, handsComp: hands)
                     && storageComp.StorageRemoveSound != null)
                     _audio.Play(storageComp.StorageRemoveSound, Filter.Pvs(uid, entityManager: EntityManager), uid, true, AudioParams.Default);
                 return;
             }
 
             // Else, interact using the held item
-            _interactionSystem.InteractUsing(player, hands.ActiveHandEntity.Value, args.InteractedItemUID, Transform(args.InteractedItemUID).Coordinates, checkCanInteract: false);
+            _interactionSystem.InteractUsing(player, hands.ActiveHandEntity.Value, interacted, Transform(interacted).Coordinates, checkCanInteract: false);
         }
 
         private void OnInsertItemMessage(EntityUid uid, ServerStorageComponent storageComp, StorageInsertItemMessage args)
@@ -732,11 +736,11 @@ namespace Content.Server.Storage.EntitySystems
             if (storageComp.Storage == null)
                 return;
 
-            var state = new StorageBoundUserInterfaceState((List<EntityUid>) storageComp.Storage.ContainedEntities, storageComp.StorageUsed, storageComp.StorageCapacityMax);
+            var state = new StorageBoundUserInterfaceState(GetNetEntityList(storageComp.Storage.ContainedEntities.ToList()), storageComp.StorageUsed, storageComp.StorageCapacityMax);
 
             var bui = _uiSystem.GetUiOrNull(uid, StorageUiKey.Key);
             if (bui != null)
-                UserInterfaceSystem.SetUiState(bui, state);
+                _uiSystem.SetUiState(bui, state);
         }
 
         private void Popup(EntityUid _, EntityUid player, string message, ServerStorageComponent storageComp)
index 5823bfe028884e37c344597860f5abfcbb8d9d09..d259da2c95e83af6be3f789fc9983a3cf4fd5b53 100644 (file)
@@ -26,8 +26,10 @@ public sealed partial class StoreSystem
             return;
         }
 
-        if (!EntityUid.TryParse(args[0], out var uid) || !float.TryParse(args[2], out var id))
+        if (!NetEntity.TryParse(args[0], out var uidNet) || !TryGetEntity(uidNet, out var uid) || !float.TryParse(args[2], out var id))
+        {
             return;
+        }
 
         if (!TryComp<StoreComponent>(uid, out var store))
             return;
@@ -37,7 +39,7 @@ public sealed partial class StoreSystem
             { args[1], id }
         };
 
-        TryAddCurrency(currency, uid, store);
+        TryAddCurrency(currency, uid.Value, store);
     }
 
     private CompletionResult AddCurrencyCommandCompletions(IConsoleShell shell, string[] args)
@@ -53,7 +55,7 @@ public sealed partial class StoreSystem
             return CompletionResult.FromHintOptions(allStores, "<uid>");
         }
 
-        if (args.Length == 2 && EntityUid.TryParse(args[0], out var uid))
+        if (args.Length == 2 && NetEntity.TryParse(args[0], out var uidNet) && TryGetEntity(uidNet, out var uid))
         {
             if (TryComp<StoreComponent>(uid, out var store))
                 return CompletionResult.FromHintOptions(store.CurrencyWhitelist, "<currency prototype>");
index 5de45425093add78cf112568f4435f8055fc3ab5..c5b8761808e8cc7b08916a75d31a54e3a71e044f 100644 (file)
@@ -97,12 +97,12 @@ public sealed partial class StoreSystem
         // only tell operatives to lock their uplink if it can be locked
         var showFooter = HasComp<RingerUplinkComponent>(store);
         var state = new StoreUpdateState(component.LastAvailableListings, allCurrency, showFooter);
-        UserInterfaceSystem.SetUiState(ui, state);
+        _ui.SetUiState(ui, state);
     }
 
     private void OnRequestUpdate(EntityUid uid, StoreComponent component, StoreRequestUpdateInterfaceMessage args)
     {
-        UpdateUserInterface(args.Session.AttachedEntity, args.Entity, component);
+        UpdateUserInterface(args.Session.AttachedEntity, GetEntity(args.Entity), component);
     }
 
     private void BeforeActivatableUiOpen(EntityUid uid, StoreComponent component, BeforeActivatableUIOpenEvent args)
index 3f769b67365ef2d7214a62b6e91660b555291d98..d5b17f440e9ce782da7ecf8651cbd3effa3eb218 100644 (file)
@@ -183,7 +183,7 @@ public sealed partial class StoreSystem : EntitySystem
         var ui = _ui.GetUiOrNull(uid, StoreUiKey.Key);
         if (ui != null)
         {
-            UserInterfaceSystem.SetUiState(ui, new StoreInitializeState(preset.StoreName));
+            _ui.SetUiState(ui, new StoreInitializeState(preset.StoreName));
         }
     }
 }
index 8052765a5573fa8239e3ef3cd74290c2020fa80c..8f723ab97d4634f4680bc601d9374e5fdc1553e7 100644 (file)
@@ -217,7 +217,7 @@ namespace Content.Server.Strip
             var ev = new BeforeGettingStrippedEvent(userEv.Time, userEv.Stealth);
             RaiseLocalEvent(target, ev);
 
-            var doAfterArgs = new DoAfterArgs(user, ev.Time, new AwaitedDoAfterEvent(), null, target: target, used: held)
+            var doAfterArgs = new DoAfterArgs(EntityManager, user, ev.Time, new AwaitedDoAfterEvent(), null, target: target, used: held)
             {
                 ExtraCheck = Check,
                 AttemptFrequency = AttemptFrequency.EveryTick,
@@ -289,7 +289,7 @@ namespace Content.Server.Strip
             var ev = new BeforeGettingStrippedEvent(userEv.Time, userEv.Stealth);
             RaiseLocalEvent(target, ev);
 
-            var doAfterArgs = new DoAfterArgs(user, ev.Time, new AwaitedDoAfterEvent(), null, target: target, used: held)
+            var doAfterArgs = new DoAfterArgs(EntityManager, user, ev.Time, new AwaitedDoAfterEvent(), null, target: target, used: held)
             {
                 ExtraCheck = Check,
                 AttemptFrequency = AttemptFrequency.EveryTick,
@@ -349,7 +349,7 @@ namespace Content.Server.Strip
             var ev = new BeforeGettingStrippedEvent(userEv.Time, userEv.Stealth);
             RaiseLocalEvent(target, ev);
 
-            var doAfterArgs = new DoAfterArgs(user, ev.Time, new AwaitedDoAfterEvent(), null, target: target, used: item)
+            var doAfterArgs = new DoAfterArgs(EntityManager, user, ev.Time, new AwaitedDoAfterEvent(), null, target: target, used: item)
             {
                 ExtraCheck = Check,
                 AttemptFrequency = AttemptFrequency.EveryTick,
@@ -424,7 +424,7 @@ namespace Content.Server.Strip
             var ev = new BeforeGettingStrippedEvent(userEv.Time, userEv.Stealth);
             RaiseLocalEvent(target, ev);
 
-            var doAfterArgs = new DoAfterArgs(user, ev.Time, new AwaitedDoAfterEvent(), null, target: target, used: item)
+            var doAfterArgs = new DoAfterArgs(EntityManager, user, ev.Time, new AwaitedDoAfterEvent(), null, target: target, used: item)
             {
                 ExtraCheck = Check,
                 AttemptFrequency = AttemptFrequency.EveryTick,
index 09f767ffd9ed200aa487f7f844825a6c1ae53682..2d691602f731f21ccddad617543792684f877c58 100644 (file)
@@ -488,14 +488,7 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
             return;
         }
 
-        IPlayerSession? session = null;
-        if (player != null
-            && TryComp(player, out ActorComponent? actor))
-        {
-            session = actor.PlayerSession;
-        }
-
-        var state = new SurveillanceCameraMonitorUiState(monitor.ActiveCamera, monitor.KnownSubnets.Keys.ToHashSet(), monitor.ActiveCameraAddress, monitor.ActiveSubnet, monitor.KnownCameras);
+        var state = new SurveillanceCameraMonitorUiState(GetNetEntity(monitor.ActiveCamera), monitor.KnownSubnets.Keys.ToHashSet(), monitor.ActiveCameraAddress, monitor.ActiveSubnet, monitor.KnownCameras);
         _userInterface.TrySetUiState(uid, SurveillanceCameraMonitorUiKey.Key, state);
     }
 }
index b6e182e936ec4917db3097ab3fe722cfdc4d2f51..588c4f129d2229284d6e3a82da1fc9e8ced918eb 100644 (file)
@@ -90,7 +90,7 @@ namespace Content.Server.Tabletop
             session.Players[player] = new TabletopSessionPlayerData { Camera = camera };
 
             // Tell the gamer to open a viewport for the tabletop game
-            RaiseNetworkEvent(new TabletopPlayEvent(uid, camera, Loc.GetString(tabletop.BoardName), tabletop.Size), player.ConnectedClient);
+            RaiseNetworkEvent(new TabletopPlayEvent(GetNetEntity(uid), GetNetEntity(camera), Loc.GetString(tabletop.BoardName), tabletop.Size), player.ConnectedClient);
         }
 
         /// <summary>
index 145ba335110cc5847d8034e56cbdfa3057f4d6f8..82a93f6d58ccd01da304b5cd33dbe68595573fa8 100644 (file)
@@ -46,16 +46,19 @@ namespace Content.Server.Tabletop
             if (args.SenderSession is not IPlayerSession playerSession)
                 return;
 
-            if (!TryComp(msg.TableUid, out TabletopGameComponent? tabletop) || tabletop.Session is not { } session)
-                return;
+            var table = GetEntity(msg.TableUid);
 
+            if (!TryComp(table, out TabletopGameComponent? tabletop) || tabletop.Session is not { } session)
+                return;
 
             if (!msg.Entity.IsValid())
                 return;
 
-            if (!TryComp(msg.Entity, out TabletopHologramComponent? hologram))
+            var entity = GetEntity(msg.Entity);
+
+            if (!TryComp(entity, out TabletopHologramComponent? hologram))
             {
-                _popupSystem.PopupEntity(Loc.GetString("tabletop-error-remove-non-hologram"), msg.TableUid, args.SenderSession);
+                _popupSystem.PopupEntity(Loc.GetString("tabletop-error-remove-non-hologram"), table, args.SenderSession);
                 return;
             }
 
@@ -64,7 +67,7 @@ namespace Content.Server.Tabletop
                 return;
 
             // Find the entity, remove it from the session and set it's position to the tabletop
-            session.Entities.TryGetValue(msg.Entity, out var result);
+            session.Entities.TryGetValue(entity, out var result);
             session.Entities.Remove(result);
             _entityManager.QueueDeleteEntity(result);
         }
@@ -106,7 +109,7 @@ namespace Content.Server.Tabletop
             if (args.SenderSession is not IPlayerSession playerSession)
                 return;
 
-            if (!TryComp(msg.TableUid, out TabletopGameComponent? tabletop) || tabletop.Session is not { } session)
+            if (!TryComp(GetEntity(msg.TableUid), out TabletopGameComponent? tabletop) || tabletop.Session is not { } session)
                 return;
 
             // Check if player is actually playing at this table
@@ -153,7 +156,7 @@ namespace Content.Server.Tabletop
 
         private void OnStopPlaying(TabletopStopPlayingEvent msg, EntitySessionEventArgs args)
         {
-            CloseSessionFor((IPlayerSession)args.SenderSession, msg.TableUid);
+            CloseSessionFor((IPlayerSession)args.SenderSession, GetEntity(msg.TableUid));
         }
 
         private void OnPlayerDetached(EntityUid uid, TabletopGamerComponent component, PlayerDetachedEvent args)
index f1fceb2054be1d1ebfca351466bcdcaeb6c94dc9..4bfe03ba4221c71c9aa73cb1589e5282b56a8e1a 100644 (file)
@@ -54,7 +54,7 @@ public sealed class HandTeleporterSystem : EntitySystem
             if (xform.ParentUid != xform.GridUid)
                 return;
 
-            var doafterArgs = new DoAfterArgs(args.User, component.PortalCreationDelay, new TeleporterDoAfterEvent(), uid, used: uid)
+            var doafterArgs = new DoAfterArgs(EntityManager, args.User, component.PortalCreationDelay, new TeleporterDoAfterEvent(), uid, used: uid)
             {
                 BreakOnDamage = true,
                 BreakOnUserMove = true,
index c1557ee7c58854d93e225374356da05c7061dc68..674a8102390a6a47eb87cd751734dbe3cfa7b168 100644 (file)
@@ -26,11 +26,12 @@ public sealed partial class ToolSystem
         if (args.Cancelled)
             return;
 
-        var gridUid = args.Coordinates.GetGridUid(EntityManager);
+        var coords = GetCoordinates(args.Coordinates);
+        var gridUid = coords.GetGridUid(EntityManager);
         if (gridUid == null)
             return;
         var grid = _mapManager.GetGrid(gridUid.Value);
-        var tile = grid.GetTileRef(args.Coordinates);
+        var tile = grid.GetTileRef(coords);
 
         if (_tileDefinitionManager[tile.Tile.TypeId] is not ContentTileDefinition tileDef
             || !tileDef.CanWirecutter
@@ -69,9 +70,11 @@ public sealed partial class ToolSystem
             || string.IsNullOrEmpty(tileDef.BaseTurf)
             || _tileDefinitionManager[tileDef.BaseTurf] is not ContentTileDefinition newDef
             || tile.IsBlockedTurf(true))
+        {
             return false;
+        }
 
-        var ev = new LatticeCuttingCompleteEvent(coordinates);
+        var ev = new LatticeCuttingCompleteEvent(GetNetCoordinates(coordinates));
         return UseTool(toolEntity, user, toolEntity, component.Delay, component.QualityNeeded, ev);
     }
 }
index 1f602dae37d043da7af76135c3c39b23356af6a4..614d6b873406a0946120da4409d08146dc6255a5 100644 (file)
@@ -31,14 +31,15 @@ public sealed partial class ToolSystem
         if (args.Cancelled)
             return;
 
-        var gridUid = args.Coordinates.GetGridUid(EntityManager);
+        var coords = GetCoordinates(args.Coordinates);
+        var gridUid = coords.GetGridUid(EntityManager);
         if (!_mapManager.TryGetGrid(gridUid, out var grid))
         {
             Log.Error("Attempted to pry from a non-existent grid?");
             return;
         }
 
-        var tile = grid.GetTileRef(args.Coordinates);
+        var tile = grid.GetTileRef(coords);
         var center = _turf.GetTileCenter(tile);
         if (args.Used != null)
         {
@@ -74,7 +75,7 @@ public sealed partial class ToolSystem
         if (!tileDef.CanCrowbar && !(tileDef.CanAxe && component.Advanced))
             return false;
 
-        var ev = new TilePryingDoAfterEvent(coordinates);
+        var ev = new TilePryingDoAfterEvent(GetNetCoordinates(coordinates));
 
         return UseTool(toolEntity, user, toolEntity, component.Delay, component.QualityNeeded, ev, toolComponent: tool);
     }
index 100fbc2306a06e0b57e7a080ec183a56d16e95a4..1b11dffeea7c62a9531a097389fad1d9d5890b0a 100644 (file)
@@ -14,10 +14,10 @@ public sealed class RunVerbAsCommand : ToolshedCommand
     private SharedVerbSystem? _verb;
 
     [CommandImplementation]
-    public IEnumerable<EntityUid> RunVerbAs(
+    public IEnumerable<NetEntity> RunVerbAs(
             [CommandInvocationContext] IInvocationContext ctx,
-            [PipedArgument] IEnumerable<EntityUid> input,
-            [CommandArgument] ValueRef<EntityUid> runner,
+            [PipedArgument] IEnumerable<NetEntity> input,
+            [CommandArgument] ValueRef<NetEntity> runner,
             [CommandArgument] string verb
         )
     {
@@ -26,16 +26,17 @@ public sealed class RunVerbAsCommand : ToolshedCommand
 
         foreach (var i in input)
         {
-            var runnerEid = runner.Evaluate(ctx);
+            var runnerNet = runner.Evaluate(ctx);
+            var runnerEid = EntityManager.GetEntity(runnerNet);
 
-
-            if (EntityManager.Deleted(runnerEid) && runnerEid != default)
+            if (EntityManager.Deleted(runnerEid) && runnerEid.IsValid())
                 ctx.ReportError(new DeadEntity(runnerEid));
 
             if (ctx.GetErrors().Any())
                 yield break;
 
-            var verbs = _verb.GetLocalVerbs(i, runnerEid, Verb.VerbTypes, true);
+            var eId = EntityManager.GetEntity(i);
+            var verbs = _verb.GetLocalVerbs(eId, runnerEid, Verb.VerbTypes, true);
 
             // if the "verb name" is actually a verb-type, try run any verb of that type.
             var verbType = Verb.VerbTypes.FirstOrDefault(x => x.Name == verb);
@@ -44,7 +45,7 @@ public sealed class RunVerbAsCommand : ToolshedCommand
                 var verbTy = verbs.FirstOrDefault(v => v.GetType() == verbType);
                 if (verbTy != null)
                 {
-                    _verb.ExecuteVerb(verbTy, runnerEid, i, forced: true);
+                    _verb.ExecuteVerb(verbTy, runnerEid, eId, forced: true);
                     yield return i;
                 }
             }
@@ -53,7 +54,7 @@ public sealed class RunVerbAsCommand : ToolshedCommand
             {
                 if (verbTy.Text.ToLowerInvariant() == verb)
                 {
-                    _verb.ExecuteVerb(verbTy, runnerEid, i, forced: true);
+                    _verb.ExecuteVerb(verbTy, runnerEid, eId, forced: true);
                     yield return i;
                 }
             }
index 7dcc790cb8f0577071946ec64937090b3859f33b..4ef08a91bf015d122090b43ae2b8ce764660c0c4 100644 (file)
@@ -28,7 +28,7 @@ public sealed class VisualizeCommand : ToolshedCommand
         }
 
         var ui = new ToolshedVisualizeEui(
-            input.Select(e => (EntName(e), e)).ToArray()
+            input.Select(e => (EntName(e), EntityManager.GetNetEntity(e))).ToArray()
         );
         _euiManager.OpenEui(ui, (IPlayerSession) ctx.Session);
         _euiManager.QueueStateUpdate(ui);
@@ -36,9 +36,9 @@ public sealed class VisualizeCommand : ToolshedCommand
 }
 internal sealed class ToolshedVisualizeEui : BaseEui
 {
-    private readonly (string name, EntityUid entity)[] _entities;
+    private readonly (string name, NetEntity entity)[] _entities;
 
-    public ToolshedVisualizeEui((string name, EntityUid entity)[] entities)
+    public ToolshedVisualizeEui((string name, NetEntity entity)[] entities)
     {
         _entities = entities;
     }
index 28d300ade5948eb3ab0eb562bd10ec10219bdebb..6d12b08e8651478365dbf8fbbeed38385c8f8112 100644 (file)
@@ -27,15 +27,15 @@ namespace Content.Server.Verbs
         {
             var player = (IPlayerSession) eventArgs.SenderSession;
 
-            if (!EntityManager.EntityExists(args.EntityUid))
+            if (!EntityManager.EntityExists(GetEntity(args.EntityUid)))
             {
-                Logger.Warning($"{nameof(HandleVerbRequest)} called on a non-existent entity with id {args.EntityUid} by player {player}.");
+                Log.Warning($"{nameof(HandleVerbRequest)} called on a non-existent entity with id {args.EntityUid} by player {player}.");
                 return;
             }
 
             if (player.AttachedEntity is not {} attached)
             {
-                Logger.Warning($"{nameof(HandleVerbRequest)} called by player {player} with no attached entity.");
+                Log.Warning($"{nameof(HandleVerbRequest)} called by player {player} with no attached entity.");
                 return;
             }
 
@@ -54,11 +54,11 @@ namespace Content.Server.Verbs
                 if (type != null)
                     verbTypes.Add(type);
                 else
-                    Logger.Error($"Unknown verb type received: {key}");
+                    Log.Error($"Unknown verb type received: {key}");
             }
 
             var response =
-                new VerbsResponseEvent(args.EntityUid, GetLocalVerbs(args.EntityUid, attached, verbTypes, force));
+                new VerbsResponseEvent(args.EntityUid, GetLocalVerbs(GetEntity(args.EntityUid), attached, verbTypes, force));
             RaiseNetworkEvent(response, player.ConnectedClient);
         }
 
index 5143237fa0b34a656a525a1f8a7e85771566dd13..fdd5f3a9f42d537c2a335185494c31aedc116c2c 100644 (file)
@@ -84,6 +84,6 @@ public sealed partial class VoiceMaskSystem : EntitySystem
         }
 
         if (_uiSystem.TryGetUi(owner, VoiceMaskUIKey.Key, out var bui))
-            UserInterfaceSystem.SetUiState(bui, new VoiceMaskBuiState(component.VoiceName));
+            _uiSystem.SetUiState(bui, new VoiceMaskBuiState(component.VoiceName));
     }
 }
index c8f894ea19bf7b16617114871142ab7321a66cea..c4fec25139f9199d5dc83e8c338d1e76de9e49a9 100644 (file)
@@ -102,15 +102,15 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
             return false;
         }
 
-        var target = ev.Target!.Value;
+        var target = GetEntity(ev.Target!.Value);
 
-        if (!TryComp<HandsComponent>(ev.Target.Value, out var targetHandsComponent))
+        if (!TryComp<HandsComponent>(target, out var targetHandsComponent))
         {
-            if (!TryComp<StatusEffectsComponent>(ev.Target!.Value, out var status) || !status.AllowedEffects.Contains("KnockedDown"))
+            if (!TryComp<StatusEffectsComponent>(target, out var status) || !status.AllowedEffects.Contains("KnockedDown"))
                 return false;
         }
 
-        if (!InRange(user, ev.Target.Value, component.Range, session))
+        if (!InRange(user, target, component.Range, session))
         {
             return false;
         }
@@ -122,7 +122,7 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
             inTargetHand = targetHandsComponent.ActiveHand.HeldEntity!.Value;
         }
 
-        Interaction.DoContactInteraction(user, ev.Target);
+        Interaction.DoContactInteraction(user, target);
 
         var attemptEvent = new DisarmAttemptEvent(target, user, inTargetHand);
 
@@ -228,7 +228,7 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
             filter = Filter.Pvs(user, entityManager: EntityManager);
         }
 
-        RaiseNetworkEvent(new MeleeLungeEvent(user, angle, localPos, animation), filter);
+        RaiseNetworkEvent(new MeleeLungeEvent(GetNetEntity(user), angle, localPos, animation), filter);
     }
 
     private void OnSpeechHit(EntityUid owner, MeleeSpeechComponent comp, MeleeHitEvent args)
index 2bb1dc82450a8eeb28ebc229db9b8f7c3258a036..0acb20f5a24c8c5ac3f41315e0c3da856399ebd5 100644 (file)
@@ -398,7 +398,7 @@ public sealed partial class GunSystem : SharedGunSystem
         // Lord
         // Forgive me for the shitcode I am about to do
         // Effects tempt me not
-        var sprites = new List<(EntityCoordinates coordinates, Angle angle, SpriteSpecifier sprite, float scale)>();
+        var sprites = new List<(NetCoordinates coordinates, Angle angle, SpriteSpecifier sprite, float scale)>();
         var gridUid = fromCoordinates.GetGridUid(EntityManager);
         var angle = mapDirection;
 
@@ -421,18 +421,27 @@ public sealed partial class GunSystem : SharedGunSystem
         {
             if (hitscan.MuzzleFlash != null)
             {
-                sprites.Add((fromCoordinates.Offset(angle.ToVec().Normalized() / 2), angle, hitscan.MuzzleFlash, 1f));
+                var coords = fromCoordinates.Offset(angle.ToVec().Normalized() / 2);
+                var netCoords = GetNetCoordinates(coords);
+
+                sprites.Add((netCoords, angle, hitscan.MuzzleFlash, 1f));
             }
 
             if (hitscan.TravelFlash != null)
             {
-                sprites.Add((fromCoordinates.Offset(angle.ToVec() * (distance + 0.5f) / 2), angle, hitscan.TravelFlash, distance - 1.5f));
+                var coords = fromCoordinates.Offset(angle.ToVec() * (distance + 0.5f) / 2);
+                var netCoords = GetNetCoordinates(coords);
+
+                sprites.Add((netCoords, angle, hitscan.TravelFlash, distance - 1.5f));
             }
         }
 
         if (hitscan.ImpactFlash != null)
         {
-            sprites.Add((fromCoordinates.Offset(angle.ToVec() * distance), angle.FlipPositive(), hitscan.ImpactFlash, 1f));
+            var coords = fromCoordinates.Offset(angle.ToVec() * distance);
+            var netCoords = GetNetCoordinates(coords);
+
+            sprites.Add((netCoords, angle.FlipPositive(), hitscan.ImpactFlash, 1f));
         }
 
         if (sprites.Count > 0)
index 90f6b5c95453653373d1ed3fce03e5736b6d1cdb..07f0de2ebe7da5e8942ed7c0b63c96dcc57cd68b 100644 (file)
@@ -742,7 +742,7 @@ public sealed class WiresSystem : SharedWiresSystem
 
         if (_toolTime > 0f)
         {
-            var args = new DoAfterArgs(user, _toolTime, new WireDoAfterEvent(action, id), target, target: target, used: toolEntity)
+            var args = new DoAfterArgs(EntityManager, user, _toolTime, new WireDoAfterEvent(action, id), target, target: target, used: toolEntity)
             {
                 NeedHand = true,
                 BreakOnDamage = true,
index 30d9bae7e8b532b803632e9fb22123eb2f022e16..49036fb19d8f2b5a1789eaa2c14f65248c25ddef 100644 (file)
@@ -214,11 +214,11 @@ public sealed class ArtifactAnalyzerSystem : EntitySystem
         var scanning = TryComp<ActiveArtifactAnalyzerComponent>(component.AnalyzerEntity, out var active);
         var remaining = active != null ? _timing.CurTime - active.StartTime : TimeSpan.Zero;
 
-        var state = new AnalysisConsoleScanUpdateState(artifact, analyzerConnected, serverConnected,
+        var state = new AnalysisConsoleScanUpdateState(GetNetEntity(artifact), analyzerConnected, serverConnected,
             canScan, canPrint, msg, scanning, remaining, totalTime, points);
 
         var bui = _ui.GetUi(uid, ArtifactAnalzyerUiKey.Key);
-        UserInterfaceSystem.SetUiState(bui, state);
+        _ui.SetUiState(bui, state);
     }
 
     /// <summary>
index 37f974f6b0a12519d64e12961887e8993166a51d..649a7a34f16b68a57ef344b1540755a992be40a2 100644 (file)
@@ -25,7 +25,7 @@ public partial class ArtifactSystem
         if (args.Length != 2)
             shell.WriteError("Argument length must be 2");
 
-        if (!EntityUid.TryParse(args[0], out var uid) || ! int.TryParse(args[1], out var id))
+        if (!NetEntity.TryParse(args[0], out var uidNet) || !TryGetEntity(uidNet, out var uid) || !int.TryParse(args[1], out var id))
             return;
 
         if (!TryComp<ArtifactComponent>(uid, out var artifact))
@@ -33,13 +33,13 @@ public partial class ArtifactSystem
 
         if (artifact.NodeTree.FirstOrDefault(n => n.Id == id) is { } node)
         {
-            EnterNode(uid, ref node);
+            EnterNode(uid.Value, ref node);
         }
     }
 
     private CompletionResult ForceArtifactNodeCompletions(IConsoleShell shell, string[] args)
     {
-        if (args.Length == 2 && EntityUid.TryParse(args[0], out var uid))
+        if (args.Length == 2 && NetEntity.TryParse(args[0], out var uidNet) && TryGetEntity(uidNet, out var uid))
         {
             if (TryComp<ArtifactComponent>(uid, out var artifact))
             {
@@ -56,13 +56,13 @@ public partial class ArtifactSystem
         if (args.Length != 1)
             shell.WriteError("Argument length must be 1");
 
-        if (!EntityUid.TryParse(args[0], out var uid))
+        if (!NetEntity.TryParse(args[0], out var uidNet) || !TryGetEntity(uidNet, out var uid))
             return;
 
         if (!TryComp<ArtifactComponent>(uid, out var artifact))
             return;
 
-        var pointSum = GetResearchPointValue(uid, artifact, true);
-        shell.WriteLine($"Max point value for {ToPrettyString(uid)} with {artifact.NodeTree.Count} nodes: {pointSum}");
+        var pointSum = GetResearchPointValue(uid.Value, artifact, true);
+        shell.WriteLine($"Max point value for {ToPrettyString(uid.Value)} with {artifact.NodeTree.Count} nodes: {pointSum}");
     }
 }
index 68bbc1e9ad0728df711ae91624a7467db2a7c6ad..796646c83c2c24373b4c33885ab80fce7cf44dee 100644 (file)
@@ -61,9 +61,9 @@ public sealed class AccessReaderComponentState : ComponentState
 
     public List<HashSet<string>> AccessLists;
 
-    public HashSet<StationRecordKey> AccessKeys;
+    public List<(NetEntity, uint)> AccessKeys;
 
-    public AccessReaderComponentState(bool enabled, HashSet<string> denyTags, List<HashSet<string>> accessLists, HashSet<StationRecordKey> accessKeys)
+    public AccessReaderComponentState(bool enabled, HashSet<string> denyTags, List<HashSet<string>> accessLists, List<(NetEntity, uint)> accessKeys)
     {
         Enabled = enabled;
         DenyTags = denyTags;
index 4e22c3b5e6e5a53655808c703e9f73715fd0d7cc..8794500b900641b540d1b85bdab0ef65eeb3b5b0 100644 (file)
@@ -21,6 +21,7 @@ public sealed class AccessReaderSystem : EntitySystem
     [Dependency] private readonly InventorySystem _inventorySystem = default!;
     [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
     [Dependency] private readonly SharedContainerSystem _containerSystem = default!;
+    [Dependency] private readonly SharedStationRecordsSystem _records = default!;
 
     public override void Initialize()
     {
@@ -36,7 +37,7 @@ public sealed class AccessReaderSystem : EntitySystem
     private void OnGetState(EntityUid uid, AccessReaderComponent component, ref ComponentGetState args)
     {
         args.State = new AccessReaderComponentState(component.Enabled, component.DenyTags, component.AccessLists,
-            component.AccessKeys);
+            _records.Convert(component.AccessKeys));
     }
 
     private void OnHandleState(EntityUid uid, AccessReaderComponent component, ref ComponentHandleState args)
@@ -44,7 +45,16 @@ public sealed class AccessReaderSystem : EntitySystem
         if (args.Current is not AccessReaderComponentState state)
             return;
         component.Enabled = state.Enabled;
-        component.AccessKeys = new(state.AccessKeys);
+        component.AccessKeys.Clear();
+        foreach (var key in state.AccessKeys)
+        {
+            var id = EnsureEntity<AccessReaderComponent>(key.Item1, uid);
+            if (!id.IsValid())
+                continue;
+
+            component.AccessKeys.Add(new StationRecordKey(key.Item2, id));
+        }
+
         component.AccessLists = new(state.AccessLists);
         component.DenyTags = new(state.DenyTags);
     }
index 3d45d3ef1a686115f7261c1d2531cf21b7917aef..c6f873c78a38a0ea0da43381daf361a9645d9604 100644 (file)
@@ -65,22 +65,22 @@ public sealed class GetItemActionsEvent : EntityEventArgs
 [Serializable, NetSerializable]
 public sealed class RequestPerformActionEvent : EntityEventArgs
 {
-    public readonly EntityUid Action;
-    public readonly EntityUid? EntityTarget;
-    public readonly EntityCoordinates? EntityCoordinatesTarget;
+    public readonly NetEntity Action;
+    public readonly NetEntity? EntityTarget;
+    public readonly NetCoordinates? EntityCoordinatesTarget;
 
-    public RequestPerformActionEvent(EntityUid action)
+    public RequestPerformActionEvent(NetEntity action)
     {
         Action = action;
     }
 
-    public RequestPerformActionEvent(EntityUid action, EntityUid entityTarget)
+    public RequestPerformActionEvent(NetEntity action, NetEntity entityTarget)
     {
         Action = action;
         EntityTarget = entityTarget;
     }
 
-    public RequestPerformActionEvent(EntityUid action, EntityCoordinates entityCoordinatesTarget)
+    public RequestPerformActionEvent(NetEntity action, NetCoordinates entityCoordinatesTarget)
     {
         Action = action;
         EntityCoordinatesTarget = entityCoordinatesTarget;
index bceb08b121ff645328e07c251ee28aec77f9df5e..f7db07a85a8ffbbca5a6f725cc1bb1ecf75c0e15 100644 (file)
@@ -21,9 +21,9 @@ public sealed partial class ActionsComponent : Component
 [Serializable, NetSerializable]
 public sealed class ActionsComponentState : ComponentState
 {
-    public readonly HashSet<EntityUid> Actions;
+    public readonly HashSet<NetEntity> Actions;
 
-    public ActionsComponentState(HashSet<EntityUid> actions)
+    public ActionsComponentState(HashSet<NetEntity> actions)
     {
         Actions = actions;
     }
index 7ece8e2b1fd2f0b784483f6b2d49de3e16903240..5580c19e199ed09f441a5753b45e3e413c075295 100644 (file)
@@ -149,19 +149,19 @@ public abstract class BaseActionComponentState : ComponentState
     public (TimeSpan Start, TimeSpan End)? Cooldown;
     public TimeSpan? UseDelay;
     public int? Charges;
-    public EntityUid? Provider;
-    public EntityUid? EntityIcon;
+    public NetEntity? Provider;
+    public NetEntity? EntityIcon;
     public bool CheckCanInteract;
     public bool ClientExclusive;
     public int Priority;
-    public EntityUid? AttachedEntity;
+    public NetEntity? AttachedEntity;
     public bool AutoPopulate;
     public bool AutoRemove;
     public bool Temporary;
     public ItemActionIconStyle ItemIconStyle;
     public SoundSpecifier? Sound;
 
-    protected BaseActionComponentState(BaseActionComponent component)
+    protected BaseActionComponentState(BaseActionComponent component, IEntityManager entManager)
     {
         Icon = component.Icon;
         IconOn = component.IconOn;
@@ -172,12 +172,18 @@ public abstract class BaseActionComponentState : ComponentState
         Cooldown = component.Cooldown;
         UseDelay = component.UseDelay;
         Charges = component.Charges;
-        Provider = component.Provider;
-        EntityIcon = component.EntityIcon;
+
+        // TODO ACTION REFACTOR fix bugs
+        if (entManager.TryGetNetEntity(component.Provider, out var provider))
+            Provider = provider;
+        if (entManager.TryGetNetEntity(component.EntityIcon, out var icon))
+            EntityIcon = icon;
+        if (entManager.TryGetNetEntity(component.AttachedEntity, out var attached))
+            AttachedEntity = attached;
+
         CheckCanInteract = component.CheckCanInteract;
         ClientExclusive = component.ClientExclusive;
         Priority = component.Priority;
-        AttachedEntity = component.AttachedEntity;
         AutoPopulate = component.AutoPopulate;
         AutoRemove = component.AutoRemove;
         Temporary = component.Temporary;
index 33c4bf8cef401e2bd7632083d0c387f956c5f1fa..9024f42e0e7748dd0dc8de6c3420298917b53c92 100644 (file)
@@ -27,7 +27,7 @@ public sealed class EntityTargetActionComponentState : BaseActionComponentState
     public EntityWhitelist? Whitelist;
     public bool CanTargetSelf;
 
-    public EntityTargetActionComponentState(EntityTargetActionComponent component) : base(component)
+    public EntityTargetActionComponentState(EntityTargetActionComponent component, IEntityManager entManager) : base(component, entManager)
     {
         Whitelist = component.Whitelist;
         CanTargetSelf = component.CanTargetSelf;
index f97ca04a46c2a1621b2506546f826b297432e65c..04c9b94556cab8bb6fa4d0c4ab87c2add4469d29 100644 (file)
@@ -19,7 +19,7 @@ public sealed partial class InstantActionComponent : BaseActionComponent
 [Serializable, NetSerializable]
 public sealed class InstantActionComponentState : BaseActionComponentState
 {
-    public InstantActionComponentState(InstantActionComponent component) : base(component)
+    public InstantActionComponentState(InstantActionComponent component, IEntityManager entManager) : base(component, entManager)
     {
     }
 }
index 12e5c2260a565fd64bcdc133ed1c1ca8386a03f2..3d476dd48c00824850f191f4e23941cda27d3bed 100644 (file)
@@ -65,20 +65,20 @@ public abstract class SharedActionsSystem : EntitySystem
 
     private void OnInstantGetState(EntityUid uid, InstantActionComponent component, ref ComponentGetState args)
     {
-        args.State = new InstantActionComponentState(component);
+        args.State = new InstantActionComponentState(component, EntityManager);
     }
 
     private void OnEntityTargetGetState(EntityUid uid, EntityTargetActionComponent component, ref ComponentGetState args)
     {
-        args.State = new EntityTargetActionComponentState(component);
+        args.State = new EntityTargetActionComponentState(component, EntityManager);
     }
 
     private void OnWorldTargetGetState(EntityUid uid, WorldTargetActionComponent component, ref ComponentGetState args)
     {
-        args.State = new WorldTargetActionComponentState(component);
+        args.State = new WorldTargetActionComponentState(component, EntityManager);
     }
 
-    private void BaseHandleState(BaseActionComponent component, BaseActionComponentState state)
+    private void BaseHandleState<T>(EntityUid uid, BaseActionComponent component, BaseActionComponentState state) where T : BaseActionComponent
     {
         component.Icon = state.Icon;
         component.IconOn = state.IconOn;
@@ -89,12 +89,12 @@ public abstract class SharedActionsSystem : EntitySystem
         component.Cooldown = state.Cooldown;
         component.UseDelay = state.UseDelay;
         component.Charges = state.Charges;
-        component.Provider = state.Provider;
-        component.EntityIcon = state.EntityIcon;
+        component.Provider = EnsureEntity<T>(state.Provider, uid);
+        component.EntityIcon = EnsureEntity<T>(state.EntityIcon, uid);
         component.CheckCanInteract = state.CheckCanInteract;
         component.ClientExclusive = state.ClientExclusive;
         component.Priority = state.Priority;
-        component.AttachedEntity = state.AttachedEntity;
+        component.AttachedEntity = EnsureEntity<T>(state.AttachedEntity, uid);
         component.AutoPopulate = state.AutoPopulate;
         component.AutoRemove = state.AutoRemove;
         component.Temporary = state.Temporary;
@@ -107,7 +107,7 @@ public abstract class SharedActionsSystem : EntitySystem
         if (args.Current is not InstantActionComponentState state)
             return;
 
-        BaseHandleState(component, state);
+        BaseHandleState<InstantActionComponent>(uid, component, state);
     }
 
     private void OnEntityTargetHandleState(EntityUid uid, EntityTargetActionComponent component, ref ComponentHandleState args)
@@ -115,7 +115,7 @@ public abstract class SharedActionsSystem : EntitySystem
         if (args.Current is not EntityTargetActionComponentState state)
             return;
 
-        BaseHandleState(component, state);
+        BaseHandleState<EntityTargetActionComponent>(uid, component, state);
         component.Whitelist = state.Whitelist;
         component.CanTargetSelf = state.CanTargetSelf;
     }
@@ -125,7 +125,7 @@ public abstract class SharedActionsSystem : EntitySystem
         if (args.Current is not WorldTargetActionComponentState state)
             return;
 
-        BaseHandleState(component, state);
+        BaseHandleState<WorldTargetActionComponent>(uid, component, state);
     }
 
     private void OnGetActionData<T>(EntityUid uid, T component, ref GetActionDataEvent args) where T : BaseActionComponent
@@ -177,7 +177,7 @@ public abstract class SharedActionsSystem : EntitySystem
 
     protected bool TryGetContainer(
         EntityUid holderId,
-        [NotNullWhen(true)] out IContainer? container,
+        [NotNullWhen(true)] out BaseContainer? container,
         ContainerManagerComponent? containerManager = null)
     {
         return _containerSystem.TryGetContainer(holderId, ActionContainerId, out container, containerManager);
@@ -185,7 +185,7 @@ public abstract class SharedActionsSystem : EntitySystem
 
     protected bool TryGetProvidedContainer(
         EntityUid providerId,
-        [NotNullWhen(true)] out IContainer? container,
+        [NotNullWhen(true)] out BaseContainer? container,
         ContainerManagerComponent? containerManager = null)
     {
         return _containerSystem.TryGetContainer(providerId, ProvidedActionContainerId, out container, containerManager);
@@ -215,7 +215,9 @@ public abstract class SharedActionsSystem : EntitySystem
         if (action.AttachedEntity == null)
             return;
 
-        if (!TryComp(action.AttachedEntity, out ActionsComponent? comp))
+        var ent = action.AttachedEntity;
+
+        if (!TryComp(ent, out ActionsComponent? comp))
         {
             action.AttachedEntity = null;
             return;
@@ -267,7 +269,7 @@ public abstract class SharedActionsSystem : EntitySystem
 
     private void OnActionsGetState(EntityUid uid, ActionsComponent component, ref ComponentGetState args)
     {
-        args.State = new ActionsComponentState(component.Actions);
+        args.State = new ActionsComponentState(GetNetEntitySet(component.Actions));
     }
 
     private void OnActionsShutdown(EntityUid uid, ActionsComponent component, ComponentShutdown args)
@@ -291,20 +293,22 @@ public abstract class SharedActionsSystem : EntitySystem
         if (!TryComp(user, out ActionsComponent? component))
             return;
 
-        if (!TryComp(ev.Action, out MetaDataComponent? metaData))
+        var actionEnt = GetEntity(ev.Action);
+
+        if (!TryComp(actionEnt, out MetaDataComponent? metaData))
             return;
 
-        var name = Name(ev.Action, metaData);
+        var name = Name(actionEnt, metaData);
 
         // Does the user actually have the requested action?
-        if (!component.Actions.Contains(ev.Action))
+        if (!component.Actions.Contains(actionEnt))
         {
             _adminLogger.Add(LogType.Action,
                 $"{ToPrettyString(user):user} attempted to perform an action that they do not have: {name}.");
             return;
         }
 
-        var action = GetActionData(ev.Action);
+        var action = GetActionData(actionEnt);
         if (action == null || !action.Enabled)
             return;
 
@@ -318,12 +322,14 @@ public abstract class SharedActionsSystem : EntitySystem
         switch (action)
         {
             case EntityTargetActionComponent entityAction:
-                if (ev.EntityTarget is not { Valid: true } entityTarget)
+                if (ev.EntityTarget is not { Valid: true } netTarget)
                 {
                     Log.Error($"Attempted to perform an entity-targeted action without a target! Action: {name}");
                     return;
                 }
 
+                var entityTarget = GetEntity(netTarget);
+
                 var targetWorldPos = _transformSystem.GetWorldPosition(entityTarget);
                 _rotateToFaceSystem.TryFaceCoordinates(user, targetWorldPos);
 
@@ -344,18 +350,19 @@ public abstract class SharedActionsSystem : EntitySystem
                 if (entityAction.Event != null)
                 {
                     entityAction.Event.Target = entityTarget;
-                    Dirty(ev.Action, entityAction);
+                    Dirty(actionEnt, entityAction);
                     performEvent = entityAction.Event;
                 }
 
                 break;
             case WorldTargetActionComponent worldAction:
-                if (ev.EntityCoordinatesTarget is not { } entityCoordinatesTarget)
+                if (ev.EntityCoordinatesTarget is not { } netCoordinatesTarget)
                 {
                     Log.Error($"Attempted to perform a world-targeted action without a target! Action: {name}");
                     return;
                 }
 
+                var entityCoordinatesTarget = GetCoordinates(netCoordinatesTarget);
                 _rotateToFaceSystem.TryFaceCoordinates(user, entityCoordinatesTarget.Position);
 
                 if (!ValidateWorldTarget(user, entityCoordinatesTarget, worldAction))
@@ -375,7 +382,7 @@ public abstract class SharedActionsSystem : EntitySystem
                 if (worldAction.Event != null)
                 {
                     worldAction.Event.Target = entityCoordinatesTarget;
-                    Dirty(ev.Action, worldAction);
+                    Dirty(actionEnt, worldAction);
                     performEvent = worldAction.Event;
                 }
 
@@ -403,7 +410,7 @@ public abstract class SharedActionsSystem : EntitySystem
             performEvent.Performer = user;
 
         // All checks passed. Perform the action!
-        PerformAction(user, component, ev.Action, action, performEvent, curTime);
+        PerformAction(user, component, actionEnt, action, performEvent, curTime);
     }
 
     public bool ValidateEntityTarget(EntityUid user, EntityUid target, EntityTargetActionComponent action)
@@ -477,11 +484,12 @@ public abstract class SharedActionsSystem : EntitySystem
         {
             // This here is required because of client-side prediction (RaisePredictiveEvent results in event re-use).
             actionEvent.Handled = false;
+            var provider = action.Provider;
 
-            if (action.Provider == null)
+            if (provider == null)
                 RaiseLocalEvent(performer, (object) actionEvent, broadcast: true);
             else
-                RaiseLocalEvent(action.Provider.Value, (object) actionEvent, broadcast: true);
+                RaiseLocalEvent(provider.Value, (object) actionEvent, broadcast: true);
 
             handled = actionEvent.Handled;
         }
@@ -550,7 +558,7 @@ public abstract class SharedActionsSystem : EntitySystem
     /// <param name="holder">Component of <see cref="holderId"/></param>
     /// <param name="action">Component of <see cref="actionId"/></param>
     /// <param name="actionContainer">Action container of <see cref="holderId"/></param>
-    public virtual void AddAction(EntityUid holderId, EntityUid actionId, EntityUid? provider, ActionsComponent? holder = null, BaseActionComponent? action = null, bool dirty = true, IContainer? actionContainer = null)
+    public virtual void AddAction(EntityUid holderId, EntityUid actionId, EntityUid? provider, ActionsComponent? holder = null, BaseActionComponent? action = null, bool dirty = true, BaseContainer? actionContainer = null)
     {
         action ??= GetActionData(actionId);
         // TODO remove when action subscriptions are split up
@@ -572,7 +580,7 @@ public abstract class SharedActionsSystem : EntitySystem
             Dirty(holderId, holder);
     }
 
-    protected virtual void AddActionInternal(EntityUid holderId, EntityUid actionId, IContainer container, ActionsComponent holder)
+    protected virtual void AddActionInternal(EntityUid holderId, EntityUid actionId, BaseContainer container, ActionsComponent holder)
     {
         container.Insert(actionId);
         holder.Actions.Add(actionId);
index f2ee34f530ddb7b8b081577bca99c057b7581c0d..4974b4478dbffe2e389e0fcc38e5c23d9c792539 100644 (file)
@@ -19,7 +19,7 @@ public sealed partial class WorldTargetActionComponent : BaseTargetActionCompone
 [Serializable, NetSerializable]
 public sealed class WorldTargetActionComponentState : BaseActionComponentState
 {
-    public WorldTargetActionComponentState(WorldTargetActionComponent component) : base(component)
+    public WorldTargetActionComponentState(WorldTargetActionComponent component, IEntityManager entManager) : base(component, entManager)
     {
     }
 }
index 218202ff3de3053e0875cad99385b1d673ec00fe..782c4b84f2fbb0489f9889db3741af2b1eb429f4 100644 (file)
@@ -7,10 +7,10 @@ namespace Content.Shared.Administration
     [Serializable, NetSerializable]
     public sealed class EditSolutionsEuiState : EuiStateBase
     {
-        public readonly EntityUid Target;
+        public readonly NetEntity Target;
         public readonly Dictionary<string, Solution>? Solutions;
 
-        public EditSolutionsEuiState(EntityUid target, Dictionary<string, Solution>? solutions)
+        public EditSolutionsEuiState(NetEntity target, Dictionary<string, Solution>? solutions)
         {
             Target = target;
             Solutions = solutions;
index d6b3f0c0dcab1441052bfbe3d8cbbda7c62bdcc2..bc1195dc47d6e136ace0e96ae1a1eeff0ec3df13 100644 (file)
@@ -10,7 +10,7 @@ namespace Content.Shared.Administration
         string IdentityName,
         string StartingJob,
         bool Antag,
-        EntityUid? EntityUid,
+        NetEntity? NetEntity,
         NetUserId SessionId,
         bool Connected,
         bool ActiveThisRound);
index 495543509eabe3ee207c7a9fa8eb6b6e0670c919..f1b4837859e8c11cd379c023cdbe3b593133db35 100644 (file)
@@ -6,6 +6,6 @@ namespace Content.Shared.Administration
     [Serializable, NetSerializable]
     public sealed class SetOutfitEuiState : EuiStateBase
     {
-        public EntityUid TargetEntityId;
+        public NetEntity TargetNetEntity;
     }
 }
index 852b6c6a7a8073a31c064af37c7c90aa51e21096..51ae8cc7406e1320c94136c6c13dfb749f7661ab 100644 (file)
@@ -32,11 +32,11 @@ public sealed partial class GasAnalyzerComponent : Component
     public sealed class GasAnalyzerUserMessage : BoundUserInterfaceMessage
     {
         public string DeviceName;
-        public EntityUid DeviceUid;
+        public NetEntity DeviceUid;
         public bool DeviceFlipped;
         public string? Error;
         public GasMixEntry[] NodeGasMixes;
-        public GasAnalyzerUserMessage(GasMixEntry[] nodeGasMixes, string deviceName, EntityUid deviceUid, bool deviceFlipped, string? error = null)
+        public GasAnalyzerUserMessage(GasMixEntry[] nodeGasMixes, string deviceName, NetEntity deviceUid, bool deviceFlipped, string? error = null)
         {
             NodeGasMixes = nodeGasMixes;
             DeviceName = deviceName;
index 4abdc2131f0ac7c6a4fef60fd297cd7cf90796ab..d52c6a4ae7d5b013308cca3a6653435c77a040a1 100644 (file)
@@ -39,13 +39,13 @@ namespace Content.Shared.Atmos.EntitySystems
         [Serializable, NetSerializable]
         public sealed class AtmosDebugOverlayMessage : EntityEventArgs
         {
-            public EntityUid GridId { get; }
+            public NetEntity GridId { get; }
 
             public Vector2i BaseIdx { get; }
             // LocalViewRange*LocalViewRange
             public AtmosDebugOverlayData[] OverlayData { get; }
 
-            public AtmosDebugOverlayMessage(EntityUid gridIndices, Vector2i baseIdx, AtmosDebugOverlayData[] overlayData)
+            public AtmosDebugOverlayMessage(NetEntity gridIndices, Vector2i baseIdx, AtmosDebugOverlayData[] overlayData)
             {
                 GridId = gridIndices;
                 BaseIdx = baseIdx;
index b4722fb53f34fccffebb6b93775af091c4b29d31..eb0079eb358e60e03f12ed3559774882ad2e4528 100644 (file)
@@ -103,8 +103,8 @@ namespace Content.Shared.Atmos.EntitySystems
         [Serializable, NetSerializable]
         public sealed class GasOverlayUpdateEvent : EntityEventArgs
         {
-            public Dictionary<EntityUid, List<GasOverlayChunk>> UpdatedChunks = new();
-            public Dictionary<EntityUid, HashSet<Vector2i>> RemovedChunks = new();
+            public Dictionary<NetEntity, List<GasOverlayChunk>> UpdatedChunks = new();
+            public Dictionary<NetEntity, HashSet<Vector2i>> RemovedChunks = new();
         }
     }
 }
index 7cd5da16109cba545867ed8703a22c2064bd8d48..9c5c5dd344844d8150a90067aea4b6c7dd087378 100644 (file)
@@ -97,13 +97,13 @@ public sealed class BeamFiredEvent : EntityEventArgs
 [Serializable, NetSerializable]
 public sealed class BeamVisualizerEvent : EntityEventArgs
 {
-    public readonly EntityUid Beam;
+    public readonly NetEntity Beam;
     public readonly float DistanceLength;
     public readonly Angle UserAngle;
     public readonly string? BodyState;
     public readonly string Shader = "unshaded";
 
-    public BeamVisualizerEvent(EntityUid beam, float distanceLength, Angle userAngle, string? bodyState = null, string shader = "unshaded")
+    public BeamVisualizerEvent(NetEntity beam, float distanceLength, Angle userAngle, string? bodyState = null, string shader = "unshaded")
     {
         Beam = beam;
         DistanceLength = distanceLength;
index 821c2c2e5bd5fe61d5ee3d8e970c738e6dee7789..6ca323fd130528a67b08596fc5a6f6d1ac85accf 100644 (file)
@@ -5,10 +5,10 @@ namespace Content.Shared.Body.Organ;
 [Serializable, NetSerializable]
 public sealed class OrganComponentState : ComponentState
 {
-    public readonly EntityUid? Body;
+    public readonly NetEntity? Body;
     public readonly OrganSlot? Parent;
 
-    public OrganComponentState(EntityUid? body, OrganSlot? parent)
+    public OrganComponentState(NetEntity? body, OrganSlot? parent)
     {
         Body = body;
         Parent = parent;
index 924e4f8aaf847f79d6491d6266a92d55f8a86662..e67c9852bc1de6be72dc894dcc223809fbdd4cf1 100644 (file)
@@ -5,10 +5,23 @@ namespace Content.Shared.Body.Organ;
 
 [Serializable, NetSerializable]
 [Access(typeof(SharedBodySystem))]
-[DataRecord]
-public sealed record OrganSlot(string Id, EntityUid Parent)
+[DataDefinition]
+public sealed partial record OrganSlot
 {
-    public EntityUid? Child { get; set; }
+    [DataField("id")]
+    public string Id = string.Empty;
+
+    [NonSerialized]
+    [DataField("parent")]
+    public EntityUid Parent;
+
+    public NetEntity NetParent;
+
+    [NonSerialized]
+    [DataField("child")]
+    public EntityUid? Child;
+
+    public NetEntity? NetChild;
 
     // Rider doesn't suggest explicit properties during deconstruction without this
     public void Deconstruct(out EntityUid? child, out string id, out EntityUid parent)
index bd3cf55efde601b14594da8577716be2ec01c6c9..e50ecdda1250a314c087c0a4140511835ccc6b5f 100644 (file)
@@ -6,7 +6,7 @@ namespace Content.Shared.Body.Part;
 [Serializable, NetSerializable]
 public sealed class BodyPartComponentState : ComponentState
 {
-    public readonly EntityUid? Body;
+    public readonly NetEntity? Body;
     public readonly BodyPartSlot? ParentSlot;
     public readonly Dictionary<string, BodyPartSlot> Children;
     public readonly Dictionary<string, OrganSlot> Organs;
@@ -15,7 +15,7 @@ public sealed class BodyPartComponentState : ComponentState
     public readonly BodyPartSymmetry Symmetry;
 
     public BodyPartComponentState(
-        EntityUid? body,
+        NetEntity? body,
         BodyPartSlot? parentSlot,
         Dictionary<string, BodyPartSlot> children,
         Dictionary<string, OrganSlot> organs,
index da80a6d83271c80dab23a839d39014d7f1c5dcf7..8f6348ce33a4501ece94bb3090ecacbdcb3c0f53 100644 (file)
@@ -5,10 +5,32 @@ namespace Content.Shared.Body.Part;
 
 [Serializable, NetSerializable]
 [Access(typeof(SharedBodySystem))]
-[DataRecord]
-public sealed record BodyPartSlot(string Id, EntityUid Parent, BodyPartType? Type)
+[DataDefinition]
+public sealed partial record BodyPartSlot
 {
-    public EntityUid? Child { get; set; }
+    [DataField("id")]
+    public string Id = string.Empty;
+
+    [DataField("type")]
+    public BodyPartType? Type;
+
+    [NonSerialized]
+    [DataField("parent")]
+    public EntityUid Parent;
+
+    public NetEntity NetParent;
+
+    [NonSerialized]
+    [DataField("child")]
+    public EntityUid? Child;
+
+    public NetEntity? NetChild;
+
+    public void SetChild(EntityUid? child, NetEntity? netChild)
+    {
+        Child = child;
+        NetChild = netChild;
+    }
 
     // Rider doesn't suggest explicit properties during deconstruction without this
     public void Deconstruct(out EntityUid? child, out string id, out EntityUid parent, out BodyPartType? type)
index 151f287cdb4581f3ac53ec487d825d89ccf5ebcc..9519faf0f1ee1b58a68061e02fc5542ee5dedeec 100644 (file)
@@ -38,7 +38,7 @@ public partial class SharedBodySystem
 
         var prototype = Prototypes.Index<BodyPrototype>(body.Prototype);
 
-        if (!_netManager.IsClient || bodyId.IsClientSide())
+        if (!_netManager.IsClient || IsClientSide(bodyId))
             InitBody(body, prototype);
 
         Dirty(body); // Client doesn't actually spawn the body, need to sync it
@@ -72,7 +72,12 @@ public partial class SharedBodySystem
             body.Root != null)
             return false;
 
-        slot = new BodyPartSlot(slotId, bodyId.Value, null);
+        slot = new BodyPartSlot
+        {
+            Id = slotId,
+            Parent = bodyId.Value,
+            NetParent = GetNetEntity(bodyId.Value),
+        };
         body.Root = slot;
 
         return true;
@@ -86,7 +91,13 @@ public partial class SharedBodySystem
             return;
         var bodyId = Spawn(root.Part, body.Owner.ToCoordinates());
         var partComponent = Comp<BodyPartComponent>(bodyId);
-        var slot = new BodyPartSlot(root.Part, body.Owner, partComponent.PartType);
+        var slot = new BodyPartSlot
+        {
+            Id = root.Part,
+            Type = partComponent.PartType,
+            Parent = body.Owner,
+            NetParent = GetNetEntity(body.Owner),
+        };
         body.Root = slot;
         partComponent.Body = bodyId;
 
index dbfadc6a0fecd5aca02f245cb00ff8d7fb4fa514..57fea15ba4481fcabafa94ad962ea940e3f2cd1f 100644 (file)
@@ -12,6 +12,8 @@ namespace Content.Shared.Body.Systems;
 
 public partial class SharedBodySystem
 {
+    [Dependency] private readonly SharedContainerSystem _container = default!;
+
     private void InitializeOrgans()
     {
         SubscribeLocalEvent<OrganComponent, ComponentGetState>(OnOrganGetState);
@@ -23,7 +25,12 @@ public partial class SharedBodySystem
         if (!Resolve(parent, ref part, false))
             return null;
 
-        var slot = new OrganSlot(slotId, parent);
+        var slot = new OrganSlot()
+        {
+            Id = slotId,
+            Parent = parent,
+            NetParent = GetNetEntity(parent),
+        };
         part.Organs.Add(slotId, slot);
 
         return slot;
@@ -35,12 +42,12 @@ public partial class SharedBodySystem
                slot.Child == null &&
                Resolve(organId.Value, ref organ, false) &&
                Containers.TryGetContainer(slot.Parent, BodyContainerId, out var container) &&
-               container.CanInsert(organId.Value);
+               _container.CanInsert(organId.Value, container);
     }
 
     private void OnOrganGetState(EntityUid uid, OrganComponent organ, ref ComponentGetState args)
     {
-        args.State = new OrganComponentState(organ.Body, organ.ParentSlot);
+        args.State = new OrganComponentState(GetNetEntity(organ.Body), organ.ParentSlot);
     }
 
     private void OnOrganHandleState(EntityUid uid, OrganComponent organ, ref ComponentHandleState args)
@@ -48,7 +55,7 @@ public partial class SharedBodySystem
         if (args.Current is not OrganComponentState state)
             return;
 
-        organ.Body = state.Body;
+        organ.Body = EnsureEntity<OrganComponent>(state.Body, uid);
         organ.ParentSlot = state.Parent;
     }
 
index 8c55fe9cddc4e3cbafe00982b228d11b326fc220..b58a9cefd22ceb7e215e9c5a6233826b48aff2d9 100644 (file)
@@ -26,7 +26,7 @@ public partial class SharedBodySystem
     private void OnPartGetState(EntityUid uid, BodyPartComponent part, ref ComponentGetState args)
     {
         args.State = new BodyPartComponentState(
-            part.Body,
+            GetNetEntity(part.Body),
             part.ParentSlot,
             part.Children,
             part.Organs,
@@ -41,7 +41,7 @@ public partial class SharedBodySystem
         if (args.Current is not BodyPartComponentState state)
             return;
 
-        part.Body = state.Body;
+        part.Body = EnsureEntity<BodyPartComponent>(state.Body, uid);
         part.ParentSlot = state.ParentSlot; // TODO use containers. This is broken and does not work.
         part.Children = state.Children; // TODO use containers. This is broken and does not work.
         part.Organs = state.Organs; // TODO end my suffering.
@@ -54,7 +54,7 @@ public partial class SharedBodySystem
     {
         if (part.ParentSlot is { } slot)
         {
-            slot.Child = null;
+            slot.SetChild(null, GetNetEntity(null));
             DirtyAllComponents(slot.Parent);
         }
 
@@ -73,7 +73,13 @@ public partial class SharedBodySystem
         if (!Resolve(parent, ref part, false))
             return null;
 
-        var slot = new BodyPartSlot(slotId, parent, partType);
+        var slot = new BodyPartSlot
+        {
+            Id = slotId,
+            Type = partType,
+            Parent = parent,
+            NetParent = GetNetEntity(parent),
+        };
         part.Children.Add(slotId, slot);
 
         return slot;
@@ -91,7 +97,12 @@ public partial class SharedBodySystem
             !Resolve(parentId.Value, ref parent, false))
             return false;
 
-        slot = new BodyPartSlot(id, parentId.Value, null);
+        slot = new BodyPartSlot
+        {
+            Id = id,
+            Parent = parentId.Value,
+            NetParent = GetNetEntity(parentId.Value),
+        };
         if (!parent.Children.TryAdd(id, slot))
         {
             slot = null;
@@ -171,7 +182,7 @@ public partial class SharedBodySystem
                Resolve(partId.Value, ref part, false) &&
                (slot.Type == null || slot.Type == part.PartType) &&
                Containers.TryGetContainer(slot.Parent, BodyContainerId, out var container) &&
-               container.CanInsert(partId.Value);
+               _container.CanInsert(partId.Value, container);
     }
 
     public virtual bool AttachPart(
@@ -191,7 +202,7 @@ public partial class SharedBodySystem
         if (!container.Insert(partId.Value))
             return false;
 
-        slot.Child = partId;
+        slot.SetChild(partId, GetNetEntity(partId));
         part.ParentSlot = slot;
 
         if (TryComp(slot.Parent, out BodyPartComponent? parentPart))
@@ -241,7 +252,7 @@ public partial class SharedBodySystem
 
         var oldBodyNullable = part.Body;
 
-        slot.Child = null;
+        slot.SetChild(null, null);
         part.ParentSlot = null;
         part.Body = null;
 
index 95058546144a9a07e4d1558b6017524634788432..64595f6ecf40f0cf18aef336915210daaa00e942 100644 (file)
@@ -6,9 +6,9 @@ namespace Content.Shared.Bql;
 [Serializable, NetSerializable]
 public sealed class ToolshedVisualizeEuiState : EuiStateBase
 {
-    public readonly (string name, EntityUid entity)[] Entities;
+    public readonly (string name, NetEntity entity)[] Entities;
 
-    public ToolshedVisualizeEuiState((string name, EntityUid entity)[] entities)
+    public ToolshedVisualizeEuiState((string name, NetEntity entity)[] entities)
     {
         Entities = entities;
     }
index f477f646e2eed0fc06aa1fce60e3dc5cd28b9d27..8f44c7fead3718edd376a5073821c5ac202bc39c 100644 (file)
@@ -78,7 +78,7 @@ public sealed partial class BuckleComponent : Component
 [Serializable, NetSerializable]
 public sealed class BuckleComponentState : ComponentState
 {
-    public BuckleComponentState(bool buckled, EntityUid? buckledTo, EntityUid? lastEntityBuckledTo,
+    public BuckleComponentState(bool buckled, NetEntity? buckledTo, NetEntity? lastEntityBuckledTo,
         bool dontCollide)
     {
         Buckled = buckled;
@@ -88,8 +88,8 @@ public sealed class BuckleComponentState : ComponentState
     }
 
     public readonly bool Buckled;
-    public readonly EntityUid? BuckledTo;
-    public  readonly EntityUid? LastEntityBuckledTo;
+    public readonly NetEntity? BuckledTo;
+    public readonly NetEntity? LastEntityBuckledTo;
     public readonly bool DontCollide;
 }
 
index 3ffbe86c3b9076918199b1784efec62523b1c1cb..8cb11ddd4358b05d1ed1e6115796996856439778 100644 (file)
@@ -125,10 +125,10 @@ public sealed class StrapComponentState : ComponentState
     public readonly StrapPosition Position;
     public readonly float MaxBuckleDistance;
     public readonly Vector2 BuckleOffsetClamped;
-    public readonly HashSet<EntityUid> BuckledEntities;
+    public readonly HashSet<NetEntity> BuckledEntities;
     public readonly int OccupiedSize;
 
-    public StrapComponentState(StrapPosition position, Vector2 offset, HashSet<EntityUid> buckled,
+    public StrapComponentState(StrapPosition position, Vector2 offset, HashSet<NetEntity> buckled,
         float maxBuckleDistance, int occupiedSize)
     {
         Position = position;
index 935bd18b40e3548fa2480bf815179c5abef25cee..e4b9e4391f91ca95860db56e1c94ab63cfe2a307 100644 (file)
@@ -59,7 +59,7 @@ public abstract partial class SharedBuckleSystem
 
     private void OnBuckleComponentGetState(EntityUid uid, BuckleComponent component, ref ComponentGetState args)
     {
-        args.State = new BuckleComponentState(component.Buckled, component.BuckledTo, component.LastEntityBuckledTo, component.DontCollide);
+        args.State = new BuckleComponentState(component.Buckled, GetNetEntity(component.BuckledTo), GetNetEntity(component.LastEntityBuckledTo), component.DontCollide);
     }
 
     private void OnBuckleMove(EntityUid uid, BuckleComponent component, ref MoveEvent ev)
index 1549129dc0d6d2401570bdc7a3de03e465cd0508..423a829809d2c3eca3c16b32c865d99febf898a1 100644 (file)
@@ -52,7 +52,7 @@ public abstract partial class SharedBuckleSystem
 
     private void OnStrapGetState(EntityUid uid, StrapComponent component, ref ComponentGetState args)
     {
-        args.State = new StrapComponentState(component.Position, component.BuckleOffset, component.BuckledEntities, component.MaxBuckleDistance, component.OccupiedSize);
+        args.State = new StrapComponentState(component.Position, component.BuckleOffset, GetNetEntitySet(component.BuckledEntities), component.MaxBuckleDistance, component.OccupiedSize);
     }
 
     private void OnStrapHandleState(EntityUid uid, StrapComponent component, ref ComponentHandleState args)
@@ -63,7 +63,7 @@ public abstract partial class SharedBuckleSystem
         component.Position = state.Position;
         component.BuckleOffsetUnclamped = state.BuckleOffsetClamped;
         component.BuckledEntities.Clear();
-        component.BuckledEntities.UnionWith(state.BuckledEntities);
+        component.BuckledEntities.UnionWith(EnsureEntitySet<StrapComponent>(state.BuckledEntities, uid));
         component.MaxBuckleDistance = state.MaxBuckleDistance;
         component.OccupiedSize = state.OccupiedSize;
     }
index 3a5fe372e240b846150963e019dd1499db2425f2..ec57524c050ab08703fd816342dc283f97f9d68a 100644 (file)
@@ -82,12 +82,12 @@ public abstract class SharedCameraRecoilSystem : EntitySystem
 [NetSerializable]
 public sealed class CameraKickEvent : EntityEventArgs
 {
-    public readonly EntityUid Euid;
+    public readonly NetEntity NetEntity;
     public readonly Vector2 Recoil;
 
-    public CameraKickEvent(EntityUid euid, Vector2 recoil)
+    public CameraKickEvent(NetEntity netEntity, Vector2 recoil)
     {
         Recoil = recoil;
-        Euid = euid;
+        NetEntity = netEntity;
     }
 }
index fb663af720ea3d9f3cdccfefca3ae26775762341..0e607f50769c1df9359fbff22493957e18830c6b 100644 (file)
@@ -61,10 +61,10 @@ public sealed partial class CardboardBoxComponent : Component
 [Serializable, NetSerializable]
 public sealed class PlayBoxEffectMessage : EntityEventArgs
 {
-    public EntityUid Source;
-    public EntityUid Mover;
+    public NetEntity Source;
+    public NetEntity Mover;
 
-    public PlayBoxEffectMessage(EntityUid source, EntityUid mover)
+    public PlayBoxEffectMessage(NetEntity source, NetEntity mover)
     {
         Source = source;
         Mover = mover;
index 5a7c40f3d1084d235db3c55bd9e83a74f84962b4..5ff5fdd9a371c6356b0b64ccec109b477b305eef 100644 (file)
@@ -14,7 +14,7 @@ public sealed partial class CartridgeLoaderComponent : Component
     /// <summary>
     /// List of programs that come preinstalled with this cartridge loader
     /// </summary>
-    [DataField("preinstalled")]
+    [DataField("preinstalled")] // TODO remove this and use container fill.
     public List<string> PreinstalledPrograms = new();
 
     /// <summary>
@@ -29,12 +29,6 @@ public sealed partial class CartridgeLoaderComponent : Component
     [ViewVariables]
     public readonly List<EntityUid> BackgroundPrograms = new();
 
-    /// <summary>
-    /// The list of program entities that are spawned into the cartridge loaders program container
-    /// </summary>
-    [DataField("installedCartridges")]
-    public List<EntityUid> InstalledPrograms = new();
-
     /// <summary>
     /// The maximum amount of programs that can be installed on the cartridge loader entity
     /// </summary>
index 5f7aaec0263c51f85303296cad43bf4e8faecbe6..18c5cf9f9199da8d97e3eb93afd41c4aef62ae7f 100644 (file)
@@ -5,10 +5,10 @@ namespace Content.Shared.CartridgeLoader;
 [Serializable, NetSerializable]
 public sealed class CartridgeLoaderUiMessage : BoundUserInterfaceMessage
 {
-    public readonly EntityUid CartridgeUid;
+    public readonly NetEntity CartridgeUid;
     public readonly CartridgeUiMessageAction Action;
 
-    public CartridgeLoaderUiMessage(EntityUid cartridgeUid, CartridgeUiMessageAction action)
+    public CartridgeLoaderUiMessage(NetEntity cartridgeUid, CartridgeUiMessageAction action)
     {
         CartridgeUid = cartridgeUid;
         Action = action;
index 2e7a961c9688e78662f22e22b5c5a3eeebb7dc8e..0bc3f66a57192c1cb170f5ffd76d02244d3bb041 100644 (file)
@@ -7,6 +7,12 @@ namespace Content.Shared.CartridgeLoader;
 [Serializable, NetSerializable]
 public class CartridgeLoaderUiState : BoundUserInterfaceState
 {
-    public EntityUid? ActiveUI;
-    public List<EntityUid> Programs = new();
+    public NetEntity? ActiveUI;
+    public List<NetEntity> Programs;
+
+    public CartridgeLoaderUiState(List<NetEntity> programs, NetEntity? activeUI)
+    {
+        Programs = programs;
+        ActiveUI = activeUI;
+    }
 }
index 537fa1c92198a6a081cf75e94d34cdd29e87ab24..1155030f93882dd3c520848dae1ecca5dad1d947 100644 (file)
@@ -16,5 +16,5 @@ public sealed class CartridgeUiMessage : BoundUserInterfaceMessage
 [Serializable, NetSerializable]
 public abstract class CartridgeMessageEvent : EntityEventArgs
 {
-    public EntityUid LoaderUid;
+    public NetEntity LoaderUid;
 }
index c71dd0fff0c2794eec5a5d260d81a9fee99e27d7..52c86936ec3b3390e7e17386ff3ccc85caa50b9d 100644 (file)
@@ -5,7 +5,7 @@ namespace Content.Shared.CartridgeLoader.Cartridges;
 [Serializable, NetSerializable]
 public sealed class NotekeeperUiState : BoundUserInterfaceState
 {
-    public List<String> Notes;
+    public List<string> Notes;
 
     public NotekeeperUiState(List<string> notes)
     {
index 0bd7c5ec16a77924e547b0b90f04b0ae68bdbd0b..15d29689b840b063b493009d7f72ede4f0d16fab 100644 (file)
@@ -2,13 +2,18 @@
 using Robust.Shared.Containers;
 using Robust.Shared.GameStates;
 using Robust.Shared.Map;
+using Robust.Shared.Network;
 
 namespace Content.Shared.CartridgeLoader;
 
 public abstract class SharedCartridgeLoaderSystem : EntitySystem
 {
+    public const string InstalledContainerId = "program-container";
+
     [Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
     [Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
+    [Dependency] private readonly SharedContainerSystem _container = default!;
+    [Dependency] private readonly INetManager _netMan = default!;
 
     public override void Initialize()
     {
@@ -36,11 +41,8 @@ public abstract class SharedCartridgeLoaderSystem : EntitySystem
     private void OnComponentRemove(EntityUid uid, CartridgeLoaderComponent loader, ComponentRemove args)
     {
         _itemSlotsSystem.RemoveItemSlot(uid, loader.CartridgeSlot);
-
-        foreach (var program in loader.InstalledPrograms)
-        {
-               EntityManager.QueueDeleteEntity(program);
-        }
+        if (_container.TryGetContainer(uid, InstalledContainerId, out var cont))
+            cont.Shutdown(EntityManager, _netMan);
     }
 
     protected virtual void OnItemInserted(EntityUid uid, CartridgeLoaderComponent loader, EntInsertedIntoContainerMessage args)
index 89b55e54fa04fdd97602a20889e8bb49440bdd23..b330af2629936e57b54771acd9e1d0ac2d2122f5 100644 (file)
@@ -6,25 +6,25 @@ namespace Content.Shared.CharacterInfo;
 [Serializable, NetSerializable]
 public sealed class RequestCharacterInfoEvent : EntityEventArgs
 {
-    public readonly EntityUid EntityUid;
+    public readonly NetEntity NetEntity;
 
-    public RequestCharacterInfoEvent(EntityUid entityUid)
+    public RequestCharacterInfoEvent(NetEntity netEntity)
     {
-        EntityUid = entityUid;
+        NetEntity = netEntity;
     }
 }
 
 [Serializable, NetSerializable]
 public sealed class CharacterInfoEvent : EntityEventArgs
 {
-    public readonly EntityUid EntityUid;
+    public readonly NetEntity NetEntity;
     public readonly string JobTitle;
     public readonly Dictionary<string, List<ConditionInfo>> Objectives;
     public readonly string? Briefing;
 
-    public CharacterInfoEvent(EntityUid entityUid, string jobTitle, Dictionary<string, List<ConditionInfo>> objectives, string? briefing)
+    public CharacterInfoEvent(NetEntity netEntity, string jobTitle, Dictionary<string, List<ConditionInfo>> objectives, string? briefing)
     {
-        EntityUid = entityUid;
+        NetEntity = netEntity;
         JobTitle = jobTitle;
         Objectives = objectives;
         Briefing = briefing;
index fee886b023e6d64c3c120f7c2d3bf99b37660431..27ab203d6e8e1e97e9bca7db16cb047e306135fe 100644 (file)
@@ -13,7 +13,7 @@ namespace Content.Shared.Chat
         public ChatChannel Channel;
         public string Message;
         public string WrappedMessage;
-        public EntityUid SenderEntity;
+        public NetEntity SenderEntity;
         public bool HideChat;
         public Color? MessageColorOverride;
         public string? AudioPath;
@@ -22,7 +22,7 @@ namespace Content.Shared.Chat
         [NonSerialized]
         public bool Read;
 
-        public ChatMessage(ChatChannel channel, string message, string wrappedMessage, EntityUid source, bool hideChat = false, Color? colorOverride = null, string? audioPath = null, float audioVolume = 0)
+        public ChatMessage(ChatChannel channel, string message, string wrappedMessage, NetEntity source, bool hideChat = false, Color? colorOverride = null, string? audioPath = null, float audioVolume = 0)
         {
             Channel = channel;
             Message = message;
index 25f3d7e33caf79604c9fd0fd5925976ba325255d..eda392fa31f5c9359186eefbcc969be85196661a 100644 (file)
@@ -76,7 +76,7 @@ public sealed partial class BonkSystem : EntitySystem
         if (args.Handled || !HasComp<ClumsyComponent>(args.Dragged))
             return;
 
-        var doAfterArgs = new DoAfterArgs(args.Dragged, component.BonkDelay, new BonkDoAfterEvent(), uid, target: uid)
+        var doAfterArgs = new DoAfterArgs(EntityManager, args.Dragged, component.BonkDelay, new BonkDoAfterEvent(), uid, target: uid)
         {
             BreakOnTargetMove = true,
             BreakOnUserMove = true,
index ae143e1f904ec43a48d7aeb7cc7ec52d94930e17..53f7284bbefcb90c17be968325f6196411a822be 100644 (file)
@@ -93,7 +93,7 @@ public sealed class ToggleableClothingSystem : EntitySystem
 
         var (time, stealth) = _strippable.GetStripTimeModifiers(user, wearer, (float) component.StripDelay.Value.TotalSeconds);
 
-        var args = new DoAfterArgs(user, time, new ToggleClothingDoAfterEvent(), item, wearer, item)
+        var args = new DoAfterArgs(EntityManager, user, time, new ToggleClothingDoAfterEvent(), item, wearer, item)
         {
             BreakOnDamage = true,
             BreakOnTargetMove = true,
index f231407ff4b063286bfc1f1bbb38d7cf92539134..12f2c198a3acd9b82ca27f62ad21f2a97e34df21 100644 (file)
@@ -15,7 +15,7 @@ public sealed class TryStartStructureConstructionMessage : EntityEventArgs
     /// <summary>
     ///     Position to start building.
     /// </summary>
-    public readonly EntityCoordinates Location;
+    public readonly NetCoordinates Location;
 
     /// <summary>
     ///     The construction prototype to start building.
@@ -27,9 +27,13 @@ public sealed class TryStartStructureConstructionMessage : EntityEventArgs
     /// <summary>
     ///     Identifier to be sent back in the acknowledgement so that the client can clean up its ghost.
     /// </summary>
+    /// <remarks>
+    /// So essentially the client is sending its own entity to the server so it knows to delete it when it gets server
+    /// response back.
+    /// </remarks>
     public readonly int Ack;
 
-    public TryStartStructureConstructionMessage(EntityCoordinates loc, string prototypeName, Angle angle, int ack)
+    public TryStartStructureConstructionMessage(NetCoordinates loc, string prototypeName, Angle angle, int ack)
     {
         Location = loc;
         PrototypeName = prototypeName;
@@ -67,9 +71,9 @@ public sealed class AckStructureConstructionMessage : EntityEventArgs
     /// <summary>
     ///     The entity that is now being constructed, if any.
     /// </summary>
-    public readonly EntityUid? Uid;
+    public readonly NetEntity? Uid;
 
-    public AckStructureConstructionMessage(int ghostId, EntityUid? uid = null)
+    public AckStructureConstructionMessage(int ghostId, NetEntity? uid = null)
     {
         GhostId = ghostId;
         Uid = uid;
@@ -110,15 +114,15 @@ public sealed class ResponseConstructionGuide : EntityEventArgs
 public sealed partial class ConstructionInteractDoAfterEvent : DoAfterEvent
 {
     [DataField("clickLocation")]
-    public EntityCoordinates ClickLocation;
+    public NetCoordinates ClickLocation;
 
     private ConstructionInteractDoAfterEvent()
     {
     }
 
-    public ConstructionInteractDoAfterEvent(InteractUsingEvent ev)
+    public ConstructionInteractDoAfterEvent(IEntityManager entManager, InteractUsingEvent ev)
     {
-        ClickLocation = ev.ClickLocation;
+        ClickLocation = entManager.GetNetCoordinates(ev.ClickLocation);
     }
 
     public override DoAfterEvent Clone() => this;
index 1d491a01bad3007b83f6249891d69d24b24ea2f6..cb92892305c4ea0aef0ad7a6e1913d3ef5ead3f2 100644 (file)
@@ -246,6 +246,9 @@ namespace Content.Shared.Containers.ItemSlots
         /// </remarks>
         public bool CanInsert(EntityUid uid, EntityUid usedUid, EntityUid? user, ItemSlot slot, bool swap = false, EntityUid? popup = null)
         {
+            if (slot.ContainerSlot == null)
+                return false;
+
             if (slot.Locked)
                 return false;
 
@@ -265,7 +268,7 @@ namespace Content.Shared.Containers.ItemSlots
             if (ev.Cancelled)
                 return false;
 
-            return slot.ContainerSlot?.CanInsertIfEmpty(usedUid, EntityManager) ?? false;
+            return _containers.CanInsert(usedUid, slot.ContainerSlot, assumeEmpty: true);
         }
 
         /// <summary>
@@ -325,16 +328,16 @@ namespace Content.Shared.Containers.ItemSlots
 
         public bool CanEject(EntityUid uid, EntityUid? user, ItemSlot slot)
         {
-            if (slot.Locked || slot.Item == null)
+            if (slot.Locked || slot.ContainerSlot?.ContainedEntity is not {} item)
                 return false;
 
-            var ev = new ItemSlotEjectAttemptEvent(uid, slot.Item.Value, user, slot);
+            var ev = new ItemSlotEjectAttemptEvent(uid, item, user, slot);
             RaiseLocalEvent(uid, ref ev);
-            RaiseLocalEvent(slot.Item.Value, ref ev);
+            RaiseLocalEvent(item, ref ev);
             if (ev.Cancelled)
                 return false;
 
-            return slot.ContainerSlot?.CanRemove(slot.Item.Value, EntityManager) ?? false;
+            return _containers.CanRemove(item, slot.ContainerSlot);
         }
 
         /// <summary>
@@ -435,11 +438,13 @@ namespace Content.Shared.Containers.ItemSlots
 
                     var verbSubject = slot.Name != string.Empty
                         ? Loc.GetString(slot.Name)
-                        : Name(args.Using.Value) ?? string.Empty;
+                        : Name(args.Using.Value);
 
-                    AlternativeVerb verb = new();
-                    verb.IconEntity = args.Using;
-                    verb.Act = () => Insert(uid, slot, args.Using.Value, args.User, excludeUserAudio: true);
+                    AlternativeVerb verb = new()
+                    {
+                        IconEntity = GetNetEntity(args.Using),
+                        Act = () => Insert(uid, slot, args.Using.Value, args.User, excludeUserAudio: true)
+                    };
 
                     if (slot.InsertVerbText != null)
                     {
@@ -491,7 +496,7 @@ namespace Content.Shared.Containers.ItemSlots
 
                 AlternativeVerb verb = new()
                 {
-                    IconEntity = slot.Item,
+                    IconEntity = GetNetEntity(slot.Item),
                     Act = () => TryEjectToHands(uid, slot, args.User, excludeUserAudio: true)
                 };
 
@@ -528,9 +533,11 @@ namespace Content.Shared.Containers.ItemSlots
                     ? Loc.GetString(slot.Name)
                     : Name(slot.Item!.Value);
 
-                InteractionVerb takeVerb = new();
-                takeVerb.IconEntity = slot.Item;
-                takeVerb.Act = () => TryEjectToHands(uid, slot, args.User, excludeUserAudio: true);
+                InteractionVerb takeVerb = new()
+                {
+                    IconEntity = GetNetEntity(slot.Item),
+                    Act = () => TryEjectToHands(uid, slot, args.User, excludeUserAudio: true)
+                };
 
                 if (slot.EjectVerbText == null)
                     takeVerb.Text = Loc.GetString("take-item-verb-text", ("subject", verbSubject));
@@ -556,7 +563,7 @@ namespace Content.Shared.Containers.ItemSlots
 
                 InteractionVerb insertVerb = new()
                 {
-                    IconEntity = args.Using,
+                    IconEntity = GetNetEntity(args.Using),
                     Act = () => Insert(uid, slot, args.Using.Value, args.User, excludeUserAudio: true)
                 };
 
index 0f174175fcd82526af94b117a66078c0c1ffad86..7e4c824e205ebd19f80d1fd2592a3696c65b06be 100644 (file)
@@ -11,9 +11,9 @@ namespace Content.Shared.CrewManifest;
 [Serializable, NetSerializable]
 public sealed class RequestCrewManifestMessage : EntityEventArgs
 {
-    public EntityUid Id { get; }
+    public NetEntity Id { get; }
 
-    public RequestCrewManifestMessage(EntityUid id)
+    public RequestCrewManifestMessage(NetEntity id)
     {
         Id = id;
     }
index e2f4eafad9e08772448548d62178d5800d0b8cb9..9294083a44441f5ad83e7f7f5dcb86025e484cc2 100644 (file)
@@ -479,7 +479,7 @@ namespace Content.Shared.Cuffs
             if (HasComp<DisarmProneComponent>(target))
                 cuffTime = 0.0f; // cuff them instantly.
 
-            var doAfterEventArgs = new DoAfterArgs(user, cuffTime, new AddCuffDoAfterEvent(), handcuff, target, handcuff)
+            var doAfterEventArgs = new DoAfterArgs(EntityManager, user, cuffTime, new AddCuffDoAfterEvent(), handcuff, target, handcuff)
             {
                 BreakOnTargetMove = true,
                 BreakOnUserMove = true,
@@ -566,7 +566,7 @@ namespace Content.Shared.Cuffs
             }
 
             var uncuffTime = isOwner ? cuff.BreakoutTime : cuff.UncuffTime;
-            var doAfterEventArgs = new DoAfterArgs(user, uncuffTime, new UnCuffDoAfterEvent(), target, target, cuffsToRemove)
+            var doAfterEventArgs = new DoAfterArgs(EntityManager, user, uncuffTime, new UnCuffDoAfterEvent(), target, target, cuffsToRemove)
             {
                 BreakOnUserMove = true,
                 BreakOnTargetMove = true,
index 74bea5333c8ca7f357e4d42fbee368f18b00cc6e..eb8ee93b95951bec35f4179ecec148cbabb7f1b1 100644 (file)
@@ -6,7 +6,7 @@ namespace Content.Shared.Decals
     [Serializable, NetSerializable]
     public sealed class DecalChunkUpdateEvent : EntityEventArgs
     {
-        public Dictionary<EntityUid, Dictionary<Vector2i, DecalChunk>> Data = new();
-        public Dictionary<EntityUid, HashSet<Vector2i>> RemovedChunks = new();
+        public Dictionary<NetEntity, Dictionary<Vector2i, DecalChunk>> Data = new();
+        public Dictionary<NetEntity, HashSet<Vector2i>> RemovedChunks = new();
     }
 }
index f22029d6e1326933875607baa351f65e3b60da50..79bf826eedbd19af4e4eb28e0d22801ce51538a3 100644 (file)
@@ -149,9 +149,9 @@ namespace Content.Shared.Decals
     public sealed class RequestDecalPlacementEvent : EntityEventArgs
     {
         public Decal Decal;
-        public EntityCoordinates Coordinates;
+        public NetCoordinates Coordinates;
 
-        public RequestDecalPlacementEvent(Decal decal, EntityCoordinates coordinates)
+        public RequestDecalPlacementEvent(Decal decal, NetCoordinates coordinates)
         {
             Decal = decal;
             Coordinates = coordinates;
@@ -161,9 +161,9 @@ namespace Content.Shared.Decals
     [Serializable, NetSerializable]
     public sealed class RequestDecalRemovalEvent : EntityEventArgs
     {
-        public EntityCoordinates Coordinates;
+        public NetCoordinates Coordinates;
 
-        public RequestDecalRemovalEvent(EntityCoordinates coordinates)
+        public RequestDecalRemovalEvent(NetCoordinates coordinates)
         {
             Coordinates = coordinates;
         }
index a85ea1b6f842706e5a8ebefd1aae67294746a240..e7fee450d124ba9d848536f4b0d7f7bc9389f230 100644 (file)
@@ -40,11 +40,11 @@ public sealed partial class DeviceListComponent : Component
 [Serializable, NetSerializable]
 public sealed class DeviceListComponentState : ComponentState
 {
-    public readonly HashSet<EntityUid> Devices;
+    public readonly HashSet<NetEntity> Devices;
     public readonly bool IsAllowList;
     public readonly bool HandleIncomingPackets;
 
-    public DeviceListComponentState(HashSet<EntityUid> devices, bool isAllowList, bool handleIncomingPackets)
+    public DeviceListComponentState(HashSet<NetEntity> devices, bool isAllowList, bool handleIncomingPackets)
     {
         Devices = devices;
         IsAllowList = isAllowList;
index 57987cd6a8233e6fb659d81da682a9825ac9d82a..910aff4a149dbc9d0773702a20f3af87aa58b901 100644 (file)
@@ -62,10 +62,10 @@ public sealed partial class NetworkConfiguratorComponent : Component
 [Serializable, NetSerializable]
 public sealed class NetworkConfiguratorComponentState : ComponentState
 {
-    public readonly EntityUid? ActiveDeviceList;
+    public readonly NetEntity? ActiveDeviceList;
     public readonly bool LinkModeActive;
 
-    public NetworkConfiguratorComponentState(EntityUid? activeDeviceList, bool linkModeActive)
+    public NetworkConfiguratorComponentState(NetEntity? activeDeviceList, bool linkModeActive)
     {
         ActiveDeviceList = activeDeviceList;
         LinkModeActive = linkModeActive;
index 2f9112d58e76cd67dbc44779348473110d425d94..c4d5d688c614ffda6dcb4a1192af8e498396bc92 100644 (file)
@@ -60,7 +60,7 @@ public abstract class SharedDeviceListSystem : EntitySystem
 
     private void GetDeviceListState(EntityUid uid, DeviceListComponent comp, ref ComponentGetState args)
     {
-        args.State = new DeviceListComponentState(comp.Devices, comp.IsAllowList, comp.HandleIncomingPackets);
+        args.State = new DeviceListComponentState(GetNetEntitySet(comp.Devices), comp.IsAllowList, comp.HandleIncomingPackets);
     }
 
     private void HandleDeviceListState(EntityUid uid, DeviceListComponent comp, ref ComponentHandleState args)
@@ -70,7 +70,7 @@ public abstract class SharedDeviceListSystem : EntitySystem
             return;
         }
 
-        comp.Devices = state.Devices;
+        comp.Devices = EnsureEntitySet<DeviceListComponent>(state.Devices, uid);
         comp.HandleIncomingPackets = state.HandleIncomingPackets;
         comp.IsAllowList = state.IsAllowList;
     }
index 716f49eb2d54ec11a3911798e98499107b0e7e17..87f77c8f0a23d8e293f1972b55ca8a5844d406a9 100644 (file)
@@ -18,7 +18,7 @@ public abstract class SharedNetworkConfiguratorSystem : EntitySystem
     private void GetNetworkConfiguratorState(EntityUid uid, NetworkConfiguratorComponent comp,
         ref ComponentGetState args)
     {
-        args.State = new NetworkConfiguratorComponentState(comp.ActiveDeviceList, comp.LinkModeActive);
+        args.State = new NetworkConfiguratorComponentState(GetNetEntity(comp.ActiveDeviceList), comp.LinkModeActive);
     }
 
     private void HandleNetworkConfiguratorState(EntityUid uid, NetworkConfiguratorComponent comp,
@@ -29,7 +29,7 @@ public abstract class SharedNetworkConfiguratorSystem : EntitySystem
             return;
         }
 
-        comp.ActiveDeviceList = state.ActiveDeviceList;
+        comp.ActiveDeviceList = EnsureEntity<NetworkConfiguratorComponent>(state.ActiveDeviceList, uid);
         comp.LinkModeActive = state.LinkModeActive;
     }
 }
index bdc198034b583631c4faf71f66c44451215b9fce..cef8ad8de14ff5aa84ca7b4115ffe98f688109a9 100644 (file)
@@ -53,7 +53,7 @@ public abstract class SharedDevourSystem : EntitySystem
                 case MobState.Critical:
                 case MobState.Dead:
 
-                    _doAfterSystem.TryStartDoAfter(new DoAfterArgs(uid, component.DevourTime, new DevourDoAfterEvent(), uid, target: target, used: uid)
+                    _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, uid, component.DevourTime, new DevourDoAfterEvent(), uid, target: target, used: uid)
                     {
                         BreakOnTargetMove = true,
                         BreakOnUserMove = true,
@@ -72,7 +72,7 @@ public abstract class SharedDevourSystem : EntitySystem
         if (component.SoundStructureDevour != null)
             _audioSystem.PlayPredicted(component.SoundStructureDevour, uid, uid, component.SoundStructureDevour.Params);
 
-        _doAfterSystem.TryStartDoAfter(new DoAfterArgs(uid, component.StructureDevourTime, new DevourDoAfterEvent(), uid, target: target, used: uid)
+        _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, uid, component.StructureDevourTime, new DevourDoAfterEvent(), uid, target: target, used: uid)
         {
             BreakOnTargetMove = true,
             BreakOnUserMove = true,
index f0c32c5ee0d9bbc21ff5a743a929a483a0f7526a..600036a8910cceec92a05dbbd1b1e5cbae578e95 100644 (file)
@@ -142,9 +142,9 @@ public abstract class SharedDisposalUnitSystem : EntitySystem
         public TimeSpan? NextFlush;
         public bool Powered;
         public bool Engaged;
-        public List<EntityUid> RecentlyEjected;
+        public List<NetEntity> RecentlyEjected;
 
-        public DisposalUnitComponentState(SoundSpecifier? flushSound, DisposalsPressureState state, TimeSpan nextPressurized, TimeSpan automaticEngageTime, TimeSpan? nextFlush, bool powered, bool engaged, List<EntityUid> recentlyEjected)
+        public DisposalUnitComponentState(SoundSpecifier? flushSound, DisposalsPressureState state, TimeSpan nextPressurized, TimeSpan automaticEngageTime, TimeSpan? nextFlush, bool powered, bool engaged, List<NetEntity> recentlyEjected)
         {
             FlushSound = flushSound;
             State = state;
index 248227c8af3439cffcf38f7df820b85ad7884aa9..d999b370b3f425024dd00aff64556d8495d76950 100644 (file)
@@ -44,9 +44,12 @@ public sealed partial class DoAfter
     /// <summary>
     ///     Position of the user relative to their parent when the do after was started.
     /// </summary>
+    [NonSerialized]
     [DataField("userPosition")]
     public EntityCoordinates UserPosition;
 
+    public NetCoordinates NetUserPosition;
+
     /// <summary>
     ///     Distance from the user to the target when the do after was started.
     /// </summary>
@@ -62,9 +65,12 @@ public sealed partial class DoAfter
     /// <summary>
     ///     If <see cref="NeedHand"/> is true, this is the entity that was in the active hand when the doafter started.
     /// </summary>
+    [NonSerialized]
     [DataField("activeItem")]
     public EntityUid? InitialItem;
 
+    public NetEntity? NetInitialItem;
+
     // cached attempt event for the sake of avoiding unnecessary reflection every time this needs to be raised.
     [NonSerialized] public object? AttemptEvent;
 
@@ -86,7 +92,7 @@ public sealed partial class DoAfter
         StartTime = startTime;
     }
 
-    public DoAfter(DoAfter other)
+    public DoAfter(IEntityManager entManager, DoAfter other)
     {
         Index = other.Index;
         Args = new(other.Args);
@@ -97,6 +103,9 @@ public sealed partial class DoAfter
         TargetDistance = other.TargetDistance;
         InitialHand = other.InitialHand;
         InitialItem = other.InitialItem;
+
+        NetUserPosition = other.NetUserPosition;
+        NetInitialItem = other.NetInitialItem;
     }
 }
 
index 7c68c8b74ae992cbc9df014a79dfba707d452f8b..c5cbc1f30286a05187b183b885635a80785d88de 100644 (file)
@@ -10,9 +10,12 @@ public sealed partial class DoAfterArgs
     /// <summary>
     ///     The entity invoking do_after
     /// </summary>
+    [NonSerialized]
     [DataField("user", required: true)]
     public EntityUid User;
 
+    public NetEntity NetUser;
+
     /// <summary>
     ///     How long does the do_after require to complete
     /// </summary>
@@ -22,15 +25,21 @@ public sealed partial class DoAfterArgs
     /// <summary>
     ///     Applicable target (if relevant)
     /// </summary>
+    [NonSerialized]
     [DataField("target")]
     public EntityUid? Target;
 
+    public NetEntity? NetTarget;
+
     /// <summary>
     ///     Entity used by the User on the Target.
     /// </summary>
+    [NonSerialized]
     [DataField("using")]
     public EntityUid? Used;
 
+    public NetEntity? NetUsed;
+
     #region Event options
     /// <summary>
     ///     The event that will get raised when the DoAfter has finished. If null, this will simply raise a <see cref="SimpleDoAfterEvent"/>
@@ -48,9 +57,12 @@ public sealed partial class DoAfterArgs
     /// <summary>
     ///     Entity which will receive the directed event. If null, no directed event will be raised.
     /// </summary>
+    [NonSerialized]
     [DataField("eventTarget")]
     public EntityUid? EventTarget;
 
+    public NetEntity? NetEventTarget;
+
     /// <summary>
     /// Should the DoAfter event broadcast? If this is false, then <see cref="EventTarget"/> should be a valid entity.
     /// </summary>
@@ -173,6 +185,7 @@ public sealed partial class DoAfterArgs
     /// <param name="target">The entity being targeted by the DoAFter. Not the same as <see cref="EventTarget"/></param>.
     /// <param name="used">The entity being used during the DoAfter. E.g., a tool</param>
     public DoAfterArgs(
+        IEntityManager entManager,
         EntityUid user,
         TimeSpan delay,
         DoAfterEvent @event,
@@ -186,6 +199,10 @@ public sealed partial class DoAfterArgs
         Used = used;
         EventTarget = eventTarget;
         Event = @event;
+
+        NetUser = entManager.GetNetEntity(User);
+        NetTarget = entManager.GetNetEntity(Target);
+        NetUsed = entManager.GetNetEntity(Used);
     }
 
     private DoAfterArgs()
@@ -202,13 +219,14 @@ public sealed partial class DoAfterArgs
     /// <param name="target">The entity being targeted by the DoAfter. Not the same as <see cref="EventTarget"/></param>.
     /// <param name="used">The entity being used during the DoAfter. E.g., a tool</param>
     public DoAfterArgs(
+        IEntityManager entManager,
         EntityUid user,
         float seconds,
         DoAfterEvent @event,
         EntityUid? eventTarget,
         EntityUid? target = null,
         EntityUid? used = null)
-        : this(user, TimeSpan.FromSeconds(seconds), @event, eventTarget, target, used)
+        : this(entManager, user, TimeSpan.FromSeconds(seconds), @event, eventTarget, target, used)
     {
     }
 
@@ -238,6 +256,12 @@ public sealed partial class DoAfterArgs
         CancelDuplicate = other.CancelDuplicate;
         DuplicateCondition = other.DuplicateCondition;
 
+        // Networked
+        NetUser = other.NetUser;
+        NetTarget = other.NetTarget;
+        NetUsed = other.NetUsed;
+        NetEventTarget = other.NetEventTarget;
+
         Event = other.Event.Clone();
     }
 }
index 7fb42b34b957457433de04354b82201dfd0e650c..ce45e35c592c7939db249f404922fc245ad6704e 100644 (file)
@@ -24,7 +24,7 @@ public sealed class DoAfterComponentState : ComponentState
     public readonly ushort NextId;
     public readonly Dictionary<ushort, DoAfter> DoAfters;
 
-    public DoAfterComponentState(DoAfterComponent component)
+    public DoAfterComponentState(IEntityManager entManager, DoAfterComponent component)
     {
         NextId = component.NextId;
 
@@ -36,9 +36,10 @@ public sealed class DoAfterComponentState : ComponentState
         DoAfters = component.DoAfters;
 #else
         DoAfters = new();
-        foreach (var (id, doafter) in component.DoAfters)
+        foreach (var (id, doAfter) in component.DoAfters)
         {
-            DoAfters.Add(id, new DoAfter(doafter));
+            var newDoAfter = new DoAfter(entManager, doAfter);
+            DoAfters.Add(id, newDoAfter);
         }
 #endif
     }
index 8903e23b898011a6e5092f8fd3abe22ab407e9ef..32f46e5791ba364f0eb89cfe28b7d805a49ec24e 100644 (file)
@@ -71,7 +71,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
         }
 
         if (dirty)
-            Dirty(comp);
+            Dirty(uid, comp);
 
         if (comp.DoAfters.Count == 0)
             RemCompDeferred(uid, active);
index 4bb6005b1c0d4c34e46b89ad43edff6d09898c02..472db8cfd612a3f8a0d7cf75c0958104d83e1e9b 100644 (file)
@@ -100,7 +100,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
 
     private void OnDoAfterGetState(EntityUid uid, DoAfterComponent comp, ref ComponentGetState args)
     {
-        args.State = new DoAfterComponentState(comp);
+        args.State = new DoAfterComponentState(EntityManager, comp);
     }
 
     private void OnDoAfterHandleState(EntityUid uid, DoAfterComponent comp, ref ComponentHandleState args)
@@ -115,7 +115,18 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
         comp.DoAfters.Clear();
         foreach (var (id, doAfter) in state.DoAfters)
         {
-            comp.DoAfters.Add(id, new(doAfter));
+            var newDoAfter = new DoAfter(EntityManager, doAfter);
+            comp.DoAfters.Add(id, newDoAfter);
+
+            // Networking yay (if you have an easier way dear god please).
+            newDoAfter.UserPosition = EnsureCoordinates<DoAfterComponent>(newDoAfter.NetUserPosition, uid);
+            newDoAfter.InitialItem = EnsureEntity<DoAfterComponent>(newDoAfter.NetInitialItem, uid);
+
+            var doAfterArgs = newDoAfter.Args;
+            doAfterArgs.Target = EnsureEntity<DoAfterComponent>(doAfterArgs.NetTarget, uid);
+            doAfterArgs.Used = EnsureEntity<DoAfterComponent>(doAfterArgs.NetUsed, uid);
+            doAfterArgs.User = EnsureEntity<DoAfterComponent>(doAfterArgs.NetUser, uid);
+            doAfterArgs.EventTarget = EnsureEntity<DoAfterComponent>(doAfterArgs.NetEventTarget, uid);
         }
 
         comp.NextId = state.NextId;
@@ -195,6 +206,16 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
         id = new DoAfterId(args.User, comp.NextId++);
         var doAfter = new DoAfter(id.Value.Index, args, GameTiming.CurTime);
 
+        // Networking yay
+        doAfter.NetUserPosition = GetNetCoordinates(doAfter.UserPosition);
+        doAfter.NetInitialItem = GetNetEntity(doAfter.InitialItem);
+
+        // Networking yay
+        args.NetTarget = GetNetEntity(args.Target);
+        args.NetUsed = GetNetEntity(args.Used);
+        args.NetUser = GetNetEntity(args.User);
+        args.NetEventTarget = GetNetEntity(args.EventTarget);
+
         if (args.BreakOnUserMove || args.BreakOnTargetMove)
             doAfter.UserPosition = Transform(args.User).Coordinates;
 
@@ -322,7 +343,7 @@ public abstract partial class SharedDoAfterSystem : EntitySystem
         }
 
         InternalCancel(doAfter, comp);
-        Dirty(comp);
+        Dirty(entity, comp);
     }
 
     private void InternalCancel(DoAfter doAfter, DoAfterComponent component)
index 847ea2ba92e18ae9f4304ce6f3d0968032fa7567..567afa07701f90ce5b016586046ea2be3bf1c0ea 100644 (file)
@@ -340,14 +340,14 @@ public enum DoorVisualLayers : byte
 public sealed class DoorComponentState : ComponentState
 {
     public readonly DoorState DoorState;
-    public readonly HashSet<EntityUid> CurrentlyCrushing;
+    public readonly HashSet<NetEntity> CurrentlyCrushing;
     public readonly TimeSpan? NextStateChange;
     public readonly bool Partial;
 
-    public DoorComponentState(DoorComponent door)
+    public DoorComponentState(DoorComponent door, HashSet<NetEntity> currentlyCrushing)
     {
         DoorState = door.State;
-        CurrentlyCrushing = door.CurrentlyCrushing;
+        CurrentlyCrushing = currentlyCrushing;
         NextStateChange = door.NextStateChange;
         Partial = door.Partial;
     }
index 7dc7d1301798afb6a8ee50d05065b513686b6961..3fc912deba97e3f887b17f757dd1d3771987a28c 100644 (file)
@@ -101,7 +101,7 @@ public abstract partial class SharedDoorSystem : EntitySystem
     #region StateManagement
     private void OnGetState(EntityUid uid, DoorComponent door, ref ComponentGetState args)
     {
-        args.State = new DoorComponentState(door);
+        args.State = new DoorComponentState(door, GetNetEntitySet(door.CurrentlyCrushing));
     }
 
     private void OnHandleState(EntityUid uid, DoorComponent door, ref ComponentHandleState args)
@@ -109,11 +109,8 @@ public abstract partial class SharedDoorSystem : EntitySystem
         if (args.Current is not DoorComponentState state)
             return;
 
-        if (!door.CurrentlyCrushing.SetEquals(state.CurrentlyCrushing))
-        {
-            door.CurrentlyCrushing.Clear();
-            door.CurrentlyCrushing.UnionWith(state.CurrentlyCrushing);
-        }
+        door.CurrentlyCrushing.Clear();
+        door.CurrentlyCrushing.UnionWith(EnsureEntitySet<DoorComponent>(state.CurrentlyCrushing, uid));
 
         door.State = state.DoorState;
         door.NextStateChange = state.NextStateChange;
index af32997942b788ab7c4e4590ce049a694805075a..34b4a7a9478ce3c7d45b1fd50be992568841f830 100644 (file)
@@ -11,14 +11,14 @@ namespace Content.Shared.DragDrop
         /// <summary>
         ///     Entity that was dragged and dropped.
         /// </summary>
-        public EntityUid Dragged { get; }
+        public NetEntity Dragged { get; }
 
         /// <summary>
         ///     Entity that was drag dropped on.
         /// </summary>
-        public EntityUid Target { get; }
+        public NetEntity Target { get; }
 
-        public DragDropRequestEvent(EntityUid dragged, EntityUid target)
+        public DragDropRequestEvent(NetEntity dragged, NetEntity target)
         {
             Dragged = dragged;
             Target = target;
index 0396d395474f5aeb9256bf65f0c7eae4004d32f6..06043d3c000a5671d0ac98be549b7b054588cdf5 100644 (file)
@@ -13,9 +13,9 @@ public sealed class ColorFlashEffectEvent : EntityEventArgs
     /// </summary>
     public Color Color;
 
-    public List<EntityUid> Entities;
+    public List<NetEntity> Entities;
 
-    public ColorFlashEffectEvent(Color color, List<EntityUid> entities)
+    public ColorFlashEffectEvent(Color color, List<NetEntity> entities)
     {
         Color = color;
         Entities = entities;
index 50549c37b14664c6239eec534f3068ee023b45b0..5d5c67431a5ae761c892d547c06481d2022b8a52 100644 (file)
@@ -9,15 +9,15 @@ namespace Content.Shared.Examine
         [Serializable, NetSerializable]
         public sealed class RequestExamineInfoMessage : EntityEventArgs
         {
-            public readonly EntityUid EntityUid;
-            
+            public readonly NetEntity NetEntity;
+
             public readonly int Id;
 
             public readonly bool GetVerbs;
 
-            public RequestExamineInfoMessage(EntityUid entityUid, int id, bool getVerbs=false)
+            public RequestExamineInfoMessage(NetEntity netEntity, int id, bool getVerbs=false)
             {
-                EntityUid = entityUid;
+                NetEntity = netEntity;
                 Id = id;
                 GetVerbs = getVerbs;
             }
@@ -26,7 +26,7 @@ namespace Content.Shared.Examine
         [Serializable, NetSerializable]
         public sealed class ExamineInfoResponseMessage : EntityEventArgs
         {
-            public readonly EntityUid EntityUid;
+            public readonly NetEntity EntityUid;
             public readonly int Id;
             public readonly FormattedMessage Message;
 
@@ -37,7 +37,7 @@ namespace Content.Shared.Examine
 
             public readonly bool KnowTarget;
 
-            public ExamineInfoResponseMessage(EntityUid entityUid, int id, FormattedMessage message, List<Verb>? verbs=null,
+            public ExamineInfoResponseMessage(NetEntity entityUid, int id, FormattedMessage message, List<Verb>? verbs=null,
                 bool centerAtCursor=true, bool openAtOldTooltip=true, bool knowTarget = true)
             {
                 EntityUid = entityUid;
index a092b7052f9f1ff7fa76d54ebf849a3ead872875..cb4845498ff6739b84a20d7f4b48f4c2c78560e0 100644 (file)
@@ -48,7 +48,7 @@ namespace Content.Shared.Examine
 
         public bool IsInDetailsRange(EntityUid examiner, EntityUid entity)
         {
-            if (entity.IsClientSide())
+            if (IsClientSide(entity))
                 return true;
 
             // check if the mob is in critical or dead
@@ -72,7 +72,7 @@ namespace Content.Shared.Examine
         public bool CanExamine(EntityUid examiner, EntityUid examined)
         {
             // special check for client-side entities stored in null-space for some UI guff.
-            if (examined.IsClientSide())
+            if (IsClientSide(examined))
                 return true;
 
             return !Deleted(examined) && CanExamine(examiner, EntityManager.GetComponent<TransformComponent>(examined).MapPosition,
index 24bcdf5d457295d7fbec9504957f85f6940923c5..5baa59fc5a0707097a54d422a60f854c5705569a 100644 (file)
@@ -24,7 +24,7 @@ public sealed class ExplosionVisualsState : ComponentState
 {
     public MapCoordinates Epicenter;
     public Dictionary<int, List<Vector2i>>? SpaceTiles;
-    public Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> Tiles;
+    public Dictionary<NetEntity, Dictionary<int, List<Vector2i>>> Tiles;
     public List<float> Intensity;
     public string ExplosionType = string.Empty;
     public Matrix3 SpaceMatrix;
@@ -35,7 +35,7 @@ public sealed class ExplosionVisualsState : ComponentState
         string typeID,
         List<float> intensity,
         Dictionary<int, List<Vector2i>>? spaceTiles,
-        Dictionary<EntityUid, Dictionary<int, List<Vector2i>>> tiles,
+        Dictionary<NetEntity, Dictionary<int, List<Vector2i>>> tiles,
         Matrix3 spaceMatrix,
         ushort spaceTileSize)
     {
index 40fc5d72da287fd640d6ec9311d5c8cbe4fbe412..7b3e1fae8d338e398c21c46dd05d8c85f39a3c30 100644 (file)
@@ -17,11 +17,11 @@ public sealed class AdminFaxEuiState : EuiStateBase
 [Serializable, NetSerializable]
 public sealed class AdminFaxEntry
 {
-    public EntityUid Uid { get; }
+    public NetEntity Uid { get; }
     public string Name { get; }
     public string Address { get; }
 
-    public AdminFaxEntry(EntityUid uid, string name, string address)
+    public AdminFaxEntry(NetEntity uid, string name, string address)
     {
         Uid = uid;
         Name = name;
@@ -39,9 +39,9 @@ public static class AdminFaxEuiMsg
     [Serializable, NetSerializable]
     public sealed class Follow : EuiMessageBase
     {
-        public EntityUid TargetFax { get; }
+        public NetEntity TargetFax { get; }
 
-        public Follow(EntityUid targetFax)
+        public Follow(NetEntity targetFax)
         {
             TargetFax = targetFax;
         }
@@ -50,14 +50,14 @@ public static class AdminFaxEuiMsg
     [Serializable, NetSerializable]
     public sealed class Send : EuiMessageBase
     {
-        public EntityUid Target { get; }
+        public NetEntity Target { get; }
         public string Title { get; }
         public string From { get; }
         public string Content { get; }
         public string StampState { get; }
         public Color StampColor { get; }
 
-        public Send(EntityUid target, string title, string from, string content, string stamp, Color stampColor)
+        public Send(NetEntity target, string title, string from, string content, string stamp, Color stampColor)
         {
             Target = target;
             Title = title;
index df0a05fa64b4832f11a8cdd05210e3808ea31ee8..6f6d56cf60a347d1c68a846d24ec92be681de805 100644 (file)
@@ -26,10 +26,10 @@ public sealed class PuddleOverlayDebugMessage : EntityEventArgs
 {
     public PuddleDebugOverlayData[] OverlayData { get; }
 
-    public EntityUid GridUid { get; }
+    public NetEntity GridUid { get; }
 
 
-    public PuddleOverlayDebugMessage(EntityUid gridUid, PuddleDebugOverlayData[] overlayData)
+    public PuddleOverlayDebugMessage(NetEntity gridUid, PuddleDebugOverlayData[] overlayData)
     {
         GridUid = gridUid;
         OverlayData = overlayData;
index 259af7c4845d952ebd37d3b999abf5bbb7865393..83e486668eb846a523ab432351368ebd3cc15bca 100644 (file)
@@ -7,9 +7,9 @@ namespace Content.Shared.Follower.Components;
 ///     Attached to entities that are currently being followed by a ghost.
 /// </summary>
 [RegisterComponent, Access(typeof(FollowerSystem))]
-[NetworkedComponent, AutoGenerateComponentState]
+[NetworkedComponent]
 public sealed partial class FollowedComponent : Component
 {
-    [AutoNetworkedField(true), DataField("following")]
+    [DataField("following")]
     public HashSet<EntityUid> Following = new();
 }
index 334b80466a71b2d4a83db002a893a0dab2324446..10e7a7be1d075fd658ccd5435b7b2a5253fa73bb 100644 (file)
@@ -8,12 +8,14 @@ using Content.Shared.Physics.Pull;
 using Content.Shared.Tag;
 using Content.Shared.Verbs;
 using Robust.Shared.Containers;
+using Robust.Shared.GameStates;
 using Robust.Shared.Map;
 using Robust.Shared.Map.Events;
 using Robust.Shared.Network;
 using Robust.Shared.Utility;
 using Robust.Shared.Physics;
 using Robust.Shared.Physics.Systems;
+using Robust.Shared.Serialization;
 
 namespace Content.Shared.Follower;
 
@@ -36,6 +38,25 @@ public sealed class FollowerSystem : EntitySystem
         SubscribeLocalEvent<FollowerComponent, GotEquippedHandEvent>(OnGotEquippedHand);
         SubscribeLocalEvent<FollowedComponent, EntityTerminatingEvent>(OnFollowedTerminating);
         SubscribeLocalEvent<BeforeSaveEvent>(OnBeforeSave);
+
+        SubscribeLocalEvent<FollowedComponent, ComponentGetState>(OnFollowedGetState);
+        SubscribeLocalEvent<FollowedComponent, ComponentHandleState>(OnFollowedHandleState);
+    }
+
+    private void OnFollowedGetState(EntityUid uid, FollowedComponent component, ref ComponentGetState args)
+    {
+        args.State = new FollowedComponentState()
+        {
+            Following = GetNetEntitySet(component.Following),
+        };
+    }
+
+    private void OnFollowedHandleState(EntityUid uid, FollowedComponent component, ref ComponentHandleState args)
+    {
+        if (args.Current is not FollowedComponentState state)
+            return;
+
+        component.Following = EnsureEntitySet<FollowedComponent>(state.Following, uid);
     }
 
     private void OnBeforeSave(BeforeSaveEvent ev)
@@ -58,7 +79,7 @@ public sealed class FollowerSystem : EntitySystem
 
     private void OnGetAlternativeVerbs(GetVerbsEvent<AlternativeVerb> ev)
     {
-        if (ev.User == ev.Target || ev.Target.IsClientSide())
+        if (ev.User == ev.Target || IsClientSide(ev.Target))
             return;
 
         if (HasComp<GhostComponent>(ev.User))
@@ -221,6 +242,12 @@ public sealed class FollowerSystem : EntitySystem
             StopFollowingEntity(player, uid, followed);
         }
     }
+
+    [Serializable, NetSerializable]
+    private sealed class FollowedComponentState : ComponentState
+    {
+        public HashSet<NetEntity> Following = new();
+    }
 }
 
 public abstract class FollowEvent : EntityEventArgs
index 62af2caef5c2cebb9a33ed567923aa9d0de43348..b4e82184297159de9795dbc1b16a2f2b2e4ccca2 100644 (file)
@@ -124,10 +124,10 @@ namespace Content.Shared.GameTicking
         /// <summary>
         /// The Status of the Player in the lobby (ready, observer, ...)
         /// </summary>
-        public Dictionary<EntityUid, Dictionary<string, uint?>> JobsAvailableByStation { get; }
-        public Dictionary<EntityUid, string> StationNames { get; }
+        public Dictionary<NetEntity, Dictionary<string, uint?>> JobsAvailableByStation { get; }
+        public Dictionary<NetEntity, string> StationNames { get; }
 
-        public TickerJobsAvailableEvent(Dictionary<EntityUid, string> stationNames, Dictionary<EntityUid, Dictionary<string, uint?>> jobsAvailableByStation)
+        public TickerJobsAvailableEvent(Dictionary<NetEntity, string> stationNames, Dictionary<NetEntity, Dictionary<string, uint?>> jobsAvailableByStation)
         {
             StationNames = stationNames;
             JobsAvailableByStation = jobsAvailableByStation;
@@ -143,7 +143,7 @@ namespace Content.Shared.GameTicking
             public string PlayerOOCName;
             public string? PlayerICName;
             public string Role;
-            public EntityUid? PlayerEntityUid;
+            public NetEntity? PlayerNetEntity;
             public bool Antag;
             public bool Observer;
             public bool Connected;
index b3ab67e3963cc1f931adf21aa83b98147b45bcec..75518c2be8b8038f673768829ddac29799788555 100644 (file)
@@ -26,12 +26,12 @@ public sealed class GatewayBoundUserInterfaceState : BoundUserInterfaceState
     /// <summary>
     /// List of enabled destinations and information about them.
     /// </summary>
-    public readonly List<(EntityUid, string, TimeSpan, bool)> Destinations;
+    public readonly List<(NetEntity, string, TimeSpan, bool)> Destinations;
 
     /// <summary>
     /// Which destination it is currently linked to, if any.
     /// </summary>
-    public readonly EntityUid? Current;
+    public readonly NetEntity? Current;
 
     /// <summary>
     /// Time the portal will close at.
@@ -43,8 +43,8 @@ public sealed class GatewayBoundUserInterfaceState : BoundUserInterfaceState
     /// </summary>
     public readonly TimeSpan LastOpen;
 
-    public GatewayBoundUserInterfaceState(List<(EntityUid, string, TimeSpan, bool)> destinations,
-        EntityUid? current, TimeSpan nextClose, TimeSpan lastOpen)
+    public GatewayBoundUserInterfaceState(List<(NetEntity, string, TimeSpan, bool)> destinations,
+        NetEntity? current, TimeSpan nextClose, TimeSpan lastOpen)
     {
         Destinations = destinations;
         Current = current;
@@ -56,9 +56,9 @@ public sealed class GatewayBoundUserInterfaceState : BoundUserInterfaceState
 [Serializable, NetSerializable]
 public sealed class GatewayOpenPortalMessage : BoundUserInterfaceMessage
 {
-    public EntityUid Destination;
+    public NetEntity Destination;
 
-    public GatewayOpenPortalMessage(EntityUid destination)
+    public GatewayOpenPortalMessage(NetEntity destination)
     {
         Destination = destination;
     }
index 3bde2517c3b348dc36fd388f5922a33c3cc02199..8dd05e62f347e7a1ff1f4d3741f224e94986f2a3 100644 (file)
@@ -6,11 +6,11 @@ namespace Content.Shared.Ghost.Roles
     [Serializable, NetSerializable]
     public sealed class MakeGhostRoleEuiState : EuiStateBase
     {
-        public MakeGhostRoleEuiState(EntityUid entityUid)
+        public MakeGhostRoleEuiState(NetEntity entityUid)
         {
             EntityUid = entityUid;
         }
 
-        public EntityUid EntityUid { get; }
+        public NetEntity EntityUid { get; }
     }
 }
index 8aae54aa5b41fc55e399e78e1c47703e88374507..b64844e9a0623af0b381b17632152875eff68cf4 100644 (file)
@@ -7,6 +7,6 @@ namespace Content.Shared.Ghost.Roles
     {
         public string Name { get; set; } = string.Empty;
         public string Description { get; set; } = string.Empty;
-        public EntityUid Id;
+        public NetEntity Id;
     }
 }
index 2bd2f8788ffa7ddd75886473bd5886975040aae8..1bd0bbacb9e927a4826b64944cb108d548bcdfe5 100644 (file)
@@ -66,7 +66,7 @@ namespace Content.Shared.Ghost
     [Serializable, NetSerializable]
     public struct GhostWarp
     {
-        public GhostWarp(EntityUid entity, string displayName, bool isWarpPoint)
+        public GhostWarp(NetEntity entity, string displayName, bool isWarpPoint)
         {
             Entity = entity;
             DisplayName = displayName;
@@ -77,11 +77,13 @@ namespace Content.Shared.Ghost
         /// The entity representing the warp point.
         /// This is passed back to the server in <see cref="GhostWarpToTargetRequestEvent"/>
         /// </summary>
-        public EntityUid Entity { get; }
+        public NetEntity Entity { get; }
+
         /// <summary>
         /// The display name to be surfaced in the ghost warps menu
         /// </summary>
         public string DisplayName { get; }
+
         /// <summary>
         /// Whether this warp represents a warp point or a player
         /// </summary>
@@ -112,9 +114,9 @@ namespace Content.Shared.Ghost
     [Serializable, NetSerializable]
     public sealed class GhostWarpToTargetRequestEvent : EntityEventArgs
     {
-        public EntityUid Target { get; }
+        public NetEntity Target { get; }
 
-        public GhostWarpToTargetRequestEvent(EntityUid target)
+        public GhostWarpToTargetRequestEvent(NetEntity target)
         {
             Target = target;
         }
index 87edd472820b4399eaccffe364818781229bff59..e43f2561a16142dab4d95e4006414f36187a08c6 100644 (file)
@@ -8,6 +8,8 @@ namespace Content.Shared.Hands.EntitySystems;
 
 public abstract partial class SharedHandsSystem : EntitySystem
 {
+    [Dependency] private readonly SharedContainerSystem _container = default!;
+
     private void InitializeDrop()
     {
         SubscribeLocalEvent<HandsComponent, EntRemovedFromContainerMessage>(HandleEntityRemoved);
@@ -32,10 +34,10 @@ public abstract partial class SharedHandsSystem : EntitySystem
     /// </summary>
     public bool CanDropHeld(EntityUid uid, Hand hand, bool checkActionBlocker = true)
     {
-        if (hand.HeldEntity == null)
+        if (hand.Container?.ContainedEntity is not {} held)
             return false;
 
-        if (!hand.Container!.CanRemove(hand.HeldEntity.Value, EntityManager))
+        if (!_container.CanRemove(held, hand.Container))
             return false;
 
         if (checkActionBlocker && !_actionBlocker.CanDrop(uid))
@@ -110,7 +112,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
     /// <summary>
     ///     Attempts to move a held item from a hand into a container that is not another hand, without dropping it on the floor in-between.
     /// </summary>
-    public bool TryDropIntoContainer(EntityUid uid, EntityUid entity, IContainer targetContainer, bool checkActionBlocker = true, HandsComponent? handsComp = null)
+    public bool TryDropIntoContainer(EntityUid uid, EntityUid entity, BaseContainer targetContainer, bool checkActionBlocker = true, HandsComponent? handsComp = null)
     {
         if (!Resolve(uid, ref handsComp))
             return false;
@@ -121,7 +123,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
         if (!CanDropHeld(uid, hand, checkActionBlocker))
             return false;
 
-        if (!targetContainer.CanInsert(entity, EntityManager))
+        if (!_container.CanInsert(entity, targetContainer))
             return false;
 
         DoDrop(uid, hand, false, handsComp);
index 439ce3d2db4b0e84b69b122eea31579817e4f223..1cd9ad9d6e64b18dc894d11e817f61b2f456be1e 100644 (file)
@@ -86,13 +86,13 @@ public abstract partial class SharedHandsSystem : EntitySystem
         var newActiveIndex = component.SortedHands.IndexOf(component.ActiveHand.Name) + 1;
         var nextHand = component.SortedHands[newActiveIndex % component.Hands.Count];
 
-        TrySetActiveHand(component.Owner, nextHand, component);
+        TrySetActiveHand(session.AttachedEntity.Value, nextHand, component);
     }
 
-    private bool DropPressed(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
+    private bool DropPressed(ICommonSession? session, EntityCoordinates coords, EntityUid netEntity)
     {
         if (TryComp(session?.AttachedEntity, out HandsComponent? hands) && hands.ActiveHand != null)
-            TryDrop(session.AttachedEntity!.Value, hands.ActiveHand, coords, handsComp: hands);
+            TryDrop(session.AttachedEntity.Value, hands.ActiveHand, coords, handsComp: hands);
 
         // always send to server.
         return false;
index eaa10ed077f4d53074b7ba291872df39a5017cfa..e62723df06e8f88d6f5c66be5686d8eaf0a43b22 100644 (file)
@@ -181,7 +181,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
             return false;
 
         // check can insert (including raising attempt events).
-        return handContainer.CanInsert(entity, EntityManager);
+        return _containerSystem.CanInsert(entity, handContainer);
     }
 
     /// <summary>
index a17caa0bcb1166d3642549933dd6fd04e754f603..29242b4a7ee97975423b91a789e848fa817a026c 100644 (file)
@@ -117,12 +117,12 @@ namespace Content.Shared.Hands
     [Serializable, NetSerializable]
     public sealed class PickupAnimationEvent : EntityEventArgs
     {
-        public EntityUid ItemUid { get; }
-        public EntityCoordinates InitialPosition { get; }
+        public NetEntity ItemUid { get; }
+        public NetCoordinates InitialPosition { get; }
         public Vector2 FinalPosition { get; }
         public Angle InitialAngle { get; }
 
-        public PickupAnimationEvent(EntityUid itemUid, EntityCoordinates initialPosition,
+        public PickupAnimationEvent(NetEntity itemUid, NetCoordinates initialPosition,
             Vector2 finalPosition, Angle initialAngle)
         {
             ItemUid = itemUid;
index 15adefbd89c8ed71506dda15656b3603f28e8707..a4e3393c7e7f8b1b16b96166a0ad206491c0873b 100644 (file)
@@ -36,7 +36,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
 
     private void OnInit(EntityUid uid, HumanoidAppearanceComponent humanoid, ComponentInit args)
     {
-        if (string.IsNullOrEmpty(humanoid.Species) || _netManager.IsClient && !uid.IsClientSide())
+        if (string.IsNullOrEmpty(humanoid.Species) || _netManager.IsClient && !IsClientSide(uid))
         {
             return;
         }
index 6d0a65f2385773fc39af72baea3fea47eab83127..1cf9f446630da465efdcf6fb6aeee16d7341755d 100644 (file)
@@ -111,7 +111,7 @@ public abstract class SharedImplanterSystem : EntitySystem
                     continue;
 
                 //Don't remove a permanent implant and look for the next that can be drawn
-                if (!implantContainer.CanRemove(implant))
+                if (!_container.CanRemove(implant, implantContainer))
                 {
                     var implantName = Identity.Entity(implant, EntityManager);
                     var targetName = Identity.Entity(target, EntityManager);
index 61a3d28f46a9f0d74ce0872d274a67a9aedd2810..cdd85b90ac2cc98336b068fc72a5b1b0d6117423 100644 (file)
@@ -42,9 +42,9 @@ public abstract partial class SharedInstrumentComponent : Component
 [Serializable, NetSerializable]
 public sealed class InstrumentStopMidiEvent : EntityEventArgs
 {
-    public EntityUid Uid { get; }
+    public NetEntity Uid { get; }
 
-    public InstrumentStopMidiEvent(EntityUid uid)
+    public InstrumentStopMidiEvent(NetEntity uid)
     {
         Uid = uid;
     }
@@ -56,10 +56,10 @@ public sealed class InstrumentStopMidiEvent : EntityEventArgs
 [Serializable, NetSerializable]
 public sealed class InstrumentSetMasterEvent : EntityEventArgs
 {
-    public EntityUid Uid { get; }
-    public EntityUid? Master { get; }
+    public NetEntity Uid { get; }
+    public NetEntity? Master { get; }
 
-    public InstrumentSetMasterEvent(EntityUid uid, EntityUid? master)
+    public InstrumentSetMasterEvent(NetEntity uid, NetEntity? master)
     {
         Uid = uid;
         Master = master;
@@ -72,11 +72,11 @@ public sealed class InstrumentSetMasterEvent : EntityEventArgs
 [Serializable, NetSerializable]
 public sealed class InstrumentSetFilteredChannelEvent : EntityEventArgs
 {
-    public EntityUid Uid { get; }
+    public NetEntity Uid { get; }
     public int Channel { get; }
     public bool Value { get; }
 
-    public InstrumentSetFilteredChannelEvent(EntityUid uid, int channel, bool value)
+    public InstrumentSetFilteredChannelEvent(NetEntity uid, int channel, bool value)
     {
         Uid = uid;
         Channel = channel;
@@ -90,9 +90,9 @@ public sealed class InstrumentSetFilteredChannelEvent : EntityEventArgs
 [Serializable, NetSerializable]
 public sealed class InstrumentStartMidiEvent : EntityEventArgs
 {
-    public EntityUid Uid { get; }
+    public NetEntity Uid { get; }
 
-    public InstrumentStartMidiEvent(EntityUid uid)
+    public InstrumentStartMidiEvent(NetEntity uid)
     {
         Uid = uid;
     }
@@ -104,10 +104,10 @@ public sealed class InstrumentStartMidiEvent : EntityEventArgs
 [Serializable, NetSerializable]
 public sealed class InstrumentMidiEventEvent : EntityEventArgs
 {
-    public EntityUid Uid { get; }
+    public NetEntity Uid { get; }
     public RobustMidiEvent[] MidiEvent { get; }
 
-    public InstrumentMidiEventEvent(EntityUid uid, RobustMidiEvent[] midiEvent)
+    public InstrumentMidiEventEvent(NetEntity uid, RobustMidiEvent[] midiEvent)
     {
         Uid = uid;
         MidiEvent = midiEvent;
index 47471b0e22244d7c4e8f62800f26b76ce2f01fd0..5e75a36004601ee37f5b4657f7f09829e34d1227 100644 (file)
@@ -10,9 +10,9 @@ public sealed class InstrumentBandRequestBuiMessage : BoundUserInterfaceMessage
 [Serializable, NetSerializable]
 public sealed class InstrumentBandResponseBuiMessage : BoundUserInterfaceMessage
 {
-    public (EntityUid, string)[] Nearby { get; set; }
+    public (NetEntity, string)[] Nearby { get; set; }
 
-    public InstrumentBandResponseBuiMessage((EntityUid, string)[] nearby)
+    public InstrumentBandResponseBuiMessage((NetEntity, string)[] nearby)
     {
         Nearby = nearby;
     }
index a7b47875c60f5708629eb765cc3bda792f25a2c3..1f8b4468ad1b57ece89f2e575bf2a17994b7a94c 100644 (file)
@@ -27,9 +27,9 @@ public sealed partial class InteractionRelayComponent : Component
 [Serializable, NetSerializable]
 public sealed class InteractionRelayComponentState : ComponentState
 {
-    public EntityUid? RelayEntity;
+    public NetEntity? RelayEntity;
 
-    public InteractionRelayComponentState(EntityUid? relayEntity)
+    public InteractionRelayComponentState(NetEntity? relayEntity)
     {
         RelayEntity = relayEntity;
     }
index 0a13fc4f1b375e5b0631bc5a07d5a6599e4376e8..9ea48a89c8eaf9155845e13abd2f3f8362f21cee 100644 (file)
@@ -32,7 +32,7 @@ namespace Content.Shared.Interaction.Helpers
 
         public static bool InRangeUnOccluded(
             this EntityUid origin,
-            IContainer other,
+            BaseContainer other,
             float range = InteractionRange,
             Ignored? predicate = null,
             bool ignoreInsideBlocker = true)
@@ -90,7 +90,7 @@ namespace Content.Shared.Interaction.Helpers
 
         public static bool InRangeUnOccluded(
             this IComponent origin,
-            IContainer other,
+            BaseContainer other,
             float range = InteractionRange,
             Ignored? predicate = null,
             bool ignoreInsideBlocker = true)
@@ -130,7 +130,7 @@ namespace Content.Shared.Interaction.Helpers
 
         #region Containers
         public static bool InRangeUnOccluded(
-            this IContainer origin,
+            this BaseContainer origin,
             EntityUid other,
             float range = InteractionRange,
             Ignored? predicate = null,
@@ -143,7 +143,7 @@ namespace Content.Shared.Interaction.Helpers
         }
 
         public static bool InRangeUnOccluded(
-            this IContainer origin,
+            this BaseContainer origin,
             IComponent other,
             float range = InteractionRange,
             Ignored? predicate = null,
@@ -155,8 +155,8 @@ namespace Content.Shared.Interaction.Helpers
         }
 
         public static bool InRangeUnOccluded(
-            this IContainer origin,
-            IContainer other,
+            this BaseContainer origin,
+            BaseContainer other,
             float range = InteractionRange,
             Ignored? predicate = null,
             bool ignoreInsideBlocker = true)
@@ -169,7 +169,7 @@ namespace Content.Shared.Interaction.Helpers
         }
 
         public static bool InRangeUnOccluded(
-            this IContainer origin,
+            this BaseContainer origin,
             EntityCoordinates other,
             float range = InteractionRange,
             Ignored? predicate = null,
@@ -181,7 +181,7 @@ namespace Content.Shared.Interaction.Helpers
         }
 
         public static bool InRangeUnOccluded(
-            this IContainer origin,
+            this BaseContainer origin,
             MapCoordinates other,
             float range = InteractionRange,
             Ignored? predicate = null,
@@ -226,7 +226,7 @@ namespace Content.Shared.Interaction.Helpers
 
         public static bool InRangeUnOccluded(
             this EntityCoordinates origin,
-            IContainer other,
+            BaseContainer other,
             float range = InteractionRange,
             Ignored? predicate = null,
             bool ignoreInsideBlocker = true)
@@ -304,7 +304,7 @@ namespace Content.Shared.Interaction.Helpers
 
         public static bool InRangeUnOccluded(
             this MapCoordinates origin,
-            IContainer other,
+            BaseContainer other,
             float range = InteractionRange,
             Ignored? predicate = null,
             bool ignoreInsideBlocker = true)
index b8cf4c7b2f20bf5c2142428a072b067d7dd1925c..f82b8f787602346ac0fa9df9c2df02410dc3c38b 100644 (file)
@@ -13,7 +13,7 @@ public abstract partial class SharedInteractionSystem
 
     private void OnGetState(EntityUid uid, InteractionRelayComponent component, ref ComponentGetState args)
     {
-        args.State = new InteractionRelayComponentState(component.RelayEntity);
+        args.State = new InteractionRelayComponentState(GetNetEntity(component.RelayEntity));
     }
 
     private void OnHandleState(EntityUid uid, InteractionRelayComponent component, ref ComponentHandleState args)
@@ -21,7 +21,7 @@ public abstract partial class SharedInteractionSystem
         if (args.Current is not InteractionRelayComponentState state)
             return;
 
-        component.RelayEntity = state.RelayEntity;
+        component.RelayEntity = EnsureEntity<InteractionRelayComponent>(state.RelayEntity, uid);
     }
 
     public void SetRelay(EntityUid uid, EntityUid? relayEntity, InteractionRelayComponent? component = null)
index bf276dff0ba0f9b8ec6b2ad5ddddca76d393106c..830a3cd936eddc650cbabb16ed04e90373ec6b68 100644 (file)
@@ -205,8 +205,10 @@ namespace Content.Shared.Interaction
         /// </summary>
         private void HandleInteractInventorySlotEvent(InteractInventorySlotEvent msg, EntitySessionEventArgs args)
         {
+            var item = GetEntity(msg.ItemUid);
+
             // client sanitization
-            if (!TryComp(msg.ItemUid, out TransformComponent? itemXform) || !ValidateClientInput(args.SenderSession, itemXform.Coordinates, msg.ItemUid, out var user))
+            if (!TryComp(item, out TransformComponent? itemXform) || !ValidateClientInput(args.SenderSession, itemXform.Coordinates, item, out var user))
             {
                 Logger.InfoS("system.interaction", $"Inventory interaction validation failed.  Session={args.SenderSession}");
                 return;
@@ -219,10 +221,10 @@ namespace Content.Shared.Interaction
 
             if (msg.AltInteract)
                 // Use 'UserInteraction' function - behaves as if the user alt-clicked the item in the world.
-                UserInteraction(user.Value, itemXform.Coordinates, msg.ItemUid, msg.AltInteract);
+                UserInteraction(user.Value, itemXform.Coordinates, item, msg.AltInteract);
             else
                 // User used 'E'. We want to activate it, not simulate clicking on the item
-                InteractionActivate(user.Value, msg.ItemUid);
+                InteractionActivate(user.Value, item);
         }
 
         public bool HandleAltUseInteraction(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
@@ -1093,7 +1095,7 @@ namespace Content.Shared.Interaction
                 return false;
             }
 
-            if (uid.IsClientSide())
+            if (IsClientSide(uid))
             {
                 Logger.WarningS("system.interaction",
                     $"Client sent interaction with client-side entity. Session={session}, Uid={uid}");
@@ -1148,14 +1150,14 @@ namespace Content.Shared.Interaction
         /// <summary>
         ///     Entity that was interacted with.
         /// </summary>
-        public EntityUid ItemUid { get; }
+        public NetEntity ItemUid { get; }
 
         /// <summary>
         ///     Whether the interaction used the alt-modifier to trigger alternative interactions.
         /// </summary>
         public bool AltInteract { get; }
 
-        public InteractInventorySlotEvent(EntityUid itemUid, bool altInteract = false)
+        public InteractInventorySlotEvent(NetEntity itemUid, bool altInteract = false)
         {
             ItemUid = itemUid;
             AltInteract = altInteract;
index ec9fb7be917773b79969d2abc1ed24cb6bd16016..59b5a3c69e70db1fed792b7ed43fe545ff1bc4ff 100644 (file)
@@ -8,13 +8,13 @@ namespace Content.Shared.Inventory.Events;
 [NetSerializable, Serializable]
 public sealed class InventoryEquipActEvent : EntityEventArgs
 {
-    public readonly EntityUid Uid;
-    public readonly EntityUid ItemUid;
+    public readonly NetEntity Uid;
+    public readonly NetEntity ItemUid;
     public readonly string Slot;
     public readonly bool Silent;
     public readonly bool Force;
 
-    public InventoryEquipActEvent(EntityUid uid, EntityUid itemUid, string slot, bool silent = false, bool force = false)
+    public InventoryEquipActEvent(NetEntity uid, NetEntity itemUid, string slot, bool silent = false, bool force = false)
     {
         Uid = uid;
         ItemUid = itemUid;
index 25dcf56921dd58e0771c2da95e71c1bc42ad0c25..f3181a87b161dd6ea5862239a4767caaa782af64 100644 (file)
@@ -360,7 +360,7 @@ public abstract partial class InventorySystem
         }
 
         //we need to do this to make sure we are 100% removing this entity, since we are now dropping dependant slots
-        if (!force && !slotContainer.CanRemove(removedItem.Value))
+        if (!force && !_containerSystem.CanRemove(removedItem.Value, slotContainer))
             return false;
 
         foreach (var slotDef in GetSlots(target, inventory))
@@ -426,14 +426,12 @@ public abstract partial class InventorySystem
         if ((containerSlot == null || slotDefinition == null) && !TryGetSlotContainer(target, slot, out containerSlot, out slotDefinition, inventory))
             return false;
 
-        if (containerSlot.ContainedEntity == null)
+        if (containerSlot.ContainedEntity is not {} itemUid)
             return false;
 
-        if (!containerSlot.ContainedEntity.HasValue || !containerSlot.CanRemove(containerSlot.ContainedEntity.Value))
+        if (!_containerSystem.CanRemove(itemUid, containerSlot))
             return false;
 
-        var itemUid = containerSlot.ContainedEntity.Value;
-
         // make sure the user can actually reach the target
         if (!CanAccess(actor, target, itemUid))
         {
index 894601f176139e9f01ddf93a1a38df1ac3267f84..7516f4faca37045614b13146492ed4b3f921b790 100644 (file)
@@ -56,10 +56,10 @@ public sealed class ItemComponentState : ComponentState
 [Serializable, NetSerializable]
 public sealed class VisualsChangedEvent : EntityEventArgs
 {
-    public readonly EntityUid Item;
+    public readonly NetEntity Item;
     public readonly string ContainerId;
 
-    public VisualsChangedEvent(EntityUid item, string containerId)
+    public VisualsChangedEvent(NetEntity item, string containerId)
     {
         Item = item;
         ContainerId = containerId;
index 06ac79af9883b33db5653f0d8cfc109d15e42d50..e86ecf01c5dcb5951851b66cb7a836188c4b33e7 100644 (file)
@@ -18,8 +18,8 @@ namespace Content.Shared.Kitchen.Components
     [Serializable, NetSerializable]
     public sealed class MicrowaveEjectSolidIndexedMessage : BoundUserInterfaceMessage
     {
-        public EntityUid EntityID;
-        public MicrowaveEjectSolidIndexedMessage(EntityUid entityId)
+        public NetEntity EntityID;
+        public MicrowaveEjectSolidIndexedMessage(NetEntity entityId)
         {
             EntityID = entityId;
         }
@@ -50,12 +50,12 @@ namespace Content.Shared.Kitchen.Components
     [NetSerializable, Serializable]
     public sealed class MicrowaveUpdateUserInterfaceState : BoundUserInterfaceState
     {
-        public EntityUid[] ContainedSolids;
+        public NetEntity[] ContainedSolids;
         public bool IsMicrowaveBusy;
         public int ActiveButtonIndex;
         public uint CurrentCookTime;
 
-        public MicrowaveUpdateUserInterfaceState(EntityUid[] containedSolids,
+        public MicrowaveUpdateUserInterfaceState(NetEntity[] containedSolids,
             bool isMicrowaveBusy, int activeButtonIndex, uint currentCookTime)
         {
             ContainedSolids = containedSolids;
index 97c13814b084dbc5c30dc8e6fad24d1e4201c08d..dc948842884a29f7c3a3896f5d2d2e049fa1ca6c 100644 (file)
@@ -32,8 +32,8 @@ namespace Content.Shared.Kitchen
     [Serializable, NetSerializable]
     public sealed class ReagentGrinderEjectChamberContentMessage : BoundUserInterfaceMessage
     {
-        public EntityUid EntityId;
-        public ReagentGrinderEjectChamberContentMessage(EntityUid entityId)
+        public NetEntity EntityId;
+        public ReagentGrinderEjectChamberContentMessage(NetEntity entityId)
         {
             EntityId = entityId;
         }
@@ -84,9 +84,9 @@ namespace Content.Shared.Kitchen
         public bool Powered;
         public bool CanJuice;
         public bool CanGrind;
-        public EntityUid[] ChamberContents;
+        public NetEntity[] ChamberContents;
         public ReagentQuantity[]? ReagentQuantities;
-        public ReagentGrinderInterfaceState(bool isBusy, bool hasBeaker, bool powered, bool canJuice, bool canGrind, EntityUid[] chamberContents, ReagentQuantity[]? heldBeakerContents)
+        public ReagentGrinderInterfaceState(bool isBusy, bool hasBeaker, bool powered, bool canJuice, bool canGrind, NetEntity[] chamberContents, ReagentQuantity[]? heldBeakerContents)
         {
             IsBusy = isBusy;
             HasBeakerIn = hasBeaker;
index 40dc6852aa4107a81b5f9fbe76dc9aa63a53e482..9cc0ce1fe759dfaee6229482712f924f44983202 100644 (file)
@@ -27,13 +27,13 @@ public sealed class GridDragToggleMessage : EntityEventArgs
 [Serializable, NetSerializable]
 public sealed class GridDragRequestPosition : EntityEventArgs
 {
-    public EntityUid Grid;
+    public NetEntity Grid;
     public Vector2 WorldPosition;
 }
 
 [Serializable, NetSerializable]
 public sealed class GridDragVelocityRequest : EntityEventArgs
 {
-    public EntityUid Grid;
+    public NetEntity Grid;
     public Vector2 LinearVelocity;
 }
index 7ab737d48bcd971e73810a3e273562318ae7bf9c..503b8ee13b1d62d80dac937eb28fda8ed023531b 100644 (file)
@@ -25,11 +25,12 @@ public sealed class NewsWriteBoundUserInterfaceState : BoundUserInterfaceState
 [Serializable, NetSerializable]
 public sealed class NewsWriteShareMessage : BoundUserInterfaceMessage
 {
-    public NewsArticle Article;
-
-    public NewsWriteShareMessage(NewsArticle article)
+    public readonly string Name;
+    public readonly string Content;
+    public NewsWriteShareMessage(string name, string content)
     {
-        Article = article;
+        Name = name;
+        Content = content;
     }
 }
 
index 1021f267341c1b03b117900f295c9867130c1b62..64bc74229ca49699f160841556ecc5b4c969e81f 100644 (file)
@@ -1,13 +1,13 @@
-using Content.Shared.StationRecords;
+using Robust.Shared.Serialization;
 
 namespace Content.Shared.MassMedia.Systems;
 
-[Serializable]
+[Serializable, NetSerializable]
 public struct NewsArticle
 {
     public string Name;
     public string Content;
     public string? Author;
-    public ICollection<StationRecordKey>? AuthorStationRecordKeyIds;
+    public ICollection<(NetEntity, uint)>? AuthorStationRecordKeyIds;
     public TimeSpan ShareTime;
 }
index 54cb1ea06e7725ab21b9e1ae29af3cb93877f30e..2f889a8d49d22a5f99d665c7137c830fc5a97049 100644 (file)
@@ -169,6 +169,6 @@ public sealed class MechComponentState : ComponentState
     public FixedPoint2 MaxIntegrity;
     public FixedPoint2 Energy;
     public FixedPoint2 MaxEnergy;
-    public EntityUid? CurrentSelectedEquipment;
+    public NetEntity? CurrentSelectedEquipment;
     public bool Broken;
 }
index 127ec580999d8ad4df7aa27b6eb2bbf0185caaeb..364bd0bf14b6e03167ac0fb58e7d1d6d003ec207 100644 (file)
@@ -22,5 +22,5 @@ public sealed partial class MechPilotComponent : Component
 [Serializable, NetSerializable]
 public sealed class MechPilotComponentState : ComponentState
 {
-    public EntityUid Mech;
+    public NetEntity Mech;
 }
index 95dd906e35010717343a885d0e3e4d19c4a676b9..026f73172964e4b444c6b91b7096e18bb0c4a1cb 100644 (file)
@@ -69,7 +69,7 @@ public abstract class SharedMechSystem : EntitySystem
             MaxIntegrity = component.MaxIntegrity,
             Energy = component.Energy,
             MaxEnergy = component.MaxEnergy,
-            CurrentSelectedEquipment = component.CurrentSelectedEquipment,
+            CurrentSelectedEquipment = GetNetEntity(component.CurrentSelectedEquipment),
             Broken = component.Broken
         };
     }
@@ -83,7 +83,7 @@ public abstract class SharedMechSystem : EntitySystem
         component.MaxIntegrity = state.MaxIntegrity;
         component.Energy = state.Energy;
         component.MaxEnergy = state.MaxEnergy;
-        component.CurrentSelectedEquipment = state.CurrentSelectedEquipment;
+        component.CurrentSelectedEquipment = EnsureEntity<MechComponent>(state.CurrentSelectedEquipment, uid);
         component.Broken = state.Broken;
     }
 
@@ -91,7 +91,7 @@ public abstract class SharedMechSystem : EntitySystem
     {
         args.State = new MechPilotComponentState
         {
-            Mech = component.Mech
+            Mech = GetNetEntity(component.Mech)
         };
     }
 
@@ -100,7 +100,7 @@ public abstract class SharedMechSystem : EntitySystem
         if (args.Current is not MechPilotComponentState state)
             return;
 
-        component.Mech = state.Mech;
+        component.Mech = EnsureEntity<MechPilotComponent>(state.Mech, uid);
     }
 
     #endregion
index 5431c659c366b6b24c61434e0748afce89174531..b4254fe0798d2c1b6dc56b1358cc229df790d860 100644 (file)
@@ -31,7 +31,7 @@ public sealed class MechSoundboardSystem : EntitySystem
         {
             Sounds = sounds.ToList()
         };
-        args.States.Add(uid, state);
+        args.States.Add(GetNetEntity(uid), state);
     }
 
     private void OnSoundboardMessage(EntityUid uid, MechSoundboardComponent comp, MechEquipmentUiMessageRelayEvent args)
index f555fe69bd80cddf6e52b2988f2cb376a4a1f854..0d623078838391e7c4147bf3f2bf15350c37b2a0 100644 (file)
@@ -13,7 +13,7 @@ public enum MechUiKey : byte
 /// </summary>
 public sealed class MechEquipmentUiStateReadyEvent : EntityEventArgs
 {
-    public Dictionary<EntityUid, BoundUserInterfaceState> States = new();
+    public Dictionary<NetEntity, BoundUserInterfaceState> States = new();
 }
 
 /// <summary>
@@ -35,9 +35,9 @@ public sealed class MechEquipmentUiMessageRelayEvent : EntityEventArgs
 [Serializable, NetSerializable]
 public sealed class MechEquipmentRemoveMessage : BoundUserInterfaceMessage
 {
-    public EntityUid Equipment;
+    public NetEntity Equipment;
 
-    public MechEquipmentRemoveMessage(EntityUid equipment)
+    public MechEquipmentRemoveMessage(NetEntity equipment)
     {
         Equipment = equipment;
     }
@@ -49,7 +49,7 @@ public sealed class MechEquipmentRemoveMessage : BoundUserInterfaceMessage
 [Serializable, NetSerializable]
 public abstract class MechEquipmentUiMessage : BoundUserInterfaceMessage
 {
-    public EntityUid Equipment;
+    public NetEntity Equipment;
 }
 
 /// <summary>
@@ -58,9 +58,9 @@ public abstract class MechEquipmentUiMessage : BoundUserInterfaceMessage
 [Serializable, NetSerializable]
 public sealed class MechGrabberEjectMessage : MechEquipmentUiMessage
 {
-    public EntityUid Item;
+    public NetEntity Item;
 
-    public MechGrabberEjectMessage(EntityUid equipment, EntityUid uid)
+    public MechGrabberEjectMessage(NetEntity equipment, NetEntity uid)
     {
         Equipment = equipment;
         Item = uid;
@@ -75,7 +75,7 @@ public sealed class MechSoundboardPlayMessage : MechEquipmentUiMessage
 {
     public int Sound;
 
-    public MechSoundboardPlayMessage(EntityUid equipment, int sound)
+    public MechSoundboardPlayMessage(NetEntity equipment, int sound)
     {
         Equipment = equipment;
         Sound = sound;
@@ -106,13 +106,13 @@ public sealed class MechSoundboardPlayMessage : MechEquipmentUiMessage
 [Serializable, NetSerializable]
 public sealed class MechBoundUiState : BoundUserInterfaceState
 {
-    public Dictionary<EntityUid, BoundUserInterfaceState> EquipmentStates = new();
+    public Dictionary<NetEntity, BoundUserInterfaceState> EquipmentStates = new();
 }
 
 [Serializable, NetSerializable]
 public sealed class MechGrabberUiState : BoundUserInterfaceState
 {
-    public List<EntityUid> Contents = new();
+    public List<NetEntity> Contents = new();
     public int MaxContents;
 }
 
index 8d2d7e230a4c0b5ba9bc9bf8cc80c6549e4cf1c5..4e27959f89714464b3cb8b7f9cc8c37bb1739ddb 100644 (file)
@@ -6,7 +6,7 @@ namespace Content.Shared.Medical.SuitSensor
     [Serializable, NetSerializable]
     public sealed class SuitSensorStatus
     {
-        public SuitSensorStatus(EntityUid suitSensorUid, string name, string job)
+        public SuitSensorStatus(NetEntity suitSensorUid, string name, string job)
         {
             SuitSensorUid = suitSensorUid;
             Name = name;
@@ -14,12 +14,12 @@ namespace Content.Shared.Medical.SuitSensor
         }
 
         public TimeSpan Timestamp;
-        public EntityUid SuitSensorUid;
+        public NetEntity SuitSensorUid;
         public string Name;
         public string Job;
         public bool IsAlive;
         public int? TotalDamage;
-        public EntityCoordinates? Coordinates;
+        public NetCoordinates? Coordinates;
     }
 
     [Serializable, NetSerializable]
index 2691f1b7fcf804cb7d9270cbb85cff2ff61c410e..eb50323d38f878e608eb590a8567c4878d67c5fa 100644 (file)
@@ -8,11 +8,11 @@ namespace Content.Shared.MedicalScanner;
 [Serializable, NetSerializable]
 public sealed class HealthAnalyzerScannedUserMessage : BoundUserInterfaceMessage
 {
-    public readonly EntityUid? TargetEntity;
+    public readonly NetEntity? TargetEntity;
     public float Temperature;
     public float BloodLevel;
 
-    public HealthAnalyzerScannedUserMessage(EntityUid? targetEntity, float temperature, float bloodLevel)
+    public HealthAnalyzerScannedUserMessage(NetEntity? targetEntity, float temperature, float bloodLevel)
     {
         TargetEntity = targetEntity;
         Temperature = temperature;
index 0047de376c5e7927715e34c91bdcb539fd900f3f..f5516d9ec97a2922d67a3632192724a1763ab11c 100644 (file)
@@ -62,14 +62,14 @@ public abstract class SharedJetpackSystem : EntitySystem
         if (args.Current is not JetpackUserComponentState state)
             return;
 
-        component.Jetpack = state.Jetpack;
+        component.Jetpack = EnsureEntity<JetpackUserComponent>(state.Jetpack, uid);
     }
 
     private void OnJetpackUserGetState(EntityUid uid, JetpackUserComponent component, ref ComponentGetState args)
     {
         args.State = new JetpackUserComponentState()
         {
-            Jetpack = component.Jetpack,
+            Jetpack = GetNetEntity(component.Jetpack),
         };
     }
 
@@ -198,7 +198,7 @@ public abstract class SharedJetpackSystem : EntitySystem
     [Serializable, NetSerializable]
     protected sealed class JetpackUserComponentState : ComponentState
     {
-        public EntityUid Jetpack;
+        public NetEntity Jetpack;
     }
 }
 
index 41314d421a7a7166db8ab53c9ea76a94c0402993..9d150a0652becf25f91b1ea917aced4db090baf3 100644 (file)
@@ -87,7 +87,7 @@ namespace Content.Shared.Movement.Systems
 
             component.RelativeRotation = state.RelativeRotation;
             component.TargetRelativeRotation = state.TargetRelativeRotation;
-            component.RelativeEntity = state.RelativeEntity;
+            component.RelativeEntity = EnsureEntity<InputMoverComponent>(state.RelativeEntity, uid);
             component.LerpTarget = state.LerpAccumulator;
         }
 
@@ -98,7 +98,7 @@ namespace Content.Shared.Movement.Systems
                 component.CanMove,
                 component.RelativeRotation,
                 component.TargetRelativeRotation,
-                component.RelativeEntity,
+                GetNetEntity(component.RelativeEntity),
                 component.LerpTarget);
         }
 
@@ -493,11 +493,11 @@ namespace Content.Shared.Movement.Systems
                 _angle = direction.ToAngle();
             }
 
-            public override bool HandleCmdMessage(ICommonSession? session, InputCmdMessage message)
+            public override bool HandleCmdMessage(IEntityManager entManager, ICommonSession? session, IFullInputCmdMessage message)
             {
-                if (message is not FullInputCmdMessage full || session?.AttachedEntity == null) return false;
+                if (session?.AttachedEntity == null) return false;
 
-                if (full.State != BoundKeyState.Up)
+                if (message.State != BoundKeyState.Up)
                     return false;
 
                 _controller.RotateCamera(session.AttachedEntity.Value, _angle);
@@ -514,11 +514,11 @@ namespace Content.Shared.Movement.Systems
                 _controller = controller;
             }
 
-            public override bool HandleCmdMessage(ICommonSession? session, InputCmdMessage message)
+            public override bool HandleCmdMessage(IEntityManager entManager, ICommonSession? session, IFullInputCmdMessage message)
             {
-                if (message is not FullInputCmdMessage full || session?.AttachedEntity == null) return false;
+                if (session?.AttachedEntity == null) return false;
 
-                if (full.State != BoundKeyState.Up)
+                if (message.State != BoundKeyState.Up)
                     return false;
 
                 _controller.ResetCamera(session.AttachedEntity.Value);
@@ -537,11 +537,11 @@ namespace Content.Shared.Movement.Systems
                 _dir = dir;
             }
 
-            public override bool HandleCmdMessage(ICommonSession? session, InputCmdMessage message)
+            public override bool HandleCmdMessage(IEntityManager entManager, ICommonSession? session, IFullInputCmdMessage message)
             {
-                if (message is not FullInputCmdMessage full || session?.AttachedEntity == null) return false;
+                if (session?.AttachedEntity == null) return false;
 
-                _controller.HandleDirChange(session.AttachedEntity.Value, _dir, message.SubTick, full.State == BoundKeyState.Down);
+                _controller.HandleDirChange(session.AttachedEntity.Value, _dir, message.SubTick, message.State == BoundKeyState.Down);
                 return false;
             }
         }
@@ -555,11 +555,11 @@ namespace Content.Shared.Movement.Systems
                 _controller = controller;
             }
 
-            public override bool HandleCmdMessage(ICommonSession? session, InputCmdMessage message)
+            public override bool HandleCmdMessage(IEntityManager entManager, ICommonSession? session, IFullInputCmdMessage message)
             {
-                if (message is not FullInputCmdMessage full || session?.AttachedEntity == null) return false;
+                if (session?.AttachedEntity == null) return false;
 
-                _controller.HandleRunChange(session.AttachedEntity.Value, full.SubTick, full.State == BoundKeyState.Down);
+                _controller.HandleRunChange(session.AttachedEntity.Value, message.SubTick, message.State == BoundKeyState.Down);
                 return false;
             }
         }
@@ -579,10 +579,10 @@ namespace Content.Shared.Movement.Systems
             /// Target rotation relative to the <see cref="RelativeEntity"/>. Typically 0
             /// </summary>
             public Angle TargetRelativeRotation;
-            public EntityUid? RelativeEntity;
+            public NetEntity? RelativeEntity;
             public TimeSpan LerpAccumulator;
 
-            public InputMoverComponentState(MoveButtons buttons, bool canMove, Angle relativeRotation, Angle targetRelativeRotation, EntityUid? relativeEntity, TimeSpan lerpTarget)
+            public InputMoverComponentState(MoveButtons buttons, bool canMove, Angle relativeRotation, Angle targetRelativeRotation, NetEntity? relativeEntity, TimeSpan lerpTarget)
             {
                 Buttons = buttons;
                 CanMove = canMove;
@@ -604,11 +604,11 @@ namespace Content.Shared.Movement.Systems
                 _button = button;
             }
 
-            public override bool HandleCmdMessage(ICommonSession? session, InputCmdMessage message)
+            public override bool HandleCmdMessage(IEntityManager entManager, ICommonSession? session, IFullInputCmdMessage message)
             {
-                if (message is not FullInputCmdMessage full || session?.AttachedEntity == null) return false;
+                if (session?.AttachedEntity == null) return false;
 
-                _controller.HandleShuttleInput(session.AttachedEntity.Value, _button, full.SubTick, full.State == BoundKeyState.Down);
+                _controller.HandleShuttleInput(session.AttachedEntity.Value, _button, message.SubTick, message.State == BoundKeyState.Down);
                 return false;
             }
         }
index 415f2cf8173cf0fa0a296ce384ef23d1008d7815..95f10cf7ad8df20cea722b7d04cbac6526fbc0ba 100644 (file)
@@ -8,6 +8,6 @@ namespace Content.Shared.NPC;
 [Serializable, NetSerializable]
 public sealed class HTNMessage : EntityEventArgs
 {
-    public EntityUid Uid;
+    public NetEntity Uid;
     public string Text = string.Empty;
 }
index 0dd14c4c1a610a6e5e2a474298a82c2cc3ed1d82..11d840e647f04a5f21024ecb80b3295e1cd57036 100644 (file)
@@ -19,13 +19,13 @@ public sealed class NPCSteeringDebugEvent : EntityEventArgs
 
 [Serializable, NetSerializable]
 public readonly record struct NPCSteeringDebugData(
-    EntityUid EntityUid,
+    NetEntity EntityUid,
     Vector2 Direction,
     float[] Interest,
     float[] Danger,
     List<Vector2> DangerPoints)
 {
-    public readonly EntityUid EntityUid = EntityUid;
+    public readonly NetEntity EntityUid = EntityUid;
     public readonly Vector2 Direction = Direction;
     public readonly float[] Interest = Interest;
     public readonly float[] Danger = Danger;
index fd62e411e0fb9556ff0a2125f56f82ef25cea1ab..17bec4c63b41864180362ecee22e33ce7390ebef 100644 (file)
@@ -5,13 +5,13 @@ namespace Content.Shared.NPC;
 [Serializable, NetSerializable]
 public sealed class PathBreadcrumbsMessage : EntityEventArgs
 {
-    public Dictionary<EntityUid, Dictionary<Vector2i, List<PathfindingBreadcrumb>>> Breadcrumbs = new();
+    public Dictionary<NetEntity, Dictionary<Vector2i, List<PathfindingBreadcrumb>>> Breadcrumbs = new();
 }
 
 [Serializable, NetSerializable]
 public sealed class PathBreadcrumbsRefreshMessage : EntityEventArgs
 {
-    public EntityUid GridUid;
+    public NetEntity GridUid;
     public Vector2i Origin;
     public List<PathfindingBreadcrumb> Data = new();
 }
@@ -19,5 +19,5 @@ public sealed class PathBreadcrumbsRefreshMessage : EntityEventArgs
 [Serializable, NetSerializable]
 public sealed class PathPolysMessage : EntityEventArgs
 {
-    public Dictionary<EntityUid, Dictionary<Vector2i, Dictionary<Vector2i, List<DebugPathPoly>>>> Polys = new();
+    public Dictionary<NetEntity, Dictionary<Vector2i, Dictionary<Vector2i, List<DebugPathPoly>>>> Polys = new();
 }
index afb788e0271349691a16d373ca43194203c36701..194cc1d979a241a689dbd7cc7fe798cfdb6eed0a 100644 (file)
@@ -5,7 +5,7 @@ namespace Content.Shared.NPC;
 [Serializable, NetSerializable]
 public sealed class PathPolysRefreshMessage : EntityEventArgs
 {
-    public EntityUid GridUid;
+    public NetEntity GridUid;
     public Vector2i Origin;
 
     /// <summary>
index 426c6e1a00f3b8c4eed58c7a95c517830f5160b5..ad5832a04acf31a3d8456e0cf6057ed28250b852 100644 (file)
@@ -16,17 +16,17 @@ namespace Content.Shared.NPC;
 [Serializable, NetSerializable]
 public sealed class DebugPathPoly
 {
-    public EntityUid GraphUid;
+    public NetEntity GraphUid;
     public Vector2i ChunkOrigin;
     public byte TileIndex;
 
     public Box2 Box;
     public PathfindingData Data;
-    public List<EntityCoordinates> Neighbors = default!;
+    public List<NetCoordinates> Neighbors = default!;
 }
 
 [Serializable, NetSerializable]
 public sealed class DebugPathPolyNeighbor
 {
-    public EntityCoordinates Coordinates;
+    public NetCoordinates Coordinates;
 }
index 0208eb613e73743647418434e96f094920e3e9d6..24982f272a3a551187d8283cfd003e34831cab58 100644 (file)
@@ -36,7 +36,7 @@ namespace Content.Shared.NodeContainer
         [Serializable, NetSerializable]
         public sealed class NodeDatum
         {
-            public EntityUid Entity;
+            public NetEntity Entity;
             public int NetId;
             public int[] Reachable = Array.Empty<int>();
             public string Name = "";
index f5e44e7beb4a8f4ce59b53ad52c90ffbdd7cff6a..c11b8e09f2c490b876947bf23e6c9b816a446393 100644 (file)
@@ -4,7 +4,9 @@ using Robust.Shared.Serialization;
 namespace Content.Shared.PDA
 {
     [Serializable, NetSerializable]
-    public sealed class PdaUpdateState : CartridgeLoaderUiState
+    public sealed class PdaUpdateState : CartridgeLoaderUiState // WTF is this. what. I ... fuck me I just want net entities to work
+        // TODO purge this shit
+        //AAAAAAAAAAAAAAAA
     {
         public bool FlashlightEnabled;
         public bool HasPen;
@@ -14,9 +16,17 @@ namespace Content.Shared.PDA
         public bool CanPlayMusic;
         public string? Address;
 
-        public PdaUpdateState(bool flashlightEnabled, bool hasPen, PdaIdInfoText pdaOwnerInfo,
-            string? stationName, bool hasUplink = false,
-            bool canPlayMusic = false, string? address = null)
+        public PdaUpdateState(
+            List<NetEntity> programs,
+            NetEntity? activeUI,
+            bool flashlightEnabled,
+            bool hasPen,
+            PdaIdInfoText pdaOwnerInfo,
+            string? stationName,
+            bool hasUplink = false,
+            bool canPlayMusic = false,
+            string? address = null)
+            : base(programs, activeUI)
         {
             FlashlightEnabled = flashlightEnabled;
             HasPen = hasPen;
index 73c4c2e48aca2566c6bb5290571417dfc939379d..429b7b56b3f090d1ef3ae1ffcd29fb50ba6a0855 100644 (file)
@@ -15,10 +15,10 @@ public sealed partial class PreventCollideComponent : Component
 [Serializable, NetSerializable]
 public sealed class PreventCollideComponentState : ComponentState
 {
-    public EntityUid Uid;
+    public NetEntity Uid;
 
-    public PreventCollideComponentState(PreventCollideComponent component)
+    public PreventCollideComponentState(NetEntity netEntity)
     {
-        Uid = component.Uid;
+        Uid = netEntity;
     }
 }
index 805981fe31a8cd915260cab2bc1f7b39fadb5fa3..408125e140913996be9e32434989cca5027816a4 100644 (file)
@@ -17,7 +17,7 @@ public sealed class SharedPreventCollideSystem : EntitySystem
 
     private void OnGetState(EntityUid uid, PreventCollideComponent component, ref ComponentGetState args)
     {
-        args.State = new PreventCollideComponentState(component);
+        args.State = new PreventCollideComponentState(GetNetEntity(component.Uid));
     }
 
     private void OnHandleState(EntityUid uid, PreventCollideComponent component, ref ComponentHandleState args)
@@ -25,7 +25,7 @@ public sealed class SharedPreventCollideSystem : EntitySystem
         if (args.Current is not PreventCollideComponentState state)
             return;
 
-        component.Uid = state.Uid;
+        component.Uid = EnsureEntity<PreventCollideComponent>(state.Uid, uid);
     }
 
     private void OnPreventCollide(EntityUid uid, PreventCollideComponent component, ref PreventCollideEvent args)
index ce22f564925c4ec4e804c120b9460102c1211717..c4fb6079cfbbecdc6fabec2b21f8cedf98e64a6a 100644 (file)
@@ -6,14 +6,14 @@ namespace Content.Shared.Placeable;
 /// <summary>
 /// Detects items placed on it that match a whitelist.
 /// </summary>
-[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(ItemPlacerSystem))]
+[RegisterComponent, NetworkedComponent, Access(typeof(ItemPlacerSystem))]
 public sealed partial class ItemPlacerComponent : Component
 {
     /// <summary>
     /// The entities that are currently on top of the placer.
-    /// Guaranteed to have less than <see cref="MaxEntities"/> enitites if it is set.
-    /// <summary>
-    [DataField("placedEntities"), AutoNetworkedField]
+    /// Guaranteed to have less than <see cref="MaxEntities"/> enitities if it is set.
+    /// </summary>
+    [DataField("placedEntities")]
     public HashSet<EntityUid> PlacedEntities = new();
 
     /// <summary>
@@ -26,6 +26,6 @@ public sealed partial class ItemPlacerComponent : Component
     /// The max amount of entities that can be placed at the same time.
     /// If 0, there is no limit.
     /// </summary>
-    [ViewVariables(VVAccess.ReadWrite), DataField("maxEntities"), AutoNetworkedField]
+    [ViewVariables(VVAccess.ReadWrite), DataField("maxEntities")]
     public uint MaxEntities = 1;
 }
index 83bb47b617f929433780acee6e45e194865c0664..ccce286214e80977f9ffa329a94a58a2ebb77e6f 100644 (file)
@@ -1,6 +1,8 @@
 using Robust.Shared.Physics.Events;
 using Robust.Shared.Physics.Systems;
 using System.Linq;
+using Robust.Shared.GameStates;
+using Robust.Shared.Serialization;
 
 namespace Content.Shared.Placeable;
 
@@ -19,6 +21,28 @@ public sealed class ItemPlacerSystem : EntitySystem
 
         SubscribeLocalEvent<ItemPlacerComponent, StartCollideEvent>(OnStartCollide);
         SubscribeLocalEvent<ItemPlacerComponent, EndCollideEvent>(OnEndCollide);
+        SubscribeLocalEvent<ItemPlacerComponent, ComponentGetState>(OnPlacerGetState);
+        SubscribeLocalEvent<ItemPlacerComponent, ComponentHandleState>(OnPlacerHandleState);
+    }
+
+    private void OnPlacerHandleState(EntityUid uid, ItemPlacerComponent component, ref ComponentHandleState args)
+    {
+        if (args.Current is not ItemPlacerComponentState state)
+            return;
+
+        component.MaxEntities = state.MaxEntities;
+        component.PlacedEntities.Clear();
+        var ents = EnsureEntitySet<ItemPlacerComponent>(state.Entities, uid);
+        component.PlacedEntities.UnionWith(ents);
+    }
+
+    private void OnPlacerGetState(EntityUid uid, ItemPlacerComponent component, ref ComponentGetState args)
+    {
+        args.State = new ItemPlacerComponentState()
+        {
+            MaxEntities = component.MaxEntities,
+            Entities = GetNetEntitySet(component.PlacedEntities),
+        };
     }
 
     private void OnStartCollide(EntityUid uid, ItemPlacerComponent comp, ref StartCollideEvent args)
@@ -57,16 +81,23 @@ public sealed class ItemPlacerSystem : EntitySystem
 
         _placeableSurface.SetPlaceable(uid, true);
     }
+
+    [Serializable, NetSerializable]
+    private sealed class ItemPlacerComponentState : ComponentState
+    {
+        public uint MaxEntities;
+        public HashSet<NetEntity> Entities = default!;
+    }
 }
 
 /// <summary>
 /// Raised on the <see cref="ItemPlacer"/> when an item is placed and it is under the item limit.
 /// </summary>
 [ByRefEvent]
-public record struct ItemPlacedEvent(EntityUid OtherEntity);
+public readonly record struct ItemPlacedEvent(EntityUid OtherEntity);
 
 /// <summary>
 /// Raised on the <see cref="ItemPlacer"/> when an item is removed from it.
 /// </summary>
 [ByRefEvent]
-public record struct ItemRemovedEvent(EntityUid OtherEntity);
+public readonly record struct ItemRemovedEvent(EntityUid OtherEntity);
index c65cc759fb22abb7eecaf738f731bc2afaa6ed51..90c31bcfec2aee3a86009d5138fb6655f6b91373 100644 (file)
@@ -3,15 +3,16 @@ using Robust.Shared.Serialization;
 namespace Content.Shared.Pointing;
 
 // TODO just make pointing properly predicted?
+// So true
 /// <summary>
 ///     Event raised when someone runs the client-side pointing verb.
 /// </summary>
 [Serializable, NetSerializable]
 public sealed class PointingAttemptEvent : EntityEventArgs
 {
-    public EntityUid Target;
+    public NetEntity Target;
 
-    public PointingAttemptEvent(EntityUid target)
+    public PointingAttemptEvent(NetEntity target)
     {
         Target = target;
     }
index 4f3619dbd3c465cd175bb161b9d630a5d71594c0..50013a5435007b6ff9eb1e377a783f785baf3074 100644 (file)
@@ -124,9 +124,9 @@ namespace Content.Shared.Popups
     [Serializable, NetSerializable]
     public sealed class PopupCoordinatesEvent : PopupEvent
     {
-        public EntityCoordinates Coordinates { get; }
+        public NetCoordinates Coordinates { get; }
 
-        public PopupCoordinatesEvent(string message, PopupType type, EntityCoordinates coordinates) : base(message, type)
+        public PopupCoordinatesEvent(string message, PopupType type, NetCoordinates coordinates) : base(message, type)
         {
             Coordinates = coordinates;
         }
@@ -138,9 +138,9 @@ namespace Content.Shared.Popups
     [Serializable, NetSerializable]
     public sealed class PopupEntityEvent : PopupEvent
     {
-        public EntityUid Uid { get; }
+        public NetEntity Uid { get; }
 
-        public PopupEntityEvent(string message, PopupType type, EntityUid uid) : base(message, type)
+        public PopupEntityEvent(string message, PopupType type, NetEntity uid) : base(message, type)
         {
             Uid = uid;
         }
index f835a7f1c4a7e0c3eba1ed153bdf3da8173c2165..5d4046556a2b629212cb1d04ffd8965ebe71e528 100644 (file)
@@ -49,7 +49,7 @@ public abstract partial class SharedProjectileSystem : EntitySystem
 
         args.Handled = true;
 
-        _doAfter.TryStartDoAfter(new DoAfterArgs(args.User, component.RemovalTime.Value,
+        _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.RemovalTime.Value,
             new RemoveEmbeddedProjectileEvent(), eventTarget: uid, target: uid)
         {
             DistanceThreshold = SharedInteractionSystem.InteractionRange,
@@ -143,9 +143,9 @@ public abstract partial class SharedProjectileSystem : EntitySystem
 public sealed class ImpactEffectEvent : EntityEventArgs
 {
     public string Prototype;
-    public EntityCoordinates Coordinates;
+    public NetCoordinates Coordinates;
 
-    public ImpactEffectEvent(string prototype, EntityCoordinates coordinates)
+    public ImpactEffectEvent(string prototype, NetCoordinates coordinates)
     {
         Prototype = prototype;
         Coordinates = coordinates;
index 4ed369af0cfe11ac8c64c0419f7032a57bdb66f6..51ab2c91e49cf1b7013e8e1ce061421642cbd561 100644 (file)
@@ -54,9 +54,9 @@ namespace Content.Shared.Pulling.Components
     [Serializable, NetSerializable]
     public sealed class PullableComponentState : ComponentState
     {
-        public readonly EntityUid? Puller;
+        public readonly NetEntity? Puller;
 
-        public PullableComponentState(EntityUid? puller)
+        public PullableComponentState(NetEntity? puller)
         {
             Puller = puller;
         }
index b73565d5b2e33cba2a9c7d5be95f8e3a55010089..63f6d648678990064335f7f34a252ceea34c4eca 100644 (file)
@@ -33,7 +33,7 @@ namespace Content.Shared.Pulling
 
         private void OnGetState(EntityUid uid, SharedPullableComponent component, ref ComponentGetState args)
         {
-            args.State = new PullableComponentState(component.Puller);
+            args.State = new PullableComponentState(GetNetEntity(component.Puller));
         }
 
         private void OnHandleState(EntityUid uid, SharedPullableComponent component, ref ComponentHandleState args)
@@ -41,21 +41,23 @@ namespace Content.Shared.Pulling
             if (args.Current is not PullableComponentState state)
                 return;
 
-            if (!state.Puller.HasValue)
+            var puller = EnsureEntity<SharedPullableComponent>(state.Puller, uid);
+
+            if (!puller.HasValue)
             {
                 ForceDisconnectPullable(component);
                 return;
             }
 
-            if (component.Puller == state.Puller)
+            if (component.Puller == puller)
             {
                 // don't disconnect and reconnect a puller for no reason
                 return;
             }
 
-            if (!TryComp<SharedPullerComponent?>(state.Puller.Value, out var comp))
+            if (!TryComp<SharedPullerComponent>(puller, out var comp))
             {
-                Log.Error($"Pullable state for entity {ToPrettyString(uid)} had invalid puller entity {ToPrettyString(state.Puller.Value)}");
+                Log.Error($"Pullable state for entity {ToPrettyString(uid)} had invalid puller entity {ToPrettyString(puller.Value)}");
                 // ensure it disconnects from any different puller, still
                 ForceDisconnectPullable(component);
                 return;
index 784c9ef3eec50e32258e0f750bd6afb5ba58cb5e..f94d155d9729d0182974f7eabf3d3c70779d12e3 100644 (file)
@@ -95,7 +95,7 @@ public sealed class RCDSystem : EntitySystem
                 return;
         }
 
-        var doAfterArgs = new DoAfterArgs(user, comp.Delay, new RCDDoAfterEvent(location, comp.Mode), uid, target: args.Target, used: uid)
+        var doAfterArgs = new DoAfterArgs(EntityManager, user, comp.Delay, new RCDDoAfterEvent(GetNetCoordinates(location), comp.Mode), uid, target: args.Target, used: uid)
         {
             BreakOnDamage = true,
             NeedHand = true,
@@ -115,7 +115,7 @@ public sealed class RCDSystem : EntitySystem
         if (args.Event?.DoAfter?.Args == null)
             return;
 
-        var location = args.Event.Location;
+        var location = GetCoordinates(args.Event.Location);
 
         var gridId = location.GetGridUid(EntityManager);
         if (!HasComp<MapGridComponent>(gridId))
@@ -140,7 +140,7 @@ public sealed class RCDSystem : EntitySystem
             return;
 
         var user = args.User;
-        var location = args.Location;
+        var location = GetCoordinates(args.Location);
 
         var gridId = location.GetGridUid(EntityManager);
         if (!HasComp<MapGridComponent>(gridId))
@@ -316,7 +316,7 @@ public sealed class RCDSystem : EntitySystem
 public sealed partial class RCDDoAfterEvent : DoAfterEvent
 {
     [DataField("location", required: true)]
-    public EntityCoordinates Location = default!;
+    public NetCoordinates Location = default!;
 
     [DataField("startingMode", required: true)]
     public RcdMode StartingMode = default!;
@@ -325,7 +325,7 @@ public sealed partial class RCDDoAfterEvent : DoAfterEvent
     {
     }
 
-    public RCDDoAfterEvent(EntityCoordinates location, RcdMode startingMode)
+    public RCDDoAfterEvent(NetCoordinates location, RcdMode startingMode)
     {
         Location = location;
         StartingMode = startingMode;
index 8d5c67a591f75e1f0ad11789a45ffb654dad3ff2..ebcd84b3a3c72ddcc32d597fe85cf6b03b6129da 100644 (file)
@@ -91,7 +91,7 @@ public sealed class GeigerComponentState : ComponentState
     public float CurrentRadiation;
     public GeigerDangerLevel DangerLevel;
     public bool IsEnabled;
-    public EntityUid? User;
+    public NetEntity? User;
 }
 
 [Serializable, NetSerializable]
index 54a528a9ea4de5a507fc40d1030197cac5e9b885..a93ca4c616b02380443da39898df0c59530ccaa7 100644 (file)
@@ -72,9 +72,9 @@ public sealed class OnRadiationOverlayResistanceUpdateEvent : EntityEventArgs
     /// <summary>
     ///     Key is grids uid. Values are tiles with their rad resistance.
     /// </summary>
-    public readonly Dictionary<EntityUid, Dictionary<Vector2i, float>> Grids;
+    public readonly Dictionary<NetEntity, Dictionary<Vector2i, float>> Grids;
 
-    public OnRadiationOverlayResistanceUpdateEvent(Dictionary<EntityUid, Dictionary<Vector2i, float>> grids)
+    public OnRadiationOverlayResistanceUpdateEvent(Dictionary<NetEntity, Dictionary<Vector2i, float>> grids)
     {
         Grids = grids;
     }
index 31c466e6c20481ab470866df0763a0b19352ffe8..ca8ab5af661dc9785e59ed97b9a7cd8485cdf2d7 100644 (file)
@@ -19,7 +19,7 @@ public sealed class RadiationRay
     /// <summary>
     ///     Uid of entity with <see cref="RadiationSourceComponent"/>.
     /// </summary>
-    public EntityUid SourceUid;
+    public NetEntity SourceUid;
     /// <summary>
     ///     World coordinates of radiation source.
     /// </summary>
@@ -27,7 +27,7 @@ public sealed class RadiationRay
     /// <summary>
     ///     Uid of entity with radiation receiver component.
     /// </summary>
-    public EntityUid DestinationUid;
+    public NetEntity DestinationUid;
     /// <summary>
     ///     World coordinates of radiation receiver.
     /// </summary>
@@ -50,10 +50,10 @@ public sealed class RadiationRay
     ///     Last tile may have negative value if ray has lost all intensity.
     ///     Grid traversal order isn't guaranteed.
     /// </remarks>
-    public Dictionary<EntityUid, List<(Vector2i, float)>> Blockers = new();
+    public Dictionary<NetEntity, List<(Vector2i, float)>> Blockers = new();
 
-    public RadiationRay(MapId mapId, EntityUid sourceUid, Vector2 source,
-        EntityUid destinationUid, Vector2 destination, float rads)
+    public RadiationRay(MapId mapId, NetEntity sourceUid, Vector2 source,
+        NetEntity destinationUid, Vector2 destination, float rads)
     {
         MapId = mapId;
         SourceUid = sourceUid;
index 64f596023d6d14607e8fd9b07e807e2a17c4a0d2..1fffa8c0257ab0e71791776b55223c07067252ae 100644 (file)
@@ -43,7 +43,7 @@ public abstract class SharedResearchStealerSystem : EntitySystem
             return;
         }
 
-        var doAfterArgs = new DoAfterArgs(uid, comp.Delay, new ResearchStealDoAfterEvent(), target: target, used: uid, eventTarget: uid)
+        var doAfterArgs = new DoAfterArgs(EntityManager, uid, comp.Delay, new ResearchStealDoAfterEvent(), target: target, used: uid, eventTarget: uid)
         {
             BreakOnDamage = true,
             BreakOnUserMove = true,
index e0706d488072f88f44fc82be1f1b9ba86fc65d47..3ddd42f2b7d9c396ec9f6a72779d55307598382f 100644 (file)
@@ -147,7 +147,7 @@ public abstract partial class SharedFultonSystem : EntitySystem
 
         var ev = new FultonedDoAfterEvent();
         _doAfter.TryStartDoAfter(
-            new DoAfterArgs(args.User, component.ApplyFultonDuration, ev, args.Target, args.Target, args.Used)
+            new DoAfterArgs(EntityManager, args.User, component.ApplyFultonDuration, ev, args.Target, args.Target, args.Used)
             {
                 CancelDuplicate = true,
                 MovementThreshold = 0.5f,
@@ -188,7 +188,7 @@ public abstract partial class SharedFultonSystem : EntitySystem
     [Serializable, NetSerializable]
     protected sealed class FultonAnimationMessage : EntityEventArgs
     {
-        public EntityUid Entity;
-        public EntityCoordinates Coordinates;
+        public NetEntity Entity;
+        public NetCoordinates Coordinates;
     }
 }
index 4fb3e62e5fdf466bd398d4e69b2a73d14a9eb85a..d60f5274b535ed9e3fb24cb185f9a6ba6843a38a 100644 (file)
@@ -12,7 +12,7 @@ public class RadarConsoleBoundInterfaceState : BoundUserInterfaceState
     /// <summary>
     /// The relevant coordinates to base the radar around.
     /// </summary>
-    public EntityCoordinates? Coordinates;
+    public NetCoordinates? Coordinates;
 
     /// <summary>
     /// The relevant rotation to rotate the angle around.
@@ -23,7 +23,7 @@ public class RadarConsoleBoundInterfaceState : BoundUserInterfaceState
 
     public RadarConsoleBoundInterfaceState(
         float maxRange,
-        EntityCoordinates? coordinates,
+        NetCoordinates? coordinates,
         Angle? angle,
         List<DockingInterfaceState> docks)
     {
@@ -40,9 +40,9 @@ public class RadarConsoleBoundInterfaceState : BoundUserInterfaceState
 [Serializable, NetSerializable]
 public sealed class DockingInterfaceState
 {
-    public EntityCoordinates Coordinates;
+    public NetCoordinates Coordinates;
     public Angle Angle;
-    public EntityUid Entity;
+    public NetEntity Entity;
     public bool Connected;
     public Color Color;
     public Color HighlightedColor;
index a008ee434352188f80e1c6d7412d090883c62610..db38416ce2b99231a942161f5b255044422e2b4e 100644 (file)
@@ -18,14 +18,14 @@ public sealed class ShuttleConsoleBoundInterfaceState : RadarConsoleBoundInterfa
     /// </summary>
     public readonly TimeSpan FTLTime;
 
-    public List<(EntityUid Entity, string Destination, bool Enabled)> Destinations;
+    public List<(NetEntity Entity, string Destination, bool Enabled)> Destinations;
 
     public ShuttleConsoleBoundInterfaceState(
         FTLState ftlState,
         TimeSpan ftlTime,
-        List<(EntityUid Entity, string Destination, bool Enabled)> destinations,
+        List<(NetEntity Entity, string Destination, bool Enabled)> destinations,
         float maxRange,
-        EntityCoordinates? coordinates,
+        NetCoordinates? coordinates,
         Angle? angle,
         List<DockingInterfaceState> docks) : base(maxRange, coordinates, angle, docks)
     {
index 7e4f579038698c0a12b47fd40b829e609335d4c7..39b91e6278c7b2f7af23cd964128d0e6201a5e25 100644 (file)
@@ -8,5 +8,5 @@ namespace Content.Shared.Shuttles.Events;
 [Serializable, NetSerializable]
 public sealed class AutodockRequestMessage : BoundUserInterfaceMessage
 {
-    public EntityUid DockEntity;
+    public NetEntity DockEntity;
 }
index e021492c20fb9a173dde34cd35bcb2eb1949d673..187b89467acc81b1f2b57f6314e4797ff192fabd 100644 (file)
@@ -8,6 +8,6 @@ namespace Content.Shared.Shuttles.Events;
 [Serializable, NetSerializable]
 public sealed class EmergencyShuttlePositionMessage : EntityEventArgs
 {
-    public EntityUid? StationUid;
+    public NetEntity? StationUid;
     public Box2? Position;
 }
index e1aac65ea3cf9eb49c96fb296d977a7999e1ec89..73fd9d2c6455b042cb1f5cae1d575b37083cb2dc 100644 (file)
@@ -8,5 +8,5 @@ namespace Content.Shared.Shuttles.Events;
 [Serializable, NetSerializable]
 public sealed class ShuttleConsoleFTLRequestMessage : BoundUserInterfaceMessage
 {
-    public EntityUid Destination;
+    public NetEntity Destination;
 }
index 599c8b06e0af07f0d3a3de288b8eb366b1522b72..e00e1553e233df453e1e0669596d18d413331045 100644 (file)
@@ -8,5 +8,5 @@ namespace Content.Shared.Shuttles.Events;
 [Serializable, NetSerializable]
 public sealed class StopAutodockRequestMessage : BoundUserInterfaceMessage
 {
-    public EntityUid DockEntity;
+    public NetEntity DockEntity;
 }
index b29bf36c047f95c8a19fe3bed2d74b5be5d3ae76..533d3b79732d474df032a0fdda51b8b218269642 100644 (file)
@@ -8,5 +8,5 @@ namespace Content.Shared.Shuttles.Events;
 [Serializable, NetSerializable]
 public sealed class UndockRequestMessage : BoundUserInterfaceMessage
 {
-    public EntityUid DockEntity;
+    public NetEntity DockEntity;
 }
index 5b3949b6c280dd24007b6b46e66727385dce95c4..f6224a8af6b6b3bb6820f1eccb23f93983488d40 100644 (file)
@@ -20,9 +20,9 @@ namespace Content.Shared.Shuttles.Systems
         [Serializable, NetSerializable]
         protected sealed class PilotComponentState : ComponentState
         {
-            public EntityUid? Console { get; }
+            public NetEntity? Console { get; }
 
-            public PilotComponentState(EntityUid? uid)
+            public PilotComponentState(NetEntity? uid)
             {
                 Console = uid;
             }
index 601f9a217865c01c1cc705c45c8a641a230414df..fd6abc89926e1ff9d58b0f417f4fbfa9ebe0c6f1 100644 (file)
@@ -48,9 +48,9 @@ public sealed class BorgSetNameBuiMessage : BoundUserInterfaceMessage
 [Serializable, NetSerializable]
 public sealed class BorgRemoveModuleBuiMessage : BoundUserInterfaceMessage
 {
-    public EntityUid Module;
+    public NetEntity Module;
 
-    public BorgRemoveModuleBuiMessage(EntityUid module)
+    public BorgRemoveModuleBuiMessage(NetEntity module)
     {
         Module = module;
     }
index 36441b50ad2ce92ded64d6ae0da0e6398d800493..71d3a7bd166c7b36caa6208f428a9c8405482e61 100644 (file)
@@ -33,7 +33,7 @@ public sealed partial class BorgChassisComponent : Component
     public string BrainContainerId = "borg_brain";
 
     [ViewVariables(VVAccess.ReadWrite)]
-    public ContainerSlot BrainContainer = new();
+    public ContainerSlot BrainContainer = default!;
 
     public EntityUid? BrainEntity => BrainContainer.ContainedEntity;
     #endregion
index 6e35630bbeb515fcc2fdbbba6b4632b5c48c23a4..ff782b765037cc83a36376d70e441187f7d932b1 100644 (file)
@@ -5,9 +5,9 @@ namespace Content.Shared.Station;
 [NetSerializable, Serializable]
 public sealed class StationsUpdatedEvent : EntityEventArgs
 {
-    public readonly HashSet<EntityUid> Stations;
+    public readonly HashSet<NetEntity> Stations;
 
-    public StationsUpdatedEvent(HashSet<EntityUid> stations)
+    public StationsUpdatedEvent(HashSet<NetEntity> stations)
     {
         Stations = stations;
     }
index 6eb8f505ff41480565337222ae5cde2e588b47ca..27288a7a1f95f20628e2709efbda42c6dcbb0eaf 100644 (file)
@@ -32,12 +32,12 @@ public sealed class GeneralStationRecordConsoleState : BoundUserInterfaceState
     /// <summary>
     ///     Current selected key.
     /// </summary>
-    public StationRecordKey? SelectedKey { get; }
+    public (NetEntity, uint)? SelectedKey { get; }
     public GeneralStationRecord? Record { get; }
-    public Dictionary<StationRecordKey, string>? RecordListing { get; }
+    public Dictionary<(NetEntity, uint), string>? RecordListing { get; }
     public GeneralStationRecordsFilter? Filter { get; }
-    public GeneralStationRecordConsoleState(StationRecordKey? key, GeneralStationRecord? record,
-        Dictionary<StationRecordKey, string>? recordListing, GeneralStationRecordsFilter? newFilter)
+    public GeneralStationRecordConsoleState((NetEntity, uint)? key, GeneralStationRecord? record,
+        Dictionary<(NetEntity, uint), string>? recordListing, GeneralStationRecordsFilter? newFilter)
     {
         SelectedKey = key;
         Record = record;
@@ -52,9 +52,9 @@ public sealed class GeneralStationRecordConsoleState : BoundUserInterfaceState
 [Serializable, NetSerializable]
 public sealed class SelectGeneralStationRecord : BoundUserInterfaceMessage
 {
-    public StationRecordKey? SelectedKey { get; }
+    public (NetEntity, uint)? SelectedKey { get; }
 
-    public SelectGeneralStationRecord(StationRecordKey? selectedKey)
+    public SelectGeneralStationRecord((NetEntity, uint)? selectedKey)
     {
         SelectedKey = selectedKey;
     }
diff --git a/Content.Shared/StationRecords/SharedStationRecordsSystem.cs b/Content.Shared/StationRecords/SharedStationRecordsSystem.cs
new file mode 100644 (file)
index 0000000..c2cc418
--- /dev/null
@@ -0,0 +1,43 @@
+namespace Content.Shared.StationRecords;
+
+public abstract class SharedStationRecordsSystem : EntitySystem
+{
+    public StationRecordKey? Convert((NetEntity, uint)? input)
+    {
+        return input == null ? null : Convert(input.Value);
+    }
+
+    public (NetEntity, uint)? Convert(StationRecordKey? input)
+    {
+        return input == null ? null : Convert(input.Value);
+    }
+
+    public StationRecordKey Convert((NetEntity, uint) input)
+    {
+        return new StationRecordKey(input.Item2, GetEntity(input.Item1));
+    }
+    public (NetEntity, uint) Convert(StationRecordKey input)
+    {
+        return (GetNetEntity(input.OriginStation), input.Id);
+    }
+
+    public List<(NetEntity, uint)> Convert(ICollection<StationRecordKey> input)
+    {
+        var result = new List<(NetEntity, uint)>(input.Count);
+        foreach (var entry in input)
+        {
+            result.Add(Convert(entry));
+        }
+        return result;
+    }
+
+    public List<StationRecordKey> Convert(ICollection<(NetEntity, uint)> input)
+    {
+        var result = new List<StationRecordKey>(input.Count);
+        foreach (var entry in input)
+        {
+            result.Add(Convert(entry));
+        }
+        return result;
+    }
+}
index d52ba4743ce36023a2f7068475ffa3218e059552..937c3aa3ef1e4c35299d56393f91d4d652040f71 100644 (file)
@@ -1,21 +1,37 @@
-using Robust.Shared.Serialization;
-
 namespace Content.Shared.StationRecords;
 
 // Station record keys. These should be stored somewhere,
 // preferably within an ID card.
-[Serializable, NetSerializable]
-public readonly struct StationRecordKey
+public readonly struct StationRecordKey : IEquatable<StationRecordKey>
 {
-    [ViewVariables]
-    public uint ID { get; }
+    [DataField("id")]
+    public readonly uint Id;
+
+    [DataField("station")]
+    public readonly EntityUid OriginStation;
 
-    [ViewVariables]
-    public EntityUid OriginStation { get; }
+    public static StationRecordKey Invalid = default;
 
     public StationRecordKey(uint id, EntityUid originStation)
     {
-        ID = id;
+        Id = id;
         OriginStation = originStation;
     }
+
+    public bool Equals(StationRecordKey other)
+    {
+        return Id == other.Id && OriginStation.Id == other.OriginStation.Id;
+    }
+
+    public override bool Equals(object? obj)
+    {
+        return obj is StationRecordKey other && Equals(other);
+    }
+
+    public override int GetHashCode()
+    {
+        return HashCode.Combine(Id, OriginStation);
+    }
+
+    public bool IsValid() => OriginStation.IsValid();
 }
index 1b7fc89d642321d2e138b6fa47ecd0b3f9477610..6509c223b654942210135e292e4f4c4755ac4b45 100644 (file)
@@ -16,9 +16,9 @@ public sealed partial class StationRecordKeyStorageComponent : Component
 [Serializable, NetSerializable]
 public sealed class StationRecordKeyStorageComponentState : ComponentState
 {
-    public StationRecordKey? Key;
+    public (NetEntity, uint)? Key;
 
-    public StationRecordKeyStorageComponentState(StationRecordKey? key)
+    public StationRecordKeyStorageComponentState((NetEntity, uint)? key)
     {
         Key = key;
     }
index 94eda02c5fb966ef50a436377c64af031d41fa70..05af0807f21ec31ba67c14f9e7255c3655bc6f18 100644 (file)
@@ -4,6 +4,8 @@ namespace Content.Shared.StationRecords;
 
 public sealed class StationRecordKeyStorageSystem : EntitySystem
 {
+    [Dependency] private readonly SharedStationRecordsSystem _records = default!;
+
     public override void Initialize()
     {
         base.Initialize();
@@ -14,14 +16,14 @@ public sealed class StationRecordKeyStorageSystem : EntitySystem
 
     private void OnGetState(EntityUid uid, StationRecordKeyStorageComponent component, ref ComponentGetState args)
     {
-        args.State = new StationRecordKeyStorageComponentState(component.Key);
+        args.State = new StationRecordKeyStorageComponentState(_records.Convert(component.Key));
     }
 
     private void OnHandleState(EntityUid uid, StationRecordKeyStorageComponent component, ref ComponentHandleState args)
     {
         if (args.Current is not StationRecordKeyStorageComponentState state)
             return;
-        component.Key = state.Key;
+        component.Key = _records.Convert(state.Key);
     }
 
     /// <summary>
@@ -38,7 +40,7 @@ public sealed class StationRecordKeyStorageSystem : EntitySystem
         }
 
         keyStorage.Key = key;
-        Dirty(keyStorage);
+        Dirty(uid, keyStorage);
     }
 
     /// <summary>
index 5031a3decda0963fd96a862632d9cb88d058fabf..7c84e54bdc48ad696ae82bf83ca975a7e302a3b0 100644 (file)
@@ -60,11 +60,11 @@ public sealed class StepTriggerComponentState : ComponentState
 {
     public float IntersectRatio { get; }
     public float RequiredTriggerSpeed { get; }
-    public readonly HashSet<EntityUid> CurrentlySteppedOn;
-    public readonly HashSet<EntityUid> Colliding;
+    public readonly HashSet<NetEntity> CurrentlySteppedOn;
+    public readonly HashSet<NetEntity> Colliding;
     public readonly bool Active;
 
-    public StepTriggerComponentState(float intersectRatio, HashSet<EntityUid> currentlySteppedOn, HashSet<EntityUid> colliding, float requiredTriggerSpeed, bool active)
+    public StepTriggerComponentState(float intersectRatio, HashSet<NetEntity> currentlySteppedOn, HashSet<NetEntity> colliding, float requiredTriggerSpeed, bool active)
     {
         IntersectRatio = intersectRatio;
         CurrentlySteppedOn = currentlySteppedOn;
index d0abac8cbdc7626304050fe84293d52903547892..081262de0f3f26f87d526805de5e40e953a07ebc 100644 (file)
@@ -171,18 +171,14 @@ public sealed class StepTriggerSystem : EntitySystem
         component.RequiredTriggerSpeed = state.RequiredTriggerSpeed;
         component.IntersectRatio = state.IntersectRatio;
         component.Active = state.Active;
+        var stepped = EnsureEntitySet<StepTriggerComponent>(state.CurrentlySteppedOn, uid);
+        var colliding = EnsureEntitySet<StepTriggerComponent>(state.CurrentlySteppedOn, uid);
 
-        if (!component.CurrentlySteppedOn.SetEquals(state.CurrentlySteppedOn))
-        {
-            component.CurrentlySteppedOn.Clear();
-            component.CurrentlySteppedOn.UnionWith(state.CurrentlySteppedOn);
-        }
+        component.CurrentlySteppedOn.Clear();
+        component.CurrentlySteppedOn.UnionWith(stepped);
 
-        if (!component.Colliding.SetEquals(state.Colliding))
-        {
-            component.Colliding.Clear();
-            component.Colliding.UnionWith(state.Colliding);
-        }
+        component.Colliding.Clear();
+        component.Colliding.UnionWith(colliding);
 
         if (component.Colliding.Count > 0)
         {
@@ -194,12 +190,12 @@ public sealed class StepTriggerSystem : EntitySystem
         }
     }
 
-    private static void TriggerGetState(EntityUid uid, StepTriggerComponent component, ref ComponentGetState args)
+    private void TriggerGetState(EntityUid uid, StepTriggerComponent component, ref ComponentGetState args)
     {
         args.State = new StepTriggerComponentState(
             component.IntersectRatio,
-            component.CurrentlySteppedOn,
-            component.Colliding,
+            GetNetEntitySet(component.CurrentlySteppedOn),
+            GetNetEntitySet(component.Colliding),
             component.RequiredTriggerSpeed,
             component.Active);
     }
index 13617a60a12f5da5b15e6561aaf61e706ad6e174..4294ce1e790ecdf27aa435800a4674f5352b5a68 100644 (file)
@@ -56,13 +56,13 @@ public sealed partial class BinComponent : Component
 [Serializable, NetSerializable]
 public sealed class BinComponentState : ComponentState
 {
-    public List<EntityUid> Items;
+    public List<NetEntity> Items;
 
     public EntityWhitelist? Whitelist;
 
     public int MaxItems;
 
-    public BinComponentState(List<EntityUid> items, EntityWhitelist? whitelist, int maxItems)
+    public BinComponentState(List<NetEntity> items, EntityWhitelist? whitelist, int maxItems)
     {
         Items = items;
         Whitelist = whitelist;
index 897a20b45dfbd5c47486cfaf4022d78730169485..e82861f4e15bbfee16710f8dfb049e5c31fc28d7 100644 (file)
@@ -38,7 +38,7 @@ public sealed class BinSystem : EntitySystem
 
     private void OnGetState(EntityUid uid, BinComponent component, ref ComponentGetState args)
     {
-        args.State = new BinComponentState(component.Items, component.Whitelist, component.MaxItems);
+        args.State = new BinComponentState(GetNetEntityList(component.Items), component.Whitelist, component.MaxItems);
     }
 
     private void OnHandleState(EntityUid uid, BinComponent component, ref ComponentHandleState args)
@@ -46,7 +46,7 @@ public sealed class BinSystem : EntitySystem
         if (args.Current is not BinComponentState state)
             return;
 
-        component.Items = new List<EntityUid>(state.Items);
+        component.Items = EnsureEntityList<BinComponent>(state.Items, uid);
         component.Whitelist = state.Whitelist;
         component.MaxItems = state.MaxItems;
     }
index 2131fdc9e8fd8065a4cf097ae69c255ef71cf1a0..d44cda40f4caa888416d8d52c1bfefb7e5a42e0c 100644 (file)
@@ -81,7 +81,7 @@ public sealed class DumpableSystem : EntitySystem
                     StartDoAfter(uid, args.Target, args.User, dumpable);
                 },
                 Text = Loc.GetString("dump-disposal-verb-name", ("unit", args.Target)),
-                IconEntity = uid
+                IconEntity = GetNetEntity(uid)
             };
             args.Verbs.Add(verb);
         }
@@ -95,7 +95,7 @@ public sealed class DumpableSystem : EntitySystem
                     StartDoAfter(uid, args.Target, args.User, dumpable);
                 },
                 Text = Loc.GetString("dump-placeable-verb-name", ("surface", args.Target)),
-                IconEntity = uid
+                IconEntity = GetNetEntity(uid)
             };
             args.Verbs.Add(verb);
         }
@@ -108,7 +108,7 @@ public sealed class DumpableSystem : EntitySystem
 
         float delay = storage.StoredEntities.Count * (float) dumpable.DelayPerItem.TotalSeconds * dumpable.Multiplier;
 
-        _doAfterSystem.TryStartDoAfter(new DoAfterArgs(userUid, delay, new DumpableDoAfterEvent(), storageUid, target: targetUid, used: storageUid)
+        _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, userUid, delay, new DumpableDoAfterEvent(), storageUid, target: targetUid, used: storageUid)
         {
             BreakOnTargetMove = true,
             BreakOnUserMove = true,
index 42defac7ff0c64a93ea3b2b0102f8e8872dc0d5a..c14495e171aaa7a9c17508e32099de9cc74b3e7d 100644 (file)
@@ -7,13 +7,13 @@ namespace Content.Shared.Storage;
 public sealed partial class AreaPickupDoAfterEvent : DoAfterEvent
 {
     [DataField("entities", required: true)]
-    public IReadOnlyList<EntityUid> Entities = default!;
+    public IReadOnlyList<NetEntity> Entities = default!;
 
     private AreaPickupDoAfterEvent()
     {
     }
 
-    public AreaPickupDoAfterEvent(List<EntityUid> entities)
+    public AreaPickupDoAfterEvent(List<NetEntity> entities)
     {
         Entities = entities;
     }
index b8694739d22f04591e68c4af0160c1a3eb4846c2..4573af6863d9a12118e69f0a7da250439c706467 100644 (file)
@@ -10,11 +10,11 @@ namespace Content.Shared.Storage
         [Serializable, NetSerializable]
         public sealed class StorageBoundUserInterfaceState : BoundUserInterfaceState
         {
-            public readonly List<EntityUid> StoredEntities;
+            public readonly List<NetEntity> StoredEntities;
             public readonly int StorageSizeUsed;
             public readonly int StorageCapacityMax;
 
-            public StorageBoundUserInterfaceState(List<EntityUid> storedEntities, int storageSizeUsed, int storageCapacityMax)
+            public StorageBoundUserInterfaceState(List<NetEntity> storedEntities, int storageSizeUsed, int storageCapacityMax)
             {
                 StoredEntities = storedEntities;
                 StorageSizeUsed = storageSizeUsed;
@@ -30,8 +30,8 @@ namespace Content.Shared.Storage
         [Serializable, NetSerializable]
         public sealed class StorageInteractWithItemEvent : BoundUserInterfaceMessage
         {
-            public readonly EntityUid InteractedItemUID;
-            public StorageInteractWithItemEvent(EntityUid interactedItemUID)
+            public readonly NetEntity InteractedItemUID;
+            public StorageInteractWithItemEvent(NetEntity interactedItemUID)
             {
                 InteractedItemUID = interactedItemUID;
             }
@@ -59,12 +59,12 @@ namespace Content.Shared.Storage
     [Serializable, NetSerializable]
     public sealed class AnimateInsertingEntitiesEvent : EntityEventArgs
     {
-        public readonly EntityUid Storage;
-        public readonly List<EntityUid> StoredEntities;
-        public readonly List<EntityCoordinates> EntityPositions;
+        public readonly NetEntity Storage;
+        public readonly List<NetEntity> StoredEntities;
+        public readonly List<NetCoordinates> EntityPositions;
         public readonly List<Angle> EntityAngles;
 
-        public AnimateInsertingEntitiesEvent(EntityUid storage, List<EntityUid> storedEntities, List<EntityCoordinates> entityPositions, List<Angle> entityAngles)
+        public AnimateInsertingEntitiesEvent(NetEntity storage, List<NetEntity> storedEntities, List<NetCoordinates> entityPositions, List<Angle> entityAngles)
         {
             Storage = storage;
             StoredEntities = storedEntities;
index 9f64ff31facb1aa3912a9c6a2997718f0b6e01a7..cc6193a09046c39afc5c2da844903e53a6315360 100644 (file)
@@ -9,7 +9,7 @@ public sealed class SurveillanceCameraMonitorUiState : BoundUserInterfaceState
 {
     // The active camera on the monitor. If this is null, the part of the UI
     // that contains the monitor should clear.
-    public EntityUid? ActiveCamera { get; }
+    public NetEntity? ActiveCamera { get; }
 
     // Currently available subnets. Does not send the entirety of the possible
     // cameras to view because that could be really, really large
@@ -23,7 +23,7 @@ public sealed class SurveillanceCameraMonitorUiState : BoundUserInterfaceState
     // Known cameras, by address and name.
     public Dictionary<string, string> Cameras { get; }
 
-    public SurveillanceCameraMonitorUiState(EntityUid? activeCamera, HashSet<string> subnets, string activeAddress, string activeSubnet, Dictionary<string, string> cameras)
+    public SurveillanceCameraMonitorUiState(NetEntity? activeCamera, HashSet<string> subnets, string activeAddress, string activeSubnet, Dictionary<string, string> cameras)
     {
         ActiveCamera = activeCamera;
         Subnets = subnets;
index 8f32327db0fb09c9990b4b42d83514feafff1c09..f51cb89634a1e1c19bc42247ca23e18535174027 100644 (file)
@@ -12,11 +12,11 @@ namespace Content.Shared.Tabletop.Events
         /// <summary>
         /// The UID of the entity being dragged.
         /// </summary>
-        public EntityUid DraggedEntityUid;
+        public NetEntity DraggedEntityUid;
 
         public bool IsDragging;
 
-        public TabletopDraggingPlayerChangedEvent(EntityUid draggedEntityUid, bool isDragging)
+        public TabletopDraggingPlayerChangedEvent(NetEntity draggedEntityUid, bool isDragging)
         {
             DraggedEntityUid = draggedEntityUid;
             IsDragging = isDragging;
index f6ac2e53a0449b7be18d1dff160dc6c376806ce7..8abbd90aeceed1f8e88b0db41e2fc035257102a2 100644 (file)
@@ -14,7 +14,7 @@ namespace Content.Shared.Tabletop.Events
         /// <summary>
         /// The UID of the entity being moved.
         /// </summary>
-        public EntityUid MovedEntityUid { get; }
+        public NetEntity MovedEntityUid { get; }
 
         /// <summary>
         /// The new coordinates of the entity being moved.
@@ -24,9 +24,9 @@ namespace Content.Shared.Tabletop.Events
         /// <summary>
         /// The UID of the table the entity is being moved on.
         /// </summary>
-        public EntityUid TableUid { get; }
+        public NetEntity TableUid { get; }
 
-        public TabletopMoveEvent(EntityUid movedEntityUid, MapCoordinates coordinates, EntityUid tableUid)
+        public TabletopMoveEvent(NetEntity movedEntityUid, MapCoordinates coordinates, NetEntity tableUid)
         {
             MovedEntityUid = movedEntityUid;
             Coordinates = coordinates;
index dfd3079e2f2b2d3041433d883965491a30055755..566434bce7784d81317f6cbed70b43c79f58ecb2 100644 (file)
@@ -8,12 +8,12 @@ namespace Content.Shared.Tabletop.Events
     [Serializable, NetSerializable]
     public sealed class TabletopPlayEvent : EntityEventArgs
     {
-        public EntityUid TableUid;
-        public EntityUid CameraUid;
+        public NetEntity TableUid;
+        public NetEntity CameraUid;
         public string Title;
         public Vector2i Size;
 
-        public TabletopPlayEvent(EntityUid tableUid, EntityUid cameraUid, string title, Vector2i size)
+        public TabletopPlayEvent(NetEntity tableUid, NetEntity cameraUid, string title, Vector2i size)
         {
             TableUid = tableUid;
             CameraUid = cameraUid;
index f52bede662bcc21e631cf1c6374c5a9e3cafe04c..23301dec4a51e5ad7d7de24d85c929ed5416f781 100644 (file)
@@ -11,9 +11,9 @@ namespace Content.Shared.Tabletop.Events
         /// <summary>
         /// The entity UID of the table associated with this tabletop game.
         /// </summary>
-        public EntityUid TableUid;
+        public NetEntity TableUid;
 
-        public TabletopStopPlayingEvent(EntityUid tableUid)
+        public TabletopStopPlayingEvent(NetEntity tableUid)
         {
             TableUid = tableUid;
         }
index 542542054a929714aa27ed6680507b31495f2772..1ff90303411ea812d0a35b363cf967392f30f6c6 100644 (file)
@@ -35,12 +35,15 @@ namespace Content.Shared.Tabletop
             if (args.SenderSession is not { AttachedEntity: { } playerEntity } playerSession)
                 return;
 
-            if (!CanSeeTable(playerEntity, msg.TableUid) || !CanDrag(playerEntity, msg.MovedEntityUid, out _))
+            var table = GetEntity(msg.TableUid);
+            var moved = GetEntity(msg.MovedEntityUid);
+
+            if (!CanSeeTable(playerEntity, table) || !CanDrag(playerEntity, moved, out _))
                 return;
 
             // Move the entity and dirty it (we use the map ID from the entity so noone can try to be funny and move the item to another map)
-            var transform = EntityManager.GetComponent<TransformComponent>(msg.MovedEntityUid);
-            _transforms.SetParent(msg.MovedEntityUid, transform, _mapMan.GetMapEntityId(transform.MapID));
+            var transform = EntityManager.GetComponent<TransformComponent>(moved);
+            _transforms.SetParent(moved, transform, _mapMan.GetMapEntityId(transform.MapID));
             _transforms.SetLocalPositionNoLerp(transform, msg.Coordinates.Position);
         }
 
@@ -51,13 +54,13 @@ namespace Content.Shared.Tabletop
 
         private void OnDraggingPlayerChanged(TabletopDraggingPlayerChangedEvent msg, EntitySessionEventArgs args)
         {
-            var dragged = msg.DraggedEntityUid;
+            var dragged = GetEntity(msg.DraggedEntityUid);
 
             if (!TryComp(dragged, out TabletopDraggableComponent? draggableComponent))
                 return;
 
             draggableComponent.DraggingPlayer = msg.IsDragging ? args.SenderSession.UserId : null;
-            Dirty(draggableComponent);
+            Dirty(dragged, draggableComponent);
 
             if (!TryComp(dragged, out AppearanceComponent? appearance))
                 return;
@@ -89,8 +92,8 @@ namespace Content.Shared.Tabletop
         [Serializable, NetSerializable]
         public sealed class TabletopRequestTakeOut : EntityEventArgs
         {
-            public EntityUid Entity;
-            public EntityUid TableUid;
+            public NetEntity Entity;
+            public NetEntity TableUid;
         }
 
         #region Utility
index b4dddafea3a25aef9883a9b6ef6513231cca87a9..ae9a1a03d0db47484afa79061a99c340572a67cc 100644 (file)
@@ -27,9 +27,9 @@ public sealed partial class LinkedEntityComponent : Component
 [Serializable, NetSerializable]
 public sealed class LinkedEntityComponentState : ComponentState
 {
-    public HashSet<EntityUid> LinkedEntities;
+    public HashSet<NetEntity> LinkedEntities;
 
-    public LinkedEntityComponentState(HashSet<EntityUid> linkedEntities)
+    public LinkedEntityComponentState(HashSet<NetEntity> linkedEntities)
     {
         LinkedEntities = linkedEntities;
     }
index 7c4c078eb2b7c38464d9c6b2fcb603d76f2e6857..37441508e11629a5180640b6469647ba7764a637 100644 (file)
@@ -20,9 +20,9 @@ public sealed partial class PortalTimeoutComponent : Component
 [Serializable, NetSerializable]
 public sealed class PortalTimeoutComponentState : ComponentState
 {
-    public EntityUid? EnteredPortal;
+    public NetEntity? EnteredPortal;
 
-    public PortalTimeoutComponentState(EntityUid? enteredPortal)
+    public PortalTimeoutComponentState(NetEntity? enteredPortal)
     {
         EnteredPortal = enteredPortal;
     }
index 165e136505b282cf2da59679e72e732c682622e7..12667e488604b80d257a715b70a6d2306c2986d3 100644 (file)
@@ -26,13 +26,15 @@ public sealed class LinkedEntitySystem : EntitySystem
 
     private void OnGetState(EntityUid uid, LinkedEntityComponent component, ref ComponentGetState args)
     {
-        args.State = new LinkedEntityComponentState(component.LinkedEntities);
+        args.State = new LinkedEntityComponentState(GetNetEntitySet(component.LinkedEntities));
     }
 
     private void OnHandleState(EntityUid uid, LinkedEntityComponent component, ref ComponentHandleState args)
     {
         if (args.Current is LinkedEntityComponentState state)
-            component.LinkedEntities = state.LinkedEntities;
+        {
+            component.LinkedEntities = EnsureEntitySet<LinkedEntityComponent>(state.LinkedEntities, uid);
+        }
     }
 
     private void OnLinkShutdown(EntityUid uid, LinkedEntityComponent component, ComponentShutdown args)
index bb235bee5e57ce540af37f65b03c997b91a394d1..1ecaca57c3ca1adc5a472c1976741b9f37596c49 100644 (file)
@@ -79,13 +79,13 @@ public abstract class SharedPortalSystem : EntitySystem
 
     private void OnGetState(EntityUid uid, PortalTimeoutComponent component, ref ComponentGetState args)
     {
-        args.State = new PortalTimeoutComponentState(component.EnteredPortal);
+        args.State = new PortalTimeoutComponentState(GetNetEntity(component.EnteredPortal));
     }
 
     private void OnHandleState(EntityUid uid, PortalTimeoutComponent component, ref ComponentHandleState args)
     {
         if (args.Current is PortalTimeoutComponentState state)
-            component.EnteredPortal = state.EnteredPortal;
+            component.EnteredPortal = EnsureEntity<PortalTimeoutComponent>(state.EnteredPortal, uid);
     }
 
     private bool ShouldCollide(string ourId, string otherId, Fixture our, Fixture other)
index 7a986d9b1df9a0bb175eebbe3a716b3f474bebf1..eb09127dea88f3c249c4b429fbf8f9788b7220b7 100644 (file)
@@ -6,15 +6,16 @@ namespace Content.Shared.Throwing
     [RegisterComponent, NetworkedComponent]
     public sealed partial class ThrownItemComponent : Component
     {
+        [ViewVariables(VVAccess.ReadWrite), DataField("thrower")]
         public EntityUid? Thrower { get; set; }
     }
 
     [Serializable, NetSerializable]
     public sealed class ThrownItemComponentState : ComponentState
     {
-        public EntityUid? Thrower { get; }
+        public NetEntity? Thrower { get; }
 
-        public ThrownItemComponentState(EntityUid? thrower)
+        public ThrownItemComponentState(NetEntity? thrower)
         {
             Thrower = thrower;
         }
index 2fcad4b184305281be0153050ab5d7361d4a4394..7fb1cc6b8a586051237239ab64ce5cebbd166b69 100644 (file)
@@ -38,7 +38,7 @@ namespace Content.Shared.Throwing
 
         private void OnGetState(EntityUid uid, ThrownItemComponent component, ref ComponentGetState args)
         {
-            args.State = new ThrownItemComponentState(component.Thrower);
+            args.State = new ThrownItemComponentState(GetNetEntity(component.Thrower));
         }
 
         private void OnHandleState(EntityUid uid, ThrownItemComponent component, ref ComponentHandleState args)
@@ -49,7 +49,7 @@ namespace Content.Shared.Throwing
                 return;
             }
 
-            component.Thrower = state.Thrower.Value;
+            component.Thrower = EnsureEntity<ThrownItemComponent>(state.Thrower.Value, uid);
         }
 
         private void ThrowItem(EntityUid uid, ThrownItemComponent component, ThrownEvent args)
index 7073b10f9d1695faa967026b570132b8c6588e71..716a9332d0ebf9a9cfedfe2085e4751444ff9bee 100644 (file)
@@ -29,7 +29,7 @@ public abstract partial class SharedToolSystem : EntitySystem
         ev.DoAfter = args.DoAfter;
 
         if (args.OriginalTarget != null)
-            RaiseLocalEvent(args.OriginalTarget.Value, (object) ev);
+            RaiseLocalEvent(GetEntity(args.OriginalTarget.Value), (object) ev);
         else
             RaiseLocalEvent((object) ev);
     }
@@ -108,8 +108,8 @@ public abstract partial class SharedToolSystem : EntitySystem
         if (!CanStartToolUse(tool, user, target, toolQualitiesNeeded, toolComponent))
             return false;
 
-        var toolEvent = new ToolDoAfterEvent(doAfterEv, target);
-        var doAfterArgs = new DoAfterArgs(user, delay / toolComponent.SpeedModifier, toolEvent, tool, target: target, used: tool)
+        var toolEvent = new ToolDoAfterEvent(doAfterEv, GetNetEntity(target));
+        var doAfterArgs = new DoAfterArgs(EntityManager, user, delay / toolComponent.SpeedModifier, toolEvent, tool, target: target, used: tool)
         {
             BreakOnDamage = true,
             BreakOnTargetMove = true,
@@ -214,7 +214,7 @@ public abstract partial class SharedToolSystem : EntitySystem
         ///     Entity that the wrapped do after event will get directed at. If null, event will be broadcast.
         /// </summary>
         [DataField("target")]
-        public EntityUid? OriginalTarget;
+        public NetEntity? OriginalTarget;
 
         [DataField("wrappedEvent")]
         public DoAfterEvent WrappedEvent = default!;
@@ -223,7 +223,7 @@ public abstract partial class SharedToolSystem : EntitySystem
         {
         }
 
-        public ToolDoAfterEvent(DoAfterEvent wrappedEvent, EntityUid? originalTarget)
+        public ToolDoAfterEvent(DoAfterEvent wrappedEvent, NetEntity? originalTarget)
         {
             DebugTools.Assert(wrappedEvent.GetType().HasCustomAttribute<NetSerializableAttribute>(), "Tool event is not serializable");
 
@@ -247,13 +247,13 @@ public abstract partial class SharedToolSystem : EntitySystem
     protected sealed partial class LatticeCuttingCompleteEvent : DoAfterEvent
     {
         [DataField("coordinates", required:true)]
-        public EntityCoordinates Coordinates;
+        public NetCoordinates Coordinates;
 
         private LatticeCuttingCompleteEvent()
         {
         }
 
-        public LatticeCuttingCompleteEvent(EntityCoordinates coordinates)
+        public LatticeCuttingCompleteEvent(NetCoordinates coordinates)
         {
             Coordinates = coordinates;
         }
@@ -264,14 +264,14 @@ public abstract partial class SharedToolSystem : EntitySystem
     [Serializable, NetSerializable]
     protected sealed partial class TilePryingDoAfterEvent : DoAfterEvent
     {
-        [DataField("coordinates", required:true)]
-        public EntityCoordinates Coordinates;
+        [DataField("coordinates", required: true)]
+        public NetCoordinates Coordinates;
 
         private TilePryingDoAfterEvent()
         {
         }
 
-        public TilePryingDoAfterEvent(EntityCoordinates coordinates)
+        public TilePryingDoAfterEvent(NetCoordinates coordinates)
         {
             Coordinates = coordinates;
         }
index f006f9011eb78cdd6b5dd45957faa11be5324c58..a6618842e430f7a1b899addc744e9f8d7dd4b6bb 100644 (file)
@@ -21,5 +21,5 @@ public sealed partial class RiderComponent : Component
 [Serializable, NetSerializable]
 public sealed class RiderComponentState : ComponentState
 {
-    public EntityUid? Entity;
+    public NetEntity? Entity;
 }
index b4b566390c881b27adf7165da7caf6c6342bc043..3acd823c735973c0c3060ea5fdcc829ca375b5ae 100644 (file)
@@ -18,7 +18,7 @@ public abstract partial class SharedVehicleSystem
     {
         args.State = new RiderComponentState()
         {
-            Entity = component.Vehicle,
+            Entity = GetNetEntity(component.Vehicle),
         };
     }
 
index 2385982f8dd3daed84efec5f5de10b75e2ca06f1..87e2f0890a2e64c569cba6aae30399c808ce4601 100644 (file)
@@ -67,7 +67,7 @@ public abstract partial class SharedVendingMachineSystem
 
         args.Handled = true;
 
-        var doAfterArgs = new DoAfterArgs(args.User, (float) component.RestockDelay.TotalSeconds, new RestockDoAfterEvent(), target,
+        var doAfterArgs = new DoAfterArgs(EntityManager, args.User, (float) component.RestockDelay.TotalSeconds, new RestockDoAfterEvent(), target,
             target: target, used: uid)
         {
             BreakOnTargetMove = true,
index 301c5555ee6445cb9bea0458cf2df86f19a51862..40cb2d500229837959475f03358ebfd13af92a84 100644 (file)
@@ -24,14 +24,16 @@ namespace Content.Shared.Verbs
             if (user == null)
                 return;
 
+            var target = GetEntity(args.Target);
+
             // It is possible that client-side prediction can cause this event to be raised after the target entity has
             // been deleted. So we need to check that the entity still exists.
-            if (Deleted(args.Target) || Deleted(user))
+            if (Deleted(target) || Deleted(user))
                 return;
 
             // Get the list of verbs. This effectively also checks that the requested verb is in fact a valid verb that
             // the user can perform.
-            var verbs = GetLocalVerbs(args.Target, user.Value, args.RequestedVerb.GetType());
+            var verbs = GetLocalVerbs(target, user.Value, args.RequestedVerb.GetType());
 
             // Note that GetLocalVerbs might waste time checking & preparing unrelated verbs even though we know
             // precisely which one we want to run. However, MOST entities will only have 1 or 2 verbs of a given type.
@@ -39,7 +41,7 @@ namespace Content.Shared.Verbs
 
             // Find the requested verb.
             if (verbs.TryGetValue(args.RequestedVerb, out var verb))
-                ExecuteVerb(verb, user.Value, args.Target);
+                ExecuteVerb(verb, user.Value, target);
         }
 
         /// <summary>
index cd5edc22d94dd4cfdaa63d521be40e722eef419e..33576b6b9c7b0ac515e50ca5f66534f1a0446329 100644 (file)
@@ -112,7 +112,7 @@ namespace Content.Shared.Verbs
         ///     If this is not null, and no icon or icon texture were specified, a sprite view of this entity will be
         ///     used as the icon for this verb.
         /// </summary>
-        public EntityUid? IconEntity;
+        public NetEntity? IconEntity;
 
         /// <summary>
         ///     Whether or not to close the context menu after using it to run this verb.
@@ -221,7 +221,7 @@ namespace Content.Shared.Verbs
             typeof(AlternativeVerb),
             typeof(ActivationVerb),
             typeof(ExamineVerb),
-            typeof(EquipmentVerb) 
+            typeof(EquipmentVerb)
         };
     }
 
index 64b92385c58c636c18983fcf7616f0f4a5b7ca00..9a09d5d7a1aad373cc08ccedcf9481130037aa85 100644 (file)
@@ -10,7 +10,7 @@ namespace Content.Shared.Verbs
     [Serializable, NetSerializable]
     public sealed class RequestServerVerbsEvent : EntityEventArgs
     {
-        public readonly EntityUid EntityUid;
+        public readonly NetEntity EntityUid;
 
         public readonly List<string> VerbTypes = new();
 
@@ -18,11 +18,11 @@ namespace Content.Shared.Verbs
         ///     If the target item is inside of some storage (e.g., backpack), this is the entity that owns that item
         ///     slot. Needed for validating that the user can access the target item.
         /// </summary>
-        public readonly EntityUid? SlotOwner;
+        public readonly NetEntity? SlotOwner;
 
         public readonly bool AdminRequest;
 
-        public RequestServerVerbsEvent(EntityUid entityUid, IEnumerable<Type> verbTypes, EntityUid? slotOwner = null, bool adminRequest = false)
+        public RequestServerVerbsEvent(NetEntity entityUid, IEnumerable<Type> verbTypes, NetEntity? slotOwner = null, bool adminRequest = false)
         {
             EntityUid = entityUid;
             SlotOwner = slotOwner;
@@ -40,9 +40,9 @@ namespace Content.Shared.Verbs
     public sealed class VerbsResponseEvent : EntityEventArgs
     {
         public readonly List<Verb>? Verbs;
-        public readonly EntityUid Entity;
+        public readonly NetEntity Entity;
 
-        public VerbsResponseEvent(EntityUid entity, SortedSet<Verb>? verbs)
+        public VerbsResponseEvent(NetEntity entity, SortedSet<Verb>? verbs)
         {
             Entity = entity;
 
@@ -57,10 +57,10 @@ namespace Content.Shared.Verbs
     [Serializable, NetSerializable]
     public sealed class ExecuteVerbEvent : EntityEventArgs
     {
-        public readonly EntityUid Target;
+        public readonly NetEntity Target;
         public readonly Verb RequestedVerb;
 
-        public ExecuteVerbEvent(EntityUid target, Verb requestedVerb)
+        public ExecuteVerbEvent(NetEntity target, Verb requestedVerb)
         {
             Target = target;
             RequestedVerb = requestedVerb;
index cb731258d96ce71480f6d092ea3a6fbcd0ba8afa..b8230168324f8ea9ed7346102fa7c732ed2f8731 100644 (file)
@@ -10,9 +10,9 @@ namespace Content.Shared.Weapons.Melee.Events
         /// <summary>
         /// Coordinates being attacked.
         /// </summary>
-        public readonly EntityCoordinates Coordinates;
+        public readonly NetCoordinates Coordinates;
 
-        protected AttackEvent(EntityCoordinates coordinates)
+        protected AttackEvent(NetCoordinates coordinates)
         {
             Coordinates = coordinates;
         }
index 51b6f909048ae5a6d930546836da1451559335bf..204b7b9f6264952fd9bbbcb17a6df5037db8117c 100644 (file)
@@ -6,9 +6,9 @@ namespace Content.Shared.Weapons.Melee.Events;
 [Serializable, NetSerializable]
 public sealed class DisarmAttackEvent : AttackEvent
 {
-    public EntityUid? Target;
+    public NetEntity? Target;
 
-    public DisarmAttackEvent(EntityUid? target, EntityCoordinates coordinates) : base(coordinates)
+    public DisarmAttackEvent(NetEntity? target, NetCoordinates coordinates) : base(coordinates)
     {
         Target = target;
     }
index 47d5d7f6c9ab181521ae1d15542b5e8fee203c7a..6ea6caadc9e1aa2cdc1850c90279fc0f80024424 100644 (file)
@@ -9,14 +9,14 @@ namespace Content.Shared.Weapons.Melee.Events;
 [Serializable, NetSerializable]
 public sealed class HeavyAttackEvent : AttackEvent
 {
-    public readonly EntityUid Weapon;
+    public readonly NetEntity Weapon;
 
     /// <summary>
     /// As what the client swung at will not match server we'll have them tell us what they hit so we can verify.
     /// </summary>
-    public List<EntityUid> Entities;
+    public List<NetEntity> Entities;
 
-    public HeavyAttackEvent(EntityUid weapon, List<EntityUid> entities, EntityCoordinates coordinates) : base(coordinates)
+    public HeavyAttackEvent(NetEntity weapon, List<NetEntity> entities, NetCoordinates coordinates) : base(coordinates)
     {
         Weapon = weapon;
         Entities = entities;
index 9b0f979f7d23ab5604ff4ffa7df46813f6cd8350..0318747f38aa8ebeafeefbee3d3bffa70e782baf 100644 (file)
@@ -9,10 +9,10 @@ namespace Content.Shared.Weapons.Melee.Events;
 [Serializable, NetSerializable]
 public sealed class LightAttackEvent : AttackEvent
 {
-    public readonly EntityUid? Target;
-    public readonly EntityUid Weapon;
+    public readonly NetEntity? Target;
+    public readonly NetEntity Weapon;
 
-    public LightAttackEvent(EntityUid? target, EntityUid weapon, EntityCoordinates coordinates) : base(coordinates)
+    public LightAttackEvent(NetEntity? target, NetEntity weapon, NetCoordinates coordinates) : base(coordinates)
     {
         Target = target;
         Weapon = weapon;
index 012bec8ab5b70e0ab763c1b60f870ddf929b1821..66acc213c1d9cab7724a71b23bd8c8b00185b7ca 100644 (file)
@@ -9,7 +9,7 @@ namespace Content.Shared.Weapons.Melee.Events;
 [Serializable, NetSerializable]
 public sealed class MeleeLungeEvent : EntityEventArgs
 {
-    public EntityUid Entity;
+    public NetEntity Entity;
 
     /// <summary>
     /// Width of the attack angle.
@@ -26,9 +26,9 @@ public sealed class MeleeLungeEvent : EntityEventArgs
     /// </summary>
     public string? Animation;
 
-    public MeleeLungeEvent(EntityUid uid, Angle angle, Vector2 localPos, string? animation)
+    public MeleeLungeEvent(NetEntity entity, Angle angle, Vector2 localPos, string? animation)
     {
-        Entity = uid;
+        Entity = entity;
         Angle = angle;
         LocalPos = localPos;
         Animation = animation;
index e7fa5cd4a205636c2883758fadb799f0340608f3..ff98a5fb66580146d9a1e676216f4963adfab2a2 100644 (file)
@@ -5,9 +5,9 @@ namespace Content.Shared.Weapons.Melee.Events;
 [Serializable, NetSerializable]
 public sealed class StopAttackEvent : EntityEventArgs
 {
-    public readonly EntityUid Weapon;
+    public readonly NetEntity Weapon;
 
-    public StopAttackEvent(EntityUid weapon)
+    public StopAttackEvent(NetEntity weapon)
     {
         Weapon = weapon;
     }
index 05f9997813f46ac7ae265ec5733d194f2bdb6442..08ecea43263c6c9f231dda2d6a5b7d22239c6dd7 100644 (file)
@@ -164,7 +164,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
             return;
 
         if (!TryGetWeapon(user.Value, out var weaponUid, out var weapon) ||
-            weaponUid != msg.Weapon)
+            weaponUid != GetEntity(msg.Weapon))
         {
             return;
         }
@@ -184,12 +184,12 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
             return;
 
         if (!TryGetWeapon(user.Value, out var weaponUid, out var weapon) ||
-            weaponUid != msg.Weapon)
+            weaponUid != GetEntity(msg.Weapon))
         {
             return;
         }
 
-        AttemptAttack(args.SenderSession.AttachedEntity!.Value, msg.Weapon, weapon, msg, args.SenderSession);
+        AttemptAttack(args.SenderSession.AttachedEntity!.Value, weaponUid, weapon, msg, args.SenderSession);
     }
 
     private void OnHeavyAttack(HeavyAttackEvent msg, EntitySessionEventArgs args)
@@ -200,12 +200,12 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
         }
 
         if (!TryGetWeapon(args.SenderSession.AttachedEntity.Value, out var weaponUid, out var weapon) ||
-            weaponUid != msg.Weapon)
+            weaponUid != GetEntity(msg.Weapon))
         {
             return;
         }
 
-        AttemptAttack(args.SenderSession.AttachedEntity.Value, msg.Weapon, weapon, msg, args.SenderSession);
+        AttemptAttack(args.SenderSession.AttachedEntity.Value, weaponUid, weapon, msg, args.SenderSession);
     }
 
     private void OnDisarmAttack(DisarmAttackEvent msg, EntitySessionEventArgs args)
@@ -330,7 +330,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
 
     public void AttemptLightAttackMiss(EntityUid user, EntityUid weaponUid, MeleeWeaponComponent weapon, EntityCoordinates coordinates)
     {
-        AttemptAttack(user, weaponUid, weapon, new LightAttackEvent(null, weaponUid, coordinates), null);
+        AttemptAttack(user, weaponUid, weapon, new LightAttackEvent(null, GetNetEntity(weaponUid), GetNetCoordinates(coordinates)), null);
     }
 
     public bool AttemptLightAttack(EntityUid user, EntityUid weaponUid, MeleeWeaponComponent weapon, EntityUid target)
@@ -338,7 +338,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
         if (!TryComp<TransformComponent>(target, out var targetXform))
             return false;
 
-        return AttemptAttack(user, weaponUid, weapon, new LightAttackEvent(target, weaponUid, targetXform.Coordinates), null);
+        return AttemptAttack(user, weaponUid, weapon, new LightAttackEvent(GetNetEntity(target), GetNetEntity(weaponUid), GetNetCoordinates(targetXform.Coordinates)), null);
     }
 
     public bool AttemptDisarmAttack(EntityUid user, EntityUid weaponUid, MeleeWeaponComponent weapon, EntityUid target)
@@ -346,7 +346,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
         if (!TryComp<TransformComponent>(target, out var targetXform))
             return false;
 
-        return AttemptAttack(user, weaponUid, weapon, new DisarmAttackEvent(target, targetXform.Coordinates), null);
+        return AttemptAttack(user, weaponUid, weapon, new DisarmAttackEvent(GetNetEntity(target), GetNetCoordinates(targetXform.Coordinates)), null);
     }
 
     /// <summary>
@@ -366,16 +366,20 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
         switch (attack)
         {
             case LightAttackEvent light:
-                if (!Blocker.CanAttack(user, light.Target))
+                var lightTarget = GetEntity(light.Target);
+
+                if (!Blocker.CanAttack(user, lightTarget))
                     return false;
 
                 // Can't self-attack if you're the weapon
-                if (weaponUid == light.Target)
+                if (weaponUid == lightTarget)
                     return false;
 
                 break;
             case DisarmAttackEvent disarm:
-                if (!Blocker.CanAttack(user, disarm.Target))
+                var disarmTarget = GetEntity(disarm.Target);
+
+                if (!Blocker.CanAttack(user, disarmTarget))
                     return false;
                 break;
             default:
@@ -441,7 +445,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
                     throw new NotImplementedException();
             }
 
-            DoLungeAnimation(user, weapon.Angle, attack.Coordinates.ToMap(EntityManager, TransformSystem), weapon.Range, animation);
+            DoLungeAnimation(user, weapon.Angle, GetCoordinates(attack.Coordinates).ToMap(EntityManager, TransformSystem), weapon.Range, animation);
         }
 
         weapon.Attacking = true;
@@ -454,13 +458,14 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
     {
         // If I do not come back later to fix Light Attacks being Heavy Attacks you can throw me in the spider pit -Errant
         var damage = GetDamage(meleeUid, user, component) * GetHeavyDamageModifier(meleeUid, user, component);
+        var target = GetEntity(ev.Target);
 
         // For consistency with wide attacks stuff needs damageable.
-        if (Deleted(ev.Target) ||
-            !HasComp<DamageableComponent>(ev.Target) ||
-            !TryComp<TransformComponent>(ev.Target, out var targetXform) ||
+        if (Deleted(target) ||
+            !HasComp<DamageableComponent>(target) ||
+            !TryComp<TransformComponent>(target, out var targetXform) ||
             // Not in LOS.
-            !InRange(user, ev.Target.Value, component.Range, session))
+            !InRange(user, target.Value, component.Range, session))
         {
             // Leave IsHit set to true, because the only time it's set to false
             // is when a melee weapon is examined. Misses are inferred from an
@@ -485,7 +490,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
         // Sawmill.Debug($"Melee damage is {damage.Total} out of {component.Damage.Total}");
 
         // Raise event before doing damage so we can cancel damage if the event is handled
-        var hitEvent = new MeleeHitEvent(new List<EntityUid> { ev.Target.Value }, user, meleeUid, damage);
+        var hitEvent = new MeleeHitEvent(new List<EntityUid> { target.Value }, user, meleeUid, damage);
         RaiseLocalEvent(meleeUid, hitEvent);
 
         if (hitEvent.Handled)
@@ -493,43 +498,45 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
 
         var targets = new List<EntityUid>(1)
         {
-            ev.Target.Value
+            target.Value
         };
 
-        Interaction.DoContactInteraction(ev.Weapon, ev.Target);
-        Interaction.DoContactInteraction(user, ev.Weapon);
+        var weapon = GetEntity(ev.Weapon);
+
+        Interaction.DoContactInteraction(weapon, target);
+        Interaction.DoContactInteraction(user, weapon);
 
         // If the user is using a long-range weapon, this probably shouldn't be happening? But I'll interpret melee as a
         // somewhat messy scuffle. See also, heavy attacks.
-        Interaction.DoContactInteraction(user, ev.Target);
+        Interaction.DoContactInteraction(user, target);
 
         // For stuff that cares about it being attacked.
         var attackedEvent = new AttackedEvent(meleeUid, user, targetXform.Coordinates);
-        RaiseLocalEvent(ev.Target.Value, attackedEvent);
+        RaiseLocalEvent(target.Value, attackedEvent);
 
         var modifiedDamage = DamageSpecifier.ApplyModifierSets(damage + hitEvent.BonusDamage + attackedEvent.BonusDamage, hitEvent.ModifiersList);
-        var damageResult = Damageable.TryChangeDamage(ev.Target, modifiedDamage, origin:user);
+        var damageResult = Damageable.TryChangeDamage(target, modifiedDamage, origin:user);
 
         if (damageResult != null && damageResult.Total > FixedPoint2.Zero)
         {
             // If the target has stamina and is taking blunt damage, they should also take stamina damage based on their blunt to stamina factor
             if (damageResult.DamageDict.TryGetValue("Blunt", out var bluntDamage))
             {
-                _stamina.TakeStaminaDamage(ev.Target.Value, (bluntDamage * component.BluntStaminaDamageFactor).Float(), visual: false, source: user, with: meleeUid == user ? null : meleeUid);
+                _stamina.TakeStaminaDamage(target.Value, (bluntDamage * component.BluntStaminaDamageFactor).Float(), visual: false, source: user, with: meleeUid == user ? null : meleeUid);
             }
 
             if (meleeUid == user)
             {
                 AdminLogger.Add(LogType.MeleeHit, LogImpact.Medium,
-                    $"{ToPrettyString(user):actor} melee attacked (light) {ToPrettyString(ev.Target.Value):subject} using their hands and dealt {damageResult.Total:damage} damage");
+                    $"{ToPrettyString(user):actor} melee attacked (light) {ToPrettyString(target.Value):subject} using their hands and dealt {damageResult.Total:damage} damage");
             }
             else
             {
                 AdminLogger.Add(LogType.MeleeHit, LogImpact.Medium,
-                    $"{ToPrettyString(user):actor} melee attacked (light) {ToPrettyString(ev.Target.Value):subject} using {ToPrettyString(meleeUid):tool} and dealt {damageResult.Total:damage} damage");
+                    $"{ToPrettyString(user):actor} melee attacked (light) {ToPrettyString(target.Value):subject} using {ToPrettyString(meleeUid):tool} and dealt {damageResult.Total:damage} damage");
             }
 
-            PlayHitSound(ev.Target.Value, user, GetHighestDamageSound(modifiedDamage, _protoManager), hitEvent.HitSoundOverride, component.HitSound);
+            PlayHitSound(target.Value, user, GetHighestDamageSound(modifiedDamage, _protoManager), hitEvent.HitSoundOverride, component.HitSound);
         }
         else
         {
@@ -561,7 +568,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
         if (!TryComp<TransformComponent>(user, out var userXform))
             return false;
 
-        var targetMap = ev.Coordinates.ToMap(EntityManager, TransformSystem);
+        var targetMap = GetCoordinates(ev.Coordinates).ToMap(EntityManager, TransformSystem);
 
         if (targetMap.MapId != userXform.MapID)
             return false;
@@ -571,7 +578,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
         var distance = Math.Min(component.Range, direction.Length());
 
         var damage = GetDamage(meleeUid, user, component);
-        var entities = ev.Entities;
+        var entities = GetEntityList(ev.Entities);
 
         if (entities.Count == 0)
         {
@@ -632,12 +639,14 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
         if (hitEvent.Handled)
             return true;
 
-        Interaction.DoContactInteraction(user, ev.Weapon);
+        var weapon = GetEntity(ev.Weapon);
+
+        Interaction.DoContactInteraction(user, weapon);
 
         // For stuff that cares about it being attacked.
         foreach (var target in targets)
         {
-            Interaction.DoContactInteraction(ev.Weapon, target);
+            Interaction.DoContactInteraction(weapon, target);
 
             // If the user is using a long-range weapon, this probably shouldn't be happening? But I'll interpret melee as a
             // somewhat messy scuffle. See also, light attacks.
@@ -648,7 +657,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
 
         foreach (var entity in targets)
         {
-            var attackedEvent = new AttackedEvent(meleeUid, user, ev.Coordinates);
+            var attackedEvent = new AttackedEvent(meleeUid, user, GetCoordinates(ev.Coordinates));
             RaiseLocalEvent(entity, attackedEvent);
             var modifiedDamage = DamageSpecifier.ApplyModifierSets(damage + hitEvent.BonusDamage + attackedEvent.BonusDamage, hitEvent.ModifiersList);
 
@@ -820,9 +829,13 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
 
     protected virtual bool DoDisarm(EntityUid user, DisarmAttackEvent ev, EntityUid meleeUid, MeleeWeaponComponent component, ICommonSession? session)
     {
-        if (Deleted(ev.Target) ||
-            user == ev.Target)
+        var target = GetEntity(ev.Target);
+
+        if (Deleted(target) ||
+            user == target)
+        {
             return false;
+        }
 
         // Play a sound to give instant feedback; same with playing the animations
         Audio.PlayPredicted(component.SwingSound, meleeUid, user);
index 3c88e716b62170486dc704f31418b1f34fb1e692..807395c46551d3425600d76013cd59e089f2be2c 100644 (file)
@@ -112,14 +112,16 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
             return;
         }
 
-        if (!msg.Coordinates.TryDistance(EntityManager, TransformSystem, Transform(gunUid.Value).Coordinates,
+        var coords = GetCoordinates(msg.Coordinates);
+
+        if (!coords.TryDistance(EntityManager, TransformSystem, Transform(gunUid.Value).Coordinates,
                 out var distance) ||
             distance > gun.MaxDistance)
         {
             return;
         }
 
-        TransformSystem.SetCoordinates(gun.TetherEntity.Value, msg.Coordinates);
+        TransformSystem.SetCoordinates(gun.TetherEntity.Value, coords);
     }
 
     private void OnTetherRanged(EntityUid uid, TetherGunComponent component, AfterInteractEvent args)
@@ -283,7 +285,7 @@ public abstract partial class SharedTetherGunSystem : EntitySystem
     [Serializable, NetSerializable]
     protected sealed class RequestTetherMoveEvent : EntityEventArgs
     {
-        public EntityCoordinates Coordinates;
+        public NetCoordinates Coordinates;
     }
 
     [Serializable, NetSerializable]
index d5fb2e7dc844ef2a93569d2bc1e69d1208f57fd8..8d0f6a52838bb49be18bca045f5eecf020d77231 100644 (file)
@@ -7,7 +7,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
 
 namespace Content.Shared.Weapons.Ranged.Components;
 
-[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
+[RegisterComponent, NetworkedComponent]
 public sealed partial class BallisticAmmoProviderComponent : Component
 {
     [ViewVariables(VVAccess.ReadWrite), DataField("soundRack")]
@@ -25,7 +25,6 @@ public sealed partial class BallisticAmmoProviderComponent : Component
     public int Count => UnspawnedCount + Container.ContainedEntities.Count;
 
     [ViewVariables(VVAccess.ReadWrite), DataField("unspawnedCount")]
-    [AutoNetworkedField]
     public int UnspawnedCount;
 
     [ViewVariables(VVAccess.ReadWrite), DataField("whitelist")]
@@ -35,7 +34,6 @@ public sealed partial class BallisticAmmoProviderComponent : Component
 
     // TODO: Make this use stacks when the typeserializer is done.
     [DataField("entities")]
-    [AutoNetworkedField(true)]
     public List<EntityUid> Entities = new();
 
     /// <summary>
@@ -45,7 +43,6 @@ public sealed partial class BallisticAmmoProviderComponent : Component
     /// Set to false for entities like turrets to avoid users being able to cycle them.
     /// </remarks>
     [ViewVariables(VVAccess.ReadWrite), DataField("cycleable")]
-    [AutoNetworkedField]
     public bool Cycleable = true;
 
     /// <summary>
index ca9c3f8706988087ed50b345ae71ba7b0025e836..91f5e6cd8682887b94d6751b7fdbf703d13f6a41 100644 (file)
@@ -8,7 +8,7 @@ namespace Content.Shared.Weapons.Ranged.Events;
 [Serializable, NetSerializable]
 public sealed class MuzzleFlashEvent : EntityEventArgs
 {
-    public EntityUid Uid;
+    public NetEntity Uid;
     public string Prototype;
 
     /// <summary>
@@ -16,7 +16,7 @@ public sealed class MuzzleFlashEvent : EntityEventArgs
     /// </summary>
     public bool MatchRotation;
 
-    public MuzzleFlashEvent(EntityUid uid, string prototype, bool matchRotation = false)
+    public MuzzleFlashEvent(NetEntity uid, string prototype, bool matchRotation = false)
     {
         Uid = uid;
         Prototype = prototype;
index af352d84456cccdc2e468bd423b5bea977d746b9..21e90b2108b920356c72ef5329b5ed2c89f7c05a 100644 (file)
@@ -9,6 +9,6 @@ namespace Content.Shared.Weapons.Ranged.Events;
 [Serializable, NetSerializable]
 public sealed class RequestShootEvent : EntityEventArgs
 {
-    public EntityUid Gun;
-    public EntityCoordinates Coordinates;
-}
\ No newline at end of file
+    public NetEntity Gun;
+    public NetCoordinates Coordinates;
+}
index 5fc1f5dc4e683f6599bb01955c9fda96a330429a..8cbe6f6487b9e593feade7ac96c1ece01789e1f5 100644 (file)
@@ -8,5 +8,5 @@ namespace Content.Shared.Weapons.Ranged.Events;
 [Serializable, NetSerializable]
 public sealed class RequestStopShootEvent : EntityEventArgs
 {
-    public EntityUid Gun;
-}
\ No newline at end of file
+    public NetEntity Gun;
+}
index aea7fb4e8bcca5b6f9f88cac74ae75acd5682100..f8b2394315cec823bb53cce6fad442c8604e4add 100644 (file)
@@ -29,6 +29,29 @@ public abstract partial class SharedGunSystem
         SubscribeLocalEvent<BallisticAmmoProviderComponent, AfterInteractEvent>(OnBallisticAfterInteract);
         SubscribeLocalEvent<BallisticAmmoProviderComponent, AmmoFillDoAfterEvent>(OnBallisticAmmoFillDoAfter);
         SubscribeLocalEvent<BallisticAmmoProviderComponent, UseInHandEvent>(OnBallisticUse);
+
+        SubscribeLocalEvent<BallisticAmmoProviderComponent, ComponentGetState>(OnBallisticGetState);
+        SubscribeLocalEvent<BallisticAmmoProviderComponent, ComponentHandleState>(OnBallisticHandleState);
+    }
+
+    private void OnBallisticGetState(EntityUid uid, BallisticAmmoProviderComponent component, ref ComponentGetState args)
+    {
+        args.State = new BallisticAmmoProviderComponentState()
+        {
+            UnspawnedCount = component.UnspawnedCount,
+            Cycleable = component.Cycleable,
+            Entities = GetNetEntityList(component.Entities),
+        };
+    }
+
+    private void OnBallisticHandleState(EntityUid uid, BallisticAmmoProviderComponent component, ref ComponentHandleState args)
+    {
+        if (args.Current is not BallisticAmmoProviderComponentState state)
+            return;
+
+        component.UnspawnedCount = state.UnspawnedCount;
+        component.Cycleable = state.Cycleable;
+        component.Entities = EnsureEntityList<BallisticAmmoProviderComponent>(state.Entities, uid);
     }
 
     private void OnBallisticUse(EntityUid uid, BallisticAmmoProviderComponent component, UseInHandEvent args)
@@ -73,7 +96,7 @@ public abstract partial class SharedGunSystem
 
         args.Handled = true;
 
-        _doAfter.TryStartDoAfter(new DoAfterArgs(args.User, component.FillDelay, new AmmoFillDoAfterEvent(), used: uid, target: args.Target, eventTarget: uid)
+        _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, args.User, component.FillDelay, new AmmoFillDoAfterEvent(), used: uid, target: args.Target, eventTarget: uid)
         {
             BreakOnTargetMove = true,
             BreakOnUserMove = true,
@@ -141,7 +164,7 @@ public abstract partial class SharedGunSystem
                 SimulateInsertAmmo(ent.Value, args.Target.Value, Transform(args.Target.Value).Coordinates);
             }
 
-            if (ent.Value.IsClientSide())
+            if (IsClientSide(ent.Value))
                 Del(ent.Value);
         }
 
@@ -269,6 +292,14 @@ public abstract partial class SharedGunSystem
         Appearance.SetData(uid, AmmoVisuals.AmmoCount, GetBallisticShots(component), appearance);
         Appearance.SetData(uid, AmmoVisuals.AmmoMax, component.Capacity, appearance);
     }
+
+    [Serializable, NetSerializable]
+    private sealed class BallisticAmmoProviderComponentState : ComponentState
+    {
+        public int UnspawnedCount;
+        public List<NetEntity> Entities = new();
+        public bool Cycleable = true;
+    }
 }
 
 /// <summary>
index f66950711e812622191c540c97abcd180f9dadac..f5eb7e87121fee078021bf8ec35d72e35a03192d 100644 (file)
@@ -47,7 +47,7 @@ public partial class SharedGunSystem
         args.State = new RevolverAmmoProviderComponentState
         {
             CurrentIndex = component.CurrentIndex,
-            AmmoSlots = component.AmmoSlots,
+            AmmoSlots = GetNetEntityList(component.AmmoSlots),
             Chambers = component.Chambers,
         };
     }
@@ -64,7 +64,7 @@ public partial class SharedGunSystem
         // Need to copy across the state rather than the ref.
         for (var i = 0; i < component.AmmoSlots.Count; i++)
         {
-            component.AmmoSlots[i] = state.AmmoSlots[i];
+            component.AmmoSlots[i] = EnsureEntity<RevolverAmmoProviderComponent>(state.AmmoSlots[i], uid);
             component.Chambers[i] = state.Chambers[i];
         }
 
@@ -416,7 +416,7 @@ public partial class SharedGunSystem
     protected sealed class RevolverAmmoProviderComponentState : ComponentState
     {
         public int CurrentIndex;
-        public List<EntityUid?> AmmoSlots = default!;
+        public List<NetEntity?> AmmoSlots = default!;
         public bool?[] Chambers = default!;
     }
 
index 797a2f472d1933592822ef7e0c26ca294829036a..5ef51121527c8b2f6889205f5d3f2dc4b988b10c 100644 (file)
@@ -131,18 +131,20 @@ public abstract partial class SharedGunSystem : EntitySystem
             return;
         }
 
-        if (ent != msg.Gun)
+        if (ent != GetEntity(msg.Gun))
             return;
 
-        gun.ShootCoordinates = msg.Coordinates;
+        gun.ShootCoordinates = GetCoordinates(msg.Coordinates);
         Log.Debug($"Set shoot coordinates to {gun.ShootCoordinates}");
         AttemptShoot(user.Value, ent, gun);
     }
 
     private void OnStopShootRequest(RequestStopShootEvent ev, EntitySessionEventArgs args)
     {
+        var gunUid = GetEntity(ev.Gun);
+
         if (args.SenderSession.AttachedEntity == null ||
-            !TryComp<GunComponent>(ev.Gun, out var gun) ||
+            !TryComp<GunComponent>(gunUid, out var gun) ||
             !TryGetGun(args.SenderSession.AttachedEntity.Value, out _, out var userGun))
         {
             return;
@@ -151,7 +153,7 @@ public abstract partial class SharedGunSystem : EntitySystem
         if (userGun != gun)
             return;
 
-        StopShooting(ev.Gun, gun);
+        StopShooting(gunUid, gun);
     }
 
     public bool CanShoot(GunComponent component)
@@ -432,7 +434,7 @@ public abstract partial class SharedGunSystem : EntitySystem
         if (sprite == null)
             return;
 
-        var ev = new MuzzleFlashEvent(gun, sprite, user == gun);
+        var ev = new MuzzleFlashEvent(GetNetEntity(gun), sprite, user == gun);
         CreateEffect(gun, ev, user);
     }
 
@@ -454,7 +456,7 @@ public abstract partial class SharedGunSystem : EntitySystem
     [Serializable, NetSerializable]
     public sealed class HitscanEvent : EntityEventArgs
     {
-        public List<(EntityCoordinates coordinates, Angle angle, SpriteSpecifier Sprite, float Distance)> Sprites = new();
+        public List<(NetCoordinates coordinates, Angle angle, SpriteSpecifier Sprite, float Distance)> Sprites = new();
     }
 }
 
index 020e5c2ad08ef32de4d1e2e16008790625effc13..d4d83dfdf71a578712796dad7f645f2708a5ea7b 100644 (file)
@@ -170,7 +170,7 @@ public sealed class WieldableSystem : EntitySystem
         if (ev.Cancelled)
             return false;
 
-        var doargs = new DoAfterArgs(user, component.WieldTime, new WieldableDoAfterEvent(), used, used: used)
+        var doargs = new DoAfterArgs(EntityManager, user, component.WieldTime, new WieldableDoAfterEvent(), used, used: used)
         {
             BreakOnUserMove = false,
             BreakOnDamage = true
index 3945d93ca3d6e55fdd27334d648f6701ba6a5d4c..151bea990f031004c2a33d5808b8cb7b7c6f58f4 100644 (file)
@@ -32,7 +32,7 @@ public sealed class AnalysisConsoleExtractButtonPressedMessage : BoundUserInterf
 [Serializable, NetSerializable]
 public sealed class AnalysisConsoleScanUpdateState : BoundUserInterfaceState
 {
-    public EntityUid? Artifact;
+    public NetEntity? Artifact;
 
     public bool AnalyzerConnected;
 
@@ -52,7 +52,7 @@ public sealed class AnalysisConsoleScanUpdateState : BoundUserInterfaceState
 
     public int PointAmount;
 
-    public AnalysisConsoleScanUpdateState(EntityUid? artifact, bool analyzerConnected, bool serverConnected, bool canScan, bool canPrint,
+    public AnalysisConsoleScanUpdateState(NetEntity? artifact, bool analyzerConnected, bool serverConnected, bool canScan, bool canPrint,
         FormattedMessage? scanReport, bool scanning, TimeSpan timeRemaining, TimeSpan totalTime, int pointAmount)
     {
         Artifact = artifact;