From 5cd42c9ad6b09473c5ca73059b0a705f2c281928 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Fri, 3 Dec 2021 15:53:09 +0100 Subject: [PATCH] Inline UID --- Content.Client/AI/ClientAiDebugSystem.cs | 6 +- .../AI/ClientPathfindingDebugSystem.cs | 8 +- .../Visualizers/AMEControllerVisualizer.cs | 4 +- .../AME/Visualizers/AMEVisualizer.cs | 4 +- .../UI/IdCardConsoleBoundUserInterface.cs | 2 +- Content.Client/Actions/ActionsSystem.cs | 8 +- .../Actions/ClientActionsComponent.cs | 4 +- Content.Client/Actions/UI/ActionSlot.cs | 4 +- .../Administration/AdminNameOverlay.cs | 2 +- .../EditSolutionsWindow.xaml.cs | 2 +- .../UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs | 2 +- .../UI/Tabs/AtmosTab/AddGasWindow.xaml.cs | 2 +- .../UI/Tabs/AtmosTab/FillGasWindow.xaml.cs | 2 +- .../AtmosTab/SetTemperatureWindow.xaml.cs | 2 +- .../Animations/AnimationsTestComponent.cs | 2 +- .../Animations/ReusableAnimations.cs | 14 +-- .../Visualizers/AtmosPlaqueVisualizer.cs | 2 +- .../Atmos/Visualizers/FireVisualizer.cs | 4 +- .../Visualizers/GasCanisterVisualizer.cs | 2 +- .../Visualizers/GasPortableVisualizer.cs | 2 +- .../Visualizers/PipeConnectorVisualizer.cs | 2 +- Content.Client/Audio/AmbientSoundSystem.cs | 8 +- .../Body/UI/BodyScannerBoundUserInterface.cs | 2 +- Content.Client/Body/UI/BodyScannerDisplay.cs | 8 +- .../Botany/PlantHolderVisualizer.cs | 4 +- Content.Client/Buckle/BuckleComponent.cs | 2 +- Content.Client/Buckle/BuckleVisualizer.cs | 4 +- .../Camera/CameraRecoilComponent.cs | 2 +- .../Cargo/CargoConsoleBoundUserInterface.cs | 4 +- .../Systems/HumanoidAppearanceSystem.cs | 10 +- .../Components/CharacterInfoComponent.cs | 4 +- .../CharacterInterfaceComponent.cs | 2 +- .../CharacterInterfaceSystem.cs | 2 +- Content.Client/Chat/Managers/ChatManager.cs | 10 +- Content.Client/Chat/UI/SpeechBubble.cs | 8 +- .../Chemistry/Visualizers/VaporVisualizer.cs | 4 +- .../Clickable/ClickableComponent.cs | 4 +- Content.Client/Clothing/ClothingComponent.cs | 2 +- Content.Client/CombatMode/CombatModeSystem.cs | 2 +- Content.Client/Commands/DebugCommands.cs | 2 +- .../Commands/HideMechanismsCommand.cs | 2 +- .../Commands/ShowMechanismsCommand.cs | 2 +- Content.Client/Computer/ComputerVisualizer.cs | 4 +- .../ConstructionPlacementHijack.cs | 2 +- .../Construction/ConstructionSystem.cs | 16 +-- .../Construction/MachineFrameVisualizer.cs | 2 +- .../ContextMenu/UI/EntityMenuElement.cs | 8 +- .../ContextMenu/UI/EntityMenuPresenter.cs | 12 +- .../UI/EntityMenuPresenterGrouping.cs | 12 +- .../Crayon/CrayonDecalVisualizer.cs | 2 +- .../Cuffs/Components/HandcuffComponent.cs | 2 +- Content.Client/Damage/DamageVisualizer.cs | 6 +- .../Disposal/Systems/DisposalUnitSystem.cs | 2 +- .../UI/DisposalUnitBoundUserInterface.cs | 2 +- .../Visualizers/DisposalUnitVisualizer.cs | 2 +- .../Visualizers/DisposalVisualizer.cs | 4 +- Content.Client/DoAfter/DoAfterSystem.cs | 16 +-- Content.Client/DoAfter/UI/DoAfterGui.cs | 10 +- Content.Client/Doors/AirlockVisualizer.cs | 6 +- Content.Client/Doors/ClientDoorComponent.cs | 2 +- Content.Client/DragDrop/DragDropSystem.cs | 36 +++--- Content.Client/Entry/EntryPoint.cs | 4 +- Content.Client/Examine/ExamineSystem.cs | 8 +- .../FireExtinguisherVisualizer.cs | 2 +- Content.Client/Fluids/PuddleVisualizer.cs | 4 +- Content.Client/Ghost/GhostSystem.cs | 6 +- .../Gravity/GravityGeneratorVisualizer.cs | 4 +- .../Gravity/UI/GravityGeneratorWindow.xaml.cs | 2 +- Content.Client/Hands/HandsComponent.cs | 2 +- Content.Client/Hands/HandsGui.xaml.cs | 2 +- Content.Client/Hands/ShowHandItemOverlay.cs | 2 +- Content.Client/Hands/Systems/HandsSystem.cs | 4 +- .../HealthOverlay/HealthOverlaySystem.cs | 14 +-- .../HealthOverlay/UI/HealthOverlayGui.cs | 12 +- .../IconSmoothing/IconSmoothComponent.cs | 26 ++-- .../IconSmoothing/IconSmoothSystem.cs | 10 +- .../UI/InstrumentBoundUserInterface.cs | 2 +- .../Instruments/UI/InstrumentMenu.xaml.cs | 2 +- .../Components/InteractionOutlineComponent.cs | 6 +- .../Interactable/InteractionSystem.cs | 2 +- .../Interactable/UnobstructedExtensions.cs | 2 +- .../Inventory/ClientInventoryComponent.cs | 2 +- .../Inventory/ClientInventorySystem.cs | 4 +- .../Inventory/StrippableBoundUserInterface.cs | 2 +- .../Items/Components/ItemComponent.cs | 2 +- .../Items/Managers/ItemSlotManager.cs | 22 ++-- Content.Client/Items/UI/ItemSlotButton.cs | 2 +- Content.Client/Items/UI/ItemStatusPanel.cs | 10 +- Content.Client/Kitchen/UI/GrinderMenu.xaml.cs | 4 +- .../Kitchen/UI/MicrowaveBoundUserInterface.cs | 8 +- .../Visualizers/MicrowaveVisualizer.cs | 4 +- .../Visualizers/ReagentGrinderVisualizer.cs | 2 +- .../Lathe/UI/LatheBoundUserInterface.cs | 6 +- .../Lathe/Visualizers/AutolatheVisualizer.cs | 6 +- .../Lathe/Visualizers/ProtolatheVisualizer.cs | 6 +- .../Components/LightBehaviourComponent.cs | 20 +-- .../Light/RgbLightControllerSystem.cs | 2 +- .../Lobby/UI/LobbyCharacterPreviewPanel.cs | 10 +- .../MachineLinking/SignalSwitchVisualizer.cs | 2 +- Content.Client/Markers/MarkerComponent.cs | 2 +- .../MedicalScannerVisualizer.cs | 2 +- .../UI/MedicalScannerBoundUserInterface.cs | 2 +- .../UI/MedicalScannerWindow.xaml.cs | 2 +- .../Mining/AsteroidRockVisualizer.cs | 2 +- .../MobState/DamageStateVisualizer.cs | 2 +- .../MobState/Overlays/CritOverlay.cs | 2 +- .../NodeContainer/NodeVisualizationOverlay.cs | 10 +- .../Visualizers/CreamPiedVisualizer.cs | 4 +- Content.Client/PDA/PDAVisualizer.cs | 4 +- .../Paper/UI/PaperBoundUserInterface.cs | 2 +- .../ParticleAcceleratorPartVisualizer.cs | 2 +- .../Physics/Controllers/MoverController.cs | 18 +-- .../Components/PointingArrowComponent.cs | 2 +- .../Components/RoguePointingArrowComponent.cs | 2 +- .../Pointing/RoguePointingArrowVisualizer.cs | 4 +- Content.Client/Popups/PopupSystem.cs | 2 +- Content.Client/Power/APC/ApcVisualizer.cs | 4 +- Content.Client/Power/SMES/SmesVisualizer.cs | 4 +- .../Visualizers/PowerDeviceVisualizer.cs | 2 +- .../PowerCell/PowerCellVisualizer.cs | 4 +- .../PowerCell/PowerChargerVisualizer.cs | 4 +- .../Preferences/UI/CharacterSetupGui.xaml.cs | 6 +- .../UI/HumanoidProfileEditor.xaml.cs | 6 +- .../Recycling/RecyclerVisualizer.cs | 4 +- .../UI/ResearchConsoleBoundUserInterface.cs | 2 +- Content.Client/Rotation/RotationVisualizer.cs | 4 +- .../Components/ContainmentFieldComponent.cs | 2 +- .../Singularity/SingularityOverlay.cs | 10 +- .../RadiationCollectorVisualizer.cs | 2 +- .../Visualizers/SingularityVisualizer.cs | 2 +- Content.Client/Smoking/BurnStateVisualizer.cs | 2 +- .../Spawners/ClientEntitySpawnerComponent.cs | 2 +- Content.Client/Stack/StackVisualizer.cs | 2 +- .../StationEvents/RadiationPulseOverlay.cs | 12 +- .../Storage/ClientStorageComponent.cs | 12 +- .../Visualizers/BagOpenCloseVisualizer.cs | 2 +- .../Visualizers/MappedItemVisualizer.cs | 2 +- .../Storage/Visualizers/StorageVisualizer.cs | 2 +- Content.Client/Suspicion/SuspicionGui.xaml.cs | 2 +- Content.Client/Suspicion/TraitorOverlay.cs | 8 +- Content.Client/Tabletop/TabletopSystem.cs | 4 +- .../Trigger/TimerTriggerVisualizer.cs | 6 +- .../UI/VendingMachineVisualizer.cs | 6 +- .../VendingMachineBoundUserInterface.cs | 4 +- Content.Client/Verbs/UI/VerbMenuPresenter.cs | 6 +- Content.Client/Verbs/VerbSystem.cs | 10 +- Content.Client/Viewport/GameScreenBase.cs | 20 +-- .../Wall/Components/LowWallComponent.cs | 16 +-- .../Melee/Components/MeleeLungeComponent.cs | 4 +- .../MeleeWeaponArcAnimationComponent.cs | 10 +- .../Weapons/Melee/MeleeWeaponSystem.cs | 16 +-- .../Visualizers/BarrelBoltVisualizer.cs | 4 +- .../Barrels/Visualizers/MagVisualizer.cs | 4 +- .../Visualizers/SpentAmmoVisualizer.cs | 2 +- .../Weapons/Ranged/RangedWeaponSystem.cs | 4 +- .../Wires/Visualizers/WiresVisualizer.cs | 2 +- .../Tests/Body/LegTest.cs | 4 +- .../Tests/Body/LungTest.cs | 12 +- .../Tests/Buckle/BuckleTest.cs | 56 ++++----- .../Tests/Chemistry/TryAllReactionsTest.cs | 4 +- .../Tests/ClickableTest.cs | 10 +- .../Tests/Commands/RejuvenateTest.cs | 6 +- .../Tests/ContainerOcclusionTest.cs | 26 ++-- .../Tests/Damageable/DamageableTest.cs | 4 +- .../Tests/DeleteInventoryTest.cs | 2 +- .../DestructibleDamageGroupTest.cs | 24 ++-- .../DestructibleDamageTypeTest.cs | 32 ++--- .../DestructibleDestructionTest.cs | 10 +- .../DestructibleThresholdActivationTest.cs | 26 ++-- .../Tests/DeviceNetwork/DeviceNetworkTest.cs | 26 ++-- .../Tests/Disposal/DisposalUnitTest.cs | 18 +-- .../Tests/Doors/AirlockTest.cs | 12 +- Content.IntegrationTests/Tests/EntityTest.cs | 16 +-- .../Tests/Fluids/PuddleTest.cs | 18 +-- .../Components/ActionBlocking/HandCuffTest.cs | 14 +-- .../Components/Mobs/ActionsComponentTests.cs | 32 ++--- .../Components/Mobs/AlertsComponentTests.cs | 8 +- .../Components/Movement/ClimbUnitTest.cs | 8 +- .../Tests/Gravity/WeightlessStatusTests.cs | 4 +- .../Tests/GravityGridTest.cs | 18 +-- .../Tests/HumanInventoryUniformSlotsTest.cs | 4 +- .../Click/InteractionSystemTests.cs | 70 +++++------ .../Tests/Interaction/InRangeUnobstructed.cs | 10 +- .../Tests/InventoryHelpersTest.cs | 8 +- .../Tests/MindEntityDeletionTest.cs | 16 +-- .../Tests/Networking/ConnectTest.cs | 3 +- .../Networking/SimplePredictReconcileTest.cs | 14 +-- .../Tests/PDA/PDAExtensionsTests.cs | 28 ++--- .../Tests/Power/PowerTest.cs | 114 +++++++++--------- .../Tests/SaveLoadMapTest.cs | 4 +- Content.IntegrationTests/Tests/ShuttleTest.cs | 8 +- Content.IntegrationTests/Tests/Tag/TagTest.cs | 2 +- .../Utility/EntitySystemExtensionsTest.cs | 2 +- .../Tests/Utility/EntityWhitelistTest.cs | 14 ++- Content.Server/AI/Commands/AddAiCommand.cs | 6 +- .../AI/Components/AiControllerComponent.cs | 4 +- .../AI/EntitySystems/AiFactionTagSystem.cs | 6 +- Content.Server/AI/EntitySystems/AiSystem.cs | 6 +- .../AI/LoadBalancer/AiActionRequestJob.cs | 4 +- .../Combat/Melee/SwingMeleeWeaponOperator.cs | 12 +- .../Combat/Melee/UnarmedCombatOperator.cs | 10 +- .../Inventory/CloseStorageOperator.cs | 2 +- .../Operators/Inventory/DropEntityOperator.cs | 2 +- .../Inventory/DropHandItemsOperator.cs | 2 +- .../Inventory/EquipEntityOperator.cs | 2 +- .../Inventory/InteractWithEntityOperator.cs | 6 +- .../Inventory/OpenStorageOperator.cs | 2 +- .../Inventory/PickupEntityOperator.cs | 6 +- .../Inventory/UseItemInInventoryOperator.cs | 4 +- .../Nutrition/UseDrinkInInventoryOperator.cs | 12 +- .../Nutrition/UseFoodInInventoryOperator.cs | 12 +- .../Accessible/AiReachableSystem.cs | 18 +-- .../Pathfinding/Accessible/ReachableArgs.cs | 6 +- .../AI/Pathfinding/PathfindingNode.cs | 6 +- .../AI/Pathfinding/PathfindingSystem.cs | 22 ++-- .../AI/Steering/AiSteeringSystem.cs | 64 +++++----- .../Steering/EntityTargetSteeringRequest.cs | 4 +- .../Combat/Melee/MeleeWeaponAttackEntity.cs | 2 +- .../Combat/Melee/UnarmedAttackEntity.cs | 2 +- .../AI/Utility/Actions/Idle/WanderAndWait.cs | 2 +- .../Actions/Test/MoveRightAndLeftTen.cs | 4 +- .../AI/Utility/AiLogic/UtilityAI.cs | 2 +- .../ActionBlocker/CanMoveCon.cs | 2 +- .../Clothing/ClothingInInventoryCon.cs | 2 +- .../Combat/Melee/CanUnarmedCombatCon.cs | 2 +- .../Combat/Melee/HasMeleeWeaponCon.cs | 2 +- .../Combat/Melee/MeleeWeaponDamageCon.cs | 2 +- .../Combat/Melee/MeleeWeaponEquippedCon.cs | 2 +- .../Combat/Melee/MeleeWeaponSpeedCon.cs | 2 +- .../Considerations/Combat/TargetHealthCon.cs | 2 +- .../Considerations/Combat/TargetIsCritCon.cs | 2 +- .../Considerations/Combat/TargetIsDeadCon.cs | 2 +- .../Containers/TargetAccessibleCon.cs | 2 +- .../Considerations/Hands/FreeHandCon.cs | 2 +- .../Inventory/CanPutTargetInInventoryCon.cs | 2 +- .../Inventory/TargetInOurInventoryCon.cs | 2 +- .../Movement/TargetDistanceCon.cs | 4 +- .../Nutrition/Drink/DrinkValueCon.cs | 4 +- .../Nutrition/Drink/ThirstCon.cs | 2 +- .../Nutrition/Food/FoodValueCon.cs | 6 +- .../Nutrition/Food/HungerCon.cs | 2 +- .../Clothing/Gloves/EquipAnyGlovesExp.cs | 2 +- .../Gloves/PickUpAnyNearbyGlovesExp.cs | 2 +- .../Clothing/Head/EquipAnyHeadExp.cs | 2 +- .../Clothing/Head/PickUpAnyNearbyHeadExp.cs | 2 +- .../OuterClothing/EquipAnyOuterClothingExp.cs | 2 +- .../PickUpAnyNearbyOuterClothingExp.cs | 2 +- .../Clothing/Shoes/EquipAnyShoesExp.cs | 2 +- .../Clothing/Shoes/PickUpAnyNearbyShoesExp.cs | 2 +- .../Combat/Melee/EquipMeleeExp.cs | 2 +- .../Combat/Melee/MeleeAttackNearbyExp.cs | 2 +- .../Melee/UnarmedAttackNearbyHostilesExp.cs | 2 +- .../Nutrition/UseDrinkInInventoryExp.cs | 2 +- .../Nutrition/UseFoodInInventoryExp.cs | 2 +- Content.Server/AI/Utility/UtilityAiHelpers.cs | 2 +- Content.Server/AI/Utils/Visibility.cs | 6 +- .../States/Clothing/EquippedClothingState.cs | 2 +- .../States/Clothing/NearbyClothingState.cs | 6 +- .../Combat/Nearby/NearbyMeleeWeapons.cs | 4 +- .../States/Hands/AnyFreeHandState.cs | 2 +- .../AI/WorldState/States/Hands/FreeHands.cs | 2 +- .../WorldState/States/Hands/HandItemsState.cs | 2 +- .../States/Inventory/EquippedEntityState.cs | 2 +- .../States/Inventory/InventoryState.cs | 4 +- .../Inventory/LastOpenedStorageState.cs | 2 +- .../States/Mobs/NearbyBodiesState.cs | 4 +- .../States/Mobs/NearbyPlayersState.cs | 6 +- .../States/Nutrition/HungryState.cs | 2 +- .../States/Nutrition/NearbyDrinkState.cs | 6 +- .../States/Nutrition/NearbyFoodState.cs | 6 +- .../States/Nutrition/ThirstyState.cs | 2 +- Content.Server/AME/AMENodeGroup.cs | 10 +- .../AME/Components/AMEControllerComponent.cs | 24 ++-- .../AME/Components/AMEPartComponent.cs | 6 +- .../AME/Components/AMEShieldComponent.cs | 4 +- .../Components/IdCardConsoleComponent.cs | 26 ++-- .../Access/Systems/AccessReaderSystem.cs | 6 +- Content.Server/Access/Systems/IdCardSystem.cs | 10 +- Content.Server/Actions/Actions/CombatMode.cs | 2 +- .../Actions/Actions/DebugTargetEntity.cs | 6 +- .../Actions/Actions/DebugTargetPoint.cs | 2 +- Content.Server/Actions/Actions/DebugToggle.cs | 4 +- .../Actions/Actions/DisarmAction.cs | 24 ++-- Content.Server/Actions/Actions/GhostBoo.cs | 4 +- Content.Server/Actions/Actions/PAIMidi.cs | 4 +- .../Actions/Actions/ScreamAction.cs | 6 +- .../Actions/Commands/CooldownAction.cs | 2 +- .../Actions/Commands/GrantAction.cs | 2 +- .../Actions/Commands/RevokeAction.cs | 2 +- .../Actions/ServerActionsComponent.cs | 16 +-- .../Actions/Spells/GiveItemSpell.cs | 10 +- Content.Server/Administration/AdminSystem.cs | 4 +- .../Administration/AdminVerbSystem.cs | 28 ++--- .../Administration/Commands/AGhost.cs | 14 +-- .../Administration/Commands/ControlMob.cs | 4 +- .../Commands/DeleteComponent.cs | 2 +- .../Commands/DeleteEntitiesWithComponent.cs | 2 +- .../Commands/DeleteEntitiesWithId.cs | 4 +- .../Commands/DeleteEntityCommand.cs | 2 +- .../Commands/ExplosionCommand.cs | 4 +- .../Commands/FindEntitiesWithComponents.cs | 4 +- .../Commands/RejuvenateCommand.cs | 18 +-- .../Commands/RemoveExtraComponents.cs | 8 +- .../Administration/Commands/SetMindCommand.cs | 6 +- .../Commands/SetOutfitCommand.cs | 12 +- .../Administration/Commands/WarpCommand.cs | 10 +- .../Logs/AdminLogSystem.Json.cs | 2 +- .../Logs/Converters/EntityConverter.cs | 2 +- .../Logs/Converters/PlayerSessionConverter.cs | 4 +- .../Administration/UI/SetOutfitEui.cs | 2 +- Content.Server/Advertise/AdvertiseSystem.cs | 2 +- Content.Server/Alert/Click/RemoveCuffs.cs | 2 +- Content.Server/Alert/Click/ResistFire.cs | 4 +- Content.Server/Alert/Click/StopBeingPulled.cs | 4 +- Content.Server/Alert/Click/StopPiloting.cs | 2 +- Content.Server/Alert/Click/StopPulling.cs | 2 +- Content.Server/Alert/Click/Unbuckle.cs | 2 +- Content.Server/Alert/Commands/ClearAlert.cs | 2 +- Content.Server/Alert/Commands/ShowAlert.cs | 2 +- Content.Server/Alert/ServerAlertsComponent.cs | 2 +- Content.Server/Animals/Systems/UdderSystem.cs | 6 +- .../Components/BlockGameArcadeComponent.cs | 6 +- .../Components/SpaceVillainArcadeComponent.cs | 6 +- .../Atmos/Commands/AddAtmosCommand.cs | 2 +- .../Commands/AddUnsimulatedAtmosCommand.cs | 2 +- .../Atmos/Commands/DeleteGasCommand.cs | 4 +- .../Atmos/Components/AtmosPlaqueComponent.cs | 6 +- .../Atmos/Components/BreathToolComponent.cs | 4 +- .../Atmos/Components/GasAnalyzerComponent.cs | 20 +-- .../Atmos/Components/GasTankComponent.cs | 24 ++-- .../Components/MovedByPressureComponent.cs | 12 +- .../Atmos/EntitySystems/AirtightSystem.cs | 14 +-- .../EntitySystems/AtmosDebugOverlaySystem.cs | 8 +- .../EntitySystems/AtmosphereSystem.Grid.cs | 4 +- .../AtmosphereSystem.HighPressureDelta.cs | 2 +- .../EntitySystems/AtmosphereSystem.Hotspot.cs | 3 +- .../AtmosphereSystem.Processing.cs | 2 +- .../Atmos/EntitySystems/AtmosphereSystem.cs | 6 +- .../Atmos/EntitySystems/BarotraumaSystem.cs | 4 +- .../Atmos/EntitySystems/FlammableSystem.cs | 10 +- .../Atmos/EntitySystems/GasTankSystem.cs | 2 +- .../EntitySystems/GasTileOverlaySystem.cs | 6 +- .../GasDualPortVentPumpSystem.cs | 4 +- .../EntitySystems/GasPressurePumpSystem.cs | 10 +- .../Binary/EntitySystems/GasValveSystem.cs | 4 +- .../EntitySystems/GasVolumePumpSystem.cs | 10 +- .../Components/AtmosPipeColorComponent.cs | 2 +- .../Piping/EntitySystems/AtmosDeviceSystem.cs | 10 +- .../AtmosUnsafeUnanchorSystem.cs | 4 +- .../Other/EntitySystems/GasMinerSystem.cs | 4 +- .../Trinary/EntitySystems/GasFilterSystem.cs | 8 +- .../Trinary/EntitySystems/GasMixerSystem.cs | 6 +- .../Unary/EntitySystems/GasCanisterSystem.cs | 16 +-- .../EntitySystems/GasOutletInjectorSystem.cs | 2 +- .../EntitySystems/GasPassiveVentSystem.cs | 2 +- .../EntitySystems/GasThermoMachineSystem.cs | 2 +- .../Unary/EntitySystems/GasVentPumpSystem.cs | 4 +- .../EntitySystems/GasVentScrubberSystem.cs | 6 +- .../BarSign/Systems/BarSignSystem.cs | 10 +- .../Body/Commands/AddHandCommand.cs | 8 +- .../Body/Commands/AttachBodyPartCommand.cs | 12 +- .../Body/Commands/DestroyMechanismCommand.cs | 2 +- .../Body/Commands/RemoveHandCommand.cs | 2 +- .../Body/Components/BodyComponent.cs | 12 +- .../Body/Components/BodyPartComponent.cs | 12 +- .../Body/Components/BodyScannerComponent.cs | 6 +- .../Body/Components/InternalsComponent.cs | 12 +- .../Body/Components/MechanismComponent.cs | 12 +- .../Surgery/BiologicalSurgeryDataComponent.cs | 12 +- .../Components/SurgeryToolComponent.cs | 16 +-- .../Surgery/Components/SurgeryToolSystem.cs | 2 +- Content.Server/Body/Systems/LungSystem.cs | 4 +- .../Body/Systems/MetabolizerSystem.cs | 2 +- .../Botany/Components/LogComponent.cs | 6 +- .../Botany/Components/PlantHolderComponent.cs | 52 ++++---- .../Botany/Components/ProduceComponent.cs | 4 +- .../Components/SeedExtractorComponent.cs | 8 +- Content.Server/Botany/Seed.cs | 14 +-- Content.Server/Bql/QuerySelectors.cs | 12 +- .../Buckle/Components/BuckleComponent.cs | 42 +++---- .../Buckle/Components/StrapComponent.cs | 6 +- Content.Server/Buckle/Systems/BuckleSystem.cs | 6 +- Content.Server/Buckle/Systems/StrapSystem.cs | 12 +- .../Cargo/Components/CargoConsoleComponent.cs | 16 +-- .../Cargo/Components/CargoTelepadComponent.cs | 26 ++-- .../Components/MagicMirrorComponent.cs | 8 +- .../Systems/HumanoidAppearanceSystem.cs | 2 +- .../CharacterInfo/CharacterInfoComponent.cs | 2 +- Content.Server/Chat/Commands/SayCommand.cs | 2 +- .../Chat/Commands/SuicideCommand.cs | 12 +- Content.Server/Chat/Managers/ChatManager.cs | 34 +++--- .../Components/ChemMasterComponent.cs | 66 +++++----- .../FoamSolutionAreaEffectComponent.cs | 20 +-- .../Components/HyposprayComponent.cs | 18 +-- .../Chemistry/Components/InjectorComponent.cs | 36 +++--- .../Components/ReagentDispenserComponent.cs | 30 ++--- .../SmokeSolutionAreaEffectComponent.cs | 18 +-- .../Components/SolutionAreaEffectComponent.cs | 28 ++--- .../Components/SolutionTransferComponent.cs | 18 +-- .../TransformableContainerComponent.cs | 6 +- .../EntitySystems/ChemicalReactionSystem.cs | 2 +- .../EntitySystems/RehydratableSystem.cs | 6 +- .../EntitySystems/SolutionContainerSystem.cs | 4 +- .../SolutionInjectOnCollideSystem.cs | 4 +- .../EntitySystems/SolutionTransferSystem.cs | 2 +- .../TransformableContainerSystem.cs | 12 +- .../Chemistry/EntitySystems/VaporSystem.cs | 20 +-- .../ReactionEffects/AreaReactionEffect.cs | 2 +- .../ReactionEffects/FoamAreaReactionEffect.cs | 2 +- .../SmokeAreaReactionEffect.cs | 2 +- .../TileReactions/CleanTileReaction.cs | 4 +- .../TileReactions/CreateEntityTileReaction.cs | 2 +- .../TileReactions/SpillTileReaction.cs | 2 +- Content.Server/Climbing/ClimbSystem.cs | 4 +- .../Climbing/Components/ClimbableComponent.cs | 38 +++--- Content.Server/Cloning/CloningSystem.cs | 10 +- .../Cloning/Components/CloningPodComponent.cs | 24 ++-- .../Clothing/Components/ClothingComponent.cs | 8 +- .../Clothing/Components/MagbootsComponent.cs | 12 +- Content.Server/Commands/CommandUtils.cs | 22 ++-- .../CommunicationsConsoleComponent.cs | 2 +- Content.Server/Computer/ComputerComponent.cs | 12 +- .../Configurable/ConfigurationComponent.cs | 4 +- .../Commands/FixRotationsCommand.cs | 12 +- .../Construction/Commands/TileWallsCommand.cs | 12 +- .../Construction/Completions/BuildComputer.cs | 10 +- .../Construction/Completions/BuildMachine.cs | 12 +- .../Completions/DeleteEntitiesInContainer.cs | 2 +- .../Completions/EmptyContainer.cs | 4 +- .../Completions/SpawnPrototype.cs | 4 +- .../Components/MachineComponent.cs | 26 ++-- .../Components/MachineFrameComponent.cs | 28 ++--- .../Components/WelderRefinableComponent.cs | 12 +- .../Construction/Conditions/AirlockBolted.cs | 6 +- .../Conditions/ComponentInTile.cs | 2 +- .../Construction/Conditions/ContainerEmpty.cs | 2 +- .../Conditions/ContainerNotEmpty.cs | 2 +- .../Construction/Conditions/DoorWelded.cs | 6 +- .../Construction/Conditions/EntityAnchored.cs | 4 +- .../Conditions/MachineFrameComplete.cs | 2 +- .../Conditions/ToiletLidClosed.cs | 2 +- .../Construction/Conditions/WirePanel.cs | 2 +- .../Construction/ConstructionSystem.Graph.cs | 3 +- .../ConstructionSystem.Initial.cs | 44 +++---- .../ConstructionSystem.Interactions.cs | 6 +- .../Construction/ConstructionSystem.cs | 8 +- Content.Server/Containers/ContainerExt.cs | 4 +- .../EmptyOnMachineDeconstructSystem.cs | 2 +- Content.Server/Conveyor/ConveyorSystem.cs | 16 +-- .../Coordinates/Helpers/SnapgridHelper.cs | 2 +- Content.Server/Crayon/CrayonComponent.cs | 6 +- .../Cuffs/Components/CuffableComponent.cs | 30 ++--- .../Cuffs/Components/HandcuffComponent.cs | 6 +- Content.Server/Cuffs/CuffableSystem.cs | 12 +- Content.Server/Damage/Commands/HurtCommand.cs | 12 +- .../Systems/DamageOnToolInteractSystem.cs | 8 +- .../Damage/Systems/DamageOtherOnHitSystem.cs | 2 +- .../Behaviors/SpawnEntitiesBehavior.cs | 4 +- .../DeviceNetwork/Systems/ApcNetworkSystem.cs | 2 +- .../Systems/DeviceNetworkSystem.cs | 6 +- .../Systems/WiredNetworkSystem.cs | 2 +- .../Systems/WirelessNetworkSystem.cs | 6 +- .../Tube/Components/DisposalBendComponent.cs | 2 +- .../Tube/Components/DisposalEntryComponent.cs | 6 +- .../Components/DisposalJunctionComponent.cs | 4 +- .../Components/DisposalRouterComponent.cs | 8 +- .../Components/DisposalTaggerComponent.cs | 6 +- .../Components/DisposalTransitComponent.cs | 2 +- .../Tube/Components/DisposalTubeComponent.cs | 8 +- .../Disposal/Tube/DisposalTubeSystem.cs | 8 +- .../Disposal/TubeConnectionsCommand.cs | 2 +- .../Components/DisposalHolderComponent.cs | 6 +- .../Unit/Components/DisposalUnitComponent.cs | 8 +- .../Unit/EntitySystems/DisposableSystem.cs | 12 +- .../Unit/EntitySystems/DisposalUnitSystem.cs | 42 +++---- Content.Server/DoAfter/DoAfterEventArgs.cs | 2 +- .../Doors/Components/AirlockComponent.cs | 2 +- .../Doors/Components/FirelockComponent.cs | 8 +- .../Doors/Components/ServerDoorComponent.cs | 78 ++++++------ Content.Server/Doors/Systems/AirlockSystem.cs | 2 +- Content.Server/Doors/Systems/DoorSystem.cs | 2 +- .../Electrocution/ElectrocutionSystem.cs | 22 ++-- .../DisassembleOnActivateSystem.cs | 10 +- .../EntitySystems/SpawnAfterInteractSystem.cs | 8 +- .../EntityList/SpawnEntityListCommand.cs | 2 +- .../Components/ClusterFlashComponent.cs | 12 +- .../Components/ExplosionLaunchedComponent.cs | 2 +- .../Components/OnUseTimerTriggerComponent.cs | 2 +- .../EntitySystems/ExplosionSystem.cs | 16 +-- .../Explosion/EntitySystems/TriggerSystem.cs | 6 +- .../Extinguisher/FireExtinguisherComponent.cs | 16 +-- Content.Server/Flash/FlashSystem.cs | 18 +-- .../Fluids/Components/BucketComponent.cs | 22 ++-- .../Fluids/Components/MopComponent.cs | 18 +-- .../Fluids/Components/PuddleComponent.cs | 2 +- .../Fluids/Components/SpillExtensions.cs | 18 +-- .../Fluids/Components/SprayComponent.cs | 26 ++-- .../Fluids/EntitySystems/EvaporationSystem.cs | 4 +- .../Fluids/EntitySystems/PuddleSystem.cs | 41 ++++--- .../GameTicking/Commands/MappingCommand.cs | 2 +- .../GameTicking/GameTicker.RoundFlow.cs | 4 +- .../GameTicking/GameTicker.Spawning.cs | 32 ++--- .../GameTicking/Presets/GamePreset.cs | 16 +-- .../GameTicking/Presets/PresetSuspicion.cs | 2 +- .../GameTicking/Presets/PresetTraitor.cs | 2 +- .../Presets/PresetTraitorDeathMatch.cs | 42 +++---- .../GameTicking/Rules/RuleDeathMatch.cs | 2 +- .../GameTicking/Rules/RuleSuspicion.cs | 4 +- .../Ghost/Components/GhostRadioComponent.cs | 4 +- Content.Server/Ghost/GhostSystem.cs | 34 +++--- .../GhostRoleMobSpawnerComponent.cs | 8 +- Content.Server/Ghost/Roles/GhostRoleSystem.cs | 4 +- .../EntitySystems/GravityGeneratorSystem.cs | 18 +-- .../EntitySystems/GravityShakeSystem.cs | 4 +- .../Gravity/EntitySystems/GravitySystem.cs | 8 +- .../Gravity/EntitySystems/WeightlessSystem.cs | 14 +-- .../Hands/Components/HandsComponent.cs | 30 ++--- .../Hands/Systems/HandVirtualItemSystem.cs | 10 +- Content.Server/Hands/Systems/HandsSystem.cs | 40 +++--- Content.Server/Headset/HeadsetComponent.cs | 4 +- .../Instruments/InstrumentComponent.cs | 4 +- .../Instruments/InstrumentSystem.cs | 2 +- .../Interaction/Components/ClumsyComponent.cs | 2 +- .../Interaction/InteractionSystem.cs | 70 +++++------ Content.Server/Interaction/TilePryCommand.cs | 4 +- .../Components/DebugEquipComponent.cs | 8 +- .../HumanInventoryControllerComponent.cs | 2 +- .../Components/InventoryComponent.cs | 38 +++--- Content.Server/Inventory/InventoryHelpers.cs | 8 +- Content.Server/Inventory/InventorySystem.cs | 4 +- Content.Server/Items/ItemComponent.cs | 4 +- .../Jobs/GiveItemOnHolidaySpecial.cs | 4 +- .../Components/KitchenSpikeComponent.cs | 14 +-- .../Kitchen/Components/MicrowaveComponent.cs | 64 +++++----- .../EntitySystems/ReagentGrinderSystem.cs | 56 ++++----- .../Labels/Label/HandLabelerSystem.cs | 12 +- Content.Server/Labels/Label/LabelSystem.cs | 2 +- .../Lathe/Components/LatheComponent.cs | 26 ++-- .../Components/ProtolatheDatabaseComponent.cs | 2 +- .../Components/EmergencyLightComponent.cs | 14 +-- .../Components/ExpendableLightComponent.cs | 16 +-- .../Components/HandheldLightComponent.cs | 16 +-- .../Light/Components/LightBulbComponent.cs | 2 +- .../EntitySystems/LightReplacerSystem.cs | 28 ++--- .../Light/EntitySystems/MatchboxSystem.cs | 2 +- .../Light/EntitySystems/MatchstickSystem.cs | 8 +- .../Light/EntitySystems/PoweredLightSystem.cs | 10 +- .../UnpoweredFlashlightSystem.cs | 6 +- Content.Server/Lock/LockSystem.cs | 18 +-- .../System/SignalLinkerSystem.cs | 36 +++--- .../Medical/Components/HealingComponent.cs | 8 +- .../Components/MedicalScannerComponent.cs | 24 ++-- .../Medical/MedicalScannerSystem.cs | 6 +- .../Mind/Commands/MindInfoCommand.cs | 2 +- .../Mind/Components/MindComponent.cs | 18 +-- Content.Server/Mind/Mind.cs | 14 +-- .../Components/AsteroidRockComponent.cs | 8 +- .../BodyBagEntityStorageComponent.cs | 2 +- .../CrematoriumEntityStorageComponent.cs | 12 +- .../MorgueEntityStorageComponent.cs | 14 +-- .../Morgue/Components/MorgueTrayComponent.cs | 2 +- .../Components/FootstepModifierComponent.cs | 2 +- .../Components/StressTestMovementComponent.cs | 2 +- .../Movement/StressTestMovementSystem.cs | 2 +- .../EntitySystems/NodeGroupSystem.cs | 2 +- .../NodeContainer/NodeGroups/BaseNodeGroup.cs | 2 +- .../NodeContainer/Nodes/AdjacentNode.cs | 6 +- Content.Server/NodeContainer/Nodes/Node.cs | 2 +- .../NodeContainer/Nodes/PipeNode.cs | 18 +-- Content.Server/Nuke/NukeSystem.cs | 6 +- .../Nutrition/Components/FoodComponent.cs | 2 +- .../Nutrition/Components/HungerComponent.cs | 8 +- .../Nutrition/Components/ThirstComponent.cs | 8 +- .../Nutrition/EntitySystems/CreamPieSystem.cs | 2 +- .../Nutrition/EntitySystems/DrinkSystem.cs | 8 +- .../Nutrition/EntitySystems/FoodSystem.cs | 6 +- .../EntitySystems/ForcefeedOnCollideSystem.cs | 2 +- .../EntitySystems/SliceableFoodSystem.cs | 6 +- .../EntitySystems/SmokingSystem.Cigar.cs | 2 +- .../Nutrition/EntitySystems/SmokingSystem.cs | 2 +- .../Nutrition/EntitySystems/UtensilSystem.cs | 6 +- Content.Server/Nutrition/Hungry.cs | 2 +- .../Conditions/KillPersonCondition.cs | 2 +- .../Conditions/KillRandomPersonCondition.cs | 2 +- .../Objectives/Conditions/StealCondition.cs | 2 +- Content.Server/PAI/PAISystem.cs | 12 +- Content.Server/PDA/PDAExtensions.cs | 12 +- Content.Server/PDA/PDASystem.cs | 16 +-- Content.Server/Paper/PaperComponent.cs | 10 +- .../ParticleAcceleratorControlBoxComponent.cs | 24 ++-- .../ParticleAcceleratorEmitterComponent.cs | 6 +- .../ParticleAcceleratorPartComponent.cs | 2 +- .../Components/ParticleProjectileComponent.cs | 12 +- .../ParticleAcceleratorPartSystem.cs | 2 +- .../Physics/Controllers/ConveyorController.cs | 4 +- .../Physics/Controllers/MoverController.cs | 14 +-- .../Physics/Controllers/PullController.cs | 10 +- .../Controllers/SingularityController.cs | 2 +- .../Pinpointer/ServerPinpointerSystem.cs | 6 +- .../Components/RandomPottedPlantComponent.cs | 4 +- .../PneumaticCannon/PneumaticCannonSystem.cs | 36 +++--- .../Components/PointingArrowComponent.cs | 8 +- .../Pointing/EntitySystems/PointingSystem.cs | 28 ++--- .../EntitySystems/RoguePointingSystem.cs | 6 +- .../Power/Components/ApcComponent.cs | 20 +-- .../Components/ApcPowerReceiverComponent.cs | 4 +- .../Power/Components/BaseCharger.cs | 14 +-- .../Components/BaseNetConnectorComponent.cs | 2 +- .../Power/Components/CableComponent.cs | 10 +- .../Power/Components/CablePlacerComponent.cs | 6 +- .../Power/EntitySystems/BaseChargerSystem.cs | 8 +- .../EntitySystems/CableMultitoolSystem.cs | 4 +- .../Power/EntitySystems/CableVisSystem.cs | 2 +- .../EntitySystems/ExtensionCableSystem.cs | 26 ++-- .../Power/EntitySystems/PowerNetSystem.cs | 12 +- .../EntitySystems/PowerReceiverSystem.cs | 6 +- Content.Server/Power/NodeGroups/ApcNet.cs | 4 +- .../NodeGroups/BaseNetConnectorNodeGroup.cs | 2 +- Content.Server/Power/NodeGroups/PowerNet.cs | 8 +- Content.Server/Power/Nodes/CableDeviceNode.cs | 4 +- Content.Server/Power/Nodes/CableNode.cs | 10 +- .../Power/Nodes/CableTerminalNode.cs | 8 +- .../Power/Nodes/CableTerminalPortNode.cs | 6 +- Content.Server/Power/SMES/SmesComponent.cs | 8 +- .../Components/PowerCellChargerComponent.cs | 4 +- .../Components/PowerCellComponent.cs | 4 +- .../Components/PowerCellSlotComponent.cs | 18 +-- Content.Server/PowerCell/PowerCellSystem.cs | 8 +- .../Components/HitscanComponent.cs | 12 +- .../Components/ProjectileComponent.cs | 2 +- .../Projectiles/ProjectileSystem.cs | 14 +-- Content.Server/Pulling/PullingSystem.cs | 2 +- Content.Server/RCD/Systems/RCDAmmoSystem.cs | 2 +- Content.Server/RCD/Systems/RCDSystem.cs | 6 +- .../Radiation/RadiationPulseComponent.cs | 4 +- .../Radiation/RadiationPulseSystem.cs | 8 +- .../Components/HandheldRadioComponent.cs | 2 +- .../Components/RecyclableComponent.cs | 4 +- .../Recycling/Components/RecyclerComponent.cs | 6 +- Content.Server/Recycling/RecyclerSystem.cs | 10 +- Content.Server/Repairable/RepairableSystem.cs | 4 +- .../Components/ResearchClientComponent.cs | 2 +- .../Components/ResearchConsoleComponent.cs | 10 +- .../ResearchPointSourceComponent.cs | 2 +- .../Components/ResearchServerComponent.cs | 2 +- .../Components/TechnologyDatabaseComponent.cs | 2 +- Content.Server/Rotatable/RotatableSystem.cs | 16 +-- .../Sandbox/Commands/ColorNetworkCommand.cs | 6 +- Content.Server/Sandbox/SandboxManager.cs | 24 ++-- .../Systems/DeployableBarrierSystem.cs | 8 +- .../EntitySystems/ShuttleConsoleSystem.cs | 16 +-- .../Shuttles/EntitySystems/ShuttleSystem.cs | 8 +- .../Components/ContainmentFieldConnection.cs | 14 +-- .../ContainmentFieldGeneratorComponent.cs | 10 +- .../Components/RadiationCollectorComponent.cs | 2 +- .../Components/ServerSingularityComponent.cs | 4 +- .../Components/SingularityGenerator.cs | 2 +- .../ContainmentFieldGeneratorSystem.cs | 2 +- .../EntitySystems/EmitterSystem.cs | 14 +-- .../EntitySystems/SingularitySystem.cs | 32 ++--- .../Solar/EntitySystems/PowerSolarSystem.cs | 10 +- .../Components/ConditionalSpawnerComponent.cs | 4 +- .../Components/RandomSpawnerComponent.cs | 10 +- .../Components/TimedSpawnerComponent.cs | 2 +- .../Components/RandomSpriteColorComponent.cs | 2 +- .../Components/RandomSpriteStateComponent.cs | 2 +- Content.Server/Stack/StackSystem.cs | 20 +-- .../Standing/StandingStateSystem.cs | 2 +- .../StationEvents/Events/GasLeak.cs | 12 +- .../StationEvents/Events/MeteorSwarm.cs | 4 +- .../StationEvents/Events/PowerGridCheck.cs | 4 +- .../StationEvents/Events/RadiationStorm.cs | 4 +- .../StationEvents/Events/StationEvent.cs | 2 +- .../CursedEntityStorageComponent.cs | 2 +- .../Components/EntityStorageComponent.cs | 40 +++--- .../Components/SecretStashComponent.cs | 14 +-- .../Components/ServerStorageComponent.cs | 64 +++++----- .../Components/StorageFillComponent.cs | 4 +- .../EntitySystems/ItemCounterSystem.cs | 4 +- .../Storage/EntitySystems/ItemMapperSystem.cs | 4 +- .../EntitySystems/SpawnItemsOnUseSystem.cs | 6 +- .../Storage/EntitySystems/StorageSystem.cs | 18 +-- Content.Server/Strip/StrippableComponent.cs | 54 ++++----- Content.Server/Strip/StrippableSystem.cs | 2 +- .../Stunnable/StunOnCollideSystem.cs | 2 +- Content.Server/Stunnable/StunSystem.cs | 4 +- Content.Server/Stunnable/StunbatonSystem.cs | 32 ++--- .../Suspicion/SuspicionRoleComponent.cs | 6 +- Content.Server/Tabletop/TabletopChessSetup.cs | 26 ++-- .../Tabletop/TabletopParchisSetup.cs | 48 +++++--- .../Tabletop/TabletopSystem.Draggable.cs | 8 +- .../Tabletop/TabletopSystem.Session.cs | 10 +- Content.Server/Tabletop/TabletopSystem.cs | 10 +- .../Components/HeatResistanceComponent.cs | 2 +- .../Components/TemperatureComponent.cs | 2 +- Content.Server/Throwing/ThrowHelper.cs | 14 +-- .../Tiles/FloorTileItemComponent.cs | 4 +- Content.Server/Toilet/ToiletComponent.cs | 18 +-- .../Tools/Components/TilePryingComponent.cs | 4 +- Content.Server/Tools/ToolSystem.Welder.cs | 14 +-- .../Uplink/Account/UplinkAccountsSystem.cs | 2 +- .../Uplink/Commands/AddUplinkCommand.cs | 2 +- .../Uplink/Telecrystal/TelecrystalSystem.cs | 2 +- Content.Server/Traitor/Uplink/UplinkSystem.cs | 18 +-- .../TraitorDeathMatchRedemptionComponent.cs | 12 +- .../UserInterface/ActivatableUISystem.cs | 4 +- .../UserInterface/UserInterfaceHelpers.cs | 2 +- .../VendingMachineComponent.cs | 20 +-- .../Verbs/Commands/InvokeVerbCommand.cs | 4 +- Content.Server/Verbs/VerbSystem.cs | 2 +- .../Weapon/Melee/MeleeWeaponSystem.cs | 34 +++--- .../Ammunition/Components/AmmoBoxComponent.cs | 16 +-- .../Ammunition/Components/AmmoComponent.cs | 4 +- .../Components/RangedMagazineComponent.cs | 12 +- .../Components/SpeedLoaderComponent.cs | 14 +-- .../Weapon/Ranged/Barrels/BarrelSystem.cs | 18 +-- .../Components/BoltActionBarrelComponent.cs | 14 +-- .../Barrels/Components/PumpBarrelComponent.cs | 12 +- .../Components/RevolverBarrelComponent.cs | 10 +- .../ServerBatteryBarrelComponent.cs | 28 ++--- .../ServerMagazineBarrelComponent.cs | 26 ++-- .../Components/ServerRangedBarrelComponent.cs | 44 +++---- .../Ranged/ServerRangedWeaponComponent.cs | 18 +-- .../Weapon/WeaponCapacitorChargerComponent.cs | 8 +- Content.Server/Wieldable/WieldableSystem.cs | 14 +-- Content.Server/Window/WindowComponent.cs | 6 +- Content.Server/WireHacking/WiresComponent.cs | 20 +-- .../Actions/Behaviors/IActionBehavior.cs | 4 +- .../Behaviors/Item/IItemActionBehavior.cs | 6 +- .../Components/ItemActionsComponent.cs | 4 +- .../Components/SharedActionsComponent.cs | 4 +- Content.Shared/Actions/IActionAttempt.cs | 10 +- .../Body/Components/SharedBodyComponent.cs | 6 +- .../Components/SharedBodyPartComponent.cs | 20 +-- .../Components/SharedBuckleComponent.cs | 2 +- .../Buckle/Components/SharedStrapComponent.cs | 2 +- .../Reaction/SharedChemicalReactionSystem.cs | 2 +- Content.Shared/Chemistry/ReactiveSystem.cs | 4 +- .../Chemistry/Reagent/ReagentPrototype.cs | 2 +- .../Climbing/SharedClimbableComponent.cs | 2 +- .../Clothing/SharedMagbootsComponent.cs | 2 +- .../CombatMode/SharedCombatModeSystem.cs | 2 +- .../Conditions/EmptyOrWindowValidInTile.cs | 2 +- .../Conditions/NoWindowsInTile.cs | 2 +- .../Conditions/WallmountCondition.cs | 6 +- .../Steps/MaterialConstructionGraphStep.cs | 2 +- .../Containers/ItemSlot/ItemSlotsComponent.cs | 2 +- .../Containers/ItemSlot/ItemSlotsSystem.cs | 26 ++-- .../EntityCoordinatesExtensions.cs | 6 +- .../Disposal/SharedDisposalUnitSystem.cs | 10 +- Content.Shared/Doors/SharedDoorComponent.cs | 2 +- Content.Shared/Examine/ExamineSystemShared.cs | 46 +++---- .../Friction/SharedTileFrictionController.cs | 4 +- .../Hands/Components/SharedHandsComponent.cs | 20 +-- Content.Shared/Hands/SharedHandsSystem.cs | 2 +- Content.Shared/Interaction/BeforeInteract.cs | 6 +- .../Helpers/SharedUnobstructedExtensions.cs | 12 +- .../Helpers/SharedUnoccludedExtensions.cs | 12 +- Content.Shared/Interaction/IActivate.cs | 4 +- Content.Shared/Interaction/IAfterInteract.cs | 6 +- Content.Shared/Interaction/IInteractHand.cs | 4 +- Content.Shared/Interaction/IInteractUsing.cs | 6 +- Content.Shared/Interaction/IUse.cs | 4 +- .../Interaction/RotateToFaceSystem.cs | 10 +- .../Interaction/SharedInteractionSystem.cs | 76 ++++++------ Content.Shared/Item/SharedItemComponent.cs | 8 +- .../Components/SharedKitchenSpikeComponent.cs | 2 +- Content.Shared/Lathe/SharedLatheComponent.cs | 4 +- Content.Shared/Maps/TurfHelpers.cs | 2 +- .../SharedMedicalScannerComponent.cs | 2 +- .../MobState/Components/MobStateComponent.cs | 4 +- .../MovementIgnoreGravityComponent.cs | 8 +- .../SharedPlayerInputMoverComponent.cs | 2 +- .../SharedPlayerMobMoverComponent.cs | 2 +- .../EntitySystems/SharedMobMoverSystem.cs | 2 +- .../EntitySystems/SharedMoverSystem.cs | 10 +- .../Movement/SharedMoverController.cs | 10 +- .../EntitySystems/SharedCreamPieSystem.cs | 2 +- .../Placeable/PlaceableSurfaceSystem.cs | 8 +- .../Popups/SharedPopupExtensions.cs | 6 +- .../Pulling/Components/PullableComponent.cs | 4 +- .../Pulling/Systems/SharedPullerSystem.cs | 4 +- .../SharedPullingStateManagementSystem.cs | 22 ++-- .../Systems/SharedPullingSystem.Actions.cs | 26 ++-- .../Pulling/Systems/SharedPullingSystem.cs | 26 ++-- .../Random/Helpers/SharedEntityExtensions.cs | 2 +- .../Shuttles/Components/PilotComponent.cs | 2 +- .../Singularity/SharedSingularitySystem.cs | 12 +- .../Slippery/SharedSlipperySystem.cs | 4 +- .../StatusEffect/StatusEffectsSystem.cs | 2 +- .../EntitySystems/SharedItemCounterSystem.cs | 4 +- .../EntitySystems/SharedItemMapperSystem.cs | 6 +- .../Storage/SharedStorageComponent.cs | 6 +- .../Components/SharedStrippableComponent.cs | 4 +- .../Components/SharedStrippingComponent.cs | 2 +- Content.Shared/SubFloor/SubFloorHideSystem.cs | 8 +- .../Tabletop/SharedTabletopSystem.cs | 2 +- Content.Shared/Tag/TagComponentExtensions.cs | 22 ++-- Content.Shared/Throwing/ThrownItemSystem.cs | 24 ++-- Content.Shared/Timing/UseDelayComponent.cs | 4 +- .../Transform/TransformExtensions.cs | 2 +- Content.Shared/Verbs/SharedVerbSystem.cs | 18 +-- Content.Shared/Verbs/VerbEvents.cs | 6 +- 803 files changed, 3613 insertions(+), 3577 deletions(-) diff --git a/Content.Client/AI/ClientAiDebugSystem.cs b/Content.Client/AI/ClientAiDebugSystem.cs index 80565b0051..c774e32aa3 100644 --- a/Content.Client/AI/ClientAiDebugSystem.cs +++ b/Content.Client/AI/ClientAiDebugSystem.cs @@ -40,19 +40,19 @@ namespace Content.Client.AI var deletedEntities = new List(0); foreach (var (entity, panel) in _aiBoxes) { - if ((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Deleted) { deletedEntities.Add(entity); continue; } - if (!_eyeManager.GetWorldViewport().Contains(IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition)) + if (!_eyeManager.GetWorldViewport().Contains(IoCManager.Resolve().GetComponent(entity).WorldPosition)) { panel.Visible = false; continue; } - var (x, y) = _eyeManager.CoordinatesToScreen(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates).Position; + var (x, y) = _eyeManager.CoordinatesToScreen(IoCManager.Resolve().GetComponent(entity).Coordinates).Position; var offsetPosition = new Vector2(x - panel.Width / 2, y - panel.Height - 50f); panel.Visible = true; diff --git a/Content.Client/AI/ClientPathfindingDebugSystem.cs b/Content.Client/AI/ClientPathfindingDebugSystem.cs index 82d3326722..aea3a130b7 100644 --- a/Content.Client/AI/ClientPathfindingDebugSystem.cs +++ b/Content.Client/AI/ClientPathfindingDebugSystem.cs @@ -287,7 +287,7 @@ namespace Content.Client.AI private void DrawCachedRegions(DrawingHandleScreen screenHandle, Box2 viewport) { var attachedEntity = _playerManager.LocalPlayer?.ControlledEntity; - if (attachedEntity == null || !CachedRegions.TryGetValue(IoCManager.Resolve().GetComponent(attachedEntity.Uid).GridID, out var entityRegions)) + if (attachedEntity == null || !CachedRegions.TryGetValue(IoCManager.Resolve().GetComponent(attachedEntity).GridID, out var entityRegions)) { return; } @@ -305,7 +305,7 @@ namespace Content.Client.AI screenTile.X + 15.0f, screenTile.Y + 15.0f); - screenHandle.DrawRect(box, _cachedRegionColors[IoCManager.Resolve().GetComponent(attachedEntity.Uid).GridID][region]); + screenHandle.DrawRect(box, _cachedRegionColors[IoCManager.Resolve().GetComponent(attachedEntity).GridID][region]); } } } @@ -336,7 +336,7 @@ namespace Content.Client.AI private void DrawRegions(DrawingHandleScreen screenHandle, Box2 viewport) { var attachedEntity = _playerManager.LocalPlayer?.ControlledEntity; - if (attachedEntity == null || !Regions.TryGetValue(IoCManager.Resolve().GetComponent(attachedEntity.Uid).GridID, out var entityRegions)) + if (attachedEntity == null || !Regions.TryGetValue(IoCManager.Resolve().GetComponent(attachedEntity).GridID, out var entityRegions)) { return; } @@ -356,7 +356,7 @@ namespace Content.Client.AI screenTile.X + 15.0f, screenTile.Y + 15.0f); - screenHandle.DrawRect(box, _regionColors[IoCManager.Resolve().GetComponent(attachedEntity.Uid).GridID][chunk][region]); + screenHandle.DrawRect(box, _regionColors[IoCManager.Resolve().GetComponent(attachedEntity).GridID][chunk][region]); } } } diff --git a/Content.Client/AME/Visualizers/AMEControllerVisualizer.cs b/Content.Client/AME/Visualizers/AMEControllerVisualizer.cs index f84fb0bbd7..81d38f4582 100644 --- a/Content.Client/AME/Visualizers/AMEControllerVisualizer.cs +++ b/Content.Client/AME/Visualizers/AMEControllerVisualizer.cs @@ -12,7 +12,7 @@ namespace Content.Client.AME.Visualizers public override void InitializeEntity(IEntity entity) { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); sprite.LayerMapSet(Layers.Display, sprite.AddLayerState("control_on")); sprite.LayerSetVisible(Layers.Display, false); @@ -21,7 +21,7 @@ namespace Content.Client.AME.Visualizers public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (component.TryGetData(AMEControllerVisuals.DisplayState, out var state)) { switch (state) diff --git a/Content.Client/AME/Visualizers/AMEVisualizer.cs b/Content.Client/AME/Visualizers/AMEVisualizer.cs index 12eaf91fbd..96ae206db2 100644 --- a/Content.Client/AME/Visualizers/AMEVisualizer.cs +++ b/Content.Client/AME/Visualizers/AMEVisualizer.cs @@ -12,7 +12,7 @@ namespace Content.Client.AME.Visualizers public override void InitializeEntity(IEntity entity) { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); sprite.LayerMapSet(Layers.Core, sprite.AddLayerState("core")); sprite.LayerSetVisible(Layers.Core, false); sprite.LayerMapSet(Layers.CoreState, sprite.AddLayerState("core_weak")); @@ -22,7 +22,7 @@ namespace Content.Client.AME.Visualizers public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (component.TryGetData(AMEShieldVisuals.Core, out var core)) { if (core == "isCore") diff --git a/Content.Client/Access/UI/IdCardConsoleBoundUserInterface.cs b/Content.Client/Access/UI/IdCardConsoleBoundUserInterface.cs index 23be7c6bbe..1cdefc343b 100644 --- a/Content.Client/Access/UI/IdCardConsoleBoundUserInterface.cs +++ b/Content.Client/Access/UI/IdCardConsoleBoundUserInterface.cs @@ -22,7 +22,7 @@ namespace Content.Client.Access.UI { base.Open(); - _window = new IdCardConsoleWindow(this, _prototypeManager) {Title = IoCManager.Resolve().GetComponent(Owner.Owner.Uid).EntityName}; + _window = new IdCardConsoleWindow(this, _prototypeManager) {Title = IoCManager.Resolve().GetComponent(Owner.Owner).EntityName}; _window.OnClose += Close; _window.OpenCentered(); } diff --git a/Content.Client/Actions/ActionsSystem.cs b/Content.Client/Actions/ActionsSystem.cs index 1210cc0e12..521b684fab 100644 --- a/Content.Client/Actions/ActionsSystem.cs +++ b/Content.Client/Actions/ActionsSystem.cs @@ -85,7 +85,7 @@ namespace Content.Client.Actions { var playerEntity = _playerManager.LocalPlayer?.ControlledEntity; if (playerEntity == null || - !IoCManager.Resolve().TryGetComponent(playerEntity.Uid, out var actionsComponent)) return false; + !IoCManager.Resolve().TryGetComponent(playerEntity, out var actionsComponent)) return false; actionsComponent.HandleHotbarKeybind(slot, args); return true; @@ -99,7 +99,7 @@ namespace Content.Client.Actions { var playerEntity = _playerManager.LocalPlayer?.ControlledEntity; if (playerEntity == null || - !IoCManager.Resolve().TryGetComponent(playerEntity.Uid, out var actionsComponent)) return false; + !IoCManager.Resolve().TryGetComponent(playerEntity, out var actionsComponent)) return false; actionsComponent.HandleChangeHotbarKeybind(hotbar, args); return true; @@ -111,7 +111,7 @@ namespace Content.Client.Actions { var playerEntity = _playerManager.LocalPlayer?.ControlledEntity; if (playerEntity == null || - !IoCManager.Resolve().TryGetComponent(playerEntity.Uid, out var actionsComponent)) return false; + !IoCManager.Resolve().TryGetComponent(playerEntity, out var actionsComponent)) return false; return actionsComponent.TargetingOnUse(args); } @@ -120,7 +120,7 @@ namespace Content.Client.Actions { var playerEntity = _playerManager.LocalPlayer?.ControlledEntity; if (playerEntity == null || - !IoCManager.Resolve().TryGetComponent(playerEntity.Uid, out var actionsComponent)) return; + !IoCManager.Resolve().TryGetComponent(playerEntity, out var actionsComponent)) return; actionsComponent.ToggleActionsMenu(); } diff --git a/Content.Client/Actions/ClientActionsComponent.cs b/Content.Client/Actions/ClientActionsComponent.cs index 69858c3bb9..6010505811 100644 --- a/Content.Client/Actions/ClientActionsComponent.cs +++ b/Content.Client/Actions/ClientActionsComponent.cs @@ -230,8 +230,8 @@ namespace Content.Client.Actions { StopHighlightingItemSlots(); - _highlightedEntity = item.Uid; - _itemSlotManager.HighlightEntity(item.Uid); + _highlightedEntity = item; + _itemSlotManager.HighlightEntity(item); } /// diff --git a/Content.Client/Actions/UI/ActionSlot.cs b/Content.Client/Actions/UI/ActionSlot.cs index 77db508340..169851e9bd 100644 --- a/Content.Client/Actions/UI/ActionSlot.cs +++ b/Content.Client/Actions/UI/ActionSlot.cs @@ -231,7 +231,7 @@ namespace Content.Client.Actions.UI { ActionPrototype actionPrototype => new ActionAttempt(actionPrototype), ItemActionPrototype itemActionPrototype => - (Item != null && IoCManager.Resolve().TryGetComponent(Item.Uid, out var itemActions)) ? + (Item != null && IoCManager.Resolve().TryGetComponent(Item, out var itemActions)) ? new ItemActionAttempt(itemActionPrototype, Item, itemActions) : null, _ => null }; @@ -504,7 +504,7 @@ namespace Content.Client.Actions.UI if (Item != null) { - SetItemIcon(IoCManager.Resolve().TryGetComponent(Item.Uid, out var spriteComponent) ? spriteComponent : null); + SetItemIcon(IoCManager.Resolve().TryGetComponent(Item, out var spriteComponent) ? spriteComponent : null); } else { diff --git a/Content.Client/Administration/AdminNameOverlay.cs b/Content.Client/Administration/AdminNameOverlay.cs index a0899c27c8..1f42e57d16 100644 --- a/Content.Client/Administration/AdminNameOverlay.cs +++ b/Content.Client/Administration/AdminNameOverlay.cs @@ -42,7 +42,7 @@ namespace Content.Client.Administration } // if not on the same map, continue - if (IoCManager.Resolve().GetComponent(entity.Uid).MapID != _eyeManager.CurrentMap) + if (IoCManager.Resolve().GetComponent(entity).MapID != _eyeManager.CurrentMap) { continue; } diff --git a/Content.Client/Administration/UI/ManageSolutions/EditSolutionsWindow.xaml.cs b/Content.Client/Administration/UI/ManageSolutions/EditSolutionsWindow.xaml.cs index cd10f1a7f1..c443c1d6c4 100644 --- a/Content.Client/Administration/UI/ManageSolutions/EditSolutionsWindow.xaml.cs +++ b/Content.Client/Administration/UI/ManageSolutions/EditSolutionsWindow.xaml.cs @@ -47,7 +47,7 @@ namespace Content.Client.Administration.UI.ManageSolutions _target = target; var targetName = _entityManager.TryGetEntity(target, out var entity) - ? IoCManager.Resolve().GetComponent(entity.Uid).EntityName + ? IoCManager.Resolve().GetComponent(entity).EntityName : string.Empty; Title = Loc.GetString("admin-solutions-window-title", ("targetName", targetName)); diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs index b806fbaf58..b4282c04e9 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/AddAtmosWindow.xaml.cs @@ -24,7 +24,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab foreach (var grid in _data) { IEntity? tempQualifier = IoCManager.Resolve().LocalPlayer?.ControlledEntity; - var playerGrid = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid) : null).GridID; + var playerGrid = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier) : null).GridID; GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}"); } diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs index c75ff3854f..7d2ebf9356 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/AddGasWindow.xaml.cs @@ -29,7 +29,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab foreach (var grid in _gridData) { IEntity? tempQualifier = IoCManager.Resolve().LocalPlayer?.ControlledEntity; - var playerGrid = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid) : null).GridID; + var playerGrid = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier) : null).GridID; GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}"); } diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs index 7ffa8c8b25..df931a36d3 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/FillGasWindow.xaml.cs @@ -29,7 +29,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab foreach (var grid in _gridData) { IEntity? tempQualifier = IoCManager.Resolve().LocalPlayer?.ControlledEntity; - var playerGrid = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid) : null).GridID; + var playerGrid = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier) : null).GridID; GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}"); } diff --git a/Content.Client/Administration/UI/Tabs/AtmosTab/SetTemperatureWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AtmosTab/SetTemperatureWindow.xaml.cs index 87c6b9ab15..14d2be159c 100644 --- a/Content.Client/Administration/UI/Tabs/AtmosTab/SetTemperatureWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AtmosTab/SetTemperatureWindow.xaml.cs @@ -24,7 +24,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab foreach (var grid in _data) { IEntity? tempQualifier = IoCManager.Resolve().LocalPlayer?.ControlledEntity; - var playerGrid = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid) : null).GridID; + var playerGrid = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier) : null).GridID; GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}"); } diff --git a/Content.Client/Animations/AnimationsTestComponent.cs b/Content.Client/Animations/AnimationsTestComponent.cs index 3673c60afe..92100ce33e 100644 --- a/Content.Client/Animations/AnimationsTestComponent.cs +++ b/Content.Client/Animations/AnimationsTestComponent.cs @@ -17,7 +17,7 @@ namespace Content.Client.Animations { base.Initialize(); - var animations = IoCManager.Resolve().GetComponent(Owner.Uid); + var animations = IoCManager.Resolve().GetComponent(Owner); animations.Play(new Animation { Length = TimeSpan.FromSeconds(20), diff --git a/Content.Client/Animations/ReusableAnimations.cs b/Content.Client/Animations/ReusableAnimations.cs index 9c558ff6e5..98c7096db5 100644 --- a/Content.Client/Animations/ReusableAnimations.cs +++ b/Content.Client/Animations/ReusableAnimations.cs @@ -15,20 +15,20 @@ namespace Content.Client.Animations public static void AnimateEntityPickup(IEntity entity, EntityCoordinates initialPosition, Vector2 finalPosition) { var animatableClone = IoCManager.Resolve().SpawnEntity("clientsideclone", initialPosition); - string val = IoCManager.Resolve().GetComponent(entity.Uid).EntityName; - IoCManager.Resolve().GetComponent(animatableClone.Uid).EntityName = val; + string val = IoCManager.Resolve().GetComponent(entity).EntityName; + IoCManager.Resolve().GetComponent(animatableClone).EntityName = val; - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out SpriteComponent? sprite0)) + if (!IoCManager.Resolve().TryGetComponent(entity, out SpriteComponent? sprite0)) { - Logger.Error("Entity ({0}) couldn't be animated for pickup since it doesn't have a {1}!", IoCManager.Resolve().GetComponent(entity.Uid).EntityName, nameof(SpriteComponent)); + Logger.Error("Entity ({0}) couldn't be animated for pickup since it doesn't have a {1}!", IoCManager.Resolve().GetComponent(entity).EntityName, nameof(SpriteComponent)); return; } - var sprite = IoCManager.Resolve().GetComponent(animatableClone.Uid); + var sprite = IoCManager.Resolve().GetComponent(animatableClone); sprite.CopyFrom(sprite0); - var animations = IoCManager.Resolve().GetComponent(animatableClone.Uid); + var animations = IoCManager.Resolve().GetComponent(animatableClone); animations.AnimationCompleted += (_) => { - IoCManager.Resolve().DeleteEntity(animatableClone.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) animatableClone); }; animations.Play(new Animation diff --git a/Content.Client/Atmos/Visualizers/AtmosPlaqueVisualizer.cs b/Content.Client/Atmos/Visualizers/AtmosPlaqueVisualizer.cs index 60e3f6e8f1..1a219d87b2 100644 --- a/Content.Client/Atmos/Visualizers/AtmosPlaqueVisualizer.cs +++ b/Content.Client/Atmos/Visualizers/AtmosPlaqueVisualizer.cs @@ -17,7 +17,7 @@ namespace Content.Client.Atmos.Visualizers { base.InitializeEntity(entity); - IoCManager.Resolve().GetComponentOrNull(entity.Uid); + IoCManager.Resolve().GetComponentOrNull(entity); } public override void OnChangeData(AppearanceComponent component) diff --git a/Content.Client/Atmos/Visualizers/FireVisualizer.cs b/Content.Client/Atmos/Visualizers/FireVisualizer.cs index 2dc75bac94..7e6e0b7835 100644 --- a/Content.Client/Atmos/Visualizers/FireVisualizer.cs +++ b/Content.Client/Atmos/Visualizers/FireVisualizer.cs @@ -27,7 +27,7 @@ namespace Content.Client.Atmos.Visualizers { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); sprite.LayerMapReserveBlank(FireVisualLayers.Fire); sprite.LayerSetVisible(FireVisualLayers.Fire, false); @@ -50,7 +50,7 @@ namespace Content.Client.Atmos.Visualizers private void SetOnFire(AppearanceComponent component, bool onFire, float fireStacks) { - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (_sprite != null) { diff --git a/Content.Client/Atmos/Visualizers/GasCanisterVisualizer.cs b/Content.Client/Atmos/Visualizers/GasCanisterVisualizer.cs index a42799a81e..1bc4c268b3 100644 --- a/Content.Client/Atmos/Visualizers/GasCanisterVisualizer.cs +++ b/Content.Client/Atmos/Visualizers/GasCanisterVisualizer.cs @@ -20,7 +20,7 @@ namespace Content.Client.Atmos.Visualizers { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); sprite.LayerMapSet(Layers.PressureLight, sprite.AddLayerState(_statePressure[0])); sprite.LayerSetShader(Layers.PressureLight, "unshaded"); diff --git a/Content.Client/Atmos/Visualizers/GasPortableVisualizer.cs b/Content.Client/Atmos/Visualizers/GasPortableVisualizer.cs index 1bae2d07a0..e66cfab97c 100644 --- a/Content.Client/Atmos/Visualizers/GasPortableVisualizer.cs +++ b/Content.Client/Atmos/Visualizers/GasPortableVisualizer.cs @@ -17,7 +17,7 @@ namespace Content.Client.Atmos.Visualizers { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); if (_stateConnected != null) { diff --git a/Content.Client/Atmos/Visualizers/PipeConnectorVisualizer.cs b/Content.Client/Atmos/Visualizers/PipeConnectorVisualizer.cs index aa2d47c796..13d10be7f6 100644 --- a/Content.Client/Atmos/Visualizers/PipeConnectorVisualizer.cs +++ b/Content.Client/Atmos/Visualizers/PipeConnectorVisualizer.cs @@ -41,7 +41,7 @@ namespace Content.Client.Atmos.Visualizers { base.InitializeEntity(entity); - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out var sprite)) + if (!IoCManager.Resolve().TryGetComponent(entity, out var sprite)) return; if (_connectorRsi == null) diff --git a/Content.Client/Audio/AmbientSoundSystem.cs b/Content.Client/Audio/AmbientSoundSystem.cs index baf6b9e9e6..5017890886 100644 --- a/Content.Client/Audio/AmbientSoundSystem.cs +++ b/Content.Client/Audio/AmbientSoundSystem.cs @@ -96,11 +96,11 @@ namespace Content.Client.Audio return; } - var coordinates = IoCManager.Resolve().GetComponent(player.Uid).Coordinates; + var coordinates = IoCManager.Resolve().GetComponent(player).Coordinates; foreach (var (comp, (stream, _)) in _playingSounds.ToArray()) { - if (!comp.Deleted && comp.Enabled && IoCManager.Resolve().GetComponent(comp.Owner.Uid).Coordinates.TryDistance(EntityManager, coordinates, out var range) && + if (!comp.Deleted && comp.Enabled && IoCManager.Resolve().GetComponent(comp.Owner).Coordinates.TryDistance(EntityManager, coordinates, out var range) && range <= comp.Range) { continue; @@ -136,11 +136,11 @@ namespace Content.Client.Audio foreach (var entity in _lookup.GetEntitiesInRange(coordinates, _maxAmbientRange, LookupFlags.Approximate | LookupFlags.IncludeAnchored)) { - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out AmbientSoundComponent? ambientComp) || + if (!IoCManager.Resolve().TryGetComponent(entity, out AmbientSoundComponent? ambientComp) || _playingSounds.ContainsKey(ambientComp) || !ambientComp.Enabled || // We'll also do this crude distance check because it's what we're doing in the active loop above. - !IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.TryDistance(EntityManager, coordinates, out var range) || + !IoCManager.Resolve().GetComponent(entity).Coordinates.TryDistance(EntityManager, coordinates, out var range) || range > ambientComp.Range - RangeBuffer) { continue; diff --git a/Content.Client/Body/UI/BodyScannerBoundUserInterface.cs b/Content.Client/Body/UI/BodyScannerBoundUserInterface.cs index dfad58cb91..a2a96ca937 100644 --- a/Content.Client/Body/UI/BodyScannerBoundUserInterface.cs +++ b/Content.Client/Body/UI/BodyScannerBoundUserInterface.cs @@ -38,7 +38,7 @@ namespace Content.Client.Body.UI if (!IoCManager.Resolve().TryGetEntity(scannerState.Uid, out _entity)) { - throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner.Uid} at {IoCManager.Resolve().GetComponent(Owner.Owner.Uid).MapPosition}"); + throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner} at {IoCManager.Resolve().GetComponent(Owner.Owner).MapPosition}"); } _display?.UpdateDisplay(_entity); diff --git a/Content.Client/Body/UI/BodyScannerDisplay.cs b/Content.Client/Body/UI/BodyScannerDisplay.cs index e6550050b0..8932f7df27 100644 --- a/Content.Client/Body/UI/BodyScannerDisplay.cs +++ b/Content.Client/Body/UI/BodyScannerDisplay.cs @@ -111,7 +111,7 @@ namespace Content.Client.Body.UI _currentEntity = entity; BodyPartList.Clear(); - var body = IoCManager.Resolve().GetComponentOrNull(_currentEntity.Uid); + var body = IoCManager.Resolve().GetComponentOrNull(_currentEntity); if (body == null) { @@ -129,7 +129,7 @@ namespace Content.Client.Body.UI if (_currentEntity == null) return; - var body = IoCManager.Resolve().GetComponentOrNull(_currentEntity.Uid); + var body = IoCManager.Resolve().GetComponentOrNull(_currentEntity); if (body == null) { @@ -147,10 +147,10 @@ namespace Content.Client.Body.UI private void UpdateBodyPartBox(SharedBodyPartComponent part, string slotName) { - BodyPartLabel.Text = $"{Loc.GetString(slotName)}: {Loc.GetString(IoCManager.Resolve().GetComponent(part.Owner.Uid).EntityName)}"; + BodyPartLabel.Text = $"{Loc.GetString(slotName)}: {Loc.GetString(IoCManager.Resolve().GetComponent(part.Owner).EntityName)}"; // TODO BODY Part damage - if (IoCManager.Resolve().TryGetComponent(part.Owner.Uid, out DamageableComponent? damageable)) + if (IoCManager.Resolve().TryGetComponent(part.Owner, out DamageableComponent? damageable)) { BodyPartHealth.Text = Loc.GetString("body-scanner-display-body-part-damage-text",("damage", damageable.TotalDamage)); } diff --git a/Content.Client/Botany/PlantHolderVisualizer.cs b/Content.Client/Botany/PlantHolderVisualizer.cs index f5798fb867..0a5acd3ebe 100644 --- a/Content.Client/Botany/PlantHolderVisualizer.cs +++ b/Content.Client/Botany/PlantHolderVisualizer.cs @@ -14,7 +14,7 @@ namespace Content.Client.Botany { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); sprite.LayerMapReserveBlank(PlantHolderLayers.Plant); sprite.LayerMapReserveBlank(PlantHolderLayers.HealthLight); @@ -56,7 +56,7 @@ namespace Content.Client.Botany { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (component.TryGetData(PlantHolderVisuals.Plant, out var specifier)) { diff --git a/Content.Client/Buckle/BuckleComponent.cs b/Content.Client/Buckle/BuckleComponent.cs index db048aea26..507b0dbb7f 100644 --- a/Content.Client/Buckle/BuckleComponent.cs +++ b/Content.Client/Buckle/BuckleComponent.cs @@ -31,7 +31,7 @@ namespace Content.Client.Buckle LastEntityBuckledTo = buckle.LastEntityBuckledTo; DontCollide = buckle.DontCollide; - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out SpriteComponent? ownerSprite)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out SpriteComponent? ownerSprite)) { return; } diff --git a/Content.Client/Buckle/BuckleVisualizer.cs b/Content.Client/Buckle/BuckleVisualizer.cs index a991b90ad7..035b6e8aa0 100644 --- a/Content.Client/Buckle/BuckleVisualizer.cs +++ b/Content.Client/Buckle/BuckleVisualizer.cs @@ -31,9 +31,9 @@ namespace Content.Client.Buckle private void SetRotation(AppearanceComponent component, Angle rotation) { - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); - if (!IoCManager.Resolve().TryGetComponent(sprite.Owner.Uid, out AnimationPlayerComponent? animation)) + if (!IoCManager.Resolve().TryGetComponent(sprite.Owner, out AnimationPlayerComponent? animation)) { sprite.Rotation = rotation; return; diff --git a/Content.Client/Camera/CameraRecoilComponent.cs b/Content.Client/Camera/CameraRecoilComponent.cs index 2a1c95c61d..d037fbd602 100644 --- a/Content.Client/Camera/CameraRecoilComponent.cs +++ b/Content.Client/Camera/CameraRecoilComponent.cs @@ -39,7 +39,7 @@ namespace Content.Client.Camera { if (float.IsNaN(recoil.X) || float.IsNaN(recoil.Y)) { - Logger.Error($"CameraRecoilComponent on entity {Owner.Uid} passed a NaN recoil value. Ignoring."); + Logger.Error($"CameraRecoilComponent on entity {Owner} passed a NaN recoil value. Ignoring."); return; } diff --git a/Content.Client/Cargo/CargoConsoleBoundUserInterface.cs b/Content.Client/Cargo/CargoConsoleBoundUserInterface.cs index d56f740c6e..f12eae5c52 100644 --- a/Content.Client/Cargo/CargoConsoleBoundUserInterface.cs +++ b/Content.Client/Cargo/CargoConsoleBoundUserInterface.cs @@ -50,8 +50,8 @@ namespace Content.Client.Cargo { base.Open(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Owner.Uid, out GalacticMarketComponent? market) || - !IoCManager.Resolve().TryGetComponent(Owner.Owner.Uid, out CargoOrderDatabaseComponent? orders)) return; + if (!IoCManager.Resolve().TryGetComponent(Owner.Owner, out GalacticMarketComponent? market) || + !IoCManager.Resolve().TryGetComponent(Owner.Owner, out CargoOrderDatabaseComponent? orders)) return; Market = market; Orders = orders; diff --git a/Content.Client/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs b/Content.Client/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs index 6d7067610e..720582fa01 100644 --- a/Content.Client/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs +++ b/Content.Client/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs @@ -50,7 +50,7 @@ namespace Content.Client.CharacterAppearance.Systems { foreach (var (part, _) in body.Parts) { - if (IoCManager.Resolve().TryGetComponent(part.Owner.Uid, out SpriteComponent? partSprite)) + if (IoCManager.Resolve().TryGetComponent(part.Owner, out SpriteComponent? partSprite)) { partSprite!.Color = component.Appearance.SkinColor; } @@ -108,12 +108,12 @@ namespace Content.Client.CharacterAppearance.Systems private void BodyPartAdded(HumanoidAppearanceBodyPartAddedEvent args) { if(!EntityManager.TryGetEntity(args.Uid, out var owner)) return; - if (!IoCManager.Resolve().TryGetComponent(owner.Uid, out SpriteComponent? sprite)) + if (!IoCManager.Resolve().TryGetComponent(owner, out SpriteComponent? sprite)) { return; } - if (!IoCManager.Resolve().HasComponent(args.Args.Part.Owner.Uid)) + if (!IoCManager.Resolve().HasComponent(args.Args.Part.Owner)) { return; } @@ -132,12 +132,12 @@ namespace Content.Client.CharacterAppearance.Systems private void BodyPartRemoved(HumanoidAppearanceBodyPartRemovedEvent args) { if(!EntityManager.TryGetEntity(args.Uid, out var owner)) return; - if (!IoCManager.Resolve().TryGetComponent(owner.Uid, out SpriteComponent? sprite)) + if (!IoCManager.Resolve().TryGetComponent(owner, out SpriteComponent? sprite)) { return; } - if (!IoCManager.Resolve().HasComponent(args.Args.Part.Owner.Uid)) + if (!IoCManager.Resolve().HasComponent(args.Args.Part.Owner)) { return; } diff --git a/Content.Client/CharacterInfo/Components/CharacterInfoComponent.cs b/Content.Client/CharacterInfo/Components/CharacterInfoComponent.cs index 32a82dc2e9..1c4aa52b95 100644 --- a/Content.Client/CharacterInfo/Components/CharacterInfoComponent.cs +++ b/Content.Client/CharacterInfo/Components/CharacterInfoComponent.cs @@ -50,12 +50,12 @@ namespace Content.Client.CharacterInfo.Components { case CharacterInfoMessage characterInfoMessage: _control.UpdateUI(characterInfoMessage); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ISpriteComponent? spriteComponent)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ISpriteComponent? spriteComponent)) { _control.SpriteView.Sprite = spriteComponent; } - _control.NameLabel.Text = IoCManager.Resolve().GetComponent(Owner.Uid).EntityName; + _control.NameLabel.Text = IoCManager.Resolve().GetComponent(Owner).EntityName; break; } } diff --git a/Content.Client/CharacterInterface/CharacterInterfaceComponent.cs b/Content.Client/CharacterInterface/CharacterInterfaceComponent.cs index f034a9ed30..ee944c0224 100644 --- a/Content.Client/CharacterInterface/CharacterInterfaceComponent.cs +++ b/Content.Client/CharacterInterface/CharacterInterfaceComponent.cs @@ -42,7 +42,7 @@ namespace Content.Client.CharacterInterface base.Initialize(); //Use all the character ui interfaced components to create the character window - _uiComponents = IoCManager.Resolve().GetComponents(Owner.Uid).ToList(); + _uiComponents = IoCManager.Resolve().GetComponents(Owner).ToList(); if (_uiComponents.Count == 0) { return; diff --git a/Content.Client/CharacterInterface/CharacterInterfaceSystem.cs b/Content.Client/CharacterInterface/CharacterInterfaceSystem.cs index c3ad1fa525..d8897a8e5b 100644 --- a/Content.Client/CharacterInterface/CharacterInterfaceSystem.cs +++ b/Content.Client/CharacterInterface/CharacterInterfaceSystem.cs @@ -38,7 +38,7 @@ namespace Content.Client.CharacterInterface private void HandleOpenCharacterMenu() { if (_playerManager.LocalPlayer?.ControlledEntity == null - || !IoCManager.Resolve().TryGetComponent(_playerManager.LocalPlayer.ControlledEntity.Uid, out CharacterInterfaceComponent? characterInterface)) + || !IoCManager.Resolve().TryGetComponent(_playerManager.LocalPlayer.ControlledEntity, out CharacterInterfaceComponent? characterInterface)) { return; } diff --git a/Content.Client/Chat/Managers/ChatManager.cs b/Content.Client/Chat/Managers/ChatManager.cs index d50869ca8f..49289ceb99 100644 --- a/Content.Client/Chat/Managers/ChatManager.cs +++ b/Content.Client/Chat/Managers/ChatManager.cs @@ -475,13 +475,13 @@ namespace Content.Client.Chat.Managers private void EnqueueSpeechBubble(IEntity entity, string contents, SpeechBubble.SpeechType speechType) { // Don't enqueue speech bubbles for other maps. TODO: Support multiple viewports/maps? - if (IoCManager.Resolve().GetComponent(entity.Uid).MapID != _eyeManager.CurrentMap) + if (IoCManager.Resolve().GetComponent(entity).MapID != _eyeManager.CurrentMap) return; - if (!_queuedSpeechBubbles.TryGetValue(entity.Uid, out var queueData)) + if (!_queuedSpeechBubbles.TryGetValue(entity, out var queueData)) { queueData = new SpeechBubbleQueueData(); - _queuedSpeechBubbles.Add(entity.Uid, queueData); + _queuedSpeechBubbles.Add(entity, queueData); } queueData.MessageQueue.Enqueue(new SpeechBubbleData @@ -496,7 +496,7 @@ namespace Content.Client.Chat.Managers var bubble = SpeechBubble.CreateSpeechBubble(speechData.Type, speechData.Message, entity, _eyeManager, this); - if (_activeSpeechBubbles.TryGetValue(entity.Uid, out var existing)) + if (_activeSpeechBubbles.TryGetValue(entity, out var existing)) { // Push up existing bubbles above the mob's head. foreach (var existingBubble in existing) @@ -507,7 +507,7 @@ namespace Content.Client.Chat.Managers else { existing = new List(); - _activeSpeechBubbles.Add(entity.Uid, existing); + _activeSpeechBubbles.Add(entity, existing); } existing.Add(bubble); diff --git a/Content.Client/Chat/UI/SpeechBubble.cs b/Content.Client/Chat/UI/SpeechBubble.cs index b73d3837af..2ac75d3a0c 100644 --- a/Content.Client/Chat/UI/SpeechBubble.cs +++ b/Content.Client/Chat/UI/SpeechBubble.cs @@ -99,7 +99,7 @@ namespace Content.Client.Chat.UI _verticalOffsetAchieved = MathHelper.Lerp(_verticalOffsetAchieved, VerticalOffset, 10 * args.DeltaSeconds); } - if (!IoCManager.Resolve().GetComponent(_senderEntity.Uid).Coordinates.IsValid(IoCManager.Resolve())) + if (!IoCManager.Resolve().GetComponent(_senderEntity).Coordinates.IsValid(IoCManager.Resolve())) { Modulate = Color.White.WithAlpha(0); return; @@ -116,14 +116,14 @@ namespace Content.Client.Chat.UI Modulate = Color.White; } - if ((!IoCManager.Resolve().EntityExists(_senderEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_senderEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || _timeLeft <= 0) + if ((!IoCManager.Resolve().EntityExists(_senderEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_senderEntity).EntityLifeStage) >= EntityLifeStage.Deleted || _timeLeft <= 0) { // Timer spawn to prevent concurrent modification exception. Timer.Spawn(0, Die); return; } - var worldPos = IoCManager.Resolve().GetComponent(_senderEntity.Uid).WorldPosition; + var worldPos = IoCManager.Resolve().GetComponent(_senderEntity).WorldPosition; var scale = _eyeManager.MainViewport.GetRenderScale(); var offset = new Vector2(0, EntityVerticalOffset * EyeManager.PixelsPerMeter * scale); var lowerCenter = (_eyeManager.WorldToScreen(worldPos) - offset) / UIScale; @@ -144,7 +144,7 @@ namespace Content.Client.Chat.UI return; } - _chatManager.RemoveSpeechBubble(_senderEntity.Uid, this); + _chatManager.RemoveSpeechBubble(_senderEntity, this); } /// diff --git a/Content.Client/Chemistry/Visualizers/VaporVisualizer.cs b/Content.Client/Chemistry/Visualizers/VaporVisualizer.cs index 05b20993ab..c6cd5dc945 100644 --- a/Content.Client/Chemistry/Visualizers/VaporVisualizer.cs +++ b/Content.Client/Chemistry/Visualizers/VaporVisualizer.cs @@ -54,7 +54,7 @@ namespace Content.Client.Chemistry.Visualizers { if (!state) return; - var animPlayer = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var animPlayer = IoCManager.Resolve().GetComponent(component.Owner); if(!animPlayer.HasRunningAnimation(AnimationKey)) animPlayer.Play(VaporFlick, AnimationKey); @@ -62,7 +62,7 @@ namespace Content.Client.Chemistry.Visualizers private void SetColor(AppearanceComponent component, Color color) { - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); sprite.Color = color; } diff --git a/Content.Client/Clickable/ClickableComponent.cs b/Content.Client/Clickable/ClickableComponent.cs index 7ee5c98db1..d29bd8a77b 100644 --- a/Content.Client/Clickable/ClickableComponent.cs +++ b/Content.Client/Clickable/ClickableComponent.cs @@ -29,14 +29,14 @@ namespace Content.Client.Clickable /// True if the click worked, false otherwise. public bool CheckClick(Vector2 worldPos, out int drawDepth, out uint renderOrder) { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out ISpriteComponent? sprite) || !sprite.Visible) + if (!IoCManager.Resolve().TryGetComponent(Owner, out ISpriteComponent? sprite) || !sprite.Visible) { drawDepth = default; renderOrder = default; return false; } - var transform = IoCManager.Resolve().GetComponent(Owner.Uid); + var transform = IoCManager.Resolve().GetComponent(Owner); var localPos = transform.InvWorldMatrix.Transform(worldPos); var spriteMatrix = Matrix3.Invert(sprite.GetLocalMatrix()); diff --git a/Content.Client/Clothing/ClothingComponent.cs b/Content.Client/Clothing/ClothingComponent.cs index 0725588509..a75febecd8 100644 --- a/Content.Client/Clothing/ClothingComponent.cs +++ b/Content.Client/Clothing/ClothingComponent.cs @@ -42,7 +42,7 @@ namespace Content.Client.Clothing if (!Owner.TryGetContainer(out IContainer? container)) return; - if (!IoCManager.Resolve().TryGetComponent(container.Owner.Uid, out ClientInventoryComponent? inventory)) + if (!IoCManager.Resolve().TryGetComponent(container.Owner, out ClientInventoryComponent? inventory)) return; if (!inventory.TryFindItemSlots(Owner, out EquipmentSlotDefines.Slots? slots)) return; diff --git a/Content.Client/CombatMode/CombatModeSystem.cs b/Content.Client/CombatMode/CombatModeSystem.cs index 64661b52b3..36122127c6 100644 --- a/Content.Client/CombatMode/CombatModeSystem.cs +++ b/Content.Client/CombatMode/CombatModeSystem.cs @@ -35,7 +35,7 @@ namespace Content.Client.CombatMode public bool IsInCombatMode() { var entity = _playerManager.LocalPlayer?.ControlledEntity; - if (entity == null || !IoCManager.Resolve().TryGetComponent(entity.Uid, out CombatModeComponent? combatMode)) + if (entity == null || !IoCManager.Resolve().TryGetComponent(entity, out CombatModeComponent? combatMode)) { return false; } diff --git a/Content.Client/Commands/DebugCommands.cs b/Content.Client/Commands/DebugCommands.cs index c297ef616c..0add88555d 100644 --- a/Content.Client/Commands/DebugCommands.cs +++ b/Content.Client/Commands/DebugCommands.cs @@ -55,7 +55,7 @@ namespace Content.Client.Commands foreach (var component in components) { - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out ISpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out ISpriteComponent? sprite)) { sprite.DrawDepth = (int) DrawDepth.Overlays; } diff --git a/Content.Client/Commands/HideMechanismsCommand.cs b/Content.Client/Commands/HideMechanismsCommand.cs index 64efe026b0..ad08c3be5a 100644 --- a/Content.Client/Commands/HideMechanismsCommand.cs +++ b/Content.Client/Commands/HideMechanismsCommand.cs @@ -21,7 +21,7 @@ namespace Content.Client.Commands foreach (var mechanism in mechanisms) { - if (!IoCManager.Resolve().TryGetComponent(mechanism.Owner.Uid, out SpriteComponent? sprite)) + if (!IoCManager.Resolve().TryGetComponent(mechanism.Owner, out SpriteComponent? sprite)) { continue; } diff --git a/Content.Client/Commands/ShowMechanismsCommand.cs b/Content.Client/Commands/ShowMechanismsCommand.cs index 50eb37f817..0adf5340b9 100644 --- a/Content.Client/Commands/ShowMechanismsCommand.cs +++ b/Content.Client/Commands/ShowMechanismsCommand.cs @@ -23,7 +23,7 @@ namespace Content.Client.Commands foreach (var mechanism in mechanisms) { - if (IoCManager.Resolve().TryGetComponent(mechanism.Owner.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(mechanism.Owner, out SpriteComponent? sprite)) { sprite.ContainerOccluded = false; } diff --git a/Content.Client/Computer/ComputerVisualizer.cs b/Content.Client/Computer/ComputerVisualizer.cs index 91fa0c253c..fc1bb76124 100644 --- a/Content.Client/Computer/ComputerVisualizer.cs +++ b/Content.Client/Computer/ComputerVisualizer.cs @@ -24,7 +24,7 @@ namespace Content.Client.Computer { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); sprite.LayerSetState(Layers.Screen, ScreenState); if (!string.IsNullOrEmpty(KeyboardState)) @@ -38,7 +38,7 @@ namespace Content.Client.Computer { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (!component.TryGetData(ComputerVisuals.Powered, out bool powered)) { diff --git a/Content.Client/Construction/ConstructionPlacementHijack.cs b/Content.Client/Construction/ConstructionPlacementHijack.cs index a495fbeead..9075ca4395 100644 --- a/Content.Client/Construction/ConstructionPlacementHijack.cs +++ b/Content.Client/Construction/ConstructionPlacementHijack.cs @@ -38,7 +38,7 @@ namespace Content.Client.Construction /// public override bool HijackDeletion(IEntity entity) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ConstructionGhostComponent? ghost)) + if (IoCManager.Resolve().TryGetComponent(entity, out ConstructionGhostComponent? ghost)) { _constructionSystem.ClearGhost(ghost.GhostId); } diff --git a/Content.Client/Construction/ConstructionSystem.cs b/Content.Client/Construction/ConstructionSystem.cs index b5ce427521..5c0c40e62c 100644 --- a/Content.Client/Construction/ConstructionSystem.cs +++ b/Content.Client/Construction/ConstructionSystem.cs @@ -147,7 +147,7 @@ namespace Content.Client.Construction var entity = EntityManager.GetEntity(args.EntityUid); - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out var ghostComp)) + if (!IoCManager.Resolve().TryGetComponent(entity, out var ghostComp)) return false; TryStartConstruction(ghostComp.GhostId); @@ -171,12 +171,12 @@ namespace Content.Client.Construction } var ghost = EntityManager.SpawnEntity("constructionghost", loc); - var comp = IoCManager.Resolve().GetComponent(ghost.Uid); + var comp = IoCManager.Resolve().GetComponent(ghost); comp.Prototype = prototype; comp.GhostId = _nextId++; - IoCManager.Resolve().GetComponent(ghost.Uid).LocalRotation = dir.ToAngle(); + IoCManager.Resolve().GetComponent(ghost).LocalRotation = dir.ToAngle(); _ghosts.Add(comp.GhostId, comp); - var sprite = IoCManager.Resolve().GetComponent(ghost.Uid); + var sprite = IoCManager.Resolve().GetComponent(ghost); sprite.Color = new Color(48, 255, 48, 128); sprite.AddBlankLayer(0); // There is no way to actually check if this already exists, so we blindly insert a new one sprite.LayerSetSprite(0, prototype.Icon); @@ -191,7 +191,7 @@ namespace Content.Client.Construction { foreach (var ghost in _ghosts) { - if (IoCManager.Resolve().GetComponent(ghost.Value.Owner.Uid).Coordinates.Equals(loc)) return true; + if (IoCManager.Resolve().GetComponent(ghost.Value.Owner).Coordinates.Equals(loc)) return true; } return false; @@ -206,7 +206,7 @@ namespace Content.Client.Construction throw new ArgumentException($"Can't start construction for a ghost with no prototype. Ghost id: {ghostId}"); } - var transform = IoCManager.Resolve().GetComponent(ghost.Owner.Uid); + var transform = IoCManager.Resolve().GetComponent(ghost.Owner); var msg = new TryStartStructureConstructionMessage(transform.Coordinates, ghost.Prototype.ID, transform.LocalRotation, ghostId); RaiseNetworkEvent(msg); } @@ -226,7 +226,7 @@ namespace Content.Client.Construction { if (_ghosts.TryGetValue(ghostId, out var ghost)) { - IoCManager.Resolve().QueueDeleteEntity(ghost.Owner.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) ghost.Owner); _ghosts.Remove(ghostId); } } @@ -238,7 +238,7 @@ namespace Content.Client.Construction { foreach (var (_, ghost) in _ghosts) { - IoCManager.Resolve().QueueDeleteEntity(ghost.Owner.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) ghost.Owner); } _ghosts.Clear(); diff --git a/Content.Client/Construction/MachineFrameVisualizer.cs b/Content.Client/Construction/MachineFrameVisualizer.cs index a356c47774..239d1657ac 100644 --- a/Content.Client/Construction/MachineFrameVisualizer.cs +++ b/Content.Client/Construction/MachineFrameVisualizer.cs @@ -15,7 +15,7 @@ namespace Content.Client.Construction if (component.TryGetData(MachineFrameVisuals.State, out var data)) { - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); sprite.LayerSetState(0, $"box_{data}"); } diff --git a/Content.Client/ContextMenu/UI/EntityMenuElement.cs b/Content.Client/ContextMenu/UI/EntityMenuElement.cs index b912bbdc39..70b381a282 100644 --- a/Content.Client/ContextMenu/UI/EntityMenuElement.cs +++ b/Content.Client/ContextMenu/UI/EntityMenuElement.cs @@ -58,7 +58,7 @@ namespace Content.Client.ContextMenu.UI /// public void UpdateEntity(IEntity? entity = null) { - if (Entity != null && IoCManager.Resolve().EntityExists(Entity.Uid)) + if (Entity != null && IoCManager.Resolve().EntityExists(Entity)) entity ??= Entity; if (entity == null) @@ -67,12 +67,12 @@ namespace Content.Client.ContextMenu.UI return; } - EntityIcon.Sprite = IoCManager.Resolve().GetComponentOrNull(entity.Uid); + EntityIcon.Sprite = IoCManager.Resolve().GetComponentOrNull(entity); if (UserInterfaceManager.DebugMonitors.Visible) - Text = $"{IoCManager.Resolve().GetComponent(entity!.Uid).EntityName} ({entity.Uid})"; + Text = $"{IoCManager.Resolve().GetComponent(entity!).EntityName} ({entity})"; else - Text = IoCManager.Resolve().GetComponent(entity!.Uid).EntityName; + Text = IoCManager.Resolve().GetComponent(entity!).EntityName; } } } diff --git a/Content.Client/ContextMenu/UI/EntityMenuPresenter.cs b/Content.Client/ContextMenu/UI/EntityMenuPresenter.cs index 635611fafb..3a2d17b105 100644 --- a/Content.Client/ContextMenu/UI/EntityMenuPresenter.cs +++ b/Content.Client/ContextMenu/UI/EntityMenuPresenter.cs @@ -85,7 +85,7 @@ namespace Content.Client.ContextMenu.UI var entitySpriteStates = GroupEntities(entities); var orderedStates = entitySpriteStates.ToList(); - orderedStates.Sort((x, y) => string.CompareOrdinal(IoCManager.Resolve().GetComponent(x.First().Uid).EntityPrototype?.Name, IoCManager.Resolve().GetComponent(y.First().Uid).EntityPrototype?.Name)); + orderedStates.Sort((x, y) => string.CompareOrdinal(IoCManager.Resolve().GetComponent(x.First()).EntityPrototype?.Name, IoCManager.Resolve().GetComponent(y.First()).EntityPrototype?.Name)); Elements.Clear(); AddToUI(orderedStates); @@ -135,7 +135,7 @@ namespace Content.Client.ContextMenu.UI var funcId = _inputManager.NetworkBindMap.KeyFunctionID(func); var message = new FullInputCmdMessage(_gameTiming.CurTick, _gameTiming.TickFraction, funcId, - BoundKeyState.Down, IoCManager.Resolve().GetComponent(entity.Uid).Coordinates, args.PointerLocation, entity.Uid); + BoundKeyState.Down, IoCManager.Resolve().GetComponent(entity).Coordinates, args.PointerLocation, entity); var session = _playerManager.LocalPlayer?.Session; if (session != null) @@ -184,7 +184,7 @@ namespace Content.Client.ContextMenu.UI foreach (var entity in Elements.Keys.ToList()) { - if ((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || !ignoreFov && !_examineSystem.CanExamine(player, entity)) + if ((!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Deleted || !ignoreFov && !_examineSystem.CanExamine(player, entity)) RemoveEntity(entity); } } @@ -250,7 +250,7 @@ namespace Content.Client.ContextMenu.UI // find the element associated with this entity if (!Elements.TryGetValue(entity, out var element)) { - Logger.Error($"Attempted to remove unknown entity from the entity menu: {IoCManager.Resolve().GetComponent(entity.Uid).EntityName} ({entity.Uid})"); + Logger.Error($"Attempted to remove unknown entity from the entity menu: {IoCManager.Resolve().GetComponent(entity).EntityName} ({entity})"); return; } @@ -264,7 +264,7 @@ namespace Content.Client.ContextMenu.UI UpdateElement(e); // if the verb menu is open and targeting this entity, close it. - if (_verbSystem.VerbMenu.CurrentTarget == entity.Uid) + if (_verbSystem.VerbMenu.CurrentTarget == entity) _verbSystem.VerbMenu.Close(); // If this was the last entity, close the entity menu @@ -335,7 +335,7 @@ namespace Content.Client.ContextMenu.UI if (entityElement.Entity != null) { - if (!((!IoCManager.Resolve().EntityExists(entityElement.Entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entityElement.Entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted)) + if (!((!IoCManager.Resolve().EntityExists(entityElement.Entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entityElement.Entity).EntityLifeStage) >= EntityLifeStage.Deleted)) return entityElement.Entity; continue; } diff --git a/Content.Client/ContextMenu/UI/EntityMenuPresenterGrouping.cs b/Content.Client/ContextMenu/UI/EntityMenuPresenterGrouping.cs index 57c0c69691..905c8a2f92 100644 --- a/Content.Client/ContextMenu/UI/EntityMenuPresenterGrouping.cs +++ b/Content.Client/ContextMenu/UI/EntityMenuPresenterGrouping.cs @@ -22,7 +22,7 @@ namespace Content.Client.ContextMenu.UI { if (GroupingContextMenuType == 0) { - var newEntities = entities.GroupBy(e => IoCManager.Resolve().GetComponent(e.Uid).EntityName + (IoCManager.Resolve().GetComponent(e.Uid).EntityPrototype?.ID ?? string.Empty)).ToList(); + var newEntities = entities.GroupBy(e => IoCManager.Resolve().GetComponent(e).EntityName + (IoCManager.Resolve().GetComponent(e).EntityPrototype?.ID ?? string.Empty)).ToList(); return newEntities.Select(grp => grp.ToList()).ToList(); } else @@ -36,11 +36,11 @@ namespace Content.Client.ContextMenu.UI { private static readonly List> EqualsList = new() { - (a, b) => IoCManager.Resolve().GetComponent(a.Uid).EntityPrototype!.ID == IoCManager.Resolve().GetComponent(b.Uid).EntityPrototype!.ID, + (a, b) => IoCManager.Resolve().GetComponent(a).EntityPrototype!.ID == IoCManager.Resolve().GetComponent(b).EntityPrototype!.ID, (a, b) => { - IoCManager.Resolve().TryGetComponent(a.Uid, out var spriteA); - IoCManager.Resolve().TryGetComponent(b.Uid, out var spriteB); + IoCManager.Resolve().TryGetComponent(a, out var spriteA); + IoCManager.Resolve().TryGetComponent(b, out var spriteB); if (spriteA == null || spriteB == null) return spriteA == spriteB; @@ -53,11 +53,11 @@ namespace Content.Client.ContextMenu.UI }; private static readonly List> GetHashCodeList = new() { - e => EqualityComparer.Default.GetHashCode(IoCManager.Resolve().GetComponent(e.Uid).EntityPrototype!.ID), + e => EqualityComparer.Default.GetHashCode(IoCManager.Resolve().GetComponent(e).EntityPrototype!.ID), e => { var hash = 0; - foreach (var element in IoCManager.Resolve().GetComponent(e.Uid).AllLayers.Where(obj => obj.Visible).Select(s => s.RsiState.Name)) + foreach (var element in IoCManager.Resolve().GetComponent(e).AllLayers.Where(obj => obj.Visible).Select(s => s.RsiState.Name)) { hash ^= EqualityComparer.Default.GetHashCode(element!); } diff --git a/Content.Client/Crayon/CrayonDecalVisualizer.cs b/Content.Client/Crayon/CrayonDecalVisualizer.cs index 047e23e224..cfeb50bf90 100644 --- a/Content.Client/Crayon/CrayonDecalVisualizer.cs +++ b/Content.Client/Crayon/CrayonDecalVisualizer.cs @@ -14,7 +14,7 @@ namespace Content.Client.Crayon { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (component.TryGetData(CrayonVisuals.State, out string state)) { diff --git a/Content.Client/Cuffs/Components/HandcuffComponent.cs b/Content.Client/Cuffs/Components/HandcuffComponent.cs index b3415a5b0b..a5351aa864 100644 --- a/Content.Client/Cuffs/Components/HandcuffComponent.cs +++ b/Content.Client/Cuffs/Components/HandcuffComponent.cs @@ -22,7 +22,7 @@ namespace Content.Client.Cuffs.Components return; } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var sprite)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var sprite)) { sprite.LayerSetState(0, new RSI.StateId(state.IconState)); // TODO: safety check to see if RSI contains the state? } diff --git a/Content.Client/Damage/DamageVisualizer.cs b/Content.Client/Damage/DamageVisualizer.cs index 0944b045db..4b61ab7654 100644 --- a/Content.Client/Damage/DamageVisualizer.cs +++ b/Content.Client/Damage/DamageVisualizer.cs @@ -291,9 +291,9 @@ namespace Content.Client.Damage private void InitializeVisualizer(IEntity entity, DamageVisualizerDataComponent damageData) { - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out SpriteComponent? spriteComponent) - || !IoCManager.Resolve().TryGetComponent(entity.Uid, out var damageComponent) - || !IoCManager.Resolve().HasComponent(entity.Uid)) + if (!IoCManager.Resolve().TryGetComponent(entity, out SpriteComponent? spriteComponent) + || !IoCManager.Resolve().TryGetComponent(entity, out var damageComponent) + || !IoCManager.Resolve().HasComponent(entity)) return; _thresholds.Add(FixedPoint2.Zero); diff --git a/Content.Client/Disposal/Systems/DisposalUnitSystem.cs b/Content.Client/Disposal/Systems/DisposalUnitSystem.cs index 1c183dce0d..7302c072b5 100644 --- a/Content.Client/Disposal/Systems/DisposalUnitSystem.cs +++ b/Content.Client/Disposal/Systems/DisposalUnitSystem.cs @@ -40,7 +40,7 @@ namespace Content.Client.Disposal.Systems { if (component.Deleted) return true; - if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out ClientUserInterfaceComponent? userInterface)) return true; + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out ClientUserInterfaceComponent? userInterface)) return true; var state = component.UiState; if (state == null) return true; diff --git a/Content.Client/Disposal/UI/DisposalUnitBoundUserInterface.cs b/Content.Client/Disposal/UI/DisposalUnitBoundUserInterface.cs index 50982edf1c..10eb990421 100644 --- a/Content.Client/Disposal/UI/DisposalUnitBoundUserInterface.cs +++ b/Content.Client/Disposal/UI/DisposalUnitBoundUserInterface.cs @@ -53,7 +53,7 @@ namespace Content.Client.Disposal.UI Window?.UpdateState(cast); // Kinda icky but we just want client to handle its own lerping and not flood bandwidth for it. - if (!IoCManager.Resolve().TryGetComponent(Owner.Owner.Uid, out DisposalUnitComponent? component)) return; + if (!IoCManager.Resolve().TryGetComponent(Owner.Owner, out DisposalUnitComponent? component)) return; component.UiState = cast; EntitySystem.Get().UpdateActive(component, true); diff --git a/Content.Client/Disposal/Visualizers/DisposalUnitVisualizer.cs b/Content.Client/Disposal/Visualizers/DisposalUnitVisualizer.cs index aafbf4f3e0..3153e671f1 100644 --- a/Content.Client/Disposal/Visualizers/DisposalUnitVisualizer.cs +++ b/Content.Client/Disposal/Visualizers/DisposalUnitVisualizer.cs @@ -89,7 +89,7 @@ namespace Content.Client.Disposal.Visualizers case VisualState.Flushing: sprite.LayerSetState(DisposalUnitVisualLayers.Base, _stateAnchored); - var animPlayer = IoCManager.Resolve().GetComponent(appearance.Owner.Uid); + var animPlayer = IoCManager.Resolve().GetComponent(appearance.Owner); if (!animPlayer.HasRunningAnimation(AnimationKey)) { diff --git a/Content.Client/Disposal/Visualizers/DisposalVisualizer.cs b/Content.Client/Disposal/Visualizers/DisposalVisualizer.cs index 64fe31de08..d4f53834ff 100644 --- a/Content.Client/Disposal/Visualizers/DisposalVisualizer.cs +++ b/Content.Client/Disposal/Visualizers/DisposalVisualizer.cs @@ -47,9 +47,9 @@ namespace Content.Client.Disposal.Visualizers { appearance.Owner.EnsureComponent(); } - else if (IoCManager.Resolve().HasComponent(appearance.Owner.Uid)) + else if (IoCManager.Resolve().HasComponent(appearance.Owner)) { - IoCManager.Resolve().RemoveComponent(appearance.Owner.Uid); + IoCManager.Resolve().RemoveComponent(appearance.Owner); } } diff --git a/Content.Client/DoAfter/DoAfterSystem.cs b/Content.Client/DoAfter/DoAfterSystem.cs index 55b9943c69..31e0384939 100644 --- a/Content.Client/DoAfter/DoAfterSystem.cs +++ b/Content.Client/DoAfter/DoAfterSystem.cs @@ -51,7 +51,7 @@ namespace Content.Client.DoAfter var currentTime = _gameTiming.CurTime; // Can't see any I guess? - if (_attachedEntity == null || (!IoCManager.Resolve().EntityExists(_attachedEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_attachedEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if (_attachedEntity == null || (!IoCManager.Resolve().EntityExists(_attachedEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_attachedEntity).EntityLifeStage) >= EntityLifeStage.Deleted) return; var viewbox = _eyeManager.GetWorldViewport().Enlarged(2.0f); @@ -59,23 +59,23 @@ namespace Content.Client.DoAfter foreach (var comp in EntityManager.EntityQuery(true)) { var doAfters = comp.DoAfters.ToList(); - var compPos = IoCManager.Resolve().GetComponent(comp.Owner.Uid).WorldPosition; + var compPos = IoCManager.Resolve().GetComponent(comp.Owner).WorldPosition; if (doAfters.Count == 0 || - IoCManager.Resolve().GetComponent(comp.Owner.Uid).MapID != IoCManager.Resolve().GetComponent(_attachedEntity.Uid).MapID || + IoCManager.Resolve().GetComponent(comp.Owner).MapID != IoCManager.Resolve().GetComponent(_attachedEntity).MapID || !viewbox.Contains(compPos)) { comp.Disable(); continue; } - var range = (compPos - IoCManager.Resolve().GetComponent(_attachedEntity.Uid).WorldPosition).Length + + var range = (compPos - IoCManager.Resolve().GetComponent(_attachedEntity).WorldPosition).Length + 0.01f; if (comp.Owner != _attachedEntity && !ExamineSystemShared.InRangeUnOccluded( - IoCManager.Resolve().GetComponent(_attachedEntity.Uid).MapPosition, - IoCManager.Resolve().GetComponent(comp.Owner.Uid).MapPosition, range, + IoCManager.Resolve().GetComponent(_attachedEntity).MapPosition, + IoCManager.Resolve().GetComponent(comp.Owner).MapPosition, range, entity => entity == comp.Owner || entity == _attachedEntity)) { comp.Disable(); @@ -84,7 +84,7 @@ namespace Content.Client.DoAfter comp.Enable(); - var userGrid = IoCManager.Resolve().GetComponent(comp.Owner.Uid).Coordinates; + var userGrid = IoCManager.Resolve().GetComponent(comp.Owner).Coordinates; // Check cancellations / finishes foreach (var (id, doAfter) in doAfters) @@ -117,7 +117,7 @@ namespace Content.Client.DoAfter if (doAfter.BreakOnTargetMove) { if (EntityManager.TryGetEntity(doAfter.TargetUid, out var targetEntity) && - !IoCManager.Resolve().GetComponent(targetEntity.Uid).Coordinates.InRange(EntityManager, doAfter.TargetGrid, + !IoCManager.Resolve().GetComponent(targetEntity).Coordinates.InRange(EntityManager, doAfter.TargetGrid, doAfter.MovementThreshold)) { comp.Cancel(id, currentTime); diff --git a/Content.Client/DoAfter/UI/DoAfterGui.cs b/Content.Client/DoAfter/UI/DoAfterGui.cs index 3f37075fad..c07a919526 100644 --- a/Content.Client/DoAfter/UI/DoAfterGui.cs +++ b/Content.Client/DoAfter/UI/DoAfterGui.cs @@ -149,11 +149,11 @@ namespace Content.Client.DoAfter.UI IEntity? tempQualifier = AttachedEntity; if (tempQualifier != null) { - IoCManager.Resolve().EntityExists(tempQualifier.Uid); + IoCManager.Resolve().EntityExists(tempQualifier); } if (RETURNED_VALUE != true || - !IoCManager.Resolve().TryGetComponent(AttachedEntity.Uid, out DoAfterComponent? doAfterComponent)) + !IoCManager.Resolve().TryGetComponent(AttachedEntity, out DoAfterComponent? doAfterComponent)) { Visible = false; return; @@ -166,8 +166,8 @@ namespace Content.Client.DoAfter.UI return; } - if (_eyeManager.CurrentMap != IoCManager.Resolve().GetComponent(AttachedEntity.Uid).MapID || - !IoCManager.Resolve().GetComponent(AttachedEntity.Uid).Coordinates.IsValid(_entityManager)) + if (_eyeManager.CurrentMap != IoCManager.Resolve().GetComponent(AttachedEntity).MapID || + !IoCManager.Resolve().GetComponent(AttachedEntity).Coordinates.IsValid(_entityManager)) { Visible = false; return; @@ -217,7 +217,7 @@ namespace Content.Client.DoAfter.UI RemoveDoAfter(id); } - var screenCoordinates = _eyeManager.CoordinatesToScreen(IoCManager.Resolve().GetComponent(AttachedEntity.Uid).Coordinates); + var screenCoordinates = _eyeManager.CoordinatesToScreen(IoCManager.Resolve().GetComponent(AttachedEntity).Coordinates); _playerPosition = new ScreenCoordinates(screenCoordinates.Position / UIScale, screenCoordinates.Window); LayoutContainer.SetPosition(this, new Vector2(_playerPosition.X - Width / 2, _playerPosition.Y - Height - 30.0f)); } diff --git a/Content.Client/Doors/AirlockVisualizer.cs b/Content.Client/Doors/AirlockVisualizer.cs index ab00a3fda1..2d44f9b42a 100644 --- a/Content.Client/Doors/AirlockVisualizer.cs +++ b/Content.Client/Doors/AirlockVisualizer.cs @@ -112,7 +112,7 @@ namespace Content.Client.Doors public override void InitializeEntity(IEntity entity) { - if (!IoCManager.Resolve().HasComponent(entity.Uid)) + if (!IoCManager.Resolve().HasComponent(entity)) { IoCManager.Resolve().AddComponent(entity); } @@ -122,8 +122,8 @@ namespace Content.Client.Doors { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); - var animPlayer = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); + var animPlayer = IoCManager.Resolve().GetComponent(component.Owner); if (!component.TryGetData(DoorVisuals.VisualState, out DoorVisualState state)) { state = DoorVisualState.Closed; diff --git a/Content.Client/Doors/ClientDoorComponent.cs b/Content.Client/Doors/ClientDoorComponent.cs index f3dec6ffef..0ae261e51b 100644 --- a/Content.Client/Doors/ClientDoorComponent.cs +++ b/Content.Client/Doors/ClientDoorComponent.cs @@ -39,7 +39,7 @@ namespace Content.Client.Doors base.State = value; - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, new DoorStateChangedEvent(State), false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, new DoorStateChangedEvent(State), false); } } diff --git a/Content.Client/DragDrop/DragDropSystem.cs b/Content.Client/DragDrop/DragDropSystem.cs index 73ecbbd5c5..840693aef4 100644 --- a/Content.Client/DragDrop/DragDropSystem.cs +++ b/Content.Client/DragDrop/DragDropSystem.cs @@ -142,7 +142,7 @@ namespace Content.Client.DragDrop } var canDrag = false; - foreach (var draggable in IoCManager.Resolve().GetComponents(entity.Uid)) + foreach (var draggable in IoCManager.Resolve().GetComponents(entity)) { var dragEventArgs = new StartDragDropEvent(dragger, entity); @@ -176,19 +176,19 @@ namespace Content.Client.DragDrop private bool OnBeginDrag() { - if (_dragDropHelper.Dragged == null || (!IoCManager.Resolve().EntityExists(_dragDropHelper.Dragged.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_dragDropHelper.Dragged.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if (_dragDropHelper.Dragged == null || (!IoCManager.Resolve().EntityExists(_dragDropHelper.Dragged) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_dragDropHelper.Dragged).EntityLifeStage) >= EntityLifeStage.Deleted) { // something happened to the clicked entity or we moved the mouse off the target so // we shouldn't replay the original click return false; } - if (IoCManager.Resolve().TryGetComponent(_dragDropHelper.Dragged.Uid, out var draggedSprite)) + if (IoCManager.Resolve().TryGetComponent(_dragDropHelper.Dragged, out var draggedSprite)) { // pop up drag shadow under mouse var mousePos = _eyeManager.ScreenToMap(_dragDropHelper.MouseScreenPosition); _dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos); - var dragSprite = IoCManager.Resolve().GetComponent(_dragShadow.Uid); + var dragSprite = IoCManager.Resolve().GetComponent(_dragShadow); dragSprite.CopyFrom(draggedSprite); dragSprite.RenderOrder = EntityManager.CurrentTick.Value; dragSprite.Color = dragSprite.Color.WithAlpha(0.7f); @@ -196,7 +196,7 @@ namespace Content.Client.DragDrop dragSprite.DrawDepth = (int) DrawDepth.Overlays; if (!dragSprite.NoRotation) { - IoCManager.Resolve().GetComponent(_dragShadow.Uid).WorldRotation = IoCManager.Resolve().GetComponent(_dragDropHelper.Dragged.Uid).WorldRotation; + IoCManager.Resolve().GetComponent(_dragShadow).WorldRotation = IoCManager.Resolve().GetComponent(_dragDropHelper.Dragged).WorldRotation; } HighlightTargets(); @@ -207,13 +207,13 @@ namespace Content.Client.DragDrop } Logger.Warning("Unable to display drag shadow for {0} because it" + - " has no sprite component.", IoCManager.Resolve().GetComponent(_dragDropHelper.Dragged.Uid).EntityName); + " has no sprite component.", IoCManager.Resolve().GetComponent(_dragDropHelper.Dragged).EntityName); return false; } private bool OnContinueDrag(float frameTime) { - if (_dragDropHelper.Dragged == null || (!IoCManager.Resolve().EntityExists(_dragDropHelper.Dragged.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_dragDropHelper.Dragged.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if (_dragDropHelper.Dragged == null || (!IoCManager.Resolve().EntityExists(_dragDropHelper.Dragged) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_dragDropHelper.Dragged).EntityLifeStage) >= EntityLifeStage.Deleted) { return false; } @@ -233,7 +233,7 @@ namespace Content.Client.DragDrop if (_dragShadow == null) return false; - IoCManager.Resolve().GetComponent(_dragShadow.Uid).WorldPosition = mousePos.Position; + IoCManager.Resolve().GetComponent(_dragShadow).WorldPosition = mousePos.Position; _targetRecheckTime += frameTime; if (_targetRecheckTime > TargetRecheckInterval) @@ -295,7 +295,7 @@ namespace Content.Client.DragDrop // now when ending the drag, we will not replay the click because // by this time we've determined the input was actually a drag attempt - var range = (args.Coordinates.ToMapPos(EntityManager) - IoCManager.Resolve().GetComponent(_dragger.Uid).MapPosition.Position).Length + 0.01f; + var range = (args.Coordinates.ToMapPos(EntityManager) - IoCManager.Resolve().GetComponent(_dragger).MapPosition.Position).Length + 0.01f; // tell the server we are dropping if we are over a valid drop target in range. // We don't use args.EntityUid here because drag interactions generally should // work even if there's something "on top" of the drop target @@ -330,8 +330,8 @@ namespace Content.Client.DragDrop if (!draggable.CanDrop(dropArgs)) continue; // tell the server about the drop attempt - RaiseNetworkEvent(new DragDropRequestEvent(args.Coordinates, _dragDropHelper.Dragged!.Uid, - entity.Uid)); + RaiseNetworkEvent(new DragDropRequestEvent(args.Coordinates, _dragDropHelper.Dragged!, + entity)); draggable.Drop(dropArgs); @@ -352,9 +352,9 @@ namespace Content.Client.DragDrop private void HighlightTargets() { if (_dragDropHelper.Dragged == null || - (!IoCManager.Resolve().EntityExists(_dragDropHelper.Dragged.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_dragDropHelper.Dragged.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || + (!IoCManager.Resolve().EntityExists(_dragDropHelper.Dragged) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_dragDropHelper.Dragged).EntityLifeStage) >= EntityLifeStage.Deleted || _dragShadow == null || - (!IoCManager.Resolve().EntityExists(_dragShadow.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_dragShadow.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + (!IoCManager.Resolve().EntityExists(_dragShadow) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_dragShadow).EntityLifeStage) >= EntityLifeStage.Deleted) { Logger.Warning("Programming error. Can't highlight drag and drop targets, not currently " + "dragging anything or dragged entity / shadow was deleted."); @@ -374,12 +374,12 @@ namespace Content.Client.DragDrop var pvsEntities = IoCManager.Resolve().GetEntitiesIntersecting(_eyeManager.CurrentMap, bounds, LookupFlags.Approximate | LookupFlags.IncludeAnchored); foreach (var pvsEntity in pvsEntities) { - if (!IoCManager.Resolve().TryGetComponent(pvsEntity.Uid, out ISpriteComponent? inRangeSprite) || + if (!IoCManager.Resolve().TryGetComponent(pvsEntity, out ISpriteComponent? inRangeSprite) || !inRangeSprite.Visible || pvsEntity == _dragDropHelper.Dragged) continue; // check if it's able to be dropped on by current dragged entity - var dropArgs = new DragDropEvent(_dragger!, IoCManager.Resolve().GetComponent(pvsEntity.Uid).Coordinates, _dragDropHelper.Dragged, pvsEntity); + var dropArgs = new DragDropEvent(_dragger!, IoCManager.Resolve().GetComponent(pvsEntity).Coordinates, _dragDropHelper.Dragged, pvsEntity); var valid = ValidDragDrop(dropArgs); if (valid == null) continue; @@ -415,14 +415,14 @@ namespace Content.Client.DragDrop /// null if the target doesn't support IDragDropOn private bool? ValidDragDrop(DragDropEvent eventArgs) { - if (!_actionBlockerSystem.CanInteract(eventArgs.User.Uid)) + if (!_actionBlockerSystem.CanInteract(eventArgs.User)) { return false; } bool? valid = null; - foreach (var comp in IoCManager.Resolve().GetComponents(eventArgs.Target.Uid)) + foreach (var comp in IoCManager.Resolve().GetComponents(eventArgs.Target)) { if (!comp.CanDragDropOn(eventArgs)) { @@ -440,7 +440,7 @@ namespace Content.Client.DragDrop // Need at least one IDraggable to return true or else we can't do shit valid = false; - foreach (var comp in IoCManager.Resolve().GetComponents(eventArgs.User.Uid)) + foreach (var comp in IoCManager.Resolve().GetComponents(eventArgs.User)) { if (!comp.CanDrop(eventArgs)) continue; valid = true; diff --git a/Content.Client/Entry/EntryPoint.cs b/Content.Client/Entry/EntryPoint.cs index adb339ae15..dfcc1904cf 100644 --- a/Content.Client/Entry/EntryPoint.cs +++ b/Content.Client/Entry/EntryPoint.cs @@ -151,9 +151,9 @@ namespace Content.Client.Entry /// public static void DetachPlayerFromEntity(EntityDetachedEventArgs eventArgs) { - if (!((!IoCManager.Resolve().EntityExists(eventArgs.OldEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(eventArgs.OldEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted)) + if (!((!IoCManager.Resolve().EntityExists(eventArgs.OldEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(eventArgs.OldEntity).EntityLifeStage) >= EntityLifeStage.Deleted)) { - IoCManager.Resolve().RemoveComponent(eventArgs.OldEntity.Uid); + IoCManager.Resolve().RemoveComponent(eventArgs.OldEntity); } } diff --git a/Content.Client/Examine/ExamineSystem.cs b/Content.Client/Examine/ExamineSystem.cs index 53897fafd5..b6ee62c791 100644 --- a/Content.Client/Examine/ExamineSystem.cs +++ b/Content.Client/Examine/ExamineSystem.cs @@ -136,14 +136,14 @@ namespace Content.Client.Examine }; vBox.AddChild(hBox); - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ISpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(entity, out ISpriteComponent? sprite)) { hBox.AddChild(new SpriteView { Sprite = sprite, OverrideDirection = Direction.South }); } hBox.AddChild(new Label { - Text = IoCManager.Resolve().GetComponent(entity.Uid).EntityName, + Text = IoCManager.Resolve().GetComponent(entity).EntityName, HorizontalExpand = true, }); @@ -153,14 +153,14 @@ namespace Content.Client.Examine _examineTooltipOpen.Open(UIBox2.FromDimensions(popupPos.Position, size)); FormattedMessage message; - if (entity.Uid.IsClientSide()) + if (entity.IsClientSide()) { message = GetExamineText(entity, _playerManager.LocalPlayer?.ControlledEntity); } else { // Ask server for extra examine info. - RaiseNetworkEvent(new ExamineSystemMessages.RequestExamineInfoMessage(entity.Uid)); + RaiseNetworkEvent(new ExamineSystemMessages.RequestExamineInfoMessage(entity)); ExamineSystemMessages.ExamineInfoResponseMessage response; try diff --git a/Content.Client/Extinguisher/FireExtinguisherVisualizer.cs b/Content.Client/Extinguisher/FireExtinguisherVisualizer.cs index 8497592b86..e3f9759342 100644 --- a/Content.Client/Extinguisher/FireExtinguisherVisualizer.cs +++ b/Content.Client/Extinguisher/FireExtinguisherVisualizer.cs @@ -27,7 +27,7 @@ namespace Content.Client.Extinguisher private void SetSafety(AppearanceComponent component, bool safety) { - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); sprite.LayerSetState(FireExtinguisherVisualLayers.Base, safety ? _safetyOnState : _safetyOffState); } diff --git a/Content.Client/Fluids/PuddleVisualizer.cs b/Content.Client/Fluids/PuddleVisualizer.cs index 560e56d1f7..20a272b865 100644 --- a/Content.Client/Fluids/PuddleVisualizer.cs +++ b/Content.Client/Fluids/PuddleVisualizer.cs @@ -25,9 +25,9 @@ namespace Content.Client.Fluids { base.InitializeEntity(entity); - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out SpriteComponent? spriteComponent)) + if (!IoCManager.Resolve().TryGetComponent(entity, out SpriteComponent? spriteComponent)) { - Logger.Warning($"Missing SpriteComponent for PuddleVisualizer on entityUid = {entity.Uid}"); + Logger.Warning($"Missing SpriteComponent for PuddleVisualizer on entityUid = {entity}"); return; } diff --git a/Content.Client/Ghost/GhostSystem.cs b/Content.Client/Ghost/GhostSystem.cs index 577a3e1a66..dc3a72d320 100644 --- a/Content.Client/Ghost/GhostSystem.cs +++ b/Content.Client/Ghost/GhostSystem.cs @@ -36,7 +36,7 @@ namespace Content.Client.Ghost foreach (var ghost in EntityManager.GetAllComponents(typeof(GhostComponent), true)) { - if (IoCManager.Resolve().TryGetComponent(ghost.Owner.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(ghost.Owner, out SpriteComponent? sprite)) { sprite.Visible = value; } @@ -60,7 +60,7 @@ namespace Content.Client.Ghost private void OnGhostInit(EntityUid uid, GhostComponent component, ComponentInit args) { - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out SpriteComponent? sprite)) { sprite.Visible = GhostVisibility; } @@ -104,7 +104,7 @@ namespace Content.Client.Ghost var entity = _playerManager.LocalPlayer?.ControlledEntity; if (entity == null || - !IoCManager.Resolve().TryGetComponent(entity.Uid, out GhostComponent? ghost)) + !IoCManager.Resolve().TryGetComponent(entity, out GhostComponent? ghost)) { return; } diff --git a/Content.Client/Gravity/GravityGeneratorVisualizer.cs b/Content.Client/Gravity/GravityGeneratorVisualizer.cs index 622516bda9..c426309836 100644 --- a/Content.Client/Gravity/GravityGeneratorVisualizer.cs +++ b/Content.Client/Gravity/GravityGeneratorVisualizer.cs @@ -42,7 +42,7 @@ namespace Content.Client.Gravity { base.InitializeEntity(entity); - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out SpriteComponent? sprite)) + if (!IoCManager.Resolve().TryGetComponent(entity, out SpriteComponent? sprite)) return; sprite.LayerMapReserveBlank(GravityGeneratorVisualLayers.Base); @@ -53,7 +53,7 @@ namespace Content.Client.Gravity { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (component.TryGetData(GravityGeneratorVisuals.State, out GravityGeneratorStatus state)) { diff --git a/Content.Client/Gravity/UI/GravityGeneratorWindow.xaml.cs b/Content.Client/Gravity/UI/GravityGeneratorWindow.xaml.cs index 03987cf823..d7fb80dcba 100644 --- a/Content.Client/Gravity/UI/GravityGeneratorWindow.xaml.cs +++ b/Content.Client/Gravity/UI/GravityGeneratorWindow.xaml.cs @@ -34,7 +34,7 @@ namespace Content.Client.Gravity.UI OnButton.OnPressed += _ => _owner.SetPowerSwitch(true); OffButton.OnPressed += _ => _owner.SetPowerSwitch(false); - EntityView.Sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + EntityView.Sprite = IoCManager.Resolve().GetComponent(component.Owner); } public void UpdateState(SharedGravityGeneratorComponent.GeneratorState state) diff --git a/Content.Client/Hands/HandsComponent.cs b/Content.Client/Hands/HandsComponent.cs index ee24ba625d..4a81bd6958 100644 --- a/Content.Client/Hands/HandsComponent.cs +++ b/Content.Client/Hands/HandsComponent.cs @@ -38,7 +38,7 @@ namespace Content.Client.Hands public void UpdateHandContainers() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out var containerMan)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out var containerMan)) return; foreach (var hand in Hands) diff --git a/Content.Client/Hands/HandsGui.xaml.cs b/Content.Client/Hands/HandsGui.xaml.cs index 3777213d85..5887cb2115 100644 --- a/Content.Client/Hands/HandsGui.xaml.cs +++ b/Content.Client/Hands/HandsGui.xaml.cs @@ -100,7 +100,7 @@ namespace Content.Client.Hands // Show blocked overlay if hand is blocked. newButton.Blocked.Visible = - hand.HeldItem != null && IoCManager.Resolve().HasComponent(hand.HeldItem.Uid); + hand.HeldItem != null && IoCManager.Resolve().HasComponent(hand.HeldItem); } if (TryGetActiveHand(out var activeHand)) diff --git a/Content.Client/Hands/ShowHandItemOverlay.cs b/Content.Client/Hands/ShowHandItemOverlay.cs index 858b1267b0..803cd98736 100644 --- a/Content.Client/Hands/ShowHandItemOverlay.cs +++ b/Content.Client/Hands/ShowHandItemOverlay.cs @@ -46,7 +46,7 @@ namespace Content.Client.Hands var sys = EntitySystem.Get(); var handEntity = sys.GetActiveHandEntity(); - if (handEntity == null || !_cfg.GetCVar(CCVars.HudHeldItemShow) || !IoCManager.Resolve().HasComponent(handEntity.Uid)) + if (handEntity == null || !_cfg.GetCVar(CCVars.HudHeldItemShow) || !IoCManager.Resolve().HasComponent(handEntity)) return; var screen = args.ScreenHandle; diff --git a/Content.Client/Hands/Systems/HandsSystem.cs b/Content.Client/Hands/Systems/HandsSystem.cs index 094704ef5e..1bcb60c113 100644 --- a/Content.Client/Hands/Systems/HandsSystem.cs +++ b/Content.Client/Hands/Systems/HandsSystem.cs @@ -50,7 +50,7 @@ namespace Content.Client.Hands protected override void HandleContainerModified(EntityUid uid, SharedHandsComponent component, ContainerModifiedMessage args) { - if (uid == _playerManager.LocalPlayer?.ControlledEntity?.Uid) + if (uid == _playerManager.LocalPlayer?.ControlledEntity) GuiStateUpdated?.Invoke(); } @@ -89,7 +89,7 @@ namespace Content.Client.Hands { var player = _playerManager.LocalPlayer?.ControlledEntity; - if (player == null || !IoCManager.Resolve().TryGetComponent(player.Uid, out HandsComponent? hands)) + if (player == null || !IoCManager.Resolve().TryGetComponent(player, out HandsComponent? hands)) return null; return hands; diff --git a/Content.Client/HealthOverlay/HealthOverlaySystem.cs b/Content.Client/HealthOverlay/HealthOverlaySystem.cs index dc37b63932..b8a69fa5be 100644 --- a/Content.Client/HealthOverlay/HealthOverlaySystem.cs +++ b/Content.Client/HealthOverlay/HealthOverlaySystem.cs @@ -72,7 +72,7 @@ namespace Content.Client.HealthOverlay return; } - if (_attachedEntity == null || (!IoCManager.Resolve().EntityExists(_attachedEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_attachedEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if (_attachedEntity == null || (!IoCManager.Resolve().EntityExists(_attachedEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_attachedEntity).EntityLifeStage) >= EntityLifeStage.Deleted) { return; } @@ -83,25 +83,25 @@ namespace Content.Client.HealthOverlay { var entity = mobState.Owner; - if (IoCManager.Resolve().GetComponent(_attachedEntity.Uid).MapID != IoCManager.Resolve().GetComponent(entity.Uid).MapID || - !viewBox.Contains(IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition)) + if (IoCManager.Resolve().GetComponent(_attachedEntity).MapID != IoCManager.Resolve().GetComponent(entity).MapID || + !viewBox.Contains(IoCManager.Resolve().GetComponent(entity).WorldPosition)) { - if (_guis.TryGetValue(entity.Uid, out var oldGui)) + if (_guis.TryGetValue(entity, out var oldGui)) { - _guis.Remove(entity.Uid); + _guis.Remove(entity); oldGui.Dispose(); } continue; } - if (_guis.ContainsKey(entity.Uid)) + if (_guis.ContainsKey(entity)) { continue; } var gui = new HealthOverlayGui(entity); - _guis.Add(entity.Uid, gui); + _guis.Add(entity, gui); } } } diff --git a/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs b/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs index f7284f7cdf..d994dc16fa 100644 --- a/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs +++ b/Content.Client/HealthOverlay/UI/HealthOverlayGui.cs @@ -72,13 +72,13 @@ namespace Content.Client.HealthOverlay.UI private void MoreFrameUpdate(FrameEventArgs args) { - if ((!IoCManager.Resolve().EntityExists(Entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(Entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Entity).EntityLifeStage) >= EntityLifeStage.Deleted) { return; } - if (!IoCManager.Resolve().TryGetComponent(Entity.Uid, out MobStateComponent? mobState) || - !IoCManager.Resolve().TryGetComponent(Entity.Uid, out DamageableComponent? damageable)) + if (!IoCManager.Resolve().TryGetComponent(Entity, out MobStateComponent? mobState) || + !IoCManager.Resolve().TryGetComponent(Entity, out DamageableComponent? damageable)) { CritBar.Visible = false; HealthBar.Visible = false; @@ -138,8 +138,8 @@ namespace Content.Client.HealthOverlay.UI MoreFrameUpdate(args); - if ((!IoCManager.Resolve().EntityExists(Entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || - _eyeManager.CurrentMap != IoCManager.Resolve().GetComponent(Entity.Uid).MapID) + if ((!IoCManager.Resolve().EntityExists(Entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Entity).EntityLifeStage) >= EntityLifeStage.Deleted || + _eyeManager.CurrentMap != IoCManager.Resolve().GetComponent(Entity).MapID) { Visible = false; return; @@ -147,7 +147,7 @@ namespace Content.Client.HealthOverlay.UI Visible = true; - var screenCoordinates = _eyeManager.CoordinatesToScreen(IoCManager.Resolve().GetComponent(Entity.Uid).Coordinates); + var screenCoordinates = _eyeManager.CoordinatesToScreen(IoCManager.Resolve().GetComponent(Entity).Coordinates); var playerPosition = UserInterfaceManager.ScreenToUIPosition(screenCoordinates); LayoutContainer.SetPosition(this, new Vector2(playerPosition.X - Width / 2, playerPosition.Y - Height - 30.0f)); } diff --git a/Content.Client/IconSmoothing/IconSmoothComponent.cs b/Content.Client/IconSmoothing/IconSmoothComponent.cs index 2b7cdec664..eb84e7c68a 100644 --- a/Content.Client/IconSmoothing/IconSmoothComponent.cs +++ b/Content.Client/IconSmoothing/IconSmoothComponent.cs @@ -63,7 +63,7 @@ namespace Content.Client.IconSmoothing { base.Initialize(); - Sprite = IoCManager.Resolve().GetComponent(Owner.Uid); + Sprite = IoCManager.Resolve().GetComponent(Owner); } /// @@ -71,7 +71,7 @@ namespace Content.Client.IconSmoothing { base.Startup(); - if (IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) + if (IoCManager.Resolve().GetComponent(Owner).Anchored) { // ensures lastposition initial value is populated on spawn. Just calling // the hook here would cause a dirty event to fire needlessly @@ -95,9 +95,9 @@ namespace Content.Client.IconSmoothing private void UpdateLastPosition() { - if (_mapManager.TryGetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID, out var grid)) + if (_mapManager.TryGetGrid(IoCManager.Resolve().GetComponent(Owner).GridID, out var grid)) { - _lastPosition = (IoCManager.Resolve().GetComponent(Owner.Uid).GridID, grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates)); + _lastPosition = (IoCManager.Resolve().GetComponent(Owner).GridID, grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner).Coordinates)); } else { @@ -109,9 +109,9 @@ namespace Content.Client.IconSmoothing internal virtual void CalculateNewSprite() { - if (!_mapManager.TryGetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID, out var grid)) + if (!_mapManager.TryGetGrid(IoCManager.Resolve().GetComponent(Owner).GridID, out var grid)) { - Logger.Error($"Failed to calculate IconSmoothComponent sprite in {Owner} because grid {IoCManager.Resolve().GetComponent(Owner.Uid).GridID} was missing."); + Logger.Error($"Failed to calculate IconSmoothComponent sprite in {Owner} because grid {IoCManager.Resolve().GetComponent(Owner).GridID} was missing."); return; } CalculateNewSprite(grid); @@ -136,14 +136,14 @@ namespace Content.Client.IconSmoothing private void CalculateNewSpriteCardinal(IMapGrid grid) { - if (!IoCManager.Resolve().GetComponent(Owner.Uid).Anchored || Sprite == null) + if (!IoCManager.Resolve().GetComponent(Owner).Anchored || Sprite == null) { return; } var dirs = CardinalConnectDirs.None; - var position = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + var position = IoCManager.Resolve().GetComponent(Owner).Coordinates; if (MatchingEntity(grid.GetInDir(position, Direction.North))) dirs |= CardinalConnectDirs.North; if (MatchingEntity(grid.GetInDir(position, Direction.South))) @@ -173,12 +173,12 @@ namespace Content.Client.IconSmoothing protected (CornerFill ne, CornerFill nw, CornerFill sw, CornerFill se) CalculateCornerFill(IMapGrid grid) { - if (!IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) + if (!IoCManager.Resolve().GetComponent(Owner).Anchored) { return (CornerFill.None, CornerFill.None, CornerFill.None, CornerFill.None); } - var position = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + var position = IoCManager.Resolve().GetComponent(Owner).Coordinates; var n = MatchingEntity(grid.GetInDir(position, Direction.North)); var ne = MatchingEntity(grid.GetInDir(position, Direction.NorthEast)); var e = MatchingEntity(grid.GetInDir(position, Direction.East)); @@ -240,7 +240,7 @@ namespace Content.Client.IconSmoothing } // Local is fine as we already know it's parented to the grid (due to the way anchoring works). - switch (IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation.GetCardinalDir()) + switch (IoCManager.Resolve().GetComponent(Owner).LocalRotation.GetCardinalDir()) { case Direction.North: return (cornerSW, cornerSE, cornerNE, cornerNW); @@ -258,7 +258,7 @@ namespace Content.Client.IconSmoothing { base.Shutdown(); - if (IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) + if (IoCManager.Resolve().GetComponent(Owner).Anchored) { IoCManager.Resolve().EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, Mode)); } @@ -266,7 +266,7 @@ namespace Content.Client.IconSmoothing public void AnchorStateChanged() { - if (IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) + if (IoCManager.Resolve().GetComponent(Owner).Anchored) { IoCManager.Resolve().EventBus.RaiseEvent(EventSource.Local, new IconSmoothDirtyEvent(Owner, _lastPosition, Mode)); UpdateLastPosition(); diff --git a/Content.Client/IconSmoothing/IconSmoothSystem.cs b/Content.Client/IconSmoothing/IconSmoothSystem.cs index 17b8fd59c8..17c7e1324c 100644 --- a/Content.Client/IconSmoothing/IconSmoothSystem.cs +++ b/Content.Client/IconSmoothing/IconSmoothSystem.cs @@ -51,14 +51,14 @@ namespace Content.Client.IconSmoothing // Yes, we updates ALL smoothing entities surrounding us even if they would never smooth with us. // This is simpler to implement. If you want to optimize it be my guest. var senderEnt = ev.Sender; - if (IoCManager.Resolve().EntityExists(senderEnt.Uid) && - _mapManager.TryGetGrid(IoCManager.Resolve().GetComponent(senderEnt.Uid).GridID, out var grid1) && - IoCManager.Resolve().TryGetComponent(senderEnt.Uid, out IconSmoothComponent? iconSmooth) + if (IoCManager.Resolve().EntityExists(senderEnt) && + _mapManager.TryGetGrid(IoCManager.Resolve().GetComponent(senderEnt).GridID, out var grid1) && + IoCManager.Resolve().TryGetComponent(senderEnt, out IconSmoothComponent? iconSmooth) && iconSmooth.Running) { - var coords = IoCManager.Resolve().GetComponent(senderEnt.Uid).Coordinates; + var coords = IoCManager.Resolve().GetComponent(senderEnt).Coordinates; - _dirtyEntities.Enqueue(senderEnt.Uid); + _dirtyEntities.Enqueue(senderEnt); AddValidEntities(grid1.GetInDir(coords, Direction.North)); AddValidEntities(grid1.GetInDir(coords, Direction.South)); AddValidEntities(grid1.GetInDir(coords, Direction.East)); diff --git a/Content.Client/Instruments/UI/InstrumentBoundUserInterface.cs b/Content.Client/Instruments/UI/InstrumentBoundUserInterface.cs index d9bf9d3eea..c94c0c3206 100644 --- a/Content.Client/Instruments/UI/InstrumentBoundUserInterface.cs +++ b/Content.Client/Instruments/UI/InstrumentBoundUserInterface.cs @@ -18,7 +18,7 @@ namespace Content.Client.Instruments.UI protected override void Open() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Owner.Uid, out var instrument)) return; + if (!IoCManager.Resolve().TryGetComponent(Owner.Owner, out var instrument)) return; Instrument = instrument; _instrumentMenu = new InstrumentMenu(this); diff --git a/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs b/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs index da812a85ac..5a3842bb5e 100644 --- a/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs +++ b/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs @@ -36,7 +36,7 @@ namespace Content.Client.Instruments.UI if (_owner.Instrument != null) { _owner.Instrument.OnMidiPlaybackEnded += InstrumentOnMidiPlaybackEnded; - Title = IoCManager.Resolve().GetComponent(_owner.Instrument.Owner.Uid).EntityName; + Title = IoCManager.Resolve().GetComponent(_owner.Instrument.Owner).EntityName; LoopButton.Disabled = !_owner.Instrument.IsMidiOpen; LoopButton.Pressed = _owner.Instrument.LoopMidi; StopButton.Disabled = !_owner.Instrument.IsMidiOpen; diff --git a/Content.Client/Interactable/Components/InteractionOutlineComponent.cs b/Content.Client/Interactable/Components/InteractionOutlineComponent.cs index f7329835e9..2a0a1cb6dc 100644 --- a/Content.Client/Interactable/Components/InteractionOutlineComponent.cs +++ b/Content.Client/Interactable/Components/InteractionOutlineComponent.cs @@ -25,7 +25,7 @@ namespace Content.Client.Interactable.Components { _lastRenderScale = renderScale; _inRange = inInteractionRange; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ISpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ISpriteComponent? sprite)) { sprite.PostShader = MakeNewShader(inInteractionRange, renderScale); sprite.RenderOrder = IoCManager.Resolve().CurrentTick.Value; @@ -34,7 +34,7 @@ namespace Content.Client.Interactable.Components public void OnMouseLeave() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ISpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ISpriteComponent? sprite)) { sprite.PostShader = null; sprite.RenderOrder = 0; @@ -46,7 +46,7 @@ namespace Content.Client.Interactable.Components public void UpdateInRange(bool inInteractionRange, int renderScale) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ISpriteComponent? sprite) + if (IoCManager.Resolve().TryGetComponent(Owner, out ISpriteComponent? sprite) && (inInteractionRange != _inRange || _lastRenderScale != renderScale)) { _inRange = inInteractionRange; diff --git a/Content.Client/Interactable/InteractionSystem.cs b/Content.Client/Interactable/InteractionSystem.cs index 0103ece58c..4b48df0daa 100644 --- a/Content.Client/Interactable/InteractionSystem.cs +++ b/Content.Client/Interactable/InteractionSystem.cs @@ -15,7 +15,7 @@ namespace Content.Client.Interactable if (!entity.TryGetContainer(out var container)) return false; - if (!EntityManager.TryGetComponent(container.Owner.Uid, out ClientStorageComponent storage)) + if (!EntityManager.TryGetComponent(container.Owner, out ClientStorageComponent storage)) return false; // we don't check if the user can access the storage entity itself. This should be handed by the UI system. diff --git a/Content.Client/Interactable/UnobstructedExtensions.cs b/Content.Client/Interactable/UnobstructedExtensions.cs index a583d16e4a..742126689c 100644 --- a/Content.Client/Interactable/UnobstructedExtensions.cs +++ b/Content.Client/Interactable/UnobstructedExtensions.cs @@ -22,7 +22,7 @@ namespace Content.Client.Interactable bool ignoreInsideBlocker = false, bool popup = false) { - var otherPosition = IoCManager.Resolve().GetComponent(other.Uid).MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other).MapPosition; return origin.InRangeUnobstructed(otherPosition, range, collisionMask, predicate, ignoreInsideBlocker, popup); diff --git a/Content.Client/Inventory/ClientInventoryComponent.cs b/Content.Client/Inventory/ClientInventoryComponent.cs index 03e0a110ba..0cec189f5c 100644 --- a/Content.Client/Inventory/ClientInventoryComponent.cs +++ b/Content.Client/Inventory/ClientInventoryComponent.cs @@ -140,7 +140,7 @@ namespace Content.Client.Inventory return; } - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ClothingComponent? clothing)) + if (IoCManager.Resolve().TryGetComponent(entity, out ClothingComponent? clothing)) { var flag = SlotMasks[slot]; var data = clothing.GetEquippedStateInfo(flag, SpeciesId); diff --git a/Content.Client/Inventory/ClientInventorySystem.cs b/Content.Client/Inventory/ClientInventorySystem.cs index d01c5d32eb..43754ebd2a 100644 --- a/Content.Client/Inventory/ClientInventorySystem.cs +++ b/Content.Client/Inventory/ClientInventorySystem.cs @@ -38,7 +38,7 @@ namespace Content.Client.Inventory { if (component.TryGetSlot(EquipmentSlotDefines.Slots.SHOES, out IEntity? shoes)) { - RaiseLocalEvent(shoes.Uid, args, false); + RaiseLocalEvent(shoes, args, false); } } @@ -48,7 +48,7 @@ namespace Content.Client.Inventory { if (ent != null) { - RaiseLocalEvent(ent.Uid, args, false); + RaiseLocalEvent(ent, args, false); } } } diff --git a/Content.Client/Inventory/StrippableBoundUserInterface.cs b/Content.Client/Inventory/StrippableBoundUserInterface.cs index ad9c5d4341..dee8e4f03c 100644 --- a/Content.Client/Inventory/StrippableBoundUserInterface.cs +++ b/Content.Client/Inventory/StrippableBoundUserInterface.cs @@ -29,7 +29,7 @@ namespace Content.Client.Inventory { base.Open(); - _strippingMenu = new StrippingMenu($"{Loc.GetString("strippable-bound-user-interface-stripping-menu-title",("ownerName", Name: IoCManager.Resolve().GetComponent(Owner.Owner.Uid).EntityName))}"); + _strippingMenu = new StrippingMenu($"{Loc.GetString("strippable-bound-user-interface-stripping-menu-title",("ownerName", Name: IoCManager.Resolve().GetComponent(Owner.Owner).EntityName))}"); _strippingMenu.OnClose += Close; _strippingMenu.OpenCentered(); diff --git a/Content.Client/Items/Components/ItemComponent.cs b/Content.Client/Items/Components/ItemComponent.cs index 4d04ba481b..7c60585abe 100644 --- a/Content.Client/Items/Components/ItemComponent.cs +++ b/Content.Client/Items/Components/ItemComponent.cs @@ -15,7 +15,7 @@ namespace Content.Client.Items.Components if (!Owner.TryGetContainer(out var container)) return; - if (IoCManager.Resolve().TryGetComponent(container.Owner.Uid, out HandsComponent? hands)) + if (IoCManager.Resolve().TryGetComponent(container.Owner, out HandsComponent? hands)) hands.UpdateHandVisualizer(); } } diff --git a/Content.Client/Items/Managers/ItemSlotManager.cs b/Content.Client/Items/Managers/ItemSlotManager.cs index 4f2fa0b0a3..012951d56c 100644 --- a/Content.Client/Items/Managers/ItemSlotManager.cs +++ b/Content.Client/Items/Managers/ItemSlotManager.cs @@ -42,22 +42,22 @@ namespace Content.Client.Items.Managers else { ISpriteComponent? sprite; - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out HandVirtualItemComponent? virtPull) + if (IoCManager.Resolve().TryGetComponent(entity, out HandVirtualItemComponent? virtPull) && _entityManager.TryGetComponent(virtPull.BlockingEntity, out ISpriteComponent pulledSprite)) { sprite = pulledSprite; } - else if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out sprite)) + else if (!IoCManager.Resolve().TryGetComponent(entity, out sprite)) { return false; } button.ClearHover(); button.SpriteView.Sprite = sprite; - button.StorageButton.Visible = IoCManager.Resolve().HasComponent(entity.Uid); + button.StorageButton.Visible = IoCManager.Resolve().HasComponent(entity); } - button.Entity = entity?.Uid ?? default; + button.Entity = entity ?? default; // im lazy button.UpdateSlotHighlighted(); @@ -80,11 +80,11 @@ namespace Content.Client.Items.Managers } else if (args.Function == ContentKeyFunctions.ActivateItemInWorld) { - _entityManager.EntityNetManager?.SendSystemNetworkMessage(new InteractInventorySlotEvent(item.Uid, altInteract: false)); + _entityManager.EntityNetManager?.SendSystemNetworkMessage(new InteractInventorySlotEvent(item, altInteract: false)); } else if (args.Function == ContentKeyFunctions.AltActivateItemInWorld) { - _entityManager.EntityNetManager?.SendSystemNetworkMessage(new InteractInventorySlotEvent(item.Uid, altInteract: true)); + _entityManager.EntityNetManager?.SendSystemNetworkMessage(new InteractInventorySlotEvent(item, altInteract: true)); } else { @@ -104,8 +104,8 @@ namespace Content.Client.Items.Managers } if (entity == null || - (!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || - !IoCManager.Resolve().TryGetComponent(entity.Uid, out ItemCooldownComponent? cooldown) || + (!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Deleted || + !IoCManager.Resolve().TryGetComponent(entity, out ItemCooldownComponent? cooldown) || !cooldown.CooldownStart.HasValue || !cooldown.CooldownEnd.HasValue) { @@ -132,15 +132,15 @@ namespace Content.Client.Items.Managers return; } - if (!IoCManager.Resolve().HasComponent(entity.Uid)) + if (!IoCManager.Resolve().HasComponent(entity)) { return; } // Set green / red overlay at 50% transparency var hoverEntity = _entityManager.SpawnEntity("hoverentity", MapCoordinates.Nullspace); - var hoverSprite = IoCManager.Resolve().GetComponent(hoverEntity.Uid); - hoverSprite.CopyFrom(IoCManager.Resolve().GetComponent(entity.Uid)); + var hoverSprite = IoCManager.Resolve().GetComponent(hoverEntity); + hoverSprite.CopyFrom(IoCManager.Resolve().GetComponent(entity)); hoverSprite.Color = fits ? new Color(0, 255, 0, 127) : new Color(255, 0, 0, 127); button.HoverSpriteView.Sprite = hoverSprite; diff --git a/Content.Client/Items/UI/ItemSlotButton.cs b/Content.Client/Items/UI/ItemSlotButton.cs index 928c98f551..de8fb657a0 100644 --- a/Content.Client/Items/UI/ItemSlotButton.cs +++ b/Content.Client/Items/UI/ItemSlotButton.cs @@ -142,7 +142,7 @@ namespace Content.Client.Items.UI ISpriteComponent? tempQualifier = HoverSpriteView.Sprite; if (tempQualifier != null) { - IoCManager.Resolve().DeleteEntity(tempQualifier.Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) tempQualifier.Owner); } HoverSpriteView.Sprite = null; diff --git a/Content.Client/Items/UI/ItemStatusPanel.cs b/Content.Client/Items/UI/ItemStatusPanel.cs index 9cbfca32bc..8d092eb1d3 100644 --- a/Content.Client/Items/UI/ItemStatusPanel.cs +++ b/Content.Client/Items/UI/ItemStatusPanel.cs @@ -156,14 +156,14 @@ namespace Content.Client.Items.UI if (_entity == null) return; - if (IoCManager.Resolve().TryGetComponent(_entity.Uid, out HandVirtualItemComponent? virtualItem) + if (IoCManager.Resolve().TryGetComponent(_entity, out HandVirtualItemComponent? virtualItem) && _entityManager.TryGetEntity(virtualItem.BlockingEntity, out var blockEnt)) { - _itemNameLabel.Text = IoCManager.Resolve().GetComponent(blockEnt.Uid).EntityName; + _itemNameLabel.Text = IoCManager.Resolve().GetComponent(blockEnt).EntityName; } else { - _itemNameLabel.Text = IoCManager.Resolve().GetComponent(_entity.Uid).EntityName; + _itemNameLabel.Text = IoCManager.Resolve().GetComponent(_entity).EntityName; } } @@ -185,7 +185,7 @@ namespace Content.Client.Items.UI ClearOldStatus(); - foreach (var statusComponent in IoCManager.Resolve().GetComponents(_entity!.Uid)) + foreach (var statusComponent in IoCManager.Resolve().GetComponents(_entity!)) { var control = statusComponent.MakeControl(); _statusContents.AddChild(control); @@ -194,7 +194,7 @@ namespace Content.Client.Items.UI } var collectMsg = new ItemStatusCollectMessage(); - IoCManager.Resolve().EventBus.RaiseLocalEvent(_entity.Uid, collectMsg); + IoCManager.Resolve().EventBus.RaiseLocalEvent(_entity, collectMsg); foreach (var control in collectMsg.Controls) { diff --git a/Content.Client/Kitchen/UI/GrinderMenu.xaml.cs b/Content.Client/Kitchen/UI/GrinderMenu.xaml.cs index 85ffc3f3b8..199d82e52c 100644 --- a/Content.Client/Kitchen/UI/GrinderMenu.xaml.cs +++ b/Content.Client/Kitchen/UI/GrinderMenu.xaml.cs @@ -99,9 +99,9 @@ namespace Content.Client.Kitchen.UI { return; } - var texture = IoCManager.Resolve().GetComponent(entity.Uid).Icon?.Default; + var texture = IoCManager.Resolve().GetComponent(entity).Icon?.Default; - var solidItem = ChamberContentBox.BoxContents.AddItem(IoCManager.Resolve().GetComponent(entity.Uid).EntityName, texture); + var solidItem = ChamberContentBox.BoxContents.AddItem(IoCManager.Resolve().GetComponent(entity).EntityName, texture); var solidIndex = ChamberContentBox.BoxContents.IndexOf(solidItem); _chamberVisualContents.Add(solidIndex, uid); } diff --git a/Content.Client/Kitchen/UI/MicrowaveBoundUserInterface.cs b/Content.Client/Kitchen/UI/MicrowaveBoundUserInterface.cs index b8b71f1401..2a2258f898 100644 --- a/Content.Client/Kitchen/UI/MicrowaveBoundUserInterface.cs +++ b/Content.Client/Kitchen/UI/MicrowaveBoundUserInterface.cs @@ -115,17 +115,17 @@ namespace Content.Client.Kitchen.UI return; } - if ((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Deleted) { continue; } Texture? texture; - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out IconComponent? iconComponent)) + if (IoCManager.Resolve().TryGetComponent(entity, out IconComponent? iconComponent)) { texture = iconComponent.Icon?.Default; } - else if (IoCManager.Resolve().TryGetComponent(entity.Uid, out SpriteComponent? spriteComponent)) + else if (IoCManager.Resolve().TryGetComponent(entity, out SpriteComponent? spriteComponent)) { texture = spriteComponent.Icon?.Default; } @@ -134,7 +134,7 @@ namespace Content.Client.Kitchen.UI continue; } - var solidItem = _menu.IngredientsList.AddItem(IoCManager.Resolve().GetComponent(entity.Uid).EntityName, texture); + var solidItem = _menu.IngredientsList.AddItem(IoCManager.Resolve().GetComponent(entity).EntityName, texture); var solidIndex = _menu.IngredientsList.IndexOf(solidItem); _solids.Add(solidIndex, t); } diff --git a/Content.Client/Kitchen/Visualizers/MicrowaveVisualizer.cs b/Content.Client/Kitchen/Visualizers/MicrowaveVisualizer.cs index a452dcb729..82bdd77963 100644 --- a/Content.Client/Kitchen/Visualizers/MicrowaveVisualizer.cs +++ b/Content.Client/Kitchen/Visualizers/MicrowaveVisualizer.cs @@ -16,9 +16,9 @@ namespace Content.Client.Kitchen.Visualizers public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); - var microwaveComponent = IoCManager.Resolve().GetComponentOrNull(component.Owner.Uid); + var microwaveComponent = IoCManager.Resolve().GetComponentOrNull(component.Owner); if (!component.TryGetData(PowerDeviceVisuals.VisualState, out MicrowaveVisualState state)) { diff --git a/Content.Client/Kitchen/Visualizers/ReagentGrinderVisualizer.cs b/Content.Client/Kitchen/Visualizers/ReagentGrinderVisualizer.cs index 96d026fe43..e799111a6f 100644 --- a/Content.Client/Kitchen/Visualizers/ReagentGrinderVisualizer.cs +++ b/Content.Client/Kitchen/Visualizers/ReagentGrinderVisualizer.cs @@ -10,7 +10,7 @@ namespace Content.Client.Kitchen.Visualizers public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); component.TryGetData(ReagentGrinderVisualState.BeakerAttached, out bool hasBeaker); sprite.LayerSetState(0, $"juicer{(hasBeaker ? "1" : "0")}"); } diff --git a/Content.Client/Lathe/UI/LatheBoundUserInterface.cs b/Content.Client/Lathe/UI/LatheBoundUserInterface.cs index 0af7cae5d5..468d78796e 100644 --- a/Content.Client/Lathe/UI/LatheBoundUserInterface.cs +++ b/Content.Client/Lathe/UI/LatheBoundUserInterface.cs @@ -37,9 +37,9 @@ namespace Content.Client.Lathe.UI { base.Open(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Owner.Uid, out MaterialStorageComponent? storage) - || !IoCManager.Resolve().TryGetComponent(Owner.Owner.Uid, out SharedLatheComponent? lathe) - || !IoCManager.Resolve().TryGetComponent(Owner.Owner.Uid, out SharedLatheDatabaseComponent? database)) return; + if (!IoCManager.Resolve().TryGetComponent(Owner.Owner, out MaterialStorageComponent? storage) + || !IoCManager.Resolve().TryGetComponent(Owner.Owner, out SharedLatheComponent? lathe) + || !IoCManager.Resolve().TryGetComponent(Owner.Owner, out SharedLatheDatabaseComponent? database)) return; Storage = storage; Lathe = lathe; diff --git a/Content.Client/Lathe/Visualizers/AutolatheVisualizer.cs b/Content.Client/Lathe/Visualizers/AutolatheVisualizer.cs index b4d97b990c..06bb614fd4 100644 --- a/Content.Client/Lathe/Visualizers/AutolatheVisualizer.cs +++ b/Content.Client/Lathe/Visualizers/AutolatheVisualizer.cs @@ -50,7 +50,7 @@ namespace Content.Client.Lathe.Visualizers public override void InitializeEntity(IEntity entity) { - if (!IoCManager.Resolve().HasComponent(entity.Uid)) + if (!IoCManager.Resolve().HasComponent(entity)) { IoCManager.Resolve().AddComponent(entity); } @@ -60,8 +60,8 @@ namespace Content.Client.Lathe.Visualizers { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); - var animPlayer = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); + var animPlayer = IoCManager.Resolve().GetComponent(component.Owner); if (!component.TryGetData(PowerDeviceVisuals.VisualState, out LatheVisualState state)) { state = LatheVisualState.Idle; diff --git a/Content.Client/Lathe/Visualizers/ProtolatheVisualizer.cs b/Content.Client/Lathe/Visualizers/ProtolatheVisualizer.cs index c3088b1294..5e20139d4b 100644 --- a/Content.Client/Lathe/Visualizers/ProtolatheVisualizer.cs +++ b/Content.Client/Lathe/Visualizers/ProtolatheVisualizer.cs @@ -50,7 +50,7 @@ namespace Content.Client.Lathe.Visualizers public override void InitializeEntity(IEntity entity) { - if (!IoCManager.Resolve().HasComponent(entity.Uid)) + if (!IoCManager.Resolve().HasComponent(entity)) { IoCManager.Resolve().AddComponent(entity); } @@ -60,8 +60,8 @@ namespace Content.Client.Lathe.Visualizers { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); - var animPlayer = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); + var animPlayer = IoCManager.Resolve().GetComponent(component.Owner); if (!component.TryGetData(PowerDeviceVisuals.VisualState, out LatheVisualState state)) { state = LatheVisualState.Idle; diff --git a/Content.Client/Light/Components/LightBehaviourComponent.cs b/Content.Client/Light/Components/LightBehaviourComponent.cs index ad3de8fb74..1764f9d97f 100644 --- a/Content.Client/Light/Components/LightBehaviourComponent.cs +++ b/Content.Client/Light/Components/LightBehaviourComponent.cs @@ -58,7 +58,7 @@ namespace Content.Client.Light.Components _random = random; _parent = parent; - if (Enabled && IoCManager.Resolve().TryGetComponent(_parent.Uid, out PointLightComponent? light)) + if (Enabled && IoCManager.Resolve().TryGetComponent(_parent, out PointLightComponent? light)) { light.Enabled = true; } @@ -68,7 +68,7 @@ namespace Content.Client.Light.Components public void UpdatePlaybackValues(Animation owner) { - if (IoCManager.Resolve().TryGetComponent(_parent.Uid, out PointLightComponent? light)) + if (IoCManager.Resolve().TryGetComponent(_parent, out PointLightComponent? light)) { light.Enabled = true; } @@ -99,7 +99,7 @@ namespace Content.Client.Light.Components throw new InvalidOperationException("Property parameter is null! Check the prototype!"); } - if (IoCManager.Resolve().TryGetComponent(_parent.Uid, out PointLightComponent? light)) + if (IoCManager.Resolve().TryGetComponent(_parent, out PointLightComponent? light)) { AnimationHelper.SetAnimatableProperty(light, Property, value); } @@ -395,7 +395,7 @@ namespace Content.Client.Light.Components // TODO: Do NOT ensure component here. And use eventbus events instead... Owner.EnsureComponent(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AnimationPlayerComponent? animation)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AnimationPlayerComponent? animation)) { #pragma warning disable 618 animation.AnimationCompleted += OnAnimationCompleted; @@ -430,7 +430,7 @@ namespace Content.Client.Light.Components { container.LightBehaviour.UpdatePlaybackValues(container.Animation); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AnimationPlayerComponent? animation)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AnimationPlayerComponent? animation)) { animation.Play(container.Animation, container.FullKey); } @@ -442,7 +442,7 @@ namespace Content.Client.Light.Components /// private void CopyLightSettings() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out PointLightComponent? light)) + if (IoCManager.Resolve().TryGetComponent(Owner, out PointLightComponent? light)) { _originalColor = light.Color; _originalEnabled = light.Enabled; @@ -452,7 +452,7 @@ namespace Content.Client.Light.Components } else { - Logger.Warning($"{IoCManager.Resolve().GetComponent(Owner.Uid).EntityName} has a {nameof(LightBehaviourComponent)} but it has no {nameof(PointLightComponent)}! Check the prototype!"); + Logger.Warning($"{IoCManager.Resolve().GetComponent(Owner).EntityName} has a {nameof(LightBehaviourComponent)} but it has no {nameof(PointLightComponent)}! Check the prototype!"); } } @@ -463,7 +463,7 @@ namespace Content.Client.Light.Components /// public void StartLightBehaviour(string id = "") { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AnimationPlayerComponent? animation)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AnimationPlayerComponent? animation)) { return; } @@ -491,7 +491,7 @@ namespace Content.Client.Light.Components /// Should the light have its original settings applied? public void StopLightBehaviour(string id = "", bool removeBehaviour = false, bool resetToOriginalSettings = false) { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AnimationPlayerComponent? animation)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AnimationPlayerComponent? animation)) { return; } @@ -519,7 +519,7 @@ namespace Content.Client.Light.Components _animations.Remove(container); } - if (resetToOriginalSettings && IoCManager.Resolve().TryGetComponent(Owner.Uid, out PointLightComponent? light)) + if (resetToOriginalSettings && IoCManager.Resolve().TryGetComponent(Owner, out PointLightComponent? light)) { light.Color = _originalColor; light.Enabled = _originalEnabled; diff --git a/Content.Client/Light/RgbLightControllerSystem.cs b/Content.Client/Light/RgbLightControllerSystem.cs index be0b7ab4b0..59fbfe62b9 100644 --- a/Content.Client/Light/RgbLightControllerSystem.cs +++ b/Content.Client/Light/RgbLightControllerSystem.cs @@ -27,7 +27,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.Uid.GetHashCode() * 0.1)) % 1), + (float) (((curTime.TotalSeconds - offset.TotalSeconds) / rgb.CycleRate + Math.Abs(rgb.Owner.GetHashCode() * 0.1)) % 1), 1.0f, 1.0f, 1.0f diff --git a/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs b/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs index 15b5546047..7446162a46 100644 --- a/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs +++ b/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs @@ -98,7 +98,7 @@ namespace Content.Client.Lobby.UI _preferencesManager.OnServerDataLoaded -= UpdateUI; if (!disposing) return; - IoCManager.Resolve().DeleteEntity(_previewDummy.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) _previewDummy); _previewDummy = null!; } @@ -106,7 +106,7 @@ namespace Content.Client.Lobby.UI { return new() { - Sprite = IoCManager.Resolve().GetComponent(entity.Uid), + Sprite = IoCManager.Resolve().GetComponent(entity), OverrideDirection = direction, Scale = (2, 2) }; @@ -130,7 +130,7 @@ namespace Content.Client.Lobby.UI else { _summaryLabel.Text = selectedCharacter.Summary; - EntitySystem.Get().UpdateFromProfile(_previewDummy.Uid, selectedCharacter); + EntitySystem.Get().UpdateFromProfile(_previewDummy, selectedCharacter); GiveDummyJobClothes(_previewDummy, selectedCharacter); } } @@ -140,7 +140,7 @@ namespace Content.Client.Lobby.UI { var protoMan = IoCManager.Resolve(); - var inventory = IoCManager.Resolve().GetComponent(dummy.Uid); + var inventory = IoCManager.Resolve().GetComponent(dummy); var highPriorityJob = profile.JobPriorities.FirstOrDefault(p => p.Value == JobPriority.High).Key; @@ -160,7 +160,7 @@ namespace Content.Client.Lobby.UI { var item = entityMan.SpawnEntity(itemType, MapCoordinates.Nullspace); inventory.SetSlotVisuals(slot, item); - IoCManager.Resolve().DeleteEntity(item.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) item); } } } diff --git a/Content.Client/MachineLinking/SignalSwitchVisualizer.cs b/Content.Client/MachineLinking/SignalSwitchVisualizer.cs index c86d95a650..0fa48f1aa1 100644 --- a/Content.Client/MachineLinking/SignalSwitchVisualizer.cs +++ b/Content.Client/MachineLinking/SignalSwitchVisualizer.cs @@ -17,7 +17,7 @@ namespace Content.Client.MachineLinking { base.InitializeEntity(entity); - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(entity, out SpriteComponent? sprite)) { sprite.LayerMapReserveBlank(Layer); } diff --git a/Content.Client/Markers/MarkerComponent.cs b/Content.Client/Markers/MarkerComponent.cs index 19cc4ed824..2ac08b3338 100644 --- a/Content.Client/Markers/MarkerComponent.cs +++ b/Content.Client/Markers/MarkerComponent.cs @@ -20,7 +20,7 @@ namespace Content.Client.Markers { var system = EntitySystem.Get(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ISpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ISpriteComponent? sprite)) { sprite.Visible = system.MarkersVisible; } diff --git a/Content.Client/MedicalScanner/MedicalScannerVisualizer.cs b/Content.Client/MedicalScanner/MedicalScannerVisualizer.cs index bcc0c5f47a..efa1f6d450 100644 --- a/Content.Client/MedicalScanner/MedicalScannerVisualizer.cs +++ b/Content.Client/MedicalScanner/MedicalScannerVisualizer.cs @@ -15,7 +15,7 @@ namespace Content.Client.MedicalScanner { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (!component.TryGetData(MedicalScannerVisuals.Status, out MedicalScannerStatus status)) return; sprite.LayerSetState(MedicalScannerVisualLayers.Machine, StatusToMachineStateId(status)); sprite.LayerSetState(MedicalScannerVisualLayers.Terminal, StatusToTerminalStateId(status)); diff --git a/Content.Client/MedicalScanner/UI/MedicalScannerBoundUserInterface.cs b/Content.Client/MedicalScanner/UI/MedicalScannerBoundUserInterface.cs index 38669d2cf8..ef28c43a9e 100644 --- a/Content.Client/MedicalScanner/UI/MedicalScannerBoundUserInterface.cs +++ b/Content.Client/MedicalScanner/UI/MedicalScannerBoundUserInterface.cs @@ -20,7 +20,7 @@ namespace Content.Client.MedicalScanner.UI base.Open(); _window = new MedicalScannerWindow { - Title = IoCManager.Resolve().GetComponent(Owner.Owner.Uid).EntityName, + Title = IoCManager.Resolve().GetComponent(Owner.Owner).EntityName, }; _window.OnClose += Close; _window.ScanButton.OnPressed += _ => SendMessage(new UiButtonPressedMessage(UiButton.ScanDNA)); diff --git a/Content.Client/MedicalScanner/UI/MedicalScannerWindow.xaml.cs b/Content.Client/MedicalScanner/UI/MedicalScannerWindow.xaml.cs index c1cc2ced0c..b3203c034e 100644 --- a/Content.Client/MedicalScanner/UI/MedicalScannerWindow.xaml.cs +++ b/Content.Client/MedicalScanner/UI/MedicalScannerWindow.xaml.cs @@ -37,7 +37,7 @@ namespace Content.Client.MedicalScanner.UI } else { - text.Append($"{Loc.GetString("medical-scanner-window-entity-health-text", ("entityName", Name: IoCManager.Resolve().GetComponent(entity.Uid).EntityName))}\n"); + text.Append($"{Loc.GetString("medical-scanner-window-entity-health-text", ("entityName", Name: IoCManager.Resolve().GetComponent(entity).EntityName))}\n"); var totalDamage = state.DamagePerType.Values.Sum(); diff --git a/Content.Client/Mining/AsteroidRockVisualizer.cs b/Content.Client/Mining/AsteroidRockVisualizer.cs index f3590ddce8..ac3afa5cc1 100644 --- a/Content.Client/Mining/AsteroidRockVisualizer.cs +++ b/Content.Client/Mining/AsteroidRockVisualizer.cs @@ -17,7 +17,7 @@ namespace Content.Client.Mining { base.InitializeEntity(entity); - IoCManager.Resolve().GetComponentOrNull(entity.Uid)?.LayerMapReserveBlank(Layer); + IoCManager.Resolve().GetComponentOrNull(entity)?.LayerMapReserveBlank(Layer); } public override void OnChangeData(AppearanceComponent component) diff --git a/Content.Client/MobState/DamageStateVisualizer.cs b/Content.Client/MobState/DamageStateVisualizer.cs index 5219da3d50..afcc822cd1 100644 --- a/Content.Client/MobState/DamageStateVisualizer.cs +++ b/Content.Client/MobState/DamageStateVisualizer.cs @@ -52,7 +52,7 @@ namespace Content.Client.MobState public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (!component.TryGetData(DamageStateVisuals.State, out DamageState data)) { return; diff --git a/Content.Client/MobState/Overlays/CritOverlay.cs b/Content.Client/MobState/Overlays/CritOverlay.cs index 0c802081cb..8b113da5bf 100644 --- a/Content.Client/MobState/Overlays/CritOverlay.cs +++ b/Content.Client/MobState/Overlays/CritOverlay.cs @@ -32,7 +32,7 @@ namespace Content.Client.MobState.Overlays return false; } - if (IoCManager.Resolve().TryGetComponent(playerEntity.Uid, out var mobState)) + if (IoCManager.Resolve().TryGetComponent(playerEntity, out var mobState)) { if (critical) if (mobState.IsCritical()) diff --git a/Content.Client/NodeContainer/NodeVisualizationOverlay.cs b/Content.Client/NodeContainer/NodeVisualizationOverlay.cs index ef4c6a3db8..e1ee379b47 100644 --- a/Content.Client/NodeContainer/NodeVisualizationOverlay.cs +++ b/Content.Client/NodeContainer/NodeVisualizationOverlay.cs @@ -81,9 +81,9 @@ namespace Content.Client.NodeContainer var entity = _entityManager.GetEntity(node.Entity); - var gridId = IoCManager.Resolve().GetComponent(entity.Uid).GridID; + var gridId = IoCManager.Resolve().GetComponent(entity).GridID; var grid = _mapManager.GetGrid(gridId); - var gridTile = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); + var gridTile = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(entity).Coordinates); var sb = new StringBuilder(); sb.Append($"entity: {entity}\n"); @@ -117,13 +117,13 @@ namespace Content.Client.NodeContainer var worldAABB = overlayDrawArgs.WorldAABB; _lookup.FastEntitiesIntersecting(map, ref worldAABB, entity => { - if (!_system.Entities.TryGetValue(entity.Uid, out var nodeData)) + if (!_system.Entities.TryGetValue(entity, out var nodeData)) return; - var gridId = IoCManager.Resolve().GetComponent(entity.Uid).GridID; + var gridId = IoCManager.Resolve().GetComponent(entity).GridID; var grid = _mapManager.GetGrid(gridId); var gridDict = _gridIndex.GetOrNew(gridId); - var coords = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; + var coords = IoCManager.Resolve().GetComponent(entity).Coordinates; // TODO: This probably shouldn't be capable of returning NaN... if (float.IsNaN(coords.Position.X) || float.IsNaN(coords.Position.Y)) diff --git a/Content.Client/Nutrition/Visualizers/CreamPiedVisualizer.cs b/Content.Client/Nutrition/Visualizers/CreamPiedVisualizer.cs index 59d3da159b..d31f74595c 100644 --- a/Content.Client/Nutrition/Visualizers/CreamPiedVisualizer.cs +++ b/Content.Client/Nutrition/Visualizers/CreamPiedVisualizer.cs @@ -17,7 +17,7 @@ namespace Content.Client.Nutrition.Visualizers { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); sprite.LayerMapReserveBlank(CreamPiedVisualLayers.Pie); sprite.LayerSetRSI(CreamPiedVisualLayers.Pie, "Effects/creampie.rsi"); @@ -36,7 +36,7 @@ namespace Content.Client.Nutrition.Visualizers private void SetPied(AppearanceComponent component, bool pied) { - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); sprite.LayerSetVisible(CreamPiedVisualLayers.Pie, pied); sprite.LayerSetState(CreamPiedVisualLayers.Pie, _state); diff --git a/Content.Client/PDA/PDAVisualizer.cs b/Content.Client/PDA/PDAVisualizer.cs index f1bd1cd6ce..9fb063f0ca 100644 --- a/Content.Client/PDA/PDAVisualizer.cs +++ b/Content.Client/PDA/PDAVisualizer.cs @@ -28,7 +28,7 @@ namespace Content.Client.PDA public override void InitializeEntity(IEntity entity) { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); if (_state != null) { @@ -46,7 +46,7 @@ namespace Content.Client.PDA { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); sprite.LayerSetVisible(PDAVisualLayers.Flashlight, false); if (component.TryGetData(UnpoweredFlashlightVisuals.LightOn, out bool isFlashlightOn)) { diff --git a/Content.Client/Paper/UI/PaperBoundUserInterface.cs b/Content.Client/Paper/UI/PaperBoundUserInterface.cs index 67ed0345f9..b3803a6e89 100644 --- a/Content.Client/Paper/UI/PaperBoundUserInterface.cs +++ b/Content.Client/Paper/UI/PaperBoundUserInterface.cs @@ -21,7 +21,7 @@ namespace Content.Client.Paper.UI base.Open(); _window = new PaperWindow { - Title = IoCManager.Resolve().GetComponent(Owner.Owner.Uid).EntityName, + Title = IoCManager.Resolve().GetComponent(Owner.Owner).EntityName, }; _window.OnClose += Close; _window.Input.OnTextEntered += Input_OnTextEntered; diff --git a/Content.Client/ParticleAccelerator/ParticleAcceleratorPartVisualizer.cs b/Content.Client/ParticleAccelerator/ParticleAcceleratorPartVisualizer.cs index fb9b7ee3f1..d4ca9a64fb 100644 --- a/Content.Client/ParticleAccelerator/ParticleAcceleratorPartVisualizer.cs +++ b/Content.Client/ParticleAccelerator/ParticleAcceleratorPartVisualizer.cs @@ -36,7 +36,7 @@ namespace Content.Client.ParticleAccelerator public override void InitializeEntity(IEntity entity) { base.InitializeEntity(entity); - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out var sprite)) + if (!IoCManager.Resolve().TryGetComponent(entity, out var sprite)) { throw new EntityCreationException("No sprite component found in entity that has ParticleAcceleratorPartVisualizer"); } diff --git a/Content.Client/Physics/Controllers/MoverController.cs b/Content.Client/Physics/Controllers/MoverController.cs index 1a6f9f9ccd..c128f608e4 100644 --- a/Content.Client/Physics/Controllers/MoverController.cs +++ b/Content.Client/Physics/Controllers/MoverController.cs @@ -19,8 +19,8 @@ namespace Content.Client.Physics.Controllers var player = _playerManager.LocalPlayer?.ControlledEntity; if (player == null || - !IoCManager.Resolve().TryGetComponent(player.Uid, out IMoverComponent? mover) || - !IoCManager.Resolve().TryGetComponent(player.Uid, out PhysicsComponent? body)) return; + !IoCManager.Resolve().TryGetComponent(player, out IMoverComponent? mover) || + !IoCManager.Resolve().TryGetComponent(player, out PhysicsComponent? body)) return; // Essentially we only want to set our mob to predicted so every other entity we just interpolate // (i.e. only see what the server has sent us). @@ -30,7 +30,7 @@ namespace Content.Client.Physics.Controllers // We set joints to predicted given these can affect how our mob moves. // I would only recommend disabling this if you make pulling not use joints anymore (someday maybe?) - if (IoCManager.Resolve().TryGetComponent(player.Uid, out JointComponent? jointComponent)) + if (IoCManager.Resolve().TryGetComponent(player, out JointComponent? jointComponent)) { foreach (var joint in jointComponent.GetJoints) { @@ -40,10 +40,10 @@ namespace Content.Client.Physics.Controllers } // If we're being pulled then we won't predict anything and will receive server lerps so it looks way smoother. - if (IoCManager.Resolve().TryGetComponent(player.Uid, out SharedPullableComponent? pullableComp)) + if (IoCManager.Resolve().TryGetComponent(player, out SharedPullableComponent? pullableComp)) { var puller = pullableComp.Puller; - if (puller != null && IoCManager.Resolve().TryGetComponent(puller.Uid, out var pullerBody)) + if (puller != null && IoCManager.Resolve().TryGetComponent(puller, out var pullerBody)) { pullerBody.Predict = false; body.Predict = false; @@ -51,20 +51,20 @@ namespace Content.Client.Physics.Controllers } // If we're pulling a mob then make sure that isn't predicted so it doesn't fuck our velocity up. - if (IoCManager.Resolve().TryGetComponent(player.Uid, out SharedPullerComponent? pullerComp)) + if (IoCManager.Resolve().TryGetComponent(player, out SharedPullerComponent? pullerComp)) { var pulling = pullerComp.Pulling; if (pulling != null && - IoCManager.Resolve().HasComponent(pulling.Uid) && - IoCManager.Resolve().TryGetComponent(pulling.Uid, out PhysicsComponent? pullingBody)) + IoCManager.Resolve().HasComponent(pulling) && + IoCManager.Resolve().TryGetComponent(pulling, out PhysicsComponent? pullingBody)) { pullingBody.Predict = false; } } // Server-side should just be handled on its own so we'll just do this shizznit - if (IoCManager.Resolve().TryGetComponent(player.Uid, out IMobMoverComponent? mobMover)) + if (IoCManager.Resolve().TryGetComponent(player, out IMobMoverComponent? mobMover)) { HandleMobMovement(mover, body, mobMover); return; diff --git a/Content.Client/Pointing/Components/PointingArrowComponent.cs b/Content.Client/Pointing/Components/PointingArrowComponent.cs index 11916b80b7..187f9a19a8 100644 --- a/Content.Client/Pointing/Components/PointingArrowComponent.cs +++ b/Content.Client/Pointing/Components/PointingArrowComponent.cs @@ -13,7 +13,7 @@ namespace Content.Client.Pointing.Components { base.Startup(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(Owner, out SpriteComponent? sprite)) { sprite.DrawDepth = (int) DrawDepth.Overlays; } diff --git a/Content.Client/Pointing/Components/RoguePointingArrowComponent.cs b/Content.Client/Pointing/Components/RoguePointingArrowComponent.cs index 782042c160..9d06ae585f 100644 --- a/Content.Client/Pointing/Components/RoguePointingArrowComponent.cs +++ b/Content.Client/Pointing/Components/RoguePointingArrowComponent.cs @@ -13,7 +13,7 @@ namespace Content.Client.Pointing.Components { base.Startup(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(Owner, out SpriteComponent? sprite)) { sprite.DrawDepth = (int) DrawDepth.Overlays; } diff --git a/Content.Client/Pointing/RoguePointingArrowVisualizer.cs b/Content.Client/Pointing/RoguePointingArrowVisualizer.cs index c5a974fff4..9c313bed3d 100644 --- a/Content.Client/Pointing/RoguePointingArrowVisualizer.cs +++ b/Content.Client/Pointing/RoguePointingArrowVisualizer.cs @@ -25,9 +25,9 @@ namespace Content.Client.Pointing private void SetRotation(AppearanceComponent component, Angle rotation) { - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); - if (!IoCManager.Resolve().TryGetComponent(sprite.Owner.Uid, out AnimationPlayerComponent? animation)) + if (!IoCManager.Resolve().TryGetComponent(sprite.Owner, out AnimationPlayerComponent? animation)) { sprite.Rotation = rotation; return; diff --git a/Content.Client/Popups/PopupSystem.cs b/Content.Client/Popups/PopupSystem.cs index 1d369fc80d..622013f2d6 100644 --- a/Content.Client/Popups/PopupSystem.cs +++ b/Content.Client/Popups/PopupSystem.cs @@ -162,7 +162,7 @@ namespace Content.Client.Popups var position = Entity == null ? InitialPos - : (_eyeManager.CoordinatesToScreen(IoCManager.Resolve().GetComponent(Entity.Uid).Coordinates).Position / UIScale) - DesiredSize / 2; + : (_eyeManager.CoordinatesToScreen(IoCManager.Resolve().GetComponent(Entity).Coordinates).Position / UIScale) - DesiredSize / 2; LayoutContainer.SetPosition(this, position - (0, 20 * (TimeLeft * TimeLeft + TimeLeft))); diff --git a/Content.Client/Power/APC/ApcVisualizer.cs b/Content.Client/Power/APC/ApcVisualizer.cs index 2a101eb79c..3107cdbebb 100644 --- a/Content.Client/Power/APC/ApcVisualizer.cs +++ b/Content.Client/Power/APC/ApcVisualizer.cs @@ -13,7 +13,7 @@ namespace Content.Client.Power.APC { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); sprite.LayerMapSet(Layers.ChargeState, sprite.AddLayerState("apco3-0")); sprite.LayerSetShader(Layers.ChargeState, "unshaded"); @@ -35,7 +35,7 @@ namespace Content.Client.Power.APC { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (component.TryGetData(ApcVisuals.ChargeState, out var state)) { switch (state) diff --git a/Content.Client/Power/SMES/SmesVisualizer.cs b/Content.Client/Power/SMES/SmesVisualizer.cs index aaa08031a2..13f6a0068a 100644 --- a/Content.Client/Power/SMES/SmesVisualizer.cs +++ b/Content.Client/Power/SMES/SmesVisualizer.cs @@ -14,7 +14,7 @@ namespace Content.Client.Power.SMES { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); sprite.LayerMapSet(Layers.Input, sprite.AddLayerState("smes-oc0")); sprite.LayerSetShader(Layers.Input, "unshaded"); @@ -29,7 +29,7 @@ namespace Content.Client.Power.SMES { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (!component.TryGetData(SmesVisuals.LastChargeLevel, out var level) || level == 0) { sprite.LayerSetVisible(Layers.Charge, false); diff --git a/Content.Client/Power/Visualizers/PowerDeviceVisualizer.cs b/Content.Client/Power/Visualizers/PowerDeviceVisualizer.cs index 9f996da270..dd3c525128 100644 --- a/Content.Client/Power/Visualizers/PowerDeviceVisualizer.cs +++ b/Content.Client/Power/Visualizers/PowerDeviceVisualizer.cs @@ -13,7 +13,7 @@ namespace Content.Client.Power { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); var powered = component.TryGetData(PowerDeviceVisuals.Powered, out bool poweredVar) && poweredVar; sprite.LayerSetVisible(PowerDeviceVisualLayers.Powered, powered); } diff --git a/Content.Client/PowerCell/PowerCellVisualizer.cs b/Content.Client/PowerCell/PowerCellVisualizer.cs index f5c9ae4110..7b6aebbee6 100644 --- a/Content.Client/PowerCell/PowerCellVisualizer.cs +++ b/Content.Client/PowerCell/PowerCellVisualizer.cs @@ -17,7 +17,7 @@ namespace Content.Client.PowerCell { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); if (_prefix != null) { @@ -30,7 +30,7 @@ namespace Content.Client.PowerCell { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (component.TryGetData(PowerCellVisuals.ChargeLevel, out byte level)) { var adjustedLevel = level * 25; diff --git a/Content.Client/PowerCell/PowerChargerVisualizer.cs b/Content.Client/PowerCell/PowerChargerVisualizer.cs index 73214f2321..c5af6aa785 100644 --- a/Content.Client/PowerCell/PowerChargerVisualizer.cs +++ b/Content.Client/PowerCell/PowerChargerVisualizer.cs @@ -13,7 +13,7 @@ namespace Content.Client.PowerCell { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); // Base item sprite.LayerMapSet(Layers.Base, sprite.AddLayerState("empty")); @@ -27,7 +27,7 @@ namespace Content.Client.PowerCell { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); // Update base item if (component.TryGetData(CellVisual.Occupied, out bool occupied)) diff --git a/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs b/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs index 7b6a53732c..e709966659 100644 --- a/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs +++ b/Content.Client/Preferences/UI/CharacterSetupGui.xaml.cs @@ -151,7 +151,7 @@ namespace Content.Client.Preferences.UI Group = group; _previewDummy = entityManager.SpawnEntity("MobHumanDummy", MapCoordinates.Nullspace); - EntitySystem.Get().UpdateFromProfile(_previewDummy.Uid, profile); + EntitySystem.Get().UpdateFromProfile(_previewDummy, profile); var humanoid = profile as HumanoidCharacterProfile; if (humanoid != null) { @@ -165,7 +165,7 @@ namespace Content.Client.Preferences.UI var view = new SpriteView { - Sprite = IoCManager.Resolve().GetComponent(_previewDummy.Uid), + Sprite = IoCManager.Resolve().GetComponent(_previewDummy), Scale = (2, 2), OverrideDirection = Direction.South }; @@ -218,7 +218,7 @@ namespace Content.Client.Preferences.UI if (!disposing) return; - IoCManager.Resolve().DeleteEntity(_previewDummy.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) _previewDummy); _previewDummy = null!; } } diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs index 76302080fb..c2a3377ec0 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs @@ -438,7 +438,7 @@ namespace Content.Client.Preferences.UI #region Preview _previewDummy = entityManager.SpawnEntity("MobHumanDummy", MapCoordinates.Nullspace); - var sprite = IoCManager.Resolve().GetComponent(_previewDummy.Uid); + var sprite = IoCManager.Resolve().GetComponent(_previewDummy); // Front _previewSprite = new SpriteView @@ -482,7 +482,7 @@ namespace Content.Client.Preferences.UI if (!disposing) return; - IoCManager.Resolve().DeleteEntity(_previewDummy.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) _previewDummy); _preferencesManager.OnServerDataLoaded -= LoadServerData; } @@ -660,7 +660,7 @@ namespace Content.Client.Preferences.UI if (Profile is null) return; - EntitySystem.Get().UpdateFromProfile(_previewDummy.Uid, Profile); + EntitySystem.Get().UpdateFromProfile(_previewDummy, Profile); LobbyCharacterPreviewPanel.GiveDummyJobClothes(_previewDummy, Profile); } diff --git a/Content.Client/Recycling/RecyclerVisualizer.cs b/Content.Client/Recycling/RecyclerVisualizer.cs index 96cb5802fd..5b7fbe889f 100644 --- a/Content.Client/Recycling/RecyclerVisualizer.cs +++ b/Content.Client/Recycling/RecyclerVisualizer.cs @@ -21,8 +21,8 @@ namespace Content.Client.Recycling { base.InitializeEntity(entity); - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out ISpriteComponent? sprite) || - !IoCManager.Resolve().TryGetComponent(entity.Uid, out AppearanceComponent? appearance)) + if (!IoCManager.Resolve().TryGetComponent(entity, out ISpriteComponent? sprite) || + !IoCManager.Resolve().TryGetComponent(entity, out AppearanceComponent? appearance)) { return; } diff --git a/Content.Client/Research/UI/ResearchConsoleBoundUserInterface.cs b/Content.Client/Research/UI/ResearchConsoleBoundUserInterface.cs index 7fb900bdaf..8703825d65 100644 --- a/Content.Client/Research/UI/ResearchConsoleBoundUserInterface.cs +++ b/Content.Client/Research/UI/ResearchConsoleBoundUserInterface.cs @@ -24,7 +24,7 @@ namespace Content.Client.Research.UI { base.Open(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Owner.Uid, out _technologyDatabase)) return; + if (!IoCManager.Resolve().TryGetComponent(Owner.Owner, out _technologyDatabase)) return; _consoleMenu = new ResearchConsoleMenu(this); diff --git a/Content.Client/Rotation/RotationVisualizer.cs b/Content.Client/Rotation/RotationVisualizer.cs index faba72e7b3..f8a2c519bd 100644 --- a/Content.Client/Rotation/RotationVisualizer.cs +++ b/Content.Client/Rotation/RotationVisualizer.cs @@ -33,9 +33,9 @@ namespace Content.Client.Rotation private void SetRotation(AppearanceComponent component, Angle rotation) { - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); - if (!IoCManager.Resolve().TryGetComponent(sprite.Owner.Uid, out AnimationPlayerComponent? animation)) + if (!IoCManager.Resolve().TryGetComponent(sprite.Owner, out AnimationPlayerComponent? animation)) { sprite.Rotation = rotation; return; diff --git a/Content.Client/Singularity/Components/ContainmentFieldComponent.cs b/Content.Client/Singularity/Components/ContainmentFieldComponent.cs index a3bd3f4a5b..2bae3934ab 100644 --- a/Content.Client/Singularity/Components/ContainmentFieldComponent.cs +++ b/Content.Client/Singularity/Components/ContainmentFieldComponent.cs @@ -18,7 +18,7 @@ namespace Content.Client.Singularity.Components { base.Initialize(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out _spriteComponent)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out _spriteComponent)) { Logger.Error($"{nameof(ContainmentFieldComponent)} created without {nameof(SpriteComponent)}"); } diff --git a/Content.Client/Singularity/SingularityOverlay.cs b/Content.Client/Singularity/SingularityOverlay.cs index a4f9a5ca1c..bf10dfb1cb 100644 --- a/Content.Client/Singularity/SingularityOverlay.cs +++ b/Content.Client/Singularity/SingularityOverlay.cs @@ -78,9 +78,9 @@ namespace Content.Client.Singularity { var singuloEntity = distortion.Owner; - if (!_singularities.Keys.Contains(singuloEntity.Uid) && SinguloQualifies(singuloEntity, currentEyeLoc)) + if (!_singularities.Keys.Contains(singuloEntity) && SinguloQualifies(singuloEntity, currentEyeLoc)) { - _singularities.Add(singuloEntity.Uid, new SingularityShaderInstance(IoCManager.Resolve().GetComponent(singuloEntity.Uid).MapPosition.Position, distortion.Intensity, distortion.Falloff)); + _singularities.Add(singuloEntity, new SingularityShaderInstance(IoCManager.Resolve().GetComponent(singuloEntity).MapPosition.Position, distortion.Intensity, distortion.Falloff)); } } @@ -95,14 +95,14 @@ namespace Content.Client.Singularity } else { - if (!IoCManager.Resolve().TryGetComponent(singuloEntity.Uid, out var distortion)) + if (!IoCManager.Resolve().TryGetComponent(singuloEntity, out var distortion)) { _singularities.Remove(activeSinguloUid); } else { var shaderInstance = _singularities[activeSinguloUid]; - shaderInstance.CurrentMapCoords = IoCManager.Resolve().GetComponent(singuloEntity.Uid).MapPosition.Position; + shaderInstance.CurrentMapCoords = IoCManager.Resolve().GetComponent(singuloEntity).MapPosition.Position; shaderInstance.Intensity = distortion.Intensity; shaderInstance.Falloff = distortion.Falloff; } @@ -119,7 +119,7 @@ namespace Content.Client.Singularity private bool SinguloQualifies(IEntity singuloEntity, MapCoordinates currentEyeLoc) { - return IoCManager.Resolve().GetComponent(singuloEntity.Uid).MapID == currentEyeLoc.MapId && IoCManager.Resolve().GetComponent(singuloEntity.Uid).Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, IoCManager.Resolve().GetComponent(singuloEntity.Uid).ParentUid, currentEyeLoc), MaxDist); + return IoCManager.Resolve().GetComponent(singuloEntity).MapID == currentEyeLoc.MapId && IoCManager.Resolve().GetComponent(singuloEntity).Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, IoCManager.Resolve().GetComponent(singuloEntity).ParentUid, currentEyeLoc), MaxDist); } private sealed class SingularityShaderInstance diff --git a/Content.Client/Singularity/Visualizers/RadiationCollectorVisualizer.cs b/Content.Client/Singularity/Visualizers/RadiationCollectorVisualizer.cs index 2830e719e0..e943f027ae 100644 --- a/Content.Client/Singularity/Visualizers/RadiationCollectorVisualizer.cs +++ b/Content.Client/Singularity/Visualizers/RadiationCollectorVisualizer.cs @@ -46,7 +46,7 @@ namespace Content.Client.Singularity.Visualizers public override void InitializeEntity(IEntity entity) { - if (!IoCManager.Resolve().HasComponent(entity.Uid)) + if (!IoCManager.Resolve().HasComponent(entity)) { IoCManager.Resolve().AddComponent(entity); } diff --git a/Content.Client/Singularity/Visualizers/SingularityVisualizer.cs b/Content.Client/Singularity/Visualizers/SingularityVisualizer.cs index 2f14d899f1..99ed733c8b 100644 --- a/Content.Client/Singularity/Visualizers/SingularityVisualizer.cs +++ b/Content.Client/Singularity/Visualizers/SingularityVisualizer.cs @@ -18,7 +18,7 @@ namespace Content.Client.Singularity.Visualizers { base.InitializeEntity(entity); - IoCManager.Resolve().GetComponentOrNull(entity.Uid)?.LayerMapReserveBlank(Layer); + IoCManager.Resolve().GetComponentOrNull(entity)?.LayerMapReserveBlank(Layer); } public override void OnChangeData(AppearanceComponent component) diff --git a/Content.Client/Smoking/BurnStateVisualizer.cs b/Content.Client/Smoking/BurnStateVisualizer.cs index 387a62091a..ab0ded6d48 100644 --- a/Content.Client/Smoking/BurnStateVisualizer.cs +++ b/Content.Client/Smoking/BurnStateVisualizer.cs @@ -39,7 +39,7 @@ namespace Content.Client.Smoking private void SetState(AppearanceComponent component, SmokableState burnState) { - var clothing = IoCManager.Resolve().GetComponentOrNull(component.Owner.Uid); + var clothing = IoCManager.Resolve().GetComponentOrNull(component.Owner); if (component.Owner.TryGetComponent(out var sprite)) { diff --git a/Content.Client/Spawners/ClientEntitySpawnerComponent.cs b/Content.Client/Spawners/ClientEntitySpawnerComponent.cs index 8e56097e57..88f6ea7f10 100644 --- a/Content.Client/Spawners/ClientEntitySpawnerComponent.cs +++ b/Content.Client/Spawners/ClientEntitySpawnerComponent.cs @@ -33,7 +33,7 @@ namespace Content.Client.Spawners { foreach (var proto in _prototypes) { - var entity = IoCManager.Resolve().SpawnEntity(proto, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var entity = IoCManager.Resolve().SpawnEntity(proto, IoCManager.Resolve().GetComponent(Owner).Coordinates); _entity.Add(entity); } } diff --git a/Content.Client/Stack/StackVisualizer.cs b/Content.Client/Stack/StackVisualizer.cs index d0e06cb312..bf9d5d23a2 100644 --- a/Content.Client/Stack/StackVisualizer.cs +++ b/Content.Client/Stack/StackVisualizer.cs @@ -84,7 +84,7 @@ namespace Content.Client.Stack if (_isComposite && _spriteLayers.Count > 0 - && IoCManager.Resolve().TryGetComponent(entity.Uid, out var spriteComponent)) + && IoCManager.Resolve().TryGetComponent(entity, out var spriteComponent)) { var spritePath = _spritePath ?? spriteComponent.BaseRSI!.Path!; diff --git a/Content.Client/StationEvents/RadiationPulseOverlay.cs b/Content.Client/StationEvents/RadiationPulseOverlay.cs index a2ce7672af..8cdfbc5a7b 100644 --- a/Content.Client/StationEvents/RadiationPulseOverlay.cs +++ b/Content.Client/StationEvents/RadiationPulseOverlay.cs @@ -86,14 +86,14 @@ namespace Content.Client.StationEvents { var pulseEntity = pulse.Owner; - if (!_pulses.Keys.Contains(pulseEntity.Uid) && PulseQualifies(pulseEntity, currentEyeLoc)) + if (!_pulses.Keys.Contains(pulseEntity) && PulseQualifies(pulseEntity, currentEyeLoc)) { _pulses.Add( - pulseEntity.Uid, + pulseEntity, ( _baseShader.Duplicate(), new RadiationShaderInstance( - IoCManager.Resolve().GetComponent(pulseEntity.Uid).MapPosition.Position, + IoCManager.Resolve().GetComponent(pulseEntity).MapPosition.Position, pulse.Range, pulse.StartTime, pulse.EndTime @@ -108,10 +108,10 @@ namespace Content.Client.StationEvents { if (_entityManager.TryGetEntity(activePulseUid, out var pulseEntity) && PulseQualifies(pulseEntity, currentEyeLoc) && - IoCManager.Resolve().TryGetComponent(pulseEntity.Uid, out var pulse)) + IoCManager.Resolve().TryGetComponent(pulseEntity, out var pulse)) { var shaderInstance = _pulses[activePulseUid]; - shaderInstance.instance.CurrentMapCoords = IoCManager.Resolve().GetComponent(pulseEntity.Uid).MapPosition.Position; + shaderInstance.instance.CurrentMapCoords = IoCManager.Resolve().GetComponent(pulseEntity).MapPosition.Position; shaderInstance.instance.Range = pulse.Range; } else { _pulses[activePulseUid].shd.Dispose(); @@ -123,7 +123,7 @@ namespace Content.Client.StationEvents private bool PulseQualifies(IEntity pulseEntity, MapCoordinates currentEyeLoc) { - return IoCManager.Resolve().GetComponent(pulseEntity.Uid).MapID == currentEyeLoc.MapId && IoCManager.Resolve().GetComponent(pulseEntity.Uid).Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, IoCManager.Resolve().GetComponent(pulseEntity.Uid).ParentUid, currentEyeLoc), MaxDist); + return IoCManager.Resolve().GetComponent(pulseEntity).MapID == currentEyeLoc.MapId && IoCManager.Resolve().GetComponent(pulseEntity).Coordinates.InRange(_entityManager, EntityCoordinates.FromMap(_entityManager, IoCManager.Resolve().GetComponent(pulseEntity).ParentUid, currentEyeLoc), MaxDist); } private sealed record RadiationShaderInstance(Vector2 CurrentMapCoords, float Range, TimeSpan Start, TimeSpan End) diff --git a/Content.Client/Storage/ClientStorageComponent.cs b/Content.Client/Storage/ClientStorageComponent.cs index b438666ace..178c046645 100644 --- a/Content.Client/Storage/ClientStorageComponent.cs +++ b/Content.Client/Storage/ClientStorageComponent.cs @@ -46,7 +46,7 @@ namespace Content.Client.Storage { base.OnAdd(); - _window = new StorageWindow(this) {Title = IoCManager.Resolve().GetComponent(Owner.Uid).EntityName}; + _window = new StorageWindow(this) {Title = IoCManager.Resolve().GetComponent(Owner).EntityName}; _window.EntityList.GenerateItem += GenerateButton; _window.EntityList.ItemPressed += Interact; } @@ -120,7 +120,7 @@ namespace Content.Client.Storage if (IoCManager.Resolve().TryGetEntity(entityId, out var entity)) { - ReusableAnimations.AnimateEntityPickup(entity, initialPosition, IoCManager.Resolve().GetComponent(Owner.Uid).LocalPosition); + ReusableAnimations.AnimateEntityPickup(entity, initialPosition, IoCManager.Resolve().GetComponent(Owner).LocalPosition); } } } @@ -181,8 +181,8 @@ namespace Content.Client.Storage if (!IoCManager.Resolve().TryGetEntity(entityUid, out var entity)) return; - IoCManager.Resolve().TryGetComponent(entity.Uid, out ISpriteComponent? sprite); - IoCManager.Resolve().TryGetComponent(entity.Uid, out ItemComponent? item); + IoCManager.Resolve().TryGetComponent(entity, out ISpriteComponent? sprite); + IoCManager.Resolve().TryGetComponent(entity, out ItemComponent? item); button.AddChild(new BoxContainer { @@ -202,7 +202,7 @@ namespace Content.Client.Storage { HorizontalExpand = true, ClipText = true, - Text = IoCManager.Resolve().GetComponent(entity.Uid).EntityName + Text = IoCManager.Resolve().GetComponent(entity).EntityName }, new Label { @@ -252,7 +252,7 @@ namespace Content.Client.Storage { var controlledEntity = IoCManager.Resolve().LocalPlayer?.ControlledEntity; - if (controlledEntity != null && IoCManager.Resolve().TryGetComponent(controlledEntity.Uid, out HandsComponent? hands)) + if (controlledEntity != null && IoCManager.Resolve().TryGetComponent(controlledEntity, out HandsComponent? hands)) { #pragma warning disable 618 StorageEntity.SendNetworkMessage(new InsertEntityMessage()); diff --git a/Content.Client/Storage/Visualizers/BagOpenCloseVisualizer.cs b/Content.Client/Storage/Visualizers/BagOpenCloseVisualizer.cs index 5f2c3016d7..5a4037e3d4 100644 --- a/Content.Client/Storage/Visualizers/BagOpenCloseVisualizer.cs +++ b/Content.Client/Storage/Visualizers/BagOpenCloseVisualizer.cs @@ -32,7 +32,7 @@ namespace Content.Client.Storage.Visualizers base.InitializeEntity(entity); if (_openIcon != null && - IoCManager.Resolve().TryGetComponent(entity.Uid, out var spriteComponent) && + IoCManager.Resolve().TryGetComponent(entity, out var spriteComponent) && spriteComponent.BaseRSI?.Path != null) { spriteComponent.LayerMapReserveBlank(OpenIcon); diff --git a/Content.Client/Storage/Visualizers/MappedItemVisualizer.cs b/Content.Client/Storage/Visualizers/MappedItemVisualizer.cs index 53d81ce757..6b0f77f850 100644 --- a/Content.Client/Storage/Visualizers/MappedItemVisualizer.cs +++ b/Content.Client/Storage/Visualizers/MappedItemVisualizer.cs @@ -20,7 +20,7 @@ namespace Content.Client.Storage.Visualizers { base.InitializeEntity(entity); - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out var spriteComponent)) + if (IoCManager.Resolve().TryGetComponent(entity, out var spriteComponent)) { _rsiPath ??= spriteComponent.BaseRSI!.Path!; } diff --git a/Content.Client/Storage/Visualizers/StorageVisualizer.cs b/Content.Client/Storage/Visualizers/StorageVisualizer.cs index 7cc3f4111e..52768036cc 100644 --- a/Content.Client/Storage/Visualizers/StorageVisualizer.cs +++ b/Content.Client/Storage/Visualizers/StorageVisualizer.cs @@ -19,7 +19,7 @@ namespace Content.Client.Storage.Visualizers public override void InitializeEntity(IEntity entity) { - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out ISpriteComponent? sprite)) + if (!IoCManager.Resolve().TryGetComponent(entity, out ISpriteComponent? sprite)) { return; } diff --git a/Content.Client/Suspicion/SuspicionGui.xaml.cs b/Content.Client/Suspicion/SuspicionGui.xaml.cs index fe78715743..3352d64c94 100644 --- a/Content.Client/Suspicion/SuspicionGui.xaml.cs +++ b/Content.Client/Suspicion/SuspicionGui.xaml.cs @@ -65,7 +65,7 @@ namespace Content.Client.Suspicion return false; } - return IoCManager.Resolve().TryGetComponent(_playerManager.LocalPlayer.ControlledEntity.Uid, out suspicion); + return IoCManager.Resolve().TryGetComponent(_playerManager.LocalPlayer.ControlledEntity, out suspicion); } public void UpdateLabel() diff --git a/Content.Client/Suspicion/TraitorOverlay.cs b/Content.Client/Suspicion/TraitorOverlay.cs index d79cc098e8..6e1212d66d 100644 --- a/Content.Client/Suspicion/TraitorOverlay.cs +++ b/Content.Client/Suspicion/TraitorOverlay.cs @@ -41,7 +41,7 @@ namespace Content.Client.Suspicion var viewport = _eyeManager.GetWorldViewport(); var ent = _playerManager.LocalPlayer?.ControlledEntity; - if (ent == null || IoCManager.Resolve().TryGetComponent(ent.Uid, out SuspicionRoleComponent? sus) != true) + if (ent == null || IoCManager.Resolve().TryGetComponent(ent, out SuspicionRoleComponent? sus) != true) { return; } @@ -54,19 +54,19 @@ namespace Content.Client.Suspicion continue; } - if (!IoCManager.Resolve().TryGetComponent(ally.Uid, out IPhysBody? physics)) + if (!IoCManager.Resolve().TryGetComponent(ally, out IPhysBody? physics)) { continue; } - if (!ExamineSystemShared.InRangeUnOccluded(IoCManager.Resolve().GetComponent(ent.Uid).MapPosition, IoCManager.Resolve().GetComponent(ally.Uid).MapPosition, 15, + if (!ExamineSystemShared.InRangeUnOccluded(IoCManager.Resolve().GetComponent(ent).MapPosition, IoCManager.Resolve().GetComponent(ally).MapPosition, 15, entity => entity == ent || entity == ally)) { continue; } // if not on the same map, continue - if (IoCManager.Resolve().GetComponent(physics.Owner.Uid).MapID != _eyeManager.CurrentMap || physics.Owner.IsInContainer()) + if (IoCManager.Resolve().GetComponent(physics.Owner).MapID != _eyeManager.CurrentMap || physics.Owner.IsInContainer()) { continue; } diff --git a/Content.Client/Tabletop/TabletopSystem.cs b/Content.Client/Tabletop/TabletopSystem.cs index 81d9070cc4..be986d8422 100644 --- a/Content.Client/Tabletop/TabletopSystem.cs +++ b/Content.Client/Tabletop/TabletopSystem.cs @@ -51,7 +51,7 @@ namespace Content.Client.Tabletop public override void Update(float frameTime) { // If there is no player entity, return - if (_playerManager.LocalPlayer is not { ControlledEntity: { Uid: var playerEntity } }) return; + if (_playerManager.LocalPlayer is not { ControlledEntity: { (EntityUid) this: var playerEntity } }) return; if (StunnedOrNoHands(playerEntity)) { @@ -166,7 +166,7 @@ namespace Content.Client.Tabletop private bool OnMouseDown(in PointerInputCmdHandler.PointerInputCmdArgs args) { // Return if no player entity - if (_playerManager.LocalPlayer is not { ControlledEntity: { Uid : var playerEntityUid } }) return false; + if (_playerManager.LocalPlayer is not { ControlledEntity: { (EntityUid) this : var playerEntityUid } }) return false; // Return if can not see table or stunned/no hands if (!CanSeeTable(playerEntityUid, _table) || StunnedOrNoHands(playerEntityUid)) diff --git a/Content.Client/Trigger/TimerTriggerVisualizer.cs b/Content.Client/Trigger/TimerTriggerVisualizer.cs index f9dc0ced68..9b6df47a67 100644 --- a/Content.Client/Trigger/TimerTriggerVisualizer.cs +++ b/Content.Client/Trigger/TimerTriggerVisualizer.cs @@ -38,7 +38,7 @@ namespace Content.Client.Trigger public override void InitializeEntity(IEntity entity) { - if (!IoCManager.Resolve().HasComponent(entity.Uid)) + if (!IoCManager.Resolve().HasComponent(entity)) { IoCManager.Resolve().AddComponent(entity); } @@ -46,8 +46,8 @@ namespace Content.Client.Trigger public override void OnChangeData(AppearanceComponent component) { - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); - var animPlayer = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); + var animPlayer = IoCManager.Resolve().GetComponent(component.Owner); if (!component.TryGetData(TriggerVisuals.VisualState, out TriggerVisualState state)) { state = TriggerVisualState.Unprimed; diff --git a/Content.Client/VendingMachines/UI/VendingMachineVisualizer.cs b/Content.Client/VendingMachines/UI/VendingMachineVisualizer.cs index b8e88aa4f7..d4d3ecadf4 100644 --- a/Content.Client/VendingMachines/UI/VendingMachineVisualizer.cs +++ b/Content.Client/VendingMachines/UI/VendingMachineVisualizer.cs @@ -121,7 +121,7 @@ namespace Content.Client.VendingMachines.UI { base.InitializeEntity(entity); - if (!IoCManager.Resolve().HasComponent(entity.Uid)) + if (!IoCManager.Resolve().HasComponent(entity)) { IoCManager.Resolve().AddComponent(entity); } @@ -141,8 +141,8 @@ namespace Content.Client.VendingMachines.UI { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); - var animPlayer = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); + var animPlayer = IoCManager.Resolve().GetComponent(component.Owner); if (!component.TryGetData(VendingMachineVisuals.VisualState, out VendingMachineVisualState state)) { state = VendingMachineVisualState.Normal; diff --git a/Content.Client/VendingMachines/VendingMachineBoundUserInterface.cs b/Content.Client/VendingMachines/VendingMachineBoundUserInterface.cs index 292dd1dcd9..57e8b14340 100644 --- a/Content.Client/VendingMachines/VendingMachineBoundUserInterface.cs +++ b/Content.Client/VendingMachines/VendingMachineBoundUserInterface.cs @@ -23,14 +23,14 @@ namespace Content.Client.VendingMachines { base.Open(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Owner.Uid, out SharedVendingMachineComponent? vendingMachine)) + if (!IoCManager.Resolve().TryGetComponent(Owner.Owner, out SharedVendingMachineComponent? vendingMachine)) { return; } VendingMachine = vendingMachine; - _menu = new VendingMachineMenu(this) {Title = IoCManager.Resolve().GetComponent(Owner.Owner.Uid).EntityName}; + _menu = new VendingMachineMenu(this) {Title = IoCManager.Resolve().GetComponent(Owner.Owner).EntityName}; _menu.Populate(VendingMachine.Inventory); _menu.OnClose += Close; diff --git a/Content.Client/Verbs/UI/VerbMenuPresenter.cs b/Content.Client/Verbs/UI/VerbMenuPresenter.cs index 20d4ad9965..8a010ad110 100644 --- a/Content.Client/Verbs/UI/VerbMenuPresenter.cs +++ b/Content.Client/Verbs/UI/VerbMenuPresenter.cs @@ -49,10 +49,10 @@ namespace Content.Client.Verbs.UI Close(); - CurrentTarget = target.Uid; + CurrentTarget = target; CurrentVerbs = _verbSystem.GetVerbs(target, user, VerbType.All); - - if (!target.Uid.IsClientSide()) + + if (!target.IsClientSide()) { AddElement(RootMenu, new ContextMenuElement(Loc.GetString("verb-system-waiting-on-server-text"))); } diff --git a/Content.Client/Verbs/VerbSystem.cs b/Content.Client/Verbs/VerbSystem.cs index 5ac29f0299..deccbb7f54 100644 --- a/Content.Client/Verbs/VerbSystem.cs +++ b/Content.Client/Verbs/VerbSystem.cs @@ -140,7 +140,7 @@ namespace Content.Client.Verbs { foreach (var entity in entities.ToList()) { - if (!EntityManager.TryGetComponent(entity.Uid, out ISpriteComponent? spriteComponent) || + if (!EntityManager.TryGetComponent(entity, out ISpriteComponent? spriteComponent) || !spriteComponent.Visible) { entities.Remove(entity); @@ -155,12 +155,12 @@ namespace Content.Client.Verbs // Remove any entities that do not have LOS if ((visibility & MenuVisibility.NoFov) == 0) { - var playerPos = IoCManager.Resolve().GetComponent(player.Uid).MapPosition; + var playerPos = IoCManager.Resolve().GetComponent(player).MapPosition; foreach (var entity in entities.ToList()) { if (!ExamineSystemShared.InRangeUnOccluded( playerPos, - IoCManager.Resolve().GetComponent(entity.Uid).MapPosition, + IoCManager.Resolve().GetComponent(entity).MapPosition, ExamineSystemShared.ExamineRange, null)) { @@ -182,9 +182,9 @@ namespace Content.Client.Verbs /// public Dictionary> GetVerbs(IEntity target, IEntity user, VerbType verbTypes) { - if (!target.Uid.IsClientSide()) + if (!target.IsClientSide()) { - RaiseNetworkEvent(new RequestServerVerbsEvent(target.Uid, verbTypes)); + RaiseNetworkEvent(new RequestServerVerbsEvent(target, verbTypes)); } return GetLocalVerbs(target, user, verbTypes); diff --git a/Content.Client/Viewport/GameScreenBase.cs b/Content.Client/Viewport/GameScreenBase.cs index 8c2d2af6db..3f09603ae6 100644 --- a/Content.Client/Viewport/GameScreenBase.cs +++ b/Content.Client/Viewport/GameScreenBase.cs @@ -115,7 +115,7 @@ namespace Content.Client.Viewport InteractionOutlineComponent? outline; if(!_outlineEnabled || !ConfigurationManager.GetCVar(CCVars.OutlineEnabled)) { - if(entityToClick != null && IoCManager.Resolve().TryGetComponent(entityToClick.Uid, out outline)) + if(entityToClick != null && IoCManager.Resolve().TryGetComponent(entityToClick, out outline)) { outline.OnMouseLeave(); //Prevent outline remains from persisting post command. } @@ -124,7 +124,7 @@ namespace Content.Client.Viewport if (entityToClick == _lastHoveredEntity) { - if (entityToClick != null && IoCManager.Resolve().TryGetComponent(entityToClick.Uid, out outline)) + if (entityToClick != null && IoCManager.Resolve().TryGetComponent(entityToClick, out outline)) { outline.UpdateInRange(inRange, renderScale); } @@ -132,15 +132,15 @@ namespace Content.Client.Viewport return; } - if (_lastHoveredEntity != null && !((!IoCManager.Resolve().EntityExists(_lastHoveredEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_lastHoveredEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) && - IoCManager.Resolve().TryGetComponent(_lastHoveredEntity.Uid, out outline)) + if (_lastHoveredEntity != null && !((!IoCManager.Resolve().EntityExists(_lastHoveredEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_lastHoveredEntity).EntityLifeStage) >= EntityLifeStage.Deleted) && + IoCManager.Resolve().TryGetComponent(_lastHoveredEntity, out outline)) { outline.OnMouseLeave(); } _lastHoveredEntity = entityToClick; - if (_lastHoveredEntity != null && IoCManager.Resolve().TryGetComponent(_lastHoveredEntity.Uid, out outline)) + if (_lastHoveredEntity != null && IoCManager.Resolve().TryGetComponent(_lastHoveredEntity, out outline)) { outline.OnMouseEnter(inRange, renderScale); } @@ -167,7 +167,7 @@ namespace Content.Client.Viewport var foundEntities = new List<(IEntity clicked, int drawDepth, uint renderOrder)>(); foreach (var entity in entities) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out var component) + if (IoCManager.Resolve().TryGetComponent(entity, out var component) && !entity.IsInContainer() && component.CheckClick(coordinates.Position, out var drawDepthClicked, out var renderOrder)) { @@ -223,15 +223,15 @@ namespace Content.Client.Viewport } */ - var transX = IoCManager.Resolve().GetComponent(x.clicked.Uid); - var transY = IoCManager.Resolve().GetComponent(y.clicked.Uid); + var transX = IoCManager.Resolve().GetComponent(x.clicked); + var transY = IoCManager.Resolve().GetComponent(y.clicked); val = transX.Coordinates.Y.CompareTo(transY.Coordinates.Y); if (val != 0) { return val; } - return x.clicked.Uid.CompareTo(y.clicked.Uid); + return x.clicked.CompareTo(y.clicked); } } @@ -254,7 +254,7 @@ namespace Content.Client.Viewport if (args.Viewport is IViewportControl vp) { var mousePosWorld = vp.ScreenToMap(kArgs.PointerLocation.Position); - entityToClick = GetEntityUnderPosition(mousePosWorld)?.Uid ?? EntityUid.Invalid; + entityToClick = GetEntityUnderPosition(mousePosWorld) ?? EntityUid.Invalid; coordinates = MapManager.TryFindGridAt(mousePosWorld, out var grid) ? grid.MapToGrid(mousePosWorld) : EntityCoordinates.FromMap(MapManager, mousePosWorld); diff --git a/Content.Client/Wall/Components/LowWallComponent.cs b/Content.Client/Wall/Components/LowWallComponent.cs index cca0478b8f..356671f9af 100644 --- a/Content.Client/Wall/Components/LowWallComponent.cs +++ b/Content.Client/Wall/Components/LowWallComponent.cs @@ -42,11 +42,11 @@ namespace Content.Client.Wall.Components { base.Startup(); - _overlayEntity = IoCManager.Resolve().SpawnEntity("LowWallOverlay", IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); - IoCManager.Resolve().GetComponent(_overlayEntity.Uid).AttachParent(Owner); - IoCManager.Resolve().GetComponent(_overlayEntity.Uid).LocalPosition = Vector2.Zero; + _overlayEntity = IoCManager.Resolve().SpawnEntity("LowWallOverlay", IoCManager.Resolve().GetComponent(Owner).Coordinates); + IoCManager.Resolve().GetComponent(_overlayEntity).AttachParent(Owner); + IoCManager.Resolve().GetComponent(_overlayEntity).LocalPosition = Vector2.Zero; - _overlaySprite = IoCManager.Resolve().GetComponent(_overlayEntity.Uid); + _overlaySprite = IoCManager.Resolve().GetComponent(_overlayEntity); var overState0 = $"{StateBase}over_0"; _overlaySprite.LayerMapSet(OverCornerLayers.SE, _overlaySprite.AddLayerState(overState0)); @@ -66,7 +66,7 @@ namespace Content.Client.Wall.Components IEntity? tempQualifier = _overlayEntity; if (tempQualifier != null) { - IoCManager.Resolve().DeleteEntity(tempQualifier.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) tempQualifier); } } @@ -74,13 +74,13 @@ namespace Content.Client.Wall.Components { base.CalculateNewSprite(); - if (Sprite == null || !IoCManager.Resolve().GetComponent(Owner.Uid).Anchored || _overlaySprite == null) + if (Sprite == null || !IoCManager.Resolve().GetComponent(Owner).Anchored || _overlaySprite == null) { return; } - var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); - var coords = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner).GridID); + var coords = IoCManager.Resolve().GetComponent(Owner).Coordinates; var (n, nl) = MatchingWall(grid.GetInDir(coords, Direction.North)); var (ne, nel) = MatchingWall(grid.GetInDir(coords, Direction.NorthEast)); diff --git a/Content.Client/Weapons/Melee/Components/MeleeLungeComponent.cs b/Content.Client/Weapons/Melee/Components/MeleeLungeComponent.cs index 0b26421fb0..70b905a12c 100644 --- a/Content.Client/Weapons/Melee/Components/MeleeLungeComponent.cs +++ b/Content.Client/Weapons/Melee/Components/MeleeLungeComponent.cs @@ -39,14 +39,14 @@ namespace Content.Client.Weapons.Melee.Components offset *= (ResetTime - _time) / ResetTime; } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ISpriteComponent? spriteComponent)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ISpriteComponent? spriteComponent)) { spriteComponent.Offset = offset; } if (deleteSelf) { - IoCManager.Resolve().RemoveComponent(Owner.Uid); + IoCManager.Resolve().RemoveComponent(Owner); } } } diff --git a/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs b/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs index d72ce62f58..81ccdc9850 100644 --- a/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs +++ b/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs @@ -22,7 +22,7 @@ namespace Content.Client.Weapons.Melee.Components { base.Initialize(); - _sprite = IoCManager.Resolve().GetComponent(Owner.Uid); + _sprite = IoCManager.Resolve().GetComponent(Owner); } public void SetData(MeleeWeaponAnimationPrototype prototype, Angle baseAngle, IEntity attacker, bool followAttacker = true) @@ -31,7 +31,7 @@ namespace Content.Client.Weapons.Melee.Components _sprite?.AddLayer(new RSI.StateId(prototype.State)); _baseAngle = baseAngle; if(followAttacker) - IoCManager.Resolve().GetComponent(Owner.Uid).AttachParent(attacker); + IoCManager.Resolve().GetComponent(Owner).AttachParent(attacker); } internal void Update(float frameTime) @@ -55,12 +55,12 @@ namespace Content.Client.Weapons.Melee.Components { case WeaponArcType.Slash: var angle = Angle.FromDegrees(_meleeWeaponAnimation.Width)/2; - IoCManager.Resolve().GetComponent(Owner.Uid).WorldRotation = + IoCManager.Resolve().GetComponent(Owner).WorldRotation = _baseAngle + Angle.Lerp(-angle, angle, (float) (_timer / _meleeWeaponAnimation.Length.TotalSeconds)); break; case WeaponArcType.Poke: - IoCManager.Resolve().GetComponent(Owner.Uid).WorldRotation = _baseAngle; + IoCManager.Resolve().GetComponent(Owner).WorldRotation = _baseAngle; if (_sprite != null) { @@ -72,7 +72,7 @@ namespace Content.Client.Weapons.Melee.Components if (_meleeWeaponAnimation.Length.TotalSeconds <= _timer) { - IoCManager.Resolve().DeleteEntity(Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) Owner); } } } diff --git a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs index 3e4c33a1c5..809ee4503b 100644 --- a/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs +++ b/Content.Client/Weapons/Melee/MeleeWeaponSystem.cs @@ -51,21 +51,21 @@ namespace Content.Client.Weapons.Melee return; } - if (!((!IoCManager.Resolve().EntityExists(attacker.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(attacker.Uid).EntityLifeStage) >= EntityLifeStage.Deleted)) + if (!((!IoCManager.Resolve().EntityExists(attacker) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(attacker).EntityLifeStage) >= EntityLifeStage.Deleted)) { var lunge = attacker.EnsureComponent(); lunge.SetData(msg.Angle); - var entity = EntityManager.SpawnEntity(weaponArc.Prototype, IoCManager.Resolve().GetComponent(attacker.Uid).Coordinates); - IoCManager.Resolve().GetComponent(entity.Uid).LocalRotation = msg.Angle; + var entity = EntityManager.SpawnEntity(weaponArc.Prototype, IoCManager.Resolve().GetComponent(attacker).Coordinates); + IoCManager.Resolve().GetComponent(entity).LocalRotation = msg.Angle; - var weaponArcAnimation = IoCManager.Resolve().GetComponent(entity.Uid); + var weaponArcAnimation = IoCManager.Resolve().GetComponent(entity); weaponArcAnimation.SetData(weaponArc, msg.Angle, attacker, msg.ArcFollowAttacker); // Due to ISpriteComponent limitations, weapons that don't use an RSI won't have this effect. if (EntityManager.TryGetEntity(msg.Source, out var source) && msg.TextureEffect && - IoCManager.Resolve().TryGetComponent(source.Uid, out ISpriteComponent? sourceSprite) && + IoCManager.Resolve().TryGetComponent(source, out ISpriteComponent? sourceSprite) && sourceSprite.BaseRSI?.Path != null) { var curTime = _gameTiming.CurTime; @@ -73,7 +73,7 @@ namespace Content.Client.Weapons.Melee { EffectSprite = sourceSprite.BaseRSI.Path.ToString(), RsiState = sourceSprite.LayerGetState(0).Name, - Coordinates = IoCManager.Resolve().GetComponent(attacker.Uid).Coordinates, + Coordinates = IoCManager.Resolve().GetComponent(attacker).Coordinates, Color = Vector4.Multiply(new Vector4(255, 255, 255, 125), 1.0f), ColorDelta = Vector4.Multiply(new Vector4(0, 0, 0, -10), 1.0f), Velocity = msg.Angle.ToWorldVec(), @@ -88,12 +88,12 @@ namespace Content.Client.Weapons.Melee foreach (var uid in msg.Hits) { - if (!EntityManager.TryGetEntity(uid, out var hitEntity) || (!IoCManager.Resolve().EntityExists(hitEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(hitEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if (!EntityManager.TryGetEntity(uid, out var hitEntity) || (!IoCManager.Resolve().EntityExists(hitEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(hitEntity).EntityLifeStage) >= EntityLifeStage.Deleted) { continue; } - if (!IoCManager.Resolve().TryGetComponent(hitEntity.Uid, out ISpriteComponent? sprite)) + if (!IoCManager.Resolve().TryGetComponent(hitEntity, out ISpriteComponent? sprite)) { continue; } diff --git a/Content.Client/Weapons/Ranged/Barrels/Visualizers/BarrelBoltVisualizer.cs b/Content.Client/Weapons/Ranged/Barrels/Visualizers/BarrelBoltVisualizer.cs index 6d435e95db..da9364c079 100644 --- a/Content.Client/Weapons/Ranged/Barrels/Visualizers/BarrelBoltVisualizer.cs +++ b/Content.Client/Weapons/Ranged/Barrels/Visualizers/BarrelBoltVisualizer.cs @@ -12,14 +12,14 @@ namespace Content.Client.Weapons.Ranged.Barrels.Visualizers public override void InitializeEntity(IEntity entity) { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); sprite.LayerSetState(RangedBarrelVisualLayers.Bolt, "bolt-open"); } public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (!component.TryGetData(BarrelBoltVisuals.BoltOpen, out bool boltOpen)) { diff --git a/Content.Client/Weapons/Ranged/Barrels/Visualizers/MagVisualizer.cs b/Content.Client/Weapons/Ranged/Barrels/Visualizers/MagVisualizer.cs index 424da8b7df..b80752fdc5 100644 --- a/Content.Client/Weapons/Ranged/Barrels/Visualizers/MagVisualizer.cs +++ b/Content.Client/Weapons/Ranged/Barrels/Visualizers/MagVisualizer.cs @@ -22,7 +22,7 @@ namespace Content.Client.Weapons.Ranged.Barrels.Visualizers public override void InitializeEntity(IEntity entity) { base.InitializeEntity(entity); - var sprite = IoCManager.Resolve().GetComponent(entity.Uid); + var sprite = IoCManager.Resolve().GetComponent(entity); if (sprite.LayerMapTryGet(RangedBarrelVisualLayers.Mag, out _)) { @@ -45,7 +45,7 @@ namespace Content.Client.Weapons.Ranged.Barrels.Visualizers // 1.If no mag then hide it OR // 2. If step 0 isn't visible then hide it (mag or unshaded) // 3. Otherwise just do mag / unshaded as is - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); component.TryGetData(MagazineBarrelVisuals.MagLoaded, out _magLoaded); diff --git a/Content.Client/Weapons/Ranged/Barrels/Visualizers/SpentAmmoVisualizer.cs b/Content.Client/Weapons/Ranged/Barrels/Visualizers/SpentAmmoVisualizer.cs index f6f99c2a79..10602a6644 100644 --- a/Content.Client/Weapons/Ranged/Barrels/Visualizers/SpentAmmoVisualizer.cs +++ b/Content.Client/Weapons/Ranged/Barrels/Visualizers/SpentAmmoVisualizer.cs @@ -12,7 +12,7 @@ namespace Content.Client.Weapons.Ranged.Barrels.Visualizers public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (!component.TryGetData(AmmoVisuals.Spent, out bool spent)) { diff --git a/Content.Client/Weapons/Ranged/RangedWeaponSystem.cs b/Content.Client/Weapons/Ranged/RangedWeaponSystem.cs index 43d363bb21..9908236fc9 100644 --- a/Content.Client/Weapons/Ranged/RangedWeaponSystem.cs +++ b/Content.Client/Weapons/Ranged/RangedWeaponSystem.cs @@ -48,12 +48,12 @@ namespace Content.Client.Weapons.Ranged } var entity = _playerManager.LocalPlayer?.ControlledEntity; - if (entity == null || !IoCManager.Resolve().TryGetComponent(entity.Uid, out SharedHandsComponent? hands)) + if (entity == null || !IoCManager.Resolve().TryGetComponent(entity, out SharedHandsComponent? hands)) { return; } - if (!hands.TryGetActiveHeldEntity(out var held) || !IoCManager.Resolve().TryGetComponent(held.Uid, out ClientRangedWeaponComponent? weapon)) + if (!hands.TryGetActiveHeldEntity(out var held) || !IoCManager.Resolve().TryGetComponent(held, out ClientRangedWeaponComponent? weapon)) { _blocked = true; return; diff --git a/Content.Client/Wires/Visualizers/WiresVisualizer.cs b/Content.Client/Wires/Visualizers/WiresVisualizer.cs index e0ade4bf4a..52504a905f 100644 --- a/Content.Client/Wires/Visualizers/WiresVisualizer.cs +++ b/Content.Client/Wires/Visualizers/WiresVisualizer.cs @@ -10,7 +10,7 @@ namespace Content.Client.Wires.Visualizers public override void OnChangeData(AppearanceComponent component) { base.OnChangeData(component); - var sprite = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var sprite = IoCManager.Resolve().GetComponent(component.Owner); if (component.TryGetData(WiresVisuals.MaintenancePanelState, out var state)) { sprite.LayerSetVisible(WiresVisualLayers.MaintenancePanel, state); diff --git a/Content.IntegrationTests/Tests/Body/LegTest.cs b/Content.IntegrationTests/Tests/Body/LegTest.cs index e68e608e46..835d67256d 100644 --- a/Content.IntegrationTests/Tests/Body/LegTest.cs +++ b/Content.IntegrationTests/Tests/Body/LegTest.cs @@ -48,8 +48,8 @@ namespace Content.IntegrationTests.Tests.Body var entityManager = IoCManager.Resolve(); var human = entityManager.SpawnEntity("HumanBodyAndAppearanceDummy", new MapCoordinates(Vector2.Zero, mapId)); - Assert.That(IoCManager.Resolve().TryGetComponent(human.Uid, out SharedBodyComponent body)); - Assert.That(IoCManager.Resolve().TryGetComponent(human.Uid, out appearance)); + Assert.That(IoCManager.Resolve().TryGetComponent(human, out SharedBodyComponent body)); + Assert.That(IoCManager.Resolve().TryGetComponent(human, out appearance)); Assert.That(!appearance.TryGetData(RotationVisuals.RotationState, out RotationState _)); diff --git a/Content.IntegrationTests/Tests/Body/LungTest.cs b/Content.IntegrationTests/Tests/Body/LungTest.cs index b9e87e7bfc..597d76127c 100644 --- a/Content.IntegrationTests/Tests/Body/LungTest.cs +++ b/Content.IntegrationTests/Tests/Body/LungTest.cs @@ -66,11 +66,11 @@ namespace Content.IntegrationTests.Tests.Body var bodySys = EntitySystem.Get(); var lungSys = EntitySystem.Get(); - Assert.That(IoCManager.Resolve().TryGetComponent(human.Uid, out SharedBodyComponent body)); + Assert.That(IoCManager.Resolve().TryGetComponent(human, out SharedBodyComponent body)); - var lungs = bodySys.GetComponentsOnMechanisms(human.Uid, body).ToArray(); + var lungs = bodySys.GetComponentsOnMechanisms(human, body).ToArray(); Assert.That(lungs.Count, Is.EqualTo(1)); - Assert.That(IoCManager.Resolve().TryGetComponent(human.Uid, out BloodstreamComponent bloodstream)); + Assert.That(IoCManager.Resolve().TryGetComponent(human, out BloodstreamComponent bloodstream)); var gas = new GasMixture(1); @@ -171,8 +171,8 @@ namespace Content.IntegrationTests.Tests.Body var coordinates = new EntityCoordinates(grid.GridEntityId, center); human = entityManager.SpawnEntity("HumanBodyAndBloodstreamDummy", coordinates); - Assert.True(IoCManager.Resolve().HasComponent(human.Uid)); - Assert.True(IoCManager.Resolve().TryGetComponent(human.Uid, out respirator)); + Assert.True(IoCManager.Resolve().HasComponent(human)); + Assert.True(IoCManager.Resolve().TryGetComponent(human, out respirator)); Assert.False(respirator.Suffocating); }); @@ -184,7 +184,7 @@ namespace Content.IntegrationTests.Tests.Body await server.WaitRunTicks(increment); await server.WaitAssertion(() => { - Assert.False(respirator.Suffocating, $"Entity {IoCManager.Resolve().GetComponent(human.Uid).EntityName} is suffocating on tick {tick}"); + Assert.False(respirator.Suffocating, $"Entity {IoCManager.Resolve().GetComponent(human).EntityName} is suffocating on tick {tick}"); }); } diff --git a/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs b/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs index 4aaf4e097f..a01f151e0b 100644 --- a/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs +++ b/Content.IntegrationTests/Tests/Buckle/BuckleTest.cs @@ -78,17 +78,17 @@ namespace Content.IntegrationTests.Tests.Buckle chair = entityManager.SpawnEntity(StrapDummyId, coordinates); // Default state, unbuckled - Assert.True(IoCManager.Resolve().TryGetComponent(human.Uid, out buckle)); + Assert.True(IoCManager.Resolve().TryGetComponent(human, out buckle)); Assert.NotNull(buckle); Assert.Null(buckle.BuckledTo); Assert.False(buckle.Buckled); - Assert.True(actionBlocker.CanMove(human.Uid)); - Assert.True(actionBlocker.CanChangeDirection(human.Uid)); - Assert.True(standingState.Down(human.Uid)); - Assert.True(standingState.Stand(human.Uid)); + Assert.True(actionBlocker.CanMove(human)); + Assert.True(actionBlocker.CanChangeDirection(human)); + Assert.True(standingState.Down((EntityUid) human)); + Assert.True(standingState.Stand((EntityUid) human)); // Default state, no buckled entities, strap - Assert.True(IoCManager.Resolve().TryGetComponent(chair.Uid, out strap)); + Assert.True(IoCManager.Resolve().TryGetComponent(chair, out strap)); Assert.NotNull(strap); Assert.IsEmpty(strap.BuckledEntities); Assert.Zero(strap.OccupiedSize); @@ -100,10 +100,10 @@ namespace Content.IntegrationTests.Tests.Buckle var player = IoCManager.Resolve().Sessions.Single(); Assert.True(((BuckleComponentState) buckle.GetComponentState()).Buckled); - Assert.False(actionBlocker.CanMove(human.Uid)); - Assert.False(actionBlocker.CanChangeDirection(human.Uid)); - Assert.False(standingState.Down(human.Uid)); - Assert.That((IoCManager.Resolve().GetComponent(human.Uid).WorldPosition - IoCManager.Resolve().GetComponent(chair.Uid).WorldPosition).Length, Is.LessThanOrEqualTo(buckle.BuckleOffset.Length)); + Assert.False(actionBlocker.CanMove(human)); + Assert.False(actionBlocker.CanChangeDirection(human)); + Assert.False(standingState.Down((EntityUid) human)); + Assert.That((IoCManager.Resolve().GetComponent(human).WorldPosition - IoCManager.Resolve().GetComponent(chair).WorldPosition).Length, Is.LessThanOrEqualTo(buckle.BuckleOffset.Length)); // Side effects of buckling for the strap Assert.That(strap.BuckledEntities, Does.Contain(human)); @@ -134,9 +134,9 @@ namespace Content.IntegrationTests.Tests.Buckle Assert.True(buckle.TryUnbuckle(human)); Assert.Null(buckle.BuckledTo); Assert.False(buckle.Buckled); - Assert.True(actionBlocker.CanMove(human.Uid)); - Assert.True(actionBlocker.CanChangeDirection(human.Uid)); - Assert.True(standingState.Down(human.Uid)); + Assert.True(actionBlocker.CanMove(human)); + Assert.True(actionBlocker.CanChangeDirection(human)); + Assert.True(standingState.Down((EntityUid) human)); // Unbuckle, strap Assert.IsEmpty(strap.BuckledEntities); @@ -171,7 +171,7 @@ namespace Content.IntegrationTests.Tests.Buckle Assert.False(buckle.Buckled); // Move away from the chair - IoCManager.Resolve().GetComponent(human.Uid).WorldPosition += (1000, 1000); + IoCManager.Resolve().GetComponent(human).WorldPosition += (1000, 1000); // Out of range Assert.False(buckle.TryBuckle(human, chair)); @@ -179,7 +179,7 @@ namespace Content.IntegrationTests.Tests.Buckle Assert.False(buckle.ToggleBuckle(human, chair)); // Move near the chair - IoCManager.Resolve().GetComponent(human.Uid).WorldPosition = IoCManager.Resolve().GetComponent(chair.Uid).WorldPosition + (0.5f, 0); + IoCManager.Resolve().GetComponent(human).WorldPosition = IoCManager.Resolve().GetComponent(chair).WorldPosition + (0.5f, 0); // In range Assert.True(buckle.TryBuckle(human, chair)); @@ -192,15 +192,15 @@ namespace Content.IntegrationTests.Tests.Buckle // Force unbuckle Assert.True(buckle.TryUnbuckle(human, true)); Assert.False(buckle.Buckled); - Assert.True(actionBlocker.CanMove(human.Uid)); - Assert.True(actionBlocker.CanChangeDirection(human.Uid)); - Assert.True(standingState.Down(human.Uid)); + Assert.True(actionBlocker.CanMove(human)); + Assert.True(actionBlocker.CanChangeDirection(human)); + Assert.True(standingState.Down((EntityUid) human)); // Re-buckle Assert.True(buckle.TryBuckle(human, chair)); // Move away from the chair - IoCManager.Resolve().GetComponent(human.Uid).WorldPosition += (1, 0); + IoCManager.Resolve().GetComponent(human).WorldPosition += (1, 0); }); await server.WaitRunTicks(1); @@ -239,10 +239,10 @@ namespace Content.IntegrationTests.Tests.Buckle IEntity chair = entityManager.SpawnEntity(StrapDummyId, coordinates); // Component sanity check - Assert.True(IoCManager.Resolve().TryGetComponent(human.Uid, out buckle)); - Assert.True(IoCManager.Resolve().HasComponent(chair.Uid)); - Assert.True(IoCManager.Resolve().TryGetComponent(human.Uid, out hands)); - Assert.True(IoCManager.Resolve().TryGetComponent(human.Uid, out body)); + Assert.True(IoCManager.Resolve().TryGetComponent(human, out buckle)); + Assert.True(IoCManager.Resolve().HasComponent(chair)); + Assert.True(IoCManager.Resolve().TryGetComponent(human, out hands)); + Assert.True(IoCManager.Resolve().TryGetComponent(human, out body)); // Buckle Assert.True(buckle.TryBuckle(human, chair)); @@ -255,7 +255,7 @@ namespace Content.IntegrationTests.Tests.Buckle var akms = entityManager.SpawnEntity(ItemDummyId, coordinates); // Equip items - Assert.True(IoCManager.Resolve().TryGetComponent(akms.Uid, out ItemComponent item)); + Assert.True(IoCManager.Resolve().TryGetComponent(akms, out ItemComponent item)); Assert.True(hands.PutInHand(item)); } }); @@ -324,8 +324,8 @@ namespace Content.IntegrationTests.Tests.Buckle chair = entityManager.SpawnEntity(StrapDummyId, coordinates); // Component sanity check - Assert.True(IoCManager.Resolve().TryGetComponent(human.Uid, out buckle)); - Assert.True(IoCManager.Resolve().HasComponent(chair.Uid)); + Assert.True(IoCManager.Resolve().TryGetComponent(human, out buckle)); + Assert.True(IoCManager.Resolve().HasComponent(chair)); // Buckle Assert.True(buckle.TryBuckle(human, chair)); @@ -333,7 +333,7 @@ namespace Content.IntegrationTests.Tests.Buckle Assert.True(buckle.Buckled); // Move the buckled entity away - IoCManager.Resolve().GetComponent(human.Uid).WorldPosition += (100, 0); + IoCManager.Resolve().GetComponent(human).WorldPosition += (100, 0); }); await WaitUntil(server, () => !buckle.Buckled, 10); @@ -343,7 +343,7 @@ namespace Content.IntegrationTests.Tests.Buckle await server.WaitAssertion(() => { // Move the now unbuckled entity back onto the chair - IoCManager.Resolve().GetComponent(human.Uid).WorldPosition -= (100, 0); + IoCManager.Resolve().GetComponent(human).WorldPosition -= (100, 0); // Buckle Assert.True(buckle.TryBuckle(human, chair)); diff --git a/Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs b/Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs index e53b9f8fc0..a11774c8fb 100644 --- a/Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs +++ b/Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs @@ -50,11 +50,11 @@ namespace Content.IntegrationTests.Tests.Chemistry { beaker = entityManager.SpawnEntity("TestSolutionContainer", coordinates); Assert.That(EntitySystem.Get() - .TryGetSolution(beaker.Uid, "beaker", out component)); + .TryGetSolution(beaker, "beaker", out component)); foreach (var (id, reactant) in reactionPrototype.Reactants) { Assert.That(EntitySystem.Get() - .TryAddReagent(beaker.Uid, component, id, reactant.Amount, out var quantity)); + .TryAddReagent(beaker, component, id, reactant.Amount, out var quantity)); Assert.That(reactant.Amount, Is.EqualTo(quantity)); } }); diff --git a/Content.IntegrationTests/Tests/ClickableTest.cs b/Content.IntegrationTests/Tests/ClickableTest.cs index 8ad4efa657..ecd9c3128e 100644 --- a/Content.IntegrationTests/Tests/ClickableTest.cs +++ b/Content.IntegrationTests/Tests/ClickableTest.cs @@ -78,12 +78,12 @@ namespace Content.IntegrationTests.Tests { var gridEnt = mapManager.GetAllGrids().First().GridEntityId; IEntity tempQualifier = serverEntManager.GetEntity(gridEnt); - worldPos = IoCManager.Resolve().GetComponent(tempQualifier.Uid).WorldPosition; + worldPos = IoCManager.Resolve().GetComponent(tempQualifier).WorldPosition; var ent = serverEntManager.SpawnEntity(prototype, new EntityCoordinates(gridEnt, 0f, 0f)); - IoCManager.Resolve().GetComponent(ent.Uid).LocalRotation = angle; - IoCManager.Resolve().GetComponent(ent.Uid).Scale = (scale, scale); - entity = ent.Uid; + IoCManager.Resolve().GetComponent(ent).LocalRotation = angle; + IoCManager.Resolve().GetComponent(ent).Scale = (scale, scale); + entity = ent; }); // Let client sync up. @@ -94,7 +94,7 @@ namespace Content.IntegrationTests.Tests await _client.WaitPost(() => { var ent = clientEntManager.GetEntity(entity); - var clickable = IoCManager.Resolve().GetComponent(ent.Uid); + var clickable = IoCManager.Resolve().GetComponent(ent); hit = clickable.CheckClick((clickPosX, clickPosY) + worldPos!.Value, out _, out _); }); diff --git a/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs b/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs index 7515a906c8..cb35a38272 100644 --- a/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs +++ b/Content.IntegrationTests/Tests/Commands/RejuvenateTest.cs @@ -48,8 +48,8 @@ namespace Content.IntegrationTests.Tests.Commands var human = entityManager.SpawnEntity("DamageableDummy", MapCoordinates.Nullspace); // Sanity check - Assert.True(IoCManager.Resolve().TryGetComponent(human.Uid, out DamageableComponent damageable)); - Assert.True(IoCManager.Resolve().TryGetComponent(human.Uid, out MobStateComponent mobState)); + Assert.True(IoCManager.Resolve().TryGetComponent(human, out DamageableComponent damageable)); + Assert.True(IoCManager.Resolve().TryGetComponent(human, out MobStateComponent mobState)); mobState.UpdateState(0); Assert.That(mobState.IsAlive, Is.True); Assert.That(mobState.IsCritical, Is.False); @@ -59,7 +59,7 @@ namespace Content.IntegrationTests.Tests.Commands // Kill the entity DamageSpecifier damage = new(prototypeManager.Index("Toxin"), FixedPoint2.New(10000000)); - EntitySystem.Get().TryChangeDamage(human.Uid, damage, true); + EntitySystem.Get().TryChangeDamage(human, damage, true); // Check that it is dead Assert.That(mobState.IsAlive, Is.False); diff --git a/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs b/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs index 940b312ff3..3b10bc266c 100644 --- a/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs +++ b/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs @@ -81,9 +81,9 @@ namespace Content.IntegrationTests.Tests var ent = IoCManager.Resolve(); var container = ent.SpawnEntity("ContainerOcclusionA", pos); var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos); - dummyUid = dummy.Uid; + dummyUid = dummy; - IoCManager.Resolve().GetComponent(container.Uid).Insert(dummy); + IoCManager.Resolve().GetComponent(container).Insert(dummy); }); await RunTicksSync(c, s, 5); @@ -91,8 +91,8 @@ namespace Content.IntegrationTests.Tests c.Assert(() => { var dummy = IoCManager.Resolve().GetEntity(dummyUid); - var sprite = IoCManager.Resolve().GetComponent(dummy.Uid); - var light = IoCManager.Resolve().GetComponent(dummy.Uid); + var sprite = IoCManager.Resolve().GetComponent(dummy); + var light = IoCManager.Resolve().GetComponent(dummy); Assert.True(sprite.ContainerOccluded); Assert.True(light.ContainerOccluded); }); @@ -112,9 +112,9 @@ namespace Content.IntegrationTests.Tests var ent = IoCManager.Resolve(); var container = ent.SpawnEntity("ContainerOcclusionB", pos); var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos); - dummyUid = dummy.Uid; + dummyUid = dummy; - IoCManager.Resolve().GetComponent(container.Uid).Insert(dummy); + IoCManager.Resolve().GetComponent(container).Insert(dummy); }); await RunTicksSync(c, s, 5); @@ -122,8 +122,8 @@ namespace Content.IntegrationTests.Tests c.Assert(() => { var dummy = IoCManager.Resolve().GetEntity(dummyUid); - var sprite = IoCManager.Resolve().GetComponent(dummy.Uid); - var light = IoCManager.Resolve().GetComponent(dummy.Uid); + var sprite = IoCManager.Resolve().GetComponent(dummy); + var light = IoCManager.Resolve().GetComponent(dummy); Assert.False(sprite.ContainerOccluded); Assert.False(light.ContainerOccluded); }); @@ -144,10 +144,10 @@ namespace Content.IntegrationTests.Tests var containerA = ent.SpawnEntity("ContainerOcclusionA", pos); var containerB = ent.SpawnEntity("ContainerOcclusionB", pos); var dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos); - dummyUid = dummy.Uid; + dummyUid = dummy; - IoCManager.Resolve().GetComponent(containerA.Uid).Insert(containerB); - IoCManager.Resolve().GetComponent(containerB.Uid).Insert(dummy); + IoCManager.Resolve().GetComponent(containerA).Insert(containerB); + IoCManager.Resolve().GetComponent(containerB).Insert(dummy); }); await RunTicksSync(c, s, 5); @@ -155,8 +155,8 @@ namespace Content.IntegrationTests.Tests c.Assert(() => { var dummy = IoCManager.Resolve().GetEntity(dummyUid); - var sprite = IoCManager.Resolve().GetComponent(dummy.Uid); - var light = IoCManager.Resolve().GetComponent(dummy.Uid); + var sprite = IoCManager.Resolve().GetComponent(dummy); + var light = IoCManager.Resolve().GetComponent(dummy); Assert.True(sprite.ContainerOccluded); Assert.True(light.ContainerOccluded); }); diff --git a/Content.IntegrationTests/Tests/Damageable/DamageableTest.cs b/Content.IntegrationTests/Tests/Damageable/DamageableTest.cs index 17c334ec96..8945f961d5 100644 --- a/Content.IntegrationTests/Tests/Damageable/DamageableTest.cs +++ b/Content.IntegrationTests/Tests/Damageable/DamageableTest.cs @@ -119,7 +119,7 @@ namespace Content.IntegrationTests.Tests.Damageable sMapManager.CreateMap(mapId); sDamageableEntity = sEntityManager.SpawnEntity("TestDamageableEntityId", coordinates); - sDamageableComponent = IoCManager.Resolve().GetComponent(sDamageableEntity.Uid); + sDamageableComponent = IoCManager.Resolve().GetComponent(sDamageableEntity); sDamageableSystem = sEntitySystemManager.GetEntitySystem(); group1 = sPrototypeManager.Index("TestGroup1"); @@ -138,7 +138,7 @@ namespace Content.IntegrationTests.Tests.Damageable await server.WaitAssertion(() => { - var uid = sDamageableEntity.Uid; + var uid = (EntityUid) sDamageableEntity; // Check that the correct types are supported. Assert.That(sDamageableComponent.Damage.DamageDict.ContainsKey(type1.ID), Is.False); diff --git a/Content.IntegrationTests/Tests/DeleteInventoryTest.cs b/Content.IntegrationTests/Tests/DeleteInventoryTest.cs index ec4641929a..decafab3e1 100644 --- a/Content.IntegrationTests/Tests/DeleteInventoryTest.cs +++ b/Content.IntegrationTests/Tests/DeleteInventoryTest.cs @@ -38,7 +38,7 @@ namespace Content.IntegrationTests.Tests Assert.That(inv.Equip(Slots.HEAD, item, false), Is.True); // Delete parent. - IoCManager.Resolve().DeleteEntity(container.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) container); // Assert that child item was also deleted. Assert.That(item.Deleted, Is.True); diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageGroupTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageGroupTest.cs index ea0f6ed8d3..0cbfc16f27 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageGroupTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageGroupTest.cs @@ -43,7 +43,7 @@ namespace Content.IntegrationTests.Tests.Destructible var coordinates = new EntityCoordinates(gridId, 0, 0); sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageGroupEntityId, coordinates); - sDamageableComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity.Uid); + sDamageableComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity); sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem(); sTestThresholdListenerSystem.ThresholdsReached.Clear(); @@ -67,19 +67,19 @@ namespace Content.IntegrationTests.Tests.Destructible DamageSpecifier burnDamage = new(burnDamageGroup, FixedPoint2.New(5)); // Raise brute damage to 5 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bruteDamage, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage, true); // No thresholds reached yet, the earliest one is at 10 damage Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise brute damage to 10 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bruteDamage, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage, true); // No threshold reached, burn needs to be 10 as well Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise burn damage to 10 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, burnDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, burnDamage * 2, true); // One threshold reached, brute 10 + burn 10 Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1)); @@ -102,26 +102,26 @@ namespace Content.IntegrationTests.Tests.Destructible sTestThresholdListenerSystem.ThresholdsReached.Clear(); // Raise brute damage to 20 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bruteDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * 2, true); // No new thresholds reached Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise burn damage to 20 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, burnDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, burnDamage * 2, true); // No new thresholds reached Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Lower brute damage to 0 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bruteDamage * -10); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * -10); Assert.That(sDamageableComponent.TotalDamage,Is.EqualTo(FixedPoint2.New(20))); // No new thresholds reached, healing should not trigger it Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise brute damage back up to 10 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bruteDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * 2, true); // 10 brute + 10 burn threshold reached, brute was healed and brought back to its threshold amount and slash stayed the same Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1)); @@ -135,13 +135,13 @@ namespace Content.IntegrationTests.Tests.Destructible Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise brute damage to 10 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bruteDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * 2, true); // No new thresholds reached Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise burn damage to 10 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, burnDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, burnDamage * 2, true); // Both classes of damage were healed and then raised again, the threshold should have been reached as triggers once is default false Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1)); @@ -173,13 +173,13 @@ namespace Content.IntegrationTests.Tests.Destructible Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise brute damage to 10 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bruteDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bruteDamage * 2, true); // No new thresholds reached Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise burn damage to 10 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, burnDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, burnDamage * 2, true); // No new thresholds reached as triggers once is set to true and it already triggered before Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs index e235bfa5e2..fad076471c 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDamageTypeTest.cs @@ -41,7 +41,7 @@ namespace Content.IntegrationTests.Tests.Destructible var coordinates = new EntityCoordinates(gridId, 0, 0); sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDamageTypeEntityId, coordinates); - sDamageableComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity.Uid); + sDamageableComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity); sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem(); sDamageableSystem = sEntitySystemManager.GetEntitySystem(); }); @@ -62,19 +62,19 @@ namespace Content.IntegrationTests.Tests.Destructible var slashDamage = new DamageSpecifier(slashDamageType,5); // Raise blunt damage to 5 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true); // No thresholds reached yet, the earliest one is at 10 damage Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise blunt damage to 10 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true); // No threshold reached, slash needs to be 10 as well Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise slash damage to 10 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, slashDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * 2, true); // One threshold reached, blunt 10 + slash 10 Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1)); @@ -97,25 +97,25 @@ namespace Content.IntegrationTests.Tests.Destructible sTestThresholdListenerSystem.ThresholdsReached.Clear(); // Raise blunt damage to 20 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 2, true); // No new thresholds reached Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise slash damage to 20 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, slashDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * 2, true); // No new thresholds reached Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Lower blunt damage to 0 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage * -4, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * -4, true); // No new thresholds reached, healing should not trigger it Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise blunt damage back up to 10 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 2, true); // 10 blunt + 10 slash threshold reached, blunt was healed and brought back to its threshold amount and slash stayed the same Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1)); @@ -123,20 +123,20 @@ namespace Content.IntegrationTests.Tests.Destructible sTestThresholdListenerSystem.ThresholdsReached.Clear(); // Heal both types of damage to 0 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage * -2, true); - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, slashDamage * -4, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * -2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * -4, true); // No new thresholds reached, healing should not trigger it Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise blunt damage to 10 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 2, true); // No new thresholds reached Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise slash damage to 10 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, slashDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * 2, true); // Both types of damage were healed and then raised again, the threshold should have been reached as triggers once is default false Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1)); @@ -162,20 +162,20 @@ namespace Content.IntegrationTests.Tests.Destructible threshold.TriggersOnce = true; // Heal blunt and slash back to 0 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage * -2, true); - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, slashDamage * -2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * -2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * -2, true); // No new thresholds reached from healing Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise blunt damage to 10 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage * 2, true); // No new thresholds reached Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); // Raise slash damage to 10 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, slashDamage * 2, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, slashDamage * 2, true); // No new thresholds reached as triggers once is set to true and it already triggered before Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs index fa1a13a043..6d3ccc570a 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleDestructionTest.cs @@ -40,19 +40,19 @@ namespace Content.IntegrationTests.Tests.Destructible var coordinates = new EntityCoordinates(gridId, 0, 0); sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleDestructionEntityId, coordinates); - sDamageableComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity.Uid); + sDamageableComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity); sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem(); }); await server.WaitAssertion(() => { - var coordinates = IoCManager.Resolve().GetComponent(sDestructibleEntity.Uid).Coordinates; + var coordinates = IoCManager.Resolve().GetComponent(sDestructibleEntity).Coordinates; var bruteDamageGroup = sPrototypeManager.Index("TestBrute"); DamageSpecifier bruteDamage = new(bruteDamageGroup,50); Assert.DoesNotThrow(() => { - EntitySystem.Get().TryChangeDamage(sDestructibleEntity.Uid, bruteDamage, true); + EntitySystem.Get().TryChangeDamage(sDestructibleEntity, bruteDamage, true); }); Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1)); @@ -73,12 +73,12 @@ namespace Content.IntegrationTests.Tests.Destructible foreach (var entity in entitiesInRange) { - if (IoCManager.Resolve().GetComponent(entity.Uid).EntityPrototype == null) + if (IoCManager.Resolve().GetComponent(entity).EntityPrototype == null) { continue; } - if (IoCManager.Resolve().GetComponent(entity.Uid).EntityPrototype.Name != SpawnedEntityId) + if (IoCManager.Resolve().GetComponent(entity).EntityPrototype.Name != SpawnedEntityId) { continue; } diff --git a/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs b/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs index ae70d2abe5..f36f6fe67b 100644 --- a/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs +++ b/Content.IntegrationTests/Tests/Destructible/DestructibleThresholdActivationTest.cs @@ -48,8 +48,8 @@ namespace Content.IntegrationTests.Tests.Destructible var coordinates = new EntityCoordinates(gridId, 0, 0); sDestructibleEntity = sEntityManager.SpawnEntity(DestructibleEntityId, coordinates); - sDamageableComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity.Uid); - sDestructibleComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity.Uid); + sDamageableComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity); + sDestructibleComponent = IoCManager.Resolve().GetComponent(sDestructibleEntity); sTestThresholdListenerSystem = sEntitySystemManager.GetEntitySystem(); sTestThresholdListenerSystem.ThresholdsReached.Clear(); @@ -68,12 +68,12 @@ namespace Content.IntegrationTests.Tests.Destructible { var bluntDamage = new DamageSpecifier(sPrototypeManager.Index("TestBlunt"), 10); - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true); // No thresholds reached yet, the earliest one is at 20 damage Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true); // Only one threshold reached, 20 Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1)); @@ -89,7 +89,7 @@ namespace Content.IntegrationTests.Tests.Destructible sTestThresholdListenerSystem.ThresholdsReached.Clear(); - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage*3, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*3, true); // One threshold reached, 50, since 20 already triggered before and it has not been healed below that amount Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1)); @@ -118,7 +118,7 @@ namespace Content.IntegrationTests.Tests.Destructible sTestThresholdListenerSystem.ThresholdsReached.Clear(); // Damage for 50 again, up to 100 now - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage*5, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*5, true); // No thresholds reached as they weren't healed below the trigger amount Assert.IsEmpty(sTestThresholdListenerSystem.ThresholdsReached); @@ -127,7 +127,7 @@ namespace Content.IntegrationTests.Tests.Destructible sDamageableSystem.SetAllDamage(sDamageableComponent, 0); // Damage for 100, up to 100 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage*10, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*10, true); // Two thresholds reached as damage increased past the previous, 20 and 50 Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(2)); @@ -135,25 +135,25 @@ namespace Content.IntegrationTests.Tests.Destructible sTestThresholdListenerSystem.ThresholdsReached.Clear(); // Heal the entity for 40 damage, down to 60 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage*-4, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*-4, true); // Thresholds don't work backwards Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty); // Damage for 10, up to 70 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true); // Not enough healing to de-trigger a threshold Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty); // Heal by 30, down to 40 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage*-3, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*-3, true); // Thresholds don't work backwards Assert.That(sTestThresholdListenerSystem.ThresholdsReached, Is.Empty); // Damage up to 50 again - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage, true); // The 50 threshold should have triggered again, after being healed Assert.That(sTestThresholdListenerSystem.ThresholdsReached.Count, Is.EqualTo(1)); @@ -186,7 +186,7 @@ namespace Content.IntegrationTests.Tests.Destructible sDamageableSystem.SetAllDamage(sDamageableComponent, 0); // Damage up to 50 - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage*5, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*5, true); // Check that the total damage matches Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.New(50))); @@ -247,7 +247,7 @@ namespace Content.IntegrationTests.Tests.Destructible } // Damage the entity up to 50 damage again - sDamageableSystem.TryChangeDamage(sDestructibleEntity.Uid, bluntDamage*5, true); + sDamageableSystem.TryChangeDamage(sDestructibleEntity, bluntDamage*5, true); // Check that the total damage matches Assert.That(sDamageableComponent.TotalDamage, Is.EqualTo(FixedPoint2.New(50))); diff --git a/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs b/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs index 4f75bcc9ca..d6aa0b1150 100644 --- a/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs +++ b/Content.IntegrationTests/Tests/DeviceNetwork/DeviceNetworkTest.cs @@ -82,19 +82,19 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork device1 = entityManager.SpawnEntity("DummyNetworkDevice", MapCoordinates.Nullspace); - Assert.That(IoCManager.Resolve().TryGetComponent(device1.Uid, out networkComponent1), Is.True); + Assert.That(IoCManager.Resolve().TryGetComponent(device1, out networkComponent1), Is.True); Assert.That(networkComponent1.Open, Is.True); Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty)); device2 = entityManager.SpawnEntity("DummyNetworkDevice", MapCoordinates.Nullspace); - Assert.That(IoCManager.Resolve().TryGetComponent(device2.Uid, out networkComponent2), Is.True); + Assert.That(IoCManager.Resolve().TryGetComponent(device2, out networkComponent2), Is.True); Assert.That(networkComponent2.Open, Is.True); Assert.That(networkComponent2.Address, Is.Not.EqualTo(string.Empty)); Assert.That(networkComponent1.Address, Is.Not.EqualTo(networkComponent2.Address)); - deviceNetSystem.QueuePacket(device1.Uid, networkComponent2.Address, networkComponent2.Frequency, payload); + deviceNetSystem.QueuePacket(device1, networkComponent2.Address, networkComponent2.Frequency, payload); }); await server.WaitRunTicks(1); @@ -145,20 +145,20 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork device1 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", MapCoordinates.Nullspace); - Assert.That(IoCManager.Resolve().TryGetComponent(device1.Uid, out networkComponent1), Is.True); - Assert.That(IoCManager.Resolve().TryGetComponent(device1.Uid, out wirelessNetworkComponent), Is.True); + Assert.That(IoCManager.Resolve().TryGetComponent(device1, out networkComponent1), Is.True); + Assert.That(IoCManager.Resolve().TryGetComponent(device1, out wirelessNetworkComponent), Is.True); Assert.That(networkComponent1.Open, Is.True); Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty)); device2 = entityManager.SpawnEntity("DummyWirelessNetworkDevice", new MapCoordinates(new Robust.Shared.Maths.Vector2(0,50), MapId.Nullspace)); - Assert.That(IoCManager.Resolve().TryGetComponent(device2.Uid, out networkComponent2), Is.True); + Assert.That(IoCManager.Resolve().TryGetComponent(device2, out networkComponent2), Is.True); Assert.That(networkComponent2.Open, Is.True); Assert.That(networkComponent2.Address, Is.Not.EqualTo(string.Empty)); Assert.That(networkComponent1.Address, Is.Not.EqualTo(networkComponent2.Address)); - deviceNetSystem.QueuePacket(device1.Uid, networkComponent2.Address, networkComponent2.Frequency, payload); + deviceNetSystem.QueuePacket(device1, networkComponent2.Address, networkComponent2.Frequency, payload); }); await server.WaitRunTicks(1); @@ -174,7 +174,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork wirelessNetworkComponent.Range = 0; - deviceNetSystem.QueuePacket(device1.Uid, networkComponent2.Address, networkComponent2.Frequency, payload); + deviceNetSystem.QueuePacket(device1, networkComponent2.Address, networkComponent2.Frequency, payload); }); await server.WaitRunTicks(1); @@ -232,20 +232,20 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork device1 = entityManager.SpawnEntity("DummyWiredNetworkDevice", MapCoordinates.Nullspace); - Assert.That(IoCManager.Resolve().TryGetComponent(device1.Uid, out networkComponent1), Is.True); - Assert.That(IoCManager.Resolve().TryGetComponent(device1.Uid, out wiredNetworkComponent), Is.True); + Assert.That(IoCManager.Resolve().TryGetComponent(device1, out networkComponent1), Is.True); + Assert.That(IoCManager.Resolve().TryGetComponent(device1, out wiredNetworkComponent), Is.True); Assert.That(networkComponent1.Open, Is.True); Assert.That(networkComponent1.Address, Is.Not.EqualTo(string.Empty)); device2 = entityManager.SpawnEntity("DummyWiredNetworkDevice", new MapCoordinates(new Robust.Shared.Maths.Vector2(0, 2), MapId.Nullspace)); - Assert.That(IoCManager.Resolve().TryGetComponent(device2.Uid, out networkComponent2), Is.True); + Assert.That(IoCManager.Resolve().TryGetComponent(device2, out networkComponent2), Is.True); Assert.That(networkComponent2.Open, Is.True); Assert.That(networkComponent2.Address, Is.Not.EqualTo(string.Empty)); Assert.That(networkComponent1.Address, Is.Not.EqualTo(networkComponent2.Address)); - deviceNetSystem.QueuePacket(device1.Uid, networkComponent2.Address, networkComponent2.Frequency, payload); + deviceNetSystem.QueuePacket(device1, networkComponent2.Address, networkComponent2.Frequency, payload); }); await server.WaitRunTicks(1); @@ -256,7 +256,7 @@ namespace Content.IntegrationTests.Tests.DeviceNetwork entityManager.SpawnEntity("CableApcExtension", grid.MapToGrid(new MapCoordinates(new Robust.Shared.Maths.Vector2(0, 1), MapId.Nullspace))); - deviceNetSystem.QueuePacket(device1.Uid, networkComponent2.Address, networkComponent2.Frequency, payload); + deviceNetSystem.QueuePacket(device1, networkComponent2.Address, networkComponent2.Frequency, payload); }); await server.WaitRunTicks(1); diff --git a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs index 455881988f..0d40199825 100644 --- a/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs +++ b/Content.IntegrationTests/Tests/Disposal/DisposalUnitTest.cs @@ -44,7 +44,7 @@ namespace Content.IntegrationTests.Tests.Disposal foreach (var entity in entities) { Assert.That(system.CanInsert(unit, entity), Is.EqualTo(result)); - system.TryInsert(unit.Owner.Uid, entity.Uid, entity.Uid); + system.TryInsert(unit.Owner, entity, entity); } } @@ -143,22 +143,22 @@ namespace Content.IntegrationTests.Tests.Disposal human = entityManager.SpawnEntity("HumanDummy", coordinates); wrench = entityManager.SpawnEntity("WrenchDummy", coordinates); disposalUnit = entityManager.SpawnEntity("DisposalUnitDummy", coordinates); - disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", IoCManager.Resolve().GetComponent(disposalUnit.Uid).MapPosition); + disposalTrunk = entityManager.SpawnEntity("DisposalTrunkDummy", IoCManager.Resolve().GetComponent(disposalUnit).MapPosition); // Test for components existing ref DisposalUnitComponent? comp = ref unit!; - Assert.True(IoCManager.Resolve().TryGetComponent(disposalUnit.Uid, out comp)); - Assert.True(IoCManager.Resolve().HasComponent(disposalTrunk.Uid)); + Assert.True(IoCManager.Resolve().TryGetComponent(disposalUnit, out comp)); + Assert.True(IoCManager.Resolve().HasComponent(disposalTrunk)); // Can't insert, unanchored and unpowered - IoCManager.Resolve().GetComponent(unit.Owner.Uid).Anchored = false; + IoCManager.Resolve().GetComponent(unit.Owner).Anchored = false; UnitInsertContains(unit, false, human, wrench, disposalUnit, disposalTrunk); }); await server.WaitAssertion(() => { // Anchor the disposal unit - IoCManager.Resolve().GetComponent(unit.Owner.Uid).Anchored = true; + IoCManager.Resolve().GetComponent(unit.Owner).Anchored = true; // No power Assert.False(unit.Powered); @@ -173,7 +173,7 @@ namespace Content.IntegrationTests.Tests.Disposal await server.WaitAssertion(() => { // Move the disposal trunk away - IoCManager.Resolve().GetComponent(disposalTrunk.Uid).WorldPosition += (1, 0); + IoCManager.Resolve().GetComponent(disposalTrunk).WorldPosition += (1, 0); // Fail to flush with a mob and an item Flush(unit, false, human, wrench); @@ -182,7 +182,7 @@ namespace Content.IntegrationTests.Tests.Disposal await server.WaitAssertion(() => { // Move the disposal trunk back - IoCManager.Resolve().GetComponent(disposalTrunk.Uid).WorldPosition -= (1, 0); + IoCManager.Resolve().GetComponent(disposalTrunk).WorldPosition -= (1, 0); // Fail to flush with a mob and an item, no power Flush(unit, false, human, wrench); @@ -191,7 +191,7 @@ namespace Content.IntegrationTests.Tests.Disposal await server.WaitAssertion(() => { // Remove power need - Assert.True(IoCManager.Resolve().TryGetComponent(disposalUnit.Uid, out ApcPowerReceiverComponent power)); + Assert.True(IoCManager.Resolve().TryGetComponent(disposalUnit, out ApcPowerReceiverComponent power)); power!.NeedsPower = false; Assert.True(unit.Powered); diff --git a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs index 867c38ef6a..2d06c780e7 100644 --- a/Content.IntegrationTests/Tests/Doors/AirlockTest.cs +++ b/Content.IntegrationTests/Tests/Doors/AirlockTest.cs @@ -65,7 +65,7 @@ namespace Content.IntegrationTests.Tests.Doors airlock = entityManager.SpawnEntity("AirlockDummy", MapCoordinates.Nullspace); - Assert.True(IoCManager.Resolve().TryGetComponent(airlock.Uid, out doorComponent)); + Assert.True(IoCManager.Resolve().TryGetComponent(airlock, out doorComponent)); Assert.That(doorComponent.State, Is.EqualTo(SharedDoorComponent.DoorState.Closed)); }); @@ -97,7 +97,7 @@ namespace Content.IntegrationTests.Tests.Doors { Assert.DoesNotThrow(() => { - IoCManager.Resolve().DeleteEntity(airlock.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) airlock); }); }); @@ -136,9 +136,9 @@ namespace Content.IntegrationTests.Tests.Doors airlock = entityManager.SpawnEntity("AirlockDummy", new MapCoordinates((0, 0), mapId)); - Assert.True(IoCManager.Resolve().TryGetComponent(physicsDummy.Uid, out physBody)); + Assert.True(IoCManager.Resolve().TryGetComponent(physicsDummy, out physBody)); - Assert.True(IoCManager.Resolve().TryGetComponent(airlock.Uid, out doorComponent)); + Assert.True(IoCManager.Resolve().TryGetComponent(airlock, out doorComponent)); Assert.That(doorComponent.State, Is.EqualTo(SharedDoorComponent.DoorState.Closed)); }); @@ -151,7 +151,7 @@ namespace Content.IntegrationTests.Tests.Doors for (var i = 0; i < 240; i += 10) { // Keep the airlock awake so they collide - server.Post(() => IoCManager.Resolve().GetComponent(airlock.Uid).WakeBody()); + server.Post(() => IoCManager.Resolve().GetComponent(airlock).WakeBody()); await server.WaitRunTicks(10); await server.WaitIdleAsync(); @@ -164,7 +164,7 @@ namespace Content.IntegrationTests.Tests.Doors // Assert.That(physicsDummy.Transform.MapPosition.X, Is.GreaterThan(physicsDummyStartingX)); // Blocked by the airlock - await server.WaitAssertion(() => Assert.That(Math.Abs(IoCManager.Resolve().GetComponent(physicsDummy.Uid).MapPosition.X - 1) > 0.01f)); + await server.WaitAssertion(() => Assert.That(Math.Abs(IoCManager.Resolve().GetComponent(physicsDummy).MapPosition.X - 1) > 0.01f)); } } } diff --git a/Content.IntegrationTests/Tests/EntityTest.cs b/Content.IntegrationTests/Tests/EntityTest.cs index 7f37a60f63..f0f8288628 100644 --- a/Content.IntegrationTests/Tests/EntityTest.cs +++ b/Content.IntegrationTests/Tests/EntityTest.cs @@ -88,8 +88,8 @@ namespace Content.IntegrationTests.Tests Logger.LogS(LogLevel.Debug, "EntityTest", $"Testing: {prototype.ID}"); testEntity = entityMan.SpawnEntity(prototype.ID, testLocation); server.RunTicks(2); - Assert.That((!IoCManager.Resolve().EntityExists(testEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(testEntity.Uid).EntityLifeStage) >= EntityLifeStage.Initialized); - entityMan.DeleteEntity(testEntity.Uid); + Assert.That((!IoCManager.Resolve().EntityExists(testEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(testEntity).EntityLifeStage) >= EntityLifeStage.Initialized); + entityMan.DeleteEntity((EntityUid) testEntity); }, "Entity '{0}' threw an exception.", prototype.ID); } @@ -173,11 +173,11 @@ namespace Content.IntegrationTests.Tests var entity = entityManager.SpawnEntity("AllComponentsOneToOneDeleteTestEntity", testLocation); - Assert.That((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Initialized); + Assert.That((!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Initialized); // The component may already exist if it is a mandatory component // such as MetaData or Transform - if (IoCManager.Resolve().HasComponent(entity.Uid, type)) + if (IoCManager.Resolve().HasComponent(entity, type)) { continue; } @@ -194,7 +194,7 @@ namespace Content.IntegrationTests.Tests server.RunTicks(2); - entityManager.DeleteEntity(entity.Uid); + entityManager.DeleteEntity((EntityUid) entity); } }); }); @@ -302,14 +302,14 @@ namespace Content.IntegrationTests.Tests var testLocation = grid.ToCoordinates(); var entity = entityManager.SpawnEntity("AllComponentsOneEntityDeleteTestEntity", testLocation); - Assert.That((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Initialized); + Assert.That((!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Initialized); foreach (var type in distinct.components) { var component = (Component) componentFactory.GetComponent(type); // If the entity already has this component, if it was ensured or added by another - if (IoCManager.Resolve().HasComponent(entity.Uid, component.GetType())) + if (IoCManager.Resolve().HasComponent(entity, component.GetType())) { continue; } @@ -336,7 +336,7 @@ namespace Content.IntegrationTests.Tests } server.RunTicks(2); - entityManager.DeleteEntity(entity.Uid); + entityManager.DeleteEntity((EntityUid) entity); } }); }); diff --git a/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs b/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs index 029dcde6c7..09416d2049 100644 --- a/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs +++ b/Content.IntegrationTests/Tests/Fluids/PuddleTest.cs @@ -101,7 +101,7 @@ namespace Content.IntegrationTests.Tests.Fluids sGrid = sMapManager.CreateGrid(sMapId); sGridId = sGrid.Index; sGridEntity = sEntityManager.GetEntity(sGrid.GridEntityId); - IoCManager.Resolve().GetComponent(sGridEntity.Uid).EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1444 + IoCManager.Resolve().GetComponent(sGridEntity).EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1444 var tileDefinition = sTileDefinitionManager["underplating"]; var tile = new Tile(tileDefinition.TileId); @@ -115,7 +115,7 @@ namespace Content.IntegrationTests.Tests.Fluids { Assert.True(sPauseManager.IsGridPaused(sGridId)); Assert.True(sPauseManager.IsMapPaused(sMapId)); - Assert.True((!IoCManager.Resolve().EntityExists(sGridEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(sGridEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve().GetComponent(sGridEntity.Uid).EntityPaused); + Assert.True((!IoCManager.Resolve().EntityExists(sGridEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(sGridEntity).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve().GetComponent(sGridEntity).EntityPaused); }); float evaporateTime = default; @@ -132,11 +132,11 @@ namespace Content.IntegrationTests.Tests.Fluids // Check that the puddle was created Assert.NotNull(puddle); - evaporation = IoCManager.Resolve().GetComponent(puddle.Owner.Uid); + evaporation = IoCManager.Resolve().GetComponent(puddle.Owner); - IoCManager.Resolve().GetComponent(puddle.Owner.Uid).EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1445 + IoCManager.Resolve().GetComponent(puddle.Owner).EntityPaused = true; // See https://github.com/space-wizards/RobustToolbox/issues/1445 - Assert.True((!IoCManager.Resolve().EntityExists(puddle.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(puddle.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve().GetComponent(puddle.Owner.Uid).EntityPaused); + Assert.True((!IoCManager.Resolve().EntityExists(puddle.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(puddle.Owner).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve().GetComponent(puddle.Owner).EntityPaused); // Check that the puddle is going to evaporate Assert.Positive(evaporation.EvaporateTime); @@ -154,10 +154,10 @@ namespace Content.IntegrationTests.Tests.Fluids // No evaporation due to being paused await server.WaitAssertion(() => { - Assert.True((!IoCManager.Resolve().EntityExists(puddle.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(puddle.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve().GetComponent(puddle.Owner.Uid).EntityPaused); + Assert.True((!IoCManager.Resolve().EntityExists(puddle.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(puddle.Owner).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve().GetComponent(puddle.Owner).EntityPaused); // Check that the puddle still exists - Assert.False((!IoCManager.Resolve().EntityExists(puddle.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(puddle.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted); + Assert.False((!IoCManager.Resolve().EntityExists(puddle.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(puddle.Owner).EntityLifeStage) >= EntityLifeStage.Deleted); }); // Unpause the map @@ -168,10 +168,10 @@ namespace Content.IntegrationTests.Tests.Fluids { Assert.False(sPauseManager.IsMapPaused(sMapId)); Assert.False(sPauseManager.IsGridPaused(sGridId)); - Assert.False((!IoCManager.Resolve().EntityExists(puddle.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(puddle.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve().GetComponent(puddle.Owner.Uid).EntityPaused); + Assert.False((!IoCManager.Resolve().EntityExists(puddle.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(puddle.Owner).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve().GetComponent(puddle.Owner).EntityPaused); // Check that the puddle still exists - Assert.False((!IoCManager.Resolve().EntityExists(puddle.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(puddle.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted); + Assert.False((!IoCManager.Resolve().EntityExists(puddle.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(puddle.Owner).EntityLifeStage) >= EntityLifeStage.Deleted); }); // Wait enough time for it to evaporate diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs index 94edfadd74..59e86b1b26 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/ActionBlocking/HandCuffTest.cs @@ -63,16 +63,16 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking cuffs = entityManager.SpawnEntity("HandcuffsDummy", coordinates); secondCuffs = entityManager.SpawnEntity("HandcuffsDummy", coordinates); - IoCManager.Resolve().GetComponent(human.Uid).WorldPosition = IoCManager.Resolve().GetComponent(otherHuman.Uid).WorldPosition; + IoCManager.Resolve().GetComponent(human).WorldPosition = IoCManager.Resolve().GetComponent(otherHuman).WorldPosition; // Test for components existing ref CuffableComponent? comp = ref cuffed!; - Assert.True(IoCManager.Resolve().TryGetComponent(human.Uid, out comp), $"Human has no {nameof(CuffableComponent)}"); + Assert.True(IoCManager.Resolve().TryGetComponent(human, out comp), $"Human has no {nameof(CuffableComponent)}"); ref HandsComponent? comp1 = ref hands!; - Assert.True(IoCManager.Resolve().TryGetComponent(human.Uid, out comp1), $"Human has no {nameof(HandsComponent)}"); - Assert.True(IoCManager.Resolve().TryGetComponent(human.Uid, out SharedBodyComponent? _), $"Human has no {nameof(SharedBodyComponent)}"); - Assert.True(IoCManager.Resolve().TryGetComponent(cuffs.Uid, out HandcuffComponent? _), $"Handcuff has no {nameof(HandcuffComponent)}"); - Assert.True(IoCManager.Resolve().TryGetComponent(secondCuffs.Uid, out HandcuffComponent? _), $"Second handcuffs has no {nameof(HandcuffComponent)}"); + Assert.True(IoCManager.Resolve().TryGetComponent(human, out comp1), $"Human has no {nameof(HandsComponent)}"); + Assert.True(IoCManager.Resolve().TryGetComponent(human, out SharedBodyComponent? _), $"Human has no {nameof(SharedBodyComponent)}"); + Assert.True(IoCManager.Resolve().TryGetComponent(cuffs, out HandcuffComponent? _), $"Handcuff has no {nameof(HandcuffComponent)}"); + Assert.True(IoCManager.Resolve().TryGetComponent(secondCuffs, out HandcuffComponent? _), $"Second handcuffs has no {nameof(HandcuffComponent)}"); // Test to ensure cuffed players register the handcuffs cuffed.TryAddNewCuffs(human, cuffs); @@ -97,7 +97,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking private void AddHand(IEntity to) { var host = IoCManager.Resolve(); - host.ExecuteCommand(null, $"addhand {to.Uid}"); + host.ExecuteCommand(null, $"addhand {to}"); } } } diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs index 6cf7531e30..239ffb5c0e 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/ActionsComponentTests.cs @@ -72,7 +72,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs await server.WaitAssertion(() => { var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity; - var actionsComponent = IoCManager.Resolve().GetComponent(playerEnt!.Uid); + var actionsComponent = IoCManager.Resolve().GetComponent(playerEnt!); // player should begin with their innate actions granted innateActions.AddRange(actionsComponent.InnateActions); @@ -99,7 +99,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { var local = clientPlayerMgr.LocalPlayer; var controlled = local!.ControlledEntity; - var actionsComponent = IoCManager.Resolve().GetComponent(controlled!.Uid); + var actionsComponent = IoCManager.Resolve().GetComponent(controlled!); // we should have our innate actions and debug1. foreach (var innateAction in innateActions) @@ -154,7 +154,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs await server.WaitAssertion(() => { var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity; - var actionsComponent = IoCManager.Resolve().GetComponent(playerEnt!.Uid); + var actionsComponent = IoCManager.Resolve().GetComponent(playerEnt!); actionsComponent.Revoke(ActionType.DebugInstant); }); @@ -165,7 +165,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { var local = clientPlayerMgr.LocalPlayer; var controlled = local!.ControlledEntity; - var actionsComponent = IoCManager.Resolve().GetComponent(controlled!.Uid); + var actionsComponent = IoCManager.Resolve().GetComponent(controlled!); // we should have our innate actions, but debug1 should be revoked foreach (var innateAction in innateActions) @@ -246,12 +246,12 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs await server.WaitAssertion(() => { serverPlayerEnt = serverPlayerManager.Sessions.Single().AttachedEntity; - serverActionsComponent = IoCManager.Resolve().GetComponent(serverPlayerEnt!.Uid); + serverActionsComponent = IoCManager.Resolve().GetComponent(serverPlayerEnt!); // spawn and give them an item that has actions serverFlashlight = serverEntManager.SpawnEntity("TestFlashlight", - new EntityCoordinates(serverPlayerEnt.Uid, (0, 0))); - Assert.That(IoCManager.Resolve().TryGetComponent(serverFlashlight.Uid, out var itemActions)); + new EntityCoordinates(serverPlayerEnt, (0, 0))); + Assert.That(IoCManager.Resolve().TryGetComponent(serverFlashlight, out var itemActions)); // we expect this only to have a toggle light action initially var actionConfigs = itemActions.ActionConfigs.ToList(); Assert.That(actionConfigs.Count == 1); @@ -260,11 +260,11 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs // grant an extra item action, before pickup, initially disabled itemActions.GrantOrUpdate(ItemActionType.DebugToggle, false); - IoCManager.Resolve().GetComponent(serverPlayerEnt.Uid).PutInHand(IoCManager.Resolve().GetComponent(serverFlashlight.Uid), false); + IoCManager.Resolve().GetComponent(serverPlayerEnt).PutInHand(IoCManager.Resolve().GetComponent(serverFlashlight), false); // grant an extra item action, after pickup, with a cooldown itemActions.GrantOrUpdate(ItemActionType.DebugInstant, cooldown: cooldown); - Assert.That(serverActionsComponent.TryGetItemActionStates(serverFlashlight.Uid, out var state)); + Assert.That(serverActionsComponent.TryGetItemActionStates((EntityUid) serverFlashlight, out var state)); // they should have been granted all 3 actions Assert.That(state.Count == 3); Assert.That(state.TryGetValue(ItemActionType.ToggleLight, out var toggleLightState)); @@ -286,7 +286,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { var local = clientPlayerMgr.LocalPlayer; var controlled = local!.ControlledEntity; - clientActionsComponent = IoCManager.Resolve().GetComponent(controlled!.Uid); + clientActionsComponent = IoCManager.Resolve().GetComponent(controlled!); var lightEntry = clientActionsComponent.ItemActionStates() .Where(entry => entry.Value.ContainsKey(ItemActionType.ToggleLight)) @@ -318,7 +318,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs // server should see the action toggled on await server.WaitAssertion(() => { - Assert.That(serverActionsComponent.ItemActionStates().TryGetValue(serverFlashlight.Uid, out var lightStates)); + Assert.That(serverActionsComponent.ItemActionStates().TryGetValue(serverFlashlight, out var lightStates)); Assert.That(lightStates.TryGetValue(ItemActionType.ToggleLight, out var lightState)); Assert.That(lightState, Is.EqualTo(new ActionState(true, toggledOn: true))); }); @@ -334,9 +334,9 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs await server.WaitAssertion(() => { // drop the item, and the item actions should go away - IoCManager.Resolve().GetComponent(serverPlayerEnt.Uid) - .TryDropEntity(serverFlashlight, IoCManager.Resolve().GetComponent(serverPlayerEnt.Uid).Coordinates, false); - Assert.That(serverActionsComponent.ItemActionStates().ContainsKey(serverFlashlight.Uid), Is.False); + IoCManager.Resolve().GetComponent(serverPlayerEnt) + .TryDropEntity(serverFlashlight, IoCManager.Resolve().GetComponent(serverPlayerEnt).Coordinates, false); + Assert.That(serverActionsComponent.ItemActionStates().ContainsKey(serverFlashlight), Is.False); }); await server.WaitRunTicks(5); @@ -352,8 +352,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { // pick the item up again, the states should be back to what they were when dropped, // as the states "stick" with the item - IoCManager.Resolve().GetComponent(serverPlayerEnt.Uid).PutInHand(IoCManager.Resolve().GetComponent(serverFlashlight.Uid), false); - Assert.That(serverActionsComponent.ItemActionStates().TryGetValue(serverFlashlight.Uid, out var lightStates)); + IoCManager.Resolve().GetComponent(serverPlayerEnt).PutInHand(IoCManager.Resolve().GetComponent(serverFlashlight), false); + Assert.That(serverActionsComponent.ItemActionStates().TryGetValue(serverFlashlight, out var lightStates)); Assert.That(lightStates.TryGetValue(ItemActionType.ToggleLight, out var lightState)); Assert.That(lightState.Equals(new ActionState(true, toggledOn: true))); Assert.That(lightStates.TryGetValue(ItemActionType.DebugInstant, out var debugInstantState)); diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/AlertsComponentTests.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/AlertsComponentTests.cs index c4ac544863..3ccf1ca83b 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/AlertsComponentTests.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Mobs/AlertsComponentTests.cs @@ -31,7 +31,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity; Assert.NotNull(playerEnt); - var alertsComponent = IoCManager.Resolve().GetComponent(playerEnt.Uid); + var alertsComponent = IoCManager.Resolve().GetComponent(playerEnt); Assert.NotNull(alertsComponent); // show 2 alerts @@ -51,7 +51,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs Assert.NotNull(local); var controlled = local.ControlledEntity; Assert.NotNull(controlled); - var alertsComponent = IoCManager.Resolve().GetComponent(controlled.Uid); + var alertsComponent = IoCManager.Resolve().GetComponent(controlled); Assert.NotNull(alertsComponent); // find the alertsui @@ -71,7 +71,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs { var playerEnt = serverPlayerManager.Sessions.Single().AttachedEntity; Assert.NotNull(playerEnt); - var alertsComponent = IoCManager.Resolve().GetComponent(playerEnt.Uid); + var alertsComponent = IoCManager.Resolve().GetComponent(playerEnt); Assert.NotNull(alertsComponent); alertsComponent.ClearAlert(AlertType.Debug1); @@ -86,7 +86,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Mobs Assert.NotNull(local); var controlled = local.ControlledEntity; Assert.NotNull(controlled); - var alertsComponent = IoCManager.Resolve().GetComponent(controlled.Uid); + var alertsComponent = IoCManager.Resolve().GetComponent(controlled); Assert.NotNull(alertsComponent); // find the alertsui diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs index 903dc5b20d..583db23cb5 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs @@ -55,13 +55,13 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement // Test for climb components existing // Players and tables should have these in their prototypes. ref ClimbingComponent? comp = ref climbing!; - Assert.That(IoCManager.Resolve().TryGetComponent(human.Uid, out comp), "Human has no climbing"); - Assert.That(IoCManager.Resolve().TryGetComponent(table.Uid, out ClimbableComponent? _), "Table has no climbable"); + Assert.That(IoCManager.Resolve().TryGetComponent(human, out comp), "Human has no climbing"); + Assert.That(IoCManager.Resolve().TryGetComponent(table, out ClimbableComponent? _), "Table has no climbable"); // Now let's make the player enter a climbing transitioning state. climbing.IsClimbing = true; - climbing.TryMoveTo(IoCManager.Resolve().GetComponent(human.Uid).WorldPosition, IoCManager.Resolve().GetComponent(table.Uid).WorldPosition); - var body = IoCManager.Resolve().GetComponent(human.Uid); + climbing.TryMoveTo(IoCManager.Resolve().GetComponent(human).WorldPosition, IoCManager.Resolve().GetComponent(table).WorldPosition); + var body = IoCManager.Resolve().GetComponent(human); // TODO: Check it's climbing // Force the player out of climb state. It should immediately remove the ClimbController. diff --git a/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs b/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs index 0d3fd65f70..9ced1f20f6 100644 --- a/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs +++ b/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs @@ -53,7 +53,7 @@ namespace Content.IntegrationTests.Tests.Gravity var coordinates = grid.ToCoordinates(); human = entityManager.SpawnEntity("HumanDummy", coordinates); - Assert.True(IoCManager.Resolve().TryGetComponent(human.Uid, out alerts)); + Assert.True(IoCManager.Resolve().TryGetComponent(human, out alerts)); }); // Let WeightlessSystem and GravitySystem tick @@ -64,7 +64,7 @@ namespace Content.IntegrationTests.Tests.Gravity // No gravity without a gravity generator Assert.True(alerts.IsShowingAlert(AlertType.Weightless)); - entityManager.SpawnEntity("GravityGeneratorDummy", IoCManager.Resolve().GetComponent(human.Uid).Coordinates); + entityManager.SpawnEntity("GravityGeneratorDummy", IoCManager.Resolve().GetComponent(human).Coordinates); }); // Let WeightlessSystem and GravitySystem tick diff --git a/Content.IntegrationTests/Tests/GravityGridTest.cs b/Content.IntegrationTests/Tests/GravityGridTest.cs index 51e3fd55ed..6f3784826d 100644 --- a/Content.IntegrationTests/Tests/GravityGridTest.cs +++ b/Content.IntegrationTests/Tests/GravityGridTest.cs @@ -50,18 +50,18 @@ namespace Content.IntegrationTests.Tests var entityMan = IoCManager.Resolve(); generator = entityMan.SpawnEntity("GravityGeneratorDummy", grid2.ToCoordinates()); - Assert.That(IoCManager.Resolve().HasComponent(generator.Uid)); - Assert.That(IoCManager.Resolve().HasComponent(generator.Uid)); + Assert.That(IoCManager.Resolve().HasComponent(generator)); + Assert.That(IoCManager.Resolve().HasComponent(generator)); - var powerComponent = IoCManager.Resolve().GetComponent(generator.Uid); + var powerComponent = IoCManager.Resolve().GetComponent(generator); powerComponent.NeedsPower = false; }); server.RunTicks(1); server.Assert(() => { - var generatorComponent = IoCManager.Resolve().GetComponent(generator.Uid); - var powerComponent = IoCManager.Resolve().GetComponent(generator.Uid); + var generatorComponent = IoCManager.Resolve().GetComponent(generator); + var powerComponent = IoCManager.Resolve().GetComponent(generator); Assert.That(generatorComponent.GravityActive, Is.True); @@ -69,8 +69,8 @@ namespace Content.IntegrationTests.Tests var grid1Entity = entityMan.GetEntity(grid1.GridEntityId); var grid2Entity = entityMan.GetEntity(grid2.GridEntityId); - Assert.That(!IoCManager.Resolve().GetComponent(grid1Entity.Uid).Enabled); - Assert.That(IoCManager.Resolve().GetComponent(grid2Entity.Uid).Enabled); + Assert.That(!IoCManager.Resolve().GetComponent(grid1Entity).Enabled); + Assert.That(IoCManager.Resolve().GetComponent(grid2Entity).Enabled); // Re-enable needs power so it turns off again. // Charge rate is ridiculously high so it finishes in one tick. @@ -79,14 +79,14 @@ namespace Content.IntegrationTests.Tests server.RunTicks(1); server.Assert(() => { - var generatorComponent = IoCManager.Resolve().GetComponent(generator.Uid); + var generatorComponent = IoCManager.Resolve().GetComponent(generator); Assert.That(generatorComponent.GravityActive, Is.False); var entityMan = IoCManager.Resolve(); var grid2Entity = entityMan.GetEntity(grid2.GridEntityId); - Assert.That(IoCManager.Resolve().GetComponent(grid2Entity.Uid).Enabled, Is.False); + Assert.That(IoCManager.Resolve().GetComponent(grid2Entity).Enabled, Is.False); }); await server.WaitIdleAsync(); diff --git a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs index bd7d547edc..6e421e64ef 100644 --- a/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs +++ b/Content.IntegrationTests/Tests/HumanInventoryUniformSlotsTest.cs @@ -81,7 +81,7 @@ namespace Content.IntegrationTests.Tests pocketItem = entityMan.SpawnEntity("FlashlightDummy", MapCoordinates.Nullspace); var tooBigItem = entityMan.SpawnEntity("ToolboxDummy", MapCoordinates.Nullspace); - inventory = IoCManager.Resolve().GetComponent(human.Uid); + inventory = IoCManager.Resolve().GetComponent(human); Assert.That(inventory.CanEquip(Slots.INNERCLOTHING, uniform)); @@ -123,7 +123,7 @@ namespace Content.IntegrationTests.Tests private static bool IsDescendant(IEntity descendant, IEntity parent) { - var tmpParent = IoCManager.Resolve().GetComponent(descendant.Uid).Parent; + var tmpParent = IoCManager.Resolve().GetComponent(descendant).Parent; while (tmpParent != null) { if (tmpParent.Owner == parent) diff --git a/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs b/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs index c272aacd2f..b1a5e4288a 100644 --- a/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs +++ b/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs @@ -85,20 +85,20 @@ namespace Content.IntegrationTests.Tests.Interaction.Click var interactHand = false; server.Assert(() => { - testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target.Uid)); attack = true; }; + testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target)); attack = true; }; testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; }; testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; }; - interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, false, target.Uid); - interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); + interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target).Coordinates, false, target); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target).Coordinates, target); Assert.That(attack); Assert.That(interactUsing, Is.False); Assert.That(interactHand); - Assert.That(IoCManager.Resolve().TryGetComponent(user.Uid, out var hands)); - Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); + Assert.That(IoCManager.Resolve().TryGetComponent(user, out var hands)); + Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item))); - interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target).Coordinates, target); Assert.That(interactUsing); }); @@ -143,7 +143,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click target = entityManager.SpawnEntity(null, new MapCoordinates((1.9f, 0), mapId)); item = entityManager.SpawnEntity(null, coords); item.EnsureComponent(); - wall = entityManager.SpawnEntity("DummyDebugWall", new MapCoordinates((1, 0), IoCManager.Resolve().GetComponent(user.Uid).MapID)); + wall = entityManager.SpawnEntity("DummyDebugWall", new MapCoordinates((1, 0), IoCManager.Resolve().GetComponent(user).MapID)); }); await server.WaitRunTicks(1); @@ -157,20 +157,20 @@ namespace Content.IntegrationTests.Tests.Interaction.Click var interactHand = false; server.Assert(() => { - testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target.Uid)); attack = true; }; + testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target)); attack = true; }; testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; }; testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; }; - interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, false, target.Uid); - interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); + interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target).Coordinates, false, target); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target).Coordinates, target); Assert.That(attack, Is.False); Assert.That(interactUsing, Is.False); Assert.That(interactHand, Is.False); - Assert.That(IoCManager.Resolve().TryGetComponent(user.Uid, out var hands)); - Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); + Assert.That(IoCManager.Resolve().TryGetComponent(user, out var hands)); + Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item))); - interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target).Coordinates, target); Assert.That(interactUsing, Is.False); }); @@ -226,20 +226,20 @@ namespace Content.IntegrationTests.Tests.Interaction.Click var interactHand = false; server.Assert(() => { - testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target.Uid)); attack = true; }; + testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target)); attack = true; }; testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; }; testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; }; - interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, false, target.Uid); - interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); + interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target).Coordinates, false, target); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target).Coordinates, target); Assert.That(attack); Assert.That(interactUsing, Is.False); Assert.That(interactHand); - Assert.That(IoCManager.Resolve().TryGetComponent(user.Uid, out var hands)); - Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); + Assert.That(IoCManager.Resolve().TryGetComponent(user, out var hands)); + Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item))); - interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target).Coordinates, target); Assert.That(interactUsing); }); @@ -296,20 +296,20 @@ namespace Content.IntegrationTests.Tests.Interaction.Click var interactHand = false; server.Assert(() => { - testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target.Uid)); attack = true; }; + testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(target)); attack = true; }; testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactUsing = true; }; testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(target)); interactHand = true; }; - interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, false, target.Uid); - interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); + interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target).Coordinates, false, target); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target).Coordinates, target); Assert.That(attack, Is.False); Assert.That(interactUsing, Is.False); Assert.That(interactHand, Is.False); - Assert.That(IoCManager.Resolve().TryGetComponent(user.Uid, out var hands)); - Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); + Assert.That(IoCManager.Resolve().TryGetComponent(user, out var hands)); + Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item))); - interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target).Coordinates, target); Assert.That(interactUsing, Is.False); }); @@ -373,31 +373,31 @@ namespace Content.IntegrationTests.Tests.Interaction.Click server.Assert(() => { Assert.That(container.Insert(user)); - Assert.That(IoCManager.Resolve().GetComponent(user.Uid).Parent.Owner, Is.EqualTo(containerEntity)); + Assert.That(IoCManager.Resolve().GetComponent(user).Parent.Owner, Is.EqualTo(containerEntity)); - testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity.Uid)); attack = true; }; + testInteractionSystem.AttackEvent = (_, _, ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity)); attack = true; }; testInteractionSystem.InteractUsingEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity)); interactUsing = true; }; testInteractionSystem.InteractHandEvent = (ev) => { Assert.That(ev.Target, Is.EqualTo(containerEntity)); interactHand = true; }; - interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, false, target.Uid); - interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); + interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(target).Coordinates, false, target); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target).Coordinates, target); Assert.That(attack, Is.False); Assert.That(interactUsing, Is.False); Assert.That(interactHand, Is.False); - interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(containerEntity.Uid).Coordinates, false, containerEntity.Uid); - interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(containerEntity.Uid).Coordinates, containerEntity.Uid); + interactionSystem.DoAttack(user, IoCManager.Resolve().GetComponent(containerEntity).Coordinates, false, containerEntity); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(containerEntity).Coordinates, containerEntity); Assert.That(attack); Assert.That(interactUsing, Is.False); Assert.That(interactHand); - Assert.That(IoCManager.Resolve().TryGetComponent(user.Uid, out var hands)); - Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item.Uid))); + Assert.That(IoCManager.Resolve().TryGetComponent(user, out var hands)); + Assert.That(hands.PutInHand(IoCManager.Resolve().GetComponent(item))); - interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target.Uid).Coordinates, target.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(target).Coordinates, target); Assert.That(interactUsing, Is.False); - interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(containerEntity.Uid).Coordinates, containerEntity.Uid); + interactionSystem.UserInteraction(user, IoCManager.Resolve().GetComponent(containerEntity).Coordinates, containerEntity); Assert.That(interactUsing, Is.True); }); diff --git a/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs b/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs index 0f1cb446ad..4cb57aa744 100644 --- a/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs +++ b/Content.IntegrationTests/Tests/Interaction/InRangeUnobstructed.cs @@ -52,9 +52,9 @@ namespace Content.IntegrationTests.Tests.Interaction origin = entityManager.SpawnEntity(HumanId, coordinates); other = entityManager.SpawnEntity(HumanId, coordinates); container = ContainerHelpers.EnsureContainer(other, "InRangeUnobstructedTestOtherContainer"); - component = IoCManager.Resolve().GetComponent(other.Uid); - entityCoordinates = IoCManager.Resolve().GetComponent(other.Uid).Coordinates; - mapCoordinates = IoCManager.Resolve().GetComponent(other.Uid).MapPosition; + component = IoCManager.Resolve().GetComponent(other); + entityCoordinates = IoCManager.Resolve().GetComponent(other).Coordinates; + mapCoordinates = IoCManager.Resolve().GetComponent(other).MapPosition; }); await server.WaitIdleAsync(); @@ -83,7 +83,7 @@ namespace Content.IntegrationTests.Tests.Interaction // Move them slightly apart - IoCManager.Resolve().GetComponent(origin.Uid).LocalPosition += _interactionRangeDivided15X; + IoCManager.Resolve().GetComponent(origin).LocalPosition += _interactionRangeDivided15X; // Entity <-> Entity Assert.True(origin.InRangeUnobstructed(other)); @@ -107,7 +107,7 @@ namespace Content.IntegrationTests.Tests.Interaction // Move them out of range - IoCManager.Resolve().GetComponent(origin.Uid).LocalPosition += _interactionRangeDivided15X; + IoCManager.Resolve().GetComponent(origin).LocalPosition += _interactionRangeDivided15X; // Entity <-> Entity Assert.False(origin.InRangeUnobstructed(other)); diff --git a/Content.IntegrationTests/Tests/InventoryHelpersTest.cs b/Content.IntegrationTests/Tests/InventoryHelpersTest.cs index ffb2f13610..a952a8c0d1 100644 --- a/Content.IntegrationTests/Tests/InventoryHelpersTest.cs +++ b/Content.IntegrationTests/Tests/InventoryHelpersTest.cs @@ -62,7 +62,7 @@ namespace Content.IntegrationTests.Tests var entityMan = IoCManager.Resolve(); human = entityMan.SpawnEntity("InventoryStunnableDummy", MapCoordinates.Nullspace); - inventory = IoCManager.Resolve().GetComponent(human.Uid); + inventory = IoCManager.Resolve().GetComponent(human); // Can't do the test if this human doesn't have the slots for it. Assert.That(inventory.HasSlot(Slots.INNERCLOTHING)); @@ -72,9 +72,9 @@ namespace Content.IntegrationTests.Tests // Do we actually have the uniform equipped? Assert.That(inventory.TryGetSlotItem(Slots.INNERCLOTHING, out ItemComponent uniform)); - Assert.That(IoCManager.Resolve().GetComponent(uniform.Owner.Uid).EntityPrototype != null && IoCManager.Resolve().GetComponent(uniform.Owner.Uid).EntityPrototype.ID == "InventoryJumpsuitJanitorDummy"); + Assert.That(IoCManager.Resolve().GetComponent(uniform.Owner).EntityPrototype != null && IoCManager.Resolve().GetComponent(uniform.Owner).EntityPrototype.ID == "InventoryJumpsuitJanitorDummy"); - EntitySystem.Get().TryStun(human.Uid, TimeSpan.FromSeconds(1f)); + EntitySystem.Get().TryStun(human, TimeSpan.FromSeconds(1f)); // Since the mob is stunned, they can't equip this. Assert.That(inventory.SpawnItemInSlot(Slots.IDCARD, "InventoryIDCardDummy", true), Is.False); @@ -85,7 +85,7 @@ namespace Content.IntegrationTests.Tests // Let's try skipping the interaction check and see if it equips it! Assert.That(inventory.SpawnItemInSlot(Slots.IDCARD, "InventoryIDCardDummy")); Assert.That(inventory.TryGetSlotItem(Slots.IDCARD, out ItemComponent id)); - Assert.That(IoCManager.Resolve().GetComponent(id.Owner.Uid).EntityPrototype != null && IoCManager.Resolve().GetComponent(id.Owner.Uid).EntityPrototype.ID == "InventoryIDCardDummy"); + Assert.That(IoCManager.Resolve().GetComponent(id.Owner).EntityPrototype != null && IoCManager.Resolve().GetComponent(id.Owner).EntityPrototype.ID == "InventoryIDCardDummy"); }); await server.WaitIdleAsync(); diff --git a/Content.IntegrationTests/Tests/MindEntityDeletionTest.cs b/Content.IntegrationTests/Tests/MindEntityDeletionTest.cs index c8f80787b4..0c644afaf4 100644 --- a/Content.IntegrationTests/Tests/MindEntityDeletionTest.cs +++ b/Content.IntegrationTests/Tests/MindEntityDeletionTest.cs @@ -38,7 +38,7 @@ namespace Content.IntegrationTests.Tests mind = new Mind(player.UserId); mind.ChangeOwningPlayer(player.UserId); - mind.TransferTo(playerEnt.Uid); + mind.TransferTo(playerEnt); mind.Visit(visitEnt); Assert.That(player.AttachedEntity, Is.EqualTo(visitEnt)); @@ -49,12 +49,12 @@ namespace Content.IntegrationTests.Tests server.Assert(() => { - IoCManager.Resolve().DeleteEntity(visitEnt.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) visitEnt); Assert.That(mind.VisitingEntity, Is.Null); // This used to throw so make sure it doesn't. - IoCManager.Resolve().DeleteEntity(playerEnt.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) playerEnt); }); await server.WaitIdleAsync(); @@ -82,7 +82,7 @@ namespace Content.IntegrationTests.Tests mind = new Mind(player.UserId); mind.ChangeOwningPlayer(player.UserId); - mind.TransferTo(playerEnt.Uid); + mind.TransferTo(playerEnt); Assert.That(mind.CurrentEntity, Is.EqualTo(playerEnt)); }); @@ -91,14 +91,14 @@ namespace Content.IntegrationTests.Tests server.Post(() => { - IoCManager.Resolve().DeleteEntity(playerEnt.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) playerEnt); }); server.RunTicks(1); server.Assert(() => { - Assert.That(IoCManager.Resolve().EntityExists(mind.CurrentEntity.Uid), Is.True); + Assert.That(IoCManager.Resolve().EntityExists(mind.CurrentEntity), Is.True); }); await server.WaitIdleAsync(); @@ -131,7 +131,7 @@ namespace Content.IntegrationTests.Tests mind = new Mind(player.UserId); mind.ChangeOwningPlayer(player.UserId); - mind.TransferTo(playerEnt.Uid); + mind.TransferTo(playerEnt); Assert.That(mind.CurrentEntity, Is.EqualTo(playerEnt)); }); @@ -149,7 +149,7 @@ namespace Content.IntegrationTests.Tests server.Assert(() => { - Assert.That(IoCManager.Resolve().EntityExists(mind.CurrentEntity.Uid), Is.True); + Assert.That(IoCManager.Resolve().EntityExists(mind.CurrentEntity), Is.True); Assert.That(mind.CurrentEntity, Is.Not.EqualTo(playerEnt)); }); diff --git a/Content.IntegrationTests/Tests/Networking/ConnectTest.cs b/Content.IntegrationTests/Tests/Networking/ConnectTest.cs index 857397e6b3..4c3bb935fb 100644 --- a/Content.IntegrationTests/Tests/Networking/ConnectTest.cs +++ b/Content.IntegrationTests/Tests/Networking/ConnectTest.cs @@ -55,7 +55,8 @@ namespace Content.IntegrationTests.Tests.Networking var clEntityManager = client.ResolveDependency(); var svEntityManager = server.ResolveDependency(); - var lastSvEntity = svEntityManager.GetEntities().Last().Uid; + IEntity tempQualifier = svEntityManager.GetEntities().Last(); + var lastSvEntity = (EntityUid) tempQualifier; Assert.That(clEntityManager.GetComponent(lastSvEntity).Coordinates, Is.EqualTo(svEntityManager.GetComponent(lastSvEntity).Coordinates)); diff --git a/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs b/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs index 6b825a2e5d..2c7c1aa2fe 100644 --- a/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs +++ b/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs @@ -112,8 +112,8 @@ namespace Content.IntegrationTests.Tests.Networking await client.WaitPost(() => { - IEntity tempQualifier = cEntityManager.GetEntity(serverEnt.Uid); - clientComponent = IoCManager.Resolve().GetComponent(tempQualifier.Uid); + IEntity tempQualifier = cEntityManager.GetEntity(serverEnt); + clientComponent = IoCManager.Resolve().GetComponent(tempQualifier); }); Assert.That(clientComponent.Foo, Is.False); @@ -137,7 +137,7 @@ namespace Content.IntegrationTests.Tests.Networking { await client.WaitPost(() => { - cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt.Uid, true)); + cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, true)); Assert.That(clientComponent.Foo, Is.True); }); @@ -209,7 +209,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.Uid, false)); + cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, false)); Assert.That(clientComponent.Foo, Is.False); }); @@ -280,7 +280,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.Uid, false)); + cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, false)); Assert.That(clientComponent.Foo, Is.False); }); @@ -308,7 +308,7 @@ namespace Content.IntegrationTests.Tests.Networking // Send another event, to re-enable it. await client.WaitPost(() => { - cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt.Uid, true)); + cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, true)); Assert.That(clientComponent.Foo, Is.True); }); @@ -457,7 +457,7 @@ namespace Content.IntegrationTests.Tests.Networking private void HandleMessage(SetFooMessage message, EntitySessionEventArgs args) { var entity = EntityManager.GetEntity(message.Uid); - var component = IoCManager.Resolve().GetComponent(entity.Uid); + var component = IoCManager.Resolve().GetComponent(entity); var old = component.Foo; if (Allow) { diff --git a/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs b/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs index f847d9d5f7..a9a6db0289 100644 --- a/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs +++ b/Content.IntegrationTests/Tests/PDA/PDAExtensionsTests.cs @@ -70,16 +70,16 @@ namespace Content.IntegrationTests.Tests.PDA Assert.NotNull(id); // Put PDA in hand - var dummyPda = sEntityManager.SpawnEntity(PdaDummy, IoCManager.Resolve().GetComponent(player.Uid).MapPosition); - var pdaItemComponent = IoCManager.Resolve().GetComponent(dummyPda.Uid); - IoCManager.Resolve().GetComponent(player.Uid).PutInHand(pdaItemComponent); + var dummyPda = sEntityManager.SpawnEntity(PdaDummy, IoCManager.Resolve().GetComponent(player).MapPosition); + var pdaItemComponent = IoCManager.Resolve().GetComponent(dummyPda); + IoCManager.Resolve().GetComponent(player).PutInHand(pdaItemComponent); - var pdaComponent = IoCManager.Resolve().GetComponent(dummyPda.Uid); - var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, IoCManager.Resolve().GetComponent(player.Uid).MapPosition); + var pdaComponent = IoCManager.Resolve().GetComponent(dummyPda); + var pdaIdCard = sEntityManager.SpawnEntity(IdCardDummy, IoCManager.Resolve().GetComponent(player).MapPosition); - var itemSlots = IoCManager.Resolve().GetComponent(dummyPda.Uid); + var itemSlots = IoCManager.Resolve().GetComponent(dummyPda); sEntityManager.EntitySysManager.GetEntitySystem() - .TryInsert(dummyPda.Uid, pdaComponent.IdSlot, pdaIdCard); + .TryInsert(dummyPda, pdaComponent.IdSlot, pdaIdCard); var pdaContainedId = pdaComponent.ContainedID; // The PDA in the hand should be found first @@ -90,11 +90,11 @@ namespace Content.IntegrationTests.Tests.PDA Assert.That(id, Is.EqualTo(pdaContainedId)); // Put ID card in hand - var idDummy = sEntityManager.SpawnEntity(IdCardDummy, IoCManager.Resolve().GetComponent(player.Uid).MapPosition); - var idItemComponent = IoCManager.Resolve().GetComponent(idDummy.Uid); - IoCManager.Resolve().GetComponent(player.Uid).PutInHand(idItemComponent); + var idDummy = sEntityManager.SpawnEntity(IdCardDummy, IoCManager.Resolve().GetComponent(player).MapPosition); + var idItemComponent = IoCManager.Resolve().GetComponent(idDummy); + IoCManager.Resolve().GetComponent(player).PutInHand(idItemComponent); - var idCardComponent = IoCManager.Resolve().GetComponent(idDummy.Uid); + var idCardComponent = IoCManager.Resolve().GetComponent(idDummy); // The ID in the hand should be found first Assert.NotNull(player.GetHeldId()); @@ -103,7 +103,7 @@ namespace Content.IntegrationTests.Tests.PDA Assert.That(id, Is.EqualTo(idCardComponent)); // Remove all IDs and PDAs - var inventory = IoCManager.Resolve().GetComponent(player.Uid); + var inventory = IoCManager.Resolve().GetComponent(player); foreach (var slot in inventory.Slots) { @@ -114,13 +114,13 @@ namespace Content.IntegrationTests.Tests.PDA continue; } - if (IoCManager.Resolve().HasComponent(item.Owner.Uid)) + if (IoCManager.Resolve().HasComponent(item.Owner)) { inventory.ForceUnequip(slot); } } - var hands = IoCManager.Resolve().GetComponent(player.Uid); + var hands = IoCManager.Resolve().GetComponent(player); hands.Drop(dummyPda, false); hands.Drop(idDummy, false); diff --git a/Content.IntegrationTests/Tests/Power/PowerTest.cs b/Content.IntegrationTests/Tests/Power/PowerTest.cs index 942fc5e72a..4db6e18806 100644 --- a/Content.IntegrationTests/Tests/Power/PowerTest.cs +++ b/Content.IntegrationTests/Tests/Power/PowerTest.cs @@ -205,9 +205,9 @@ namespace Content.IntegrationTests.Tests.Power var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1)); var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2)); - supplier = IoCManager.Resolve().GetComponent(generatorEnt.Uid); - consumer1 = IoCManager.Resolve().GetComponent(consumerEnt1.Uid); - consumer2 = IoCManager.Resolve().GetComponent(consumerEnt2.Uid); + supplier = IoCManager.Resolve().GetComponent(generatorEnt); + consumer1 = IoCManager.Resolve().GetComponent(consumerEnt1); + consumer2 = IoCManager.Resolve().GetComponent(consumerEnt2); // Plenty of surplus and tolerance supplier.MaxSupply = loadPower * 4; @@ -259,9 +259,9 @@ namespace Content.IntegrationTests.Tests.Power var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1)); var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2)); - supplier = IoCManager.Resolve().GetComponent(generatorEnt.Uid); - consumer1 = IoCManager.Resolve().GetComponent(consumerEnt1.Uid); - consumer2 = IoCManager.Resolve().GetComponent(consumerEnt2.Uid); + supplier = IoCManager.Resolve().GetComponent(generatorEnt); + consumer1 = IoCManager.Resolve().GetComponent(consumerEnt1); + consumer2 = IoCManager.Resolve().GetComponent(consumerEnt2); // Too little supply, both consumers should get 33% power. supplier.MaxSupply = loadPower; @@ -306,8 +306,8 @@ namespace Content.IntegrationTests.Tests.Power var generatorEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates()); var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2)); - supplier = IoCManager.Resolve().GetComponent(generatorEnt.Uid); - consumer = IoCManager.Resolve().GetComponent(consumerEnt.Uid); + supplier = IoCManager.Resolve().GetComponent(generatorEnt); + consumer = IoCManager.Resolve().GetComponent(consumerEnt); // Supply has enough total power but needs to ramp up to match. supplier.MaxSupply = 400; @@ -376,9 +376,9 @@ namespace Content.IntegrationTests.Tests.Power var generatorEnt = _entityManager.SpawnEntity("DischargingBatteryDummy", grid.ToCoordinates()); var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2)); - netBattery = IoCManager.Resolve().GetComponent(generatorEnt.Uid); - battery = IoCManager.Resolve().GetComponent(generatorEnt.Uid); - consumer = IoCManager.Resolve().GetComponent(consumerEnt.Uid); + netBattery = IoCManager.Resolve().GetComponent(generatorEnt); + battery = IoCManager.Resolve().GetComponent(generatorEnt); + consumer = IoCManager.Resolve().GetComponent(consumerEnt); battery.MaxCharge = startingCharge; battery.CurrentCharge = startingCharge; @@ -454,9 +454,9 @@ namespace Content.IntegrationTests.Tests.Power var generatorEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates()); var batteryEnt = _entityManager.SpawnEntity("ChargingBatteryDummy", grid.ToCoordinates(0, 2)); - supplier = IoCManager.Resolve().GetComponent(generatorEnt.Uid); - var netBattery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); - battery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); + supplier = IoCManager.Resolve().GetComponent(generatorEnt); + var netBattery = IoCManager.Resolve().GetComponent(batteryEnt); + battery = IoCManager.Resolve().GetComponent(batteryEnt); supplier.MaxSupply = 500; supplier.SupplyRampTolerance = 500; @@ -499,16 +499,16 @@ namespace Content.IntegrationTests.Tests.Power } var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1)); - IoCManager.Resolve().GetComponent(terminal.Uid).LocalRotation = Angle.FromDegrees(180); + IoCManager.Resolve().GetComponent(terminal).LocalRotation = Angle.FromDegrees(180); var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2)); var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0)); var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3)); - consumer = IoCManager.Resolve().GetComponent(consumerEnt.Uid); - supplier = IoCManager.Resolve().GetComponent(supplyEnt.Uid); - netBattery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); - battery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); + consumer = IoCManager.Resolve().GetComponent(consumerEnt); + supplier = IoCManager.Resolve().GetComponent(supplyEnt); + netBattery = IoCManager.Resolve().GetComponent(batteryEnt); + battery = IoCManager.Resolve().GetComponent(batteryEnt); // Consumer needs 1000 W, supplier can only provide 800, battery fills in the remaining 200. consumer.DrawRate = 1000; @@ -567,16 +567,16 @@ namespace Content.IntegrationTests.Tests.Power } var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1)); - IoCManager.Resolve().GetComponent(terminal.Uid).LocalRotation = Angle.FromDegrees(180); + IoCManager.Resolve().GetComponent(terminal).LocalRotation = Angle.FromDegrees(180); var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2)); var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0)); var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3)); - consumer = IoCManager.Resolve().GetComponent(consumerEnt.Uid); - supplier = IoCManager.Resolve().GetComponent(supplyEnt.Uid); - netBattery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); - battery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); + consumer = IoCManager.Resolve().GetComponent(consumerEnt); + supplier = IoCManager.Resolve().GetComponent(supplyEnt); + netBattery = IoCManager.Resolve().GetComponent(batteryEnt); + battery = IoCManager.Resolve().GetComponent(batteryEnt); // Consumer needs 1000 W, supply and battery can only provide 400 each. // BUT the battery has 50% input efficiency, so 50% of the power of the supply gets lost. @@ -643,7 +643,7 @@ namespace Content.IntegrationTests.Tests.Power _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2)); var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2)); - IoCManager.Resolve().GetComponent(terminal.Uid).LocalRotation = Angle.FromDegrees(180); + IoCManager.Resolve().GetComponent(terminal).LocalRotation = Angle.FromDegrees(180); var batteryEnt1 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1)); var batteryEnt2 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3)); @@ -651,13 +651,13 @@ namespace Content.IntegrationTests.Tests.Power var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 0)); var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 4)); - consumer1 = IoCManager.Resolve().GetComponent(consumerEnt1.Uid); - consumer2 = IoCManager.Resolve().GetComponent(consumerEnt2.Uid); - supplier = IoCManager.Resolve().GetComponent(supplyEnt.Uid); - var netBattery1 = IoCManager.Resolve().GetComponent(batteryEnt1.Uid); - var netBattery2 = IoCManager.Resolve().GetComponent(batteryEnt2.Uid); - var battery1 = IoCManager.Resolve().GetComponent(batteryEnt1.Uid); - var battery2 = IoCManager.Resolve().GetComponent(batteryEnt2.Uid); + consumer1 = IoCManager.Resolve().GetComponent(consumerEnt1); + consumer2 = IoCManager.Resolve().GetComponent(consumerEnt2); + supplier = IoCManager.Resolve().GetComponent(supplyEnt); + var netBattery1 = IoCManager.Resolve().GetComponent(batteryEnt1); + var netBattery2 = IoCManager.Resolve().GetComponent(batteryEnt2); + var battery1 = IoCManager.Resolve().GetComponent(batteryEnt1); + var battery2 = IoCManager.Resolve().GetComponent(batteryEnt2); // There are two loads, 500 W and 1000 W respectively. // The 500 W load is behind a 50% efficient battery, @@ -730,7 +730,7 @@ namespace Content.IntegrationTests.Tests.Power _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2)); var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 2)); - IoCManager.Resolve().GetComponent(terminal.Uid).LocalRotation = Angle.FromDegrees(180); + IoCManager.Resolve().GetComponent(terminal).LocalRotation = Angle.FromDegrees(180); var batteryEnt1 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 1)); var batteryEnt2 = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 3)); @@ -738,13 +738,13 @@ namespace Content.IntegrationTests.Tests.Power var consumerEnt1 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 0)); var consumerEnt2 = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 4)); - consumer1 = IoCManager.Resolve().GetComponent(consumerEnt1.Uid); - consumer2 = IoCManager.Resolve().GetComponent(consumerEnt2.Uid); - supplier = IoCManager.Resolve().GetComponent(supplyEnt.Uid); - var netBattery1 = IoCManager.Resolve().GetComponent(batteryEnt1.Uid); - var netBattery2 = IoCManager.Resolve().GetComponent(batteryEnt2.Uid); - var battery1 = IoCManager.Resolve().GetComponent(batteryEnt1.Uid); - var battery2 = IoCManager.Resolve().GetComponent(batteryEnt2.Uid); + consumer1 = IoCManager.Resolve().GetComponent(consumerEnt1); + consumer2 = IoCManager.Resolve().GetComponent(consumerEnt2); + supplier = IoCManager.Resolve().GetComponent(supplyEnt); + var netBattery1 = IoCManager.Resolve().GetComponent(batteryEnt1); + var netBattery2 = IoCManager.Resolve().GetComponent(batteryEnt2); + var battery1 = IoCManager.Resolve().GetComponent(batteryEnt1); + var battery2 = IoCManager.Resolve().GetComponent(batteryEnt2); consumer1.DrawRate = 500; consumer2.DrawRate = 1000; @@ -800,16 +800,16 @@ namespace Content.IntegrationTests.Tests.Power } var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1)); - IoCManager.Resolve().GetComponent(terminal.Uid).LocalRotation = Angle.FromDegrees(180); + IoCManager.Resolve().GetComponent(terminal).LocalRotation = Angle.FromDegrees(180); var batteryEnt = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2)); var supplyEnt = _entityManager.SpawnEntity("GeneratorDummy", grid.ToCoordinates(0, 0)); var consumerEnt = _entityManager.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 3)); - consumer = IoCManager.Resolve().GetComponent(consumerEnt.Uid); - supplier = IoCManager.Resolve().GetComponent(supplyEnt.Uid); - netBattery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); - var battery = IoCManager.Resolve().GetComponent(batteryEnt.Uid); + consumer = IoCManager.Resolve().GetComponent(consumerEnt); + supplier = IoCManager.Resolve().GetComponent(supplyEnt); + netBattery = IoCManager.Resolve().GetComponent(batteryEnt); + var battery = IoCManager.Resolve().GetComponent(batteryEnt); // Consumer needs 1000 W, supplier can only provide 800, battery fills in the remaining 200. consumer.DrawRate = 1000; @@ -879,13 +879,13 @@ namespace Content.IntegrationTests.Tests.Power var rightEnt = _entityManager.SpawnEntity("CableHV", grid.ToCoordinates(0, 3)); var terminal = _entityManager.SpawnEntity("CableTerminal", grid.ToCoordinates(0, 1)); - IoCManager.Resolve().GetComponent(terminal.Uid).LocalRotation = Angle.FromDegrees(180); + IoCManager.Resolve().GetComponent(terminal).LocalRotation = Angle.FromDegrees(180); var battery = _entityManager.SpawnEntity("FullBatteryDummy", grid.ToCoordinates(0, 2)); - var batteryNodeContainer = IoCManager.Resolve().GetComponent(battery.Uid); + var batteryNodeContainer = IoCManager.Resolve().GetComponent(battery); - leftNode = IoCManager.Resolve().GetComponent(leftEnt.Uid).GetNode("power"); - rightNode = IoCManager.Resolve().GetComponent(rightEnt.Uid).GetNode("power"); + leftNode = IoCManager.Resolve().GetComponent(leftEnt).GetNode("power"); + rightNode = IoCManager.Resolve().GetComponent(rightEnt).GetNode("power"); batteryInput = batteryNodeContainer.GetNode("input"); batteryOutput = batteryNodeContainer.GetNode("output"); @@ -931,9 +931,9 @@ namespace Content.IntegrationTests.Tests.Power var substationEnt = _entityManager.SpawnEntity("SubstationDummy", grid.ToCoordinates(0, 1)); var apcEnt = _entityManager.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 2)); - var generatorSupplier = IoCManager.Resolve().GetComponent(generatorEnt.Uid); - substationNetBattery = IoCManager.Resolve().GetComponent(substationEnt.Uid); - apcBattery = IoCManager.Resolve().GetComponent(apcEnt.Uid); + var generatorSupplier = IoCManager.Resolve().GetComponent(generatorEnt); + substationNetBattery = IoCManager.Resolve().GetComponent(substationEnt); + apcBattery = IoCManager.Resolve().GetComponent(apcEnt); generatorSupplier.MaxSupply = 1000; generatorSupplier.SupplyRampTolerance = 1000; @@ -973,12 +973,12 @@ namespace Content.IntegrationTests.Tests.Power var apcExtensionEnt = _entityManager.SpawnEntity("CableApcExtension", grid.ToCoordinates(0, 0)); var powerReceiverEnt = _entityManager.SpawnEntity("ApcPowerReceiverDummy", grid.ToCoordinates(0, 2)); - receiver = IoCManager.Resolve().GetComponent(powerReceiverEnt.Uid); - var battery = IoCManager.Resolve().GetComponent(apcEnt.Uid); - apcNetBattery = IoCManager.Resolve().GetComponent(apcEnt.Uid); + receiver = IoCManager.Resolve().GetComponent(powerReceiverEnt); + var battery = IoCManager.Resolve().GetComponent(apcEnt); + apcNetBattery = IoCManager.Resolve().GetComponent(apcEnt); - _extensionCableSystem.SetProviderTransferRange(apcExtensionEnt.Uid, 5); - _extensionCableSystem.SetReceiverReceptionRange(powerReceiverEnt.Uid, 5); + _extensionCableSystem.SetProviderTransferRange(apcExtensionEnt, 5); + _extensionCableSystem.SetReceiverReceptionRange(powerReceiverEnt, 5); battery.MaxCharge = 10000; //arbitrary nonzero amount of charge battery.CurrentCharge = battery.MaxCharge; //fill battery diff --git a/Content.IntegrationTests/Tests/SaveLoadMapTest.cs b/Content.IntegrationTests/Tests/SaveLoadMapTest.cs index 7d4cd21d70..4ca9802ba9 100644 --- a/Content.IntegrationTests/Tests/SaveLoadMapTest.cs +++ b/Content.IntegrationTests/Tests/SaveLoadMapTest.cs @@ -40,13 +40,13 @@ namespace Content.IntegrationTests.Tests { var mapGrid = mapManager.CreateGrid(mapId); var mapGridEnt = entityManager.GetEntity(mapGrid.GridEntityId); - IoCManager.Resolve().GetComponent(mapGridEnt.Uid).WorldPosition = new Vector2(10, 10); + IoCManager.Resolve().GetComponent(mapGridEnt).WorldPosition = new Vector2(10, 10); mapGrid.SetTile(new Vector2i(0,0), new Tile(1, 512)); } { var mapGrid = mapManager.CreateGrid(mapId); var mapGridEnt = entityManager.GetEntity(mapGrid.GridEntityId); - IoCManager.Resolve().GetComponent(mapGridEnt.Uid).WorldPosition = new Vector2(-8, -8); + IoCManager.Resolve().GetComponent(mapGridEnt).WorldPosition = new Vector2(-8, -8); mapGrid.SetTile(new Vector2i(0, 0), new Tile(2, 511)); } diff --git a/Content.IntegrationTests/Tests/ShuttleTest.cs b/Content.IntegrationTests/Tests/ShuttleTest.cs index 6a91090b56..eb939bd8e9 100644 --- a/Content.IntegrationTests/Tests/ShuttleTest.cs +++ b/Content.IntegrationTests/Tests/ShuttleTest.cs @@ -31,10 +31,10 @@ namespace Content.IntegrationTests.Tests var grid = mapMan.CreateGrid(mapId); gridEnt = entMan.GetEntity(grid.GridEntityId); - Assert.That(IoCManager.Resolve().TryGetComponent(gridEnt.Uid, out ShuttleComponent? shuttleComponent)); - Assert.That(IoCManager.Resolve().TryGetComponent(gridEnt.Uid, out PhysicsComponent? physicsComponent)); + Assert.That(IoCManager.Resolve().TryGetComponent(gridEnt, out ShuttleComponent? shuttleComponent)); + Assert.That(IoCManager.Resolve().TryGetComponent(gridEnt, out PhysicsComponent? physicsComponent)); Assert.That(physicsComponent!.BodyType, Is.EqualTo(BodyType.Dynamic)); - Assert.That(IoCManager.Resolve().GetComponent(gridEnt.Uid).LocalPosition, Is.EqualTo(Vector2.Zero)); + Assert.That(IoCManager.Resolve().GetComponent(gridEnt).LocalPosition, Is.EqualTo(Vector2.Zero)); physicsComponent.ApplyLinearImpulse(Vector2.One); }); @@ -44,7 +44,7 @@ namespace Content.IntegrationTests.Tests await server.WaitAssertion(() => { - Assert.That((gridEnt != null ? IoCManager.Resolve().GetComponent(gridEnt.Uid) : null).LocalPosition, Is.Not.EqualTo(Vector2.Zero)); + Assert.That((gridEnt != null ? IoCManager.Resolve().GetComponent(gridEnt) : null).LocalPosition, Is.Not.EqualTo(Vector2.Zero)); }); } } diff --git a/Content.IntegrationTests/Tests/Tag/TagTest.cs b/Content.IntegrationTests/Tests/Tag/TagTest.cs index 1d1cabb746..51de1b767e 100644 --- a/Content.IntegrationTests/Tests/Tag/TagTest.cs +++ b/Content.IntegrationTests/Tests/Tag/TagTest.cs @@ -61,7 +61,7 @@ namespace Content.IntegrationTests.Tests.Tag { sMapManager.CreateNewMapEntity(MapId.Nullspace); sTagDummy = sEntityManager.SpawnEntity(TagEntityId, MapCoordinates.Nullspace); - sTagComponent = IoCManager.Resolve().GetComponent(sTagDummy.Uid); + sTagComponent = IoCManager.Resolve().GetComponent(sTagDummy); }); await server.WaitAssertion(() => diff --git a/Content.IntegrationTests/Tests/Utility/EntitySystemExtensionsTest.cs b/Content.IntegrationTests/Tests/Utility/EntitySystemExtensionsTest.cs index d93ea05719..9e9dabd26a 100644 --- a/Content.IntegrationTests/Tests/Utility/EntitySystemExtensionsTest.cs +++ b/Content.IntegrationTests/Tests/Utility/EntitySystemExtensionsTest.cs @@ -47,7 +47,7 @@ namespace Content.IntegrationTests.Tests.Utility { var grid = GetMainGrid(sMapManager); var gridEnt = sEntityManager.GetEntity(grid.GridEntityId); - var gridPos = IoCManager.Resolve().GetComponent(gridEnt.Uid).WorldPosition; + var gridPos = IoCManager.Resolve().GetComponent(gridEnt).WorldPosition; var entityCoordinates = GetMainEntityCoordinates(sMapManager); // Nothing blocking it, only entity is the grid diff --git a/Content.IntegrationTests/Tests/Utility/EntityWhitelistTest.cs b/Content.IntegrationTests/Tests/Utility/EntityWhitelistTest.cs index a64bee8bab..d15e392c34 100644 --- a/Content.IntegrationTests/Tests/Utility/EntityWhitelistTest.cs +++ b/Content.IntegrationTests/Tests/Utility/EntityWhitelistTest.cs @@ -73,11 +73,15 @@ namespace Content.IntegrationTests.Tests.Utility var mapId = GetMainMapId(mapManager); var mapCoordinates = new MapCoordinates(0, 0, mapId); - var validComponent = entityManager.SpawnEntity("ValidComponentDummy", mapCoordinates).Uid; - var validTag = entityManager.SpawnEntity("ValidTagDummy", mapCoordinates).Uid; + IEntity tempQualifier = entityManager.SpawnEntity("ValidComponentDummy", mapCoordinates); + var validComponent = (EntityUid) tempQualifier; + IEntity tempQualifier1 = entityManager.SpawnEntity("ValidTagDummy", mapCoordinates); + var validTag = (EntityUid) tempQualifier1; - var invalidComponent = entityManager.SpawnEntity("InvalidComponentDummy", mapCoordinates).Uid; - var invalidTag = entityManager.SpawnEntity("InvalidTagDummy", mapCoordinates).Uid; + IEntity tempQualifier2 = entityManager.SpawnEntity("InvalidComponentDummy", mapCoordinates); + var invalidComponent = (EntityUid) tempQualifier2; + IEntity tempQualifier3 = entityManager.SpawnEntity("InvalidTagDummy", mapCoordinates); + var invalidTag = (EntityUid) tempQualifier3; // Test instantiated on its own var whitelistInst = new EntityWhitelist @@ -99,7 +103,7 @@ namespace Content.IntegrationTests.Tests.Utility // Test from serialized var dummy = entityManager.SpawnEntity("WhitelistDummy", mapCoordinates); - var whitelistSer = IoCManager.Resolve().GetComponent(dummy.Uid).Slots.Values.First().Whitelist; + var whitelistSer = IoCManager.Resolve().GetComponent(dummy).Slots.Values.First().Whitelist; Assert.That(whitelistSer, Is.Not.Null); Assert.That(whitelistSer.Components, Is.Not.Null); diff --git a/Content.Server/AI/Commands/AddAiCommand.cs b/Content.Server/AI/Commands/AddAiCommand.cs index 58fa5bc8ea..8fb5a74fe9 100644 --- a/Content.Server/AI/Commands/AddAiCommand.cs +++ b/Content.Server/AI/Commands/AddAiCommand.cs @@ -35,16 +35,16 @@ namespace Content.Server.AI.Commands return; } - if (IoCManager.Resolve().HasComponent(ent.Uid)) + if (IoCManager.Resolve().HasComponent(ent)) { shell.WriteLine("Entity already has an AI component."); return; } // TODO: IMover refffaaccctttooorrr - if (IoCManager.Resolve().HasComponent(ent.Uid)) + if (IoCManager.Resolve().HasComponent(ent)) { - IoCManager.Resolve().RemoveComponent(ent.Uid); + IoCManager.Resolve().RemoveComponent(ent); } var comp = IoCManager.Resolve().AddComponent(ent); diff --git a/Content.Server/AI/Components/AiControllerComponent.cs b/Content.Server/AI/Components/AiControllerComponent.cs index a81cf32512..ca4c4b7af8 100644 --- a/Content.Server/AI/Components/AiControllerComponent.cs +++ b/Content.Server/AI/Components/AiControllerComponent.cs @@ -61,7 +61,7 @@ namespace Content.Server.AI.Components { get { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out MovementSpeedModifierComponent? component)) + if (IoCManager.Resolve().TryGetComponent(Owner, out MovementSpeedModifierComponent? component)) { return component.CurrentWalkSpeed; } @@ -78,7 +78,7 @@ namespace Content.Server.AI.Components { get { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out MovementSpeedModifierComponent? component)) + if (IoCManager.Resolve().TryGetComponent(Owner, out MovementSpeedModifierComponent? component)) { return component.CurrentSprintSpeed; } diff --git a/Content.Server/AI/EntitySystems/AiFactionTagSystem.cs b/Content.Server/AI/EntitySystems/AiFactionTagSystem.cs index e499206f86..adf2a0d2c5 100644 --- a/Content.Server/AI/EntitySystems/AiFactionTagSystem.cs +++ b/Content.Server/AI/EntitySystems/AiFactionTagSystem.cs @@ -55,7 +55,7 @@ namespace Content.Server.AI.EntitySystems public Faction GetHostileFactions(Faction faction) => _hostileFactions.TryGetValue(faction, out var hostiles) ? hostiles : Faction.None; public Faction GetFactions(IEntity entity) => - IoCManager.Resolve().TryGetComponent(entity.Uid, out AiFactionTagComponent? factionTags) + IoCManager.Resolve().TryGetComponent(entity, out AiFactionTagComponent? factionTags) ? factionTags.Factions : Faction.None; @@ -72,9 +72,9 @@ namespace Content.Server.AI.EntitySystems { if ((component.Factions & hostile) == 0) continue; - if (IoCManager.Resolve().GetComponent(component.Owner.Uid).MapID != IoCManager.Resolve().GetComponent(entity.Uid).MapID) + if (IoCManager.Resolve().GetComponent(component.Owner).MapID != IoCManager.Resolve().GetComponent(entity).MapID) continue; - if (!IoCManager.Resolve().GetComponent(component.Owner.Uid).MapPosition.InRange(IoCManager.Resolve().GetComponent(entity.Uid).MapPosition, range)) + if (!IoCManager.Resolve().GetComponent(component.Owner).MapPosition.InRange(IoCManager.Resolve().GetComponent(entity).MapPosition, range)) continue; yield return component.Owner; diff --git a/Content.Server/AI/EntitySystems/AiSystem.cs b/Content.Server/AI/EntitySystems/AiSystem.cs index 86d2b1bb77..3e682e47ef 100644 --- a/Content.Server/AI/EntitySystems/AiSystem.cs +++ b/Content.Server/AI/EntitySystems/AiSystem.cs @@ -51,8 +51,8 @@ namespace Content.Server.AI.EntitySystems foreach (var message in _queuedMobStateMessages) { // TODO: Need to generecise this but that will be part of a larger cleanup later anyway. - if ((!IoCManager.Resolve().EntityExists(message.Entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(message.Entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || - !IoCManager.Resolve().TryGetComponent(message.Entity.Uid, out UtilityAi? controller)) + if ((!IoCManager.Resolve().EntityExists(message.Entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(message.Entity).EntityLifeStage) >= EntityLifeStage.Deleted || + !IoCManager.Resolve().TryGetComponent(message.Entity, out UtilityAi? controller)) { continue; } @@ -122,7 +122,7 @@ namespace Content.Server.AI.EntitySystems private void MobStateChanged(MobStateChangedMessage message) { - if (!IoCManager.Resolve().HasComponent(message.Entity.Uid)) + if (!IoCManager.Resolve().HasComponent(message.Entity)) { return; } diff --git a/Content.Server/AI/LoadBalancer/AiActionRequestJob.cs b/Content.Server/AI/LoadBalancer/AiActionRequestJob.cs index 8cb7f356e1..8594dc5eb7 100644 --- a/Content.Server/AI/LoadBalancer/AiActionRequestJob.cs +++ b/Content.Server/AI/LoadBalancer/AiActionRequestJob.cs @@ -39,7 +39,7 @@ namespace Content.Server.AI.LoadBalancer var entity = _request.Context.GetState().GetValue(); - if (entity == null || !IoCManager.Resolve().HasComponent(entity.Uid)) + if (entity == null || !IoCManager.Resolve().HasComponent(entity)) { return null; } @@ -124,7 +124,7 @@ namespace Content.Server.AI.LoadBalancer DebugTools.AssertNotNull(selfState); FoundAction?.Invoke(new SharedAiDebug.UtilityAiDebugMessage( - selfState!.Uid, + selfState!, DebugTime, cutoff, foundAction.GetType().Name, diff --git a/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs b/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs index df991f69bc..89c5186d23 100644 --- a/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs +++ b/Content.Server/AI/Operators/Combat/Melee/SwingMeleeWeaponOperator.cs @@ -29,7 +29,7 @@ namespace Content.Server.AI.Operators.Combat.Melee return true; } - if (!IoCManager.Resolve().TryGetComponent(_owner.Uid, out CombatModeComponent? combatModeComponent)) + if (!IoCManager.Resolve().TryGetComponent(_owner, out CombatModeComponent? combatModeComponent)) { return false; } @@ -47,7 +47,7 @@ namespace Content.Server.AI.Operators.Combat.Melee if (!base.Shutdown(outcome)) return false; - if (IoCManager.Resolve().TryGetComponent(_owner.Uid, out CombatModeComponent? combatModeComponent)) + if (IoCManager.Resolve().TryGetComponent(_owner, out CombatModeComponent? combatModeComponent)) { combatModeComponent.IsInCombatMode = false; } @@ -62,15 +62,15 @@ namespace Content.Server.AI.Operators.Combat.Melee return Outcome.Success; } - if (!IoCManager.Resolve().TryGetComponent(_owner.Uid, out HandsComponent? hands) || hands.GetActiveHand == null) + if (!IoCManager.Resolve().TryGetComponent(_owner, out HandsComponent? hands) || hands.GetActiveHand == null) { return Outcome.Failed; } var meleeWeapon = hands.GetActiveHand.Owner; - IoCManager.Resolve().TryGetComponent(meleeWeapon.Uid, out MeleeWeaponComponent? meleeWeaponComponent); + IoCManager.Resolve().TryGetComponent(meleeWeapon, out MeleeWeaponComponent? meleeWeaponComponent); - if ((IoCManager.Resolve().GetComponent(_target.Uid).Coordinates.Position - IoCManager.Resolve().GetComponent(_owner.Uid).Coordinates.Position).Length > + if ((IoCManager.Resolve().GetComponent(_target).Coordinates.Position - IoCManager.Resolve().GetComponent(_owner).Coordinates.Position).Length > meleeWeaponComponent?.Range) { return Outcome.Failed; @@ -78,7 +78,7 @@ namespace Content.Server.AI.Operators.Combat.Melee var interactionSystem = IoCManager.Resolve().GetEntitySystem(); - interactionSystem.AiUseInteraction(_owner, IoCManager.Resolve().GetComponent(_target.Uid).Coordinates, _target.Uid); + interactionSystem.AiUseInteraction(_owner, IoCManager.Resolve().GetComponent(_target).Coordinates, _target); _elapsedTime += frameTime; return Outcome.Continuing; } diff --git a/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs b/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs index 9b09fe37eb..d08aee2254 100644 --- a/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs +++ b/Content.Server/AI/Operators/Combat/Melee/UnarmedCombatOperator.cs @@ -29,7 +29,7 @@ namespace Content.Server.AI.Operators.Combat.Melee return true; } - if (!IoCManager.Resolve().TryGetComponent(_owner.Uid, out CombatModeComponent? combatModeComponent)) + if (!IoCManager.Resolve().TryGetComponent(_owner, out CombatModeComponent? combatModeComponent)) { return false; } @@ -39,7 +39,7 @@ namespace Content.Server.AI.Operators.Combat.Melee combatModeComponent.IsInCombatMode = true; } - if (IoCManager.Resolve().TryGetComponent(_owner.Uid, out UnarmedCombatComponent? unarmedCombatComponent)) + if (IoCManager.Resolve().TryGetComponent(_owner, out UnarmedCombatComponent? unarmedCombatComponent)) { _unarmedCombat = unarmedCombatComponent; } @@ -56,7 +56,7 @@ namespace Content.Server.AI.Operators.Combat.Melee if (!base.Shutdown(outcome)) return false; - if (IoCManager.Resolve().TryGetComponent(_owner.Uid, out CombatModeComponent? combatModeComponent)) + if (IoCManager.Resolve().TryGetComponent(_owner, out CombatModeComponent? combatModeComponent)) { combatModeComponent.IsInCombatMode = false; } @@ -76,14 +76,14 @@ namespace Content.Server.AI.Operators.Combat.Melee return Outcome.Failed; } - if ((IoCManager.Resolve().GetComponent(_target.Uid).Coordinates.Position - IoCManager.Resolve().GetComponent(_owner.Uid).Coordinates.Position).Length > + if ((IoCManager.Resolve().GetComponent(_target).Coordinates.Position - IoCManager.Resolve().GetComponent(_owner).Coordinates.Position).Length > _unarmedCombat.Range) { return Outcome.Failed; } var interactionSystem = IoCManager.Resolve().GetEntitySystem(); - interactionSystem.AiUseInteraction(_owner, IoCManager.Resolve().GetComponent(_target.Uid).Coordinates, _target.Uid); + interactionSystem.AiUseInteraction(_owner, IoCManager.Resolve().GetComponent(_target).Coordinates, _target); _elapsedTime += frameTime; return Outcome.Continuing; } diff --git a/Content.Server/AI/Operators/Inventory/CloseStorageOperator.cs b/Content.Server/AI/Operators/Inventory/CloseStorageOperator.cs index 30356b7174..2cb31f716c 100644 --- a/Content.Server/AI/Operators/Inventory/CloseStorageOperator.cs +++ b/Content.Server/AI/Operators/Inventory/CloseStorageOperator.cs @@ -59,7 +59,7 @@ namespace Content.Server.AI.Operators.Inventory return Outcome.Failed; } - if (!IoCManager.Resolve().TryGetComponent(_target.Uid, out EntityStorageComponent? storageComponent) || + if (!IoCManager.Resolve().TryGetComponent(_target, out EntityStorageComponent? storageComponent) || storageComponent.IsWeldedShut) { return Outcome.Failed; diff --git a/Content.Server/AI/Operators/Inventory/DropEntityOperator.cs b/Content.Server/AI/Operators/Inventory/DropEntityOperator.cs index 67bcba2ee2..c123bcd28a 100644 --- a/Content.Server/AI/Operators/Inventory/DropEntityOperator.cs +++ b/Content.Server/AI/Operators/Inventory/DropEntityOperator.cs @@ -21,7 +21,7 @@ namespace Content.Server.AI.Operators.Inventory /// public override Outcome Execute(float frameTime) { - if (!IoCManager.Resolve().TryGetComponent(_owner.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(_owner, out HandsComponent? handsComponent)) { return Outcome.Failed; } diff --git a/Content.Server/AI/Operators/Inventory/DropHandItemsOperator.cs b/Content.Server/AI/Operators/Inventory/DropHandItemsOperator.cs index d36406246c..e35b11bd57 100644 --- a/Content.Server/AI/Operators/Inventory/DropHandItemsOperator.cs +++ b/Content.Server/AI/Operators/Inventory/DropHandItemsOperator.cs @@ -15,7 +15,7 @@ namespace Content.Server.AI.Operators.Inventory public override Outcome Execute(float frameTime) { - if (!IoCManager.Resolve().TryGetComponent(_owner.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(_owner, out HandsComponent? handsComponent)) { return Outcome.Failed; } diff --git a/Content.Server/AI/Operators/Inventory/EquipEntityOperator.cs b/Content.Server/AI/Operators/Inventory/EquipEntityOperator.cs index 39867823fd..0c1e3ee9a2 100644 --- a/Content.Server/AI/Operators/Inventory/EquipEntityOperator.cs +++ b/Content.Server/AI/Operators/Inventory/EquipEntityOperator.cs @@ -16,7 +16,7 @@ namespace Content.Server.AI.Operators.Inventory public override Outcome Execute(float frameTime) { - if (!IoCManager.Resolve().TryGetComponent(_owner.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(_owner, out HandsComponent? handsComponent)) { return Outcome.Failed; } diff --git a/Content.Server/AI/Operators/Inventory/InteractWithEntityOperator.cs b/Content.Server/AI/Operators/Inventory/InteractWithEntityOperator.cs index 40cb324e9e..d7603b8f3b 100644 --- a/Content.Server/AI/Operators/Inventory/InteractWithEntityOperator.cs +++ b/Content.Server/AI/Operators/Inventory/InteractWithEntityOperator.cs @@ -23,7 +23,7 @@ namespace Content.Server.AI.Operators.Inventory public override Outcome Execute(float frameTime) { - if (IoCManager.Resolve().GetComponent(_useTarget.Uid).GridID != IoCManager.Resolve().GetComponent(_owner.Uid).GridID) + if (IoCManager.Resolve().GetComponent(_useTarget).GridID != IoCManager.Resolve().GetComponent(_owner).GridID) { return Outcome.Failed; } @@ -33,14 +33,14 @@ namespace Content.Server.AI.Operators.Inventory return Outcome.Failed; } - if (IoCManager.Resolve().TryGetComponent(_owner.Uid, out CombatModeComponent? combatModeComponent)) + if (IoCManager.Resolve().TryGetComponent(_owner, out CombatModeComponent? combatModeComponent)) { combatModeComponent.IsInCombatMode = false; } // Click on da thing var interactionSystem = IoCManager.Resolve().GetEntitySystem(); - interactionSystem.AiUseInteraction(_owner, IoCManager.Resolve().GetComponent(_useTarget.Uid).Coordinates, _useTarget.Uid); + interactionSystem.AiUseInteraction(_owner, IoCManager.Resolve().GetComponent(_useTarget).Coordinates, _useTarget); return Outcome.Success; } diff --git a/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs b/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs index 3fdee9fbd9..5c3b0e7895 100644 --- a/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs +++ b/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs @@ -35,7 +35,7 @@ namespace Content.Server.AI.Operators.Inventory return Outcome.Failed; } - if (!IoCManager.Resolve().TryGetComponent(container.Owner.Uid, out EntityStorageComponent? storageComponent) || + if (!IoCManager.Resolve().TryGetComponent(container.Owner, out EntityStorageComponent? storageComponent) || storageComponent.IsWeldedShut) { return Outcome.Failed; diff --git a/Content.Server/AI/Operators/Inventory/PickupEntityOperator.cs b/Content.Server/AI/Operators/Inventory/PickupEntityOperator.cs index f833974251..6c545b3d95 100644 --- a/Content.Server/AI/Operators/Inventory/PickupEntityOperator.cs +++ b/Content.Server/AI/Operators/Inventory/PickupEntityOperator.cs @@ -22,15 +22,15 @@ namespace Content.Server.AI.Operators.Inventory public override Outcome Execute(float frameTime) { - if ((!IoCManager.Resolve().EntityExists(_target.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_target.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || - !IoCManager.Resolve().HasComponent(_target.Uid) || + if ((!IoCManager.Resolve().EntityExists(_target) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_target).EntityLifeStage) >= EntityLifeStage.Deleted || + !IoCManager.Resolve().HasComponent(_target) || _target.IsInContainer() || !_owner.InRangeUnobstructed(_target, popup: true)) { return Outcome.Failed; } - if (!IoCManager.Resolve().TryGetComponent(_owner.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(_owner, out HandsComponent? handsComponent)) { return Outcome.Failed; } diff --git a/Content.Server/AI/Operators/Inventory/UseItemInInventoryOperator.cs b/Content.Server/AI/Operators/Inventory/UseItemInInventoryOperator.cs index 8bb037b730..e116bb1098 100644 --- a/Content.Server/AI/Operators/Inventory/UseItemInInventoryOperator.cs +++ b/Content.Server/AI/Operators/Inventory/UseItemInInventoryOperator.cs @@ -22,12 +22,12 @@ namespace Content.Server.AI.Operators.Inventory public override Outcome Execute(float frameTime) { // TODO: Also have this check storage a la backpack etc. - if (!IoCManager.Resolve().TryGetComponent(_owner.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(_owner, out HandsComponent? handsComponent)) { return Outcome.Failed; } - if (!IoCManager.Resolve().TryGetComponent(_target.Uid, out ItemComponent? itemComponent)) + if (!IoCManager.Resolve().TryGetComponent(_target, out ItemComponent? itemComponent)) { return Outcome.Failed; } diff --git a/Content.Server/AI/Operators/Nutrition/UseDrinkInInventoryOperator.cs b/Content.Server/AI/Operators/Nutrition/UseDrinkInInventoryOperator.cs index 5fd1f6d71d..51b6d71a77 100644 --- a/Content.Server/AI/Operators/Nutrition/UseDrinkInInventoryOperator.cs +++ b/Content.Server/AI/Operators/Nutrition/UseDrinkInInventoryOperator.cs @@ -30,9 +30,9 @@ namespace Content.Server.AI.Operators.Nutrition } // TODO: Also have this check storage a la backpack etc. - if ((!IoCManager.Resolve().EntityExists(_target.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_target.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || - !IoCManager.Resolve().TryGetComponent(_owner.Uid, out HandsComponent? handsComponent) || - !IoCManager.Resolve().TryGetComponent(_target.Uid, out ItemComponent? itemComponent)) + if ((!IoCManager.Resolve().EntityExists(_target) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_target).EntityLifeStage) >= EntityLifeStage.Deleted || + !IoCManager.Resolve().TryGetComponent(_owner, out HandsComponent? handsComponent) || + !IoCManager.Resolve().TryGetComponent(_target, out ItemComponent? itemComponent)) { return Outcome.Failed; } @@ -43,7 +43,7 @@ namespace Content.Server.AI.Operators.Nutrition { if (handsComponent.GetItem(slot) != itemComponent) continue; handsComponent.ActiveHand = slot; - if (!IoCManager.Resolve().TryGetComponent(_target.Uid, out drinkComponent)) + if (!IoCManager.Resolve().TryGetComponent(_target, out drinkComponent)) { return Outcome.Failed; } @@ -58,8 +58,8 @@ namespace Content.Server.AI.Operators.Nutrition return Outcome.Failed; } - if (drinkComponent.Deleted || EntitySystem.Get().IsEmpty(drinkComponent.Owner.Uid, drinkComponent) - || IoCManager.Resolve().TryGetComponent(_owner.Uid, out ThirstComponent? thirstComponent) && + if (drinkComponent.Deleted || EntitySystem.Get().IsEmpty(drinkComponent.Owner, drinkComponent) + || IoCManager.Resolve().TryGetComponent(_owner, out ThirstComponent? thirstComponent) && thirstComponent.CurrentThirst >= thirstComponent.ThirstThresholds[ThirstThreshold.Okay]) { return Outcome.Success; diff --git a/Content.Server/AI/Operators/Nutrition/UseFoodInInventoryOperator.cs b/Content.Server/AI/Operators/Nutrition/UseFoodInInventoryOperator.cs index 480a1d1599..5d4b6afc51 100644 --- a/Content.Server/AI/Operators/Nutrition/UseFoodInInventoryOperator.cs +++ b/Content.Server/AI/Operators/Nutrition/UseFoodInInventoryOperator.cs @@ -29,9 +29,9 @@ namespace Content.Server.AI.Operators.Nutrition } // TODO: Also have this check storage a la backpack etc. - if ((!IoCManager.Resolve().EntityExists(_target.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_target.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || - !IoCManager.Resolve().TryGetComponent(_owner.Uid, out HandsComponent? handsComponent) || - !IoCManager.Resolve().TryGetComponent(_target.Uid, out ItemComponent? itemComponent)) + if ((!IoCManager.Resolve().EntityExists(_target) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_target).EntityLifeStage) >= EntityLifeStage.Deleted || + !IoCManager.Resolve().TryGetComponent(_owner, out HandsComponent? handsComponent) || + !IoCManager.Resolve().TryGetComponent(_target, out ItemComponent? itemComponent)) { return Outcome.Failed; } @@ -42,7 +42,7 @@ namespace Content.Server.AI.Operators.Nutrition { if (handsComponent.GetItem(slot) != itemComponent) continue; handsComponent.ActiveHand = slot; - if (!IoCManager.Resolve().TryGetComponent(_target.Uid, out foodComponent)) + if (!IoCManager.Resolve().TryGetComponent(_target, out foodComponent)) { return Outcome.Failed; } @@ -57,9 +57,9 @@ namespace Content.Server.AI.Operators.Nutrition return Outcome.Failed; } - if ((!IoCManager.Resolve().EntityExists(_target.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_target.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || + if ((!IoCManager.Resolve().EntityExists(_target) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_target).EntityLifeStage) >= EntityLifeStage.Deleted || foodComponent.UsesRemaining == 0 || - IoCManager.Resolve().TryGetComponent(_owner.Uid, out HungerComponent? hungerComponent) && + IoCManager.Resolve().TryGetComponent(_owner, out HungerComponent? hungerComponent) && hungerComponent.CurrentHunger >= hungerComponent.HungerThresholds[HungerThreshold.Okay]) { return Outcome.Success; diff --git a/Content.Server/AI/Pathfinding/Accessible/AiReachableSystem.cs b/Content.Server/AI/Pathfinding/Accessible/AiReachableSystem.cs index 6593d94ce6..2db8ca2fe5 100644 --- a/Content.Server/AI/Pathfinding/Accessible/AiReachableSystem.cs +++ b/Content.Server/AI/Pathfinding/Accessible/AiReachableSystem.cs @@ -174,19 +174,19 @@ namespace Content.Server.AI.Pathfinding.Accessible public bool CanAccess(IEntity entity, IEntity target, float range = 0.0f) { // TODO: Handle this gracefully instead of just failing. - if (!IoCManager.Resolve().GetComponent(target.Uid).GridID.IsValid()) + if (!IoCManager.Resolve().GetComponent(target).GridID.IsValid()) return false; - var targetTile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(target.Uid).GridID).GetTileRef(IoCManager.Resolve().GetComponent(target.Uid).Coordinates); + var targetTile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(target).GridID).GetTileRef(IoCManager.Resolve().GetComponent(target).Coordinates); var targetNode = _pathfindingSystem.GetNode(targetTile); var collisionMask = 0; - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? physics)) + if (IoCManager.Resolve().TryGetComponent(entity, out IPhysBody? physics)) { collisionMask = physics.CollisionMask; } - var access = _accessReader.FindAccessTags(entity.Uid); + var access = _accessReader.FindAccessTags(entity); // We'll do a quick traversable check before going through regions // If we can't access it we'll try to get a valid node in range (this is essentially an early-out) @@ -198,7 +198,7 @@ namespace Content.Server.AI.Pathfinding.Accessible return false; } - var pathfindingArgs = new PathfindingArgs(entity.Uid, access, collisionMask, default, targetTile, range); + var pathfindingArgs = new PathfindingArgs(entity, access, collisionMask, default, targetTile, range); foreach (var node in BFSPathfinder.GetNodesInRange(pathfindingArgs, false)) { targetNode = node; @@ -210,12 +210,12 @@ namespace Content.Server.AI.Pathfinding.Accessible public bool CanAccess(IEntity entity, PathfindingNode targetNode) { - if (IoCManager.Resolve().GetComponent(entity.Uid).GridID != targetNode.TileRef.GridIndex) + if (IoCManager.Resolve().GetComponent(entity).GridID != targetNode.TileRef.GridIndex) { return false; } - var entityTile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID).GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); + var entityTile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity).GridID).GetTileRef(IoCManager.Resolve().GetComponent(entity).Coordinates); var entityNode = _pathfindingSystem.GetNode(entityTile); var entityRegion = GetRegion(entityNode); var targetRegion = GetRegion(targetNode); @@ -425,12 +425,12 @@ namespace Content.Server.AI.Pathfinding.Accessible /// public PathfindingRegion? GetRegion(IEntity entity) { - if (!IoCManager.Resolve().GetComponent(entity.Uid).GridID.IsValid()) + if (!IoCManager.Resolve().GetComponent(entity).GridID.IsValid()) { return null; } - var entityTile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID).GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); + var entityTile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity).GridID).GetTileRef(IoCManager.Resolve().GetComponent(entity).Coordinates); var entityNode = _pathfindingSystem.GetNode(entityTile); return GetRegion(entityNode); } diff --git a/Content.Server/AI/Pathfinding/Accessible/ReachableArgs.cs b/Content.Server/AI/Pathfinding/Accessible/ReachableArgs.cs index 423cc90db3..aed00d3ca7 100644 --- a/Content.Server/AI/Pathfinding/Accessible/ReachableArgs.cs +++ b/Content.Server/AI/Pathfinding/Accessible/ReachableArgs.cs @@ -29,14 +29,14 @@ namespace Content.Server.AI.Pathfinding.Accessible public static ReachableArgs GetArgs(IEntity entity) { var collisionMask = 0; - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? physics)) + if (IoCManager.Resolve().TryGetComponent(entity, out IPhysBody? physics)) { collisionMask = physics.CollisionMask; } var accessSystem = EntitySystem.Get(); - var access = accessSystem.FindAccessTags(entity.Uid); - var visionRadius = IoCManager.Resolve().GetComponent(entity.Uid).VisionRadius; + var access = accessSystem.FindAccessTags(entity); + var visionRadius = IoCManager.Resolve().GetComponent(entity).VisionRadius; return new ReachableArgs(visionRadius, access, collisionMask); } diff --git a/Content.Server/AI/Pathfinding/PathfindingNode.cs b/Content.Server/AI/Pathfinding/PathfindingNode.cs index ef4ce54d9e..c653b0aeae 100644 --- a/Content.Server/AI/Pathfinding/PathfindingNode.cs +++ b/Content.Server/AI/Pathfinding/PathfindingNode.cs @@ -44,7 +44,7 @@ namespace Content.Server.AI.Pathfinding public static bool IsRelevant(IEntity entity, IPhysBody physicsComponent) { - if (IoCManager.Resolve().GetComponent(entity.Uid).GridID == GridId.Invalid || + if (IoCManager.Resolve().GetComponent(entity).GridID == GridId.Invalid || (PathfindingSystem.TrackedCollisionLayers & physicsComponent.CollisionLayer) == 0) { return false; @@ -261,13 +261,13 @@ namespace Content.Server.AI.Pathfinding public void AddEntity(IEntity entity, IPhysBody physicsComponent) { // If we're a door - if (IoCManager.Resolve().HasComponent(entity.Uid) || IoCManager.Resolve().HasComponent(entity.Uid)) + if (IoCManager.Resolve().HasComponent(entity) || IoCManager.Resolve().HasComponent(entity)) { // If we need access to traverse this then add to readers, otherwise no point adding it (except for maybe tile costs in future) // TODO: Check for powered I think (also need an event for when it's depowered // AccessReader calls this whenever opening / closing but it can seem to get called multiple times // Which may or may not be intended? - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out AccessReader? accessReader) && !_accessReaders.ContainsKey(entity)) + if (IoCManager.Resolve().TryGetComponent(entity, out AccessReader? accessReader) && !_accessReaders.ContainsKey(entity)) { _accessReaders.Add(entity, accessReader); ParentChunk.Dirty(); diff --git a/Content.Server/AI/Pathfinding/PathfindingSystem.cs b/Content.Server/AI/Pathfinding/PathfindingSystem.cs index 97fc42775c..d3045f286f 100644 --- a/Content.Server/AI/Pathfinding/PathfindingSystem.cs +++ b/Content.Server/AI/Pathfinding/PathfindingSystem.cs @@ -184,7 +184,7 @@ namespace Content.Server.AI.Pathfinding /// public PathfindingNode GetNode(IEntity entity) { - var tile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID).GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); + var tile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity).GridID).GetTileRef(IoCManager.Resolve().GetComponent(entity).Coordinates); return GetNode(tile); } @@ -265,16 +265,16 @@ namespace Content.Server.AI.Pathfinding /// private void HandleEntityAdd(IEntity entity) { - if ((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || + if ((!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Deleted || _lastKnownPositions.ContainsKey(entity) || - !IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? physics) || + !IoCManager.Resolve().TryGetComponent(entity, out IPhysBody? physics) || !PathfindingNode.IsRelevant(entity, physics)) { return; } - var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID); - var tileRef = grid.GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity).GridID); + var tileRef = grid.GetTileRef(IoCManager.Resolve().GetComponent(entity).Coordinates); var chunk = GetChunk(tileRef); var node = chunk.GetNode(tileRef); @@ -305,8 +305,8 @@ namespace Content.Server.AI.Pathfinding private void HandleEntityMove(MoveEvent moveEvent) { // If we've moved to space or the likes then remove us. - if ((!IoCManager.Resolve().EntityExists(moveEvent.Sender.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(moveEvent.Sender.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || - !IoCManager.Resolve().TryGetComponent(moveEvent.Sender.Uid, out IPhysBody? physics) || + if ((!IoCManager.Resolve().EntityExists(moveEvent.Sender) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(moveEvent.Sender).EntityLifeStage) >= EntityLifeStage.Deleted || + !IoCManager.Resolve().TryGetComponent(moveEvent.Sender, out IPhysBody? physics) || !PathfindingNode.IsRelevant(moveEvent.Sender, physics) || moveEvent.NewPosition.GetGridId(EntityManager) == GridId.Invalid) { @@ -315,9 +315,9 @@ namespace Content.Server.AI.Pathfinding } // Memory leak protection until grid parenting confirmed fix / you REALLY need the performance - var gridBounds = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(moveEvent.Sender.Uid).GridID).WorldBounds; + var gridBounds = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(moveEvent.Sender).GridID).WorldBounds; - if (!gridBounds.Contains(IoCManager.Resolve().GetComponent(moveEvent.Sender.Uid).WorldPosition)) + if (!gridBounds.Contains(IoCManager.Resolve().GetComponent(moveEvent.Sender).WorldPosition)) { HandleEntityRemove(moveEvent.Sender); return; @@ -371,13 +371,13 @@ namespace Content.Server.AI.Pathfinding public bool CanTraverse(IEntity entity, PathfindingNode node) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? physics) && + if (IoCManager.Resolve().TryGetComponent(entity, out IPhysBody? physics) && (physics.CollisionMask & node.BlockedCollisionMask) != 0) { return false; } - var access = _accessReader.FindAccessTags(entity.Uid); + var access = _accessReader.FindAccessTags(entity); foreach (var reader in node.AccessReaders) { if (!_accessReader.IsAllowed(reader, access)) diff --git a/Content.Server/AI/Steering/AiSteeringSystem.cs b/Content.Server/AI/Steering/AiSteeringSystem.cs index 9baef0a02a..7b9f90b1bc 100644 --- a/Content.Server/AI/Steering/AiSteeringSystem.cs +++ b/Content.Server/AI/Steering/AiSteeringSystem.cs @@ -129,7 +129,7 @@ namespace Content.Server.AI.Steering /// public void Unregister(IEntity entity) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out AiControllerComponent? controller)) + if (IoCManager.Resolve().TryGetComponent(entity, out AiControllerComponent? controller)) { controller.VelocityDir = Vector2.Zero; } @@ -248,23 +248,23 @@ namespace Content.Server.AI.Steering private SteeringStatus Steer(IEntity entity, IAiSteeringRequest steeringRequest, float frameTime) { // Main optimisation to be done below is the redundant calls and adding more variables - if ((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || - !IoCManager.Resolve().TryGetComponent(entity.Uid, out AiControllerComponent? controller) || - !EntitySystem.Get().CanMove(entity.Uid) || - !IoCManager.Resolve().GetComponent(entity.Uid).GridID.IsValid()) + if ((!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Deleted || + !IoCManager.Resolve().TryGetComponent(entity, out AiControllerComponent? controller) || + !EntitySystem.Get().CanMove(entity) || + !IoCManager.Resolve().GetComponent(entity).GridID.IsValid()) { return SteeringStatus.NoPath; } var entitySteering = steeringRequest as EntityTargetSteeringRequest; - if (entitySteering != null && (!IoCManager.Resolve().EntityExists(entitySteering.Target.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entitySteering.Target.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if (entitySteering != null && (!IoCManager.Resolve().EntityExists(entitySteering.Target) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entitySteering.Target).EntityLifeStage) >= EntityLifeStage.Deleted) { controller.VelocityDir = Vector2.Zero; return SteeringStatus.NoPath; } - if (_pauseManager.IsGridPaused(IoCManager.Resolve().GetComponent(entity.Uid).GridID)) + if (_pauseManager.IsGridPaused(IoCManager.Resolve().GetComponent(entity).GridID)) { controller.VelocityDir = Vector2.Zero; return SteeringStatus.Pending; @@ -272,14 +272,14 @@ namespace Content.Server.AI.Steering // Validation // Check if we can even arrive -> Currently only samegrid movement supported - if (IoCManager.Resolve().GetComponent(entity.Uid).GridID != steeringRequest.TargetGrid.GetGridId(EntityManager)) + if (IoCManager.Resolve().GetComponent(entity).GridID != steeringRequest.TargetGrid.GetGridId(EntityManager)) { controller.VelocityDir = Vector2.Zero; return SteeringStatus.NoPath; } // Check if we have arrived - var targetDistance = (IoCManager.Resolve().GetComponent(entity.Uid).MapPosition.Position - steeringRequest.TargetMap.Position).Length; + var targetDistance = (IoCManager.Resolve().GetComponent(entity).MapPosition.Position - steeringRequest.TargetMap.Position).Length; steeringRequest.TimeUntilInteractionCheck -= frameTime; if (targetDistance <= steeringRequest.ArrivalDistance && steeringRequest.TimeUntilInteractionCheck <= 0.0f) @@ -416,19 +416,19 @@ namespace Content.Server.AI.Steering } var cancelToken = new CancellationTokenSource(); - var gridManager = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID); - var startTile = gridManager.GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); + var gridManager = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity).GridID); + var startTile = gridManager.GetTileRef(IoCManager.Resolve().GetComponent(entity).Coordinates); var endTile = gridManager.GetTileRef(steeringRequest.TargetGrid); var collisionMask = 0; - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? physics)) + if (IoCManager.Resolve().TryGetComponent(entity, out IPhysBody? physics)) { collisionMask = physics.CollisionMask; } - var access = _accessReader.FindAccessTags(entity.Uid); + var access = _accessReader.FindAccessTags(entity); var job = _pathfindingSystem.RequestPath(new PathfindingArgs( - entity.Uid, + entity, access, collisionMask, startTile, @@ -447,7 +447,7 @@ namespace Content.Server.AI.Steering { _pathfindingRequests.Remove(entity); - var entityTile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID).GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); + var entityTile = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity).GridID).GetTileRef(IoCManager.Resolve().GetComponent(entity).Coordinates); var tile = path.Dequeue(); var closestDistance = PathfindingHelpers.OctileDistance(entityTile, tile); @@ -485,7 +485,7 @@ namespace Content.Server.AI.Steering // If no tiles left just move towards the target (if we're close) if (!_paths.ContainsKey(entity) || _paths[entity].Count == 0) { - if ((steeringRequest.TargetGrid.Position - IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.Position).Length <= 2.0f) + if ((steeringRequest.TargetGrid.Position - IoCManager.Resolve().GetComponent(entity).Coordinates.Position).Length <= 2.0f) { return steeringRequest.TargetGrid; } @@ -495,7 +495,7 @@ namespace Content.Server.AI.Steering } if (!_nextGrid.TryGetValue(entity, out var nextGrid) || - (nextGrid.Position - IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.Position).Length <= TileTolerance) + (nextGrid.Position - IoCManager.Resolve().GetComponent(entity).Coordinates.Position).Length <= TileTolerance) { UpdateGridCache(entity); nextGrid = _nextGrid[entity]; @@ -514,7 +514,7 @@ namespace Content.Server.AI.Steering { if (_paths[entity].Count == 0) return; var nextTile = dequeue ? _paths[entity].Dequeue() : _paths[entity].Peek(); - var nextGrid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID).GridTileToLocal(nextTile.GridIndices); + var nextGrid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity).GridID).GridTileToLocal(nextTile.GridIndices); _nextGrid[entity] = nextGrid; } @@ -526,12 +526,12 @@ namespace Content.Server.AI.Steering { if (!_stuckPositions.TryGetValue(entity, out var stuckPosition)) { - _stuckPositions[entity] = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; + _stuckPositions[entity] = IoCManager.Resolve().GetComponent(entity).Coordinates; _stuckCounter[entity] = 0; return; } - if ((IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.Position - stuckPosition.Position).Length <= 1.0f) + if ((IoCManager.Resolve().GetComponent(entity).Coordinates.Position - stuckPosition.Position).Length <= 1.0f) { _stuckCounter.TryGetValue(entity, out var stuckCount); _stuckCounter[entity] = stuckCount + 1; @@ -539,7 +539,7 @@ namespace Content.Server.AI.Steering else { // No longer stuck - _stuckPositions[entity] = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; + _stuckPositions[entity] = IoCManager.Resolve().GetComponent(entity).Coordinates; _stuckCounter[entity] = 0; return; } @@ -565,7 +565,7 @@ namespace Content.Server.AI.Steering private Vector2 Seek(IEntity entity, EntityCoordinates grid) { // is-even much - var entityPos = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; + var entityPos = IoCManager.Resolve().GetComponent(entity).Coordinates; return entityPos == grid ? Vector2.Zero : (grid.Position - entityPos.Position).Normalized; @@ -580,7 +580,7 @@ namespace Content.Server.AI.Steering /// private Vector2 Arrival(IEntity entity, EntityCoordinates grid, float slowingDistance = 1.0f) { - var entityPos = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; + var entityPos = IoCManager.Resolve().GetComponent(entity).Coordinates; DebugTools.Assert(slowingDistance > 0.0f); if (entityPos == grid) { @@ -599,14 +599,14 @@ namespace Content.Server.AI.Steering /// private Vector2 Pursuit(IEntity entity, IEntity target) { - var entityPos = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; - var targetPos = IoCManager.Resolve().GetComponent(target.Uid).Coordinates; + var entityPos = IoCManager.Resolve().GetComponent(entity).Coordinates; + var targetPos = IoCManager.Resolve().GetComponent(target).Coordinates; if (entityPos == targetPos) { return Vector2.Zero; } - if (IoCManager.Resolve().TryGetComponent(target.Uid, out IPhysBody? physics)) + if (IoCManager.Resolve().TryGetComponent(target, out IPhysBody? physics)) { var targetDistance = (targetPos.Position - entityPos.Position); targetPos = targetPos.Offset(physics.LinearVelocity * targetDistance); @@ -624,7 +624,7 @@ namespace Content.Server.AI.Steering /// private Vector2 CollisionAvoidance(IEntity entity, Vector2 direction, ICollection ignoredTargets) { - if (direction == Vector2.Zero || !IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? physics)) + if (direction == Vector2.Zero || !IoCManager.Resolve().TryGetComponent(entity, out IPhysBody? physics)) { return Vector2.Zero; } @@ -636,8 +636,8 @@ namespace Content.Server.AI.Steering var avoidanceVector = Vector2.Zero; var checkTiles = new HashSet(); var avoidTiles = new HashSet(); - var entityGridCoords = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; - var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID); + var entityGridCoords = IoCManager.Resolve().GetComponent(entity).Coordinates; + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity).GridID); var currentTile = grid.GetTileRef(entityGridCoords); var halfwayTile = grid.GetTileRef(entityGridCoords.Offset(direction / 2)); var nextTile = grid.GetTileRef(entityGridCoords.Offset(direction)); @@ -660,18 +660,18 @@ namespace Content.Server.AI.Steering // err for now we'll just assume the first entity is the center and just add a vector for it //Pathfinding updates are deferred so this may not be done yet. - if ((!IoCManager.Resolve().EntityExists(physicsEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(physicsEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) continue; + if ((!IoCManager.Resolve().EntityExists(physicsEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(physicsEntity).EntityLifeStage) >= EntityLifeStage.Deleted) continue; // if we're moving in the same direction then ignore // So if 2 entities are moving towards each other and both detect a collision they'll both move in the same direction // i.e. towards the right - if (IoCManager.Resolve().TryGetComponent(physicsEntity.Uid, out IPhysBody? otherPhysics) && + if (IoCManager.Resolve().TryGetComponent(physicsEntity, out IPhysBody? otherPhysics) && Vector2.Dot(otherPhysics.LinearVelocity, direction) > 0) { continue; } - var centerGrid = IoCManager.Resolve().GetComponent(physicsEntity.Uid).Coordinates; + var centerGrid = IoCManager.Resolve().GetComponent(physicsEntity).Coordinates; // Check how close we are to center of tile and get the inverse; if we're closer this is stronger var additionalVector = (centerGrid.Position - entityGridCoords.Position); var distance = additionalVector.Length; diff --git a/Content.Server/AI/Steering/EntityTargetSteeringRequest.cs b/Content.Server/AI/Steering/EntityTargetSteeringRequest.cs index 70279fbf00..3d21553f9e 100644 --- a/Content.Server/AI/Steering/EntityTargetSteeringRequest.cs +++ b/Content.Server/AI/Steering/EntityTargetSteeringRequest.cs @@ -7,8 +7,8 @@ namespace Content.Server.AI.Steering public sealed class EntityTargetSteeringRequest : IAiSteeringRequest { public SteeringStatus Status { get; set; } = SteeringStatus.Pending; - public MapCoordinates TargetMap => IoCManager.Resolve().GetComponent(_target.Uid).MapPosition; - public EntityCoordinates TargetGrid => IoCManager.Resolve().GetComponent(_target.Uid).Coordinates; + public MapCoordinates TargetMap => IoCManager.Resolve().GetComponent(_target).MapPosition; + public EntityCoordinates TargetGrid => IoCManager.Resolve().GetComponent(_target).Coordinates; public IEntity Target => _target; private readonly IEntity _target; diff --git a/Content.Server/AI/Utility/Actions/Combat/Melee/MeleeWeaponAttackEntity.cs b/Content.Server/AI/Utility/Actions/Combat/Melee/MeleeWeaponAttackEntity.cs index 9a4ee18e6b..497807a27f 100644 --- a/Content.Server/AI/Utility/Actions/Combat/Melee/MeleeWeaponAttackEntity.cs +++ b/Content.Server/AI/Utility/Actions/Combat/Melee/MeleeWeaponAttackEntity.cs @@ -27,7 +27,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee { MoveToEntityOperator moveOperator; var equipped = context.GetState().GetValue(); - if (equipped != null && IoCManager.Resolve().TryGetComponent(equipped.Uid, out MeleeWeaponComponent? meleeWeaponComponent)) + if (equipped != null && IoCManager.Resolve().TryGetComponent(equipped, out MeleeWeaponComponent? meleeWeaponComponent)) { moveOperator = new MoveToEntityOperator(Owner, Target, meleeWeaponComponent.Range - 0.01f); } diff --git a/Content.Server/AI/Utility/Actions/Combat/Melee/UnarmedAttackEntity.cs b/Content.Server/AI/Utility/Actions/Combat/Melee/UnarmedAttackEntity.cs index 7297411981..ab2aaeea2a 100644 --- a/Content.Server/AI/Utility/Actions/Combat/Melee/UnarmedAttackEntity.cs +++ b/Content.Server/AI/Utility/Actions/Combat/Melee/UnarmedAttackEntity.cs @@ -24,7 +24,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee public override void SetupOperators(Blackboard context) { MoveToEntityOperator moveOperator; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out UnarmedCombatComponent? unarmedCombatComponent)) + if (IoCManager.Resolve().TryGetComponent(Owner, out UnarmedCombatComponent? unarmedCombatComponent)) { moveOperator = new MoveToEntityOperator(Owner, Target, unarmedCombatComponent.Range - 0.01f); } diff --git a/Content.Server/AI/Utility/Actions/Idle/WanderAndWait.cs b/Content.Server/AI/Utility/Actions/Idle/WanderAndWait.cs index c576df6770..4422837905 100644 --- a/Content.Server/AI/Utility/Actions/Idle/WanderAndWait.cs +++ b/Content.Server/AI/Utility/Actions/Idle/WanderAndWait.cs @@ -81,7 +81,7 @@ namespace Content.Server.AI.Utility.Actions.Idle var targetNode = robustRandom.Pick(reachableNodes); var mapManager = IoCManager.Resolve(); - var grid = mapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); + var grid = mapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner).GridID); var targetGrid = grid.GridTileToLocal(targetNode.TileRef.GridIndices); return targetGrid; diff --git a/Content.Server/AI/Utility/Actions/Test/MoveRightAndLeftTen.cs b/Content.Server/AI/Utility/Actions/Test/MoveRightAndLeftTen.cs index 49817c8212..868dc2fb28 100644 --- a/Content.Server/AI/Utility/Actions/Test/MoveRightAndLeftTen.cs +++ b/Content.Server/AI/Utility/Actions/Test/MoveRightAndLeftTen.cs @@ -19,8 +19,8 @@ namespace Content.Server.AI.Utility.Actions.Test public override void SetupOperators(Blackboard context) { - var currentPosition = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; - var nextPosition = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates.Offset(new Vector2(10.0f, 0.0f)); + var currentPosition = IoCManager.Resolve().GetComponent(Owner).Coordinates; + var nextPosition = IoCManager.Resolve().GetComponent(Owner).Coordinates.Offset(new Vector2(10.0f, 0.0f)); var originalPosOp = new MoveToGridOperator(Owner, currentPosition, 0.25f); var newPosOp = new MoveToGridOperator(Owner, nextPosition, 0.25f); diff --git a/Content.Server/AI/Utility/AiLogic/UtilityAI.cs b/Content.Server/AI/Utility/AiLogic/UtilityAI.cs index 15a7e708c1..cff3df39b2 100644 --- a/Content.Server/AI/Utility/AiLogic/UtilityAI.cs +++ b/Content.Server/AI/Utility/AiLogic/UtilityAI.cs @@ -185,7 +185,7 @@ namespace Content.Server.AI.Utility.AiLogic { _planCooldownRemaining = PlanCooldown; _actionCancellation = new CancellationTokenSource(); - _actionRequest = _planner.RequestAction(new AiActionRequest(Owner.Uid, _blackboard, AvailableActions), _actionCancellation); + _actionRequest = _planner.RequestAction(new AiActionRequest(Owner, _blackboard, AvailableActions), _actionCancellation); return; } diff --git a/Content.Server/AI/Utility/Considerations/ActionBlocker/CanMoveCon.cs b/Content.Server/AI/Utility/Considerations/ActionBlocker/CanMoveCon.cs index 83a7db8947..18ffa4ac79 100644 --- a/Content.Server/AI/Utility/Considerations/ActionBlocker/CanMoveCon.cs +++ b/Content.Server/AI/Utility/Considerations/ActionBlocker/CanMoveCon.cs @@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.ActionBlocker { var self = context.GetState().GetValue(); - if (self == null || !EntitySystem.Get().CanMove(self.Uid)) + if (self == null || !EntitySystem.Get().CanMove(self)) { return 0.0f; } diff --git a/Content.Server/AI/Utility/Considerations/Clothing/ClothingInInventoryCon.cs b/Content.Server/AI/Utility/Considerations/Clothing/ClothingInInventoryCon.cs index 6368f5d457..2b20a2b3e7 100644 --- a/Content.Server/AI/Utility/Considerations/Clothing/ClothingInInventoryCon.cs +++ b/Content.Server/AI/Utility/Considerations/Clothing/ClothingInInventoryCon.cs @@ -25,7 +25,7 @@ namespace Content.Server.AI.Utility.Considerations.Clothing foreach (var entity in context.GetState().GetValue()) { - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out ClothingComponent? clothingComponent)) + if (!IoCManager.Resolve().TryGetComponent(entity, out ClothingComponent? clothingComponent)) { continue; } diff --git a/Content.Server/AI/Utility/Considerations/Combat/Melee/CanUnarmedCombatCon.cs b/Content.Server/AI/Utility/Considerations/Combat/Melee/CanUnarmedCombatCon.cs index d1ef7cce19..75a3a0c59f 100644 --- a/Content.Server/AI/Utility/Considerations/Combat/Melee/CanUnarmedCombatCon.cs +++ b/Content.Server/AI/Utility/Considerations/Combat/Melee/CanUnarmedCombatCon.cs @@ -13,7 +13,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat.Melee IEntity tempQualifier = context.GetState().GetValue(); if (tempQualifier != null) { - IoCManager.Resolve().HasComponent(tempQualifier.Uid); + IoCManager.Resolve().HasComponent(tempQualifier); } return RETURNED_VALUE ?? false ? 1.0f : 0.0f; diff --git a/Content.Server/AI/Utility/Considerations/Combat/Melee/HasMeleeWeaponCon.cs b/Content.Server/AI/Utility/Considerations/Combat/Melee/HasMeleeWeaponCon.cs index 1f41993112..7208b6d533 100644 --- a/Content.Server/AI/Utility/Considerations/Combat/Melee/HasMeleeWeaponCon.cs +++ b/Content.Server/AI/Utility/Considerations/Combat/Melee/HasMeleeWeaponCon.cs @@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat.Melee { foreach (var item in context.GetState().GetValue()) { - if (IoCManager.Resolve().HasComponent(item.Uid)) + if (IoCManager.Resolve().HasComponent(item)) { return 1.0f; } diff --git a/Content.Server/AI/Utility/Considerations/Combat/Melee/MeleeWeaponDamageCon.cs b/Content.Server/AI/Utility/Considerations/Combat/Melee/MeleeWeaponDamageCon.cs index efcdc77644..6c5c317bed 100644 --- a/Content.Server/AI/Utility/Considerations/Combat/Melee/MeleeWeaponDamageCon.cs +++ b/Content.Server/AI/Utility/Considerations/Combat/Melee/MeleeWeaponDamageCon.cs @@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat.Melee { var target = context.GetState().GetValue(); - if (target == null || !IoCManager.Resolve().TryGetComponent(target.Uid, out MeleeWeaponComponent? meleeWeaponComponent)) + if (target == null || !IoCManager.Resolve().TryGetComponent(target, out MeleeWeaponComponent? meleeWeaponComponent)) { return 0.0f; } diff --git a/Content.Server/AI/Utility/Considerations/Combat/Melee/MeleeWeaponEquippedCon.cs b/Content.Server/AI/Utility/Considerations/Combat/Melee/MeleeWeaponEquippedCon.cs index b7650d2625..60a383e9cb 100644 --- a/Content.Server/AI/Utility/Considerations/Combat/Melee/MeleeWeaponEquippedCon.cs +++ b/Content.Server/AI/Utility/Considerations/Combat/Melee/MeleeWeaponEquippedCon.cs @@ -17,7 +17,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat.Melee return 0.0f; } - return IoCManager.Resolve().HasComponent(equipped.Uid) ? 1.0f : 0.0f; + return IoCManager.Resolve().HasComponent(equipped) ? 1.0f : 0.0f; } } } diff --git a/Content.Server/AI/Utility/Considerations/Combat/Melee/MeleeWeaponSpeedCon.cs b/Content.Server/AI/Utility/Considerations/Combat/Melee/MeleeWeaponSpeedCon.cs index 3e14dff7c6..d84c977509 100644 --- a/Content.Server/AI/Utility/Considerations/Combat/Melee/MeleeWeaponSpeedCon.cs +++ b/Content.Server/AI/Utility/Considerations/Combat/Melee/MeleeWeaponSpeedCon.cs @@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat.Melee { var target = context.GetState().GetValue(); - if (target == null || !IoCManager.Resolve().TryGetComponent(target.Uid, out MeleeWeaponComponent? meleeWeaponComponent)) + if (target == null || !IoCManager.Resolve().TryGetComponent(target, out MeleeWeaponComponent? meleeWeaponComponent)) { return 0.0f; } diff --git a/Content.Server/AI/Utility/Considerations/Combat/TargetHealthCon.cs b/Content.Server/AI/Utility/Considerations/Combat/TargetHealthCon.cs index 56a23d9eef..e3bc538c45 100644 --- a/Content.Server/AI/Utility/Considerations/Combat/TargetHealthCon.cs +++ b/Content.Server/AI/Utility/Considerations/Combat/TargetHealthCon.cs @@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat { var target = context.GetState().GetValue(); - if (target == null || !IoCManager.Resolve().EntityExists(target.Uid) || !IoCManager.Resolve().TryGetComponent(target.Uid, out DamageableComponent? damageableComponent)) + if (target == null || !IoCManager.Resolve().EntityExists(target) || !IoCManager.Resolve().TryGetComponent(target, out DamageableComponent? damageableComponent)) { return 0.0f; } diff --git a/Content.Server/AI/Utility/Considerations/Combat/TargetIsCritCon.cs b/Content.Server/AI/Utility/Considerations/Combat/TargetIsCritCon.cs index 946edec33d..37b3f99552 100644 --- a/Content.Server/AI/Utility/Considerations/Combat/TargetIsCritCon.cs +++ b/Content.Server/AI/Utility/Considerations/Combat/TargetIsCritCon.cs @@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat { var target = context.GetState().GetValue(); - if (target == null || !IoCManager.Resolve().TryGetComponent(target.Uid, out MobStateComponent? mobState)) + if (target == null || !IoCManager.Resolve().TryGetComponent(target, out MobStateComponent? mobState)) { return 0.0f; } diff --git a/Content.Server/AI/Utility/Considerations/Combat/TargetIsDeadCon.cs b/Content.Server/AI/Utility/Considerations/Combat/TargetIsDeadCon.cs index 60d1bfb8b9..26622c9723 100644 --- a/Content.Server/AI/Utility/Considerations/Combat/TargetIsDeadCon.cs +++ b/Content.Server/AI/Utility/Considerations/Combat/TargetIsDeadCon.cs @@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Combat { var target = context.GetState().GetValue(); - if (target == null || !IoCManager.Resolve().TryGetComponent(target.Uid, out MobStateComponent? mobState)) + if (target == null || !IoCManager.Resolve().TryGetComponent(target, out MobStateComponent? mobState)) { return 0.0f; } diff --git a/Content.Server/AI/Utility/Considerations/Containers/TargetAccessibleCon.cs b/Content.Server/AI/Utility/Considerations/Containers/TargetAccessibleCon.cs index 4c9d6a95cd..6b0f394754 100644 --- a/Content.Server/AI/Utility/Considerations/Containers/TargetAccessibleCon.cs +++ b/Content.Server/AI/Utility/Considerations/Containers/TargetAccessibleCon.cs @@ -25,7 +25,7 @@ namespace Content.Server.AI.Utility.Considerations.Containers if (target.TryGetContainer(out var container)) { - if (IoCManager.Resolve().TryGetComponent(container.Owner.Uid, out EntityStorageComponent? storageComponent)) + if (IoCManager.Resolve().TryGetComponent(container.Owner, out EntityStorageComponent? storageComponent)) { if (storageComponent.IsWeldedShut && !storageComponent.Open) { diff --git a/Content.Server/AI/Utility/Considerations/Hands/FreeHandCon.cs b/Content.Server/AI/Utility/Considerations/Hands/FreeHandCon.cs index f01567278b..029775d5f3 100644 --- a/Content.Server/AI/Utility/Considerations/Hands/FreeHandCon.cs +++ b/Content.Server/AI/Utility/Considerations/Hands/FreeHandCon.cs @@ -12,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.Hands { var owner = context.GetState().GetValue(); - if (owner == null || !IoCManager.Resolve().TryGetComponent(owner.Uid, out HandsComponent? handsComponent)) + if (owner == null || !IoCManager.Resolve().TryGetComponent(owner, out HandsComponent? handsComponent)) { return 0.0f; } diff --git a/Content.Server/AI/Utility/Considerations/Inventory/CanPutTargetInInventoryCon.cs b/Content.Server/AI/Utility/Considerations/Inventory/CanPutTargetInInventoryCon.cs index 84013384b1..14ccfbf4d2 100644 --- a/Content.Server/AI/Utility/Considerations/Inventory/CanPutTargetInInventoryCon.cs +++ b/Content.Server/AI/Utility/Considerations/Inventory/CanPutTargetInInventoryCon.cs @@ -16,7 +16,7 @@ namespace Content.Server.AI.Utility.Considerations.Inventory // If not then check if we have a free hand var target = context.GetState().GetValue(); - if (target == null || !IoCManager.Resolve().HasComponent(target.Uid)) + if (target == null || !IoCManager.Resolve().HasComponent(target)) { return 0.0f; } diff --git a/Content.Server/AI/Utility/Considerations/Inventory/TargetInOurInventoryCon.cs b/Content.Server/AI/Utility/Considerations/Inventory/TargetInOurInventoryCon.cs index 7cebb1dae0..b7fcd97b1c 100644 --- a/Content.Server/AI/Utility/Considerations/Inventory/TargetInOurInventoryCon.cs +++ b/Content.Server/AI/Utility/Considerations/Inventory/TargetInOurInventoryCon.cs @@ -13,7 +13,7 @@ namespace Content.Server.AI.Utility.Considerations.Inventory { var target = context.GetState().GetValue(); - if (target == null || !IoCManager.Resolve().HasComponent(target.Uid)) + if (target == null || !IoCManager.Resolve().HasComponent(target)) { return 0.0f; } diff --git a/Content.Server/AI/Utility/Considerations/Movement/TargetDistanceCon.cs b/Content.Server/AI/Utility/Considerations/Movement/TargetDistanceCon.cs index ec790605fc..6360b0d045 100644 --- a/Content.Server/AI/Utility/Considerations/Movement/TargetDistanceCon.cs +++ b/Content.Server/AI/Utility/Considerations/Movement/TargetDistanceCon.cs @@ -11,13 +11,13 @@ namespace Content.Server.AI.Utility.Considerations.Movement { var self = context.GetState().GetValue(); var target = context.GetState().GetValue(); - if (target == null || (!IoCManager.Resolve().EntityExists(target.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(target.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve().GetComponent(target.Uid).GridID != (self != null ? IoCManager.Resolve().GetComponent(self.Uid) : null).GridID) + if (target == null || (!IoCManager.Resolve().EntityExists(target) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(target).EntityLifeStage) >= EntityLifeStage.Deleted || IoCManager.Resolve().GetComponent(target).GridID != (self != null ? IoCManager.Resolve().GetComponent(self) : null).GridID) { return 0.0f; } // Anything further than 100 tiles gets clamped - return (IoCManager.Resolve().GetComponent(target.Uid).Coordinates.Position - IoCManager.Resolve().GetComponent(self.Uid).Coordinates.Position).Length / 100; + return (IoCManager.Resolve().GetComponent(target).Coordinates.Position - IoCManager.Resolve().GetComponent(self).Coordinates.Position).Length / 100; } } } diff --git a/Content.Server/AI/Utility/Considerations/Nutrition/Drink/DrinkValueCon.cs b/Content.Server/AI/Utility/Considerations/Nutrition/Drink/DrinkValueCon.cs index 79a1c6b47b..2d18ea9cd3 100644 --- a/Content.Server/AI/Utility/Considerations/Nutrition/Drink/DrinkValueCon.cs +++ b/Content.Server/AI/Utility/Considerations/Nutrition/Drink/DrinkValueCon.cs @@ -14,8 +14,8 @@ namespace Content.Server.AI.Utility.Considerations.Nutrition.Drink var target = context.GetState().GetValue(); if (target == null - || (!IoCManager.Resolve().EntityExists(target.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(target.Uid).EntityLifeStage) >= EntityLifeStage.Deleted - || !EntitySystem.Get().TryGetSolution(target.Uid, DrinkComponent.DefaultSolutionName, out var drink)) + || (!IoCManager.Resolve().EntityExists(target) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(target).EntityLifeStage) >= EntityLifeStage.Deleted + || !EntitySystem.Get().TryGetSolution(target, DrinkComponent.DefaultSolutionName, out var drink)) { return 0.0f; } diff --git a/Content.Server/AI/Utility/Considerations/Nutrition/Drink/ThirstCon.cs b/Content.Server/AI/Utility/Considerations/Nutrition/Drink/ThirstCon.cs index 95760be285..6ea21c75db 100644 --- a/Content.Server/AI/Utility/Considerations/Nutrition/Drink/ThirstCon.cs +++ b/Content.Server/AI/Utility/Considerations/Nutrition/Drink/ThirstCon.cs @@ -13,7 +13,7 @@ namespace Content.Server.AI.Utility.Considerations.Nutrition.Drink { var owner = context.GetState().GetValue(); - if (owner == null || !IoCManager.Resolve().TryGetComponent(owner.Uid, out ThirstComponent? thirst)) + if (owner == null || !IoCManager.Resolve().TryGetComponent(owner, out ThirstComponent? thirst)) { return 0.0f; } diff --git a/Content.Server/AI/Utility/Considerations/Nutrition/Food/FoodValueCon.cs b/Content.Server/AI/Utility/Considerations/Nutrition/Food/FoodValueCon.cs index b0a1657739..3b305d47b2 100644 --- a/Content.Server/AI/Utility/Considerations/Nutrition/Food/FoodValueCon.cs +++ b/Content.Server/AI/Utility/Considerations/Nutrition/Food/FoodValueCon.cs @@ -13,9 +13,9 @@ namespace Content.Server.AI.Utility.Considerations.Nutrition.Food { var target = context.GetState().GetValue(); - if (target == null || !IoCManager.Resolve().EntityExists(target.Uid) - || !IoCManager.Resolve().TryGetComponent(target.Uid, out var foodComp) - || !EntitySystem.Get().TryGetSolution(target.Uid, foodComp.SolutionName, out var food)) + if (target == null || !IoCManager.Resolve().EntityExists(target) + || !IoCManager.Resolve().TryGetComponent(target, out var foodComp) + || !EntitySystem.Get().TryGetSolution(target, foodComp.SolutionName, out var food)) { return 0.0f; } diff --git a/Content.Server/AI/Utility/Considerations/Nutrition/Food/HungerCon.cs b/Content.Server/AI/Utility/Considerations/Nutrition/Food/HungerCon.cs index bbfa55c334..33cc9dca90 100644 --- a/Content.Server/AI/Utility/Considerations/Nutrition/Food/HungerCon.cs +++ b/Content.Server/AI/Utility/Considerations/Nutrition/Food/HungerCon.cs @@ -14,7 +14,7 @@ namespace Content.Server.AI.Utility.Considerations.Nutrition.Food { var owner = context.GetState().GetValue(); - if (owner == null || !IoCManager.Resolve().TryGetComponent(owner.Uid, out HungerComponent? hunger)) + if (owner == null || !IoCManager.Resolve().TryGetComponent(owner, out HungerComponent? hunger)) { return 0.0f; } diff --git a/Content.Server/AI/Utility/ExpandableActions/Clothing/Gloves/EquipAnyGlovesExp.cs b/Content.Server/AI/Utility/ExpandableActions/Clothing/Gloves/EquipAnyGlovesExp.cs index a88414efc3..e570698cc6 100644 --- a/Content.Server/AI/Utility/ExpandableActions/Clothing/Gloves/EquipAnyGlovesExp.cs +++ b/Content.Server/AI/Utility/ExpandableActions/Clothing/Gloves/EquipAnyGlovesExp.cs @@ -38,7 +38,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Clothing.Gloves foreach (var entity in context.GetState().GetValue()) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ClothingComponent? clothing) && + if (IoCManager.Resolve().TryGetComponent(entity, out ClothingComponent? clothing) && (clothing.SlotFlags & EquipmentSlotDefines.SlotFlags.GLOVES) != 0) { yield return new EquipGloves {Owner = owner, Target = entity, Bonus = Bonus}; diff --git a/Content.Server/AI/Utility/ExpandableActions/Clothing/Gloves/PickUpAnyNearbyGlovesExp.cs b/Content.Server/AI/Utility/ExpandableActions/Clothing/Gloves/PickUpAnyNearbyGlovesExp.cs index a34839afd7..959a4a6d87 100644 --- a/Content.Server/AI/Utility/ExpandableActions/Clothing/Gloves/PickUpAnyNearbyGlovesExp.cs +++ b/Content.Server/AI/Utility/ExpandableActions/Clothing/Gloves/PickUpAnyNearbyGlovesExp.cs @@ -36,7 +36,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Clothing.Gloves foreach (var entity in context.GetState().GetValue()) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ClothingComponent? clothing) && + if (IoCManager.Resolve().TryGetComponent(entity, out ClothingComponent? clothing) && (clothing.SlotFlags & EquipmentSlotDefines.SlotFlags.GLOVES) != 0) { yield return new PickUpGloves {Owner = owner, Target = entity, Bonus = Bonus}; diff --git a/Content.Server/AI/Utility/ExpandableActions/Clothing/Head/EquipAnyHeadExp.cs b/Content.Server/AI/Utility/ExpandableActions/Clothing/Head/EquipAnyHeadExp.cs index 69cd62d789..62f675ae1c 100644 --- a/Content.Server/AI/Utility/ExpandableActions/Clothing/Head/EquipAnyHeadExp.cs +++ b/Content.Server/AI/Utility/ExpandableActions/Clothing/Head/EquipAnyHeadExp.cs @@ -37,7 +37,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Clothing.Head foreach (var entity in context.GetState().GetValue()) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ClothingComponent? clothing) && + if (IoCManager.Resolve().TryGetComponent(entity, out ClothingComponent? clothing) && (clothing.SlotFlags & EquipmentSlotDefines.SlotFlags.HEAD) != 0) { yield return new EquipHead {Owner = owner, Target = entity, Bonus = Bonus}; diff --git a/Content.Server/AI/Utility/ExpandableActions/Clothing/Head/PickUpAnyNearbyHeadExp.cs b/Content.Server/AI/Utility/ExpandableActions/Clothing/Head/PickUpAnyNearbyHeadExp.cs index bb5175e6b1..0e1ad0e81c 100644 --- a/Content.Server/AI/Utility/ExpandableActions/Clothing/Head/PickUpAnyNearbyHeadExp.cs +++ b/Content.Server/AI/Utility/ExpandableActions/Clothing/Head/PickUpAnyNearbyHeadExp.cs @@ -36,7 +36,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Clothing.Head foreach (var entity in context.GetState().GetValue()) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ClothingComponent? clothing) && + if (IoCManager.Resolve().TryGetComponent(entity, out ClothingComponent? clothing) && (clothing.SlotFlags & EquipmentSlotDefines.SlotFlags.HEAD) != 0) { yield return new PickUpHead {Owner = owner, Target = entity, Bonus = Bonus}; diff --git a/Content.Server/AI/Utility/ExpandableActions/Clothing/OuterClothing/EquipAnyOuterClothingExp.cs b/Content.Server/AI/Utility/ExpandableActions/Clothing/OuterClothing/EquipAnyOuterClothingExp.cs index 6c926a62fd..88fc7d3cf3 100644 --- a/Content.Server/AI/Utility/ExpandableActions/Clothing/OuterClothing/EquipAnyOuterClothingExp.cs +++ b/Content.Server/AI/Utility/ExpandableActions/Clothing/OuterClothing/EquipAnyOuterClothingExp.cs @@ -38,7 +38,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Clothing.OuterClothing foreach (var entity in context.GetState().GetValue()) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ClothingComponent? clothing) && + if (IoCManager.Resolve().TryGetComponent(entity, out ClothingComponent? clothing) && (clothing.SlotFlags & EquipmentSlotDefines.SlotFlags.OUTERCLOTHING) != 0) { yield return new EquipOuterClothing {Owner = owner, Target = entity, Bonus = Bonus}; diff --git a/Content.Server/AI/Utility/ExpandableActions/Clothing/OuterClothing/PickUpAnyNearbyOuterClothingExp.cs b/Content.Server/AI/Utility/ExpandableActions/Clothing/OuterClothing/PickUpAnyNearbyOuterClothingExp.cs index c7233b45e0..3134bd14d3 100644 --- a/Content.Server/AI/Utility/ExpandableActions/Clothing/OuterClothing/PickUpAnyNearbyOuterClothingExp.cs +++ b/Content.Server/AI/Utility/ExpandableActions/Clothing/OuterClothing/PickUpAnyNearbyOuterClothingExp.cs @@ -37,7 +37,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Clothing.OuterClothing foreach (var entity in context.GetState().GetValue()) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ClothingComponent? clothing) && + if (IoCManager.Resolve().TryGetComponent(entity, out ClothingComponent? clothing) && (clothing.SlotFlags & EquipmentSlotDefines.SlotFlags.OUTERCLOTHING) != 0) { yield return new PickUpOuterClothing {Owner = owner, Target = entity, Bonus = Bonus}; diff --git a/Content.Server/AI/Utility/ExpandableActions/Clothing/Shoes/EquipAnyShoesExp.cs b/Content.Server/AI/Utility/ExpandableActions/Clothing/Shoes/EquipAnyShoesExp.cs index 2e6997a86b..85077d611c 100644 --- a/Content.Server/AI/Utility/ExpandableActions/Clothing/Shoes/EquipAnyShoesExp.cs +++ b/Content.Server/AI/Utility/ExpandableActions/Clothing/Shoes/EquipAnyShoesExp.cs @@ -38,7 +38,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Clothing.Shoes foreach (var entity in context.GetState().GetValue()) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ClothingComponent? clothing) && + if (IoCManager.Resolve().TryGetComponent(entity, out ClothingComponent? clothing) && (clothing.SlotFlags & EquipmentSlotDefines.SlotFlags.SHOES) != 0) { yield return new EquipShoes {Owner = owner, Target = entity, Bonus = Bonus}; diff --git a/Content.Server/AI/Utility/ExpandableActions/Clothing/Shoes/PickUpAnyNearbyShoesExp.cs b/Content.Server/AI/Utility/ExpandableActions/Clothing/Shoes/PickUpAnyNearbyShoesExp.cs index 102946b4ae..dca91f730d 100644 --- a/Content.Server/AI/Utility/ExpandableActions/Clothing/Shoes/PickUpAnyNearbyShoesExp.cs +++ b/Content.Server/AI/Utility/ExpandableActions/Clothing/Shoes/PickUpAnyNearbyShoesExp.cs @@ -37,7 +37,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Clothing.Shoes foreach (var entity in context.GetState().GetValue()) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ClothingComponent? clothing) && + if (IoCManager.Resolve().TryGetComponent(entity, out ClothingComponent? clothing) && (clothing.SlotFlags & EquipmentSlotDefines.SlotFlags.SHOES) != 0) { yield return new PickUpShoes {Owner = owner, Target = entity, Bonus = Bonus}; diff --git a/Content.Server/AI/Utility/ExpandableActions/Combat/Melee/EquipMeleeExp.cs b/Content.Server/AI/Utility/ExpandableActions/Combat/Melee/EquipMeleeExp.cs index 0d51eeac97..ef5ba1d2c2 100644 --- a/Content.Server/AI/Utility/ExpandableActions/Combat/Melee/EquipMeleeExp.cs +++ b/Content.Server/AI/Utility/ExpandableActions/Combat/Melee/EquipMeleeExp.cs @@ -34,7 +34,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Combat.Melee foreach (var entity in context.GetState().GetValue()) { - if (!IoCManager.Resolve().HasComponent(entity.Uid)) + if (!IoCManager.Resolve().HasComponent(entity)) { continue; } diff --git a/Content.Server/AI/Utility/ExpandableActions/Combat/Melee/MeleeAttackNearbyExp.cs b/Content.Server/AI/Utility/ExpandableActions/Combat/Melee/MeleeAttackNearbyExp.cs index 6b46fcc898..59d0f9a3d7 100644 --- a/Content.Server/AI/Utility/ExpandableActions/Combat/Melee/MeleeAttackNearbyExp.cs +++ b/Content.Server/AI/Utility/ExpandableActions/Combat/Melee/MeleeAttackNearbyExp.cs @@ -31,7 +31,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Combat.Melee public override IEnumerable GetActions(Blackboard context) { var owner = context.GetState().GetValue(); - if (!IoCManager.Resolve().TryGetComponent(owner.Uid, out AiControllerComponent? controller)) + if (!IoCManager.Resolve().TryGetComponent(owner, out AiControllerComponent? controller)) { throw new InvalidOperationException(); } diff --git a/Content.Server/AI/Utility/ExpandableActions/Combat/Melee/UnarmedAttackNearbyHostilesExp.cs b/Content.Server/AI/Utility/ExpandableActions/Combat/Melee/UnarmedAttackNearbyHostilesExp.cs index d2441b5b62..2d06446922 100644 --- a/Content.Server/AI/Utility/ExpandableActions/Combat/Melee/UnarmedAttackNearbyHostilesExp.cs +++ b/Content.Server/AI/Utility/ExpandableActions/Combat/Melee/UnarmedAttackNearbyHostilesExp.cs @@ -31,7 +31,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Combat.Melee public override IEnumerable GetActions(Blackboard context) { var owner = context.GetState().GetValue(); - if (!IoCManager.Resolve().TryGetComponent(owner.Uid, out AiControllerComponent? controller)) + if (!IoCManager.Resolve().TryGetComponent(owner, out AiControllerComponent? controller)) { throw new InvalidOperationException(); } diff --git a/Content.Server/AI/Utility/ExpandableActions/Nutrition/UseDrinkInInventoryExp.cs b/Content.Server/AI/Utility/ExpandableActions/Nutrition/UseDrinkInInventoryExp.cs index 0a858d07fc..4ba283ae27 100644 --- a/Content.Server/AI/Utility/ExpandableActions/Nutrition/UseDrinkInInventoryExp.cs +++ b/Content.Server/AI/Utility/ExpandableActions/Nutrition/UseDrinkInInventoryExp.cs @@ -32,7 +32,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Nutrition foreach (var entity in context.GetState().GetValue()) { - if (!IoCManager.Resolve().HasComponent(entity.Uid)) + if (!IoCManager.Resolve().HasComponent(entity)) { continue; } diff --git a/Content.Server/AI/Utility/ExpandableActions/Nutrition/UseFoodInInventoryExp.cs b/Content.Server/AI/Utility/ExpandableActions/Nutrition/UseFoodInInventoryExp.cs index 71a65f0aca..dcba00439a 100644 --- a/Content.Server/AI/Utility/ExpandableActions/Nutrition/UseFoodInInventoryExp.cs +++ b/Content.Server/AI/Utility/ExpandableActions/Nutrition/UseFoodInInventoryExp.cs @@ -32,7 +32,7 @@ namespace Content.Server.AI.Utility.ExpandableActions.Nutrition foreach (var entity in context.GetState().GetValue()) { - if (!IoCManager.Resolve().HasComponent(entity.Uid)) + if (!IoCManager.Resolve().HasComponent(entity)) { continue; } diff --git a/Content.Server/AI/Utility/UtilityAiHelpers.cs b/Content.Server/AI/Utility/UtilityAiHelpers.cs index 3243bca6e3..7b24ef57ea 100644 --- a/Content.Server/AI/Utility/UtilityAiHelpers.cs +++ b/Content.Server/AI/Utility/UtilityAiHelpers.cs @@ -10,7 +10,7 @@ namespace Content.Server.AI.Utility { public static Blackboard? GetBlackboard(IEntity entity) { - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out AiControllerComponent? aiControllerComponent)) + if (!IoCManager.Resolve().TryGetComponent(entity, out AiControllerComponent? aiControllerComponent)) { return null; } diff --git a/Content.Server/AI/Utils/Visibility.cs b/Content.Server/AI/Utils/Visibility.cs index 1b16b7279b..6cbc876508 100644 --- a/Content.Server/AI/Utils/Visibility.cs +++ b/Content.Server/AI/Utils/Visibility.cs @@ -18,7 +18,7 @@ namespace Content.Server.AI.Utils public static IEnumerable GetNearestEntities(EntityCoordinates grid, Type component, float range) { var inRange = GetEntitiesInRange(grid, component, range).ToList(); - var sortedInRange = inRange.OrderBy(o => (IoCManager.Resolve().GetComponent(o.Uid).Coordinates.Position - grid.Position).Length); + var sortedInRange = inRange.OrderBy(o => (IoCManager.Resolve().GetComponent(o).Coordinates.Position - grid.Position).Length); return sortedInRange; } @@ -28,12 +28,12 @@ namespace Content.Server.AI.Utils var entityManager = IoCManager.Resolve(); foreach (var entity in entityManager.GetAllComponents(component).Select(c => c.Owner)) { - if (IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.GetGridId(entityManager) != grid.GetGridId(entityManager)) + if (IoCManager.Resolve().GetComponent(entity).Coordinates.GetGridId(entityManager) != grid.GetGridId(entityManager)) { continue; } - if ((IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.Position - grid.Position).Length <= range) + if ((IoCManager.Resolve().GetComponent(entity).Coordinates.Position - grid.Position).Length <= range) { yield return entity; } diff --git a/Content.Server/AI/WorldState/States/Clothing/EquippedClothingState.cs b/Content.Server/AI/WorldState/States/Clothing/EquippedClothingState.cs index e5d3fa6676..1314680392 100644 --- a/Content.Server/AI/WorldState/States/Clothing/EquippedClothingState.cs +++ b/Content.Server/AI/WorldState/States/Clothing/EquippedClothingState.cs @@ -16,7 +16,7 @@ namespace Content.Server.AI.WorldState.States.Clothing { var result = new Dictionary(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out InventoryComponent? inventoryComponent)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out InventoryComponent? inventoryComponent)) { return result; } diff --git a/Content.Server/AI/WorldState/States/Clothing/NearbyClothingState.cs b/Content.Server/AI/WorldState/States/Clothing/NearbyClothingState.cs index 9967959fb1..71f9f51b43 100644 --- a/Content.Server/AI/WorldState/States/Clothing/NearbyClothingState.cs +++ b/Content.Server/AI/WorldState/States/Clothing/NearbyClothingState.cs @@ -19,17 +19,17 @@ namespace Content.Server.AI.WorldState.States.Clothing { var result = new List(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AiControllerComponent? controller)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AiControllerComponent? controller)) { return result; } foreach (var entity in Visibility - .GetNearestEntities(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, typeof(ClothingComponent), controller.VisionRadius)) + .GetNearestEntities(IoCManager.Resolve().GetComponent(Owner).Coordinates, typeof(ClothingComponent), controller.VisionRadius)) { if (entity.TryGetContainer(out var container)) { - if (!IoCManager.Resolve().HasComponent(container.Owner.Uid)) + if (!IoCManager.Resolve().HasComponent(container.Owner)) { continue; } diff --git a/Content.Server/AI/WorldState/States/Combat/Nearby/NearbyMeleeWeapons.cs b/Content.Server/AI/WorldState/States/Combat/Nearby/NearbyMeleeWeapons.cs index 36af6b96cb..b064011b41 100644 --- a/Content.Server/AI/WorldState/States/Combat/Nearby/NearbyMeleeWeapons.cs +++ b/Content.Server/AI/WorldState/States/Combat/Nearby/NearbyMeleeWeapons.cs @@ -17,13 +17,13 @@ namespace Content.Server.AI.WorldState.States.Combat.Nearby { var result = new List(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AiControllerComponent? controller)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AiControllerComponent? controller)) { return result; } foreach (var entity in Visibility - .GetNearestEntities(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, typeof(MeleeWeaponComponent), controller.VisionRadius)) + .GetNearestEntities(IoCManager.Resolve().GetComponent(Owner).Coordinates, typeof(MeleeWeaponComponent), controller.VisionRadius)) { result.Add(entity); } diff --git a/Content.Server/AI/WorldState/States/Hands/AnyFreeHandState.cs b/Content.Server/AI/WorldState/States/Hands/AnyFreeHandState.cs index b7209dab07..9b33236cdb 100644 --- a/Content.Server/AI/WorldState/States/Hands/AnyFreeHandState.cs +++ b/Content.Server/AI/WorldState/States/Hands/AnyFreeHandState.cs @@ -11,7 +11,7 @@ namespace Content.Server.AI.WorldState.States.Hands public override string Name => "AnyFreeHand"; public override bool GetValue() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out HandsComponent? handsComponent)) { return false; } diff --git a/Content.Server/AI/WorldState/States/Hands/FreeHands.cs b/Content.Server/AI/WorldState/States/Hands/FreeHands.cs index 7e295419ca..83bada9c2c 100644 --- a/Content.Server/AI/WorldState/States/Hands/FreeHands.cs +++ b/Content.Server/AI/WorldState/States/Hands/FreeHands.cs @@ -15,7 +15,7 @@ namespace Content.Server.AI.WorldState.States.Hands { var result = new List(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out HandsComponent? handsComponent)) { return result; } diff --git a/Content.Server/AI/WorldState/States/Hands/HandItemsState.cs b/Content.Server/AI/WorldState/States/Hands/HandItemsState.cs index e35818ab03..5c95083458 100644 --- a/Content.Server/AI/WorldState/States/Hands/HandItemsState.cs +++ b/Content.Server/AI/WorldState/States/Hands/HandItemsState.cs @@ -13,7 +13,7 @@ namespace Content.Server.AI.WorldState.States.Hands public override List GetValue() { var result = new List(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out HandsComponent? handsComponent)) { return result; } diff --git a/Content.Server/AI/WorldState/States/Inventory/EquippedEntityState.cs b/Content.Server/AI/WorldState/States/Inventory/EquippedEntityState.cs index 556a31468b..43547899a4 100644 --- a/Content.Server/AI/WorldState/States/Inventory/EquippedEntityState.cs +++ b/Content.Server/AI/WorldState/States/Inventory/EquippedEntityState.cs @@ -15,7 +15,7 @@ namespace Content.Server.AI.WorldState.States.Inventory public override IEntity? GetValue() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out HandsComponent? handsComponent)) { return null; } diff --git a/Content.Server/AI/WorldState/States/Inventory/InventoryState.cs b/Content.Server/AI/WorldState/States/Inventory/InventoryState.cs index d058d6d8af..dc6767bd90 100644 --- a/Content.Server/AI/WorldState/States/Inventory/InventoryState.cs +++ b/Content.Server/AI/WorldState/States/Inventory/InventoryState.cs @@ -13,11 +13,11 @@ namespace Content.Server.AI.WorldState.States.Inventory public override IEnumerable GetValue() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out HandsComponent? handsComponent)) + if (IoCManager.Resolve().TryGetComponent(Owner, out HandsComponent? handsComponent)) { foreach (var item in handsComponent.GetAllHeldItems()) { - if ((!IoCManager.Resolve().EntityExists(item.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(item.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(item.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(item.Owner).EntityLifeStage) >= EntityLifeStage.Deleted) continue; yield return item.Owner; diff --git a/Content.Server/AI/WorldState/States/Inventory/LastOpenedStorageState.cs b/Content.Server/AI/WorldState/States/Inventory/LastOpenedStorageState.cs index 1ffda4f9c5..9be38ae361 100644 --- a/Content.Server/AI/WorldState/States/Inventory/LastOpenedStorageState.cs +++ b/Content.Server/AI/WorldState/States/Inventory/LastOpenedStorageState.cs @@ -18,7 +18,7 @@ namespace Content.Server.AI.WorldState.States.Inventory public override void SetValue(IEntity? value) { base.SetValue(value); - if (value != null && !IoCManager.Resolve().HasComponent(value.Uid)) + if (value != null && !IoCManager.Resolve().HasComponent(value)) { Logger.Warning("Set LastOpenedStorageState for an entity that doesn't have a storage component"); } diff --git a/Content.Server/AI/WorldState/States/Mobs/NearbyBodiesState.cs b/Content.Server/AI/WorldState/States/Mobs/NearbyBodiesState.cs index e191fd34fb..b8e9dd89e2 100644 --- a/Content.Server/AI/WorldState/States/Mobs/NearbyBodiesState.cs +++ b/Content.Server/AI/WorldState/States/Mobs/NearbyBodiesState.cs @@ -17,12 +17,12 @@ namespace Content.Server.AI.WorldState.States.Mobs { var result = new List(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AiControllerComponent? controller)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AiControllerComponent? controller)) { return result; } - foreach (var entity in Visibility.GetEntitiesInRange(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, typeof(SharedBodyComponent), controller.VisionRadius)) + foreach (var entity in Visibility.GetEntitiesInRange(IoCManager.Resolve().GetComponent(Owner).Coordinates, typeof(SharedBodyComponent), controller.VisionRadius)) { if (entity == Owner) continue; result.Add(entity); diff --git a/Content.Server/AI/WorldState/States/Mobs/NearbyPlayersState.cs b/Content.Server/AI/WorldState/States/Mobs/NearbyPlayersState.cs index aa2625c9a7..a4a85e9020 100644 --- a/Content.Server/AI/WorldState/States/Mobs/NearbyPlayersState.cs +++ b/Content.Server/AI/WorldState/States/Mobs/NearbyPlayersState.cs @@ -20,13 +20,13 @@ namespace Content.Server.AI.WorldState.States.Mobs { var result = new List(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AiControllerComponent? controller)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AiControllerComponent? controller)) { return result; } var nearbyPlayers = Filter.Empty() - .AddInRange(IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition, controller.VisionRadius) + .AddInRange(IoCManager.Resolve().GetComponent(Owner).MapPosition, controller.VisionRadius) .Recipients; foreach (var player in nearbyPlayers) @@ -36,7 +36,7 @@ namespace Content.Server.AI.WorldState.States.Mobs continue; } - if (player.AttachedEntity != Owner && IoCManager.Resolve().HasComponent(player.AttachedEntity.Uid)) + if (player.AttachedEntity != Owner && IoCManager.Resolve().HasComponent(player.AttachedEntity)) { result.Add(player.AttachedEntity); } diff --git a/Content.Server/AI/WorldState/States/Nutrition/HungryState.cs b/Content.Server/AI/WorldState/States/Nutrition/HungryState.cs index a75252d5ec..a9c9da5f74 100644 --- a/Content.Server/AI/WorldState/States/Nutrition/HungryState.cs +++ b/Content.Server/AI/WorldState/States/Nutrition/HungryState.cs @@ -14,7 +14,7 @@ namespace Content.Server.AI.WorldState.States.Nutrition public override bool GetValue() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out HungerComponent? hungerComponent)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out HungerComponent? hungerComponent)) { return false; } diff --git a/Content.Server/AI/WorldState/States/Nutrition/NearbyDrinkState.cs b/Content.Server/AI/WorldState/States/Nutrition/NearbyDrinkState.cs index bc1cd4c6eb..57377a0953 100644 --- a/Content.Server/AI/WorldState/States/Nutrition/NearbyDrinkState.cs +++ b/Content.Server/AI/WorldState/States/Nutrition/NearbyDrinkState.cs @@ -19,17 +19,17 @@ namespace Content.Server.AI.WorldState.States.Nutrition { var result = new List(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AiControllerComponent? controller)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AiControllerComponent? controller)) { return result; } foreach (var entity in Visibility - .GetNearestEntities(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, typeof(DrinkComponent), controller.VisionRadius)) + .GetNearestEntities(IoCManager.Resolve().GetComponent(Owner).Coordinates, typeof(DrinkComponent), controller.VisionRadius)) { if (entity.TryGetContainer(out var container)) { - if (!IoCManager.Resolve().HasComponent(container.Owner.Uid)) + if (!IoCManager.Resolve().HasComponent(container.Owner)) { continue; } diff --git a/Content.Server/AI/WorldState/States/Nutrition/NearbyFoodState.cs b/Content.Server/AI/WorldState/States/Nutrition/NearbyFoodState.cs index 33278f7d00..c820b8d2b5 100644 --- a/Content.Server/AI/WorldState/States/Nutrition/NearbyFoodState.cs +++ b/Content.Server/AI/WorldState/States/Nutrition/NearbyFoodState.cs @@ -19,17 +19,17 @@ namespace Content.Server.AI.WorldState.States.Nutrition { var result = new List(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AiControllerComponent? controller)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AiControllerComponent? controller)) { return result; } foreach (var entity in Visibility - .GetNearestEntities(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, typeof(FoodComponent), controller.VisionRadius)) + .GetNearestEntities(IoCManager.Resolve().GetComponent(Owner).Coordinates, typeof(FoodComponent), controller.VisionRadius)) { if (entity.TryGetContainer(out var container)) { - if (!IoCManager.Resolve().HasComponent(container.Owner.Uid)) + if (!IoCManager.Resolve().HasComponent(container.Owner)) { continue; } diff --git a/Content.Server/AI/WorldState/States/Nutrition/ThirstyState.cs b/Content.Server/AI/WorldState/States/Nutrition/ThirstyState.cs index 94c11b6120..fc78103085 100644 --- a/Content.Server/AI/WorldState/States/Nutrition/ThirstyState.cs +++ b/Content.Server/AI/WorldState/States/Nutrition/ThirstyState.cs @@ -14,7 +14,7 @@ namespace Content.Server.AI.WorldState.States.Nutrition public override bool GetValue() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out ThirstComponent? thirstComponent)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out ThirstComponent? thirstComponent)) { return false; } diff --git a/Content.Server/AME/AMENodeGroup.cs b/Content.Server/AME/AMENodeGroup.cs index 3667e9fb1c..f57d1605bb 100644 --- a/Content.Server/AME/AMENodeGroup.cs +++ b/Content.Server/AME/AMENodeGroup.cs @@ -46,11 +46,11 @@ namespace Content.Server.AME foreach (var node in groupNodes) { var nodeOwner = node.Owner; - if (IoCManager.Resolve().TryGetComponent(nodeOwner.Uid, out AMEShieldComponent? shield)) + if (IoCManager.Resolve().TryGetComponent(nodeOwner, out AMEShieldComponent? shield)) { - var nodeNeighbors = grid.GetCellsInSquareArea(IoCManager.Resolve().GetComponent(nodeOwner.Uid).Coordinates, 1) + var nodeNeighbors = grid.GetCellsInSquareArea(IoCManager.Resolve().GetComponent(nodeOwner).Coordinates, 1) .Select(sgc => IoCManager.Resolve().GetEntity(sgc)) - .Where(entity => entity != nodeOwner && IoCManager.Resolve().HasComponent(entity.Uid)); + .Where(entity => entity != nodeOwner && IoCManager.Resolve().HasComponent(entity)); if (nodeNeighbors.Count() >= 8) { @@ -69,7 +69,7 @@ namespace Content.Server.AME foreach (var node in groupNodes) { var nodeOwner = node.Owner; - if (IoCManager.Resolve().TryGetComponent(nodeOwner.Uid, out AMEControllerComponent? controller)) + if (IoCManager.Resolve().TryGetComponent(nodeOwner, out AMEControllerComponent? controller)) { if (_masterController == null) { @@ -177,7 +177,7 @@ namespace Content.Server.AME intensity = Math.Min(intensity, 8); - EntitySystem.Get().SpawnExplosion(epicenter.Owner.Uid, intensity / 2, intensity, intensity * 2, intensity * 3); + EntitySystem.Get().SpawnExplosion(epicenter.Owner, intensity / 2, intensity, intensity * 2, intensity * 3); } } } diff --git a/Content.Server/AME/Components/AMEControllerComponent.cs b/Content.Server/AME/Components/AMEControllerComponent.cs index 1d18b4c13d..cf14a58492 100644 --- a/Content.Server/AME/Components/AMEControllerComponent.cs +++ b/Content.Server/AME/Components/AMEControllerComponent.cs @@ -38,7 +38,7 @@ namespace Content.Server.AME.Components [DataField("clickSound")] private SoundSpecifier _clickSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg"); [DataField("injectSound")] private SoundSpecifier _injectSound = new SoundPathSpecifier("/Audio/Effects/bang.ogg"); - private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) || receiver.Powered; + private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered; [ViewVariables] private int _stability = 100; @@ -55,9 +55,9 @@ namespace Content.Server.AME.Components UserInterface.OnReceiveMessage += OnUiReceiveMessage; } - IoCManager.Resolve().TryGetComponent(Owner.Uid, out _appearance); + IoCManager.Resolve().TryGetComponent(Owner, out _appearance); - IoCManager.Resolve().TryGetComponent(Owner.Uid, out _powerSupplier); + IoCManager.Resolve().TryGetComponent(Owner, out _powerSupplier); _injecting = false; InjectionAmount = 2; @@ -96,7 +96,7 @@ namespace Content.Server.AME.Components if (jar is null) return; - IoCManager.Resolve().TryGetComponent(jar.Uid, out var fuelJar); + IoCManager.Resolve().TryGetComponent(jar, out var fuelJar); if (fuelJar != null && _powerSupplier != null) { var availableInject = fuelJar.FuelAmount >= InjectionAmount ? InjectionAmount : fuelJar.FuelAmount; @@ -120,12 +120,12 @@ namespace Content.Server.AME.Components /// Data relevant to the event such as the actor which triggered it. void IActivate.Activate(ActivateEventArgs args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) { return; } - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out HandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out HandsComponent? hands)) { Owner.PopupMessage(args.User, Loc.GetString("ame-controller-component-interact-no-hands-text")); return; @@ -157,7 +157,7 @@ namespace Content.Server.AME.Components return new AMEControllerBoundUserInterfaceState(Powered, IsMasterController(), false, HasJar, 0, InjectionAmount, GetCoreCount()); } - var jarcomponent = IoCManager.Resolve().GetComponent(jar.Uid); + var jarcomponent = IoCManager.Resolve().GetComponent(jar); return new AMEControllerBoundUserInterfaceState(Powered, IsMasterController(), _injecting, HasJar, jarcomponent.FuelAmount, InjectionAmount, GetCoreCount()); } @@ -175,7 +175,7 @@ namespace Content.Server.AME.Components var actionBlocker = EntitySystem.Get(); //Check if player can interact in their current state - if (!actionBlocker.CanInteract(playerEntity.Uid) || !actionBlocker.CanUse(playerEntity.Uid)) + if (!actionBlocker.CanInteract(playerEntity) || !actionBlocker.CanUse(playerEntity)) return false; //Check if device is powered if (needsPower && !Powered) @@ -246,7 +246,7 @@ namespace Content.Server.AME.Components _jarSlot.Remove(jar); UpdateUserInterface(); - if (!IoCManager.Resolve().TryGetComponent(user.Uid, out var hands) || !IoCManager.Resolve().TryGetComponent(jar.Uid, out var item)) + if (!IoCManager.Resolve().TryGetComponent(user, out var hands) || !IoCManager.Resolve().TryGetComponent(jar, out var item)) return; if (hands.CanPutInHand(item)) hands.PutInHand(item); @@ -290,7 +290,7 @@ namespace Content.Server.AME.Components private AMENodeGroup? GetAMENodeGroup() { - IoCManager.Resolve().TryGetComponent(Owner.Uid, out NodeContainerComponent? nodeContainer); + IoCManager.Resolve().TryGetComponent(Owner, out NodeContainerComponent? nodeContainer); var engineNodeGroup = nodeContainer?.Nodes.Values .Select(node => node.NodeGroup) @@ -336,7 +336,7 @@ namespace Content.Server.AME.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out HandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out HandsComponent? hands)) { Owner.PopupMessage(args.User, Loc.GetString("ame-controller-component-interact-using-no-hands-text")); return true; @@ -349,7 +349,7 @@ namespace Content.Server.AME.Components } var activeHandEntity = hands.GetActiveHand.Owner; - if (IoCManager.Resolve().TryGetComponent(activeHandEntity.Uid, out var fuelContainer)) + if (IoCManager.Resolve().TryGetComponent(activeHandEntity, out var fuelContainer)) { if (HasJar) { diff --git a/Content.Server/AME/Components/AMEPartComponent.cs b/Content.Server/AME/Components/AMEPartComponent.cs index 997e3976db..c3da184a86 100644 --- a/Content.Server/AME/Components/AMEPartComponent.cs +++ b/Content.Server/AME/Components/AMEPartComponent.cs @@ -35,13 +35,13 @@ namespace Content.Server.AME.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs args) { - if (!IoCManager.Resolve().HasComponent(args.User.Uid)) + if (!IoCManager.Resolve().HasComponent(args.User)) { Owner.PopupMessage(args.User, Loc.GetString("ame-part-component-interact-using-no-hands")); return false; } - if (!EntitySystem.Get().HasQuality(args.Using.Uid, _qualityNeeded)) + if (!EntitySystem.Get().HasQuality(args.Using, _qualityNeeded)) return false; if (!_mapManager.TryGetGrid(args.ClickLocation.GetGridId(_serverEntityManager), out var mapGrid)) @@ -58,7 +58,7 @@ namespace Content.Server.AME.Components SoundSystem.Play(Filter.Pvs(Owner), _unwrapSound.GetSound(), Owner); - IoCManager.Resolve().QueueDeleteEntity(Owner.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) Owner); return true; } diff --git a/Content.Server/AME/Components/AMEShieldComponent.cs b/Content.Server/AME/Components/AMEShieldComponent.cs index 61faaa5a03..ac86d5ccf8 100644 --- a/Content.Server/AME/Components/AMEShieldComponent.cs +++ b/Content.Server/AME/Components/AMEShieldComponent.cs @@ -22,8 +22,8 @@ namespace Content.Server.AME.Components protected override void Initialize() { base.Initialize(); - IoCManager.Resolve().TryGetComponent(Owner.Uid, out _appearance); - IoCManager.Resolve().TryGetComponent(Owner.Uid, out _pointLight); + IoCManager.Resolve().TryGetComponent(Owner, out _appearance); + IoCManager.Resolve().TryGetComponent(Owner, out _pointLight); } public void SetCore() diff --git a/Content.Server/Access/Components/IdCardConsoleComponent.cs b/Content.Server/Access/Components/IdCardConsoleComponent.cs index d3c5d5bc5a..9c93b7e454 100644 --- a/Content.Server/Access/Components/IdCardConsoleComponent.cs +++ b/Content.Server/Access/Components/IdCardConsoleComponent.cs @@ -23,7 +23,7 @@ namespace Content.Server.Access.Components [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(IdCardConsoleUiKey.Key); - [ViewVariables] private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) || receiver.Powered; + [ViewVariables] private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered; protected override void Initialize() { @@ -70,14 +70,14 @@ namespace Content.Server.Access.Components /// private bool PrivilegedIdIsAuthorized() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AccessReader? reader)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AccessReader? reader)) { return true; } var privilegedIdEntity = PrivilegedIdSlot.Item; var accessSystem = EntitySystem.Get(); - return privilegedIdEntity != null && accessSystem.IsAllowed(reader, privilegedIdEntity.Uid); + return privilegedIdEntity != null && accessSystem.IsAllowed(reader, privilegedIdEntity); } /// @@ -91,8 +91,8 @@ namespace Content.Server.Access.Components return; var cardSystem = EntitySystem.Get(); - cardSystem.TryChangeFullName(targetIdEntity.Uid, newFullName); - cardSystem.TryChangeJobTitle(targetIdEntity.Uid, newJobTitle); + cardSystem.TryChangeFullName(targetIdEntity, newFullName); + cardSystem.TryChangeJobTitle(targetIdEntity, newJobTitle); if (!newAccessList.TrueForAll(x => _prototypeManager.HasIndex(x))) { @@ -101,7 +101,7 @@ namespace Content.Server.Access.Components } var accessSystem = EntitySystem.Get(); - accessSystem.TrySetTags(targetIdEntity.Uid, newAccessList); + accessSystem.TrySetTags(targetIdEntity, newAccessList); } /// @@ -110,9 +110,9 @@ namespace Content.Server.Access.Components private void HandleIdButton(IEntity user, ItemSlot slot) { if (slot.HasItem) - EntitySystem.Get().TryEjectToHands(OwnerUid, slot, user.Uid); + EntitySystem.Get().TryEjectToHands(OwnerUid, slot, user); else - EntitySystem.Get().TryInsertFromHand(OwnerUid, slot, user.Uid); + EntitySystem.Get().TryInsertFromHand(OwnerUid, slot, user); } public void UpdateUserInterface() @@ -130,16 +130,16 @@ namespace Content.Server.Access.Components null, null, null, - (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid).EntityName : null) ?? string.Empty, + (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier).EntityName : null) ?? string.Empty, string.Empty); } else { - var targetIdComponent = IoCManager.Resolve().GetComponent(targetIdEntity.Uid); - var targetAccessComponent = IoCManager.Resolve().GetComponent(targetIdEntity.Uid); + var targetIdComponent = IoCManager.Resolve().GetComponent(targetIdEntity); + var targetAccessComponent = IoCManager.Resolve().GetComponent(targetIdEntity); var name = string.Empty; if(PrivilegedIdSlot.Item != null) - name = IoCManager.Resolve().GetComponent(PrivilegedIdSlot.Item.Uid).EntityName; + name = IoCManager.Resolve().GetComponent(PrivilegedIdSlot.Item).EntityName; newState = new IdCardConsoleBoundUserInterfaceState( PrivilegedIdSlot.HasItem, PrivilegedIdIsAuthorized(), @@ -148,7 +148,7 @@ namespace Content.Server.Access.Components targetIdComponent.JobTitle, targetAccessComponent.Tags.ToArray(), name, - IoCManager.Resolve().GetComponent(targetIdEntity.Uid).EntityName); + IoCManager.Resolve().GetComponent(targetIdEntity).EntityName); } UserInterface?.SetState(newState); } diff --git a/Content.Server/Access/Systems/AccessReaderSystem.cs b/Content.Server/Access/Systems/AccessReaderSystem.cs index 64641446fe..45ee5116c7 100644 --- a/Content.Server/Access/Systems/AccessReaderSystem.cs +++ b/Content.Server/Access/Systems/AccessReaderSystem.cs @@ -73,7 +73,7 @@ namespace Content.Server.Access.Systems if (EntityManager.TryGetComponent(uid, out SharedHandsComponent? hands)) { if (hands.TryGetActiveHeldEntity(out var heldItem) && - FindAccessTagsItem(heldItem.Uid, out tags)) + FindAccessTagsItem(heldItem, out tags)) { return tags; } @@ -84,7 +84,7 @@ namespace Content.Server.Access.Systems { if (inventoryComponent.HasSlot(EquipmentSlotDefines.Slots.IDCARD) && inventoryComponent.TryGetSlotItem(EquipmentSlotDefines.Slots.IDCARD, out ItemComponent? item) && - FindAccessTagsItem(item.Owner.Uid, out tags) + FindAccessTagsItem(item.Owner, out tags) ) { return tags; @@ -111,7 +111,7 @@ namespace Content.Server.Access.Systems IEntity tempQualifier = pda?.ContainedID?.Owner; if (tempQualifier != null) { - IoCManager.Resolve().GetComponent(tempQualifier.Uid); + IoCManager.Resolve().GetComponent(tempQualifier); } tags = RETURNED_VALUE?.Tags; diff --git a/Content.Server/Access/Systems/IdCardSystem.cs b/Content.Server/Access/Systems/IdCardSystem.cs index d0e81e4a28..7e1141bede 100644 --- a/Content.Server/Access/Systems/IdCardSystem.cs +++ b/Content.Server/Access/Systems/IdCardSystem.cs @@ -22,7 +22,7 @@ namespace Content.Server.Access.Systems private void OnInit(EntityUid uid, IdCardComponent id, ComponentInit args) { - id.OriginalOwnerName ??= IoCManager.Resolve().GetComponent(id.Owner.Uid).EntityName; + id.OriginalOwnerName ??= IoCManager.Resolve().GetComponent(id.Owner).EntityName; UpdateEntityName(uid, id); } @@ -67,7 +67,7 @@ namespace Content.Server.Access.Systems if (string.IsNullOrWhiteSpace(id.FullName) && string.IsNullOrWhiteSpace(id.JobTitle)) { - IoCManager.Resolve().GetComponent(id.Owner.Uid).EntityName = id.OriginalOwnerName; + IoCManager.Resolve().GetComponent(id.Owner).EntityName = id.OriginalOwnerName; return; } @@ -80,7 +80,7 @@ namespace Content.Server.Access.Systems : Loc.GetString("access-id-card-component-owner-full-name-job-title-text", ("fullName", id.FullName), ("jobSuffix", jobSuffix)); - IoCManager.Resolve().GetComponent(id.Owner.Uid).EntityName = val; + IoCManager.Resolve().GetComponent(id.Owner).EntityName = val; } /// @@ -92,7 +92,7 @@ namespace Content.Server.Access.Systems // check held item? if (EntityManager.TryGetComponent(uid, out SharedHandsComponent? hands) && hands.TryGetActiveHeldEntity(out var heldItem) && - TryGetIdCard(heldItem.Uid, out idCard)) + TryGetIdCard(heldItem, out idCard)) { return true; } @@ -105,7 +105,7 @@ namespace Content.Server.Access.Systems if (EntityManager.TryGetComponent(uid, out InventoryComponent? inventoryComponent) && inventoryComponent.HasSlot(EquipmentSlotDefines.Slots.IDCARD) && inventoryComponent.TryGetSlotItem(EquipmentSlotDefines.Slots.IDCARD, out ItemComponent? item) && - TryGetIdCard(item.Owner.Uid, out idCard)) + TryGetIdCard(item.Owner, out idCard)) { return true; } diff --git a/Content.Server/Actions/Actions/CombatMode.cs b/Content.Server/Actions/Actions/CombatMode.cs index 17ec641b0a..e072b317a9 100644 --- a/Content.Server/Actions/Actions/CombatMode.cs +++ b/Content.Server/Actions/Actions/CombatMode.cs @@ -15,7 +15,7 @@ namespace Content.Server.Actions.Actions { public bool DoToggleAction(ToggleActionEventArgs args) { - if (!IoCManager.Resolve().TryGetComponent(args.Performer.Uid, out CombatModeComponent? combatMode)) + if (!IoCManager.Resolve().TryGetComponent(args.Performer, out CombatModeComponent? combatMode)) { return false; } diff --git a/Content.Server/Actions/Actions/DebugTargetEntity.cs b/Content.Server/Actions/Actions/DebugTargetEntity.cs index 0b079018df..e2b5cab049 100644 --- a/Content.Server/Actions/Actions/DebugTargetEntity.cs +++ b/Content.Server/Actions/Actions/DebugTargetEntity.cs @@ -13,14 +13,14 @@ namespace Content.Server.Actions.Actions { public void DoTargetEntityAction(TargetEntityItemActionEventArgs args) { - args.Performer.PopupMessageEveryone(IoCManager.Resolve().GetComponent(args.Item.Uid).EntityName + ": Clicked " + - IoCManager.Resolve().GetComponent(args.Target.Uid).EntityName); + args.Performer.PopupMessageEveryone(IoCManager.Resolve().GetComponent(args.Item).EntityName + ": Clicked " + + IoCManager.Resolve().GetComponent(args.Target).EntityName); } public void DoTargetEntityAction(TargetEntityActionEventArgs args) { args.Performer.PopupMessageEveryone("Clicked " + - IoCManager.Resolve().GetComponent(args.Target.Uid).EntityName); + IoCManager.Resolve().GetComponent(args.Target).EntityName); } } } diff --git a/Content.Server/Actions/Actions/DebugTargetPoint.cs b/Content.Server/Actions/Actions/DebugTargetPoint.cs index 6c9a01b822..bcab85d283 100644 --- a/Content.Server/Actions/Actions/DebugTargetPoint.cs +++ b/Content.Server/Actions/Actions/DebugTargetPoint.cs @@ -13,7 +13,7 @@ namespace Content.Server.Actions.Actions { public void DoTargetPointAction(TargetPointItemActionEventArgs args) { - args.Performer.PopupMessageEveryone(IoCManager.Resolve().GetComponent(args.Item.Uid).EntityName + ": Clicked local position " + + args.Performer.PopupMessageEveryone(IoCManager.Resolve().GetComponent(args.Item).EntityName + ": Clicked local position " + args.Target); } diff --git a/Content.Server/Actions/Actions/DebugToggle.cs b/Content.Server/Actions/Actions/DebugToggle.cs index 587c08c255..b1d18fb68f 100644 --- a/Content.Server/Actions/Actions/DebugToggle.cs +++ b/Content.Server/Actions/Actions/DebugToggle.cs @@ -19,11 +19,11 @@ namespace Content.Server.Actions.Actions { if (args.ToggledOn) { - args.Performer.PopupMessageEveryone(IoCManager.Resolve().GetComponent(args.Item.Uid).EntityName + ": " + MessageOn); + args.Performer.PopupMessageEveryone(IoCManager.Resolve().GetComponent(args.Item).EntityName + ": " + MessageOn); } else { - args.Performer.PopupMessageEveryone(IoCManager.Resolve().GetComponent(args.Item.Uid).EntityName + ": " +MessageOff); + args.Performer.PopupMessageEveryone(IoCManager.Resolve().GetComponent(args.Item).EntityName + ": " +MessageOff); } return true; diff --git a/Content.Server/Actions/Actions/DisarmAction.cs b/Content.Server/Actions/Actions/DisarmAction.cs index b0982e62ea..2140ef6c1f 100644 --- a/Content.Server/Actions/Actions/DisarmAction.cs +++ b/Content.Server/Actions/Actions/DisarmAction.cs @@ -49,18 +49,18 @@ namespace Content.Server.Actions.Actions public void DoTargetEntityAction(TargetEntityActionEventArgs args) { - var disarmedActs = IoCManager.Resolve().GetComponents(args.Target.Uid).ToArray(); + var disarmedActs = IoCManager.Resolve().GetComponents(args.Target).ToArray(); if (!args.Performer.InRangeUnobstructed(args.Target)) return; if (disarmedActs.Length == 0) { - if (IoCManager.Resolve().TryGetComponent(args.Performer.Uid, out ActorComponent? actor)) + if (IoCManager.Resolve().TryGetComponent(args.Performer, out ActorComponent? actor)) { // Fall back to a normal interaction with the entity var player = actor.PlayerSession; - var coordinates = IoCManager.Resolve().GetComponent(args.Target.Uid).Coordinates; - var target = args.Target.Uid; + var coordinates = IoCManager.Resolve().GetComponent(args.Target).Coordinates; + var target = (EntityUid) args.Target; EntitySystem.Get().HandleUseInteraction(player, coordinates, target); return; } @@ -68,13 +68,13 @@ namespace Content.Server.Actions.Actions return; } - if (!IoCManager.Resolve().TryGetComponent(args.Performer.Uid, out var actions)) return; - if (args.Target == args.Performer || !EntitySystem.Get().CanAttack(args.Performer.Uid)) return; + if (!IoCManager.Resolve().TryGetComponent(args.Performer, out var actions)) return; + if (args.Target == args.Performer || !EntitySystem.Get().CanAttack(args.Performer)) return; var random = IoCManager.Resolve(); var system = EntitySystem.Get(); - var diff = IoCManager.Resolve().GetComponent(args.Target.Uid).MapPosition.Position - IoCManager.Resolve().GetComponent(args.Performer.Uid).MapPosition.Position; + var diff = IoCManager.Resolve().GetComponent(args.Target).MapPosition.Position - IoCManager.Resolve().GetComponent(args.Performer).MapPosition.Position; var angle = Angle.FromWorldVec(diff); actions.Cooldown(ActionType.Disarm, Cooldowns.SecondsFromNow(_cooldown)); @@ -84,10 +84,10 @@ namespace Content.Server.Actions.Actions SoundSystem.Play(Filter.Pvs(args.Performer), PunchMissSound.GetSound(), args.Performer, AudioHelpers.WithVariation(0.025f)); args.Performer.PopupMessageOtherClients(Loc.GetString("disarm-action-popup-message-other-clients", - ("performerName", Name: IoCManager.Resolve().GetComponent(args.Performer.Uid).EntityName), - ("targetName", Name: IoCManager.Resolve().GetComponent(args.Target.Uid).EntityName))); + ("performerName", Name: IoCManager.Resolve().GetComponent(args.Performer).EntityName), + ("targetName", Name: IoCManager.Resolve().GetComponent(args.Target).EntityName))); args.Performer.PopupMessageCursor(Loc.GetString("disarm-action-popup-message-cursor", - ("targetName", Name: IoCManager.Resolve().GetComponent(args.Target.Uid).EntityName))); + ("targetName", Name: IoCManager.Resolve().GetComponent(args.Target).EntityName))); system.SendLunge(angle, args.Performer); return; } @@ -96,7 +96,7 @@ namespace Content.Server.Actions.Actions var eventArgs = new DisarmedActEvent() { Target = args.Target, Source = args.Performer, PushProbability = _pushProb }; - IoCManager.Resolve().EventBus.RaiseLocalEvent(args.Target.Uid, eventArgs); + IoCManager.Resolve().EventBus.RaiseLocalEvent(args.Target, eventArgs); EntitySystem.Get().Add(LogType.DisarmedAction, LogImpact.Low, $"{args.Performer:performer} used disarm on {args.Target:target}"); @@ -114,7 +114,7 @@ namespace Content.Server.Actions.Actions return; } - SoundSystem.Play(Filter.Pvs(args.Performer), DisarmSuccessSound.GetSound(), IoCManager.Resolve().GetComponent(args.Performer.Uid).Coordinates, AudioHelpers.WithVariation(0.025f)); + SoundSystem.Play(Filter.Pvs(args.Performer), DisarmSuccessSound.GetSound(), IoCManager.Resolve().GetComponent(args.Performer).Coordinates, AudioHelpers.WithVariation(0.025f)); } } } diff --git a/Content.Server/Actions/Actions/GhostBoo.cs b/Content.Server/Actions/Actions/GhostBoo.cs index 43c25d2dad..6607b86a20 100644 --- a/Content.Server/Actions/Actions/GhostBoo.cs +++ b/Content.Server/Actions/Actions/GhostBoo.cs @@ -23,7 +23,7 @@ namespace Content.Server.Actions.Actions public void DoInstantAction(InstantActionEventArgs args) { - if (!IoCManager.Resolve().TryGetComponent(args.Performer.Uid, out var actions)) return; + if (!IoCManager.Resolve().TryGetComponent(args.Performer, out var actions)) return; // find all IGhostBooAffected nearby and do boo on them var ents = IoCManager.Resolve().GetEntitiesInRange(args.Performer, _radius); @@ -32,7 +32,7 @@ namespace Content.Server.Actions.Actions foreach (var ent in ents) { var ghostBoo = new GhostBooEvent(); - IoCManager.Resolve().EventBus.RaiseLocalEvent(ent.Uid, ghostBoo); + IoCManager.Resolve().EventBus.RaiseLocalEvent(ent, ghostBoo); if (ghostBoo.Handled) booCounter++; diff --git a/Content.Server/Actions/Actions/PAIMidi.cs b/Content.Server/Actions/Actions/PAIMidi.cs index 10d5aa516a..3c4e58ffac 100644 --- a/Content.Server/Actions/Actions/PAIMidi.cs +++ b/Content.Server/Actions/Actions/PAIMidi.cs @@ -23,8 +23,8 @@ namespace Content.Server.Actions.Actions public void DoInstantAction(InstantActionEventArgs args) { - if (!IoCManager.Resolve().TryGetComponent(args.Performer.Uid, out var serverUi)) return; - if (!IoCManager.Resolve().TryGetComponent(args.Performer.Uid, out var actor)) return; + if (!IoCManager.Resolve().TryGetComponent(args.Performer, out var serverUi)) return; + if (!IoCManager.Resolve().TryGetComponent(args.Performer, out var actor)) return; if (!serverUi.TryGetBoundUserInterface(InstrumentUiKey.Key,out var bui)) return; bui.Toggle(actor.PlayerSession); diff --git a/Content.Server/Actions/Actions/ScreamAction.cs b/Content.Server/Actions/Actions/ScreamAction.cs index f050337fd5..73289cd0ff 100644 --- a/Content.Server/Actions/Actions/ScreamAction.cs +++ b/Content.Server/Actions/Actions/ScreamAction.cs @@ -41,9 +41,9 @@ namespace Content.Server.Actions.Actions public void DoInstantAction(InstantActionEventArgs args) { - if (!EntitySystem.Get().CanSpeak(args.Performer.Uid)) return; - if (!IoCManager.Resolve().TryGetComponent(args.Performer.Uid, out var humanoid)) return; - if (!IoCManager.Resolve().TryGetComponent(args.Performer.Uid, out var actions)) return; + if (!EntitySystem.Get().CanSpeak(args.Performer)) return; + if (!IoCManager.Resolve().TryGetComponent(args.Performer, out var humanoid)) return; + if (!IoCManager.Resolve().TryGetComponent(args.Performer, out var actions)) return; if (_random.Prob(.01f)) { diff --git a/Content.Server/Actions/Commands/CooldownAction.cs b/Content.Server/Actions/Commands/CooldownAction.cs index 04d0c9b7f2..cb5e8d9b1a 100644 --- a/Content.Server/Actions/Commands/CooldownAction.cs +++ b/Content.Server/Actions/Commands/CooldownAction.cs @@ -30,7 +30,7 @@ namespace Content.Server.Actions.Commands } if (attachedEntity == null) return; - if (!IoCManager.Resolve().TryGetComponent(attachedEntity.Uid, out ServerActionsComponent? actionsComponent)) + if (!IoCManager.Resolve().TryGetComponent(attachedEntity, out ServerActionsComponent? actionsComponent)) { shell.WriteLine("user has no actions component"); return; diff --git a/Content.Server/Actions/Commands/GrantAction.cs b/Content.Server/Actions/Commands/GrantAction.cs index 376d3e3687..3df0bc6050 100644 --- a/Content.Server/Actions/Commands/GrantAction.cs +++ b/Content.Server/Actions/Commands/GrantAction.cs @@ -28,7 +28,7 @@ namespace Content.Server.Actions.Commands } if (attachedEntity == null) return; - if (!IoCManager.Resolve().TryGetComponent(attachedEntity.Uid, out ServerActionsComponent? actionsComponent)) + if (!IoCManager.Resolve().TryGetComponent(attachedEntity, out ServerActionsComponent? actionsComponent)) { shell.WriteLine("user has no actions component"); return; diff --git a/Content.Server/Actions/Commands/RevokeAction.cs b/Content.Server/Actions/Commands/RevokeAction.cs index 4b657e8ffd..094b1c0e28 100644 --- a/Content.Server/Actions/Commands/RevokeAction.cs +++ b/Content.Server/Actions/Commands/RevokeAction.cs @@ -28,7 +28,7 @@ namespace Content.Server.Actions.Commands if (!CommandUtils.TryGetAttachedEntityByUsernameOrId(shell, target, player, out attachedEntity)) return; } if (attachedEntity == null) return; - if (!IoCManager.Resolve().TryGetComponent(attachedEntity.Uid, out ServerActionsComponent? actionsComponent)) + if (!IoCManager.Resolve().TryGetComponent(attachedEntity, out ServerActionsComponent? actionsComponent)) { shell.WriteLine("user has no actions component"); return; diff --git a/Content.Server/Actions/ServerActionsComponent.cs b/Content.Server/Actions/ServerActionsComponent.cs index fd2a7698f0..fb51fda434 100644 --- a/Content.Server/Actions/ServerActionsComponent.cs +++ b/Content.Server/Actions/ServerActionsComponent.cs @@ -63,7 +63,7 @@ namespace Content.Server.Actions if (!attempt.TryGetActionState(this, out var actionState) || !actionState.Enabled) { Logger.DebugS("action", "user {0} attempted to use" + - " action {1} which is not granted to them", IoCManager.Resolve().GetComponent(player.Uid).EntityName, + " action {1} which is not granted to them", IoCManager.Resolve().GetComponent(player).EntityName, attempt); return; } @@ -71,7 +71,7 @@ namespace Content.Server.Actions if (actionState.IsOnCooldown(GameTiming)) { Logger.DebugS("action", "user {0} attempted to use" + - " action {1} which is on cooldown", IoCManager.Resolve().GetComponent(player.Uid).EntityName, + " action {1} which is on cooldown", IoCManager.Resolve().GetComponent(player).EntityName, attempt); return; } @@ -86,7 +86,7 @@ namespace Content.Server.Actions if (toggleMsg.ToggleOn == actionState.ToggledOn) { Logger.DebugS("action", "user {0} attempted to" + - " toggle action {1} to {2}, but it is already toggled {2}", IoCManager.Resolve().GetComponent(player.Uid).EntityName, + " toggle action {1} to {2}, but it is already toggled {2}", IoCManager.Resolve().GetComponent(player).EntityName, attempt.Action.Name, toggleMsg.ToggleOn); return; } @@ -113,11 +113,11 @@ namespace Content.Server.Actions { Logger.DebugS("action", "user {0} attempted to" + " perform target entity action {1} but could not find entity with " + - "provided uid {2}", IoCManager.Resolve().GetComponent(player.Uid).EntityName, attempt.Action.Name, + "provided uid {2}", IoCManager.Resolve().GetComponent(player).EntityName, attempt.Action.Name, targetEntityMsg.Target); return; } - if (!CheckRangeAndSetFacing(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates, player)) return; + if (!CheckRangeAndSetFacing(IoCManager.Resolve().GetComponent(entity).Coordinates, player)) return; attempt.DoTargetEntityAction(player, entity); break; @@ -160,7 +160,7 @@ namespace Content.Server.Actions return null; } - if (!IoCManager.Resolve().TryGetComponent(item.Uid, out var actionsComponent)) + if (!IoCManager.Resolve().TryGetComponent(item, out var actionsComponent)) { Logger.DebugS("action", "user {0} attempted to perform" + " item action {1} for item {2} which has no ItemActionsComponent", @@ -198,13 +198,13 @@ namespace Content.Server.Actions { // ensure it's within their clickable range var targetWorldPos = target.ToMapPos(EntityManager); - var rangeBox = new Box2(IoCManager.Resolve().GetComponent(player.Uid).WorldPosition, IoCManager.Resolve().GetComponent(player.Uid).WorldPosition) + var rangeBox = new Box2(IoCManager.Resolve().GetComponent(player).WorldPosition, IoCManager.Resolve().GetComponent(player).WorldPosition) .Enlarged(MaxUpdateRange); if (!rangeBox.Contains(targetWorldPos)) { Logger.DebugS("action", "user {0} attempted to" + " perform target action further than allowed range", - IoCManager.Resolve().GetComponent(player.Uid).EntityName); + IoCManager.Resolve().GetComponent(player).EntityName); return false; } diff --git a/Content.Server/Actions/Spells/GiveItemSpell.cs b/Content.Server/Actions/Spells/GiveItemSpell.cs index 8919c0bfa3..21f472771f 100644 --- a/Content.Server/Actions/Spells/GiveItemSpell.cs +++ b/Content.Server/Actions/Spells/GiveItemSpell.cs @@ -36,13 +36,13 @@ namespace Content.Server.Actions.Spells { var caster = args.Performer; - if (!IoCManager.Resolve().TryGetComponent(caster.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(caster, out HandsComponent? handsComponent)) { caster.PopupMessage(Loc.GetString("spell-fail-no-hands")); return; } - if (!EntitySystem.Get().CanInteract(caster.Uid)) return; + if (!EntitySystem.Get().CanInteract(caster)) return; // TODO: Nix when we get EntityPrototype serializers if (!IoCManager.Resolve().HasIndex(ItemProto)) @@ -52,12 +52,12 @@ namespace Content.Server.Actions.Spells } // TODO: Look this is shitty and ideally a test would do it - var spawnedProto = IoCManager.Resolve().SpawnEntity(ItemProto, IoCManager.Resolve().GetComponent(caster.Uid).MapPosition); + var spawnedProto = IoCManager.Resolve().SpawnEntity(ItemProto, IoCManager.Resolve().GetComponent(caster).MapPosition); - if (!IoCManager.Resolve().TryGetComponent(spawnedProto.Uid, out ItemComponent? itemComponent)) + if (!IoCManager.Resolve().TryGetComponent(spawnedProto, out ItemComponent? itemComponent)) { Logger.Error($"Tried to use {nameof(GiveItemSpell)} but prototype has no {nameof(ItemComponent)}?"); - IoCManager.Resolve().DeleteEntity(spawnedProto.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) spawnedProto); return; } diff --git a/Content.Server/Administration/AdminSystem.cs b/Content.Server/Administration/AdminSystem.cs index 9281f649e8..0da1c32f89 100644 --- a/Content.Server/Administration/AdminSystem.cs +++ b/Content.Server/Administration/AdminSystem.cs @@ -126,10 +126,10 @@ namespace Content.Server.Administration var username = string.Empty; if(session.AttachedEntity != null) - username = IoCManager.Resolve().GetComponent(session.AttachedEntity.Uid).EntityName; + username = IoCManager.Resolve().GetComponent(session.AttachedEntity).EntityName; var antag = session.ContentData()?.Mind?.AllRoles.Any(r => r.Antagonist) ?? false; - var uid = session.AttachedEntity?.Uid ?? EntityUid.Invalid; + var uid = session.AttachedEntity ?? EntityUid.Invalid; return new PlayerInfo(name, username, antag, uid, session.UserId); } diff --git a/Content.Server/Administration/AdminVerbSystem.cs b/Content.Server/Administration/AdminVerbSystem.cs index dff0b62986..0b422cad5b 100644 --- a/Content.Server/Administration/AdminVerbSystem.cs +++ b/Content.Server/Administration/AdminVerbSystem.cs @@ -56,7 +56,7 @@ namespace Content.Server.Administration private void AddDebugVerbs(GetOtherVerbsEvent args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out var actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out var actor)) return; var player = actor.PlayerSession; @@ -68,7 +68,7 @@ namespace Content.Server.Administration verb.Text = Loc.GetString("delete-verb-get-data-text"); verb.Category = VerbCategory.Debug; verb.IconTexture = "/Textures/Interface/VerbIcons/delete_transparent.svg.192dpi.png"; - verb.Act = () => IoCManager.Resolve().DeleteEntity(args.Target.Uid); + verb.Act = () => IoCManager.Resolve().DeleteEntity((EntityUid) args.Target); verb.Impact = LogImpact.Medium; args.Verbs.Add(verb); } @@ -88,8 +88,8 @@ namespace Content.Server.Administration // Control mob verb if (_groupController.CanCommand(player, "controlmob") && args.User != args.Target && - IoCManager.Resolve().HasComponent(args.User.Uid) && - IoCManager.Resolve().TryGetComponent(args.Target.Uid, out var targetMind)) + IoCManager.Resolve().HasComponent(args.User) && + IoCManager.Resolve().TryGetComponent(args.Target, out var targetMind)) { Verb verb = new(); verb.Text = Loc.GetString("control-mob-verb-get-data-text"); @@ -97,7 +97,7 @@ namespace Content.Server.Administration // TODO VERB ICON control mob icon verb.Act = () => { - player.ContentData()?.Mind?.TransferTo(args.Target.Uid, ghostCheckOverride: true); + player.ContentData()?.Mind?.TransferTo(args.Target, ghostCheckOverride: true); }; verb.Impact = LogImpact.High; args.Verbs.Add(verb); @@ -106,13 +106,13 @@ namespace Content.Server.Administration // Make Sentient verb if (_groupController.CanCommand(player, "makesentient") && args.User != args.Target && - !IoCManager.Resolve().HasComponent(args.Target.Uid)) + !IoCManager.Resolve().HasComponent(args.Target)) { Verb verb = new(); verb.Text = Loc.GetString("make-sentient-verb-get-data-text"); verb.Category = VerbCategory.Debug; verb.IconTexture = "/Textures/Interface/VerbIcons/sentient.svg.192dpi.png"; - verb.Act = () => MakeSentientCommand.MakeSentient(args.Target.Uid, EntityManager); + verb.Act = () => MakeSentientCommand.MakeSentient(args.Target, EntityManager); verb.Impact = LogImpact.Medium; args.Verbs.Add(verb); } @@ -125,9 +125,9 @@ namespace Content.Server.Administration verb.Category = VerbCategory.Debug; verb.Act = () => { - var coords = IoCManager.Resolve().GetComponent(args.Target.Uid).Coordinates; + var coords = IoCManager.Resolve().GetComponent(args.Target).Coordinates; Timer.Spawn(_gameTiming.TickPeriod, () => _explosions.SpawnExplosion(coords, 0, 1, 2, 1), CancellationToken.None); - if (IoCManager.Resolve().TryGetComponent(args.Target.Uid, out SharedBodyComponent? body)) + if (IoCManager.Resolve().TryGetComponent(args.Target, out SharedBodyComponent? body)) { body.Gib(); } @@ -138,7 +138,7 @@ namespace Content.Server.Administration // Set clothing verb if (_groupController.CanCommand(player, "setoutfit") && - IoCManager.Resolve().HasComponent(args.Target.Uid)) + IoCManager.Resolve().HasComponent(args.Target)) { Verb verb = new(); verb.Text = Loc.GetString("set-outfit-verb-get-data-text"); @@ -168,7 +168,7 @@ namespace Content.Server.Administration // Get Disposal tube direction verb if (_groupController.CanCommand(player, "tubeconnections") && - IoCManager.Resolve().TryGetComponent(args.Target.Uid, out var tube)) + IoCManager.Resolve().TryGetComponent(args.Target, out var tube)) { Verb verb = new(); verb.Text = Loc.GetString("tube-direction-verb-get-data-text"); @@ -187,7 +187,7 @@ namespace Content.Server.Administration verb.Category = VerbCategory.Debug; // TODO VERB ICON add ghost icon // Where is the national park service icon for haunted forests? - verb.Act = () => _ghostRoleSystem.OpenMakeGhostRoleEui(player, args.Target.Uid); + verb.Act = () => _ghostRoleSystem.OpenMakeGhostRoleEui(player, args.Target); verb.Impact = LogImpact.Medium; args.Verbs.Add(verb); } @@ -206,13 +206,13 @@ namespace Content.Server.Administration // Add verb to open Solution Editor if (_groupController.CanCommand(player, "addreagent") && - IoCManager.Resolve().HasComponent(args.Target.Uid)) + IoCManager.Resolve().HasComponent(args.Target)) { Verb verb = new(); verb.Text = Loc.GetString("edit-solutions-verb-get-data-text"); verb.Category = VerbCategory.Debug; verb.IconTexture = "/Textures/Interface/VerbIcons/spill.svg.192dpi.png"; - verb.Act = () => OpenEditSolutionsEui(player, args.Target.Uid); + verb.Act = () => OpenEditSolutionsEui(player, args.Target); verb.Impact = LogImpact.Medium; // maybe high depending on WHAT reagents they add... args.Verbs.Add(verb); } diff --git a/Content.Server/Administration/Commands/AGhost.cs b/Content.Server/Administration/Commands/AGhost.cs index e339b82b25..b93df56ebb 100644 --- a/Content.Server/Administration/Commands/AGhost.cs +++ b/Content.Server/Administration/Commands/AGhost.cs @@ -35,7 +35,7 @@ namespace Content.Server.Administration.Commands return; } - if (mind.VisitingEntity != null && IoCManager.Resolve().HasComponent(mind.VisitingEntity.Uid)) + if (mind.VisitingEntity != null && IoCManager.Resolve().HasComponent(mind.VisitingEntity)) { player.ContentData()!.Mind?.UnVisit(); return; @@ -43,26 +43,26 @@ namespace Content.Server.Administration.Commands var canReturn = mind.CurrentEntity != null; IEntity? tempQualifier = player.AttachedEntity; - var ghost = IoCManager.Resolve().SpawnEntity((string?) "AdminObserver", (EntityCoordinates) ((tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid) : null).Coordinates + var ghost = IoCManager.Resolve().SpawnEntity((string?) "AdminObserver", (EntityCoordinates) ((tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier) : null).Coordinates ?? EntitySystem.Get().GetObserverSpawnPoint())); if (canReturn) { // TODO: Remove duplication between all this and "GamePreset.OnGhostAttempt()"... if(!string.IsNullOrWhiteSpace(mind.CharacterName)) - IoCManager.Resolve().GetComponent(ghost.Uid).EntityName = mind.CharacterName; + IoCManager.Resolve().GetComponent(ghost).EntityName = mind.CharacterName; else if (!string.IsNullOrWhiteSpace(mind.Session?.Name)) - IoCManager.Resolve().GetComponent(ghost.Uid).EntityName = mind.Session.Name; + IoCManager.Resolve().GetComponent(ghost).EntityName = mind.Session.Name; mind.Visit(ghost); } else { - IoCManager.Resolve().GetComponent(ghost.Uid).EntityName = player.Name; - mind.TransferTo(ghost.Uid); + IoCManager.Resolve().GetComponent(ghost).EntityName = player.Name; + mind.TransferTo(ghost); } - var comp = IoCManager.Resolve().GetComponent(ghost.Uid); + var comp = IoCManager.Resolve().GetComponent(ghost); EntitySystem.Get().SetCanReturnToBody(comp, canReturn); } } diff --git a/Content.Server/Administration/Commands/ControlMob.cs b/Content.Server/Administration/Commands/ControlMob.cs index 49e89db485..0bfe8cc4e9 100644 --- a/Content.Server/Administration/Commands/ControlMob.cs +++ b/Content.Server/Administration/Commands/ControlMob.cs @@ -50,7 +50,7 @@ namespace Content.Server.Administration.Commands } var target = entityManager.GetEntity(eUid); - if (!IoCManager.Resolve().TryGetComponent(target.Uid, out MindComponent? mindComponent)) + if (!IoCManager.Resolve().TryGetComponent(target, out MindComponent? mindComponent)) { shell.WriteLine(Loc.GetString("shell-entity-is-not-mob")); return; @@ -60,7 +60,7 @@ namespace Content.Server.Administration.Commands DebugTools.AssertNotNull(mind); - mind!.TransferTo(target.Uid); + mind!.TransferTo(target); } } } diff --git a/Content.Server/Administration/Commands/DeleteComponent.cs b/Content.Server/Administration/Commands/DeleteComponent.cs index 839ba06863..868466d013 100644 --- a/Content.Server/Administration/Commands/DeleteComponent.cs +++ b/Content.Server/Administration/Commands/DeleteComponent.cs @@ -37,7 +37,7 @@ namespace Content.Server.Administration.Commands foreach (var component in components) { - var uid = component.Owner.Uid; + var uid = (EntityUid) component.Owner; entityManager.RemoveComponent(uid, component); i++; } diff --git a/Content.Server/Administration/Commands/DeleteEntitiesWithComponent.cs b/Content.Server/Administration/Commands/DeleteEntitiesWithComponent.cs index b5b838007d..07fde752d8 100644 --- a/Content.Server/Administration/Commands/DeleteEntitiesWithComponent.cs +++ b/Content.Server/Administration/Commands/DeleteEntitiesWithComponent.cs @@ -42,7 +42,7 @@ namespace Content.Server.Administration.Commands var count = 0; foreach (var entity in entitiesWithAllComponents) { - IoCManager.Resolve().DeleteEntity(entity.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) entity); count += 1; } diff --git a/Content.Server/Administration/Commands/DeleteEntitiesWithId.cs b/Content.Server/Administration/Commands/DeleteEntitiesWithId.cs index a63cc4bec5..730aded3e7 100644 --- a/Content.Server/Administration/Commands/DeleteEntitiesWithId.cs +++ b/Content.Server/Administration/Commands/DeleteEntitiesWithId.cs @@ -24,12 +24,12 @@ namespace Content.Server.Administration.Commands var id = args[0].ToLower(); var entityManager = IoCManager.Resolve(); - var entities = entityManager.GetEntities().Where(e => IoCManager.Resolve().GetComponent(e.Uid).EntityPrototype?.ID.ToLower() == id); + var entities = entityManager.GetEntities().Where(e => IoCManager.Resolve().GetComponent(e).EntityPrototype?.ID.ToLower() == id); var i = 0; foreach (var entity in entities) { - IoCManager.Resolve().DeleteEntity(entity.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) entity); i++; } diff --git a/Content.Server/Administration/Commands/DeleteEntityCommand.cs b/Content.Server/Administration/Commands/DeleteEntityCommand.cs index d87af342bc..79c6623842 100644 --- a/Content.Server/Administration/Commands/DeleteEntityCommand.cs +++ b/Content.Server/Administration/Commands/DeleteEntityCommand.cs @@ -34,7 +34,7 @@ namespace Content.Server.Administration.Commands return; } - IoCManager.Resolve().DeleteEntity(entity.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) entity); shell.WriteLine($"Deleted entity with id {id}."); } } diff --git a/Content.Server/Administration/Commands/ExplosionCommand.cs b/Content.Server/Administration/Commands/ExplosionCommand.cs index 056319bfe6..1b2d77bdfd 100644 --- a/Content.Server/Administration/Commands/ExplosionCommand.cs +++ b/Content.Server/Administration/Commands/ExplosionCommand.cs @@ -33,8 +33,8 @@ namespace Content.Server.Administration.Commands var lgh = int.Parse(args[4]); var fla = int.Parse(args[5]); - var mapTransform = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GetMapTransform(); - var coords = new EntityCoordinates(mapTransform.Owner.Uid, x, y); + var mapTransform = IoCManager.Resolve().GetComponent(player.AttachedEntity).GetMapTransform(); + var coords = new EntityCoordinates(mapTransform.Owner, x, y); EntitySystem.Get().SpawnExplosion(coords, dev, hvy, lgh, fla); } diff --git a/Content.Server/Administration/Commands/FindEntitiesWithComponents.cs b/Content.Server/Administration/Commands/FindEntitiesWithComponents.cs index 54d9cbb2f6..c6a49508eb 100644 --- a/Content.Server/Administration/Commands/FindEntitiesWithComponents.cs +++ b/Content.Server/Administration/Commands/FindEntitiesWithComponents.cs @@ -53,12 +53,12 @@ namespace Content.Server.Administration.Commands foreach (var entity in entitiesWithAllComponents) { - if (IoCManager.Resolve().GetComponent(entity.Uid).EntityPrototype == null) + if (IoCManager.Resolve().GetComponent(entity).EntityPrototype == null) { continue; } - entityIds.Add(IoCManager.Resolve().GetComponent(entity.Uid).EntityPrototype.ID); + entityIds.Add(IoCManager.Resolve().GetComponent(entity).EntityPrototype.ID); } if (entityIds.Count == 0) diff --git a/Content.Server/Administration/Commands/RejuvenateCommand.cs b/Content.Server/Administration/Commands/RejuvenateCommand.cs index f0d1c07e2b..6aeef64345 100644 --- a/Content.Server/Administration/Commands/RejuvenateCommand.cs +++ b/Content.Server/Administration/Commands/RejuvenateCommand.cs @@ -53,32 +53,32 @@ namespace Content.Server.Administration.Commands public static void PerformRejuvenate(IEntity target) { - var targetUid = target.Uid; + var targetUid = (EntityUid) target; var entMan = IoCManager.Resolve(); entMan.GetComponentOrNull(targetUid)?.UpdateState(0); entMan.GetComponentOrNull(targetUid)?.ResetFood(); entMan.GetComponentOrNull(targetUid)?.ResetThirst(); - EntitySystem.Get().TryRemoveAllStatusEffects(target.Uid); + EntitySystem.Get().TryRemoveAllStatusEffects(target); - if (IoCManager.Resolve().TryGetComponent(target.Uid, out FlammableComponent? flammable)) + if (IoCManager.Resolve().TryGetComponent(target, out FlammableComponent? flammable)) { - EntitySystem.Get().Extinguish(target.Uid, flammable); + EntitySystem.Get().Extinguish(target, flammable); } - if (IoCManager.Resolve().TryGetComponent(target.Uid, out DamageableComponent? damageable)) + if (IoCManager.Resolve().TryGetComponent(target, out DamageableComponent? damageable)) { EntitySystem.Get().SetAllDamage(damageable, 0); } - if (IoCManager.Resolve().TryGetComponent(target.Uid, out CreamPiedComponent? creamPied)) + if (IoCManager.Resolve().TryGetComponent(target, out CreamPiedComponent? creamPied)) { - EntitySystem.Get().SetCreamPied(target.Uid, creamPied, false); + EntitySystem.Get().SetCreamPied(target, creamPied, false); } - if (IoCManager.Resolve().HasComponent(target.Uid)) + if (IoCManager.Resolve().HasComponent(target)) { - IoCManager.Resolve().RemoveComponent(target.Uid); + IoCManager.Resolve().RemoveComponent(target); } } } diff --git a/Content.Server/Administration/Commands/RemoveExtraComponents.cs b/Content.Server/Administration/Commands/RemoveExtraComponents.cs index 13a88a937c..b32fd54819 100644 --- a/Content.Server/Administration/Commands/RemoveExtraComponents.cs +++ b/Content.Server/Administration/Commands/RemoveExtraComponents.cs @@ -33,19 +33,19 @@ namespace Content.Server.Administration.Commands foreach (var entity in entityManager.GetEntities()) { - if (checkPrototype && IoCManager.Resolve().GetComponent(entity.Uid).EntityPrototype != prototype || IoCManager.Resolve().GetComponent(entity.Uid).EntityPrototype == null) + if (checkPrototype && IoCManager.Resolve().GetComponent(entity).EntityPrototype != prototype || IoCManager.Resolve().GetComponent(entity).EntityPrototype == null) { continue; } var modified = false; - foreach (var component in IoCManager.Resolve().GetComponents(entity.Uid)) + foreach (var component in IoCManager.Resolve().GetComponents(entity)) { - if (IoCManager.Resolve().GetComponent(entity.Uid).EntityPrototype.Components.ContainsKey(component.Name)) + if (IoCManager.Resolve().GetComponent(entity).EntityPrototype.Components.ContainsKey(component.Name)) continue; - entityManager.RemoveComponent(entity.Uid, component); + entityManager.RemoveComponent(entity, component); components++; modified = true; diff --git a/Content.Server/Administration/Commands/SetMindCommand.cs b/Content.Server/Administration/Commands/SetMindCommand.cs index 9ad393cd9c..6e2c4cf269 100644 --- a/Content.Server/Administration/Commands/SetMindCommand.cs +++ b/Content.Server/Administration/Commands/SetMindCommand.cs @@ -44,7 +44,7 @@ namespace Content.Server.Administration.Commands var target = entityManager.GetEntity(eUid); - if (!IoCManager.Resolve().HasComponent(target.Uid)) + if (!IoCManager.Resolve().HasComponent(target)) { shell.WriteLine(Loc.GetString("set-mind-command-target-has-no-mind-message")); return; @@ -69,11 +69,11 @@ namespace Content.Server.Administration.Commands { mind = new Mind.Mind(session.UserId) { - CharacterName = IoCManager.Resolve().GetComponent(target.Uid).EntityName + CharacterName = IoCManager.Resolve().GetComponent(target).EntityName }; mind.ChangeOwningPlayer(session.UserId); } - mind.TransferTo(target.Uid); + mind.TransferTo(target); } } } diff --git a/Content.Server/Administration/Commands/SetOutfitCommand.cs b/Content.Server/Administration/Commands/SetOutfitCommand.cs index 405bbb10cb..09b0bac877 100644 --- a/Content.Server/Administration/Commands/SetOutfitCommand.cs +++ b/Content.Server/Administration/Commands/SetOutfitCommand.cs @@ -53,7 +53,7 @@ namespace Content.Server.Administration.Commands var target = entityManager.GetEntity(eUid); - if (!IoCManager.Resolve().TryGetComponent(target.Uid, out var inventoryComponent)) + if (!IoCManager.Resolve().TryGetComponent(target, out var inventoryComponent)) { shell.WriteLine(Loc.GetString("shell-target-entity-does-not-have-message",("missing", "inventory"))); return; @@ -82,7 +82,7 @@ namespace Content.Server.Administration.Commands HumanoidCharacterProfile? profile = null; // Check if we are setting the outfit of a player to respect the preferences - if (IoCManager.Resolve().TryGetComponent(target.Uid, out var actorComponent)) + if (IoCManager.Resolve().TryGetComponent(target, out var actorComponent)) { var userId = actorComponent.PlayerSession.UserId; var preferencesManager = IoCManager.Resolve(); @@ -98,15 +98,15 @@ namespace Content.Server.Administration.Commands { continue; } - var equipmentEntity = entityManager.SpawnEntity(gearStr, IoCManager.Resolve().GetComponent(target.Uid).Coordinates); + var equipmentEntity = entityManager.SpawnEntity(gearStr, IoCManager.Resolve().GetComponent(target).Coordinates); if (slot == EquipmentSlotDefines.Slots.IDCARD && - IoCManager.Resolve().TryGetComponent(equipmentEntity.Uid, out var pdaComponent) && + IoCManager.Resolve().TryGetComponent(equipmentEntity, out var pdaComponent) && pdaComponent.ContainedID != null) { - pdaComponent.ContainedID.FullName = IoCManager.Resolve().GetComponent(target.Uid).EntityName; + pdaComponent.ContainedID.FullName = IoCManager.Resolve().GetComponent(target).EntityName; } - inventoryComponent.Equip(slot, IoCManager.Resolve().GetComponent(equipmentEntity.Uid), false); + inventoryComponent.Equip(slot, IoCManager.Resolve().GetComponent(equipmentEntity), false); } } } diff --git a/Content.Server/Administration/Commands/WarpCommand.cs b/Content.Server/Administration/Commands/WarpCommand.cs index fc3313c5df..685fe76ed5 100644 --- a/Content.Server/Administration/Commands/WarpCommand.cs +++ b/Content.Server/Administration/Commands/WarpCommand.cs @@ -60,12 +60,12 @@ namespace Content.Server.Administration.Commands } var mapManager = IoCManager.Resolve(); - var currentMap = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).MapID; - var currentGrid = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GridID; + var currentMap = IoCManager.Resolve().GetComponent(player.AttachedEntity).MapID; + var currentGrid = IoCManager.Resolve().GetComponent(player.AttachedEntity).GridID; var found = entMan.EntityQuery(true) .Where(p => p.Location == location) - .Select(p => IoCManager.Resolve().GetComponent(p.Owner.Uid).Coordinates) + .Select(p => IoCManager.Resolve().GetComponent(p.Owner).Coordinates) .OrderBy(p => p, Comparer.Create((a, b) => { // Sort so that warp points on the same grid/map are first. @@ -113,8 +113,8 @@ namespace Content.Server.Administration.Commands if (found.GetGridId(entMan) != GridId.Invalid) { - IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).Coordinates = found; - if (IoCManager.Resolve().TryGetComponent(player.AttachedEntity.Uid, out IPhysBody? physics)) + IoCManager.Resolve().GetComponent(player.AttachedEntity).Coordinates = found; + if (IoCManager.Resolve().TryGetComponent(player.AttachedEntity, out IPhysBody? physics)) { physics.LinearVelocity = Vector2.Zero; } diff --git a/Content.Server/Administration/Logs/AdminLogSystem.Json.cs b/Content.Server/Administration/Logs/AdminLogSystem.Json.cs index ee14ab864f..79ab73257e 100644 --- a/Content.Server/Administration/Logs/AdminLogSystem.Json.cs +++ b/Content.Server/Administration/Logs/AdminLogSystem.Json.cs @@ -57,7 +57,7 @@ public partial class AdminLogSystem EntityUid? entityId = properties[key] switch { EntityUid id => id, - IEntity entity => entity.Uid, + IEntity entity => entity, IPlayerSession {AttachedEntityUid: { }} session => session.AttachedEntityUid.Value, IComponent component => component.OwnerUid, _ => null diff --git a/Content.Server/Administration/Logs/Converters/EntityConverter.cs b/Content.Server/Administration/Logs/Converters/EntityConverter.cs index 226d14a97f..b06a091891 100644 --- a/Content.Server/Administration/Logs/Converters/EntityConverter.cs +++ b/Content.Server/Administration/Logs/Converters/EntityConverter.cs @@ -12,6 +12,6 @@ public class EntityConverter : AdminLogConverter public override void Write(Utf8JsonWriter writer, IEntity value, JsonSerializerOptions options) { - EntityUidConverter.Write(writer, value.Uid, options, _entities); + EntityUidConverter.Write(writer, value, options, _entities); } } diff --git a/Content.Server/Administration/Logs/Converters/PlayerSessionConverter.cs b/Content.Server/Administration/Logs/Converters/PlayerSessionConverter.cs index 6255615d6e..5d4cd75c77 100644 --- a/Content.Server/Administration/Logs/Converters/PlayerSessionConverter.cs +++ b/Content.Server/Administration/Logs/Converters/PlayerSessionConverter.cs @@ -14,8 +14,8 @@ public class PlayerSessionConverter : AdminLogConverter if (value.Player.AttachedEntity != null) { - writer.WriteNumber("id", (int) value.Player.AttachedEntity.Uid); - writer.WriteString("name", IoCManager.Resolve().GetComponent(value.Player.AttachedEntity.Uid).EntityName); + writer.WriteNumber("id", (int) (EntityUid) value.Player.AttachedEntity); + writer.WriteString("name", IoCManager.Resolve().GetComponent(value.Player.AttachedEntity).EntityName); } writer.WriteString("player", value.Player.UserId.UserId); diff --git a/Content.Server/Administration/UI/SetOutfitEui.cs b/Content.Server/Administration/UI/SetOutfitEui.cs index 4ffa70c942..74f3932ee4 100644 --- a/Content.Server/Administration/UI/SetOutfitEui.cs +++ b/Content.Server/Administration/UI/SetOutfitEui.cs @@ -31,7 +31,7 @@ namespace Content.Server.Administration.UI { return new SetOutfitEuiState { - TargetEntityId = _target.Uid + TargetEntityId = _target }; } diff --git a/Content.Server/Advertise/AdvertiseSystem.cs b/Content.Server/Advertise/AdvertiseSystem.cs index 1e8c483daa..6bce9a8d8d 100644 --- a/Content.Server/Advertise/AdvertiseSystem.cs +++ b/Content.Server/Advertise/AdvertiseSystem.cs @@ -117,7 +117,7 @@ namespace Content.Server.Advertise if (advertise.NextAdvertisementTime > curTime) continue; - SayAdvertisement(advertise.Owner.Uid, true, advertise); + SayAdvertisement(advertise.Owner, true, advertise); } } } diff --git a/Content.Server/Alert/Click/RemoveCuffs.cs b/Content.Server/Alert/Click/RemoveCuffs.cs index 6f163f77d9..af55ca2617 100644 --- a/Content.Server/Alert/Click/RemoveCuffs.cs +++ b/Content.Server/Alert/Click/RemoveCuffs.cs @@ -16,7 +16,7 @@ namespace Content.Server.Alert.Click { public void AlertClicked(ClickAlertEventArgs args) { - if (IoCManager.Resolve().TryGetComponent(args.Player.Uid, out CuffableComponent? cuffableComponent)) + if (IoCManager.Resolve().TryGetComponent(args.Player, out CuffableComponent? cuffableComponent)) { cuffableComponent.TryUncuff(args.Player); } diff --git a/Content.Server/Alert/Click/ResistFire.cs b/Content.Server/Alert/Click/ResistFire.cs index 344be21afc..8a980b1037 100644 --- a/Content.Server/Alert/Click/ResistFire.cs +++ b/Content.Server/Alert/Click/ResistFire.cs @@ -17,9 +17,9 @@ namespace Content.Server.Alert.Click { public void AlertClicked(ClickAlertEventArgs args) { - if (IoCManager.Resolve().TryGetComponent(args.Player.Uid, out FlammableComponent? flammable)) + if (IoCManager.Resolve().TryGetComponent(args.Player, out FlammableComponent? flammable)) { - EntitySystem.Get().Resist(args.Player.Uid, flammable); + EntitySystem.Get().Resist(args.Player, flammable); } } } diff --git a/Content.Server/Alert/Click/StopBeingPulled.cs b/Content.Server/Alert/Click/StopBeingPulled.cs index a7b35117e1..2d76c98347 100644 --- a/Content.Server/Alert/Click/StopBeingPulled.cs +++ b/Content.Server/Alert/Click/StopBeingPulled.cs @@ -18,10 +18,10 @@ namespace Content.Server.Alert.Click { public void AlertClicked(ClickAlertEventArgs args) { - if (!EntitySystem.Get().CanInteract(args.Player.Uid)) + if (!EntitySystem.Get().CanInteract(args.Player)) return; - if (IoCManager.Resolve().TryGetComponent(args.Player.Uid, out var playerPullable)) + if (IoCManager.Resolve().TryGetComponent(args.Player, out var playerPullable)) { EntitySystem.Get().TryStopPull(playerPullable); } diff --git a/Content.Server/Alert/Click/StopPiloting.cs b/Content.Server/Alert/Click/StopPiloting.cs index 22970eff55..9b1ccabed7 100644 --- a/Content.Server/Alert/Click/StopPiloting.cs +++ b/Content.Server/Alert/Click/StopPiloting.cs @@ -19,7 +19,7 @@ namespace Content.Server.Alert.Click { public void AlertClicked(ClickAlertEventArgs args) { - if (IoCManager.Resolve().TryGetComponent(args.Player.Uid, out PilotComponent? pilotComponent) && + if (IoCManager.Resolve().TryGetComponent(args.Player, out PilotComponent? pilotComponent) && pilotComponent.Console != null) { EntitySystem.Get().RemovePilot(pilotComponent); diff --git a/Content.Server/Alert/Click/StopPulling.cs b/Content.Server/Alert/Click/StopPulling.cs index 3c1fcad56e..212720a099 100644 --- a/Content.Server/Alert/Click/StopPulling.cs +++ b/Content.Server/Alert/Click/StopPulling.cs @@ -19,7 +19,7 @@ namespace Content.Server.Alert.Click { var ps = EntitySystem.Get(); var playerTarget = ps.GetPulled(args.Player); - if (playerTarget != null && IoCManager.Resolve().TryGetComponent(playerTarget.Uid, out SharedPullableComponent playerPullable)) + if (playerTarget != null && IoCManager.Resolve().TryGetComponent(playerTarget, out SharedPullableComponent playerPullable)) { ps.TryStopPull(playerPullable); } diff --git a/Content.Server/Alert/Click/Unbuckle.cs b/Content.Server/Alert/Click/Unbuckle.cs index 435f0c1e02..9515320efe 100644 --- a/Content.Server/Alert/Click/Unbuckle.cs +++ b/Content.Server/Alert/Click/Unbuckle.cs @@ -16,7 +16,7 @@ namespace Content.Server.Alert.Click { public void AlertClicked(ClickAlertEventArgs args) { - if (IoCManager.Resolve().TryGetComponent(args.Player.Uid, out BuckleComponent? buckle)) + if (IoCManager.Resolve().TryGetComponent(args.Player, out BuckleComponent? buckle)) { buckle.TryUnbuckle(args.Player); } diff --git a/Content.Server/Alert/Commands/ClearAlert.cs b/Content.Server/Alert/Commands/ClearAlert.cs index 93d89bb895..850a0d8740 100644 --- a/Content.Server/Alert/Commands/ClearAlert.cs +++ b/Content.Server/Alert/Commands/ClearAlert.cs @@ -34,7 +34,7 @@ namespace Content.Server.Alert.Commands if (!CommandUtils.TryGetAttachedEntityByUsernameOrId(shell, target, player, out attachedEntity)) return; } - if (!IoCManager.Resolve().TryGetComponent(attachedEntity.Uid, out ServerAlertsComponent? alertsComponent)) + if (!IoCManager.Resolve().TryGetComponent(attachedEntity, out ServerAlertsComponent? alertsComponent)) { shell.WriteLine("user has no alerts component"); return; diff --git a/Content.Server/Alert/Commands/ShowAlert.cs b/Content.Server/Alert/Commands/ShowAlert.cs index e63be7a72e..70dfcb76e3 100644 --- a/Content.Server/Alert/Commands/ShowAlert.cs +++ b/Content.Server/Alert/Commands/ShowAlert.cs @@ -40,7 +40,7 @@ namespace Content.Server.Alert.Commands if (!CommandUtils.TryGetAttachedEntityByUsernameOrId(shell, target, player, out attachedEntity)) return; } - if (!IoCManager.Resolve().TryGetComponent(attachedEntity.Uid, out ServerAlertsComponent? alertsComponent)) + if (!IoCManager.Resolve().TryGetComponent(attachedEntity, out ServerAlertsComponent? alertsComponent)) { shell.WriteLine("user has no alerts component"); return; diff --git a/Content.Server/Alert/ServerAlertsComponent.cs b/Content.Server/Alert/ServerAlertsComponent.cs index eeffc32af9..32db5fd927 100644 --- a/Content.Server/Alert/ServerAlertsComponent.cs +++ b/Content.Server/Alert/ServerAlertsComponent.cs @@ -67,7 +67,7 @@ namespace Content.Server.Alert { Logger.DebugS("alert", "user {0} attempted to" + " click alert {1} which is not currently showing for them", - IoCManager.Resolve().GetComponent(player.Uid).EntityName, msg.Type); + IoCManager.Resolve().GetComponent(player).EntityName, msg.Type); break; } diff --git a/Content.Server/Animals/Systems/UdderSystem.cs b/Content.Server/Animals/Systems/UdderSystem.cs index ae56860f15..9eb223bca8 100644 --- a/Content.Server/Animals/Systems/UdderSystem.cs +++ b/Content.Server/Animals/Systems/UdderSystem.cs @@ -42,7 +42,7 @@ namespace Content.Server.Animals.Systems continue; // Actually there is food digestion so no problem with instant reagent generation "OnFeed" - if (IoCManager.Resolve().TryGetComponent(udder.Owner.Uid, out var hunger)) + if (IoCManager.Resolve().TryGetComponent(udder.Owner, out var hunger)) { hunger.HungerThresholds.TryGetValue(HungerThreshold.Peckish, out var targetThreshold); @@ -123,13 +123,13 @@ namespace Content.Server.Animals.Systems { if (args.Using == null || !args.CanInteract || - !IoCManager.Resolve().HasComponent(args.Using.Uid)) + !IoCManager.Resolve().HasComponent(args.Using)) return; Verb verb = new(); verb.Act = () => { - AttemptMilk(uid, args.User.Uid, args.Using.Uid, component); + AttemptMilk(uid, args.User, args.Using, component); }; verb.Text = Loc.GetString("udder-system-verb-milk"); verb.Priority = 2; diff --git a/Content.Server/Arcade/Components/BlockGameArcadeComponent.cs b/Content.Server/Arcade/Components/BlockGameArcadeComponent.cs index ab56fc9157..879351472b 100644 --- a/Content.Server/Arcade/Components/BlockGameArcadeComponent.cs +++ b/Content.Server/Arcade/Components/BlockGameArcadeComponent.cs @@ -49,10 +49,10 @@ namespace Content.Server.Arcade.Components void IActivate.Activate(ActivateEventArgs eventArgs) { - if(!Powered || !IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if(!Powered || !IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) return; - if(!EntitySystem.Get().CanInteract(eventArgs.User.Uid)) + if(!EntitySystem.Get().CanInteract(eventArgs.User)) return; UserInterface?.Toggle(actor.PlayerSession); @@ -668,7 +668,7 @@ namespace Content.Server.Arcade.Components { var blockGameSystem = EntitySystem.Get(); - _highScorePlacement = blockGameSystem.RegisterHighScore(IoCManager.Resolve().GetComponent(_component._player.AttachedEntity.Uid).EntityName, Points); + _highScorePlacement = blockGameSystem.RegisterHighScore(IoCManager.Resolve().GetComponent(_component._player.AttachedEntity).EntityName, Points); SendHighscoreUpdate(); } _component.UserInterface?.SendMessage(new BlockGameMessages.BlockGameGameOverScreenMessage(Points, _highScorePlacement?.LocalPlacement, _highScorePlacement?.GlobalPlacement)); diff --git a/Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs b/Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs index 1e89a3bc22..e4690b7ee3 100644 --- a/Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs +++ b/Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs @@ -74,10 +74,10 @@ namespace Content.Server.Arcade.Components void IActivate.Activate(ActivateEventArgs eventArgs) { - if (!Powered || !IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (!Powered || !IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) return; - if (!EntitySystem.Get().CanInteract(eventArgs.User.Uid)) + if (!EntitySystem.Get().CanInteract(eventArgs.User)) return; _game ??= new SpaceVillainGame(this); @@ -223,7 +223,7 @@ namespace Content.Server.Arcade.Components public void ProcessWin() { var entityManager = IoCManager.Resolve(); - entityManager.SpawnEntity(_random.Pick(_possibleRewards), IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition); + entityManager.SpawnEntity(_random.Pick(_possibleRewards), IoCManager.Resolve().GetComponent(Owner).MapPosition); } /// diff --git a/Content.Server/Atmos/Commands/AddAtmosCommand.cs b/Content.Server/Atmos/Commands/AddAtmosCommand.cs index 412f21e3f1..a88d5a85da 100644 --- a/Content.Server/Atmos/Commands/AddAtmosCommand.cs +++ b/Content.Server/Atmos/Commands/AddAtmosCommand.cs @@ -47,7 +47,7 @@ namespace Content.Server.Atmos.Commands return; } - if (IoCManager.Resolve().HasComponent(grid.Uid)) + if (IoCManager.Resolve().HasComponent(grid)) { shell.WriteLine("Grid already has an atmosphere."); return; diff --git a/Content.Server/Atmos/Commands/AddUnsimulatedAtmosCommand.cs b/Content.Server/Atmos/Commands/AddUnsimulatedAtmosCommand.cs index 4ca0658ff1..75526ac9a3 100644 --- a/Content.Server/Atmos/Commands/AddUnsimulatedAtmosCommand.cs +++ b/Content.Server/Atmos/Commands/AddUnsimulatedAtmosCommand.cs @@ -47,7 +47,7 @@ namespace Content.Server.Atmos.Commands return; } - if (IoCManager.Resolve().HasComponent(grid.Uid)) + if (IoCManager.Resolve().HasComponent(grid)) { shell.WriteLine("Grid already has an atmosphere."); return; diff --git a/Content.Server/Atmos/Commands/DeleteGasCommand.cs b/Content.Server/Atmos/Commands/DeleteGasCommand.cs index e3dde932a2..efd78fc2c0 100644 --- a/Content.Server/Atmos/Commands/DeleteGasCommand.cs +++ b/Content.Server/Atmos/Commands/DeleteGasCommand.cs @@ -39,7 +39,7 @@ namespace Content.Server.Atmos.Commands return; } - gridId = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GridID; + gridId = IoCManager.Resolve().GetComponent(player.AttachedEntity).GridID; if (gridId == GridId.Invalid) { @@ -65,7 +65,7 @@ namespace Content.Server.Atmos.Commands return; } - gridId = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GridID; + gridId = IoCManager.Resolve().GetComponent(player.AttachedEntity).GridID; if (gridId == GridId.Invalid) { diff --git a/Content.Server/Atmos/Components/AtmosPlaqueComponent.cs b/Content.Server/Atmos/Components/AtmosPlaqueComponent.cs index 310c6f7a4e..d724d7cb47 100644 --- a/Content.Server/Atmos/Components/AtmosPlaqueComponent.cs +++ b/Content.Server/Atmos/Components/AtmosPlaqueComponent.cs @@ -68,7 +68,7 @@ namespace Content.Server.Atmos.Components PlaqueType.Unset => "Uhm", _ => "Uhm", }; - IoCManager.Resolve().GetComponent(Owner.Uid).EntityDescription = val; + IoCManager.Resolve().GetComponent(Owner).EntityDescription = val; var val1 = _type switch { @@ -83,9 +83,9 @@ namespace Content.Server.Atmos.Components PlaqueType.Unset => "Uhm", _ => "Uhm", }; - IoCManager.Resolve().GetComponent(Owner.Uid).EntityName = val1; + IoCManager.Resolve().GetComponent(Owner).EntityName = val1; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { var state = _type == PlaqueType.Zumos ? "zumosplaque" : "atmosplaque"; diff --git a/Content.Server/Atmos/Components/BreathToolComponent.cs b/Content.Server/Atmos/Components/BreathToolComponent.cs index 993eb12da8..ba589d1bb4 100644 --- a/Content.Server/Atmos/Components/BreathToolComponent.cs +++ b/Content.Server/Atmos/Components/BreathToolComponent.cs @@ -33,7 +33,7 @@ namespace Content.Server.Atmos.Components if ((EquipmentSlotDefines.SlotMasks[eventArgs.Slot] & _allowedSlots) != _allowedSlots) return; IsFunctional = true; - if (IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out InternalsComponent? internals)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.User, out InternalsComponent? internals)) { ConnectedInternalsEntity = eventArgs.User; internals.ConnectBreathTool(Owner); @@ -50,7 +50,7 @@ namespace Content.Server.Atmos.Components var old = ConnectedInternalsEntity; ConnectedInternalsEntity = null; - if (old != null && IoCManager.Resolve().TryGetComponent(old.Uid, out var internalsComponent)) + if (old != null && IoCManager.Resolve().TryGetComponent(old, out var internalsComponent)) { internalsComponent.DisconnectBreathTool(); } diff --git a/Content.Server/Atmos/Components/GasAnalyzerComponent.cs b/Content.Server/Atmos/Components/GasAnalyzerComponent.cs index 9d03df42c8..579a2e87cd 100644 --- a/Content.Server/Atmos/Components/GasAnalyzerComponent.cs +++ b/Content.Server/Atmos/Components/GasAnalyzerComponent.cs @@ -40,7 +40,7 @@ namespace Content.Server.Atmos.Components UserInterface.OnClosed += UserInterfaceOnClose; } - IoCManager.Resolve().TryGetComponent(Owner.Uid, out _appearance); + IoCManager.Resolve().TryGetComponent(Owner, out _appearance); } public override ComponentState GetComponentState() @@ -123,7 +123,7 @@ namespace Content.Server.Atmos.Components { // Already get the pressure before Dirty(), because we can't get the EntitySystem in that thread or smth var pressure = 0f; - var tile = EntitySystem.Get().GetTileMixture(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var tile = EntitySystem.Get().GetTileMixture(IoCManager.Resolve().GetComponent(Owner).Coordinates); if (tile != null) { pressure = tile.Pressure; @@ -161,17 +161,17 @@ namespace Content.Server.Atmos.Components if (session.AttachedEntity == null) return; - if (!IoCManager.Resolve().TryGetComponent(session.AttachedEntity.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(session.AttachedEntity, out HandsComponent? handsComponent)) return; var activeHandEntity = handsComponent?.GetActiveHand?.Owner; - if (activeHandEntity == null || !IoCManager.Resolve().TryGetComponent(activeHandEntity.Uid, out GasAnalyzerComponent? gasAnalyzer)) + if (activeHandEntity == null || !IoCManager.Resolve().TryGetComponent(activeHandEntity, out GasAnalyzerComponent? gasAnalyzer)) { return; } } - var pos = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + var pos = IoCManager.Resolve().GetComponent(Owner).Coordinates; if (!_checkPlayer && _position.HasValue) { // Check if position is out of range => don't update @@ -226,14 +226,14 @@ namespace Content.Server.Atmos.Components return; } - if (!IoCManager.Resolve().TryGetComponent(player.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(player, out HandsComponent? handsComponent)) { Owner.PopupMessage(player, Loc.GetString("gas-analyzer-component-player-has-no-hands-message")); return; } var activeHandEntity = handsComponent.GetActiveHand?.Owner; - if (activeHandEntity == null || !IoCManager.Resolve().TryGetComponent(activeHandEntity.Uid, out GasAnalyzerComponent? gasAnalyzer)) + if (activeHandEntity == null || !IoCManager.Resolve().TryGetComponent(activeHandEntity, out GasAnalyzerComponent? gasAnalyzer)) { serverMsg.Session.AttachedEntity?.PopupMessage(Loc.GetString("gas-analyzer-component-need-gas-analyzer-in-hand-message")); return; @@ -253,7 +253,7 @@ namespace Content.Server.Atmos.Components return true; } - if (IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) { OpenInterface(actor.PlayerSession, eventArgs.ClickLocation); } @@ -265,7 +265,7 @@ namespace Content.Server.Atmos.Components void IDropped.Dropped(DroppedEventArgs eventArgs) { - if (IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) { CloseInterface(actor.PlayerSession); } @@ -273,7 +273,7 @@ namespace Content.Server.Atmos.Components bool IUse.UseEntity(UseEntityEventArgs eventArgs) { - if (IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) { ToggleInterface(actor.PlayerSession); return true; diff --git a/Content.Server/Atmos/Components/GasTankComponent.cs b/Content.Server/Atmos/Components/GasTankComponent.cs index 4661b5a9c5..34325acfa9 100644 --- a/Content.Server/Atmos/Components/GasTankComponent.cs +++ b/Content.Server/Atmos/Components/GasTankComponent.cs @@ -155,14 +155,14 @@ namespace Content.Server.Atmos.Components bool IUse.UseEntity(UseEntityEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) return false; + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) return false; OpenInterface(actor.PlayerSession); return true; } void IActivate.Activate(ActivateEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) return; + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) return; OpenInterface(actor.PlayerSession); } @@ -216,7 +216,7 @@ namespace Content.Server.Atmos.Components { var user = GetInternalsComponent()?.Owner; - if (user == null || !EntitySystem.Get().CanUse(user.Uid)) + if (user == null || !EntitySystem.Get().CanUse(user)) return; if (IsConnected) @@ -230,10 +230,10 @@ namespace Content.Server.Atmos.Components private InternalsComponent? GetInternalsComponent(IEntity? owner = null) { - if ((!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) return null; - if (owner != null) return IoCManager.Resolve().GetComponentOrNull(owner.Uid); + if ((!IoCManager.Resolve().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner).EntityLifeStage) >= EntityLifeStage.Deleted) return null; + if (owner != null) return IoCManager.Resolve().GetComponentOrNull(owner); return Owner.TryGetContainer(out var container) - ? IoCManager.Resolve().GetComponentOrNull(container.Owner.Uid) + ? IoCManager.Resolve().GetComponentOrNull(container.Owner) : null; } @@ -271,7 +271,7 @@ namespace Content.Server.Atmos.Components EntitySystem.Get().SpawnExplosion(OwnerUid, (int) (range * 0.25f), (int) (range * 0.5f), (int) (range * 1.5f), 1); - IoCManager.Resolve().QueueDeleteEntity(Owner.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) Owner); return; } @@ -279,13 +279,13 @@ namespace Content.Server.Atmos.Components { if (_integrity <= 0) { - var environment = atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, true); + var environment = atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(Owner).Coordinates, true); if(environment != null) atmosphereSystem.Merge(environment, Air); - SoundSystem.Play(Filter.Pvs(Owner), _ruptureSound.GetSound(), IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, AudioHelpers.WithVariation(0.125f)); + SoundSystem.Play(Filter.Pvs(Owner), _ruptureSound.GetSound(), IoCManager.Resolve().GetComponent(Owner).Coordinates, AudioHelpers.WithVariation(0.125f)); - IoCManager.Resolve().QueueDeleteEntity(Owner.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) Owner); return; } @@ -297,7 +297,7 @@ namespace Content.Server.Atmos.Components { if (_integrity <= 0) { - var environment = atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, true); + var environment = atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(Owner).Coordinates, true); if (environment == null) return; @@ -328,7 +328,7 @@ namespace Content.Server.Atmos.Components { public bool DoToggleAction(ToggleItemActionEventArgs args) { - if (!IoCManager.Resolve().TryGetComponent(args.Item.Uid, out var gasTankComponent)) return false; + if (!IoCManager.Resolve().TryGetComponent(args.Item, out var gasTankComponent)) return false; // no change if (gasTankComponent.IsConnected == args.ToggledOn) return false; gasTankComponent.ToggleInternals(); diff --git a/Content.Server/Atmos/Components/MovedByPressureComponent.cs b/Content.Server/Atmos/Components/MovedByPressureComponent.cs index 9c2fc8b370..ac78981872 100644 --- a/Content.Server/Atmos/Components/MovedByPressureComponent.cs +++ b/Content.Server/Atmos/Components/MovedByPressureComponent.cs @@ -42,12 +42,12 @@ namespace Content.Server.Atmos.Components public void ExperiencePressureDifference(int cycle, float pressureDifference, AtmosDirection direction, float pressureResistanceProbDelta, EntityCoordinates throwTarget) { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out PhysicsComponent? physics)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out PhysicsComponent? physics)) return; // TODO ATMOS stuns? - var transform = IoCManager.Resolve().GetComponent(physics.Owner.Uid); + var transform = IoCManager.Resolve().GetComponent(physics.Owner); var maxForce = MathF.Sqrt(pressureDifference) * 2.25f; var moveProb = 100f; @@ -61,7 +61,7 @@ namespace Content.Server.Atmos.Components && (maxForce >= (MoveResist * MoveForcePushRatio))) || (physics.BodyType == BodyType.Static && (maxForce >= (MoveResist * MoveForceForcePushRatio)))) { - if (IoCManager.Resolve().HasComponent(physics.Owner.Uid)) + if (IoCManager.Resolve().HasComponent(physics.Owner)) { physics.BodyStatus = BodyStatus.InAir; @@ -72,10 +72,10 @@ namespace Content.Server.Atmos.Components Owner.SpawnTimer(2000, () => { - if (Deleted || !IoCManager.Resolve().TryGetComponent(Owner.Uid, out PhysicsComponent? physicsComponent)) return; + if (Deleted || !IoCManager.Resolve().TryGetComponent(Owner, out PhysicsComponent? physicsComponent)) return; // Uhh if you get race conditions good luck buddy. - if (IoCManager.Resolve().HasComponent(physicsComponent.Owner.Uid)) + if (IoCManager.Resolve().HasComponent(physicsComponent.Owner)) { physicsComponent.BodyStatus = BodyStatus.OnGround; } @@ -118,7 +118,7 @@ namespace Content.Server.Atmos.Components public static bool IsMovedByPressure(this IEntity entity, [NotNullWhen(true)] out MovedByPressureComponent? moved) { - return IoCManager.Resolve().TryGetComponent(entity.Uid, out moved) && + return IoCManager.Resolve().TryGetComponent(entity, out moved) && moved.Enabled; } } diff --git a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs index 85b55acbfc..e653297587 100644 --- a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs @@ -29,13 +29,13 @@ namespace Content.Server.Atmos.EntitySystems { if (airtight.FixAirBlockedDirectionInitialize) { - var rotateEvent = new RotateEvent(airtight.Owner, Angle.Zero, IoCManager.Resolve().GetComponent(airtight.Owner.Uid).WorldRotation); + var rotateEvent = new RotateEvent(airtight.Owner, Angle.Zero, IoCManager.Resolve().GetComponent(airtight.Owner).WorldRotation); OnAirtightRotated(uid, airtight, ref rotateEvent); } // Adding this component will immediately anchor the entity, because the atmos system // requires airtight entities to be anchored for performance. - IoCManager.Resolve().GetComponent(airtight.Owner.Uid).Anchored = true; + IoCManager.Resolve().GetComponent(airtight.Owner).Anchored = true; UpdatePosition(airtight); } @@ -54,8 +54,8 @@ namespace Content.Server.Atmos.EntitySystems private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent airtight, ref AnchorStateChangedEvent args) { - var gridId = IoCManager.Resolve().GetComponent(airtight.Owner.Uid).GridID; - var coords = IoCManager.Resolve().GetComponent(airtight.Owner.Uid).Coordinates; + var gridId = IoCManager.Resolve().GetComponent(airtight.Owner).GridID; + var coords = IoCManager.Resolve().GetComponent(airtight.Owner).Coordinates; var grid = _mapManager.GetGrid(gridId); var tilePos = grid.TileIndicesFor(coords); @@ -84,11 +84,11 @@ namespace Content.Server.Atmos.EntitySystems public void UpdatePosition(AirtightComponent airtight) { - if (!IoCManager.Resolve().GetComponent(airtight.Owner.Uid).Anchored || !IoCManager.Resolve().GetComponent(airtight.Owner.Uid).GridID.IsValid()) + if (!IoCManager.Resolve().GetComponent(airtight.Owner).Anchored || !IoCManager.Resolve().GetComponent(airtight.Owner).GridID.IsValid()) return; - var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(airtight.Owner.Uid).GridID); - airtight.LastPosition = (IoCManager.Resolve().GetComponent(airtight.Owner.Uid).GridID, grid.TileIndicesFor(IoCManager.Resolve().GetComponent(airtight.Owner.Uid).Coordinates)); + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(airtight.Owner).GridID); + airtight.LastPosition = (IoCManager.Resolve().GetComponent(airtight.Owner).GridID, grid.TileIndicesFor(IoCManager.Resolve().GetComponent(airtight.Owner).Coordinates)); InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2, airtight.FixVacuum && !airtight.AirBlocked); } diff --git a/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs b/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs index 19514ab6d0..b899a3b1bf 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs @@ -136,16 +136,16 @@ namespace Content.Server.Atmos.EntitySystems var entity = session.AttachedEntity; - var worldBounds = Box2.CenteredAround(IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition, + var worldBounds = Box2.CenteredAround(IoCManager.Resolve().GetComponent(entity).WorldPosition, new Vector2(LocalViewRange, LocalViewRange)); - foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve().GetComponent(entity.Uid).MapID, worldBounds)) + foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve().GetComponent(entity).MapID, worldBounds)) { if (!EntityManager.TryGetEntity(grid.GridEntityId, out var gridEnt)) continue; - if (!IoCManager.Resolve().TryGetComponent(gridEnt.Uid, out var gam)) continue; + if (!IoCManager.Resolve().TryGetComponent(gridEnt, out var gam)) continue; - var entityTile = grid.GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates).GridIndices; + var entityTile = grid.GetTileRef(IoCManager.Resolve().GetComponent(entity).Coordinates).GridIndices; var baseTile = new Vector2i(entityTile.X - (LocalViewRange / 2), entityTile.Y - (LocalViewRange / 2)); var debugOverlayContent = new AtmosDebugOverlayData[LocalViewRange * LocalViewRange]; diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs index 805228f4d4..db0f7cfd3b 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs @@ -1315,7 +1315,7 @@ namespace Content.Server.Atmos.EntitySystems public bool AddAtmosDevice(AtmosDeviceComponent atmosDevice) { - var grid = IoCManager.Resolve().GetComponent(atmosDevice.Owner.Uid).GridID; + var grid = IoCManager.Resolve().GetComponent(atmosDevice.Owner).GridID; if (!_mapManager.TryGetGrid(grid, out var mapGrid)) return false; @@ -1526,7 +1526,7 @@ namespace Content.Server.Atmos.EntitySystems public bool TryGetMapGrid(GridAtmosphereComponent gridAtmosphere, [NotNullWhen(true)] out IMapGrid? mapGrid) { - if (IoCManager.Resolve().TryGetComponent(gridAtmosphere.Owner.Uid, out IMapGridComponent? mapGridComponent)) + if (IoCManager.Resolve().TryGetComponent(gridAtmosphere.Owner, out IMapGridComponent? mapGridComponent)) { mapGrid = mapGridComponent.Grid; return true; diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs index ddfea355f7..b6e5f2516e 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs @@ -34,7 +34,7 @@ namespace Content.Server.Atmos.EntitySystems foreach (var entity in _gridtileLookupSystem.GetEntitiesIntersecting(tile.GridIndex, tile.GridIndices)) { - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? physics) + if (!IoCManager.Resolve().TryGetComponent(entity, out IPhysBody? physics) || !entity.IsMovedByPressure(out var pressure) || entity.IsInContainer()) continue; diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Hotspot.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Hotspot.cs index ae213ddc45..07fdc654e4 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Hotspot.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Hotspot.cs @@ -2,6 +2,7 @@ using Content.Server.Atmos.Components; using Content.Server.Atmos.Reactions; using Content.Shared.Atmos; using Robust.Server.GameObjects; +using Robust.Shared.GameObjects; using Robust.Shared.IoC; namespace Content.Server.Atmos.EntitySystems @@ -143,7 +144,7 @@ namespace Content.Server.Atmos.EntitySystems foreach (var entity in _gridtileLookupSystem.GetEntitiesIntersecting(tile.GridIndex, tile.GridIndices)) { - RaiseLocalEvent(entity.Uid, fireEvent, false); + RaiseLocalEvent(entity, fireEvent, false); } } } diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs index e33fe91a74..eba7619884 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs @@ -314,7 +314,7 @@ namespace Content.Server.Atmos.EntitySystems var number = 0; while (atmosphere.CurrentRunAtmosDevices.TryDequeue(out var device)) { - RaiseLocalEvent(device.Owner.Uid, _updateEvent, false); + RaiseLocalEvent(device.Owner, _updateEvent, false); device.LastProcess = time; if (number++ < LagCheckIterations) continue; diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs index acf6b7e293..2cf7f858bc 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs @@ -75,10 +75,10 @@ namespace Content.Server.Atmos.EntitySystems { foreach (var exposed in EntityManager.EntityQuery()) { - var tile = GetTileMixture(IoCManager.Resolve().GetComponent(exposed.Owner.Uid).Coordinates); + var tile = GetTileMixture(IoCManager.Resolve().GetComponent(exposed.Owner).Coordinates); if (tile == null) continue; - var updateEvent = new AtmosExposedUpdateEvent(IoCManager.Resolve().GetComponent(exposed.Owner.Uid).Coordinates, tile); - RaiseLocalEvent(exposed.Owner.Uid, ref updateEvent); + var updateEvent = new AtmosExposedUpdateEvent(IoCManager.Resolve().GetComponent(exposed.Owner).Coordinates, tile); + RaiseLocalEvent(exposed.Owner, ref updateEvent); } _exposedTimer -= ExposedUpdateDelay; diff --git a/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs b/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs index aea96c67df..91a672d503 100644 --- a/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs +++ b/Content.Server/Atmos/EntitySystems/BarotraumaSystem.cs @@ -86,9 +86,9 @@ namespace Content.Server.Atmos.EntitySystems if (totalDamage >= barotrauma.MaxDamage) continue; - var uid = barotrauma.Owner.Uid; + var uid = (EntityUid) barotrauma.Owner; - var status = IoCManager.Resolve().GetComponentOrNull(barotrauma.Owner.Uid); + var status = IoCManager.Resolve().GetComponentOrNull(barotrauma.Owner); var pressure = 1f; diff --git a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs index 151eed66a4..40abc9739c 100644 --- a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs +++ b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs @@ -58,7 +58,7 @@ namespace Content.Server.Atmos.EntitySystems return; var isHotEvent = new IsHotEvent(); - RaiseLocalEvent(args.Used.Uid, isHotEvent, false); + RaiseLocalEvent(args.Used, isHotEvent, false); if (!isHotEvent.IsHot) return; @@ -69,7 +69,7 @@ namespace Content.Server.Atmos.EntitySystems private void OnCollideEvent(EntityUid uid, FlammableComponent flammable, StartCollideEvent args) { - var otherUid = args.OtherFixture.Body.Owner.Uid; + var otherUid = (EntityUid) args.OtherFixture.Body.Owner; if (!EntityManager.TryGetComponent(otherUid, out FlammableComponent? otherFlammable)) return; @@ -174,7 +174,7 @@ namespace Content.Server.Atmos.EntitySystems if (!Resolve(uid, ref flammable, ref alerts)) return; - if (!flammable.OnFire || !_actionBlockerSystem.CanInteract(flammable.Owner.Uid) || flammable.Resisting) + if (!flammable.OnFire || !_actionBlockerSystem.CanInteract(flammable.Owner) || flammable.Resisting) return; flammable.Resisting = true; @@ -217,7 +217,7 @@ namespace Content.Server.Atmos.EntitySystems // TODO: This needs cleanup to take off the crust from TemperatureComponent and shit. foreach (var (flammable, physics, transform) in EntityManager.EntityQuery()) { - var uid = flammable.Owner.Uid; + var uid = (EntityUid) flammable.Owner; // Slowly dry ourselves off if wet. if (flammable.FireStacks < 0) @@ -225,7 +225,7 @@ namespace Content.Server.Atmos.EntitySystems flammable.FireStacks = MathF.Min(0, flammable.FireStacks + 1); } - IoCManager.Resolve().TryGetComponent(flammable.Owner.Uid, out ServerAlertsComponent? status); + IoCManager.Resolve().TryGetComponent(flammable.Owner, out ServerAlertsComponent? status); if (!flammable.OnFire) { diff --git a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs index da89e453a2..b4256c1614 100644 --- a/Content.Server/Atmos/EntitySystems/GasTankSystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTankSystem.cs @@ -24,7 +24,7 @@ namespace Content.Server.Atmos.EntitySystems private void AddOpenUIVerb(EntityUid uid, GasTankComponent component, GetActivationVerbsEvent args) { - if (!args.CanAccess || !IoCManager.Resolve().TryGetComponent(args.User.Uid, out var actor)) + if (!args.CanAccess || !IoCManager.Resolve().TryGetComponent(args.User, out var actor)) return; Verb verb = new(); diff --git a/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs b/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs index 8b6b755404..d20ab1fbe6 100644 --- a/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs +++ b/Content.Server/Atmos/EntitySystems/GasTileOverlaySystem.cs @@ -197,17 +197,17 @@ namespace Content.Server.Atmos.EntitySystems // This is the max in any direction that we can get a chunk (e.g. max 2 chunks away of data). var (maxXDiff, maxYDiff) = ((int) (_updateRange / ChunkSize) + 1, (int) (_updateRange / ChunkSize) + 1); - var worldBounds = Box2.CenteredAround(IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition, + var worldBounds = Box2.CenteredAround(IoCManager.Resolve().GetComponent(entity).WorldPosition, new Vector2(_updateRange, _updateRange)); - foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve().GetComponent(entity.Uid).MapID, worldBounds)) + foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve().GetComponent(entity).MapID, worldBounds)) { if (!_overlay.TryGetValue(grid.Index, out var chunks)) { continue; } - var entityTile = grid.GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates).GridIndices; + var entityTile = grid.GetTileRef(IoCManager.Resolve().GetComponent(entity).Coordinates).GridIndices; for (var x = -maxXDiff; x <= maxXDiff; x++) { diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs index a5e48e8d0d..d2febdb99b 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasDualPortVentPumpSystem.cs @@ -28,7 +28,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnGasDualPortVentPumpUpdated(EntityUid uid, GasDualPortVentPumpComponent vent, AtmosDeviceUpdateEvent args) { - var appearance = IoCManager.Resolve().GetComponentOrNull(vent.Owner.Uid); + var appearance = IoCManager.Resolve().GetComponentOrNull(vent.Owner); if (vent.Welded) { @@ -45,7 +45,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems return; } - var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(vent.Owner.Uid).Coordinates, true); + var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(vent.Owner).Coordinates, true); // We're in an air-blocked tile... Do nothing. if (environment == null) diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs index 29a9d1c005..34c897337e 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs @@ -38,7 +38,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnExamined(EntityUid uid, GasPressurePumpComponent pump, ExaminedEvent args) { - if (!IoCManager.Resolve().GetComponent(pump.Owner.Uid).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. + if (!IoCManager.Resolve().GetComponent(pump.Owner).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. return; if (Loc.TryGetString("gas-pressure-pump-system-examined", out var str, @@ -50,7 +50,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, AtmosDeviceUpdateEvent args) { - var appearance = IoCManager.Resolve().GetComponentOrNull(pump.Owner.Uid); + var appearance = IoCManager.Resolve().GetComponentOrNull(pump.Owner); if (!pump.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) @@ -92,10 +92,10 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnPumpInteractHand(EntityUid uid, GasPressurePumpComponent component, InteractHandEvent args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) return; - if (IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored) + if (IoCManager.Resolve().GetComponent(component.Owner).Anchored) { _userInterfaceSystem.TryOpen(uid, GasPressurePumpUiKey.Key, actor.PlayerSession); DirtyUI(uid, component); @@ -127,7 +127,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems return; _userInterfaceSystem.TrySetUiState(uid, GasPressurePumpUiKey.Key, - new GasPressurePumpBoundUserInterfaceState(IoCManager.Resolve().GetComponent(pump.Owner.Uid).EntityName, pump.TargetPressure, pump.Enabled)); + new GasPressurePumpBoundUserInterfaceState(IoCManager.Resolve().GetComponent(pump.Owner).EntityName, pump.TargetPressure, pump.Enabled)); } } } diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs index 33b0454bf1..43693e4ad9 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs @@ -31,7 +31,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnExamined(EntityUid uid, GasValveComponent valve, ExaminedEvent args) { - if (!IoCManager.Resolve().GetComponent(valve.Owner.Uid).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. + if (!IoCManager.Resolve().GetComponent(valve.Owner).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. return; if (Loc.TryGetString("gas-valve-system-examined", out var str, @@ -49,7 +49,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnActivate(EntityUid uid, GasValveComponent component, ActivateInWorldEvent args) { - if (args.User.InRangeUnobstructed(args.Target) && Get().CanInteract(args.User.Uid)) + if (args.User.InRangeUnobstructed(args.Target) && Get().CanInteract(args.User)) { Toggle(uid, component); SoundSystem.Play(Filter.Pvs(component.Owner), component._valveSound.GetSound(), component.Owner, AudioHelpers.WithVariation(0.25f)); diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs index 46fdb8ff84..82e632ba2e 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs @@ -39,7 +39,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnExamined(EntityUid uid, GasVolumePumpComponent pump, ExaminedEvent args) { - if (!IoCManager.Resolve().GetComponent(pump.Owner.Uid).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. + if (!IoCManager.Resolve().GetComponent(pump.Owner).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status. return; if (Loc.TryGetString("gas-volume-pump-system-examined", out var str, @@ -83,7 +83,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems // Some of the gas from the mixture leaks when overclocked. if (pump.Overclocked) { - var tile = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(pump.Owner.Uid).Coordinates, true); + var tile = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(pump.Owner).Coordinates, true); if (tile != null) { @@ -97,10 +97,10 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems private void OnPumpInteractHand(EntityUid uid, GasVolumePumpComponent component, InteractHandEvent args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) return; - if (IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored) + if (IoCManager.Resolve().GetComponent(component.Owner).Anchored) { _userInterfaceSystem.TryOpen(uid, GasVolumePumpUiKey.Key, actor.PlayerSession); DirtyUI(uid, component); @@ -132,7 +132,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems return; _userInterfaceSystem.TrySetUiState(uid, GasVolumePumpUiKey.Key, - new GasVolumePumpBoundUserInterfaceState(IoCManager.Resolve().GetComponent(pump.Owner.Uid).EntityName, pump.TransferRate, pump.Enabled)); + new GasVolumePumpBoundUserInterfaceState(IoCManager.Resolve().GetComponent(pump.Owner).EntityName, pump.TransferRate, pump.Enabled)); } } } diff --git a/Content.Server/Atmos/Piping/Components/AtmosPipeColorComponent.cs b/Content.Server/Atmos/Piping/Components/AtmosPipeColorComponent.cs index 87439345f5..2057ae2118 100644 --- a/Content.Server/Atmos/Piping/Components/AtmosPipeColorComponent.cs +++ b/Content.Server/Atmos/Piping/Components/AtmosPipeColorComponent.cs @@ -19,7 +19,7 @@ namespace Content.Server.Atmos.Piping.Components public Color ColorVV { get => Color; - set => EntitySystem.Get().SetColor(Owner.Uid, this, value); + set => EntitySystem.Get().SetColor(Owner, this, value); } } } diff --git a/Content.Server/Atmos/Piping/EntitySystems/AtmosDeviceSystem.cs b/Content.Server/Atmos/Piping/EntitySystems/AtmosDeviceSystem.cs index 1f6ac4d801..92a027a5c1 100644 --- a/Content.Server/Atmos/Piping/EntitySystems/AtmosDeviceSystem.cs +++ b/Content.Server/Atmos/Piping/EntitySystems/AtmosDeviceSystem.cs @@ -32,7 +32,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems private bool CanJoinAtmosphere(AtmosDeviceComponent component) { - return !component.RequireAnchored || IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored; + return !component.RequireAnchored || IoCManager.Resolve().GetComponent(component.Owner).Anchored; } public void JoinAtmosphere(AtmosDeviceComponent component) @@ -59,7 +59,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems component.LastProcess = _gameTiming.CurTime; - RaiseLocalEvent(component.Owner.Uid, new AtmosDeviceEnabledEvent(), false); + RaiseLocalEvent(component.Owner, new AtmosDeviceEnabledEvent(), false); } public void LeaveAtmosphere(AtmosDeviceComponent component) @@ -79,7 +79,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems } component.LastProcess = TimeSpan.Zero; - RaiseLocalEvent(component.Owner.Uid, new AtmosDeviceDisabledEvent(), false); + RaiseLocalEvent(component.Owner, new AtmosDeviceDisabledEvent(), false); } public void RejoinAtmosphere(AtmosDeviceComponent component) @@ -104,7 +104,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems if (!component.RequireAnchored) return; - if(IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored) + if(IoCManager.Resolve().GetComponent(component.Owner).Anchored) JoinAtmosphere(component); else LeaveAtmosphere(component); @@ -127,7 +127,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems var time = _gameTiming.CurTime; foreach (var device in _joinedDevices) { - RaiseLocalEvent(device.Owner.Uid, _updateEvent, false); + RaiseLocalEvent(device.Owner, _updateEvent, false); device.LastProcess = time; } } diff --git a/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs b/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs index 6ada0a09e3..3ba85fddd3 100644 --- a/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs +++ b/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs @@ -31,7 +31,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems if (!component.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes)) return; - if (_atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates) is not {} environment) + if (_atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(component.Owner).Coordinates) is not {} environment) return; foreach (var node in nodes.Nodes.Values) @@ -52,7 +52,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems if (!component.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodes)) return; - if (_atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates, true) is not {} environment) + if (_atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(component.Owner).Coordinates, true) is not {} environment) environment = GasMixture.SpaceGas; var lost = 0f; diff --git a/Content.Server/Atmos/Piping/Other/EntitySystems/GasMinerSystem.cs b/Content.Server/Atmos/Piping/Other/EntitySystems/GasMinerSystem.cs index 7732c1d0f4..fe4ab565ab 100644 --- a/Content.Server/Atmos/Piping/Other/EntitySystems/GasMinerSystem.cs +++ b/Content.Server/Atmos/Piping/Other/EntitySystems/GasMinerSystem.cs @@ -37,10 +37,10 @@ namespace Content.Server.Atmos.Piping.Other.EntitySystems private bool CheckMinerOperation(GasMinerComponent miner, [NotNullWhen(true)] out GasMixture? environment) { - environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(miner.Owner.Uid).Coordinates, true); + environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(miner.Owner).Coordinates, true); // Space. - if (_atmosphereSystem.IsTileSpace(IoCManager.Resolve().GetComponent(miner.Owner.Uid).Coordinates)) + if (_atmosphereSystem.IsTileSpace(IoCManager.Resolve().GetComponent(miner.Owner).Coordinates)) { miner.Broken = true; return false; diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs index 5187743b6e..4a0da847db 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs @@ -38,7 +38,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems private void OnFilterUpdated(EntityUid uid, GasFilterComponent filter, AtmosDeviceUpdateEvent args) { - var appearance = IoCManager.Resolve().GetComponentOrNull(filter.Owner.Uid); + var appearance = IoCManager.Resolve().GetComponentOrNull(filter.Owner); if (!filter.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) @@ -81,10 +81,10 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems private void OnFilterInteractHand(EntityUid uid, GasFilterComponent component, InteractHandEvent args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) return; - if (IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored) + if (IoCManager.Resolve().GetComponent(component.Owner).Anchored) { _userInterfaceSystem.TryOpen(uid, GasFilterUiKey.Key, actor.PlayerSession); DirtyUI(uid, component); @@ -104,7 +104,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems return; _userInterfaceSystem.TrySetUiState(uid, GasFilterUiKey.Key, - new GasFilterBoundUserInterfaceState(IoCManager.Resolve().GetComponent(filter.Owner.Uid).EntityName, filter.TransferRate, filter.Enabled, filter.FilteredGas)); + new GasFilterBoundUserInterfaceState(IoCManager.Resolve().GetComponent(filter.Owner).EntityName, filter.TransferRate, filter.Enabled, filter.FilteredGas)); } private void OnToggleStatusMessage(EntityUid uid, GasFilterComponent filter, GasFilterToggleStatusMessage args) diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs index c8a3fb062e..668f8e02b1 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs @@ -106,10 +106,10 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems private void OnMixerInteractHand(EntityUid uid, GasMixerComponent component, InteractHandEvent args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) return; - if (IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored) + if (IoCManager.Resolve().GetComponent(component.Owner).Anchored) { _userInterfaceSystem.TryOpen(uid, GasMixerUiKey.Key, actor.PlayerSession); DirtyUI(uid, component); @@ -128,7 +128,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems return; _userInterfaceSystem.TrySetUiState(uid, GasMixerUiKey.Key, - new GasMixerBoundUserInterfaceState(IoCManager.Resolve().GetComponent(mixer.Owner.Uid).EntityName, mixer.TargetPressure, mixer.Enabled, mixer.InletOneConcentration)); + new GasMixerBoundUserInterfaceState(IoCManager.Resolve().GetComponent(mixer.Owner).EntityName, mixer.TargetPressure, mixer.Enabled, mixer.InletOneConcentration)); } private void OnToggleStatusMessage(EntityUid uid, GasMixerComponent mixer, GasMixerToggleStatusMessage args) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs index ec3fa4ecc3..454b171b29 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs @@ -110,14 +110,14 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (containerManager.TryGetContainer(canister.ContainerName, out var tankContainer) && tankContainer.ContainedEntities.Count > 0) { - var tank = tankContainer.ContainedEntities[0].Uid; + var tank = (EntityUid) tankContainer.ContainedEntities[0]; var tankComponent = EntityManager.GetComponent(tank); tankLabel = EntityManager.GetComponent(tank).EntityName; tankPressure = tankComponent.Air.Pressure; } _userInterfaceSystem.TrySetUiState(uid, GasCanisterUiKey.Key, - new GasCanisterBoundUserInterfaceState(IoCManager.Resolve().GetComponent(canister.Owner.Uid).EntityName, + new GasCanisterBoundUserInterfaceState(IoCManager.Resolve().GetComponent(canister.Owner).EntityName, canister.Air.Pressure, portStatus, tankLabel, tankPressure, canister.ReleasePressure, canister.ReleaseValve, canister.MinReleasePressure, canister.MaxReleasePressure)); } @@ -206,12 +206,12 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (container.ContainedEntities.Count > 0) { IEntity tempQualifier = container.ContainedEntities[0]; - var gasTank = IoCManager.Resolve().GetComponent(tempQualifier.Uid); + var gasTank = IoCManager.Resolve().GetComponent(tempQualifier); _atmosphereSystem.ReleaseGasTo(canister.Air, gasTank.Air, canister.ReleasePressure); } else { - var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(canister.Owner.Uid).Coordinates, true); + var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(canister.Owner).Coordinates, true); _atmosphereSystem.ReleaseGasTo(canister.Air, environment, canister.ReleasePressure); } } @@ -244,7 +244,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnCanisterActivate(EntityUid uid, GasCanisterComponent component, ActivateInWorldEvent args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) return; _userInterfaceSystem.GetUiOrNull(uid, GasCanisterUiKey.Key)?.Open(actor.PlayerSession); @@ -254,7 +254,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnCanisterInteractHand(EntityUid uid, GasCanisterComponent component, InteractHandEvent args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) return; _userInterfaceSystem.GetUiOrNull(uid, GasCanisterUiKey.Key)?.Open(actor.PlayerSession); @@ -271,11 +271,11 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems return; // Check the used item is valid... - if (!IoCManager.Resolve().TryGetComponent(args.Used.Uid, out GasTankComponent? _)) + if (!IoCManager.Resolve().TryGetComponent(args.Used, out GasTankComponent? _)) return; // Check the user has hands. - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out HandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out HandsComponent? hands)) return; if (!args.User.InRangeUnobstructed(canister, SharedInteractionSystem.InteractionRange, popup: true)) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs index 1c1a1bdc88..e07063f4d4 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs @@ -35,7 +35,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (!nodeContainer.TryGetNode(injector.InletName, out PipeNode? inlet)) return; - var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(injector.Owner.Uid).Coordinates, true); + var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(injector.Owner).Coordinates, true); if (environment == null) return; diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs index 05603665bf..2935413f52 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs @@ -25,7 +25,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnPassiveVentUpdated(EntityUid uid, GasPassiveVentComponent vent, AtmosDeviceUpdateEvent args) { - var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(vent.Owner.Uid).Coordinates, true); + var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(vent.Owner).Coordinates, true); if (environment == null) return; diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs index be39e37991..98df062037 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs @@ -25,7 +25,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnThermoMachineUpdated(EntityUid uid, GasThermoMachineComponent thermoMachine, AtmosDeviceUpdateEvent args) { - var appearance = IoCManager.Resolve().GetComponentOrNull(thermoMachine.Owner.Uid); + var appearance = IoCManager.Resolve().GetComponentOrNull(thermoMachine.Owner); if (!thermoMachine.Enabled || !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index 121a33b24f..b848769875 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -27,7 +27,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, AtmosDeviceUpdateEvent args) { - var appearance = IoCManager.Resolve().GetComponentOrNull(vent.Owner.Uid); + var appearance = IoCManager.Resolve().GetComponentOrNull(vent.Owner); if (vent.Welded) { @@ -43,7 +43,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems return; } - var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(vent.Owner.Uid).Coordinates, true); + var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(vent.Owner).Coordinates, true); // We're in an air-blocked tile... Do nothing. if (environment == null) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs index 5b184f4bb5..6df03c59a6 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs @@ -28,7 +28,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnVentScrubberUpdated(EntityUid uid, GasVentScrubberComponent scrubber, AtmosDeviceUpdateEvent args) { - var appearance = IoCManager.Resolve().GetComponentOrNull(scrubber.Owner.Uid); + var appearance = IoCManager.Resolve().GetComponentOrNull(scrubber.Owner); if (scrubber.Welded) { @@ -44,14 +44,14 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems return; } - var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(scrubber.Owner.Uid).Coordinates, true); + var environment = _atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(scrubber.Owner).Coordinates, true); Scrub(_atmosphereSystem, scrubber, appearance, environment, outlet); if (!scrubber.WideNet) return; // Scrub adjacent tiles too. - foreach (var adjacent in _atmosphereSystem.GetAdjacentTileMixtures(IoCManager.Resolve().GetComponent(scrubber.Owner.Uid).Coordinates, false, true)) + foreach (var adjacent in _atmosphereSystem.GetAdjacentTileMixtures(IoCManager.Resolve().GetComponent(scrubber.Owner).Coordinates, false, true)) { Scrub(_atmosphereSystem, scrubber, null, adjacent, outlet); } diff --git a/Content.Server/BarSign/Systems/BarSignSystem.cs b/Content.Server/BarSign/Systems/BarSignSystem.cs index cf833cc2ec..fb3ac2456e 100644 --- a/Content.Server/BarSign/Systems/BarSignSystem.cs +++ b/Content.Server/BarSign/Systems/BarSignSystem.cs @@ -67,9 +67,9 @@ namespace Content.Server.BarSign.Systems return; } - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out SpriteComponent? sprite)) { - if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out ApcPowerReceiverComponent? receiver) || !receiver.Powered) + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver) || !receiver.Powered) { sprite.LayerSetState(0, "empty"); sprite.LayerSetShader(0, "shaded"); @@ -83,15 +83,15 @@ namespace Content.Server.BarSign.Systems if (!string.IsNullOrEmpty(prototype.Name)) { - IoCManager.Resolve().GetComponent(component.Owner.Uid).EntityName = prototype.Name; + IoCManager.Resolve().GetComponent(component.Owner).EntityName = prototype.Name; } else { string val = Loc.GetString("barsign-component-name"); - IoCManager.Resolve().GetComponent(component.Owner.Uid).EntityName = val; + IoCManager.Resolve().GetComponent(component.Owner).EntityName = val; } - IoCManager.Resolve().GetComponent(component.Owner.Uid).EntityDescription = prototype.Description; + IoCManager.Resolve().GetComponent(component.Owner).EntityDescription = prototype.Description; } } } diff --git a/Content.Server/Body/Commands/AddHandCommand.cs b/Content.Server/Body/Commands/AddHandCommand.cs index 2efa331866..67e71b574b 100644 --- a/Content.Server/Body/Commands/AddHandCommand.cs +++ b/Content.Server/Body/Commands/AddHandCommand.cs @@ -52,7 +52,7 @@ namespace Content.Server.Body.Commands } entity = player.AttachedEntityUid.Value; - hand = entityManager.SpawnEntity(DefaultHandPrototype, entityManager.GetComponent(entity).Coordinates).Uid; + hand = entityManager.SpawnEntity(DefaultHandPrototype, entityManager.GetComponent(entity).Coordinates); break; } case 1: @@ -66,7 +66,7 @@ namespace Content.Server.Body.Commands } entity = uid; - hand = entityManager.SpawnEntity(DefaultHandPrototype, entityManager.GetComponent(entity).Coordinates).Uid; + hand = entityManager.SpawnEntity(DefaultHandPrototype, entityManager.GetComponent(entity).Coordinates); } else { @@ -83,7 +83,7 @@ namespace Content.Server.Body.Commands } entity = player.AttachedEntityUid.Value; - hand = entityManager.SpawnEntity(args[0], entityManager.GetComponent(entity).Coordinates).Uid; + hand = entityManager.SpawnEntity(args[0], entityManager.GetComponent(entity).Coordinates); } break; @@ -110,7 +110,7 @@ namespace Content.Server.Body.Commands return; } - hand = entityManager.SpawnEntity(args[1], entityManager.GetComponent(entity).Coordinates).Uid; + hand = entityManager.SpawnEntity(args[1], entityManager.GetComponent(entity).Coordinates); break; } diff --git a/Content.Server/Body/Commands/AttachBodyPartCommand.cs b/Content.Server/Body/Commands/AttachBodyPartCommand.cs index 9b926b1c50..9edf7167b5 100644 --- a/Content.Server/Body/Commands/AttachBodyPartCommand.cs +++ b/Content.Server/Body/Commands/AttachBodyPartCommand.cs @@ -73,9 +73,9 @@ namespace Content.Server.Body.Commands return; } - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out SharedBodyComponent? body)) + if (!IoCManager.Resolve().TryGetComponent(entity, out SharedBodyComponent? body)) { - shell.WriteLine($"Entity {IoCManager.Resolve().GetComponent(entity.Uid).EntityName} with uid {entity.Uid} does not have a {nameof(SharedBodyComponent)} component."); + shell.WriteLine($"Entity {IoCManager.Resolve().GetComponent(entity).EntityName} with uid {entity} does not have a {nameof(SharedBodyComponent)} component."); return; } @@ -85,19 +85,19 @@ namespace Content.Server.Body.Commands return; } - if (!IoCManager.Resolve().TryGetComponent(partEntity.Uid, out SharedBodyPartComponent? part)) + if (!IoCManager.Resolve().TryGetComponent(partEntity, out SharedBodyPartComponent? part)) { - shell.WriteLine($"Entity {IoCManager.Resolve().GetComponent(partEntity.Uid).EntityName} with uid {args[0]} does not have a {nameof(SharedBodyPartComponent)} component."); + shell.WriteLine($"Entity {IoCManager.Resolve().GetComponent(partEntity).EntityName} with uid {args[0]} does not have a {nameof(SharedBodyPartComponent)} component."); return; } if (body.HasPart(part)) { - shell.WriteLine($"Body part {IoCManager.Resolve().GetComponent(partEntity.Uid).EntityName} with uid {partEntity.Uid} is already attached to entity {IoCManager.Resolve().GetComponent(entity.Uid).EntityName} with uid {entity.Uid}"); + shell.WriteLine($"Body part {IoCManager.Resolve().GetComponent(partEntity).EntityName} with uid {partEntity} is already attached to entity {IoCManager.Resolve().GetComponent(entity).EntityName} with uid {entity}"); return; } - body.SetPart($"AttachBodyPartVerb-{partEntity.Uid}", part); + body.SetPart($"AttachBodyPartVerb-{partEntity}", part); } } } diff --git a/Content.Server/Body/Commands/DestroyMechanismCommand.cs b/Content.Server/Body/Commands/DestroyMechanismCommand.cs index f2aa21c433..9d2726cde3 100644 --- a/Content.Server/Body/Commands/DestroyMechanismCommand.cs +++ b/Content.Server/Body/Commands/DestroyMechanismCommand.cs @@ -37,7 +37,7 @@ namespace Content.Server.Body.Commands return; } - if (!IoCManager.Resolve().TryGetComponent(player.AttachedEntity.Uid, out SharedBodyComponent? body)) + if (!IoCManager.Resolve().TryGetComponent(player.AttachedEntity, out SharedBodyComponent? body)) { var random = IoCManager.Resolve(); var text = $"You have no body{(random.Prob(0.2f) ? " and you must scream." : ".")}"; diff --git a/Content.Server/Body/Commands/RemoveHandCommand.cs b/Content.Server/Body/Commands/RemoveHandCommand.cs index c6a5221d2c..e474ebfb1a 100644 --- a/Content.Server/Body/Commands/RemoveHandCommand.cs +++ b/Content.Server/Body/Commands/RemoveHandCommand.cs @@ -33,7 +33,7 @@ namespace Content.Server.Body.Commands return; } - if (!IoCManager.Resolve().TryGetComponent(player.AttachedEntity.Uid, out SharedBodyComponent? body)) + if (!IoCManager.Resolve().TryGetComponent(player.AttachedEntity, out SharedBodyComponent? body)) { var random = IoCManager.Resolve(); var text = $"You have no body{(random.Prob(0.2f) ? " and you must scream." : ".")}"; diff --git a/Content.Server/Body/Components/BodyComponent.cs b/Content.Server/Body/Components/BodyComponent.cs index 9e773bdc2c..640fdd8c92 100644 --- a/Content.Server/Body/Components/BodyComponent.cs +++ b/Content.Server/Body/Components/BodyComponent.cs @@ -58,9 +58,9 @@ namespace Content.Server.Body.Components { // Using MapPosition instead of Coordinates here prevents // a crash within the character preview menu in the lobby - var entity = IoCManager.Resolve().SpawnEntity(preset.PartIDs[slot.Id], IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition); + var entity = IoCManager.Resolve().SpawnEntity(preset.PartIDs[slot.Id], IoCManager.Resolve().GetComponent(Owner).MapPosition); - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out SharedBodyPartComponent? part)) + if (!IoCManager.Resolve().TryGetComponent(entity, out SharedBodyPartComponent? part)) { Logger.Error($"Entity {slot.Id} does not have a {nameof(SharedBodyPartComponent)} component."); continue; @@ -88,22 +88,22 @@ namespace Content.Server.Body.Components { base.Gib(gibParts); - SoundSystem.Play(Filter.Pvs(Owner), _gibSound.GetSound(), IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, AudioHelpers.WithVariation(0.025f)); + SoundSystem.Play(Filter.Pvs(Owner), _gibSound.GetSound(), IoCManager.Resolve().GetComponent(Owner).Coordinates, AudioHelpers.WithVariation(0.025f)); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ContainerManagerComponent? container)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ContainerManagerComponent? container)) { foreach (var cont in container.GetAllContainers()) { foreach (var ent in cont.ContainedEntities) { cont.ForceRemove(ent); - IoCManager.Resolve().GetComponent(ent.Uid).Coordinates = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + IoCManager.Resolve().GetComponent(ent).Coordinates = IoCManager.Resolve().GetComponent(Owner).Coordinates; ent.RandomOffset(0.25f); } } } - IoCManager.Resolve().QueueDeleteEntity(Owner.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) Owner); } } } diff --git a/Content.Server/Body/Components/BodyPartComponent.cs b/Content.Server/Body/Components/BodyPartComponent.cs index ec739784f7..e28049b5e5 100644 --- a/Content.Server/Body/Components/BodyPartComponent.cs +++ b/Content.Server/Body/Components/BodyPartComponent.cs @@ -64,9 +64,9 @@ namespace Content.Server.Body.Components // identical on it foreach (var mechanismId in MechanismIds) { - var entity = IoCManager.Resolve().SpawnEntity(mechanismId, IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition); + var entity = IoCManager.Resolve().SpawnEntity(mechanismId, IoCManager.Resolve().GetComponent(Owner).MapPosition); - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out SharedMechanismComponent? mechanism)) + if (!IoCManager.Resolve().TryGetComponent(entity, out SharedMechanismComponent? mechanism)) { Logger.Error($"Entity {mechanismId} does not have a {nameof(SharedMechanismComponent)} component."); continue; @@ -104,7 +104,7 @@ namespace Content.Server.Body.Components _surgeonCache = null; _owningBodyCache = null; - if (IoCManager.Resolve().TryGetComponent(eventArgs.Target.Uid, out SharedBodyComponent? body)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.Target, out SharedBodyComponent? body)) { SendSlots(eventArgs, body); } @@ -141,8 +141,8 @@ namespace Content.Server.Body.Components if (_optionsCache.Count > 0) { - OpenSurgeryUI(IoCManager.Resolve().GetComponent(eventArgs.User.Uid).PlayerSession); - BodyPartSlotRequest(IoCManager.Resolve().GetComponent(eventArgs.User.Uid).PlayerSession, + OpenSurgeryUI(IoCManager.Resolve().GetComponent(eventArgs.User).PlayerSession); + BodyPartSlotRequest(IoCManager.Resolve().GetComponent(eventArgs.User).PlayerSession, toSend); _surgeonCache = eventArgs.User; _owningBodyCache = body; @@ -161,7 +161,7 @@ namespace Content.Server.Body.Components private void ReceiveBodyPartSlot(int key) { if (_surgeonCache == null || - !IoCManager.Resolve().TryGetComponent(_surgeonCache.Uid, out ActorComponent? actor)) + !IoCManager.Resolve().TryGetComponent(_surgeonCache, out ActorComponent? actor)) { return; } diff --git a/Content.Server/Body/Components/BodyScannerComponent.cs b/Content.Server/Body/Components/BodyScannerComponent.cs index ca19f0a55a..3b4deae1e1 100644 --- a/Content.Server/Body/Components/BodyScannerComponent.cs +++ b/Content.Server/Body/Components/BodyScannerComponent.cs @@ -17,7 +17,7 @@ namespace Content.Server.Body.Components void IActivate.Activate(ActivateEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) { return; } @@ -29,7 +29,7 @@ namespace Content.Server.Body.Components return; } - if (IoCManager.Resolve().TryGetComponent(session.AttachedEntity.Uid, out SharedBodyComponent? body)) + if (IoCManager.Resolve().TryGetComponent(session.AttachedEntity, out SharedBodyComponent? body)) { var state = InterfaceState(body); UserInterface?.SetState(state); @@ -57,7 +57,7 @@ namespace Content.Server.Body.Components /// private BodyScannerUIState InterfaceState(SharedBodyComponent body) { - return new(body.Owner.Uid); + return new(body.Owner); } } } diff --git a/Content.Server/Body/Components/InternalsComponent.cs b/Content.Server/Body/Components/InternalsComponent.cs index 75e6cb9f49..3f1b9524f4 100644 --- a/Content.Server/Body/Components/InternalsComponent.cs +++ b/Content.Server/Body/Components/InternalsComponent.cs @@ -17,7 +17,7 @@ namespace Content.Server.Body.Components var old = BreathToolEntity; BreathToolEntity = null; - if (old != null && IoCManager.Resolve().TryGetComponent(old.Uid, out BreathToolComponent? breathTool) ) + if (old != null && IoCManager.Resolve().TryGetComponent(old, out BreathToolComponent? breathTool) ) { breathTool.DisconnectInternals(); DisconnectTank(); @@ -26,7 +26,7 @@ namespace Content.Server.Body.Components public void ConnectBreathTool(IEntity toolEntity) { - if (BreathToolEntity != null && IoCManager.Resolve().TryGetComponent(BreathToolEntity.Uid, out BreathToolComponent? tool)) + if (BreathToolEntity != null && IoCManager.Resolve().TryGetComponent(BreathToolEntity, out BreathToolComponent? tool)) { tool.DisconnectInternals(); } @@ -36,7 +36,7 @@ namespace Content.Server.Body.Components public void DisconnectTank() { - if (GasTankEntity != null && IoCManager.Resolve().TryGetComponent(GasTankEntity.Uid, out GasTankComponent? tank)) + if (GasTankEntity != null && IoCManager.Resolve().TryGetComponent(GasTankEntity, out GasTankComponent? tank)) { tank.DisconnectFromInternals(Owner); } @@ -49,7 +49,7 @@ namespace Content.Server.Body.Components if (BreathToolEntity == null) return false; - if (GasTankEntity != null && IoCManager.Resolve().TryGetComponent(GasTankEntity.Uid, out GasTankComponent? tank)) + if (GasTankEntity != null && IoCManager.Resolve().TryGetComponent(GasTankEntity, out GasTankComponent? tank)) { tank.DisconnectFromInternals(Owner); } @@ -62,9 +62,9 @@ namespace Content.Server.Body.Components { return BreathToolEntity != null && GasTankEntity != null && - IoCManager.Resolve().TryGetComponent(BreathToolEntity.Uid, out BreathToolComponent? breathTool) && + IoCManager.Resolve().TryGetComponent(BreathToolEntity, out BreathToolComponent? breathTool) && breathTool.IsFunctional && - IoCManager.Resolve().TryGetComponent(GasTankEntity.Uid, out GasTankComponent? gasTank) && + IoCManager.Resolve().TryGetComponent(GasTankEntity, out GasTankComponent? gasTank) && gasTank.Air != null; } diff --git a/Content.Server/Body/Components/MechanismComponent.cs b/Content.Server/Body/Components/MechanismComponent.cs index 0d018c9748..8eb8a9d19d 100644 --- a/Content.Server/Body/Components/MechanismComponent.cs +++ b/Content.Server/Body/Components/MechanismComponent.cs @@ -44,11 +44,11 @@ namespace Content.Server.Body.Components PerformerCache = null; BodyCache = null; - if (IoCManager.Resolve().TryGetComponent(eventArgs.Target.Uid, out SharedBodyComponent? body)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.Target, out SharedBodyComponent? body)) { SendBodyPartListToUser(eventArgs, body); } - else if (IoCManager.Resolve().TryGetComponent(eventArgs.Target.Uid, out var part)) + else if (IoCManager.Resolve().TryGetComponent(eventArgs.Target, out var part)) { DebugTools.AssertNotNull(part); @@ -77,7 +77,7 @@ namespace Content.Server.Body.Components } if (OptionsCache.Count > 0 && - IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) { OpenSurgeryUI(actor.PlayerSession); UpdateSurgeryUIBodyPartRequest(actor.PlayerSession, toSend); @@ -87,7 +87,7 @@ namespace Content.Server.Body.Components else // If surgery cannot be performed, show message saying so. { eventArgs.Target?.PopupMessage(eventArgs.User, - Loc.GetString("mechanism-component-no-way-to-install-message", ("partName", Name: IoCManager.Resolve().GetComponent(Owner.Uid).EntityName))); + Loc.GetString("mechanism-component-no-way-to-install-message", ("partName", Name: IoCManager.Resolve().GetComponent(Owner).EntityName))); } } @@ -97,7 +97,7 @@ namespace Content.Server.Body.Components private void HandleReceiveBodyPart(int key) { if (PerformerCache == null || - !IoCManager.Resolve().TryGetComponent(PerformerCache.Uid, out ActorComponent? actor)) + !IoCManager.Resolve().TryGetComponent(PerformerCache, out ActorComponent? actor)) { return; } @@ -113,7 +113,7 @@ namespace Content.Server.Body.Components if (!OptionsCache.TryGetValue(key, out var targetObject)) { BodyCache.Owner.PopupMessage(PerformerCache, - Loc.GetString("mechanism-component-no-useful-way-to-use-message",("partName", Name: IoCManager.Resolve().GetComponent(Owner.Uid).EntityName))); + Loc.GetString("mechanism-component-no-useful-way-to-use-message",("partName", Name: IoCManager.Resolve().GetComponent(Owner).EntityName))); return; } diff --git a/Content.Server/Body/Surgery/BiologicalSurgeryDataComponent.cs b/Content.Server/Body/Surgery/BiologicalSurgeryDataComponent.cs index 025fead820..b0285dcd6c 100644 --- a/Content.Server/Body/Surgery/BiologicalSurgeryDataComponent.cs +++ b/Content.Server/Body/Surgery/BiologicalSurgeryDataComponent.cs @@ -31,7 +31,7 @@ namespace Content.Server.Body.Surgery private bool VesselsClamped { get; set; } - public SharedBodyPartComponent? Parent => IoCManager.Resolve().GetComponentOrNull(Owner.Uid); + public SharedBodyPartComponent? Parent => IoCManager.Resolve().GetComponentOrNull(Owner); public BodyPartType? ParentType => Parent?.PartType; @@ -53,7 +53,7 @@ namespace Content.Server.Body.Surgery private async Task SurgeryDoAfter(IEntity performer) { - if (!IoCManager.Resolve().HasComponent(performer.Uid)) + if (!IoCManager.Resolve().HasComponent(performer)) { return true; } @@ -299,7 +299,7 @@ namespace Content.Server.Body.Surgery performer.PopupMessage(Loc.GetString("biological-surgery-data-component-loosen-organ-message")); - if (!IoCManager.Resolve().HasComponent(performer.Uid)) + if (!IoCManager.Resolve().HasComponent(performer)) { AddDisconnectedOrgan(target); return; @@ -340,16 +340,16 @@ namespace Content.Server.Body.Surgery performer.PopupMessage(Loc.GetString("biological-surgery-data-component-remove-organ-message")); - if (!IoCManager.Resolve().HasComponent(performer.Uid)) + if (!IoCManager.Resolve().HasComponent(performer)) { - Parent.RemoveMechanism(target, IoCManager.Resolve().GetComponent(performer.Uid).Coordinates); + Parent.RemoveMechanism(target, IoCManager.Resolve().GetComponent(performer).Coordinates); RemoveDisconnectedOrgan(target); return; } if (await SurgeryDoAfter(performer)) { - Parent.RemoveMechanism(target, IoCManager.Resolve().GetComponent(performer.Uid).Coordinates); + Parent.RemoveMechanism(target, IoCManager.Resolve().GetComponent(performer).Coordinates); RemoveDisconnectedOrgan(target); } } diff --git a/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs b/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs index 441bf6ca3b..6020b766a8 100644 --- a/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs +++ b/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs @@ -54,7 +54,7 @@ namespace Content.Server.Body.Surgery.Components return false; } - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) { return false; } @@ -62,7 +62,7 @@ namespace Content.Server.Body.Surgery.Components CloseAllSurgeryUIs(); // Attempt surgery on a body by sending a list of operable parts for the client to choose from - if (IoCManager.Resolve().TryGetComponent(eventArgs.Target.Uid, out SharedBodyComponent? body)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.Target, out SharedBodyComponent? body)) { // Create dictionary to send to client (text to be shown : data sent back if selected) var toSend = new Dictionary(); @@ -89,7 +89,7 @@ namespace Content.Server.Body.Surgery.Components NotUsefulPopup(); } } - else if (IoCManager.Resolve().TryGetComponent(eventArgs.Target.Uid, out var part)) + else if (IoCManager.Resolve().TryGetComponent(eventArgs.Target, out var part)) { // Attempt surgery on a DroppedBodyPart - there's only one possible target so no need for selection UI PerformerCache = eventArgs.User; @@ -109,7 +109,7 @@ namespace Content.Server.Body.Surgery.Components } // Log error if the surgery fails somehow. - Logger.Debug($"Error when trying to perform surgery on ${nameof(SharedBodyPartComponent)} {IoCManager.Resolve().GetComponent(eventArgs.User.Uid).EntityName}"); + Logger.Debug($"Error when trying to perform surgery on ${nameof(SharedBodyPartComponent)} {IoCManager.Resolve().GetComponent(eventArgs.User).EntityName}"); throw new InvalidOperationException(); } @@ -129,8 +129,8 @@ namespace Content.Server.Body.Surgery.Components if (_optionsCache.Count > 0 && PerformerCache != null) { - OpenSurgeryUI(IoCManager.Resolve().GetComponent(PerformerCache.Uid).PlayerSession); - UpdateSurgeryUIMechanismRequest(IoCManager.Resolve().GetComponent(PerformerCache.Uid).PlayerSession, + OpenSurgeryUI(IoCManager.Resolve().GetComponent(PerformerCache).PlayerSession); + UpdateSurgeryUIMechanismRequest(IoCManager.Resolve().GetComponent(PerformerCache).PlayerSession, toSend); _callbackCache = callback; } @@ -214,7 +214,7 @@ namespace Content.Server.Body.Surgery.Components private void HandleReceiveBodyPart(int key) { if (PerformerCache == null || - !IoCManager.Resolve().TryGetComponent(PerformerCache.Uid, out ActorComponent? actor)) + !IoCManager.Resolve().TryGetComponent(PerformerCache, out ActorComponent? actor)) { return; } @@ -248,7 +248,7 @@ namespace Content.Server.Body.Surgery.Components !_optionsCache.TryGetValue(key, out var targetObject) || targetObject is not MechanismComponent target || PerformerCache == null || - !IoCManager.Resolve().TryGetComponent(PerformerCache.Uid, out ActorComponent? actor)) + !IoCManager.Resolve().TryGetComponent(PerformerCache, out ActorComponent? actor)) { NotUsefulAnymorePopup(); return; diff --git a/Content.Server/Body/Surgery/Components/SurgeryToolSystem.cs b/Content.Server/Body/Surgery/Components/SurgeryToolSystem.cs index 63e6ce0242..5e95ace8be 100644 --- a/Content.Server/Body/Surgery/Components/SurgeryToolSystem.cs +++ b/Content.Server/Body/Surgery/Components/SurgeryToolSystem.cs @@ -57,7 +57,7 @@ namespace Content.Server.Body.Surgery.Components continue; } - if (!_actionBlockerSystem.CanInteract(tool.PerformerCache.Uid) || + if (!_actionBlockerSystem.CanInteract(tool.PerformerCache) || !tool.PerformerCache.InRangeUnobstructed(tool.BodyCache)) { tool.CloseAllSurgeryUIs(); diff --git a/Content.Server/Body/Systems/LungSystem.cs b/Content.Server/Body/Systems/LungSystem.cs index 39f8e1afc3..51fc34d0b4 100644 --- a/Content.Server/Body/Systems/LungSystem.cs +++ b/Content.Server/Body/Systems/LungSystem.cs @@ -114,9 +114,9 @@ public class LungSystem : EntitySystem EntityManager.TryGetComponent(mech.Body.OwnerUid, out InternalsComponent? internals) && internals.BreathToolEntity != null && internals.GasTankEntity != null && - IoCManager.Resolve().TryGetComponent(internals.BreathToolEntity.Uid, out BreathToolComponent? breathTool) && + IoCManager.Resolve().TryGetComponent(internals.BreathToolEntity, out BreathToolComponent? breathTool) && breathTool.IsFunctional && - IoCManager.Resolve().TryGetComponent(internals.GasTankEntity.Uid, out GasTankComponent? gasTank)) + IoCManager.Resolve().TryGetComponent(internals.GasTankEntity, out GasTankComponent? gasTank)) { TakeGasFrom(uid, frameTime, gasTank.RemoveAirVolume(Atmospherics.BreathVolume), lung); return; diff --git a/Content.Server/Body/Systems/MetabolizerSystem.cs b/Content.Server/Body/Systems/MetabolizerSystem.cs index 99037f0434..0f2229f879 100644 --- a/Content.Server/Body/Systems/MetabolizerSystem.cs +++ b/Content.Server/Body/Systems/MetabolizerSystem.cs @@ -165,7 +165,7 @@ namespace Content.Server.Body.Systems { var entity = EntityManager.GetEntity(args.SolutionEntity); _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, - $"Metabolism effect {effect.GetType().Name} of reagent {args.Reagent.Name:reagent} applied on entity {entity} at {IoCManager.Resolve().GetComponent(entity.Uid).Coordinates}"); + $"Metabolism effect {effect.GetType().Name} of reagent {args.Reagent.Name:reagent} applied on entity {entity} at {IoCManager.Resolve().GetComponent(entity).Coordinates}"); } effect.Effect(args); diff --git a/Content.Server/Botany/Components/LogComponent.cs b/Content.Server/Botany/Components/LogComponent.cs index 7d504fc3b1..632846476a 100644 --- a/Content.Server/Botany/Components/LogComponent.cs +++ b/Content.Server/Botany/Components/LogComponent.cs @@ -16,18 +16,18 @@ namespace Content.Server.Botany.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - if (!EntitySystem.Get().CanInteract(eventArgs.User.Uid)) + if (!EntitySystem.Get().CanInteract(eventArgs.User)) return false; if (eventArgs.Using.HasTag("BotanySharp")) { for (var i = 0; i < 2; i++) { - var plank = IoCManager.Resolve().SpawnEntity("MaterialWoodPlank1", IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var plank = IoCManager.Resolve().SpawnEntity("MaterialWoodPlank1", IoCManager.Resolve().GetComponent(Owner).Coordinates); plank.RandomOffset(0.25f); } - IoCManager.Resolve().QueueDeleteEntity(Owner.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) Owner); return true; } diff --git a/Content.Server/Botany/Components/PlantHolderComponent.cs b/Content.Server/Botany/Components/PlantHolderComponent.cs index 410298d39c..8ae3a77ee1 100644 --- a/Content.Server/Botany/Components/PlantHolderComponent.cs +++ b/Content.Server/Botany/Components/PlantHolderComponent.cs @@ -248,7 +248,7 @@ namespace Content.Server.Botany.Components _updateSpriteAfterUpdate = true; } - var environment = EntitySystem.Get().GetTileMixture(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, true) ?? + var environment = EntitySystem.Get().GetTileMixture(IoCManager.Resolve().GetComponent(Owner).Coordinates, true) ?? GasMixture.SpaceGas; if (Seed.ConsumeGasses.Count > 0) @@ -361,7 +361,7 @@ namespace Content.Server.Botany.Components } else if (Age < 0) // Revert back to seed packet! { - Seed.SpawnSeedPacket(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + Seed.SpawnSeedPacket(IoCManager.Resolve().GetComponent(Owner).Coordinates); RemovePlant(); ForceUpdate = true; Update(); @@ -421,12 +421,12 @@ namespace Content.Server.Botany.Components public bool DoHarvest(IEntity user) { - if (Seed == null || (!IoCManager.Resolve().EntityExists(user.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(user.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || !EntitySystem.Get().CanInteract(user.Uid)) + if (Seed == null || (!IoCManager.Resolve().EntityExists(user) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(user).EntityLifeStage) >= EntityLifeStage.Deleted || !EntitySystem.Get().CanInteract(user)) return false; if (Harvest && !Dead) { - if (IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? hands)) + if (IoCManager.Resolve().TryGetComponent(user, out HandsComponent? hands)) { if (!Seed.CheckHarvest(user, hands.GetActiveHand?.Owner)) return false; @@ -453,7 +453,7 @@ namespace Content.Server.Botany.Components if (Seed == null || !Harvest) return; - Seed.AutoHarvest(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + Seed.AutoHarvest(IoCManager.Resolve().GetComponent(Owner).Coordinates); AfterHarvest(); } @@ -549,7 +549,7 @@ namespace Content.Server.Botany.Components public void UpdateReagents() { var solutionSystem = EntitySystem.Get(); - if (!solutionSystem.TryGetSolution(Owner.Uid, SoilSolutionName, out var solution)) + if (!solutionSystem.TryGetSolution(Owner, SoilSolutionName, out var solution)) return; if (solution.TotalVolume <= 0 || MutationLevel >= 25) @@ -651,17 +651,17 @@ namespace Content.Server.Botany.Components var user = eventArgs.User; var usingItem = eventArgs.Using; - if ((!IoCManager.Resolve().EntityExists(usingItem.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(usingItem.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || !EntitySystem.Get().CanInteract(user.Uid)) + if ((!IoCManager.Resolve().EntityExists(usingItem) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(usingItem).EntityLifeStage) >= EntityLifeStage.Deleted || !EntitySystem.Get().CanInteract(user)) return false; - if (IoCManager.Resolve().TryGetComponent(usingItem.Uid, out SeedComponent? seeds)) + if (IoCManager.Resolve().TryGetComponent(usingItem, out SeedComponent? seeds)) { if (Seed == null) { if (seeds.Seed == null) { user.PopupMessageCursor(Loc.GetString("plant-holder-component-empty-seed-packet-message")); - IoCManager.Resolve().QueueDeleteEntity(usingItem.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) usingItem); return false; } @@ -675,7 +675,7 @@ namespace Content.Server.Botany.Components Health = Seed.Endurance; _lastCycle = _gameTiming.CurTime; - IoCManager.Resolve().QueueDeleteEntity(usingItem.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) usingItem); CheckLevelSanity(); UpdateSprite(); @@ -684,7 +684,7 @@ namespace Content.Server.Botany.Components } user.PopupMessageCursor(Loc.GetString("plant-holder-component-already-seeded-message", - ("name", Name: IoCManager.Resolve().GetComponent(Owner.Uid).EntityName))); + ("name", Name: IoCManager.Resolve().GetComponent(Owner).EntityName))); return false; } @@ -693,9 +693,9 @@ namespace Content.Server.Botany.Components if (WeedLevel > 0) { user.PopupMessageCursor(Loc.GetString("plant-holder-component-remove-weeds-message", - ("name", Name: IoCManager.Resolve().GetComponent(Owner.Uid).EntityName))); + ("name", Name: IoCManager.Resolve().GetComponent(Owner).EntityName))); user.PopupMessageOtherClients(Loc.GetString("plant-holder-component-remove-weeds-others-message", - ("otherName", Name: IoCManager.Resolve().GetComponent(user.Uid).EntityName))); + ("otherName", Name: IoCManager.Resolve().GetComponent(user).EntityName))); WeedLevel = 0; UpdateSprite(); } @@ -712,9 +712,9 @@ namespace Content.Server.Botany.Components if (Seed != null) { user.PopupMessageCursor(Loc.GetString("plant-holder-component-remove-plant-message", - ("name", Name: IoCManager.Resolve().GetComponent(Owner.Uid).EntityName))); + ("name", Name: IoCManager.Resolve().GetComponent(Owner).EntityName))); user.PopupMessageOtherClients(Loc.GetString("plant-holder-component-remove-plant-others-message", - ("name", Name: IoCManager.Resolve().GetComponent(user.Uid).EntityName))); + ("name", Name: IoCManager.Resolve().GetComponent(user).EntityName))); RemovePlant(); } else @@ -726,15 +726,15 @@ namespace Content.Server.Botany.Components } var solutionSystem = EntitySystem.Get(); - if (solutionSystem.TryGetDrainableSolution(usingItem.Uid, out var solution) - && solutionSystem.TryGetSolution(Owner.Uid, SoilSolutionName, out var targetSolution)) + if (solutionSystem.TryGetDrainableSolution(usingItem, out var solution) + && solutionSystem.TryGetSolution(Owner, SoilSolutionName, out var targetSolution)) { var amount = FixedPoint2.New(5); var sprayed = false; - var targetEntity = Owner.Uid; - var solutionEntity = usingItem.Uid; + var targetEntity = (EntityUid) Owner; + var solutionEntity = (EntityUid) usingItem; - if (IoCManager.Resolve().TryGetComponent(usingItem.Uid, out SprayComponent? spray)) + if (IoCManager.Resolve().TryGetComponent(usingItem, out SprayComponent? spray)) { sprayed = true; amount = FixedPoint2.New(1); @@ -783,7 +783,7 @@ namespace Content.Server.Botany.Components return false; } - var seed = Seed.SpawnSeedPacket(IoCManager.Resolve().GetComponent(user.Uid).Coordinates); + var seed = Seed.SpawnSeedPacket(IoCManager.Resolve().GetComponent(user).Coordinates); seed.RandomOffset(0.25f); user.PopupMessageCursor(Loc.GetString("plant-holder-component-take-sample-message", ("seedName", Seed.DisplayName))); @@ -804,7 +804,7 @@ namespace Content.Server.Botany.Components return DoHarvest(user); } - if (IoCManager.Resolve().TryGetComponent(usingItem.Uid, out var produce)) + if (IoCManager.Resolve().TryGetComponent(usingItem, out var produce)) { user.PopupMessageCursor(Loc.GetString("plant-holder-component-compost-message", ("owner", Owner), @@ -814,16 +814,16 @@ namespace Content.Server.Botany.Components ("usingItem", usingItem), ("owner", Owner))); - if (solutionSystem.TryGetSolution(usingItem.Uid, produce.SolutionName, out var solution2)) + if (solutionSystem.TryGetSolution(usingItem, produce.SolutionName, out var solution2)) { // This deliberately discards overfill. - solutionSystem.TryAddSolution(usingItem.Uid, solution2, - solutionSystem.SplitSolution(usingItem.Uid, solution2, solution2.TotalVolume)); + solutionSystem.TryAddSolution(usingItem, solution2, + solutionSystem.SplitSolution(usingItem, solution2, solution2.TotalVolume)); ForceUpdateByExternalCause(); } - IoCManager.Resolve().QueueDeleteEntity(usingItem.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) usingItem); return true; } diff --git a/Content.Server/Botany/Components/ProduceComponent.cs b/Content.Server/Botany/Components/ProduceComponent.cs index 9b4877bf2d..c7623c5e61 100644 --- a/Content.Server/Botany/Components/ProduceComponent.cs +++ b/Content.Server/Botany/Components/ProduceComponent.cs @@ -35,13 +35,13 @@ namespace Content.Server.Botany.Components if (Seed == null) return; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(Owner, out SpriteComponent? sprite)) { sprite.LayerSetRSI(0, Seed.PlantRsi); sprite.LayerSetState(0, Seed.PlantIconState); } - var solutionContainer = EntitySystem.Get().EnsureSolution(Owner.Uid, SolutionName); + var solutionContainer = EntitySystem.Get().EnsureSolution(Owner, SolutionName); if (solutionContainer == null) { Logger.Warning($"No solution container found in {nameof(ProduceComponent)}."); diff --git a/Content.Server/Botany/Components/SeedExtractorComponent.cs b/Content.Server/Botany/Components/SeedExtractorComponent.cs index 99490371d7..78229fe2d4 100644 --- a/Content.Server/Botany/Components/SeedExtractorComponent.cs +++ b/Content.Server/Botany/Components/SeedExtractorComponent.cs @@ -27,17 +27,17 @@ namespace Content.Server.Botany.Components if (!_powerReceiver?.Powered ?? false) return false; - if (IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out ProduceComponent? produce) && produce.Seed != null) + if (IoCManager.Resolve().TryGetComponent(eventArgs.Using, out ProduceComponent? produce) && produce.Seed != null) { - eventArgs.User.PopupMessageCursor(Loc.GetString("seed-extractor-component-interact-message",("name", Name: IoCManager.Resolve().GetComponent(eventArgs.Using.Uid).EntityName))); + eventArgs.User.PopupMessageCursor(Loc.GetString("seed-extractor-component-interact-message",("name", Name: IoCManager.Resolve().GetComponent(eventArgs.Using).EntityName))); - IoCManager.Resolve().QueueDeleteEntity(eventArgs.Using.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) eventArgs.Using); var random = _random.Next(_minSeeds, _maxSeeds); for (var i = 0; i < random; i++) { - produce.Seed.SpawnSeedPacket(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, IoCManager.Resolve()); + produce.Seed.SpawnSeedPacket(IoCManager.Resolve().GetComponent(Owner).Coordinates, IoCManager.Resolve()); } return true; diff --git a/Content.Server/Botany/Seed.cs b/Content.Server/Botany/Seed.cs index 40fbbd60a2..1e11c2f69e 100644 --- a/Content.Server/Botany/Seed.cs +++ b/Content.Server/Botany/Seed.cs @@ -257,14 +257,14 @@ namespace Content.Server.Botany var seedComp = seed.EnsureComponent(); seedComp.Seed = this; - if (IoCManager.Resolve().TryGetComponent(seed.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(seed, out SpriteComponent? sprite)) { // Seed state will always be seed. Blame the spriter if that's not the case! sprite.LayerSetSprite(0, new SpriteSpecifier.Rsi(PlantRsi, "seed")); } string val = Loc.GetString("botany-seed-packet-name", ("seedName", SeedName), ("seedNoun", SeedNoun)); - IoCManager.Resolve().GetComponent(seed.Uid).EntityName = val; + IoCManager.Resolve().GetComponent(seed).EntityName = val; return seed; } @@ -301,7 +301,7 @@ namespace Content.Server.Botany } user.PopupMessageCursor(Loc.GetString("botany-harvest-success-message", ("name", DisplayName))); - return GenerateProduct(IoCManager.Resolve().GetComponent(user.Uid).Coordinates, yieldMod); + return GenerateProduct(IoCManager.Resolve().GetComponent(user).Coordinates, yieldMod); } public IEnumerable GenerateProduct(EntityCoordinates position, int yieldMod = 1) @@ -342,10 +342,10 @@ namespace Content.Server.Botany if (Mysterious) { - string val1 = IoCManager.Resolve().GetComponent(entity.Uid).EntityName + "?"; - IoCManager.Resolve().GetComponent(entity.Uid).EntityName = val1; - string val = IoCManager.Resolve().GetComponent(entity.Uid).EntityDescription + (" " + Loc.GetString("botany-mysterious-description-addon")); - IoCManager.Resolve().GetComponent(entity.Uid).EntityDescription = val; + string val1 = IoCManager.Resolve().GetComponent(entity).EntityName + "?"; + IoCManager.Resolve().GetComponent(entity).EntityName = val1; + string val = IoCManager.Resolve().GetComponent(entity).EntityDescription + (" " + Loc.GetString("botany-mysterious-description-addon")); + IoCManager.Resolve().GetComponent(entity).EntityDescription = val; } } diff --git a/Content.Server/Bql/QuerySelectors.cs b/Content.Server/Bql/QuerySelectors.cs index c173fb9b1f..c900413a1c 100644 --- a/Content.Server/Bql/QuerySelectors.cs +++ b/Content.Server/Bql/QuerySelectors.cs @@ -26,7 +26,7 @@ namespace Content.Server.Bql return input.Where(e => { if (entityManager.TryGetComponent(e, out var mind)) - return (mind.Mind?.VisitingEntity?.Uid == e) ^ isInverted; + return (mind.Mind?.VisitingEntity == e) ^ isInverted; return isInverted; }); @@ -36,7 +36,7 @@ namespace Content.Server.Bql { return DoSelection( - entityManager.EntityQuery().Select(x => x.Owner.Uid), + entityManager.EntityQuery().Select(x => (EntityUid) x.Owner), arguments, isInverted, entityManager); } } @@ -57,7 +57,7 @@ namespace Content.Server.Bql public override IEnumerable DoInitialSelection(IReadOnlyList arguments, bool isInverted, IEntityManager entityManager) { - return DoSelection(entityManager.EntityQuery().Select(x => x.Owner.Uid), arguments, + return DoSelection(entityManager.EntityQuery().Select(x => (EntityUid) x.Owner), arguments, isInverted, entityManager); } @@ -79,7 +79,7 @@ namespace Content.Server.Bql public override IEnumerable DoInitialSelection(IReadOnlyList arguments, bool isInverted, IEntityManager entityManager) { - return DoSelection(entityManager.EntityQuery().Select(x => x.Owner.Uid), arguments, + return DoSelection(entityManager.EntityQuery().Select(x => (EntityUid) x.Owner), arguments, isInverted, entityManager); } } @@ -108,7 +108,7 @@ namespace Content.Server.Bql public override IEnumerable DoInitialSelection(IReadOnlyList arguments, bool isInverted, IEntityManager entityManager) { - return DoSelection(entityManager.EntityQuery().Select(x => x.Owner.Uid), arguments, + return DoSelection(entityManager.EntityQuery().Select(x => (EntityUid) x.Owner), arguments, isInverted, entityManager); } } @@ -130,7 +130,7 @@ namespace Content.Server.Bql public override IEnumerable DoInitialSelection(IReadOnlyList arguments, bool isInverted, IEntityManager entityManager) { - return DoSelection(entityManager.EntityQuery().Select(x => x.Owner.Uid), arguments, + return DoSelection(entityManager.EntityQuery().Select(x => (EntityUid) x.Owner), arguments, isInverted, entityManager); } } diff --git a/Content.Server/Buckle/Components/BuckleComponent.cs b/Content.Server/Buckle/Components/BuckleComponent.cs index 0d466395b6..09d076c708 100644 --- a/Content.Server/Buckle/Components/BuckleComponent.cs +++ b/Content.Server/Buckle/Components/BuckleComponent.cs @@ -118,8 +118,8 @@ namespace Content.Server.Buckle.Components /// The strap to reattach to. public void ReAttach(StrapComponent strap) { - var ownTransform = IoCManager.Resolve().GetComponent(Owner.Uid); - var strapTransform = IoCManager.Resolve().GetComponent(strap.Owner.Uid); + var ownTransform = IoCManager.Resolve().GetComponent(Owner); + var strapTransform = IoCManager.Resolve().GetComponent(strap.Owner); ownTransform.AttachParent(strapTransform); ownTransform.LocalRotation = Angle.Zero; @@ -129,10 +129,10 @@ namespace Content.Server.Buckle.Components case StrapPosition.None: break; case StrapPosition.Stand: - EntitySystem.Get().Stand(Owner.Uid); + EntitySystem.Get().Stand((EntityUid) Owner); break; case StrapPosition.Down: - EntitySystem.Get().Down(Owner.Uid, false, false); + EntitySystem.Get().Down((EntityUid) Owner, false, false); break; } @@ -148,13 +148,13 @@ namespace Content.Server.Buckle.Components return false; } - if (!EntitySystem.Get().CanInteract(user.Uid)) + if (!EntitySystem.Get().CanInteract(user)) { user.PopupMessage(Loc.GetString("buckle-component-cannot-do-that-message")); return false; } - if (!IoCManager.Resolve().TryGetComponent(to.Uid, out strap)) + if (!IoCManager.Resolve().TryGetComponent(to, out strap)) { return false; } @@ -178,7 +178,7 @@ namespace Content.Server.Buckle.Components } } - if (!IoCManager.Resolve().HasComponent(user.Uid)) + if (!IoCManager.Resolve().HasComponent(user)) { user.PopupMessage(Loc.GetString("buckle-component-no-hands-message ")); return false; @@ -194,10 +194,10 @@ namespace Content.Server.Buckle.Components return false; } - var parent = IoCManager.Resolve().GetComponent(to.Uid).Parent; + var parent = IoCManager.Resolve().GetComponent(to).Parent; while (parent != null) { - if (parent == IoCManager.Resolve().GetComponent(user.Uid)) + if (parent == IoCManager.Resolve().GetComponent(user)) { var message = Loc.GetString(Owner == user ? "buckle-component-cannot-buckle-message" @@ -246,7 +246,7 @@ namespace Content.Server.Buckle.Components ReAttach(strap); BuckledTo = strap; - LastEntityBuckledTo = BuckledTo.Owner.Uid; + LastEntityBuckledTo = BuckledTo.Owner; DontCollide = true; UpdateBuckleStatus(); @@ -255,7 +255,7 @@ namespace Content.Server.Buckle.Components SendMessage(new BuckleMessage(Owner, to)); #pragma warning restore 618 - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out SharedPullableComponent? ownerPullable)) + if (IoCManager.Resolve().TryGetComponent(Owner, out SharedPullableComponent? ownerPullable)) { if (ownerPullable.Puller != null) { @@ -263,7 +263,7 @@ namespace Content.Server.Buckle.Components } } - if (IoCManager.Resolve().TryGetComponent(to.Uid, out SharedPullableComponent? toPullable)) + if (IoCManager.Resolve().TryGetComponent(to, out SharedPullableComponent? toPullable)) { if (toPullable.Puller == Owner) { @@ -303,7 +303,7 @@ namespace Content.Server.Buckle.Components return false; } - if (!EntitySystem.Get().CanInteract(user.Uid)) + if (!EntitySystem.Get().CanInteract(user)) { user.PopupMessage(Loc.GetString("buckle-component-cannot-do-that-message")); return false; @@ -317,25 +317,25 @@ namespace Content.Server.Buckle.Components BuckledTo = null; - if (IoCManager.Resolve().GetComponent(Owner.Uid).Parent == IoCManager.Resolve().GetComponent(oldBuckledTo.Owner.Uid)) + if (IoCManager.Resolve().GetComponent(Owner).Parent == IoCManager.Resolve().GetComponent(oldBuckledTo.Owner)) { - IoCManager.Resolve().GetComponent(Owner.Uid).AttachParentToContainerOrGrid(); - IoCManager.Resolve().GetComponent(Owner.Uid).WorldRotation = IoCManager.Resolve().GetComponent(oldBuckledTo.Owner.Uid).WorldRotation; + IoCManager.Resolve().GetComponent(Owner).AttachParentToContainerOrGrid(); + IoCManager.Resolve().GetComponent(Owner).WorldRotation = IoCManager.Resolve().GetComponent(oldBuckledTo.Owner).WorldRotation; } Appearance?.SetData(BuckleVisuals.Buckled, false); - if (IoCManager.Resolve().HasComponent(Owner.Uid) + if (IoCManager.Resolve().HasComponent(Owner) || (_mobState?.IsIncapacitated() ?? false)) { - EntitySystem.Get().Down(Owner.Uid); + EntitySystem.Get().Down((EntityUid) Owner); } else { - EntitySystem.Get().Stand(Owner.Uid); + EntitySystem.Get().Stand((EntityUid) Owner); } - _mobState?.CurrentState?.EnterState(Owner.Uid, IoCManager.Resolve()); + _mobState?.CurrentState?.EnterState(Owner, IoCManager.Resolve()); UpdateBuckleStatus(); @@ -395,7 +395,7 @@ namespace Content.Server.Buckle.Components int? drawDepth = null; if (BuckledTo != null && - IoCManager.Resolve().GetComponent(BuckledTo.Owner.Uid).LocalRotation.GetCardinalDir() == Direction.North && + IoCManager.Resolve().GetComponent(BuckledTo.Owner).LocalRotation.GetCardinalDir() == Direction.North && BuckledTo.SpriteComponent != null) { drawDepth = BuckledTo.SpriteComponent.DrawDepth - 1; diff --git a/Content.Server/Buckle/Components/StrapComponent.cs b/Content.Server/Buckle/Components/StrapComponent.cs index 6a0279e880..b7e520e0b3 100644 --- a/Content.Server/Buckle/Components/StrapComponent.cs +++ b/Content.Server/Buckle/Components/StrapComponent.cs @@ -149,7 +149,7 @@ namespace Content.Server.Buckle.Components { foreach (var entity in _buckledEntities.ToArray()) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out var buckle)) + if (IoCManager.Resolve().TryGetComponent(entity, out var buckle)) { buckle.TryUnbuckle(entity, true); } @@ -166,7 +166,7 @@ namespace Content.Server.Buckle.Components bool IInteractHand.InteractHand(InteractHandEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out var buckle)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out var buckle)) { return false; } @@ -176,7 +176,7 @@ namespace Content.Server.Buckle.Components public override bool DragDropOn(DragDropEvent eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.Dragged.Uid, out BuckleComponent? buckleComponent)) return false; + if (!IoCManager.Resolve().TryGetComponent(eventArgs.Dragged, out BuckleComponent? buckleComponent)) return false; return buckleComponent.TryBuckle(eventArgs.User, Owner); } } diff --git a/Content.Server/Buckle/Systems/BuckleSystem.cs b/Content.Server/Buckle/Systems/BuckleSystem.cs index ceec287143..f7cdea8221 100644 --- a/Content.Server/Buckle/Systems/BuckleSystem.cs +++ b/Content.Server/Buckle/Systems/BuckleSystem.cs @@ -79,7 +79,7 @@ namespace Content.Server.Buckle.Systems return; } - var strapPosition = IoCManager.Resolve().GetComponent(strap.Owner.Uid).Coordinates.Offset(buckle.BuckleOffset); + var strapPosition = IoCManager.Resolve().GetComponent(strap.Owner).Coordinates.Offset(buckle.BuckleOffset); if (ev.NewPosition.InRange(EntityManager, strapPosition, 0.2f)) { @@ -95,7 +95,7 @@ namespace Content.Server.Buckle.Systems // This fixes buckle offsets and draw depths. foreach (var buckledEntity in strap.BuckledEntities) { - if (!IoCManager.Resolve().TryGetComponent(buckledEntity.Uid, out BuckleComponent? buckled)) + if (!IoCManager.Resolve().TryGetComponent(buckledEntity, out BuckleComponent? buckled)) { continue; } @@ -112,7 +112,7 @@ namespace Content.Server.Buckle.Systems { foreach (var buckledEntity in strap.BuckledEntities) { - if (!IoCManager.Resolve().TryGetComponent(buckledEntity.Uid, out BuckleComponent? buckled)) + if (!IoCManager.Resolve().TryGetComponent(buckledEntity, out BuckleComponent? buckled)) { continue; } diff --git a/Content.Server/Buckle/Systems/StrapSystem.cs b/Content.Server/Buckle/Systems/StrapSystem.cs index 15bb6bfc70..359de7388e 100644 --- a/Content.Server/Buckle/Systems/StrapSystem.cs +++ b/Content.Server/Buckle/Systems/StrapSystem.cs @@ -39,7 +39,7 @@ namespace Content.Server.Buckle.Systems // Add unstrap verbs for every strapped entity. foreach (var entity in component.BuckledEntities) { - var buckledComp = IoCManager.Resolve().GetComponent(entity.Uid); + var buckledComp = IoCManager.Resolve().GetComponent(entity); if (!_interactionSystem.InRangeUnobstructed(args.User, args.Target, range: buckledComp.Range)) continue; @@ -50,7 +50,7 @@ namespace Content.Server.Buckle.Systems if (entity == args.User) verb.Text = Loc.GetString("verb-self-target-pronoun"); else - verb.Text = IoCManager.Resolve().GetComponent(entity.Uid).EntityName; + verb.Text = IoCManager.Resolve().GetComponent(entity).EntityName; // In the event that you have more than once entity with the same name strapped to the same object, // these two verbs will be identical according to Verb.CompareTo, and only one with actually be added to @@ -61,7 +61,7 @@ namespace Content.Server.Buckle.Systems } // Add a verb to buckle the user. - if (IoCManager.Resolve().TryGetComponent(args.User.Uid, out var buckle) && + if (IoCManager.Resolve().TryGetComponent(args.User, out var buckle) && buckle.BuckledTo != component && args.User != component.Owner && component.HasSpace(buckle) && @@ -76,7 +76,7 @@ namespace Content.Server.Buckle.Systems // If the user is currently holding/pulling an entity that can be buckled, add a verb for that. if (args.Using != null && - IoCManager.Resolve().TryGetComponent(args.Using.Uid, out var usingBuckle) && + IoCManager.Resolve().TryGetComponent(args.Using, out var usingBuckle) && component.HasSpace(usingBuckle) && _interactionSystem.InRangeUnobstructed(args.Using, args.Target, range: usingBuckle.Range)) { @@ -88,11 +88,11 @@ namespace Content.Server.Buckle.Systems Verb verb = new(); verb.Act = () => usingBuckle.TryBuckle(args.User, args.Target); verb.Category = VerbCategory.Buckle; - verb.Text = IoCManager.Resolve().GetComponent(args.Using.Uid).EntityName; + verb.Text = IoCManager.Resolve().GetComponent(args.Using).EntityName; // If the used entity is a person being pulled, prioritize this verb. Conversely, if it is // just a held object, the user is probably just trying to sit down. - verb.Priority = IoCManager.Resolve().HasComponent(args.Using.Uid) ? 1 : -1; + verb.Priority = IoCManager.Resolve().HasComponent(args.Using) ? 1 : -1; args.Verbs.Add(verb); } diff --git a/Content.Server/Cargo/Components/CargoConsoleComponent.cs b/Content.Server/Cargo/Components/CargoConsoleComponent.cs index c392e3eeac..4018f466fd 100644 --- a/Content.Server/Cargo/Components/CargoConsoleComponent.cs +++ b/Content.Server/Cargo/Components/CargoConsoleComponent.cs @@ -58,7 +58,7 @@ namespace Content.Server.Cargo.Components [DataField("errorSound")] private SoundSpecifier _errorSound = new SoundPathSpecifier("/Audio/Effects/error.ogg"); - private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) || receiver.Powered; + private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered; private CargoConsoleSystem _cargoConsoleSystem = default!; [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(CargoConsoleUiKey.Key); @@ -91,7 +91,7 @@ namespace Content.Server.Cargo.Components private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage serverMsg) { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out CargoOrderDatabaseComponent? orders)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out CargoOrderDatabaseComponent? orders)) { return; } @@ -143,7 +143,7 @@ namespace Content.Server.Cargo.Components (capacity.CurrentCapacity == capacity.MaxCapacity || capacity.CurrentCapacity + order.Amount > capacity.MaxCapacity || !_cargoConsoleSystem.CheckBalance(_bankAccount.Id, (-product.PointCost) * order.Amount) - || !_cargoConsoleSystem.ApproveOrder(Owner.Uid, uid.Value, orders.Database.Id, msg.OrderNumber) + || !_cargoConsoleSystem.ApproveOrder(Owner, uid.Value, orders.Database.Id, msg.OrderNumber) || !_cargoConsoleSystem.ChangeBalance(_bankAccount.Id, (-product.PointCost) * order.Amount)) ) { @@ -162,20 +162,20 @@ namespace Content.Server.Cargo.Components // TODO replace with shuttle code // TEMPORARY loop for spawning stuff on telepad (looks for a telepad adjacent to the console) IEntity? cargoTelepad = null; - var indices = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates.ToVector2i(IoCManager.Resolve(), _mapManager); + var indices = IoCManager.Resolve().GetComponent(Owner).Coordinates.ToVector2i(IoCManager.Resolve(), _mapManager); var offsets = new Vector2i[] { new Vector2i(0, 1), new Vector2i(1, 1), new Vector2i(1, 0), new Vector2i(1, -1), new Vector2i(0, -1), new Vector2i(-1, -1), new Vector2i(-1, 0), new Vector2i(-1, 1), }; var adjacentEntities = new List>(); //Probably better than IEnumerable.concat foreach (var offset in offsets) { - adjacentEntities.Add((indices+offset).GetEntitiesInTileFast(IoCManager.Resolve().GetComponent(Owner.Uid).GridID)); + adjacentEntities.Add((indices+offset).GetEntitiesInTileFast(IoCManager.Resolve().GetComponent(Owner).GridID)); } foreach (var enumerator in adjacentEntities) { foreach (IEntity entity in enumerator) { - if (IoCManager.Resolve().HasComponent(entity.Uid) && IoCManager.Resolve().TryGetComponent(entity.Uid, out var powerReceiver) && powerReceiver.Powered) + if (IoCManager.Resolve().HasComponent(entity) && IoCManager.Resolve().TryGetComponent(entity, out var powerReceiver) && powerReceiver.Powered) { cargoTelepad = entity; break; @@ -184,7 +184,7 @@ namespace Content.Server.Cargo.Components } if (cargoTelepad != null) { - if (IoCManager.Resolve().TryGetComponent(cargoTelepad.Uid, out var telepadComponent)) + if (IoCManager.Resolve().TryGetComponent(cargoTelepad, out var telepadComponent)) { var approvedOrders = _cargoConsoleSystem.RemoveAndGetApprovedOrders(orders.Database.Id); orders.Database.ClearOrderCapacity(); @@ -201,7 +201,7 @@ namespace Content.Server.Cargo.Components private void UpdateUIState() { - if (_bankAccount == null || !IoCManager.Resolve().EntityExists(Owner.Uid)) + if (_bankAccount == null || !IoCManager.Resolve().EntityExists(Owner)) { return; } diff --git a/Content.Server/Cargo/Components/CargoTelepadComponent.cs b/Content.Server/Cargo/Components/CargoTelepadComponent.cs index 1b214baec9..af83c5fa7a 100644 --- a/Content.Server/Cargo/Components/CargoTelepadComponent.cs +++ b/Content.Server/Cargo/Components/CargoTelepadComponent.cs @@ -67,14 +67,14 @@ namespace Content.Server.Cargo.Components { if (args.Powered && _currentState == CargoTelepadState.Unpowered) { _currentState = CargoTelepadState.Idle; - if(IoCManager.Resolve().TryGetComponent(Owner.Uid, out var spriteComponent) && spriteComponent.LayerCount > 0) + if(IoCManager.Resolve().TryGetComponent(Owner, out var spriteComponent) && spriteComponent.LayerCount > 0) spriteComponent.LayerSetState(0, "idle"); TeleportLoop(); } else if (!args.Powered) { _currentState = CargoTelepadState.Unpowered; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var spriteComponent) && spriteComponent.LayerCount > 0) + if (IoCManager.Resolve().TryGetComponent(Owner, out var spriteComponent) && spriteComponent.LayerCount > 0) spriteComponent.LayerSetState(0, "offline"); } } @@ -83,23 +83,23 @@ namespace Content.Server.Cargo.Components if (_currentState == CargoTelepadState.Idle && _teleportQueue.Count > 0) { _currentState = CargoTelepadState.Charging; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var spriteComponent) && spriteComponent.LayerCount > 0) + if (IoCManager.Resolve().TryGetComponent(Owner, out var spriteComponent) && spriteComponent.LayerCount > 0) spriteComponent.LayerSetState(0, "idle"); Owner.SpawnTimer((int) (TeleportDelay * 1000), () => { - if (!Deleted && !((!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) && _currentState == CargoTelepadState.Charging && _teleportQueue.Count > 0) + if (!Deleted && !((!IoCManager.Resolve().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner).EntityLifeStage) >= EntityLifeStage.Deleted) && _currentState == CargoTelepadState.Charging && _teleportQueue.Count > 0) { _currentState = CargoTelepadState.Teleporting; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var spriteComponent) && spriteComponent.LayerCount > 0) + if (IoCManager.Resolve().TryGetComponent(Owner, out var spriteComponent) && spriteComponent.LayerCount > 0) spriteComponent.LayerSetState(0, "beam"); Owner.SpawnTimer((int) (TeleportDuration * 1000), () => { - if (!Deleted && !((!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) && _currentState == CargoTelepadState.Teleporting && _teleportQueue.Count > 0) + if (!Deleted && !((!IoCManager.Resolve().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner).EntityLifeStage) >= EntityLifeStage.Deleted) && _currentState == CargoTelepadState.Teleporting && _teleportQueue.Count > 0) { SoundSystem.Play(Filter.Pvs(Owner), _teleportSound.GetSound(), Owner, AudioParams.Default.WithVolume(-8f)); SpawnProduct(_teleportQueue[0]); _teleportQueue.RemoveAt(0); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var spriteComponent) && spriteComponent.LayerCount > 0) + if (IoCManager.Resolve().TryGetComponent(Owner, out var spriteComponent) && spriteComponent.LayerCount > 0) spriteComponent.LayerSetState(0, "idle"); _currentState = CargoTelepadState.Idle; TeleportLoop(); @@ -119,18 +119,18 @@ namespace Content.Server.Cargo.Components if (!_prototypeManager.TryIndex(data.ProductId, out CargoProductPrototype? prototype)) return; - var product = IoCManager.Resolve().SpawnEntity(prototype.Product, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var product = IoCManager.Resolve().SpawnEntity(prototype.Product, IoCManager.Resolve().GetComponent(Owner).Coordinates); - IoCManager.Resolve().GetComponent(product.Uid).Anchored = false; + IoCManager.Resolve().GetComponent(product).Anchored = false; // spawn a piece of paper. - var printed = IoCManager.Resolve().SpawnEntity(PrinterOutput, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); - if (!IoCManager.Resolve().TryGetComponent(printed.Uid, out PaperComponent paper)) + var printed = IoCManager.Resolve().SpawnEntity(PrinterOutput, IoCManager.Resolve().GetComponent(Owner).Coordinates); + if (!IoCManager.Resolve().TryGetComponent(printed, out PaperComponent paper)) return; // fill in the order data string val = Loc.GetString("cargo-console-paper-print-name", ("orderNumber", data.OrderNumber)); - IoCManager.Resolve().GetComponent(printed.Uid).EntityName = val; + IoCManager.Resolve().GetComponent(printed).EntityName = val; paper.SetContent(Loc.GetString( "cargo-console-paper-print-text", ("orderNumber", data.OrderNumber), @@ -139,7 +139,7 @@ namespace Content.Server.Cargo.Components ("approver", data.Approver))); // attempt to attach the label - if (IoCManager.Resolve().TryGetComponent(product.Uid, out PaperLabelComponent label)) + if (IoCManager.Resolve().TryGetComponent(product, out PaperLabelComponent label)) { EntitySystem.Get().TryInsert(OwnerUid, label.LabelSlot, printed); } diff --git a/Content.Server/CharacterAppearance/Components/MagicMirrorComponent.cs b/Content.Server/CharacterAppearance/Components/MagicMirrorComponent.cs index 5c144ab689..c59ec1a9c2 100644 --- a/Content.Server/CharacterAppearance/Components/MagicMirrorComponent.cs +++ b/Content.Server/CharacterAppearance/Components/MagicMirrorComponent.cs @@ -48,7 +48,7 @@ namespace Content.Server.CharacterAppearance.Components return; } - if (!IoCManager.Resolve().TryGetComponent(obj.Session.AttachedEntity.Uid, out HumanoidAppearanceComponent? looks)) + if (!IoCManager.Resolve().TryGetComponent(obj.Session.AttachedEntity, out HumanoidAppearanceComponent? looks)) { return; } @@ -91,17 +91,17 @@ namespace Content.Server.CharacterAppearance.Components break; } - EntitySystem.Get().ForceAppearanceUpdate(obj.Session.AttachedEntity.Uid); + EntitySystem.Get().ForceAppearanceUpdate(obj.Session.AttachedEntity); } void IActivate.Activate(ActivateEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) { return; } - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out HumanoidAppearanceComponent? looks)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out HumanoidAppearanceComponent? looks)) { Owner.PopupMessage(eventArgs.User, Loc.GetString("magic-mirror-component-activate-user-has-no-hair")); return; diff --git a/Content.Server/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs b/Content.Server/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs index de3f66a6b9..6146ec96d7 100644 --- a/Content.Server/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs +++ b/Content.Server/CharacterAppearance/Systems/HumanoidAppearanceSystem.cs @@ -22,7 +22,7 @@ namespace Content.Server.CharacterAppearance.Systems { foreach (var (part, _) in body.Parts) { - if (IoCManager.Resolve().TryGetComponent(part.Owner.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(part.Owner, out SpriteComponent? sprite)) { sprite!.Color = component.Appearance.SkinColor; } diff --git a/Content.Server/CharacterInfo/CharacterInfoComponent.cs b/Content.Server/CharacterInfo/CharacterInfoComponent.cs index 3524e26e7a..160724ab99 100644 --- a/Content.Server/CharacterInfo/CharacterInfoComponent.cs +++ b/Content.Server/CharacterInfo/CharacterInfoComponent.cs @@ -24,7 +24,7 @@ namespace Content.Server.CharacterInfo case RequestCharacterInfoMessage _: var conditions = new Dictionary>(); var jobTitle = "No Profession"; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out MindComponent? mindComponent)) + if (IoCManager.Resolve().TryGetComponent(Owner, out MindComponent? mindComponent)) { var mind = mindComponent.Mind; diff --git a/Content.Server/Chat/Commands/SayCommand.cs b/Content.Server/Chat/Commands/SayCommand.cs index f63f5c699b..718ca42667 100644 --- a/Content.Server/Chat/Commands/SayCommand.cs +++ b/Content.Server/Chat/Commands/SayCommand.cs @@ -46,7 +46,7 @@ namespace Content.Server.Chat.Commands return; } - if (IoCManager.Resolve().HasComponent(playerEntity.Uid)) + if (IoCManager.Resolve().HasComponent(playerEntity)) chat.SendDeadChat(player, message); else { diff --git a/Content.Server/Chat/Commands/SuicideCommand.cs b/Content.Server/Chat/Commands/SuicideCommand.cs index 065402793d..6ebaeb5ad9 100644 --- a/Content.Server/Chat/Commands/SuicideCommand.cs +++ b/Content.Server/Chat/Commands/SuicideCommand.cs @@ -55,7 +55,7 @@ namespace Content.Server.Chat.Commands _ => prototypeManager.Index("Blunt") }, 200); - EntitySystem.Get().TryChangeDamage(target.Uid, damage, true); + EntitySystem.Get().TryChangeDamage(target, damage, true); } } @@ -88,11 +88,11 @@ namespace Content.Server.Chat.Commands EntitySystem.Get().Add(LogType.Suicide, $"{player.AttachedEntity} is committing suicide"); // Held item suicide - var handsComponent = IoCManager.Resolve().GetComponent(owner.Uid); + var handsComponent = IoCManager.Resolve().GetComponent(owner); var itemComponent = handsComponent.GetActiveHand; if (itemComponent != null) { - var suicide = IoCManager.Resolve().GetComponents(itemComponent.Owner.Uid).FirstOrDefault(); + var suicide = IoCManager.Resolve().GetComponents(itemComponent.Owner).FirstOrDefault(); if (suicide != null) { @@ -107,9 +107,9 @@ namespace Content.Server.Chat.Commands { foreach (var entity in entities) { - if (IoCManager.Resolve().HasComponent(entity.Uid)) + if (IoCManager.Resolve().HasComponent(entity)) continue; - var suicide = IoCManager.Resolve().GetComponents(entity.Uid).FirstOrDefault(); + var suicide = IoCManager.Resolve().GetComponents(entity).FirstOrDefault(); if (suicide != null) { DealDamage(suicide, chat, owner); @@ -126,7 +126,7 @@ namespace Content.Server.Chat.Commands owner.PopupMessage(selfMessage); DamageSpecifier damage = new(IoCManager.Resolve().Index("Bloodloss"), 200); - EntitySystem.Get().TryChangeDamage(owner.Uid, damage, true); + EntitySystem.Get().TryChangeDamage(owner, damage, true); // Prevent the player from returning to the body. // Note that mind cannot be null because otherwise owner would be null. diff --git a/Content.Server/Chat/Managers/ChatManager.cs b/Content.Server/Chat/Managers/ChatManager.cs index cdff688731..673ea6bbfc 100644 --- a/Content.Server/Chat/Managers/ChatManager.cs +++ b/Content.Server/Chat/Managers/ChatManager.cs @@ -116,13 +116,13 @@ namespace Content.Server.Chat.Managers public void EntitySay(IEntity source, string message, bool hideChat=false) { - if (!EntitySystem.Get().CanSpeak(source.Uid)) + if (!EntitySystem.Get().CanSpeak(source)) { return; } // Check if message exceeds the character limit if the sender is a player - if (IoCManager.Resolve().TryGetComponent(source.Uid, out ActorComponent? actor) && + if (IoCManager.Resolve().TryGetComponent(source, out ActorComponent? actor) && message.Length > MaxMessageLength) { var feedback = Loc.GetString("chat-manager-max-message-length-exceeded-message", ("limit", MaxMessageLength)); @@ -135,25 +135,25 @@ namespace Content.Server.Chat.Managers foreach (var handler in _chatTransformHandlers) { //TODO: rather return a bool and use a out var? - message = handler(source.Uid, message); + message = handler(source, message); } message = message.Trim(); // We'll try to avoid using MapPosition as EntityCoordinates can early-out and potentially be faster for common use cases // Downside is it may potentially convert to MapPosition unnecessarily. - var sourceMapId = IoCManager.Resolve().GetComponent(source.Uid).MapID; - var sourceCoords = IoCManager.Resolve().GetComponent(source.Uid).Coordinates; + var sourceMapId = IoCManager.Resolve().GetComponent(source).MapID; + var sourceCoords = IoCManager.Resolve().GetComponent(source).Coordinates; var clients = new List(); foreach (var player in _playerManager.Sessions) { if (player.AttachedEntity == null) continue; - var transform = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid); + var transform = IoCManager.Resolve().GetComponent(player.AttachedEntity); if (transform.MapID != sourceMapId || - !IoCManager.Resolve().HasComponent(player.AttachedEntity.Uid) && + !IoCManager.Resolve().HasComponent(player.AttachedEntity) && !sourceCoords.InRange(_entManager, transform.Coordinates, VoiceRange)) continue; clients.Add(player.ConnectedClient); @@ -168,9 +168,9 @@ namespace Content.Server.Chat.Managers message = message[0].ToString().ToUpper() + message.Remove(0, 1); - if (IoCManager.Resolve().TryGetComponent(source.Uid, out InventoryComponent? inventory) && + if (IoCManager.Resolve().TryGetComponent(source, out InventoryComponent? inventory) && inventory.TryGetSlotItem(EquipmentSlotDefines.Slots.EARS, out ItemComponent? item) && - IoCManager.Resolve().TryGetComponent(item.Owner.Uid, out HeadsetComponent? headset)) + IoCManager.Resolve().TryGetComponent(item.Owner, out HeadsetComponent? headset)) { headset.RadioRequested = true; } @@ -194,21 +194,21 @@ namespace Content.Server.Chat.Managers var msg = _netManager.CreateNetMessage(); msg.Channel = ChatChannel.Local; msg.Message = message; - msg.MessageWrap = Loc.GetString("chat-manager-entity-say-wrap-message",("entityName", Name: IoCManager.Resolve().GetComponent(source.Uid).EntityName)); - msg.SenderEntity = source.Uid; + msg.MessageWrap = Loc.GetString("chat-manager-entity-say-wrap-message",("entityName", Name: IoCManager.Resolve().GetComponent(source).EntityName)); + msg.SenderEntity = source; msg.HideChat = hideChat; _netManager.ServerSendToMany(msg, clients); } public void EntityMe(IEntity source, string action) { - if (!EntitySystem.Get().CanEmote(source.Uid)) + if (!EntitySystem.Get().CanEmote(source)) { return; } // Check if entity is a player - if (!IoCManager.Resolve().TryGetComponent(source.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(source, out ActorComponent? actor)) { return; } @@ -223,7 +223,7 @@ namespace Content.Server.Chat.Managers action = FormattedMessage.EscapeText(action); var clients = Filter.Empty() - .AddInRange(IoCManager.Resolve().GetComponent(source.Uid).MapPosition, VoiceRange) + .AddInRange(IoCManager.Resolve().GetComponent(source).MapPosition, VoiceRange) .Recipients .Select(p => p.ConnectedClient) .ToList(); @@ -231,8 +231,8 @@ namespace Content.Server.Chat.Managers var msg = _netManager.CreateNetMessage(); msg.Channel = ChatChannel.Emotes; msg.Message = action; - msg.MessageWrap = Loc.GetString("chat-manager-entity-me-wrap-message", ("entityName",Name: IoCManager.Resolve().GetComponent(source.Uid).EntityName)); - msg.SenderEntity = source.Uid; + msg.MessageWrap = Loc.GetString("chat-manager-entity-me-wrap-message", ("entityName",Name: IoCManager.Resolve().GetComponent(source).EntityName)); + msg.SenderEntity = source; _netManager.ServerSendToMany(msg, clients); } @@ -299,7 +299,7 @@ namespace Content.Server.Chat.Managers IEntity? tempQualifier = player.AttachedEntity; msg.MessageWrap = Loc.GetString("chat-manager-send-dead-chat-wrap-message", ("deadChannelName", Loc.GetString("chat-manager-dead-channel-name")), - ("playerName", (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid).EntityName : null) ?? "???")); + ("playerName", (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier).EntityName : null) ?? "???")); msg.SenderEntity = player.AttachedEntityUid.GetValueOrDefault(); _netManager.ServerSendToMany(msg, clients.ToList()); } diff --git a/Content.Server/Chemistry/Components/ChemMasterComponent.cs b/Content.Server/Chemistry/Components/ChemMasterComponent.cs index 7762f715a3..2a64c13803 100644 --- a/Content.Server/Chemistry/Components/ChemMasterComponent.cs +++ b/Content.Server/Chemistry/Components/ChemMasterComponent.cs @@ -51,10 +51,10 @@ namespace Content.Server.Chemistry.Components private bool _bufferModeTransfer = true; [ViewVariables] - private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) || receiver.Powered; + private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered; [ViewVariables] - private Solution BufferSolution => _bufferSolution ??= EntitySystem.Get().EnsureSolution(Owner.Uid, SolutionName); + private Solution BufferSolution => _bufferSolution ??= EntitySystem.Get().EnsureSolution(Owner, SolutionName); private Solution? _bufferSolution; @@ -78,7 +78,7 @@ namespace Content.Server.Chemistry.Components UserInterface.OnReceiveMessage += OnUiReceiveMessage; } - _bufferSolution = EntitySystem.Get().EnsureSolution(Owner.Uid, SolutionName); + _bufferSolution = EntitySystem.Get().EnsureSolution(Owner, SolutionName); } [Obsolete("Component Messages are deprecated, use Entity Events instead.")] @@ -167,7 +167,7 @@ namespace Content.Server.Chemistry.Components var actionBlocker = EntitySystem.Get(); //Check if player can interact in their current state - if (!actionBlocker.CanInteract(playerEntity.Uid) || !actionBlocker.CanUse(playerEntity.Uid)) + if (!actionBlocker.CanInteract(playerEntity) || !actionBlocker.CanUse(playerEntity)) return false; //Check if device is powered if (needsPower && !Powered) @@ -183,17 +183,17 @@ namespace Content.Server.Chemistry.Components private ChemMasterBoundUserInterfaceState GetUserInterfaceState() { var beaker = BeakerSlot.Item; - if (beaker is null || !IoCManager.Resolve().TryGetComponent(beaker.Uid, out FitsInDispenserComponent? fits) || - !EntitySystem.Get().TryGetSolution(beaker.Uid, fits.Solution, out var beakerSolution)) + if (beaker is null || !IoCManager.Resolve().TryGetComponent(beaker, out FitsInDispenserComponent? fits) || + !EntitySystem.Get().TryGetSolution(beaker, fits.Solution, out var beakerSolution)) { return new ChemMasterBoundUserInterfaceState(Powered, false, FixedPoint2.New(0), FixedPoint2.New(0), - "", _label, IoCManager.Resolve().GetComponent(Owner.Uid).EntityName, new List(), BufferSolution.Contents, _bufferModeTransfer, + "", _label, IoCManager.Resolve().GetComponent(Owner).EntityName, new List(), BufferSolution.Contents, _bufferModeTransfer, BufferSolution.TotalVolume, _pillType); } return new ChemMasterBoundUserInterfaceState(Powered, true, beakerSolution.CurrentVolume, beakerSolution.MaxVolume, - IoCManager.Resolve().GetComponent(beaker.Uid).EntityName, _label, IoCManager.Resolve().GetComponent(Owner.Uid).EntityName, beakerSolution.Contents, BufferSolution.Contents, _bufferModeTransfer, + IoCManager.Resolve().GetComponent(beaker).EntityName, _label, IoCManager.Resolve().GetComponent(Owner).EntityName, beakerSolution.Contents, BufferSolution.Contents, _bufferModeTransfer, BufferSolution.TotalVolume, _pillType); } @@ -208,8 +208,8 @@ namespace Content.Server.Chemistry.Components if (!BeakerSlot.HasItem && _bufferModeTransfer) return; var beaker = BeakerSlot.Item; - if (beaker is null || !IoCManager.Resolve().TryGetComponent(beaker.Uid, out FitsInDispenserComponent? fits) || - !EntitySystem.Get().TryGetSolution(beaker.Uid, fits.Solution, out var beakerSolution)) + if (beaker is null || !IoCManager.Resolve().TryGetComponent(beaker, out FitsInDispenserComponent? fits) || + !EntitySystem.Get().TryGetSolution(beaker, fits.Solution, out var beakerSolution)) return; if (isBuffer) @@ -235,7 +235,7 @@ namespace Content.Server.Chemistry.Components if (_bufferModeTransfer) { EntitySystem.Get() - .TryAddReagent(beaker.Uid, beakerSolution, id, actualAmount, out var _); + .TryAddReagent(beaker, beakerSolution, id, actualAmount, out var _); // beakerSolution.Solution.AddReagent(id, actualAmount); } @@ -259,7 +259,7 @@ namespace Content.Server.Chemistry.Components actualAmount = FixedPoint2.Min(reagent.Quantity, amount); } - EntitySystem.Get().TryRemoveReagent(beaker.Uid, beakerSolution, id, actualAmount); + EntitySystem.Get().TryRemoveReagent(beaker, beakerSolution, id, actualAmount); BufferSolution.AddReagent(id, actualAmount); break; } @@ -302,23 +302,23 @@ namespace Content.Server.Chemistry.Components var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(30)); for (int i = 0; i < bottleAmount; i++) { - var bottle = IoCManager.Resolve().SpawnEntity("ChemistryEmptyBottle01", IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var bottle = IoCManager.Resolve().SpawnEntity("ChemistryEmptyBottle01", IoCManager.Resolve().GetComponent(Owner).Coordinates); //Adding label LabelComponent labelComponent = bottle.EnsureComponent(); - labelComponent.OriginalName = IoCManager.Resolve().GetComponent(bottle.Uid).EntityName; - string val = IoCManager.Resolve().GetComponent(bottle.Uid).EntityName + $" ({label})"; - IoCManager.Resolve().GetComponent(bottle.Uid).EntityName = val; + labelComponent.OriginalName = IoCManager.Resolve().GetComponent(bottle).EntityName; + string val = IoCManager.Resolve().GetComponent(bottle).EntityName + $" ({label})"; + IoCManager.Resolve().GetComponent(bottle).EntityName = val; labelComponent.CurrentLabel = label; var bufferSolution = BufferSolution.SplitSolution(actualVolume); - var bottleSolution = EntitySystem.Get().EnsureSolution(bottle.Uid, "drink"); + var bottleSolution = EntitySystem.Get().EnsureSolution(bottle, "drink"); - EntitySystem.Get().TryAddSolution(bottle.Uid, bottleSolution, bufferSolution); + EntitySystem.Get().TryAddSolution(bottle, bottleSolution, bufferSolution); //Try to give them the bottle - if (IoCManager.Resolve().TryGetComponent(user.Uid, out var hands) && - IoCManager.Resolve().TryGetComponent(bottle.Uid, out var item)) + if (IoCManager.Resolve().TryGetComponent(user, out var hands) && + IoCManager.Resolve().TryGetComponent(bottle, out var item)) { if (hands.CanPutInHand(item)) { @@ -328,7 +328,7 @@ namespace Content.Server.Chemistry.Components } //Put it on the floor - IoCManager.Resolve().GetComponent(bottle.Uid).Coordinates = IoCManager.Resolve().GetComponent(user.Uid).Coordinates; + IoCManager.Resolve().GetComponent(bottle).Coordinates = IoCManager.Resolve().GetComponent(user).Coordinates; //Give it an offset bottle.RandomOffset(0.2f); } @@ -345,29 +345,29 @@ namespace Content.Server.Chemistry.Components var actualVolume = FixedPoint2.Min(individualVolume, FixedPoint2.New(50)); for (int i = 0; i < pillAmount; i++) { - var pill = IoCManager.Resolve().SpawnEntity("pill", IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var pill = IoCManager.Resolve().SpawnEntity("pill", IoCManager.Resolve().GetComponent(Owner).Coordinates); //Adding label LabelComponent labelComponent = pill.EnsureComponent(); - labelComponent.OriginalName = IoCManager.Resolve().GetComponent(pill.Uid).EntityName; - string val = IoCManager.Resolve().GetComponent(pill.Uid).EntityName + $" ({label})"; - IoCManager.Resolve().GetComponent(pill.Uid).EntityName = val; + labelComponent.OriginalName = IoCManager.Resolve().GetComponent(pill).EntityName; + string val = IoCManager.Resolve().GetComponent(pill).EntityName + $" ({label})"; + IoCManager.Resolve().GetComponent(pill).EntityName = val; labelComponent.CurrentLabel = label; var bufferSolution = BufferSolution.SplitSolution(actualVolume); - var pillSolution = EntitySystem.Get().EnsureSolution(pill.Uid, "food"); - EntitySystem.Get().TryAddSolution(pill.Uid, pillSolution, bufferSolution); + var pillSolution = EntitySystem.Get().EnsureSolution(pill, "food"); + EntitySystem.Get().TryAddSolution(pill, pillSolution, bufferSolution); //Change pill Sprite component state - if (!IoCManager.Resolve().TryGetComponent(pill.Uid, out SpriteComponent? sprite)) + if (!IoCManager.Resolve().TryGetComponent(pill, out SpriteComponent? sprite)) { return; } sprite?.LayerSetState(0, "pill" + _pillType); //Try to give them the bottle - if (IoCManager.Resolve().TryGetComponent(user.Uid, out var hands) && - IoCManager.Resolve().TryGetComponent(pill.Uid, out var item)) + if (IoCManager.Resolve().TryGetComponent(user, out var hands) && + IoCManager.Resolve().TryGetComponent(pill, out var item)) { if (hands.CanPutInHand(item)) { @@ -377,7 +377,7 @@ namespace Content.Server.Chemistry.Components } //Put it on the floor - IoCManager.Resolve().GetComponent(pill.Uid).Coordinates = IoCManager.Resolve().GetComponent(user.Uid).Coordinates; + IoCManager.Resolve().GetComponent(pill).Coordinates = IoCManager.Resolve().GetComponent(user).Coordinates; //Give it an offset pill.RandomOffset(0.2f); } @@ -395,12 +395,12 @@ namespace Content.Server.Chemistry.Components /// Data relevant to the event such as the actor which triggered it. void IActivate.Activate(ActivateEventArgs args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) { return; } - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out HandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out HandsComponent? hands)) { Owner.PopupMessage(args.User, Loc.GetString("chem-master-component-activate-no-hands")); return; diff --git a/Content.Server/Chemistry/Components/FoamSolutionAreaEffectComponent.cs b/Content.Server/Chemistry/Components/FoamSolutionAreaEffectComponent.cs index 940099a05f..a1bfed42a9 100644 --- a/Content.Server/Chemistry/Components/FoamSolutionAreaEffectComponent.cs +++ b/Content.Server/Chemistry/Components/FoamSolutionAreaEffectComponent.cs @@ -23,8 +23,8 @@ namespace Content.Server.Chemistry.Components protected override void UpdateVisuals() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance) && - EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance) && + EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution)) { appearance.SetData(FoamVisuals.Color, solution.Color.WithAlpha(0.80f)); } @@ -32,16 +32,16 @@ namespace Content.Server.Chemistry.Components protected override void ReactWithEntity(IEntity entity, double solutionFraction) { - if (!EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution)) + if (!EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution)) return; - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out BloodstreamComponent? bloodstream)) + if (!IoCManager.Resolve().TryGetComponent(entity, out BloodstreamComponent? bloodstream)) return; // TODO: Add a permeability property to clothing // For now it just adds to protection for each clothing equipped var protection = 0f; - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out InventoryComponent? inventory)) + if (IoCManager.Resolve().TryGetComponent(entity, out InventoryComponent? inventory)) { foreach (var slot in inventory.Slots) { @@ -63,14 +63,14 @@ namespace Content.Server.Chemistry.Components bloodstream.Solution.AvailableVolume); var transferSolution = cloneSolution.SplitSolution(transferAmount); - bloodstreamSys.TryAddToBloodstream(entity.Uid, transferSolution, bloodstream); + bloodstreamSys.TryAddToBloodstream(entity, transferSolution, bloodstream); } protected override void OnKill() { - if ((!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner).EntityLifeStage) >= EntityLifeStage.Deleted) return; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(FoamVisuals.State, true); } @@ -79,10 +79,10 @@ namespace Content.Server.Chemistry.Components { if (!string.IsNullOrEmpty(_foamedMetalPrototype)) { - IoCManager.Resolve().SpawnEntity(_foamedMetalPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + IoCManager.Resolve().SpawnEntity(_foamedMetalPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); } - IoCManager.Resolve().QueueDeleteEntity(Owner.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) Owner); }); } } diff --git a/Content.Server/Chemistry/Components/HyposprayComponent.cs b/Content.Server/Chemistry/Components/HyposprayComponent.cs index 32709752dc..937d22178c 100644 --- a/Content.Server/Chemistry/Components/HyposprayComponent.cs +++ b/Content.Server/Chemistry/Components/HyposprayComponent.cs @@ -59,7 +59,7 @@ namespace Content.Server.Chemistry.Components } var solutionsSys = EntitySystem.Get(); - solutionsSys.TryGetSolution(Owner.Uid, SolutionName, out var hypoSpraySolution); + solutionsSys.TryGetSolution(Owner, SolutionName, out var hypoSpraySolution); if (hypoSpraySolution == null || hypoSpraySolution.CurrentVolume == 0) { @@ -67,7 +67,7 @@ namespace Content.Server.Chemistry.Components return true; } - if (!solutionsSys.TryGetInjectableSolution(target.Uid, out var targetSolution)) + if (!solutionsSys.TryGetInjectableSolution(target, out var targetSolution)) { user.PopupMessage(user, Loc.GetString("hypospray-cant-inject", ("target", target))); @@ -80,7 +80,7 @@ namespace Content.Server.Chemistry.Components { target.PopupMessage(Loc.GetString("hypospray-component-feel-prick-message")); var meleeSys = EntitySystem.Get(); - var angle = Angle.FromWorldVec(IoCManager.Resolve().GetComponent(target.Uid).WorldPosition - IoCManager.Resolve().GetComponent(user.Uid).WorldPosition); + var angle = Angle.FromWorldVec(IoCManager.Resolve().GetComponent(target).WorldPosition - IoCManager.Resolve().GetComponent(user).WorldPosition); meleeSys.SendLunge(angle, user); } @@ -100,24 +100,24 @@ namespace Content.Server.Chemistry.Components // Move units from attackSolution to targetSolution var removedSolution = EntitySystem.Get() - .SplitSolution(Owner.Uid, hypoSpraySolution, realTransferAmount); + .SplitSolution(Owner, hypoSpraySolution, realTransferAmount); if (!targetSolution.CanAddSolution(removedSolution)) { return true; } - removedSolution.DoEntityReaction(target.Uid, ReactionMethod.Injection); + removedSolution.DoEntityReaction(target, ReactionMethod.Injection); - EntitySystem.Get().TryAddSolution(target.Uid, targetSolution, removedSolution); + EntitySystem.Get().TryAddSolution(target, targetSolution, removedSolution); static bool EligibleEntity(IEntity entity) { // TODO: Does checking for BodyComponent make sense as a "can be hypospray'd" tag? // In SS13 the hypospray ONLY works on mobs, NOT beakers or anything else. - return IoCManager.Resolve().HasComponent(entity.Uid) - && IoCManager.Resolve().HasComponent(entity.Uid); + return IoCManager.Resolve().HasComponent(entity) + && IoCManager.Resolve().HasComponent(entity); } return true; @@ -126,7 +126,7 @@ namespace Content.Server.Chemistry.Components public override ComponentState GetComponentState() { var solutionSys = IoCManager.Resolve().EntitySysManager.GetEntitySystem(); - return solutionSys.TryGetSolution(Owner.Uid, SolutionName, out var solution) + return solutionSys.TryGetSolution(Owner, SolutionName, out var solution) ? new HyposprayComponentState(solution.CurrentVolume, solution.MaxVolume) : new HyposprayComponentState(FixedPoint2.Zero, FixedPoint2.Zero); } diff --git a/Content.Server/Chemistry/Components/InjectorComponent.cs b/Content.Server/Chemistry/Components/InjectorComponent.cs index ad265a8d7f..112cd10ccd 100644 --- a/Content.Server/Chemistry/Components/InjectorComponent.cs +++ b/Content.Server/Chemistry/Components/InjectorComponent.cs @@ -117,7 +117,7 @@ namespace Content.Server.Chemistry.Components var solutionsSys = EntitySystem.Get(); //Make sure we have the attacking entity - if (eventArgs.Target == null || !IoCManager.Resolve().HasComponent(Owner.Uid)) + if (eventArgs.Target == null || !IoCManager.Resolve().HasComponent(Owner)) { return false; } @@ -128,15 +128,15 @@ namespace Content.Server.Chemistry.Components // Handle injecting/drawing for solutions if (ToggleState == InjectorToggleMode.Inject) { - if (solutionsSys.TryGetInjectableSolution(targetEntity.Uid, out var injectableSolution)) + if (solutionsSys.TryGetInjectableSolution(targetEntity, out var injectableSolution)) { TryInject(targetEntity, injectableSolution, eventArgs.User, false); } - else if (solutionsSys.TryGetRefillableSolution(targetEntity.Uid, out var refillableSolution)) + else if (solutionsSys.TryGetRefillableSolution(targetEntity, out var refillableSolution)) { TryInject(targetEntity, refillableSolution, eventArgs.User, true); } - else if (IoCManager.Resolve().TryGetComponent(targetEntity.Uid, out BloodstreamComponent? bloodstream)) + else if (IoCManager.Resolve().TryGetComponent(targetEntity, out BloodstreamComponent? bloodstream)) { TryInjectIntoBloodstream(bloodstream, eventArgs.User); } @@ -149,7 +149,7 @@ namespace Content.Server.Chemistry.Components } else if (ToggleState == InjectorToggleMode.Draw) { - if (solutionsSys.TryGetDrawableSolution(targetEntity.Uid, out var drawableSolution)) + if (solutionsSys.TryGetDrawableSolution(targetEntity, out var drawableSolution)) { TryDraw(targetEntity, drawableSolution, eventArgs.User); } @@ -189,12 +189,12 @@ namespace Content.Server.Chemistry.Components // Move units from attackSolution to targetSolution var removedSolution = - EntitySystem.Get().SplitSolution(user.Uid, targetBloodstream.Solution, realTransferAmount); + EntitySystem.Get().SplitSolution(user, targetBloodstream.Solution, realTransferAmount); var bloodstreamSys = EntitySystem.Get(); bloodstreamSys.TryAddToBloodstream(targetBloodstream.OwnerUid, removedSolution, targetBloodstream); - removedSolution.DoEntityReaction(targetBloodstream.Owner.Uid, ReactionMethod.Injection); + removedSolution.DoEntityReaction(targetBloodstream.Owner, ReactionMethod.Injection); Owner.PopupMessage(user, Loc.GetString("injector-component-inject-success-message", @@ -206,7 +206,7 @@ namespace Content.Server.Chemistry.Components private void TryInject(IEntity targetEntity, Solution targetSolution, IEntity user, bool asRefill) { - if (!EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution) + if (!EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution) || solution.CurrentVolume == 0) { return; @@ -223,19 +223,19 @@ namespace Content.Server.Chemistry.Components } // Move units from attackSolution to targetSolution - var removedSolution = EntitySystem.Get().SplitSolution(Owner.Uid, solution, realTransferAmount); + var removedSolution = EntitySystem.Get().SplitSolution(Owner, solution, realTransferAmount); - removedSolution.DoEntityReaction(targetEntity.Uid, ReactionMethod.Injection); + removedSolution.DoEntityReaction(targetEntity, ReactionMethod.Injection); if (!asRefill) { EntitySystem.Get() - .Inject(targetEntity.Uid, targetSolution, removedSolution); + .Inject(targetEntity, targetSolution, removedSolution); } else { EntitySystem.Get() - .Refill(targetEntity.Uid, targetSolution, removedSolution); + .Refill(targetEntity, targetSolution, removedSolution); } Owner.PopupMessage(user, @@ -249,7 +249,7 @@ namespace Content.Server.Chemistry.Components private void AfterInject() { // Automatically set syringe to draw after completely draining it. - if (EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution) + if (EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution) && solution.CurrentVolume == 0) { ToggleState = InjectorToggleMode.Draw; @@ -259,7 +259,7 @@ namespace Content.Server.Chemistry.Components private void AfterDraw() { // Automatically set syringe to inject after completely filling it. - if (EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution) + if (EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution) && solution.AvailableVolume == 0) { ToggleState = InjectorToggleMode.Inject; @@ -268,7 +268,7 @@ namespace Content.Server.Chemistry.Components private void TryDraw(IEntity targetEntity, Solution targetSolution, IEntity user) { - if (!EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution) + if (!EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution) || solution.AvailableVolume == 0) { return; @@ -286,9 +286,9 @@ namespace Content.Server.Chemistry.Components // Move units from attackSolution to targetSolution var removedSolution = EntitySystem.Get() - .Draw(targetEntity.Uid, targetSolution, realTransferAmount); + .Draw(targetEntity, targetSolution, realTransferAmount); - if (!EntitySystem.Get().TryAddSolution(targetEntity.Uid, solution, removedSolution)) + if (!EntitySystem.Get().TryAddSolution(targetEntity, solution, removedSolution)) { return; } @@ -305,7 +305,7 @@ namespace Content.Server.Chemistry.Components public override ComponentState GetComponentState() { IoCManager.Resolve().EntitySysManager.GetEntitySystem() - .TryGetSolution(Owner.Uid, SolutionName, out var solution); + .TryGetSolution(Owner, SolutionName, out var solution); var currentVolume = solution?.CurrentVolume ?? FixedPoint2.Zero; var maxVolume = solution?.MaxVolume ?? FixedPoint2.Zero; diff --git a/Content.Server/Chemistry/Components/ReagentDispenserComponent.cs b/Content.Server/Chemistry/Components/ReagentDispenserComponent.cs index 03b4c1f724..7ced183099 100644 --- a/Content.Server/Chemistry/Components/ReagentDispenserComponent.cs +++ b/Content.Server/Chemistry/Components/ReagentDispenserComponent.cs @@ -57,13 +57,13 @@ namespace Content.Server.Chemistry.Components { get { - EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution); + EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution); return solution; } } [ViewVariables] - private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) || receiver.Powered; + private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered; [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ReagentDispenserUiKey.Key); @@ -209,7 +209,7 @@ namespace Content.Server.Chemistry.Components var actionBlocker = EntitySystem.Get(); //Check if player can interact in their current state - if (!actionBlocker.CanInteract(playerEntity.Uid) || !actionBlocker.CanUse(playerEntity.Uid)) + if (!actionBlocker.CanInteract(playerEntity) || !actionBlocker.CanUse(playerEntity)) return false; //Check if device is powered if (needsPower && !Powered) @@ -225,17 +225,17 @@ namespace Content.Server.Chemistry.Components private ReagentDispenserBoundUserInterfaceState GetUserInterfaceState() { var beaker = BeakerSlot.Item; - if (beaker == null || !IoCManager.Resolve().TryGetComponent(beaker.Uid, out FitsInDispenserComponent? fits) || - !EntitySystem.Get().TryGetSolution(beaker.Uid, fits.Solution, out var solution)) + if (beaker == null || !IoCManager.Resolve().TryGetComponent(beaker, out FitsInDispenserComponent? fits) || + !EntitySystem.Get().TryGetSolution(beaker, fits.Solution, out var solution)) { return new ReagentDispenserBoundUserInterfaceState(Powered, false, FixedPoint2.New(0), FixedPoint2.New(0), - string.Empty, Inventory, IoCManager.Resolve().GetComponent(Owner.Uid).EntityName, null, _dispenseAmount); + string.Empty, Inventory, IoCManager.Resolve().GetComponent(Owner).EntityName, null, _dispenseAmount); } return new ReagentDispenserBoundUserInterfaceState(Powered, true, solution.CurrentVolume, solution.MaxVolume, - IoCManager.Resolve().GetComponent(beaker.Uid).EntityName, Inventory, IoCManager.Resolve().GetComponent(Owner.Uid).EntityName, solution.Contents.ToList(), _dispenseAmount); + IoCManager.Resolve().GetComponent(beaker).EntityName, Inventory, IoCManager.Resolve().GetComponent(Owner).EntityName, solution.Contents.ToList(), _dispenseAmount); } public void UpdateUserInterface() @@ -251,12 +251,12 @@ namespace Content.Server.Chemistry.Components { var beaker = BeakerSlot.Item; - if (beaker == null || !IoCManager.Resolve().TryGetComponent(beaker.Uid, out FitsInDispenserComponent? fits) || + if (beaker == null || !IoCManager.Resolve().TryGetComponent(beaker, out FitsInDispenserComponent? fits) || !EntitySystem.Get() - .TryGetSolution(beaker.Uid, fits.Solution, out var solution)) + .TryGetSolution(beaker, fits.Solution, out var solution)) return; - EntitySystem.Get().RemoveAllSolution(beaker.Uid, solution); + EntitySystem.Get().RemoveAllSolution(beaker, solution); UpdateUserInterface(); } @@ -269,12 +269,12 @@ namespace Content.Server.Chemistry.Components { var beaker = BeakerSlot.Item; - if (beaker is null || !IoCManager.Resolve().TryGetComponent(beaker.Uid, out FitsInDispenserComponent? fits) + if (beaker is null || !IoCManager.Resolve().TryGetComponent(beaker, out FitsInDispenserComponent? fits) || !EntitySystem.Get() - .TryGetSolution(beaker.Uid, fits.Solution, out var solution)) return; + .TryGetSolution(beaker, fits.Solution, out var solution)) return; EntitySystem.Get() - .TryAddReagent(beaker.Uid, solution, Inventory[dispenseIndex].ID, _dispenseAmount, out _); + .TryAddReagent(beaker, solution, Inventory[dispenseIndex].ID, _dispenseAmount, out _); UpdateUserInterface(); } @@ -285,12 +285,12 @@ namespace Content.Server.Chemistry.Components /// Data relevant to the event such as the actor which triggered it. void IActivate.Activate(ActivateEventArgs args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) { return; } - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out HandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out HandsComponent? hands)) { Owner.PopupMessage(args.User, Loc.GetString("reagent-dispenser-component-activate-no-hands")); return; diff --git a/Content.Server/Chemistry/Components/SmokeSolutionAreaEffectComponent.cs b/Content.Server/Chemistry/Components/SmokeSolutionAreaEffectComponent.cs index 2d8f0c75ef..d4f3beff8c 100644 --- a/Content.Server/Chemistry/Components/SmokeSolutionAreaEffectComponent.cs +++ b/Content.Server/Chemistry/Components/SmokeSolutionAreaEffectComponent.cs @@ -19,8 +19,8 @@ namespace Content.Server.Chemistry.Components protected override void UpdateVisuals() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance) && - EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance) && + EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution)) { appearance.SetData(SmokeVisuals.Color, solution.Color); } @@ -28,13 +28,13 @@ namespace Content.Server.Chemistry.Components protected override void ReactWithEntity(IEntity entity, double solutionFraction) { - if (!EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution)) + if (!EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution)) return; - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out BloodstreamComponent? bloodstream)) + if (!IoCManager.Resolve().TryGetComponent(entity, out BloodstreamComponent? bloodstream)) return; - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out InternalsComponent? internals) && + if (IoCManager.Resolve().TryGetComponent(entity, out InternalsComponent? internals) && internals.AreInternalsWorking()) return; @@ -46,19 +46,19 @@ namespace Content.Server.Chemistry.Components foreach (var reagentQuantity in transferSolution.Contents.ToArray()) { if (reagentQuantity.Quantity == FixedPoint2.Zero) continue; - chemistry.ReactionEntity(entity.Uid, ReactionMethod.Ingestion, reagentQuantity.ReagentId, reagentQuantity.Quantity, transferSolution); + chemistry.ReactionEntity(entity, ReactionMethod.Ingestion, reagentQuantity.ReagentId, reagentQuantity.Quantity, transferSolution); } var bloodstreamSys = EntitySystem.Get(); - bloodstreamSys.TryAddToBloodstream(entity.Uid, transferSolution, bloodstream); + bloodstreamSys.TryAddToBloodstream(entity, transferSolution, bloodstream); } protected override void OnKill() { - if ((!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner).EntityLifeStage) >= EntityLifeStage.Deleted) return; - IoCManager.Resolve().DeleteEntity(Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) Owner); } } } diff --git a/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs b/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs index 13db7a4bb6..bbbf366024 100644 --- a/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs +++ b/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs @@ -46,7 +46,7 @@ namespace Content.Server.Chemistry.Components if (Inception != null) return; - if (IoCManager.Resolve().HasComponent(Owner.Uid)) + if (IoCManager.Resolve().HasComponent(Owner)) return; Amount = amount; @@ -62,7 +62,7 @@ namespace Content.Server.Chemistry.Components /// public void Spread() { - if (IoCManager.Resolve().GetComponent(Owner.Uid).EntityPrototype == null) + if (IoCManager.Resolve().GetComponent(Owner).EntityPrototype == null) { Logger.Error("AreaEffectComponent needs its owner to be spawned by a prototype."); return; @@ -70,8 +70,8 @@ namespace Content.Server.Chemistry.Components void SpreadToDir(Direction dir) { - var grid = MapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); - var coords = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + var grid = MapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner).GridID); + var coords = IoCManager.Resolve().GetComponent(Owner).Coordinates; foreach (var neighbor in grid.GetInDir(coords, dir)) { if (IoCManager.Resolve().TryGetComponent(neighbor, @@ -83,15 +83,15 @@ namespace Content.Server.Chemistry.Components return; } - var newEffect = IoCManager.Resolve().SpawnEntity(IoCManager.Resolve().GetComponent(Owner.Uid).EntityPrototype.ID, grid.DirectionToGrid(coords, dir)); + var newEffect = IoCManager.Resolve().SpawnEntity(IoCManager.Resolve().GetComponent(Owner).EntityPrototype.ID, grid.DirectionToGrid(coords, dir)); - if (!IoCManager.Resolve().TryGetComponent(newEffect.Uid, out SolutionAreaEffectComponent? effectComponent)) + if (!IoCManager.Resolve().TryGetComponent(newEffect, out SolutionAreaEffectComponent? effectComponent)) { - IoCManager.Resolve().DeleteEntity(newEffect.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) newEffect); return; } - if (EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution)) + if (EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution)) { effectComponent.TryAddSolution(solution.Clone()); } @@ -128,12 +128,12 @@ namespace Content.Server.Chemistry.Components /// with the other area effects from the inception. public void React(float averageExposures) { - if (!EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution)) + if (!EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution)) return; var chemistry = EntitySystem.Get(); - var mapGrid = MapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); - var tile = mapGrid.GetTileRef(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates.ToVector2i(IoCManager.Resolve(), MapManager)); + var mapGrid = MapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner).GridID); + var tile = mapGrid.GetTileRef(IoCManager.Resolve().GetComponent(Owner).Coordinates.ToVector2i(IoCManager.Resolve(), MapManager)); var solutionFraction = 1 / Math.Floor(averageExposures); @@ -153,7 +153,7 @@ namespace Content.Server.Chemistry.Components // Touch every entity on the tile foreach (var entity in tile.GetEntitiesInTileFast().ToArray()) { - chemistry.ReactionEntity(entity.Uid, ReactionMethod.Touch, reagent, + chemistry.ReactionEntity(entity, ReactionMethod.Touch, reagent, reagentQuantity.Quantity * solutionFraction, solution); } } @@ -171,13 +171,13 @@ namespace Content.Server.Chemistry.Components if (solution.TotalVolume == 0) return; - if (!EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solutionArea)) + if (!EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solutionArea)) return; var addSolution = solution.SplitSolution(FixedPoint2.Min(solution.TotalVolume, solutionArea.AvailableVolume)); - EntitySystem.Get().TryAddSolution(Owner.Uid, solutionArea, addSolution); + EntitySystem.Get().TryAddSolution(Owner, solutionArea, addSolution); UpdateVisuals(); } diff --git a/Content.Server/Chemistry/Components/SolutionTransferComponent.cs b/Content.Server/Chemistry/Components/SolutionTransferComponent.cs index a03a5d176d..b581addab6 100644 --- a/Content.Server/Chemistry/Components/SolutionTransferComponent.cs +++ b/Content.Server/Chemistry/Components/SolutionTransferComponent.cs @@ -116,19 +116,19 @@ namespace Content.Server.Chemistry.Components if (!eventArgs.InRangeUnobstructed() || eventArgs.Target == null) return false; - if (!IoCManager.Resolve().HasComponent(Owner.Uid)) + if (!IoCManager.Resolve().HasComponent(Owner)) return false; var target = eventArgs.Target!; - if (!IoCManager.Resolve().HasComponent(target.Uid)) + if (!IoCManager.Resolve().HasComponent(target)) { return false; } - if (CanReceive && IoCManager.Resolve().TryGetComponent(target.Uid, out ReagentTankComponent? tank) - && solutionsSys.TryGetRefillableSolution(Owner.Uid, out var ownerRefill) - && solutionsSys.TryGetDrainableSolution(eventArgs.Target.Uid, out var targetDrain)) + if (CanReceive && IoCManager.Resolve().TryGetComponent(target, out ReagentTankComponent? tank) + && solutionsSys.TryGetRefillableSolution(Owner, out var ownerRefill) + && solutionsSys.TryGetDrainableSolution(eventArgs.Target, out var targetDrain)) { var transferred = DoTransfer(eventArgs.User, eventArgs.Target, targetDrain, Owner, ownerRefill, tank.TransferAmount); if (transferred > 0) @@ -144,8 +144,8 @@ namespace Content.Server.Chemistry.Components } } - if (CanSend && solutionsSys.TryGetRefillableSolution(eventArgs.Target.Uid, out var targetRefill) - && solutionsSys.TryGetDrainableSolution(Owner.Uid, out var ownerDrain)) + if (CanSend && solutionsSys.TryGetRefillableSolution(eventArgs.Target, out var targetRefill) + && solutionsSys.TryGetDrainableSolution(Owner, out var ownerDrain)) { var transferred = DoTransfer(eventArgs.User, Owner, ownerDrain, target, targetRefill, TransferAmount); @@ -189,8 +189,8 @@ namespace Content.Server.Chemistry.Components var actualAmount = FixedPoint2.Min(amount, FixedPoint2.Min(source.DrainAvailable, target.AvailableVolume)); - var solution = EntitySystem.Get().Drain(sourceEntity.Uid, source, actualAmount); - EntitySystem.Get().Refill(targetEntity.Uid, target, solution); + var solution = EntitySystem.Get().Drain(sourceEntity, source, actualAmount); + EntitySystem.Get().Refill(targetEntity, target, solution); return actualAmount; } diff --git a/Content.Server/Chemistry/Components/TransformableContainerComponent.cs b/Content.Server/Chemistry/Components/TransformableContainerComponent.cs index 58d352b1ec..4a1d46bc46 100644 --- a/Content.Server/Chemistry/Components/TransformableContainerComponent.cs +++ b/Content.Server/Chemistry/Components/TransformableContainerComponent.cs @@ -23,14 +23,14 @@ namespace Content.Server.Chemistry.Components { base.Initialize(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out SpriteComponent? sprite) && + if (IoCManager.Resolve().TryGetComponent(Owner, out SpriteComponent? sprite) && sprite.BaseRSIPath != null) { InitialSprite = new SpriteSpecifier.Rsi(new ResourcePath(sprite.BaseRSIPath), "icon"); } - InitialName = IoCManager.Resolve().GetComponent(Owner.Uid).EntityName; - InitialDescription = IoCManager.Resolve().GetComponent(Owner.Uid).EntityDescription; + InitialName = IoCManager.Resolve().GetComponent(Owner).EntityName; + InitialDescription = IoCManager.Resolve().GetComponent(Owner).EntityDescription; } protected override void Startup() diff --git a/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs b/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs index 4f2e2b1820..65f73c3ecb 100644 --- a/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/ChemicalReactionSystem.cs @@ -19,7 +19,7 @@ namespace Content.Server.Chemistry.EntitySystems var entity = EntityManager.GetEntity(ownerUid); _logSystem.Add(LogType.ChemicalReaction, reaction.Impact, - $"Chemical reaction {reaction.ID} occurred with strength {unitReactions:strength} on entity {entity} at {IoCManager.Resolve().GetComponent(entity.Uid).Coordinates}"); + $"Chemical reaction {reaction.ID} occurred with strength {unitReactions:strength} on entity {entity} at {IoCManager.Resolve().GetComponent(entity).Coordinates}"); SoundSystem.Play(Filter.Pvs(ownerUid, entityManager:EntityManager), reaction.Sound.GetSound(), ownerUid); } diff --git a/Content.Server/Chemistry/EntitySystems/RehydratableSystem.cs b/Content.Server/Chemistry/EntitySystems/RehydratableSystem.cs index 6aefb1952c..41c84661c2 100644 --- a/Content.Server/Chemistry/EntitySystems/RehydratableSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/RehydratableSystem.cs @@ -41,11 +41,11 @@ namespace Content.Server.Chemistry.EntitySystems if (!string.IsNullOrEmpty(component.TargetPrototype)) { var ent = IoCManager.Resolve().SpawnEntity(component.TargetPrototype, - IoCManager.Resolve().GetComponent(owner.Uid).Coordinates); - IoCManager.Resolve().GetComponent(ent.Uid).AttachToGridOrMap(); + IoCManager.Resolve().GetComponent(owner).Coordinates); + IoCManager.Resolve().GetComponent(ent).AttachToGridOrMap(); } - IoCManager.Resolve().QueueDeleteEntity(owner.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) owner); } } } diff --git a/Content.Server/Chemistry/EntitySystems/SolutionContainerSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionContainerSystem.cs index 2995bee9db..2f52634590 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionContainerSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionContainerSystem.cs @@ -67,7 +67,7 @@ namespace Content.Server.Chemistry.EntitySystems ExaminedEvent args) { SolutionContainerManagerComponent? solutionsManager = null; - if (!Resolve(args.Examined.Uid, ref solutionsManager) + if (!Resolve(args.Examined, ref solutionsManager) || !solutionsManager.Solutions.TryGetValue(examinableComponent.Solution, out var solutionHolder)) return; @@ -294,7 +294,7 @@ namespace Content.Server.Chemistry.EntitySystems { var reagentQuantity = FixedPoint2.New(0); if (EntityManager.TryGetEntity(ownerUid, out var owner) - && IoCManager.Resolve().TryGetComponent(owner.Uid, out SolutionContainerManagerComponent? managerComponent)) + && IoCManager.Resolve().TryGetComponent(owner, out SolutionContainerManagerComponent? managerComponent)) { foreach (var solution in managerComponent.Solutions.Values) { diff --git a/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs index 3fb0556ea9..6a422134c9 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs @@ -30,8 +30,8 @@ namespace Content.Server.Chemistry.EntitySystems private void HandleInjection(EntityUid uid, SolutionInjectOnCollideComponent component, StartCollideEvent args) { - if (!IoCManager.Resolve().TryGetComponent(args.OtherFixture.Body.Owner.Uid, out var bloodstream) || - !_solutionsSystem.TryGetInjectableSolution(component.Owner.Uid, out var solution)) return; + if (!IoCManager.Resolve().TryGetComponent(args.OtherFixture.Body.Owner, out var bloodstream) || + !_solutionsSystem.TryGetInjectableSolution(component.Owner, out var solution)) return; var solRemoved = solution.SplitSolution(component.TransferAmount); var solRemovedVol = solRemoved.TotalVolume; diff --git a/Content.Server/Chemistry/EntitySystems/SolutionTransferSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionTransferSystem.cs index 2b4d008aff..3c1e73ffc4 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionTransferSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionTransferSystem.cs @@ -32,7 +32,7 @@ namespace Content.Server.Chemistry.EntitySystems if (!args.CanAccess || !args.CanInteract || !component.CanChangeTransferAmount) return; - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out var actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out var actor)) return; // Custom transfer verb diff --git a/Content.Server/Chemistry/EntitySystems/TransformableContainerSystem.cs b/Content.Server/Chemistry/EntitySystems/TransformableContainerSystem.cs index 36c141df2d..edfb898034 100644 --- a/Content.Server/Chemistry/EntitySystems/TransformableContainerSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/TransformableContainerSystem.cs @@ -51,14 +51,14 @@ namespace Content.Server.Chemistry.EntitySystems new SpriteSpecifier.Rsi( new ResourcePath("Objects/Consumable/Drinks/" + proto.SpriteReplacementPath), "icon"); var ownerEntity = EntityManager.GetEntity(uid); - if (IoCManager.Resolve().TryGetComponent(ownerEntity.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(ownerEntity, out SpriteComponent? sprite)) { sprite?.LayerSetSprite(0, spriteSpec); } string val = proto.Name + " glass"; - IoCManager.Resolve().GetComponent(ownerEntity.Uid).EntityName = val; - IoCManager.Resolve().GetComponent(ownerEntity.Uid).EntityDescription = proto.Description; + IoCManager.Resolve().GetComponent(ownerEntity).EntityName = val; + IoCManager.Resolve().GetComponent(ownerEntity).EntityDescription = proto.Description; component.CurrentReagent = proto; component.Transformed = true; } @@ -69,14 +69,14 @@ namespace Content.Server.Chemistry.EntitySystems component.CurrentReagent = null; component.Transformed = false; - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out SpriteComponent? sprite) && + if (IoCManager.Resolve().TryGetComponent(component.Owner, out SpriteComponent? sprite) && component.InitialSprite != null) { sprite.LayerSetSprite(0, component.InitialSprite); } - IoCManager.Resolve().GetComponent(component.Owner.Uid).EntityName = component.InitialName; - IoCManager.Resolve().GetComponent(component.Owner.Uid).EntityDescription = component.InitialDescription; + IoCManager.Resolve().GetComponent(component.Owner).EntityName = component.InitialName; + IoCManager.Resolve().GetComponent(component.Owner).EntityDescription = component.InitialDescription; } } } diff --git a/Content.Server/Chemistry/EntitySystems/VaporSystem.cs b/Content.Server/Chemistry/EntitySystems/VaporSystem.cs index 075d72a413..7451bdf82c 100644 --- a/Content.Server/Chemistry/EntitySystems/VaporSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/VaporSystem.cs @@ -36,7 +36,7 @@ namespace Content.Server.Chemistry.EntitySystems foreach (var (_, value) in contents.Solutions) { - value.DoEntityReaction(args.OtherFixture.Body.Owner.Uid, ReactionMethod.Touch); + value.DoEntityReaction(args.OtherFixture.Body.Owner, ReactionMethod.Touch); } // Check for collision with a impassable object (e.g. wall) and stop @@ -52,7 +52,7 @@ namespace Content.Server.Chemistry.EntitySystems vapor.Target = target; vapor.AliveTime = aliveTime; // Set Move - if (IoCManager.Resolve().TryGetComponent(vapor.Owner.Uid, out PhysicsComponent? physics)) + if (IoCManager.Resolve().TryGetComponent(vapor.Owner, out PhysicsComponent? physics)) { physics.BodyStatus = BodyStatus.InAir; physics.ApplyLinearImpulse(dir * speed); @@ -66,13 +66,13 @@ namespace Content.Server.Chemistry.EntitySystems return false; } - if (!_solutionContainerSystem.TryGetSolution(vapor.Owner.Uid, SharedVaporComponent.SolutionName, + if (!_solutionContainerSystem.TryGetSolution(vapor.Owner, SharedVaporComponent.SolutionName, out var vaporSolution)) { return false; } - return _solutionContainerSystem.TryAddSolution(vapor.Owner.Uid, vaporSolution, solution); + return _solutionContainerSystem.TryAddSolution(vapor.Owner, vaporSolution, solution); } public override void Update(float frameTime) @@ -97,24 +97,24 @@ namespace Content.Server.Chemistry.EntitySystems vapor.Timer += frameTime; vapor.ReactTimer += frameTime; - if (vapor.ReactTimer >= ReactTime && IoCManager.Resolve().GetComponent(vapor.Owner.Uid).GridID.IsValid()) + if (vapor.ReactTimer >= ReactTime && IoCManager.Resolve().GetComponent(vapor.Owner).GridID.IsValid()) { vapor.ReactTimer = 0; - var mapGrid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity.Uid).GridID); + var mapGrid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(entity).GridID); - var tile = mapGrid.GetTileRef(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.ToVector2i(EntityManager, _mapManager)); + var tile = mapGrid.GetTileRef(IoCManager.Resolve().GetComponent(entity).Coordinates.ToVector2i(EntityManager, _mapManager)); foreach (var reagentQuantity in contents.Contents.ToArray()) { if (reagentQuantity.Quantity == FixedPoint2.Zero) continue; var reagent = _protoManager.Index(reagentQuantity.ReagentId); - _solutionContainerSystem.TryRemoveReagent(vapor.Owner.Uid, contents, reagentQuantity.ReagentId, + _solutionContainerSystem.TryRemoveReagent(vapor.Owner, contents, reagentQuantity.ReagentId, reagent.ReactionTile(tile, (reagentQuantity.Quantity / vapor.TransferAmount) * 0.25f)); } } // Check if we've reached our target. if (!vapor.Reached && - vapor.Target.TryDistance(EntityManager, IoCManager.Resolve().GetComponent(entity.Uid).Coordinates, out var distance) && + vapor.Target.TryDistance(EntityManager, IoCManager.Resolve().GetComponent(entity).Coordinates, out var distance) && distance <= 0.5f) { vapor.Reached = true; @@ -123,7 +123,7 @@ namespace Content.Server.Chemistry.EntitySystems if (contents.CurrentVolume == 0 || vapor.Timer > vapor.AliveTime) { // Delete this - IoCManager.Resolve().QueueDeleteEntity(entity.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) entity); } } } diff --git a/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs b/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs index 94cb2d989f..949f39fcc8 100644 --- a/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs +++ b/Content.Server/Chemistry/ReactionEffects/AreaReactionEffect.cs @@ -122,7 +122,7 @@ namespace Content.Server.Chemistry.ReactionEffects if (areaEffectComponent == null) { Logger.Error("Couldn't get AreaEffectComponent from " + _prototypeId); - IoCManager.Resolve().QueueDeleteEntity(ent.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) ent); return; } diff --git a/Content.Server/Chemistry/ReactionEffects/FoamAreaReactionEffect.cs b/Content.Server/Chemistry/ReactionEffects/FoamAreaReactionEffect.cs index d090f0b637..daa9c877bd 100644 --- a/Content.Server/Chemistry/ReactionEffects/FoamAreaReactionEffect.cs +++ b/Content.Server/Chemistry/ReactionEffects/FoamAreaReactionEffect.cs @@ -12,7 +12,7 @@ namespace Content.Server.Chemistry.ReactionEffects { protected override SolutionAreaEffectComponent? GetAreaEffectComponent(IEntity entity) { - return IoCManager.Resolve().GetComponentOrNull(entity.Uid); + return IoCManager.Resolve().GetComponentOrNull(entity); } } } diff --git a/Content.Server/Chemistry/ReactionEffects/SmokeAreaReactionEffect.cs b/Content.Server/Chemistry/ReactionEffects/SmokeAreaReactionEffect.cs index 47f5a489d8..b39e23bd7e 100644 --- a/Content.Server/Chemistry/ReactionEffects/SmokeAreaReactionEffect.cs +++ b/Content.Server/Chemistry/ReactionEffects/SmokeAreaReactionEffect.cs @@ -12,7 +12,7 @@ namespace Content.Server.Chemistry.ReactionEffects { protected override SolutionAreaEffectComponent? GetAreaEffectComponent(IEntity entity) { - return IoCManager.Resolve().GetComponentOrNull(entity.Uid); + return IoCManager.Resolve().GetComponentOrNull(entity); } } } diff --git a/Content.Server/Chemistry/TileReactions/CleanTileReaction.cs b/Content.Server/Chemistry/TileReactions/CleanTileReaction.cs index cdd4290932..4abe8b2413 100644 --- a/Content.Server/Chemistry/TileReactions/CleanTileReaction.cs +++ b/Content.Server/Chemistry/TileReactions/CleanTileReaction.cs @@ -25,7 +25,7 @@ namespace Content.Server.Chemistry.TileReactions var amount = FixedPoint2.Zero; foreach (var entity in entities) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out CleanableComponent? cleanable)) + if (IoCManager.Resolve().TryGetComponent(entity, out CleanableComponent? cleanable)) { var next = (amount + cleanable.CleanAmount) * CleanAmountMultiplier; // Nothing left? @@ -33,7 +33,7 @@ namespace Content.Server.Chemistry.TileReactions break; amount = next; - IoCManager.Resolve().QueueDeleteEntity(entity.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) entity); } } diff --git a/Content.Server/Chemistry/TileReactions/CreateEntityTileReaction.cs b/Content.Server/Chemistry/TileReactions/CreateEntityTileReaction.cs index b6817de8c5..37690a585f 100644 --- a/Content.Server/Chemistry/TileReactions/CreateEntityTileReaction.cs +++ b/Content.Server/Chemistry/TileReactions/CreateEntityTileReaction.cs @@ -51,7 +51,7 @@ public class CreateEntityTileReaction : ITileReaction int acc = 0; foreach (var ent in tile.GetEntitiesInTile()) { - if (Whitelist.IsValid(ent.Uid)) + if (Whitelist.IsValid(ent)) acc += 1; if (acc >= MaxOnTile) diff --git a/Content.Server/Chemistry/TileReactions/SpillTileReaction.cs b/Content.Server/Chemistry/TileReactions/SpillTileReaction.cs index f79c3b8200..05f7fa2d64 100644 --- a/Content.Server/Chemistry/TileReactions/SpillTileReaction.cs +++ b/Content.Server/Chemistry/TileReactions/SpillTileReaction.cs @@ -30,7 +30,7 @@ namespace Content.Server.Chemistry.TileReactions if (puddle != null) { - var slippery = IoCManager.Resolve().GetComponent(puddle.Owner.Uid); + var slippery = IoCManager.Resolve().GetComponent(puddle.Owner); slippery.LaunchForwardsMultiplier = _launchForwardsMultiplier; slippery.RequiredSlipSpeed = _requiredSlipSpeed; slippery.ParalyzeTime = _paralyzeTime; diff --git a/Content.Server/Climbing/ClimbSystem.cs b/Content.Server/Climbing/ClimbSystem.cs index ec13166924..41f4852867 100644 --- a/Content.Server/Climbing/ClimbSystem.cs +++ b/Content.Server/Climbing/ClimbSystem.cs @@ -37,11 +37,11 @@ namespace Content.Server.Climbing private void AddClimbVerb(EntityUid uid, ClimbableComponent component, GetAlternativeVerbsEvent args) { - if (!args.CanAccess || !args.CanInteract || !_actionBlockerSystem.CanMove(args.User.Uid)) + if (!args.CanAccess || !args.CanInteract || !_actionBlockerSystem.CanMove(args.User)) return; // Check that the user climb. - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ClimbingComponent? climbingComponent) || + if (!IoCManager.Resolve().TryGetComponent(args.User, out ClimbingComponent? climbingComponent) || climbingComponent.IsClimbing) return; diff --git a/Content.Server/Climbing/Components/ClimbableComponent.cs b/Content.Server/Climbing/Components/ClimbableComponent.cs index b3e6679747..0ec321a182 100644 --- a/Content.Server/Climbing/Components/ClimbableComponent.cs +++ b/Content.Server/Climbing/Components/ClimbableComponent.cs @@ -36,7 +36,7 @@ namespace Content.Server.Climbing.Components if (!Owner.EnsureComponent(out PhysicsComponent _)) { - Logger.Warning($"Entity {IoCManager.Resolve().GetComponent(Owner.Uid).EntityName} at {IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition} didn't have a {nameof(PhysicsComponent)}"); + Logger.Warning($"Entity {IoCManager.Resolve().GetComponent(Owner).EntityName} at {IoCManager.Resolve().GetComponent(Owner).MapPosition} didn't have a {nameof(PhysicsComponent)}"); } } @@ -68,14 +68,14 @@ namespace Content.Server.Climbing.Components /// private bool CanVault(IEntity user, IEntity target, out string reason) { - if (!EntitySystem.Get().CanInteract(user.Uid)) + if (!EntitySystem.Get().CanInteract(user)) { reason = Loc.GetString("comp-climbable-cant-interact"); return false; } - if (!IoCManager.Resolve().HasComponent(user.Uid) || - !IoCManager.Resolve().TryGetComponent(user.Uid, out SharedBodyComponent? body)) + if (!IoCManager.Resolve().HasComponent(user) || + !IoCManager.Resolve().TryGetComponent(user, out SharedBodyComponent? body)) { reason = Loc.GetString("comp-climbable-cant-climb"); return false; @@ -108,13 +108,13 @@ namespace Content.Server.Climbing.Components /// private bool CanVault(IEntity user, IEntity dragged, IEntity target, out string reason) { - if (!EntitySystem.Get().CanInteract(user.Uid)) + if (!EntitySystem.Get().CanInteract(user)) { reason = Loc.GetString("comp-climbable-cant-interact"); return false; } - if (target == null || !IoCManager.Resolve().HasComponent(dragged.Uid)) + if (target == null || !IoCManager.Resolve().HasComponent(dragged)) { reason = Loc.GetString("comp-climbable-cant-climb"); return false; @@ -159,14 +159,14 @@ namespace Content.Server.Climbing.Components var result = await EntitySystem.Get().WaitDoAfter(doAfterEventArgs); - if (result != DoAfterStatus.Cancelled && IoCManager.Resolve().TryGetComponent(entityToMove.Uid, out PhysicsComponent? body) && body.Fixtures.Count >= 1) + if (result != DoAfterStatus.Cancelled && IoCManager.Resolve().TryGetComponent(entityToMove, out PhysicsComponent? body) && body.Fixtures.Count >= 1) { - var entityPos = IoCManager.Resolve().GetComponent(entityToMove.Uid).WorldPosition; + var entityPos = IoCManager.Resolve().GetComponent(entityToMove).WorldPosition; - var direction = (IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition - entityPos).Normalized; - var endPoint = IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition; + var direction = (IoCManager.Resolve().GetComponent(Owner).WorldPosition - entityPos).Normalized; + var endPoint = IoCManager.Resolve().GetComponent(Owner).WorldPosition; - var climbMode = IoCManager.Resolve().GetComponent(entityToMove.Uid); + var climbMode = IoCManager.Resolve().GetComponent(entityToMove); climbMode.IsClimbing = true; if (MathF.Abs(direction.X) < 0.6f) // user climbed mostly vertically so lets make it a clean straight line @@ -193,7 +193,7 @@ namespace Content.Server.Climbing.Components public async void TryClimb(IEntity user) { - if (!IoCManager.Resolve().TryGetComponent(user.Uid, out ClimbingComponent? climbingComponent) || climbingComponent.IsClimbing) + if (!IoCManager.Resolve().TryGetComponent(user, out ClimbingComponent? climbingComponent) || climbingComponent.IsClimbing) return; var doAfterEventArgs = new DoAfterEventArgs(user, _climbDelay, default, Owner) @@ -206,24 +206,24 @@ namespace Content.Server.Climbing.Components var result = await EntitySystem.Get().WaitDoAfter(doAfterEventArgs); - if (result != DoAfterStatus.Cancelled && IoCManager.Resolve().TryGetComponent(user.Uid, out PhysicsComponent? body) && body.Fixtures.Count >= 1) + if (result != DoAfterStatus.Cancelled && IoCManager.Resolve().TryGetComponent(user, out PhysicsComponent? body) && body.Fixtures.Count >= 1) { // TODO: Remove the copy-paste code - var userPos = IoCManager.Resolve().GetComponent(user.Uid).WorldPosition; + var userPos = IoCManager.Resolve().GetComponent(user).WorldPosition; - var direction = (IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition - userPos).Normalized; - var endPoint = IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition; + var direction = (IoCManager.Resolve().GetComponent(Owner).WorldPosition - userPos).Normalized; + var endPoint = IoCManager.Resolve().GetComponent(Owner).WorldPosition; - var climbMode = IoCManager.Resolve().GetComponent(user.Uid); + var climbMode = IoCManager.Resolve().GetComponent(user); climbMode.IsClimbing = true; if (MathF.Abs(direction.X) < 0.6f) // user climbed mostly vertically so lets make it a clean straight line { - endPoint = new Vector2(IoCManager.Resolve().GetComponent(user.Uid).WorldPosition.X, endPoint.Y); + endPoint = new Vector2(IoCManager.Resolve().GetComponent(user).WorldPosition.X, endPoint.Y); } else if (MathF.Abs(direction.Y) < 0.6f) // user climbed mostly horizontally so lets make it a clean straight line { - endPoint = new Vector2(endPoint.X, IoCManager.Resolve().GetComponent(user.Uid).WorldPosition.Y); + endPoint = new Vector2(endPoint.X, IoCManager.Resolve().GetComponent(user).WorldPosition.Y); } climbMode.TryMoveTo(userPos, endPoint); diff --git a/Content.Server/Cloning/CloningSystem.cs b/Content.Server/Cloning/CloningSystem.cs index 4e4d5a15cc..e70c2b4678 100644 --- a/Content.Server/Cloning/CloningSystem.cs +++ b/Content.Server/Cloning/CloningSystem.cs @@ -36,11 +36,11 @@ namespace Content.Server.Cloning { if (!ClonesWaitingForMind.TryGetValue(mind, out var entityUid) || !EntityManager.TryGetEntity(entityUid, out var entity) || - !IoCManager.Resolve().TryGetComponent(entity.Uid, out MindComponent? mindComp) || + !IoCManager.Resolve().TryGetComponent(entity, out MindComponent? mindComp) || mindComp.Mind != null) return; - mind.TransferTo(entity.Uid, ghostCheckOverride: true); + mind.TransferTo(entity, ghostCheckOverride: true); mind.UnVisit(); ClonesWaitingForMind.Remove(mind); } @@ -48,7 +48,7 @@ namespace Content.Server.Cloning private void HandleActivate(EntityUid uid, CloningPodComponent component, ActivateInWorldEvent args) { if (!component.Powered || - !IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + !IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) { return; } @@ -60,10 +60,10 @@ namespace Content.Server.Cloning { if (component.Parent == EntityUid.Invalid || !EntityManager.TryGetEntity(component.Parent, out var parent) || - !IoCManager.Resolve().TryGetComponent(parent.Uid, out var cloningPodComponent) || + !IoCManager.Resolve().TryGetComponent(parent, out var cloningPodComponent) || component.Owner != cloningPodComponent.BodyContainer?.ContainedEntity) { - IoCManager.Resolve().RemoveComponent(component.Owner.Uid); + IoCManager.Resolve().RemoveComponent(component.Owner); return; } diff --git a/Content.Server/Cloning/Components/CloningPodComponent.cs b/Content.Server/Cloning/Components/CloningPodComponent.cs index 027f821524..12abf36cba 100644 --- a/Content.Server/Cloning/Components/CloningPodComponent.cs +++ b/Content.Server/Cloning/Components/CloningPodComponent.cs @@ -26,7 +26,7 @@ namespace Content.Server.Cloning.Components [Dependency] private readonly EuiManager _euiManager = null!; [ViewVariables] - public bool Powered => !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) || receiver.Powered; + public bool Powered => !IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered; [ViewVariables] public BoundUserInterface? UserInterface => @@ -70,7 +70,7 @@ namespace Content.Server.Cloning.Components private void UpdateAppearance() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(CloningPodVisuals.Status, Status); } @@ -108,9 +108,9 @@ namespace Content.Server.Cloning.Components if (cloningSystem.ClonesWaitingForMind.TryGetValue(mind, out var cloneUid)) { if (IoCManager.Resolve().TryGetEntity(cloneUid, out var clone) && - IoCManager.Resolve().TryGetComponent(clone.Uid, out var cloneState) && + IoCManager.Resolve().TryGetComponent(clone, out var cloneState) && !cloneState.IsDead() && - IoCManager.Resolve().TryGetComponent(clone.Uid, out MindComponent? cloneMindComp) && + IoCManager.Resolve().TryGetComponent(clone, out MindComponent? cloneMindComp) && (cloneMindComp.Mind == null || cloneMindComp.Mind == mind)) { obj.Session.AttachedEntity?.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-already-cloning")); @@ -121,7 +121,7 @@ namespace Content.Server.Cloning.Components } if (mind.OwnedEntity != null && - IoCManager.Resolve().TryGetComponent(mind.OwnedEntity.Uid, out var state) && + IoCManager.Resolve().TryGetComponent(mind.OwnedEntity, out var state) && !state.IsDead()) { obj.Session.AttachedEntity?.PopupMessageCursor(Loc.GetString("cloning-pod-component-msg-already-alive")); @@ -135,19 +135,19 @@ namespace Content.Server.Cloning.Components return; // If we can't track down the client, we can't offer transfer. That'd be quite bad. } - var mob = IoCManager.Resolve().SpawnEntity("MobHuman", IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition); + var mob = IoCManager.Resolve().SpawnEntity("MobHuman", IoCManager.Resolve().GetComponent(Owner).MapPosition); - EntitySystem.Get().UpdateFromProfile(mob.Uid, dna.Profile); - IoCManager.Resolve().GetComponent(mob.Uid).EntityName = dna.Profile.Name; + EntitySystem.Get().UpdateFromProfile(mob, dna.Profile); + IoCManager.Resolve().GetComponent(mob).EntityName = dna.Profile.Name; var cloneMindReturn = IoCManager.Resolve().AddComponent(mob); cloneMindReturn.Mind = mind; - cloneMindReturn.Parent = Owner.Uid; + cloneMindReturn.Parent = Owner; BodyContainer.Insert(mob); CapturedMind = mind; - cloningSystem.ClonesWaitingForMind.Add(mind, mob.Uid); + cloningSystem.ClonesWaitingForMind.Add(mind, mob); UpdateStatus(CloningPodStatus.NoMind); @@ -171,12 +171,12 @@ namespace Content.Server.Cloning.Components if (entity == null || CloningProgress < CloningTime) return; - IoCManager.Resolve().RemoveComponent(entity.Uid); + IoCManager.Resolve().RemoveComponent(entity); BodyContainer.Remove(entity!); CapturedMind = null; CloningProgress = 0f; UpdateStatus(CloningPodStatus.Idle); - EntitySystem.Get().ForciblySetClimbing(entity.Uid); + EntitySystem.Get().ForciblySetClimbing(entity); } public void UpdateStatus(CloningPodStatus status) diff --git a/Content.Server/Clothing/Components/ClothingComponent.cs b/Content.Server/Clothing/Components/ClothingComponent.cs index 90f4e8330e..bf6fd752d1 100644 --- a/Content.Server/Clothing/Components/ClothingComponent.cs +++ b/Content.Server/Clothing/Components/ClothingComponent.cs @@ -61,8 +61,8 @@ namespace Content.Server.Clothing.Components bool IUse.UseEntity(UseEntityEventArgs eventArgs) { if (!_quickEquipEnabled) return false; - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out InventoryComponent? inv) - || !IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out HandsComponent? hands)) return false; + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out InventoryComponent? inv) + || !IoCManager.Resolve().TryGetComponent(eventArgs.User, out HandsComponent? hands)) return false; foreach (var (slot, flag) in SlotMasks) { @@ -80,14 +80,14 @@ namespace Content.Server.Clothing.Components { hands.Drop(item.Owner); inv.Equip(slot, item); - hands.PutInHand(IoCManager.Resolve().GetComponent(Owner.Uid)); + hands.PutInHand(IoCManager.Resolve().GetComponent(Owner)); } } else { hands.Drop(Owner); if (!TryEquip(inv, slot, eventArgs.User)) - hands.PutInHand(IoCManager.Resolve().GetComponent(Owner.Uid)); + hands.PutInHand(IoCManager.Resolve().GetComponent(Owner)); } return true; diff --git a/Content.Server/Clothing/Components/MagbootsComponent.cs b/Content.Server/Clothing/Components/MagbootsComponent.cs index 5c961082a9..c34ac5f84a 100644 --- a/Content.Server/Clothing/Components/MagbootsComponent.cs +++ b/Content.Server/Clothing/Components/MagbootsComponent.cs @@ -60,12 +60,12 @@ namespace Content.Server.Clothing.Components { if (On && eventArgs.Slot == Slots.SHOES) { - if (IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out MovedByPressureComponent? movedByPressure)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.User, out MovedByPressureComponent? movedByPressure)) { movedByPressure.Enabled = true; } - if (IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ServerAlertsComponent? alerts)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.User, out ServerAlertsComponent? alerts)) { alerts.ClearAlert(AlertType.Magboots); } @@ -82,15 +82,15 @@ namespace Content.Server.Clothing.Components if (!Owner.TryGetContainer(out var container)) return; - if (IoCManager.Resolve().TryGetComponent(container.Owner.Uid, out InventoryComponent? inventoryComponent) + if (IoCManager.Resolve().TryGetComponent(container.Owner, out InventoryComponent? inventoryComponent) && inventoryComponent.GetSlotItem(Slots.SHOES)?.Owner == Owner) { - if (IoCManager.Resolve().TryGetComponent(container.Owner.Uid, out MovedByPressureComponent? movedByPressure)) + if (IoCManager.Resolve().TryGetComponent(container.Owner, out MovedByPressureComponent? movedByPressure)) { movedByPressure.Enabled = false; } - if (IoCManager.Resolve().TryGetComponent(container.Owner.Uid, out ServerAlertsComponent? alerts)) + if (IoCManager.Resolve().TryGetComponent(container.Owner, out ServerAlertsComponent? alerts)) { if (On) { @@ -127,7 +127,7 @@ namespace Content.Server.Clothing.Components { public bool DoToggleAction(ToggleItemActionEventArgs args) { - if (!IoCManager.Resolve().TryGetComponent(args.Item.Uid, out var magboots)) + if (!IoCManager.Resolve().TryGetComponent(args.Item, out var magboots)) return false; magboots.Toggle(args.Performer); diff --git a/Content.Server/Commands/CommandUtils.cs b/Content.Server/Commands/CommandUtils.cs index a37c94407c..2b89e0f6d7 100644 --- a/Content.Server/Commands/CommandUtils.cs +++ b/Content.Server/Commands/CommandUtils.cs @@ -56,31 +56,31 @@ namespace Content.Server.Commands public static string SubstituteEntityDetails(IConsoleShell shell, IEntity ent, string ruleString) { // gross, is there a better way to do this? - ruleString = ruleString.Replace("$ID", ent.Uid.ToString()); + ruleString = ruleString.Replace("$ID", ent.ToString()); ruleString = ruleString.Replace("$WX", - IoCManager.Resolve().GetComponent(ent.Uid).WorldPosition.X.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(ent).WorldPosition.X.ToString(CultureInfo.InvariantCulture)); ruleString = ruleString.Replace("$WY", - IoCManager.Resolve().GetComponent(ent.Uid).WorldPosition.Y.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(ent).WorldPosition.Y.ToString(CultureInfo.InvariantCulture)); ruleString = ruleString.Replace("$LX", - IoCManager.Resolve().GetComponent(ent.Uid).LocalPosition.X.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(ent).LocalPosition.X.ToString(CultureInfo.InvariantCulture)); ruleString = ruleString.Replace("$LY", - IoCManager.Resolve().GetComponent(ent.Uid).LocalPosition.Y.ToString(CultureInfo.InvariantCulture)); - ruleString = ruleString.Replace("$NAME", IoCManager.Resolve().GetComponent(ent.Uid).EntityName); + IoCManager.Resolve().GetComponent(ent).LocalPosition.Y.ToString(CultureInfo.InvariantCulture)); + ruleString = ruleString.Replace("$NAME", IoCManager.Resolve().GetComponent(ent).EntityName); if (shell.Player is IPlayerSession player) { if (player.AttachedEntity != null) { var p = player.AttachedEntity; - ruleString = ruleString.Replace("$PID", ent.Uid.ToString()); + ruleString = ruleString.Replace("$PID", ent.ToString()); ruleString = ruleString.Replace("$PWX", - IoCManager.Resolve().GetComponent(p.Uid).WorldPosition.X.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(p).WorldPosition.X.ToString(CultureInfo.InvariantCulture)); ruleString = ruleString.Replace("$PWY", - IoCManager.Resolve().GetComponent(p.Uid).WorldPosition.Y.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(p).WorldPosition.Y.ToString(CultureInfo.InvariantCulture)); ruleString = ruleString.Replace("$PLX", - IoCManager.Resolve().GetComponent(p.Uid).LocalPosition.X.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(p).LocalPosition.X.ToString(CultureInfo.InvariantCulture)); ruleString = ruleString.Replace("$PLY", - IoCManager.Resolve().GetComponent(p.Uid).LocalPosition.Y.ToString(CultureInfo.InvariantCulture)); + IoCManager.Resolve().GetComponent(p).LocalPosition.Y.ToString(CultureInfo.InvariantCulture)); } } return ruleString; diff --git a/Content.Server/Communications/CommunicationsConsoleComponent.cs b/Content.Server/Communications/CommunicationsConsoleComponent.cs index 0fa28d3084..888041ba4a 100644 --- a/Content.Server/Communications/CommunicationsConsoleComponent.cs +++ b/Content.Server/Communications/CommunicationsConsoleComponent.cs @@ -25,7 +25,7 @@ namespace Content.Server.Communications { [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IChatManager _chatManager = default!; - private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) || receiver.Powered; + private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered; private RoundEndSystem RoundEndSystem => EntitySystem.Get(); diff --git a/Content.Server/Computer/ComputerComponent.cs b/Content.Server/Computer/ComputerComponent.cs index 4486637cfa..14bc1e789e 100644 --- a/Content.Server/Computer/ComputerComponent.cs +++ b/Content.Server/Computer/ComputerComponent.cs @@ -26,8 +26,8 @@ namespace Content.Server.Computer // Let's ensure the container manager and container are here. Owner.EnsureContainer("board", out var _); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? powerReceiver) && - IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? powerReceiver) && + IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(ComputerVisuals.Powered, powerReceiver.Powered); } @@ -49,7 +49,7 @@ namespace Content.Server.Computer private void PowerReceiverOnOnPowerStateChanged(PowerChangedMessage e) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(ComputerVisuals.Powered, e.Powered); } @@ -63,8 +63,8 @@ namespace Content.Server.Computer private void CreateComputerBoard() { // Ensure that the construction component is aware of the board container. - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ConstructionComponent? construction)) - EntitySystem.Get().AddContainer(Owner.Uid, "board", construction); + if (IoCManager.Resolve().TryGetComponent(Owner, out ConstructionComponent? construction)) + EntitySystem.Get().AddContainer(Owner, "board", construction); // We don't do anything if this is null or empty. if (string.IsNullOrEmpty(_boardPrototype)) @@ -79,7 +79,7 @@ namespace Content.Server.Computer return; } - var board = IoCManager.Resolve().SpawnEntity(_boardPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var board = IoCManager.Resolve().SpawnEntity(_boardPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); if(!container.Insert(board)) Logger.Warning($"Couldn't insert board {board} to computer {Owner}!"); diff --git a/Content.Server/Configurable/ConfigurationComponent.cs b/Content.Server/Configurable/ConfigurationComponent.cs index b428d9472f..2de59b5ddb 100644 --- a/Content.Server/Configurable/ConfigurationComponent.cs +++ b/Content.Server/Configurable/ConfigurationComponent.cs @@ -81,10 +81,10 @@ namespace Content.Server.Configurable async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - if (UserInterface == null || !IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (UserInterface == null || !IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) return false; - if (!IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out var tool) || !tool.Qualities.Contains(_qualityNeeded)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.Using, out var tool) || !tool.Qualities.Contains(_qualityNeeded)) return false; OpenUserInterface(actor); diff --git a/Content.Server/Construction/Commands/FixRotationsCommand.cs b/Content.Server/Construction/Commands/FixRotationsCommand.cs index 6d676608ca..a6f7eccac1 100644 --- a/Content.Server/Construction/Commands/FixRotationsCommand.cs +++ b/Content.Server/Construction/Commands/FixRotationsCommand.cs @@ -36,7 +36,7 @@ namespace Content.Server.Construction.Commands return; } - gridId = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GridID; + gridId = IoCManager.Resolve().GetComponent(player.AttachedEntity).GridID; break; case 1: if (!int.TryParse(args[0], out var id)) @@ -67,7 +67,7 @@ namespace Content.Server.Construction.Commands } var changed = 0; - foreach (var childUid in IoCManager.Resolve().GetComponent(gridEntity.Uid).ChildEntityUids) + foreach (var childUid in IoCManager.Resolve().GetComponent(gridEntity).ChildEntityUids) { if (!entityManager.TryGetEntity(childUid, out var childEntity)) { @@ -83,9 +83,9 @@ namespace Content.Server.Construction.Commands valid |= occluder.Enabled; } // low walls & grilles - valid |= IoCManager.Resolve().HasComponent(childEntity.Uid); + valid |= IoCManager.Resolve().HasComponent(childEntity); // cables - valid |= IoCManager.Resolve().HasComponent(childEntity.Uid); + valid |= IoCManager.Resolve().HasComponent(childEntity); // anything else that might need this forced valid |= childEntity.HasTag("ForceFixRotations"); // override @@ -96,9 +96,9 @@ namespace Content.Server.Construction.Commands continue; } - if (IoCManager.Resolve().GetComponent(childEntity.Uid).LocalRotation != Angle.Zero) + if (IoCManager.Resolve().GetComponent(childEntity).LocalRotation != Angle.Zero) { - IoCManager.Resolve().GetComponent(childEntity.Uid).LocalRotation = Angle.Zero; + IoCManager.Resolve().GetComponent(childEntity).LocalRotation = Angle.Zero; changed++; } } diff --git a/Content.Server/Construction/Commands/TileWallsCommand.cs b/Content.Server/Construction/Commands/TileWallsCommand.cs index 8276ca16d0..81a1d01512 100644 --- a/Content.Server/Construction/Commands/TileWallsCommand.cs +++ b/Content.Server/Construction/Commands/TileWallsCommand.cs @@ -32,7 +32,7 @@ namespace Content.Server.Construction.Commands return; } - gridId = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GridID; + gridId = IoCManager.Resolve().GetComponent(player.AttachedEntity).GridID; break; case 1: if (!int.TryParse(args[0], out var id)) @@ -67,14 +67,14 @@ namespace Content.Server.Construction.Commands var underplating = tileDefinitionManager["underplating"]; var underplatingTile = new Robust.Shared.Map.Tile(underplating.TileId); var changed = 0; - foreach (var childUid in IoCManager.Resolve().GetComponent(gridEntity.Uid).ChildEntityUids) + foreach (var childUid in IoCManager.Resolve().GetComponent(gridEntity).ChildEntityUids) { if (!entityManager.TryGetEntity(childUid, out var childEntity)) { continue; } - var prototype = IoCManager.Resolve().GetComponent(childEntity.Uid).EntityPrototype; + var prototype = IoCManager.Resolve().GetComponent(childEntity).EntityPrototype; while (true) { if (prototype?.Parent == null) @@ -90,12 +90,12 @@ namespace Content.Server.Construction.Commands continue; } - if (!IoCManager.Resolve().GetComponent(childEntity.Uid).Anchored) + if (!IoCManager.Resolve().GetComponent(childEntity).Anchored) { continue; } - var tile = grid.GetTileRef(IoCManager.Resolve().GetComponent(childEntity.Uid).Coordinates); + var tile = grid.GetTileRef(IoCManager.Resolve().GetComponent(childEntity).Coordinates); var tileDef = (ContentTileDefinition) tileDefinitionManager[tile.Tile.TypeId]; if (tileDef.Name == "underplating") @@ -103,7 +103,7 @@ namespace Content.Server.Construction.Commands continue; } - grid.SetTile(IoCManager.Resolve().GetComponent(childEntity.Uid).Coordinates, underplatingTile); + grid.SetTile(IoCManager.Resolve().GetComponent(childEntity).Coordinates, underplatingTile); changed++; } diff --git a/Content.Server/Construction/Completions/BuildComputer.cs b/Content.Server/Construction/Completions/BuildComputer.cs index 567b791143..2cf431ee22 100644 --- a/Content.Server/Construction/Completions/BuildComputer.cs +++ b/Content.Server/Construction/Completions/BuildComputer.cs @@ -41,7 +41,7 @@ namespace Content.Server.Construction.Completions var board = container.ContainedEntities[0]; - if (!IoCManager.Resolve().TryGetComponent(board.Uid, out ComputerBoardComponent? boardComponent)) + if (!IoCManager.Resolve().TryGetComponent(board, out ComputerBoardComponent? boardComponent)) { Logger.Warning($"Computer entity {uid} had an invalid entity in container \"{Container}\"! Aborting build computer action."); return; @@ -51,21 +51,21 @@ namespace Content.Server.Construction.Completions var transform = entityManager.GetComponent(uid); var computer = entityManager.SpawnEntity(boardComponent.Prototype, transform.Coordinates); - IoCManager.Resolve().GetComponent(computer.Uid).LocalRotation = transform.LocalRotation; + IoCManager.Resolve().GetComponent(computer).LocalRotation = transform.LocalRotation; - var computerContainer = containerSystem.EnsureContainer(computer.Uid, Container); + var computerContainer = containerSystem.EnsureContainer(computer, Container); // In case it already existed and there are any entities inside the container, delete them. foreach (var ent in computerContainer.ContainedEntities.ToArray()) { computerContainer.ForceRemove(ent); - IoCManager.Resolve().DeleteEntity(ent.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) ent); } computerContainer.Insert(board); // We only add this container. If some construction needs to take other containers into account, fix this. - entityManager.EntitySysManager.GetEntitySystem().AddContainer(computer.Uid, Container); + entityManager.EntitySysManager.GetEntitySystem().AddContainer(computer, Container); // Delete the original entity. entityManager.DeleteEntity(uid); diff --git a/Content.Server/Construction/Completions/BuildMachine.cs b/Content.Server/Construction/Completions/BuildMachine.cs index c4cc64b79a..d31799ac38 100644 --- a/Content.Server/Construction/Completions/BuildMachine.cs +++ b/Content.Server/Construction/Completions/BuildMachine.cs @@ -54,7 +54,7 @@ namespace Content.Server.Construction.Completions var board = entBoardContainer.ContainedEntities[0]; - if (!IoCManager.Resolve().TryGetComponent(board.Uid, out MachineBoardComponent? boardComponent)) + if (!IoCManager.Resolve().TryGetComponent(board, out MachineBoardComponent? boardComponent)) { Logger.Warning($"Machine frame entity {uid} had an invalid entity in container \"{MachineFrameComponent.BoardContainer}\"! Aborting build machine action."); return; @@ -64,7 +64,7 @@ namespace Content.Server.Construction.Completions var transform = entityManager.GetComponent(uid); var machine = entityManager.SpawnEntity(boardComponent.Prototype, transform.Coordinates); - IoCManager.Resolve().GetComponent(machine.Uid).LocalRotation = transform.LocalRotation; + IoCManager.Resolve().GetComponent(machine).LocalRotation = transform.LocalRotation; var boardContainer = machine.EnsureContainer(MachineFrameComponent.BoardContainer, out var existed); @@ -92,14 +92,14 @@ namespace Content.Server.Construction.Completions } var constructionSystem = entityManager.EntitySysManager.GetEntitySystem(); - if (IoCManager.Resolve().TryGetComponent(machine.Uid, out ConstructionComponent? construction)) + if (IoCManager.Resolve().TryGetComponent(machine, out ConstructionComponent? construction)) { // We only add these two container. If some construction needs to take other containers into account, fix this. - constructionSystem.AddContainer(machine.Uid, MachineFrameComponent.BoardContainer, construction); - constructionSystem.AddContainer(machine.Uid, MachineFrameComponent.PartContainer, construction); + constructionSystem.AddContainer(machine, MachineFrameComponent.BoardContainer, construction); + constructionSystem.AddContainer(machine, MachineFrameComponent.PartContainer, construction); } - if (IoCManager.Resolve().TryGetComponent(machine.Uid, out MachineComponent? machineComp)) + if (IoCManager.Resolve().TryGetComponent(machine, out MachineComponent? machineComp)) { machineComp.RefreshParts(); } diff --git a/Content.Server/Construction/Completions/DeleteEntitiesInContainer.cs b/Content.Server/Construction/Completions/DeleteEntitiesInContainer.cs index 0bc8bf79fa..ea88d2d73a 100644 --- a/Content.Server/Construction/Completions/DeleteEntitiesInContainer.cs +++ b/Content.Server/Construction/Completions/DeleteEntitiesInContainer.cs @@ -23,7 +23,7 @@ namespace Content.Server.Construction.Completions foreach (var contained in container.ContainedEntities.ToArray()) { if(container.Remove(contained)) - IoCManager.Resolve().QueueDeleteEntity(contained.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) contained); } } } diff --git a/Content.Server/Construction/Completions/EmptyContainer.cs b/Content.Server/Construction/Completions/EmptyContainer.cs index ea565fbdff..59f31f2d94 100644 --- a/Content.Server/Construction/Completions/EmptyContainer.cs +++ b/Content.Server/Construction/Completions/EmptyContainer.cs @@ -25,8 +25,8 @@ namespace Content.Server.Construction.Completions foreach (var contained in container.ContainedEntities.ToArray()) { container.ForceRemove(contained); - IoCManager.Resolve().GetComponent(contained.Uid).Coordinates = transform.Coordinates; - IoCManager.Resolve().GetComponent(contained.Uid).AttachToGridOrMap(); + IoCManager.Resolve().GetComponent(contained).Coordinates = transform.Coordinates; + IoCManager.Resolve().GetComponent(contained).AttachToGridOrMap(); } } } diff --git a/Content.Server/Construction/Completions/SpawnPrototype.cs b/Content.Server/Construction/Completions/SpawnPrototype.cs index 3aff9a3aa7..a4c3c1068c 100644 --- a/Content.Server/Construction/Completions/SpawnPrototype.cs +++ b/Content.Server/Construction/Completions/SpawnPrototype.cs @@ -26,8 +26,8 @@ namespace Content.Server.Construction.Completions if (EntityPrototypeHelpers.HasComponent(Prototype)) { var stackEnt = entityManager.SpawnEntity(Prototype, coordinates); - var stack = IoCManager.Resolve().GetComponent(stackEnt.Uid); - entityManager.EntitySysManager.GetEntitySystem().SetCount(stackEnt.Uid, Amount, stack); + var stack = IoCManager.Resolve().GetComponent(stackEnt); + entityManager.EntitySysManager.GetEntitySystem().SetCount(stackEnt, Amount, stack); } else { diff --git a/Content.Server/Construction/Components/MachineComponent.cs b/Content.Server/Construction/Components/MachineComponent.cs index f4cd9a6e04..7854a0ffa5 100644 --- a/Content.Server/Construction/Components/MachineComponent.cs +++ b/Content.Server/Construction/Components/MachineComponent.cs @@ -32,14 +32,14 @@ namespace Content.Server.Construction.Components { foreach (var entity in _partContainer.ContainedEntities) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out var machinePart)) + if (IoCManager.Resolve().TryGetComponent(entity, out var machinePart)) yield return machinePart; } } public void RefreshParts() { - foreach (var refreshable in IoCManager.Resolve().GetComponents(Owner.Uid)) + foreach (var refreshable in IoCManager.Resolve().GetComponents(Owner)) { refreshable.RefreshParts(GetAllParts()); } @@ -63,14 +63,14 @@ namespace Content.Server.Construction.Components return; } - var board = entityManager.SpawnEntity(BoardPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var board = entityManager.SpawnEntity(BoardPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); if (!_boardContainer.Insert(board)) { - throw new Exception($"Couldn't insert board with prototype {BoardPrototype} to machine with prototype {IoCManager.Resolve().GetComponent(Owner.Uid).EntityPrototype?.ID ?? "N/A"}!"); + throw new Exception($"Couldn't insert board with prototype {BoardPrototype} to machine with prototype {IoCManager.Resolve().GetComponent(Owner).EntityPrototype?.ID ?? "N/A"}!"); } - if (!IoCManager.Resolve().TryGetComponent(board.Uid, out var machineBoard)) + if (!IoCManager.Resolve().TryGetComponent(board, out var machineBoard)) { throw new Exception($"Entity with prototype {BoardPrototype} doesn't have a {nameof(MachineBoardComponent)}!"); } @@ -79,29 +79,29 @@ namespace Content.Server.Construction.Components { for (var i = 0; i < amount; i++) { - var p = entityManager.SpawnEntity(MachinePartComponent.Prototypes[part], IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var p = entityManager.SpawnEntity(MachinePartComponent.Prototypes[part], IoCManager.Resolve().GetComponent(Owner).Coordinates); if (!partContainer.Insert(p)) - throw new Exception($"Couldn't insert machine part of type {part} to machine with prototype {IoCManager.Resolve().GetComponent(Owner.Uid).EntityPrototype?.ID ?? "N/A"}!"); + throw new Exception($"Couldn't insert machine part of type {part} to machine with prototype {IoCManager.Resolve().GetComponent(Owner).EntityPrototype?.ID ?? "N/A"}!"); } } foreach (var (stackType, amount) in machineBoard.MaterialRequirements) { - var stack = EntitySystem.Get().Spawn(amount, stackType, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var stack = EntitySystem.Get().Spawn(amount, stackType, IoCManager.Resolve().GetComponent(Owner).Coordinates); if (!partContainer.Insert(IoCManager.Resolve().GetEntity(stack))) - throw new Exception($"Couldn't insert machine material of type {stackType} to machine with prototype {IoCManager.Resolve().GetComponent(Owner.Uid).EntityPrototype?.ID ?? "N/A"}"); + throw new Exception($"Couldn't insert machine material of type {stackType} to machine with prototype {IoCManager.Resolve().GetComponent(Owner).EntityPrototype?.ID ?? "N/A"}"); } foreach (var (compName, info) in machineBoard.ComponentRequirements) { for (var i = 0; i < info.Amount; i++) { - var c = entityManager.SpawnEntity(info.DefaultPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var c = entityManager.SpawnEntity(info.DefaultPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); if(!partContainer.Insert(c)) - throw new Exception($"Couldn't insert machine component part with default prototype '{compName}' to machine with prototype {IoCManager.Resolve().GetComponent(Owner.Uid).EntityPrototype?.ID ?? "N/A"}"); + throw new Exception($"Couldn't insert machine component part with default prototype '{compName}' to machine with prototype {IoCManager.Resolve().GetComponent(Owner).EntityPrototype?.ID ?? "N/A"}"); } } @@ -109,10 +109,10 @@ namespace Content.Server.Construction.Components { for (var i = 0; i < info.Amount; i++) { - var c = entityManager.SpawnEntity(info.DefaultPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var c = entityManager.SpawnEntity(info.DefaultPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); if(!partContainer.Insert(c)) - throw new Exception($"Couldn't insert machine component part with default prototype '{tagName}' to machine with prototype {IoCManager.Resolve().GetComponent(Owner.Uid).EntityPrototype?.ID ?? "N/A"}"); + throw new Exception($"Couldn't insert machine component part with default prototype '{tagName}' to machine with prototype {IoCManager.Resolve().GetComponent(Owner).EntityPrototype?.ID ?? "N/A"}"); } } } diff --git a/Content.Server/Construction/Components/MachineFrameComponent.cs b/Content.Server/Construction/Components/MachineFrameComponent.cs index 8b53f2dec3..140b3cef9a 100644 --- a/Content.Server/Construction/Components/MachineFrameComponent.cs +++ b/Content.Server/Construction/Components/MachineFrameComponent.cs @@ -122,7 +122,7 @@ namespace Content.Server.Construction.Components RegenerateProgress(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var construction)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var construction)) { // Attempt to set pathfinding to the machine node... EntitySystem.Get().SetPathfindingTarget(OwnerUid, "machine", construction); @@ -168,7 +168,7 @@ namespace Content.Server.Construction.Components if (!HasBoard) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out appearance)) { appearance.SetData(MachineFrameVisuals.State, 1); } @@ -187,10 +187,10 @@ namespace Content.Server.Construction.Components var board = _boardContainer.ContainedEntities[0]; - if (!IoCManager.Resolve().TryGetComponent(board.Uid, out var machineBoard)) + if (!IoCManager.Resolve().TryGetComponent(board, out var machineBoard)) return; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out appearance)) { appearance.SetData(MachineFrameVisuals.State, 2); } @@ -199,7 +199,7 @@ namespace Content.Server.Construction.Components foreach (var part in _partContainer.ContainedEntities) { - if (IoCManager.Resolve().TryGetComponent(part.Uid, out var machinePart)) + if (IoCManager.Resolve().TryGetComponent(part, out var machinePart)) { // Check this is part of the requirements... if (!Requirements.ContainsKey(machinePart.PartType)) @@ -211,7 +211,7 @@ namespace Content.Server.Construction.Components _progress[machinePart.PartType]++; } - if (IoCManager.Resolve().TryGetComponent(part.Uid, out var stack)) + if (IoCManager.Resolve().TryGetComponent(part, out var stack)) { var type = stack.StackTypeId; // Check this is part of the requirements... @@ -229,7 +229,7 @@ namespace Content.Server.Construction.Components { var registration = _componentFactory.GetRegistration(compName); - if (!IoCManager.Resolve().HasComponent(part.Uid, registration.Type)) + if (!IoCManager.Resolve().HasComponent(part, registration.Type)) continue; if (!_componentProgress.ContainsKey(compName)) @@ -254,7 +254,7 @@ namespace Content.Server.Construction.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - if (!HasBoard && IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out var machineBoard)) + if (!HasBoard && IoCManager.Resolve().TryGetComponent(eventArgs.Using, out var machineBoard)) { if (eventArgs.Using.TryRemoveFromContainer()) { @@ -264,12 +264,12 @@ namespace Content.Server.Construction.Components // Setup requirements and progress... ResetProgressAndRequirements(machineBoard); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var appearance)) { appearance.SetData(MachineFrameVisuals.State, 2); } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ConstructionComponent? construction)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ConstructionComponent? construction)) { // So prying the components off works correctly. EntitySystem.Get().ResetEdge(OwnerUid, construction); @@ -280,7 +280,7 @@ namespace Content.Server.Construction.Components } else if (HasBoard) { - if (IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out var machinePart)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.Using, out var machinePart)) { if (!Requirements.ContainsKey(machinePart.PartType)) return false; @@ -293,7 +293,7 @@ namespace Content.Server.Construction.Components } } - if (IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out var stack)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.Using, out var stack)) { var type = stack.StackTypeId; if (!MaterialRequirements.ContainsKey(type)) @@ -314,7 +314,7 @@ namespace Content.Server.Construction.Components return true; } - var splitStack = EntitySystem.Get().Split(eventArgs.Using.Uid, needed, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, stack); + var splitStack = EntitySystem.Get().Split(eventArgs.Using, needed, IoCManager.Resolve().GetComponent(Owner).Coordinates, stack); if (splitStack == null) return false; @@ -333,7 +333,7 @@ namespace Content.Server.Construction.Components var registration = _componentFactory.GetRegistration(compName); - if (!IoCManager.Resolve().HasComponent(eventArgs.Using.Uid, registration.Type)) + if (!IoCManager.Resolve().HasComponent(eventArgs.Using, registration.Type)) continue; if (!eventArgs.Using.TryRemoveFromContainer() || !_partContainer.Insert(eventArgs.Using)) continue; diff --git a/Content.Server/Construction/Components/WelderRefinableComponent.cs b/Content.Server/Construction/Components/WelderRefinableComponent.cs index 0c06e61208..9f67195476 100644 --- a/Content.Server/Construction/Components/WelderRefinableComponent.cs +++ b/Content.Server/Construction/Components/WelderRefinableComponent.cs @@ -41,7 +41,7 @@ namespace Content.Server.Construction.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { // check if object is welder - if (!IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out ToolComponent? tool)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.Using, out ToolComponent? tool)) return false; // check if someone is already welding object @@ -52,7 +52,7 @@ namespace Content.Server.Construction.Components var toolSystem = EntitySystem.Get(); - if (!await toolSystem.UseTool(eventArgs.Using.Uid, eventArgs.User.Uid, Owner.Uid, _refineFuel, _refineTime, _qualityNeeded)) + if (!await toolSystem.UseTool(eventArgs.Using, eventArgs.User, Owner, _refineFuel, _refineTime, _qualityNeeded)) { // failed to veld - abort refine _beingWelded = false; @@ -60,8 +60,8 @@ namespace Content.Server.Construction.Components } // get last owner coordinates and delete it - var resultPosition = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; - IoCManager.Resolve().DeleteEntity(Owner.Uid); + var resultPosition = IoCManager.Resolve().GetComponent(Owner).Coordinates; + IoCManager.Resolve().DeleteEntity((EntityUid) Owner); // spawn each result after refine foreach (var result in _refineResult!) @@ -70,8 +70,8 @@ namespace Content.Server.Construction.Components // TODO: If something has a stack... Just use a prototype with a single thing in the stack. // This is not a good way to do it. - if (IoCManager.Resolve().TryGetComponent(droppedEnt.Uid, out var stack)) - EntitySystem.Get().SetCount(droppedEnt.Uid,1, stack); + if (IoCManager.Resolve().TryGetComponent(droppedEnt, out var stack)) + EntitySystem.Get().SetCount(droppedEnt,1, stack); } return true; diff --git a/Content.Server/Construction/Conditions/AirlockBolted.cs b/Content.Server/Construction/Conditions/AirlockBolted.cs index b9f7b81658..6c7f89e435 100644 --- a/Content.Server/Construction/Conditions/AirlockBolted.cs +++ b/Content.Server/Construction/Conditions/AirlockBolted.cs @@ -31,14 +31,14 @@ namespace Content.Server.Construction.Conditions { var entity = args.Examined; - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out AirlockComponent? airlock)) return false; + if (!IoCManager.Resolve().TryGetComponent(entity, out AirlockComponent? airlock)) return false; if (airlock.BoltsDown != Value) { if (Value == true) - args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-bolt", ("entityName", Name: IoCManager.Resolve().GetComponent(entity.Uid).EntityName)) + "\n"); + args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-bolt", ("entityName", Name: IoCManager.Resolve().GetComponent(entity).EntityName)) + "\n"); else - args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-unbolt", ("entityName", Name: IoCManager.Resolve().GetComponent(entity.Uid).EntityName)) + "\n"); + args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-unbolt", ("entityName", Name: IoCManager.Resolve().GetComponent(entity).EntityName)) + "\n"); return true; } diff --git a/Content.Server/Construction/Conditions/ComponentInTile.cs b/Content.Server/Construction/Conditions/ComponentInTile.cs index 0c14f7ad52..2449b2cfc6 100644 --- a/Content.Server/Construction/Conditions/ComponentInTile.cs +++ b/Content.Server/Construction/Conditions/ComponentInTile.cs @@ -56,7 +56,7 @@ namespace Content.Server.Construction.Conditions foreach (var ent in entities) { - if (IoCManager.Resolve().HasComponent(ent.Uid, type)) + if (IoCManager.Resolve().HasComponent(ent, type)) return HasEntity; } diff --git a/Content.Server/Construction/Conditions/ContainerEmpty.cs b/Content.Server/Construction/Conditions/ContainerEmpty.cs index 1dfec7202b..be149bb975 100644 --- a/Content.Server/Construction/Conditions/ContainerEmpty.cs +++ b/Content.Server/Construction/Conditions/ContainerEmpty.cs @@ -45,7 +45,7 @@ namespace Content.Server.Construction.Conditions var entity = args.Examined; - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out ContainerManagerComponent? containerManager) || + if (!IoCManager.Resolve().TryGetComponent(entity, out ContainerManagerComponent? containerManager) || !containerManager.TryGetContainer(Container, out var container)) return false; if (container.ContainedEntities.Count == 0) diff --git a/Content.Server/Construction/Conditions/ContainerNotEmpty.cs b/Content.Server/Construction/Conditions/ContainerNotEmpty.cs index 343c0e8f4a..5daa7b61f0 100644 --- a/Content.Server/Construction/Conditions/ContainerNotEmpty.cs +++ b/Content.Server/Construction/Conditions/ContainerNotEmpty.cs @@ -38,7 +38,7 @@ namespace Content.Server.Construction.Conditions var entity = args.Examined; - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out ContainerManagerComponent? containerManager) || + if (!IoCManager.Resolve().TryGetComponent(entity, out ContainerManagerComponent? containerManager) || !containerManager.TryGetContainer(Container, out var container)) return false; if (container.ContainedEntities.Count != 0) diff --git a/Content.Server/Construction/Conditions/DoorWelded.cs b/Content.Server/Construction/Conditions/DoorWelded.cs index c382f8bdc5..34809ef82c 100644 --- a/Content.Server/Construction/Conditions/DoorWelded.cs +++ b/Content.Server/Construction/Conditions/DoorWelded.cs @@ -29,14 +29,14 @@ namespace Content.Server.Construction.Conditions { var entity = args.Examined; - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out ServerDoorComponent? door)) return false; + if (!IoCManager.Resolve().TryGetComponent(entity, out ServerDoorComponent? door)) return false; if (door.IsWeldedShut != Welded) { if (Welded == true) - args.PushMarkup(Loc.GetString("construction-examine-condition-door-weld", ("entityName", Name: IoCManager.Resolve().GetComponent(entity.Uid).EntityName)) + "\n"); + args.PushMarkup(Loc.GetString("construction-examine-condition-door-weld", ("entityName", Name: IoCManager.Resolve().GetComponent(entity).EntityName)) + "\n"); else - args.PushMarkup(Loc.GetString("construction-examine-condition-door-unweld", ("entityName", Name: IoCManager.Resolve().GetComponent(entity.Uid).EntityName)) + "\n"); + args.PushMarkup(Loc.GetString("construction-examine-condition-door-unweld", ("entityName", Name: IoCManager.Resolve().GetComponent(entity).EntityName)) + "\n"); return true; } diff --git a/Content.Server/Construction/Conditions/EntityAnchored.cs b/Content.Server/Construction/Conditions/EntityAnchored.cs index 38a15bf104..32d9244028 100644 --- a/Content.Server/Construction/Conditions/EntityAnchored.cs +++ b/Content.Server/Construction/Conditions/EntityAnchored.cs @@ -30,10 +30,10 @@ namespace Content.Server.Construction.Conditions switch (Anchored) { - case true when !IoCManager.Resolve().GetComponent(entity.Uid).Anchored: + case true when !IoCManager.Resolve().GetComponent(entity).Anchored: args.PushMarkup(Loc.GetString("construction-examine-condition-entity-anchored")); return true; - case false when IoCManager.Resolve().GetComponent(entity.Uid).Anchored: + case false when IoCManager.Resolve().GetComponent(entity).Anchored: args.PushMarkup(Loc.GetString("construction-examine-condition-entity-unanchored")); return true; } diff --git a/Content.Server/Construction/Conditions/MachineFrameComplete.cs b/Content.Server/Construction/Conditions/MachineFrameComplete.cs index 616915f404..7e4fec885a 100644 --- a/Content.Server/Construction/Conditions/MachineFrameComplete.cs +++ b/Content.Server/Construction/Conditions/MachineFrameComplete.cs @@ -38,7 +38,7 @@ namespace Content.Server.Construction.Conditions { var entity = args.Examined; - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out var machineFrame)) + if (!IoCManager.Resolve().TryGetComponent(entity, out var machineFrame)) return false; if (!machineFrame.HasBoard) diff --git a/Content.Server/Construction/Conditions/ToiletLidClosed.cs b/Content.Server/Construction/Conditions/ToiletLidClosed.cs index f5969af0e1..52aca37833 100644 --- a/Content.Server/Construction/Conditions/ToiletLidClosed.cs +++ b/Content.Server/Construction/Conditions/ToiletLidClosed.cs @@ -26,7 +26,7 @@ namespace Content.Server.Construction.Conditions { var entity = args.Examined; - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out ToiletComponent? toilet)) return false; + if (!IoCManager.Resolve().TryGetComponent(entity, out ToiletComponent? toilet)) return false; if (!toilet.LidOpen) return false; args.PushMarkup(Loc.GetString("construction-examine-condition-toilet-lid-closed") + "\n"); diff --git a/Content.Server/Construction/Conditions/WirePanel.cs b/Content.Server/Construction/Conditions/WirePanel.cs index b42bc65f91..9a818ea1ae 100644 --- a/Content.Server/Construction/Conditions/WirePanel.cs +++ b/Content.Server/Construction/Conditions/WirePanel.cs @@ -30,7 +30,7 @@ namespace Content.Server.Construction.Conditions { var entity = args.Examined; - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out WiresComponent? wires)) return false; + if (!IoCManager.Resolve().TryGetComponent(entity, out WiresComponent? wires)) return false; switch (Open) { diff --git a/Content.Server/Construction/ConstructionSystem.Graph.cs b/Content.Server/Construction/ConstructionSystem.Graph.cs index 128273bdb8..2269e205ba 100644 --- a/Content.Server/Construction/ConstructionSystem.Graph.cs +++ b/Content.Server/Construction/ConstructionSystem.Graph.cs @@ -166,7 +166,8 @@ namespace Content.Server.Construction Resolve(uid, ref containerManager, false); // We create the new entity. - var newUid = EntityManager.SpawnEntity(newEntity, transform.Coordinates).Uid; + IEntity tempQualifier = EntityManager.SpawnEntity(newEntity, transform.Coordinates); + var newUid = (EntityUid) tempQualifier; // Construction transferring. var newConstruction = EntityManager.EnsureComponent(newUid); diff --git a/Content.Server/Construction/ConstructionSystem.Initial.cs b/Content.Server/Construction/ConstructionSystem.Initial.cs index eb491bf9fc..0ff0fd6f82 100644 --- a/Content.Server/Construction/ConstructionSystem.Initial.cs +++ b/Content.Server/Construction/ConstructionSystem.Initial.cs @@ -45,11 +45,11 @@ namespace Content.Server.Construction // LEGACY CODE. See warning at the top of the file! private IEnumerable EnumerateNearby(IEntity user) { - if (IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? hands)) + if (IoCManager.Resolve().TryGetComponent(user, out HandsComponent? hands)) { foreach (var itemComponent in hands?.GetAllHeldItems()!) { - if (IoCManager.Resolve().TryGetComponent(itemComponent.Owner.Uid, out ServerStorageComponent? storage)) + if (IoCManager.Resolve().TryGetComponent(itemComponent.Owner, out ServerStorageComponent? storage)) { foreach (var storedEntity in storage.StoredEntities!) { @@ -61,11 +61,11 @@ namespace Content.Server.Construction } } - if (IoCManager.Resolve().TryGetComponent(user!.Uid, out InventoryComponent? inventory)) + if (IoCManager.Resolve().TryGetComponent(user!, out InventoryComponent? inventory)) { foreach (var held in inventory.GetAllHeldItems()) { - if (IoCManager.Resolve().TryGetComponent(held.Uid, out ServerStorageComponent? storage)) + if (IoCManager.Resolve().TryGetComponent(held, out ServerStorageComponent? storage)) { foreach (var storedEntity in storage.StoredEntities!) { @@ -164,7 +164,7 @@ namespace Content.Server.Construction if (!materialStep.EntityValid(entity, out var stack)) continue; - var splitStack = _stackSystem.Split(entity.Uid, materialStep.Amount, user.ToCoordinates(), stack); + var splitStack = _stackSystem.Split(entity, materialStep.Amount, user.ToCoordinates(), stack); if (splitStack == null) continue; @@ -186,7 +186,7 @@ namespace Content.Server.Construction case ArbitraryInsertConstructionGraphStep arbitraryStep: foreach (var entity in EnumerateNearby(user)) { - if (!arbitraryStep.EntityValid(entity.Uid, EntityManager)) + if (!arbitraryStep.EntityValid(entity, EntityManager)) continue; if (string.IsNullOrEmpty(arbitraryStep.Store)) @@ -235,13 +235,13 @@ namespace Content.Server.Construction return null; } - var newEntity = EntityManager.SpawnEntity(graph.Nodes[edge.Target].Entity, IoCManager.Resolve().GetComponent(user.Uid).Coordinates); + var newEntity = EntityManager.SpawnEntity(graph.Nodes[edge.Target].Entity, IoCManager.Resolve().GetComponent(user).Coordinates); // Yes, this should throw if it's missing the component. - var construction = IoCManager.Resolve().GetComponent(newEntity.Uid); + var construction = IoCManager.Resolve().GetComponent(newEntity); // We attempt to set the pathfinding target. - SetPathfindingTarget(newEntity.Uid, targetNode.Name, construction); + SetPathfindingTarget(newEntity, targetNode.Name, construction); // We preserve the containers... foreach (var (name, cont) in containers) @@ -263,14 +263,14 @@ namespace Content.Server.Construction { foreach (var completed in step.Completed) { - completed.PerformAction(newEntity.Uid, user.Uid, EntityManager); + completed.PerformAction(newEntity, user, EntityManager); } } // And we also have edge completed effects! foreach (var completed in edge.Completed) { - completed.PerformAction(newEntity.Uid, user.Uid, EntityManager); + completed.PerformAction(newEntity, user, EntityManager); } return newEntity; @@ -297,9 +297,9 @@ namespace Content.Server.Construction var user = args.SenderSession.AttachedEntity; - if (user == null || !Get().CanInteract(user.Uid)) return; + if (user == null || !Get().CanInteract(user)) return; - if (!IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? hands)) return; + if (!IoCManager.Resolve().TryGetComponent(user, out HandsComponent? hands)) return; foreach (var condition in constructionPrototype.Conditions) { @@ -328,7 +328,7 @@ namespace Content.Server.Construction var item = await Construct(user, "item_construction", constructionGraph, edge, targetNode); - if(item != null && IoCManager.Resolve().TryGetComponent(item.Uid, out ItemComponent? itemComp)) + if(item != null && IoCManager.Resolve().TryGetComponent(item, out ItemComponent? itemComp)) hands.PutInHandOrDrop(itemComp); } @@ -398,8 +398,8 @@ namespace Content.Server.Construction } if (user == null - || !Get().CanInteract(user.Uid) - || !IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? hands) || hands.GetActiveHand == null + || !Get().CanInteract(user) + || !IoCManager.Resolve().TryGetComponent(user, out HandsComponent? hands) || hands.GetActiveHand == null || !user.InRangeUnobstructed(ev.Location, ignoreInsideBlocker:constructionPrototype.CanBuildInImpassable)) { Cleanup(); @@ -430,7 +430,7 @@ namespace Content.Server.Construction switch (step) { case EntityInsertConstructionGraphStep entityInsert: - if (entityInsert.EntityValid(holding.Uid, EntityManager)) + if (entityInsert.EntityValid(holding, EntityManager)) valid = true; break; case ToolConstructionGraphStep _: @@ -457,13 +457,13 @@ namespace Content.Server.Construction // We do this to be able to move the construction to its proper position in case it's anchored... // Oh wow transform anchoring is amazing wow I love it!!!! - var wasAnchored = IoCManager.Resolve().GetComponent(structure.Uid).Anchored; - IoCManager.Resolve().GetComponent(structure.Uid).Anchored = false; + var wasAnchored = IoCManager.Resolve().GetComponent(structure).Anchored; + IoCManager.Resolve().GetComponent(structure).Anchored = false; - IoCManager.Resolve().GetComponent(structure.Uid).Coordinates = ev.Location; - IoCManager.Resolve().GetComponent(structure.Uid).LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.Zero; + IoCManager.Resolve().GetComponent(structure).Coordinates = ev.Location; + IoCManager.Resolve().GetComponent(structure).LocalRotation = constructionPrototype.CanRotate ? ev.Angle : Angle.Zero; - IoCManager.Resolve().GetComponent(structure.Uid).Anchored = wasAnchored; + IoCManager.Resolve().GetComponent(structure).Anchored = wasAnchored; RaiseNetworkEvent(new AckStructureConstructionMessage(ev.Ack)); diff --git a/Content.Server/Construction/ConstructionSystem.Interactions.cs b/Content.Server/Construction/ConstructionSystem.Interactions.cs index 30a95d9d81..b79e3105db 100644 --- a/Content.Server/Construction/ConstructionSystem.Interactions.cs +++ b/Content.Server/Construction/ConstructionSystem.Interactions.cs @@ -349,13 +349,13 @@ namespace Content.Server.Construction // TODO: Sanity checks. - user = interactUsing.User.Uid; + user = interactUsing.User; // If we're validating whether this event handles the step... if (doAfterState == DoAfterState.Validation) { // Then we only really need to check whether the tool entity has that quality or not. - return _toolSystem.HasQuality(interactUsing.Used.Uid, toolInsertStep.Tool) + return _toolSystem.HasQuality(interactUsing.Used, toolInsertStep.Tool) ? HandleResult.Validated : HandleResult.False; } @@ -363,7 +363,7 @@ namespace Content.Server.Construction if (doAfterState != DoAfterState.None) return doAfterState == DoAfterState.Completed ? HandleResult.True : HandleResult.False; - if (!_toolSystem.UseTool(interactUsing.Used.Uid, interactUsing.User.Uid, + if (!_toolSystem.UseTool(interactUsing.Used, interactUsing.User, uid, toolInsertStep.Fuel, toolInsertStep.DoAfter, toolInsertStep.Tool, new ConstructionDoAfterComplete(uid, ev), new ConstructionDoAfterCancelled(uid, ev))) return HandleResult.False; diff --git a/Content.Server/Construction/ConstructionSystem.cs b/Content.Server/Construction/ConstructionSystem.cs index bec83689c1..b4c9740239 100644 --- a/Content.Server/Construction/ConstructionSystem.cs +++ b/Content.Server/Construction/ConstructionSystem.cs @@ -51,13 +51,13 @@ namespace Content.Server.Construction { if (GetCurrentGraph(uid, construction) is not {} graph) { - _sawmill.Warning($"Prototype {IoCManager.Resolve().GetComponent(construction.Owner.Uid).EntityPrototype?.ID}'s construction component has an invalid graph specified."); + _sawmill.Warning($"Prototype {IoCManager.Resolve().GetComponent(construction.Owner).EntityPrototype?.ID}'s construction component has an invalid graph specified."); return; } if (GetNodeFromGraph(graph, construction.Node) is not {} node) { - _sawmill.Warning($"Prototype {IoCManager.Resolve().GetComponent(construction.Owner.Uid).EntityPrototype?.ID}'s construction component has an invalid node specified."); + _sawmill.Warning($"Prototype {IoCManager.Resolve().GetComponent(construction.Owner).EntityPrototype?.ID}'s construction component has an invalid node specified."); return; } @@ -66,7 +66,7 @@ namespace Content.Server.Construction { if (GetEdgeFromNode(node, edgeIndex) is not {} currentEdge) { - _sawmill.Warning($"Prototype {IoCManager.Resolve().GetComponent(construction.Owner.Uid).EntityPrototype?.ID}'s construction component has an invalid edge index specified."); + _sawmill.Warning($"Prototype {IoCManager.Resolve().GetComponent(construction.Owner).EntityPrototype?.ID}'s construction component has an invalid edge index specified."); return; } @@ -77,7 +77,7 @@ namespace Content.Server.Construction { if (GetNodeFromGraph(graph, targetNodeId) is not { } targetNode) { - _sawmill.Warning($"Prototype {IoCManager.Resolve().GetComponent(construction.Owner.Uid).EntityPrototype?.ID}'s construction component has an invalid target node specified."); + _sawmill.Warning($"Prototype {IoCManager.Resolve().GetComponent(construction.Owner).EntityPrototype?.ID}'s construction component has an invalid target node specified."); return; } diff --git a/Content.Server/Containers/ContainerExt.cs b/Content.Server/Containers/ContainerExt.cs index 698f9ef2d9..c66bc7b8f5 100644 --- a/Content.Server/Containers/ContainerExt.cs +++ b/Content.Server/Containers/ContainerExt.cs @@ -14,8 +14,8 @@ namespace Content.Server.Containers { foreach (var entity in container.ContainedEntities) { - if (IoCManager.Resolve().GetComponent(entity.Uid).EntityPrototype?.ID == prototypeId) total++; - if(!IoCManager.Resolve().TryGetComponent(entity.Uid, out var component)) continue; + if (IoCManager.Resolve().GetComponent(entity).EntityPrototype?.ID == prototypeId) total++; + if(!IoCManager.Resolve().TryGetComponent(entity, out var component)) continue; total += component.CountPrototypeOccurencesRecursive(prototypeId); } } diff --git a/Content.Server/Containers/EmptyOnMachineDeconstructSystem.cs b/Content.Server/Containers/EmptyOnMachineDeconstructSystem.cs index 43d87404c1..91497ceae9 100644 --- a/Content.Server/Containers/EmptyOnMachineDeconstructSystem.cs +++ b/Content.Server/Containers/EmptyOnMachineDeconstructSystem.cs @@ -35,7 +35,7 @@ namespace Content.Server.Containers { if (!EntityManager.TryGetComponent(uid, out var mComp)) return; - var baseCoords = IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates; + var baseCoords = IoCManager.Resolve().GetComponent(component.Owner).Coordinates; foreach (var v in component.Containers) { if (mComp.TryGetContainer(v, out var container)) diff --git a/Content.Server/Conveyor/ConveyorSystem.cs b/Content.Server/Conveyor/ConveyorSystem.cs index b2271be56b..8578013aab 100644 --- a/Content.Server/Conveyor/ConveyorSystem.cs +++ b/Content.Server/Conveyor/ConveyorSystem.cs @@ -42,9 +42,9 @@ namespace Content.Server.Conveyor private void UpdateAppearance(ConveyorComponent component) { - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out var appearance)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out var appearance)) { - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out var receiver) && receiver.Powered) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out var receiver) && receiver.Powered) { appearance.SetData(ConveyorVisuals.State, component.State); } @@ -100,13 +100,13 @@ namespace Content.Server.Conveyor return false; } - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out ApcPowerReceiverComponent? receiver) && + if (IoCManager.Resolve().TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver) && !receiver.Powered) { return false; } - if (IoCManager.Resolve().HasComponent(component.Owner.Uid)) + if (IoCManager.Resolve().HasComponent(component.Owner)) { return false; } @@ -126,7 +126,7 @@ namespace Content.Server.Conveyor var adjustment = component.State == ConveyorState.Reversed ? MathHelper.Pi/2 : -MathHelper.Pi/2; var radians = MathHelper.DegreesToRadians(component.Angle); - return new Angle(IoCManager.Resolve().GetComponent(component.Owner.Uid).LocalRotation.Theta + radians + adjustment); + return new Angle(IoCManager.Resolve().GetComponent(component.Owner).LocalRotation.Theta + radians + adjustment); } public IEnumerable<(IEntity, IPhysBody)> GetEntitiesToMove(ConveyorComponent comp) @@ -134,7 +134,7 @@ namespace Content.Server.Conveyor //todo uuuhhh cache this foreach (var entity in _entityLookup.GetEntitiesIntersecting(comp.Owner, flags: LookupFlags.Approximate)) { - if ((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Deleted) { continue; } @@ -144,13 +144,13 @@ namespace Content.Server.Conveyor continue; } - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? physics) || + if (!IoCManager.Resolve().TryGetComponent(entity, out IPhysBody? physics) || physics.BodyType == BodyType.Static || physics.BodyStatus == BodyStatus.InAir || entity.IsWeightless()) { continue; } - if (IoCManager.Resolve().HasComponent(entity.Uid)) + if (IoCManager.Resolve().HasComponent(entity)) { continue; } diff --git a/Content.Server/Coordinates/Helpers/SnapgridHelper.cs b/Content.Server/Coordinates/Helpers/SnapgridHelper.cs index 8797ec13a8..f0a82884ee 100644 --- a/Content.Server/Coordinates/Helpers/SnapgridHelper.cs +++ b/Content.Server/Coordinates/Helpers/SnapgridHelper.cs @@ -9,7 +9,7 @@ namespace Content.Server.Coordinates.Helpers { public static void SnapToGrid(this IEntity entity, IEntityManager? entityManager = null, IMapManager? mapManager = null) { - IoCManager.Resolve().GetComponent(entity.Uid).Coordinates = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.SnapToGrid(entityManager, mapManager); + IoCManager.Resolve().GetComponent(entity).Coordinates = IoCManager.Resolve().GetComponent(entity).Coordinates.SnapToGrid(entityManager, mapManager); } public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, IEntityManager? entityManager = null, IMapManager? mapManager = null) diff --git a/Content.Server/Crayon/CrayonComponent.cs b/Content.Server/Crayon/CrayonComponent.cs index 9280e9fe65..c863e18ec9 100644 --- a/Content.Server/Crayon/CrayonComponent.cs +++ b/Content.Server/Crayon/CrayonComponent.cs @@ -97,7 +97,7 @@ namespace Content.Server.Crayon // Opens the selection window bool IUse.UseEntity(UseEntityEventArgs eventArgs) { - if (IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) { UserInterface?.Toggle(actor.PlayerSession); if (UserInterface?.SessionHasOpen(actor.PlayerSession) == true) @@ -132,7 +132,7 @@ namespace Content.Server.Crayon } var entity = IoCManager.Resolve().SpawnEntity("CrayonDecal", eventArgs.ClickLocation); - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(entity, out AppearanceComponent? appearance)) { appearance.SetData(CrayonVisuals.State, SelectedState); appearance.SetData(CrayonVisuals.Color, _color); @@ -150,7 +150,7 @@ namespace Content.Server.Crayon void IDropped.Dropped(DroppedEventArgs eventArgs) { - if (IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) UserInterface?.Close(actor.PlayerSession); } } diff --git a/Content.Server/Cuffs/Components/CuffableComponent.cs b/Content.Server/Cuffs/Components/CuffableComponent.cs index cec5bf60fd..e7b5389d05 100644 --- a/Content.Server/Cuffs/Components/CuffableComponent.cs +++ b/Content.Server/Cuffs/Components/CuffableComponent.cs @@ -67,7 +67,7 @@ namespace Content.Server.Cuffs.Components if (CuffedHandCount > 0) { - if (IoCManager.Resolve().TryGetComponent(LastAddedCuffs.Uid, out var cuffs)) + if (IoCManager.Resolve().TryGetComponent(LastAddedCuffs, out var cuffs)) { return new CuffableComponentState(CuffedHandCount, CanStillInteract, @@ -92,7 +92,7 @@ namespace Content.Server.Cuffs.Components /// public bool TryAddNewCuffs(IEntity user, IEntity handcuff) { - if (!IoCManager.Resolve().HasComponent(handcuff.Uid)) + if (!IoCManager.Resolve().HasComponent(handcuff)) { Logger.Warning($"Handcuffs being applied to player are missing a {nameof(HandcuffComponent)}!"); return false; @@ -105,14 +105,14 @@ namespace Content.Server.Cuffs.Components } // Success! - if (IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? handsComponent) && handsComponent.IsHolding(handcuff)) + if (IoCManager.Resolve().TryGetComponent(user, out HandsComponent? handsComponent) && handsComponent.IsHolding(handcuff)) { // Good lord handscomponent is scuffed, I hope some smug person will fix it someday handsComponent.Drop(handcuff); } Container.Insert(handcuff); - CanStillInteract = IoCManager.Resolve().TryGetComponent(Owner.Uid, out HandsComponent? ownerHands) && ownerHands.HandNames.Count() > CuffedHandCount; + CanStillInteract = IoCManager.Resolve().TryGetComponent(Owner, out HandsComponent? ownerHands) && ownerHands.HandNames.Count() > CuffedHandCount; OnCuffedStateChanged?.Invoke(); UpdateAlert(); @@ -132,7 +132,7 @@ namespace Content.Server.Cuffs.Components /// public void UpdateHeldItems() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out HandsComponent? handsComponent)) return; + if (!IoCManager.Resolve().TryGetComponent(Owner, out HandsComponent? handsComponent)) return; var itemCount = handsComponent.GetAllHeldItems().Count(); var freeHandCount = handsComponent.HandNames.Count() - CuffedHandCount; @@ -159,7 +159,7 @@ namespace Content.Server.Cuffs.Components /// private void UpdateAlert() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ServerAlertsComponent? status)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ServerAlertsComponent? status)) { if (CanStillInteract) { @@ -201,14 +201,14 @@ namespace Content.Server.Cuffs.Components } } - if (!IoCManager.Resolve().TryGetComponent(cuffsToRemove.Uid, out var cuff)) + if (!IoCManager.Resolve().TryGetComponent(cuffsToRemove, out var cuff)) { Logger.Warning($"A user is trying to remove handcuffs without a {nameof(HandcuffComponent)}. This should never happen!"); return; } - var attempt = new UncuffAttemptEvent(user.Uid, Owner.Uid); - IoCManager.Resolve().EventBus.RaiseLocalEvent(user.Uid, attempt); + var attempt = new UncuffAttemptEvent(user, Owner); + IoCManager.Resolve().EventBus.RaiseLocalEvent(user, attempt); if (attempt.Cancelled) { @@ -260,23 +260,23 @@ namespace Content.Server.Cuffs.Components SoundSystem.Play(Filter.Pvs(Owner), cuff.EndUncuffSound.GetSound(), Owner); Container.ForceRemove(cuffsToRemove); - IoCManager.Resolve().GetComponent(cuffsToRemove.Uid).AttachToGridOrMap(); - IoCManager.Resolve().GetComponent(cuffsToRemove.Uid).WorldPosition = IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition; + IoCManager.Resolve().GetComponent(cuffsToRemove).AttachToGridOrMap(); + IoCManager.Resolve().GetComponent(cuffsToRemove).WorldPosition = IoCManager.Resolve().GetComponent(Owner).WorldPosition; if (cuff.BreakOnRemove) { cuff.Broken = true; - IoCManager.Resolve().GetComponent(cuffsToRemove.Uid).EntityName = cuff.BrokenName; - IoCManager.Resolve().GetComponent(cuffsToRemove.Uid).EntityDescription = cuff.BrokenDesc; + IoCManager.Resolve().GetComponent(cuffsToRemove).EntityName = cuff.BrokenName; + IoCManager.Resolve().GetComponent(cuffsToRemove).EntityDescription = cuff.BrokenDesc; - if (IoCManager.Resolve().TryGetComponent(cuffsToRemove.Uid, out var sprite) && cuff.BrokenState != null) + if (IoCManager.Resolve().TryGetComponent(cuffsToRemove, out var sprite) && cuff.BrokenState != null) { sprite.LayerSetState(0, cuff.BrokenState); // TODO: safety check to see if RSI contains the state? } } - CanStillInteract = IoCManager.Resolve().TryGetComponent(Owner.Uid, out HandsComponent? handsComponent) && handsComponent.HandNames.Count() > CuffedHandCount; + CanStillInteract = IoCManager.Resolve().TryGetComponent(Owner, out HandsComponent? handsComponent) && handsComponent.HandNames.Count() > CuffedHandCount; OnCuffedStateChanged?.Invoke(); UpdateAlert(); Dirty(); diff --git a/Content.Server/Cuffs/Components/HandcuffComponent.cs b/Content.Server/Cuffs/Components/HandcuffComponent.cs index e5cf45d265..251c3120cf 100644 --- a/Content.Server/Cuffs/Components/HandcuffComponent.cs +++ b/Content.Server/Cuffs/Components/HandcuffComponent.cs @@ -148,7 +148,7 @@ namespace Content.Server.Cuffs.Components { if (_cuffing) return true; - if (eventArgs.Target == null || !EntitySystem.Get().CanUse(eventArgs.User.Uid) || !IoCManager.Resolve().TryGetComponent(eventArgs.Target.Uid, out var cuffed)) + if (eventArgs.Target == null || !EntitySystem.Get().CanUse(eventArgs.User) || !IoCManager.Resolve().TryGetComponent(eventArgs.Target, out var cuffed)) { return false; } @@ -165,7 +165,7 @@ namespace Content.Server.Cuffs.Components return true; } - if (!IoCManager.Resolve().TryGetComponent(eventArgs.Target.Uid, out var hands)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.Target, out var hands)) { eventArgs.User.PopupMessage(Loc.GetString("handcuff-component-target-has-no-hands-error",("targetName", eventArgs.Target))); return true; @@ -199,7 +199,7 @@ namespace Content.Server.Cuffs.Components { var cuffTime = CuffTime; - if (IoCManager.Resolve().HasComponent(target.Uid)) + if (IoCManager.Resolve().HasComponent(target)) { cuffTime = MathF.Max(0.1f, cuffTime - StunBonus); } diff --git a/Content.Server/Cuffs/CuffableSystem.cs b/Content.Server/Cuffs/CuffableSystem.cs index 837206a7fd..b056e6891a 100644 --- a/Content.Server/Cuffs/CuffableSystem.cs +++ b/Content.Server/Cuffs/CuffableSystem.cs @@ -66,7 +66,7 @@ namespace Content.Server.Cuffs if (args.User == args.Target) { // This UncuffAttemptEvent check should probably be In MobStateSystem, not here? - if (IoCManager.Resolve().TryGetComponent(userEntity.Uid, out var state)) + if (IoCManager.Resolve().TryGetComponent(userEntity, out var state)) { // Manually check this. if (state.IsIncapacitated()) @@ -83,14 +83,14 @@ namespace Content.Server.Cuffs else { // Check if the user can interact. - if (!_actionBlockerSystem.CanInteract(userEntity.Uid)) + if (!_actionBlockerSystem.CanInteract(userEntity)) { args.Cancel(); } } if (args.Cancelled) { - _popupSystem.PopupEntity(Loc.GetString("cuffable-component-cannot-interact-message"), args.Target, Filter.Entities(userEntity.Uid)); + _popupSystem.PopupEntity(Loc.GetString("cuffable-component-cannot-interact-message"), args.Target, Filter.Entities(userEntity)); } } @@ -101,11 +101,11 @@ namespace Content.Server.Cuffs { var owner = message.Sender; - if (!IoCManager.Resolve().TryGetComponent(owner.Uid, out CuffableComponent? cuffable) || + if (!IoCManager.Resolve().TryGetComponent(owner, out CuffableComponent? cuffable) || !cuffable.Initialized) return; var dirty = false; - var handCount = IoCManager.Resolve().GetComponentOrNull(owner.Uid)?.Count ?? 0; + var handCount = IoCManager.Resolve().GetComponentOrNull(owner)?.Count ?? 0; while (cuffable.CuffedHandCount > handCount && cuffable.CuffedHandCount > 0) { @@ -115,7 +115,7 @@ namespace Content.Server.Cuffs var entity = container.ContainedEntities[^1]; container.Remove(entity); - IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition = IoCManager.Resolve().GetComponent(owner.Uid).WorldPosition; + IoCManager.Resolve().GetComponent(entity).WorldPosition = IoCManager.Resolve().GetComponent(owner).WorldPosition; } if (dirty) diff --git a/Content.Server/Damage/Commands/HurtCommand.cs b/Content.Server/Damage/Commands/HurtCommand.cs index c3eda3b14d..b20c4c5fdb 100644 --- a/Content.Server/Damage/Commands/HurtCommand.cs +++ b/Content.Server/Damage/Commands/HurtCommand.cs @@ -104,9 +104,9 @@ namespace Content.Server.Damage.Commands func = (entity, ignoreResistances) => { var damage = new DamageSpecifier(damageGroup, amount); - EntitySystem.Get().TryChangeDamage(entity.Uid, damage, ignoreResistances); + EntitySystem.Get().TryChangeDamage(entity, damage, ignoreResistances); - shell.WriteLine($"Damaged entity {IoCManager.Resolve().GetComponent(entity.Uid).EntityName} with id {entity.Uid} for {amount} {damageGroup} damage{(ignoreResistances ? ", ignoring resistances." : ".")}"); + shell.WriteLine($"Damaged entity {IoCManager.Resolve().GetComponent(entity).EntityName} with id {entity} for {amount} {damageGroup} damage{(ignoreResistances ? ", ignoring resistances." : ".")}"); }; return true; @@ -117,9 +117,9 @@ namespace Content.Server.Damage.Commands func = (entity, ignoreResistances) => { var damage = new DamageSpecifier(damageType, amount); - EntitySystem.Get().TryChangeDamage(entity.Uid, damage, ignoreResistances); + EntitySystem.Get().TryChangeDamage(entity, damage, ignoreResistances); - shell.WriteLine($"Damaged entity {IoCManager.Resolve().GetComponent(entity.Uid).EntityName} with id {entity.Uid} for {amount} {damageType} damage{(ignoreResistances ? ", ignoring resistances." : ".")}"); + shell.WriteLine($"Damaged entity {IoCManager.Resolve().GetComponent(entity).EntityName} with id {entity} for {amount} {damageType} damage{(ignoreResistances ? ", ignoring resistances." : ".")}"); }; return true; @@ -197,9 +197,9 @@ namespace Content.Server.Damage.Commands return; } - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out DamageableComponent? damageable)) + if (!IoCManager.Resolve().TryGetComponent(entity, out DamageableComponent? damageable)) { - shell.WriteLine($"Entity {IoCManager.Resolve().GetComponent(entity.Uid).EntityName} with id {entity.Uid} does not have a {nameof(DamageableComponent)}."); + shell.WriteLine($"Entity {IoCManager.Resolve().GetComponent(entity).EntityName} with id {entity} does not have a {nameof(DamageableComponent)}."); return; } diff --git a/Content.Server/Damage/Systems/DamageOnToolInteractSystem.cs b/Content.Server/Damage/Systems/DamageOnToolInteractSystem.cs index 7aff24d612..68b231ab05 100644 --- a/Content.Server/Damage/Systems/DamageOnToolInteractSystem.cs +++ b/Content.Server/Damage/Systems/DamageOnToolInteractSystem.cs @@ -28,10 +28,10 @@ namespace Content.Server.Damage.Systems return; if (component.WeldingDamage is {} weldingDamage - && IoCManager.Resolve().TryGetComponent(args.Used.Uid, out var welder) + && IoCManager.Resolve().TryGetComponent(args.Used, out var welder) && welder.Lit) { - var dmg = _damageableSystem.TryChangeDamage(args.Target.Uid, weldingDamage); + var dmg = _damageableSystem.TryChangeDamage(args.Target, weldingDamage); if (dmg != null) _logSystem.Add(LogType.Damaged, @@ -40,10 +40,10 @@ namespace Content.Server.Damage.Systems args.Handled = true; } else if (component.DefaultDamage is {} damage - && IoCManager.Resolve().TryGetComponent(args.Used.Uid, out var tool) + && IoCManager.Resolve().TryGetComponent(args.Used, out var tool) && tool.Qualities.ContainsAny(component.Tools)) { - var dmg = _damageableSystem.TryChangeDamage(args.Target.Uid, damage); + var dmg = _damageableSystem.TryChangeDamage(args.Target, damage); if (dmg != null) _logSystem.Add(LogType.Damaged, diff --git a/Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs b/Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs index 8f7d1f4aca..da72fe3455 100644 --- a/Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs +++ b/Content.Server/Damage/Systems/DamageOtherOnHitSystem.cs @@ -21,7 +21,7 @@ namespace Content.Server.Damage.Systems private void OnDoHit(EntityUid uid, DamageOtherOnHitComponent component, ThrowDoHitEvent args) { - var dmg = _damageableSystem.TryChangeDamage(args.Target.Uid, component.Damage, component.IgnoreResistances); + var dmg = _damageableSystem.TryChangeDamage(args.Target, component.Damage, component.IgnoreResistances); if (dmg != null) _logSystem.Add(LogType.ThrowHit, $"{args.Target} received {dmg.Total} damage from collision"); } diff --git a/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs index 19cd984791..bdf7172f1a 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs @@ -34,8 +34,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors if (EntityPrototypeHelpers.HasComponent(entityId)) { var spawned = system.EntityManager.SpawnEntity(entityId, position); - var stack = IoCManager.Resolve().GetComponent(spawned.Uid); - EntitySystem.Get().SetCount(spawned.Uid, count, stack); + var stack = IoCManager.Resolve().GetComponent(spawned); + EntitySystem.Get().SetCount(spawned, count, stack); spawned.RandomOffset(0.5f); } else diff --git a/Content.Server/DeviceNetwork/Systems/ApcNetworkSystem.cs b/Content.Server/DeviceNetwork/Systems/ApcNetworkSystem.cs index 844162af7a..6c2865ea5a 100644 --- a/Content.Server/DeviceNetwork/Systems/ApcNetworkSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/ApcNetworkSystem.cs @@ -36,7 +36,7 @@ namespace Content.Server.DeviceNetwork.Systems private void OnProviderConnected(EntityUid uid, ApcNetworkComponent component, ExtensionCableSystem.ProviderConnectedEvent args) { - if (!IoCManager.Resolve().TryGetComponent(args.Provider.Owner.Uid, out NodeContainerComponent? nodeContainer)) return; + if (!IoCManager.Resolve().TryGetComponent(args.Provider.Owner, out NodeContainerComponent? nodeContainer)) return; if (nodeContainer.TryGetNode("power", out CableNode? node)) { diff --git a/Content.Server/DeviceNetwork/Systems/DeviceNetworkSystem.cs b/Content.Server/DeviceNetwork/Systems/DeviceNetworkSystem.cs index f515bf37aa..3826029ad6 100644 --- a/Content.Server/DeviceNetwork/Systems/DeviceNetworkSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/DeviceNetworkSystem.cs @@ -211,12 +211,12 @@ namespace Content.Server.DeviceNetwork.Systems { foreach (var connection in connections) { - var beforeEvent = new BeforePacketSentEvent(packet.Sender.Owner.Uid); - RaiseLocalEvent(connection.Owner.Uid, beforeEvent, false); + var beforeEvent = new BeforePacketSentEvent(packet.Sender.Owner); + RaiseLocalEvent(connection.Owner, beforeEvent, false); if (!beforeEvent.Cancelled) { - RaiseLocalEvent(connection.Owner.Uid, new PacketSentEvent(connection.Frequency, packet.Sender.Address, packet.Data, packet.Broadcast) , false); + RaiseLocalEvent(connection.Owner, new PacketSentEvent(connection.Frequency, packet.Sender.Address, packet.Data, packet.Broadcast) , false); } } } diff --git a/Content.Server/DeviceNetwork/Systems/WiredNetworkSystem.cs b/Content.Server/DeviceNetwork/Systems/WiredNetworkSystem.cs index 931be2d703..b2c52eef15 100644 --- a/Content.Server/DeviceNetwork/Systems/WiredNetworkSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/WiredNetworkSystem.cs @@ -26,7 +26,7 @@ namespace Content.Server.DeviceNetwork.Systems IEntity sender = EntityManager.GetEntity(args.Sender); IEntity receiver = EntityManager.GetEntity(uid); - if (IoCManager.Resolve().GetComponent(receiver.Uid).GridID != IoCManager.Resolve().GetComponent(sender.Uid).GridID) + if (IoCManager.Resolve().GetComponent(receiver).GridID != IoCManager.Resolve().GetComponent(sender).GridID) { args.Cancel(); } diff --git a/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs b/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs index 72bb0a2228..f4be680740 100644 --- a/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs +++ b/Content.Server/DeviceNetwork/Systems/WirelessNetworkSystem.cs @@ -21,11 +21,11 @@ namespace Content.Server.DeviceNetwork.Systems { var sender = EntityManager.GetEntity(args.Sender); - var ownPosition = IoCManager.Resolve().GetComponent(component.Owner.Uid).WorldPosition; - var position = IoCManager.Resolve().GetComponent(sender.Uid).WorldPosition; + var ownPosition = IoCManager.Resolve().GetComponent(component.Owner).WorldPosition; + var position = IoCManager.Resolve().GetComponent(sender).WorldPosition; var distance = (ownPosition - position).Length; - if(IoCManager.Resolve().TryGetComponent(sender.Uid, out var sendingComponent) && distance > sendingComponent.Range) + if(IoCManager.Resolve().TryGetComponent(sender, out var sendingComponent) && distance > sendingComponent.Range) { args.Cancel(); } diff --git a/Content.Server/Disposal/Tube/Components/DisposalBendComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalBendComponent.cs index 532410489b..e461004734 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalBendComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalBendComponent.cs @@ -17,7 +17,7 @@ namespace Content.Server.Disposal.Tube.Components protected override Direction[] ConnectableDirections() { - var direction = IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation; + var direction = IoCManager.Resolve().GetComponent(Owner).LocalRotation; var side = new Angle(MathHelper.DegreesToRadians(direction.Degrees + _sideDegrees)); return new[] {direction.GetDir(), side.GetDir()}; diff --git a/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs index 054a88472a..97ca2bc1de 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalEntryComponent.cs @@ -21,8 +21,8 @@ namespace Content.Server.Disposal.Tube.Components public bool TryInsert(DisposalUnitComponent from) { - var holder = IoCManager.Resolve().SpawnEntity(HolderPrototypeId, IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition); - var holderComponent = IoCManager.Resolve().GetComponent(holder.Uid); + var holder = IoCManager.Resolve().SpawnEntity(HolderPrototypeId, IoCManager.Resolve().GetComponent(Owner).MapPosition); + var holderComponent = IoCManager.Resolve().GetComponent(holder); foreach (var entity in from.ContainedEntities.ToArray()) { @@ -37,7 +37,7 @@ namespace Content.Server.Disposal.Tube.Components protected override Direction[] ConnectableDirections() { - return new[] {IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation.GetDir()}; + return new[] {IoCManager.Resolve().GetComponent(Owner).LocalRotation.GetDir()}; } /// diff --git a/Content.Server/Disposal/Tube/Components/DisposalJunctionComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalJunctionComponent.cs index c9f5c26efb..2da7497048 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalJunctionComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalJunctionComponent.cs @@ -27,14 +27,14 @@ namespace Content.Server.Disposal.Tube.Components protected override Direction[] ConnectableDirections() { - var direction = IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation; + var direction = IoCManager.Resolve().GetComponent(Owner).LocalRotation; return _degrees.Select(degree => new Angle(degree.Theta + direction.Theta).GetDir()).ToArray(); } public override Direction NextDirection(DisposalHolderComponent holder) { - var next = IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation.GetDir(); + var next = IoCManager.Resolve().GetComponent(Owner).LocalRotation.GetDir(); var directions = ConnectableDirections().Skip(1).ToArray(); if (holder.PreviousDirectionFrom == Direction.Invalid || diff --git a/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs index 23fcf34ed6..a3231fe3ba 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs @@ -36,7 +36,7 @@ namespace Content.Server.Disposal.Tube.Components [ViewVariables] public bool Anchored => - !IoCManager.Resolve().TryGetComponent(Owner.Uid, out IPhysBody? physics) || + !IoCManager.Resolve().TryGetComponent(Owner, out IPhysBody? physics) || physics.BodyType == BodyType.Static; [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalRouterUiKey.Key); @@ -52,7 +52,7 @@ namespace Content.Server.Disposal.Tube.Components return directions[1]; } - return IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation.GetDir(); + return IoCManager.Resolve().GetComponent(Owner).LocalRotation.GetDir(); } protected override void Initialize() @@ -160,12 +160,12 @@ namespace Content.Server.Disposal.Tube.Components /// Data relevant to the event such as the actor which triggered it. void IActivate.Activate(ActivateEventArgs args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) { return; } - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out HandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out HandsComponent? hands)) { Owner.PopupMessage(args.User, Loc.GetString("disposal-router-window-tag-input-activate-no-hands")); return; diff --git a/Content.Server/Disposal/Tube/Components/DisposalTaggerComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalTaggerComponent.cs index 0cbf565891..bc16a54a0e 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalTaggerComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalTaggerComponent.cs @@ -33,7 +33,7 @@ namespace Content.Server.Disposal.Tube.Components [ViewVariables] public bool Anchored => - !IoCManager.Resolve().TryGetComponent(Owner.Uid, out PhysicsComponent? physics) || + !IoCManager.Resolve().TryGetComponent(Owner, out PhysicsComponent? physics) || physics.BodyType == BodyType.Static; [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalTaggerUiKey.Key); @@ -126,12 +126,12 @@ namespace Content.Server.Disposal.Tube.Components /// Data relevant to the event such as the actor which triggered it. void IActivate.Activate(ActivateEventArgs args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) { return; } - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out HandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out HandsComponent? hands)) { Owner.PopupMessage(args.User, Loc.GetString("disposal-tagger-window-activate-no-hands")); return; diff --git a/Content.Server/Disposal/Tube/Components/DisposalTransitComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalTransitComponent.cs index 904131e2e1..e6bc59d070 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalTransitComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalTransitComponent.cs @@ -15,7 +15,7 @@ namespace Content.Server.Disposal.Tube.Components protected override Direction[] ConnectableDirections() { - var rotation = IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation; + var rotation = IoCManager.Resolve().GetComponent(Owner).LocalRotation; var opposite = new Angle(rotation.Theta + Math.PI); return new[] {rotation.GetDir(), opposite.GetDir()}; diff --git a/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs index 6090457ebc..0e69aad6b8 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs @@ -38,7 +38,7 @@ namespace Content.Server.Disposal.Tube.Components [ViewVariables] private bool Anchored => - !IoCManager.Resolve().TryGetComponent(Owner.Uid, out PhysicsComponent? physics) || + !IoCManager.Resolve().TryGetComponent(Owner, out PhysicsComponent? physics) || physics.BodyType == BodyType.Static; /// @@ -91,7 +91,7 @@ namespace Content.Server.Disposal.Tube.Components foreach (var entity in Contents.ContainedEntities.ToArray()) { - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out DisposalHolderComponent? holder)) + if (!IoCManager.Resolve().TryGetComponent(entity, out DisposalHolderComponent? holder)) { continue; } @@ -109,7 +109,7 @@ namespace Content.Server.Disposal.Tube.Components private void UpdateVisualState() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { return; } @@ -125,7 +125,7 @@ namespace Content.Server.Disposal.Tube.Components public void AnchoredChanged() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out PhysicsComponent? physics)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out PhysicsComponent? physics)) { return; } diff --git a/Content.Server/Disposal/Tube/DisposalTubeSystem.cs b/Content.Server/Disposal/Tube/DisposalTubeSystem.cs index e647a9b0d3..b8266c5d6b 100644 --- a/Content.Server/Disposal/Tube/DisposalTubeSystem.cs +++ b/Content.Server/Disposal/Tube/DisposalTubeSystem.cs @@ -34,7 +34,7 @@ namespace Content.Server.Disposal.Tube if (!args.CanAccess || !args.CanInteract) return; - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out var actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out var actor)) return; var player = actor.PlayerSession; @@ -50,7 +50,7 @@ namespace Content.Server.Disposal.Tube if (!args.CanAccess || !args.CanInteract) return; - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out var actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out var actor)) return; var player = actor.PlayerSession; @@ -87,8 +87,8 @@ namespace Content.Server.Disposal.Tube return null; var oppositeDirection = nextDirection.GetOpposite(); - var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(targetTube.Owner.Uid).GridID); - var position = IoCManager.Resolve().GetComponent(targetTube.Owner.Uid).Coordinates; + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(targetTube.Owner).GridID); + var position = IoCManager.Resolve().GetComponent(targetTube.Owner).Coordinates; foreach (var entity in grid.GetInDir(position, nextDirection)) { if (!EntityManager.TryGetComponent(entity, out IDisposalTubeComponent? tube)) diff --git a/Content.Server/Disposal/TubeConnectionsCommand.cs b/Content.Server/Disposal/TubeConnectionsCommand.cs index 45513b1ddf..d8344d19e9 100644 --- a/Content.Server/Disposal/TubeConnectionsCommand.cs +++ b/Content.Server/Disposal/TubeConnectionsCommand.cs @@ -44,7 +44,7 @@ namespace Content.Server.Disposal return; } - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out IDisposalTubeComponent? tube)) + if (!IoCManager.Resolve().TryGetComponent(entity, out IDisposalTubeComponent? tube)) { shell.WriteLine(Loc.GetString("shell-entity-with-uid-lacks-component", ("uid", id), diff --git a/Content.Server/Disposal/Unit/Components/DisposalHolderComponent.cs b/Content.Server/Disposal/Unit/Components/DisposalHolderComponent.cs index 341b2fbe62..8a667bebaa 100644 --- a/Content.Server/Disposal/Unit/Components/DisposalHolderComponent.cs +++ b/Content.Server/Disposal/Unit/Components/DisposalHolderComponent.cs @@ -84,8 +84,8 @@ namespace Content.Server.Disposal.Unit.Components return false; } - return IoCManager.Resolve().HasComponent(entity.Uid) || - IoCManager.Resolve().HasComponent(entity.Uid); + return IoCManager.Resolve().HasComponent(entity) || + IoCManager.Resolve().HasComponent(entity); } public bool TryInsert(IEntity entity) @@ -95,7 +95,7 @@ namespace Content.Server.Disposal.Unit.Components return false; } - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? physics)) + if (IoCManager.Resolve().TryGetComponent(entity, out IPhysBody? physics)) { physics.CanCollide = false; } diff --git a/Content.Server/Disposal/Unit/Components/DisposalUnitComponent.cs b/Content.Server/Disposal/Unit/Components/DisposalUnitComponent.cs index b6fe29c6ca..2136768560 100644 --- a/Content.Server/Disposal/Unit/Components/DisposalUnitComponent.cs +++ b/Content.Server/Disposal/Unit/Components/DisposalUnitComponent.cs @@ -75,7 +75,7 @@ namespace Content.Server.Disposal.Unit.Components [ViewVariables] public bool Powered => - !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) || + !IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered; [ViewVariables] public PressureState State => Pressure >= 1 ? PressureState.Ready : PressureState.Pressurizing; @@ -97,8 +97,8 @@ namespace Content.Server.Disposal.Unit.Components var actionBlocker = EntitySystem.Get(); - if (!actionBlocker.CanInteract(player.Uid) || - !actionBlocker.CanUse(player.Uid)) + if (!actionBlocker.CanInteract(player) || + !actionBlocker.CanUse(player)) { return false; } @@ -149,7 +149,7 @@ namespace Content.Server.Disposal.Unit.Components public override bool DragDropOn(DragDropEvent eventArgs) { - EntitySystem.Get().TryInsert(Owner.Uid, eventArgs.Dragged.Uid, eventArgs.User.Uid); + EntitySystem.Get().TryInsert(Owner, eventArgs.Dragged, eventArgs.User); return true; } diff --git a/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs b/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs index 5ab5118809..a041908407 100644 --- a/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs +++ b/Content.Server/Disposal/Unit/EntitySystems/DisposableSystem.cs @@ -47,24 +47,24 @@ namespace Content.Server.Disposal.Unit.EntitySystems foreach (var entity in holder.Container.ContainedEntities.ToArray()) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? physics)) + if (IoCManager.Resolve().TryGetComponent(entity, out IPhysBody? physics)) { physics.CanCollide = true; } holder.Container.ForceRemove(entity); - if (IoCManager.Resolve().GetComponent(entity.Uid).Parent == holderTransform) + if (IoCManager.Resolve().GetComponent(entity).Parent == holderTransform) { if (duc != null) { // Insert into disposal unit - IoCManager.Resolve().GetComponent(entity.Uid).Coordinates = new EntityCoordinates(duc.OwnerUid, Vector2.Zero); + IoCManager.Resolve().GetComponent(entity).Coordinates = new EntityCoordinates(duc.OwnerUid, Vector2.Zero); duc.Container.Insert(entity); } else { - IoCManager.Resolve().GetComponent(entity.Uid).AttachParentToContainerOrGrid(); + IoCManager.Resolve().GetComponent(entity).AttachParentToContainerOrGrid(); } } } @@ -161,11 +161,11 @@ namespace Content.Server.Disposal.Unit.EntitySystems if (holder.TimeLeft > 0) { var progress = 1 - holder.TimeLeft / holder.StartingTime; - var origin = IoCManager.Resolve().GetComponent(currentTube.Owner.Uid).Coordinates; + var origin = IoCManager.Resolve().GetComponent(currentTube.Owner).Coordinates; var destination = holder.CurrentDirection.ToVec(); var newPosition = destination * progress; - IoCManager.Resolve().GetComponent(holder.Owner.Uid).Coordinates = origin.Offset(newPosition); + IoCManager.Resolve().GetComponent(holder.Owner).Coordinates = origin.Offset(newPosition); continue; } diff --git a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs index a25528c69c..d9edba6ff1 100644 --- a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs +++ b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs @@ -98,13 +98,13 @@ namespace Content.Server.Disposal.Unit.EntitySystems if (!args.CanAccess || !args.CanInteract || component.ContainedEntities.Contains(args.User) || - !_actionBlockerSystem.CanMove(args.User.Uid)) + !_actionBlockerSystem.CanMove(args.User)) return; // Add verb to climb inside of the unit, Verb verb = new() { - Act = () => TryInsert(component.Owner.Uid, args.User.Uid, args.User.Uid), + Act = () => TryInsert(component.Owner, args.User, args.User), Text = Loc.GetString("disposal-self-insert-verb-get-data-text") }; // TODO VERN ICON @@ -159,7 +159,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems public void TogglePower(DisposalUnitComponent component) { - if (!EntityManager.TryGetComponent(component.Owner.Uid, out ApcPowerReceiverComponent? receiver)) + if (!EntityManager.TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver)) { return; } @@ -172,7 +172,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems #region Eventbus Handlers private void HandleActivate(EntityUid uid, DisposalUnitComponent component, ActivateInWorldEvent args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) { return; } @@ -187,7 +187,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems private void HandleInteractHand(EntityUid uid, DisposalUnitComponent component, InteractHandEvent args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) return; + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) return; // Duplicated code here, not sure how else to get actor inside to make UserInterface happy. @@ -198,7 +198,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems private void HandleInteractUsing(EntityUid uid, DisposalUnitComponent component, InteractUsingEvent args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out HandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out HandsComponent? hands)) { return; } @@ -238,7 +238,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems UpdateInterface(component, component.Powered); - if (!IoCManager.Resolve().HasComponent(component.Owner.Uid)) + if (!IoCManager.Resolve().HasComponent(component.Owner)) { Logger.WarningS("VitalComponentMissing", $"Disposal unit {uid} is missing an {nameof(AnchorableComponent)}"); } @@ -302,7 +302,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems { var currentTime = GameTiming.CurTime; - if (!IoCManager.Resolve().TryGetComponent(args.Entity.Uid, out HandsComponent? hands) || + if (!IoCManager.Resolve().TryGetComponent(args.Entity, out HandsComponent? hands) || hands.Count == 0 || currentTime < component.LastExitAttempt + ExitAttemptDelay) { @@ -351,7 +351,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems if (count > 0) { - if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out PhysicsComponent? disposalsBody)) + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out PhysicsComponent? disposalsBody)) { component.RecentlyEjected.Clear(); } @@ -382,7 +382,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems private bool IsValidInteraction(ITargetedInteractEventArgs eventArgs) { - if (!Get().CanInteract(eventArgs.User.Uid)) + if (!Get().CanInteract(eventArgs.User)) { eventArgs.Target.PopupMessage(eventArgs.User, Loc.GetString("ui-disposal-unit-is-valid-interaction-cannot=interact")); return false; @@ -395,7 +395,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems } // This popup message doesn't appear on clicks, even when code was seperate. Unsure why. - if (!IoCManager.Resolve().HasComponent(eventArgs.User.Uid)) + if (!IoCManager.Resolve().HasComponent(eventArgs.User)) { eventArgs.Target.PopupMessage(eventArgs.User, Loc.GetString("ui-disposal-unit-is-valid-interaction-no-hands")); return false; @@ -444,8 +444,8 @@ namespace Content.Server.Disposal.Unit.EntitySystems return false; } - var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(component.Owner.Uid).GridID); - var coords = IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates; + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(component.Owner).GridID); + var coords = IoCManager.Resolve().GetComponent(component.Owner).Coordinates; var entry = grid.GetLocal(coords) .FirstOrDefault(entity => EntityManager.HasComponent(entity)); @@ -457,7 +457,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems var air = component.Air; var entryComponent = EntityManager.GetComponent(entry); - if (_atmosSystem.GetTileMixture(IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates, true) is {Temperature: > 0} environment) + if (_atmosSystem.GetTileMixture(IoCManager.Resolve().GetComponent(component.Owner).Coordinates, true) is {Temperature: > 0} environment) { var transferMoles = 0.1f * (0.05f * Atmospherics.OneAtmosphere * 1.01f - air.Pressure) * air.Volume / (environment.Temperature * Atmospherics.R); @@ -483,7 +483,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems public void UpdateInterface(DisposalUnitComponent component, bool powered) { var stateString = Loc.GetString($"{component.State}"); - var state = new SharedDisposalUnitComponent.DisposalUnitBoundUserInterfaceState(IoCManager.Resolve().GetComponent(component.Owner.Uid).EntityName, stateString, EstimatedFullPressure(component), powered, component.Engaged); + var state = new SharedDisposalUnitComponent.DisposalUnitBoundUserInterfaceState(IoCManager.Resolve().GetComponent(component.Owner).EntityName, stateString, EstimatedFullPressure(component), powered, component.Engaged); component.UserInterface?.SetState(state); } @@ -504,12 +504,12 @@ namespace Content.Server.Disposal.Unit.EntitySystems public void UpdateVisualState(DisposalUnitComponent component, bool flush) { - if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out AppearanceComponent? appearance)) + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out AppearanceComponent? appearance)) { return; } - if (!IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored) + if (!IoCManager.Resolve().GetComponent(component.Owner).Anchored) { appearance.SetData(SharedDisposalUnitComponent.Visuals.VisualState, SharedDisposalUnitComponent.VisualState.UnAnchored); appearance.SetData(SharedDisposalUnitComponent.Visuals.Handle, SharedDisposalUnitComponent.HandleState.Normal); @@ -557,8 +557,8 @@ namespace Content.Server.Disposal.Unit.EntitySystems component.AutomaticEngageToken = null; } - if (!component.RecentlyEjected.Contains(entity.Uid)) - component.RecentlyEjected.Add(entity.Uid); + if (!component.RecentlyEjected.Contains(entity)) + component.RecentlyEjected.Add(entity); component.Dirty(); HandleStateChange(component, true); @@ -567,7 +567,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems public bool CanFlush(DisposalUnitComponent component) { - return component.State == SharedDisposalUnitComponent.PressureState.Ready && component.Powered && IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored; + return component.State == SharedDisposalUnitComponent.PressureState.Ready && component.Powered && IoCManager.Resolve().GetComponent(component.Owner).Anchored; } public void Engage(DisposalUnitComponent component) @@ -633,7 +633,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems { TryQueueEngage(component); - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ActorComponent? actor)) + if (IoCManager.Resolve().TryGetComponent(entity, out ActorComponent? actor)) { component.UserInterface?.Close(actor.PlayerSession); } diff --git a/Content.Server/DoAfter/DoAfterEventArgs.cs b/Content.Server/DoAfter/DoAfterEventArgs.cs index 7f61ea07bf..79d91462ca 100644 --- a/Content.Server/DoAfter/DoAfterEventArgs.cs +++ b/Content.Server/DoAfter/DoAfterEventArgs.cs @@ -102,7 +102,7 @@ namespace Content.Server.DoAfter IEntity user, float delay, CancellationToken cancelToken = default, - IEntity? target = null) : this(user.Uid, delay, cancelToken, target?.Uid ?? null) + IEntity? target = null) : this((EntityUid) user, delay, cancelToken, target ?? null) { } diff --git a/Content.Server/Doors/Components/AirlockComponent.cs b/Content.Server/Doors/Components/AirlockComponent.cs index 6d565aa209..b03f0dcb40 100644 --- a/Content.Server/Doors/Components/AirlockComponent.cs +++ b/Content.Server/Doors/Components/AirlockComponent.cs @@ -176,7 +176,7 @@ namespace Content.Server.Doors.Components _boltLightsWirePulsed ? StatusLightState.On : StatusLightState.Off, "BLTL"); var ev = new DoorGetCloseTimeModifierEvent(); - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, ev, false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, ev, false); var timingStatus = new StatusLightData(Color.Orange, !AutoClose ? StatusLightState.Off : diff --git a/Content.Server/Doors/Components/FirelockComponent.cs b/Content.Server/Doors/Components/FirelockComponent.cs index 3565e9386f..84ba57c50e 100644 --- a/Content.Server/Doors/Components/FirelockComponent.cs +++ b/Content.Server/Doors/Components/FirelockComponent.cs @@ -31,7 +31,7 @@ namespace Content.Server.Doors.Components if (DoorComponent != null && DoorComponent.State == SharedDoorComponent.DoorState.Open && DoorComponent.CanCloseGeneric()) { DoorComponent.Close(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AirtightComponent? airtight)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AirtightComponent? airtight)) { EntitySystem.Get().SetAirblocked(airtight, true); } @@ -47,7 +47,7 @@ namespace Content.Server.Doors.Components var minMoles = float.MaxValue; var maxMoles = 0f; - foreach (var adjacent in atmosphereSystem.GetAdjacentTileMixtures(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates)) + foreach (var adjacent in atmosphereSystem.GetAdjacentTileMixtures(IoCManager.Resolve().GetComponent(Owner).Coordinates)) { var moles = adjacent.TotalMoles; if (moles < minMoles) @@ -63,7 +63,7 @@ namespace Content.Server.Doors.Components { var atmosphereSystem = EntitySystem.Get(); - if (!atmosphereSystem.TryGetGridAndTile(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, out var tuple)) + if (!atmosphereSystem.TryGetGridAndTile(IoCManager.Resolve().GetComponent(Owner).Coordinates, out var tuple)) return false; if (atmosphereSystem.GetTileMixture(tuple.Value.Grid, tuple.Value.Tile) == null) @@ -72,7 +72,7 @@ namespace Content.Server.Doors.Components if (atmosphereSystem.IsHotspotActive(tuple.Value.Grid, tuple.Value.Tile)) return true; - foreach (var adjacent in atmosphereSystem.GetAdjacentTiles(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates)) + foreach (var adjacent in atmosphereSystem.GetAdjacentTiles(IoCManager.Resolve().GetComponent(Owner).Coordinates)) { if (atmosphereSystem.IsHotspotActive(tuple.Value.Grid, adjacent)) return true; diff --git a/Content.Server/Doors/Components/ServerDoorComponent.cs b/Content.Server/Doors/Components/ServerDoorComponent.cs index 6b26307541..bfcffa35d7 100644 --- a/Content.Server/Doors/Components/ServerDoorComponent.cs +++ b/Content.Server/Doors/Components/ServerDoorComponent.cs @@ -78,7 +78,7 @@ namespace Content.Server.Doors.Components _ => throw new ArgumentOutOfRangeException(), }; - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, new DoorStateChangedEvent(State), false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, new DoorStateChangedEvent(State), false); _autoCloseCancelTokenSource?.Cancel(); Dirty(); @@ -220,7 +220,7 @@ namespace Content.Server.Doors.Components { if (!CanWeldShut) { - Logger.Warning("{0} prototype loaded with incompatible flags: 'welded' is true, but door cannot be welded.", IoCManager.Resolve().GetComponent(Owner.Uid).EntityName); + Logger.Warning("{0} prototype loaded with incompatible flags: 'welded' is true, but door cannot be welded.", IoCManager.Resolve().GetComponent(Owner).EntityName); return; } SetAppearance(DoorVisualState.Welded); @@ -243,7 +243,7 @@ namespace Content.Server.Doors.Components { if (IsWeldedShut) { - Logger.Warning("{0} prototype loaded with incompatible flags: 'welded' and 'startOpen' are both true.", IoCManager.Resolve().GetComponent(Owner.Uid).EntityName); + Logger.Warning("{0} prototype loaded with incompatible flags: 'welded' and 'startOpen' are both true.", IoCManager.Resolve().GetComponent(Owner).EntityName); return; } QuickOpen(false); @@ -258,7 +258,7 @@ namespace Content.Server.Doors.Components return; DoorClickShouldActivateEvent ev = new DoorClickShouldActivateEvent(eventArgs); - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, ev, false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, ev, false); if (ev.Handled) return; @@ -277,7 +277,7 @@ namespace Content.Server.Doors.Components public void TryOpen(IEntity? user=null) { var msg = new DoorOpenAttemptEvent(); - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, msg); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, msg); if (msg.Cancelled) return; @@ -291,7 +291,7 @@ namespace Content.Server.Doors.Components { Open(); - if (IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? hands) && hands.Count == 0) + if (IoCManager.Resolve().TryGetComponent(user, out HandsComponent? hands) && hands.Count == 0) { SoundSystem.Play(Filter.Pvs(Owner), _tryOpenDoorSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2)); @@ -310,7 +310,7 @@ namespace Content.Server.Doors.Components return false; } - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AccessReader? access)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AccessReader? access)) { return true; } @@ -322,9 +322,9 @@ namespace Content.Server.Doors.Components return doorSystem.AccessType switch { DoorSystem.AccessTypes.AllowAll => true, - DoorSystem.AccessTypes.AllowAllIdExternal => isAirlockExternal || accessSystem.IsAllowed(access, user.Uid), + DoorSystem.AccessTypes.AllowAllIdExternal => isAirlockExternal || accessSystem.IsAllowed(access, user), DoorSystem.AccessTypes.AllowAllNoExternal => !isAirlockExternal, - _ => accessSystem.IsAllowed(access, user.Uid) + _ => accessSystem.IsAllowed(access, user) }; } @@ -334,7 +334,7 @@ namespace Content.Server.Doors.Components /// private bool HasAccessType(string accessType) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AccessReader? access)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AccessReader? access)) { return access.AccessLists.Any(list => list.Contains(accessType)); } @@ -355,7 +355,7 @@ namespace Content.Server.Doors.Components } var ev = new BeforeDoorOpenedEvent(); - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, ev, false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, ev, false); return !ev.Cancelled; } @@ -365,12 +365,12 @@ namespace Content.Server.Doors.Components public void Open() { State = DoorState.Opening; - if (Occludes && IoCManager.Resolve().TryGetComponent(Owner.Uid, out OccluderComponent? occluder)) + if (Occludes && IoCManager.Resolve().TryGetComponent(Owner, out OccluderComponent? occluder)) { occluder.Enabled = false; } - if (ChangeAirtight && IoCManager.Resolve().TryGetComponent(Owner.Uid, out AirtightComponent? airtight)) + if (ChangeAirtight && IoCManager.Resolve().TryGetComponent(Owner, out AirtightComponent? airtight)) { EntitySystem.Get().SetAirblocked(airtight, false); } @@ -398,7 +398,7 @@ namespace Content.Server.Doors.Components { base.OnPartialOpen(); - if (ChangeAirtight && IoCManager.Resolve().TryGetComponent(Owner.Uid, out AirtightComponent? airtight)) + if (ChangeAirtight && IoCManager.Resolve().TryGetComponent(Owner, out AirtightComponent? airtight)) { EntitySystem.Get().SetAirblocked(airtight, false); } @@ -408,7 +408,7 @@ namespace Content.Server.Doors.Components private void QuickOpen(bool refresh) { - if (Occludes && IoCManager.Resolve().TryGetComponent(Owner.Uid, out OccluderComponent? occluder)) + if (Occludes && IoCManager.Resolve().TryGetComponent(Owner, out OccluderComponent? occluder)) { occluder.Enabled = false; } @@ -425,7 +425,7 @@ namespace Content.Server.Doors.Components public void TryClose(IEntity? user=null) { var msg = new DoorCloseAttemptEvent(); - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, msg); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, msg); if (msg.Cancelled) return; @@ -445,13 +445,13 @@ namespace Content.Server.Doors.Components return false; } - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AccessReader? access)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AccessReader? access)) { return true; } var accessSystem = EntitySystem.Get(); - return accessSystem.IsAllowed(access, user.Uid); + return accessSystem.IsAllowed(access, user); } /// @@ -461,7 +461,7 @@ namespace Content.Server.Doors.Components public bool CanCloseGeneric() { var ev = new BeforeDoorClosedEvent(); - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, ev, false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, ev, false); if (ev.Cancelled) return false; @@ -471,7 +471,7 @@ namespace Content.Server.Doors.Components private bool SafetyCheck() { var ev = new DoorSafetyEnabledEvent(); - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, ev, false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, ev, false); return ev.Safety || _inhibitCrush; } @@ -483,7 +483,7 @@ namespace Content.Server.Doors.Components { var safety = SafetyCheck(); - if (safety && IoCManager.Resolve().TryGetComponent(Owner.Uid, out PhysicsComponent? physicsComponent)) + if (safety && IoCManager.Resolve().TryGetComponent(Owner, out PhysicsComponent? physicsComponent)) { var broadPhaseSystem = EntitySystem.Get(); @@ -527,7 +527,7 @@ namespace Content.Server.Doors.Components OnPartialClose(); await Timer.Delay(CloseTimeTwo, _stateChangeCancelTokenSource.Token); - if (Occludes && IoCManager.Resolve().TryGetComponent(Owner.Uid, out OccluderComponent? occluder)) + if (Occludes && IoCManager.Resolve().TryGetComponent(Owner, out OccluderComponent? occluder)) { occluder.Enabled = true; } @@ -543,7 +543,7 @@ namespace Content.Server.Doors.Components // if safety is off, crushes people inside of the door, temporarily turning off collisions with them while doing so. var becomeairtight = ChangeAirtight && (SafetyCheck() || !TryCrush()); - if (becomeairtight && IoCManager.Resolve().TryGetComponent(Owner.Uid, out AirtightComponent? airtight)) + if (becomeairtight && IoCManager.Resolve().TryGetComponent(Owner, out AirtightComponent? airtight)) { EntitySystem.Get().SetAirblocked(airtight, true); } @@ -581,12 +581,12 @@ namespace Content.Server.Doors.Components continue; hitsomebody = true; - CurrentlyCrushing.Add(e.Owner.Uid); + CurrentlyCrushing.Add(e.Owner); - if (IoCManager.Resolve().HasComponent(e.Owner.Uid)) - EntitySystem.Get().TryChangeDamage(e.Owner.Uid, CrushDamage); + if (IoCManager.Resolve().HasComponent(e.Owner)) + EntitySystem.Get().TryChangeDamage(e.Owner, CrushDamage); - EntitySystem.Get().TryParalyze(e.Owner.Uid, TimeSpan.FromSeconds(DoorStunTime)); + EntitySystem.Get().TryParalyze(e.Owner, TimeSpan.FromSeconds(DoorStunTime)); } // If we hit someone, open up after stun (opens right when stun ends) @@ -604,7 +604,7 @@ namespace Content.Server.Doors.Components public void Deny() { var ev = new BeforeDoorDeniedEvent(); - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, ev, false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, ev, false); if (ev.Cancelled) return; @@ -651,14 +651,14 @@ namespace Content.Server.Doors.Components return; var autoev = new BeforeDoorAutoCloseEvent(); - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, autoev, false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, autoev, false); if (autoev.Cancelled) return; _autoCloseCancelTokenSource = new(); var ev = new DoorGetCloseTimeModifierEvent(); - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, ev, false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, ev, false); var realCloseTime = AutoCloseDelay * ev.CloseTimeModifier; Owner.SpawnRepeatingTimer(realCloseTime, async () => @@ -673,7 +673,7 @@ namespace Content.Server.Doors.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - if(!IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out ToolComponent? tool)) + if(!IoCManager.Resolve().TryGetComponent(eventArgs.Using, out ToolComponent? tool)) { return false; } @@ -684,19 +684,19 @@ namespace Content.Server.Doors.Components if (tool.Qualities.Contains(_pryingQuality) && !IsWeldedShut) { var ev = new DoorGetPryTimeModifierEvent(); - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, ev, false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, ev, false); var canEv = new BeforeDoorPryEvent(eventArgs); - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, canEv, false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, canEv, false); if (canEv.Cancelled) return false; - var successfulPry = await toolSystem.UseTool(eventArgs.Using.Uid, eventArgs.User.Uid, Owner.Uid, + var successfulPry = await toolSystem.UseTool(eventArgs.Using, eventArgs.User, Owner, 0f, ev.PryTimeModifier * PryTime, _pryingQuality); if (successfulPry && !IsWeldedShut) { - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, new OnDoorPryEvent(eventArgs), false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, new OnDoorPryEvent(eventArgs), false); if (State == DoorState.Closed) { Open(); @@ -710,12 +710,12 @@ namespace Content.Server.Doors.Components } // for welding doors - if (CanWeldShut && IoCManager.Resolve().TryGetComponent(tool.Owner.Uid, out WelderComponent? welder) && welder.Lit) + if (CanWeldShut && IoCManager.Resolve().TryGetComponent(tool.Owner, out WelderComponent? welder) && welder.Lit) { if(!_beingWelded) { _beingWelded = true; - if(await toolSystem.UseTool(eventArgs.Using.Uid, eventArgs.User.Uid, Owner.Uid, 3f, 3f, _weldingQuality, () => CanWeldShut)) + if(await toolSystem.UseTool(eventArgs.Using, eventArgs.User, Owner, 3f, 3f, _weldingQuality, () => CanWeldShut)) { // just in case if (!CanWeldShut) @@ -745,8 +745,8 @@ namespace Content.Server.Doors.Components private void CreateDoorElectronicsBoard() { // Ensure that the construction component is aware of the board container. - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ConstructionComponent? construction)) - EntitySystem.Get().AddContainer(Owner.Uid, "board", construction); + if (IoCManager.Resolve().TryGetComponent(Owner, out ConstructionComponent? construction)) + EntitySystem.Get().AddContainer(Owner, "board", construction); // We don't do anything if this is null or empty. if (string.IsNullOrEmpty(_boardPrototype)) diff --git a/Content.Server/Doors/Systems/AirlockSystem.cs b/Content.Server/Doors/Systems/AirlockSystem.cs index df81252479..ef1b97f4e0 100644 --- a/Content.Server/Doors/Systems/AirlockSystem.cs +++ b/Content.Server/Doors/Systems/AirlockSystem.cs @@ -88,7 +88,7 @@ namespace Content.Server.Doors.Systems private void OnDoorClickShouldActivate(EntityUid uid, AirlockComponent component, DoorClickShouldActivateEvent args) { if (component.WiresComponent != null && component.WiresComponent.IsPanelOpen && - IoCManager.Resolve().TryGetComponent(args.Args.User.Uid, out ActorComponent? actor)) + IoCManager.Resolve().TryGetComponent(args.Args.User, out ActorComponent? actor)) { component.WiresComponent.OpenInterface(actor.PlayerSession); args.Handled = true; diff --git a/Content.Server/Doors/Systems/DoorSystem.cs b/Content.Server/Doors/Systems/DoorSystem.cs index ca1e6dca39..82913a3fee 100644 --- a/Content.Server/Doors/Systems/DoorSystem.cs +++ b/Content.Server/Doors/Systems/DoorSystem.cs @@ -46,7 +46,7 @@ namespace Content.Server.Doors private void HandleCollide(EntityUid uid, ServerDoorComponent component, StartCollideEvent args) { - if (!IoCManager.Resolve().HasComponent(args.OtherFixture.Body.Owner.Uid)) + if (!IoCManager.Resolve().HasComponent(args.OtherFixture.Body.Owner)) { return; } diff --git a/Content.Server/Electrocution/ElectrocutionSystem.cs b/Content.Server/Electrocution/ElectrocutionSystem.cs index a374d79819..495e166714 100644 --- a/Content.Server/Electrocution/ElectrocutionSystem.cs +++ b/Content.Server/Electrocution/ElectrocutionSystem.cs @@ -99,7 +99,7 @@ namespace Content.Server.Electrocution foreach (var finished in finishedElectrocutionsQueue) { - var uid = finished.Owner.Uid; + var uid = (EntityUid) finished.Owner; if (EntityManager.EntityExists(finished.Electrocuting)) { // TODO: damage should be scaled by shock damage multiplier @@ -123,7 +123,7 @@ namespace Content.Server.Electrocution if (!electrified.OnBump) return; - TryDoElectrifiedAct(uid, args.OtherFixture.Body.Owner.Uid, electrified); + TryDoElectrifiedAct(uid, args.OtherFixture.Body.Owner, electrified); } private void OnElectrifiedAttacked(EntityUid uid, ElectrifiedComponent electrified, AttackedEvent args) @@ -131,7 +131,7 @@ namespace Content.Server.Electrocution if (!electrified.OnAttacked) return; - TryDoElectrifiedAct(uid, args.User.Uid, electrified); + TryDoElectrifiedAct(uid, args.User, electrified); } private void OnElectrifiedHandInteract(EntityUid uid, ElectrifiedComponent electrified, InteractHandEvent args) @@ -139,7 +139,7 @@ namespace Content.Server.Electrocution if (!electrified.OnHandInteract) return; - TryDoElectrifiedAct(uid, args.User.Uid, electrified); + TryDoElectrifiedAct(uid, args.User, electrified); } public bool TryDoElectrifiedAct(EntityUid uid, EntityUid targetUid, @@ -158,7 +158,7 @@ namespace Content.Server.Electrocution foreach (var entity in transform.Coordinates.GetEntitiesInTile( LookupFlags.Approximate | LookupFlags.IncludeAnchored, _entityLookup)) { - if (IoCManager.Resolve().HasComponent(entity.Uid)) + if (IoCManager.Resolve().HasComponent(entity)) return false; } } @@ -277,10 +277,10 @@ namespace Content.Server.Electrocution var electrocutionEntity = EntityManager.SpawnEntity( $"VirtualElectrocutionLoad{node.NodeGroupID}", sourceTransform.Coordinates); - var electrocutionNode = IoCManager.Resolve().GetComponent(electrocutionEntity.Uid) + var electrocutionNode = IoCManager.Resolve().GetComponent(electrocutionEntity) .GetNode("electrocution"); - var electrocutionComponent = IoCManager.Resolve().GetComponent(electrocutionEntity.Uid); + var electrocutionComponent = IoCManager.Resolve().GetComponent(electrocutionEntity); electrocutionNode.CableEntity = sourceUid; electrocutionNode.NodeName = node.Name; @@ -396,16 +396,16 @@ namespace Content.Server.Electrocution if (EntityManager.TryGetComponent(entity, out SharedPullableComponent? pullable) && pullable.Puller != null - && !visited.Contains(pullable.Puller.Uid)) + && !visited.Contains(pullable.Puller)) { - GetChainedElectrocutionTargetsRecurse(pullable.Puller.Uid, depth + 1, visited, all); + GetChainedElectrocutionTargetsRecurse(pullable.Puller, depth + 1, visited, all); } if (EntityManager.TryGetComponent(entity, out SharedPullerComponent? puller) && puller.Pulling != null - && !visited.Contains(puller.Pulling.Uid)) + && !visited.Contains(puller.Pulling)) { - GetChainedElectrocutionTargetsRecurse(puller.Pulling.Uid, depth + 1, visited, all); + GetChainedElectrocutionTargetsRecurse(puller.Pulling, depth + 1, visited, all); } } diff --git a/Content.Server/Engineering/EntitySystems/DisassembleOnActivateSystem.cs b/Content.Server/Engineering/EntitySystems/DisassembleOnActivateSystem.cs index c59fc4fc85..4d088e216b 100644 --- a/Content.Server/Engineering/EntitySystems/DisassembleOnActivateSystem.cs +++ b/Content.Server/Engineering/EntitySystems/DisassembleOnActivateSystem.cs @@ -41,18 +41,18 @@ namespace Content.Server.Engineering.EntitySystems component.TokenSource.Cancel(); } - if (component.Deleted || (!IoCManager.Resolve().EntityExists(component.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(component.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if (component.Deleted || (!IoCManager.Resolve().EntityExists(component.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(component.Owner).EntityLifeStage) >= EntityLifeStage.Deleted) return; - var entity = EntityManager.SpawnEntity(component.Prototype, IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates); + var entity = EntityManager.SpawnEntity(component.Prototype, IoCManager.Resolve().GetComponent(component.Owner).Coordinates); - if (IoCManager.Resolve().TryGetComponent(args.User.Uid, out var hands) - && IoCManager.Resolve().TryGetComponent(entity.Uid, out var item)) + if (IoCManager.Resolve().TryGetComponent(args.User, out var hands) + && IoCManager.Resolve().TryGetComponent(entity, out var item)) { hands.PutInHandOrDrop(item); } - IoCManager.Resolve().DeleteEntity(component.Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) component.Owner); return; } diff --git a/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs b/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs index 371ede26e8..b0b4ae0563 100644 --- a/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs +++ b/Content.Server/Engineering/EntitySystems/SpawnAfterInteractSystem.cs @@ -57,10 +57,10 @@ namespace Content.Server.Engineering.EntitySystems return; } - if (component.Deleted || (!IoCManager.Resolve().EntityExists(component.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(component.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if (component.Deleted || (!IoCManager.Resolve().EntityExists(component.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(component.Owner).EntityLifeStage) >= EntityLifeStage.Deleted) return; - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out var stackComp) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out var stackComp) && component.RemoveOnInteract && !_stackSystem.Use(uid, 1, stackComp)) { return; @@ -68,8 +68,8 @@ namespace Content.Server.Engineering.EntitySystems EntityManager.SpawnEntity(component.Prototype, args.ClickLocation.SnapToGrid(grid)); - if (component.RemoveOnInteract && stackComp == null && !((!IoCManager.Resolve().EntityExists(component.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(component.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted)) - IoCManager.Resolve().DeleteEntity(component.Owner.Uid); + if (component.RemoveOnInteract && stackComp == null && !((!IoCManager.Resolve().EntityExists(component.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(component.Owner).EntityLifeStage) >= EntityLifeStage.Deleted)) + IoCManager.Resolve().DeleteEntity((EntityUid) component.Owner); } } } diff --git a/Content.Server/EntityList/SpawnEntityListCommand.cs b/Content.Server/EntityList/SpawnEntityListCommand.cs index cd57605bb7..5574a6213e 100644 --- a/Content.Server/EntityList/SpawnEntityListCommand.cs +++ b/Content.Server/EntityList/SpawnEntityListCommand.cs @@ -49,7 +49,7 @@ namespace Content.Server.EntityList foreach (var entity in prototype.Entities(prototypeManager)) { - entityManager.SpawnEntity(entity.ID, IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).Coordinates); + entityManager.SpawnEntity(entity.ID, IoCManager.Resolve().GetComponent(player.AttachedEntity).Coordinates); i++; } diff --git a/Content.Server/Explosion/Components/ClusterFlashComponent.cs b/Content.Server/Explosion/Components/ClusterFlashComponent.cs index ef9bd9a50a..0d5ac0ba53 100644 --- a/Content.Server/Explosion/Components/ClusterFlashComponent.cs +++ b/Content.Server/Explosion/Components/ClusterFlashComponent.cs @@ -60,7 +60,7 @@ namespace Content.Server.Explosion.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs args) { if (_grenadesContainer.ContainedEntities.Count >= _maxGrenades || - !IoCManager.Resolve().HasComponent(args.Using.Uid)) + !IoCManager.Resolve().HasComponent(args.Using)) return false; _grenadesContainer.Insert(args.Using); @@ -93,7 +93,7 @@ namespace Content.Server.Explosion.Components return false; Owner.SpawnTimer((int) (_delay * 1000), () => { - if ((!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner).EntityLifeStage) >= EntityLifeStage.Deleted) return; _countDown = true; var random = IoCManager.Resolve(); @@ -116,14 +116,14 @@ namespace Content.Server.Explosion.Components grenade.SpawnTimer(delay, () => { - if ((!IoCManager.Resolve().EntityExists(grenade.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(grenade.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(grenade) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(grenade).EntityLifeStage) >= EntityLifeStage.Deleted) return; EntitySystem.Get().Trigger(grenade, eventArgs.User); }); } - IoCManager.Resolve().DeleteEntity(Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) Owner); }); return true; } @@ -135,7 +135,7 @@ namespace Content.Server.Explosion.Components if (_unspawnedCount > 0) { _unspawnedCount--; - grenade = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition); + grenade = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner).MapPosition); return true; } @@ -155,7 +155,7 @@ namespace Content.Server.Explosion.Components private void UpdateAppearance() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) return; + if (!IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) return; appearance.SetData(ClusterFlashVisuals.GrenadesCounter, _grenadesContainer.ContainedEntities.Count + _unspawnedCount); } diff --git a/Content.Server/Explosion/Components/ExplosionLaunchedComponent.cs b/Content.Server/Explosion/Components/ExplosionLaunchedComponent.cs index 822902d2bd..85ca431d3a 100644 --- a/Content.Server/Explosion/Components/ExplosionLaunchedComponent.cs +++ b/Content.Server/Explosion/Components/ExplosionLaunchedComponent.cs @@ -13,7 +13,7 @@ namespace Content.Server.Explosion.Components void IExAct.OnExplosion(ExplosionEventArgs eventArgs) { - if ((!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner).EntityLifeStage) >= EntityLifeStage.Deleted) return; var sourceLocation = eventArgs.Source; diff --git a/Content.Server/Explosion/Components/OnUseTimerTriggerComponent.cs b/Content.Server/Explosion/Components/OnUseTimerTriggerComponent.cs index 2a2a8a2c19..f26fe65b08 100644 --- a/Content.Server/Explosion/Components/OnUseTimerTriggerComponent.cs +++ b/Content.Server/Explosion/Components/OnUseTimerTriggerComponent.cs @@ -19,7 +19,7 @@ namespace Content.Server.Explosion.Components // TODO: Need to split this out so it's a generic "OnUseTimerTrigger" component. public void Trigger(IEntity user) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) appearance.SetData(TriggerVisuals.VisualState, TriggerVisualState.Primed); EntitySystem.Get().HandleTimerTrigger(TimeSpan.FromSeconds(_delay), Owner, user); diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs index 987b8c5d6a..6ced1674d8 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.cs @@ -82,12 +82,12 @@ namespace Content.Server.Explosion.EntitySystems foreach (var player in players) { - if (player.AttachedEntity == null || !IoCManager.Resolve().TryGetComponent(player.AttachedEntity.Uid, out CameraRecoilComponent? recoil)) + if (player.AttachedEntity == null || !IoCManager.Resolve().TryGetComponent(player.AttachedEntity, out CameraRecoilComponent? recoil)) { continue; } - var playerPos = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).WorldPosition; + var playerPos = IoCManager.Resolve().GetComponent(player.AttachedEntity).WorldPosition; var delta = epicenter.ToMapPos(EntityManager) - playerPos; //Change if zero. Will result in a NaN later breaking camera shake if not changed @@ -130,18 +130,18 @@ namespace Content.Server.Explosion.EntitySystems // and splitted into two lists based on if they are Impassable or not foreach (var entity in entitiesInRange) { - if ((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || entity.IsInContainer()) + if ((!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Deleted || entity.IsInContainer()) { continue; } - if (!IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.TryDistance(EntityManager, epicenter, out var distance) || + if (!IoCManager.Resolve().GetComponent(entity).Coordinates.TryDistance(EntityManager, epicenter, out var distance) || distance > maxRange) { continue; } - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out PhysicsComponent? body) || body.Fixtures.Count < 1) + if (!IoCManager.Resolve().TryGetComponent(entity, out PhysicsComponent? body) || body.Fixtures.Count < 1) { continue; } @@ -171,7 +171,7 @@ namespace Content.Server.Explosion.EntitySystems continue; } - _acts.HandleExplosion(epicenter, entity.Uid, CalculateSeverity(distance, devastationRange, heavyRange)); + _acts.HandleExplosion(epicenter, entity, CalculateSeverity(distance, devastationRange, heavyRange)); } // Impassable entities were handled first so NonImpassable entities have a bigger chance to get hit. As now @@ -183,7 +183,7 @@ namespace Content.Server.Explosion.EntitySystems continue; } - _acts.HandleExplosion(epicenter, entity.Uid, CalculateSeverity(distance, devastationRange, heavyRange)); + _acts.HandleExplosion(epicenter, entity, CalculateSeverity(distance, devastationRange, heavyRange)); } } @@ -312,7 +312,7 @@ namespace Content.Server.Explosion.EntitySystems { while (EntityManager.TryGetEntity(entity, out var e) && e.TryGetContainer(out var container)) { - entity = container.Owner.Uid; + entity = container.Owner; } if (!EntityManager.TryGetComponent(entity, out transform)) diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs index 921a73baa7..5f4af077a4 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs @@ -76,7 +76,7 @@ namespace Content.Server.Explosion.EntitySystems if (component.Flashed) return; // TODO Make flash durations sane ffs. - _flashSystem.FlashArea(uid, args.User?.Uid, component.Range, component.Duration * 1000f); + _flashSystem.FlashArea(uid, args.User, component.Range, component.Duration * 1000f); component.Flashed = true; } #endregion @@ -119,7 +119,7 @@ namespace Content.Server.Explosion.EntitySystems public void Trigger(IEntity trigger, IEntity? user = null) { var triggerEvent = new TriggerEvent(trigger, user); - EntityManager.EventBus.RaiseLocalEvent(trigger.Uid, triggerEvent); + EntityManager.EventBus.RaiseLocalEvent(trigger, triggerEvent); } public void HandleTimerTrigger(TimeSpan delay, IEntity triggered, IEntity? user = null) @@ -132,7 +132,7 @@ namespace Content.Server.Explosion.EntitySystems Timer.Spawn(delay, () => { - if ((!IoCManager.Resolve().EntityExists(triggered.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(triggered.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) return; + if ((!IoCManager.Resolve().EntityExists(triggered) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(triggered).EntityLifeStage) >= EntityLifeStage.Deleted) return; Trigger(triggered, user); }); } diff --git a/Content.Server/Extinguisher/FireExtinguisherComponent.cs b/Content.Server/Extinguisher/FireExtinguisherComponent.cs index bcab8b78fd..a67bce5af0 100644 --- a/Content.Server/Extinguisher/FireExtinguisherComponent.cs +++ b/Content.Server/Extinguisher/FireExtinguisherComponent.cs @@ -60,15 +60,15 @@ namespace Content.Server.Extinguisher } var targetEntity = eventArgs.Target; - if (IoCManager.Resolve().HasComponent(eventArgs.Target.Uid) - && solutionContainerSystem.TryGetDrainableSolution(targetEntity.Uid, out var targetSolution) - && solutionContainerSystem.TryGetDrainableSolution(Owner.Uid, out var container)) + if (IoCManager.Resolve().HasComponent(eventArgs.Target) + && solutionContainerSystem.TryGetDrainableSolution(targetEntity, out var targetSolution) + && solutionContainerSystem.TryGetDrainableSolution(Owner, out var container)) { var transfer = FixedPoint2.Min(container.AvailableVolume, targetSolution.DrainAvailable); if (transfer > 0) { - var drained = solutionContainerSystem.Drain(targetEntity.Uid, targetSolution, transfer); - solutionContainerSystem.TryAddSolution(Owner.Uid, container, drained); + var drained = solutionContainerSystem.Drain(targetEntity, targetSolution, transfer); + solutionContainerSystem.TryAddSolution(Owner, container, drained); SoundSystem.Play(Filter.Pvs(Owner), _refillSound.GetSound(), Owner); eventArgs.Target.PopupMessage(eventArgs.User, @@ -99,18 +99,18 @@ namespace Content.Server.Extinguisher private void SetSafety(IEntity user, bool state) { - if (!EntitySystem.Get().CanInteract(user.Uid) || !_hasSafety) + if (!EntitySystem.Get().CanInteract(user) || !_hasSafety) return; _safety = state; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) appearance.SetData(FireExtinguisherVisuals.Safety, _safety); } void IDropped.Dropped(DroppedEventArgs eventArgs) { - if (_hasSafety && IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (_hasSafety && IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) appearance.SetData(FireExtinguisherVisuals.Safety, _safety); } } diff --git a/Content.Server/Flash/FlashSystem.cs b/Content.Server/Flash/FlashSystem.cs index 04341050a1..7333571b24 100644 --- a/Content.Server/Flash/FlashSystem.cs +++ b/Content.Server/Flash/FlashSystem.cs @@ -52,7 +52,7 @@ namespace Content.Server.Flash args.Handled = true; foreach (IEntity e in args.HitEntities) { - Flash(e.Uid, args.User.Uid, uid, comp.FlashDuration, comp.SlowTo); + Flash(e, args.User, uid, comp.FlashDuration, comp.SlowTo); } } @@ -63,10 +63,10 @@ namespace Content.Server.Flash return; } - if (IoCManager.Resolve().HasComponent(args.Entity.Uid)) + if (IoCManager.Resolve().HasComponent(args.Entity)) { args.CanInteract = true; - Flash(args.Entity.Uid, args.User.Uid, uid, comp.FlashDuration, comp.SlowTo); + Flash(args.Entity, args.User, uid, comp.FlashDuration, comp.SlowTo); } } @@ -77,9 +77,9 @@ namespace Content.Server.Flash return; } - foreach (var entity in _entityLookup.GetEntitiesInRange(IoCManager.Resolve().GetComponent(comp.Owner.Uid).Coordinates, comp.Range)) + foreach (var entity in _entityLookup.GetEntitiesInRange(IoCManager.Resolve().GetComponent(comp.Owner).Coordinates, comp.Range)) { - Flash(entity.Uid, args.User.Uid, uid, comp.AoeFlashDuration, comp.SlowTo); + Flash(entity, args.User, uid, comp.AoeFlashDuration, comp.SlowTo); } } @@ -88,7 +88,7 @@ namespace Content.Server.Flash if (comp.HasUses) { // TODO flash visualizer - if (!IoCManager.Resolve().TryGetComponent(comp.Owner.Uid, out var sprite)) + if (!IoCManager.Resolve().TryGetComponent(comp.Owner, out var sprite)) return false; if (--comp.Uses == 0) @@ -155,10 +155,10 @@ namespace Content.Server.Flash foreach (var entity in _entityLookup.GetEntitiesInRange(transform.Coordinates, range)) { - if (!IoCManager.Resolve().HasComponent(entity.Uid) || + if (!IoCManager.Resolve().HasComponent(entity) || !transform.InRangeUnobstructed(entity, range, CollisionGroup.Opaque)) continue; - Flash(entity.Uid, user, source, duration, slowTo, displayPopup); + Flash(entity, user, source, duration, slowTo, displayPopup); } if (sound != null) @@ -191,7 +191,7 @@ namespace Content.Server.Flash { // Forward the event to the glasses, if any. if(component.TryGetSlotItem(EquipmentSlotDefines.Slots.EYES, out ItemComponent? glasses)) - RaiseLocalEvent(glasses.Owner.Uid, args); + RaiseLocalEvent(glasses.Owner, args); } private void OnFlashImmunityFlashAttempt(EntityUid uid, FlashImmunityComponent component, FlashAttemptEvent args) diff --git a/Content.Server/Fluids/Components/BucketComponent.cs b/Content.Server/Fluids/Components/BucketComponent.cs index 24c92713a8..bf86cddefc 100644 --- a/Content.Server/Fluids/Components/BucketComponent.cs +++ b/Content.Server/Fluids/Components/BucketComponent.cs @@ -31,19 +31,19 @@ namespace Content.Server.Fluids.Components public FixedPoint2 MaxVolume { get => - EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution) + EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution) ? solution.MaxVolume : FixedPoint2.Zero; set { - if (EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution)) + if (EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution)) { solution.MaxVolume = value; } } } - public FixedPoint2 CurrentVolume => EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution) + public FixedPoint2 CurrentVolume => EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution) ? solution.CurrentVolume : FixedPoint2.Zero; @@ -54,9 +54,9 @@ namespace Content.Server.Fluids.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { var solutionsSys = EntitySystem.Get(); - if (!solutionsSys.TryGetSolution(Owner.Uid, SolutionName, out var contents) || - _currentlyUsing.Contains(eventArgs.Using.Uid) || - !IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out MopComponent? mopComponent) || + if (!solutionsSys.TryGetSolution(Owner, SolutionName, out var contents) || + _currentlyUsing.Contains(eventArgs.Using) || + !IoCManager.Resolve().TryGetComponent(eventArgs.Using, out MopComponent? mopComponent) || mopComponent.Mopping) { return false; @@ -74,7 +74,7 @@ namespace Content.Server.Fluids.Components return false; } - _currentlyUsing.Add(eventArgs.Using.Uid); + _currentlyUsing.Add(eventArgs.Using); // IMO let em move while doing it. var doAfterArgs = new DoAfterEventArgs(eventArgs.User, 1.0f, target: eventArgs.Target) @@ -84,10 +84,10 @@ namespace Content.Server.Fluids.Components }; var result = await EntitySystem.Get().WaitDoAfter(doAfterArgs); - _currentlyUsing.Remove(eventArgs.Using.Uid); + _currentlyUsing.Remove(eventArgs.Using); if (result == DoAfterStatus.Cancelled || - (!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || + (!IoCManager.Resolve().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner).EntityLifeStage) >= EntityLifeStage.Deleted || mopComponent.Deleted || CurrentVolume <= 0 || !Owner.InRangeUnobstructed(mopComponent.Owner)) @@ -108,8 +108,8 @@ namespace Content.Server.Fluids.Components return false; } - var solution = solutionsSys.SplitSolution(Owner.Uid, contents, transferAmount); - if (!solutionsSys.TryAddSolution(mopComponent.Owner.Uid, mopContents, solution)) + var solution = solutionsSys.SplitSolution(Owner, contents, transferAmount); + if (!solutionsSys.TryAddSolution(mopComponent.Owner, mopContents, solution)) { return false; } diff --git a/Content.Server/Fluids/Components/MopComponent.cs b/Content.Server/Fluids/Components/MopComponent.cs index fd326e7574..ca865fbc28 100644 --- a/Content.Server/Fluids/Components/MopComponent.cs +++ b/Content.Server/Fluids/Components/MopComponent.cs @@ -37,7 +37,7 @@ namespace Content.Server.Fluids.Components { get { - EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution); + EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution); return solution; } } @@ -90,7 +90,7 @@ namespace Content.Server.Fluids.Components */ var solutionSystem = EntitySystem.Get(); - if (!solutionSystem.TryGetSolution(Owner.Uid, SolutionName, out var contents ) || + if (!solutionSystem.TryGetSolution(Owner, SolutionName, out var contents ) || Mopping || !eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true)) { @@ -106,12 +106,12 @@ namespace Content.Server.Fluids.Components if (eventArgs.Target == null) { // Drop the liquid on the mop on to the ground - solutionSystem.SplitSolution(Owner.Uid, contents, FixedPoint2.Min(ResidueAmount, CurrentVolume)) + solutionSystem.SplitSolution(Owner, contents, FixedPoint2.Min(ResidueAmount, CurrentVolume)) .SpillAt(eventArgs.ClickLocation, "PuddleSmear"); return true; } - if (!IoCManager.Resolve().TryGetComponent(eventArgs.Target.Uid, out PuddleComponent? puddleComponent) || + if (!IoCManager.Resolve().TryGetComponent(eventArgs.Target, out PuddleComponent? puddleComponent) || !solutionSystem.TryGetSolution(puddleComponent.OwnerUid, puddleComponent.SolutionName, out var puddleSolution)) return false; @@ -128,7 +128,7 @@ namespace Content.Server.Fluids.Components Mopping = false; if (result == DoAfterStatus.Cancelled || - (!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || + (!IoCManager.Resolve().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner).EntityLifeStage) >= EntityLifeStage.Deleted || puddleComponent.Deleted) return false; @@ -143,21 +143,21 @@ namespace Content.Server.Fluids.Components // is the puddle cleaned? if (puddleSolution.TotalVolume - transferAmount <= 0) { - IoCManager.Resolve().DeleteEntity(puddleComponent.Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) puddleComponent.Owner); // After cleaning the puddle, make a new puddle with solution from the mop as a "wet floor". Then evaporate it slowly. // we do this WITHOUT adding to the existing puddle. Otherwise we have might have water puddles with the vomit sprite. - solutionSystem.SplitSolution(Owner.Uid, contents, transferAmount) + solutionSystem.SplitSolution(Owner, contents, transferAmount) .SplitSolution(ResidueAmount) .SpillAt(eventArgs.ClickLocation, "PuddleSmear", combine: false); } else { // remove solution from the puddle - solutionSystem.SplitSolution(eventArgs.Target.Uid, puddleSolution, transferAmount); + solutionSystem.SplitSolution(eventArgs.Target, puddleSolution, transferAmount); // and from the mop - solutionSystem.SplitSolution(Owner.Uid, contents, transferAmount); + solutionSystem.SplitSolution(Owner, contents, transferAmount); } SoundSystem.Play(Filter.Pvs(Owner), _pickupSound.GetSound(), Owner); diff --git a/Content.Server/Fluids/Components/PuddleComponent.cs b/Content.Server/Fluids/Components/PuddleComponent.cs index bd020bf788..da545e805e 100644 --- a/Content.Server/Fluids/Components/PuddleComponent.cs +++ b/Content.Server/Fluids/Components/PuddleComponent.cs @@ -47,7 +47,7 @@ namespace Content.Server.Fluids.Components public bool Overflown; [ViewVariables(VVAccess.ReadOnly)] - public FixedPoint2 CurrentVolume => EntitySystem.Get().CurrentVolume(Owner.Uid); + public FixedPoint2 CurrentVolume => EntitySystem.Get().CurrentVolume(Owner); [ViewVariables] [DataField("overflowVolume")] public FixedPoint2 OverflowVolume = DefaultOverflowVolume; diff --git a/Content.Server/Fluids/Components/SpillExtensions.cs b/Content.Server/Fluids/Components/SpillExtensions.cs index 357f0d2ac5..9b9efc3e0f 100644 --- a/Content.Server/Fluids/Components/SpillExtensions.cs +++ b/Content.Server/Fluids/Components/SpillExtensions.cs @@ -31,7 +31,7 @@ namespace Content.Server.Fluids.Components public static PuddleComponent? SpillAt(this Solution solution, IEntity entity, string prototype, bool sound = true, bool combine = true) { - return solution.SpillAt(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates, prototype, sound, combine: combine); + return solution.SpillAt(IoCManager.Resolve().GetComponent(entity).Coordinates, prototype, sound, combine: combine); } /// @@ -118,7 +118,7 @@ namespace Content.Server.Fluids.Components { foreach (var entity in tileRef.GetEntitiesInTileFast(gridTileLookupSystem)) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out PuddleComponent? p)) + if (IoCManager.Resolve().TryGetComponent(entity, out PuddleComponent? p)) { puddle = p; return true; @@ -167,9 +167,9 @@ namespace Content.Server.Fluids.Components foreach (var spillEntity in spillEntities) { if (EntitySystem.Get() - .TryGetRefillableSolution(spillEntity.Uid, out var solutionContainerComponent)) + .TryGetRefillableSolution(spillEntity, out var solutionContainerComponent)) { - EntitySystem.Get().Refill(spillEntity.Uid, solutionContainerComponent, + EntitySystem.Get().Refill(spillEntity, solutionContainerComponent, solution.SplitSolution(FixedPoint2.Min( solutionContainerComponent.AvailableVolume, solutionContainerComponent.MaxSpillRefill)) @@ -183,20 +183,20 @@ namespace Content.Server.Fluids.Components { foreach (var spillEntity in spillEntities) { - if (!IoCManager.Resolve().TryGetComponent(spillEntity.Uid, out PuddleComponent? puddleComponent)) continue; + if (!IoCManager.Resolve().TryGetComponent(spillEntity, out PuddleComponent? puddleComponent)) continue; - if (!overflow && puddleSystem.WouldOverflow(puddleComponent.Owner.Uid, solution, puddleComponent)) return null; + if (!overflow && puddleSystem.WouldOverflow(puddleComponent.Owner, solution, puddleComponent)) return null; - if (!puddleSystem.TryAddSolution(puddleComponent.Owner.Uid, solution, sound)) continue; + if (!puddleSystem.TryAddSolution(puddleComponent.Owner, solution, sound)) continue; return puddleComponent; } } var puddleEnt = serverEntityManager.SpawnEntity(prototype, spillGridCoords); - var newPuddleComponent = IoCManager.Resolve().GetComponent(puddleEnt.Uid); + var newPuddleComponent = IoCManager.Resolve().GetComponent(puddleEnt); - puddleSystem.TryAddSolution(newPuddleComponent.Owner.Uid, solution, sound); + puddleSystem.TryAddSolution(newPuddleComponent.Owner, solution, sound); return newPuddleComponent; } diff --git a/Content.Server/Fluids/Components/SprayComponent.cs b/Content.Server/Fluids/Components/SprayComponent.cs index 8325f1f79e..2fbcbbca98 100644 --- a/Content.Server/Fluids/Components/SprayComponent.cs +++ b/Content.Server/Fluids/Components/SprayComponent.cs @@ -78,14 +78,14 @@ namespace Content.Server.Fluids.Components public FixedPoint2 CurrentVolume { get { - EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution); + EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution); return solution?.CurrentVolume ?? FixedPoint2.Zero; } } async Task IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs) { - if (!EntitySystem.Get().CanInteract(eventArgs.User.Uid)) + if (!EntitySystem.Get().CanInteract(eventArgs.User)) return false; if (CurrentVolume <= 0) @@ -99,13 +99,13 @@ namespace Content.Server.Fluids.Components if(curTime < _cooldownEnd) return true; - var playerPos = IoCManager.Resolve().GetComponent(eventArgs.User.Uid).Coordinates; + var playerPos = IoCManager.Resolve().GetComponent(eventArgs.User).Coordinates; var entManager = IoCManager.Resolve(); if (eventArgs.ClickLocation.GetGridId(entManager) != playerPos.GetGridId(entManager)) return true; - if (!EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var contents)) + if (!EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var contents)) return true; var direction = (eventArgs.ClickLocation.Position - playerPos.Position).Normalized; @@ -124,35 +124,35 @@ namespace Content.Server.Fluids.Components var diffNorm = diffPos.Normalized; var diffLength = diffPos.Length; - var target = IoCManager.Resolve().GetComponent(eventArgs.User.Uid).Coordinates.Offset((diffNorm + rotation.ToVec()).Normalized * diffLength + quarter); + var target = IoCManager.Resolve().GetComponent(eventArgs.User).Coordinates.Offset((diffNorm + rotation.ToVec()).Normalized * diffLength + quarter); if (target.TryDistance(IoCManager.Resolve(), playerPos, out var distance) && distance > SprayDistance) - target = IoCManager.Resolve().GetComponent(eventArgs.User.Uid).Coordinates.Offset(diffNorm * SprayDistance); + target = IoCManager.Resolve().GetComponent(eventArgs.User).Coordinates.Offset(diffNorm * SprayDistance); - var solution = EntitySystem.Get().SplitSolution(Owner.Uid, contents, _transferAmount); + var solution = EntitySystem.Get().SplitSolution(Owner, contents, _transferAmount); if (solution.TotalVolume <= FixedPoint2.Zero) break; var vapor = entManager.SpawnEntity(_vaporPrototype, playerPos.Offset(distance < 1 ? quarter : threeQuarters)); - IoCManager.Resolve().GetComponent(vapor.Uid).LocalRotation = rotation; + IoCManager.Resolve().GetComponent(vapor).LocalRotation = rotation; - if (IoCManager.Resolve().TryGetComponent(vapor.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(vapor, out AppearanceComponent? appearance)) { appearance.SetData(VaporVisuals.Color, contents.Color.WithAlpha(1f)); appearance.SetData(VaporVisuals.State, true); } // Add the solution to the vapor and actually send the thing - var vaporComponent = IoCManager.Resolve().GetComponent(vapor.Uid); + var vaporComponent = IoCManager.Resolve().GetComponent(vapor); var vaporSystem = EntitySystem.Get(); vaporSystem.TryAddSolution(vaporComponent, solution); // impulse direction is defined in world-coordinates, not local coordinates - var impulseDirection = IoCManager.Resolve().GetComponent(vapor.Uid).WorldRotation.ToVec(); + var impulseDirection = IoCManager.Resolve().GetComponent(vapor).WorldRotation.ToVec(); vaporSystem.Start(vaporComponent, impulseDirection, _sprayVelocity, target, _sprayAliveTime); - if (_impulse > 0f && IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out IPhysBody? body)) + if (_impulse > 0f && IoCManager.Resolve().TryGetComponent(eventArgs.User, out IPhysBody? body)) { body.ApplyLinearImpulse(-impulseDirection * _impulse); } @@ -163,7 +163,7 @@ namespace Content.Server.Fluids.Components _lastUseTime = curTime; _cooldownEnd = _lastUseTime + TimeSpan.FromSeconds(_cooldownTime); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ItemCooldownComponent? cooldown)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ItemCooldownComponent? cooldown)) { cooldown.CooldownStart = _lastUseTime; cooldown.CooldownEnd = _cooldownEnd; diff --git a/Content.Server/Fluids/EntitySystems/EvaporationSystem.cs b/Content.Server/Fluids/EntitySystems/EvaporationSystem.cs index 0ca5a761bf..ff32c906ea 100644 --- a/Content.Server/Fluids/EntitySystems/EvaporationSystem.cs +++ b/Content.Server/Fluids/EntitySystems/EvaporationSystem.cs @@ -20,7 +20,7 @@ namespace Content.Server.Fluids.EntitySystems var queueDelete = new RemQueue(); foreach (var evaporationComponent in EntityManager.EntityQuery()) { - var uid = evaporationComponent.Owner.Uid; + var uid = (EntityUid) evaporationComponent.Owner; evaporationComponent.Accumulator += frameTime; if (!_solutionContainerSystem.TryGetSolution(uid, evaporationComponent.SolutionName, out var solution)) @@ -52,7 +52,7 @@ namespace Content.Server.Fluids.EntitySystems foreach (var evaporationComponent in queueDelete) { - EntityManager.RemoveComponent(evaporationComponent.Owner.Uid, evaporationComponent); + EntityManager.RemoveComponent(evaporationComponent.Owner, evaporationComponent); } } } diff --git a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs index 92d9252c45..3d105159fe 100644 --- a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs +++ b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs @@ -61,7 +61,7 @@ namespace Content.Server.Fluids.EntitySystems private void UpdateVisuals(EntityUid uid, PuddleComponent puddleComponent) { - if ((!IoCManager.Resolve().EntityExists(puddleComponent.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(puddleComponent.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || EmptyHolder(uid, puddleComponent) || + if ((!IoCManager.Resolve().EntityExists(puddleComponent.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(puddleComponent.Owner).EntityLifeStage) >= EntityLifeStage.Deleted || EmptyHolder(uid, puddleComponent) || !EntityManager.TryGetComponent(uid, out var appearanceComponent)) { return; @@ -96,7 +96,7 @@ namespace Content.Server.Fluids.EntitySystems if (!args.CanAccess || !args.CanInteract) return; - if (!_solutionContainerSystem.TryGetDrainableSolution(args.Target.Uid, out var solution)) + if (!_solutionContainerSystem.TryGetDrainableSolution(args.Target, out var solution)) return; if (solution.DrainAvailable == FixedPoint2.Zero) @@ -105,8 +105,8 @@ namespace Content.Server.Fluids.EntitySystems Verb verb = new(); verb.Text = Loc.GetString("spill-target-verb-get-data-text"); // TODO VERB ICONS spill icon? pouring out a glass/beaker? - verb.Act = () => _solutionContainerSystem.SplitSolution(args.Target.Uid, - solution, solution.DrainAvailable).SpillAt(IoCManager.Resolve().GetComponent(args.Target.Uid).Coordinates, "PuddleSmear"); + verb.Act = () => _solutionContainerSystem.SplitSolution(args.Target, + solution, solution.DrainAvailable).SpillAt(IoCManager.Resolve().GetComponent(args.Target).Coordinates, "PuddleSmear"); verb.Impact = LogImpact.Medium; // dangerous reagent reaction are logged separately. args.Verbs.Add(verb); } @@ -121,10 +121,10 @@ namespace Content.Server.Fluids.EntitySystems private void OnUnanchored(EntityUid uid, PuddleComponent puddle, UnanchoredEvent unanchoredEvent) { - if (!IoCManager.Resolve().GetComponent(puddle.Owner.Uid).Anchored) + if (!IoCManager.Resolve().GetComponent(puddle.Owner).Anchored) return; - IoCManager.Resolve().QueueDeleteEntity(puddle.Owner.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) puddle.Owner); } /// @@ -147,7 +147,7 @@ namespace Content.Server.Fluids.EntitySystems if (!Resolve(uid, ref puddleComponent)) return true; - return !_solutionContainerSystem.TryGetSolution(puddleComponent.Owner.Uid, puddleComponent.SolutionName, + return !_solutionContainerSystem.TryGetSolution(puddleComponent.Owner, puddleComponent.SolutionName, out var solution) || solution.Contents.Count == 0; } @@ -157,7 +157,7 @@ namespace Content.Server.Fluids.EntitySystems if (!Resolve(uid, ref puddleComponent)) return FixedPoint2.Zero; - return _solutionContainerSystem.TryGetSolution(puddleComponent.Owner.Uid, puddleComponent.SolutionName, + return _solutionContainerSystem.TryGetSolution(puddleComponent.Owner, puddleComponent.SolutionName, out var solution) ? solution.CurrentVolume : FixedPoint2.Zero; @@ -172,7 +172,7 @@ namespace Content.Server.Fluids.EntitySystems return false; if (solution.TotalVolume == 0 || - !_solutionContainerSystem.TryGetSolution(puddleComponent.Owner.Uid, puddleComponent.SolutionName, + !_solutionContainerSystem.TryGetSolution(puddleComponent.Owner, puddleComponent.SolutionName, out var puddleSolution)) { return false; @@ -180,13 +180,13 @@ namespace Content.Server.Fluids.EntitySystems var result = _solutionContainerSystem - .TryAddSolution(puddleComponent.Owner.Uid, puddleSolution, solution); + .TryAddSolution(puddleComponent.Owner, puddleSolution, solution); if (!result) { return false; } - RaiseLocalEvent(puddleComponent.Owner.Uid, new SolutionChangedEvent()); + RaiseLocalEvent(puddleComponent.Owner, new SolutionChangedEvent()); if (checkForOverflow) { @@ -241,12 +241,12 @@ namespace Content.Server.Fluids.EntitySystems { var adjacentPuddle = adjacent(); var quantity = FixedPoint2.Min(overflowSplit, adjacentPuddle.OverflowVolume); - var puddleSolution = _solutionContainerSystem.EnsureSolution(puddleComponent.Owner.Uid, + var puddleSolution = _solutionContainerSystem.EnsureSolution(puddleComponent.Owner, puddleComponent.SolutionName); - var spillAmount = _solutionContainerSystem.SplitSolution(puddleComponent.Owner.Uid, + var spillAmount = _solutionContainerSystem.SplitSolution(puddleComponent.Owner, puddleSolution, quantity); - TryAddSolution(adjacentPuddle.Owner.Uid, spillAmount, false, false); + TryAddSolution(adjacentPuddle.Owner, spillAmount, false, false); nextPuddles.Add(adjacentPuddle); } } @@ -288,11 +288,11 @@ namespace Content.Server.Fluids.EntitySystems puddle = default; // We're most likely in space, do nothing. - if (!IoCManager.Resolve().GetComponent(puddleComponent.Owner.Uid).GridID.IsValid()) + if (!IoCManager.Resolve().GetComponent(puddleComponent.Owner).GridID.IsValid()) return false; - var mapGrid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(puddleComponent.Owner.Uid).GridID); - var coords = IoCManager.Resolve().GetComponent(puddleComponent.Owner.Uid).Coordinates; + var mapGrid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(puddleComponent.Owner).GridID); + var coords = IoCManager.Resolve().GetComponent(puddleComponent.Owner).Coordinates; if (!coords.Offset(direction).TryGetTileRef(out var tile)) { @@ -305,7 +305,7 @@ namespace Content.Server.Fluids.EntitySystems return false; } - if (!IoCManager.Resolve().GetComponent(puddleComponent.Owner.Uid).Anchored) + if (!IoCManager.Resolve().GetComponent(puddleComponent.Owner).Anchored) return false; foreach (var entity in mapGrid.GetInDir(coords, direction)) @@ -330,8 +330,9 @@ namespace Content.Server.Fluids.EntitySystems puddle ??= () => { - return IoCManager.Resolve().GetComponent(IoCManager.Resolve().SpawnEntity(IoCManager.Resolve().GetComponent(puddleComponent.Owner.Uid).EntityPrototype?.ID, - mapGrid.DirectionToGrid(coords, direction)).Uid); + IEntity tempQualifier = IoCManager.Resolve().SpawnEntity(IoCManager.Resolve().GetComponent(puddleComponent.Owner).EntityPrototype?.ID, + mapGrid.DirectionToGrid(coords, direction)); + return IoCManager.Resolve().GetComponent(tempQualifier); }; return true; diff --git a/Content.Server/GameTicking/Commands/MappingCommand.cs b/Content.Server/GameTicking/Commands/MappingCommand.cs index d5a98c46c6..34e45facd9 100644 --- a/Content.Server/GameTicking/Commands/MappingCommand.cs +++ b/Content.Server/GameTicking/Commands/MappingCommand.cs @@ -77,7 +77,7 @@ namespace Content.Server.GameTicking.Commands shell.ExecuteCommand($"loadbp {mapId} \"{CommandParsing.Escape(mapName)}\" true"); IEntity? tempQualifier = player.AttachedEntity; - if ((tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid).EntityPrototype : null)?.ID != "AdminObserver") + if ((tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier).EntityPrototype : null)?.ID != "AdminObserver") shell.ExecuteCommand("aghost"); shell.ExecuteCommand($"tp 0 0 {mapId}"); diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index 864b83a318..3e4d0d0c46 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -280,7 +280,7 @@ namespace Content.Server.GameTicking if (mind.CharacterName != null) playerIcName = mind.CharacterName; else if (mind.CurrentEntity != null) - playerIcName = IoCManager.Resolve().GetComponent(mind.CurrentEntity.Uid).EntityName; + playerIcName = IoCManager.Resolve().GetComponent(mind.CurrentEntity).EntityName; var playerEndRoundInfo = new RoundEndMessageEvent.RoundEndPlayerInfo() { @@ -371,7 +371,7 @@ namespace Content.Server.GameTicking { // TODO: Maybe something less naive here? // FIXME: Actually, definitely. - IoCManager.Resolve().DeleteEntity(entity.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) entity); } _mapManager.Restart(); diff --git a/Content.Server/GameTicking/GameTicker.Spawning.cs b/Content.Server/GameTicking/GameTicker.Spawning.cs index 48f31e3ed4..238a614695 100644 --- a/Content.Server/GameTicking/GameTicker.Spawning.cs +++ b/Content.Server/GameTicking/GameTicker.Spawning.cs @@ -119,7 +119,7 @@ namespace Content.Server.GameTicking } var mob = SpawnPlayerMob(job, character, station, lateJoin); - newMind.TransferTo(mob.Uid); + newMind.TransferTo(mob); if (player.UserId == new Guid("{e887eb93-f503-4b65-95b6-2f282c014192}")) { @@ -190,10 +190,10 @@ namespace Content.Server.GameTicking newMind.AddRole(new ObserverRole(newMind)); var mob = SpawnObserverMob(); - IoCManager.Resolve().GetComponent(mob.Uid).EntityName = name; - var ghost = IoCManager.Resolve().GetComponent(mob.Uid); + IoCManager.Resolve().GetComponent(mob).EntityName = name; + var ghost = IoCManager.Resolve().GetComponent(mob); EntitySystem.Get().SetCanReturnToBody(ghost, false); - newMind.TransferTo(mob.Uid); + newMind.TransferTo(mob); _playersInLobby[player] = LobbyPlayerStatus.Observer; RaiseNetworkEvent(GetStatusSingle(player, LobbyPlayerStatus.Observer)); @@ -213,8 +213,8 @@ namespace Content.Server.GameTicking if (profile != null) { - EntitySystem.Get().UpdateFromProfile(entity.Uid, profile); - IoCManager.Resolve().GetComponent(entity.Uid).EntityName = profile.Name; + EntitySystem.Get().UpdateFromProfile(entity, profile); + IoCManager.Resolve().GetComponent(entity).EntityName = profile.Name; } return entity; @@ -230,25 +230,25 @@ namespace Content.Server.GameTicking #region Equip Helpers public void EquipStartingGear(IEntity entity, StartingGearPrototype startingGear, HumanoidCharacterProfile? profile) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out InventoryComponent? inventory)) + if (IoCManager.Resolve().TryGetComponent(entity, out InventoryComponent? inventory)) { foreach (var slot in EquipmentSlotDefines.AllSlots) { var equipmentStr = startingGear.GetGear(slot, profile); if (!string.IsNullOrEmpty(equipmentStr)) { - var equipmentEntity = EntityManager.SpawnEntity(equipmentStr, IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); - inventory.Equip(slot, IoCManager.Resolve().GetComponent(equipmentEntity.Uid)); + var equipmentEntity = EntityManager.SpawnEntity(equipmentStr, IoCManager.Resolve().GetComponent(entity).Coordinates); + inventory.Equip(slot, IoCManager.Resolve().GetComponent(equipmentEntity)); } } } - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out HandsComponent? handsComponent)) + if (IoCManager.Resolve().TryGetComponent(entity, out HandsComponent? handsComponent)) { var inhand = startingGear.Inhand; foreach (var (hand, prototype) in inhand) { - var inhandEntity = EntityManager.SpawnEntity(prototype, IoCManager.Resolve().GetComponent(entity.Uid).Coordinates); + var inhandEntity = EntityManager.SpawnEntity(prototype, IoCManager.Resolve().GetComponent(entity).Coordinates); handsComponent.TryPickupEntity(hand, inhandEntity, checkActionBlocker: false); } } @@ -256,7 +256,7 @@ namespace Content.Server.GameTicking public void EquipIdCard(IEntity entity, string characterName, JobPrototype jobPrototype) { - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out InventoryComponent? inventory)) + if (!IoCManager.Resolve().TryGetComponent(entity, out InventoryComponent? inventory)) return; if (!inventory.TryGetSlotItem(EquipmentSlotDefines.Slots.IDCARD, out ItemComponent? item)) @@ -266,14 +266,14 @@ namespace Content.Server.GameTicking var itemEntity = item.Owner; - if (!IoCManager.Resolve().TryGetComponent(itemEntity.Uid, out PDAComponent? pdaComponent) || pdaComponent.ContainedID == null) + if (!IoCManager.Resolve().TryGetComponent(itemEntity, out PDAComponent? pdaComponent) || pdaComponent.ContainedID == null) return; var card = pdaComponent.ContainedID; - _cardSystem.TryChangeFullName(card.Owner.Uid, characterName, card); - _cardSystem.TryChangeJobTitle(card.Owner.Uid, jobPrototype.Name, card); + _cardSystem.TryChangeFullName(card.Owner, characterName, card); + _cardSystem.TryChangeJobTitle(card.Owner, jobPrototype.Name, card); - var access = IoCManager.Resolve().GetComponent(card.Owner.Uid); + var access = IoCManager.Resolve().GetComponent(card.Owner); var accessTags = access.Tags; accessTags.UnionWith(jobPrototype.Access); EntityManager.EntitySysManager.GetEntitySystem() diff --git a/Content.Server/GameTicking/Presets/GamePreset.cs b/Content.Server/GameTicking/Presets/GamePreset.cs index a265046cd8..434463bf02 100644 --- a/Content.Server/GameTicking/Presets/GamePreset.cs +++ b/Content.Server/GameTicking/Presets/GamePreset.cs @@ -39,7 +39,7 @@ namespace Content.Server.GameTicking.Presets { var playerEntity = mind.OwnedEntity; - if (playerEntity != null && IoCManager.Resolve().HasComponent(playerEntity.Uid)) + if (playerEntity != null && IoCManager.Resolve().HasComponent(playerEntity)) return false; if (mind.VisitingEntity != null) @@ -47,7 +47,7 @@ namespace Content.Server.GameTicking.Presets mind.UnVisit(); } - var position = (playerEntity != null ? IoCManager.Resolve().GetComponent(playerEntity.Uid) : null).Coordinates ?? EntitySystem.Get().GetObserverSpawnPoint(); + var position = (playerEntity != null ? IoCManager.Resolve().GetComponent(playerEntity) : null).Coordinates ?? EntitySystem.Get().GetObserverSpawnPoint(); // Ok, so, this is the master place for the logic for if ghosting is "too cheaty" to allow returning. // There's no reason at this time to move it to any other place, especially given that the 'side effects required' situations would also have to be moved. // + If CharacterDeadPhysically applies, we're physically dead. Therefore, ghosting OK, and we can return (this is critical for gibbing) @@ -58,7 +58,7 @@ namespace Content.Server.GameTicking.Presets // (If the mob survives, that's a bug. Ghosting is kept regardless.) var canReturn = canReturnGlobal && mind.CharacterDeadPhysically; - if (playerEntity != null && canReturnGlobal && IoCManager.Resolve().TryGetComponent(playerEntity.Uid, out MobStateComponent? mobState)) + if (playerEntity != null && canReturnGlobal && IoCManager.Resolve().TryGetComponent(playerEntity, out MobStateComponent? mobState)) { if (mobState.IsCritical()) { @@ -67,7 +67,7 @@ namespace Content.Server.GameTicking.Presets //todo: what if they dont breathe lol //cry deeply DamageSpecifier damage = new(IoCManager.Resolve().Index("Asphyxiation"), 200); - EntitySystem.Get().TryChangeDamage(playerEntity.Uid, damage, true); + EntitySystem.Get().TryChangeDamage(playerEntity, damage, true); } } @@ -78,11 +78,11 @@ namespace Content.Server.GameTicking.Presets // If all else fails, it'll default to the default entity prototype name, "observer". // However, that should rarely happen. if(!string.IsNullOrWhiteSpace(mind.CharacterName)) - IoCManager.Resolve().GetComponent(ghost.Uid).EntityName = mind.CharacterName; + IoCManager.Resolve().GetComponent(ghost).EntityName = mind.CharacterName; else if (!string.IsNullOrWhiteSpace(mind.Session?.Name)) - IoCManager.Resolve().GetComponent(ghost.Uid).EntityName = mind.Session.Name; + IoCManager.Resolve().GetComponent(ghost).EntityName = mind.Session.Name; - var ghostComponent = IoCManager.Resolve().GetComponent(ghost.Uid); + var ghostComponent = IoCManager.Resolve().GetComponent(ghost); if (mind.TimeOfDeath.HasValue) { @@ -94,7 +94,7 @@ namespace Content.Server.GameTicking.Presets if (canReturn) mind.Visit(ghost); else - mind.TransferTo(ghost.Uid); + mind.TransferTo(ghost); return true; } diff --git a/Content.Server/GameTicking/Presets/PresetSuspicion.cs b/Content.Server/GameTicking/Presets/PresetSuspicion.cs index 59f3e7d1db..21cce723bd 100644 --- a/Content.Server/GameTicking/Presets/PresetSuspicion.cs +++ b/Content.Server/GameTicking/Presets/PresetSuspicion.cs @@ -115,7 +115,7 @@ namespace Content.Server.GameTicking.Presets // creadth: we need to create uplink for the antag. // PDA should be in place already, so we just need to // initiate uplink account. - var uplinkAccount = new UplinkAccount(TraitorStartingBalance, mind.OwnedEntity!.Uid); + var uplinkAccount = new UplinkAccount(TraitorStartingBalance, mind.OwnedEntity!); var accounts = EntityManager.EntitySysManager.GetEntitySystem(); accounts.AddNewAccount(uplinkAccount); diff --git a/Content.Server/GameTicking/Presets/PresetTraitor.cs b/Content.Server/GameTicking/Presets/PresetTraitor.cs index e89f15cff1..135419da4a 100644 --- a/Content.Server/GameTicking/Presets/PresetTraitor.cs +++ b/Content.Server/GameTicking/Presets/PresetTraitor.cs @@ -126,7 +126,7 @@ namespace Content.Server.GameTicking.Presets // initiate uplink account. DebugTools.AssertNotNull(mind.OwnedEntity); - var uplinkAccount = new UplinkAccount(StartingBalance, mind.OwnedEntity!.Uid); + var uplinkAccount = new UplinkAccount(StartingBalance, mind.OwnedEntity!); var accounts = EntityManager.EntitySysManager.GetEntitySystem(); accounts.AddNewAccount(uplinkAccount); diff --git a/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs b/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs index 3884765920..a3da383f75 100644 --- a/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs +++ b/Content.Server/GameTicking/Presets/PresetTraitorDeathMatch.cs @@ -80,50 +80,50 @@ namespace Content.Server.GameTicking.Presets // Delete anything that may contain "dangerous" role-specific items. // (This includes the PDA, as everybody gets the captain PDA in this mode for true-all-access reasons.) - if (mind.OwnedEntity != null && IoCManager.Resolve().TryGetComponent(mind.OwnedEntity.Uid, out InventoryComponent? inventory)) + if (mind.OwnedEntity != null && IoCManager.Resolve().TryGetComponent(mind.OwnedEntity, out InventoryComponent? inventory)) { var victimSlots = new[] {EquipmentSlotDefines.Slots.IDCARD, EquipmentSlotDefines.Slots.BELT, EquipmentSlotDefines.Slots.BACKPACK}; foreach (var slot in victimSlots) { if (inventory.TryGetSlotItem(slot, out ItemComponent? vItem)) - IoCManager.Resolve().DeleteEntity(vItem.Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) vItem.Owner); } // Replace their items: // pda - var newPDA = _entityManager.SpawnEntity(PDAPrototypeName, IoCManager.Resolve().GetComponent(mind.OwnedEntity.Uid).Coordinates); - inventory.Equip(EquipmentSlotDefines.Slots.IDCARD, IoCManager.Resolve().GetComponent(newPDA.Uid)); + var newPDA = _entityManager.SpawnEntity(PDAPrototypeName, IoCManager.Resolve().GetComponent(mind.OwnedEntity).Coordinates); + inventory.Equip(EquipmentSlotDefines.Slots.IDCARD, IoCManager.Resolve().GetComponent(newPDA)); // belt - var newTmp = _entityManager.SpawnEntity(BeltPrototypeName, IoCManager.Resolve().GetComponent(mind.OwnedEntity.Uid).Coordinates); - inventory.Equip(EquipmentSlotDefines.Slots.BELT, IoCManager.Resolve().GetComponent(newTmp.Uid)); + var newTmp = _entityManager.SpawnEntity(BeltPrototypeName, IoCManager.Resolve().GetComponent(mind.OwnedEntity).Coordinates); + inventory.Equip(EquipmentSlotDefines.Slots.BELT, IoCManager.Resolve().GetComponent(newTmp)); // backpack - newTmp = _entityManager.SpawnEntity(BackpackPrototypeName, IoCManager.Resolve().GetComponent(mind.OwnedEntity.Uid).Coordinates); - inventory.Equip(EquipmentSlotDefines.Slots.BACKPACK, IoCManager.Resolve().GetComponent(newTmp.Uid)); + newTmp = _entityManager.SpawnEntity(BackpackPrototypeName, IoCManager.Resolve().GetComponent(mind.OwnedEntity).Coordinates); + inventory.Equip(EquipmentSlotDefines.Slots.BACKPACK, IoCManager.Resolve().GetComponent(newTmp)); // Like normal traitors, they need access to a traitor account. - var uplinkAccount = new UplinkAccount(startingBalance, mind.OwnedEntity.Uid); + var uplinkAccount = new UplinkAccount(startingBalance, mind.OwnedEntity); var accounts = _entityManager.EntitySysManager.GetEntitySystem(); accounts.AddNewAccount(uplinkAccount); _entityManager.EntitySysManager.GetEntitySystem() .AddUplink(mind.OwnedEntity, uplinkAccount, newPDA); - _allOriginalNames[uplinkAccount] = IoCManager.Resolve().GetComponent(mind.OwnedEntity.Uid).EntityName; + _allOriginalNames[uplinkAccount] = IoCManager.Resolve().GetComponent(mind.OwnedEntity).EntityName; // The PDA needs to be marked with the correct owner. - var pda = IoCManager.Resolve().GetComponent(newPDA.Uid); + var pda = IoCManager.Resolve().GetComponent(newPDA); _entityManager.EntitySysManager.GetEntitySystem() - .SetOwner(pda, IoCManager.Resolve().GetComponent(mind.OwnedEntity.Uid).EntityName); + .SetOwner(pda, IoCManager.Resolve().GetComponent(mind.OwnedEntity).EntityName); IoCManager.Resolve().AddComponent(newPDA).UserId = mind.UserId; } // Finally, it would be preferrable if they spawned as far away from other players as reasonably possible. if (mind.OwnedEntity != null && FindAnyIsolatedSpawnLocation(mind, out var bestTarget)) { - IoCManager.Resolve().GetComponent(mind.OwnedEntity.Uid).Coordinates = bestTarget; + IoCManager.Resolve().GetComponent(mind.OwnedEntity).Coordinates = bestTarget; } else { @@ -151,7 +151,7 @@ namespace Content.Server.GameTicking.Presets var avoidMeEntity = avoidMeMind.OwnedEntity; if (avoidMeEntity == null) continue; - if (IoCManager.Resolve().TryGetComponent(avoidMeEntity.Uid, out MobStateComponent? mobState)) + if (IoCManager.Resolve().TryGetComponent(avoidMeEntity, out MobStateComponent? mobState)) { // Does have mob state component; if critical or dead, they don't really matter for spawn checks if (mobState.IsCritical() || mobState.IsDead()) @@ -162,7 +162,7 @@ namespace Content.Server.GameTicking.Presets // Doesn't have mob state component. Assume something interesting is going on and don't count this as someone to avoid. continue; } - existingPlayerPoints.Add(IoCManager.Resolve().GetComponent(avoidMeEntity.Uid).Coordinates); + existingPlayerPoints.Add(IoCManager.Resolve().GetComponent(avoidMeEntity).Coordinates); } // Iterate over each possible spawn point, comparing to the existing player points. @@ -176,18 +176,18 @@ namespace Content.Server.GameTicking.Presets var atmosphereSystem = EntitySystem.Get(); foreach (var entity in ents) { - if (!atmosphereSystem.IsTileMixtureProbablySafe(IoCManager.Resolve().GetComponent(entity.Uid).Coordinates)) + if (!atmosphereSystem.IsTileMixtureProbablySafe(IoCManager.Resolve().GetComponent(entity).Coordinates)) continue; var distanceFromNearest = float.PositiveInfinity; foreach (var existing in existingPlayerPoints) { - if (IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.TryDistance(_entityManager, existing, out var dist)) + if (IoCManager.Resolve().GetComponent(entity).Coordinates.TryDistance(_entityManager, existing, out var dist)) distanceFromNearest = Math.Min(distanceFromNearest, dist); } if (bestTargetDistanceFromNearest < distanceFromNearest) { - bestTarget = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; + bestTarget = IoCManager.Resolve().GetComponent(entity).Coordinates; bestTargetDistanceFromNearest = distanceFromNearest; foundATarget = true; } @@ -198,17 +198,17 @@ namespace Content.Server.GameTicking.Presets public override bool OnGhostAttempt(Mind.Mind mind, bool canReturnGlobal) { var entity = mind.OwnedEntity; - if ((entity != null) && IoCManager.Resolve().TryGetComponent(entity.Uid, out MobStateComponent? mobState)) + if ((entity != null) && IoCManager.Resolve().TryGetComponent(entity, out MobStateComponent? mobState)) { if (mobState.IsCritical()) { // TODO BODY SYSTEM KILL var damage = new DamageSpecifier(_prototypeManager.Index("Asphyxiation"), 100); - EntitySystem.Get().TryChangeDamage(entity.Uid, damage, true); + EntitySystem.Get().TryChangeDamage(entity, damage, true); } else if (!mobState.IsDead()) { - if (IoCManager.Resolve().HasComponent(entity.Uid)) + if (IoCManager.Resolve().HasComponent(entity)) { return false; } diff --git a/Content.Server/GameTicking/Rules/RuleDeathMatch.cs b/Content.Server/GameTicking/Rules/RuleDeathMatch.cs index 2ee27b63fb..699404bfee 100644 --- a/Content.Server/GameTicking/Rules/RuleDeathMatch.cs +++ b/Content.Server/GameTicking/Rules/RuleDeathMatch.cs @@ -64,7 +64,7 @@ namespace Content.Server.GameTicking.Rules { var playerEntity = playerSession.AttachedEntity; if (playerEntity == null - || !IoCManager.Resolve().TryGetComponent(playerEntity.Uid, out MobStateComponent? state)) + || !IoCManager.Resolve().TryGetComponent(playerEntity, out MobStateComponent? state)) { continue; } diff --git a/Content.Server/GameTicking/Rules/RuleSuspicion.cs b/Content.Server/GameTicking/Rules/RuleSuspicion.cs index e3a6c69ba9..d3c41fb117 100644 --- a/Content.Server/GameTicking/Rules/RuleSuspicion.cs +++ b/Content.Server/GameTicking/Rules/RuleSuspicion.cs @@ -91,8 +91,8 @@ namespace Content.Server.GameTicking.Rules foreach (var playerSession in _playerManager.ServerSessions) { if (playerSession.AttachedEntity == null - || !IoCManager.Resolve().TryGetComponent(playerSession.AttachedEntity.Uid, out MobStateComponent? mobState) - || !IoCManager.Resolve().HasComponent(playerSession.AttachedEntity.Uid)) + || !IoCManager.Resolve().TryGetComponent(playerSession.AttachedEntity, out MobStateComponent? mobState) + || !IoCManager.Resolve().HasComponent(playerSession.AttachedEntity)) { continue; } diff --git a/Content.Server/Ghost/Components/GhostRadioComponent.cs b/Content.Server/Ghost/Components/GhostRadioComponent.cs index 5badaacf32..fa70b7fe3f 100644 --- a/Content.Server/Ghost/Components/GhostRadioComponent.cs +++ b/Content.Server/Ghost/Components/GhostRadioComponent.cs @@ -26,7 +26,7 @@ namespace Content.Server.Ghost.Components public void Receive(string message, int channel, IEntity speaker) { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out ActorComponent? actor)) return; var playerChannel = actor.PlayerSession.ConnectedClient; @@ -36,7 +36,7 @@ namespace Content.Server.Ghost.Components msg.Channel = ChatChannel.Radio; msg.Message = message; //Square brackets are added here to avoid issues with escaping - msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: IoCManager.Resolve().GetComponent(speaker.Uid).EntityName)); + msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: IoCManager.Resolve().GetComponent(speaker).EntityName)); _netManager.ServerSendMessage(msg, playerChannel); } diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index 93456133f2..e70c3155c0 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -64,7 +64,7 @@ namespace Content.Server.Ghost visibility.Layer |= (int) VisibilityFlags.Ghost; visibility.Layer &= ~(int) VisibilityFlags.Normal; - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out EyeComponent? eye)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out EyeComponent? eye)) { eye.VisibilityMask |= (uint) VisibilityFlags.Ghost; } @@ -75,17 +75,17 @@ namespace Content.Server.Ghost private void OnGhostShutdown(EntityUid uid, GhostComponent component, ComponentShutdown args) { // Perf: If the entity is deleting itself, no reason to change these back. - if ((!IoCManager.Resolve().EntityExists(component.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(component.Owner.Uid).EntityLifeStage) < EntityLifeStage.Terminating) + if ((!IoCManager.Resolve().EntityExists(component.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(component.Owner).EntityLifeStage) < EntityLifeStage.Terminating) { // Entity can't be seen by ghosts anymore. - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out VisibilityComponent? visibility)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out VisibilityComponent? visibility)) { visibility.Layer &= ~(int) VisibilityFlags.Ghost; visibility.Layer |= (int) VisibilityFlags.Normal; } // Entity can't see ghosts anymore. - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out EyeComponent? eye)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out EyeComponent? eye)) { eye.VisibilityMask &= ~(uint) VisibilityFlags.Ghost; } @@ -117,13 +117,13 @@ namespace Content.Server.Ghost var entity = args.SenderSession.AttachedEntity; if (entity == null || - !IoCManager.Resolve().HasComponent(entity.Uid)) + !IoCManager.Resolve().HasComponent(entity)) { Logger.Warning($"User {args.SenderSession.Name} sent a {nameof(GhostWarpsRequestEvent)} without being a ghost."); return; } - var response = new GhostWarpsResponseEvent(GetLocationNames().ToList(), GetPlayerWarps(entity.Uid)); + var response = new GhostWarpsResponseEvent(GetLocationNames().ToList(), GetPlayerWarps(entity)); RaiseNetworkEvent(response, args.SenderSession.ConnectedClient); } @@ -132,9 +132,9 @@ namespace Content.Server.Ghost var entity = args.SenderSession.AttachedEntity; if (entity == null || - !IoCManager.Resolve().TryGetComponent(entity.Uid, out GhostComponent? ghost) || + !IoCManager.Resolve().TryGetComponent(entity, out GhostComponent? ghost) || !ghost.CanReturnToBody || - !IoCManager.Resolve().TryGetComponent(entity.Uid, out ActorComponent? actor)) + !IoCManager.Resolve().TryGetComponent(entity, out ActorComponent? actor)) { Logger.Warning($"User {args.SenderSession.Name} sent an invalid {nameof(GhostReturnToBodyRequest)}"); return; @@ -146,7 +146,7 @@ namespace Content.Server.Ghost private void OnGhostWarpToLocationRequest(GhostWarpToLocationRequestEvent msg, EntitySessionEventArgs args) { if (args.SenderSession.AttachedEntity == null || - !IoCManager.Resolve().TryGetComponent(args.SenderSession.AttachedEntity.Uid, out GhostComponent? ghost)) + !IoCManager.Resolve().TryGetComponent(args.SenderSession.AttachedEntity, out GhostComponent? ghost)) { Logger.Warning($"User {args.SenderSession.Name} tried to warp to {msg.Name} without being a ghost."); return; @@ -154,7 +154,7 @@ namespace Content.Server.Ghost if (FindLocation(msg.Name) is { } warp) { - IoCManager.Resolve().GetComponent(ghost.Owner.Uid).Coordinates = IoCManager.Resolve().GetComponent(warp.Owner.Uid).Coordinates; + IoCManager.Resolve().GetComponent(ghost.Owner).Coordinates = IoCManager.Resolve().GetComponent(warp.Owner).Coordinates; } Logger.Warning($"User {args.SenderSession.Name} tried to warp to an invalid warp: {msg.Name}"); @@ -163,7 +163,7 @@ namespace Content.Server.Ghost private void OnGhostWarpToTargetRequest(GhostWarpToTargetRequestEvent msg, EntitySessionEventArgs args) { if (args.SenderSession.AttachedEntity == null || - !IoCManager.Resolve().TryGetComponent(args.SenderSession.AttachedEntity.Uid, out GhostComponent? ghost)) + !IoCManager.Resolve().TryGetComponent(args.SenderSession.AttachedEntity, out GhostComponent? ghost)) { Logger.Warning($"User {args.SenderSession.Name} tried to warp to {msg.Target} without being a ghost."); return; @@ -175,19 +175,19 @@ namespace Content.Server.Ghost return; } - IoCManager.Resolve().GetComponent(ghost.Owner.Uid).Coordinates = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates; + IoCManager.Resolve().GetComponent(ghost.Owner).Coordinates = IoCManager.Resolve().GetComponent(entity).Coordinates; } private void DeleteEntity(EntityUid uid) { if (!EntityManager.TryGetEntity(uid, out var entity) - || (!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted - || (!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) == EntityLifeStage.Terminating) + || (!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Deleted + || (!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) == EntityLifeStage.Terminating) return; - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out var mind)) + if (IoCManager.Resolve().TryGetComponent(entity, out var mind)) mind.GhostOnShutdown = false; - IoCManager.Resolve().DeleteEntity(entity.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) entity); } private IEnumerable GetLocationNames() @@ -222,7 +222,7 @@ namespace Content.Server.Ghost { if (player.AttachedEntity != null) { - players.Add(player.AttachedEntity.Uid, IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).EntityName); + players.Add(player.AttachedEntity, IoCManager.Resolve().GetComponent(player.AttachedEntity).EntityName); } } diff --git a/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs b/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs index 7851b306a6..8aaa78ec3b 100644 --- a/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs +++ b/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs @@ -42,15 +42,15 @@ namespace Content.Server.Ghost.Roles.Components if (string.IsNullOrEmpty(Prototype)) throw new NullReferenceException("Prototype string cannot be null or empty!"); - var mob = IoCManager.Resolve().SpawnEntity(Prototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var mob = IoCManager.Resolve().SpawnEntity(Prototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); if (MakeSentient) - MakeSentientCommand.MakeSentient(mob.Uid, IoCManager.Resolve()); + MakeSentientCommand.MakeSentient(mob, IoCManager.Resolve()); mob.EnsureComponent(); var ghostRoleSystem = EntitySystem.Get(); - ghostRoleSystem.GhostRoleInternalCreateMindAndTransfer(session, OwnerUid, mob.Uid, this); + ghostRoleSystem.GhostRoleInternalCreateMindAndTransfer(session, OwnerUid, mob, this); if (++_currentTakeovers < _availableTakeovers) return true; @@ -58,7 +58,7 @@ namespace Content.Server.Ghost.Roles.Components Taken = true; if (_deleteOnSpawn) - IoCManager.Resolve().DeleteEntity(Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) Owner); return true; } diff --git a/Content.Server/Ghost/Roles/GhostRoleSystem.cs b/Content.Server/Ghost/Roles/GhostRoleSystem.cs index 564c69e278..8c068d23a5 100644 --- a/Content.Server/Ghost/Roles/GhostRoleSystem.cs +++ b/Content.Server/Ghost/Roles/GhostRoleSystem.cs @@ -59,7 +59,7 @@ namespace Content.Server.Ghost.Roles public void OpenEui(IPlayerSession session) { - if (session.AttachedEntity == null || !IoCManager.Resolve().HasComponent(session.AttachedEntity.Uid)) + if (session.AttachedEntity == null || !IoCManager.Resolve().HasComponent(session.AttachedEntity)) return; if(_openUis.ContainsKey(session)) @@ -194,7 +194,7 @@ namespace Content.Server.Ghost.Roles { // Close the session of any player that has a ghost roles window open and isn't a ghost anymore. if (!_openUis.ContainsKey(message.Player)) return; - if (IoCManager.Resolve().HasComponent(message.Entity.Uid)) return; + if (IoCManager.Resolve().HasComponent(message.Entity)) return; CloseEui(message.Player); } diff --git a/Content.Server/Gravity/EntitySystems/GravityGeneratorSystem.cs b/Content.Server/Gravity/EntitySystems/GravityGeneratorSystem.cs index edefb66c21..20c8f4b93d 100644 --- a/Content.Server/Gravity/EntitySystems/GravityGeneratorSystem.cs +++ b/Content.Server/Gravity/EntitySystems/GravityGeneratorSystem.cs @@ -126,7 +126,7 @@ namespace Content.Server.Gravity.EntitySystems ApcPowerReceiverComponent powerReceiver, float chargeRate) { - if (!_uiSystem.IsUiOpen(component.Owner.Uid, SharedGravityGeneratorComponent.GravityGeneratorUiKey.Key)) + if (!_uiSystem.IsUiOpen(component.Owner, SharedGravityGeneratorComponent.GravityGeneratorUiKey.Key)) return; var chargeTarget = chargeRate < 0 ? 0 : 1; @@ -162,7 +162,7 @@ namespace Content.Server.Gravity.EntitySystems ); _uiSystem.TrySetUiState( - component.Owner.Uid, + component.Owner, SharedGravityGeneratorComponent.GravityGeneratorUiKey.Key, state); @@ -184,7 +184,7 @@ namespace Content.Server.Gravity.EntitySystems private void UpdateGravityActive(GravityGeneratorComponent grav, bool shake) { - var gridId = IoCManager.Resolve().GetComponent(grav.Owner.Uid).GridID; + var gridId = IoCManager.Resolve().GetComponent(grav.Owner).GridID; if (gridId == GridId.Invalid) return; @@ -202,7 +202,7 @@ namespace Content.Server.Gravity.EntitySystems private void OnInteractHand(EntityUid uid, GravityGeneratorComponent component, InteractHandEvent args) { - if (!EntityManager.TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) return; ApcPowerReceiverComponent? powerReceiver = default!; @@ -219,7 +219,7 @@ namespace Content.Server.Gravity.EntitySystems public void UpdateState(GravityGeneratorComponent grav, ApcPowerReceiverComponent powerReceiver) { - var uid = grav.Owner.Uid; + var uid = (EntityUid) grav.Owner; var appearance = EntityManager.GetComponentOrNull(uid); appearance?.SetData(GravityGeneratorVisuals.Charge, grav.Charge); @@ -249,28 +249,28 @@ namespace Content.Server.Gravity.EntitySystems private void MakeBroken(GravityGeneratorComponent component, AppearanceComponent? appearance) { - _ambientSoundSystem.SetAmbience(component.Owner.Uid, false); + _ambientSoundSystem.SetAmbience(component.Owner, false); appearance?.SetData(GravityGeneratorVisuals.State, GravityGeneratorStatus.Broken); } private void MakeUnpowered(GravityGeneratorComponent component, AppearanceComponent? appearance) { - _ambientSoundSystem.SetAmbience(component.Owner.Uid, false); + _ambientSoundSystem.SetAmbience(component.Owner, false); appearance?.SetData(GravityGeneratorVisuals.State, GravityGeneratorStatus.Unpowered); } private void MakeOff(GravityGeneratorComponent component, AppearanceComponent? appearance) { - _ambientSoundSystem.SetAmbience(component.Owner.Uid, false); + _ambientSoundSystem.SetAmbience(component.Owner, false); appearance?.SetData(GravityGeneratorVisuals.State, GravityGeneratorStatus.Off); } private void MakeOn(GravityGeneratorComponent component, AppearanceComponent? appearance) { - _ambientSoundSystem.SetAmbience(component.Owner.Uid, true); + _ambientSoundSystem.SetAmbience(component.Owner, true); appearance?.SetData(GravityGeneratorVisuals.State, GravityGeneratorStatus.On); } diff --git a/Content.Server/Gravity/EntitySystems/GravityShakeSystem.cs b/Content.Server/Gravity/EntitySystems/GravityShakeSystem.cs index 59ea4fd331..f44433d6bd 100644 --- a/Content.Server/Gravity/EntitySystems/GravityShakeSystem.cs +++ b/Content.Server/Gravity/EntitySystems/GravityShakeSystem.cs @@ -80,8 +80,8 @@ namespace Content.Server.Gravity.EntitySystems foreach (var player in _playerManager.Sessions) { if (player.AttachedEntity == null - || IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GridID != gridId - || !IoCManager.Resolve().TryGetComponent(player.AttachedEntity.Uid, out CameraRecoilComponent? recoil)) + || IoCManager.Resolve().GetComponent(player.AttachedEntity).GridID != gridId + || !IoCManager.Resolve().TryGetComponent(player.AttachedEntity, out CameraRecoilComponent? recoil)) { continue; } diff --git a/Content.Server/Gravity/EntitySystems/GravitySystem.cs b/Content.Server/Gravity/EntitySystems/GravitySystem.cs index 2c55b0e15f..ea59f3a9a4 100644 --- a/Content.Server/Gravity/EntitySystems/GravitySystem.cs +++ b/Content.Server/Gravity/EntitySystems/GravitySystem.cs @@ -17,12 +17,12 @@ namespace Content.Server.Gravity.EntitySystems private void HandleGravityInitialize(EntityUid uid, GravityComponent component, ComponentInit args) { // Incase there's already a generator on the grid we'll just set it now. - var gridId = IoCManager.Resolve().GetComponent(component.Owner.Uid).GridID; + var gridId = IoCManager.Resolve().GetComponent(component.Owner).GridID; GravityChangedMessage message; foreach (var generator in EntityManager.EntityQuery()) { - if (IoCManager.Resolve().GetComponent(generator.Owner.Uid).GridID == gridId && generator.GravityActive) + if (IoCManager.Resolve().GetComponent(generator.Owner).GridID == gridId && generator.GravityActive) { component.Enabled = true; message = new GravityChangedMessage(gridId, true); @@ -41,7 +41,7 @@ namespace Content.Server.Gravity.EntitySystems if (comp.Enabled) return; comp.Enabled = true; - var gridId = IoCManager.Resolve().GetComponent(comp.Owner.Uid).GridID; + var gridId = IoCManager.Resolve().GetComponent(comp.Owner).GridID; var message = new GravityChangedMessage(gridId, true); RaiseLocalEvent(message); } @@ -51,7 +51,7 @@ namespace Content.Server.Gravity.EntitySystems if (!comp.Enabled) return; comp.Enabled = false; - var gridId = IoCManager.Resolve().GetComponent(comp.Owner.Uid).GridID; + var gridId = IoCManager.Resolve().GetComponent(comp.Owner).GridID; var message = new GravityChangedMessage(gridId, false); RaiseLocalEvent(message); } diff --git a/Content.Server/Gravity/EntitySystems/WeightlessSystem.cs b/Content.Server/Gravity/EntitySystems/WeightlessSystem.cs index 99ff25a4d3..af2198cc67 100644 --- a/Content.Server/Gravity/EntitySystems/WeightlessSystem.cs +++ b/Content.Server/Gravity/EntitySystems/WeightlessSystem.cs @@ -34,15 +34,15 @@ namespace Content.Server.Gravity.EntitySystems public void AddAlert(ServerAlertsComponent status) { - var gridId = IoCManager.Resolve().GetComponent(status.Owner.Uid).GridID; + var gridId = IoCManager.Resolve().GetComponent(status.Owner).GridID; var alerts = _alerts.GetOrNew(gridId); alerts.Add(status); - if (_mapManager.TryGetGrid(IoCManager.Resolve().GetComponent(status.Owner.Uid).GridID, out var grid)) + if (_mapManager.TryGetGrid(IoCManager.Resolve().GetComponent(status.Owner).GridID, out var grid)) { var gridEntity = EntityManager.GetEntity(grid.GridEntityId); - if (IoCManager.Resolve().GetComponent(gridEntity.Uid).Enabled) + if (IoCManager.Resolve().GetComponent(gridEntity).Enabled) { RemoveWeightless(status); } @@ -55,7 +55,7 @@ namespace Content.Server.Gravity.EntitySystems public void RemoveAlert(ServerAlertsComponent status) { - var grid = IoCManager.Resolve().GetComponent(status.Owner.Uid).GridID; + var grid = IoCManager.Resolve().GetComponent(status.Owner).GridID; if (!_alerts.TryGetValue(grid, out var statuses)) { return; @@ -99,13 +99,13 @@ namespace Content.Server.Gravity.EntitySystems private void EntParentChanged(ref EntParentChangedMessage ev) { - if (!IoCManager.Resolve().TryGetComponent(ev.Entity.Uid, out ServerAlertsComponent? status)) + if (!IoCManager.Resolve().TryGetComponent(ev.Entity, out ServerAlertsComponent? status)) { return; } if (ev.OldParent != null && - IoCManager.Resolve().TryGetComponent(ev.OldParent.Uid, out IMapGridComponent? mapGrid)) + IoCManager.Resolve().TryGetComponent(ev.OldParent, out IMapGridComponent? mapGrid)) { var oldGrid = mapGrid.GridIndex; @@ -115,7 +115,7 @@ namespace Content.Server.Gravity.EntitySystems } } - var newGrid = IoCManager.Resolve().GetComponent(ev.Entity.Uid).GridID; + var newGrid = IoCManager.Resolve().GetComponent(ev.Entity).GridID; var newStatuses = _alerts.GetOrNew(newGrid); newStatuses.Add(status); diff --git a/Content.Server/Hands/Components/HandsComponent.cs b/Content.Server/Hands/Components/HandsComponent.cs index 81280eef98..96bd44a42a 100644 --- a/Content.Server/Hands/Components/HandsComponent.cs +++ b/Content.Server/Hands/Components/HandsComponent.cs @@ -38,12 +38,12 @@ namespace Content.Server.Hands.Components protected override void OnHeldEntityRemovedFromHand(IEntity heldEntity, HandState handState) { - if (IoCManager.Resolve().TryGetComponent(heldEntity.Uid, out ItemComponent? item)) + if (IoCManager.Resolve().TryGetComponent(heldEntity, out ItemComponent? item)) { item.RemovedFromSlot(); _entitySystemManager.GetEntitySystem().UnequippedHandInteraction(Owner, heldEntity, handState); } - if (IoCManager.Resolve().TryGetComponent(heldEntity.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(heldEntity, out SpriteComponent? sprite)) { sprite.RenderOrder = IoCManager.Resolve().CurrentTick.Value; } @@ -51,15 +51,15 @@ namespace Content.Server.Hands.Components protected override void HandlePickupAnimation(IEntity entity) { - var initialPosition = EntityCoordinates.FromMap(IoCManager.Resolve().GetComponent(Owner.Uid).Parent?.Owner ?? Owner, IoCManager.Resolve().GetComponent(entity.Uid).MapPosition); + var initialPosition = EntityCoordinates.FromMap(IoCManager.Resolve().GetComponent(Owner).Parent?.Owner ?? Owner, IoCManager.Resolve().GetComponent(entity).MapPosition); - var finalPosition = IoCManager.Resolve().GetComponent(Owner.Uid).LocalPosition; + var finalPosition = IoCManager.Resolve().GetComponent(Owner).LocalPosition; if (finalPosition.EqualsApprox(initialPosition.Position)) return; IoCManager.Resolve().EntityNetManager!.SendSystemNetworkMessage( - new PickupAnimationMessage(entity.Uid, finalPosition, initialPosition)); + new PickupAnimationMessage(entity, finalPosition, initialPosition)); } #region Pull/Disarm @@ -106,13 +106,13 @@ namespace Content.Server.Hands.Components { if (ActiveHand != null && Drop(ActiveHand, false)) { - source.PopupMessageOtherClients(Loc.GetString("hands-component-disarm-success-others-message", ("disarmer", Name: IoCManager.Resolve().GetComponent(source.Uid).EntityName), ("disarmed", Name: IoCManager.Resolve().GetComponent(target.Uid).EntityName))); - source.PopupMessageCursor(Loc.GetString("hands-component-disarm-success-message", ("disarmed", Name: IoCManager.Resolve().GetComponent(target.Uid).EntityName))); + source.PopupMessageOtherClients(Loc.GetString("hands-component-disarm-success-others-message", ("disarmer", Name: IoCManager.Resolve().GetComponent(source).EntityName), ("disarmed", Name: IoCManager.Resolve().GetComponent(target).EntityName))); + source.PopupMessageCursor(Loc.GetString("hands-component-disarm-success-message", ("disarmed", Name: IoCManager.Resolve().GetComponent(target).EntityName))); } else { - source.PopupMessageOtherClients(Loc.GetString("hands-component-shove-success-others-message", ("shover", Name: IoCManager.Resolve().GetComponent(source.Uid).EntityName), ("shoved", Name: IoCManager.Resolve().GetComponent(target.Uid).EntityName))); - source.PopupMessageCursor(Loc.GetString("hands-component-shove-success-message", ("shoved", Name: IoCManager.Resolve().GetComponent(target.Uid).EntityName))); + source.PopupMessageOtherClients(Loc.GetString("hands-component-shove-success-others-message", ("shover", Name: IoCManager.Resolve().GetComponent(source).EntityName), ("shoved", Name: IoCManager.Resolve().GetComponent(target).EntityName))); + source.PopupMessageCursor(Loc.GetString("hands-component-shove-success-message", ("shoved", Name: IoCManager.Resolve().GetComponent(target).EntityName))); } } } @@ -123,8 +123,8 @@ namespace Content.Server.Hands.Components private bool BreakPulls() { // What is this API?? - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out SharedPullerComponent? puller) - || puller.Pulling == null || !IoCManager.Resolve().TryGetComponent(puller.Pulling.Uid, out SharedPullableComponent? pullable)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out SharedPullerComponent? puller) + || puller.Pulling == null || !IoCManager.Resolve().TryGetComponent(puller.Pulling, out SharedPullableComponent? pullable)) return false; return _entitySystemManager.GetEntitySystem().TryStopPull(pullable); @@ -163,7 +163,7 @@ namespace Content.Server.Hands.Components if (!TryGetHeldEntity(handName, out var heldEntity)) return null; - IoCManager.Resolve().TryGetComponent(heldEntity.Uid, out ItemComponent? item); + IoCManager.Resolve().TryGetComponent(heldEntity, out ItemComponent? item); return item; } @@ -177,7 +177,7 @@ namespace Content.Server.Hands.Components if (!TryGetHeldEntity(handName, out var heldEntity)) return false; - return IoCManager.Resolve().TryGetComponent(heldEntity.Uid, out item); + return IoCManager.Resolve().TryGetComponent(heldEntity, out item); } /// @@ -190,7 +190,7 @@ namespace Content.Server.Hands.Components if (!TryGetActiveHeldEntity(out var heldEntity)) return null; - IoCManager.Resolve().TryGetComponent(heldEntity.Uid, out ItemComponent? item); + IoCManager.Resolve().TryGetComponent(heldEntity, out ItemComponent? item); return item; } } @@ -199,7 +199,7 @@ namespace Content.Server.Hands.Components { foreach (var entity in GetAllHeldEntities()) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ItemComponent? item)) + if (IoCManager.Resolve().TryGetComponent(entity, out ItemComponent? item)) yield return item; } } diff --git a/Content.Server/Hands/Systems/HandVirtualItemSystem.cs b/Content.Server/Hands/Systems/HandVirtualItemSystem.cs index 667ca166eb..80fe3c2274 100644 --- a/Content.Server/Hands/Systems/HandVirtualItemSystem.cs +++ b/Content.Server/Hands/Systems/HandVirtualItemSystem.cs @@ -32,9 +32,9 @@ namespace Content.Server.Hands.Systems if (!hand.IsEmpty) continue; - var pos = IoCManager.Resolve().GetComponent(hands.Owner.Uid).Coordinates; + var pos = IoCManager.Resolve().GetComponent(hands.Owner).Coordinates; var virtualItem = EntityManager.SpawnEntity("HandVirtualItem", pos); - var virtualItemComp = IoCManager.Resolve().GetComponent(virtualItem.Uid); + var virtualItemComp = IoCManager.Resolve().GetComponent(virtualItem); virtualItemComp.BlockingEntity = blockingEnt; hands.PutEntityIntoHand(hand, virtualItem); return true; @@ -56,7 +56,7 @@ namespace Content.Server.Hands.Systems // If the virtual item gets removed from the hands for any reason, cancel the pull and delete it. private void HandleItemUnequipped(EntityUid uid, HandVirtualItemComponent component, UnequippedHandEvent args) { - Delete(component, args.User.Uid); + Delete(component, args.User); } private void HandleItemDropped(EntityUid uid, HandVirtualItemComponent component, DroppedEvent args) @@ -74,7 +74,7 @@ namespace Content.Server.Hands.Systems var targEv = new VirtualItemDeletedEvent(comp.BlockingEntity, user); RaiseLocalEvent(comp.BlockingEntity, targEv, false); - IoCManager.Resolve().QueueDeleteEntity(comp.Owner.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) comp.Owner); } /// @@ -93,7 +93,7 @@ namespace Content.Server.Hands.Systems if (hand.HeldEntity != null) { - if (EntityManager.TryGetComponent(hand.HeldEntity.Uid, + if (EntityManager.TryGetComponent(hand.HeldEntity, out var virt) && virt.BlockingEntity == matching) { diff --git a/Content.Server/Hands/Systems/HandsSystem.cs b/Content.Server/Hands/Systems/HandsSystem.cs index 22864b7393..e668ee5d14 100644 --- a/Content.Server/Hands/Systems/HandsSystem.cs +++ b/Content.Server/Hands/Systems/HandsSystem.cs @@ -72,7 +72,7 @@ namespace Content.Server.Hands.Systems private void HandlePullStarted(EntityUid uid, HandsComponent component, PullStartedMessage args) { - if (!_virtualItemSystem.TrySpawnVirtualItemInHand(args.Pulled.Owner.Uid, uid)) + if (!_virtualItemSystem.TrySpawnVirtualItemInHand(args.Pulled.Owner, uid)) { DebugTools.Assert("Unable to find available hand when starting pulling??"); } @@ -85,11 +85,11 @@ namespace Content.Server.Hands.Systems foreach (var hand in component.Hands) { if (hand.HeldEntity == null - || !IoCManager.Resolve().TryGetComponent(hand.HeldEntity.Uid, out HandVirtualItemComponent? virtualItem) - || virtualItem.BlockingEntity != args.Pulled.Owner.Uid) + || !IoCManager.Resolve().TryGetComponent(hand.HeldEntity, out HandVirtualItemComponent? virtualItem) + || virtualItem.BlockingEntity != args.Pulled.Owner) continue; - IoCManager.Resolve().DeleteEntity(hand.HeldEntity.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) hand.HeldEntity); break; } } @@ -101,7 +101,7 @@ namespace Content.Server.Hands.Systems if (player == null) return; - if (!IoCManager.Resolve().TryGetComponent(player.Uid, out SharedHandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(player, out SharedHandsComponent? hands)) return; if (!hands.TryGetSwapHandsResult(out var nextHand)) @@ -117,7 +117,7 @@ namespace Content.Server.Hands.Systems if (player == null) return false; - if (!IoCManager.Resolve().TryGetComponent(player.Uid, out SharedHandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(player, out SharedHandsComponent? hands)) return false; var activeHand = hands.ActiveHand; @@ -173,7 +173,7 @@ namespace Content.Server.Hands.Systems { foreach (var inhand in component.GetAllHeldItems()) { - if (IoCManager.Resolve().HasComponent(inhand.Owner.Uid)) + if (IoCManager.Resolve().HasComponent(inhand.Owner)) continue; args.PushText(Loc.GetString("comp-hands-examine", ("user", component.Owner), ("item", inhand.Owner))); @@ -191,10 +191,10 @@ namespace Content.Server.Hands.Systems var playerEnt = playerSession.AttachedEntity; - if (playerEnt == null || !IoCManager.Resolve().EntityExists(playerEnt.Uid)) + if (playerEnt == null || !IoCManager.Resolve().EntityExists(playerEnt)) return false; - return IoCManager.Resolve().TryGetComponent(playerEnt.Uid, out hands); + return IoCManager.Resolve().TryGetComponent(playerEnt, out hands); } private void HandleActivateItem(ICommonSession? session) @@ -221,16 +221,16 @@ namespace Content.Server.Hands.Systems var playerEnt = playerSession.AttachedEntity; if (playerEnt == null || - !IoCManager.Resolve().EntityExists(playerEnt.Uid) || + !IoCManager.Resolve().EntityExists(playerEnt) || playerEnt.IsInContainer() || - !IoCManager.Resolve().TryGetComponent(playerEnt.Uid, out SharedHandsComponent? hands) || + !IoCManager.Resolve().TryGetComponent(playerEnt, out SharedHandsComponent? hands) || !hands.TryGetActiveHeldEntity(out var throwEnt) || - !_actionBlockerSystem.CanThrow(playerEnt.Uid)) + !_actionBlockerSystem.CanThrow(playerEnt)) return false; - if (IoCManager.Resolve().TryGetComponent(throwEnt.Uid, out StackComponent? stack) && stack.Count > 1 && stack.ThrowIndividually) + if (IoCManager.Resolve().TryGetComponent(throwEnt, out StackComponent? stack) && stack.Count > 1 && stack.ThrowIndividually) { - var splitStack = _stackSystem.Split(throwEnt.Uid, 1, IoCManager.Resolve().GetComponent(playerEnt.Uid).Coordinates, stack); + var splitStack = _stackSystem.Split(throwEnt, 1, IoCManager.Resolve().GetComponent(playerEnt).Coordinates, stack); if (splitStack == null) return false; @@ -240,7 +240,7 @@ namespace Content.Server.Hands.Systems else if (!hands.Drop(throwEnt)) return false; - var direction = coords.ToMapPos(EntityManager) - IoCManager.Resolve().GetComponent(playerEnt.Uid).WorldPosition; + var direction = coords.ToMapPos(EntityManager) - IoCManager.Resolve().GetComponent(playerEnt).WorldPosition; if (direction == Vector2.Zero) return true; @@ -269,15 +269,15 @@ namespace Content.Server.Hands.Systems var plyEnt = playerSession.AttachedEntity; - if (plyEnt == null || !IoCManager.Resolve().EntityExists(plyEnt.Uid)) + if (plyEnt == null || !IoCManager.Resolve().EntityExists(plyEnt)) return; - if (!IoCManager.Resolve().TryGetComponent(plyEnt.Uid, out SharedHandsComponent? hands) || - !IoCManager.Resolve().TryGetComponent(plyEnt.Uid, out InventoryComponent? inventory)) + if (!IoCManager.Resolve().TryGetComponent(plyEnt, out SharedHandsComponent? hands) || + !IoCManager.Resolve().TryGetComponent(plyEnt, out InventoryComponent? inventory)) return; if (!inventory.TryGetSlotItem(equipmentSlot, out ItemComponent? equipmentItem) || - !IoCManager.Resolve().TryGetComponent(equipmentItem.Owner.Uid, out ServerStorageComponent? storageComponent)) + !IoCManager.Resolve().TryGetComponent(equipmentItem.Owner, out ServerStorageComponent? storageComponent)) { plyEnt.PopupMessage(Loc.GetString("hands-system-missing-equipment-slot", ("slotName", SlotNames[equipmentSlot].ToLower()))); return; @@ -299,7 +299,7 @@ namespace Content.Server.Hands.Systems if (storageComponent.Remove(lastStoredEntity)) { if (!hands.TryPickupEntityToActiveHand(lastStoredEntity)) - IoCManager.Resolve().GetComponent(lastStoredEntity.Uid).Coordinates = IoCManager.Resolve().GetComponent(plyEnt.Uid).Coordinates; + IoCManager.Resolve().GetComponent(lastStoredEntity).Coordinates = IoCManager.Resolve().GetComponent(plyEnt).Coordinates; } } } diff --git a/Content.Server/Headset/HeadsetComponent.cs b/Content.Server/Headset/HeadsetComponent.cs index b0e8fdbea7..1ed527dd59 100644 --- a/Content.Server/Headset/HeadsetComponent.cs +++ b/Content.Server/Headset/HeadsetComponent.cs @@ -59,7 +59,7 @@ namespace Content.Server.Headset { if (Owner.TryGetContainer(out var container)) { - if (!IoCManager.Resolve().TryGetComponent(container.Owner.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(container.Owner, out ActorComponent? actor)) return; var playerChannel = actor.PlayerSession.ConnectedClient; @@ -69,7 +69,7 @@ namespace Content.Server.Headset msg.Channel = ChatChannel.Radio; msg.Message = message; //Square brackets are added here to avoid issues with escaping - msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: IoCManager.Resolve().GetComponent(source.Uid).EntityName)); + msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: IoCManager.Resolve().GetComponent(source).EntityName)); _netManager.ServerSendMessage(msg, playerChannel); } } diff --git a/Content.Server/Instruments/InstrumentComponent.cs b/Content.Server/Instruments/InstrumentComponent.cs index 611f671da8..bd8b50bb13 100644 --- a/Content.Server/Instruments/InstrumentComponent.cs +++ b/Content.Server/Instruments/InstrumentComponent.cs @@ -24,8 +24,8 @@ public sealed class InstrumentComponent : SharedInstrumentComponent public int MidiEventCount = 0; public IPlayerSession? InstrumentPlayer => - IoCManager.Resolve().GetComponentOrNull(Owner.Uid)?.CurrentSingleUser - ?? IoCManager.Resolve().GetComponentOrNull(Owner.Uid)?.PlayerSession; + IoCManager.Resolve().GetComponentOrNull(Owner)?.CurrentSingleUser + ?? IoCManager.Resolve().GetComponentOrNull(Owner)?.PlayerSession; [ViewVariables] public BoundUserInterface? UserInterface => Owner.GetUIOrNull(InstrumentUiKey.Key); } diff --git a/Content.Server/Instruments/InstrumentSystem.cs b/Content.Server/Instruments/InstrumentSystem.cs index 8c93a55126..a1617bbb93 100644 --- a/Content.Server/Instruments/InstrumentSystem.cs +++ b/Content.Server/Instruments/InstrumentSystem.cs @@ -158,7 +158,7 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem if (mob != null) { - _stunSystem.TryParalyze(mob.Uid, TimeSpan.FromSeconds(1)); + _stunSystem.TryParalyze(mob, TimeSpan.FromSeconds(1)); instrument.Owner.PopupMessage(mob, "instrument-component-finger-cramps-max-message"); } diff --git a/Content.Server/Interaction/Components/ClumsyComponent.cs b/Content.Server/Interaction/Components/ClumsyComponent.cs index bbf753b6b6..194939d74f 100644 --- a/Content.Server/Interaction/Components/ClumsyComponent.cs +++ b/Content.Server/Interaction/Components/ClumsyComponent.cs @@ -30,7 +30,7 @@ namespace Content.Server.Interaction.Components /// True if a "bad action" happened, false if the normal action should happen. public static bool TryRollClumsy(IEntity entity, float chance) { - return IoCManager.Resolve().TryGetComponent(entity.Uid, out ClumsyComponent? clumsy) + return IoCManager.Resolve().TryGetComponent(entity, out ClumsyComponent? clumsy) && clumsy.RollClumsy(chance); } } diff --git a/Content.Server/Interaction/InteractionSystem.cs b/Content.Server/Interaction/InteractionSystem.cs index e970edabbc..c8b58237a2 100644 --- a/Content.Server/Interaction/InteractionSystem.cs +++ b/Content.Server/Interaction/InteractionSystem.cs @@ -91,7 +91,7 @@ namespace Content.Server.Interaction userEntity = ((IPlayerSession?) session)?.AttachedEntity; - if (userEntity == null || !IoCManager.Resolve().EntityExists(userEntity.Uid)) + if (userEntity == null || !IoCManager.Resolve().EntityExists(userEntity)) { Logger.WarningS("system.interaction", $"Client sent interaction with no attached entity. Session={session}"); @@ -109,7 +109,7 @@ namespace Content.Server.Interaction if (!entity.TryGetContainer(out var container)) return false; - if (!EntityManager.TryGetComponent(container.Owner.Uid, out ServerStorageComponent storage)) + if (!EntityManager.TryGetComponent(container.Owner, out ServerStorageComponent storage)) return false; if (storage.Storage?.ID != container.ID) @@ -137,7 +137,7 @@ namespace Content.Server.Interaction } // client sanitization - if (!ValidateClientInput(args.SenderSession, IoCManager.Resolve().GetComponent(item.Uid).Coordinates, msg.ItemUid, out var userEntity)) + if (!ValidateClientInput(args.SenderSession, IoCManager.Resolve().GetComponent(item).Coordinates, msg.ItemUid, out var userEntity)) { Logger.InfoS("system.interaction", $"Inventory interaction validation failed. Session={args.SenderSession}"); return; @@ -145,7 +145,7 @@ namespace Content.Server.Interaction if (msg.AltInteract) // Use 'UserInteraction' function - behaves as if the user alt-clicked the item in the world. - UserInteraction(userEntity, IoCManager.Resolve().GetComponent(item.Uid).Coordinates, msg.ItemUid, msg.AltInteract); + UserInteraction(userEntity, IoCManager.Resolve().GetComponent(item).Coordinates, msg.ItemUid, msg.AltInteract); else // User used 'E'. We want to activate it, not simulate clicking on the item InteractionActivate(userEntity, item); @@ -160,7 +160,7 @@ namespace Content.Server.Interaction return; } - if (!_actionBlockerSystem.CanInteract(userEntity.Uid)) + if (!_actionBlockerSystem.CanInteract(userEntity)) return; if (!EntityManager.TryGetEntity(msg.Dropped, out var dropped)) @@ -176,8 +176,8 @@ namespace Content.Server.Interaction return; // trigger dragdrops on the dropped entity - RaiseLocalEvent(dropped.Uid, interactionArgs); - foreach (var dragDrop in IoCManager.Resolve().GetComponents(dropped.Uid)) + RaiseLocalEvent(dropped, interactionArgs); + foreach (var dragDrop in IoCManager.Resolve().GetComponents(dropped)) { if (dragDrop.CanDrop(interactionArgs) && dragDrop.Drop(interactionArgs)) @@ -187,8 +187,8 @@ namespace Content.Server.Interaction } // trigger dragdropons on the targeted entity - RaiseLocalEvent(target.Uid, interactionArgs, false); - foreach (var dragDropOn in IoCManager.Resolve().GetComponents(target.Uid)) + RaiseLocalEvent(target, interactionArgs, false); + foreach (var dragDropOn in IoCManager.Resolve().GetComponents(target)) { if (dragDropOn.CanDragDropOn(interactionArgs) && dragDropOn.DragDropOn(interactionArgs)) @@ -225,7 +225,7 @@ namespace Content.Server.Interaction return true; } - if (IoCManager.Resolve().TryGetComponent(userEntity.Uid, out CombatModeComponent? combatMode) && combatMode.IsInCombatMode) + if (IoCManager.Resolve().TryGetComponent(userEntity, out CombatModeComponent? combatMode) && combatMode.IsInCombatMode) DoAttack(userEntity, coords, true); return true; @@ -240,7 +240,7 @@ namespace Content.Server.Interaction /// internal void AiUseInteraction(IEntity entity, EntityCoordinates coords, EntityUid uid) { - if (IoCManager.Resolve().HasComponent(entity.Uid)) + if (IoCManager.Resolve().HasComponent(entity)) throw new InvalidOperationException(); UserInteraction(entity, coords, uid); @@ -282,7 +282,7 @@ namespace Content.Server.Interaction return true; } - if (userEntity.Uid == uid) + if (userEntity == uid) return false; if (!EntityManager.TryGetEntity(uid, out var pulledObject)) @@ -291,7 +291,7 @@ namespace Content.Server.Interaction if (!InRangeUnobstructed(userEntity, pulledObject, popup: true)) return false; - if (!IoCManager.Resolve().TryGetComponent(pulledObject.Uid, out SharedPullableComponent? pull)) + if (!IoCManager.Resolve().TryGetComponent(pulledObject, out SharedPullableComponent? pull)) return false; return _pullSystem.TogglePull(userEntity, pull); @@ -309,7 +309,7 @@ namespace Content.Server.Interaction public async void UserInteraction(IEntity user, EntityCoordinates coordinates, EntityUid clickedUid, bool altInteract = false) { // TODO COMBAT Consider using alt-interact for advanced combat? maybe alt-interact disarms? - if (!altInteract && IoCManager.Resolve().TryGetComponent(user.Uid, out CombatModeComponent? combatMode) && combatMode.IsInCombatMode) + if (!altInteract && IoCManager.Resolve().TryGetComponent(user, out CombatModeComponent? combatMode) && combatMode.IsInCombatMode) { DoAttack(user, coordinates, false, clickedUid); return; @@ -318,7 +318,7 @@ namespace Content.Server.Interaction if (!ValidateInteractAndFace(user, coordinates)) return; - if (!_actionBlockerSystem.CanInteract(user.Uid)) + if (!_actionBlockerSystem.CanInteract(user)) return; // Get entity clicked upon from UID if valid UID, if not assume no entity clicked upon and null @@ -326,15 +326,15 @@ namespace Content.Server.Interaction // Check if interacted entity is in the same container, the direct child, or direct parent of the user. // This is bypassed IF the interaction happened through an item slot (e.g., backpack UI) - if (target != null && !user.IsInSameOrParentContainer(target) && !CanAccessViaStorage(user.Uid, target.Uid)) + if (target != null && !user.IsInSameOrParentContainer(target) && !CanAccessViaStorage(user, target)) { Logger.WarningS("system.interaction", - $"User entity named {IoCManager.Resolve().GetComponent(user.Uid).EntityName} clicked on object {IoCManager.Resolve().GetComponent(target.Uid).EntityName} that isn't the parent, child, or in the same container"); + $"User entity named {IoCManager.Resolve().GetComponent(user).EntityName} clicked on object {IoCManager.Resolve().GetComponent(target).EntityName} that isn't the parent, child, or in the same container"); return; } // Verify user has a hand, and find what object they are currently holding in their active hand - if (!IoCManager.Resolve().TryGetComponent(user.Uid, out var hands)) + if (!IoCManager.Resolve().TryGetComponent(user, out var hands)) return; var item = hands.GetActiveHand?.Owner; @@ -374,10 +374,10 @@ namespace Content.Server.Interaction private bool ValidateInteractAndFace(IEntity user, EntityCoordinates coordinates) { // Verify user is on the same map as the entity they clicked on - if (coordinates.GetMapId(_entityManager) != IoCManager.Resolve().GetComponent(user.Uid).MapID) + if (coordinates.GetMapId(_entityManager) != IoCManager.Resolve().GetComponent(user).MapID) { Logger.WarningS("system.interaction", - $"User entity named {IoCManager.Resolve().GetComponent(user.Uid).EntityName} clicked on a map they aren't located on"); + $"User entity named {IoCManager.Resolve().GetComponent(user).EntityName} clicked on a map they aren't located on"); return false; } @@ -393,19 +393,19 @@ namespace Content.Server.Interaction /// public void InteractHand(IEntity user, IEntity target) { - if (!_actionBlockerSystem.CanInteract(user.Uid)) + if (!_actionBlockerSystem.CanInteract(user)) return; // all interactions should only happen when in range / unobstructed, so no range check is needed var message = new InteractHandEvent(user, target); - RaiseLocalEvent(target.Uid, message); + RaiseLocalEvent(target, message); _adminLogSystem.Add(LogType.InteractHand, LogImpact.Low, $"{user} interacted with {target}"); if (message.Handled) return; var interactHandEventArgs = new InteractHandEventArgs(user, target); - var interactHandComps = IoCManager.Resolve().GetComponents(target.Uid).ToList(); + var interactHandComps = IoCManager.Resolve().GetComponents(target).ToList(); foreach (var interactHandComp in interactHandComps) { // If an InteractHand returns a status completion we finish our interaction @@ -430,12 +430,12 @@ namespace Content.Server.Interaction if (target != null) { - var rangedMsg = new RangedInteractEvent(user.Uid, used.Uid, target.Uid, clickLocation); - RaiseLocalEvent(target.Uid, rangedMsg); + var rangedMsg = new RangedInteractEvent(user, used, target, clickLocation); + RaiseLocalEvent(target, rangedMsg); if (rangedMsg.Handled) return true; - var rangedInteractions = IoCManager.Resolve().GetComponents(target.Uid).ToList(); + var rangedInteractions = IoCManager.Resolve().GetComponents(target).ToList(); var rangedInteractionEventArgs = new RangedInteractEventArgs(user, used, clickLocation); // See if we have a ranged interaction @@ -457,7 +457,7 @@ namespace Content.Server.Interaction if (!ValidateInteractAndFace(user, coordinates)) return; - if (!_actionBlockerSystem.CanAttack(user.Uid)) + if (!_actionBlockerSystem.CanAttack(user)) return; IEntity? targetEnt = null; @@ -468,10 +468,10 @@ namespace Content.Server.Interaction EntityManager.TryGetEntity(targetUid, out targetEnt); // Check if interacted entity is in the same container, the direct child, or direct parent of the user. - if (targetEnt != null && !user.IsInSameOrParentContainer(targetEnt) && !CanAccessViaStorage(user.Uid, targetEnt.Uid)) + if (targetEnt != null && !user.IsInSameOrParentContainer(targetEnt) && !CanAccessViaStorage(user, targetEnt)) { Logger.WarningS("system.interaction", - $"User entity named {IoCManager.Resolve().GetComponent(user.Uid).EntityName} clicked on object {IoCManager.Resolve().GetComponent(targetEnt.Uid).EntityName} that isn't the parent, child, or in the same container"); + $"User entity named {IoCManager.Resolve().GetComponent(user).EntityName} clicked on object {IoCManager.Resolve().GetComponent(targetEnt).EntityName} that isn't the parent, child, or in the same container"); return; } @@ -481,7 +481,7 @@ namespace Content.Server.Interaction } // Verify user has a hand, and find what object they are currently holding in their active hand - if (IoCManager.Resolve().TryGetComponent(user.Uid, out var hands)) + if (IoCManager.Resolve().TryGetComponent(user, out var hands)) { var item = hands.GetActiveHand?.Owner; @@ -490,7 +490,7 @@ namespace Content.Server.Interaction if (wideAttack) { var ev = new WideAttackEvent(item, user, coordinates); - RaiseLocalEvent(item.Uid, ev, false); + RaiseLocalEvent(item, ev, false); if (ev.Handled) { @@ -501,7 +501,7 @@ namespace Content.Server.Interaction else { var ev = new ClickAttackEvent(item, user, coordinates, targetUid); - RaiseLocalEvent(item.Uid, ev, false); + RaiseLocalEvent(item, ev, false); if (ev.Handled) { @@ -522,7 +522,7 @@ namespace Content.Server.Interaction } else if (!wideAttack && (targetEnt != null || EntityManager.TryGetEntity(targetUid, out targetEnt)) && - IoCManager.Resolve().HasComponent(targetEnt.Uid)) + IoCManager.Resolve().HasComponent(targetEnt)) { // We pick up items if our hand is empty, even if we're in combat mode. InteractHand(user, targetEnt); @@ -535,14 +535,14 @@ namespace Content.Server.Interaction if (wideAttack) { var ev = new WideAttackEvent(user, user, coordinates); - RaiseLocalEvent(user.Uid, ev, false); + RaiseLocalEvent(user, ev, false); if (ev.Handled) _adminLogSystem.Add(LogType.AttackUnarmedWide, $"{user} wide attacked at {coordinates}"); } else { var ev = new ClickAttackEvent(user, user, coordinates, targetUid); - RaiseLocalEvent(user.Uid, ev, false); + RaiseLocalEvent(user, ev, false); if (ev.Handled) { if (targetEnt != null) diff --git a/Content.Server/Interaction/TilePryCommand.cs b/Content.Server/Interaction/TilePryCommand.cs index 33bc7dd942..cfb13f57e6 100644 --- a/Content.Server/Interaction/TilePryCommand.cs +++ b/Content.Server/Interaction/TilePryCommand.cs @@ -47,9 +47,9 @@ namespace Content.Server.Interaction } var mapManager = IoCManager.Resolve(); - var playerGrid = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).GridID; + var playerGrid = IoCManager.Resolve().GetComponent(player.AttachedEntity).GridID; var mapGrid = mapManager.GetGrid(playerGrid); - var playerPosition = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).Coordinates; + var playerPosition = IoCManager.Resolve().GetComponent(player.AttachedEntity).Coordinates; var tileDefinitionManager = IoCManager.Resolve(); for (var i = -radius; i <= radius; i++) diff --git a/Content.Server/Inventory/Components/DebugEquipComponent.cs b/Content.Server/Inventory/Components/DebugEquipComponent.cs index ee7a0277d1..00d27af966 100644 --- a/Content.Server/Inventory/Components/DebugEquipComponent.cs +++ b/Content.Server/Inventory/Components/DebugEquipComponent.cs @@ -17,22 +17,22 @@ namespace Content.Server.Inventory.Components void IEquipped.Equipped(EquippedEventArgs eventArgs) { - eventArgs.User.PopupMessage("equipped " + IoCManager.Resolve().GetComponent(Owner.Uid).EntityName); + eventArgs.User.PopupMessage("equipped " + IoCManager.Resolve().GetComponent(Owner).EntityName); } void IEquippedHand.EquippedHand(EquippedHandEventArgs eventArgs) { - eventArgs.User.PopupMessage("equipped hand " + IoCManager.Resolve().GetComponent(Owner.Uid).EntityName); + eventArgs.User.PopupMessage("equipped hand " + IoCManager.Resolve().GetComponent(Owner).EntityName); } void IUnequipped.Unequipped(UnequippedEventArgs eventArgs) { - eventArgs.User.PopupMessage("unequipped " + IoCManager.Resolve().GetComponent(Owner.Uid).EntityName); + eventArgs.User.PopupMessage("unequipped " + IoCManager.Resolve().GetComponent(Owner).EntityName); } void IUnequippedHand.UnequippedHand(UnequippedHandEventArgs eventArgs) { - eventArgs.User.PopupMessage("unequipped hand" + IoCManager.Resolve().GetComponent(Owner.Uid).EntityName); + eventArgs.User.PopupMessage("unequipped hand" + IoCManager.Resolve().GetComponent(Owner).EntityName); } } } diff --git a/Content.Server/Inventory/Components/HumanInventoryControllerComponent.cs b/Content.Server/Inventory/Components/HumanInventoryControllerComponent.cs index 0fdf44b602..cb8e756e26 100644 --- a/Content.Server/Inventory/Components/HumanInventoryControllerComponent.cs +++ b/Content.Server/Inventory/Components/HumanInventoryControllerComponent.cs @@ -43,7 +43,7 @@ namespace Content.Server.Inventory.Components if (slotMask == SlotFlags.POCKET) { - var itemComponent = IoCManager.Resolve().GetComponent(entity.Uid); + var itemComponent = IoCManager.Resolve().GetComponent(entity); // If this item is small enough then it always fits in pockets. if (itemComponent.Size <= (int) ReferenceSizes.Pocket) diff --git a/Content.Server/Inventory/Components/InventoryComponent.cs b/Content.Server/Inventory/Components/InventoryComponent.cs index ba186bec6a..4a11405109 100644 --- a/Content.Server/Inventory/Components/InventoryComponent.cs +++ b/Content.Server/Inventory/Components/InventoryComponent.cs @@ -69,7 +69,7 @@ namespace Content.Server.Inventory.Components { if (TryGetSlotItem(slot, out ItemComponent? item)) { - IoCManager.Resolve().DeleteEntity(item.Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) item.Owner); } RemoveSlot(slot); @@ -112,7 +112,7 @@ namespace Content.Server.Inventory.Components public IEnumerable LookupItems() where T : Component { return _slotContainers.Values - .SelectMany(x => x.ContainedEntities.Select(e => IoCManager.Resolve().GetComponentOrNull(e.Uid))) + .SelectMany(x => x.ContainedEntities.Select(e => IoCManager.Resolve().GetComponentOrNull(e))) .Where(x => x != null); } @@ -124,14 +124,14 @@ namespace Content.Server.Inventory.Components } var containedEntity = _slotContainers[slot].ContainedEntity; - if ((containedEntity != null ? (!IoCManager.Resolve().EntityExists(containedEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(containedEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted : null) == true) + if ((containedEntity != null ? (!IoCManager.Resolve().EntityExists(containedEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(containedEntity).EntityLifeStage) >= EntityLifeStage.Deleted : null) == true) { _slotContainers.Remove(slot); containedEntity = null; Dirty(); } - return (containedEntity != null ? IoCManager.Resolve().GetComponent(containedEntity.Uid) : null); + return (containedEntity != null ? IoCManager.Resolve().GetComponent(containedEntity) : null); } public bool TryGetSlotItem(Slots slot, [NotNullWhen(true)] out T? itemComponent) where T : ItemComponent @@ -193,7 +193,7 @@ namespace Content.Server.Inventory.Components Equip(slot, item, mobCheck, out var _); public bool Equip(Slots slot, IEntity entity, bool mobCheck = true) => - Equip(slot, IoCManager.Resolve().GetComponent(entity.Uid), mobCheck); + Equip(slot, IoCManager.Resolve().GetComponent(entity), mobCheck); /// /// Checks whether an item can be put in the specified slot. @@ -225,7 +225,7 @@ namespace Content.Server.Inventory.Components } } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out IInventoryController? controller)) + if (IoCManager.Resolve().TryGetComponent(Owner, out IInventoryController? controller)) { pass = controller.CanEquip(slot, item.Owner, pass, out var controllerReason); reason = controllerReason ?? reason; @@ -251,7 +251,7 @@ namespace Content.Server.Inventory.Components CanEquip(slot, item, mobCheck, out var _); public bool CanEquip(Slots slot, IEntity entity, bool mobCheck = true) => - CanEquip(slot, IoCManager.Resolve().GetComponent(entity.Uid), mobCheck); + CanEquip(slot, IoCManager.Resolve().GetComponent(entity), mobCheck); /// /// Drops the item in a slot. @@ -280,7 +280,7 @@ namespace Content.Server.Inventory.Components } // TODO: The item should be dropped to the container our owner is in, if any. - IoCManager.Resolve().GetComponent(entity.Uid).AttachParentToContainerOrGrid(); + IoCManager.Resolve().GetComponent(entity).AttachParentToContainerOrGrid(); _entitySystemManager.GetEntitySystem().UnequippedInteraction(Owner, entity, slot); @@ -307,10 +307,10 @@ namespace Content.Server.Inventory.Components return; } - var item = IoCManager.Resolve().GetComponent(entity.Uid); + var item = IoCManager.Resolve().GetComponent(entity); inventorySlot.ForceRemove(entity); - var itemTransform = IoCManager.Resolve().GetComponent(entity.Uid); + var itemTransform = IoCManager.Resolve().GetComponent(entity); itemTransform.AttachParentToContainerOrGrid(); @@ -411,7 +411,7 @@ namespace Content.Server.Inventory.Components if (container is not ContainerSlot slot || !_slotContainers.ContainsValue(slot)) return; - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ItemComponent? itemComp)) + if (IoCManager.Resolve().TryGetComponent(entity, out ItemComponent? itemComp)) { itemComp.RemovedFromSlot(); } @@ -431,10 +431,10 @@ namespace Content.Server.Inventory.Components { case ClientInventoryUpdate.Equip: { - var hands = IoCManager.Resolve().GetComponent(Owner.Uid); + var hands = IoCManager.Resolve().GetComponent(Owner); var activeHand = hands.ActiveHand; var activeItem = hands.GetActiveHand; - if (activeHand != null && activeItem != null && IoCManager.Resolve().TryGetComponent(activeItem.Owner.Uid, out ItemComponent? item)) + if (activeHand != null && activeItem != null && IoCManager.Resolve().TryGetComponent(activeItem.Owner, out ItemComponent? item)) { hands.TryDropNoInteraction(); if (!Equip(msg.Inventoryslot, item, true, out var reason)) @@ -449,7 +449,7 @@ namespace Content.Server.Inventory.Components case ClientInventoryUpdate.Use: { var interactionSystem = _entitySystemManager.GetEntitySystem(); - var hands = IoCManager.Resolve().GetComponent(Owner.Uid); + var hands = IoCManager.Resolve().GetComponent(Owner); var activeHand = hands.GetActiveHand; var itemContainedInSlot = GetSlotItem(msg.Inventoryslot); if (itemContainedInSlot != null) @@ -469,14 +469,14 @@ namespace Content.Server.Inventory.Components } case ClientInventoryUpdate.Hover: { - var hands = IoCManager.Resolve().GetComponent(Owner.Uid); + var hands = IoCManager.Resolve().GetComponent(Owner); var activeHand = hands.GetActiveHand; if (activeHand != null && GetSlotItem(msg.Inventoryslot) == null) { var canEquip = CanEquip(msg.Inventoryslot, activeHand, true, out var reason); _hoverEntity = new KeyValuePair(msg.Inventoryslot, - (activeHand.Owner.Uid, canEquip)); + (Uid: activeHand.Owner, canEquip)); Dirty(); } @@ -511,7 +511,7 @@ namespace Content.Server.Inventory.Components if (!HasSlot(msg.Slot)) // client input sanitization return; var item = GetSlotItem(msg.Slot); - if (item != null && IoCManager.Resolve().TryGetComponent(item.Owner.Uid, out ServerStorageComponent? storage)) + if (item != null && IoCManager.Resolve().TryGetComponent(item.Owner, out ServerStorageComponent? storage)) storage.OpenStorageUI(Owner); break; } @@ -524,7 +524,7 @@ namespace Content.Server.Inventory.Components { if (container != null && container.ContainedEntity != null) { - list.Add(new KeyValuePair(slot, container.ContainedEntity.Uid)); + list.Add(new KeyValuePair(slot, container.ContainedEntity)); } } @@ -545,7 +545,7 @@ namespace Content.Server.Inventory.Components { foreach (var entity in slot.ContainedEntities) { - var exActs = IoCManager.Resolve().GetComponents(entity.Uid).ToList(); + var exActs = IoCManager.Resolve().GetComponents(entity).ToList(); foreach (var exAct in exActs) { exAct.OnExplosion(eventArgs); diff --git a/Content.Server/Inventory/InventoryHelpers.cs b/Content.Server/Inventory/InventoryHelpers.cs index c28e4c4c4a..45ae29fe90 100644 --- a/Content.Server/Inventory/InventoryHelpers.cs +++ b/Content.Server/Inventory/InventoryHelpers.cs @@ -16,7 +16,7 @@ namespace Content.Server.Inventory var user = inventory.Owner; // Let's do nothing if the owner of the inventory has been deleted. - if ((!IoCManager.Resolve().EntityExists(user.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(user.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(user) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(user).EntityLifeStage) >= EntityLifeStage.Deleted) return false; // If we don't have that slot or there's already an item there, we do nothing. @@ -28,17 +28,17 @@ namespace Content.Server.Inventory return false; // Let's spawn this first... - var item = entityManager.SpawnEntity(prototype, IoCManager.Resolve().GetComponent(user.Uid).MapPosition); + var item = entityManager.SpawnEntity(prototype, IoCManager.Resolve().GetComponent(user).MapPosition); // Helper method that deletes the item and returns false. bool DeleteItem() { - IoCManager.Resolve().DeleteEntity(item.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) item); return false; } // If this doesn't have an item component, then we can't do anything with it. - if (!IoCManager.Resolve().TryGetComponent(item.Uid, out ItemComponent? itemComp)) + if (!IoCManager.Resolve().TryGetComponent(item, out ItemComponent? itemComp)) return DeleteItem(); // We finally try to equip the item, otherwise we delete it. diff --git a/Content.Server/Inventory/InventorySystem.cs b/Content.Server/Inventory/InventorySystem.cs index 75514455c4..52344adcdd 100644 --- a/Content.Server/Inventory/InventorySystem.cs +++ b/Content.Server/Inventory/InventorySystem.cs @@ -38,7 +38,7 @@ namespace Content.Server.Inventory { if (component.TryGetSlotItem(EquipmentSlotDefines.Slots.SHOES, out ItemComponent? shoes)) { - RaiseLocalEvent(shoes.Owner.Uid, args, false); + RaiseLocalEvent(shoes.Owner, args, false); } } @@ -81,7 +81,7 @@ namespace Content.Server.Inventory { foreach (var equipped in component.GetAllHeldItems()) { - RaiseLocalEvent(equipped.Uid, args, false); + RaiseLocalEvent(equipped, args, false); } } } diff --git a/Content.Server/Items/ItemComponent.cs b/Content.Server/Items/ItemComponent.cs index 8d1050259e..d33ab54562 100644 --- a/Content.Server/Items/ItemComponent.cs +++ b/Content.Server/Items/ItemComponent.cs @@ -12,7 +12,7 @@ namespace Content.Server.Items { public override void RemovedFromSlot() { - foreach (var component in IoCManager.Resolve().GetComponents(Owner.Uid)) + foreach (var component in IoCManager.Resolve().GetComponents(Owner)) { component.Visible = true; } @@ -20,7 +20,7 @@ namespace Content.Server.Items public override void EquippedToSlot() { - foreach (var component in IoCManager.Resolve().GetComponents(Owner.Uid)) + foreach (var component in IoCManager.Resolve().GetComponents(Owner)) { component.Visible = false; } diff --git a/Content.Server/Jobs/GiveItemOnHolidaySpecial.cs b/Content.Server/Jobs/GiveItemOnHolidaySpecial.cs index 602254a91a..87b06697a0 100644 --- a/Content.Server/Jobs/GiveItemOnHolidaySpecial.cs +++ b/Content.Server/Jobs/GiveItemOnHolidaySpecial.cs @@ -30,9 +30,9 @@ namespace Content.Server.Jobs if (!EntitySystem.Get().IsCurrentlyHoliday(Holiday)) return; - var entity = IoCManager.Resolve().SpawnEntity(Prototype, IoCManager.Resolve().GetComponent(mob.Uid).Coordinates); + var entity = IoCManager.Resolve().SpawnEntity(Prototype, IoCManager.Resolve().GetComponent(mob).Coordinates); - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out ItemComponent? item) || !IoCManager.Resolve().TryGetComponent(mob.Uid, out HandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(entity, out ItemComponent? item) || !IoCManager.Resolve().TryGetComponent(mob, out HandsComponent? hands)) return; hands.PutInHand(item, false); diff --git a/Content.Server/Kitchen/Components/KitchenSpikeComponent.cs b/Content.Server/Kitchen/Components/KitchenSpikeComponent.cs index e977aaa4c1..aa5f7116da 100644 --- a/Content.Server/Kitchen/Components/KitchenSpikeComponent.cs +++ b/Content.Server/Kitchen/Components/KitchenSpikeComponent.cs @@ -40,8 +40,8 @@ namespace Content.Server.Kitchen.Components if (!string.IsNullOrEmpty(_meatPrototype)) { - var meat = IoCManager.Resolve().SpawnEntity(_meatPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); - IoCManager.Resolve().GetComponent(meat.Uid).EntityName = _meatName; + var meat = IoCManager.Resolve().SpawnEntity(_meatPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); + IoCManager.Resolve().GetComponent(meat).EntityName = _meatName; } if (_meatParts != 0) @@ -67,7 +67,7 @@ namespace Content.Server.Kitchen.Components private void UpdateAppearance() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(KitchenSpikeVisuals.Status, (_meatParts > 0) ? KitchenSpikeStatus.Bloody : KitchenSpikeStatus.Empty); } @@ -83,7 +83,7 @@ namespace Content.Server.Kitchen.Components return false; } - if (!IoCManager.Resolve().TryGetComponent(victim.Uid, out butcherable)) + if (!IoCManager.Resolve().TryGetComponent(victim, out butcherable)) { Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-butcher", ("victim", victim), ("this", Owner))); return false; @@ -97,7 +97,7 @@ namespace Content.Server.Kitchen.Components public async void TrySpike(IEntity victim, IEntity user) { - var victimUid = victim.Uid; + var victimUid = (EntityUid) victim; if (_beingButchered.Contains(victimUid)) return; SharedButcherableComponent? butcherable; @@ -106,7 +106,7 @@ namespace Content.Server.Kitchen.Components return; // Prevent dead from being spiked TODO: Maybe remove when rounds can be played and DOT is implemented - if (IoCManager.Resolve().TryGetComponent(victim.Uid, out var state) && + if (IoCManager.Resolve().TryGetComponent(victim, out var state) && !state.IsDead()) { Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-not-dead", ("victim", victim))); @@ -154,7 +154,7 @@ namespace Content.Server.Kitchen.Components Owner.PopupMessageEveryone(Loc.GetString("comp-kitchen-spike-kill", ("user", user), ("victim", victim))); // TODO: Need to be able to leave them on the spike to do DoT, see ss13. - IoCManager.Resolve().DeleteEntity(victim.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) victim); SoundSystem.Play(Filter.Pvs(Owner), SpikeSound.GetSound(), Owner); } diff --git a/Content.Server/Kitchen/Components/MicrowaveComponent.cs b/Content.Server/Kitchen/Components/MicrowaveComponent.cs index 013f8be7dc..8aed651bbd 100644 --- a/Content.Server/Kitchen/Components/MicrowaveComponent.cs +++ b/Content.Server/Kitchen/Components/MicrowaveComponent.cs @@ -68,10 +68,10 @@ namespace Content.Server.Kitchen.Components /// [ViewVariables] private uint _currentCookTimerTime = 1; - private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) || receiver.Powered; + private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered; private bool HasContents => EntitySystem.Get() - .TryGetSolution(Owner.Uid, SolutionName, out var solution) && + .TryGetSolution(Owner, SolutionName, out var solution) && (solution.Contents.Count > 0 || _storage.ContainedEntities.Count > 0); private bool _uiDirty = true; @@ -94,7 +94,7 @@ namespace Content.Server.Kitchen.Components _currentCookTimerTime = _cookTimeDefault; - EntitySystem.Get().EnsureSolution(Owner.Uid, SolutionName); + EntitySystem.Get().EnsureSolution(Owner, SolutionName); _storage = ContainerHelpers.EnsureContainer(Owner, "microwave_entity_container", out _); @@ -184,12 +184,12 @@ namespace Content.Server.Kitchen.Components } if (_uiDirty && EntitySystem.Get() - .TryGetSolution(Owner.Uid, SolutionName, out var solution)) + .TryGetSolution(Owner, SolutionName, out var solution)) { UserInterface?.SetState(new MicrowaveUpdateUserInterfaceState ( solution.Contents.ToArray(), - _storage.ContainedEntities.Select(item => item.Uid).ToArray(), + _storage.ContainedEntities.Select(item => (EntityUid) item).ToArray(), _busy, _currentCookTimeButtonIndex, _currentCookTimerTime @@ -206,7 +206,7 @@ namespace Content.Server.Kitchen.Components finalState = MicrowaveVisualState.Broken; } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(PowerDeviceVisuals.VisualState, finalState); } @@ -220,7 +220,7 @@ namespace Content.Server.Kitchen.Components void IActivate.Activate(ActivateEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor) || !Powered) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor) || !Powered) { return; } @@ -243,7 +243,7 @@ namespace Content.Server.Kitchen.Components return false; } - var itemEntity = IoCManager.Resolve().GetComponent(eventArgs.User.Uid).GetActiveHand?.Owner; + var itemEntity = IoCManager.Resolve().GetComponent(eventArgs.User).GetActiveHand?.Owner; if (itemEntity == null) { @@ -251,15 +251,15 @@ namespace Content.Server.Kitchen.Components return false; } - if (IoCManager.Resolve().TryGetComponent(itemEntity.Uid, out var attackPourable)) + if (IoCManager.Resolve().TryGetComponent(itemEntity, out var attackPourable)) { var solutionsSystem = EntitySystem.Get(); - if (!solutionsSystem.TryGetDrainableSolution(itemEntity.Uid, out var attackSolution)) + if (!solutionsSystem.TryGetDrainableSolution(itemEntity, out var attackSolution)) { return false; } - if (!solutionsSystem.TryGetSolution(Owner.Uid, SolutionName, out var solution)) + if (!solutionsSystem.TryGetSolution(Owner, SolutionName, out var solution)) { return false; } @@ -275,8 +275,8 @@ namespace Content.Server.Kitchen.Components //Move units from attackSolution to targetSolution var removedSolution = EntitySystem.Get() - .Drain(itemEntity.Uid, attackSolution, realTransferAmount); - if (!EntitySystem.Get().TryAddSolution(Owner.Uid, solution, removedSolution)) + .Drain(itemEntity, attackSolution, realTransferAmount); + if (!EntitySystem.Get().TryAddSolution(Owner, solution, removedSolution)) { return false; } @@ -286,7 +286,7 @@ namespace Content.Server.Kitchen.Components return true; } - if (!IoCManager.Resolve().TryGetComponent(itemEntity.Uid, typeof(ItemComponent), out var food)) + if (!IoCManager.Resolve().TryGetComponent(itemEntity, typeof(ItemComponent), out var food)) { Owner.PopupMessage(eventArgs.User, "microwave-component-interact-using-transfer-fail"); return false; @@ -312,18 +312,18 @@ namespace Content.Server.Kitchen.Components var solidsDict = new Dictionary(); foreach (var item in _storage.ContainedEntities) { - if (IoCManager.Resolve().GetComponent(item.Uid).EntityPrototype == null) + if (IoCManager.Resolve().GetComponent(item).EntityPrototype == null) { continue; } - if (solidsDict.ContainsKey(IoCManager.Resolve().GetComponent(item.Uid).EntityPrototype.ID)) + if (solidsDict.ContainsKey(IoCManager.Resolve().GetComponent(item).EntityPrototype.ID)) { - solidsDict[IoCManager.Resolve().GetComponent(item.Uid).EntityPrototype.ID]++; + solidsDict[IoCManager.Resolve().GetComponent(item).EntityPrototype.ID]++; } else { - solidsDict.Add(IoCManager.Resolve().GetComponent(item.Uid).EntityPrototype.ID, 1); + solidsDict.Add(IoCManager.Resolve().GetComponent(item).EntityPrototype.ID, 1); } } @@ -366,13 +366,13 @@ namespace Content.Server.Kitchen.Components if (recipeToCook != null) { SubtractContents(recipeToCook); - IoCManager.Resolve().SpawnEntity(recipeToCook.Result, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + IoCManager.Resolve().SpawnEntity(recipeToCook.Result, IoCManager.Resolve().GetComponent(Owner).Coordinates); } else { VaporizeReagents(); VaporizeSolids(); - IoCManager.Resolve().SpawnEntity(_badRecipeName, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + IoCManager.Resolve().SpawnEntity(_badRecipeName, IoCManager.Resolve().GetComponent(Owner).Coordinates); } } @@ -390,18 +390,18 @@ namespace Content.Server.Kitchen.Components private void VaporizeReagents() { - if (EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution)) + if (EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution)) { - EntitySystem.Get().RemoveAllSolution(Owner.Uid, solution); + EntitySystem.Get().RemoveAllSolution(Owner, solution); } } private void VaporizeReagentQuantity(Solution.ReagentQuantity reagentQuantity) { - if (EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution)) + if (EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution)) { EntitySystem.Get() - .TryRemoveReagent(Owner.Uid, solution, reagentQuantity.ReagentId, reagentQuantity.Quantity); + .TryRemoveReagent(Owner, solution, reagentQuantity.ReagentId, reagentQuantity.Quantity); } } @@ -411,7 +411,7 @@ namespace Content.Server.Kitchen.Components { var item = _storage.ContainedEntities.ElementAt(i); _storage.Remove(item); - IoCManager.Resolve().DeleteEntity(item.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) item); } } @@ -433,8 +433,8 @@ namespace Content.Server.Kitchen.Components private void SubtractContents(FoodRecipePrototype recipe) { - var solutionUid = Owner.Uid; - if (!EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution)) + var solutionUid = (EntityUid) Owner; + if (!EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution)) { return; } @@ -451,15 +451,15 @@ namespace Content.Server.Kitchen.Components { foreach (var item in _storage.ContainedEntities) { - if (IoCManager.Resolve().GetComponent(item.Uid).EntityPrototype == null) + if (IoCManager.Resolve().GetComponent(item).EntityPrototype == null) { continue; } - if (IoCManager.Resolve().GetComponent(item.Uid).EntityPrototype.ID == recipeSolid.Key) + if (IoCManager.Resolve().GetComponent(item).EntityPrototype.ID == recipeSolid.Key) { _storage.Remove(item); - IoCManager.Resolve().DeleteEntity(item.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) item); break; } } @@ -474,7 +474,7 @@ namespace Content.Server.Kitchen.Components return MicrowaveSuccessState.RecipeFail; } - if (!EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution)) + if (!EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution)) { return MicrowaveSuccessState.RecipeFail; } @@ -517,7 +517,7 @@ namespace Content.Server.Kitchen.Components { var headCount = 0; - if (IoCManager.Resolve().TryGetComponent(victim.Uid, out var body)) + if (IoCManager.Resolve().TryGetComponent(victim, out var body)) { var headSlots = body.GetSlotsOfType(BodyPartType.Head); diff --git a/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs b/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs index ad1438e1bf..4971e168b5 100644 --- a/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/ReagentGrinderSystem.cs @@ -54,7 +54,7 @@ namespace Content.Server.Kitchen.EntitySystems { if (args.Handled) return; - if (!IoCManager.Resolve().HasComponent(args.User.Uid)) + if (!IoCManager.Resolve().HasComponent(args.User)) { component.Owner.PopupMessage(args.User, Loc.GetString("reagent-grinder-component-interact-using-no-hands")); @@ -67,13 +67,13 @@ namespace Content.Server.Kitchen.EntitySystems // First, check if user is trying to insert a beaker. // No promise it will be a beaker right now, but whatever. // Maybe this should whitelist "beaker" in the prototype id of heldEnt? - if (_solutionsSystem.TryGetFitsInDispenser(heldEnt.Uid, out var beaker)) + if (_solutionsSystem.TryGetFitsInDispenser(heldEnt, out var beaker)) { component.BeakerContainer.Insert(heldEnt); component.HeldBeaker = beaker; EnqueueUiUpdate(component); //We are done, return. Insert the beaker and exit! - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out AppearanceComponent? appearance)) { appearance.SetData(SharedReagentGrinderComponent.ReagentGrinderVisualState.BeakerAttached, component.BeakerContainer.ContainedEntity != null); @@ -85,7 +85,7 @@ namespace Content.Server.Kitchen.EntitySystems } //Next, see if the user is trying to insert something they want to be ground/juiced. - if (!IoCManager.Resolve().TryGetComponent(heldEnt.Uid, out ExtractableComponent? juice)) + if (!IoCManager.Resolve().TryGetComponent(heldEnt, out ExtractableComponent? juice)) { //Entity did NOT pass the whitelist for grind/juice. //Wouldn't want the clown grinding up the Captain's ID card now would you? @@ -113,7 +113,7 @@ namespace Content.Server.Kitchen.EntitySystems { if (args.Handled) return; - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) { return; } @@ -161,7 +161,7 @@ namespace Content.Server.Kitchen.EntitySystems switch (message.Message) { case SharedReagentGrinderComponent.ReagentGrinderGrindStartMessage msg: - if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out ApcPowerReceiverComponent? receiver) || + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver) || !receiver.Powered) break; ClickSound(component); DoWork(component, message.Session.AttachedEntity!, @@ -169,7 +169,7 @@ namespace Content.Server.Kitchen.EntitySystems break; case SharedReagentGrinderComponent.ReagentGrinderJuiceStartMessage msg: - if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out ApcPowerReceiverComponent? receiver2) || + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver2) || !receiver2.Powered) break; ClickSound(component); DoWork(component, message.Session.AttachedEntity!, @@ -193,7 +193,7 @@ namespace Content.Server.Kitchen.EntitySystems break; case SharedReagentGrinderComponent.ReagentGrinderEjectChamberContentMessage msg: - if (component.Chamber.ContainedEntities.TryFirstOrDefault(x => x.Uid == msg.EntityID, out var ent)) + if (component.Chamber.ContainedEntities.TryFirstOrDefault(x => x == msg.EntityID, out var ent)) { component.Chamber.Remove(ent); ent.RandomOffset(0.4f); @@ -226,11 +226,11 @@ namespace Content.Server.Kitchen.EntitySystems { foreach (var entity in comp.Chamber.ContainedEntities) { - if (canJuice || !IoCManager.Resolve().TryGetComponent(entity.Uid, out ExtractableComponent? component)) continue; + if (canJuice || !IoCManager.Resolve().TryGetComponent(entity, out ExtractableComponent? component)) continue; canJuice = component.JuiceSolution != null; canGrind = component.GrindableSolution != null - && _solutionsSystem.TryGetSolution(entity.Uid, component.GrindableSolution, out _); + && _solutionsSystem.TryGetSolution(entity, component.GrindableSolution, out _); } } @@ -239,10 +239,10 @@ namespace Content.Server.Kitchen.EntitySystems ( comp.Busy, comp.BeakerContainer.ContainedEntity != null, - IoCManager.Resolve().TryGetComponent(comp.Owner.Uid, out ApcPowerReceiverComponent? receiver) && receiver.Powered, + IoCManager.Resolve().TryGetComponent(comp.Owner, out ApcPowerReceiverComponent? receiver) && receiver.Powered, canJuice, canGrind, - comp.Chamber.ContainedEntities.Select(item => item.Uid).ToArray(), + comp.Chamber.ContainedEntities.Select(item => (EntityUid) item).ToArray(), //Remember the beaker can be null! comp.HeldBeaker?.Contents.ToArray() )); @@ -264,14 +264,14 @@ namespace Content.Server.Kitchen.EntitySystems component.BeakerContainer.Remove(beaker); - if (user == null || !IoCManager.Resolve().TryGetComponent(user.Uid, out var hands) || - !IoCManager.Resolve().TryGetComponent(beaker.Uid, out var item)) + if (user == null || !IoCManager.Resolve().TryGetComponent(user, out var hands) || + !IoCManager.Resolve().TryGetComponent(beaker, out var item)) return; hands.PutInHandOrDrop(item); component.HeldBeaker = null; EnqueueUiUpdate(component); - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out AppearanceComponent? appearance)) { appearance.SetData(SharedReagentGrinderComponent.ReagentGrinderVisualState.BeakerAttached, component.BeakerContainer.ContainedEntity != null); @@ -286,7 +286,7 @@ namespace Content.Server.Kitchen.EntitySystems SharedReagentGrinderComponent.GrinderProgram program) { //Have power, are we busy, chamber has anything to grind, a beaker for the grounds to go? - if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out ApcPowerReceiverComponent? receiver) || !receiver.Powered || + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver) || !receiver.Powered || component.Busy || component.Chamber.ContainedEntities.Count <= 0 || component.BeakerContainer.ContainedEntity == null || component.HeldBeaker == null) { @@ -308,18 +308,18 @@ namespace Content.Server.Kitchen.EntitySystems { foreach (var item in component.Chamber.ContainedEntities.ToList()) { - if (!IoCManager.Resolve().TryGetComponent(item.Uid, out ExtractableComponent? extract) + if (!IoCManager.Resolve().TryGetComponent(item, out ExtractableComponent? extract) || extract.GrindableSolution == null - || !_solutionsSystem.TryGetSolution(item.Uid, extract.GrindableSolution, out var solution)) continue; + || !_solutionsSystem.TryGetSolution(item, extract.GrindableSolution, out var solution)) continue; var juiceEvent = new ExtractableScalingEvent(); // default of scalar is always 1.0 - RaiseLocalEvent(item.Uid, juiceEvent, false); + RaiseLocalEvent(item, juiceEvent, false); if (component.HeldBeaker.CurrentVolume + solution.CurrentVolume * juiceEvent.Scalar > component.HeldBeaker.MaxVolume) continue; solution.ScaleSolution(juiceEvent.Scalar); - _solutionsSystem.TryAddSolution(beakerEntity.Uid, component.HeldBeaker, solution); - _solutionsSystem.RemoveAllSolution(beakerEntity.Uid, solution); - IoCManager.Resolve().DeleteEntity(item.Uid); + _solutionsSystem.TryAddSolution(beakerEntity, component.HeldBeaker, solution); + _solutionsSystem.RemoveAllSolution(beakerEntity, solution); + IoCManager.Resolve().DeleteEntity((EntityUid) item); } component.Busy = false; @@ -334,24 +334,24 @@ namespace Content.Server.Kitchen.EntitySystems { foreach (var item in component.Chamber.ContainedEntities.ToList()) { - if (!IoCManager.Resolve().TryGetComponent(item.Uid, out var juiceMe) + if (!IoCManager.Resolve().TryGetComponent(item, out var juiceMe) || juiceMe.JuiceSolution == null) { - Logger.Warning("Couldn't find a juice solution on entityUid:{0}", item.Uid); + Logger.Warning("Couldn't find a juice solution on entityUid:{0}", item); continue; } var juiceEvent = new ExtractableScalingEvent(); // default of scalar is always 1.0 - if (IoCManager.Resolve().HasComponent(item.Uid)) + if (IoCManager.Resolve().HasComponent(item)) { - RaiseLocalEvent(item.Uid, juiceEvent); + RaiseLocalEvent(item, juiceEvent); } if (component.HeldBeaker.CurrentVolume + juiceMe.JuiceSolution.TotalVolume * juiceEvent.Scalar > component.HeldBeaker.MaxVolume) continue; juiceMe.JuiceSolution.ScaleSolution(juiceEvent.Scalar); - _solutionsSystem.TryAddSolution(beakerEntity.Uid, component.HeldBeaker, juiceMe.JuiceSolution); - IoCManager.Resolve().DeleteEntity(item.Uid); + _solutionsSystem.TryAddSolution(beakerEntity, component.HeldBeaker, juiceMe.JuiceSolution); + IoCManager.Resolve().DeleteEntity((EntityUid) item); } bui?.SendMessage(new SharedReagentGrinderComponent.ReagentGrinderWorkCompleteMessage()); diff --git a/Content.Server/Labels/Label/HandLabelerSystem.cs b/Content.Server/Labels/Label/HandLabelerSystem.cs index a0e9f3db62..18815e4696 100644 --- a/Content.Server/Labels/Label/HandLabelerSystem.cs +++ b/Content.Server/Labels/Label/HandLabelerSystem.cs @@ -34,7 +34,7 @@ namespace Content.Server.Labels private void AfterInteractOn(EntityUid uid, HandLabelerComponent handLabeler, AfterInteractEvent args) { - if (args.Target == null || !handLabeler.Whitelist.IsValid(args.Target.Uid)) + if (args.Target == null || !handLabeler.Whitelist.IsValid(args.Target)) return; AddLabelTo(uid, handLabeler, args.Target, out string? result); @@ -53,7 +53,7 @@ namespace Content.Server.Labels LabelComponent label = target.EnsureComponent(); if (label.OriginalName != null) - IoCManager.Resolve().GetComponent(target.Uid).EntityName = label.OriginalName; + IoCManager.Resolve().GetComponent(target).EntityName = label.OriginalName; label.OriginalName = null; if (handLabeler.AssignedLabel == string.Empty) @@ -63,16 +63,16 @@ namespace Content.Server.Labels return; } - label.OriginalName = IoCManager.Resolve().GetComponent(target.Uid).EntityName; - string val = IoCManager.Resolve().GetComponent(target.Uid).EntityName + $" ({handLabeler.AssignedLabel})"; - IoCManager.Resolve().GetComponent(target.Uid).EntityName = val; + label.OriginalName = IoCManager.Resolve().GetComponent(target).EntityName; + string val = IoCManager.Resolve().GetComponent(target).EntityName + $" ({handLabeler.AssignedLabel})"; + IoCManager.Resolve().GetComponent(target).EntityName = val; label.CurrentLabel = handLabeler.AssignedLabel; result = Loc.GetString("hand-labeler-successfully-applied"); } private void OnUseInHand(EntityUid uid, HandLabelerComponent handLabeler, UseInHandEvent args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) return; handLabeler.Owner.GetUIOrNull(HandLabelerUiKey.Key)?.Open(actor.PlayerSession); diff --git a/Content.Server/Labels/Label/LabelSystem.cs b/Content.Server/Labels/Label/LabelSystem.cs index 9d14a5d92c..d75e6d3bf7 100644 --- a/Content.Server/Labels/Label/LabelSystem.cs +++ b/Content.Server/Labels/Label/LabelSystem.cs @@ -71,7 +71,7 @@ namespace Content.Server.Labels return; } - if (!EntityManager.TryGetComponent(comp.LabelSlot.Item.Uid, out PaperComponent paper)) + if (!EntityManager.TryGetComponent(comp.LabelSlot.Item, out PaperComponent paper)) // Assuming yaml has the correct entity whitelist, this should not happen. return; diff --git a/Content.Server/Lathe/Components/LatheComponent.cs b/Content.Server/Lathe/Components/LatheComponent.cs index 2aa78c7dea..72e7941549 100644 --- a/Content.Server/Lathe/Components/LatheComponent.cs +++ b/Content.Server/Lathe/Components/LatheComponent.cs @@ -42,7 +42,7 @@ namespace Content.Server.Lathe.Components [ViewVariables] private LatheRecipePrototype? _producingRecipe; [ViewVariables] - private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) || receiver.Powered; + private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered; private static readonly TimeSpan InsertionTime = TimeSpan.FromSeconds(0.9f); @@ -75,20 +75,20 @@ namespace Content.Server.Lathe.Components } break; case LatheSyncRequestMessage _: - if (!IoCManager.Resolve().HasComponent(Owner.Uid)) return; + if (!IoCManager.Resolve().HasComponent(Owner)) return; UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue())); if (_producingRecipe != null) UserInterface?.SendMessage(new LatheProducingRecipeMessage(_producingRecipe.ID)); break; case LatheServerSelectionMessage _: - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out ResearchClientComponent? researchClient)) return; + if (!IoCManager.Resolve().TryGetComponent(Owner, out ResearchClientComponent? researchClient)) return; researchClient.OpenUserInterface(message.Session); break; case LatheServerSyncMessage _: - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out TechnologyDatabaseComponent? database) - || !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ProtolatheDatabaseComponent? protoDatabase)) return; + if (!IoCManager.Resolve().TryGetComponent(Owner, out TechnologyDatabaseComponent? database) + || !IoCManager.Resolve().TryGetComponent(Owner, out ProtolatheDatabaseComponent? protoDatabase)) return; if (database.SyncWithServer()) protoDatabase.Sync(); @@ -101,7 +101,7 @@ namespace Content.Server.Lathe.Components internal bool Produce(LatheRecipePrototype recipe) { - if (Producing || !Powered || !CanProduce(recipe) || !IoCManager.Resolve().TryGetComponent(Owner.Uid, out MaterialStorageComponent? storage)) return false; + if (Producing || !Powered || !CanProduce(recipe) || !IoCManager.Resolve().TryGetComponent(Owner, out MaterialStorageComponent? storage)) return false; UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue())); @@ -123,7 +123,7 @@ namespace Content.Server.Lathe.Components { Producing = false; _producingRecipe = null; - IoCManager.Resolve().SpawnEntity(recipe.Result, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + IoCManager.Resolve().SpawnEntity(recipe.Result, IoCManager.Resolve().GetComponent(Owner).Coordinates); UserInterface?.SendMessage(new LatheStoppedProducingRecipeMessage()); State = LatheState.Base; SetAppearance(LatheVisualState.Idle); @@ -139,7 +139,7 @@ namespace Content.Server.Lathe.Components void IActivate.Activate(ActivateEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) return; if (!Powered) { @@ -151,12 +151,12 @@ namespace Content.Server.Lathe.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out MaterialStorageComponent? storage) - || !IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out MaterialComponent? material)) return false; + if (!IoCManager.Resolve().TryGetComponent(Owner, out MaterialStorageComponent? storage) + || !IoCManager.Resolve().TryGetComponent(eventArgs.Using, out MaterialComponent? material)) return false; var multiplier = 1; - if (IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out StackComponent? stack)) multiplier = stack.Count; + if (IoCManager.Resolve().TryGetComponent(eventArgs.Using, out StackComponent? stack)) multiplier = stack.Count; var totalAmount = 0; @@ -202,14 +202,14 @@ namespace Content.Server.Lathe.Components SetAppearance(LatheVisualState.Idle); }); - IoCManager.Resolve().DeleteEntity(eventArgs.Using.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) eventArgs.Using); return true; } private void SetAppearance(LatheVisualState state) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(PowerDeviceVisuals.VisualState, state); } diff --git a/Content.Server/Lathe/Components/ProtolatheDatabaseComponent.cs b/Content.Server/Lathe/Components/ProtolatheDatabaseComponent.cs index 1c3963f5e0..efd8818994 100644 --- a/Content.Server/Lathe/Components/ProtolatheDatabaseComponent.cs +++ b/Content.Server/Lathe/Components/ProtolatheDatabaseComponent.cs @@ -27,7 +27,7 @@ namespace Content.Server.Lathe.Components /// public void Sync() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out TechnologyDatabaseComponent? database)) return; + if (!IoCManager.Resolve().TryGetComponent(Owner, out TechnologyDatabaseComponent? database)) return; foreach (var technology in database.Technologies) { diff --git a/Content.Server/Light/Components/EmergencyLightComponent.cs b/Content.Server/Light/Components/EmergencyLightComponent.cs index 5a8fe47ca0..d4ba9c4b3d 100644 --- a/Content.Server/Light/Components/EmergencyLightComponent.cs +++ b/Content.Server/Light/Components/EmergencyLightComponent.cs @@ -60,7 +60,7 @@ namespace Content.Server.Light.Components /// public void UpdateState() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver)) { return; } @@ -80,7 +80,7 @@ namespace Content.Server.Light.Components public void OnUpdate(float frameTime) { - if ((!IoCManager.Resolve().EntityExists(Owner.Uid) || !IoCManager.Resolve().TryGetComponent(Owner.Uid, out BatteryComponent? battery) || IoCManager.Resolve().GetComponent(Owner.Uid).EntityPaused)) + if ((!IoCManager.Resolve().EntityExists(Owner) || !IoCManager.Resolve().TryGetComponent(Owner, out BatteryComponent? battery) || IoCManager.Resolve().GetComponent(Owner).EntityPaused)) { return; } @@ -98,7 +98,7 @@ namespace Content.Server.Light.Components battery.CurrentCharge += _chargingWattage * frameTime * _chargingEfficiency; if (battery.IsFullyCharged) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver)) { receiver.Load = 1; } @@ -110,23 +110,23 @@ namespace Content.Server.Light.Components private void TurnOff() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out PointLightComponent? light)) + if (IoCManager.Resolve().TryGetComponent(Owner, out PointLightComponent? light)) { light.Enabled = false; } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) appearance.SetData(EmergencyLightVisuals.On, false); } private void TurnOn() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out PointLightComponent? light)) + if (IoCManager.Resolve().TryGetComponent(Owner, out PointLightComponent? light)) { light.Enabled = true; } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) appearance.SetData(EmergencyLightVisuals.On, true); } diff --git a/Content.Server/Light/Components/ExpendableLightComponent.cs b/Content.Server/Light/Components/ExpendableLightComponent.cs index 42561642e3..cda164a995 100644 --- a/Content.Server/Light/Components/ExpendableLightComponent.cs +++ b/Content.Server/Light/Components/ExpendableLightComponent.cs @@ -36,14 +36,14 @@ namespace Content.Server.Light.Components { base.Initialize(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var item)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var item)) { item.EquippedPrefix = "unlit"; } CurrentState = ExpendableLightState.BrandNew; Owner.EnsureComponent(); - IoCManager.Resolve().TryGetComponent(Owner.Uid, out _appearance); + IoCManager.Resolve().TryGetComponent(Owner, out _appearance); } /// @@ -53,7 +53,7 @@ namespace Content.Server.Light.Components { if (!Activated && CurrentState == ExpendableLightState.BrandNew) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var item)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var item)) { item.EquippedPrefix = "lit"; } @@ -92,7 +92,7 @@ namespace Content.Server.Light.Components private void UpdateSpriteAndSounds(bool on) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(Owner, out SpriteComponent? sprite)) { switch (CurrentState) { @@ -126,7 +126,7 @@ namespace Content.Server.Light.Components } } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ClothingComponent? clothing)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ClothingComponent? clothing)) { clothing.ClothingEquippedPrefix = on ? "Activated" : string.Empty; } @@ -155,13 +155,13 @@ namespace Content.Server.Light.Components case ExpendableLightState.Fading: CurrentState = ExpendableLightState.Dead; - IoCManager.Resolve().GetComponent(Owner.Uid).EntityName = SpentName; - IoCManager.Resolve().GetComponent(Owner.Uid).EntityDescription = SpentDesc; + IoCManager.Resolve().GetComponent(Owner).EntityName = SpentName; + IoCManager.Resolve().GetComponent(Owner).EntityDescription = SpentDesc; UpdateSpriteAndSounds(Activated); UpdateVisualizer(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var item)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var item)) { item.EquippedPrefix = "unlit"; } diff --git a/Content.Server/Light/Components/HandheldLightComponent.cs b/Content.Server/Light/Components/HandheldLightComponent.cs index 680d396945..6e87fbbde8 100644 --- a/Content.Server/Light/Components/HandheldLightComponent.cs +++ b/Content.Server/Light/Components/HandheldLightComponent.cs @@ -77,7 +77,7 @@ namespace Content.Server.Light.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - if (!EntitySystem.Get().CanInteract(eventArgs.User.Uid)) return false; + if (!EntitySystem.Get().CanInteract(eventArgs.User)) return false; if (!_cellSlot.InsertCell(eventArgs.Using)) return false; Dirty(); return true; @@ -106,7 +106,7 @@ namespace Content.Server.Light.Components /// True if the light's status was toggled, false otherwise. public bool ToggleStatus(IEntity user) { - if (!EntitySystem.Get().CanUse(user.Uid)) return false; + if (!EntitySystem.Get().CanUse(user)) return false; return Activated ? TurnOff() : TurnOn(user); } @@ -167,22 +167,22 @@ namespace Content.Server.Light.Components private void SetState(bool on) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(Owner, out SpriteComponent? sprite)) { sprite.LayerSetVisible(1, on); } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out PointLightComponent? light)) + if (IoCManager.Resolve().TryGetComponent(Owner, out PointLightComponent? light)) { light.Enabled = on; } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ClothingComponent? clothing)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ClothingComponent? clothing)) { clothing.ClothingEquippedPrefix = Loc.GetString(on ? "on" : "off"); } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ItemComponent? item)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ItemComponent? item)) { item.EquippedPrefix = Loc.GetString(on ? "on" : "off"); } @@ -201,7 +201,7 @@ namespace Content.Server.Light.Components return; } - var appearanceComponent = IoCManager.Resolve().GetComponent(Owner.Uid); + var appearanceComponent = IoCManager.Resolve().GetComponent(Owner); if (Cell.MaxCharge - Cell.CurrentCharge < Cell.MaxCharge * 0.70) { @@ -254,7 +254,7 @@ namespace Content.Server.Light.Components { public bool DoToggleAction(ToggleItemActionEventArgs args) { - if (!IoCManager.Resolve().TryGetComponent(args.Item.Uid, out var lightComponent)) return false; + if (!IoCManager.Resolve().TryGetComponent(args.Item, out var lightComponent)) return false; if (lightComponent.Activated == args.ToggledOn) return false; return lightComponent.ToggleStatus(args.Performer); } diff --git a/Content.Server/Light/Components/LightBulbComponent.cs b/Content.Server/Light/Components/LightBulbComponent.cs index a411303691..f632689169 100644 --- a/Content.Server/Light/Components/LightBulbComponent.cs +++ b/Content.Server/Light/Components/LightBulbComponent.cs @@ -39,7 +39,7 @@ namespace Content.Server.Light.Components public void OnBreak(BreakageEventArgs eventArgs) { EntitySystem.Get() - .SetState(Owner.Uid, LightBulbState.Broken, this); + .SetState(Owner, LightBulbState.Broken, this); } } } diff --git a/Content.Server/Light/EntitySystems/LightReplacerSystem.cs b/Content.Server/Light/EntitySystems/LightReplacerSystem.cs index 657bd2aff8..7bbf0b7969 100644 --- a/Content.Server/Light/EntitySystems/LightReplacerSystem.cs +++ b/Content.Server/Light/EntitySystems/LightReplacerSystem.cs @@ -44,20 +44,20 @@ namespace Content.Server.Light.EntitySystems return; // standard interaction checks - if (!_blocker.CanUse(eventArgs.User.Uid)) return; + if (!_blocker.CanUse(eventArgs.User)) return; if (!eventArgs.CanReach) return; // behaviour will depends on target type if (eventArgs.Target != null) { - var targetUid = eventArgs.Target.Uid; + var targetUid = (EntityUid) eventArgs.Target; // replace broken light in fixture? if (EntityManager.TryGetComponent(targetUid, out PoweredLightComponent? fixture)) - eventArgs.Handled = TryReplaceBulb(uid, targetUid, eventArgs.User.Uid, component, fixture); + eventArgs.Handled = TryReplaceBulb(uid, targetUid, eventArgs.User, component, fixture); // add new bulb to light replacer container? else if (EntityManager.TryGetComponent(targetUid, out LightBulbComponent? bulb)) - eventArgs.Handled = TryInsertBulb(uid, targetUid, eventArgs.User.Uid, true, component, bulb); + eventArgs.Handled = TryInsertBulb(uid, targetUid, eventArgs.User, true, component, bulb); } } @@ -67,18 +67,18 @@ namespace Content.Server.Light.EntitySystems return; // standard interaction checks - if (!_blocker.CanInteract(eventArgs.User.Uid)) return; + if (!_blocker.CanInteract(eventArgs.User)) return; if (eventArgs.Used != null) { - var usedUid = eventArgs.Used.Uid; + var usedUid = (EntityUid) eventArgs.Used; // want to insert a new light bulb? if (EntityManager.TryGetComponent(usedUid, out LightBulbComponent ? bulb)) - eventArgs.Handled = TryInsertBulb(uid, usedUid, eventArgs.User.Uid, true, component, bulb); + eventArgs.Handled = TryInsertBulb(uid, usedUid, eventArgs.User, true, component, bulb); // add bulbs from storage? else if (EntityManager.TryGetComponent(usedUid, out ServerStorageComponent? storage)) - eventArgs.Handled = TryInsertBulbsFromStorage(uid, usedUid, eventArgs.User.Uid, component, storage); + eventArgs.Handled = TryInsertBulbsFromStorage(uid, usedUid, eventArgs.User, component, storage); } } @@ -96,7 +96,7 @@ namespace Content.Server.Light.EntitySystems return false; // check if light bulb is broken or missing - var fixtureBulbUid = _poweredLight.GetBulb(fixture.Owner.Uid, fixture); + var fixtureBulbUid = _poweredLight.GetBulb(fixture.Owner, fixture); if (fixtureBulbUid != null) { if (!EntityManager.TryGetComponent(fixtureBulbUid.Value, out LightBulbComponent? fixtureBulb)) @@ -107,7 +107,7 @@ namespace Content.Server.Light.EntitySystems // try get first inserted bulb of the same type as targeted light fixtutre var bulb = replacer.InsertedBulbs.ContainedEntities.FirstOrDefault( - (e) => IoCManager.Resolve().GetComponentOrNull(e.Uid)?.Type == fixture.BulbType); + (e) => IoCManager.Resolve().GetComponentOrNull(e)?.Type == fixture.BulbType); // found bulb in inserted storage if (bulb != null) @@ -125,7 +125,7 @@ namespace Content.Server.Light.EntitySystems // found right bulb, let's spawn it if (bulbEnt != null) { - bulb = EntityManager.SpawnEntity(bulbEnt.PrototypeName, IoCManager.Resolve().GetComponent(replacer.Owner.Uid).Coordinates); + bulb = EntityManager.SpawnEntity(bulbEnt.PrototypeName, IoCManager.Resolve().GetComponent(replacer.Owner).Coordinates); bulbEnt.Amount--; } // not found any light bulbs @@ -142,7 +142,7 @@ namespace Content.Server.Light.EntitySystems } // insert it into fixture - var wasReplaced = _poweredLight.ReplaceBulb(fixtureUid, bulb.Uid, fixture); + var wasReplaced = _poweredLight.ReplaceBulb(fixtureUid, bulb, fixture); if (wasReplaced) { SoundSystem.Play(Filter.Pvs(replacerUid), replacer.Sound.GetSound(), @@ -211,9 +211,9 @@ namespace Content.Server.Light.EntitySystems var storagedEnts = storage.StoredEntities.ToArray(); foreach (var ent in storagedEnts) { - if (EntityManager.TryGetComponent(ent.Uid, out LightBulbComponent? bulb)) + if (EntityManager.TryGetComponent(ent, out LightBulbComponent? bulb)) { - if (TryInsertBulb(replacerUid, ent.Uid, userUid, false, replacer, bulb)) + if (TryInsertBulb(replacerUid, ent, userUid, false, replacer, bulb)) insertedBulbs++; } } diff --git a/Content.Server/Light/EntitySystems/MatchboxSystem.cs b/Content.Server/Light/EntitySystems/MatchboxSystem.cs index 2c66d86d81..1e43ec6dbe 100644 --- a/Content.Server/Light/EntitySystems/MatchboxSystem.cs +++ b/Content.Server/Light/EntitySystems/MatchboxSystem.cs @@ -17,7 +17,7 @@ namespace Content.Server.Light.EntitySystems private void OnInteractUsing(EntityUid uid, MatchboxComponent component, InteractUsingEvent args) { if (!args.Handled - && IoCManager.Resolve().TryGetComponent(args.Used.Uid, out var matchstick) + && IoCManager.Resolve().TryGetComponent(args.Used, out var matchstick) && matchstick.CurrentState == SmokableState.Unlit) { Get().Ignite(matchstick, args.User); diff --git a/Content.Server/Light/EntitySystems/MatchstickSystem.cs b/Content.Server/Light/EntitySystems/MatchstickSystem.cs index bbbf734ed8..63b0ac6f50 100644 --- a/Content.Server/Light/EntitySystems/MatchstickSystem.cs +++ b/Content.Server/Light/EntitySystems/MatchstickSystem.cs @@ -34,7 +34,7 @@ namespace Content.Server.Light.EntitySystems if (match.CurrentState != SmokableState.Lit) continue; - _atmosphereSystem.HotspotExpose(IoCManager.Resolve().GetComponent(match.Owner.Uid).Coordinates, 400, 50, true); + _atmosphereSystem.HotspotExpose(IoCManager.Resolve().GetComponent(match.Owner).Coordinates, 400, 50, true); } } @@ -44,7 +44,7 @@ namespace Content.Server.Light.EntitySystems return; var isHotEvent = new IsHotEvent(); - RaiseLocalEvent(args.Used.Uid, isHotEvent, false); + RaiseLocalEvent(args.Used, isHotEvent, false); if (!isHotEvent.IsHot) return; @@ -84,7 +84,7 @@ namespace Content.Server.Light.EntitySystems component.PointLightComponent.Enabled = component.CurrentState == SmokableState.Lit; } - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out ItemComponent? item)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out ItemComponent? item)) { switch (component.CurrentState) { @@ -97,7 +97,7 @@ namespace Content.Server.Light.EntitySystems } } - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out AppearanceComponent? appearance)) { appearance.SetData(SmokingVisuals.Smoking, component.CurrentState); } diff --git a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs index 44b09cf989..dff18f2986 100644 --- a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs +++ b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs @@ -75,7 +75,7 @@ namespace Content.Server.Light.EntitySystems _ => throw new ArgumentOutOfRangeException() }; - var entity = EntityManager.SpawnEntity(prototype, IoCManager.Resolve().GetComponent(light.Owner.Uid).Coordinates); + var entity = EntityManager.SpawnEntity(prototype, IoCManager.Resolve().GetComponent(light.Owner).Coordinates); light.LightBulbContainer.Insert(entity); } @@ -88,7 +88,7 @@ namespace Content.Server.Light.EntitySystems if (args.Handled) return; - args.Handled = InsertBulb(uid, args.Used.Uid, component); + args.Handled = InsertBulb(uid, args.Used, component); } private void OnInteractHand(EntityUid uid, PoweredLightComponent light, InteractHandEvent args) @@ -102,7 +102,7 @@ namespace Content.Server.Light.EntitySystems return; // check if it's possible to apply burn damage to user - var userUid = args.User.Uid; + var userUid = (EntityUid) args.User; if (EntityManager.TryGetComponent(userUid, out HeatResistanceComponent? heatResist) && EntityManager.TryGetComponent(bulbUid.Value, out LightBulbComponent? lightBulb)) { @@ -213,7 +213,7 @@ namespace Content.Server.Light.EntitySystems if (!Resolve(uid, ref light)) return null; - return light.LightBulbContainer.ContainedEntity?.Uid; + return light.LightBulbContainer.ContainedEntity; } /// @@ -340,7 +340,7 @@ namespace Content.Server.Light.EntitySystems light.IsBlinking = isNowBlinking; - if (!IoCManager.Resolve().TryGetComponent(light.Owner.Uid, out AppearanceComponent? appearance)) + if (!IoCManager.Resolve().TryGetComponent(light.Owner, out AppearanceComponent? appearance)) return; appearance.SetData(PoweredLightVisuals.Blinking, isNowBlinking); } diff --git a/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs b/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs index f018a40bd4..bdaeb2dd3c 100644 --- a/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs +++ b/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs @@ -37,18 +37,18 @@ namespace Content.Server.Light.EntitySystems public void ToggleLight(UnpoweredFlashlightComponent flashlight) { - if (!IoCManager.Resolve().TryGetComponent(flashlight.Owner.Uid, out PointLightComponent? light)) + if (!IoCManager.Resolve().TryGetComponent(flashlight.Owner, out PointLightComponent? light)) return; flashlight.LightOn = !flashlight.LightOn; light.Enabled = flashlight.LightOn; - if (IoCManager.Resolve().TryGetComponent(flashlight.Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(flashlight.Owner, out AppearanceComponent? appearance)) appearance.SetData(UnpoweredFlashlightVisuals.LightOn, flashlight.LightOn); SoundSystem.Play(Filter.Pvs(light.Owner), flashlight.ToggleSound.GetSound(), flashlight.Owner); - RaiseLocalEvent(flashlight.Owner.Uid, new LightToggleEvent(flashlight.LightOn)); + RaiseLocalEvent(flashlight.Owner, new LightToggleEvent(flashlight.LightOn)); } } diff --git a/Content.Server/Lock/LockSystem.cs b/Content.Server/Lock/LockSystem.cs index 5b3be3d8bd..e995041faf 100644 --- a/Content.Server/Lock/LockSystem.cs +++ b/Content.Server/Lock/LockSystem.cs @@ -35,7 +35,7 @@ namespace Content.Server.Lock private void OnStartup(EntityUid uid, LockComponent lockComp, ComponentStartup args) { - if (IoCManager.Resolve().TryGetComponent(lockComp.Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(lockComp.Owner, out AppearanceComponent? appearance)) { appearance.SetData(StorageVisuals.CanLock, true); } @@ -64,7 +64,7 @@ namespace Content.Server.Lock args.PushText(Loc.GetString(lockComp.Locked ? "lock-comp-on-examined-is-locked" : "lock-comp-on-examined-is-unlocked", - ("entityName", Name: IoCManager.Resolve().GetComponent(lockComp.Owner.Uid).EntityName))); + ("entityName", Name: IoCManager.Resolve().GetComponent(lockComp.Owner).EntityName))); } public bool TryLock(EntityUid uid, IEntity user, LockComponent? lockComp = null) @@ -78,7 +78,7 @@ namespace Content.Server.Lock if (!HasUserAccess(uid, user, quiet: false)) return false; - lockComp.Owner.PopupMessage(user, Loc.GetString("lock-comp-do-lock-success", ("entityName",Name: IoCManager.Resolve().GetComponent(lockComp.Owner.Uid).EntityName))); + lockComp.Owner.PopupMessage(user, Loc.GetString("lock-comp-do-lock-success", ("entityName",Name: IoCManager.Resolve().GetComponent(lockComp.Owner).EntityName))); lockComp.Locked = true; if(lockComp.LockSound != null) @@ -86,12 +86,12 @@ namespace Content.Server.Lock SoundSystem.Play(Filter.Pvs(lockComp.Owner), lockComp.LockSound.GetSound(), lockComp.Owner, AudioParams.Default.WithVolume(-5)); } - if (IoCManager.Resolve().TryGetComponent(lockComp.Owner.Uid, out AppearanceComponent? appearanceComp)) + if (IoCManager.Resolve().TryGetComponent(lockComp.Owner, out AppearanceComponent? appearanceComp)) { appearanceComp.SetData(StorageVisuals.Locked, true); } - RaiseLocalEvent(lockComp.Owner.Uid, new LockToggledEvent(true)); + RaiseLocalEvent(lockComp.Owner, new LockToggledEvent(true)); return true; } @@ -107,7 +107,7 @@ namespace Content.Server.Lock if (!HasUserAccess(uid, user, quiet: false)) return false; - lockComp.Owner.PopupMessage(user, Loc.GetString("lock-comp-do-unlock-success", ("entityName", Name: IoCManager.Resolve().GetComponent(lockComp.Owner.Uid).EntityName))); + lockComp.Owner.PopupMessage(user, Loc.GetString("lock-comp-do-unlock-success", ("entityName", Name: IoCManager.Resolve().GetComponent(lockComp.Owner).EntityName))); lockComp.Locked = false; if(lockComp.UnlockSound != null) @@ -115,12 +115,12 @@ namespace Content.Server.Lock SoundSystem.Play(Filter.Pvs(lockComp.Owner), lockComp.UnlockSound.GetSound(), lockComp.Owner, AudioParams.Default.WithVolume(-5)); } - if (IoCManager.Resolve().TryGetComponent(lockComp.Owner.Uid, out AppearanceComponent? appearanceComp)) + if (IoCManager.Resolve().TryGetComponent(lockComp.Owner, out AppearanceComponent? appearanceComp)) { appearanceComp.SetData(StorageVisuals.Locked, false); } - RaiseLocalEvent(lockComp.Owner.Uid, new LockToggledEvent(false)); + RaiseLocalEvent(lockComp.Owner, new LockToggledEvent(false)); return true; } @@ -150,7 +150,7 @@ namespace Content.Server.Lock if (!Resolve(uid, ref reader)) return true; - if (!_accessReader.IsAllowed(reader, user.Uid)) + if (!_accessReader.IsAllowed(reader, user)) { if (!quiet) reader.Owner.PopupMessage(user, Loc.GetString("lock-comp-has-user-access-fail")); diff --git a/Content.Server/MachineLinking/System/SignalLinkerSystem.cs b/Content.Server/MachineLinking/System/SignalLinkerSystem.cs index 74051e72d0..555cce3138 100644 --- a/Content.Server/MachineLinking/System/SignalLinkerSystem.cs +++ b/Content.Server/MachineLinking/System/SignalLinkerSystem.cs @@ -72,7 +72,7 @@ namespace Content.Server.MachineLinking.System { if (!IsInRange(component, link.ReceiverComponent)) continue; - RaiseLocalEvent(link.ReceiverComponent.Owner.Uid, + RaiseLocalEvent(link.ReceiverComponent.Owner, new SignalReceivedEvent(link.Receiverport.Name, args.Value), false); } } @@ -81,8 +81,8 @@ namespace Content.Server.MachineLinking.System { if (args.Handled) return; - if (!IoCManager.Resolve().TryGetComponent(args.Used.Uid, out var linker) || !linker.Port.HasValue || - !IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor) || + if (!IoCManager.Resolve().TryGetComponent(args.Used, out var linker) || !linker.Port.HasValue || + !IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor) || !linker.Port.Value.transmitter.Outputs.TryGetPort(linker.Port.Value.port, out var port)) { return; @@ -121,9 +121,9 @@ namespace Content.Server.MachineLinking.System { case SignalPortSelected portSelected: if (msg.Session.AttachedEntity == null || - !IoCManager.Resolve().TryGetComponent(msg.Session.AttachedEntity.Uid, out HandsComponent? hands) || + !IoCManager.Resolve().TryGetComponent(msg.Session.AttachedEntity, out HandsComponent? hands) || !hands.TryGetActiveHeldEntity(out var heldEntity) || - !IoCManager.Resolve().TryGetComponent(heldEntity.Uid, out SignalLinkerComponent? signalLinkerComponent) || + !IoCManager.Resolve().TryGetComponent(heldEntity, out SignalLinkerComponent? signalLinkerComponent) || !_interaction.InRangeUnobstructed(msg.Session.AttachedEntity, component.Owner, ignoreInsideBlocker: true) || !signalLinkerComponent.Port.HasValue || !signalLinkerComponent.Port.Value.transmitter.Outputs.ContainsPort(signalLinkerComponent.Port @@ -161,9 +161,9 @@ namespace Content.Server.MachineLinking.System { case SignalPortSelected portSelected: if (msg.Session.AttachedEntity == null || - !IoCManager.Resolve().TryGetComponent(msg.Session.AttachedEntity.Uid, out HandsComponent? hands) || + !IoCManager.Resolve().TryGetComponent(msg.Session.AttachedEntity, out HandsComponent? hands) || !hands.TryGetActiveHeldEntity(out var heldEntity) || - !IoCManager.Resolve().TryGetComponent(heldEntity.Uid, out SignalLinkerComponent? signalLinkerComponent) || + !IoCManager.Resolve().TryGetComponent(heldEntity, out SignalLinkerComponent? signalLinkerComponent) || !_interaction.InRangeUnobstructed(msg.Session.AttachedEntity, component.Owner, ignoreInsideBlocker: true)) return; LinkerSaveInteraction(msg.Session.AttachedEntity, signalLinkerComponent, component, @@ -177,8 +177,8 @@ namespace Content.Server.MachineLinking.System { if (args.Handled) return; - if (!IoCManager.Resolve().TryGetComponent(args.Used.Uid, out var linker) || - !IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.Used, out var linker) || + !IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) { return; } @@ -205,8 +205,8 @@ namespace Content.Server.MachineLinking.System { if (_linkCollection.RemoveLink(transmitter, transmitterPort, receiver, receiverPort)) { - RaiseLocalEvent(receiver.Owner.Uid, new PortDisconnectedEvent(receiverPort)); - RaiseLocalEvent(transmitter.Owner.Uid, new PortDisconnectedEvent(transmitterPort)); + RaiseLocalEvent(receiver.Owner, new PortDisconnectedEvent(receiverPort)); + RaiseLocalEvent(transmitter.Owner, new PortDisconnectedEvent(transmitterPort)); entity.PopupMessageCursor(Loc.GetString("signal-linker-component-unlinked-port", ("port", receiverPort), ("machine", receiver))); } @@ -241,14 +241,14 @@ namespace Content.Server.MachineLinking.System } var linkAttempt = new LinkAttemptEvent(entity, transmitter, transmitterPort, receiver, receiverPort); - RaiseLocalEvent(receiver.Owner.Uid, linkAttempt); - RaiseLocalEvent(transmitter.Owner.Uid, linkAttempt); + RaiseLocalEvent(receiver.Owner, linkAttempt); + RaiseLocalEvent(transmitter.Owner, linkAttempt); if (linkAttempt.Cancelled) return; var link = _linkCollection.AddLink(transmitter, transmitterPort, receiver, receiverPort); if (link.Transmitterport.Signal != null) - RaiseLocalEvent(receiver.Owner.Uid, + RaiseLocalEvent(receiver.Owner, new SignalReceivedEvent(receiverPort, link.Transmitterport.Signal)); entity.PopupMessageCursor(Loc.GetString("signal-linker-component-linked-port", ("port", receiverPort), @@ -277,15 +277,15 @@ namespace Content.Server.MachineLinking.System private bool IsInRange(SignalTransmitterComponent transmitterComponent, SignalReceiverComponent receiverComponent) { - if (IoCManager.Resolve().TryGetComponent(transmitterComponent.Owner.Uid, out var transmitterPowerReceiverComponent) && - IoCManager.Resolve().TryGetComponent(receiverComponent.Owner.Uid, out var receiverPowerReceiverComponent) + if (IoCManager.Resolve().TryGetComponent(transmitterComponent.Owner, out var transmitterPowerReceiverComponent) && + IoCManager.Resolve().TryGetComponent(receiverComponent.Owner, out var receiverPowerReceiverComponent) ) //&& todo are they on the same powernet? { return true; } - return IoCManager.Resolve().GetComponent(transmitterComponent.Owner.Uid).MapPosition.InRange( - IoCManager.Resolve().GetComponent(receiverComponent.Owner.Uid).MapPosition, 30f); + return IoCManager.Resolve().GetComponent(transmitterComponent.Owner).MapPosition.InRange( + IoCManager.Resolve().GetComponent(receiverComponent.Owner).MapPosition, 30f); } } } diff --git a/Content.Server/Medical/Components/HealingComponent.cs b/Content.Server/Medical/Components/HealingComponent.cs index 20b60078ed..e4e132c417 100644 --- a/Content.Server/Medical/Components/HealingComponent.cs +++ b/Content.Server/Medical/Components/HealingComponent.cs @@ -41,7 +41,7 @@ namespace Content.Server.Medical.Components return false; } - if (!IoCManager.Resolve().TryGetComponent(eventArgs.Target.Uid, out DamageableComponent? targetDamage)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.Target, out DamageableComponent? targetDamage)) { return true; } @@ -50,7 +50,7 @@ namespace Content.Server.Medical.Components return true; } - if (!EntitySystem.Get().CanInteract(eventArgs.User.Uid)) + if (!EntitySystem.Get().CanInteract(eventArgs.User)) { return true; } @@ -61,12 +61,12 @@ namespace Content.Server.Medical.Components return true; } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var stack) && !EntitySystem.Get().Use(Owner.Uid, 1, stack)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var stack) && !EntitySystem.Get().Use(Owner, 1, stack)) { return true; } - var healed = EntitySystem.Get().TryChangeDamage(eventArgs.Target.Uid, Damage, true); + var healed = EntitySystem.Get().TryChangeDamage(eventArgs.Target, Damage, true); if (healed == null) return true; diff --git a/Content.Server/Medical/Components/MedicalScannerComponent.cs b/Content.Server/Medical/Components/MedicalScannerComponent.cs index ad654e95d2..745839be88 100644 --- a/Content.Server/Medical/Components/MedicalScannerComponent.cs +++ b/Content.Server/Medical/Components/MedicalScannerComponent.cs @@ -37,7 +37,7 @@ namespace Content.Server.Medical.Components private ContainerSlot _bodyContainer = default!; [ViewVariables] - private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) || receiver.Powered; + private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered; [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(MedicalScannerUiKey.Key); @@ -72,7 +72,7 @@ namespace Content.Server.Medical.Components var body = _bodyContainer.ContainedEntity; if (body == null) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance?.SetData(MedicalScannerVisuals.Status, MedicalScannerStatus.Open); } @@ -80,22 +80,22 @@ namespace Content.Server.Medical.Components return EmptyUIState; } - if (!IoCManager.Resolve().TryGetComponent(body.Uid, out DamageableComponent? damageable)) + if (!IoCManager.Resolve().TryGetComponent(body, out DamageableComponent? damageable)) { return EmptyUIState; } - if (_bodyContainer.ContainedEntity?.Uid == null) + if (_bodyContainer.ContainedEntity == null) { - return new MedicalScannerBoundUserInterfaceState(body.Uid, damageable, true); + return new MedicalScannerBoundUserInterfaceState(body, damageable, true); } var cloningSystem = EntitySystem.Get(); - var scanned = IoCManager.Resolve().TryGetComponent(_bodyContainer.ContainedEntity.Uid, out MindComponent? mindComponent) && + var scanned = IoCManager.Resolve().TryGetComponent(_bodyContainer.ContainedEntity, out MindComponent? mindComponent) && mindComponent.Mind != null && cloningSystem.HasDnaScan(mindComponent.Mind); - return new MedicalScannerBoundUserInterfaceState(body.Uid, damageable, scanned); + return new MedicalScannerBoundUserInterfaceState(body, damageable, scanned); } private void UpdateUserInterface() @@ -137,7 +137,7 @@ namespace Content.Server.Medical.Components if (body == null) return MedicalScannerStatus.Open; - var state = IoCManager.Resolve().GetComponentOrNull(body.Uid); + var state = IoCManager.Resolve().GetComponentOrNull(body); return state == null ? MedicalScannerStatus.Open : GetStatusFromDamageState(state); } @@ -147,7 +147,7 @@ namespace Content.Server.Medical.Components private void UpdateAppearance() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(MedicalScannerVisuals.Status, GetStatus()); } @@ -155,7 +155,7 @@ namespace Content.Server.Medical.Components void IActivate.Activate(ActivateEventArgs args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) { return; } @@ -180,7 +180,7 @@ namespace Content.Server.Medical.Components _bodyContainer.Remove(containedEntity); UpdateUserInterface(); UpdateAppearance(); - EntitySystem.Get().ForciblySetClimbing(containedEntity.Uid); + EntitySystem.Get().ForciblySetClimbing(containedEntity); } public void Update(float frameTime) @@ -200,7 +200,7 @@ namespace Content.Server.Medical.Components { var cloningSystem = EntitySystem.Get(); - if (!IoCManager.Resolve().TryGetComponent(_bodyContainer.ContainedEntity.Uid, out MindComponent? mindComp) || mindComp.Mind == null) + if (!IoCManager.Resolve().TryGetComponent(_bodyContainer.ContainedEntity, out MindComponent? mindComp) || mindComp.Mind == null) { obj.Session.AttachedEntity?.PopupMessageCursor(Loc.GetString("medical-scanner-component-msg-no-soul")); break; diff --git a/Content.Server/Medical/MedicalScannerSystem.cs b/Content.Server/Medical/MedicalScannerSystem.cs index be17118dcc..c7be09be5b 100644 --- a/Content.Server/Medical/MedicalScannerSystem.cs +++ b/Content.Server/Medical/MedicalScannerSystem.cs @@ -38,7 +38,7 @@ namespace Content.Server.Medical Verb verb = new(); verb.Act = () => component.InsertBody(args.Using); verb.Category = VerbCategory.Insert; - verb.Text = IoCManager.Resolve().GetComponent(args.Using.Uid).EntityName; + verb.Text = IoCManager.Resolve().GetComponent(args.Using).EntityName; args.Verbs.Add(verb); } @@ -60,7 +60,7 @@ namespace Content.Server.Medical // Self-insert verb if (!component.IsOccupied && component.CanInsert(args.User) && - _actionBlockerSystem.CanMove(args.User.Uid)) + _actionBlockerSystem.CanMove(args.User)) { Verb verb = new(); verb.Act = () => component.InsertBody(args.User); @@ -75,7 +75,7 @@ namespace Content.Server.Medical private void OnRelayMovement(EntityUid uid, MedicalScannerComponent component, RelayMovementEntityEvent args) { - if (_blocker.CanInteract(args.Entity.Uid)) + if (_blocker.CanInteract(args.Entity)) { if (_gameTiming.CurTime < component.LastInternalOpenAttempt + MedicalScannerComponent.InternalOpenAttemptDelay) diff --git a/Content.Server/Mind/Commands/MindInfoCommand.cs b/Content.Server/Mind/Commands/MindInfoCommand.cs index d069588a66..c83ef4b3b3 100644 --- a/Content.Server/Mind/Commands/MindInfoCommand.cs +++ b/Content.Server/Mind/Commands/MindInfoCommand.cs @@ -41,7 +41,7 @@ namespace Content.Server.Mind.Commands } var builder = new StringBuilder(); - builder.AppendFormat("player: {0}, mob: {1}\nroles: ", mind.UserId, mind.OwnedComponent?.Owner?.Uid); + builder.AppendFormat("player: {0}, mob: {1}\nroles: ", mind.UserId, mind.OwnedComponent?.Owner); foreach (var role in mind.AllRoles) { builder.AppendFormat("{0} ", role.Name); diff --git a/Content.Server/Mind/Components/MindComponent.cs b/Content.Server/Mind/Components/MindComponent.cs index cfe016197b..25d6eefb74 100644 --- a/Content.Server/Mind/Components/MindComponent.cs +++ b/Content.Server/Mind/Components/MindComponent.cs @@ -59,7 +59,7 @@ namespace Content.Server.Mind.Components public void InternalEjectMind() { if (!Deleted) - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, new MindRemovedMessage()); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, new MindRemovedMessage()); Mind = null; } @@ -71,7 +71,7 @@ namespace Content.Server.Mind.Components public void InternalAssignMind(Mind value) { Mind = value; - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, new MindAddedMessage()); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, new MindAddedMessage()); } protected override void Shutdown() @@ -87,16 +87,16 @@ namespace Content.Server.Mind.Components var visiting = Mind?.VisitingEntity; if (visiting != null) { - if (IoCManager.Resolve().TryGetComponent(visiting.Uid, out GhostComponent? ghost)) + if (IoCManager.Resolve().TryGetComponent(visiting, out GhostComponent? ghost)) { EntitySystem.Get().SetCanReturnToBody(ghost, false); } - Mind!.TransferTo(visiting.Uid); + Mind!.TransferTo(visiting); } else if (GhostOnShutdown) { - var spawnPosition = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + var spawnPosition = IoCManager.Resolve().GetComponent(Owner).Coordinates; // Use a regular timer here because the entity has probably been deleted. Timer.Spawn(0, () => { @@ -110,14 +110,14 @@ namespace Content.Server.Mind.Components } var ghost = IoCManager.Resolve().SpawnEntity("MobObserver", spawnPosition); - var ghostComponent = IoCManager.Resolve().GetComponent(ghost.Uid); + var ghostComponent = IoCManager.Resolve().GetComponent(ghost); EntitySystem.Get().SetCanReturnToBody(ghostComponent, false); if (Mind != null) { string? val = Mind.CharacterName ?? string.Empty; - IoCManager.Resolve().GetComponent(ghost.Uid).EntityName = val; - Mind.TransferTo(ghost.Uid); + IoCManager.Resolve().GetComponent(ghost).EntityName = val; + Mind.TransferTo(ghost); } }); } @@ -132,7 +132,7 @@ namespace Content.Server.Mind.Components } var dead = - IoCManager.Resolve().TryGetComponent(Owner.Uid, out var state) && + IoCManager.Resolve().TryGetComponent(Owner, out var state) && state.IsDead(); if (!HasMind) diff --git a/Content.Server/Mind/Mind.cs b/Content.Server/Mind/Mind.cs index 045b444fed..2091065f1d 100644 --- a/Content.Server/Mind/Mind.cs +++ b/Content.Server/Mind/Mind.cs @@ -155,7 +155,7 @@ namespace Content.Server.Mind // This can be null if they're deleted (spike / brain nom) if (OwnedEntity == null) return true; - var targetMobState = IoCManager.Resolve().GetComponentOrNull(OwnedEntity.Uid); + var targetMobState = IoCManager.Resolve().GetComponentOrNull(OwnedEntity); // This can be null if it's a brain (this happens very often) // Brains are the result of gibbing so should definitely count as dead if (targetMobState == null) @@ -185,7 +185,7 @@ namespace Content.Server.Mind var message = new RoleAddedEvent(role); IEntity? tempQualifier = OwnedEntity; - (tempQualifier != null ? IoCManager.Resolve() : null).EventBus.RaiseLocalEvent(OwnedEntity.Uid, message); + (tempQualifier != null ? IoCManager.Resolve() : null).EventBus.RaiseLocalEvent(OwnedEntity, message); return role; } @@ -208,7 +208,7 @@ namespace Content.Server.Mind var message = new RoleRemovedEvent(role); IEntity? tempQualifier = OwnedEntity; - (tempQualifier != null ? IoCManager.Resolve() : null).EventBus.RaiseLocalEvent(OwnedEntity.Uid, message); + (tempQualifier != null ? IoCManager.Resolve() : null).EventBus.RaiseLocalEvent(OwnedEntity, message); } public bool HasRole() where T : Role @@ -296,7 +296,7 @@ namespace Content.Server.Mind if (IsVisitingEntity && (ghostCheckOverride // to force mind transfer, for example from ControlMobVerb - || !IoCManager.Resolve().TryGetComponent(VisitingEntity!.Uid, out GhostComponent? ghostComponent) // visiting entity is not a Ghost + || !IoCManager.Resolve().TryGetComponent(VisitingEntity!, out GhostComponent? ghostComponent) // visiting entity is not a Ghost || !ghostComponent.CanReturnToBody)) // it is a ghost, but cannot return to body anyway, so it's okay { VisitingEntity = null; @@ -377,12 +377,12 @@ namespace Content.Server.Mind DebugTools.AssertNotNull(oldVisitingEnt); - if (IoCManager.Resolve().HasComponent(oldVisitingEnt!.Uid)) + if (IoCManager.Resolve().HasComponent(oldVisitingEnt!)) { - IoCManager.Resolve().RemoveComponent(oldVisitingEnt.Uid); + IoCManager.Resolve().RemoveComponent(oldVisitingEnt); } - IoCManager.Resolve().EventBus.RaiseLocalEvent(oldVisitingEnt.Uid, new MindUnvisitedMessage()); + IoCManager.Resolve().EventBus.RaiseLocalEvent(oldVisitingEnt, new MindUnvisitedMessage()); } public bool TryGetSession([NotNullWhen(true)] out IPlayerSession? session) diff --git a/Content.Server/Mining/Components/AsteroidRockComponent.cs b/Content.Server/Mining/Components/AsteroidRockComponent.cs index f7d3cd0c71..25c80109a5 100644 --- a/Content.Server/Mining/Components/AsteroidRockComponent.cs +++ b/Content.Server/Mining/Components/AsteroidRockComponent.cs @@ -25,7 +25,7 @@ namespace Content.Server.Mining.Components protected override void Initialize() { base.Initialize(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(AsteroidRockVisuals.State, _random.Pick(SpriteStates)); } @@ -34,12 +34,12 @@ namespace Content.Server.Mining.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { var item = eventArgs.Using; - if (!IoCManager.Resolve().TryGetComponent(item.Uid, out MeleeWeaponComponent? meleeWeaponComponent)) + if (!IoCManager.Resolve().TryGetComponent(item, out MeleeWeaponComponent? meleeWeaponComponent)) return false; - EntitySystem.Get().TryChangeDamage(Owner.Uid, meleeWeaponComponent.Damage); + EntitySystem.Get().TryChangeDamage(Owner, meleeWeaponComponent.Damage); - if (!IoCManager.Resolve().TryGetComponent(item.Uid, out PickaxeComponent? pickaxeComponent)) + if (!IoCManager.Resolve().TryGetComponent(item, out PickaxeComponent? pickaxeComponent)) return true; SoundSystem.Play(Filter.Pvs(Owner), pickaxeComponent.MiningSound.GetSound(), Owner, AudioParams.Default); diff --git a/Content.Server/Morgue/Components/BodyBagEntityStorageComponent.cs b/Content.Server/Morgue/Components/BodyBagEntityStorageComponent.cs index b59b46ebe7..5d3eaf4e65 100644 --- a/Content.Server/Morgue/Components/BodyBagEntityStorageComponent.cs +++ b/Content.Server/Morgue/Components/BodyBagEntityStorageComponent.cs @@ -29,7 +29,7 @@ namespace Content.Server.Morgue.Components protected override bool AddToContents(IEntity entity) { - if (IoCManager.Resolve().HasComponent(entity.Uid) && !EntitySystem.Get().IsDown(entity.Uid)) return false; + if (IoCManager.Resolve().HasComponent(entity) && !EntitySystem.Get().IsDown((EntityUid) entity)) return false; return base.AddToContents(entity); } } diff --git a/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs b/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs index 30d0160f46..cc84234915 100644 --- a/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs +++ b/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs @@ -105,7 +105,7 @@ namespace Content.Server.Morgue.Components _cremateCancelToken = new CancellationTokenSource(); Owner.SpawnTimer(_burnMilis, () => { - if ((!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner).EntityLifeStage) >= EntityLifeStage.Deleted) return; Appearance?.SetData(CrematoriumVisuals.Burning, false); @@ -117,10 +117,10 @@ namespace Content.Server.Morgue.Components { var item = Contents.ContainedEntities[i]; Contents.Remove(item); - IoCManager.Resolve().DeleteEntity(item.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) item); } - var ash = IoCManager.Resolve().SpawnEntity("Ash", IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var ash = IoCManager.Resolve().SpawnEntity("Ash", IoCManager.Resolve().GetComponent(Owner).Coordinates); Contents.Insert(ash); } @@ -133,7 +133,7 @@ namespace Content.Server.Morgue.Components SuicideKind ISuicideAct.Suicide(IEntity victim, IChatManager chat) { - if (IoCManager.Resolve().TryGetComponent(victim.Uid, out ActorComponent? actor) && actor.PlayerSession.ContentData()?.Mind is {} mind) + if (IoCManager.Resolve().TryGetComponent(victim, out ActorComponent? actor) && actor.PlayerSession.ContentData()?.Mind is {} mind) { EntitySystem.Get().OnGhostAttempt(mind, false); mind.OwnedEntity?.PopupMessage(Loc.GetString("crematorium-entity-storage-component-suicide-message")); @@ -144,11 +144,11 @@ namespace Content.Server.Morgue.Components if (CanInsert(victim)) { Insert(victim); - EntitySystem.Get().Down(victim.Uid, false); + EntitySystem.Get().Down((EntityUid) victim, false); } else { - IoCManager.Resolve().DeleteEntity(victim.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) victim); } Cremate(); diff --git a/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs b/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs index b41a8173e6..833950ecac 100644 --- a/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs +++ b/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs @@ -65,13 +65,13 @@ namespace Content.Server.Morgue.Components public override Vector2 ContentsDumpPosition() { if (_tray != null) - return IoCManager.Resolve().GetComponent(_tray.Uid).WorldPosition; + return IoCManager.Resolve().GetComponent(_tray).WorldPosition; return base.ContentsDumpPosition(); } protected override bool AddToContents(IEntity entity) { - if (IoCManager.Resolve().HasComponent(entity.Uid) && !EntitySystem.Get().IsDown(entity.Uid)) + if (IoCManager.Resolve().HasComponent(entity) && !EntitySystem.Get().IsDown((EntityUid) entity)) return false; return base.AddToContents(entity); } @@ -79,7 +79,7 @@ namespace Content.Server.Morgue.Components public override bool CanOpen(IEntity user, bool silent = false) { if (!Owner.InRangeUnobstructed( - IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates.Offset(IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation.GetCardinalDir()), + IoCManager.Resolve().GetComponent(Owner).Coordinates.Offset(IoCManager.Resolve().GetComponent(Owner).LocalRotation.GetCardinalDir()), collisionMask: CollisionGroup.Impassable | CollisionGroup.VaultImpassable )) { @@ -100,7 +100,7 @@ namespace Content.Server.Morgue.Components if (_tray == null) { - _tray = IoCManager.Resolve().SpawnEntity(_trayPrototypeId, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + _tray = IoCManager.Resolve().SpawnEntity(_trayPrototypeId, IoCManager.Resolve().GetComponent(Owner).Coordinates); var trayComp = _tray.EnsureComponent(); trayComp.Morgue = Owner; } @@ -109,7 +109,7 @@ namespace Content.Server.Morgue.Components TrayContainer?.Remove(_tray); } - IoCManager.Resolve().GetComponent(_tray.Uid).Coordinates = new EntityCoordinates(Owner.Uid, 0, -1); + IoCManager.Resolve().GetComponent(_tray).Coordinates = new EntityCoordinates(Owner, 0, -1); base.OpenStorage(); } @@ -122,9 +122,9 @@ namespace Content.Server.Morgue.Components foreach (var entity in Contents.ContainedEntities) { count++; - if (!hasMob && IoCManager.Resolve().HasComponent(entity.Uid)) + if (!hasMob && IoCManager.Resolve().HasComponent(entity)) hasMob = true; - if (!hasSoul && IoCManager.Resolve().TryGetComponent(entity.Uid, out var actor) && actor.PlayerSession != null) + if (!hasSoul && IoCManager.Resolve().TryGetComponent(entity, out var actor) && actor.PlayerSession != null) hasSoul = true; } Appearance?.SetData(MorgueVisuals.HasContents, count > 0); diff --git a/Content.Server/Morgue/Components/MorgueTrayComponent.cs b/Content.Server/Morgue/Components/MorgueTrayComponent.cs index c9510df4d2..8ba23bbd97 100644 --- a/Content.Server/Morgue/Components/MorgueTrayComponent.cs +++ b/Content.Server/Morgue/Components/MorgueTrayComponent.cs @@ -16,7 +16,7 @@ namespace Content.Server.Morgue.Components void IActivate.Activate(ActivateEventArgs eventArgs) { - if (Morgue != null && !((!IoCManager.Resolve().EntityExists(Morgue.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Morgue.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) && IoCManager.Resolve().TryGetComponent(Morgue.Uid, out var comp)) + if (Morgue != null && !((!IoCManager.Resolve().EntityExists(Morgue) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Morgue).EntityLifeStage) >= EntityLifeStage.Deleted) && IoCManager.Resolve().TryGetComponent(Morgue, out var comp)) { comp.Activate(new ActivateEventArgs(eventArgs.User, Morgue)); } diff --git a/Content.Server/Movement/Components/FootstepModifierComponent.cs b/Content.Server/Movement/Components/FootstepModifierComponent.cs index d0791571d5..fee5f74909 100644 --- a/Content.Server/Movement/Components/FootstepModifierComponent.cs +++ b/Content.Server/Movement/Components/FootstepModifierComponent.cs @@ -25,7 +25,7 @@ namespace Content.Server.Movement.Components public void PlayFootstep() { - SoundSystem.Play(Filter.Pvs(Owner), SoundCollection.GetSound(), IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, AudioHelpers.WithVariation(Variation).WithVolume(-2f)); + SoundSystem.Play(Filter.Pvs(Owner), SoundCollection.GetSound(), IoCManager.Resolve().GetComponent(Owner).Coordinates, AudioHelpers.WithVariation(Variation).WithVolume(-2f)); } } } diff --git a/Content.Server/Movement/Components/StressTestMovementComponent.cs b/Content.Server/Movement/Components/StressTestMovementComponent.cs index cc7ed70853..13d3a89081 100644 --- a/Content.Server/Movement/Components/StressTestMovementComponent.cs +++ b/Content.Server/Movement/Components/StressTestMovementComponent.cs @@ -16,7 +16,7 @@ namespace Content.Server.Movement.Components { base.Startup(); - Origin = IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition; + Origin = IoCManager.Resolve().GetComponent(Owner).WorldPosition; } } } diff --git a/Content.Server/Movement/StressTestMovementSystem.cs b/Content.Server/Movement/StressTestMovementSystem.cs index 622ded56cc..087aee0d83 100644 --- a/Content.Server/Movement/StressTestMovementSystem.cs +++ b/Content.Server/Movement/StressTestMovementSystem.cs @@ -16,7 +16,7 @@ namespace Content.Server.Movement foreach (var stressTest in EntityManager.EntityQuery(true)) { - var transform = IoCManager.Resolve().GetComponent(stressTest.Owner.Uid); + var transform = IoCManager.Resolve().GetComponent(stressTest.Owner); stressTest.Progress += frameTime; diff --git a/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs b/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs index ce19ef09b7..eece6b6a04 100644 --- a/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs +++ b/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs @@ -364,7 +364,7 @@ namespace Content.Server.NodeContainer.EntitySystems Name = n.Name, NetId = n.NetId, Reachable = n.ReachableNodes.Select(r => r.NetId).ToArray(), - Entity = n.Owner.Uid, + Entity = n.Owner, Type = n.GetType().Name }).ToArray() }; diff --git a/Content.Server/NodeContainer/NodeGroups/BaseNodeGroup.cs b/Content.Server/NodeContainer/NodeGroups/BaseNodeGroup.cs index d19296936e..cc4f14be4c 100644 --- a/Content.Server/NodeContainer/NodeGroups/BaseNodeGroup.cs +++ b/Content.Server/NodeContainer/NodeGroups/BaseNodeGroup.cs @@ -77,7 +77,7 @@ namespace Content.Server.NodeContainer.NodeGroups public virtual void Initialize(Node sourceNode) { // TODO: Can we get rid of this GridId? - GridId = IoCManager.Resolve().GetComponent(sourceNode.Owner.Uid).GridID; + GridId = IoCManager.Resolve().GetComponent(sourceNode.Owner).GridID; } /// diff --git a/Content.Server/NodeContainer/Nodes/AdjacentNode.cs b/Content.Server/NodeContainer/Nodes/AdjacentNode.cs index fd6c6582f9..c3a08ccc13 100644 --- a/Content.Server/NodeContainer/Nodes/AdjacentNode.cs +++ b/Content.Server/NodeContainer/Nodes/AdjacentNode.cs @@ -14,12 +14,12 @@ namespace Content.Server.NodeContainer.Nodes { public override IEnumerable GetReachableNodes() { - if (!IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) + if (!IoCManager.Resolve().GetComponent(Owner).Anchored) yield break; var entMan = IoCManager.Resolve(); - var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); - var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner).GridID); + var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner).Coordinates); foreach (var (_, node) in NodeHelpers.GetCardinalNeighborNodes(entMan, grid, gridIndex)) { diff --git a/Content.Server/NodeContainer/Nodes/Node.cs b/Content.Server/NodeContainer/Nodes/Node.cs index adca0ea852..a3d1f7425e 100644 --- a/Content.Server/NodeContainer/Nodes/Node.cs +++ b/Content.Server/NodeContainer/Nodes/Node.cs @@ -38,7 +38,7 @@ namespace Content.Server.NodeContainer.Nodes /// public bool Connectable => !Deleting && Anchored; - protected bool Anchored => !NeedAnchored || IoCManager.Resolve().GetComponent(Owner.Uid).Anchored; + protected bool Anchored => !NeedAnchored || IoCManager.Resolve().GetComponent(Owner).Anchored; [ViewVariables(VVAccess.ReadWrite)] [DataField("needAnchored")] diff --git a/Content.Server/NodeContainer/Nodes/PipeNode.cs b/Content.Server/NodeContainer/Nodes/PipeNode.cs index bbd5106acd..15b30c247c 100644 --- a/Content.Server/NodeContainer/Nodes/PipeNode.cs +++ b/Content.Server/NodeContainer/Nodes/PipeNode.cs @@ -166,11 +166,11 @@ namespace Content.Server.NodeContainer.Nodes /// protected IEnumerable PipesInDirection(PipeDirection pipeDir) { - if (!IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) + if (!IoCManager.Resolve().GetComponent(Owner).Anchored) yield break; - var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); - var position = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner).GridID); + var position = IoCManager.Resolve().GetComponent(Owner).Coordinates; foreach (var entity in grid.GetInDir(position, pipeDir.ToDirection())) { if (!IoCManager.Resolve().TryGetComponent(entity, out var container)) @@ -189,11 +189,11 @@ namespace Content.Server.NodeContainer.Nodes /// protected IEnumerable PipesInTile() { - if (!IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) + if (!IoCManager.Resolve().GetComponent(Owner).Anchored) yield break; - var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); - var position = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner).GridID); + var position = IoCManager.Resolve().GetComponent(Owner).Coordinates; foreach (var entity in grid.GetLocal(position)) { if (!IoCManager.Resolve().TryGetComponent(entity, out var container)) @@ -215,7 +215,7 @@ namespace Content.Server.NodeContainer.Nodes { if (RotationsEnabled) { - CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation); + CurrentPipeDirection = _originalPipeDirection.RotatePipeDirection(IoCManager.Resolve().GetComponent(Owner).LocalRotation); } else { @@ -275,8 +275,8 @@ namespace Content.Server.NodeContainer.Nodes /// private void UpdateAppearance() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance) - || !IoCManager.Resolve().TryGetComponent(Owner.Uid, out NodeContainerComponent? container)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance) + || !IoCManager.Resolve().TryGetComponent(Owner, out NodeContainerComponent? container)) return; var netConnectedDirections = PipeDirection.None; diff --git a/Content.Server/Nuke/NukeSystem.cs b/Content.Server/Nuke/NukeSystem.cs index 865c644902..40e9417e86 100644 --- a/Content.Server/Nuke/NukeSystem.cs +++ b/Content.Server/Nuke/NukeSystem.cs @@ -116,10 +116,10 @@ namespace Content.Server.Nuke // standard interactions check if (!args.InRangeUnobstructed()) return; - if (!_actionBlocker.CanInteract(args.User.Uid) || !_actionBlocker.CanUse(args.User.Uid)) + if (!_actionBlocker.CanInteract(args.User) || !_actionBlocker.CanUse(args.User)) return; - if (!EntityManager.TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) return; ShowUI(uid, actor.PlayerSession, component); @@ -413,7 +413,7 @@ namespace Content.Server.Nuke var ents = _lookup.GetEntitiesInRange(pos, component.BlastRadius); foreach (var ent in ents) { - var entUid = ent.Uid; + var entUid = (EntityUid) ent; if (!EntityManager.EntityExists(entUid)) continue;; diff --git a/Content.Server/Nutrition/Components/FoodComponent.cs b/Content.Server/Nutrition/Components/FoodComponent.cs index b567e5cdd0..b53a2cb183 100644 --- a/Content.Server/Nutrition/Components/FoodComponent.cs +++ b/Content.Server/Nutrition/Components/FoodComponent.cs @@ -64,7 +64,7 @@ namespace Content.Server.Nutrition.Components { get { - if (!EntitySystem.Get().TryGetSolution(Owner.Uid, SolutionName, out var solution)) + if (!EntitySystem.Get().TryGetSolution(Owner, SolutionName, out var solution)) { return 0; } diff --git a/Content.Server/Nutrition/Components/HungerComponent.cs b/Content.Server/Nutrition/Components/HungerComponent.cs index aa9dca5fef..070fed6c42 100644 --- a/Content.Server/Nutrition/Components/HungerComponent.cs +++ b/Content.Server/Nutrition/Components/HungerComponent.cs @@ -88,13 +88,13 @@ namespace Content.Server.Nutrition.Components { // Revert slow speed if required if (_lastHungerThreshold == HungerThreshold.Starving && _currentHungerThreshold != HungerThreshold.Dead && - IoCManager.Resolve().TryGetComponent(Owner.Uid, out MovementSpeedModifierComponent? movementSlowdownComponent)) + IoCManager.Resolve().TryGetComponent(Owner, out MovementSpeedModifierComponent? movementSlowdownComponent)) { EntitySystem.Get().RefreshMovementSpeedModifiers(OwnerUid); } // Update UI - IoCManager.Resolve().TryGetComponent(Owner.Uid, out ServerAlertsComponent? alertsComponent); + IoCManager.Resolve().TryGetComponent(Owner, out ServerAlertsComponent? alertsComponent); if (HungerThresholdAlertTypes.TryGetValue(_currentHungerThreshold, out var alertId)) { @@ -185,7 +185,7 @@ namespace Content.Server.Nutrition.Components return; // --> Current Hunger is below dead threshold - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out MobStateComponent? mobState)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out MobStateComponent? mobState)) return; if (!mobState.IsDead()) @@ -194,7 +194,7 @@ namespace Content.Server.Nutrition.Components _accumulatedFrameTime += frametime; if (_accumulatedFrameTime >= 1) { - EntitySystem.Get().TryChangeDamage(Owner.Uid, Damage * (int) _accumulatedFrameTime, true); + EntitySystem.Get().TryChangeDamage(Owner, Damage * (int) _accumulatedFrameTime, true); _accumulatedFrameTime -= (int) _accumulatedFrameTime; } } diff --git a/Content.Server/Nutrition/Components/ThirstComponent.cs b/Content.Server/Nutrition/Components/ThirstComponent.cs index 931dbdf25b..f56866e8de 100644 --- a/Content.Server/Nutrition/Components/ThirstComponent.cs +++ b/Content.Server/Nutrition/Components/ThirstComponent.cs @@ -87,13 +87,13 @@ namespace Content.Server.Nutrition.Components { // Revert slow speed if required if (_lastThirstThreshold == ThirstThreshold.Parched && _currentThirstThreshold != ThirstThreshold.Dead && - IoCManager.Resolve().TryGetComponent(Owner.Uid, out MovementSpeedModifierComponent? movementSlowdownComponent)) + IoCManager.Resolve().TryGetComponent(Owner, out MovementSpeedModifierComponent? movementSlowdownComponent)) { EntitySystem.Get().RefreshMovementSpeedModifiers(OwnerUid); } // Update UI - IoCManager.Resolve().TryGetComponent(Owner.Uid, out ServerAlertsComponent? alertsComponent); + IoCManager.Resolve().TryGetComponent(Owner, out ServerAlertsComponent? alertsComponent); if (ThirstThresholdAlertTypes.TryGetValue(_currentThirstThreshold, out var alertId)) { @@ -182,7 +182,7 @@ namespace Content.Server.Nutrition.Components return; // --> Current Hunger is below dead threshold - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out MobStateComponent? mobState)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out MobStateComponent? mobState)) return; if (!mobState.IsDead()) @@ -191,7 +191,7 @@ namespace Content.Server.Nutrition.Components _accumulatedFrameTime += frametime; if (_accumulatedFrameTime >= 1) { - EntitySystem.Get().TryChangeDamage(Owner.Uid, Damage * (int) _accumulatedFrameTime, true); + EntitySystem.Get().TryChangeDamage(Owner, Damage * (int) _accumulatedFrameTime, true); _accumulatedFrameTime -= (int) _accumulatedFrameTime; } } diff --git a/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs b/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs index 4cc0ed7bcc..83ec89e6fa 100644 --- a/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/CreamPieSystem.cs @@ -25,7 +25,7 @@ namespace Content.Server.Nutrition.EntitySystems { SoundSystem.Play(Filter.Pvs(creamPie.Owner), creamPie.Sound.GetSound(), creamPie.Owner, AudioHelpers.WithVariation(0.125f)); - if (IoCManager.Resolve().TryGetComponent(creamPie.Owner.Uid, out var foodComp) && _solutionsSystem.TryGetSolution(creamPie.Owner.Uid, foodComp.SolutionName, out var solution)) + if (IoCManager.Resolve().TryGetComponent(creamPie.Owner, out var foodComp) && _solutionsSystem.TryGetSolution(creamPie.Owner, foodComp.SolutionName, out var solution)) { solution.SpillAt(creamPie.Owner, "PuddleSmear", false); } diff --git a/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs b/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs index 7a668b2f81..af585ce9fa 100644 --- a/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/DrinkSystem.cs @@ -241,7 +241,7 @@ namespace Content.Server.Nutrition.EntitySystems if (!drink.Opened) { _popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-not-open", - ("owner", Name: IoCManager.Resolve().GetComponent(drink.Owner.Uid).EntityName)), uid, Filter.Entities(userUid)); + ("owner", Name: IoCManager.Resolve().GetComponent(drink.Owner).EntityName)), uid, Filter.Entities(userUid)); return true; } @@ -252,7 +252,7 @@ namespace Content.Server.Nutrition.EntitySystems drinkSolution.DrainAvailable <= 0) { _popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-is-empty", - ("entity", Name: IoCManager.Resolve().GetComponent(drink.Owner.Uid).EntityName)), uid, Filter.Entities(userUid)); + ("entity", Name: IoCManager.Resolve().GetComponent(drink.Owner).EntityName)), uid, Filter.Entities(userUid)); return true; } @@ -324,7 +324,7 @@ namespace Content.Server.Nutrition.EntitySystems if (!drink.Opened) { _popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-not-open", - ("owner", Name: IoCManager.Resolve().GetComponent(drink.Owner.Uid).EntityName)), uid, Filter.Entities(userUid)); + ("owner", Name: IoCManager.Resolve().GetComponent(drink.Owner).EntityName)), uid, Filter.Entities(userUid)); return true; } @@ -332,7 +332,7 @@ namespace Content.Server.Nutrition.EntitySystems drinkSolution.DrainAvailable <= 0) { _popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-is-empty", - ("entity", Name: IoCManager.Resolve().GetComponent(drink.Owner.Uid).EntityName)), uid, Filter.Entities(userUid)); + ("entity", Name: IoCManager.Resolve().GetComponent(drink.Owner).EntityName)), uid, Filter.Entities(userUid)); return true; } diff --git a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs index c91eb56d4a..ac15ebb448 100644 --- a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs @@ -196,7 +196,7 @@ namespace Content.Server.Nutrition.EntitySystems private void DeleteAndSpawnTrash(FoodComponent component, EntityUid? userUid = null) { //We're empty. Become trash. - var position = IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates; + var position = IoCManager.Resolve().GetComponent(component.Owner).Coordinates; var finisher = IoCManager.Resolve().SpawnEntity(component.TrashPrototype, position); // If the user is holding the item @@ -207,7 +207,7 @@ namespace Content.Server.Nutrition.EntitySystems EntityManager.DeleteEntity(component.OwnerUid); // Put the trash in the user's hand - if (IoCManager.Resolve().TryGetComponent(finisher.Uid, out ItemComponent? item) && + if (IoCManager.Resolve().TryGetComponent(finisher, out ItemComponent? item) && handsComponent.CanPutInHand(item)) { handsComponent.PutInHand(item); @@ -420,7 +420,7 @@ namespace Content.Server.Nutrition.EntitySystems foreach (var item in hands.GetAllHeldItems()) { // Is utensil? - if (!IoCManager.Resolve().TryGetComponent(item.Owner.Uid, out UtensilComponent? utensil)) + if (!IoCManager.Resolve().TryGetComponent(item.Owner, out UtensilComponent? utensil)) continue; if ((utensil.Types & component.Utensil) != 0 && // Acceptable type? diff --git a/Content.Server/Nutrition/EntitySystems/ForcefeedOnCollideSystem.cs b/Content.Server/Nutrition/EntitySystems/ForcefeedOnCollideSystem.cs index 9c07118667..c2ffa178e5 100644 --- a/Content.Server/Nutrition/EntitySystems/ForcefeedOnCollideSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/ForcefeedOnCollideSystem.cs @@ -19,7 +19,7 @@ namespace Content.Server.Nutrition.EntitySystems private void OnThrowDoHit(EntityUid uid, ForcefeedOnCollideComponent component, ThrowDoHitEvent args) { - _foodSystem.ProjectileForceFeed(uid, args.Target.Uid, args.User?.Uid); + _foodSystem.ProjectileForceFeed(uid, args.Target, args.User); } private void OnLand(EntityUid uid, ForcefeedOnCollideComponent component, LandEvent args) diff --git a/Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs b/Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs index 396101dbdf..9eca47cf86 100644 --- a/Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs @@ -57,7 +57,8 @@ namespace Content.Server.Nutrition.EntitySystems return false; } - var sliceUid = EntityManager.SpawnEntity(component.Slice, transform.Coordinates).Uid; + IEntity tempQualifier = EntityManager.SpawnEntity(component.Slice, transform.Coordinates); + var sliceUid = (EntityUid) tempQualifier; var lostSolution = _solutionContainerSystem.SplitSolution(uid, solution, solution.CurrentVolume / FixedPoint2.New(component.Count)); @@ -86,7 +87,8 @@ namespace Content.Server.Nutrition.EntitySystems // Split last slice if (component.Count == 1) { - var lastSlice = EntityManager.SpawnEntity(component.Slice, transform.Coordinates).Uid; + IEntity tempQualifier1 = EntityManager.SpawnEntity(component.Slice, transform.Coordinates); + var lastSlice = (EntityUid) tempQualifier1; // Fill last slice with the rest of the solution FillSlice(lastSlice, solution); diff --git a/Content.Server/Nutrition/EntitySystems/SmokingSystem.Cigar.cs b/Content.Server/Nutrition/EntitySystems/SmokingSystem.Cigar.cs index 8a0307159a..0fc638fd2e 100644 --- a/Content.Server/Nutrition/EntitySystems/SmokingSystem.Cigar.cs +++ b/Content.Server/Nutrition/EntitySystems/SmokingSystem.Cigar.cs @@ -42,7 +42,7 @@ namespace Content.Server.Nutrition.EntitySystems return; var isHotEvent = new IsHotEvent(); - RaiseLocalEvent(args.Used.Uid, isHotEvent, false); + RaiseLocalEvent(args.Used, isHotEvent, false); if (!isHotEvent.IsHot) return; diff --git a/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs b/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs index 3672769723..2b5435b83d 100644 --- a/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs @@ -96,7 +96,7 @@ namespace Content.Server.Nutrition.EntitySystems // This is awful. I hate this so much. // TODO: Please, someone refactor containers and free me from this bullshit. if (!smokable.Owner.TryGetContainerMan(out var containerManager) || - !IoCManager.Resolve().TryGetComponent(containerManager.Owner.Uid, out BloodstreamComponent? bloodstream)) + !IoCManager.Resolve().TryGetComponent(containerManager.Owner, out BloodstreamComponent? bloodstream)) continue; _reactiveSystem.ReactionEntity(containerManager.OwnerUid, ReactionMethod.Ingestion, inhaledSolution); diff --git a/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs b/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs index 6bb33d17a3..f30d228fba 100644 --- a/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs @@ -35,7 +35,7 @@ namespace Content.Server.Nutrition.EntitySystems if (ev.Target == null) return; - if (TryUseUtensil(ev.UserUid, ev.Target.Uid, component)) + if (TryUseUtensil(ev.UserUid, ev.Target, component)) ev.Handled = true; } @@ -61,7 +61,7 @@ namespace Content.Server.Nutrition.EntitySystems /// Attempt to break the utensil after interaction. /// /// Utensil. - /// User of the utensil. + /// User of the utensil. public void TryBreak(EntityUid uid, EntityUid userUid, UtensilComponent? component = null) { if (!Resolve(uid, ref component)) @@ -70,7 +70,7 @@ namespace Content.Server.Nutrition.EntitySystems if (_robustRandom.Prob(component.BreakChance)) { SoundSystem.Play(Filter.Pvs(userUid), component.BreakSound.GetSound(), userUid, AudioParams.Default.WithVolume(-2f)); - IoCManager.Resolve().DeleteEntity(component.Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) component.Owner); } } } diff --git a/Content.Server/Nutrition/Hungry.cs b/Content.Server/Nutrition/Hungry.cs index 9199f1bfe8..80ec6d604c 100644 --- a/Content.Server/Nutrition/Hungry.cs +++ b/Content.Server/Nutrition/Hungry.cs @@ -31,7 +31,7 @@ namespace Content.Server.Nutrition return; } - if (!IoCManager.Resolve().TryGetComponent(player.AttachedEntity.Uid, out HungerComponent? hunger)) + if (!IoCManager.Resolve().TryGetComponent(player.AttachedEntity, out HungerComponent? hunger)) { shell.WriteLine($"Your entity does not have a {nameof(HungerComponent)} component."); return; diff --git a/Content.Server/Objectives/Conditions/KillPersonCondition.cs b/Content.Server/Objectives/Conditions/KillPersonCondition.cs index 8047742ca8..83e8bc8563 100644 --- a/Content.Server/Objectives/Conditions/KillPersonCondition.cs +++ b/Content.Server/Objectives/Conditions/KillPersonCondition.cs @@ -23,7 +23,7 @@ namespace Content.Server.Objectives.Conditions if(Target.CharacterName != null) targetName = Target.CharacterName; else if (Target.OwnedEntity != null) - targetName = IoCManager.Resolve().GetComponent(Target.OwnedEntity.Uid).EntityName; + targetName = IoCManager.Resolve().GetComponent(Target.OwnedEntity).EntityName; return Loc.GetString("objective-condition-kill-person-title", ("targetName", targetName)); } diff --git a/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs b/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs index 82b14312a0..0ca98426e9 100644 --- a/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs +++ b/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs @@ -24,7 +24,7 @@ namespace Content.Server.Objectives.Conditions if (entity == null) return false; - return (IoCManager.Resolve().GetComponentOrNull(entity.Uid)?.IsAlive() ?? false) && mc.Mind != mind; + return (IoCManager.Resolve().GetComponentOrNull(entity)?.IsAlive() ?? false) && mc.Mind != mind; }).Select(mc => mc.Mind).ToList(); return new KillRandomPersonCondition {Target = IoCManager.Resolve().Pick(allHumans)}; } diff --git a/Content.Server/Objectives/Conditions/StealCondition.cs b/Content.Server/Objectives/Conditions/StealCondition.cs index 6d7524d1c7..d16df78333 100644 --- a/Content.Server/Objectives/Conditions/StealCondition.cs +++ b/Content.Server/Objectives/Conditions/StealCondition.cs @@ -58,7 +58,7 @@ namespace Content.Server.Objectives.Conditions get { if (_mind?.OwnedEntity == null) return 0f; - if (!IoCManager.Resolve().TryGetComponent(_mind.OwnedEntity.Uid, out var containerManagerComponent)) return 0f; + if (!IoCManager.Resolve().TryGetComponent(_mind.OwnedEntity, out var containerManagerComponent)) return 0f; float count = containerManagerComponent.CountPrototypeOccurencesRecursive(_prototypeId); return count/_amount; diff --git a/Content.Server/PAI/PAISystem.cs b/Content.Server/PAI/PAISystem.cs index eaead6ee84..1f469db7df 100644 --- a/Content.Server/PAI/PAISystem.cs +++ b/Content.Server/PAI/PAISystem.cs @@ -63,25 +63,25 @@ namespace Content.Server.PAI // Check for pAI activation if (EntityManager.TryGetComponent(uid, out var mind) && mind.HasMind) { - _popupSystem.PopupEntity(Loc.GetString("pai-system-pai-installed"), uid, Filter.Entities(args.User.Uid)); + _popupSystem.PopupEntity(Loc.GetString("pai-system-pai-installed"), uid, Filter.Entities(args.User)); return; } else if (EntityManager.HasComponent(uid)) { - _popupSystem.PopupEntity(Loc.GetString("pai-system-still-searching"), uid, Filter.Entities(args.User.Uid)); + _popupSystem.PopupEntity(Loc.GetString("pai-system-still-searching"), uid, Filter.Entities(args.User)); return; } // Ownership tag string val = Loc.GetString("pai-system-pai-name", ("owner", args.User)); - IoCManager.Resolve().GetComponent(component.Owner.Uid).EntityName = val; + IoCManager.Resolve().GetComponent(component.Owner).EntityName = val; var ghostFinder = EntityManager.EnsureComponent(uid); ghostFinder.RoleName = Loc.GetString("pai-system-role-name"); ghostFinder.RoleDescription = Loc.GetString("pai-system-role-description"); - _popupSystem.PopupEntity(Loc.GetString("pai-system-searching"), uid, Filter.Entities(args.User.Uid)); + _popupSystem.PopupEntity(Loc.GetString("pai-system-searching"), uid, Filter.Entities(args.User)); UpdatePAIAppearance(uid, PAIStatus.Searching); } @@ -145,7 +145,7 @@ namespace Content.Server.PAI if (EntityManager.HasComponent(uid)) { EntityManager.RemoveComponent(uid); - _popupSystem.PopupEntity(Loc.GetString("pai-system-wiped-device"), uid, Filter.Entities(args.User.Uid)); + _popupSystem.PopupEntity(Loc.GetString("pai-system-wiped-device"), uid, Filter.Entities(args.User)); PAITurningOff(uid); } }; @@ -161,7 +161,7 @@ namespace Content.Server.PAI if (EntityManager.HasComponent(uid)) { EntityManager.RemoveComponent(uid); - _popupSystem.PopupEntity(Loc.GetString("pai-system-stopped-searching"), uid, Filter.Entities(args.User.Uid)); + _popupSystem.PopupEntity(Loc.GetString("pai-system-stopped-searching"), uid, Filter.Entities(args.User)); PAITurningOff(uid); } }; diff --git a/Content.Server/PDA/PDAExtensions.cs b/Content.Server/PDA/PDAExtensions.cs index 29903eb451..3342f7974c 100644 --- a/Content.Server/PDA/PDAExtensions.cs +++ b/Content.Server/PDA/PDAExtensions.cs @@ -19,18 +19,18 @@ namespace Content.Server.PDA { IdCardComponent? firstIdInPda = null; - if (IoCManager.Resolve().TryGetComponent(player.Uid, out HandsComponent? hands)) + if (IoCManager.Resolve().TryGetComponent(player, out HandsComponent? hands)) { foreach (var item in hands.GetAllHeldItems()) { if (firstIdInPda == null && - IoCManager.Resolve().TryGetComponent(item.Owner.Uid, out PDAComponent? pda) && + IoCManager.Resolve().TryGetComponent(item.Owner, out PDAComponent? pda) && pda.ContainedID != null) { firstIdInPda = pda.ContainedID; } - if (IoCManager.Resolve().TryGetComponent(item.Owner.Uid, out IdCardComponent? card)) + if (IoCManager.Resolve().TryGetComponent(item.Owner, out IdCardComponent? card)) { return card; } @@ -44,18 +44,18 @@ namespace Content.Server.PDA IdCardComponent? firstIdInInventory = null; - if (IoCManager.Resolve().TryGetComponent(player.Uid, out InventoryComponent? inventory)) + if (IoCManager.Resolve().TryGetComponent(player, out InventoryComponent? inventory)) { foreach (var item in inventory.GetAllHeldItems()) { if (firstIdInInventory == null && - IoCManager.Resolve().TryGetComponent(item.Uid, out PDAComponent? pda) && + IoCManager.Resolve().TryGetComponent(item, out PDAComponent? pda) && pda.ContainedID != null) { firstIdInInventory = pda.ContainedID; } - if (IoCManager.Resolve().TryGetComponent(item.Uid, out IdCardComponent? card)) + if (IoCManager.Resolve().TryGetComponent(item, out IdCardComponent? card)) { return card; } diff --git a/Content.Server/PDA/PDASystem.cs b/Content.Server/PDA/PDASystem.cs index db82a58cc9..63e6fb95d2 100644 --- a/Content.Server/PDA/PDASystem.cs +++ b/Content.Server/PDA/PDASystem.cs @@ -73,7 +73,7 @@ namespace Content.Server.PDA private void OnItemInserted(EntityUid uid, PDAComponent pda, EntInsertedIntoContainerMessage args) { if (args.Container.ID == pda.IdSlot.ID) - pda.ContainedID = IoCManager.Resolve().GetComponentOrNull(args.Entity.Uid); + pda.ContainedID = IoCManager.Resolve().GetComponentOrNull(args.Entity); UpdatePDAAppearance(pda); UpdatePDAUserInterface(pda); @@ -112,7 +112,7 @@ namespace Content.Server.PDA private bool OpenUI(PDAComponent pda, IEntity user) { - if (!IoCManager.Resolve().TryGetComponent(user.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(user, out ActorComponent? actor)) return false; var ui = pda.Owner.GetUIOrNull(PDAUiKey.Key); @@ -123,7 +123,7 @@ namespace Content.Server.PDA private void UpdatePDAAppearance(PDAComponent pda) { - if (IoCManager.Resolve().TryGetComponent(pda.Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(pda.Owner, out AppearanceComponent? appearance)) appearance.SetData(PDAVisuals.IDCardInserted, pda.ContainedID != null); } @@ -136,7 +136,7 @@ namespace Content.Server.PDA JobTitle = pda.ContainedID?.JobTitle }; - var hasUplink = IoCManager.Resolve().HasComponent(pda.Owner.Uid); + var hasUplink = IoCManager.Resolve().HasComponent(pda.Owner); var ui = pda.Owner.GetUIOrNull(PDAUiKey.Key); ui?.SetState(new PDAUpdateState(pda.FlashlightOn, pda.PenSlot.HasItem, ownerInfo, hasUplink)); @@ -155,24 +155,24 @@ namespace Content.Server.PDA break; case PDAToggleFlashlightMessage _: { - if (IoCManager.Resolve().TryGetComponent(pda.Owner.Uid, out UnpoweredFlashlightComponent? flashlight)) + if (IoCManager.Resolve().TryGetComponent(pda.Owner, out UnpoweredFlashlightComponent? flashlight)) _unpoweredFlashlight.ToggleLight(flashlight); break; } case PDAEjectIDMessage _: { - _itemSlotsSystem.TryEjectToHands(pda.Owner.Uid, pda.IdSlot, playerUid); + _itemSlotsSystem.TryEjectToHands(pda.Owner, pda.IdSlot, playerUid); break; } case PDAEjectPenMessage _: { - _itemSlotsSystem.TryEjectToHands(pda.Owner.Uid, pda.PenSlot, playerUid); + _itemSlotsSystem.TryEjectToHands(pda.Owner, pda.PenSlot, playerUid); break; } case PDAShowUplinkMessage _: { - if (IoCManager.Resolve().TryGetComponent(pda.Owner.Uid, out UplinkComponent? uplink)) + if (IoCManager.Resolve().TryGetComponent(pda.Owner, out UplinkComponent? uplink)) _uplinkSystem.ToggleUplinkUI(uplink, msg.Session); break; } diff --git a/Content.Server/Paper/PaperComponent.cs b/Content.Server/Paper/PaperComponent.cs index 77257efa16..4fcdb6938b 100644 --- a/Content.Server/Paper/PaperComponent.cs +++ b/Content.Server/Paper/PaperComponent.cs @@ -43,7 +43,7 @@ namespace Content.Server.Paper Content = content + '\n'; UpdateUserInterface(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) return; var status = string.IsNullOrWhiteSpace(content) @@ -74,7 +74,7 @@ namespace Content.Server.Paper bool IUse.UseEntity(UseEntityEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) return false; _mode = PaperAction.Read; @@ -91,12 +91,12 @@ namespace Content.Server.Paper Content += msg.Text + '\n'; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(PaperVisuals.Status, PaperStatus.Written); } - IoCManager.Resolve().GetComponent(Owner.Uid).EntityDescription = ""; + IoCManager.Resolve().GetComponent(Owner).EntityDescription = ""; UpdateUserInterface(); } @@ -104,7 +104,7 @@ namespace Content.Server.Paper { if (!eventArgs.Using.HasTag("Write")) return false; - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) return false; _mode = PaperAction.Write; diff --git a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs index e75f0c7a00..2935fce44c 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs @@ -222,12 +222,12 @@ namespace Content.Server.ParticleAccelerator.Components void IActivate.Activate(ActivateEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) { return; } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var wires) && wires.IsPanelOpen) + if (IoCManager.Resolve().TryGetComponent(Owner, out var wires) && wires.IsPanelOpen) { wires.OpenInterface(actor.PlayerSession); } @@ -334,7 +334,7 @@ namespace Content.Server.ParticleAccelerator.Components private void UpdateWireStatus() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out WiresComponent? wires)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out WiresComponent? wires)) { return; } @@ -384,10 +384,10 @@ namespace Content.Server.ParticleAccelerator.Components _partEmitterRight = null; // Find fuel chamber first by scanning cardinals. - if (IoCManager.Resolve().GetComponent(Owner.Uid).Anchored) + if (IoCManager.Resolve().GetComponent(Owner).Anchored) { - var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); - var coords = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner).GridID); + var coords = IoCManager.Resolve().GetComponent(Owner).Coordinates; foreach (var maybeFuel in grid.GetCardinalNeighborCells(coords)) { if (IoCManager.Resolve().TryGetComponent(maybeFuel, out _partFuelChamber)) @@ -406,7 +406,7 @@ namespace Content.Server.ParticleAccelerator.Components // Align ourselves to match fuel chamber orientation. // This means that if you mess up the orientation of the control box it's not a big deal, // because the sprite is far from obvious about the orientation. - IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation = IoCManager.Resolve().GetComponent(_partFuelChamber.Owner.Uid).LocalRotation; + IoCManager.Resolve().GetComponent(Owner).LocalRotation = IoCManager.Resolve().GetComponent(_partFuelChamber.Owner).LocalRotation; var offsetEndCap = RotateOffset((1, 1)); var offsetPowerBox = RotateOffset((1, -1)); @@ -452,7 +452,7 @@ namespace Content.Server.ParticleAccelerator.Components Vector2i RotateOffset(in Vector2i vec) { - var rot = new Angle(IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation); + var rot = new Angle(IoCManager.Resolve().GetComponent(Owner).LocalRotation); return (Vector2i) rot.RotateVec(vec); } } @@ -460,8 +460,8 @@ namespace Content.Server.ParticleAccelerator.Components private bool ScanPart(Vector2i offset, [NotNullWhen(true)] out T? part) where T : ParticleAcceleratorPartComponent { - var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); - var coords = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + var grid = _mapManager.GetGrid(IoCManager.Resolve().GetComponent(Owner).GridID); + var coords = IoCManager.Resolve().GetComponent(Owner).Coordinates; foreach (var ent in grid.GetOffset(coords, offset)) { if (IoCManager.Resolve().TryGetComponent(ent, out part) && !part.Deleted) @@ -577,7 +577,7 @@ namespace Content.Server.ParticleAccelerator.Components private void UpdateAppearance() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(ParticleAcceleratorVisuals.VisualState, _apcPowerReceiverComponent!.Powered @@ -683,7 +683,7 @@ namespace Content.Server.ParticleAccelerator.Components private void UpdatePartVisualState(ParticleAcceleratorPartComponent? component) { - if (component == null || !IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out var appearanceComponent)) + if (component == null || !IoCManager.Resolve().TryGetComponent(component.Owner, out var appearanceComponent)) { return; } diff --git a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorEmitterComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorEmitterComponent.cs index 9b7389e9a4..c5e420f696 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorEmitterComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorEmitterComponent.cs @@ -16,14 +16,14 @@ namespace Content.Server.ParticleAccelerator.Components public void Fire(ParticleAcceleratorPowerState strength) { - var projectile = IoCManager.Resolve().SpawnEntity("ParticlesProjectile", IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var projectile = IoCManager.Resolve().SpawnEntity("ParticlesProjectile", IoCManager.Resolve().GetComponent(Owner).Coordinates); - if (!IoCManager.Resolve().TryGetComponent(projectile.Uid, out var particleProjectileComponent)) + if (!IoCManager.Resolve().TryGetComponent(projectile, out var particleProjectileComponent)) { Logger.Error("ParticleAcceleratorEmitter tried firing particles, but they was spawned without a ParticleProjectileComponent"); return; } - particleProjectileComponent.Fire(strength, IoCManager.Resolve().GetComponent(Owner.Uid).WorldRotation, Owner); + particleProjectileComponent.Fire(strength, IoCManager.Resolve().GetComponent(Owner).WorldRotation, Owner); } public override string ToString() diff --git a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs index 6e76d25fd4..0d52dc89d7 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs @@ -13,7 +13,7 @@ namespace Content.Server.ParticleAccelerator.Components base.Initialize(); // FIXME: this has to be an entity system, full stop. - IoCManager.Resolve().GetComponent(Owner.Uid).Anchored = true; + IoCManager.Resolve().GetComponent(Owner).Anchored = true; } public void OnAnchorChanged() diff --git a/Content.Server/ParticleAccelerator/Components/ParticleProjectileComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleProjectileComponent.cs index f8432d11ca..76fe1ea32b 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleProjectileComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleProjectileComponent.cs @@ -22,21 +22,21 @@ namespace Content.Server.ParticleAccelerator.Components { State = state; - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out var physicsComponent)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out var physicsComponent)) { Logger.Error("ParticleProjectile tried firing, but it was spawned without a CollidableComponent"); return; } physicsComponent.BodyStatus = BodyStatus.InAir; - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out var projectileComponent)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out var projectileComponent)) { Logger.Error("ParticleProjectile tried firing, but it was spawned without a ProjectileComponent"); return; } projectileComponent.IgnoreEntity(firer); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out var singuloFoodComponent)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out var singuloFoodComponent)) { Logger.Error("ParticleProjectile tried firing, but it was spawned without a SinguloFoodComponent"); return; @@ -61,7 +61,7 @@ namespace Content.Server.ParticleAccelerator.Components _ => "0" }; - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out var spriteComponent)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out var spriteComponent)) { Logger.Error("ParticleProjectile tried firing, but it was spawned without a SpriteComponent"); return; @@ -71,8 +71,8 @@ namespace Content.Server.ParticleAccelerator.Components physicsComponent .LinearVelocity = angle.ToWorldVec() * 20f; - IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation = angle; - Timer.Spawn(3000, () => IoCManager.Resolve().DeleteEntity(Owner.Uid)); + IoCManager.Resolve().GetComponent(Owner).LocalRotation = angle; + Timer.Spawn(3000, () => IoCManager.Resolve().DeleteEntity((EntityUid) Owner)); } } } diff --git a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorPartSystem.cs b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorPartSystem.cs index 7eef004449..a1743c0403 100644 --- a/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorPartSystem.cs +++ b/Content.Server/ParticleAccelerator/EntitySystems/ParticleAcceleratorPartSystem.cs @@ -26,7 +26,7 @@ namespace Content.Server.ParticleAccelerator.EntitySystems private static void RotateEvent(ref RotateEvent ev) { - if (IoCManager.Resolve().TryGetComponent(ev.Sender.Uid, out ParticleAcceleratorPartComponent? part)) + if (IoCManager.Resolve().TryGetComponent(ev.Sender, out ParticleAcceleratorPartComponent? part)) { part.Rotated(); } diff --git a/Content.Server/Physics/Controllers/ConveyorController.cs b/Content.Server/Physics/Controllers/ConveyorController.cs index f1806fbef2..55bafecf2f 100644 --- a/Content.Server/Physics/Controllers/ConveyorController.cs +++ b/Content.Server/Physics/Controllers/ConveyorController.cs @@ -41,11 +41,11 @@ namespace Content.Server.Physics.Controllers } var direction = system.GetAngle(comp).ToVec(); - var ownerPos = IoCManager.Resolve().GetComponent(comp.Owner.Uid).WorldPosition; + var ownerPos = IoCManager.Resolve().GetComponent(comp.Owner).WorldPosition; foreach (var (entity, physics) in EntitySystem.Get().GetEntitiesToMove(comp)) { - var itemRelativeToConveyor = IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition - ownerPos; + var itemRelativeToConveyor = IoCManager.Resolve().GetComponent(entity).WorldPosition - ownerPos; physics.LinearVelocity += Convey(direction, comp.Speed, frameTime, itemRelativeToConveyor); } } diff --git a/Content.Server/Physics/Controllers/MoverController.cs b/Content.Server/Physics/Controllers/MoverController.cs index 48cc2cec10..c3d94d39c2 100644 --- a/Content.Server/Physics/Controllers/MoverController.cs +++ b/Content.Server/Physics/Controllers/MoverController.cs @@ -53,7 +53,7 @@ namespace Content.Server.Physics.Controllers foreach (var (mobMover, mover, physics) in EntityManager.EntityQuery()) { - _excludedMobs.Add(mover.Owner.Uid); + _excludedMobs.Add(mover.Owner); HandleMobMovement(mover, physics, mobMover); } @@ -61,7 +61,7 @@ namespace Content.Server.Physics.Controllers foreach (var (mover, physics) in EntityManager.EntityQuery(true)) { - if (_excludedMobs.Contains(mover.Owner.Uid)) continue; + if (_excludedMobs.Contains(mover.Owner)) continue; HandleKinematicMovement(mover, physics); } @@ -75,7 +75,7 @@ namespace Content.Server.Physics.Controllers foreach (var (pilot, mover, xform) in EntityManager.EntityQuery()) { if (pilot.Console == null) continue; - _excludedMobs.Add(mover.Owner.Uid); + _excludedMobs.Add(mover.Owner); var gridId = xform.GridID; @@ -271,7 +271,7 @@ namespace Content.Server.Physics.Controllers { if (!mover.Owner.HasTag("FootstepSound")) return; - var transform = IoCManager.Resolve().GetComponent(mover.Owner.Uid); + var transform = IoCManager.Resolve().GetComponent(mover.Owner); var coordinates = transform.Coordinates; var gridId = coordinates.GetGridId(EntityManager); var distanceNeeded = mover.Sprinting ? StepSoundMoveDistanceRunning : StepSoundMoveDistanceWalking; @@ -303,9 +303,9 @@ namespace Content.Server.Physics.Controllers mobMover.StepSoundDistance -= distanceNeeded; - if (IoCManager.Resolve().TryGetComponent(mover.Owner.Uid, out var inventory) + if (IoCManager.Resolve().TryGetComponent(mover.Owner, out var inventory) && inventory.TryGetSlotItem(EquipmentSlotDefines.Slots.SHOES, out var item) - && IoCManager.Resolve().TryGetComponent(item.Owner.Uid, out var modifier)) + && IoCManager.Resolve().TryGetComponent(item.Owner, out var modifier)) { modifier.PlayFootstep(); } @@ -352,7 +352,7 @@ namespace Content.Server.Physics.Controllers SoundSystem.Play( Filter.Pvs(coordinates), soundToPlay, - IoCManager.Resolve().GetComponent(mover.Uid).Coordinates, + IoCManager.Resolve().GetComponent(mover).Coordinates, sprinting ? AudioParams.Default.WithVolume(0.75f) : null); } } diff --git a/Content.Server/Physics/Controllers/PullController.cs b/Content.Server/Physics/Controllers/PullController.cs index 16d0c835f5..c381f491c4 100644 --- a/Content.Server/Physics/Controllers/PullController.cs +++ b/Content.Server/Physics/Controllers/PullController.cs @@ -74,7 +74,7 @@ namespace Content.Server.Physics.Controllers // Now that's over with... - var pullerPosition = IoCManager.Resolve().GetComponent(puller.Uid).MapPosition; + var pullerPosition = IoCManager.Resolve().GetComponent(puller).MapPosition; var movingTo = pullable.MovingTo.Value.ToMap(IoCManager.Resolve()); if (movingTo.MapId != pullerPosition.MapId) { @@ -82,16 +82,16 @@ namespace Content.Server.Physics.Controllers continue; } - if (!IoCManager.Resolve().TryGetComponent(pullable.Owner.Uid, out var physics) || + if (!IoCManager.Resolve().TryGetComponent(pullable.Owner, out var physics) || physics.BodyType == BodyType.Static || - movingTo.MapId != IoCManager.Resolve().GetComponent(pullable.Owner.Uid).MapID) + movingTo.MapId != IoCManager.Resolve().GetComponent(pullable.Owner).MapID) { _pullableSystem.StopMoveTo(pullable); continue; } var movingPosition = movingTo.Position; - var ownerPosition = IoCManager.Resolve().GetComponent(pullable.Owner.Uid).MapPosition.Position; + var ownerPosition = IoCManager.Resolve().GetComponent(pullable.Owner).MapPosition.Position; var diff = movingPosition - ownerPosition; var diffLength = diff.Length; @@ -119,7 +119,7 @@ namespace Content.Server.Physics.Controllers var impulse = accel * physics.Mass * frameTime; physics.ApplyLinearImpulse(impulse); - if (IoCManager.Resolve().TryGetComponent(puller.Uid, out var pullerPhysics)) + if (IoCManager.Resolve().TryGetComponent(puller, out var pullerPhysics)) { pullerPhysics.WakeBody(); pullerPhysics.ApplyLinearImpulse(-impulse); diff --git a/Content.Server/Physics/Controllers/SingularityController.cs b/Content.Server/Physics/Controllers/SingularityController.cs index 371536871f..551a52d76c 100644 --- a/Content.Server/Physics/Controllers/SingularityController.cs +++ b/Content.Server/Physics/Controllers/SingularityController.cs @@ -21,7 +21,7 @@ namespace Content.Server.Physics.Controllers foreach (var (singularity, physics) in EntityManager.EntityQuery()) { - if (IoCManager.Resolve().HasComponent(singularity.Owner.Uid) || + if (IoCManager.Resolve().HasComponent(singularity.Owner) || singularity.BeingDeletedByAnotherSingularity) continue; singularity.MoveAccumulator -= frameTime; diff --git a/Content.Server/Pinpointer/ServerPinpointerSystem.cs b/Content.Server/Pinpointer/ServerPinpointerSystem.cs index 726df79b10..82f57cb000 100644 --- a/Content.Server/Pinpointer/ServerPinpointerSystem.cs +++ b/Content.Server/Pinpointer/ServerPinpointerSystem.cs @@ -60,10 +60,10 @@ namespace Content.Server.Pinpointer var l = new SortedList(); foreach (var e in ents) { - if (whitelist.IsValid(e.Uid)) + if (whitelist.IsValid(e)) { - var dist = (IoCManager.Resolve().GetComponent(e.Uid).WorldPosition - transform.WorldPosition).LengthSquared; - l.TryAdd(dist, e.Uid); + var dist = (IoCManager.Resolve().GetComponent(e).WorldPosition - transform.WorldPosition).LengthSquared; + l.TryAdd(dist, e); } } diff --git a/Content.Server/Plants/Components/RandomPottedPlantComponent.cs b/Content.Server/Plants/Components/RandomPottedPlantComponent.cs index 5ea2d4f69d..1453fabd13 100644 --- a/Content.Server/Plants/Components/RandomPottedPlantComponent.cs +++ b/Content.Server/Plants/Components/RandomPottedPlantComponent.cs @@ -61,7 +61,7 @@ namespace Content.Server.Plants.Components if (_selectedState != null) { - IoCManager.Resolve().GetComponent(Owner.Uid).LayerSetState(0, _selectedState); + IoCManager.Resolve().GetComponent(Owner).LayerSetState(0, _selectedState); } } @@ -72,7 +72,7 @@ namespace Content.Server.Plants.Components var list = _plastic ? PlasticPlantStates : RegularPlantStates; _selectedState = random.Pick(list); - IoCManager.Resolve().GetComponent(Owner.Uid).LayerSetState(0, _selectedState); + IoCManager.Resolve().GetComponent(Owner).LayerSetState(0, _selectedState); } } } diff --git a/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs b/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs index a67c00cc49..b7c81ee32e 100644 --- a/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs +++ b/Content.Server/PneumaticCannon/PneumaticCannonSystem.cs @@ -98,7 +98,7 @@ namespace Content.Server.PneumaticCannon private void OnInteractUsing(EntityUid uid, PneumaticCannonComponent component, InteractUsingEvent args) { args.Handled = true; - if (IoCManager.Resolve().HasComponent(args.Used.Uid) + if (IoCManager.Resolve().HasComponent(args.Used) && component.GasTankSlot.CanInsert(args.Used) && component.GasTankRequired) { @@ -109,7 +109,7 @@ namespace Content.Server.PneumaticCannon return; } - if (IoCManager.Resolve().TryGetComponent(args.Used.Uid, out var tool)) + if (IoCManager.Resolve().TryGetComponent(args.Used, out var tool)) { if (tool.Qualities.Contains(component.ToolModifyMode)) { @@ -138,8 +138,8 @@ namespace Content.Server.PneumaticCannon // this overrides the ServerStorageComponent's insertion stuff because // it's not event-based yet and I can't cancel it, so tools and stuff // will modify mode/power then get put in anyway - if (IoCManager.Resolve().TryGetComponent(args.Used.Uid, out var item) - && IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out var storage)) + if (IoCManager.Resolve().TryGetComponent(args.Used, out var item) + && IoCManager.Resolve().TryGetComponent(component.Owner, out var storage)) { if (storage.CanInsert(args.Used)) { @@ -167,7 +167,7 @@ namespace Content.Server.PneumaticCannon { args.User.PopupMessage(Loc.GetString("pneumatic-cannon-component-fire-no-gas", ("cannon", component.Owner))); - SoundSystem.Play(Filter.Pvs(args.Used.Uid), "/Audio/Items/hiss.ogg", args.Used.Uid, AudioParams.Default); + SoundSystem.Play(Filter.Pvs((EntityUid) args.Used), "/Audio/Items/hiss.ogg", (EntityUid) args.Used, AudioParams.Default); return; } AddToQueue(component, args.User, args.ClickLocation); @@ -175,7 +175,7 @@ namespace Content.Server.PneumaticCannon public void AddToQueue(PneumaticCannonComponent comp, IEntity user, EntityCoordinates click) { - if (!IoCManager.Resolve().TryGetComponent(comp.Owner.Uid, out var storage)) + if (!IoCManager.Resolve().TryGetComponent(comp.Owner, out var storage)) return; if (storage.StoredEntities == null) return; if (storage.StoredEntities.Count == 0) @@ -195,7 +195,7 @@ namespace Content.Server.PneumaticCannon for (int i = 0; i < entCounts; i++) { - var dir = (click.ToMapPos(EntityManager) - IoCManager.Resolve().GetComponent(user.Uid).WorldPosition).Normalized; + var dir = (click.ToMapPos(EntityManager) - IoCManager.Resolve().GetComponent(user).WorldPosition).Normalized; var randomAngle = GetRandomFireAngleFromPower(comp.Power).RotateVec(dir); var randomStrengthMult = _random.NextFloat(0.75f, 1.25f); @@ -221,10 +221,10 @@ namespace Content.Server.PneumaticCannon return; } - if (!IoCManager.Resolve().TryGetComponent(comp.Owner.Uid, out var storage)) + if (!IoCManager.Resolve().TryGetComponent(comp.Owner, out var storage)) return; - if ((!IoCManager.Resolve().EntityExists(data.User.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(data.User.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(data.User) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(data.User).EntityLifeStage) >= EntityLifeStage.Deleted) return; if (storage.StoredEntities == null) return; @@ -234,7 +234,7 @@ namespace Content.Server.PneumaticCannon storage.Remove(ent); SoundSystem.Play(Filter.Pvs(data.User), comp.FireSound.GetSound(), comp.OwnerUid, AudioParams.Default); - if (IoCManager.Resolve().TryGetComponent(data.User.Uid, out var recoil)) + if (IoCManager.Resolve().TryGetComponent(data.User, out var recoil)) { recoil.Kick(Vector2.One * data.Strength); } @@ -244,10 +244,10 @@ namespace Content.Server.PneumaticCannon // lasagna, anybody? ent.EnsureComponent(); - if(IoCManager.Resolve().TryGetComponent(data.User.Uid, out var status) + if(IoCManager.Resolve().TryGetComponent(data.User, out var status) && comp.Power == PneumaticCannonPower.High) { - _stun.TryParalyze(data.User.Uid, TimeSpan.FromSeconds(comp.HighPowerStunTime), status); + _stun.TryParalyze(data.User, TimeSpan.FromSeconds(comp.HighPowerStunTime), status); data.User.PopupMessage(Loc.GetString("pneumatic-cannon-component-power-stun", ("cannon", comp.Owner))); } @@ -255,8 +255,8 @@ namespace Content.Server.PneumaticCannon if (comp.GasTankSlot.ContainedEntity != null && comp.GasTankRequired) { // we checked for this earlier in HasGas so a GetComp is okay - var gas = IoCManager.Resolve().GetComponent(comp.GasTankSlot.ContainedEntity.Uid); - var environment = _atmos.GetTileMixture(IoCManager.Resolve().GetComponent(comp.Owner.Uid).Coordinates, true); + var gas = IoCManager.Resolve().GetComponent(comp.GasTankSlot.ContainedEntity); + var environment = _atmos.GetTileMixture(IoCManager.Resolve().GetComponent(comp.Owner).Coordinates, true); var removed = gas.RemoveAir(GetMoleUsageFromPower(comp.Power)); if (environment != null && removed != null) { @@ -276,7 +276,7 @@ namespace Content.Server.PneumaticCannon return false; // not sure how it wouldnt, but it might not! who knows - if (IoCManager.Resolve().TryGetComponent(component.GasTankSlot.ContainedEntity.Uid, out var tank)) + if (IoCManager.Resolve().TryGetComponent(component.GasTankSlot.ContainedEntity, out var tank)) { if (tank.Air.TotalMoles < usage) return false; @@ -323,7 +323,7 @@ namespace Content.Server.PneumaticCannon var ent = component.GasTankSlot.ContainedEntity; if (component.GasTankSlot.Remove(ent)) { - if (IoCManager.Resolve().TryGetComponent(user.Uid, out var hands)) + if (IoCManager.Resolve().TryGetComponent(user, out var hands)) { hands.TryPutInActiveHandOrAny(ent); } @@ -336,7 +336,7 @@ namespace Content.Server.PneumaticCannon public void TryEjectAllItems(PneumaticCannonComponent component, IEntity user) { - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out var storage)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out var storage)) { if (storage.StoredEntities == null) return; foreach (var entity in storage.StoredEntities.ToArray()) @@ -351,7 +351,7 @@ namespace Content.Server.PneumaticCannon private void UpdateAppearance(PneumaticCannonComponent component) { - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out var appearance)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out var appearance)) { appearance.SetData(PneumaticCannonVisuals.Tank, component.GasTankSlot.ContainedEntities.Count != 0); diff --git a/Content.Server/Pointing/Components/PointingArrowComponent.cs b/Content.Server/Pointing/Components/PointingArrowComponent.cs index 76e419b136..85f1acec11 100644 --- a/Content.Server/Pointing/Components/PointingArrowComponent.cs +++ b/Content.Server/Pointing/Components/PointingArrowComponent.cs @@ -58,7 +58,7 @@ namespace Content.Server.Pointing.Components { base.Startup(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(Owner, out SpriteComponent? sprite)) { sprite.DrawDepth = (int) DrawDepth.Overlays; } @@ -67,7 +67,7 @@ namespace Content.Server.Pointing.Components public void Update(float frameTime) { var movement = _speed * frameTime * (_up ? 1 : -1); - IoCManager.Resolve().GetComponent(Owner.Uid).LocalPosition += (0, movement); + IoCManager.Resolve().GetComponent(Owner).LocalPosition += (0, movement); _duration -= frameTime; _currentStep -= frameTime; @@ -76,12 +76,12 @@ namespace Content.Server.Pointing.Components { if (_rogue) { - IoCManager.Resolve().RemoveComponent(Owner.Uid); + IoCManager.Resolve().RemoveComponent(Owner); IoCManager.Resolve().AddComponent(Owner); return; } - IoCManager.Resolve().DeleteEntity(Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) Owner); return; } diff --git a/Content.Server/Pointing/EntitySystems/PointingSystem.cs b/Content.Server/Pointing/EntitySystems/PointingSystem.cs index 898c48964e..fc9a438f77 100644 --- a/Content.Server/Pointing/EntitySystems/PointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/PointingSystem.cs @@ -80,9 +80,9 @@ namespace Content.Server.Pointing.EntitySystems public bool InRange(IEntity pointer, EntityCoordinates coordinates) { - if (IoCManager.Resolve().HasComponent(pointer.Uid)) + if (IoCManager.Resolve().HasComponent(pointer)) { - return IoCManager.Resolve().GetComponent(pointer.Uid).Coordinates.InRange(EntityManager, coordinates, 15); + return IoCManager.Resolve().GetComponent(pointer).Coordinates.InRange(EntityManager, coordinates, 15); } else { @@ -105,7 +105,7 @@ namespace Content.Server.Pointing.EntitySystems return false; } - if (EntityManager.TryGetEntity(uid, out var entity) && IoCManager.Resolve().HasComponent(entity.Uid)) + if (EntityManager.TryGetEntity(uid, out var entity) && IoCManager.Resolve().HasComponent(entity)) { // this is a pointing arrow. no pointing here... return false; @@ -122,7 +122,7 @@ namespace Content.Server.Pointing.EntitySystems var arrow = EntityManager.SpawnEntity("pointingarrow", mapCoords); var layer = (int) VisibilityFlags.Normal; - if (IoCManager.Resolve().TryGetComponent(player.Uid, out VisibilityComponent? playerVisibility)) + if (IoCManager.Resolve().TryGetComponent(player, out VisibilityComponent? playerVisibility)) { var arrowVisibility = arrow.EnsureComponent(); layer = arrowVisibility.Layer = playerVisibility.Layer; @@ -133,9 +133,9 @@ namespace Content.Server.Pointing.EntitySystems { var ent = playerSession.ContentData()?.Mind?.CurrentEntity; - if (ent is null || (!IoCManager.Resolve().TryGetComponent(ent.Uid, out var eyeComp) || (eyeComp.VisibilityMask & layer) == 0)) return false; + if (ent is null || (!IoCManager.Resolve().TryGetComponent(ent, out var eyeComp) || (eyeComp.VisibilityMask & layer) == 0)) return false; - return IoCManager.Resolve().GetComponent(ent.Uid).MapPosition.InRange(IoCManager.Resolve().GetComponent(player.Uid).MapPosition, PointingRange); + return IoCManager.Resolve().GetComponent(ent).MapPosition.InRange(IoCManager.Resolve().GetComponent(player).MapPosition, PointingRange); } var viewers = Filter.Empty() @@ -153,10 +153,10 @@ namespace Content.Server.Pointing.EntitySystems : Loc.GetString("pointing-system-point-at-other", ("other", pointed)); viewerMessage = player == pointed - ? Loc.GetString("pointing-system-point-at-self-others", ("otherName", Name: IoCManager.Resolve().GetComponent(player.Uid).EntityName), ("other", player)) - : Loc.GetString("pointing-system-point-at-other-others", ("otherName", Name: IoCManager.Resolve().GetComponent(player.Uid).EntityName), ("other", pointed)); + ? Loc.GetString("pointing-system-point-at-self-others", ("otherName", Name: IoCManager.Resolve().GetComponent(player).EntityName), ("other", player)) + : Loc.GetString("pointing-system-point-at-other-others", ("otherName", Name: IoCManager.Resolve().GetComponent(player).EntityName), ("other", pointed)); - viewerPointedAtMessage = Loc.GetString("pointing-system-point-at-you-other", ("otherName", Name: IoCManager.Resolve().GetComponent(player.Uid).EntityName)); + viewerPointedAtMessage = Loc.GetString("pointing-system-point-at-you-other", ("otherName", Name: IoCManager.Resolve().GetComponent(player).EntityName)); } else { @@ -171,7 +171,7 @@ namespace Content.Server.Pointing.EntitySystems selfMessage = Loc.GetString("pointing-system-point-at-tile", ("tileName", tileDef.DisplayName)); - viewerMessage = Loc.GetString("pointing-system-other-point-at-tile", ("otherName", Name: IoCManager.Resolve().GetComponent(player.Uid).EntityName), ("tileName", tileDef.DisplayName)); + viewerMessage = Loc.GetString("pointing-system-other-point-at-tile", ("otherName", Name: IoCManager.Resolve().GetComponent(player).EntityName), ("tileName", tileDef.DisplayName)); } _pointers[session!] = _gameTiming.CurTime; @@ -200,17 +200,17 @@ namespace Content.Server.Pointing.EntitySystems return; //Check if the object is already being pointed at - if (IoCManager.Resolve().HasComponent(args.Target.Uid)) + if (IoCManager.Resolve().HasComponent(args.Target)) return; - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out var actor) || - !InRange(args.User, IoCManager.Resolve().GetComponent(args.Target.Uid).Coordinates)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out var actor) || + !InRange(args.User, IoCManager.Resolve().GetComponent(args.Target).Coordinates)) return; Verb verb = new(); verb.Text = Loc.GetString("pointing-verb-get-data-text"); verb.IconTexture = "/Textures/Interface/VerbIcons/point.svg.192dpi.png"; - verb.Act = () => TryPoint(actor.PlayerSession, IoCManager.Resolve().GetComponent(args.Target.Uid).Coordinates, args.Target.Uid); ; + verb.Act = () => TryPoint(actor.PlayerSession, IoCManager.Resolve().GetComponent(args.Target).Coordinates, args.Target); ; args.Verbs.Add(verb); } diff --git a/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs b/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs index 2814c22ff4..6c6ada6ebc 100644 --- a/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs @@ -65,7 +65,7 @@ namespace Content.Server.Pointing.EntitySystems { foreach (var (component, transform) in EntityManager.EntityQuery()) { - var uid = component.Owner.Uid; + var uid = (EntityUid) component.Owner; component.Chasing ??= RandomNearbyPlayer(uid, component, transform); if (component.Chasing == null) @@ -78,7 +78,7 @@ namespace Content.Server.Pointing.EntitySystems if (component.TurningDelay > 0) { - var difference = IoCManager.Resolve().GetComponent(component.Chasing.Uid).WorldPosition - transform.WorldPosition; + var difference = IoCManager.Resolve().GetComponent(component.Chasing).WorldPosition - transform.WorldPosition; var angle = difference.ToAngle(); var adjusted = angle.Degrees + 90; var newAngle = Angle.FromDegrees(adjusted); @@ -93,7 +93,7 @@ namespace Content.Server.Pointing.EntitySystems UpdateAppearance(uid, component, transform); - var toChased = IoCManager.Resolve().GetComponent(component.Chasing.Uid).WorldPosition - transform.WorldPosition; + var toChased = IoCManager.Resolve().GetComponent(component.Chasing).WorldPosition - transform.WorldPosition; transform.WorldPosition += toChased * frameTime * component.ChasingSpeed; diff --git a/Content.Server/Power/Components/ApcComponent.cs b/Content.Server/Power/Components/ApcComponent.cs index 02ad92ad44..145a4957db 100644 --- a/Content.Server/Power/Components/ApcComponent.cs +++ b/Content.Server/Power/Components/ApcComponent.cs @@ -56,7 +56,7 @@ namespace Content.Server.Power.Components [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ApcUiKey.Key); - public BatteryComponent? Battery => IoCManager.Resolve().TryGetComponent(Owner.Uid, out BatteryComponent? batteryComponent) ? batteryComponent : null; + public BatteryComponent? Battery => IoCManager.Resolve().TryGetComponent(Owner, out BatteryComponent? batteryComponent) ? batteryComponent : null; [ComponentDependency] private AccessReader? _accessReader = null; @@ -93,10 +93,10 @@ namespace Content.Server.Power.Components if (user == null) return; var accessSystem = EntitySystem.Get(); - if (_accessReader == null || accessSystem.IsAllowed(_accessReader, user.Uid)) + if (_accessReader == null || accessSystem.IsAllowed(_accessReader, user)) { MainBreakerEnabled = !MainBreakerEnabled; - IoCManager.Resolve().GetComponent(Owner.Uid).CanDischarge = MainBreakerEnabled; + IoCManager.Resolve().GetComponent(Owner).CanDischarge = MainBreakerEnabled; _uiDirty = true; SoundSystem.Play(Filter.Pvs(Owner), _onReceiveMessageSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f)); @@ -117,12 +117,12 @@ namespace Content.Server.Power.Components _lastChargeState = newState; _lastChargeStateChange = _gameTiming.CurTime; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(ApcVisuals.ChargeState, newState); } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out SharedPointLightComponent? light)) + if (IoCManager.Resolve().TryGetComponent(Owner, out SharedPointLightComponent? light)) { light.Color = newState switch { @@ -135,7 +135,7 @@ namespace Content.Server.Power.Components } } - IoCManager.Resolve().TryGetComponent(Owner.Uid, out BatteryComponent? battery); + IoCManager.Resolve().TryGetComponent(Owner, out BatteryComponent? battery); var newCharge = battery?.CurrentCharge; if (newCharge != null && newCharge != _lastCharge && _lastChargeChange + TimeSpan.FromSeconds(VisualsChangeDelay) < _gameTiming.CurTime) @@ -162,7 +162,7 @@ namespace Content.Server.Power.Components private ApcChargeState CalcChargeState() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out BatteryComponent? battery)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out BatteryComponent? battery)) { return ApcChargeState.Lack; } @@ -174,7 +174,7 @@ namespace Content.Server.Power.Components return ApcChargeState.Full; } - var netBattery = IoCManager.Resolve().GetComponent(Owner.Uid); + var netBattery = IoCManager.Resolve().GetComponent(Owner); var delta = netBattery.CurrentSupply - netBattery.CurrentReceiving; return delta < 0 ? ApcChargeState.Charging : ApcChargeState.Lack; @@ -186,7 +186,7 @@ namespace Content.Server.Power.Components if (bat == null) return ApcExternalPowerState.None; - var netBat = IoCManager.Resolve().GetComponent(Owner.Uid); + var netBat = IoCManager.Resolve().GetComponent(Owner); if (netBat.CurrentReceiving == 0 && netBat.LoadingNetworkDemand != 0) { return ApcExternalPowerState.None; @@ -203,7 +203,7 @@ namespace Content.Server.Power.Components void IActivate.Activate(ActivateEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) { return; } diff --git a/Content.Server/Power/Components/ApcPowerReceiverComponent.cs b/Content.Server/Power/Components/ApcPowerReceiverComponent.cs index cf3ed33dbe..9d54dd386d 100644 --- a/Content.Server/Power/Components/ApcPowerReceiverComponent.cs +++ b/Content.Server/Power/Components/ApcPowerReceiverComponent.cs @@ -85,9 +85,9 @@ namespace Content.Server.Power.Components #pragma warning disable 618 SendMessage(new PowerChangedMessage(Powered)); #pragma warning restore 618 - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, new PowerChangedEvent(Powered, NetworkLoad.ReceivingPower)); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, new PowerChangedEvent(Powered, NetworkLoad.ReceivingPower)); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var appearance)) { appearance.SetData(PowerDeviceVisuals.Powered, Powered); } diff --git a/Content.Server/Power/Components/BaseCharger.cs b/Content.Server/Power/Components/BaseCharger.cs index 559f8af05f..016aa76061 100644 --- a/Content.Server/Power/Components/BaseCharger.cs +++ b/Content.Server/Power/Components/BaseCharger.cs @@ -98,12 +98,12 @@ namespace Content.Server.Power.Components Container.Remove(heldItem); _heldBattery = null; - if (IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? handsComponent)) + if (IoCManager.Resolve().TryGetComponent(user, out HandsComponent? handsComponent)) { - handsComponent.PutInHandOrDrop(IoCManager.Resolve().GetComponent(heldItem.Uid)); + handsComponent.PutInHandOrDrop(IoCManager.Resolve().GetComponent(heldItem)); } - if (IoCManager.Resolve().TryGetComponent(heldItem.Uid, out ServerBatteryBarrelComponent? batteryBarrelComponent)) + if (IoCManager.Resolve().TryGetComponent(heldItem, out ServerBatteryBarrelComponent? batteryBarrelComponent)) { batteryBarrelComponent.UpdateAppearance(); } @@ -118,7 +118,7 @@ namespace Content.Server.Power.Components private CellChargerStatus GetStatus() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) && + if (IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) && !receiver.Powered) { return CellChargerStatus.Off; @@ -161,13 +161,13 @@ namespace Content.Server.Power.Components // Not called UpdateAppearance just because it messes with the load var status = GetStatus(); if (_status == status || - !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver)) + !IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver)) { return; } _status = status; - IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance); + IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance); switch (_status) { @@ -206,7 +206,7 @@ namespace Content.Server.Power.Components private void TransferPower(float frameTime) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) && + if (IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) && !receiver.Powered) { return; diff --git a/Content.Server/Power/Components/BaseNetConnectorComponent.cs b/Content.Server/Power/Components/BaseNetConnectorComponent.cs index 7410199d27..1737a1412d 100644 --- a/Content.Server/Power/Components/BaseNetConnectorComponent.cs +++ b/Content.Server/Power/Components/BaseNetConnectorComponent.cs @@ -68,7 +68,7 @@ namespace Content.Server.Power.Components private bool TryFindNet([NotNullWhen(true)] out TNetType? foundNet) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var container)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var container)) { var compatibleNet = container.Nodes.Values .Where(node => (NodeId == null || NodeId == node.Name) && node.NodeGroupID == (NodeGroupID) Voltage) diff --git a/Content.Server/Power/Components/CableComponent.cs b/Content.Server/Power/Components/CableComponent.cs index ec82613de4..624451765d 100644 --- a/Content.Server/Power/Components/CableComponent.cs +++ b/Content.Server/Power/Components/CableComponent.cs @@ -43,16 +43,16 @@ namespace Content.Server.Power.Components if (_cableDroppedOnCutPrototype == null) return false; - if (!await EntitySystem.Get().UseTool(eventArgs.Using.Uid, eventArgs.User.Uid, Owner.Uid, 0f, 0.25f, _cuttingQuality)) return false; + if (!await EntitySystem.Get().UseTool(eventArgs.Using, eventArgs.User, Owner, 0f, 0.25f, _cuttingQuality)) return false; - if (EntitySystem.Get().TryDoElectrifiedAct(Owner.Uid, eventArgs.User.Uid)) return false; + if (EntitySystem.Get().TryDoElectrifiedAct(Owner, eventArgs.User)) return false; - IoCManager.Resolve().DeleteEntity(Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) Owner); var droppedEnt = IoCManager.Resolve().SpawnEntity(_cableDroppedOnCutPrototype, eventArgs.ClickLocation); // TODO: Literally just use a prototype that has a single thing in the stack, it's not that complicated... - if (IoCManager.Resolve().TryGetComponent(droppedEnt.Uid, out var stack)) - EntitySystem.Get().SetCount(droppedEnt.Uid, 1, stack); + if (IoCManager.Resolve().TryGetComponent(droppedEnt, out var stack)) + EntitySystem.Get().SetCount(droppedEnt, 1, stack); return true; } diff --git a/Content.Server/Power/Components/CablePlacerComponent.cs b/Content.Server/Power/Components/CablePlacerComponent.cs index d6cf656708..4372c20dda 100644 --- a/Content.Server/Power/Components/CablePlacerComponent.cs +++ b/Content.Server/Power/Components/CablePlacerComponent.cs @@ -31,7 +31,7 @@ namespace Content.Server.Power.Components /// async Task IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs) { - if (!EntitySystem.Get().CanInteract(eventArgs.User.Uid)) + if (!EntitySystem.Get().CanInteract(eventArgs.User)) return false; if (_cablePrototypeID == null) @@ -57,8 +57,8 @@ namespace Content.Server.Power.Components } } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var stack) - && !EntitySystem.Get().Use(Owner.Uid, 1, stack)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var stack) + && !EntitySystem.Get().Use(Owner, 1, stack)) return false; IoCManager.Resolve().SpawnEntity(_cablePrototypeID, grid.GridTileToLocal(snapPos)); diff --git a/Content.Server/Power/EntitySystems/BaseChargerSystem.cs b/Content.Server/Power/EntitySystems/BaseChargerSystem.cs index 6d15ca890e..0e70a3d56b 100644 --- a/Content.Server/Power/EntitySystems/BaseChargerSystem.cs +++ b/Content.Server/Power/EntitySystems/BaseChargerSystem.cs @@ -39,11 +39,11 @@ namespace Content.Server.Power.EntitySystems !args.CanAccess || !args.CanInteract || !component.HasCell || - !_actionBlockerSystem.CanPickup(args.User.Uid)) + !_actionBlockerSystem.CanPickup(args.User)) return; Verb verb = new(); - verb.Text = IoCManager.Resolve().GetComponent(component.Container.ContainedEntity!.Uid).EntityName; + verb.Text = IoCManager.Resolve().GetComponent(component.Container.ContainedEntity!).EntityName; verb.Category = VerbCategory.Eject; verb.Act = () => component.RemoveItem(args.User); args.Verbs.Add(verb); @@ -56,11 +56,11 @@ namespace Content.Server.Power.EntitySystems !args.CanInteract || component.HasCell || !component.IsEntityCompatible(args.Using) || - !_actionBlockerSystem.CanDrop(args.User.Uid)) + !_actionBlockerSystem.CanDrop(args.User)) return; Verb verb = new(); - verb.Text = IoCManager.Resolve().GetComponent(args.Using.Uid).EntityName; + verb.Text = IoCManager.Resolve().GetComponent(args.Using).EntityName; verb.Category = VerbCategory.Insert; verb.Act = () => component.TryInsertItem(args.Using); args.Verbs.Add(verb); diff --git a/Content.Server/Power/EntitySystems/CableMultitoolSystem.cs b/Content.Server/Power/EntitySystems/CableMultitoolSystem.cs index 3f26e121d2..0ab5d77913 100644 --- a/Content.Server/Power/EntitySystems/CableMultitoolSystem.cs +++ b/Content.Server/Power/EntitySystems/CableMultitoolSystem.cs @@ -43,12 +43,12 @@ namespace Content.Server.Power.EntitySystems if (args.IsInDetailsRange) { // Determine if they are holding a multitool. - if (IoCManager.Resolve().TryGetComponent(args.Examiner.Uid, out var hands) && hands.TryGetActiveHand(out var hand)) + if (IoCManager.Resolve().TryGetComponent(args.Examiner, out var hands) && hands.TryGetActiveHand(out var hand)) { var held = hand.HeldEntity; // Pulsing is hardcoded here because I don't think it needs to be more complex than that right now. // Update if I'm wrong. - if ((held != null) && _toolSystem.HasQuality(held.Uid, "Pulsing")) + if ((held != null) && _toolSystem.HasQuality(held, "Pulsing")) { args.PushMarkup(GenerateCableMarkup(uid)); // args.PushFancyUpdatingPowerGraphs(uid); diff --git a/Content.Server/Power/EntitySystems/CableVisSystem.cs b/Content.Server/Power/EntitySystems/CableVisSystem.cs index e6df04f5dc..0ef104f270 100644 --- a/Content.Server/Power/EntitySystems/CableVisSystem.cs +++ b/Content.Server/Power/EntitySystems/CableVisSystem.cs @@ -63,7 +63,7 @@ namespace Content.Server.Power.EntitySystems if (reachable is not CableNode) continue; - var otherTransform = IoCManager.Resolve().GetComponent(reachable.Owner.Uid); + var otherTransform = IoCManager.Resolve().GetComponent(reachable.Owner); if (otherTransform.GridID != grid.Index) continue; diff --git a/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs b/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs index 2130aaf564..fb3c43572e 100644 --- a/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs +++ b/Content.Server/Power/EntitySystems/ExtensionCableSystem.cs @@ -42,7 +42,7 @@ namespace Content.Server.Power.EntitySystems receiver.Provider?.LinkedReceivers.Remove(receiver); receiver.Provider = provider; provider.LinkedReceivers.Add(receiver); - RaiseLocalEvent(receiver.Owner.Uid, new ProviderConnectedEvent(provider), broadcast: false); + RaiseLocalEvent(receiver.Owner, new ProviderConnectedEvent(provider), broadcast: false); RaiseLocalEvent(uid, new ReceiverConnectedEvent(receiver), broadcast: false); } } @@ -60,8 +60,8 @@ namespace Content.Server.Power.EntitySystems foreach (var receiver in receivers) { receiver.Provider = null; - RaiseLocalEvent(receiver.Owner.Uid, new ProviderDisconnectedEvent(provider), broadcast: false); - RaiseLocalEvent(provider.Owner.Uid, new ReceiverDisconnectedEvent(receiver), broadcast: false); + RaiseLocalEvent(receiver.Owner, new ProviderDisconnectedEvent(provider), broadcast: false); + RaiseLocalEvent(provider.Owner, new ReceiverDisconnectedEvent(receiver), broadcast: false); } foreach (var receiver in receivers) @@ -84,10 +84,10 @@ namespace Content.Server.Power.EntitySystems foreach (var entity in nearbyEntities) { - if (EntityManager.TryGetComponent(entity.Uid, out var receiver) && + if (EntityManager.TryGetComponent(entity, out var receiver) && receiver.Connectable && receiver.Provider == null && - IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.TryDistance(IoCManager.Resolve(), IoCManager.Resolve().GetComponent(owner.Uid).Coordinates, out var distance) && + IoCManager.Resolve().GetComponent(entity).Coordinates.TryDistance(IoCManager.Resolve(), IoCManager.Resolve().GetComponent(owner).Coordinates, out var distance) && distance < Math.Min(range, receiver.ReceptionRange)) { yield return receiver; @@ -110,7 +110,7 @@ namespace Content.Server.Power.EntitySystems if (provider != null) { - RaiseLocalEvent(provider.Owner.Uid, new ReceiverDisconnectedEvent(receiver), broadcast: false); + RaiseLocalEvent(provider.Owner, new ReceiverDisconnectedEvent(receiver), broadcast: false); provider.LinkedReceivers.Remove(receiver); } @@ -120,7 +120,7 @@ namespace Content.Server.Power.EntitySystems private void OnReceiverStarted(EntityUid uid, ExtensionCableReceiverComponent receiver, ComponentStartup args) { - if (IoCManager.Resolve().TryGetComponent(receiver.Owner.Uid, out PhysicsComponent? physicsComponent)) + if (IoCManager.Resolve().TryGetComponent(receiver.Owner, out PhysicsComponent? physicsComponent)) { receiver.Connectable = physicsComponent.BodyType == BodyType.Static; } @@ -137,7 +137,7 @@ namespace Content.Server.Power.EntitySystems receiver.Provider.LinkedReceivers.Remove(receiver); RaiseLocalEvent(uid, new ProviderDisconnectedEvent(receiver.Provider), broadcast: false); - RaiseLocalEvent(receiver.Provider.Owner.Uid, new ReceiverDisconnectedEvent(receiver), broadcast: false); + RaiseLocalEvent(receiver.Provider.Owner, new ReceiverDisconnectedEvent(receiver), broadcast: false); } private void AnchorStateChanged(EntityUid uid, ExtensionCableReceiverComponent receiver, ref AnchorStateChangedEvent args) @@ -156,7 +156,7 @@ namespace Content.Server.Power.EntitySystems RaiseLocalEvent(uid, new ProviderDisconnectedEvent(receiver.Provider), broadcast: false); if (receiver.Provider != null) { - RaiseLocalEvent(receiver.Provider.Owner.Uid, new ReceiverDisconnectedEvent(receiver), broadcast: false); + RaiseLocalEvent(receiver.Provider.Owner, new ReceiverDisconnectedEvent(receiver), broadcast: false); receiver.Provider.LinkedReceivers.Remove(receiver); } @@ -170,8 +170,8 @@ namespace Content.Server.Power.EntitySystems receiver.Provider = provider; provider.LinkedReceivers.Add(receiver); - RaiseLocalEvent(receiver.Owner.Uid, new ProviderConnectedEvent(provider), broadcast: false); - RaiseLocalEvent(provider.Owner.Uid, new ReceiverConnectedEvent(receiver), broadcast: false); + RaiseLocalEvent(receiver.Owner, new ProviderConnectedEvent(provider), broadcast: false); + RaiseLocalEvent(provider.Owner, new ReceiverConnectedEvent(receiver), broadcast: false); } private static bool TryFindAvailableProvider(IEntity owner, float range, [NotNullWhen(true)] out ExtensionCableProviderComponent? foundProvider) @@ -181,11 +181,11 @@ namespace Content.Server.Power.EntitySystems foreach (var entity in nearbyEntities) { - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out var provider)) continue; + if (!IoCManager.Resolve().TryGetComponent(entity, out var provider)) continue; if (!provider.Connectable) continue; - if (!IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.TryDistance(IoCManager.Resolve(), IoCManager.Resolve().GetComponent(owner.Uid).Coordinates, out var distance)) continue; + if (!IoCManager.Resolve().GetComponent(entity).Coordinates.TryDistance(IoCManager.Resolve(), IoCManager.Resolve().GetComponent(owner).Coordinates, out var distance)) continue; if (!(distance < Math.Min(range, provider.TransferRange))) continue; diff --git a/Content.Server/Power/EntitySystems/PowerNetSystem.cs b/Content.Server/Power/EntitySystems/PowerNetSystem.cs index 60a3af5455..578021ac71 100644 --- a/Content.Server/Power/EntitySystems/PowerNetSystem.cs +++ b/Content.Server/Power/EntitySystems/PowerNetSystem.cs @@ -270,7 +270,7 @@ namespace Content.Server.Power.EntitySystems { lastRecv = newRecv; var msg = new PowerConsumerReceivedChanged(newRecv, consumer.DrawRate); - RaiseLocalEvent(consumer.Owner.Uid, msg); + RaiseLocalEvent(consumer.Owner, msg); } } @@ -285,11 +285,11 @@ namespace Content.Server.Power.EntitySystems if (lastPowerSupply == 0f && currentSupply != 0f) { - RaiseLocalEvent(powerNetBattery.Owner.Uid, new PowerNetBatterySupplyEvent {Supply = true}); + RaiseLocalEvent(powerNetBattery.Owner, new PowerNetBatterySupplyEvent {Supply = true}); } else if (lastPowerSupply > 0f && currentSupply == 0f) { - RaiseLocalEvent(powerNetBattery.Owner.Uid, new PowerNetBatterySupplyEvent {Supply = false}); + RaiseLocalEvent(powerNetBattery.Owner, new PowerNetBatterySupplyEvent {Supply = false}); } } @@ -343,7 +343,7 @@ namespace Content.Server.Power.EntitySystems foreach (var apc in net.Apcs) { - var netBattery = IoCManager.Resolve().GetComponent(apc.Owner.Uid); + var netBattery = IoCManager.Resolve().GetComponent(apc.Owner); netNode.BatteriesDischarging.Add(netBattery.NetworkBattery.Id); netBattery.NetworkBattery.LinkedNetworkDischarging = netNode.Id; } @@ -372,14 +372,14 @@ namespace Content.Server.Power.EntitySystems foreach (var charger in net.Chargers) { - var battery = IoCManager.Resolve().GetComponent(charger.Owner.Uid); + var battery = IoCManager.Resolve().GetComponent(charger.Owner); netNode.BatteriesCharging.Add(battery.NetworkBattery.Id); battery.NetworkBattery.LinkedNetworkCharging = netNode.Id; } foreach (var discharger in net.Dischargers) { - var battery = IoCManager.Resolve().GetComponent(discharger.Owner.Uid); + var battery = IoCManager.Resolve().GetComponent(discharger.Owner); netNode.BatteriesDischarging.Add(battery.NetworkBattery.Id); battery.NetworkBattery.LinkedNetworkDischarging = netNode.Id; } diff --git a/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs b/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs index 8a77441cf0..6edac5a619 100644 --- a/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs +++ b/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs @@ -30,7 +30,7 @@ namespace Content.Server.Power.EntitySystems private void OnProviderConnected(EntityUid uid, ApcPowerReceiverComponent receiver, ExtensionCableSystem.ProviderConnectedEvent args) { - var providerUid = args.Provider.Owner.Uid; + var providerUid = (EntityUid) args.Provider.Owner; if (!EntityManager.TryGetComponent(providerUid, out var provider)) return; @@ -48,7 +48,7 @@ namespace Content.Server.Power.EntitySystems private void OnReceiverConnected(EntityUid uid, ApcPowerProviderComponent provider, ExtensionCableSystem.ReceiverConnectedEvent args) { - if (EntityManager.TryGetComponent(args.Receiver.Owner.Uid, out ApcPowerReceiverComponent receiver)) + if (EntityManager.TryGetComponent(args.Receiver.Owner, out ApcPowerReceiverComponent receiver)) { provider.AddReceiver(receiver); } @@ -56,7 +56,7 @@ namespace Content.Server.Power.EntitySystems private void OnReceiverDisconnected(EntityUid uid, ApcPowerProviderComponent provider, ExtensionCableSystem.ReceiverDisconnectedEvent args) { - if (EntityManager.TryGetComponent(args.Receiver.Owner.Uid, out ApcPowerReceiverComponent receiver)) + if (EntityManager.TryGetComponent(args.Receiver.Owner, out ApcPowerReceiverComponent receiver)) { provider.RemoveReceiver(receiver); } diff --git a/Content.Server/Power/NodeGroups/ApcNet.cs b/Content.Server/Power/NodeGroups/ApcNet.cs index eb1357dc41..2dc7bd53bc 100644 --- a/Content.Server/Power/NodeGroups/ApcNet.cs +++ b/Content.Server/Power/NodeGroups/ApcNet.cs @@ -67,7 +67,7 @@ namespace Content.Server.Power.NodeGroups public void AddApc(ApcComponent apc) { - if (IoCManager.Resolve().TryGetComponent(apc.Owner.Uid, out PowerNetworkBatteryComponent? netBattery)) + if (IoCManager.Resolve().TryGetComponent(apc.Owner, out PowerNetworkBatteryComponent? netBattery)) netBattery.NetworkBattery.LinkedNetworkDischarging = default; QueueNetworkReconnect(); @@ -76,7 +76,7 @@ namespace Content.Server.Power.NodeGroups public void RemoveApc(ApcComponent apc) { - if (IoCManager.Resolve().TryGetComponent(apc.Owner.Uid, out PowerNetworkBatteryComponent? netBattery)) + if (IoCManager.Resolve().TryGetComponent(apc.Owner, out PowerNetworkBatteryComponent? netBattery)) netBattery.NetworkBattery.LinkedNetworkDischarging = default; QueueNetworkReconnect(); diff --git a/Content.Server/Power/NodeGroups/BaseNetConnectorNodeGroup.cs b/Content.Server/Power/NodeGroups/BaseNetConnectorNodeGroup.cs index bc33637424..46c7540ec3 100644 --- a/Content.Server/Power/NodeGroups/BaseNetConnectorNodeGroup.cs +++ b/Content.Server/Power/NodeGroups/BaseNetConnectorNodeGroup.cs @@ -16,7 +16,7 @@ namespace Content.Server.Power.NodeGroups foreach (var node in groupNodes) { - var newNetConnectorComponents = IoCManager.Resolve().GetComponents>(node.Owner.Uid) + var newNetConnectorComponents = IoCManager.Resolve().GetComponents>(node.Owner) .Where(powerComp => (powerComp.NodeId == null || powerComp.NodeId == node.Name) && (NodeGroupID) powerComp.Voltage == node.NodeGroupID) .ToList(); diff --git a/Content.Server/Power/NodeGroups/PowerNet.cs b/Content.Server/Power/NodeGroups/PowerNet.cs index 7d44670dfc..b49d251186 100644 --- a/Content.Server/Power/NodeGroups/PowerNet.cs +++ b/Content.Server/Power/NodeGroups/PowerNet.cs @@ -91,7 +91,7 @@ namespace Content.Server.Power.NodeGroups public void AddDischarger(BatteryDischargerComponent discharger) { - var battery = IoCManager.Resolve().GetComponent(discharger.Owner.Uid); + var battery = IoCManager.Resolve().GetComponent(discharger.Owner); battery.NetworkBattery.LinkedNetworkCharging = default; Dischargers.Add(discharger); _powerNetSystem.QueueReconnectPowerNet(this); @@ -100,7 +100,7 @@ namespace Content.Server.Power.NodeGroups public void RemoveDischarger(BatteryDischargerComponent discharger) { // Can be missing if the entity is being deleted, not a big deal. - if (IoCManager.Resolve().TryGetComponent(discharger.Owner.Uid, out PowerNetworkBatteryComponent? battery)) + if (IoCManager.Resolve().TryGetComponent(discharger.Owner, out PowerNetworkBatteryComponent? battery)) battery.NetworkBattery.LinkedNetworkCharging = default; Dischargers.Remove(discharger); @@ -109,7 +109,7 @@ namespace Content.Server.Power.NodeGroups public void AddCharger(BatteryChargerComponent charger) { - var battery = IoCManager.Resolve().GetComponent(charger.Owner.Uid); + var battery = IoCManager.Resolve().GetComponent(charger.Owner); battery.NetworkBattery.LinkedNetworkCharging = default; Chargers.Add(charger); _powerNetSystem.QueueReconnectPowerNet(this); @@ -118,7 +118,7 @@ namespace Content.Server.Power.NodeGroups public void RemoveCharger(BatteryChargerComponent charger) { // Can be missing if the entity is being deleted, not a big deal. - if (IoCManager.Resolve().TryGetComponent(charger.Owner.Uid, out PowerNetworkBatteryComponent? battery)) + if (IoCManager.Resolve().TryGetComponent(charger.Owner, out PowerNetworkBatteryComponent? battery)) battery.NetworkBattery.LinkedNetworkCharging = default; Chargers.Remove(charger); diff --git a/Content.Server/Power/Nodes/CableDeviceNode.cs b/Content.Server/Power/Nodes/CableDeviceNode.cs index f6d2e2d136..d8c4c217ef 100644 --- a/Content.Server/Power/Nodes/CableDeviceNode.cs +++ b/Content.Server/Power/Nodes/CableDeviceNode.cs @@ -18,10 +18,10 @@ namespace Content.Server.Power.Nodes var entMan = IoCManager.Resolve(); // If we're in an invalid grid, such as grid 0, we cannot connect to anything. - if(!IoCManager.Resolve().TryGetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID, out var grid)) + if(!IoCManager.Resolve().TryGetGrid(IoCManager.Resolve().GetComponent(Owner).GridID, out var grid)) yield break; - var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner).Coordinates); foreach (var node in NodeHelpers.GetNodesInTile(entMan, grid, gridIndex)) { diff --git a/Content.Server/Power/Nodes/CableNode.cs b/Content.Server/Power/Nodes/CableNode.cs index 2eb124038e..9d1143b2a9 100644 --- a/Content.Server/Power/Nodes/CableNode.cs +++ b/Content.Server/Power/Nodes/CableNode.cs @@ -18,8 +18,8 @@ namespace Content.Server.Power.Nodes yield break; var entMan = IoCManager.Resolve(); - var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); - var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner).GridID); + var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner).Coordinates); // While we go over adjacent nodes, we build a list of blocked directions due to // incoming or outgoing wire terminals. @@ -44,11 +44,11 @@ namespace Content.Server.Power.Nodes if (dir == Direction.Invalid) { // On own tile, block direction it faces - terminalDirs |= 1 << (int) IoCManager.Resolve().GetComponent(node.Owner.Uid).LocalRotation.GetCardinalDir(); + terminalDirs |= 1 << (int) IoCManager.Resolve().GetComponent(node.Owner).LocalRotation.GetCardinalDir(); } else { - var terminalDir = IoCManager.Resolve().GetComponent(node.Owner.Uid).LocalRotation.GetCardinalDir(); + var terminalDir = IoCManager.Resolve().GetComponent(node.Owner).LocalRotation.GetCardinalDir(); if (terminalDir.GetOpposite() == dir) { // Target tile has a terminal towards us, block the direction. @@ -73,7 +73,7 @@ namespace Content.Server.Power.Nodes { base.OnPostRebuild(); - EntitySystem.Get().QueueUpdate(Owner.Uid); + EntitySystem.Get().QueueUpdate(Owner); } } } diff --git a/Content.Server/Power/Nodes/CableTerminalNode.cs b/Content.Server/Power/Nodes/CableTerminalNode.cs index 9c43ef1342..17351ec7eb 100644 --- a/Content.Server/Power/Nodes/CableTerminalNode.cs +++ b/Content.Server/Power/Nodes/CableTerminalNode.cs @@ -12,15 +12,15 @@ namespace Content.Server.Power.Nodes { public override IEnumerable GetReachableNodes() { - if (IoCManager.Resolve().GetComponent(Owner.Uid).GridID == GridId.Invalid) + if (IoCManager.Resolve().GetComponent(Owner).GridID == GridId.Invalid) yield break; // No funny nodes in spess. var entMan = IoCManager.Resolve(); - var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); - var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner).GridID); + var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner).Coordinates); - var dir = IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation.GetDir(); + var dir = IoCManager.Resolve().GetComponent(Owner).LocalRotation.GetDir(); var targetIdx = gridIndex + NodeHelpers.TileOffsetForDir(dir); foreach (var node in NodeHelpers.GetNodesInTile(entMan, grid, targetIdx)) diff --git a/Content.Server/Power/Nodes/CableTerminalPortNode.cs b/Content.Server/Power/Nodes/CableTerminalPortNode.cs index bed5c64aa9..e1cf189f11 100644 --- a/Content.Server/Power/Nodes/CableTerminalPortNode.cs +++ b/Content.Server/Power/Nodes/CableTerminalPortNode.cs @@ -12,12 +12,12 @@ namespace Content.Server.Power.Nodes { public override IEnumerable GetReachableNodes() { - if (IoCManager.Resolve().GetComponent(Owner.Uid).GridID == GridId.Invalid) + if (IoCManager.Resolve().GetComponent(Owner).GridID == GridId.Invalid) yield break; // No funny nodes in spess. var entMan = IoCManager.Resolve(); - var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner.Uid).GridID); - var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var grid = IoCManager.Resolve().GetGrid(IoCManager.Resolve().GetComponent(Owner).GridID); + var gridIndex = grid.TileIndicesFor(IoCManager.Resolve().GetComponent(Owner).Coordinates); var nodes = NodeHelpers.GetCardinalNeighborNodes(entMan, grid, gridIndex, includeSameTile: false); foreach (var (_, node) in nodes) diff --git a/Content.Server/Power/SMES/SmesComponent.cs b/Content.Server/Power/SMES/SmesComponent.cs index b1a3205983..74fe513cb9 100644 --- a/Content.Server/Power/SMES/SmesComponent.cs +++ b/Content.Server/Power/SMES/SmesComponent.cs @@ -47,7 +47,7 @@ namespace Content.Server.Power.SMES _lastChargeLevel = newLevel; _lastChargeLevelChange = _gameTiming.CurTime; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(SmesVisuals.LastChargeLevel, newLevel); } @@ -59,7 +59,7 @@ namespace Content.Server.Power.SMES _lastChargeState = newChargeState; _lastChargeStateChange = _gameTiming.CurTime; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(SmesVisuals.LastChargeState, newChargeState); } @@ -68,7 +68,7 @@ namespace Content.Server.Power.SMES private int GetNewChargeLevel() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out BatteryComponent? battery)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out BatteryComponent? battery)) { return 0; } @@ -78,7 +78,7 @@ namespace Content.Server.Power.SMES private ChargeState GetNewChargeState() { - var battery = IoCManager.Resolve().GetComponent(Owner.Uid); + var battery = IoCManager.Resolve().GetComponent(Owner); return (battery.CurrentSupply - battery.CurrentReceiving) switch { > 0 => ChargeState.Discharging, diff --git a/Content.Server/PowerCell/Components/PowerCellChargerComponent.cs b/Content.Server/PowerCell/Components/PowerCellChargerComponent.cs index 82910cfc91..3564d8bbdc 100644 --- a/Content.Server/PowerCell/Components/PowerCellChargerComponent.cs +++ b/Content.Server/PowerCell/Components/PowerCellChargerComponent.cs @@ -17,12 +17,12 @@ namespace Content.Server.PowerCell.Components public override bool IsEntityCompatible(IEntity entity) { - return IoCManager.Resolve().HasComponent(entity.Uid); + return IoCManager.Resolve().HasComponent(entity); } protected override BatteryComponent GetBatteryFrom(IEntity entity) { - return IoCManager.Resolve().GetComponent(entity.Uid); + return IoCManager.Resolve().GetComponent(entity); } } } diff --git a/Content.Server/PowerCell/Components/PowerCellComponent.cs b/Content.Server/PowerCell/Components/PowerCellComponent.cs index c2e0f49563..4d84d1acaf 100644 --- a/Content.Server/PowerCell/Components/PowerCellComponent.cs +++ b/Content.Server/PowerCell/Components/PowerCellComponent.cs @@ -74,12 +74,12 @@ namespace Content.Server.PowerCell.Components CurrentCharge = 0; EntitySystem.Get().SpawnExplosion(OwnerUid, 0, heavy, light, light*2); - IoCManager.Resolve().DeleteEntity(Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) Owner); } private void UpdateVisuals() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(PowerCellVisuals.ChargeLevel, GetLevel(CurrentCharge / MaxCharge)); } diff --git a/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs b/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs index f0d0f8b604..4197079ace 100644 --- a/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs +++ b/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs @@ -81,7 +81,7 @@ namespace Content.Server.PowerCell.Components get { if (_cellContainer.ContainedEntity == null) return null; - return IoCManager.Resolve().TryGetComponent(_cellContainer.ContainedEntity.Uid, out PowerCellComponent? cell) ? cell : null; + return IoCManager.Resolve().TryGetComponent(_cellContainer.ContainedEntity, out PowerCellComponent? cell) ? cell : null; } } @@ -134,14 +134,14 @@ namespace Content.Server.PowerCell.Components //Dirty(); if (user != null) { - if (!IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? hands) || !hands.PutInHand(IoCManager.Resolve().GetComponent(cell.Owner.Uid))) + if (!IoCManager.Resolve().TryGetComponent(user, out HandsComponent? hands) || !hands.PutInHand(IoCManager.Resolve().GetComponent(cell.Owner))) { - IoCManager.Resolve().GetComponent(cell.Owner.Uid).Coordinates = IoCManager.Resolve().GetComponent(user.Uid).Coordinates; + IoCManager.Resolve().GetComponent(cell.Owner).Coordinates = IoCManager.Resolve().GetComponent(user).Coordinates; } } else { - IoCManager.Resolve().GetComponent(cell.Owner.Uid).Coordinates = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + IoCManager.Resolve().GetComponent(cell.Owner).Coordinates = IoCManager.Resolve().GetComponent(Owner).Coordinates; } if (playSound) @@ -149,7 +149,7 @@ namespace Content.Server.PowerCell.Components SoundSystem.Play(Filter.Pvs(Owner), CellRemoveSound.GetSound(), Owner, AudioHelpers.WithVariation(0.125f)); } - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, new PowerCellChangedEvent(true), false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, new PowerCellChangedEvent(true), false); return cell; } @@ -162,8 +162,8 @@ namespace Content.Server.PowerCell.Components public bool InsertCell(IEntity cell, bool playSound = true) { if (Cell != null) return false; - if (!IoCManager.Resolve().TryGetComponent(cell.Uid, out (ItemComponent?) var _)) return false; - if (!IoCManager.Resolve().TryGetComponent(cell.Uid, out var cellComponent)) return false; + if (!IoCManager.Resolve().TryGetComponent((EntityUid) cell, out (ItemComponent?) var _)) return false; + if (!IoCManager.Resolve().TryGetComponent(cell, out var cellComponent)) return false; if (cellComponent.CellSize != SlotSize) return false; if (!_cellContainer.Insert(cell)) return false; //Dirty(); @@ -172,7 +172,7 @@ namespace Content.Server.PowerCell.Components SoundSystem.Play(Filter.Pvs(Owner), CellInsertSound.GetSound(), Owner, AudioHelpers.WithVariation(0.125f)); } - IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner.Uid, new PowerCellChangedEvent(false), false); + IoCManager.Resolve().EventBus.RaiseLocalEvent(Owner, new PowerCellChangedEvent(false), false); return true; } @@ -199,7 +199,7 @@ namespace Content.Server.PowerCell.Components }; } - var cell = IoCManager.Resolve().SpawnEntity(type, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var cell = IoCManager.Resolve().SpawnEntity(type, IoCManager.Resolve().GetComponent(Owner).Coordinates); _cellContainer.Insert(cell); } } diff --git a/Content.Server/PowerCell/PowerCellSystem.cs b/Content.Server/PowerCell/PowerCellSystem.cs index d5dbc0c86f..1d8e9ee306 100644 --- a/Content.Server/PowerCell/PowerCellSystem.cs +++ b/Content.Server/PowerCell/PowerCellSystem.cs @@ -31,7 +31,7 @@ namespace Content.Server.PowerCell !args.CanInteract || !component.ShowVerb || !component.HasCell || - !_actionBlockerSystem.CanPickup(args.User.Uid)) + !_actionBlockerSystem.CanPickup(args.User)) return; Verb verb = new(); @@ -47,12 +47,12 @@ namespace Content.Server.PowerCell !args.CanAccess || !args.CanInteract || component.HasCell || - !IoCManager.Resolve().HasComponent(args.Using.Uid) || - !_actionBlockerSystem.CanDrop(args.User.Uid)) + !IoCManager.Resolve().HasComponent(args.Using) || + !_actionBlockerSystem.CanDrop(args.User)) return; Verb verb = new(); - verb.Text = IoCManager.Resolve().GetComponent(args.Using.Uid).EntityName; + verb.Text = IoCManager.Resolve().GetComponent(args.Using).EntityName; verb.Category = VerbCategory.Insert; verb.Act = () => component.InsertCell(args.Using); args.Verbs.Add(verb); diff --git a/Content.Server/Projectiles/Components/HitscanComponent.cs b/Content.Server/Projectiles/Components/HitscanComponent.cs index d05395c993..547e35f5d3 100644 --- a/Content.Server/Projectiles/Components/HitscanComponent.cs +++ b/Content.Server/Projectiles/Components/HitscanComponent.cs @@ -56,12 +56,12 @@ namespace Content.Server.Projectiles.Components var mapManager = IoCManager.Resolve(); // We'll get the effects relative to the grid / map of the firer - var gridOrMap = IoCManager.Resolve().GetComponent(user.Uid).GridID == GridId.Invalid ? mapManager.GetMapEntityId(IoCManager.Resolve().GetComponent(user.Uid).MapID) : - mapManager.GetGrid(IoCManager.Resolve().GetComponent(user.Uid).GridID).GridEntityId; + var gridOrMap = IoCManager.Resolve().GetComponent(user).GridID == GridId.Invalid ? mapManager.GetMapEntityId(IoCManager.Resolve().GetComponent(user).MapID) : + mapManager.GetGrid(IoCManager.Resolve().GetComponent(user).GridID).GridEntityId; var parentXform = IoCManager.Resolve().GetComponent(gridOrMap); - var localCoordinates = new EntityCoordinates(gridOrMap, parentXform.InvWorldMatrix.Transform(IoCManager.Resolve().GetComponent(user.Uid).WorldPosition)); + var localCoordinates = new EntityCoordinates(gridOrMap, parentXform.InvWorldMatrix.Transform(IoCManager.Resolve().GetComponent(user).WorldPosition)); var localAngle = angle - parentXform.WorldRotation; var afterEffect = AfterEffects(localCoordinates, localAngle, distance, 1.0f); @@ -96,9 +96,9 @@ namespace Content.Server.Projectiles.Components Owner.SpawnTimer((int) _deathTime.TotalMilliseconds, () => { - if (!((!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted)) + if (!((!IoCManager.Resolve().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner).EntityLifeStage) >= EntityLifeStage.Deleted)) { - IoCManager.Resolve().DeleteEntity(Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) Owner); } }); } @@ -161,7 +161,7 @@ namespace Content.Server.Projectiles.Components EffectSprite = _impactFlash, Born = _startTime, DeathTime = _deathTime, - Coordinates = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates.Offset(angle.ToVec() * distance), + Coordinates = IoCManager.Resolve().GetComponent(Owner).Coordinates.Offset(angle.ToVec() * distance), //Rotated from east facing Rotation = (float) angle.FlipPositive(), Color = Vector4.Multiply(new Vector4(255, 255, 255, 750), ColorModifier), diff --git a/Content.Server/Projectiles/Components/ProjectileComponent.cs b/Content.Server/Projectiles/Components/ProjectileComponent.cs index d7aeeb3cc5..302dc9c1f6 100644 --- a/Content.Server/Projectiles/Components/ProjectileComponent.cs +++ b/Content.Server/Projectiles/Components/ProjectileComponent.cs @@ -34,7 +34,7 @@ namespace Content.Server.Projectiles.Components /// public void IgnoreEntity(IEntity shooter) { - Shooter = shooter.Uid; + Shooter = shooter; Dirty(); } diff --git a/Content.Server/Projectiles/ProjectileSystem.cs b/Content.Server/Projectiles/ProjectileSystem.cs index dda2442e11..9e5cc6b349 100644 --- a/Content.Server/Projectiles/ProjectileSystem.cs +++ b/Content.Server/Projectiles/ProjectileSystem.cs @@ -36,11 +36,11 @@ namespace Content.Server.Projectiles var otherEntity = args.OtherFixture.Body.Owner; - var coordinates = IoCManager.Resolve().GetComponent(args.OtherFixture.Body.Owner.Uid).Coordinates; + var coordinates = IoCManager.Resolve().GetComponent(args.OtherFixture.Body.Owner).Coordinates; var playerFilter = Filter.Pvs(coordinates); - if (!((!IoCManager.Resolve().EntityExists(otherEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(otherEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) && component.SoundHitSpecies != null && - IoCManager.Resolve().HasComponent(otherEntity.Uid)) + if (!((!IoCManager.Resolve().EntityExists(otherEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(otherEntity).EntityLifeStage) >= EntityLifeStage.Deleted) && component.SoundHitSpecies != null && + IoCManager.Resolve().HasComponent(otherEntity)) { SoundSystem.Play(playerFilter, component.SoundHitSpecies.GetSound(), coordinates); } @@ -52,9 +52,9 @@ namespace Content.Server.Projectiles SoundSystem.Play(playerFilter, soundHit, coordinates); } - if (!((!IoCManager.Resolve().EntityExists(otherEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(otherEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted)) + if (!((!IoCManager.Resolve().EntityExists(otherEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(otherEntity).EntityLifeStage) >= EntityLifeStage.Deleted)) { - var dmg = _damageableSystem.TryChangeDamage(otherEntity.Uid, component.Damage); + var dmg = _damageableSystem.TryChangeDamage(otherEntity, component.Damage); component.DamagedEntity = true; if (dmg is not null && EntityManager.TryGetEntity(component.Shooter, out var shooter)) @@ -63,7 +63,7 @@ namespace Content.Server.Projectiles } // Damaging it can delete it - if (!((!IoCManager.Resolve().EntityExists(otherEntity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(otherEntity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) && IoCManager.Resolve().TryGetComponent(otherEntity.Uid, out CameraRecoilComponent? recoilComponent)) + if (!((!IoCManager.Resolve().EntityExists(otherEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(otherEntity).EntityLifeStage) >= EntityLifeStage.Deleted) && IoCManager.Resolve().TryGetComponent(otherEntity, out CameraRecoilComponent? recoilComponent)) { var direction = args.OurFixture.Body.LinearVelocity.Normalized; recoilComponent.Kick(direction); @@ -83,7 +83,7 @@ namespace Content.Server.Projectiles if (component.TimeLeft <= 0) { - IoCManager.Resolve().DeleteEntity(component.Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) component.Owner); } } } diff --git a/Content.Server/Pulling/PullingSystem.cs b/Content.Server/Pulling/PullingSystem.cs index 21913431a1..a4cc18196d 100644 --- a/Content.Server/Pulling/PullingSystem.cs +++ b/Content.Server/Pulling/PullingSystem.cs @@ -41,7 +41,7 @@ namespace Content.Server.Pulling return; } - if (!IoCManager.Resolve().TryGetComponent(pulled.Uid, out SharedPullableComponent? pullable)) + if (!IoCManager.Resolve().TryGetComponent(pulled, out SharedPullableComponent? pullable)) { return; } diff --git a/Content.Server/RCD/Systems/RCDAmmoSystem.cs b/Content.Server/RCD/Systems/RCDAmmoSystem.cs index 897bde1805..c1eb63f5f1 100644 --- a/Content.Server/RCD/Systems/RCDAmmoSystem.cs +++ b/Content.Server/RCD/Systems/RCDAmmoSystem.cs @@ -29,7 +29,7 @@ namespace Content.Server.RCD.Systems if (args.Handled || !args.CanReach) return; - if (args.Target == null || !EntityManager.TryGetComponent(args.Target.Uid, out RCDComponent? rcdComponent)) + if (args.Target == null || !EntityManager.TryGetComponent(args.Target, out RCDComponent? rcdComponent)) return; if (rcdComponent.MaxAmmo - rcdComponent.CurrentAmmo < component.RefillAmmo) diff --git a/Content.Server/RCD/Systems/RCDSystem.cs b/Content.Server/RCD/Systems/RCDSystem.cs index 4dfc98cec0..2aa6fbebc3 100644 --- a/Content.Server/RCD/Systems/RCDSystem.cs +++ b/Content.Server/RCD/Systems/RCDSystem.cs @@ -121,7 +121,7 @@ namespace Content.Server.RCD.Systems IEntity? tempQualifier = args.Target; if (tempQualifier != null) { - IoCManager.Resolve().DeleteEntity(tempQualifier.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) tempQualifier); } } break; @@ -129,11 +129,11 @@ namespace Content.Server.RCD.Systems // thus we early return to avoid the tile set code. case RcdMode.Walls: var ent = EntityManager.SpawnEntity("WallSolid", mapGrid.GridTileToLocal(snapPos)); - IoCManager.Resolve().GetComponent(ent.Uid).LocalRotation = Angle.Zero; // Walls always need to point south. + IoCManager.Resolve().GetComponent(ent).LocalRotation = Angle.Zero; // Walls always need to point south. break; case RcdMode.Airlock: var airlock = EntityManager.SpawnEntity("Airlock", mapGrid.GridTileToLocal(snapPos)); - IoCManager.Resolve().GetComponent(airlock.Uid).LocalRotation = IoCManager.Resolve().GetComponent(rcd.Owner.Uid).LocalRotation; //Now apply icon smoothing. + IoCManager.Resolve().GetComponent(airlock).LocalRotation = IoCManager.Resolve().GetComponent(rcd.Owner).LocalRotation; //Now apply icon smoothing. break; default: args.Handled = true; diff --git a/Content.Server/Radiation/RadiationPulseComponent.cs b/Content.Server/Radiation/RadiationPulseComponent.cs index 9d5f8547a5..675ba5bd36 100644 --- a/Content.Server/Radiation/RadiationPulseComponent.cs +++ b/Content.Server/Radiation/RadiationPulseComponent.cs @@ -108,11 +108,11 @@ namespace Content.Server.Radiation public void Update(float frameTime) { - if (!Decay || (!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if (!Decay || (!IoCManager.Resolve().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner).EntityLifeStage) >= EntityLifeStage.Deleted) return; if (_duration <= 0f) - IoCManager.Resolve().QueueDeleteEntity(Owner.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) Owner); _duration -= frameTime; } diff --git a/Content.Server/Radiation/RadiationPulseSystem.cs b/Content.Server/Radiation/RadiationPulseSystem.cs index 9d1a68122b..eef664fcd4 100644 --- a/Content.Server/Radiation/RadiationPulseSystem.cs +++ b/Content.Server/Radiation/RadiationPulseSystem.cs @@ -33,16 +33,16 @@ namespace Content.Server.Radiation comp.Update(RadiationCooldown); var ent = comp.Owner; - if ((!IoCManager.Resolve().EntityExists(ent.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(ent.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) continue; + if ((!IoCManager.Resolve().EntityExists(ent) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(ent).EntityLifeStage) >= EntityLifeStage.Deleted) continue; - foreach (var entity in _lookup.GetEntitiesInRange(IoCManager.Resolve().GetComponent(ent.Uid).Coordinates, comp.Range)) + foreach (var entity in _lookup.GetEntitiesInRange(IoCManager.Resolve().GetComponent(ent).Coordinates, comp.Range)) { // For now at least still need this because it uses a list internally then returns and this may be deleted before we get to it. - if ((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) continue; + if ((!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Deleted) continue; // Note: Radiation is liable for a refactor (stinky Sloth coding a basic version when he did StationEvents) // so this ToArray doesn't really matter. - foreach (var radiation in IoCManager.Resolve().GetComponents(entity.Uid).ToArray()) + foreach (var radiation in IoCManager.Resolve().GetComponents(entity).ToArray()) { radiation.RadiationAct(RadiationCooldown, comp); } diff --git a/Content.Server/Radio/Components/HandheldRadioComponent.cs b/Content.Server/Radio/Components/HandheldRadioComponent.cs index b22cd467f8..79b6e3edb6 100644 --- a/Content.Server/Radio/Components/HandheldRadioComponent.cs +++ b/Content.Server/Radio/Components/HandheldRadioComponent.cs @@ -82,7 +82,7 @@ namespace Content.Server.Radio.Components public bool CanListen(string message, IEntity source) { return RadioOn && - Owner.InRangeUnobstructed(IoCManager.Resolve().GetComponent(source.Uid).Coordinates, range: ListenRange); + Owner.InRangeUnobstructed(IoCManager.Resolve().GetComponent(source).Coordinates, range: ListenRange); } public void Receive(string message, int channel, IEntity speaker) diff --git a/Content.Server/Recycling/Components/RecyclableComponent.cs b/Content.Server/Recycling/Components/RecyclableComponent.cs index ce932f73f8..431d5587c0 100644 --- a/Content.Server/Recycling/Components/RecyclableComponent.cs +++ b/Content.Server/Recycling/Components/RecyclableComponent.cs @@ -33,12 +33,12 @@ namespace Content.Server.Recycling.Components { for (var i = 0; i < Math.Max(_amount * efficiency, 1); i++) { - IoCManager.Resolve().SpawnEntity(_prototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + IoCManager.Resolve().SpawnEntity(_prototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); } } - IoCManager.Resolve().QueueDeleteEntity(Owner.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) Owner); } } } diff --git a/Content.Server/Recycling/Components/RecyclerComponent.cs b/Content.Server/Recycling/Components/RecyclerComponent.cs index eccc17f065..530a229212 100644 --- a/Content.Server/Recycling/Components/RecyclerComponent.cs +++ b/Content.Server/Recycling/Components/RecyclerComponent.cs @@ -41,7 +41,7 @@ namespace Content.Server.Recycling.Components private void Clean() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(RecyclerVisuals.Bloody, false); } @@ -49,7 +49,7 @@ namespace Content.Server.Recycling.Components SuicideKind ISuicideAct.Suicide(IEntity victim, IChatManager chat) { - if (IoCManager.Resolve().TryGetComponent(victim.Uid, out ActorComponent? actor) && actor.PlayerSession.ContentData()?.Mind is {} mind) + if (IoCManager.Resolve().TryGetComponent(victim, out ActorComponent? actor) && actor.PlayerSession.ContentData()?.Mind is {} mind) { EntitySystem.Get().OnGhostAttempt(mind, false); mind.OwnedEntity?.PopupMessage(Loc.GetString("recycler-component-suicide-message")); @@ -57,7 +57,7 @@ namespace Content.Server.Recycling.Components victim.PopupMessageOtherClients(Loc.GetString("recycler-component-suicide-message-others", ("victim",victim))); - if (IoCManager.Resolve().TryGetComponent(victim.Uid, out var body)) + if (IoCManager.Resolve().TryGetComponent(victim, out var body)) { body.Gib(true); } diff --git a/Content.Server/Recycling/RecyclerSystem.cs b/Content.Server/Recycling/RecyclerSystem.cs index 97c596e805..5e39f97dda 100644 --- a/Content.Server/Recycling/RecyclerSystem.cs +++ b/Content.Server/Recycling/RecyclerSystem.cs @@ -29,12 +29,12 @@ namespace Content.Server.Recycling // TODO: Prevent collision with recycled items // Can only recycle things that are recyclable... And also check the safety of the thing to recycle. - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out RecyclableComponent? recyclable) || !recyclable.Safe && component.Safe) return; + if (!IoCManager.Resolve().TryGetComponent(entity, out RecyclableComponent? recyclable) || !recyclable.Safe && component.Safe) return; // Mobs are a special case! if (CanGib(component, entity)) { - IoCManager.Resolve().GetComponent(entity.Uid).Gib(true); + IoCManager.Resolve().GetComponent(entity).Gib(true); Bloodstain(component); return; } @@ -45,13 +45,13 @@ namespace Content.Server.Recycling private bool CanGib(RecyclerComponent component, IEntity entity) { // We suppose this entity has a Recyclable component. - return IoCManager.Resolve().HasComponent(entity.Uid) && !component.Safe && - IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out ApcPowerReceiverComponent? receiver) && receiver.Powered; + return IoCManager.Resolve().HasComponent(entity) && !component.Safe && + IoCManager.Resolve().TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver) && receiver.Powered; } public void Bloodstain(RecyclerComponent component) { - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out AppearanceComponent? appearance)) { appearance.SetData(RecyclerVisuals.Bloody, true); } diff --git a/Content.Server/Repairable/RepairableSystem.cs b/Content.Server/Repairable/RepairableSystem.cs index 81f0834e34..4a5b675dbe 100644 --- a/Content.Server/Repairable/RepairableSystem.cs +++ b/Content.Server/Repairable/RepairableSystem.cs @@ -27,11 +27,11 @@ namespace Content.Server.Repairable public async void Repair(EntityUid uid, RepairableComponent component, InteractUsingEvent args) { // Only try repair the target if it is damaged - if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out DamageableComponent? damageable) || damageable.TotalDamage == 0) + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out DamageableComponent? damageable) || damageable.TotalDamage == 0) return; // Can the tool actually repair this, does it have enough fuel? - if (!await _toolSystem.UseTool(args.Used.Uid, args.User.Uid, uid, component.FuelCost, component.DoAfterDelay, component.QualityNeeded)) + if (!await _toolSystem.UseTool(args.Used, args.User, uid, component.FuelCost, component.DoAfterDelay, component.QualityNeeded)) return; // Repair all damage diff --git a/Content.Server/Research/Components/ResearchClientComponent.cs b/Content.Server/Research/Components/ResearchClientComponent.cs index a852a05876..376725c5ec 100644 --- a/Content.Server/Research/Components/ResearchClientComponent.cs +++ b/Content.Server/Research/Components/ResearchClientComponent.cs @@ -57,7 +57,7 @@ namespace Content.Server.Research.Components void IActivate.Activate(ActivateEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) return; OpenUserInterface(actor.PlayerSession); diff --git a/Content.Server/Research/Components/ResearchConsoleComponent.cs b/Content.Server/Research/Components/ResearchConsoleComponent.cs index 4e33bc4f76..46ac37cb7c 100644 --- a/Content.Server/Research/Components/ResearchConsoleComponent.cs +++ b/Content.Server/Research/Components/ResearchConsoleComponent.cs @@ -27,7 +27,7 @@ namespace Content.Server.Research.Components [DataField("sound")] private SoundSpecifier _soundCollectionName = new SoundCollectionSpecifier("keyboard"); - [ViewVariables] private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) || receiver.Powered; + [ViewVariables] private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered; [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ResearchConsoleUiKey.Key); @@ -47,9 +47,9 @@ namespace Content.Server.Research.Components private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message) { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out TechnologyDatabaseComponent? database)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out TechnologyDatabaseComponent? database)) return; - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out ResearchClientComponent? client)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out ResearchClientComponent? client)) return; if (!Powered) return; @@ -90,7 +90,7 @@ namespace Content.Server.Research.Components private ResearchConsoleBoundInterfaceState GetNewUiState() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out ResearchClientComponent? client) || + if (!IoCManager.Resolve().TryGetComponent(Owner, out ResearchClientComponent? client) || client.Server == null) return new ResearchConsoleBoundInterfaceState(default, default); @@ -111,7 +111,7 @@ namespace Content.Server.Research.Components void IActivate.Activate(ActivateEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) return; if (!Powered) { diff --git a/Content.Server/Research/Components/ResearchPointSourceComponent.cs b/Content.Server/Research/Components/ResearchPointSourceComponent.cs index 9de840fce5..bb32eadb66 100644 --- a/Content.Server/Research/Components/ResearchPointSourceComponent.cs +++ b/Content.Server/Research/Components/ResearchPointSourceComponent.cs @@ -43,7 +43,7 @@ namespace Content.Server.Research.Components protected override void Initialize() { base.Initialize(); - IoCManager.Resolve().TryGetComponent(Owner.Uid, out _powerReceiver); + IoCManager.Resolve().TryGetComponent(Owner, out _powerReceiver); } } } diff --git a/Content.Server/Research/Components/ResearchServerComponent.cs b/Content.Server/Research/Components/ResearchServerComponent.cs index d43d60094f..5f37de70c5 100644 --- a/Content.Server/Research/Components/ResearchServerComponent.cs +++ b/Content.Server/Research/Components/ResearchServerComponent.cs @@ -74,7 +74,7 @@ namespace Content.Server.Research.Components Id = ServerCount++; EntitySystem.Get()?.RegisterServer(this); Database = Owner.EnsureComponent(); - IoCManager.Resolve().TryGetComponent(Owner.Uid, out _powerReceiver); + IoCManager.Resolve().TryGetComponent(Owner, out _powerReceiver); } /// diff --git a/Content.Server/Research/Components/TechnologyDatabaseComponent.cs b/Content.Server/Research/Components/TechnologyDatabaseComponent.cs index 764bad415e..00ac1ad2e6 100644 --- a/Content.Server/Research/Components/TechnologyDatabaseComponent.cs +++ b/Content.Server/Research/Components/TechnologyDatabaseComponent.cs @@ -42,7 +42,7 @@ namespace Content.Server.Research.Components /// Whether it could sync or not public bool SyncWithServer() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out ResearchClientComponent? client)) return false; + if (!IoCManager.Resolve().TryGetComponent(Owner, out ResearchClientComponent? client)) return false; if (client.Server?.Database == null) return false; Sync(client.Server.Database); diff --git a/Content.Server/Rotatable/RotatableSystem.cs b/Content.Server/Rotatable/RotatableSystem.cs index 6fa8269b48..aaa4b54adc 100644 --- a/Content.Server/Rotatable/RotatableSystem.cs +++ b/Content.Server/Rotatable/RotatableSystem.cs @@ -39,12 +39,12 @@ namespace Content.Server.Rotatable // Check if the object is anchored, and whether we are still allowed to rotate it. if (!component.RotateWhileAnchored && - IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out IPhysBody? physics) && + IoCManager.Resolve().TryGetComponent(component.Owner, out IPhysBody? physics) && physics.BodyType == BodyType.Static) return; Verb resetRotation = new(); - resetRotation.Act = () => IoCManager.Resolve().GetComponent(component.Owner.Uid).LocalRotation = Angle.Zero; + resetRotation.Act = () => IoCManager.Resolve().GetComponent(component.Owner).LocalRotation = Angle.Zero; resetRotation.Category = VerbCategory.Rotate; resetRotation.IconTexture = "/Textures/Interface/VerbIcons/refresh.svg.192dpi.png"; resetRotation.Text = "Reset"; @@ -54,7 +54,7 @@ namespace Content.Server.Rotatable // rotate clockwise Verb rotateCW = new(); - rotateCW.Act = () => IoCManager.Resolve().GetComponent(component.Owner.Uid).LocalRotation += Angle.FromDegrees(-90); + rotateCW.Act = () => IoCManager.Resolve().GetComponent(component.Owner).LocalRotation += Angle.FromDegrees(-90); rotateCW.Category = VerbCategory.Rotate; rotateCW.IconTexture = "/Textures/Interface/VerbIcons/rotate_cw.svg.192dpi.png"; rotateCW.Priority = -1; @@ -63,7 +63,7 @@ namespace Content.Server.Rotatable // rotate counter-clockwise Verb rotateCCW = new(); - rotateCCW.Act = () => IoCManager.Resolve().GetComponent(component.Owner.Uid).LocalRotation += Angle.FromDegrees(90); + rotateCCW.Act = () => IoCManager.Resolve().GetComponent(component.Owner).LocalRotation += Angle.FromDegrees(90); rotateCCW.Category = VerbCategory.Rotate; rotateCCW.IconTexture = "/Textures/Interface/VerbIcons/rotate_ccw.svg.192dpi.png"; rotateCCW.Priority = 0; @@ -76,19 +76,19 @@ namespace Content.Server.Rotatable /// public static void TryFlip(FlippableComponent component, IEntity user) { - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out IPhysBody? physics) && + if (IoCManager.Resolve().TryGetComponent(component.Owner, out IPhysBody? physics) && physics.BodyType == BodyType.Static) { component.Owner.PopupMessage(user, Loc.GetString("flippable-component-try-flip-is-stuck")); return; } - var oldTransform = IoCManager.Resolve().GetComponent(component.Owner.Uid); + var oldTransform = IoCManager.Resolve().GetComponent(component.Owner); var entity = IoCManager.Resolve().SpawnEntity(component.MirrorEntity, oldTransform.Coordinates); - var newTransform = IoCManager.Resolve().GetComponent(entity.Uid); + var newTransform = IoCManager.Resolve().GetComponent(entity); newTransform.LocalRotation = oldTransform.LocalRotation; newTransform.Anchored = false; - IoCManager.Resolve().DeleteEntity(component.Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) component.Owner); } } } diff --git a/Content.Server/Sandbox/Commands/ColorNetworkCommand.cs b/Content.Server/Sandbox/Commands/ColorNetworkCommand.cs index e7737fc54f..7ff0988c7c 100644 --- a/Content.Server/Sandbox/Commands/ColorNetworkCommand.cs +++ b/Content.Server/Sandbox/Commands/ColorNetworkCommand.cs @@ -57,7 +57,7 @@ namespace Content.Server.Sandbox.Commands } var target = entityManager.GetEntity(eUid); - if (!IoCManager.Resolve().TryGetComponent(target.Uid, out NodeContainerComponent? nodeContainerComponent)) + if (!IoCManager.Resolve().TryGetComponent(target, out NodeContainerComponent? nodeContainerComponent)) { shell.WriteLine(Loc.GetString("shell-entity-is-not-node-container")); return; @@ -87,9 +87,9 @@ namespace Content.Server.Sandbox.Commands foreach (var x in group.Nodes) { - if (!IoCManager.Resolve().TryGetComponent(x.Owner.Uid, out var atmosPipeColorComponent)) continue; + if (!IoCManager.Resolve().TryGetComponent(x.Owner, out var atmosPipeColorComponent)) continue; - EntitySystem.Get().SetColor(x.Owner.Uid, atmosPipeColorComponent, color); + EntitySystem.Get().SetColor(x.Owner, atmosPipeColorComponent, color); } } } diff --git a/Content.Server/Sandbox/SandboxManager.cs b/Content.Server/Sandbox/SandboxManager.cs index 6025742e26..e5b192f8e8 100644 --- a/Content.Server/Sandbox/SandboxManager.cs +++ b/Content.Server/Sandbox/SandboxManager.cs @@ -124,22 +124,22 @@ namespace Content.Server.Sandbox .EnumeratePrototypes() .Select(p => p.ID).ToArray(); - if (IoCManager.Resolve().TryGetComponent(player.AttachedEntity.Uid, out InventoryComponent? inv) + if (IoCManager.Resolve().TryGetComponent(player.AttachedEntity, out InventoryComponent? inv) && inv.TryGetSlotItem(Slots.IDCARD, out ItemComponent? wornItem)) { - if (IoCManager.Resolve().HasComponent(wornItem.Owner.Uid)) + if (IoCManager.Resolve().HasComponent(wornItem.Owner)) { UpgradeId(wornItem.Owner); } - else if (IoCManager.Resolve().TryGetComponent(wornItem.Owner.Uid, out PDAComponent? pda)) + else if (IoCManager.Resolve().TryGetComponent(wornItem.Owner, out PDAComponent? pda)) { if (pda.ContainedID == null) { var newID = CreateFreshId(); - if (IoCManager.Resolve().TryGetComponent(pda.Owner.Uid, out ItemSlotsComponent? itemSlots)) + if (IoCManager.Resolve().TryGetComponent(pda.Owner, out ItemSlotsComponent? itemSlots)) { _entityManager.EntitySysManager.GetEntitySystem(). - TryInsert(wornItem.Owner.Uid, pda.IdSlot, newID); + TryInsert(wornItem.Owner, pda.IdSlot, newID); } } else @@ -148,21 +148,21 @@ namespace Content.Server.Sandbox } } } - else if (IoCManager.Resolve().TryGetComponent(player.AttachedEntity.Uid, out var hands)) + else if (IoCManager.Resolve().TryGetComponent(player.AttachedEntity, out var hands)) { var card = CreateFreshId(); - if (!IoCManager.Resolve().TryGetComponent(player.AttachedEntity.Uid, out inv) || !inv.Equip(Slots.IDCARD, card)) + if (!IoCManager.Resolve().TryGetComponent(player.AttachedEntity, out inv) || !inv.Equip(Slots.IDCARD, card)) { - hands.PutInHandOrDrop(IoCManager.Resolve().GetComponent(card.Uid)); + hands.PutInHandOrDrop(IoCManager.Resolve().GetComponent(card)); } } void UpgradeId(IEntity id) { var accessSystem = EntitySystem.Get(); - accessSystem.TrySetTags(id.Uid, allAccess); + accessSystem.TrySetTags(id, allAccess); - if (IoCManager.Resolve().TryGetComponent(id.Uid, out SpriteComponent? sprite)) + if (IoCManager.Resolve().TryGetComponent(id, out SpriteComponent? sprite)) { sprite.LayerSetState(0, "gold"); } @@ -170,10 +170,10 @@ namespace Content.Server.Sandbox IEntity CreateFreshId() { - var card = _entityManager.SpawnEntity("CaptainIDCard", IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).Coordinates); + var card = _entityManager.SpawnEntity("CaptainIDCard", IoCManager.Resolve().GetComponent(player.AttachedEntity).Coordinates); UpgradeId(card); - IoCManager.Resolve().GetComponent(card.Uid).FullName = IoCManager.Resolve().GetComponent(player.AttachedEntity.Uid).EntityName; + IoCManager.Resolve().GetComponent(card).FullName = IoCManager.Resolve().GetComponent(player.AttachedEntity).EntityName; return card; } } diff --git a/Content.Server/Security/Systems/DeployableBarrierSystem.cs b/Content.Server/Security/Systems/DeployableBarrierSystem.cs index 02fedccb1f..316a324d30 100644 --- a/Content.Server/Security/Systems/DeployableBarrierSystem.cs +++ b/Content.Server/Security/Systems/DeployableBarrierSystem.cs @@ -19,7 +19,7 @@ namespace Content.Server.Security.Systems private void OnStartup(EntityUid uid, DeployableBarrierComponent component, ComponentStartup args) { - if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out LockComponent? lockComponent)) + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out LockComponent? lockComponent)) return; ToggleBarrierDeploy(component, lockComponent.Locked); @@ -32,15 +32,15 @@ namespace Content.Server.Security.Systems private void ToggleBarrierDeploy(DeployableBarrierComponent component, bool isDeployed) { - IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored = isDeployed; + IoCManager.Resolve().GetComponent(component.Owner).Anchored = isDeployed; - if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out AppearanceComponent? appearanceComponent)) + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out AppearanceComponent? appearanceComponent)) return; var state = isDeployed ? DeployableBarrierState.Deployed : DeployableBarrierState.Idle; appearanceComponent.SetData(DeployableBarrierVisuals.State, state); - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out PointLightComponent? light)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out PointLightComponent? light)) light.Enabled = isDeployed; } } diff --git a/Content.Server/Shuttles/EntitySystems/ShuttleConsoleSystem.cs b/Content.Server/Shuttles/EntitySystems/ShuttleConsoleSystem.cs index cbeb0c4e31..f29cc8fbf9 100644 --- a/Content.Server/Shuttles/EntitySystems/ShuttleConsoleSystem.cs +++ b/Content.Server/Shuttles/EntitySystems/ShuttleConsoleSystem.cs @@ -96,7 +96,7 @@ namespace Content.Server.Shuttles.EntitySystems return; } - var pilotComponent = EntityManager.EnsureComponent(args.User.Uid); + var pilotComponent = EntityManager.EnsureComponent((EntityUid) args.User); if (!component.Enabled) { @@ -132,8 +132,8 @@ namespace Content.Server.Shuttles.EntitySystems public void AddPilot(IEntity entity, ShuttleConsoleComponent component) { - if (!_blocker.CanInteract(entity.Uid) || - !IoCManager.Resolve().TryGetComponent(entity.Uid, out PilotComponent? pilotComponent) || + if (!_blocker.CanInteract(entity) || + !IoCManager.Resolve().TryGetComponent(entity, out PilotComponent? pilotComponent) || component.SubscribedPilots.Contains(pilotComponent)) { return; @@ -141,14 +141,14 @@ namespace Content.Server.Shuttles.EntitySystems component.SubscribedPilots.Add(pilotComponent); - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ServerAlertsComponent? alertsComponent)) + if (IoCManager.Resolve().TryGetComponent(entity, out ServerAlertsComponent? alertsComponent)) { alertsComponent.ShowAlert(AlertType.PilotingShuttle); } entity.PopupMessage(Loc.GetString("shuttle-pilot-start")); pilotComponent.Console = component; - pilotComponent.Position = EntityManager.GetComponent(entity.Uid).Coordinates; + pilotComponent.Position = EntityManager.GetComponent(entity).Coordinates; pilotComponent.Dirty(); } @@ -163,7 +163,7 @@ namespace Content.Server.Shuttles.EntitySystems if (!helmsman.SubscribedPilots.Remove(pilotComponent)) return; - if (IoCManager.Resolve().TryGetComponent(pilotComponent.Owner.Uid, out ServerAlertsComponent? alertsComponent)) + if (IoCManager.Resolve().TryGetComponent(pilotComponent.Owner, out ServerAlertsComponent? alertsComponent)) { alertsComponent.ClearAlert(AlertType.PilotingShuttle); } @@ -171,12 +171,12 @@ namespace Content.Server.Shuttles.EntitySystems pilotComponent.Owner.PopupMessage(Loc.GetString("shuttle-pilot-end")); if (pilotComponent.LifeStage < ComponentLifeStage.Stopping) - EntityManager.RemoveComponent(pilotComponent.Owner.Uid); + EntityManager.RemoveComponent(pilotComponent.Owner); } public void RemovePilot(IEntity entity) { - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out PilotComponent? pilotComponent)) return; + if (!IoCManager.Resolve().TryGetComponent(entity, out PilotComponent? pilotComponent)) return; RemovePilot(pilotComponent); } diff --git a/Content.Server/Shuttles/EntitySystems/ShuttleSystem.cs b/Content.Server/Shuttles/EntitySystems/ShuttleSystem.cs index 246cd3064b..af98cf6c03 100644 --- a/Content.Server/Shuttles/EntitySystems/ShuttleSystem.cs +++ b/Content.Server/Shuttles/EntitySystems/ShuttleSystem.cs @@ -57,12 +57,12 @@ namespace Content.Server.Shuttles.EntitySystems private void OnShuttleStartup(EntityUid uid, ShuttleComponent component, ComponentStartup args) { - if (!IoCManager.Resolve().HasComponent(component.Owner.Uid)) + if (!IoCManager.Resolve().HasComponent(component.Owner)) { return; } - if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out PhysicsComponent? physicsComponent)) + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out PhysicsComponent? physicsComponent)) { return; } @@ -75,7 +75,7 @@ namespace Content.Server.Shuttles.EntitySystems public void Toggle(ShuttleComponent component) { - if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out PhysicsComponent? physicsComponent)) return; + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out PhysicsComponent? physicsComponent)) return; component.Enabled = !component.Enabled; @@ -111,7 +111,7 @@ namespace Content.Server.Shuttles.EntitySystems // None of the below is necessary for any cleanup if we're just deleting. if (EntityManager.GetComponent(uid).EntityLifeStage >= EntityLifeStage.Terminating) return; - if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out PhysicsComponent? physicsComponent)) + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out PhysicsComponent? physicsComponent)) { return; } diff --git a/Content.Server/Singularity/Components/ContainmentFieldConnection.cs b/Content.Server/Singularity/Components/ContainmentFieldConnection.cs index c9842e0737..241e13d8a5 100644 --- a/Content.Server/Singularity/Components/ContainmentFieldConnection.cs +++ b/Content.Server/Singularity/Components/ContainmentFieldConnection.cs @@ -36,8 +36,8 @@ namespace Content.Server.Singularity.Components Generator2 = generator2; //generateFields - var pos1 = IoCManager.Resolve().GetComponent(generator1.Owner.Uid).Coordinates; - var pos2 = IoCManager.Resolve().GetComponent(generator2.Owner.Uid).Coordinates; + var pos1 = IoCManager.Resolve().GetComponent(generator1.Owner).Coordinates; + var pos2 = IoCManager.Resolve().GetComponent(generator2.Owner).Coordinates; if (pos1 == pos2) { Dispose(); @@ -54,15 +54,15 @@ namespace Content.Server.Singularity.Components { var currentCoords = pos1.Offset(currentOffset); var newEnt = entityManager.SpawnEntity("ContainmentField", currentCoords); - if (!IoCManager.Resolve().TryGetComponent(newEnt.Uid, out var containmentFieldComponent)) + if (!IoCManager.Resolve().TryGetComponent(newEnt, out var containmentFieldComponent)) { Logger.Error("While creating Fields in ContainmentFieldConnection, a ContainmentField without a ContainmentFieldComponent was created. Deleting newly spawned ContainmentField..."); - IoCManager.Resolve().DeleteEntity(newEnt.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) newEnt); continue; } containmentFieldComponent.Parent = this; - IoCManager.Resolve().GetComponent(newEnt.Uid).WorldRotation = IoCManager.Resolve().GetComponent(generator1.Owner.Uid).WorldRotation + dirVec.ToWorldAngle(); + IoCManager.Resolve().GetComponent(newEnt).WorldRotation = IoCManager.Resolve().GetComponent(generator1.Owner).WorldRotation + dirVec.ToWorldAngle(); _fields.Add(newEnt); currentOffset += dirVec; @@ -75,7 +75,7 @@ namespace Content.Server.Singularity.Components public bool CanRepell(IEntity toRepell) { var powerNeeded = 1; - if (IoCManager.Resolve().TryGetComponent(toRepell.Uid, out var singularityComponent)) + if (IoCManager.Resolve().TryGetComponent(toRepell, out var singularityComponent)) { powerNeeded += 2*singularityComponent.Level; } @@ -88,7 +88,7 @@ namespace Content.Server.Singularity.Components _powerDecreaseCancellationTokenSource.Cancel(); foreach (var field in _fields) { - IoCManager.Resolve().DeleteEntity(field.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) field); } _fields.Clear(); diff --git a/Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs b/Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs index 8673dd1f88..e1a0088548 100644 --- a/Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs +++ b/Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs @@ -96,9 +96,9 @@ namespace Content.Server.Singularity.Components { if (_connection1?.Item1 == direction || _connection2?.Item1 == direction) continue; - var dirVec = IoCManager.Resolve().GetComponent(Owner.Uid).WorldRotation.RotateVec(direction.ToVec()); - var ray = new CollisionRay(IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition, dirVec, (int) CollisionGroup.MobMask); - var rawRayCastResults = EntitySystem.Get().IntersectRay(IoCManager.Resolve().GetComponent(Owner.Uid).MapID, ray, 4.5f, Owner, false); + var dirVec = IoCManager.Resolve().GetComponent(Owner).WorldRotation.RotateVec(direction.ToVec()); + var ray = new CollisionRay(IoCManager.Resolve().GetComponent(Owner).WorldPosition, dirVec, (int) CollisionGroup.MobMask); + var rawRayCastResults = EntitySystem.Get().IntersectRay(IoCManager.Resolve().GetComponent(Owner).MapID, ray, 4.5f, Owner, false); var rayCastResults = rawRayCastResults as RayCastResults[] ?? rawRayCastResults.ToArray(); if(!rayCastResults.Any()) continue; @@ -114,11 +114,11 @@ namespace Content.Server.Singularity.Components } if(closestResult == null) continue; var ent = closestResult.Value.HitEntity; - if (!IoCManager.Resolve().TryGetComponent(ent.Uid, out var fieldGeneratorComponent) || + if (!IoCManager.Resolve().TryGetComponent(ent, out var fieldGeneratorComponent) || fieldGeneratorComponent.Owner == Owner || !fieldGeneratorComponent.HasFreeConnections() || IsConnectedWith(fieldGeneratorComponent) || - !IoCManager.Resolve().TryGetComponent(ent.Uid, out var collidableComponent) || + !IoCManager.Resolve().TryGetComponent(ent, out var collidableComponent) || collidableComponent.BodyType != BodyType.Static) { continue; diff --git a/Content.Server/Singularity/Components/RadiationCollectorComponent.cs b/Content.Server/Singularity/Components/RadiationCollectorComponent.cs index 4c43d8dfdd..b1c70ea84d 100644 --- a/Content.Server/Singularity/Components/RadiationCollectorComponent.cs +++ b/Content.Server/Singularity/Components/RadiationCollectorComponent.cs @@ -74,7 +74,7 @@ namespace Content.Server.Singularity.Components protected void SetAppearance(RadiationCollectorVisualState state) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var appearance)) { appearance.SetData(RadiationCollectorVisuals.VisualState, state); } diff --git a/Content.Server/Singularity/Components/ServerSingularityComponent.cs b/Content.Server/Singularity/Components/ServerSingularityComponent.cs index 42f591b45b..b9e1a57448 100644 --- a/Content.Server/Singularity/Components/ServerSingularityComponent.cs +++ b/Content.Server/Singularity/Components/ServerSingularityComponent.cs @@ -32,7 +32,7 @@ namespace Content.Server.Singularity.Components _energy = value; if (_energy <= 0) { - IoCManager.Resolve().DeleteEntity(Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) Owner); return; } @@ -97,7 +97,7 @@ namespace Content.Server.Singularity.Components protected override void Shutdown() { base.Shutdown(); - SoundSystem.Play(Filter.Pvs(Owner), _singularityCollapsingSound.GetSound(), IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + SoundSystem.Play(Filter.Pvs(Owner), _singularityCollapsingSound.GetSound(), IoCManager.Resolve().GetComponent(Owner).Coordinates); } } } diff --git a/Content.Server/Singularity/Components/SingularityGenerator.cs b/Content.Server/Singularity/Components/SingularityGenerator.cs index b2deb0a017..91a281d9a6 100644 --- a/Content.Server/Singularity/Components/SingularityGenerator.cs +++ b/Content.Server/Singularity/Components/SingularityGenerator.cs @@ -22,7 +22,7 @@ namespace Content.Server.Singularity.Components if (_power > 15) { var entityManager = IoCManager.Resolve(); - entityManager.SpawnEntity("Singularity", IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + entityManager.SpawnEntity("Singularity", IoCManager.Resolve().GetComponent(Owner).Coordinates); //dont delete ourselves, just wait to get eaten } } diff --git a/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs b/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs index 3e10672535..a961df7d48 100644 --- a/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs +++ b/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs @@ -22,7 +22,7 @@ namespace Content.Server.Singularity.EntitySystems private void HandleParticleCollide(EntityUid uid, ParticleProjectileComponent component, StartCollideEvent args) { - if (IoCManager.Resolve().TryGetComponent(args.OtherFixture.Body.Owner.Uid, out var singularityGeneratorComponent)) + if (IoCManager.Resolve().TryGetComponent(args.OtherFixture.Body.Owner, out var singularityGeneratorComponent)) { singularityGeneratorComponent.Power += component.State switch { diff --git a/Content.Server/Singularity/EntitySystems/EmitterSystem.cs b/Content.Server/Singularity/EntitySystems/EmitterSystem.cs index 9b97acbcc7..821be6c9c4 100644 --- a/Content.Server/Singularity/EntitySystems/EmitterSystem.cs +++ b/Content.Server/Singularity/EntitySystems/EmitterSystem.cs @@ -44,7 +44,7 @@ namespace Content.Server.Singularity.EntitySystems return; } - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out PhysicsComponent? phys) && phys.BodyType == BodyType.Static) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out PhysicsComponent? phys) && phys.BodyType == BodyType.Static) { if (!component.IsOn) { @@ -166,9 +166,9 @@ namespace Content.Server.Singularity.EntitySystems private void Fire(EmitterComponent component) { - var projectile = IoCManager.Resolve().SpawnEntity(component.BoltType, IoCManager.Resolve().GetComponent(component.Owner.Uid).Coordinates); + var projectile = IoCManager.Resolve().SpawnEntity(component.BoltType, IoCManager.Resolve().GetComponent(component.Owner).Coordinates); - if (!IoCManager.Resolve().TryGetComponent(projectile.Uid, out var physicsComponent)) + if (!IoCManager.Resolve().TryGetComponent(projectile, out var physicsComponent)) { Logger.Error("Emitter tried firing a bolt, but it was spawned without a PhysicsComponent"); return; @@ -176,7 +176,7 @@ namespace Content.Server.Singularity.EntitySystems physicsComponent.BodyStatus = BodyStatus.InAir; - if (!IoCManager.Resolve().TryGetComponent(projectile.Uid, out var projectileComponent)) + if (!IoCManager.Resolve().TryGetComponent(projectile, out var projectileComponent)) { Logger.Error("Emitter tried firing a bolt, but it was spawned without a ProjectileComponent"); return; @@ -185,11 +185,11 @@ namespace Content.Server.Singularity.EntitySystems projectileComponent.IgnoreEntity(component.Owner); physicsComponent - .LinearVelocity = IoCManager.Resolve().GetComponent(component.Owner.Uid).WorldRotation.ToWorldVec() * 20f; - IoCManager.Resolve().GetComponent(projectile.Uid).WorldRotation = IoCManager.Resolve().GetComponent(component.Owner.Uid).WorldRotation; + .LinearVelocity = IoCManager.Resolve().GetComponent(component.Owner).WorldRotation.ToWorldVec() * 20f; + IoCManager.Resolve().GetComponent(projectile).WorldRotation = IoCManager.Resolve().GetComponent(component.Owner).WorldRotation; // TODO: Move to projectile's code. - Timer.Spawn(3000, () => IoCManager.Resolve().DeleteEntity(projectile.Uid)); + Timer.Spawn(3000, () => IoCManager.Resolve().DeleteEntity((EntityUid) projectile)); SoundSystem.Play(Filter.Pvs(component.Owner), component.FireSound.GetSound(), component.Owner, AudioHelpers.WithVariation(EmitterComponent.Variation).WithVolume(EmitterComponent.Volume).WithMaxDistance(EmitterComponent.Distance)); diff --git a/Content.Server/Singularity/EntitySystems/SingularitySystem.cs b/Content.Server/Singularity/EntitySystems/SingularitySystem.cs index c264ba838c..c8ae54634b 100644 --- a/Content.Server/Singularity/EntitySystems/SingularitySystem.cs +++ b/Content.Server/Singularity/EntitySystems/SingularitySystem.cs @@ -82,7 +82,7 @@ namespace Content.Server.Singularity.EntitySystems { if (component.BeingDeletedByAnotherSingularity) return; - var worldPos = IoCManager.Resolve().GetComponent(component.Owner.Uid).WorldPosition; + var worldPos = IoCManager.Resolve().GetComponent(component.Owner).WorldPosition; DestroyEntities(component, worldPos); DestroyTiles(component, worldPos); PullEntities(component, worldPos); @@ -102,10 +102,10 @@ namespace Content.Server.Singularity.EntitySystems private bool CanDestroy(SharedSingularityComponent component, IEntity entity) { return entity == component.Owner || - IoCManager.Resolve().HasComponent(entity.Uid) || - IoCManager.Resolve().HasComponent(entity.Uid) || - IoCManager.Resolve().HasComponent(entity.Uid) || - IoCManager.Resolve().HasComponent(entity.Uid); + IoCManager.Resolve().HasComponent(entity) || + IoCManager.Resolve().HasComponent(entity) || + IoCManager.Resolve().HasComponent(entity) || + IoCManager.Resolve().HasComponent(entity); } private void HandleDestroy(ServerSingularityComponent component, IEntity entity) @@ -114,7 +114,7 @@ namespace Content.Server.Singularity.EntitySystems if (CanDestroy(component, entity)) return; // Singularity priority management / etc. - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out var otherSingulo)) + if (IoCManager.Resolve().TryGetComponent(entity, out var otherSingulo)) { // MERGE if (!otherSingulo.BeingDeletedByAnotherSingularity) @@ -125,9 +125,9 @@ namespace Content.Server.Singularity.EntitySystems otherSingulo.BeingDeletedByAnotherSingularity = true; } - IoCManager.Resolve().QueueDeleteEntity(entity.Uid); + IoCManager.Resolve().QueueDeleteEntity((EntityUid) entity); - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out var singuloFood)) + if (IoCManager.Resolve().TryGetComponent(entity, out var singuloFood)) component.Energy += singuloFood.Energy; else component.Energy++; @@ -141,7 +141,7 @@ namespace Content.Server.Singularity.EntitySystems // The reason we don't /just/ use collision is because we'll be deleting stuff that may not necessarily have physics (e.g. carpets). var destroyRange = DestroyTileRange(component); - foreach (var entity in _lookup.GetEntitiesInRange(IoCManager.Resolve().GetComponent(component.Owner.Uid).MapID, worldPos, destroyRange)) + foreach (var entity in _lookup.GetEntitiesInRange(IoCManager.Resolve().GetComponent(component.Owner).MapID, worldPos, destroyRange)) { HandleDestroy(component, entity); } @@ -149,9 +149,9 @@ namespace Content.Server.Singularity.EntitySystems private bool CanPull(IEntity entity) { - return !(IoCManager.Resolve().HasComponent(entity.Uid) || - IoCManager.Resolve().HasComponent(entity.Uid) || - IoCManager.Resolve().HasComponent(entity.Uid) || + return !(IoCManager.Resolve().HasComponent(entity) || + IoCManager.Resolve().HasComponent(entity) || + IoCManager.Resolve().HasComponent(entity) || entity.IsInContainer()); } @@ -162,16 +162,16 @@ namespace Content.Server.Singularity.EntitySystems var pullRange = PullRange(component); var destroyRange = DestroyTileRange(component); - foreach (var entity in _lookup.GetEntitiesInRange(IoCManager.Resolve().GetComponent(component.Owner.Uid).MapID, worldPos, pullRange)) + foreach (var entity in _lookup.GetEntitiesInRange(IoCManager.Resolve().GetComponent(component.Owner).MapID, worldPos, pullRange)) { // I tried having it so level 6 can de-anchor. BAD IDEA, MASSIVE LAG. if (entity == component.Owner || - !IoCManager.Resolve().TryGetComponent(entity.Uid, out var collidableComponent) || + !IoCManager.Resolve().TryGetComponent(entity, out var collidableComponent) || collidableComponent.BodyType == BodyType.Static) continue; if (!CanPull(entity)) continue; - var vec = worldPos - IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition; + var vec = worldPos - IoCManager.Resolve().GetComponent(entity).WorldPosition; if (vec.Length < destroyRange - 0.01f) continue; @@ -192,7 +192,7 @@ namespace Content.Server.Singularity.EntitySystems var circle = new Circle(worldPos, radius); var box = new Box2(worldPos - radius, worldPos + radius); - foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve().GetComponent(component.Owner.Uid).MapID, box)) + foreach (var grid in _mapManager.FindGridsIntersecting(IoCManager.Resolve().GetComponent(component.Owner).MapID, box)) { foreach (var tile in grid.GetTilesIntersecting(circle)) { diff --git a/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs b/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs index 17e876c443..d44d00949b 100644 --- a/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs +++ b/Content.Server/Solar/EntitySystems/PowerSolarSystem.cs @@ -115,7 +115,7 @@ namespace Content.Server.Solar.EntitySystems foreach (var panel in EntityManager.EntityQuery()) { TotalPanelPower += panel.MaxSupply * panel.Coverage; - IoCManager.Resolve().GetComponent(panel.Owner.Uid).WorldRotation = TargetPanelRotation; + IoCManager.Resolve().GetComponent(panel.Owner).WorldRotation = TargetPanelRotation; _updateQueue.Enqueue(panel); } } @@ -136,7 +136,7 @@ namespace Content.Server.Solar.EntitySystems // directly downwards (abs(theta) = pi) = coverage -1 // as TowardsSun + = CCW, // panelRelativeToSun should - = CW - var panelRelativeToSun = IoCManager.Resolve().GetComponent(entity.Uid).WorldRotation - TowardsSun; + var panelRelativeToSun = IoCManager.Resolve().GetComponent(entity).WorldRotation - TowardsSun; // essentially, given cos = X & sin = Y & Y is 'downwards', // then for the first 90 degrees of rotation in either direction, // this plots the lower-right quadrant of a circle. @@ -154,12 +154,12 @@ namespace Content.Server.Solar.EntitySystems if (coverage > 0) { // Determine if the solar panel is occluded, and zero out coverage if so. - var ray = new CollisionRay(IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition, TowardsSun.ToWorldVec(), (int) CollisionGroup.Opaque); + var ray = new CollisionRay(IoCManager.Resolve().GetComponent(entity).WorldPosition, TowardsSun.ToWorldVec(), (int) CollisionGroup.Opaque); var rayCastResults = _physicsSystem.IntersectRayWithPredicate( - IoCManager.Resolve().GetComponent(entity.Uid).MapID, + IoCManager.Resolve().GetComponent(entity).MapID, ray, SunOcclusionCheckDistance, - e => !IoCManager.Resolve().GetComponent(e.Uid).Anchored || e == entity); + e => !IoCManager.Resolve().GetComponent(e).Anchored || e == entity); if (rayCastResults.Any()) coverage = 0; } diff --git a/Content.Server/Spawners/Components/ConditionalSpawnerComponent.cs b/Content.Server/Spawners/Components/ConditionalSpawnerComponent.cs index f8b9bb3808..85ab8301e9 100644 --- a/Content.Server/Spawners/Components/ConditionalSpawnerComponent.cs +++ b/Content.Server/Spawners/Components/ConditionalSpawnerComponent.cs @@ -61,8 +61,8 @@ namespace Content.Server.Spawners.Components return; } - if(!((!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted)) - IoCManager.Resolve().SpawnEntity(_robustRandom.Pick(Prototypes), IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + if(!((!IoCManager.Resolve().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner).EntityLifeStage) >= EntityLifeStage.Deleted)) + IoCManager.Resolve().SpawnEntity(_robustRandom.Pick(Prototypes), IoCManager.Resolve().GetComponent(Owner).Coordinates); } public virtual void MapInit() diff --git a/Content.Server/Spawners/Components/RandomSpawnerComponent.cs b/Content.Server/Spawners/Components/RandomSpawnerComponent.cs index bbe3bf5f7d..92326d5917 100644 --- a/Content.Server/Spawners/Components/RandomSpawnerComponent.cs +++ b/Content.Server/Spawners/Components/RandomSpawnerComponent.cs @@ -32,7 +32,7 @@ namespace Content.Server.Spawners.Components { if (RarePrototypes.Count > 0 && (RareChance == 1.0f || _robustRandom.Prob(RareChance))) { - IoCManager.Resolve().SpawnEntity(_robustRandom.Pick(RarePrototypes), IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + IoCManager.Resolve().SpawnEntity(_robustRandom.Pick(RarePrototypes), IoCManager.Resolve().GetComponent(Owner).Coordinates); return; } @@ -47,15 +47,15 @@ namespace Content.Server.Spawners.Components return; } - if(!((!IoCManager.Resolve().EntityExists(Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted)) + if(!((!IoCManager.Resolve().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(Owner).EntityLifeStage) >= EntityLifeStage.Deleted)) { var random = IoCManager.Resolve(); var x_negative = random.Prob(0.5f) ? -1 : 1; var y_negative = random.Prob(0.5f) ? -1 : 1; - var entity = IoCManager.Resolve().SpawnEntity(_robustRandom.Pick(Prototypes), IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); - IoCManager.Resolve().GetComponent(entity.Uid).LocalPosition += new Vector2(random.NextFloat() * Offset * x_negative, random.NextFloat() * Offset * y_negative); + var entity = IoCManager.Resolve().SpawnEntity(_robustRandom.Pick(Prototypes), IoCManager.Resolve().GetComponent(Owner).Coordinates); + IoCManager.Resolve().GetComponent(entity).LocalPosition += new Vector2(random.NextFloat() * Offset * x_negative, random.NextFloat() * Offset * y_negative); } } @@ -63,7 +63,7 @@ namespace Content.Server.Spawners.Components public override void MapInit() { Spawn(); - IoCManager.Resolve().DeleteEntity(Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) Owner); } } } diff --git a/Content.Server/Spawners/Components/TimedSpawnerComponent.cs b/Content.Server/Spawners/Components/TimedSpawnerComponent.cs index e445ddd8b3..64296fb7dc 100644 --- a/Content.Server/Spawners/Components/TimedSpawnerComponent.cs +++ b/Content.Server/Spawners/Components/TimedSpawnerComponent.cs @@ -76,7 +76,7 @@ namespace Content.Server.Spawners.Components for (int i = 0; i < number; i++) { var entity = _robustRandom.Pick(Prototypes); - IoCManager.Resolve().SpawnEntity(entity, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + IoCManager.Resolve().SpawnEntity(entity, IoCManager.Resolve().GetComponent(Owner).Coordinates); } } } diff --git a/Content.Server/Sprite/Components/RandomSpriteColorComponent.cs b/Content.Server/Sprite/Components/RandomSpriteColorComponent.cs index fe30a1cc8b..4dca98070b 100644 --- a/Content.Server/Sprite/Components/RandomSpriteColorComponent.cs +++ b/Content.Server/Sprite/Components/RandomSpriteColorComponent.cs @@ -36,7 +36,7 @@ namespace Content.Server.Sprite.Components private void UpdateColor() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out SpriteComponent? spriteComponent) && _selectedColor != null) + if (IoCManager.Resolve().TryGetComponent(Owner, out SpriteComponent? spriteComponent) && _selectedColor != null) { spriteComponent.LayerSetState(0, _baseState); spriteComponent.LayerSetColor(0, _colors[_selectedColor]); diff --git a/Content.Server/Sprite/Components/RandomSpriteStateComponent.cs b/Content.Server/Sprite/Components/RandomSpriteStateComponent.cs index de56228dd9..eafeede655 100644 --- a/Content.Server/Sprite/Components/RandomSpriteStateComponent.cs +++ b/Content.Server/Sprite/Components/RandomSpriteStateComponent.cs @@ -23,7 +23,7 @@ namespace Content.Server.Sprite.Components { base.Initialize(); if (_spriteStates == null) return; - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out SpriteComponent? spriteComponent)) return; + if (!IoCManager.Resolve().TryGetComponent(Owner, out SpriteComponent? spriteComponent)) return; spriteComponent.LayerSetState(_spriteLayer, _random.Pick(_spriteStates)); } } diff --git a/Content.Server/Stack/StackSystem.cs b/Content.Server/Stack/StackSystem.cs index 6c68be596d..1160292960 100644 --- a/Content.Server/Stack/StackSystem.cs +++ b/Content.Server/Stack/StackSystem.cs @@ -50,14 +50,15 @@ namespace Content.Server.Stack // Get a prototype ID to spawn the new entity. Null is also valid, although it should rarely be picked... var prototype = _prototypeManager.TryIndex(stack.StackTypeId, out var stackType) ? stackType.Spawn - : IoCManager.Resolve().GetComponent(stack.Owner.Uid).EntityPrototype?.ID; + : IoCManager.Resolve().GetComponent(stack.Owner).EntityPrototype?.ID; // Try to remove the amount of things we want to split from the original stack... if (!Use(uid, amount, stack)) return null; // Set the output parameter in the event instance to the newly split stack. - var entity = EntityManager.SpawnEntity(prototype, spawnPosition).Uid; + IEntity tempQualifier = EntityManager.SpawnEntity(prototype, spawnPosition); + var entity = (EntityUid) tempQualifier; if (EntityManager.TryGetComponent(entity, out SharedStackComponent? stackComp)) { @@ -76,7 +77,8 @@ namespace Content.Server.Stack public EntityUid Spawn(int amount, StackPrototype prototype, EntityCoordinates spawnPosition) { // Set the output result parameter to the new stack entity... - var entity = EntityManager.SpawnEntity(prototype.Spawn, spawnPosition).Uid; + IEntity tempQualifier = EntityManager.SpawnEntity(prototype.Spawn, spawnPosition); + var entity = (EntityUid) tempQualifier; var stack = EntityManager.GetComponent(entity); // And finally, set the correct amount! @@ -89,7 +91,7 @@ namespace Content.Server.Stack if (args.Handled) return; - if (!IoCManager.Resolve().TryGetComponent(args.Used.Uid, out var otherStack)) + if (!IoCManager.Resolve().TryGetComponent(args.Used, out var otherStack)) return; if (!otherStack.StackTypeId.Equals(stack.StackTypeId)) @@ -97,16 +99,16 @@ namespace Content.Server.Stack var toTransfer = Math.Min(stack.Count, otherStack.AvailableSpace); SetCount(uid, stack.Count - toTransfer, stack); - SetCount(args.Used.Uid, otherStack.Count + toTransfer, otherStack); + SetCount(args.Used, otherStack.Count + toTransfer, otherStack); var popupPos = args.ClickLocation; if (!popupPos.IsValid(EntityManager)) { - popupPos = IoCManager.Resolve().GetComponent(args.User.Uid).Coordinates; + popupPos = IoCManager.Resolve().GetComponent(args.User).Coordinates; } - var filter = Filter.Entities(args.User.Uid); + var filter = Filter.Entities(args.User); switch (toTransfer) { @@ -137,7 +139,7 @@ namespace Content.Server.Stack Verb halve = new(); halve.Text = Loc.GetString("comp-stack-split-halve"); halve.Category = VerbCategory.Split; - halve.Act = () => UserSplit(uid, args.User.Uid, stack.Count / 2, stack); + halve.Act = () => UserSplit(uid, args.User, stack.Count / 2, stack); halve.Priority = 1; args.Verbs.Add(halve); @@ -150,7 +152,7 @@ namespace Content.Server.Stack Verb verb = new(); verb.Text = amount.ToString(); verb.Category = VerbCategory.Split; - verb.Act = () => UserSplit(uid, args.User.Uid, amount, stack); + verb.Act = () => UserSplit(uid, args.User, amount, stack); // we want to sort by size, not alphabetically by the verb text. verb.Priority = priority; diff --git a/Content.Server/Standing/StandingStateSystem.cs b/Content.Server/Standing/StandingStateSystem.cs index 410d5675bf..9b2118df32 100644 --- a/Content.Server/Standing/StandingStateSystem.cs +++ b/Content.Server/Standing/StandingStateSystem.cs @@ -25,7 +25,7 @@ public class StandingStateSystem : EntitySystem IEntity tempQualifier = EntityManager.GetEntity(uid); Throwing.ThrowHelper.TryThrow(heldItem.Owner, _random.NextAngle().RotateVec(direction / dropAngle + - IoCManager.Resolve().GetComponent(tempQualifier.Uid).WorldRotation.ToVec() / 50), + IoCManager.Resolve().GetComponent(tempQualifier).WorldRotation.ToVec() / 50), 0.5f * dropAngle * _random.NextFloat(-0.9f, 1.1f), EntityManager.GetEntity(uid), 0); } diff --git a/Content.Server/StationEvents/Events/GasLeak.cs b/Content.Server/StationEvents/Events/GasLeak.cs index e41be7ef0b..a14db55d77 100644 --- a/Content.Server/StationEvents/Events/GasLeak.cs +++ b/Content.Server/StationEvents/Events/GasLeak.cs @@ -123,14 +123,14 @@ namespace Content.Server.StationEvents.Events if (!_foundTile || _targetGrid == null || - (!IoCManager.Resolve().EntityExists(_targetGrid.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_targetGrid.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || - !atmosphereSystem.IsSimulatedGrid(IoCManager.Resolve().GetComponent(_targetGrid.Uid).GridID)) + (!IoCManager.Resolve().EntityExists(_targetGrid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_targetGrid).EntityLifeStage) >= EntityLifeStage.Deleted || + !atmosphereSystem.IsSimulatedGrid(IoCManager.Resolve().GetComponent(_targetGrid).GridID)) { Running = false; return; } - var environment = atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(_targetGrid.Uid).GridID, _targetTile, true); + var environment = atmosphereSystem.GetTileMixture(IoCManager.Resolve().GetComponent(_targetGrid).GridID, _targetTile, true); environment?.AdjustMoles(_leakGas, LeakCooldown * _molesPerSecond); } @@ -156,15 +156,15 @@ namespace Content.Server.StationEvents.Events { if (!_foundTile || _targetGrid == null || - (!IoCManager.Resolve().EntityExists(_targetGrid.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_targetGrid.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || - !atmosphereSystem.IsSimulatedGrid(IoCManager.Resolve().GetComponent(_targetGrid.Uid).GridID)) + (!IoCManager.Resolve().EntityExists(_targetGrid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(_targetGrid).EntityLifeStage) >= EntityLifeStage.Deleted || + !atmosphereSystem.IsSimulatedGrid(IoCManager.Resolve().GetComponent(_targetGrid).GridID)) { return; } // Don't want it to be so obnoxious as to instantly murder anyone in the area but enough that // it COULD start potentially start a bigger fire. - atmosphereSystem.HotspotExpose(IoCManager.Resolve().GetComponent(_targetGrid.Uid).GridID, _targetTile, 700f, 50f, true); + atmosphereSystem.HotspotExpose(IoCManager.Resolve().GetComponent(_targetGrid).GridID, _targetTile, 700f, 50f, true); SoundSystem.Play(Filter.Pvs(_targetCoords), "/Audio/Effects/sparks4.ogg", _targetCoords); } } diff --git a/Content.Server/StationEvents/Events/MeteorSwarm.cs b/Content.Server/StationEvents/Events/MeteorSwarm.cs index 983c82ecdf..6ff7124c49 100644 --- a/Content.Server/StationEvents/Events/MeteorSwarm.cs +++ b/Content.Server/StationEvents/Events/MeteorSwarm.cs @@ -111,7 +111,7 @@ namespace Content.Server.StationEvents.Events var offset = angle.RotateVec(new Vector2((maximumDistance - minimumDistance) * _robustRandom.NextFloat() + minimumDistance, 0)); var spawnPosition = new MapCoordinates(center + offset, mapId); var meteor = _entityManager.SpawnEntity("MeteorLarge", spawnPosition); - var physics = _entityManager.GetComponent(meteor.Uid); + var physics = _entityManager.GetComponent(meteor); physics.BodyStatus = BodyStatus.InAir; physics.LinearDamping = 0f; physics.AngularDamping = 0f; @@ -121,7 +121,7 @@ namespace Content.Server.StationEvents.Events physics.Mass * ((MaxAngularVelocity - MinAngularVelocity) * _robustRandom.NextFloat() + MinAngularVelocity)); // TODO: God this disgusts me but projectile needs a refactor. - IoCManager.Resolve().GetComponent(meteor.Uid).TimeLeft = 120f; + IoCManager.Resolve().GetComponent(meteor).TimeLeft = 120f; } } } diff --git a/Content.Server/StationEvents/Events/PowerGridCheck.cs b/Content.Server/StationEvents/Events/PowerGridCheck.cs index f2f9d4cd91..8c5c1e0b63 100644 --- a/Content.Server/StationEvents/Events/PowerGridCheck.cs +++ b/Content.Server/StationEvents/Events/PowerGridCheck.cs @@ -53,9 +53,9 @@ namespace Content.Server.StationEvents.Events { foreach (var entity in _powered) { - if ((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) continue; + if ((!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Deleted) continue; - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ApcPowerReceiverComponent? powerReceiverComponent)) + if (IoCManager.Resolve().TryGetComponent(entity, out ApcPowerReceiverComponent? powerReceiverComponent)) { powerReceiverComponent.PowerDisabled = false; } diff --git a/Content.Server/StationEvents/Events/RadiationStorm.cs b/Content.Server/StationEvents/Events/RadiationStorm.cs index 72af52377f..37df944474 100644 --- a/Content.Server/StationEvents/Events/RadiationStorm.cs +++ b/Content.Server/StationEvents/Events/RadiationStorm.cs @@ -88,7 +88,7 @@ namespace Content.Server.StationEvents.Events return; var pulse = _entityManager.SpawnEntity("RadiationPulse", coordinates); - IoCManager.Resolve().GetComponent(pulse.Uid).DoPulse(); + IoCManager.Resolve().GetComponent(pulse).DoPulse(); ResetTimeUntilPulse(); } @@ -96,7 +96,7 @@ namespace Content.Server.StationEvents.Events { var pulse = IoCManager.Resolve() .SpawnEntity("RadiationPulse", at); - IoCManager.Resolve().GetComponent(pulse.Uid).DoPulse(); + IoCManager.Resolve().GetComponent(pulse).DoPulse(); } private bool TryFindRandomGrid(IMapGrid mapGrid, out EntityCoordinates coordinates) diff --git a/Content.Server/StationEvents/Events/StationEvent.cs b/Content.Server/StationEvents/Events/StationEvent.cs index edd085d499..6424d81b16 100644 --- a/Content.Server/StationEvents/Events/StationEvent.cs +++ b/Content.Server/StationEvents/Events/StationEvent.cs @@ -200,7 +200,7 @@ namespace Content.Server.StationEvents.Events .Where(x => x.Station == t).ToArray(); targetGrid = robustRandom.Pick(possibleTargets).Owner; - if (!entityManager.TryGetComponent(targetGrid!.Uid, out var gridComp)) + if (!entityManager.TryGetComponent(targetGrid!, out var gridComp)) return false; var grid = gridComp.Grid; diff --git a/Content.Server/Storage/Components/CursedEntityStorageComponent.cs b/Content.Server/Storage/Components/CursedEntityStorageComponent.cs index 16fa3ed9fe..56c39043d8 100644 --- a/Content.Server/Storage/Components/CursedEntityStorageComponent.cs +++ b/Content.Server/Storage/Components/CursedEntityStorageComponent.cs @@ -40,7 +40,7 @@ namespace Content.Server.Storage.Components if (lockerEnt == null) return; // No valid lockers anywhere. - var locker = IoCManager.Resolve().GetComponent(lockerEnt.Uid); + var locker = IoCManager.Resolve().GetComponent(lockerEnt); if (locker.Open) locker.TryCloseStorage(Owner); diff --git a/Content.Server/Storage/Components/EntityStorageComponent.cs b/Content.Server/Storage/Components/EntityStorageComponent.cs index 055e76ef8c..248ea45536 100644 --- a/Content.Server/Storage/Components/EntityStorageComponent.cs +++ b/Content.Server/Storage/Components/EntityStorageComponent.cs @@ -152,9 +152,9 @@ namespace Content.Server.Storage.Components Contents.ShowContents = _showContents; Contents.OccludesLight = _occludesLight; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var surface)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var surface)) { - EntitySystem.Get().SetPlaceable(Owner.Uid, Open, surface); + EntitySystem.Get().SetPlaceable(Owner, Open, surface); } UpdateAppearance(); @@ -173,7 +173,7 @@ namespace Content.Server.Storage.Components return false; } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var @lock) && @lock.Locked) + if (IoCManager.Resolve().TryGetComponent(Owner, out var @lock) && @lock.Locked) { if (!silent) Owner.PopupMessage(user, Loc.GetString("entity-storage-component-locked-message")); return false; @@ -218,13 +218,13 @@ namespace Content.Server.Storage.Components // 5. if this is NOT AN ITEM, then mobs can always be eaten unless unless a previous law prevents it // Let's not insert admin ghosts, yeah? This is really a a hack and should be replaced by attempt events - if (IoCManager.Resolve().HasComponent(entity.Uid)) + if (IoCManager.Resolve().HasComponent(entity)) continue; // checks - var targetIsItem = IoCManager.Resolve().HasComponent(entity.Uid); - var targetIsMob = IoCManager.Resolve().HasComponent(entity.Uid); + var targetIsItem = IoCManager.Resolve().HasComponent(entity); + var targetIsMob = IoCManager.Resolve().HasComponent(entity); var storageIsItem = IoCManager.Resolve().HasComponent(OwnerUid); var allowedToEat = false; @@ -270,7 +270,7 @@ namespace Content.Server.Storage.Components private void UpdateAppearance() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(StorageVisuals.CanWeld, _canWeldShut); appearance.SetData(StorageVisuals.Welded, _isWeldedShut); @@ -279,7 +279,7 @@ namespace Content.Server.Storage.Components private void ModifyComponents() { - if (!_isCollidableWhenOpen && IoCManager.Resolve().TryGetComponent(Owner.Uid, out var manager)) + if (!_isCollidableWhenOpen && IoCManager.Resolve().TryGetComponent(Owner, out var manager)) { if (Open) { @@ -297,12 +297,12 @@ namespace Content.Server.Storage.Components } } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var surface)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var surface)) { - EntitySystem.Get().SetPlaceable(Owner.Uid, Open, surface); + EntitySystem.Get().SetPlaceable(Owner, Open, surface); } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(StorageVisuals.Open, Open); } @@ -311,7 +311,7 @@ namespace Content.Server.Storage.Components protected virtual bool AddToContents(IEntity entity) { if (entity == Owner) return false; - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? entityPhysicsComponent)) + if (IoCManager.Resolve().TryGetComponent(entity, out IPhysBody? entityPhysicsComponent)) { if (MaxSize < entityPhysicsComponent.GetWorldAABB().Size.X || MaxSize < entityPhysicsComponent.GetWorldAABB().Size.Y) @@ -325,7 +325,7 @@ namespace Content.Server.Storage.Components public virtual Vector2 ContentsDumpPosition() { - return IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition; + return IoCManager.Resolve().GetComponent(Owner).WorldPosition; } private void EmptyContents() @@ -334,8 +334,8 @@ namespace Content.Server.Storage.Components { if (Contents.Remove(contained)) { - IoCManager.Resolve().GetComponent(contained.Uid).WorldPosition = ContentsDumpPosition(); - if (IoCManager.Resolve().TryGetComponent(contained.Uid, out var physics)) + IoCManager.Resolve().GetComponent(contained).WorldPosition = ContentsDumpPosition(); + if (IoCManager.Resolve().TryGetComponent(contained, out var physics)) { physics.CanCollide = true; } @@ -369,14 +369,14 @@ namespace Content.Server.Storage.Components // Trying to add while open just dumps it on the ground below us. if (Open) { - IoCManager.Resolve().GetComponent(entity.Uid).WorldPosition = IoCManager.Resolve().GetComponent(Owner.Uid).WorldPosition; + IoCManager.Resolve().GetComponent(entity).WorldPosition = IoCManager.Resolve().GetComponent(Owner).WorldPosition; return true; } if (!Contents.Insert(entity)) return false; - IoCManager.Resolve().GetComponent(entity.Uid).LocalPosition = Vector2.Zero; - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? body)) + IoCManager.Resolve().GetComponent(entity).LocalPosition = Vector2.Zero; + if (IoCManager.Resolve().TryGetComponent(entity, out IPhysBody? body)) { body.CanCollide = false; } @@ -430,7 +430,7 @@ namespace Content.Server.Storage.Components var toolSystem = EntitySystem.Get(); - if (!await toolSystem.UseTool(eventArgs.Using.Uid, eventArgs.User.Uid, Owner.Uid, 1f, 1f, _weldingQuality)) + if (!await toolSystem.UseTool(eventArgs.Using, eventArgs.User, Owner, 1f, 1f, _weldingQuality)) { _beingWelded = false; return false; @@ -463,7 +463,7 @@ namespace Content.Server.Storage.Components var containedEntities = Contents.ContainedEntities.ToList(); foreach (var entity in containedEntities) { - var exActs = IoCManager.Resolve().GetComponents(entity.Uid).ToArray(); + var exActs = IoCManager.Resolve().GetComponents(entity).ToArray(); foreach (var exAct in exActs) { exAct.OnExplosion(eventArgs); diff --git a/Content.Server/Storage/Components/SecretStashComponent.cs b/Content.Server/Storage/Components/SecretStashComponent.cs index eb736bbf79..cd3dc6b5aa 100644 --- a/Content.Server/Storage/Components/SecretStashComponent.cs +++ b/Content.Server/Storage/Components/SecretStashComponent.cs @@ -28,7 +28,7 @@ namespace Content.Server.Storage.Components [ViewVariables] private ContainerSlot _itemContainer = default!; - public string SecretPartName => _secretPartNameOverride ?? Loc.GetString("comp-secret-stash-secret-part-name", ("name", IoCManager.Resolve().GetComponent(Owner.Uid).EntityName)); + public string SecretPartName => _secretPartNameOverride ?? Loc.GetString("comp-secret-stash-secret-part-name", ("name", IoCManager.Resolve().GetComponent(Owner).EntityName)); protected override void Initialize() { @@ -50,7 +50,7 @@ namespace Content.Server.Storage.Components return false; } - if (!IoCManager.Resolve().TryGetComponent(itemToHide.Uid, out ItemComponent? item)) + if (!IoCManager.Resolve().TryGetComponent(itemToHide, out ItemComponent? item)) return false; if (item.Size > _maxItemSize) @@ -60,7 +60,7 @@ namespace Content.Server.Storage.Components return false; } - if (!IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(user, out HandsComponent? hands)) return false; if (!hands.Drop(itemToHide, _itemContainer)) @@ -83,15 +83,15 @@ namespace Content.Server.Storage.Components Owner.PopupMessage(user, Loc.GetString("comp-secret-stash-action-get-item-found-something", ("stash", SecretPartName))); - if (IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? hands)) + if (IoCManager.Resolve().TryGetComponent(user, out HandsComponent? hands)) { - if (!IoCManager.Resolve().TryGetComponent(_itemContainer.ContainedEntity.Uid, out ItemComponent? item)) + if (!IoCManager.Resolve().TryGetComponent(_itemContainer.ContainedEntity, out ItemComponent? item)) return false; hands.PutInHandOrDrop(item); } else if (_itemContainer.Remove(_itemContainer.ContainedEntity)) { - IoCManager.Resolve().GetComponent(_itemContainer.ContainedEntity.Uid).Coordinates = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + IoCManager.Resolve().GetComponent(_itemContainer.ContainedEntity).Coordinates = IoCManager.Resolve().GetComponent(Owner).Coordinates; } return true; @@ -111,7 +111,7 @@ namespace Content.Server.Storage.Components // drop item inside if (_itemContainer.ContainedEntity != null) { - IoCManager.Resolve().GetComponent(_itemContainer.ContainedEntity.Uid).Coordinates = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + IoCManager.Resolve().GetComponent(_itemContainer.ContainedEntity).Coordinates = IoCManager.Resolve().GetComponent(Owner).Coordinates; } } } diff --git a/Content.Server/Storage/Components/ServerStorageComponent.cs b/Content.Server/Storage/Components/ServerStorageComponent.cs index 022ef89317..af642aeed5 100644 --- a/Content.Server/Storage/Components/ServerStorageComponent.cs +++ b/Content.Server/Storage/Components/ServerStorageComponent.cs @@ -129,7 +129,7 @@ namespace Content.Server.Storage.Components foreach (var entity in Storage.ContainedEntities) { - var item = IoCManager.Resolve().GetComponent(entity.Uid); + var item = IoCManager.Resolve().GetComponent(entity); _storageUsed += item.Size; } } @@ -143,24 +143,24 @@ namespace Content.Server.Storage.Components { EnsureInitialCalculated(); - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ServerStorageComponent? storage) && + if (IoCManager.Resolve().TryGetComponent(entity, out ServerStorageComponent? storage) && storage._storageCapacityMax >= _storageCapacityMax) { return false; } - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out SharedItemComponent? store) && + if (IoCManager.Resolve().TryGetComponent(entity, out SharedItemComponent? store) && store.Size > _storageCapacityMax - _storageUsed) { return false; } - if (_whitelist != null && !_whitelist.IsValid(entity.Uid)) + if (_whitelist != null && !_whitelist.IsValid(entity)) { return false; } - if (IoCManager.Resolve().GetComponent(entity.Uid).Anchored) + if (IoCManager.Resolve().GetComponent(entity).Anchored) { return false; } @@ -194,10 +194,10 @@ namespace Content.Server.Storage.Components PlaySoundCollection(); EnsureInitialCalculated(); - Logger.DebugS(LoggerName, $"Storage (UID {Owner.Uid}) had entity (UID {message.Entity.Uid}) inserted into it."); + Logger.DebugS(LoggerName, $"Storage (UID {Owner}) had entity (UID {message.Entity}) inserted into it."); var size = 0; - if (IoCManager.Resolve().TryGetComponent(message.Entity.Uid, out SharedItemComponent? storable)) + if (IoCManager.Resolve().TryGetComponent(message.Entity, out SharedItemComponent? storable)) size = storable.Size; _storageUsed += size; @@ -219,7 +219,7 @@ namespace Content.Server.Storage.Components if (!_sizeCache.TryGetValue(message.Entity, out var size)) { - Logger.WarningS(LoggerName, $"Removed entity {message.Entity} without a cached size from storage {Owner} at {IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition}"); + Logger.WarningS(LoggerName, $"Removed entity {message.Entity} without a cached size from storage {Owner} at {IoCManager.Resolve().GetComponent(Owner).MapPosition}"); RecalculateStorageUsed(); return; @@ -239,7 +239,7 @@ namespace Content.Server.Storage.Components { EnsureInitialCalculated(); - if (!IoCManager.Resolve().TryGetComponent(player.Uid, out HandsComponent? hands) || + if (!IoCManager.Resolve().TryGetComponent(player, out HandsComponent? hands) || hands.GetActiveHand == null) { return false; @@ -290,9 +290,9 @@ namespace Content.Server.Storage.Components PlaySoundCollection(); EnsureInitialCalculated(); - var userSession = IoCManager.Resolve().GetComponent(entity.Uid).PlayerSession; + var userSession = IoCManager.Resolve().GetComponent(entity).PlayerSession; - Logger.DebugS(LoggerName, $"Storage (UID {Owner.Uid}) \"used\" by player session (UID {userSession.AttachedEntityUid})."); + Logger.DebugS(LoggerName, $"Storage (UID {Owner}) \"used\" by player session (UID {userSession.AttachedEntityUid})."); SubscribeSession(userSession); #pragma warning disable 618 @@ -320,7 +320,7 @@ namespace Content.Server.Storage.Components { if (session.AttachedEntity == null) { - Logger.DebugS(LoggerName, $"Storage (UID {Owner.Uid}) detected no attached entity in player session (UID {session.AttachedEntityUid})."); + Logger.DebugS(LoggerName, $"Storage (UID {Owner}) detected no attached entity in player session (UID {session.AttachedEntityUid})."); UnsubscribeSession(session); return; @@ -340,7 +340,7 @@ namespace Content.Server.Storage.Components return; } - var stored = StoredEntities.Select(e => e.Uid).ToArray(); + var stored = StoredEntities.Select(e => (EntityUid) e).ToArray(); #pragma warning disable 618 SendNetworkMessage(new StorageHeldItemsMessage(stored, _storageUsed, _storageCapacityMax), session.ConnectedClient); @@ -357,7 +357,7 @@ namespace Content.Server.Storage.Components if (!SubscribedSessions.Contains(session)) { - Logger.DebugS(LoggerName, $"Storage (UID {Owner.Uid}) subscribed player session (UID {session.AttachedEntityUid})."); + Logger.DebugS(LoggerName, $"Storage (UID {Owner}) subscribed player session (UID {session.AttachedEntityUid})."); session.PlayerStatusChanged += HandlePlayerSessionChangeEvent; SubscribedSessions.Add(session); @@ -375,7 +375,7 @@ namespace Content.Server.Storage.Components { if (SubscribedSessions.Contains(session)) { - Logger.DebugS(LoggerName, $"Storage (UID {Owner.Uid}) unsubscribed player session (UID {session.AttachedEntityUid})."); + Logger.DebugS(LoggerName, $"Storage (UID {Owner}) unsubscribed player session (UID {session.AttachedEntityUid})."); SubscribedSessions.Remove(session); #pragma warning disable 618 @@ -400,13 +400,13 @@ namespace Content.Server.Storage.Components foreach (var entity in StoredEntities) { - if (_entityManager.TryGetComponent(entity.Uid, out ServerStorageComponent storageComponent)) + if (_entityManager.TryGetComponent(entity, out ServerStorageComponent storageComponent)) { DebugTools.Assert(storageComponent != this, $"Storage component contains itself!? Entity: {OwnerUid}"); storageComponent.UnsubscribeSession(session); } - if (_entityManager.TryGetComponent(entity.Uid, out ServerUserInterfaceComponent uiComponent)) + if (_entityManager.TryGetComponent(entity, out ServerUserInterfaceComponent uiComponent)) { foreach (var ui in uiComponent.Interfaces) { @@ -418,7 +418,7 @@ namespace Content.Server.Storage.Components private void HandlePlayerSessionChangeEvent(object? obj, SessionStatusEventArgs sessionStatus) { - Logger.DebugS(LoggerName, $"Storage (UID {Owner.Uid}) handled a status change in player session (UID {sessionStatus.Session.AttachedEntityUid})."); + Logger.DebugS(LoggerName, $"Storage (UID {Owner}) handled a status change in player session (UID {sessionStatus.Session.AttachedEntityUid})."); if (sessionStatus.NewStatus != SessionStatus.InGame) { @@ -459,8 +459,8 @@ namespace Content.Server.Storage.Components break; } - var ownerTransform = IoCManager.Resolve().GetComponent(Owner.Uid); - var playerTransform = IoCManager.Resolve().GetComponent(player.Uid); + var ownerTransform = IoCManager.Resolve().GetComponent(Owner); + var playerTransform = IoCManager.Resolve().GetComponent(player); if (!playerTransform.Coordinates.InRange(IoCManager.Resolve(), ownerTransform.Coordinates, 2) || Owner.IsInContainer() && !playerTransform.ContainsEntity(ownerTransform)) @@ -473,7 +473,7 @@ namespace Content.Server.Storage.Components break; } - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out ItemComponent? item) || !IoCManager.Resolve().TryGetComponent(player.Uid, out HandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(entity, out ItemComponent? item) || !IoCManager.Resolve().TryGetComponent(player, out HandsComponent? hands)) { break; } @@ -529,9 +529,9 @@ namespace Content.Server.Storage.Components { if (!_clickInsert) return false; - Logger.DebugS(LoggerName, $"Storage (UID {Owner.Uid}) attacked by user (UID {eventArgs.User.Uid}) with entity (UID {eventArgs.Using.Uid})."); + Logger.DebugS(LoggerName, $"Storage (UID {Owner}) attacked by user (UID {eventArgs.User}) with entity (UID {eventArgs.Using})."); - if (IoCManager.Resolve().HasComponent(Owner.Uid)) + if (IoCManager.Resolve().HasComponent(Owner)) { return false; } @@ -570,14 +570,14 @@ namespace Content.Server.Storage.Components // Pick up all entities in a radius around the clicked location. // The last half of the if is because carpets exist and this is terrible - if (_areaInsert && (eventArgs.Target == null || !IoCManager.Resolve().HasComponent(eventArgs.Target.Uid))) + if (_areaInsert && (eventArgs.Target == null || !IoCManager.Resolve().HasComponent(eventArgs.Target))) { var validStorables = new List(); foreach (var entity in IoCManager.Resolve().GetEntitiesInRange(eventArgs.ClickLocation, _areaInsertRadius, LookupFlags.None)) { if (entity.IsInContainer() || entity == eventArgs.User - || !IoCManager.Resolve().HasComponent(entity.Uid) + || !IoCManager.Resolve().HasComponent(entity) || !EntitySystem.Get().InRangeUnobstructed(eventArgs.User, entity)) continue; validStorables.Add(entity); @@ -605,12 +605,12 @@ namespace Content.Server.Storage.Components // Check again, situation may have changed for some entities, but we'll still pick up any that are valid if (entity.IsInContainer() || entity == eventArgs.User - || !IoCManager.Resolve().HasComponent(entity.Uid)) + || !IoCManager.Resolve().HasComponent(entity)) continue; - var position = EntityCoordinates.FromMap(IoCManager.Resolve().GetComponent(Owner.Uid).Parent?.Owner ?? Owner, IoCManager.Resolve().GetComponent(entity.Uid).MapPosition); + var position = EntityCoordinates.FromMap(IoCManager.Resolve().GetComponent(Owner).Parent?.Owner ?? Owner, IoCManager.Resolve().GetComponent(entity).MapPosition); if (PlayerInsertEntityInWorld(eventArgs.User, entity)) { - successfullyInserted.Add(entity.Uid); + successfullyInserted.Add(entity); successfullyInsertedPositions.Add(position); } } @@ -636,15 +636,15 @@ namespace Content.Server.Storage.Components if (eventArgs.Target == null || eventArgs.Target.IsInContainer() || eventArgs.Target == eventArgs.User - || !IoCManager.Resolve().HasComponent(eventArgs.Target.Uid)) + || !IoCManager.Resolve().HasComponent(eventArgs.Target)) return false; - var position = EntityCoordinates.FromMap(IoCManager.Resolve().GetComponent(Owner.Uid).Parent?.Owner ?? Owner, IoCManager.Resolve().GetComponent(eventArgs.Target.Uid).MapPosition); + var position = EntityCoordinates.FromMap(IoCManager.Resolve().GetComponent(Owner).Parent?.Owner ?? Owner, IoCManager.Resolve().GetComponent(eventArgs.Target).MapPosition); if (PlayerInsertEntityInWorld(eventArgs.User, eventArgs.Target)) { #pragma warning disable 618 SendNetworkMessage(new AnimateInsertingEntitiesMessage( #pragma warning restore 618 - new List() { eventArgs.Target.Uid }, + new List() {eventArgs.Target}, new List() { position } )); return true; @@ -685,7 +685,7 @@ namespace Content.Server.Storage.Components foreach (var entity in storedEntities) { - var exActs = IoCManager.Resolve().GetComponents(entity.Uid).ToArray(); + var exActs = IoCManager.Resolve().GetComponents(entity).ToArray(); foreach (var exAct in exActs) { exAct.OnExplosion(eventArgs); diff --git a/Content.Server/Storage/Components/StorageFillComponent.cs b/Content.Server/Storage/Components/StorageFillComponent.cs index c7fe7378a8..c166356710 100644 --- a/Content.Server/Storage/Components/StorageFillComponent.cs +++ b/Content.Server/Storage/Components/StorageFillComponent.cs @@ -28,7 +28,7 @@ namespace Content.Server.Storage.Components return; } - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out IStorageComponent? storage)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out IStorageComponent? storage)) { Logger.Error($"StorageFillComponent couldn't find any StorageComponent ({Owner})"); return; @@ -51,7 +51,7 @@ namespace Content.Server.Storage.Components for (var i = 0; i < storageItem.Amount; i++) { storage.Insert( - IoCManager.Resolve().SpawnEntity(storageItem.PrototypeId, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates)); + IoCManager.Resolve().SpawnEntity(storageItem.PrototypeId, IoCManager.Resolve().GetComponent(Owner).Coordinates)); } if (!string.IsNullOrEmpty(storageItem.GroupId)) alreadySpawnedGroups.Add(storageItem.GroupId); diff --git a/Content.Server/Storage/EntitySystems/ItemCounterSystem.cs b/Content.Server/Storage/EntitySystems/ItemCounterSystem.cs index c12c4d320f..2e98793ec9 100644 --- a/Content.Server/Storage/EntitySystems/ItemCounterSystem.cs +++ b/Content.Server/Storage/EntitySystems/ItemCounterSystem.cs @@ -13,7 +13,7 @@ namespace Content.Server.Storage.EntitySystems { protected override int? GetCount(ContainerModifiedMessage msg, ItemCounterComponent itemCounter) { - if (!IoCManager.Resolve().TryGetComponent(msg.Container.Owner.Uid, out ServerStorageComponent? component) + if (!IoCManager.Resolve().TryGetComponent(msg.Container.Owner, out ServerStorageComponent? component) || component.StoredEntities == null) { return null; @@ -22,7 +22,7 @@ namespace Content.Server.Storage.EntitySystems var count = 0; foreach (var entity in component.StoredEntities) { - if (itemCounter.Count.IsValid(entity.Uid)) count++; + if (itemCounter.Count.IsValid(entity)) count++; } return count; diff --git a/Content.Server/Storage/EntitySystems/ItemMapperSystem.cs b/Content.Server/Storage/EntitySystems/ItemMapperSystem.cs index e2b3c1535d..121efadb62 100644 --- a/Content.Server/Storage/EntitySystems/ItemMapperSystem.cs +++ b/Content.Server/Storage/EntitySystems/ItemMapperSystem.cs @@ -17,7 +17,7 @@ namespace Content.Server.Storage.EntitySystems ItemMapperComponent itemMapper, out IReadOnlyList showLayers) { - if (IoCManager.Resolve().TryGetComponent(msg.Container.Owner.Uid, out ServerStorageComponent? component)) + if (IoCManager.Resolve().TryGetComponent(msg.Container.Owner, out ServerStorageComponent? component)) { var containedLayers = component.StoredEntities ?? new List(); var list = new List(); @@ -25,7 +25,7 @@ namespace Content.Server.Storage.EntitySystems { foreach (var entity in containedLayers) { - if (mapLayerData.Whitelist.IsValid(entity.Uid)) + if (mapLayerData.Whitelist.IsValid(entity)) { list.Add(mapLayerData.Layer); break; diff --git a/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs b/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs index 121329185b..3f49223706 100644 --- a/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs +++ b/Content.Server/Storage/EntitySystems/SpawnItemsOnUseSystem.cs @@ -42,7 +42,7 @@ namespace Content.Server.Storage.EntitySystems for (var i = 0; i < storageItem.Amount; i++) { - entityToPlaceInHands = EntityManager.SpawnEntity(storageItem.PrototypeId, IoCManager.Resolve().GetComponent(args.User.Uid).Coordinates); + entityToPlaceInHands = EntityManager.SpawnEntity(storageItem.PrototypeId, IoCManager.Resolve().GetComponent(args.User).Coordinates); } if (!string.IsNullOrEmpty(storageItem.GroupId)) alreadySpawnedGroups.Add(storageItem.GroupId); @@ -55,11 +55,11 @@ namespace Content.Server.Storage.EntitySystems if (component.Uses == 0) { args.Handled = true; - IoCManager.Resolve().DeleteEntity(owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) owner); } if (entityToPlaceInHands != null - && IoCManager.Resolve().TryGetComponent(args.User.Uid, out var hands)) + && IoCManager.Resolve().TryGetComponent(args.User, out var hands)) { hands.TryPutInAnyHand(entityToPlaceInHands); } diff --git a/Content.Server/Storage/EntitySystems/StorageSystem.cs b/Content.Server/Storage/EntitySystems/StorageSystem.cs index 5cf6850391..0858273f5d 100644 --- a/Content.Server/Storage/EntitySystems/StorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/StorageSystem.cs @@ -37,7 +37,7 @@ namespace Content.Server.Storage.EntitySystems private void OnRelayMovement(EntityUid uid, EntityStorageComponent component, RelayMovementEntityEvent args) { - if (EntityManager.HasComponent(args.Entity.Uid)) + if (EntityManager.HasComponent(args.Entity)) { if (_gameTiming.CurTime < component.LastInternalOpenAttempt + EntityStorageComponent.InternalOpenAttemptDelay) @@ -91,7 +91,7 @@ namespace Content.Server.Storage.EntitySystems return; // Get the session for the user - var session = IoCManager.Resolve().GetComponentOrNull(args.User.Uid)?.PlayerSession; + var session = IoCManager.Resolve().GetComponentOrNull(args.User)?.PlayerSession; if (session == null) return; @@ -117,7 +117,7 @@ namespace Content.Server.Storage.EntitySystems { var oldParentEntity = message.Container.Owner; - if (IoCManager.Resolve().TryGetComponent(oldParentEntity.Uid, out ServerStorageComponent? storageComp)) + if (IoCManager.Resolve().TryGetComponent(oldParentEntity, out ServerStorageComponent? storageComp)) { storageComp.HandleEntityMaybeRemoved(message); } @@ -127,7 +127,7 @@ namespace Content.Server.Storage.EntitySystems { var oldParentEntity = message.Container.Owner; - if (IoCManager.Resolve().TryGetComponent(oldParentEntity.Uid, out ServerStorageComponent? storageComp)) + if (IoCManager.Resolve().TryGetComponent(oldParentEntity, out ServerStorageComponent? storageComp)) { storageComp.HandleEntityMaybeInserted(message); } @@ -143,21 +143,21 @@ namespace Content.Server.Storage.EntitySystems if (_sessionCache.Count == 0) return; - var storagePos = IoCManager.Resolve().GetComponent(storageComp.Owner.Uid).WorldPosition; - var storageMap = IoCManager.Resolve().GetComponent(storageComp.Owner.Uid).MapID; + var storagePos = IoCManager.Resolve().GetComponent(storageComp.Owner).WorldPosition; + var storageMap = IoCManager.Resolve().GetComponent(storageComp.Owner).MapID; foreach (var session in _sessionCache) { var attachedEntity = session.AttachedEntity; // The component manages the set of sessions, so this invalid session should be removed soon. - if (attachedEntity == null || !IoCManager.Resolve().EntityExists(attachedEntity.Uid)) + if (attachedEntity == null || !IoCManager.Resolve().EntityExists(attachedEntity)) continue; - if (storageMap != IoCManager.Resolve().GetComponent(attachedEntity.Uid).MapID) + if (storageMap != IoCManager.Resolve().GetComponent(attachedEntity).MapID) continue; - var distanceSquared = (storagePos - IoCManager.Resolve().GetComponent(attachedEntity.Uid).WorldPosition).LengthSquared; + var distanceSquared = (storagePos - IoCManager.Resolve().GetComponent(attachedEntity).WorldPosition).LengthSquared; if (distanceSquared > InteractionSystem.InteractionRangeSquared) { storageComp.UnsubscribeSession(session); diff --git a/Content.Server/Strip/StrippableComponent.cs b/Content.Server/Strip/StrippableComponent.cs index 929fbb5ef6..cee2d55d91 100644 --- a/Content.Server/Strip/StrippableComponent.cs +++ b/Content.Server/Strip/StrippableComponent.cs @@ -45,17 +45,17 @@ namespace Content.Server.Strip Owner.EnsureComponentWarn(); Owner.EnsureComponentWarn(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out CuffableComponent? cuffed)) + if (IoCManager.Resolve().TryGetComponent(Owner, out CuffableComponent? cuffed)) { cuffed.OnCuffedStateChanged += UpdateSubscribed; } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out InventoryComponent? inventory)) + if (IoCManager.Resolve().TryGetComponent(Owner, out InventoryComponent? inventory)) { inventory.OnItemChanged += UpdateSubscribed; } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out HandsComponent? hands)) + if (IoCManager.Resolve().TryGetComponent(Owner, out HandsComponent? hands)) { hands.OnItemChanged += UpdateSubscribed; } @@ -80,7 +80,7 @@ namespace Content.Server.Strip public override bool Drop(DragDropEvent args) { - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) return false; + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) return false; OpenUserInterface(actor.PlayerSession); return true; @@ -90,14 +90,14 @@ namespace Content.Server.Strip { var dictionary = new Dictionary(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out CuffableComponent? cuffed)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out CuffableComponent? cuffed)) { return dictionary; } foreach (IEntity entity in cuffed.StoredEntities) { - dictionary.Add(entity.Uid, entity.Name); + dictionary.Add(entity, entity.Name); } return dictionary; @@ -107,7 +107,7 @@ namespace Content.Server.Strip { var dictionary = new Dictionary(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out InventoryComponent? inventory)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out InventoryComponent? inventory)) { return dictionary; } @@ -129,7 +129,7 @@ namespace Content.Server.Strip { var dictionary = new Dictionary(); - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out HandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out HandsComponent? hands)) { return dictionary; } @@ -138,7 +138,7 @@ namespace Content.Server.Strip { var owner = hands.GetItem(hand)?.Owner; - if ((owner != null ? IoCManager.Resolve().HasComponent(owner.Uid) : (bool?) null) ?? true) + if ((owner != null ? IoCManager.Resolve().HasComponent(owner) : (bool?) null) ?? true) { dictionary[hand] = "None"; continue; @@ -160,13 +160,13 @@ namespace Content.Server.Strip /// private async void PlaceActiveHandItemInInventory(IEntity user, Slots slot) { - var inventory = IoCManager.Resolve().GetComponent(Owner.Uid); - var userHands = IoCManager.Resolve().GetComponent(user.Uid); + var inventory = IoCManager.Resolve().GetComponent(Owner); + var userHands = IoCManager.Resolve().GetComponent(user); var item = userHands.GetActiveHand; bool Check() { - if (!EntitySystem.Get().CanInteract(user.Uid)) + if (!EntitySystem.Get().CanInteract(user)) return false; if (item == null) @@ -225,13 +225,13 @@ namespace Content.Server.Strip /// private async void PlaceActiveHandItemInHands(IEntity user, string hand) { - var hands = IoCManager.Resolve().GetComponent(Owner.Uid); - var userHands = IoCManager.Resolve().GetComponent(user.Uid); + var hands = IoCManager.Resolve().GetComponent(Owner); + var userHands = IoCManager.Resolve().GetComponent(user); var item = userHands.GetActiveHand; bool Check() { - if (!EntitySystem.Get().CanInteract(user.Uid)) + if (!EntitySystem.Get().CanInteract(user)) return false; if (item == null) @@ -291,12 +291,12 @@ namespace Content.Server.Strip /// private async void TakeItemFromInventory(IEntity user, Slots slot) { - var inventory = IoCManager.Resolve().GetComponent(Owner.Uid); - var userHands = IoCManager.Resolve().GetComponent(user.Uid); + var inventory = IoCManager.Resolve().GetComponent(Owner); + var userHands = IoCManager.Resolve().GetComponent(user); bool Check() { - if (!EntitySystem.Get().CanInteract(user.Uid)) + if (!EntitySystem.Get().CanInteract(user)) return false; if (!inventory.HasSlot(slot)) @@ -347,12 +347,12 @@ namespace Content.Server.Strip /// private async void TakeItemFromHands(IEntity user, string hand) { - var hands = IoCManager.Resolve().GetComponent(Owner.Uid); - var userHands = IoCManager.Resolve().GetComponent(user.Uid); + var hands = IoCManager.Resolve().GetComponent(Owner); + var userHands = IoCManager.Resolve().GetComponent(user); bool Check() { - if (!EntitySystem.Get().CanInteract(user.Uid)) + if (!EntitySystem.Get().CanInteract(user)) return false; if (!hands.HasHand(hand)) @@ -364,7 +364,7 @@ namespace Content.Server.Strip return false; } - if (IoCManager.Resolve().HasComponent(heldItem.Owner.Uid)) + if (IoCManager.Resolve().HasComponent(heldItem.Owner)) return false; if (!hands.CanDrop(hand, false)) @@ -399,7 +399,7 @@ namespace Content.Server.Strip private void HandleUserInterfaceMessage(ServerBoundUserInterfaceMessage obj) { var user = obj.Session.AttachedEntity; - if (user == null || !IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? userHands)) return; + if (user == null || !IoCManager.Resolve().TryGetComponent(user, out HandsComponent? userHands)) return; var placingItem = userHands.GetActiveHand != null; @@ -407,7 +407,7 @@ namespace Content.Server.Strip { case StrippingInventoryButtonPressed inventoryMessage: - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var inventory)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var inventory)) { if (inventory.TryGetSlotItem(inventoryMessage.Slot, out ItemComponent? _)) placingItem = false; @@ -421,7 +421,7 @@ namespace Content.Server.Strip case StrippingHandButtonPressed handMessage: - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var hands)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var hands)) { if (hands.TryGetItem(handMessage.Hand, out _)) placingItem = false; @@ -435,11 +435,11 @@ namespace Content.Server.Strip case StrippingHandcuffButtonPressed handcuffMessage: - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var cuffed)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var cuffed)) { foreach (var entity in cuffed.StoredEntities) { - if (entity.Uid == handcuffMessage.Handcuff) + if (entity == handcuffMessage.Handcuff) { cuffed.TryUncuff(user, entity); return; diff --git a/Content.Server/Strip/StrippableSystem.cs b/Content.Server/Strip/StrippableSystem.cs index 88de8859e1..672054a19a 100644 --- a/Content.Server/Strip/StrippableSystem.cs +++ b/Content.Server/Strip/StrippableSystem.cs @@ -20,7 +20,7 @@ namespace Content.Server.Strip if (args.Hands == null || !args.CanAccess || !args.CanInteract || args.Target == args.User) return; - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out ActorComponent? actor)) return; Verb verb = new(); diff --git a/Content.Server/Stunnable/StunOnCollideSystem.cs b/Content.Server/Stunnable/StunOnCollideSystem.cs index fc39a999c7..cc3d1e5863 100644 --- a/Content.Server/Stunnable/StunOnCollideSystem.cs +++ b/Content.Server/Stunnable/StunOnCollideSystem.cs @@ -26,7 +26,7 @@ namespace Content.Server.Stunnable private void HandleCollide(EntityUid uid, StunOnCollideComponent component, StartCollideEvent args) { - var otherUid = args.OtherFixture.Body.Owner.Uid; + var otherUid = (EntityUid) args.OtherFixture.Body.Owner; if (EntityManager.TryGetComponent(otherUid, out var status)) { diff --git a/Content.Server/Stunnable/StunSystem.cs b/Content.Server/Stunnable/StunSystem.cs index b91cc24d5c..7c7e074875 100644 --- a/Content.Server/Stunnable/StunSystem.cs +++ b/Content.Server/Stunnable/StunSystem.cs @@ -48,8 +48,8 @@ namespace Content.Server.Stunnable if (target != null) { // TODO: Use PopupSystem - source.PopupMessageOtherClients(Loc.GetString("stunned-component-disarm-success-others", ("source", Name: IoCManager.Resolve().GetComponent(source.Uid).EntityName), ("target", Name: IoCManager.Resolve().GetComponent(target.Uid).EntityName))); - source.PopupMessageCursor(Loc.GetString("stunned-component-disarm-success", ("target", Name: IoCManager.Resolve().GetComponent(target.Uid).EntityName))); + source.PopupMessageOtherClients(Loc.GetString("stunned-component-disarm-success-others", ("source", Name: IoCManager.Resolve().GetComponent(source).EntityName), ("target", Name: IoCManager.Resolve().GetComponent(target).EntityName))); + source.PopupMessageCursor(Loc.GetString("stunned-component-disarm-success", ("target", Name: IoCManager.Resolve().GetComponent(target).EntityName))); } } diff --git a/Content.Server/Stunnable/StunbatonSystem.cs b/Content.Server/Stunnable/StunbatonSystem.cs index ad6420d059..82af37fc2d 100644 --- a/Content.Server/Stunnable/StunbatonSystem.cs +++ b/Content.Server/Stunnable/StunbatonSystem.cs @@ -73,7 +73,7 @@ namespace Content.Server.Stunnable private void OnUseInHand(EntityUid uid, StunbatonComponent comp, UseInHandEvent args) { - if (!Get().CanUse(args.User.Uid)) + if (!Get().CanUse(args.User)) return; if (comp.Activated) @@ -104,7 +104,7 @@ namespace Content.Server.Stunnable private void OnInteractUsing(EntityUid uid, StunbatonComponent comp, InteractUsingEvent args) { - if (!Get().CanInteract(args.User.Uid)) + if (!Get().CanInteract(args.User)) return; if (EntityManager.TryGetComponent(uid, out var cellslot)) @@ -121,31 +121,31 @@ namespace Content.Server.Stunnable private void StunEntity(IEntity entity, StunbatonComponent comp) { - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out StatusEffectsComponent? status) || !comp.Activated) return; + if (!IoCManager.Resolve().TryGetComponent(entity, out StatusEffectsComponent? status) || !comp.Activated) return; // TODO: Make slowdown inflicted customizable. SoundSystem.Play(Filter.Pvs(comp.Owner), comp.StunSound.GetSound(), comp.Owner, AudioHelpers.WithVariation(0.25f)); - if (!EntityManager.HasComponent(entity.Uid)) + if (!EntityManager.HasComponent(entity)) { if (_robustRandom.Prob(comp.ParalyzeChanceNoSlowdown)) - _stunSystem.TryParalyze(entity.Uid, TimeSpan.FromSeconds(comp.ParalyzeTime), status); + _stunSystem.TryParalyze(entity, TimeSpan.FromSeconds(comp.ParalyzeTime), status); else - _stunSystem.TrySlowdown(entity.Uid, TimeSpan.FromSeconds(comp.SlowdownTime), 0.5f, 0.5f, status); + _stunSystem.TrySlowdown(entity, TimeSpan.FromSeconds(comp.SlowdownTime), 0.5f, 0.5f, status); } else { if (_robustRandom.Prob(comp.ParalyzeChanceWithSlowdown)) - _stunSystem.TryParalyze(entity.Uid, TimeSpan.FromSeconds(comp.ParalyzeTime), status); + _stunSystem.TryParalyze(entity, TimeSpan.FromSeconds(comp.ParalyzeTime), status); else - _stunSystem.TrySlowdown(entity.Uid, TimeSpan.FromSeconds(comp.SlowdownTime), 0.5f, 0.5f, status); + _stunSystem.TrySlowdown(entity, TimeSpan.FromSeconds(comp.SlowdownTime), 0.5f, 0.5f, status); } var slowdownTime = TimeSpan.FromSeconds(comp.SlowdownTime); - _jitterSystem.DoJitter(entity.Uid, slowdownTime, status:status); - _stutteringSystem.DoStutter(entity.Uid, slowdownTime, status); + _jitterSystem.DoJitter(entity, slowdownTime, status:status); + _stutteringSystem.DoStutter(entity, slowdownTime, status); - if (!IoCManager.Resolve().TryGetComponent(comp.Owner.Uid, out var slot) || slot.Cell == null || !(slot.Cell.CurrentCharge < comp.EnergyPerUse)) + if (!IoCManager.Resolve().TryGetComponent(comp.Owner, out var slot) || slot.Cell == null || !(slot.Cell.CurrentCharge < comp.EnergyPerUse)) return; SoundSystem.Play(Filter.Pvs(comp.Owner), comp.SparksSound.GetSound(), comp.Owner, AudioHelpers.WithVariation(0.25f)); @@ -159,8 +159,8 @@ namespace Content.Server.Stunnable return; } - if (!IoCManager.Resolve().TryGetComponent(comp.Owner.Uid, out var sprite) || - !IoCManager.Resolve().TryGetComponent(comp.Owner.Uid, out var item)) return; + if (!IoCManager.Resolve().TryGetComponent(comp.Owner, out var sprite) || + !IoCManager.Resolve().TryGetComponent(comp.Owner, out var item)) return; SoundSystem.Play(Filter.Pvs(comp.Owner), comp.SparksSound.GetSound(), comp.Owner, AudioHelpers.WithVariation(0.25f)); item.EquippedPrefix = "off"; @@ -176,12 +176,12 @@ namespace Content.Server.Stunnable return; } - if (!IoCManager.Resolve().TryGetComponent(comp.Owner.Uid, out var sprite) || - !IoCManager.Resolve().TryGetComponent(comp.Owner.Uid, out var item)) + if (!IoCManager.Resolve().TryGetComponent(comp.Owner, out var sprite) || + !IoCManager.Resolve().TryGetComponent(comp.Owner, out var item)) return; var playerFilter = Filter.Pvs(comp.Owner); - if (!IoCManager.Resolve().TryGetComponent(comp.Owner.Uid, out var slot)) + if (!IoCManager.Resolve().TryGetComponent(comp.Owner, out var slot)) return; if (slot.Cell == null) diff --git a/Content.Server/Suspicion/SuspicionRoleComponent.cs b/Content.Server/Suspicion/SuspicionRoleComponent.cs index 5d2c82c5e3..4554d20b8b 100644 --- a/Content.Server/Suspicion/SuspicionRoleComponent.cs +++ b/Content.Server/Suspicion/SuspicionRoleComponent.cs @@ -60,7 +60,7 @@ namespace Content.Server.Suspicion public bool IsDead() { - return IoCManager.Resolve().TryGetComponent(Owner.Uid, out MobStateComponent? state) && + return IoCManager.Resolve().TryGetComponent(Owner, out MobStateComponent? state) && state.IsDead(); } @@ -76,7 +76,7 @@ namespace Content.Server.Suspicion public void SyncRoles() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out MindComponent? mind) || + if (!IoCManager.Resolve().TryGetComponent(Owner, out MindComponent? mind) || !mind.HasMind) { return; @@ -159,7 +159,7 @@ namespace Content.Server.Suspicion continue; } - allies.Add((role.Role!.Mind.CharacterName, role.Owner.Uid)); + allies.Add((role.Role!.Mind.CharacterName, Uid: role.Owner)); } return new SuspicionRoleComponentState(Role?.Name, Role?.Antagonist, allies.ToArray()); diff --git a/Content.Server/Tabletop/TabletopChessSetup.cs b/Content.Server/Tabletop/TabletopChessSetup.cs index f7f08d092e..a96e74a34d 100644 --- a/Content.Server/Tabletop/TabletopChessSetup.cs +++ b/Content.Server/Tabletop/TabletopChessSetup.cs @@ -17,7 +17,7 @@ namespace Content.Server.Tabletop { var chessboard = entityManager.SpawnEntity(ChessBoardPrototype, session.Position.Offset(-1, 0)); - session.Entities.Add(chessboard.Uid); + session.Entities.Add(chessboard); SpawnPieces(session, entityManager, session.Position.Offset(-4.5f, 3.5f)); } @@ -35,8 +35,10 @@ namespace Content.Server.Tabletop SpawnPiecesRow(session, entityManager, "White", new MapCoordinates(x, y - 7 * separation, mapId), separation); // Extra queens - session.Entities.Add(entityManager.SpawnEntity("BlackQueen", new MapCoordinates(x + 9 * separation + 9f / 32, y - 3 * separation, mapId)).Uid); - session.Entities.Add(entityManager.SpawnEntity("WhiteQueen", new MapCoordinates(x + 9 * separation + 9f / 32, y - 4 * separation, mapId)).Uid); + IEntity tempQualifier = entityManager.SpawnEntity("BlackQueen", new MapCoordinates(x + 9 * separation + 9f / 32, y - 3 * separation, mapId)); + session.Entities.Add(tempQualifier); + IEntity tempQualifier1 = entityManager.SpawnEntity("WhiteQueen", new MapCoordinates(x + 9 * separation + 9f / 32, y - 4 * separation, mapId)); + session.Entities.Add(tempQualifier1); } // TODO: refactor to load FEN instead @@ -51,19 +53,24 @@ namespace Content.Server.Tabletop switch (piecesRow[i]) { case 'r': - session.Entities.Add(entityManager.SpawnEntity(color + "Rook", new MapCoordinates(x + i * separation, y, mapId)).Uid); + IEntity tempQualifier = entityManager.SpawnEntity(color + "Rook", new MapCoordinates(x + i * separation, y, mapId)); + session.Entities.Add(tempQualifier); break; case 'n': - session.Entities.Add(entityManager.SpawnEntity(color + "Knight", new MapCoordinates(x + i * separation, y, mapId)).Uid); + IEntity tempQualifier1 = entityManager.SpawnEntity(color + "Knight", new MapCoordinates(x + i * separation, y, mapId)); + session.Entities.Add(tempQualifier1); break; case 'b': - session.Entities.Add(entityManager.SpawnEntity(color + "Bishop", new MapCoordinates(x + i * separation, y, mapId)).Uid); + IEntity tempQualifier2 = entityManager.SpawnEntity(color + "Bishop", new MapCoordinates(x + i * separation, y, mapId)); + session.Entities.Add(tempQualifier2); break; case 'q': - session.Entities.Add(entityManager.SpawnEntity(color + "Queen", new MapCoordinates(x + i * separation, y, mapId)).Uid); + IEntity tempQualifier3 = entityManager.SpawnEntity(color + "Queen", new MapCoordinates(x + i * separation, y, mapId)); + session.Entities.Add(tempQualifier3); break; case 'k': - session.Entities.Add(entityManager.SpawnEntity(color + "King", new MapCoordinates(x + i * separation, y, mapId)).Uid); + IEntity tempQualifier4 = entityManager.SpawnEntity(color + "King", new MapCoordinates(x + i * separation, y, mapId)); + session.Entities.Add(tempQualifier4); break; } } @@ -76,7 +83,8 @@ namespace Content.Server.Tabletop for (int i = 0; i < 8; i++) { - session.Entities.Add(entityManager.SpawnEntity(color + "Pawn", new MapCoordinates(x + i * separation, y, mapId)).Uid); + IEntity tempQualifier = entityManager.SpawnEntity(color + "Pawn", new MapCoordinates(x + i * separation, y, mapId)); + session.Entities.Add(tempQualifier); } } } diff --git a/Content.Server/Tabletop/TabletopParchisSetup.cs b/Content.Server/Tabletop/TabletopParchisSetup.cs index c6de3f916d..85501e8eb2 100644 --- a/Content.Server/Tabletop/TabletopParchisSetup.cs +++ b/Content.Server/Tabletop/TabletopParchisSetup.cs @@ -35,28 +35,44 @@ namespace Content.Server.Tabletop var center = session.Position; // Red pieces. - session.Entities.Add(entityManager.SpawnEntity(RedPiecePrototype, center.Offset(-x1, -y1)).Uid); - session.Entities.Add(entityManager.SpawnEntity(RedPiecePrototype, center.Offset(-x1, -y2)).Uid); - session.Entities.Add(entityManager.SpawnEntity(RedPiecePrototype, center.Offset(-x2, -y1)).Uid); - session.Entities.Add(entityManager.SpawnEntity(RedPiecePrototype, center.Offset(-x2, -y2)).Uid); + IEntity tempQualifier = entityManager.SpawnEntity(RedPiecePrototype, center.Offset(-x1, -y1)); + session.Entities.Add(tempQualifier); + IEntity tempQualifier1 = entityManager.SpawnEntity(RedPiecePrototype, center.Offset(-x1, -y2)); + session.Entities.Add(tempQualifier1); + IEntity tempQualifier2 = entityManager.SpawnEntity(RedPiecePrototype, center.Offset(-x2, -y1)); + session.Entities.Add(tempQualifier2); + IEntity tempQualifier3 = entityManager.SpawnEntity(RedPiecePrototype, center.Offset(-x2, -y2)); + session.Entities.Add(tempQualifier3); // Green pieces. - session.Entities.Add(entityManager.SpawnEntity(GreenPiecePrototype, center.Offset(x1, -y1)).Uid); - session.Entities.Add(entityManager.SpawnEntity(GreenPiecePrototype, center.Offset(x1, -y2)).Uid); - session.Entities.Add(entityManager.SpawnEntity(GreenPiecePrototype, center.Offset(x2, -y1)).Uid); - session.Entities.Add(entityManager.SpawnEntity(GreenPiecePrototype, center.Offset(x2, -y2)).Uid); + IEntity tempQualifier4 = entityManager.SpawnEntity(GreenPiecePrototype, center.Offset(x1, -y1)); + session.Entities.Add(tempQualifier4); + IEntity tempQualifier5 = entityManager.SpawnEntity(GreenPiecePrototype, center.Offset(x1, -y2)); + session.Entities.Add(tempQualifier5); + IEntity tempQualifier6 = entityManager.SpawnEntity(GreenPiecePrototype, center.Offset(x2, -y1)); + session.Entities.Add(tempQualifier6); + IEntity tempQualifier7 = entityManager.SpawnEntity(GreenPiecePrototype, center.Offset(x2, -y2)); + session.Entities.Add(tempQualifier7); // Yellow pieces. - session.Entities.Add(entityManager.SpawnEntity(YellowPiecePrototype, center.Offset(x1, y1)).Uid); - session.Entities.Add(entityManager.SpawnEntity(YellowPiecePrototype, center.Offset(x1, y2)).Uid); - session.Entities.Add(entityManager.SpawnEntity(YellowPiecePrototype, center.Offset(x2, y1)).Uid); - session.Entities.Add(entityManager.SpawnEntity(YellowPiecePrototype, center.Offset(x2, y2)).Uid); + IEntity tempQualifier8 = entityManager.SpawnEntity(YellowPiecePrototype, center.Offset(x1, y1)); + session.Entities.Add(tempQualifier8); + IEntity tempQualifier9 = entityManager.SpawnEntity(YellowPiecePrototype, center.Offset(x1, y2)); + session.Entities.Add(tempQualifier9); + IEntity tempQualifier10 = entityManager.SpawnEntity(YellowPiecePrototype, center.Offset(x2, y1)); + session.Entities.Add(tempQualifier10); + IEntity tempQualifier11 = entityManager.SpawnEntity(YellowPiecePrototype, center.Offset(x2, y2)); + session.Entities.Add(tempQualifier11); // Blue pieces. - session.Entities.Add(entityManager.SpawnEntity(BluePiecePrototype, center.Offset(-x1, y1)).Uid); - session.Entities.Add(entityManager.SpawnEntity(BluePiecePrototype, center.Offset(-x1, y2)).Uid); - session.Entities.Add(entityManager.SpawnEntity(BluePiecePrototype, center.Offset(-x2, y1)).Uid); - session.Entities.Add(entityManager.SpawnEntity(BluePiecePrototype, center.Offset(-x2, y2)).Uid); + IEntity tempQualifier12 = entityManager.SpawnEntity(BluePiecePrototype, center.Offset(-x1, y1)); + session.Entities.Add(tempQualifier12); + IEntity tempQualifier13 = entityManager.SpawnEntity(BluePiecePrototype, center.Offset(-x1, y2)); + session.Entities.Add(tempQualifier13); + IEntity tempQualifier14 = entityManager.SpawnEntity(BluePiecePrototype, center.Offset(-x2, y1)); + session.Entities.Add(tempQualifier14); + IEntity tempQualifier15 = entityManager.SpawnEntity(BluePiecePrototype, center.Offset(-x2, y2)); + session.Entities.Add(tempQualifier15); } } } diff --git a/Content.Server/Tabletop/TabletopSystem.Draggable.cs b/Content.Server/Tabletop/TabletopSystem.Draggable.cs index 3410b8b3c2..71562a159b 100644 --- a/Content.Server/Tabletop/TabletopSystem.Draggable.cs +++ b/Content.Server/Tabletop/TabletopSystem.Draggable.cs @@ -46,13 +46,13 @@ namespace Content.Server.Tabletop if (!EntityManager.TryGetEntity(msg.MovedEntityUid, out var movedEntity)) return; - if (!EntityManager.HasComponent(movedEntity.Uid)) + if (!EntityManager.HasComponent(movedEntity)) return; // TODO: some permission system, disallow movement if you're not permitted to move the item // 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(movedEntity.Uid); + var transform = EntityManager.GetComponent(movedEntity); var entityCoordinates = new EntityCoordinates(_mapManager.GetMapEntityId(transform.MapID), msg.Coordinates.Position); transform.Coordinates = entityCoordinates; } @@ -61,11 +61,11 @@ namespace Content.Server.Tabletop { var draggedEntity = EntityManager.GetEntity(msg.DraggedEntityUid); - if (!IoCManager.Resolve().TryGetComponent(draggedEntity.Uid, out var draggableComponent)) return; + if (!IoCManager.Resolve().TryGetComponent(draggedEntity, out var draggableComponent)) return; draggableComponent.DraggingPlayer = msg.DraggingPlayer; - if (!IoCManager.Resolve().TryGetComponent(draggedEntity.Uid, out var appearance)) return; + if (!IoCManager.Resolve().TryGetComponent(draggedEntity, out var appearance)) return; if (draggableComponent.DraggingPlayer != null) { diff --git a/Content.Server/Tabletop/TabletopSystem.Session.cs b/Content.Server/Tabletop/TabletopSystem.Session.cs index d4c1513c69..dcc961fef6 100644 --- a/Content.Server/Tabletop/TabletopSystem.Session.cs +++ b/Content.Server/Tabletop/TabletopSystem.Session.cs @@ -82,7 +82,7 @@ namespace Content.Server.Tabletop if (session.Players.ContainsKey(player)) return; - if(IoCManager.Resolve().TryGetComponent(attachedEntity.Uid, out var gamer)) + if(IoCManager.Resolve().TryGetComponent(attachedEntity, out var gamer)) CloseSessionFor(player, gamer.Tabletop, false); // Set the entity as an absolute GAMER. @@ -111,13 +111,13 @@ namespace Content.Server.Tabletop if (!session.Players.TryGetValue(player, out var data)) return; - if(removeGamerComponent && player.AttachedEntity is {} attachedEntity && IoCManager.Resolve().TryGetComponent(attachedEntity.Uid, out TabletopGamerComponent? gamer)) + if(removeGamerComponent && player.AttachedEntity is {} attachedEntity && IoCManager.Resolve().TryGetComponent(attachedEntity, out TabletopGamerComponent? gamer)) { // We invalidate this to prevent an infinite feedback from removing the component. gamer.Tabletop = EntityUid.Invalid; // You stop being a gamer....... - IoCManager.Resolve().RemoveComponent(attachedEntity.Uid); + IoCManager.Resolve().RemoveComponent(attachedEntity); } session.Players.Remove(player); @@ -149,9 +149,9 @@ namespace Content.Server.Tabletop eyeComponent.Zoom = tabletop.CameraZoom; // Add the user to the view subscribers. If there is no player session, just skip this step - _viewSubscriberSystem.AddViewSubscriber(camera.Uid, player); + _viewSubscriberSystem.AddViewSubscriber(camera, player); - return camera.Uid; + return camera; } } } diff --git a/Content.Server/Tabletop/TabletopSystem.cs b/Content.Server/Tabletop/TabletopSystem.cs index f4db76a41c..7785eae8e6 100644 --- a/Content.Server/Tabletop/TabletopSystem.cs +++ b/Content.Server/Tabletop/TabletopSystem.cs @@ -42,7 +42,7 @@ namespace Content.Server.Tabletop if (!args.CanAccess || !args.CanInteract) return; - if (!IoCManager.Resolve().TryGetComponent(args.User.Uid, out var actor)) + if (!IoCManager.Resolve().TryGetComponent(args.User, out var actor)) return; Verb verb = new(); @@ -55,11 +55,11 @@ namespace Content.Server.Tabletop private void OnTabletopActivate(EntityUid uid, TabletopGameComponent component, ActivateInWorldEvent args) { // Check that a player is attached to the entity. - if (!EntityManager.TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) return; // Check that the entity can interact with the game board. - if(_actionBlockerSystem.CanInteract(args.User.Uid)) + if(_actionBlockerSystem.CanInteract(args.User)) OpenSessionFor(actor.PlayerSession, uid); } @@ -97,9 +97,9 @@ namespace Content.Server.Tabletop if (!EntityManager.EntityExists(gamer.Tabletop)) continue; - if (!IoCManager.Resolve().TryGetComponent(gamer.Owner.Uid, out ActorComponent? actor)) + if (!IoCManager.Resolve().TryGetComponent(gamer.Owner, out ActorComponent? actor)) { - IoCManager.Resolve().RemoveComponent(gamer.Owner.Uid); + IoCManager.Resolve().RemoveComponent(gamer.Owner); return; }; diff --git a/Content.Server/Temperature/Components/HeatResistanceComponent.cs b/Content.Server/Temperature/Components/HeatResistanceComponent.cs index 401dda2d55..b3cc28da7b 100644 --- a/Content.Server/Temperature/Components/HeatResistanceComponent.cs +++ b/Content.Server/Temperature/Components/HeatResistanceComponent.cs @@ -15,7 +15,7 @@ namespace Content.Server.Temperature.Components { // TODO: When making into system: Any animal that touches bulb that has no // InventoryComponent but still would have default heat resistance in the future (maybe) - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out var inventoryComp)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out var inventoryComp)) { // Magical number just copied from below return int.MinValue; diff --git a/Content.Server/Temperature/Components/TemperatureComponent.cs b/Content.Server/Temperature/Components/TemperatureComponent.cs index b7a9b9764d..5f6b19f2f4 100644 --- a/Content.Server/Temperature/Components/TemperatureComponent.cs +++ b/Content.Server/Temperature/Components/TemperatureComponent.cs @@ -46,7 +46,7 @@ namespace Content.Server.Temperature.Components { get { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var physics) && physics.Mass != 0) + if (IoCManager.Resolve().TryGetComponent(Owner, out var physics) && physics.Mass != 0) { return SpecificHeat * physics.Mass; } diff --git a/Content.Server/Throwing/ThrowHelper.cs b/Content.Server/Throwing/ThrowHelper.cs index 82c8c72e04..b9bfc9331d 100644 --- a/Content.Server/Throwing/ThrowHelper.cs +++ b/Content.Server/Throwing/ThrowHelper.cs @@ -33,9 +33,9 @@ namespace Content.Server.Throwing /// The ratio of impulse applied to the thrower internal static void TryThrow(this IEntity entity, Vector2 direction, float strength = 1.0f, IEntity? user = null, float pushbackRatio = 1.0f) { - if ((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || + if ((!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Deleted || strength <= 0f || - !IoCManager.Resolve().TryGetComponent(entity.Uid, out PhysicsComponent? physicsComponent)) + !IoCManager.Resolve().TryGetComponent(entity, out PhysicsComponent? physicsComponent)) { return; } @@ -46,14 +46,14 @@ namespace Content.Server.Throwing return; } - if (IoCManager.Resolve().HasComponent(entity.Uid)) + if (IoCManager.Resolve().HasComponent(entity)) { Logger.Warning("Throwing not supported for mobs!"); return; } var comp = entity.EnsureComponent(); - if (IoCManager.Resolve().HasComponent(entity.Uid)) + if (IoCManager.Resolve().HasComponent(entity)) { comp.Thrower = user; // Give it a l'il spin. @@ -63,7 +63,7 @@ namespace Content.Server.Throwing } else if(direction != Vector2.Zero) { - IoCManager.Resolve().GetComponent(entity.Uid).LocalRotation = direction.ToWorldAngle() - Math.PI; + IoCManager.Resolve().GetComponent(entity).LocalRotation = direction.ToWorldAngle() - Math.PI; } if (user != null) @@ -94,10 +94,10 @@ namespace Content.Server.Throwing } // Give thrower an impulse in the other direction - if (user != null && pushbackRatio > 0.0f && IoCManager.Resolve().TryGetComponent(user.Uid, out IPhysBody? body)) + if (user != null && pushbackRatio > 0.0f && IoCManager.Resolve().TryGetComponent(user, out IPhysBody? body)) { var msg = new ThrowPushbackAttemptEvent(); - IoCManager.Resolve().EventBus.RaiseLocalEvent(body.Owner.Uid, msg); + IoCManager.Resolve().EventBus.RaiseLocalEvent(body.Owner, msg); if (!msg.Cancelled) { diff --git a/Content.Server/Tiles/FloorTileItemComponent.cs b/Content.Server/Tiles/FloorTileItemComponent.cs index 2deb8d4fbe..d7bdc4c295 100644 --- a/Content.Server/Tiles/FloorTileItemComponent.cs +++ b/Content.Server/Tiles/FloorTileItemComponent.cs @@ -58,7 +58,7 @@ namespace Content.Server.Tiles if (!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true)) return true; - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out StackComponent? stack)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out StackComponent? stack)) return true; var mapManager = IoCManager.Resolve(); @@ -83,7 +83,7 @@ namespace Content.Server.Tiles if (HasBaseTurf(currentTileDefinition, baseTurf.Name)) { - if (!EntitySystem.Get().Use(Owner.Uid, 1, stack)) + if (!EntitySystem.Get().Use(Owner, 1, stack)) continue; PlaceAt(mapGrid, location, currentTileDefinition.TileId); diff --git a/Content.Server/Toilet/ToiletComponent.cs b/Content.Server/Toilet/ToiletComponent.cs index d566271e3f..9ef10fb061 100644 --- a/Content.Server/Toilet/ToiletComponent.cs +++ b/Content.Server/Toilet/ToiletComponent.cs @@ -68,7 +68,7 @@ namespace Content.Server.Toilet async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { // are player trying place or lift of cistern lid? - if (IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out ToolComponent? tool) + if (IoCManager.Resolve().TryGetComponent(eventArgs.Using, out ToolComponent? tool) && tool.Qualities.Contains(_pryingQuality)) { // check if someone is already prying this toilet @@ -76,7 +76,7 @@ namespace Content.Server.Toilet return false; _isPrying = true; - if (!await EntitySystem.Get().UseTool(eventArgs.Using.Uid, eventArgs.User.Uid, Owner.Uid, 0f, PryLidTime, _pryingQuality)) + if (!await EntitySystem.Get().UseTool(eventArgs.Using, eventArgs.User, Owner, 0f, PryLidTime, _pryingQuality)) { _isPrying = false; return false; @@ -112,7 +112,7 @@ namespace Content.Server.Toilet // just want to up/down seat? // check that nobody seats on seat right now - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out StrapComponent? strap)) + if (IoCManager.Resolve().TryGetComponent(Owner, out StrapComponent? strap)) { if (strap.BuckledEntities.Count != 0) return false; @@ -143,7 +143,7 @@ namespace Content.Server.Toilet private void UpdateSprite() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(ToiletVisuals.LidOpen, LidOpen); appearance.SetData(ToiletVisuals.SeatUp, IsSeatUp); @@ -153,23 +153,23 @@ namespace Content.Server.Toilet SuicideKind ISuicideAct.Suicide(IEntity victim, IChatManager chat) { // check that victim even have head - if (IoCManager.Resolve().TryGetComponent(victim.Uid, out var body) && + if (IoCManager.Resolve().TryGetComponent(victim, out var body) && body.HasPartOfType(BodyPartType.Head)) { - var othersMessage = Loc.GetString("toilet-component-suicide-head-message-others", ("victim",Name: IoCManager.Resolve().GetComponent(victim.Uid).EntityName),("owner", Name: IoCManager.Resolve().GetComponent(Owner.Uid).EntityName)); + var othersMessage = Loc.GetString("toilet-component-suicide-head-message-others", ("victim",Name: IoCManager.Resolve().GetComponent(victim).EntityName),("owner", Name: IoCManager.Resolve().GetComponent(Owner).EntityName)); victim.PopupMessageOtherClients(othersMessage); - var selfMessage = Loc.GetString("toilet-component-suicide-head-message", ("owner", Name: IoCManager.Resolve().GetComponent(Owner.Uid).EntityName)); + var selfMessage = Loc.GetString("toilet-component-suicide-head-message", ("owner", Name: IoCManager.Resolve().GetComponent(Owner).EntityName)); victim.PopupMessage(selfMessage); return SuicideKind.Asphyxiation; } else { - var othersMessage = Loc.GetString("toilet-component-suicide-message-others",("victim", Name: IoCManager.Resolve().GetComponent(victim.Uid).EntityName),("owner", Name: IoCManager.Resolve().GetComponent(Owner.Uid).EntityName)); + var othersMessage = Loc.GetString("toilet-component-suicide-message-others",("victim", Name: IoCManager.Resolve().GetComponent(victim).EntityName),("owner", Name: IoCManager.Resolve().GetComponent(Owner).EntityName)); victim.PopupMessageOtherClients(othersMessage); - var selfMessage = Loc.GetString("toilet-component-suicide-message", ("owner",Name: IoCManager.Resolve().GetComponent(Owner.Uid).EntityName)); + var selfMessage = Loc.GetString("toilet-component-suicide-message", ("owner",Name: IoCManager.Resolve().GetComponent(Owner).EntityName)); victim.PopupMessage(selfMessage); return SuicideKind.Blunt; diff --git a/Content.Server/Tools/Components/TilePryingComponent.cs b/Content.Server/Tools/Components/TilePryingComponent.cs index bf12ed8af0..efa25dec18 100644 --- a/Content.Server/Tools/Components/TilePryingComponent.cs +++ b/Content.Server/Tools/Components/TilePryingComponent.cs @@ -34,7 +34,7 @@ namespace Content.Server.Tools.Components public async void TryPryTile(IEntity user, EntityCoordinates clickLocation) { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out var tool) && _toolComponentNeeded) + if (!IoCManager.Resolve().TryGetComponent(Owner, out var tool) && _toolComponentNeeded) return; if (!_mapManager.TryGetGrid(clickLocation.GetGridId(IoCManager.Resolve()), out var mapGrid)) @@ -52,7 +52,7 @@ namespace Content.Server.Tools.Components if (!tileDef.CanCrowbar) return; - if (_toolComponentNeeded && !await EntitySystem.Get().UseTool(Owner.Uid, user.Uid, null, 0f, 0f, _qualityNeeded, toolComponent:tool)) + if (_toolComponentNeeded && !await EntitySystem.Get().UseTool(Owner, user, null, 0f, 0f, _qualityNeeded, toolComponent:tool)) return; coordinates.PryTile(IoCManager.Resolve(), _mapManager); diff --git a/Content.Server/Tools/ToolSystem.Welder.cs b/Content.Server/Tools/ToolSystem.Welder.cs index 22f4338f5f..e82f48bbdb 100644 --- a/Content.Server/Tools/ToolSystem.Welder.cs +++ b/Content.Server/Tools/ToolSystem.Welder.cs @@ -115,7 +115,7 @@ namespace Content.Server.Tools SoundSystem.Play(Filter.Pvs(uid), welder.WelderOnSounds.GetSound(), uid, AudioHelpers.WithVariation(0.125f).WithVolume(-5f)); // TODO: Use TransformComponent directly. - _atmosphereSystem.HotspotExpose(IoCManager.Resolve().GetComponent(welder.Owner.Uid).Coordinates, 700, 50, true); + _atmosphereSystem.HotspotExpose(IoCManager.Resolve().GetComponent(welder.Owner).Coordinates, 700, 50, true); welder.Dirty(); @@ -197,7 +197,7 @@ namespace Content.Server.Tools private void OnWelderActivate(EntityUid uid, WelderComponent welder, ActivateInWorldEvent args) { - args.Handled = TryToggleWelder(uid, args.User.Uid, welder); + args.Handled = TryToggleWelder(uid, args.User, welder); } private void OnWelderAfterInteract(EntityUid uid, WelderComponent welder, AfterInteractEvent args) @@ -210,15 +210,15 @@ namespace Content.Server.Tools // TODO: Clean up this inherited oldcode. - if (IoCManager.Resolve().TryGetComponent(args.Target.Uid, out ReagentTankComponent? tank) + if (IoCManager.Resolve().TryGetComponent(args.Target, out ReagentTankComponent? tank) && tank.TankType == ReagentTankType.Fuel - && _solutionContainerSystem.TryGetDrainableSolution(args.Target.Uid, out var targetSolution) + && _solutionContainerSystem.TryGetDrainableSolution(args.Target, out var targetSolution) && _solutionContainerSystem.TryGetSolution(uid, welder.FuelSolution, out var welderSolution)) { var trans = FixedPoint2.Min(welderSolution.AvailableVolume, targetSolution.DrainAvailable); if (trans > 0) { - var drained = _solutionContainerSystem.Drain(args.Target.Uid, targetSolution, trans); + var drained = _solutionContainerSystem.Drain(args.Target, targetSolution, trans); _solutionContainerSystem.TryAddSolution(uid, welderSolution, drained); SoundSystem.Play(Filter.Pvs(uid), welder.WelderRefill.GetSound(), uid); args.Target.PopupMessage(args.User, Loc.GetString("welder-component-after-interact-refueled-message")); @@ -234,7 +234,7 @@ namespace Content.Server.Tools private void OnWelderUseInHand(EntityUid uid, WelderComponent welder, UseInHandEvent args) { - args.Handled = TryToggleWelder(uid, args.User.Uid, welder); + args.Handled = TryToggleWelder(uid, args.User, welder); } private void OnWelderToolUseAttempt(EntityUid uid, WelderComponent welder, ToolUseAttemptEvent args) @@ -318,7 +318,7 @@ namespace Content.Server.Tools continue; // TODO: Use TransformComponent directly. - _atmosphereSystem.HotspotExpose(IoCManager.Resolve().GetComponent(welder.Owner.Uid).Coordinates, 700, 50, true); + _atmosphereSystem.HotspotExpose(IoCManager.Resolve().GetComponent(welder.Owner).Coordinates, 700, 50, true); solution.RemoveReagent(welder.FuelReagent, welder.FuelConsumption * _welderTimer); diff --git a/Content.Server/Traitor/Uplink/Account/UplinkAccountsSystem.cs b/Content.Server/Traitor/Uplink/Account/UplinkAccountsSystem.cs index 4477ff57be..8bf95e0101 100644 --- a/Content.Server/Traitor/Uplink/Account/UplinkAccountsSystem.cs +++ b/Content.Server/Traitor/Uplink/Account/UplinkAccountsSystem.cs @@ -107,7 +107,7 @@ namespace Content.Server.Traitor.Uplink.Account // create a stack of TCs near player var stackEntity = EntityManager.SpawnEntity(TelecrystalProtoId, spawnCoords); - stackUid = stackEntity.Uid; + stackUid = stackEntity; // set right amount in stack _stackSystem.SetCount(stackUid.Value, actTC); diff --git a/Content.Server/Traitor/Uplink/Commands/AddUplinkCommand.cs b/Content.Server/Traitor/Uplink/Commands/AddUplinkCommand.cs index 104354d4aa..6b0add0d5e 100644 --- a/Content.Server/Traitor/Uplink/Commands/AddUplinkCommand.cs +++ b/Content.Server/Traitor/Uplink/Commands/AddUplinkCommand.cs @@ -68,7 +68,7 @@ namespace Content.Server.Traitor.Uplink.Commands var tcCount = configManager.GetCVar(CCVars.TraitorStartingBalance); // Get account - var uplinkAccount = new UplinkAccount(tcCount, user.Uid); + var uplinkAccount = new UplinkAccount(tcCount, user); var accounts = entityManager.EntitySysManager.GetEntitySystem(); accounts.AddNewAccount(uplinkAccount); diff --git a/Content.Server/Traitor/Uplink/Telecrystal/TelecrystalSystem.cs b/Content.Server/Traitor/Uplink/Telecrystal/TelecrystalSystem.cs index 64071fa6b6..387411ede1 100644 --- a/Content.Server/Traitor/Uplink/Telecrystal/TelecrystalSystem.cs +++ b/Content.Server/Traitor/Uplink/Telecrystal/TelecrystalSystem.cs @@ -26,7 +26,7 @@ namespace Content.Server.Traitor.Uplink.Telecrystal if (args.Handled) return; - if (args.Target == null || !EntityManager.TryGetComponent(args.Target.Uid, out UplinkComponent? uplink)) + if (args.Target == null || !EntityManager.TryGetComponent(args.Target, out UplinkComponent? uplink)) return; // TODO: when uplink will have some auth logic (like PDA ringtone code) diff --git a/Content.Server/Traitor/Uplink/UplinkSystem.cs b/Content.Server/Traitor/Uplink/UplinkSystem.cs index a8b90a4833..426527be16 100644 --- a/Content.Server/Traitor/Uplink/UplinkSystem.cs +++ b/Content.Server/Traitor/Uplink/UplinkSystem.cs @@ -84,7 +84,7 @@ namespace Content.Server.Traitor.Uplink if (component.UplinkAccount == null) return; - if (!EntityManager.TryGetComponent(args.User.Uid, out ActorComponent? actor)) + if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) return; var actionBlocker = EntitySystem.Get(); @@ -118,7 +118,7 @@ namespace Content.Server.Traitor.Uplink if (uplink.UplinkAccount == null) return; if (!_accounts.TryPurchaseItem(uplink.UplinkAccount, message.ItemId, - IoCManager.Resolve().GetComponent(player.Uid).Coordinates, out var entity)) + IoCManager.Resolve().GetComponent(player).Coordinates, out var entity)) { SoundSystem.Play(Filter.SinglePlayer(message.Session), uplink.InsufficientFundsSound.GetSound(), uplink.Owner, AudioParams.Default); @@ -126,8 +126,8 @@ namespace Content.Server.Traitor.Uplink return; } - if (IoCManager.Resolve().TryGetComponent(player.Uid, out HandsComponent? hands) && - IoCManager.Resolve().TryGetComponent(entity.Uid, out ItemComponent? item)) + if (IoCManager.Resolve().TryGetComponent(player, out HandsComponent? hands) && + IoCManager.Resolve().TryGetComponent(entity, out ItemComponent? item)) { hands.PutInHandOrDrop(item); } @@ -146,14 +146,14 @@ namespace Content.Server.Traitor.Uplink var player = args.Session.AttachedEntity; if (player == null) return; - var cords = IoCManager.Resolve().GetComponent(player.Uid).Coordinates; + var cords = IoCManager.Resolve().GetComponent(player).Coordinates; // try to withdraw TCs from account if (!_accounts.TryWithdrawTC(acc, args.TC, cords, out var tcUid)) return; // try to put it into players hands - if (IoCManager.Resolve().TryGetComponent(player.Uid, out SharedHandsComponent? hands)) + if (IoCManager.Resolve().TryGetComponent(player, out SharedHandsComponent? hands)) hands.TryPutInAnyHand(EntityManager.GetEntity(tcUid.Value)); // play buying sound @@ -208,7 +208,7 @@ namespace Content.Server.Traitor.Uplink private IEntity? FindUplinkTarget(IEntity user) { // Try to find PDA in inventory - if (IoCManager.Resolve().TryGetComponent(user.Uid, out InventoryComponent? inventory)) + if (IoCManager.Resolve().TryGetComponent(user, out InventoryComponent? inventory)) { var foundPDA = inventory.LookupItems().FirstOrDefault(); if (foundPDA != null) @@ -216,12 +216,12 @@ namespace Content.Server.Traitor.Uplink } // Also check hands - if (IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? hands)) + if (IoCManager.Resolve().TryGetComponent(user, out HandsComponent? hands)) { var heldItems = hands.GetAllHeldItems(); foreach (var item in heldItems) { - if (IoCManager.Resolve().HasComponent(item.Owner.Uid)) + if (IoCManager.Resolve().HasComponent(item.Owner)) return item.Owner; } } diff --git a/Content.Server/TraitorDeathMatch/Components/TraitorDeathMatchRedemptionComponent.cs b/Content.Server/TraitorDeathMatch/Components/TraitorDeathMatchRedemptionComponent.cs index 779804e3f2..622d298327 100644 --- a/Content.Server/TraitorDeathMatch/Components/TraitorDeathMatchRedemptionComponent.cs +++ b/Content.Server/TraitorDeathMatch/Components/TraitorDeathMatchRedemptionComponent.cs @@ -21,14 +21,14 @@ namespace Content.Server.TraitorDeathMatch.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out var userInv)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out var userInv)) { Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-main-message", ("secondMessage", Loc.GetString("traitor-death-match-redemption-component-interact-using-no-inventory-message")))); return false; } - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out var userMindComponent)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out var userMindComponent)) { Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-main-message", ("secondMessage", Loc.GetString("traitor-death-match-redemption-component-interact-using-no-mind-message")))); @@ -43,14 +43,14 @@ namespace Content.Server.TraitorDeathMatch.Components return false; } - if (!IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out var victimUplink)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.Using, out var victimUplink)) { Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-main-message", ("secondMessage", Loc.GetString("traitor-death-match-redemption-component-interact-using-no-pda-message")))); return false; } - if (!IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out var victimPDAOwner)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.Using, out var victimPDAOwner)) { Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-main-message", ("secondMessage", Loc.GetString("traitor-death-match-redemption-component-interact-using-no-pda-owner-message")))); @@ -68,7 +68,7 @@ namespace Content.Server.TraitorDeathMatch.Components UplinkComponent? userUplink = null; if (userPDAEntity != null) - if (IoCManager.Resolve().TryGetComponent(userPDAEntity.Uid, out var userUplinkComponent)) + if (IoCManager.Resolve().TryGetComponent(userPDAEntity, out var userUplinkComponent)) userUplink = userUplinkComponent; if (userUplink == null) @@ -111,7 +111,7 @@ namespace Content.Server.TraitorDeathMatch.Components accounts.SetBalance(victimAccount, 0); accounts.AddToBalance(userAccount, transferAmount); - IoCManager.Resolve().DeleteEntity(victimUplink.Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) victimUplink.Owner); Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-success-message", ("tcAmount", transferAmount))); return true; diff --git a/Content.Server/UserInterface/ActivatableUISystem.cs b/Content.Server/UserInterface/ActivatableUISystem.cs index e6e2bfdb13..6e051a7e64 100644 --- a/Content.Server/UserInterface/ActivatableUISystem.cs +++ b/Content.Server/UserInterface/ActivatableUISystem.cs @@ -67,11 +67,11 @@ namespace Content.Server.UserInterface private bool InteractUI(IEntity user, ActivatableUIComponent aui) { - if (!IoCManager.Resolve().TryGetComponent(user.Uid, out ActorComponent? actor)) return false; + if (!IoCManager.Resolve().TryGetComponent(user, out ActorComponent? actor)) return false; if (aui.AdminOnly && !_adminManager.IsAdmin(actor.PlayerSession)) return false; - if (!_actionBlockerSystem.CanInteract(user.Uid)) + if (!_actionBlockerSystem.CanInteract(user)) { user.PopupMessageCursor(Loc.GetString("base-computer-ui-component-cannot-interact")); return true; diff --git a/Content.Server/UserInterface/UserInterfaceHelpers.cs b/Content.Server/UserInterface/UserInterfaceHelpers.cs index e12ddcd66a..0ad14e3d17 100644 --- a/Content.Server/UserInterface/UserInterfaceHelpers.cs +++ b/Content.Server/UserInterface/UserInterfaceHelpers.cs @@ -8,7 +8,7 @@ namespace Content.Server.UserInterface { public static BoundUserInterface? GetUIOrNull(this IEntity entity, object uiKey) { - return IoCManager.Resolve().GetComponentOrNull(entity.Uid)?.GetBoundUserInterfaceOrNull(uiKey); + return IoCManager.Resolve().GetComponentOrNull(entity)?.GetBoundUserInterfaceOrNull(uiKey); } } } diff --git a/Content.Server/VendingMachines/VendingMachineComponent.cs b/Content.Server/VendingMachines/VendingMachineComponent.cs index f753531ff1..c61bde068b 100644 --- a/Content.Server/VendingMachines/VendingMachineComponent.cs +++ b/Content.Server/VendingMachines/VendingMachineComponent.cs @@ -41,7 +41,7 @@ namespace Content.Server.VendingMachines private string _packPrototypeId = string.Empty; private string _spriteName = ""; - private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver) || receiver.Powered; + private bool Powered => !IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered; private bool _broken; [DataField("soundVend")] @@ -57,14 +57,14 @@ namespace Content.Server.VendingMachines void IActivate.Activate(ActivateEventArgs eventArgs) { - if(!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if(!IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) { return; } if (!Powered) return; - var wires = IoCManager.Resolve().GetComponent(Owner.Uid); + var wires = IoCManager.Resolve().GetComponent(Owner); if (wires.IsPanelOpen) { wires.OpenInterface(actor.PlayerSession); @@ -82,12 +82,12 @@ namespace Content.Server.VendingMachines return; } - IoCManager.Resolve().GetComponent(Owner.Uid).EntityName = packPrototype.Name; + IoCManager.Resolve().GetComponent(Owner).EntityName = packPrototype.Name; _animationDuration = TimeSpan.FromSeconds(packPrototype.AnimationDuration); _spriteName = packPrototype.SpriteName; if (!string.IsNullOrEmpty(_spriteName)) { - var spriteComponent = IoCManager.Resolve().GetComponent(Owner.Uid); + var spriteComponent = IoCManager.Resolve().GetComponent(Owner); const string vendingMachineRSIPath = "Structures/Machines/VendingMachines/{0}.rsi"; spriteComponent.BaseRSIPath = string.Format(vendingMachineRSIPath, _spriteName); } @@ -109,7 +109,7 @@ namespace Content.Server.VendingMachines UserInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage; } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ApcPowerReceiverComponent? receiver)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver)) { TrySetVisualState(receiver.Powered ? VendingMachineVisualState.Normal : VendingMachineVisualState.Off); } @@ -185,7 +185,7 @@ namespace Content.Server.VendingMachines { _ejecting = false; TrySetVisualState(VendingMachineVisualState.Normal); - IoCManager.Resolve().SpawnEntity(id, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + IoCManager.Resolve().SpawnEntity(id, IoCManager.Resolve().GetComponent(Owner).Coordinates); }); SoundSystem.Play(Filter.Pvs(Owner), _soundVend.GetSound(), Owner, AudioParams.Default.WithVolume(-2f)); @@ -193,10 +193,10 @@ namespace Content.Server.VendingMachines private void TryEject(string id, IEntity? sender) { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out var accessReader)) + if (IoCManager.Resolve().TryGetComponent(Owner, out var accessReader)) { var accessSystem = EntitySystem.Get(); - if (sender == null || !accessSystem.IsAllowed(accessReader, sender.Uid)) + if (sender == null || !accessSystem.IsAllowed(accessReader, sender)) { Owner.PopupMessageEveryone(Loc.GetString("vending-machine-component-try-eject-access-denied")); Deny(); @@ -235,7 +235,7 @@ namespace Content.Server.VendingMachines finalState = VendingMachineVisualState.Off; } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(VendingMachineVisuals.VisualState, finalState); } diff --git a/Content.Server/Verbs/Commands/InvokeVerbCommand.cs b/Content.Server/Verbs/Commands/InvokeVerbCommand.cs index e8a87981c1..3d38cb9dba 100644 --- a/Content.Server/Verbs/Commands/InvokeVerbCommand.cs +++ b/Content.Server/Verbs/Commands/InvokeVerbCommand.cs @@ -78,7 +78,7 @@ namespace Content.Server.Verbs.Commands verbs.TryGetValue(key, out var vset) && vset.Any()) { - verbSystem.ExecuteVerb(vset.First(), playerEntity.Uid, target.Uid, forced: true); + verbSystem.ExecuteVerb(vset.First(), playerEntity, target, forced: true); shell.WriteLine(Loc.GetString("invoke-verb-command-success", ("verb", verbName), ("target", target), ("player", playerEntity))); return; } @@ -89,7 +89,7 @@ namespace Content.Server.Verbs.Commands { if (verb.Text.ToLowerInvariant() == verbName) { - verbSystem.ExecuteVerb(verb, playerEntity.Uid, target.Uid, forced: true); + verbSystem.ExecuteVerb(verb, playerEntity, target, forced: true); shell.WriteLine(Loc.GetString("invoke-verb-command-success", ("verb", verb.Text), ("target", target), ("player", playerEntity))); return; } diff --git a/Content.Server/Verbs/VerbSystem.cs b/Content.Server/Verbs/VerbSystem.cs index 906038366c..79e0feaa8e 100644 --- a/Content.Server/Verbs/VerbSystem.cs +++ b/Content.Server/Verbs/VerbSystem.cs @@ -45,7 +45,7 @@ namespace Content.Server.Verbs // Find the requested verb. if (verbs.TryGetValue(args.RequestedVerb, out var verb)) - ExecuteVerb(verb, userEntity.Uid, args.Target); + ExecuteVerb(verb, userEntity, args.Target); else // 404 Verb not found. Note that this could happen due to something as simple as opening the verb menu, walking away, then trying // to run the pickup-item verb. So maybe this shouldn't even be logged? diff --git a/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs b/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs index 81d1881801..8afa847a6f 100644 --- a/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs +++ b/Content.Server/Weapon/Melee/MeleeWeaponSystem.cs @@ -81,7 +81,7 @@ namespace Content.Server.Weapon.Melee var owner = EntityManager.GetEntity(uid); var target = args.TargetEntity; - var location = IoCManager.Resolve().GetComponent(args.User.Uid).Coordinates; + var location = IoCManager.Resolve().GetComponent(args.User).Coordinates; var diff = args.ClickLocation.ToMapPos(IoCManager.Resolve()) - location.ToMapPos(IoCManager.Resolve()); var angle = Angle.FromWorldVec(diff); @@ -96,9 +96,9 @@ namespace Content.Server.Weapon.Melee var targets = new[] { target }; SendAnimation(comp.ClickArc, angle, args.User, owner, targets, comp.ClickAttackEffect, false); - RaiseLocalEvent(target.Uid, new AttackedEvent(args.Used, args.User, args.ClickLocation)); + RaiseLocalEvent(target, new AttackedEvent(args.Used, args.User, args.ClickLocation)); - var damage = _damageableSystem.TryChangeDamage(target.Uid, + var damage = _damageableSystem.TryChangeDamage(target, DamageSpecifier.ApplyModifierSets(comp.Damage, hitEvent.ModifiersList)); if (damage != null) @@ -138,12 +138,12 @@ namespace Content.Server.Weapon.Melee var owner = EntityManager.GetEntity(uid); - var location = IoCManager.Resolve().GetComponent(args.User.Uid).Coordinates; + var location = IoCManager.Resolve().GetComponent(args.User).Coordinates; var diff = args.ClickLocation.ToMapPos(IoCManager.Resolve()) - location.ToMapPos(IoCManager.Resolve()); var angle = Angle.FromWorldVec(diff); // This should really be improved. GetEntitiesInArc uses pos instead of bounding boxes. - var entities = ArcRayCast(IoCManager.Resolve().GetComponent(args.User.Uid).WorldPosition, angle, comp.ArcWidth, comp.Range, IoCManager.Resolve().GetComponent(owner.Uid).MapID, args.User); + var entities = ArcRayCast(IoCManager.Resolve().GetComponent(args.User).WorldPosition, angle, comp.ArcWidth, comp.Range, IoCManager.Resolve().GetComponent(owner).MapID, args.User); var hitEntities = new List(); foreach (var entity in entities) @@ -151,7 +151,7 @@ namespace Content.Server.Weapon.Melee if (entity.IsInContainer() || entity == args.User) continue; - if (EntityManager.HasComponent(entity.Uid)) + if (EntityManager.HasComponent(entity)) { hitEntities.Add(entity); } @@ -166,18 +166,18 @@ namespace Content.Server.Weapon.Melee { if (entities.Count != 0) { - SoundSystem.Play(Filter.Pvs(owner), comp.HitSound.GetSound(), IoCManager.Resolve().GetComponent(entities.First().Uid).Coordinates); + SoundSystem.Play(Filter.Pvs(owner), comp.HitSound.GetSound(), IoCManager.Resolve().GetComponent(entities.First()).Coordinates); } else { - SoundSystem.Play(Filter.Pvs(owner), comp.MissSound.GetSound(), IoCManager.Resolve().GetComponent(args.User.Uid).Coordinates); + SoundSystem.Play(Filter.Pvs(owner), comp.MissSound.GetSound(), IoCManager.Resolve().GetComponent(args.User).Coordinates); } foreach (var entity in hitEntities) { - RaiseLocalEvent(entity.Uid, new AttackedEvent(args.Used, args.User, args.ClickLocation)); + RaiseLocalEvent(entity, new AttackedEvent(args.Used, args.User, args.ClickLocation)); - var damage = _damageableSystem.TryChangeDamage(entity.Uid, + var damage = _damageableSystem.TryChangeDamage(entity, DamageSpecifier.ApplyModifierSets(comp.Damage, hitEvent.ModifiersList)); if (damage != null) @@ -219,7 +219,7 @@ namespace Content.Server.Weapon.Melee if (args.Target == null) return; - var location = IoCManager.Resolve().GetComponent(args.User.Uid).Coordinates; + var location = IoCManager.Resolve().GetComponent(args.User).Coordinates; var diff = args.ClickLocation.ToMapPos(IoCManager.Resolve()) - location.ToMapPos(IoCManager.Resolve()); var angle = Angle.FromWorldVec(diff); @@ -263,16 +263,16 @@ namespace Content.Server.Weapon.Melee private void OnChemicalInjectorHit(EntityUid uid, MeleeChemicalInjectorComponent comp, MeleeHitEvent args) { IEntity owner = EntityManager.GetEntity(uid); - if (!_solutionsSystem.TryGetInjectableSolution(owner.Uid, out var solutionContainer)) + if (!_solutionsSystem.TryGetInjectableSolution(owner, out var solutionContainer)) return; var hitBloodstreams = new List(); foreach (var entity in args.HitEntities) { - if ((!IoCManager.Resolve().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(entity).EntityLifeStage) >= EntityLifeStage.Deleted) continue; - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out var bloodstream)) + if (IoCManager.Resolve().TryGetComponent(entity, out var bloodstream)) hitBloodstreams.Add(bloodstream); } @@ -293,13 +293,13 @@ namespace Content.Server.Weapon.Melee public void SendAnimation(string arc, Angle angle, IEntity attacker, IEntity source, IEnumerable hits, bool textureEffect = false, bool arcFollowAttacker = true) { - RaiseNetworkEvent(new MeleeWeaponSystemMessages.PlayMeleeWeaponAnimationMessage(arc, angle, attacker.Uid, source.Uid, - hits.Select(e => e.Uid).ToList(), textureEffect, arcFollowAttacker), Filter.Pvs(source, 1f)); + RaiseNetworkEvent(new MeleeWeaponSystemMessages.PlayMeleeWeaponAnimationMessage(arc, angle, attacker, source, + hits.Select(e => (EntityUid) e).ToList(), textureEffect, arcFollowAttacker), Filter.Pvs(source, 1f)); } public void SendLunge(Angle angle, IEntity source) { - RaiseNetworkEvent(new MeleeWeaponSystemMessages.PlayLungeAnimationMessage(angle, source.Uid), Filter.Pvs(source, 1f)); + RaiseNetworkEvent(new MeleeWeaponSystemMessages.PlayLungeAnimationMessage(angle, source), Filter.Pvs(source, 1f)); } } diff --git a/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoBoxComponent.cs b/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoBoxComponent.cs index e5b6806096..d74a069f14 100644 --- a/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoBoxComponent.cs +++ b/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoBoxComponent.cs @@ -73,7 +73,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components private void UpdateAppearance() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearanceComponent)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearanceComponent)) { appearanceComponent.SetData(MagazineBarrelVisuals.MagLoaded, true); appearanceComponent.SetData(AmmoVisuals.AmmoCount, AmmoLeft); @@ -91,10 +91,10 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components if (_unspawnedCount > 0) { - ammo = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + ammo = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); // when dumping from held ammo box, this detaches the spawned ammo from the player. - IoCManager.Resolve().GetComponent(ammo.Uid).AttachParentToContainerOrGrid(); + IoCManager.Resolve().GetComponent(ammo).AttachParentToContainerOrGrid(); _unspawnedCount--; } @@ -104,7 +104,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components public bool TryInsertAmmo(IEntity user, IEntity entity) { - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out AmmoComponent? ammoComponent)) + if (!IoCManager.Resolve().TryGetComponent(entity, out AmmoComponent? ammoComponent)) { return false; } @@ -129,12 +129,12 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - if (IoCManager.Resolve().HasComponent(eventArgs.Using.Uid)) + if (IoCManager.Resolve().HasComponent(eventArgs.Using)) { return TryInsertAmmo(eventArgs.User, eventArgs.Using); } - if (IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out RangedMagazineComponent? rangedMagazine)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.Using, out RangedMagazineComponent? rangedMagazine)) { for (var i = 0; i < Math.Max(10, rangedMagazine.ShotsLeft); i++) { @@ -160,7 +160,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components private bool TryUse(IEntity user) { - if (!IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(user, out HandsComponent? handsComponent)) { return false; } @@ -172,7 +172,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components return false; } - if (IoCManager.Resolve().TryGetComponent(ammo.Uid, out ItemComponent? item)) + if (IoCManager.Resolve().TryGetComponent(ammo, out ItemComponent? item)) { if (!handsComponent.CanPutInHand(item)) { diff --git a/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoComponent.cs b/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoComponent.cs index b6be339de5..a8328dc75a 100644 --- a/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoComponent.cs +++ b/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoComponent.cs @@ -117,7 +117,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components } _spent = true; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearanceComponent)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearanceComponent)) { appearanceComponent.SetData(AmmoVisuals.Spent, true); } @@ -144,7 +144,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components EffectSprite = _muzzleFlashSprite, Born = time, DeathTime = deathTime, - AttachedEntityUid = entity.Uid, + AttachedEntityUid = entity, AttachedOffset = offset, //Rotated from east facing Rotation = (float) angle.Theta, diff --git a/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs b/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs index 5baa875aca..dd3888018b 100644 --- a/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs +++ b/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs @@ -77,7 +77,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components } } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearanceComponent)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearanceComponent)) { _appearanceComponent = appearanceComponent; } @@ -93,7 +93,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components public bool TryInsertAmmo(IEntity user, IEntity ammo) { - if (!IoCManager.Resolve().TryGetComponent(ammo.Uid, out AmmoComponent? ammoComponent)) + if (!IoCManager.Resolve().TryGetComponent(ammo, out AmmoComponent? ammoComponent)) { return false; } @@ -128,7 +128,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components else if (_unspawnedCount > 0) { _unspawnedCount--; - ammo = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + ammo = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); } UpdateAppearance(); @@ -142,7 +142,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components bool IUse.UseEntity(UseEntityEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out HandsComponent? handsComponent)) { return false; } @@ -153,10 +153,10 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components return false; } - var itemComponent = IoCManager.Resolve().GetComponent(ammo.Uid); + var itemComponent = IoCManager.Resolve().GetComponent(ammo); if (!handsComponent.CanPutInHand(itemComponent)) { - IoCManager.Resolve().GetComponent(ammo.Uid).Coordinates = IoCManager.Resolve().GetComponent(eventArgs.User.Uid).Coordinates; + IoCManager.Resolve().GetComponent(ammo).Coordinates = IoCManager.Resolve().GetComponent(eventArgs.User).Coordinates; ServerRangedBarrelComponent.EjectCasing(ammo); } else diff --git a/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs b/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs index 3d7e14a13e..bdd0688867 100644 --- a/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs +++ b/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs @@ -59,7 +59,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components private void UpdateAppearance() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearanceComponent)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearanceComponent)) { appearanceComponent?.SetData(MagazineBarrelVisuals.MagLoaded, true); appearanceComponent?.SetData(AmmoVisuals.AmmoCount, AmmoLeft); @@ -69,7 +69,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components public bool TryInsertAmmo(IEntity user, IEntity entity) { - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out AmmoComponent? ammoComponent)) + if (!IoCManager.Resolve().TryGetComponent(entity, out AmmoComponent? ammoComponent)) { return false; } @@ -95,7 +95,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components private bool UseEntity(IEntity user) { - if (!IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(user, out HandsComponent? handsComponent)) { return false; } @@ -106,7 +106,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components return false; } - var itemComponent = IoCManager.Resolve().GetComponent(ammo.Uid); + var itemComponent = IoCManager.Resolve().GetComponent(ammo); if (!handsComponent.CanPutInHand(itemComponent)) { ServerRangedBarrelComponent.EjectCasing(ammo); @@ -130,7 +130,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components if (_unspawnedCount > 0) { - entity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + entity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); _unspawnedCount--; } @@ -147,7 +147,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components // This area is dirty but not sure of an easier way to do it besides add an interface or somethin var changed = false; - if (IoCManager.Resolve().TryGetComponent(eventArgs.Target.Uid, out RevolverBarrelComponent? revolverBarrel)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.Target, out RevolverBarrelComponent? revolverBarrel)) { for (var i = 0; i < Capacity; i++) { @@ -167,7 +167,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components TryInsertAmmo(eventArgs.User, ammo); break; } - } else if (IoCManager.Resolve().TryGetComponent(eventArgs.Target.Uid, out BoltActionBarrelComponent? boltActionBarrel)) + } else if (IoCManager.Resolve().TryGetComponent(eventArgs.Target, out BoltActionBarrelComponent? boltActionBarrel)) { for (var i = 0; i < Capacity; i++) { diff --git a/Content.Server/Weapon/Ranged/Barrels/BarrelSystem.cs b/Content.Server/Weapon/Ranged/Barrels/BarrelSystem.cs index 436f2fbd60..a9485e066c 100644 --- a/Content.Server/Weapon/Ranged/Barrels/BarrelSystem.cs +++ b/Content.Server/Weapon/Ranged/Barrels/BarrelSystem.cs @@ -71,11 +71,11 @@ namespace Content.Server.Weapon.Ranged.Barrels !args.CanInteract || !component.PowerCellRemovable || component.PowerCell == null || - !_actionBlockerSystem.CanPickup(args.User.Uid)) + !_actionBlockerSystem.CanPickup(args.User)) return; Verb verb = new(); - verb.Text = IoCManager.Resolve().GetComponent(component.PowerCell.Owner.Uid).EntityName; + verb.Text = IoCManager.Resolve().GetComponent(component.PowerCell.Owner).EntityName; verb.Category = VerbCategory.Eject; verb.Act = () => component.TryEjectCell(args.User); args.Verbs.Add(verb); @@ -87,12 +87,12 @@ namespace Content.Server.Weapon.Ranged.Barrels !args.CanAccess || !args.CanInteract || component.PowerCell != null || - !IoCManager.Resolve().HasComponent(args.Using.Uid) || - !_actionBlockerSystem.CanDrop(args.User.Uid)) + !IoCManager.Resolve().HasComponent(args.Using) || + !_actionBlockerSystem.CanDrop(args.User)) return; Verb verb = new(); - verb.Text = IoCManager.Resolve().GetComponent(args.Using.Uid).EntityName; + verb.Text = IoCManager.Resolve().GetComponent(args.Using).EntityName; verb.Category = VerbCategory.Insert; verb.Act = () => component.TryInsertPowerCell(args.Using); args.Verbs.Add(verb); @@ -104,14 +104,14 @@ namespace Content.Server.Weapon.Ranged.Barrels !args.CanAccess || !args.CanInteract || !component.HasMagazine || - !_actionBlockerSystem.CanPickup(args.User.Uid)) + !_actionBlockerSystem.CanPickup(args.User)) return; if (component.MagNeedsOpenBolt && !component.BoltOpen) return; Verb verb = new(); - verb.Text = IoCManager.Resolve().GetComponent(component.MagazineContainer.ContainedEntity!.Uid).EntityName; + verb.Text = IoCManager.Resolve().GetComponent(component.MagazineContainer.ContainedEntity!).EntityName; verb.Category = VerbCategory.Eject; verb.Act = () => component.RemoveMagazine(args.User); args.Verbs.Add(verb); @@ -135,12 +135,12 @@ namespace Content.Server.Weapon.Ranged.Barrels // Are we holding a mag that we can insert? if (args.Using == null || !component.CanInsertMagazine(args.User, args.Using) || - !_actionBlockerSystem.CanDrop(args.User.Uid)) + !_actionBlockerSystem.CanDrop(args.User)) return; // Insert mag verb Verb insert = new(); - insert.Text = IoCManager.Resolve().GetComponent(args.Using.Uid).EntityName; + insert.Text = IoCManager.Resolve().GetComponent(args.Using).EntityName; insert.Category = VerbCategory.Insert; insert.Act = () => component.InsertMagazine(args.User, args.Using); args.Verbs.Add(insert); diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs index 5ab89867b6..bdc167c284 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs @@ -111,7 +111,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components if (_unspawnedCount > 0) { _unspawnedCount--; - var chamberEntity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var chamberEntity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); _chamberContainer.Insert(chamberEntity); } } @@ -125,7 +125,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components // (Is one chambered?, is the bullet spend) var chamber = (chamberedExists, false); - if (chamberedExists && IoCManager.Resolve().TryGetComponent(_chamberContainer.ContainedEntity!.Uid, out var ammo)) + if (chamberedExists && IoCManager.Resolve().TryGetComponent(_chamberContainer.ContainedEntity!, out var ammo)) { chamber.Item2 = ammo.Spent; } @@ -155,7 +155,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components _chamberContainer = ContainerHelpers.EnsureContainer(Owner, $"{Name}-chamber-container"); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearanceComponent)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearanceComponent)) { _appearanceComponent = appearanceComponent; } @@ -192,7 +192,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components if (chamberEntity == null) return null; - return IoCManager.Resolve().GetComponentOrNull(chamberEntity.Uid)?.TakeBullet(spawnAt); + return IoCManager.Resolve().GetComponentOrNull(chamberEntity)?.TakeBullet(spawnAt); } protected override bool WeaponCanFire() @@ -230,7 +230,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components public bool TryInsertBullet(IEntity user, IEntity ammo) { - if (!IoCManager.Resolve().TryGetComponent(ammo.Uid, out AmmoComponent? ammoComponent)) + if (!IoCManager.Resolve().TryGetComponent(ammo, out AmmoComponent? ammoComponent)) { return false; } @@ -299,7 +299,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components { return false; } - if (!IoCManager.Resolve().GetComponent(chamberedEntity.Uid).Caseless) + if (!IoCManager.Resolve().GetComponent(chamberedEntity).Caseless) { EjectCasing(chamberedEntity); } @@ -323,7 +323,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components else if (_unspawnedCount > 0) { _unspawnedCount--; - var ammoEntity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var ammoEntity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); _chamberContainer.Insert(ammoEntity); return true; } diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs index 5f1f94d71f..dfcc0592db 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs @@ -86,7 +86,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components // (Is one chambered?, is the bullet spend) var chamber = (chamberedExists, false); - if (chamberedExists && IoCManager.Resolve().TryGetComponent(_chamberContainer.ContainedEntity!.Uid, out var ammo)) + if (chamberedExists && IoCManager.Resolve().TryGetComponent(_chamberContainer.ContainedEntity!, out var ammo)) { chamber.Item2 = ammo.Spent; } @@ -125,7 +125,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components _unspawnedCount--; } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearanceComponent)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearanceComponent)) { _appearanceComponent = appearanceComponent; } @@ -162,7 +162,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components if (chamberEntity == null) return null; - return IoCManager.Resolve().GetComponentOrNull(chamberEntity.Uid)?.TakeBullet(spawnAt); + return IoCManager.Resolve().GetComponentOrNull(chamberEntity)?.TakeBullet(spawnAt); } private void Cycle(bool manual = false) @@ -171,7 +171,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components if (chamberedEntity != null) { _chamberContainer.Remove(chamberedEntity); - var ammoComponent = IoCManager.Resolve().GetComponent(chamberedEntity.Uid); + var ammoComponent = IoCManager.Resolve().GetComponent(chamberedEntity); if (!ammoComponent.Caseless) { EjectCasing(chamberedEntity); @@ -187,7 +187,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components if (_unspawnedCount > 0) { _unspawnedCount--; - var ammoEntity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var ammoEntity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); _chamberContainer.Insert(ammoEntity); } @@ -202,7 +202,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components public bool TryInsertBullet(InteractUsingEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out AmmoComponent? ammoComponent)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.Using, out AmmoComponent? ammoComponent)) { return false; } diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs index bd75feb5bb..ba331670e3 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs @@ -82,7 +82,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components { slotsSpent[i] = null; var ammoEntity = _ammoSlots[i]; - if (ammoEntity != null && IoCManager.Resolve().TryGetComponent(ammoEntity.Uid, out AmmoComponent? ammo)) + if (ammoEntity != null && IoCManager.Resolve().TryGetComponent(ammoEntity, out AmmoComponent? ammo)) { slotsSpent[i] = ammo.Spent; } @@ -114,7 +114,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components for (var i = 0; i < _unspawnedCount; i++) { - var entity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var entity = IoCManager.Resolve().SpawnEntity(_fillPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); _ammoSlots[idx] = entity; _ammoContainer.Insert(entity); idx++; @@ -126,7 +126,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components private void UpdateAppearance() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { return; } @@ -139,7 +139,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components public bool TryInsertBullet(IEntity user, IEntity entity) { - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out AmmoComponent? ammoComponent)) + if (!IoCManager.Resolve().TryGetComponent(entity, out AmmoComponent? ammoComponent)) { return false; } @@ -209,7 +209,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components IEntity? bullet = null; if (ammo != null) { - var ammoComponent = IoCManager.Resolve().GetComponent(ammo.Uid); + var ammoComponent = IoCManager.Resolve().GetComponent(ammo); bullet = ammoComponent.TakeBullet(spawnAt); if (ammoComponent.Caseless) { diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs index 1d99526b6d..34bc239db4 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs @@ -65,7 +65,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components return 0; } - return (int) Math.Ceiling(IoCManager.Resolve().GetComponent(powerCell.Uid).CurrentCharge / _baseFireCost); + return (int) Math.Ceiling(IoCManager.Resolve().GetComponent(powerCell).CurrentCharge / _baseFireCost); } } @@ -80,7 +80,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components return 0; } - return (int) Math.Ceiling((float) (IoCManager.Resolve().GetComponent(powerCell.Uid).MaxCharge / _baseFireCost)); + return (int) Math.Ceiling((float) (IoCManager.Resolve().GetComponent(powerCell).MaxCharge / _baseFireCost)); } } @@ -107,7 +107,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components _powerCellContainer = ContainerHelpers.EnsureContainer(Owner, $"{Name}-powercell-container", out var existing); if (!existing && _powerCellPrototype != null) { - var powerCellEntity = IoCManager.Resolve().SpawnEntity(_powerCellPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var powerCellEntity = IoCManager.Resolve().SpawnEntity(_powerCellPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); _powerCellContainer.Insert(powerCellEntity); } @@ -116,7 +116,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components _ammoContainer = ContainerHelpers.EnsureContainer(Owner, $"{Name}-ammo-container"); } - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearanceComponent)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearanceComponent)) { _appearanceComponent = appearanceComponent; } @@ -144,7 +144,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components var ammo = _ammoContainer.ContainedEntity; if (ammo == null) { - ammo = IoCManager.Resolve().SpawnEntity(_ammoPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + ammo = IoCManager.Resolve().SpawnEntity(_ammoPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); _ammoContainer.Insert(ammo); } @@ -160,7 +160,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components return null; } - var capacitor = IoCManager.Resolve().GetComponent(powerCellEntity.Uid); + var capacitor = IoCManager.Resolve().GetComponent(powerCellEntity); if (capacitor.CurrentCharge < _lowerChargeLimit) { return null; @@ -181,20 +181,20 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components { entity = _ammoContainer.ContainedEntity; _ammoContainer.Remove(entity); - IoCManager.Resolve().GetComponent(entity.Uid).Coordinates = spawnAt; + IoCManager.Resolve().GetComponent(entity).Coordinates = spawnAt; } else { entity = IoCManager.Resolve().SpawnEntity(_ammoPrototype, spawnAt); } - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ProjectileComponent? projectileComponent)) + if (IoCManager.Resolve().TryGetComponent(entity, out ProjectileComponent? projectileComponent)) { if (energyRatio < 1.0) { projectileComponent.Damage *= energyRatio; } - } else if (IoCManager.Resolve().TryGetComponent(entity.Uid, out HitscanComponent? hitscanComponent)) + } else if (IoCManager.Resolve().TryGetComponent(entity, out HitscanComponent? hitscanComponent)) { hitscanComponent.Damage *= energyRatio; hitscanComponent.ColorModifier = energyRatio; @@ -216,7 +216,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components return false; } - if (!IoCManager.Resolve().HasComponent(entity.Uid)) + if (!IoCManager.Resolve().HasComponent(entity)) { return false; } @@ -252,7 +252,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components return false; } - if (!IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(user, out HandsComponent? hands)) { return false; } @@ -266,9 +266,9 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components Dirty(); UpdateAppearance(); - if (!hands.PutInHand(IoCManager.Resolve().GetComponent(cell.Owner.Uid))) + if (!hands.PutInHand(IoCManager.Resolve().GetComponent(cell.Owner))) { - IoCManager.Resolve().GetComponent(cell.Owner.Uid).Coordinates = IoCManager.Resolve().GetComponent(user.Uid).Coordinates; + IoCManager.Resolve().GetComponent(cell.Owner).Coordinates = IoCManager.Resolve().GetComponent(user).Coordinates; } SoundSystem.Play(Filter.Pvs(Owner), _soundPowerCellEject.GetSound(), Owner, AudioParams.Default.WithVolume(-2)); @@ -277,7 +277,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components public override async Task InteractUsing(InteractUsingEventArgs eventArgs) { - if (!IoCManager.Resolve().HasComponent(eventArgs.Using.Uid)) + if (!IoCManager.Resolve().HasComponent(eventArgs.Using)) { return false; } diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs index 00362579fd..16abb91686 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs @@ -58,7 +58,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components var magazine = MagazineContainer.ContainedEntity; if (magazine != null) { - count += IoCManager.Resolve().GetComponent(magazine.Uid).ShotsLeft; + count += IoCManager.Resolve().GetComponent(magazine).ShotsLeft; } return count; @@ -74,7 +74,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components var magazine = MagazineContainer.ContainedEntity; if (magazine != null) { - count += IoCManager.Resolve().GetComponent(magazine.Uid).Capacity; + count += IoCManager.Resolve().GetComponent(magazine).Capacity; } return count; @@ -154,7 +154,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components { (int, int)? count = null; var magazine = MagazineContainer.ContainedEntity; - if (magazine != null && IoCManager.Resolve().TryGetComponent(magazine.Uid, out RangedMagazineComponent? rangedMagazineComponent)) + if (magazine != null && IoCManager.Resolve().TryGetComponent(magazine, out RangedMagazineComponent? rangedMagazineComponent)) { count = (rangedMagazineComponent.ShotsLeft, rangedMagazineComponent.Capacity); } @@ -170,7 +170,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components { base.Initialize(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearanceComponent)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearanceComponent)) { _appearanceComponent = appearanceComponent; } @@ -180,7 +180,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components if (!existing && _magFillPrototype != null) { - var magEntity = IoCManager.Resolve().SpawnEntity(_magFillPrototype, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + var magEntity = IoCManager.Resolve().SpawnEntity(_magFillPrototype, IoCManager.Resolve().GetComponent(Owner).Coordinates); MagazineContainer.Insert(magEntity); } Dirty(); @@ -206,7 +206,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components var entity = _chamberContainer.ContainedEntity; Cycle(); - return (entity != null ? IoCManager.Resolve().GetComponent(entity.Uid) : null).TakeBullet(spawnAt); + return (entity != null ? IoCManager.Resolve().GetComponent(entity) : null).TakeBullet(spawnAt); } private void Cycle(bool manual = false) @@ -280,7 +280,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components { return false; } - var ammoComponent = IoCManager.Resolve().GetComponent(chamberEntity.Uid); + var ammoComponent = IoCManager.Resolve().GetComponent(chamberEntity); if (!ammoComponent.Caseless) { EjectCasing(chamberEntity); @@ -299,7 +299,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components // Try and pull a round from the magazine to replace the chamber if possible var magazine = MagazineContainer.ContainedEntity; - var nextRound = (magazine != null ? IoCManager.Resolve().GetComponent(magazine.Uid) : null).TakeAmmo(); + var nextRound = (magazine != null ? IoCManager.Resolve().GetComponent(magazine) : null).TakeAmmo(); if (nextRound == null) { @@ -308,7 +308,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components _chamberContainer.Insert(nextRound); - if (_autoEjectMag && magazine != null && IoCManager.Resolve().GetComponent(magazine.Uid).ShotsLeft == 0) + if (_autoEjectMag && magazine != null && IoCManager.Resolve().GetComponent(magazine).ShotsLeft == 0) { SoundSystem.Play(Filter.Pvs(Owner), _soundAutoEject.GetSound(), Owner, AudioParams.Default.WithVolume(-2)); @@ -338,9 +338,9 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components MagazineContainer.Remove(mag); SoundSystem.Play(Filter.Pvs(Owner), _soundMagEject.GetSound(), Owner, AudioParams.Default.WithVolume(-2)); - if (IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? handsComponent)) + if (IoCManager.Resolve().TryGetComponent(user, out HandsComponent? handsComponent)) { - handsComponent.PutInHandOrDrop(IoCManager.Resolve().GetComponent(mag.Uid)); + handsComponent.PutInHandOrDrop(IoCManager.Resolve().GetComponent(mag)); } Dirty(); @@ -349,7 +349,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components public bool CanInsertMagazine(IEntity user, IEntity magazine, bool quiet = true) { - if (!IoCManager.Resolve().TryGetComponent(magazine.Uid, out RangedMagazineComponent? magazineComponent)) + if (!IoCManager.Resolve().TryGetComponent(magazine, out RangedMagazineComponent? magazineComponent)) { return false; } @@ -403,7 +403,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components } // Insert 1 ammo - if (IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out AmmoComponent? ammoComponent)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.Using, out AmmoComponent? ammoComponent)) { if (!BoltOpen) { diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs index bb50a89a10..f06767b3a4 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs @@ -149,7 +149,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components protected override void OnRemove() { base.OnRemove(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ServerRangedWeaponComponent? rangedWeaponComponent)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ServerRangedWeaponComponent? rangedWeaponComponent)) { rangedWeaponComponent.Barrel = null; rangedWeaponComponent.FireHandler -= Fire; @@ -204,7 +204,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components } var ammo = PeekAmmo(); - var projectile = TakeProjectile(IoCManager.Resolve().GetComponent(shooter.Uid).Coordinates); + var projectile = TakeProjectile(IoCManager.Resolve().GetComponent(shooter).Coordinates); if (projectile == null) { SoundSystem.Play(Filter.Broadcast(), SoundEmpty.GetSound(), Owner); @@ -212,22 +212,22 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components } // At this point firing is confirmed - var direction = (targetPos - IoCManager.Resolve().GetComponent(shooter.Uid).WorldPosition).ToAngle(); + var direction = (targetPos - IoCManager.Resolve().GetComponent(shooter).WorldPosition).ToAngle(); var angle = GetRecoilAngle(direction); // This should really be client-side but for now we'll just leave it here - if (IoCManager.Resolve().TryGetComponent(shooter.Uid, out CameraRecoilComponent? recoilComponent)) + if (IoCManager.Resolve().TryGetComponent(shooter, out CameraRecoilComponent? recoilComponent)) { recoilComponent.Kick(-angle.ToVec() * 0.15f); } // This section probably needs tweaking so there can be caseless hitscan etc. - if (IoCManager.Resolve().TryGetComponent(projectile.Uid, out HitscanComponent? hitscan)) + if (IoCManager.Resolve().TryGetComponent(projectile, out HitscanComponent? hitscan)) { FireHitscan(shooter, hitscan, angle); } - else if (IoCManager.Resolve().HasComponent(projectile.Uid) && + else if (IoCManager.Resolve().HasComponent(projectile) && ammo != null && - IoCManager.Resolve().TryGetComponent(ammo.Uid, out AmmoComponent? ammoComponent)) + IoCManager.Resolve().TryGetComponent(ammo, out AmmoComponent? ammoComponent)) { FireProjectiles(shooter, projectile, ammoComponent.ProjectilesFired, ammoComponent.EvenSpreadAngle, angle, ammoComponent.Velocity, ammo); @@ -238,7 +238,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components if (ammoComponent.Caseless) { - IoCManager.Resolve().DeleteEntity(ammo.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) ammo); } } else @@ -273,12 +273,12 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components {Direction.East, Direction.North, Direction.NorthWest, Direction.South, Direction.SouthEast, Direction.West}; const float ejectOffset = 1.8f; - var ammo = IoCManager.Resolve().GetComponent(entity.Uid); + var ammo = IoCManager.Resolve().GetComponent(entity); var offsetPos = ((robustRandom.NextFloat() - 0.5f) * ejectOffset, (robustRandom.NextFloat() - 0.5f) * ejectOffset); - IoCManager.Resolve().GetComponent(entity.Uid).Coordinates = IoCManager.Resolve().GetComponent(entity.Uid).Coordinates.Offset(offsetPos); - IoCManager.Resolve().GetComponent(entity.Uid).LocalRotation = robustRandom.Pick(ejectDirections).ToAngle(); + IoCManager.Resolve().GetComponent(entity).Coordinates = IoCManager.Resolve().GetComponent(entity).Coordinates.Offset(offsetPos); + IoCManager.Resolve().GetComponent(entity).LocalRotation = robustRandom.Pick(ejectDirections).ToAngle(); - SoundSystem.Play(Filter.Broadcast(), ammo.SoundCollectionEject.GetSound(), IoCManager.Resolve().GetComponent(entity.Uid).Coordinates, AudioParams.Default.WithVolume(-1)); + SoundSystem.Play(Filter.Broadcast(), ammo.SoundCollectionEject.GetSound(), IoCManager.Resolve().GetComponent(entity).Coordinates, AudioParams.Default.WithVolume(-1)); } /// @@ -330,10 +330,10 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components else { projectile = - IoCManager.Resolve().SpawnEntity(IoCManager.Resolve().GetComponent(baseProjectile.Uid).EntityPrototype?.ID, IoCManager.Resolve().GetComponent(baseProjectile.Uid).Coordinates); + IoCManager.Resolve().SpawnEntity(IoCManager.Resolve().GetComponent(baseProjectile).EntityPrototype?.ID, IoCManager.Resolve().GetComponent(baseProjectile).Coordinates); } - firedProjectiles[i] = projectile.Uid; + firedProjectiles[i] = projectile; Angle projectileAngle; @@ -346,10 +346,10 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components projectileAngle = angle; } - var physics = IoCManager.Resolve().GetComponent(projectile.Uid); + var physics = IoCManager.Resolve().GetComponent(projectile); physics.BodyStatus = BodyStatus.InAir; - var projectileComponent = IoCManager.Resolve().GetComponent(projectile.Uid); + var projectileComponent = IoCManager.Resolve().GetComponent(projectile); projectileComponent.IgnoreEntity(shooter); // FIXME: Work around issue where inserting and removing an entity from a container, @@ -357,16 +357,16 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components // See SharedBroadphaseSystem.HandleContainerInsert()... It sets Awake to false, which causes this. projectile.SpawnTimer(TimeSpan.FromMilliseconds(25), () => { - IoCManager.Resolve().GetComponent(projectile.Uid) + IoCManager.Resolve().GetComponent(projectile) .LinearVelocity = projectileAngle.ToVec() * velocity; }); - IoCManager.Resolve().GetComponent(projectile.Uid).WorldRotation = projectileAngle + MathHelper.PiOver2; + IoCManager.Resolve().GetComponent(projectile).WorldRotation = projectileAngle + MathHelper.PiOver2; } IoCManager.Resolve().EventBus.RaiseLocalEvent(OwnerUid, new GunShotEvent(firedProjectiles)); - IoCManager.Resolve().EventBus.RaiseLocalEvent(ammo.Uid, new AmmoShotEvent(firedProjectiles)); + IoCManager.Resolve().EventBus.RaiseLocalEvent(ammo, new AmmoShotEvent(firedProjectiles)); } /// @@ -390,16 +390,16 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components /// private void FireHitscan(IEntity shooter, HitscanComponent hitscan, Angle angle) { - var ray = new CollisionRay(IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates.ToMapPos(IoCManager.Resolve()), angle.ToVec(), (int) hitscan.CollisionMask); + var ray = new CollisionRay(IoCManager.Resolve().GetComponent(Owner).Coordinates.ToMapPos(IoCManager.Resolve()), angle.ToVec(), (int) hitscan.CollisionMask); var physicsManager = EntitySystem.Get(); - var rayCastResults = physicsManager.IntersectRay(IoCManager.Resolve().GetComponent(Owner.Uid).MapID, ray, hitscan.MaxLength, shooter, false).ToList(); + var rayCastResults = physicsManager.IntersectRay(IoCManager.Resolve().GetComponent(Owner).MapID, ray, hitscan.MaxLength, shooter, false).ToList(); if (rayCastResults.Count >= 1) { var result = rayCastResults[0]; var distance = result.Distance; hitscan.FireEffects(shooter, distance, angle, result.HitEntity); - var dmg = EntitySystem.Get().TryChangeDamage(result.HitEntity.Uid, hitscan.Damage); + var dmg = EntitySystem.Get().TryChangeDamage(result.HitEntity, hitscan.Damage); if (dmg != null) EntitySystem.Get().Add(LogType.HitScanHit, $"{shooter} hit {result.HitEntity} using {hitscan.Owner} and dealt {dmg.Total} damage"); diff --git a/Content.Server/Weapon/Ranged/ServerRangedWeaponComponent.cs b/Content.Server/Weapon/Ranged/ServerRangedWeaponComponent.cs index dfbcc63761..86e9183b2c 100644 --- a/Content.Server/Weapon/Ranged/ServerRangedWeaponComponent.cs +++ b/Content.Server/Weapon/Ranged/ServerRangedWeaponComponent.cs @@ -89,7 +89,7 @@ namespace Content.Server.Weapon.Ranged private bool UserCanFire(IEntity user) { - return (UserCanFireHandler == null || UserCanFireHandler(user)) && EntitySystem.Get().CanInteract(user.Uid); + return (UserCanFireHandler == null || UserCanFireHandler(user)) && EntitySystem.Get().CanInteract(user); } /// @@ -146,12 +146,12 @@ namespace Content.Server.Weapon.Ranged /// Target position on the map to shoot at. private void TryFire(IEntity user, Vector2 targetPos) { - if (!IoCManager.Resolve().TryGetComponent(user.Uid, out HandsComponent? hands) || hands.GetActiveHand?.Owner != Owner) + if (!IoCManager.Resolve().TryGetComponent(user, out HandsComponent? hands) || hands.GetActiveHand?.Owner != Owner) { return; } - if (!IoCManager.Resolve().TryGetComponent(user.Uid, out CombatModeComponent? combat) || !combat.IsInCombatMode) + if (!IoCManager.Resolve().TryGetComponent(user, out CombatModeComponent? combat) || !combat.IsInCombatMode) { return; } @@ -173,27 +173,27 @@ namespace Content.Server.Weapon.Ranged if (ClumsyCheck && ClumsyDamage != null && ClumsyComponent.TryRollClumsy(user, ClumsyExplodeChance)) { //Wound them - EntitySystem.Get().TryChangeDamage(user.Uid, ClumsyDamage); - EntitySystem.Get().TryParalyze(user.Uid, TimeSpan.FromSeconds(3f)); + EntitySystem.Get().TryChangeDamage(user, ClumsyDamage); + EntitySystem.Get().TryParalyze(user, TimeSpan.FromSeconds(3f)); // Apply salt to the wound ("Honk!") SoundSystem.Play( Filter.Pvs(Owner), _clumsyWeaponHandlingSound.GetSound(), - IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, AudioParams.Default.WithMaxDistance(5)); + IoCManager.Resolve().GetComponent(Owner).Coordinates, AudioParams.Default.WithMaxDistance(5)); SoundSystem.Play( Filter.Pvs(Owner), _clumsyWeaponShotSound.GetSound(), - IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, AudioParams.Default.WithMaxDistance(5)); + IoCManager.Resolve().GetComponent(Owner).Coordinates, AudioParams.Default.WithMaxDistance(5)); user.PopupMessage(Loc.GetString("server-ranged-weapon-component-try-fire-clumsy")); - IoCManager.Resolve().DeleteEntity(Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) Owner); return; } if (_canHotspot) { - EntitySystem.Get().HotspotExpose(IoCManager.Resolve().GetComponent(user.Uid).Coordinates, 700, 50); + EntitySystem.Get().HotspotExpose(IoCManager.Resolve().GetComponent(user).Coordinates, 700, 50); } FireHandler?.Invoke(user, targetPos); } diff --git a/Content.Server/Weapon/WeaponCapacitorChargerComponent.cs b/Content.Server/Weapon/WeaponCapacitorChargerComponent.cs index b9a4e82cba..67450eeab5 100644 --- a/Content.Server/Weapon/WeaponCapacitorChargerComponent.cs +++ b/Content.Server/Weapon/WeaponCapacitorChargerComponent.cs @@ -19,13 +19,13 @@ namespace Content.Server.Weapon public override bool IsEntityCompatible(IEntity entity) { - return IoCManager.Resolve().TryGetComponent(entity.Uid, out ServerBatteryBarrelComponent? battery) && battery.PowerCell != null || - IoCManager.Resolve().TryGetComponent(entity.Uid, out PowerCellSlotComponent? slot) && slot.HasCell; + return IoCManager.Resolve().TryGetComponent(entity, out ServerBatteryBarrelComponent? battery) && battery.PowerCell != null || + IoCManager.Resolve().TryGetComponent(entity, out PowerCellSlotComponent? slot) && slot.HasCell; } protected override BatteryComponent? GetBatteryFrom(IEntity entity) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out PowerCellSlotComponent? slot)) + if (IoCManager.Resolve().TryGetComponent(entity, out PowerCellSlotComponent? slot)) { if (slot.Cell != null) { @@ -33,7 +33,7 @@ namespace Content.Server.Weapon } } - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out ServerBatteryBarrelComponent? battery)) + if (IoCManager.Resolve().TryGetComponent(entity, out ServerBatteryBarrelComponent? battery)) { if (battery.PowerCell != null) { diff --git a/Content.Server/Wieldable/WieldableSystem.cs b/Content.Server/Wieldable/WieldableSystem.cs index dbf54017a4..51d38dbb67 100644 --- a/Content.Server/Wieldable/WieldableSystem.cs +++ b/Content.Server/Wieldable/WieldableSystem.cs @@ -47,8 +47,8 @@ namespace Content.Server.Wieldable // TODO VERBS ICON + localization verb.Text = component.Wielded ? "Unwield" : "Wield"; verb.Act = component.Wielded - ? () => AttemptUnwield(component.Owner.Uid, component, args.User) - : () => AttemptWield(component.Owner.Uid, component, args.User); + ? () => AttemptUnwield(component.Owner, component, args.User) + : () => AttemptWield(component.Owner, component, args.User); args.Verbs.Add(verb); } @@ -66,7 +66,7 @@ namespace Content.Server.Wieldable public bool CanWield(EntityUid uid, WieldableComponent component, IEntity user, bool quiet=false) { // Do they have enough hands free? - if (!EntityManager.TryGetComponent(user.Uid, out var hands)) + if (!EntityManager.TryGetComponent(user, out var hands)) { if(!quiet) user.PopupMessage(Loc.GetString("wieldable-component-no-hands")); @@ -148,7 +148,7 @@ namespace Content.Server.Wieldable var userEv = new UnwieldedItemEvent(used); RaiseLocalEvent(uid, targEv, false); - RaiseLocalEvent(user.Uid, userEv, false); + RaiseLocalEvent(user, userEv, false); } private void OnItemWielded(EntityUid uid, WieldableComponent component, ItemWieldedEvent args) @@ -173,7 +173,7 @@ namespace Content.Server.Wieldable for (var i = 0; i < component.FreeHandsRequired; i++) { - _virtualItemSystem.TrySpawnVirtualItemInHand(uid, args.User.Uid); + _virtualItemSystem.TrySpawnVirtualItemInHand(uid, args.User); } args.User.PopupMessage(Loc.GetString("wieldable-component-successful-wield", @@ -206,12 +206,12 @@ namespace Content.Server.Wieldable ("item", EntityManager.GetEntity(uid)))); } - _virtualItemSystem.DeleteInHandsMatching(args.User.Uid, uid); + _virtualItemSystem.DeleteInHandsMatching(args.User, uid); } private void OnItemLeaveHand(EntityUid uid, WieldableComponent component, UnequippedHandEvent args) { - if (!component.Wielded || component.Owner.Uid != args.Unequipped.Uid) + if (!component.Wielded || component.Owner != args.Unequipped) return; RaiseLocalEvent(uid, new ItemUnwieldedEvent(args.User, force: true)); } diff --git a/Content.Server/Window/WindowComponent.cs b/Content.Server/Window/WindowComponent.cs index ce5eccf858..76c2de0e62 100644 --- a/Content.Server/Window/WindowComponent.cs +++ b/Content.Server/Window/WindowComponent.cs @@ -44,8 +44,8 @@ namespace Content.Server.Window void IExamine.Examine(FormattedMessage message, bool inDetailsRange) { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out DamageableComponent? damageable) || - !IoCManager.Resolve().TryGetComponent(Owner.Uid, out DestructibleComponent? destructible)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out DamageableComponent? damageable) || + !IoCManager.Resolve().TryGetComponent(Owner, out DestructibleComponent? destructible)) { return; } @@ -105,7 +105,7 @@ namespace Content.Server.Window SoundSystem.Play( Filter.Pvs(eventArgs.Target), _knockSound.GetSound(), - IoCManager.Resolve().GetComponent(eventArgs.Target.Uid).Coordinates, AudioHelpers.WithVariation(0.05f)); + IoCManager.Resolve().GetComponent(eventArgs.Target).Coordinates, AudioHelpers.WithVariation(0.05f)); eventArgs.Target.PopupMessageEveryone(Loc.GetString("comp-window-knock")); _lastKnockTime = _gameTiming.CurTime; diff --git a/Content.Server/WireHacking/WiresComponent.cs b/Content.Server/WireHacking/WiresComponent.cs index 9059be9559..974af84504 100644 --- a/Content.Server/WireHacking/WiresComponent.cs +++ b/Content.Server/WireHacking/WiresComponent.cs @@ -117,7 +117,7 @@ namespace Content.Server.WireHacking private void UpdateAppearance() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(WiresVisuals.MaintenancePanelState, IsPanelOpen && IsPanelVisible); } @@ -175,7 +175,7 @@ namespace Content.Server.WireHacking base.Initialize(); _audioSystem = EntitySystem.Get(); - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) { appearance.SetData(WiresVisuals.MaintenancePanelState, IsPanelOpen); } @@ -230,7 +230,7 @@ namespace Content.Server.WireHacking hackingSystem.TryGetLayout(_layoutId, out layout); } - foreach (var wiresProvider in IoCManager.Resolve().GetComponents(Owner.Uid)) + foreach (var wiresProvider in IoCManager.Resolve().GetComponents(Owner)) { var builder = new WiresBuilder(this, wiresProvider, layout); wiresProvider.RegisterWires(builder); @@ -416,7 +416,7 @@ namespace Content.Server.WireHacking return; } - if (!IoCManager.Resolve().TryGetComponent(player.Uid, out HandsComponent? handsComponent)) + if (!IoCManager.Resolve().TryGetComponent(player, out HandsComponent? handsComponent)) { Owner.PopupMessage(player, Loc.GetString("wires-component-ui-on-receive-message-no-hands")); return; @@ -431,7 +431,7 @@ namespace Content.Server.WireHacking var activeHandEntity = handsComponent.GetActiveHand?.Owner; ToolComponent? tool = null; if(activeHandEntity != null) - IoCManager.Resolve().TryGetComponent(activeHandEntity.Uid, out tool); + IoCManager.Resolve().TryGetComponent(activeHandEntity, out tool); var toolSystem = EntitySystem.Get(); switch (msg.Action) @@ -444,7 +444,7 @@ namespace Content.Server.WireHacking } // activeHandEntity cannot be null because tool is not null. - toolSystem.PlayToolSound(activeHandEntity!.Uid, tool); + toolSystem.PlayToolSound(activeHandEntity!, tool); wire.IsCut = true; UpdateUserInterface(); break; @@ -456,7 +456,7 @@ namespace Content.Server.WireHacking } // activeHandEntity cannot be null because tool is not null. - toolSystem.PlayToolSound(activeHandEntity!.Uid, tool); + toolSystem.PlayToolSound(activeHandEntity!, tool); wire.IsCut = false; UpdateUserInterface(); break; @@ -502,7 +502,7 @@ namespace Content.Server.WireHacking async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.Using.Uid, out var tool)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.Using, out var tool)) { return false; } @@ -514,7 +514,7 @@ namespace Content.Server.WireHacking (tool.Qualities.Contains(_cuttingQuality) || tool.Qualities.Contains(_pulsingQuality))) { - if (IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out ActorComponent? actor)) + if (IoCManager.Resolve().TryGetComponent(eventArgs.User, out ActorComponent? actor)) { OpenInterface(actor.PlayerSession); return true; @@ -522,7 +522,7 @@ namespace Content.Server.WireHacking } // screws the panel open if the tool can do so - else if (await toolSystem.UseTool(tool.Owner.Uid, eventArgs.User.Uid, Owner.Uid, + else if (await toolSystem.UseTool(tool.Owner, eventArgs.User, Owner, 0f, WireHackingSystem.ScrewTime, _screwingQuality, toolComponent:tool)) { IsPanelOpen = !IsPanelOpen; diff --git a/Content.Shared/Actions/Behaviors/IActionBehavior.cs b/Content.Shared/Actions/Behaviors/IActionBehavior.cs index 1d808e8ab8..2a3db91969 100644 --- a/Content.Shared/Actions/Behaviors/IActionBehavior.cs +++ b/Content.Shared/Actions/Behaviors/IActionBehavior.cs @@ -35,9 +35,9 @@ namespace Content.Shared.Actions.Behaviors { Performer = performer; ActionType = actionType; - if (!IoCManager.Resolve().TryGetComponent(Performer.Uid, out PerformerActions)) + if (!IoCManager.Resolve().TryGetComponent(Performer, out PerformerActions)) { - throw new InvalidOperationException($"performer {IoCManager.Resolve().GetComponent(performer.Uid).EntityName} tried to perform action {actionType} " + + throw new InvalidOperationException($"performer {IoCManager.Resolve().GetComponent(performer).EntityName} tried to perform action {actionType} " + $" but the performer had no actions component," + " which should never occur"); } diff --git a/Content.Shared/Actions/Behaviors/Item/IItemActionBehavior.cs b/Content.Shared/Actions/Behaviors/Item/IItemActionBehavior.cs index df1b741abf..8bad8d5227 100644 --- a/Content.Shared/Actions/Behaviors/Item/IItemActionBehavior.cs +++ b/Content.Shared/Actions/Behaviors/Item/IItemActionBehavior.cs @@ -41,10 +41,10 @@ namespace Content.Shared.Actions.Behaviors.Item Performer = performer; ActionType = actionType; Item = item; - if (!IoCManager.Resolve().TryGetComponent(Item.Uid, out ItemActions)) + if (!IoCManager.Resolve().TryGetComponent(Item, out ItemActions)) { - throw new InvalidOperationException($"performer {IoCManager.Resolve().GetComponent(performer.Uid).EntityName} tried to perform item action {actionType} " + - $" for item {IoCManager.Resolve().GetComponent(Item.Uid).EntityName} but the item had no ItemActionsComponent," + + throw new InvalidOperationException($"performer {IoCManager.Resolve().GetComponent(performer).EntityName} tried to perform item action {actionType} " + + $" for item {IoCManager.Resolve().GetComponent(Item).EntityName} but the item had no ItemActionsComponent," + " which should never occur"); } } diff --git a/Content.Shared/Actions/Components/ItemActionsComponent.cs b/Content.Shared/Actions/Components/ItemActionsComponent.cs index 983d06cb5b..db42d9f5d3 100644 --- a/Content.Shared/Actions/Components/ItemActionsComponent.cs +++ b/Content.Shared/Actions/Components/ItemActionsComponent.cs @@ -184,7 +184,7 @@ namespace Content.Shared.Actions.Components void IEquippedHand.EquippedHand(EquippedHandEventArgs eventArgs) { // this entity cannot be granted actions if no actions component - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out var actionsComponent)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out var actionsComponent)) return; Holder = eventArgs.User; _holderActionsComponent = actionsComponent; @@ -196,7 +196,7 @@ namespace Content.Shared.Actions.Components void IEquipped.Equipped(EquippedEventArgs eventArgs) { // this entity cannot be granted actions if no actions component - if (!IoCManager.Resolve().TryGetComponent(eventArgs.User.Uid, out var actionsComponent)) + if (!IoCManager.Resolve().TryGetComponent(eventArgs.User, out var actionsComponent)) return; Holder = eventArgs.User; _holderActionsComponent = actionsComponent; diff --git a/Content.Shared/Actions/Components/SharedActionsComponent.cs b/Content.Shared/Actions/Components/SharedActionsComponent.cs index c470c7e1fa..8d4a3b121b 100644 --- a/Content.Shared/Actions/Components/SharedActionsComponent.cs +++ b/Content.Shared/Actions/Components/SharedActionsComponent.cs @@ -123,7 +123,7 @@ namespace Content.Shared.Actions.Components public bool TryGetItemActionStates(IEntity item, [NotNullWhen((true))] out IReadOnlyDictionary? itemActionStates) { - return TryGetItemActionStates(item.Uid, out itemActionStates); + return TryGetItemActionStates((EntityUid) item, out itemActionStates); } /// @@ -173,7 +173,7 @@ namespace Content.Shared.Actions.Components /// public bool TryGetItemActionState(ItemActionType actionType, IEntity item, out ActionState actionState) { - return TryGetItemActionState(actionType, item.Uid, out actionState); + return TryGetItemActionState(actionType, (EntityUid) item, out actionState); } /// diff --git a/Content.Shared/Actions/IActionAttempt.cs b/Content.Shared/Actions/IActionAttempt.cs index b2d2965ff9..ac8af06bc2 100644 --- a/Content.Shared/Actions/IActionAttempt.cs +++ b/Content.Shared/Actions/IActionAttempt.cs @@ -190,7 +190,7 @@ namespace Content.Shared.Actions public ComponentMessage PerformInstantActionMessage() #pragma warning restore 618 { - return new PerformInstantItemActionMessage(_action.ActionType, _item.Uid); + return new PerformInstantItemActionMessage(_action.ActionType, _item); } #pragma warning disable 618 @@ -199,23 +199,23 @@ namespace Content.Shared.Actions { if (toggleOn) { - return new PerformToggleOnItemActionMessage(_action.ActionType, _item.Uid); + return new PerformToggleOnItemActionMessage(_action.ActionType, _item); } - return new PerformToggleOffItemActionMessage(_action.ActionType, _item.Uid); + return new PerformToggleOffItemActionMessage(_action.ActionType, _item); } #pragma warning disable 618 public ComponentMessage PerformTargetPointActionMessage(PointerInputCmdHandler.PointerInputCmdArgs args) #pragma warning restore 618 { - return new PerformTargetPointItemActionMessage(_action.ActionType, _item.Uid, args.Coordinates); + return new PerformTargetPointItemActionMessage(_action.ActionType, _item, args.Coordinates); } #pragma warning disable 618 public ComponentMessage PerformTargetEntityActionMessage(PointerInputCmdHandler.PointerInputCmdArgs args) #pragma warning restore 618 { - return new PerformTargetEntityItemActionMessage(_action.ActionType, _item.Uid, args.EntityUid); + return new PerformTargetEntityItemActionMessage(_action.ActionType, _item, args.EntityUid); } public override string ToString() diff --git a/Content.Shared/Body/Components/SharedBodyComponent.cs b/Content.Shared/Body/Components/SharedBodyComponent.cs index 8d926a7211..9c39100706 100644 --- a/Content.Shared/Body/Components/SharedBodyComponent.cs +++ b/Content.Shared/Body/Components/SharedBodyComponent.cs @@ -147,7 +147,7 @@ namespace Content.Shared.Body.Components var argsAdded = new BodyPartAddedEventArgs(slot.Id, part); EntitySystem.Get().BodyPartAdded(OwnerUid, argsAdded); - foreach (var component in IoCManager.Resolve().GetComponents(Owner.Uid).ToArray()) + foreach (var component in IoCManager.Resolve().GetComponents(Owner).ToArray()) { component.BodyPartAdded(argsAdded); } @@ -175,7 +175,7 @@ namespace Content.Shared.Body.Components EntitySystem.Get().BodyPartRemoved(OwnerUid, args); - foreach (var component in IoCManager.Resolve().GetComponents(Owner.Uid)) + foreach (var component in IoCManager.Resolve().GetComponents(Owner)) { component.BodyPartRemoved(args); } @@ -547,7 +547,7 @@ namespace Content.Shared.Body.Components continue; } - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out SharedBodyPartComponent? part)) + if (!IoCManager.Resolve().TryGetComponent(entity, out SharedBodyPartComponent? part)) { continue; } diff --git a/Content.Shared/Body/Components/SharedBodyPartComponent.cs b/Content.Shared/Body/Components/SharedBodyPartComponent.cs index 604f3186c0..619f9ef81c 100644 --- a/Content.Shared/Body/Components/SharedBodyPartComponent.cs +++ b/Content.Shared/Body/Components/SharedBodyPartComponent.cs @@ -110,11 +110,11 @@ namespace Content.Shared.Body.Components public BodyPartSymmetry Symmetry { get; private set; } = BodyPartSymmetry.None; [ViewVariables] - public ISurgeryData? SurgeryDataComponent => IoCManager.Resolve().GetComponentOrNull(Owner.Uid); + public ISurgeryData? SurgeryDataComponent => IoCManager.Resolve().GetComponentOrNull(Owner); protected virtual void OnAddMechanism(SharedMechanismComponent mechanism) { - var prototypeId = IoCManager.Resolve().GetComponent(mechanism.Owner.Uid).EntityPrototype!.ID; + var prototypeId = IoCManager.Resolve().GetComponent(mechanism.Owner).EntityPrototype!.ID; if (!_mechanismIds.Contains(prototypeId)) { @@ -129,7 +129,7 @@ namespace Content.Shared.Body.Components protected virtual void OnRemoveMechanism(SharedMechanismComponent mechanism) { - _mechanismIds.Remove(IoCManager.Resolve().GetComponent(mechanism.Owner.Uid).EntityPrototype!.ID); + _mechanismIds.Remove(IoCManager.Resolve().GetComponent(mechanism.Owner).EntityPrototype!.ID); mechanism.Part = null; SizeUsed -= mechanism.Size; @@ -268,7 +268,7 @@ namespace Content.Shared.Body.Components { if (RemoveMechanism(mechanism)) { - IoCManager.Resolve().GetComponent(mechanism.Owner.Uid).Coordinates = coordinates; + IoCManager.Resolve().GetComponent(mechanism.Owner).Coordinates = coordinates; return true; } @@ -293,14 +293,14 @@ namespace Content.Shared.Body.Components return false; } - IoCManager.Resolve().DeleteEntity(mechanism.Owner.Uid); + IoCManager.Resolve().DeleteEntity((EntityUid) mechanism.Owner); return true; } private void AddedToBody(SharedBodyComponent body) { - IoCManager.Resolve().GetComponent(Owner.Uid).LocalRotation = 0; - IoCManager.Resolve().GetComponent(Owner.Uid).AttachParent(body.Owner); + IoCManager.Resolve().GetComponent(Owner).LocalRotation = 0; + IoCManager.Resolve().GetComponent(Owner).AttachParent(body.Owner); OnAddedToBody(body); foreach (var mechanism in _mechanisms) @@ -311,9 +311,9 @@ namespace Content.Shared.Body.Components private void RemovedFromBody(SharedBodyComponent old) { - if (!IoCManager.Resolve().GetComponent(Owner.Uid).Deleted) + if (!IoCManager.Resolve().GetComponent(Owner).Deleted) { - IoCManager.Resolve().GetComponent(Owner.Uid).AttachToGridOrMap(); + IoCManager.Resolve().GetComponent(Owner).AttachToGridOrMap(); } OnRemovedFromBody(old); @@ -370,7 +370,7 @@ namespace Content.Shared.Body.Components continue; } - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out SharedMechanismComponent? mechanism)) + if (!IoCManager.Resolve().TryGetComponent(entity, out SharedMechanismComponent? mechanism)) { continue; } diff --git a/Content.Shared/Buckle/Components/SharedBuckleComponent.cs b/Content.Shared/Buckle/Components/SharedBuckleComponent.cs index 0d0d09491c..dc73c1cb77 100644 --- a/Content.Shared/Buckle/Components/SharedBuckleComponent.cs +++ b/Content.Shared/Buckle/Components/SharedBuckleComponent.cs @@ -37,7 +37,7 @@ namespace Content.Shared.Buckle.Components bool IDraggable.CanDrop(CanDropEvent args) { - return IoCManager.Resolve().HasComponent(args.Target.Uid); + return IoCManager.Resolve().HasComponent(args.Target); } bool IDraggable.Drop(DragDropEvent args) diff --git a/Content.Shared/Buckle/Components/SharedStrapComponent.cs b/Content.Shared/Buckle/Components/SharedStrapComponent.cs index 5c68a6a8d9..6fbd7922b6 100644 --- a/Content.Shared/Buckle/Components/SharedStrapComponent.cs +++ b/Content.Shared/Buckle/Components/SharedStrapComponent.cs @@ -33,7 +33,7 @@ namespace Content.Shared.Buckle.Components bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.Dragged.Uid, out SharedBuckleComponent? buckleComponent)) return false; + if (!IoCManager.Resolve().TryGetComponent(eventArgs.Dragged, out SharedBuckleComponent? buckleComponent)) return false; bool Ignored(IEntity entity) => entity == eventArgs.User || entity == eventArgs.Dragged || entity == eventArgs.Target; return eventArgs.Target.InRangeUnobstructed(eventArgs.Dragged, buckleComponent.Range, predicate: Ignored); diff --git a/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs b/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs index 3148ef3173..abb6b9b500 100644 --- a/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs +++ b/Content.Shared/Chemistry/Reaction/SharedChemicalReactionSystem.cs @@ -187,7 +187,7 @@ namespace Content.Shared.Chemistry.Reaction { var entity = EntityManager.GetEntity(args.SolutionEntity); _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, - $"Reaction effect {effect.GetType().Name} of reaction ${reaction.ID:reaction} applied on entity {entity} at {IoCManager.Resolve().GetComponent(entity.Uid).Coordinates}"); + $"Reaction effect {effect.GetType().Name} of reaction ${reaction.ID:reaction} applied on entity {entity} at {IoCManager.Resolve().GetComponent(entity).Coordinates}"); } effect.Effect(args); diff --git a/Content.Shared/Chemistry/ReactiveSystem.cs b/Content.Shared/Chemistry/ReactiveSystem.cs index ea4f71cfba..ff22f73b5a 100644 --- a/Content.Shared/Chemistry/ReactiveSystem.cs +++ b/Content.Shared/Chemistry/ReactiveSystem.cs @@ -66,7 +66,7 @@ namespace Content.Shared.Chemistry { var entity = EntityManager.GetEntity(args.SolutionEntity); _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, - $"Reactive effect {effect.GetType().Name} of reagent {reagent.ID:reagent} with method {method} applied on entity {entity} at {IoCManager.Resolve().GetComponent(entity.Uid).Coordinates}"); + $"Reactive effect {effect.GetType().Name} of reagent {reagent.ID:reagent} with method {method} applied on entity {entity} at {IoCManager.Resolve().GetComponent(entity).Coordinates}"); } effect.Effect(args); @@ -94,7 +94,7 @@ namespace Content.Shared.Chemistry { var entity = EntityManager.GetEntity(args.SolutionEntity); _logSystem.Add(LogType.ReagentEffect, effect.LogImpact, - $"Reactive effect {effect.GetType().Name} of {entity} using reagent {reagent.ID} with method {method} at {IoCManager.Resolve().GetComponent(entity.Uid).Coordinates}"); + $"Reactive effect {effect.GetType().Name} of {entity} using reagent {reagent.ID} with method {method} at {IoCManager.Resolve().GetComponent(entity).Coordinates}"); } effect.Effect(args); diff --git a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs index 689d250d1d..5b235c7890 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentPrototype.cs @@ -125,7 +125,7 @@ namespace Content.Shared.Chemistry.Reagent { var entity = entMan.GetEntity(args.SolutionEntity); EntitySystem.Get().Add(LogType.ReagentEffect, plantMetabolizable.LogImpact, - $"Plant metabolism effect {plantMetabolizable.GetType().Name:effect} of reagent {ID} applied on entity {entity} at {IoCManager.Resolve().GetComponent(entity.Uid).Coordinates}"); + $"Plant metabolism effect {plantMetabolizable.GetType().Name:effect} of reagent {ID} applied on entity {entity} at {IoCManager.Resolve().GetComponent(entity).Coordinates}"); plantMetabolizable.Effect(args); } } diff --git a/Content.Shared/Climbing/SharedClimbableComponent.cs b/Content.Shared/Climbing/SharedClimbableComponent.cs index cec067707e..b32dbce0ce 100644 --- a/Content.Shared/Climbing/SharedClimbableComponent.cs +++ b/Content.Shared/Climbing/SharedClimbableComponent.cs @@ -20,7 +20,7 @@ namespace Content.Shared.Climbing public virtual bool CanDragDropOn(DragDropEvent eventArgs) { - return IoCManager.Resolve().HasComponent(eventArgs.Dragged.Uid); + return IoCManager.Resolve().HasComponent(eventArgs.Dragged); } public abstract bool DragDropOn(DragDropEvent eventArgs); diff --git a/Content.Shared/Clothing/SharedMagbootsComponent.cs b/Content.Shared/Clothing/SharedMagbootsComponent.cs index 3d65e295a7..16ba948abb 100644 --- a/Content.Shared/Clothing/SharedMagbootsComponent.cs +++ b/Content.Shared/Clothing/SharedMagbootsComponent.cs @@ -20,7 +20,7 @@ namespace Content.Shared.Clothing // inventory system will automatically hook into the event raised by this and update accordingly if (Owner.TryGetContainer(out var container)) { - EntitySystem.Get().RefreshMovementSpeedModifiers(container.Owner.Uid); + EntitySystem.Get().RefreshMovementSpeedModifiers(container.Owner); } } diff --git a/Content.Shared/CombatMode/SharedCombatModeSystem.cs b/Content.Shared/CombatMode/SharedCombatModeSystem.cs index 973bef9a54..8cef76c8bc 100644 --- a/Content.Shared/CombatMode/SharedCombatModeSystem.cs +++ b/Content.Shared/CombatMode/SharedCombatModeSystem.cs @@ -17,7 +17,7 @@ namespace Content.Shared.CombatMode { var entity = eventArgs.SenderSession?.AttachedEntity; - if (entity == null || !IoCManager.Resolve().TryGetComponent(entity.Uid, out SharedCombatModeComponent? combatModeComponent)) + if (entity == null || !IoCManager.Resolve().TryGetComponent(entity, out SharedCombatModeComponent? combatModeComponent)) { return; } diff --git a/Content.Shared/Construction/Conditions/EmptyOrWindowValidInTile.cs b/Content.Shared/Construction/Conditions/EmptyOrWindowValidInTile.cs index 3ae356117d..61a3a520b9 100644 --- a/Content.Shared/Construction/Conditions/EmptyOrWindowValidInTile.cs +++ b/Content.Shared/Construction/Conditions/EmptyOrWindowValidInTile.cs @@ -23,7 +23,7 @@ namespace Content.Shared.Construction.Conditions foreach (var entity in location.GetEntitiesInTile(LookupFlags.Approximate | LookupFlags.IncludeAnchored)) { - if (IoCManager.Resolve().HasComponent(entity.Uid)) + if (IoCManager.Resolve().HasComponent(entity)) result = true; } diff --git a/Content.Shared/Construction/Conditions/NoWindowsInTile.cs b/Content.Shared/Construction/Conditions/NoWindowsInTile.cs index f2ee536ccd..cc3a840a5e 100644 --- a/Content.Shared/Construction/Conditions/NoWindowsInTile.cs +++ b/Content.Shared/Construction/Conditions/NoWindowsInTile.cs @@ -17,7 +17,7 @@ namespace Content.Shared.Construction.Conditions { foreach (var entity in location.GetEntitiesInTile(LookupFlags.Approximate | LookupFlags.IncludeAnchored)) { - if (IoCManager.Resolve().HasComponent(entity.Uid)) + if (IoCManager.Resolve().HasComponent(entity)) return false; } diff --git a/Content.Shared/Construction/Conditions/WallmountCondition.cs b/Content.Shared/Construction/Conditions/WallmountCondition.cs index 0d17b9be5f..966dd82383 100644 --- a/Content.Shared/Construction/Conditions/WallmountCondition.cs +++ b/Content.Shared/Construction/Conditions/WallmountCondition.cs @@ -21,7 +21,7 @@ namespace Content.Shared.Construction.Conditions var entManager = IoCManager.Resolve(); // get blueprint and user position - var userWorldPosition = IoCManager.Resolve().GetComponent(user.Uid).WorldPosition; + var userWorldPosition = IoCManager.Resolve().GetComponent(user).WorldPosition; var objWorldPosition = location.ToMap(entManager).Position; // find direction from user to blueprint @@ -36,7 +36,7 @@ namespace Content.Shared.Construction.Conditions var physics = EntitySystem.Get(); var rUserToObj = new CollisionRay(userWorldPosition, userToObject.Normalized, (int) CollisionGroup.Impassable); var length = userToObject.Length; - var userToObjRaycastResults = physics.IntersectRayWithPredicate(IoCManager.Resolve().GetComponent(user.Uid).MapID, rUserToObj, maxLength: length, + var userToObjRaycastResults = physics.IntersectRayWithPredicate(IoCManager.Resolve().GetComponent(user).MapID, rUserToObj, maxLength: length, predicate: (e) => !e.HasTag("Wall")); if (!userToObjRaycastResults.Any()) return false; @@ -46,7 +46,7 @@ namespace Content.Shared.Construction.Conditions // check that we didn't try to build wallmount that facing another adjacent wall var rAdjWall = new CollisionRay(objWorldPosition, direction.ToVec(), (int) CollisionGroup.Impassable); - var adjWallRaycastResults = physics.IntersectRayWithPredicate(IoCManager.Resolve().GetComponent(user.Uid).MapID, rAdjWall, maxLength: 0.5f, + var adjWallRaycastResults = physics.IntersectRayWithPredicate(IoCManager.Resolve().GetComponent(user).MapID, rAdjWall, maxLength: 0.5f, predicate: (e) => e == targetWall || !e.HasTag("Wall")); return !adjWallRaycastResults.Any(); } diff --git a/Content.Shared/Construction/Steps/MaterialConstructionGraphStep.cs b/Content.Shared/Construction/Steps/MaterialConstructionGraphStep.cs index 3efd21922b..02834e9a2f 100644 --- a/Content.Shared/Construction/Steps/MaterialConstructionGraphStep.cs +++ b/Content.Shared/Construction/Steps/MaterialConstructionGraphStep.cs @@ -34,7 +34,7 @@ namespace Content.Shared.Construction.Steps public bool EntityValid(IEntity entity, [NotNullWhen(true)] out SharedStackComponent? stack) { - if (IoCManager.Resolve().TryGetComponent(entity.Uid, out SharedStackComponent? otherStack) && otherStack.StackTypeId.Equals(MaterialPrototypeId) && otherStack.Count >= Amount) + if (IoCManager.Resolve().TryGetComponent(entity, out SharedStackComponent? otherStack) && otherStack.StackTypeId.Equals(MaterialPrototypeId) && otherStack.Count >= Amount) stack = otherStack; else stack = null; diff --git a/Content.Shared/Containers/ItemSlot/ItemSlotsComponent.cs b/Content.Shared/Containers/ItemSlot/ItemSlotsComponent.cs index 601759450a..b8993fb475 100644 --- a/Content.Shared/Containers/ItemSlot/ItemSlotsComponent.cs +++ b/Content.Shared/Containers/ItemSlot/ItemSlotsComponent.cs @@ -174,6 +174,6 @@ namespace Content.Shared.Containers.ItemSlots public IEntity? Item => ContainerSlot.ContainedEntity; // and to make it easier for whenever IEntity is removed - public EntityUid? ItemUid => ContainerSlot.ContainedEntity?.Uid; + public EntityUid? ItemUid => ContainerSlot.ContainedEntity; } } diff --git a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs index d61cb8bc58..25bc754d24 100644 --- a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs +++ b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs @@ -56,7 +56,7 @@ namespace Content.Shared.Containers.ItemSlots if (slot.HasItem || string.IsNullOrEmpty(slot.StartingItem)) continue; - var item = EntityManager.SpawnEntity(slot.StartingItem, IoCManager.Resolve().GetComponent(itemSlots.Owner.Uid).Coordinates); + var item = EntityManager.SpawnEntity(slot.StartingItem, IoCManager.Resolve().GetComponent(itemSlots.Owner).Coordinates); slot.ContainerSlot.Insert(item); } } @@ -81,7 +81,7 @@ namespace Content.Shared.Containers.ItemSlots var itemSlots = EntityManager.EnsureComponent(uid); slot.ContainerSlot = ContainerHelpers.EnsureContainer(itemSlots.Owner, id); if (itemSlots.Slots.ContainsKey(id)) - Logger.Error($"Duplicate item slot key. Entity: {IoCManager.Resolve().GetComponent(itemSlots.Owner.Uid).EntityName} ({uid}), key: {id}"); + Logger.Error($"Duplicate item slot key. Entity: {IoCManager.Resolve().GetComponent(itemSlots.Owner).EntityName} ({uid}), key: {id}"); itemSlots.Slots[id] = slot; } @@ -225,7 +225,7 @@ namespace Content.Shared.Containers.ItemSlots /// False if failed to insert item public bool TryInsert(EntityUid uid, ItemSlot slot, IEntity item) { - if (!CanInsert(uid, item.Uid, slot)) + if (!CanInsert(uid, item, slot)) return false; Insert(uid, slot, item); @@ -244,7 +244,7 @@ namespace Content.Shared.Containers.ItemSlots if (!hands.TryGetActiveHeldEntity(out var item)) return false; - if (!CanInsert(uid, item.Uid, slot)) + if (!CanInsert(uid, item, slot)) return false; // hands.Drop(item) checks CanDrop action blocker @@ -327,7 +327,7 @@ namespace Content.Shared.Containers.ItemSlots private void AddEjectVerbs(EntityUid uid, ItemSlotsComponent itemSlots, GetAlternativeVerbsEvent args) { if (args.Hands == null || !args.CanAccess ||!args.CanInteract || - !_actionBlockerSystem.CanPickup(args.User.Uid)) + !_actionBlockerSystem.CanPickup(args.User)) { return; } @@ -344,10 +344,10 @@ namespace Content.Shared.Containers.ItemSlots var verbSubject = slot.Name != string.Empty ? Loc.GetString(slot.Name) - : IoCManager.Resolve().GetComponent(slot.Item!.Uid).EntityName ?? string.Empty; + : IoCManager.Resolve().GetComponent(slot.Item!).EntityName ?? string.Empty; Verb verb = new(); - verb.Act = () => TryEjectToHands(uid, slot, args.User.Uid); + verb.Act = () => TryEjectToHands(uid, slot, args.User); if (slot.EjectVerbText == null) { @@ -370,7 +370,7 @@ namespace Content.Shared.Containers.ItemSlots return; // If there are any slots that eject on left-click, add a "Take " verb. - if (_actionBlockerSystem.CanPickup(args.User.Uid)) + if (_actionBlockerSystem.CanPickup(args.User)) { foreach (var slot in itemSlots.Slots.Values) { @@ -379,10 +379,10 @@ namespace Content.Shared.Containers.ItemSlots var verbSubject = slot.Name != string.Empty ? Loc.GetString(slot.Name) - : IoCManager.Resolve().GetComponent(slot.Item!.Uid).EntityName ?? string.Empty; + : IoCManager.Resolve().GetComponent(slot.Item!).EntityName ?? string.Empty; Verb takeVerb = new(); - takeVerb.Act = () => TryEjectToHands(uid, slot, args.User.Uid); + takeVerb.Act = () => TryEjectToHands(uid, slot, args.User); takeVerb.IconTexture = "/Textures/Interface/VerbIcons/pickup.svg.192dpi.png"; if (slot.EjectVerbText == null) @@ -395,17 +395,17 @@ namespace Content.Shared.Containers.ItemSlots } // Next, add the insert-item verbs - if (args.Using == null || !_actionBlockerSystem.CanDrop(args.User.Uid)) + if (args.Using == null || !_actionBlockerSystem.CanDrop(args.User)) return; foreach (var slot in itemSlots.Slots.Values) { - if (!CanInsert(uid, args.Using.Uid, slot)) + if (!CanInsert(uid, args.Using, slot)) continue; var verbSubject = slot.Name != string.Empty ? Loc.GetString(slot.Name) - : IoCManager.Resolve().GetComponent(args.Using.Uid).EntityName ?? string.Empty; + : IoCManager.Resolve().GetComponent(args.Using).EntityName ?? string.Empty; Verb insertVerb = new(); insertVerb.Act = () => Insert(uid, slot, args.Using); diff --git a/Content.Shared/Coordinates/EntityCoordinatesExtensions.cs b/Content.Shared/Coordinates/EntityCoordinatesExtensions.cs index c6eaace7a1..2d81f1c411 100644 --- a/Content.Shared/Coordinates/EntityCoordinatesExtensions.cs +++ b/Content.Shared/Coordinates/EntityCoordinatesExtensions.cs @@ -23,17 +23,17 @@ namespace Content.Shared.Coordinates public static EntityCoordinates ToCoordinates(this IEntity entity, Vector2 offset) { - return ToCoordinates(entity.Uid, offset); + return ToCoordinates((EntityUid) entity, offset); } public static EntityCoordinates ToCoordinates(this IEntity entity, float x, float y) { - return new(entity.Uid, x, y); + return new(entity, x, y); } public static EntityCoordinates ToCoordinates(this IEntity entity) { - return ToCoordinates(entity.Uid, Vector2.Zero); + return ToCoordinates((EntityUid) entity, Vector2.Zero); } public static EntityCoordinates ToCoordinates(this IMapGrid grid, Vector2 offset) diff --git a/Content.Shared/Disposal/SharedDisposalUnitSystem.cs b/Content.Shared/Disposal/SharedDisposalUnitSystem.cs index 426b15ad80..e2bdb601ea 100644 --- a/Content.Shared/Disposal/SharedDisposalUnitSystem.cs +++ b/Content.Shared/Disposal/SharedDisposalUnitSystem.cs @@ -49,21 +49,21 @@ namespace Content.Shared.Disposal public virtual bool CanInsert(SharedDisposalUnitComponent component, IEntity entity) { - if (!IoCManager.Resolve().GetComponent(component.Owner.Uid).Anchored) + if (!IoCManager.Resolve().GetComponent(component.Owner).Anchored) return false; // TODO: Probably just need a disposable tag. - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out SharedItemComponent? storable) && - !IoCManager.Resolve().HasComponent(entity.Uid)) + if (!IoCManager.Resolve().TryGetComponent(entity, out SharedItemComponent? storable) && + !IoCManager.Resolve().HasComponent(entity)) { return false; } - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out IPhysBody? physics) || + if (!IoCManager.Resolve().TryGetComponent(entity, out IPhysBody? physics) || !physics.CanCollide && storable == null) { - if (!(IoCManager.Resolve().TryGetComponent(entity.Uid, out MobStateComponent? damageState) && damageState.IsDead())) + if (!(IoCManager.Resolve().TryGetComponent(entity, out MobStateComponent? damageState) && damageState.IsDead())) { return false; } diff --git a/Content.Shared/Doors/SharedDoorComponent.cs b/Content.Shared/Doors/SharedDoorComponent.cs index dbf0ad3aa5..a673fa78a8 100644 --- a/Content.Shared/Doors/SharedDoorComponent.cs +++ b/Content.Shared/Doors/SharedDoorComponent.cs @@ -99,7 +99,7 @@ namespace Content.Shared.Doors public bool IsCrushing(IEntity entity) { - return CurrentlyCrushing.Contains(entity.Uid); + return CurrentlyCrushing.Contains(entity); } protected void SetAppearance(DoorVisualState state) diff --git a/Content.Shared/Examine/ExamineSystemShared.cs b/Content.Shared/Examine/ExamineSystemShared.cs index cb136cf4a0..b68f975bac 100644 --- a/Content.Shared/Examine/ExamineSystemShared.cs +++ b/Content.Shared/Examine/ExamineSystemShared.cs @@ -51,7 +51,7 @@ namespace Content.Shared.Examine private bool IsInDetailsRange(IEntity examiner, IEntity entity) { // check if the mob is in ciritcal or dead - if (EntityManager.TryGetComponent(examiner.Uid, out MobStateComponent mobState) && mobState.IsIncapacitated()) + if (EntityManager.TryGetComponent(examiner, out MobStateComponent mobState) && mobState.IsIncapacitated()) return false; if (entity.TryGetContainerMan(out var man) && man.Owner == examiner) @@ -64,26 +64,26 @@ namespace Content.Shared.Examine [Pure] public bool CanExamine(IEntity examiner, IEntity examined) { - return CanExamine(examiner, IoCManager.Resolve().GetComponent(examined.Uid).MapPosition, + return CanExamine(examiner, IoCManager.Resolve().GetComponent(examined).MapPosition, entity => entity == examiner || entity == examined); } [Pure] public virtual bool CanExamine(IEntity examiner, MapCoordinates target, Ignored? predicate = null) { - if (!IoCManager.Resolve().TryGetComponent(examiner.Uid, out ExaminerComponent? examinerComponent)) + if (!IoCManager.Resolve().TryGetComponent(examiner, out ExaminerComponent? examinerComponent)) return false; if (!examinerComponent.DoRangeCheck) return true; - if (IoCManager.Resolve().GetComponent(examiner.Uid).MapID != target.MapId) + if (IoCManager.Resolve().GetComponent(examiner).MapID != target.MapId) return false; return InRangeUnOccluded( - IoCManager.Resolve().GetComponent(examiner.Uid).MapPosition, + IoCManager.Resolve().GetComponent(examiner).MapPosition, target, - GetExaminerRange(examiner.Uid), + GetExaminerRange(examiner), predicate: predicate, ignoreInsideBlocker: true); } @@ -128,12 +128,12 @@ namespace Content.Shared.Examine foreach (var result in rayResults) { - if (!IoCManager.Resolve().TryGetComponent(result.HitEntity.Uid, out OccluderComponent? o)) + if (!IoCManager.Resolve().TryGetComponent(result.HitEntity, out OccluderComponent? o)) { continue; } - var bBox = o.BoundingBox.Translated(IoCManager.Resolve().GetComponent(o.Owner.Uid).WorldPosition); + var bBox = o.BoundingBox.Translated(IoCManager.Resolve().GetComponent(o.Owner).WorldPosition); if (bBox.Contains(origin.Position) || bBox.Contains(other.Position)) { @@ -148,23 +148,23 @@ namespace Content.Shared.Examine public static bool InRangeUnOccluded(IEntity origin, IEntity other, float range, Ignored? predicate, bool ignoreInsideBlocker = true) { - var originPos = IoCManager.Resolve().GetComponent(origin.Uid).MapPosition; - var otherPos = IoCManager.Resolve().GetComponent(other.Uid).MapPosition; + var originPos = IoCManager.Resolve().GetComponent(origin).MapPosition; + var otherPos = IoCManager.Resolve().GetComponent(other).MapPosition; return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); } public static bool InRangeUnOccluded(IEntity origin, IComponent other, float range, Ignored? predicate, bool ignoreInsideBlocker = true) { - var originPos = IoCManager.Resolve().GetComponent(origin.Uid).MapPosition; - var otherPos = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; + var originPos = IoCManager.Resolve().GetComponent(origin).MapPosition; + var otherPos = IoCManager.Resolve().GetComponent(other.Owner).MapPosition; return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); } public static bool InRangeUnOccluded(IEntity origin, EntityCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true) { - var originPos = IoCManager.Resolve().GetComponent(origin.Uid).MapPosition; + var originPos = IoCManager.Resolve().GetComponent(origin).MapPosition; var otherPos = other.ToMap(IoCManager.Resolve()); return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); @@ -172,22 +172,22 @@ namespace Content.Shared.Examine public static bool InRangeUnOccluded(IEntity origin, MapCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true) { - var originPos = IoCManager.Resolve().GetComponent(origin.Uid).MapPosition; + var originPos = IoCManager.Resolve().GetComponent(origin).MapPosition; return InRangeUnOccluded(originPos, other, range, predicate, ignoreInsideBlocker); } public static bool InRangeUnOccluded(ITargetedInteractEventArgs args, float range, Ignored? predicate, bool ignoreInsideBlocker = true) { - var originPos = IoCManager.Resolve().GetComponent(args.User.Uid).MapPosition; - var otherPos = IoCManager.Resolve().GetComponent(args.Target.Uid).MapPosition; + var originPos = IoCManager.Resolve().GetComponent(args.User).MapPosition; + var otherPos = IoCManager.Resolve().GetComponent(args.Target).MapPosition; return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); } public static bool InRangeUnOccluded(DragDropEvent args, float range, Ignored? predicate, bool ignoreInsideBlocker = true) { - var originPos = IoCManager.Resolve().GetComponent(args.User.Uid).MapPosition; + var originPos = IoCManager.Resolve().GetComponent(args.User).MapPosition; var otherPos = args.DropLocation.ToMap(IoCManager.Resolve()); return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); @@ -195,9 +195,9 @@ namespace Content.Shared.Examine public static bool InRangeUnOccluded(AfterInteractEventArgs args, float range, Ignored? predicate, bool ignoreInsideBlocker = true) { - var originPos = IoCManager.Resolve().GetComponent(args.User.Uid).MapPosition; + var originPos = IoCManager.Resolve().GetComponent(args.User).MapPosition; IEntity? tempQualifier = args.Target; - var otherPos = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier.Uid) : null).MapPosition ?? args.ClickLocation.ToMap(IoCManager.Resolve()); + var otherPos = (tempQualifier != null ? IoCManager.Resolve().GetComponent(tempQualifier) : null).MapPosition ?? args.ClickLocation.ToMap(IoCManager.Resolve()); return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); } @@ -214,9 +214,9 @@ namespace Content.Shared.Examine var doNewline = false; //Add an entity description if one is declared - if (!string.IsNullOrEmpty(IoCManager.Resolve().GetComponent(entity.Uid).EntityDescription)) + if (!string.IsNullOrEmpty(IoCManager.Resolve().GetComponent(entity).EntityDescription)) { - message.AddText(IoCManager.Resolve().GetComponent(entity.Uid).EntityDescription); + message.AddText(IoCManager.Resolve().GetComponent(entity).EntityDescription); doNewline = true; } @@ -225,10 +225,10 @@ namespace Content.Shared.Examine // Raise the event and let things that subscribe to it change the message... var isInDetailsRange = IsInDetailsRange(examiner, entity); var examinedEvent = new ExaminedEvent(message, entity, examiner, isInDetailsRange, doNewline); - RaiseLocalEvent(entity.Uid, examinedEvent); + RaiseLocalEvent(entity, examinedEvent); //Add component statuses from components that report one - foreach (var examineComponent in IoCManager.Resolve().GetComponents(entity.Uid)) + foreach (var examineComponent in IoCManager.Resolve().GetComponents(entity)) { var subMessage = new FormattedMessage(); examineComponent.Examine(subMessage, isInDetailsRange); diff --git a/Content.Shared/Friction/SharedTileFrictionController.cs b/Content.Shared/Friction/SharedTileFrictionController.cs index aedb672832..ae0bdbb328 100644 --- a/Content.Shared/Friction/SharedTileFrictionController.cs +++ b/Content.Shared/Friction/SharedTileFrictionController.cs @@ -59,7 +59,7 @@ namespace Content.Shared.Friction Mover.UseMobMovement(body.OwnerUid)) continue; var surfaceFriction = GetTileFriction(body); - var bodyModifier = IoCManager.Resolve().GetComponentOrNull(body.Owner.Uid)?.Modifier ?? 1.0f; + var bodyModifier = IoCManager.Resolve().GetComponentOrNull(body.Owner)?.Modifier ?? 1.0f; var friction = _frictionModifier * surfaceFriction * bodyModifier; ReduceLinearVelocity(prediction, body, friction, frameTime); @@ -132,7 +132,7 @@ namespace Content.Shared.Friction [Pure] private float GetTileFriction(PhysicsComponent body) { - var transform = IoCManager.Resolve().GetComponent(body.Owner.Uid); + var transform = IoCManager.Resolve().GetComponent(body.Owner); var coords = transform.Coordinates; // TODO: Make IsWeightless event-based; we already have grid traversals tracked so just raise events diff --git a/Content.Shared/Hands/Components/SharedHandsComponent.cs b/Content.Shared/Hands/Components/SharedHandsComponent.cs index 73bb871e4b..df38684ae7 100644 --- a/Content.Shared/Hands/Components/SharedHandsComponent.cs +++ b/Content.Shared/Hands/Components/SharedHandsComponent.cs @@ -102,7 +102,7 @@ namespace Content.Shared.Hands.Components public void UpdateHandVisualizer() { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance)) + if (!IoCManager.Resolve().TryGetComponent(Owner, out AppearanceComponent? appearance)) return; var hands = new List(); @@ -111,7 +111,7 @@ namespace Content.Shared.Hands.Components if (hand.HeldEntity == null) continue; - if (!IoCManager.Resolve().TryGetComponent(hand.HeldEntity.Uid, out SharedItemComponent? item) || item.RsiPath == null) + if (!IoCManager.Resolve().TryGetComponent(hand.HeldEntity, out SharedItemComponent? item) || item.RsiPath == null) continue; var handState = new HandVisualState(item.RsiPath, item.EquippedPrefix, hand.Location, item.Color); @@ -376,7 +376,7 @@ namespace Content.Shared.Hands.Components if (!TryGetHand(handName, out var hand)) return false; - return TryDropHeldEntity(hand, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, checkActionBlocker); + return TryDropHeldEntity(hand, IoCManager.Resolve().GetComponent(Owner).Coordinates, checkActionBlocker); } /// @@ -387,7 +387,7 @@ namespace Content.Shared.Hands.Components if (!TryGetHandHoldingEntity(entity, out var hand)) return false; - return TryDropHeldEntity(hand, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates, checkActionBlocker); + return TryDropHeldEntity(hand, IoCManager.Resolve().GetComponent(Owner).Coordinates, checkActionBlocker); } /// @@ -480,7 +480,7 @@ namespace Content.Shared.Hands.Components EntitySystem.Get().DroppedInteraction(Owner, heldEntity); - IoCManager.Resolve().GetComponent(heldEntity.Uid).WorldPosition = GetFinalDropCoordinates(targetDropLocation); + IoCManager.Resolve().GetComponent(heldEntity).WorldPosition = GetFinalDropCoordinates(targetDropLocation); OnItemChanged?.Invoke(); } @@ -490,7 +490,7 @@ namespace Content.Shared.Hands.Components /// private Vector2 GetFinalDropCoordinates(EntityCoordinates targetCoords) { - var origin = IoCManager.Resolve().GetComponent(Owner.Uid).MapPosition; + var origin = IoCManager.Resolve().GetComponent(Owner).MapPosition; var target = targetCoords.ToMap(IoCManager.Resolve()); var dropVector = target.Position - origin.Position; @@ -529,7 +529,7 @@ namespace Content.Shared.Hands.Components /// private void DropHeldEntityToFloor(Hand hand) { - DropHeldEntity(hand, IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates); + DropHeldEntity(hand, IoCManager.Resolve().GetComponent(Owner).Coordinates); } private bool CanPutHeldEntityIntoContainer(Hand hand, IContainer targetContainer, bool checkActionBlocker) @@ -627,7 +627,7 @@ namespace Content.Shared.Hands.Components /// protected bool PlayerCanPickup() { - if (!EntitySystem.Get().CanPickup(Owner.Uid)) + if (!EntitySystem.Get().CanPickup(Owner)) return false; return true; @@ -653,7 +653,7 @@ namespace Content.Shared.Hands.Components if (hand.Name == ActiveHand) SelectActiveHeldEntity(); - IoCManager.Resolve().GetComponent(entity.Uid).LocalPosition = Vector2.Zero; + IoCManager.Resolve().GetComponent(entity).LocalPosition = Vector2.Zero; OnItemChanged?.Invoke(); @@ -790,7 +790,7 @@ namespace Content.Shared.Hands.Components var entity = item.Owner; if (!TryPutInActiveHandOrAny(entity, checkActionBlocker)) - IoCManager.Resolve().GetComponent(entity.Uid).Coordinates = IoCManager.Resolve().GetComponent(Owner.Uid).Coordinates; + IoCManager.Resolve().GetComponent(entity).Coordinates = IoCManager.Resolve().GetComponent(Owner).Coordinates; } /// diff --git a/Content.Shared/Hands/SharedHandsSystem.cs b/Content.Shared/Hands/SharedHandsSystem.cs index e9ac802ce5..133ab0d945 100644 --- a/Content.Shared/Hands/SharedHandsSystem.cs +++ b/Content.Shared/Hands/SharedHandsSystem.cs @@ -23,7 +23,7 @@ namespace Content.Shared.Hands { var entity = eventArgs.SenderSession.AttachedEntity; - if (entity == null || !IoCManager.Resolve().TryGetComponent(entity.Uid, out SharedHandsComponent? hands)) + if (entity == null || !IoCManager.Resolve().TryGetComponent(entity, out SharedHandsComponent? hands)) return; hands.ActiveHand = msg.HandName; diff --git a/Content.Shared/Interaction/BeforeInteract.cs b/Content.Shared/Interaction/BeforeInteract.cs index 0c36682d48..c6a9f63957 100644 --- a/Content.Shared/Interaction/BeforeInteract.cs +++ b/Content.Shared/Interaction/BeforeInteract.cs @@ -18,7 +18,7 @@ namespace Content.Shared.Interaction /// /// Entity that triggered the interaction. /// - public EntityUid UserUid => User.Uid; + public EntityUid UserUid => User; /// /// Entity that the user used to interact. @@ -28,7 +28,7 @@ namespace Content.Shared.Interaction /// /// Entity that the user used to interact. /// - public EntityUid UsedUid => Used.Uid; + public EntityUid UsedUid => Used; /// /// Entity that was interacted on. This can be null if the attack did not click on an entity. @@ -38,7 +38,7 @@ namespace Content.Shared.Interaction /// /// Entity that was interacted on. This can be null if the attack did not click on an entity. /// - public EntityUid? TargetUid => Target?.Uid; + public EntityUid? TargetUid => Target; /// /// Location that the user clicked outside of their interaction range. diff --git a/Content.Shared/Interaction/Helpers/SharedUnobstructedExtensions.cs b/Content.Shared/Interaction/Helpers/SharedUnobstructedExtensions.cs index fd37c85656..f608a86e95 100644 --- a/Content.Shared/Interaction/Helpers/SharedUnobstructedExtensions.cs +++ b/Content.Shared/Interaction/Helpers/SharedUnobstructedExtensions.cs @@ -263,7 +263,7 @@ namespace Content.Shared.Interaction.Helpers bool ignoreInsideBlocker = false) { var originPosition = origin.ToMap(IoCManager.Resolve()); - var otherPosition = IoCManager.Resolve().GetComponent(other.Uid).MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other).MapPosition; return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask, predicate, ignoreInsideBlocker); @@ -278,7 +278,7 @@ namespace Content.Shared.Interaction.Helpers bool ignoreInsideBlocker = false) { var originPosition = origin.ToMap(IoCManager.Resolve()); - var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner).MapPosition; return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask, predicate, ignoreInsideBlocker); @@ -293,7 +293,7 @@ namespace Content.Shared.Interaction.Helpers bool ignoreInsideBlocker = false) { var originPosition = origin.ToMap(IoCManager.Resolve()); - var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner).MapPosition; return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask, predicate, ignoreInsideBlocker); @@ -344,7 +344,7 @@ namespace Content.Shared.Interaction.Helpers Ignored? predicate = null, bool ignoreInsideBlocker = false) { - var otherPosition = IoCManager.Resolve().GetComponent(other.Uid).MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other).MapPosition; return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate, ignoreInsideBlocker); @@ -358,7 +358,7 @@ namespace Content.Shared.Interaction.Helpers Ignored? predicate = null, bool ignoreInsideBlocker = false) { - var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner).MapPosition; return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate, ignoreInsideBlocker); @@ -372,7 +372,7 @@ namespace Content.Shared.Interaction.Helpers Ignored? predicate = null, bool ignoreInsideBlocker = false) { - var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner).MapPosition; return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate, ignoreInsideBlocker); diff --git a/Content.Shared/Interaction/Helpers/SharedUnoccludedExtensions.cs b/Content.Shared/Interaction/Helpers/SharedUnoccludedExtensions.cs index ac7e64c4bc..e11b1ed881 100644 --- a/Content.Shared/Interaction/Helpers/SharedUnoccludedExtensions.cs +++ b/Content.Shared/Interaction/Helpers/SharedUnoccludedExtensions.cs @@ -204,7 +204,7 @@ namespace Content.Shared.Interaction.Helpers bool ignoreInsideBlocker = true) { var originPosition = origin.ToMap(IoCManager.Resolve()); - var otherPosition = IoCManager.Resolve().GetComponent(other.Uid).MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other).MapPosition; return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range, predicate, ignoreInsideBlocker); @@ -218,7 +218,7 @@ namespace Content.Shared.Interaction.Helpers bool ignoreInsideBlocker = true) { var originPosition = origin.ToMap(IoCManager.Resolve()); - var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner).MapPosition; return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range, predicate, ignoreInsideBlocker); @@ -232,7 +232,7 @@ namespace Content.Shared.Interaction.Helpers bool ignoreInsideBlocker = true) { var originPosition = origin.ToMap(IoCManager.Resolve()); - var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner).MapPosition; return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range, predicate, ignoreInsideBlocker); @@ -280,7 +280,7 @@ namespace Content.Shared.Interaction.Helpers Ignored? predicate = null, bool ignoreInsideBlocker = true) { - var otherPosition = IoCManager.Resolve().GetComponent(other.Uid).MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other).MapPosition; return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate, ignoreInsideBlocker); @@ -293,7 +293,7 @@ namespace Content.Shared.Interaction.Helpers Ignored? predicate = null, bool ignoreInsideBlocker = true) { - var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner).MapPosition; return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate, ignoreInsideBlocker); @@ -306,7 +306,7 @@ namespace Content.Shared.Interaction.Helpers Ignored? predicate = null, bool ignoreInsideBlocker = true) { - var otherPosition = IoCManager.Resolve().GetComponent(other.Owner.Uid).MapPosition; + var otherPosition = IoCManager.Resolve().GetComponent(other.Owner).MapPosition; return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate, ignoreInsideBlocker); diff --git a/Content.Shared/Interaction/IActivate.cs b/Content.Shared/Interaction/IActivate.cs index 7a0ffa6541..096c3af5a2 100644 --- a/Content.Shared/Interaction/IActivate.cs +++ b/Content.Shared/Interaction/IActivate.cs @@ -48,7 +48,7 @@ namespace Content.Shared.Interaction /// /// Entity that activated the target world entity. /// - public EntityUid UserUid => User.Uid; + public EntityUid UserUid => User; /// /// Entity that was activated in the world. @@ -58,7 +58,7 @@ namespace Content.Shared.Interaction /// /// Entity that was activated in the world. /// - public EntityUid TargetUid => Target.Uid; + public EntityUid TargetUid => Target; public ActivateInWorldEvent(IEntity user, IEntity target) { diff --git a/Content.Shared/Interaction/IAfterInteract.cs b/Content.Shared/Interaction/IAfterInteract.cs index 4ae86e6f05..76209fdf64 100644 --- a/Content.Shared/Interaction/IAfterInteract.cs +++ b/Content.Shared/Interaction/IAfterInteract.cs @@ -59,7 +59,7 @@ namespace Content.Shared.Interaction /// /// Entity that triggered the interaction. /// - public EntityUid UserUid => User.Uid; + public EntityUid UserUid => User; /// /// Entity that the user used to interact. @@ -69,7 +69,7 @@ namespace Content.Shared.Interaction /// /// Entity that the user used to interact. /// - public EntityUid UsedUid => Used.Uid; + public EntityUid UsedUid => Used; /// /// Entity that was interacted on. This can be null if the attack did not click on an entity. @@ -79,7 +79,7 @@ namespace Content.Shared.Interaction /// /// Entity that was interacted on. This can be null if the attack did not click on an entity. /// - public EntityUid? TargetUid => Target?.Uid; + public EntityUid? TargetUid => Target; /// /// Location that the user clicked outside of their interaction range. diff --git a/Content.Shared/Interaction/IInteractHand.cs b/Content.Shared/Interaction/IInteractHand.cs index 99fcd25527..558c55d93d 100644 --- a/Content.Shared/Interaction/IInteractHand.cs +++ b/Content.Shared/Interaction/IInteractHand.cs @@ -45,7 +45,7 @@ namespace Content.Shared.Interaction /// /// Entity that triggered the interaction. /// - public EntityUid UserUid => User.Uid; + public EntityUid UserUid => User; /// /// Entity that was interacted on. @@ -55,7 +55,7 @@ namespace Content.Shared.Interaction /// /// Entity that was interacted on. /// - public EntityUid TargetUid => Target.Uid; + public EntityUid TargetUid => Target; public InteractHandEvent(IEntity user, IEntity target) { diff --git a/Content.Shared/Interaction/IInteractUsing.cs b/Content.Shared/Interaction/IInteractUsing.cs index e220e1538e..3a7ebeec7d 100644 --- a/Content.Shared/Interaction/IInteractUsing.cs +++ b/Content.Shared/Interaction/IInteractUsing.cs @@ -58,7 +58,7 @@ namespace Content.Shared.Interaction /// /// Entity that triggered the interaction. /// - public EntityUid UserUid => User.Uid; + public EntityUid UserUid => User; /// /// Entity that the user used to interact. @@ -68,7 +68,7 @@ namespace Content.Shared.Interaction /// /// Entity that the user used to interact. /// - public EntityUid UsedUid => Used.Uid; + public EntityUid UsedUid => Used; /// /// Entity that was interacted on. @@ -78,7 +78,7 @@ namespace Content.Shared.Interaction /// /// Entity that was interacted on. /// - public EntityUid TargetUid => Target.Uid; + public EntityUid TargetUid => Target; /// /// The original location that was clicked by the user. diff --git a/Content.Shared/Interaction/IUse.cs b/Content.Shared/Interaction/IUse.cs index 650bf51b8e..648336a052 100644 --- a/Content.Shared/Interaction/IUse.cs +++ b/Content.Shared/Interaction/IUse.cs @@ -44,7 +44,7 @@ namespace Content.Shared.Interaction /// /// Entity holding the item in their hand. /// - public EntityUid UserUid => User.Uid; + public EntityUid UserUid => User; /// /// Item that was used. @@ -54,7 +54,7 @@ namespace Content.Shared.Interaction /// /// Item that was used. /// - public EntityUid UsedUid => Used.Uid; + public EntityUid UsedUid => Used; public UseInHandEvent(IEntity user, IEntity used) { diff --git a/Content.Shared/Interaction/RotateToFaceSystem.cs b/Content.Shared/Interaction/RotateToFaceSystem.cs index 91bfa697e7..0905c21844 100644 --- a/Content.Shared/Interaction/RotateToFaceSystem.cs +++ b/Content.Shared/Interaction/RotateToFaceSystem.cs @@ -36,7 +36,7 @@ namespace Content.Shared.Interaction [Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!; public bool TryFaceCoordinates(IEntity user, Vector2 coordinates) { - var diff = coordinates - IoCManager.Resolve().GetComponent(user.Uid).MapPosition.Position; + var diff = coordinates - IoCManager.Resolve().GetComponent(user).MapPosition.Position; if (diff.LengthSquared <= 0.01f) return true; var diffAngle = Angle.FromWorldVec(diff); @@ -45,14 +45,14 @@ namespace Content.Shared.Interaction public bool TryFaceAngle(IEntity user, Angle diffAngle) { - if (_actionBlockerSystem.CanChangeDirection(user.Uid)) + if (_actionBlockerSystem.CanChangeDirection(user)) { - IoCManager.Resolve().GetComponent(user.Uid).WorldRotation = diffAngle; + IoCManager.Resolve().GetComponent(user).WorldRotation = diffAngle; return true; } else { - if (IoCManager.Resolve().TryGetComponent(user.Uid, out SharedBuckleComponent? buckle) && buckle.Buckled) + if (IoCManager.Resolve().TryGetComponent(user, out SharedBuckleComponent? buckle) && buckle.Buckled) { var suid = buckle.LastEntityBuckledTo; if (suid != null) @@ -64,7 +64,7 @@ namespace Content.Shared.Interaction // (Since the user being buckled to it holds it down with their weight.) // This is logically equivalent to RotateWhileAnchored. // Barstools and office chairs have independent wheels, while regular chairs don't. - IoCManager.Resolve().GetComponent(rotatable.Owner.Uid).WorldRotation = diffAngle; + IoCManager.Resolve().GetComponent(rotatable.Owner).WorldRotation = diffAngle; return true; } } diff --git a/Content.Shared/Interaction/SharedInteractionSystem.cs b/Content.Shared/Interaction/SharedInteractionSystem.cs index df45f2cdb9..2356b55207 100644 --- a/Content.Shared/Interaction/SharedInteractionSystem.cs +++ b/Content.Shared/Interaction/SharedInteractionSystem.cs @@ -154,7 +154,7 @@ namespace Content.Shared.Interaction foreach (var result in rayResults) { - if (!IoCManager.Resolve().TryGetComponent(result.HitEntity.Uid, out IPhysBody? p)) + if (!IoCManager.Resolve().TryGetComponent(result.HitEntity, out IPhysBody? p)) { continue; } @@ -213,7 +213,7 @@ namespace Content.Shared.Interaction bool popup = false) { predicate ??= e => e == origin || e == other; - return InRangeUnobstructed(origin, IoCManager.Resolve().GetComponent(other.Uid).MapPosition, range, collisionMask, predicate, ignoreInsideBlocker, popup); + return InRangeUnobstructed(origin, IoCManager.Resolve().GetComponent(other).MapPosition, range, collisionMask, predicate, ignoreInsideBlocker, popup); } /// @@ -345,7 +345,7 @@ namespace Content.Shared.Interaction bool ignoreInsideBlocker = false, bool popup = false) { - var originPosition = IoCManager.Resolve().GetComponent(origin.Uid).MapPosition; + var originPosition = IoCManager.Resolve().GetComponent(origin).MapPosition; predicate ??= e => e == origin; var inRange = InRangeUnobstructed(originPosition, other, range, collisionMask, predicate, ignoreInsideBlocker); @@ -367,7 +367,7 @@ namespace Content.Shared.Interaction bool canReach) { var ev = new BeforeInteractEvent(user, used, target, clickLocation, canReach); - RaiseLocalEvent(used.Uid, ev, false); + RaiseLocalEvent(used, ev, false); return ev.Handled; } @@ -378,7 +378,7 @@ namespace Content.Shared.Interaction /// public async Task InteractUsing(IEntity user, IEntity used, IEntity target, EntityCoordinates clickLocation) { - if (!_actionBlockerSystem.CanInteract(user.Uid)) + if (!_actionBlockerSystem.CanInteract(user)) return; if (InteractDoBefore(user, used, target, clickLocation, true)) @@ -386,13 +386,13 @@ namespace Content.Shared.Interaction // all interactions should only happen when in range / unobstructed, so no range check is needed var interactUsingEvent = new InteractUsingEvent(user, used, target, clickLocation); - RaiseLocalEvent(target.Uid, interactUsingEvent); + RaiseLocalEvent(target, interactUsingEvent); if (interactUsingEvent.Handled) return; var interactUsingEventArgs = new InteractUsingEventArgs(user, clickLocation, used, target); - var interactUsings = IoCManager.Resolve().GetComponents(target.Uid).OrderByDescending(x => x.Priority); + var interactUsings = IoCManager.Resolve().GetComponents(target).OrderByDescending(x => x.Priority); foreach (var interactUsing in interactUsings) { // If an InteractUsing returns a status completion we finish our interaction @@ -410,12 +410,12 @@ namespace Content.Shared.Interaction public async Task InteractDoAfter(IEntity user, IEntity used, IEntity? target, EntityCoordinates clickLocation, bool canReach) { var afterInteractEvent = new AfterInteractEvent(user, used, target, clickLocation, canReach); - RaiseLocalEvent(used.Uid, afterInteractEvent, false); + RaiseLocalEvent(used, afterInteractEvent, false); if (afterInteractEvent.Handled) return true; var afterInteractEventArgs = new AfterInteractEventArgs(user, clickLocation, target, canReach); - var afterInteracts = IoCManager.Resolve().GetComponents(used.Uid).OrderByDescending(x => x.Priority).ToList(); + var afterInteracts = IoCManager.Resolve().GetComponents(used).OrderByDescending(x => x.Priority).ToList(); foreach (var afterInteract in afterInteracts) { @@ -441,7 +441,7 @@ namespace Content.Shared.Interaction protected void InteractionActivate(IEntity user, IEntity used) { - if (IoCManager.Resolve().TryGetComponent(used.Uid, out var delayComponent)) + if (IoCManager.Resolve().TryGetComponent(used, out var delayComponent)) { if (delayComponent.ActiveDelay) return; @@ -449,7 +449,7 @@ namespace Content.Shared.Interaction delayComponent.BeginDelay(); } - if (!_actionBlockerSystem.CanInteract(user.Uid) || !_actionBlockerSystem.CanUse(user.Uid)) + if (!_actionBlockerSystem.CanInteract(user) || !_actionBlockerSystem.CanUse(user)) return; // all activates should only fire when in range / unobstructed @@ -458,18 +458,18 @@ namespace Content.Shared.Interaction // Check if interacted entity is in the same container, the direct child, or direct parent of the user. // This is bypassed IF the interaction happened through an item slot (e.g., backpack UI) - if (!user.IsInSameOrParentContainer(used) && !CanAccessViaStorage(user.Uid, used.Uid)) + if (!user.IsInSameOrParentContainer(used) && !CanAccessViaStorage(user, used)) return; var activateMsg = new ActivateInWorldEvent(user, used); - RaiseLocalEvent(used.Uid, activateMsg); + RaiseLocalEvent(used, activateMsg); if (activateMsg.Handled) { _adminLogSystem.Add(LogType.InteractActivate, LogImpact.Low, $"{user} activated {used}"); return; } - if (!IoCManager.Resolve().TryGetComponent(used.Uid, out IActivate? activateComp)) + if (!IoCManager.Resolve().TryGetComponent(used, out IActivate? activateComp)) return; var activateEventArgs = new ActivateEventArgs(user, used); @@ -488,7 +488,7 @@ namespace Content.Shared.Interaction /// public void TryUseInteraction(IEntity user, IEntity used, bool altInteract = false) { - if (user != null && used != null && _actionBlockerSystem.CanUse(user.Uid)) + if (user != null && used != null && _actionBlockerSystem.CanUse(user)) { if (altInteract) AltInteract(user, used); @@ -503,7 +503,7 @@ namespace Content.Shared.Interaction /// public void UseInteraction(IEntity user, IEntity used) { - if (IoCManager.Resolve().TryGetComponent(used.Uid, out var delayComponent)) + if (IoCManager.Resolve().TryGetComponent(used, out var delayComponent)) { if (delayComponent.ActiveDelay) return; @@ -512,11 +512,11 @@ namespace Content.Shared.Interaction } var useMsg = new UseInHandEvent(user, used); - RaiseLocalEvent(used.Uid, useMsg); + RaiseLocalEvent(used, useMsg); if (useMsg.Handled) return; - var uses = IoCManager.Resolve().GetComponents(used.Uid).ToList(); + var uses = IoCManager.Resolve().GetComponents(used).ToList(); // Try to use item on any components which have the interface foreach (var use in uses) @@ -538,7 +538,7 @@ namespace Content.Shared.Interaction // Get list of alt-interact verbs var verbs = _verbSystem.GetLocalVerbs(target, user, VerbType.Alternative)[VerbType.Alternative]; if (verbs.Any()) - _verbSystem.ExecuteVerb(verbs.First(), user.Uid, target.Uid); + _verbSystem.ExecuteVerb(verbs.First(), user, target); } #endregion @@ -550,14 +550,14 @@ namespace Content.Shared.Interaction public void ThrownInteraction(IEntity user, IEntity thrown) { var throwMsg = new ThrownEvent(user, thrown); - RaiseLocalEvent(thrown.Uid, throwMsg); + RaiseLocalEvent(thrown, throwMsg); if (throwMsg.Handled) { _adminLogSystem.Add(LogType.Throw, LogImpact.Low,$"{user} threw {thrown}"); return; } - var comps = IoCManager.Resolve().GetComponents(thrown.Uid).ToList(); + var comps = IoCManager.Resolve().GetComponents(thrown).ToList(); var args = new ThrownEventArgs(user); // Call Thrown on all components that implement the interface @@ -577,11 +577,11 @@ namespace Content.Shared.Interaction public void EquippedInteraction(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot) { var equipMsg = new EquippedEvent(user, equipped, slot); - RaiseLocalEvent(equipped.Uid, equipMsg); + RaiseLocalEvent(equipped, equipMsg); if (equipMsg.Handled) return; - var comps = IoCManager.Resolve().GetComponents(equipped.Uid).ToList(); + var comps = IoCManager.Resolve().GetComponents(equipped).ToList(); // Call Thrown on all components that implement the interface foreach (var comp in comps) @@ -597,11 +597,11 @@ namespace Content.Shared.Interaction public void UnequippedInteraction(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot) { var unequipMsg = new UnequippedEvent(user, equipped, slot); - RaiseLocalEvent(equipped.Uid, unequipMsg); + RaiseLocalEvent(equipped, unequipMsg); if (unequipMsg.Handled) return; - var comps = IoCManager.Resolve().GetComponents(equipped.Uid).ToList(); + var comps = IoCManager.Resolve().GetComponents(equipped).ToList(); // Call Thrown on all components that implement the interface foreach (var comp in comps) @@ -618,11 +618,11 @@ namespace Content.Shared.Interaction public void EquippedHandInteraction(IEntity user, IEntity item, HandState hand) { var equippedHandMessage = new EquippedHandEvent(user, item, hand); - RaiseLocalEvent(item.Uid, equippedHandMessage); + RaiseLocalEvent(item, equippedHandMessage); if (equippedHandMessage.Handled) return; - var comps = IoCManager.Resolve().GetComponents(item.Uid).ToList(); + var comps = IoCManager.Resolve().GetComponents(item).ToList(); foreach (var comp in comps) { @@ -637,11 +637,11 @@ namespace Content.Shared.Interaction public void UnequippedHandInteraction(IEntity user, IEntity item, HandState hand) { var unequippedHandMessage = new UnequippedHandEvent(user, item, hand); - RaiseLocalEvent(item.Uid, unequippedHandMessage); + RaiseLocalEvent(item, unequippedHandMessage); if (unequippedHandMessage.Handled) return; - var comps = IoCManager.Resolve().GetComponents(item.Uid).ToList(); + var comps = IoCManager.Resolve().GetComponents(item).ToList(); foreach (var comp in comps) { @@ -658,7 +658,7 @@ namespace Content.Shared.Interaction /// public bool TryDroppedInteraction(IEntity user, IEntity item) { - if (user == null || item == null || !_actionBlockerSystem.CanDrop(user.Uid)) return false; + if (user == null || item == null || !_actionBlockerSystem.CanDrop(user)) return false; DroppedInteraction(user, item); return true; @@ -670,17 +670,17 @@ namespace Content.Shared.Interaction /// public void DroppedInteraction(IEntity user, IEntity item) { - var dropMsg = new DroppedEvent(user.Uid, item.Uid); - RaiseLocalEvent(item.Uid, dropMsg); + var dropMsg = new DroppedEvent(user, item); + RaiseLocalEvent(item, dropMsg); if (dropMsg.Handled) { _adminLogSystem.Add(LogType.Drop, LogImpact.Low, $"{user} dropped {item}"); return; } - IoCManager.Resolve().GetComponent(item.Uid).LocalRotation = Angle.Zero; + IoCManager.Resolve().GetComponent(item).LocalRotation = Angle.Zero; - var comps = IoCManager.Resolve().GetComponents(item.Uid).ToList(); + var comps = IoCManager.Resolve().GetComponents(item).ToList(); // Call Land on all components that implement the interface foreach (var comp in comps) @@ -699,11 +699,11 @@ namespace Content.Shared.Interaction public void HandSelectedInteraction(IEntity user, IEntity item) { var handSelectedMsg = new HandSelectedEvent(user, item); - RaiseLocalEvent(item.Uid, handSelectedMsg); + RaiseLocalEvent(item, handSelectedMsg); if (handSelectedMsg.Handled) return; - var comps = IoCManager.Resolve().GetComponents(item.Uid).ToList(); + var comps = IoCManager.Resolve().GetComponents(item).ToList(); // Call Land on all components that implement the interface foreach (var comp in comps) @@ -719,11 +719,11 @@ namespace Content.Shared.Interaction public void HandDeselectedInteraction(IEntity user, IEntity item) { var handDeselectedMsg = new HandDeselectedEvent(user, item); - RaiseLocalEvent(item.Uid, handDeselectedMsg); + RaiseLocalEvent(item, handDeselectedMsg); if (handDeselectedMsg.Handled) return; - var comps = IoCManager.Resolve().GetComponents(item.Uid).ToList(); + var comps = IoCManager.Resolve().GetComponents(item).ToList(); // Call Land on all components that implement the interface foreach (var comp in comps) diff --git a/Content.Shared/Item/SharedItemComponent.cs b/Content.Shared/Item/SharedItemComponent.cs index cc8e6f1d3f..8414387d54 100644 --- a/Content.Shared/Item/SharedItemComponent.cs +++ b/Content.Shared/Item/SharedItemComponent.cs @@ -112,13 +112,13 @@ namespace Content.Shared.Item /// public bool CanPickup(IEntity user, bool popup = true) { - if (!EntitySystem.Get().CanPickup(user.Uid)) + if (!EntitySystem.Get().CanPickup(user)) return false; - if (IoCManager.Resolve().GetComponent(user.Uid).MapID != IoCManager.Resolve().GetComponent(Owner.Uid).MapID) + if (IoCManager.Resolve().GetComponent(user).MapID != IoCManager.Resolve().GetComponent(Owner).MapID) return false; - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out IPhysBody? physics) || physics.BodyType == BodyType.Static) + if (!IoCManager.Resolve().TryGetComponent(Owner, out IPhysBody? physics) || physics.BodyType == BodyType.Static) return false; return user.InRangeUnobstructed(Owner, ignoreInsideBlocker: true, popup: popup); @@ -141,7 +141,7 @@ namespace Content.Shared.Item if (!CanPickup(user)) return false; - if (!IoCManager.Resolve().TryGetComponent(user.Uid, out SharedHandsComponent? hands)) + if (!IoCManager.Resolve().TryGetComponent(user, out SharedHandsComponent? hands)) return false; var activeHand = hands.ActiveHand; diff --git a/Content.Shared/Kitchen/Components/SharedKitchenSpikeComponent.cs b/Content.Shared/Kitchen/Components/SharedKitchenSpikeComponent.cs index 11dc6f691f..283eb976e2 100644 --- a/Content.Shared/Kitchen/Components/SharedKitchenSpikeComponent.cs +++ b/Content.Shared/Kitchen/Components/SharedKitchenSpikeComponent.cs @@ -24,7 +24,7 @@ namespace Content.Shared.Kitchen.Components bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs) { - if (!IoCManager.Resolve().HasComponent(eventArgs.Dragged.Uid)) + if (!IoCManager.Resolve().HasComponent(eventArgs.Dragged)) { return false; } diff --git a/Content.Shared/Lathe/SharedLatheComponent.cs b/Content.Shared/Lathe/SharedLatheComponent.cs index 55ccabe92e..dd7963c4ae 100644 --- a/Content.Shared/Lathe/SharedLatheComponent.cs +++ b/Content.Shared/Lathe/SharedLatheComponent.cs @@ -18,8 +18,8 @@ namespace Content.Shared.Lathe public bool CanProduce(LatheRecipePrototype recipe, int quantity = 1) { - if (!IoCManager.Resolve().TryGetComponent(Owner.Uid, out SharedMaterialStorageComponent? storage) - || !IoCManager.Resolve().TryGetComponent(Owner.Uid, out SharedLatheDatabaseComponent? database)) return false; + if (!IoCManager.Resolve().TryGetComponent(Owner, out SharedMaterialStorageComponent? storage) + || !IoCManager.Resolve().TryGetComponent(Owner, out SharedLatheDatabaseComponent? database)) return false; if (!database.Contains(recipe)) return false; diff --git a/Content.Shared/Maps/TurfHelpers.cs b/Content.Shared/Maps/TurfHelpers.cs index 092766ddc4..eb780641c3 100644 --- a/Content.Shared/Maps/TurfHelpers.cs +++ b/Content.Shared/Maps/TurfHelpers.cs @@ -148,7 +148,7 @@ namespace Content.Shared.Maps //Actually spawn the relevant tile item at the right position and give it some random offset. var tileItem = entityManager.SpawnEntity(tileDef.ItemDropPrototypeName, indices.ToEntityCoordinates(tileRef.GridIndex, mapManager).Offset(new Vector2(x, y))); - entityManager.GetComponent(tileItem.Uid).LocalRotation = robustRandom.NextDouble() * Math.Tau; + entityManager.GetComponent(tileItem).LocalRotation = robustRandom.NextDouble() * Math.Tau; return true; } diff --git a/Content.Shared/MedicalScanner/SharedMedicalScannerComponent.cs b/Content.Shared/MedicalScanner/SharedMedicalScannerComponent.cs index 0541357fe6..04ae56127b 100644 --- a/Content.Shared/MedicalScanner/SharedMedicalScannerComponent.cs +++ b/Content.Shared/MedicalScanner/SharedMedicalScannerComponent.cs @@ -81,7 +81,7 @@ namespace Content.Shared.MedicalScanner public bool CanInsert(IEntity entity) { - return IoCManager.Resolve().HasComponent(entity.Uid); + return IoCManager.Resolve().HasComponent(entity); } bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs) diff --git a/Content.Shared/MobState/Components/MobStateComponent.cs b/Content.Shared/MobState/Components/MobStateComponent.cs index 0edcbc4c69..35d8a55fd3 100644 --- a/Content.Shared/MobState/Components/MobStateComponent.cs +++ b/Content.Shared/MobState/Components/MobStateComponent.cs @@ -60,13 +60,13 @@ namespace Content.Shared.MobState.Components else { // Initialize with some amount of damage, defaulting to 0. - UpdateState(IoCManager.Resolve().GetComponentOrNull(Owner.Uid)?.TotalDamage ?? FixedPoint2.Zero); + UpdateState(IoCManager.Resolve().GetComponentOrNull(Owner)?.TotalDamage ?? FixedPoint2.Zero); } } protected override void OnRemove() { - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out SharedAlertsComponent? status)) + if (IoCManager.Resolve().TryGetComponent(Owner, out SharedAlertsComponent? status)) { status.ClearAlert(AlertType.HumanHealth); } diff --git a/Content.Shared/Movement/Components/MovementIgnoreGravityComponent.cs b/Content.Shared/Movement/Components/MovementIgnoreGravityComponent.cs index e378886ead..0ba4ab2f06 100644 --- a/Content.Shared/Movement/Components/MovementIgnoreGravityComponent.cs +++ b/Content.Shared/Movement/Components/MovementIgnoreGravityComponent.cs @@ -17,12 +17,12 @@ namespace Content.Shared.Movement.Components public static bool IsWeightless(this IEntity entity, PhysicsComponent? body = null, EntityCoordinates? coords = null, IMapManager? mapManager = null, IEntityManager? entityManager = null) { if (body == null) - IoCManager.Resolve().TryGetComponent(entity.Uid, out body); + IoCManager.Resolve().TryGetComponent(entity, out body); - if (IoCManager.Resolve().HasComponent(entity.Uid) || + if (IoCManager.Resolve().HasComponent(entity) || (body?.BodyType & (BodyType.Static | BodyType.Kinematic)) != 0) return false; - var transform = IoCManager.Resolve().GetComponent(entity.Uid); + var transform = IoCManager.Resolve().GetComponent(entity); var gridId = transform.GridID; if (!gridId.IsValid()) @@ -38,7 +38,7 @@ namespace Content.Shared.Movement.Components entityManager ??= IoCManager.Resolve(); var gridEntity = entityManager.GetEntity(gridEntityId); - if (!IoCManager.Resolve().GetComponent(gridEntity.Uid).Enabled) + if (!IoCManager.Resolve().GetComponent(gridEntity).Enabled) { return true; } diff --git a/Content.Shared/Movement/Components/SharedPlayerInputMoverComponent.cs b/Content.Shared/Movement/Components/SharedPlayerInputMoverComponent.cs index 149791b65c..8dfdd9aaf6 100644 --- a/Content.Shared/Movement/Components/SharedPlayerInputMoverComponent.cs +++ b/Content.Shared/Movement/Components/SharedPlayerInputMoverComponent.cs @@ -119,7 +119,7 @@ namespace Content.Shared.Movement.Components { base.Initialize(); Owner.EnsureComponentWarn(); - LastGridAngle = IoCManager.Resolve().GetComponent(Owner.Uid).Parent?.WorldRotation ?? new Angle(0); + LastGridAngle = IoCManager.Resolve().GetComponent(Owner).Parent?.WorldRotation ?? new Angle(0); } /// diff --git a/Content.Shared/Movement/Components/SharedPlayerMobMoverComponent.cs b/Content.Shared/Movement/Components/SharedPlayerMobMoverComponent.cs index 3a61bcad49..6129fad4c0 100644 --- a/Content.Shared/Movement/Components/SharedPlayerMobMoverComponent.cs +++ b/Content.Shared/Movement/Components/SharedPlayerMobMoverComponent.cs @@ -86,7 +86,7 @@ namespace Content.Shared.Movement.Components protected override void Initialize() { base.Initialize(); - if (!IoCManager.Resolve().HasComponent(Owner.Uid)) + if (!IoCManager.Resolve().HasComponent(Owner)) { Owner.EnsureComponentWarn(); } diff --git a/Content.Shared/Movement/EntitySystems/SharedMobMoverSystem.cs b/Content.Shared/Movement/EntitySystems/SharedMobMoverSystem.cs index f0b995462e..62c4751c17 100644 --- a/Content.Shared/Movement/EntitySystems/SharedMobMoverSystem.cs +++ b/Content.Shared/Movement/EntitySystems/SharedMobMoverSystem.cs @@ -43,7 +43,7 @@ namespace Content.Shared.Movement.EntitySystems if (otherBody.BodyType != BodyType.Dynamic || !otherFixture.Hard) return; - if (!IoCManager.Resolve().TryGetComponent(ourFixture.Body.Owner.Uid, out IMobMoverComponent? mobMover) || worldNormal == Vector2.Zero) return; + if (!IoCManager.Resolve().TryGetComponent(ourFixture.Body.Owner, out IMobMoverComponent? mobMover) || worldNormal == Vector2.Zero) return; otherBody.ApplyLinearImpulse(-worldNormal * mobMover.PushStrength * frameTime); } diff --git a/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs b/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs index a8292f3f73..afc22122ea 100644 --- a/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs +++ b/Content.Shared/Movement/EntitySystems/SharedMoverSystem.cs @@ -50,15 +50,15 @@ namespace Content.Shared.Movement.EntitySystems if (owner != null && session != null) { - EntityManager.EventBus.RaiseLocalEvent(owner.Uid, new RelayMoveInputEvent(session)); + EntityManager.EventBus.RaiseLocalEvent(owner, new RelayMoveInputEvent(session)); // For stuff like "Moving out of locker" or the likes if (owner.IsInContainer() && - (!IoCManager.Resolve().TryGetComponent(owner.Uid, out MobStateComponent? mobState) || + (!IoCManager.Resolve().TryGetComponent(owner, out MobStateComponent? mobState) || mobState.IsAlive())) { var relayMoveEvent = new RelayMovementEntityEvent(owner); - IoCManager.Resolve().EventBus.RaiseLocalEvent(IoCManager.Resolve().GetComponent(owner.Uid).ParentUid, relayMoveEvent); + IoCManager.Resolve().EventBus.RaiseLocalEvent(IoCManager.Resolve().GetComponent(owner).ParentUid, relayMoveEvent); } } @@ -82,10 +82,10 @@ namespace Content.Shared.Movement.EntitySystems var ent = session?.AttachedEntity; - if (ent == null || !IoCManager.Resolve().EntityExists(ent.Uid)) + if (ent == null || !IoCManager.Resolve().EntityExists(ent)) return false; - if (!IoCManager.Resolve().TryGetComponent(ent.Uid, out T? comp)) + if (!IoCManager.Resolve().TryGetComponent(ent, out T? comp)) return false; component = comp; diff --git a/Content.Shared/Movement/SharedMoverController.cs b/Content.Shared/Movement/SharedMoverController.cs index 459626e6e5..66aecf5474 100644 --- a/Content.Shared/Movement/SharedMoverController.cs +++ b/Content.Shared/Movement/SharedMoverController.cs @@ -67,7 +67,7 @@ namespace Content.Shared.Movement { var (walkDir, sprintDir) = mover.VelocityDir; - var transform = IoCManager.Resolve().GetComponent(mover.Owner.Uid); + var transform = IoCManager.Resolve().GetComponent(mover.Owner); var parentRotation = transform.Parent!.WorldRotation; // Regular movement. @@ -105,7 +105,7 @@ namespace Content.Shared.Movement } UsedMobMovement[mover.OwnerUid] = true; - var transform = IoCManager.Resolve().GetComponent(mover.Owner.Uid); + var transform = IoCManager.Resolve().GetComponent(mover.Owner); var weightless = mover.Owner.IsWeightless(physicsComponent, mapManager: _mapManager, entityManager: _entityManager); var (walkDir, sprintDir) = mover.VelocityDir; @@ -164,9 +164,9 @@ namespace Content.Shared.Movement protected bool UseMobMovement(PhysicsComponent body) { return body.BodyStatus == BodyStatus.OnGround && - IoCManager.Resolve().HasComponent(body.Owner.Uid) && + IoCManager.Resolve().HasComponent(body.Owner) && // If we're being pulled then don't mess with our velocity. - (!IoCManager.Resolve().TryGetComponent(body.Owner.Uid, out SharedPullableComponent? pullable) || !pullable.BeingPulled) && + (!IoCManager.Resolve().TryGetComponent(body.Owner, out SharedPullableComponent? pullable) || !pullable.BeingPulled) && _blocker.CanMove(body.OwnerUid); } @@ -186,7 +186,7 @@ namespace Content.Shared.Movement !otherCollider.CanCollide || ((collider.CollisionMask & otherCollider.CollisionLayer) == 0 && (otherCollider.CollisionMask & collider.CollisionLayer) == 0) || - (IoCManager.Resolve().TryGetComponent(otherCollider.Owner.Uid, out SharedPullableComponent? pullable) && pullable.BeingPulled)) + (IoCManager.Resolve().TryGetComponent(otherCollider.Owner, out SharedPullableComponent? pullable) && pullable.BeingPulled)) { continue; } diff --git a/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs b/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs index 8ab0b371b8..399a71491e 100644 --- a/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs @@ -62,7 +62,7 @@ namespace Content.Shared.Nutrition.EntitySystems private void OnCreamPiedHitBy(EntityUid uid, CreamPiedComponent creamPied, ThrowHitByEvent args) { - if (!IoCManager.Resolve().EntityExists(args.Thrown.Uid) || !IoCManager.Resolve().TryGetComponent(args.Thrown.Uid, out CreamPieComponent? creamPie)) return; + if (!IoCManager.Resolve().EntityExists(args.Thrown) || !IoCManager.Resolve().TryGetComponent(args.Thrown, out CreamPieComponent? creamPie)) return; SetCreamPied(uid, creamPied, true); diff --git a/Content.Shared/Placeable/PlaceableSurfaceSystem.cs b/Content.Shared/Placeable/PlaceableSurfaceSystem.cs index 486559d369..cd87905b2e 100644 --- a/Content.Shared/Placeable/PlaceableSurfaceSystem.cs +++ b/Content.Shared/Placeable/PlaceableSurfaceSystem.cs @@ -52,19 +52,19 @@ namespace Content.Shared.Placeable if (!surface.IsPlaceable) return; - if(!IoCManager.Resolve().TryGetComponent(args.User.Uid, out var handComponent)) + if(!IoCManager.Resolve().TryGetComponent(args.User, out var handComponent)) return; if (!args.ClickLocation.IsValid(IoCManager.Resolve())) return; - if(!handComponent.TryDropEntity(args.Used, IoCManager.Resolve().GetComponent(surface.Owner.Uid).Coordinates)) + if(!handComponent.TryDropEntity(args.Used, IoCManager.Resolve().GetComponent(surface.Owner).Coordinates)) return; if (surface.PlaceCentered) - IoCManager.Resolve().GetComponent(args.Used.Uid).LocalPosition = IoCManager.Resolve().GetComponent(args.Target.Uid).LocalPosition + surface.PositionOffset; + IoCManager.Resolve().GetComponent(args.Used).LocalPosition = IoCManager.Resolve().GetComponent(args.Target).LocalPosition + surface.PositionOffset; else - IoCManager.Resolve().GetComponent(args.Used.Uid).Coordinates = args.ClickLocation; + IoCManager.Resolve().GetComponent(args.Used).Coordinates = args.ClickLocation; args.Handled = true; } diff --git a/Content.Shared/Popups/SharedPopupExtensions.cs b/Content.Shared/Popups/SharedPopupExtensions.cs index ae3d9fde27..e9eb7ffc88 100644 --- a/Content.Shared/Popups/SharedPopupExtensions.cs +++ b/Content.Shared/Popups/SharedPopupExtensions.cs @@ -17,7 +17,7 @@ namespace Content.Shared.Popups { var popupSystem = EntitySystem.Get(); - popupSystem.PopupEntity(message, source.Uid, Filter.Entities(viewer.Uid)); + popupSystem.PopupEntity(message, source, Filter.Entities(viewer)); } /// @@ -39,7 +39,7 @@ namespace Content.Shared.Popups public static void PopupMessage(this EntityCoordinates coordinates, IEntity viewer, string message) { var popupSystem = EntitySystem.Get(); - popupSystem.PopupCoordinates(message, coordinates, Filter.Entities(viewer.Uid)); + popupSystem.PopupCoordinates(message, coordinates, Filter.Entities(viewer)); } /// @@ -52,7 +52,7 @@ namespace Content.Shared.Popups public static void PopupMessageCursor(this IEntity viewer, string message) { var popupSystem = EntitySystem.Get(); - popupSystem.PopupCursor(message, Filter.Entities(viewer.Uid)); + popupSystem.PopupCursor(message, Filter.Entities(viewer)); } } } diff --git a/Content.Shared/Pulling/Components/PullableComponent.cs b/Content.Shared/Pulling/Components/PullableComponent.cs index 7a7aa491e0..0a42911ed3 100644 --- a/Content.Shared/Pulling/Components/PullableComponent.cs +++ b/Content.Shared/Pulling/Components/PullableComponent.cs @@ -41,7 +41,7 @@ namespace Content.Shared.Pulling.Components public override ComponentState GetComponentState() { - return new PullableComponentState(Puller?.Uid); + return new PullableComponentState(Puller); } public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) @@ -71,7 +71,7 @@ namespace Content.Shared.Pulling.Components return; } - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out var comp)) + if (!IoCManager.Resolve().TryGetComponent(entity, out var comp)) { Logger.Error($"Entity {state.Puller.Value} for pulling had no Puller component"); // ensure it disconnects from any different puller, still diff --git a/Content.Shared/Pulling/Systems/SharedPullerSystem.cs b/Content.Shared/Pulling/Systems/SharedPullerSystem.cs index d452a380e8..092b9c7d04 100644 --- a/Content.Shared/Pulling/Systems/SharedPullerSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullerSystem.cs @@ -48,7 +48,7 @@ namespace Content.Shared.Pulling.Systems if (args.Puller.OwnerUid != uid) return; - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out SharedAlertsComponent? alerts)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out SharedAlertsComponent? alerts)) alerts.ShowAlert(AlertType.Pulling); RefreshMovementSpeed(component); @@ -62,7 +62,7 @@ namespace Content.Shared.Pulling.Systems if (args.Puller.OwnerUid != uid) return; - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out SharedAlertsComponent? alerts)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out SharedAlertsComponent? alerts)) alerts.ClearAlert(AlertType.Pulling); RefreshMovementSpeed(component); diff --git a/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs b/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs index 914c229b26..139261a7af 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingStateManagementSystem.cs @@ -36,14 +36,14 @@ namespace Content.Shared.Pulling // They do not expect to be cancellable. private void ForceDisconnect(SharedPullerComponent puller, SharedPullableComponent pullable) { - var pullerPhysics = IoCManager.Resolve().GetComponent(puller.Owner.Uid); - var pullablePhysics = IoCManager.Resolve().GetComponent(pullable.Owner.Uid); + var pullerPhysics = IoCManager.Resolve().GetComponent(puller.Owner); + var pullablePhysics = IoCManager.Resolve().GetComponent(pullable.Owner); // MovingTo shutdown ForceSetMovingTo(pullable, null); // Joint shutdown - if (IoCManager.Resolve().TryGetComponent(puller.Owner.Uid, out var jointComp)) + if (IoCManager.Resolve().TryGetComponent(puller.Owner, out var jointComp)) { if (jointComp.GetJoints.Contains(pullable.PullJoint!)) { @@ -61,7 +61,7 @@ namespace Content.Shared.Pulling RaiseLocalEvent(puller.OwnerUid, message, broadcast: false); - if ((!IoCManager.Resolve().EntityExists(pullable.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(pullable.Owner.Uid).EntityLifeStage) <= EntityLifeStage.MapInitialized) + if ((!IoCManager.Resolve().EntityExists(pullable.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(pullable.Owner).EntityLifeStage) <= EntityLifeStage.MapInitialized) RaiseLocalEvent(pullable.OwnerUid, message); // Networking @@ -81,22 +81,22 @@ namespace Content.Shared.Pulling var pullableOldPullerE = pullable?.Puller; if (pullableOldPullerE != null) { - ForceDisconnect(IoCManager.Resolve().GetComponent(pullableOldPullerE.Uid), pullable!); + ForceDisconnect(IoCManager.Resolve().GetComponent(pullableOldPullerE), pullable!); } // Continue with the puller. var pullerOldPullableE = puller?.Pulling; if (pullerOldPullableE != null) { - ForceDisconnect(puller!, IoCManager.Resolve().GetComponent(pullerOldPullableE.Uid)); + ForceDisconnect(puller!, IoCManager.Resolve().GetComponent(pullerOldPullableE)); } // And now for the actual connection (if any). if ((puller != null) && (pullable != null)) { - var pullerPhysics = IoCManager.Resolve().GetComponent(puller.Owner.Uid); - var pullablePhysics = IoCManager.Resolve().GetComponent(pullable.Owner.Uid); + var pullerPhysics = IoCManager.Resolve().GetComponent(puller.Owner); + var pullablePhysics = IoCManager.Resolve().GetComponent(pullable.Owner); // State startup puller.Pulling = pullable.Owner; @@ -106,7 +106,7 @@ namespace Content.Shared.Pulling var union = pullerPhysics.GetWorldAABB().Union(pullablePhysics.GetWorldAABB()); var length = Math.Max(union.Size.X, union.Size.Y) * 0.75f; - pullable.PullJoint = _jointSystem.CreateDistanceJoint(pullablePhysics.OwnerUid, pullerPhysics.Owner.Uid, id:$"pull-joint-{pullablePhysics.Owner.Uid}"); + pullable.PullJoint = _jointSystem.CreateDistanceJoint(pullablePhysics.OwnerUid, pullerPhysics.Owner, id:$"pull-joint-{pullablePhysics.Owner}"); pullable.PullJoint.CollideConnected = false; // This maximum has to be there because if the object is constrained too closely, the clamping goes backwards and asserts. pullable.PullJoint.MaxLength = Math.Max(1.0f, length); @@ -158,11 +158,11 @@ namespace Content.Shared.Pulling if (movingTo == null) { - RaiseLocalEvent(pullable.Owner.Uid, new PullableStopMovingMessage()); + RaiseLocalEvent(pullable.Owner, new PullableStopMovingMessage()); } else { - RaiseLocalEvent(pullable.Owner.Uid, new PullableMoveMessage()); + RaiseLocalEvent(pullable.Owner, new PullableMoveMessage()); } } } diff --git a/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs b/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs index 5332bbaf67..69ceca0180 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingSystem.Actions.cs @@ -29,17 +29,17 @@ namespace Content.Shared.Pulling public bool CanPull(IEntity puller, IEntity pulled) { - if (!IoCManager.Resolve().HasComponent(puller.Uid)) + if (!IoCManager.Resolve().HasComponent(puller)) { return false; } - if (!_blocker.CanInteract(puller.Uid)) + if (!_blocker.CanInteract(puller)) { return false; } - if (!IoCManager.Resolve().TryGetComponent(pulled.Uid, out var _physics)) + if (!IoCManager.Resolve().TryGetComponent(pulled, out var _physics)) { return false; } @@ -59,17 +59,17 @@ namespace Content.Shared.Pulling return false; } - if (IoCManager.Resolve().TryGetComponent(puller.Uid, out var buckle)) + if (IoCManager.Resolve().TryGetComponent(puller, out var buckle)) { // Prevent people pulling the chair they're on, etc. - if (buckle.Buckled && (buckle.LastEntityBuckledTo == pulled.Uid)) + if (buckle.Buckled && (buckle.LastEntityBuckledTo == pulled)) { return false; } } var startPull = new StartPullAttemptEvent(puller, pulled); - RaiseLocalEvent(puller.Uid, startPull); + RaiseLocalEvent(puller, startPull); return !startPull.Cancelled; } @@ -91,7 +91,7 @@ namespace Content.Shared.Pulling return false; } - var msg = new StopPullingEvent(user?.Uid); + var msg = new StopPullingEvent(user); RaiseLocalEvent(pullable.OwnerUid, msg); if (msg.Cancelled) return false; @@ -102,11 +102,11 @@ namespace Content.Shared.Pulling public bool TryStartPull(IEntity puller, IEntity pullable) { - if (!IoCManager.Resolve().TryGetComponent(puller.Uid, out var pullerComp)) + if (!IoCManager.Resolve().TryGetComponent(puller, out var pullerComp)) { return false; } - if (!IoCManager.Resolve().TryGetComponent(pullable.Uid, out var pullableComp)) + if (!IoCManager.Resolve().TryGetComponent(pullable, out var pullableComp)) { return false; } @@ -126,12 +126,12 @@ namespace Content.Shared.Pulling return false; } - if (!IoCManager.Resolve().TryGetComponent(puller.Owner.Uid, out var pullerPhysics)) + if (!IoCManager.Resolve().TryGetComponent(puller.Owner, out var pullerPhysics)) { return false; } - if (!IoCManager.Resolve().TryGetComponent(pullable.Owner.Uid, out var pullablePhysics)) + if (!IoCManager.Resolve().TryGetComponent(pullable.Owner, out var pullablePhysics)) { return false; } @@ -143,7 +143,7 @@ namespace Content.Shared.Pulling var oldPullable = puller.Pulling; if (oldPullable != null) { - if (IoCManager.Resolve().TryGetComponent(oldPullable.Uid, out var oldPullableComp)) + if (IoCManager.Resolve().TryGetComponent(oldPullable, out var oldPullableComp)) { if (!TryStopPull(oldPullableComp)) { @@ -198,7 +198,7 @@ namespace Content.Shared.Pulling return false; } - if (!IoCManager.Resolve().HasComponent(pullable.Owner.Uid)) + if (!IoCManager.Resolve().HasComponent(pullable.Owner)) { return false; } diff --git a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs index 159fac2a4a..a9c4844297 100644 --- a/Content.Shared/Pulling/Systems/SharedPullingSystem.cs +++ b/Content.Shared/Pulling/Systems/SharedPullingSystem.cs @@ -105,7 +105,7 @@ namespace Content.Shared.Pulling if (args.Pulled.OwnerUid != uid) return; - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out SharedAlertsComponent? alerts)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out SharedAlertsComponent? alerts)) alerts.ShowAlert(AlertType.Pulled); } @@ -114,7 +114,7 @@ namespace Content.Shared.Pulling if (args.Pulled.OwnerUid != uid) return; - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out SharedAlertsComponent? alerts)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out SharedAlertsComponent? alerts)) alerts.ClearAlert(AlertType.Pulled); } @@ -165,12 +165,12 @@ namespace Content.Shared.Pulling // The pulled object may have already been deleted. // TODO: Work out why. Monkey + meat spike is a good test for this, // assuming you're still pulling the monkey when it gets gibbed. - if ((!IoCManager.Resolve().EntityExists(pulled.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(pulled.Uid).EntityLifeStage) >= EntityLifeStage.Deleted) + if ((!IoCManager.Resolve().EntityExists(pulled) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(pulled).EntityLifeStage) >= EntityLifeStage.Deleted) { return; } - if (!IoCManager.Resolve().TryGetComponent(pulled.Uid, out IPhysBody? physics)) + if (!IoCManager.Resolve().TryGetComponent(pulled, out IPhysBody? physics)) { return; } @@ -183,16 +183,16 @@ namespace Content.Shared.Pulling // TODO: When Joint networking is less shitcodey fix this to use a dedicated joints message. private void HandleContainerInsert(EntInsertedIntoContainerMessage message) { - if (IoCManager.Resolve().TryGetComponent(message.Entity.Uid, out SharedPullableComponent? pullable)) + if (IoCManager.Resolve().TryGetComponent(message.Entity, out SharedPullableComponent? pullable)) { TryStopPull(pullable); } - if (IoCManager.Resolve().TryGetComponent(message.Entity.Uid, out SharedPullerComponent? puller)) + if (IoCManager.Resolve().TryGetComponent(message.Entity, out SharedPullerComponent? puller)) { if (puller.Pulling == null) return; - if (!IoCManager.Resolve().TryGetComponent(puller.Pulling.Uid, out SharedPullableComponent? pulling)) + if (!IoCManager.Resolve().TryGetComponent(puller.Pulling, out SharedPullableComponent? pulling)) { return; } @@ -215,7 +215,7 @@ namespace Content.Shared.Pulling return false; } - if (!IoCManager.Resolve().TryGetComponent(pulled.Uid, out SharedPullableComponent? pullable)) + if (!IoCManager.Resolve().TryGetComponent(pulled, out SharedPullableComponent? pullable)) { return false; } @@ -253,16 +253,16 @@ namespace Content.Shared.Pulling private void UpdatePulledRotation(IEntity puller, IEntity pulled) { // TODO: update once ComponentReference works with directed event bus. - if (!IoCManager.Resolve().TryGetComponent(pulled.Uid, out RotatableComponent? rotatable)) + if (!IoCManager.Resolve().TryGetComponent(pulled, out RotatableComponent? rotatable)) return; if (!rotatable.RotateWhilePulling) return; - var dir = IoCManager.Resolve().GetComponent(puller.Uid).WorldPosition - IoCManager.Resolve().GetComponent(pulled.Uid).WorldPosition; + var dir = IoCManager.Resolve().GetComponent(puller).WorldPosition - IoCManager.Resolve().GetComponent(pulled).WorldPosition; if (dir.LengthSquared > ThresholdRotDistance * ThresholdRotDistance) { - var oldAngle = IoCManager.Resolve().GetComponent(pulled.Uid).WorldRotation; + var oldAngle = IoCManager.Resolve().GetComponent(pulled).WorldRotation; var newAngle = Angle.FromWorldVec(dir); var diff = newAngle - oldAngle; @@ -272,10 +272,10 @@ namespace Content.Shared.Pulling // Otherwise PIANO DOOR STUCK! happens. // But it also needs to work with station rotation / align to the local parent. // So... - var baseRotation = IoCManager.Resolve().GetComponent(pulled.Uid).Parent?.WorldRotation ?? 0f; + var baseRotation = IoCManager.Resolve().GetComponent(pulled).Parent?.WorldRotation ?? 0f; var localRotation = newAngle - baseRotation; var localRotationSnapped = Angle.FromDegrees(Math.Floor((localRotation.Degrees / ThresholdRotAngle) + 0.5f) * ThresholdRotAngle); - IoCManager.Resolve().GetComponent(pulled.Uid).LocalRotation = localRotationSnapped; + IoCManager.Resolve().GetComponent(pulled).LocalRotation = localRotationSnapped; } } } diff --git a/Content.Shared/Random/Helpers/SharedEntityExtensions.cs b/Content.Shared/Random/Helpers/SharedEntityExtensions.cs index b3c427ce7b..9df605f7a7 100644 --- a/Content.Shared/Random/Helpers/SharedEntityExtensions.cs +++ b/Content.Shared/Random/Helpers/SharedEntityExtensions.cs @@ -20,7 +20,7 @@ namespace Content.Shared.Random.Helpers var randomY = random.NextFloat() * (maxY - minY) + minY; var offset = new Vector2(randomX, randomY); - IoCManager.Resolve().GetComponent(entity.Uid).LocalPosition += offset; + IoCManager.Resolve().GetComponent(entity).LocalPosition += offset; } public static void RandomOffset(this IEntity entity, float min, float max) diff --git a/Content.Shared/Shuttles/Components/PilotComponent.cs b/Content.Shared/Shuttles/Components/PilotComponent.cs index 7fc279f4a4..91dd68156f 100644 --- a/Content.Shared/Shuttles/Components/PilotComponent.cs +++ b/Content.Shared/Shuttles/Components/PilotComponent.cs @@ -39,7 +39,7 @@ namespace Content.Shared.Shuttles.Components } if (!IoCManager.Resolve().TryGetEntity(state.Console.Value, out var consoleEnt) || - !IoCManager.Resolve().TryGetComponent(consoleEnt.Uid, out SharedShuttleConsoleComponent? shuttleConsoleComponent)) + !IoCManager.Resolve().TryGetComponent(consoleEnt, out SharedShuttleConsoleComponent? shuttleConsoleComponent)) { Logger.Warning($"Unable to set Helmsman console to {state.Console.Value}"); return; diff --git a/Content.Shared/Singularity/SharedSingularitySystem.cs b/Content.Shared/Singularity/SharedSingularitySystem.cs index 67991e18ec..8fbcb87f1b 100644 --- a/Content.Shared/Singularity/SharedSingularitySystem.cs +++ b/Content.Shared/Singularity/SharedSingularitySystem.cs @@ -55,7 +55,7 @@ namespace Content.Shared.Singularity value = Math.Clamp(value, 0, 6); - var physics = IoCManager.Resolve().GetComponentOrNull(singularity.Owner.Uid); + var physics = IoCManager.Resolve().GetComponentOrNull(singularity.Owner); if (singularity.Level > 1 && value <= 1) { @@ -68,12 +68,12 @@ namespace Content.Shared.Singularity singularity.Level = value; - if (IoCManager.Resolve().TryGetComponent(singularity.Owner.Uid, out SharedRadiationPulseComponent? pulse)) + if (IoCManager.Resolve().TryGetComponent(singularity.Owner, out SharedRadiationPulseComponent? pulse)) { pulse.RadsPerSecond = 10 * value; } - if (IoCManager.Resolve().TryGetComponent(singularity.Owner.Uid, out AppearanceComponent? appearance)) + if (IoCManager.Resolve().TryGetComponent(singularity.Owner, out AppearanceComponent? appearance)) { appearance.SetData(SingularityVisuals.Level, value); } @@ -83,7 +83,7 @@ namespace Content.Shared.Singularity circle.Radius = value - 0.5f; } - if (IoCManager.Resolve().TryGetComponent(singularity.Owner.Uid, out SingularityDistortionComponent? distortion)) + if (IoCManager.Resolve().TryGetComponent(singularity.Owner, out SingularityDistortionComponent? distortion)) { distortion.Falloff = GetFalloff(value); distortion.Intensity = GetIntensity(value); @@ -102,8 +102,8 @@ namespace Content.Shared.Singularity { var other = args.BodyB.Owner; - if ((!IoCManager.Resolve().HasComponent(other.Uid) && - !IoCManager.Resolve().HasComponent(other.Uid)) || + if ((!IoCManager.Resolve().HasComponent(other) && + !IoCManager.Resolve().HasComponent(other)) || component.Level >= 4) { args.Cancel(); diff --git a/Content.Shared/Slippery/SharedSlipperySystem.cs b/Content.Shared/Slippery/SharedSlipperySystem.cs index bc8eb075a5..76667d0ba3 100644 --- a/Content.Shared/Slippery/SharedSlipperySystem.cs +++ b/Content.Shared/Slippery/SharedSlipperySystem.cs @@ -114,7 +114,7 @@ namespace Content.Shared.Slippery if (component.Deleted || !component.Slippery || component.Colliding.Count == 0) return true; - if (!EntityManager.TryGetComponent(component.Owner.Uid, out PhysicsComponent? body)) + if (!EntityManager.TryGetComponent(component.Owner, out PhysicsComponent? body)) { component.Colliding.Clear(); return true; @@ -130,7 +130,7 @@ namespace Content.Shared.Slippery continue; } - if (!IoCManager.Resolve().TryGetComponent(entity.Uid, out PhysicsComponent? otherPhysics) || + if (!IoCManager.Resolve().TryGetComponent(entity, out PhysicsComponent? otherPhysics) || !body.GetWorldAABB().Intersects(otherPhysics.GetWorldAABB())) { component.Colliding.Remove(uid); diff --git a/Content.Shared/StatusEffect/StatusEffectsSystem.cs b/Content.Shared/StatusEffect/StatusEffectsSystem.cs index bd94660599..8bb30b5187 100644 --- a/Content.Shared/StatusEffect/StatusEffectsSystem.cs +++ b/Content.Shared/StatusEffect/StatusEffectsSystem.cs @@ -37,7 +37,7 @@ namespace Content.Shared.StatusEffect // if we're past the end point of the effect if (_gameTiming.CurTime > state.Value.Cooldown.Item2) { - TryRemoveStatusEffect(status.Owner.Uid, state.Key, status); + TryRemoveStatusEffect(status.Owner, state.Key, status); } } } diff --git a/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs b/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs index a481fe7fd5..a290b0124e 100644 --- a/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedItemCounterSystem.cs @@ -21,7 +21,7 @@ namespace Content.Shared.Storage.EntitySystems private void CounterEntityInserted(EntityUid uid, ItemCounterComponent itemCounter, EntInsertedIntoContainerMessage args) { - if (!IoCManager.Resolve().TryGetComponent(itemCounter.Owner.Uid, out AppearanceComponent? appearanceComponent)) return; + if (!IoCManager.Resolve().TryGetComponent(itemCounter.Owner, out AppearanceComponent? appearanceComponent)) return; var count = GetCount(args, itemCounter); if (count == null) @@ -36,7 +36,7 @@ namespace Content.Shared.Storage.EntitySystems private void CounterEntityRemoved(EntityUid uid, ItemCounterComponent itemCounter, EntRemovedFromContainerMessage args) { - if (!IoCManager.Resolve().TryGetComponent(itemCounter.Owner.Uid, out AppearanceComponent? appearanceComponent)) return; + if (!IoCManager.Resolve().TryGetComponent(itemCounter.Owner, out AppearanceComponent? appearanceComponent)) return; var count = GetCount(args, itemCounter); if (count == null) diff --git a/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs b/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs index b8a4836c1d..e0ae4520ce 100644 --- a/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs +++ b/Content.Shared/Storage/EntitySystems/SharedItemMapperSystem.cs @@ -21,7 +21,7 @@ namespace Content.Shared.Storage.EntitySystems private void InitLayers(EntityUid uid, ItemMapperComponent component, ComponentInit args) { - if (IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out AppearanceComponent? appearanceComponent)) + if (IoCManager.Resolve().TryGetComponent(component.Owner, out AppearanceComponent? appearanceComponent)) { var list = new List(component.MapLayers.Keys); appearanceComponent.SetData(StorageMapVisuals.InitLayers, new ShowLayerData(list)); @@ -31,7 +31,7 @@ namespace Content.Shared.Storage.EntitySystems private void MapperEntityRemoved(EntityUid uid, ItemMapperComponent itemMapper, EntRemovedFromContainerMessage args) { - if (IoCManager.Resolve().TryGetComponent(itemMapper.Owner.Uid, out AppearanceComponent? appearanceComponent) + if (IoCManager.Resolve().TryGetComponent(itemMapper.Owner, out AppearanceComponent? appearanceComponent) && TryGetLayers(args, itemMapper, out var containedLayers)) { appearanceComponent.SetData(StorageMapVisuals.LayerChanged, new ShowLayerData(containedLayers)); @@ -41,7 +41,7 @@ namespace Content.Shared.Storage.EntitySystems private void MapperEntityInserted(EntityUid uid, ItemMapperComponent itemMapper, EntInsertedIntoContainerMessage args) { - if (IoCManager.Resolve().TryGetComponent(itemMapper.Owner.Uid, out AppearanceComponent? appearanceComponent) + if (IoCManager.Resolve().TryGetComponent(itemMapper.Owner, out AppearanceComponent? appearanceComponent) && TryGetLayers(args, itemMapper, out var containedLayers)) { appearanceComponent.SetData(StorageMapVisuals.LayerChanged, new ShowLayerData(containedLayers)); diff --git a/Content.Shared/Storage/SharedStorageComponent.cs b/Content.Shared/Storage/SharedStorageComponent.cs index da3653a705..4bc2559515 100644 --- a/Content.Shared/Storage/SharedStorageComponent.cs +++ b/Content.Shared/Storage/SharedStorageComponent.cs @@ -29,13 +29,13 @@ namespace Content.Shared.Storage bool IDraggable.CanDrop(CanDropEvent args) { - return IoCManager.Resolve().TryGetComponent(args.Target.Uid, out PlaceableSurfaceComponent? placeable) && + return IoCManager.Resolve().TryGetComponent(args.Target, out PlaceableSurfaceComponent? placeable) && placeable.IsPlaceable; } bool IDraggable.Drop(DragDropEvent eventArgs) { - if (!EntitySystem.Get().CanInteract(eventArgs.User.Uid)) + if (!EntitySystem.Get().CanInteract(eventArgs.User)) { return false; } @@ -52,7 +52,7 @@ namespace Content.Shared.Storage { if (Remove(storedEntity)) { - IoCManager.Resolve().GetComponent(storedEntity.Uid).WorldPosition = eventArgs.DropLocation.Position; + IoCManager.Resolve().GetComponent(storedEntity).WorldPosition = eventArgs.DropLocation.Position; } } diff --git a/Content.Shared/Strip/Components/SharedStrippableComponent.cs b/Content.Shared/Strip/Components/SharedStrippableComponent.cs index 774e46da7e..76e32c87ab 100644 --- a/Content.Shared/Strip/Components/SharedStrippableComponent.cs +++ b/Content.Shared/Strip/Components/SharedStrippableComponent.cs @@ -17,8 +17,8 @@ namespace Content.Shared.Strip.Components public bool CanBeStripped(IEntity by) { return by != Owner - && IoCManager.Resolve().HasComponent(@by.Uid) - && EntitySystem.Get().CanInteract(by.Uid); + && IoCManager.Resolve().HasComponent(@by) + && EntitySystem.Get().CanInteract(@by); } bool IDraggable.CanDrop(CanDropEvent args) diff --git a/Content.Shared/Strip/Components/SharedStrippingComponent.cs b/Content.Shared/Strip/Components/SharedStrippingComponent.cs index b8e2702b36..0210989a3a 100644 --- a/Content.Shared/Strip/Components/SharedStrippingComponent.cs +++ b/Content.Shared/Strip/Components/SharedStrippingComponent.cs @@ -14,7 +14,7 @@ namespace Content.Shared.Strip.Components bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs) { - if (!IoCManager.Resolve().TryGetComponent(eventArgs.Dragged.Uid, out SharedStrippableComponent? strippable)) return false; + if (!IoCManager.Resolve().TryGetComponent(eventArgs.Dragged, out SharedStrippableComponent? strippable)) return false; return strippable.CanBeStripped(Owner); } diff --git a/Content.Shared/SubFloor/SubFloorHideSystem.cs b/Content.Shared/SubFloor/SubFloorHideSystem.cs index c187dca217..512f2e8964 100644 --- a/Content.Shared/SubFloor/SubFloorHideSystem.cs +++ b/Content.Shared/SubFloor/SubFloorHideSystem.cs @@ -60,14 +60,14 @@ namespace Content.Shared.SubFloor { subFloor.Enabled = enabled; subFloor.Dirty(); - UpdateEntity(subFloor.Owner.Uid); + UpdateEntity(subFloor.Owner); } public void SetRequireAnchoring(SubFloorHideComponent subFloor, bool requireAnchored) { subFloor.RequireAnchored = requireAnchored; subFloor.Dirty(); - UpdateEntity(subFloor.Owner.Uid); + UpdateEntity(subFloor.Owner); } private void OnSubFloorStarted(EntityUid uid, SubFloorHideComponent component, ComponentStartup _) @@ -80,7 +80,7 @@ namespace Content.Shared.SubFloor { // If component is being deleted don't need to worry about updating any component stuff because it won't matter very shortly. IEntity tempQualifier = EntityManager.GetEntity(uid); - if ((!IoCManager.Resolve().EntityExists(tempQualifier.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(tempQualifier.Uid).EntityLifeStage) >= EntityLifeStage.Terminating) return; + if ((!IoCManager.Resolve().EntityExists(tempQualifier) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(tempQualifier).EntityLifeStage) >= EntityLifeStage.Terminating) return; // Regardless of whether we're on a subfloor or not, unhide. UpdateEntity(uid, true); @@ -126,7 +126,7 @@ namespace Content.Shared.SubFloor { foreach (var comp in EntityManager.EntityQuery(true)) { - UpdateEntity(comp.Owner.Uid); + UpdateEntity(comp.Owner); } } diff --git a/Content.Shared/Tabletop/SharedTabletopSystem.cs b/Content.Shared/Tabletop/SharedTabletopSystem.cs index 12956a9baf..8a91acb4ba 100644 --- a/Content.Shared/Tabletop/SharedTabletopSystem.cs +++ b/Content.Shared/Tabletop/SharedTabletopSystem.cs @@ -44,7 +44,7 @@ namespace Content.Shared.Tabletop return false; } - if (!IoCManager.Resolve().HasComponent(parent.Uid) && !IoCManager.Resolve().HasComponent(parent.Uid)) + if (!IoCManager.Resolve().HasComponent(parent) && !IoCManager.Resolve().HasComponent(parent)) { return false; } diff --git a/Content.Shared/Tag/TagComponentExtensions.cs b/Content.Shared/Tag/TagComponentExtensions.cs index edf4687863..e39c470eab 100644 --- a/Content.Shared/Tag/TagComponentExtensions.cs +++ b/Content.Shared/Tag/TagComponentExtensions.cs @@ -72,7 +72,7 @@ namespace Content.Shared.Tag /// public static bool TryAddTag(this IEntity entity, string id) { - return IoCManager.Resolve().TryGetComponent(entity.Uid, out TagComponent? tagComponent) && + return IoCManager.Resolve().TryGetComponent(entity, out TagComponent? tagComponent) && tagComponent.AddTag(id); } @@ -90,7 +90,7 @@ namespace Content.Shared.Tag /// public static bool TryAddTags(this IEntity entity, params string[] ids) { - return IoCManager.Resolve().TryGetComponent(entity.Uid, out TagComponent? tagComponent) && + return IoCManager.Resolve().TryGetComponent(entity, out TagComponent? tagComponent) && tagComponent.AddTags(ids); } @@ -108,7 +108,7 @@ namespace Content.Shared.Tag /// public static bool TryAddTags(this IEntity entity, IEnumerable ids) { - return IoCManager.Resolve().TryGetComponent(entity.Uid, out TagComponent? tagComponent) && + return IoCManager.Resolve().TryGetComponent(entity, out TagComponent? tagComponent) && tagComponent.AddTags(ids); } @@ -123,7 +123,7 @@ namespace Content.Shared.Tag /// public static bool HasTag(this IEntity entity, string id) { - return IoCManager.Resolve().TryGetComponent(entity.Uid, out TagComponent? tagComponent) && + return IoCManager.Resolve().TryGetComponent(entity, out TagComponent? tagComponent) && tagComponent.HasTag(id); } @@ -138,7 +138,7 @@ namespace Content.Shared.Tag /// public static bool HasAllTags(this IEntity entity, params string[] ids) { - return IoCManager.Resolve().TryGetComponent(entity.Uid, out TagComponent? tagComponent) && + return IoCManager.Resolve().TryGetComponent(entity, out TagComponent? tagComponent) && tagComponent.HasAllTags(ids); } @@ -153,7 +153,7 @@ namespace Content.Shared.Tag /// public static bool HasAllTags(this IEntity entity, IEnumerable ids) { - return IoCManager.Resolve().TryGetComponent(entity.Uid, out TagComponent? tagComponent) && + return IoCManager.Resolve().TryGetComponent(entity, out TagComponent? tagComponent) && tagComponent.HasAllTags(ids); } @@ -168,7 +168,7 @@ namespace Content.Shared.Tag /// public static bool HasAnyTag(this IEntity entity, params string[] ids) { - return IoCManager.Resolve().TryGetComponent(entity.Uid, out TagComponent? tagComponent) && + return IoCManager.Resolve().TryGetComponent(entity, out TagComponent? tagComponent) && tagComponent.HasAnyTag(ids); } @@ -183,7 +183,7 @@ namespace Content.Shared.Tag /// public static bool HasAnyTag(this IEntity entity, IEnumerable ids) { - return IoCManager.Resolve().TryGetComponent(entity.Uid, out TagComponent? tagComponent) && + return IoCManager.Resolve().TryGetComponent(entity, out TagComponent? tagComponent) && tagComponent.HasAnyTag(ids); } @@ -200,7 +200,7 @@ namespace Content.Shared.Tag /// public static bool RemoveTag(this IEntity entity, string id) { - return IoCManager.Resolve().TryGetComponent(entity.Uid, out TagComponent? tagComponent) && + return IoCManager.Resolve().TryGetComponent(entity, out TagComponent? tagComponent) && tagComponent.RemoveTag(id); } @@ -217,7 +217,7 @@ namespace Content.Shared.Tag /// public static bool RemoveTags(this IEntity entity, params string[] ids) { - return IoCManager.Resolve().TryGetComponent(entity.Uid, out TagComponent? tagComponent) && + return IoCManager.Resolve().TryGetComponent(entity, out TagComponent? tagComponent) && tagComponent.RemoveTags(ids); } @@ -234,7 +234,7 @@ namespace Content.Shared.Tag /// public static bool RemoveTags(this IEntity entity, IEnumerable ids) { - return IoCManager.Resolve().TryGetComponent(entity.Uid, out TagComponent? tagComponent) && + return IoCManager.Resolve().TryGetComponent(entity, out TagComponent? tagComponent) && tagComponent.RemoveTags(ids); } } diff --git a/Content.Shared/Throwing/ThrownItemSystem.cs b/Content.Shared/Throwing/ThrownItemSystem.cs index b68ab291c5..4db15178ea 100644 --- a/Content.Shared/Throwing/ThrownItemSystem.cs +++ b/Content.Shared/Throwing/ThrownItemSystem.cs @@ -39,7 +39,7 @@ namespace Content.Shared.Throwing private void OnGetState(EntityUid uid, ThrownItemComponent component, ref ComponentGetState args) { - args.State = new ThrownItemComponentState(component.Thrower?.Uid); + args.State = new ThrownItemComponentState(component.Thrower); } private void OnHandleState(EntityUid uid, ThrownItemComponent component, ref ComponentHandleState args) @@ -53,7 +53,7 @@ namespace Content.Shared.Throwing private void ThrowItem(EntityUid uid, ThrownItemComponent component, ThrownEvent args) { - if (!IoCManager.Resolve().TryGetComponent(component.Owner.Uid, out PhysicsComponent? physicsComponent) || + if (!IoCManager.Resolve().TryGetComponent(component.Owner, out PhysicsComponent? physicsComponent) || physicsComponent.Fixtures.Count != 1) return; if (_fixtures.GetFixtureOrNull(physicsComponent, ThrowingFixture) != null) @@ -91,8 +91,8 @@ namespace Content.Shared.Throwing private void HandlePullStarted(PullStartedMessage message) { // TODO: this isn't directed so things have to be done the bad way - if (EntityManager.TryGetComponent(message.Pulled.Owner.Uid, out ThrownItemComponent? thrownItemComponent)) - StopThrow(message.Pulled.Owner.Uid, thrownItemComponent); + if (EntityManager.TryGetComponent(message.Pulled.Owner, out ThrownItemComponent? thrownItemComponent)) + StopThrow(message.Pulled.Owner, thrownItemComponent); } private void StopThrow(EntityUid uid, ThrownItemComponent thrownItemComponent) @@ -107,21 +107,21 @@ namespace Content.Shared.Throwing } } - EntityManager.EventBus.RaiseLocalEvent(uid, new StopThrowEvent {User = thrownItemComponent.Thrower?.Uid}); + EntityManager.EventBus.RaiseLocalEvent(uid, new StopThrowEvent {User = thrownItemComponent.Thrower}); EntityManager.RemoveComponent(uid); } public void LandComponent(ThrownItemComponent thrownItem) { - if (thrownItem.Deleted || (!IoCManager.Resolve().EntityExists(thrownItem.Owner.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(thrownItem.Owner.Uid).EntityLifeStage) >= EntityLifeStage.Deleted || _containerSystem.IsEntityInContainer(thrownItem.Owner.Uid)) return; + if (thrownItem.Deleted || (!IoCManager.Resolve().EntityExists(thrownItem.Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve().GetComponent(thrownItem.Owner).EntityLifeStage) >= EntityLifeStage.Deleted || _containerSystem.IsEntityInContainer(thrownItem.Owner)) return; var landing = thrownItem.Owner; // Unfortunately we can't check for hands containers as they have specific names. if (thrownItem.Owner.TryGetContainerMan(out var containerManager) && - IoCManager.Resolve().HasComponent(containerManager.Owner.Uid)) + IoCManager.Resolve().HasComponent(containerManager.Owner)) { - EntityManager.RemoveComponent(landing.Uid, thrownItem); + EntityManager.RemoveComponent(landing, thrownItem); return; } @@ -129,8 +129,8 @@ namespace Content.Shared.Throwing if (thrownItem.Thrower is not null) _adminLogSystem.Add(LogType.Landed, LogImpact.Low, $"{landing} thrown by {thrownItem.Thrower:thrower} landed."); - var landMsg = new LandEvent {User = thrownItem.Thrower?.Uid}; - RaiseLocalEvent(landing.Uid, landMsg, false); + var landMsg = new LandEvent {User = thrownItem.Thrower}; + RaiseLocalEvent(landing, landMsg, false); } /// @@ -142,8 +142,8 @@ namespace Content.Shared.Throwing _adminLogSystem.Add(LogType.ThrowHit, LogImpact.Low, $"{thrown.Owner:thrown} thrown by {user:thrower} hit {target.Owner:target}."); // TODO: Just pass in the bodies directly - RaiseLocalEvent(target.Owner.Uid, new ThrowHitByEvent(user, thrown.Owner, target.Owner)); - RaiseLocalEvent(thrown.Owner.Uid, new ThrowDoHitEvent(user, thrown.Owner, target.Owner)); + RaiseLocalEvent(target.Owner, new ThrowHitByEvent(user, thrown.Owner, target.Owner)); + RaiseLocalEvent(thrown.Owner, new ThrowDoHitEvent(user, thrown.Owner, target.Owner)); } } } diff --git a/Content.Shared/Timing/UseDelayComponent.cs b/Content.Shared/Timing/UseDelayComponent.cs index 53ca67815d..f0d7c03d5a 100644 --- a/Content.Shared/Timing/UseDelayComponent.cs +++ b/Content.Shared/Timing/UseDelayComponent.cs @@ -46,7 +46,7 @@ namespace Content.Shared.Timing _lastUseTime = IoCManager.Resolve().CurTime; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ItemCooldownComponent? cooldown)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ItemCooldownComponent? cooldown)) { cooldown.CooldownStart = _lastUseTime; cooldown.CooldownEnd = _lastUseTime + TimeSpan.FromSeconds(Delay); @@ -59,7 +59,7 @@ namespace Content.Shared.Timing cancellationTokenSource?.Cancel(); ActiveDelay = false; - if (IoCManager.Resolve().TryGetComponent(Owner.Uid, out ItemCooldownComponent? cooldown)) + if (IoCManager.Resolve().TryGetComponent(Owner, out ItemCooldownComponent? cooldown)) { cooldown.CooldownEnd = IoCManager.Resolve().CurTime; } diff --git a/Content.Shared/Transform/TransformExtensions.cs b/Content.Shared/Transform/TransformExtensions.cs index 349d5afc30..c599cb25a6 100644 --- a/Content.Shared/Transform/TransformExtensions.cs +++ b/Content.Shared/Transform/TransformExtensions.cs @@ -20,7 +20,7 @@ namespace Content.Shared.Transform public static void AttachToGrandparent(this IEntity entity) { - AttachToGrandparent(IoCManager.Resolve().GetComponent(entity.Uid)); + AttachToGrandparent(IoCManager.Resolve().GetComponent(entity)); } } } diff --git a/Content.Shared/Verbs/SharedVerbSystem.cs b/Content.Shared/Verbs/SharedVerbSystem.cs index 79235677f4..2d1037d74e 100644 --- a/Content.Shared/Verbs/SharedVerbSystem.cs +++ b/Content.Shared/Verbs/SharedVerbSystem.cs @@ -34,22 +34,22 @@ namespace Content.Shared.Verbs canAccess = true; else // the item might be in a backpack that the user has open - canAccess = _interactionSystem.CanAccessViaStorage(user.Uid, target.Uid); + canAccess = _interactionSystem.CanAccessViaStorage(user, target); } // A large number of verbs need to check action blockers. Instead of repeatedly having each system individually // call ActionBlocker checks, just cache it for the verb request. - var canInteract = force || _actionBlockerSystem.CanInteract(user.Uid); + var canInteract = force || _actionBlockerSystem.CanInteract(user); IEntity? @using = null; - if (IoCManager.Resolve().TryGetComponent(user.Uid, out SharedHandsComponent? hands) && (force || _actionBlockerSystem.CanUse(user.Uid))) + if (IoCManager.Resolve().TryGetComponent(user, out SharedHandsComponent? hands) && (force || _actionBlockerSystem.CanUse(user))) { hands.TryGetActiveHeldEntity(out @using); // Check whether the "Held" entity is a virtual pull entity. If yes, set that as the entity being "Used". // This allows you to do things like buckle a dragged person onto a surgery table, without click-dragging // their sprite. - if (@using != null && IoCManager.Resolve().TryGetComponent(@using.Uid, out var pull)) + if (@using != null && IoCManager.Resolve().TryGetComponent(@using, out var pull)) { @using = IoCManager.Resolve().GetEntity(pull.BlockingEntity); } @@ -58,28 +58,28 @@ namespace Content.Shared.Verbs if ((verbTypes & VerbType.Interaction) == VerbType.Interaction) { GetInteractionVerbsEvent getVerbEvent = new(user, target, @using, hands, canInteract, canAccess); - RaiseLocalEvent(target.Uid, getVerbEvent); + RaiseLocalEvent(target, getVerbEvent); verbs.Add(VerbType.Interaction, getVerbEvent.Verbs); } if ((verbTypes & VerbType.Activation) == VerbType.Activation) { GetActivationVerbsEvent getVerbEvent = new(user, target, @using, hands, canInteract, canAccess); - RaiseLocalEvent(target.Uid, getVerbEvent); + RaiseLocalEvent(target, getVerbEvent); verbs.Add(VerbType.Activation, getVerbEvent.Verbs); } if ((verbTypes & VerbType.Alternative) == VerbType.Alternative) { GetAlternativeVerbsEvent getVerbEvent = new(user, target, @using, hands, canInteract, canAccess); - RaiseLocalEvent(target.Uid, getVerbEvent); + RaiseLocalEvent(target, getVerbEvent); verbs.Add(VerbType.Alternative, getVerbEvent.Verbs); } if ((verbTypes & VerbType.Other) == VerbType.Other) { GetOtherVerbsEvent getVerbEvent = new(user, target, @using, hands, canInteract, canAccess); - RaiseLocalEvent(target.Uid, getVerbEvent); + RaiseLocalEvent(target, getVerbEvent); verbs.Add(VerbType.Other, getVerbEvent.Verbs); } @@ -117,7 +117,7 @@ namespace Content.Shared.Verbs if (EntityManager.TryGetComponent(userUid, out SharedHandsComponent? hands)) { hands.TryGetActiveHeldEntity(out var useEntityd); - usedUid = useEntityd?.Uid; + usedUid = useEntityd; if (usedUid != null && EntityManager.TryGetComponent(usedUid.Value, out HandVirtualItemComponent? pull)) usedUid = pull.BlockingEntity; } diff --git a/Content.Shared/Verbs/VerbEvents.cs b/Content.Shared/Verbs/VerbEvents.cs index 49c89ce283..8861f58b32 100644 --- a/Content.Shared/Verbs/VerbEvents.cs +++ b/Content.Shared/Verbs/VerbEvents.cs @@ -184,9 +184,9 @@ namespace Content.Shared.Verbs public readonly IEntity? Using; // for eventual removal of IEntity. - public EntityUid UserUid => User.Uid; - public EntityUid TargetUid => Target.Uid; - public EntityUid? UsingUid => Using?.Uid; + public EntityUid UserUid => User; + public EntityUid TargetUid => Target; + public EntityUid? UsingUid => Using; public GetVerbsEvent(IEntity user, IEntity target, IEntity? @using, SharedHandsComponent? hands, bool canInteract, bool canAccess) {