From 15fb554c287bfbca3f5f5fae8548d71a2b47a6e8 Mon Sep 17 00:00:00 2001 From: Acruid Date: Sat, 19 Jun 2021 19:41:26 -0700 Subject: [PATCH] Engine Entity Anchoring Changes (#4195) * Converted all SnapGridPositionChangedEvent subscriptions to AnchorStateChangedEvent. * Fixes power tests with new anchored requirements. * Moved AnchorableComponent into construction. AnchorableComponent now uses Transform.Anchored. * Fixed bug with nodes, power works again. * Adds lifetime stages to Component. * Update Engine to v0.4.70. --- .../Animations/AnimationsTestComponent.cs | 2 +- .../Components/CharacterInfoComponent.cs | 2 +- .../CharacterInterfaceComponent.cs | 4 +- Content.Client/Clothing/ClothingComponent.cs | 2 +- .../Cuffs/Components/CuffableComponent.cs | 2 +- Content.Client/DoAfter/DoAfterComponent.cs | 4 +- Content.Client/Hands/HandsComponent.cs | 5 ++- .../IconSmoothing/IconSmoothComponent.cs | 4 +- .../IconSmoothing/IconSmoothSystem.cs | 7 ++-- .../Instruments/InstrumentComponent.cs | 2 +- .../Inventory/ClientInventoryComponent.cs | 4 +- .../Components/ContainmentFieldComponent.cs | 2 +- Content.Client/Sound/LoopingSoundComponent.cs | 2 +- .../Spawners/ClientEntitySpawnerComponent.cs | 4 +- .../Storage/ClientStorageComponent.cs | 6 +-- .../Suspicion/SuspicionRoleComponent.cs | 2 +- .../MeleeWeaponArcAnimationComponent.cs | 2 +- Content.Client/Window/WindowComponent.cs | 4 +- Content.Client/Window/WindowSystem.cs | 6 +-- Content.IntegrationTests/Tests/PowerTest.cs | 40 +++++++++++++------ .../AI/Components/AiControllerComponent.cs | 2 +- .../AI/Utility/AiLogic/UtilityAI.cs | 4 +- .../AME/Components/AMEControllerComponent.cs | 2 +- .../Components/AMEFuelContainerComponent.cs | 2 +- .../AME/Components/AMEShieldComponent.cs | 2 +- Content.Server/APC/Components/ApcComponent.cs | 2 +- .../Components/AccessReaderComponent.cs | 2 +- .../Access/Components/IdCardComponent.cs | 2 +- .../Components/IdCardConsoleComponent.cs | 2 +- .../Advertise/AdvertiseComponent.cs | 4 +- Content.Server/Alert/ServerAlertsComponent.cs | 2 +- .../Components/BlockGameArcadeComponent.cs | 2 +- .../Components/SpaceVillainArcadeComponent.cs | 2 +- .../Atmos/Components/AirtightComponent.cs | 15 ++++--- .../BaseComputerUserInterfaceComponent.cs | 2 +- .../Atmos/Components/GasAnalyzerComponent.cs | 2 +- .../Atmos/Components/GasTankComponent.cs | 2 +- .../Components/GridAtmosphereComponent.cs | 4 +- .../Atmos/EntitySystems/AirtightSystem.cs | 6 +-- .../AtmosUnsafeUnanchorSystem.cs | 2 +- .../Unary/EntitySystems/GasPortableSystem.cs | 2 +- Content.Server/BarSign/BarSignComponent.cs | 2 +- .../Battery/Components/BatteryComponent.cs | 2 +- Content.Server/Body/BodyComponent.cs | 2 +- .../Body/Circulatory/BloodstreamComponent.cs | 2 +- .../Body/Mechanism/MechanismComponent.cs | 2 +- Content.Server/Body/Part/BodyPartComponent.cs | 2 +- .../Body/Scanner/BodyScannerComponent.cs | 2 +- .../Components/SurgeryToolComponent.cs | 2 +- .../Botany/Components/PlantHolderComponent.cs | 2 +- .../Buckle/Components/BuckleComponent.cs | 2 +- .../Buckle/Components/StrapComponent.cs | 2 +- .../Cargo/Components/CargoConsoleComponent.cs | 4 +- .../Components/CargoOrderDatabaseComponent.cs | 2 +- .../Components/MagicMirrorComponent.cs | 4 +- .../Components/ChemMasterComponent.cs | 2 +- .../ChemicalInjectionProjectileComponent.cs | 2 +- .../Components/HyposprayComponent.cs | 2 +- .../Chemistry/Components/PillComponent.cs | 2 +- .../Components/ReagentDispenserComponent.cs | 2 +- .../Components/SolutionAreaEffectComponent.cs | 2 +- .../TransformableContainerComponent.cs | 2 +- .../Chemistry/Components/VaporComponent.cs | 2 +- .../Climbing/Components/ClimbableComponent.cs | 2 +- .../Cloning/Components/CloningPodComponent.cs | 4 +- .../CommunicationsConsoleComponent.cs | 4 +- Content.Server/Computer/ComputerComponent.cs | 2 +- .../Configurable/ConfigurationComponent.cs | 4 +- .../Components}/AnchorableComponent.cs | 19 ++------- .../Components/ConstructionComponent.cs | 2 +- .../Components/MachineComponent.cs | 2 +- .../Components/MachineFrameComponent.cs | 2 +- Content.Server/Crayon/CrayonComponent.cs | 2 +- .../Cuffs/Components/CuffableComponent.cs | 2 +- .../Destructible/DestructibleComponent.cs | 2 +- .../Mailing/DisposalMailingUnitComponent.cs | 6 +-- .../Components/DisposalRouterComponent.cs | 4 +- .../Components/DisposalTaggerComponent.cs | 4 +- .../Tube/Components/DisposalTubeComponent.cs | 6 +-- .../Components/DisposalHolderComponent.cs | 4 +- .../Unit/Components/DisposalUnitComponent.cs | 6 +-- .../Doors/Components/AirlockComponent.cs | 2 +- .../Doors/Components/ServerDoorComponent.cs | 2 +- .../Components/ClusterFlashComponent.cs | 3 +- .../ExplosiveProjectileComponent.cs | 2 +- .../Components/FlashProjectileComponent.cs | 2 +- .../Fluids/Components/BucketComponent.cs | 2 +- .../Fluids/Components/MopComponent.cs | 2 +- .../Fluids/Components/PuddleComponent.cs | 2 +- .../Fluids/Components/SprayComponent.cs | 2 +- .../Roles/Components/GhostRoleComponent.cs | 2 +- .../Gravity/GravityGeneratorComponent.cs | 2 +- Content.Server/Headset/HeadsetComponent.cs | 2 +- .../Instruments/InstrumentComponent.cs | 2 +- .../HumanInventoryControllerComponent.cs | 2 +- .../Components/InventoryComponent.cs | 4 +- .../Kitchen/Components/MicrowaveComponent.cs | 2 +- .../Components/ReagentGrinderComponent.cs | 4 +- .../Lathe/Components/LatheComponent.cs | 2 +- .../Components/ExpendableLightComponent.cs | 2 +- .../Components/HandheldLightComponent.cs | 4 +- .../Light/Components/LightBulbComponent.cs | 2 +- .../Components/LightReplacerComponent.cs | 2 +- .../Light/Components/PoweredLightComponent.cs | 2 +- .../Components/SignalLinkerComponent.cs | 2 +- .../Components/SignalSwitchComponent.cs | 2 +- .../Components/SignalTransmitterComponent.cs | 2 +- .../Components/MedicalScannerComponent.cs | 2 +- .../Mind/Components/VisitingMindComponent.cs | 2 +- .../Components/AsteroidRockComponent.cs | 2 +- .../BodyBagEntityStorageComponent.cs | 2 +- .../MorgueEntityStorageComponent.cs | 3 +- .../EntitySystems/NodeContainerSystem.cs | 4 +- .../EntitySystems/NodeGroupSystem.cs | 17 +------- .../NodeContainer/NodeContainerComponent.cs | 3 +- Content.Server/NodeContainer/Nodes/Node.cs | 4 +- .../NodeContainer/Nodes/PipeNode.cs | 5 --- .../Nutrition/Components/DrinkComponent.cs | 2 +- .../Nutrition/Components/FoodComponent.cs | 2 +- .../Components/FoodContainerComponent.cs | 2 +- .../Components/SliceableFoodComponent.cs | 2 +- Content.Server/PDA/PDAComponent.cs | 2 +- Content.Server/Paper/PaperComponent.cs | 2 +- .../ParticleAcceleratorControlBoxComponent.cs | 4 +- .../ParticleAcceleratorPartComponent.cs | 4 +- .../ParticleAcceleratorPowerBoxComponent.cs | 2 +- .../Components/PottedPlantHideComponent.cs | 2 +- .../Portal/Components/PortalComponent.cs | 2 +- .../Portal/Components/TeleporterComponent.cs | 2 +- .../Power/Components/BaseCharger.cs | 4 +- .../Components/BaseNetConnectorComponent.cs | 6 +-- .../Components/BatteryDischargerComponent.cs | 2 +- .../Components/BatteryStorageComponent.cs | 2 +- .../Components/PowerProviderComponent.cs | 2 +- .../Components/PowerReceiverComponent.cs | 2 +- .../Components/PowerCellComponent.cs | 2 +- .../Components/PowerCellSlotComponent.cs | 2 +- Content.Server/RCD/Components/RCDComponent.cs | 2 +- .../Components/HandheldRadioComponent.cs | 2 +- .../Components/ResearchClientComponent.cs | 2 +- .../Components/ResearchConsoleComponent.cs | 2 +- .../ResearchPointSourceComponent.cs | 2 +- .../Components/ResearchServerComponent.cs | 2 +- Content.Server/SMES/SmesComponent.cs | 2 +- .../Shuttle/ShuttleControllerComponent.cs | 2 +- .../ContainmentFieldGeneratorComponent.cs | 2 +- .../Components/EmitterComponent.cs | 2 +- .../Components/ServerSingularityComponent.cs | 4 +- .../SolarControlConsoleComponent.cs | 2 +- .../Solar/Components/SolarPanelComponent.cs | 2 +- .../Components/TimedSpawnerComponent.cs | 2 +- .../Components/RandomSpriteStateComponent.cs | 2 +- .../Components/EntityStorageComponent.cs | 2 +- .../Components/SecretStashComponent.cs | 2 +- .../Components/ServerStorageComponent.cs | 2 +- Content.Server/Strip/StrippableComponent.cs | 2 +- .../StunnableProjectileComponent.cs | 2 +- .../Tiles/FloorTileItemComponent.cs | 2 +- Content.Server/Toilet/ToiletComponent.cs | 2 +- .../Tools/Components/MultitoolComponent.cs | 2 +- .../Tools/Components/WelderComponent.cs | 2 +- .../VendingMachineComponent.cs | 2 +- .../Ammunition/Components/AmmoBoxComponent.cs | 2 +- .../Components/RangedMagazineComponent.cs | 2 +- .../Components/SpeedLoaderComponent.cs | 2 +- .../Components/BoltActionBarrelComponent.cs | 2 +- .../Barrels/Components/PumpBarrelComponent.cs | 2 +- .../Components/RevolverBarrelComponent.cs | 2 +- .../ServerBatteryBarrelComponent.cs | 3 +- .../ServerMagazineBarrelComponent.cs | 3 +- .../Components/ServerRangedBarrelComponent.cs | 4 +- .../Wires/Components/WiresComponent.cs | 2 +- .../Components/SharedActionsComponent.cs | 3 +- .../Body/Components/SharedBodyComponent.cs | 4 +- .../Mechanism/SharedMechanismComponent.cs | 2 +- .../SharedSolutionContainerComponent.cs | 2 +- .../Damage/Components/DamageableComponent.cs | 2 +- .../Inventory/SharedInventoryComponent.cs | 2 +- .../MobState/State/SharedMobStateComponent.cs | 2 +- .../SharedPlayerInputMoverComponent.cs | 2 +- .../SharedPlayerMobMoverComponent.cs | 2 +- .../Components/SharedPortalComponent.cs | 2 +- .../Components/SharedPullableComponent.cs | 2 +- .../Components/SharedPullerComponent.cs | 2 +- Content.Shared/SubFloor/SubFloorHideSystem.cs | 10 +++-- Content.Shared/Tag/TagComponent.cs | 2 +- RobustToolbox | 2 +- 187 files changed, 279 insertions(+), 287 deletions(-) rename Content.Server/{Anchor => Construction/Components}/AnchorableComponent.cs (93%) diff --git a/Content.Client/Animations/AnimationsTestComponent.cs b/Content.Client/Animations/AnimationsTestComponent.cs index bc58ae26d1..801b193748 100644 --- a/Content.Client/Animations/AnimationsTestComponent.cs +++ b/Content.Client/Animations/AnimationsTestComponent.cs @@ -12,7 +12,7 @@ namespace Content.Client.Animations { public override string Name => "AnimationsTest"; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Client/CharacterInfo/Components/CharacterInfoComponent.cs b/Content.Client/CharacterInfo/Components/CharacterInfoComponent.cs index 89bb8d1b96..df5c3ffcec 100644 --- a/Content.Client/CharacterInfo/Components/CharacterInfoComponent.cs +++ b/Content.Client/CharacterInfo/Components/CharacterInfoComponent.cs @@ -26,7 +26,7 @@ namespace Content.Client.CharacterInfo.Components public Control Scene { get; private set; } = default!; public UIPriority Priority => UIPriority.Info; - public override void OnAdd() + protected override void OnAdd() { base.OnAdd(); diff --git a/Content.Client/CharacterInterface/CharacterInterfaceComponent.cs b/Content.Client/CharacterInterface/CharacterInterfaceComponent.cs index d9ca6df367..95f769e126 100644 --- a/Content.Client/CharacterInterface/CharacterInterfaceComponent.cs +++ b/Content.Client/CharacterInterface/CharacterInterfaceComponent.cs @@ -36,7 +36,7 @@ namespace Content.Client.CharacterInterface /// /// Create the window with all character UIs and bind it to a keypress /// - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -54,7 +54,7 @@ namespace Content.Client.CharacterInterface /// /// Dispose of window and the keypress binding /// - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); diff --git a/Content.Client/Clothing/ClothingComponent.cs b/Content.Client/Clothing/ClothingComponent.cs index e9c53322c9..bceed9f7fe 100644 --- a/Content.Client/Clothing/ClothingComponent.cs +++ b/Content.Client/Clothing/ClothingComponent.cs @@ -52,7 +52,7 @@ namespace Content.Client.Clothing } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); ClothingEquippedPrefix = ClothingEquippedPrefix; diff --git a/Content.Client/Cuffs/Components/CuffableComponent.cs b/Content.Client/Cuffs/Components/CuffableComponent.cs index 2583946354..9aca508033 100644 --- a/Content.Client/Cuffs/Components/CuffableComponent.cs +++ b/Content.Client/Cuffs/Components/CuffableComponent.cs @@ -50,7 +50,7 @@ namespace Content.Client.Cuffs.Components } } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); diff --git a/Content.Client/DoAfter/DoAfterComponent.cs b/Content.Client/DoAfter/DoAfterComponent.cs index 1f17eed1ce..737de68901 100644 --- a/Content.Client/DoAfter/DoAfterComponent.cs +++ b/Content.Client/DoAfter/DoAfterComponent.cs @@ -33,13 +33,13 @@ namespace Content.Client.DoAfter } } - public override void OnAdd() + protected override void OnAdd() { base.OnAdd(); Enable(); } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); Disable(); diff --git a/Content.Client/Hands/HandsComponent.cs b/Content.Client/Hands/HandsComponent.cs index 8ce017b270..1e1f7315ad 100644 --- a/Content.Client/Hands/HandsComponent.cs +++ b/Content.Client/Hands/HandsComponent.cs @@ -72,14 +72,14 @@ namespace Content.Client.Hands return GetHand(handName)?.Entity; } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); _gui?.Dispose(); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -201,6 +201,7 @@ namespace Content.Client.Hands protected override void Startup() { + base.Startup(); ActiveIndex = _hands.LastOrDefault()?.Name; } diff --git a/Content.Client/IconSmoothing/IconSmoothComponent.cs b/Content.Client/IconSmoothing/IconSmoothComponent.cs index da9db8ca08..bf2ca481ba 100644 --- a/Content.Client/IconSmoothing/IconSmoothComponent.cs +++ b/Content.Client/IconSmoothing/IconSmoothComponent.cs @@ -59,7 +59,7 @@ namespace Content.Client.IconSmoothing /// internal int UpdateGeneration { get; set; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -263,7 +263,7 @@ namespace Content.Client.IconSmoothing } } - public void SnapGridOnPositionChanged() + public void AnchorStateChanged() { if (Owner.Transform.Anchored) { diff --git a/Content.Client/IconSmoothing/IconSmoothSystem.cs b/Content.Client/IconSmoothing/IconSmoothSystem.cs index 2ba9f59c71..4fc0ca3794 100644 --- a/Content.Client/IconSmoothing/IconSmoothSystem.cs +++ b/Content.Client/IconSmoothing/IconSmoothSystem.cs @@ -25,8 +25,7 @@ namespace Content.Client.IconSmoothing base.Initialize(); SubscribeLocalEvent(HandleDirtyEvent); - - SubscribeLocalEvent(HandleSnapGridMove); + SubscribeLocalEvent(HandleAnchorChanged); } public override void FrameUpdate(float frameTime) @@ -92,9 +91,9 @@ namespace Content.Client.IconSmoothing } } - private static void HandleSnapGridMove(EntityUid uid, IconSmoothComponent component, SnapGridPositionChangedEvent args) + private static void HandleAnchorChanged(EntityUid uid, IconSmoothComponent component, AnchorStateChangedEvent args) { - component.SnapGridOnPositionChanged(); + component.AnchorStateChanged(); } private void AddValidEntities(IEnumerable candidates) diff --git a/Content.Client/Instruments/InstrumentComponent.cs b/Content.Client/Instruments/InstrumentComponent.cs index edbc456736..d864f5e8ea 100644 --- a/Content.Client/Instruments/InstrumentComponent.cs +++ b/Content.Client/Instruments/InstrumentComponent.cs @@ -196,7 +196,7 @@ namespace Content.Client.Instruments } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); IoCManager.InjectDependencies(this); diff --git a/Content.Client/Inventory/ClientInventoryComponent.cs b/Content.Client/Inventory/ClientInventoryComponent.cs index 9b1059e53c..2e53ad3ac9 100644 --- a/Content.Client/Inventory/ClientInventoryComponent.cs +++ b/Content.Client/Inventory/ClientInventoryComponent.cs @@ -37,7 +37,7 @@ namespace Content.Client.Inventory [ViewVariables] [DataField("speciesId")] public string? SpeciesId { get; set; } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); @@ -48,7 +48,7 @@ namespace Content.Client.Inventory InterfaceController?.Dispose(); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Client/Singularity/Components/ContainmentFieldComponent.cs b/Content.Client/Singularity/Components/ContainmentFieldComponent.cs index b7cf081019..a99d5928fd 100644 --- a/Content.Client/Singularity/Components/ContainmentFieldComponent.cs +++ b/Content.Client/Singularity/Components/ContainmentFieldComponent.cs @@ -10,7 +10,7 @@ namespace Content.Client.Singularity.Components private SpriteComponent? _spriteComponent; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Client/Sound/LoopingSoundComponent.cs b/Content.Client/Sound/LoopingSoundComponent.cs index 8e4dfc54b8..cd2d2e2812 100644 --- a/Content.Client/Sound/LoopingSoundComponent.cs +++ b/Content.Client/Sound/LoopingSoundComponent.cs @@ -96,7 +96,7 @@ namespace Content.Client.Sound } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); SoundSystem.OcclusionCollisionMask = (int) CollisionGroup.Impassable; diff --git a/Content.Client/Spawners/ClientEntitySpawnerComponent.cs b/Content.Client/Spawners/ClientEntitySpawnerComponent.cs index 3a6a7e5468..3a35e0a14c 100644 --- a/Content.Client/Spawners/ClientEntitySpawnerComponent.cs +++ b/Content.Client/Spawners/ClientEntitySpawnerComponent.cs @@ -17,13 +17,13 @@ namespace Content.Client.Spawners private readonly List _entity = new(); - public override void Initialize() + protected override void Initialize() { base.Initialize(); SpawnEntities(); } - public override void OnRemove() + protected override void OnRemove() { RemoveEntities(); base.OnRemove(); diff --git a/Content.Client/Storage/ClientStorageComponent.cs b/Content.Client/Storage/ClientStorageComponent.cs index 0ab2341665..0d552e681b 100644 --- a/Content.Client/Storage/ClientStorageComponent.cs +++ b/Content.Client/Storage/ClientStorageComponent.cs @@ -33,7 +33,7 @@ namespace Content.Client.Storage public override IReadOnlyList StoredEntities => _storedEntities; - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -41,14 +41,14 @@ namespace Content.Client.Storage ChangeStorageVisualization(SharedBagState.Close); } - public override void OnAdd() + protected override void OnAdd() { base.OnAdd(); _window = new StorageWindow(this) {Title = Owner.Name}; } - public override void OnRemove() + protected override void OnRemove() { _window?.Dispose(); base.OnRemove(); diff --git a/Content.Client/Suspicion/SuspicionRoleComponent.cs b/Content.Client/Suspicion/SuspicionRoleComponent.cs index cf4baf3c5b..cebcef3922 100644 --- a/Content.Client/Suspicion/SuspicionRoleComponent.cs +++ b/Content.Client/Suspicion/SuspicionRoleComponent.cs @@ -128,7 +128,7 @@ namespace Content.Client.Suspicion } } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); diff --git a/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs b/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs index 0abfbe405d..9f5863458f 100644 --- a/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs +++ b/Content.Client/Weapons/Melee/Components/MeleeWeaponArcAnimationComponent.cs @@ -17,7 +17,7 @@ namespace Content.Client.Weapons.Melee.Components private SpriteComponent? _sprite; private Angle _baseAngle; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Client/Window/WindowComponent.cs b/Content.Client/Window/WindowComponent.cs index 60a6ba7ac6..b88b6ebe13 100644 --- a/Content.Client/Window/WindowComponent.cs +++ b/Content.Client/Window/WindowComponent.cs @@ -21,7 +21,7 @@ namespace Content.Client.Window private ISpriteComponent? _sprite; - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -64,7 +64,7 @@ namespace Content.Client.Window } } - public void SnapGridOnPositionChanged() + public void AnchorStateChanged() { Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new WindowSmoothDirtyEvent(Owner)); } diff --git a/Content.Client/Window/WindowSystem.cs b/Content.Client/Window/WindowSystem.cs index 51fef139b5..da6c23edff 100644 --- a/Content.Client/Window/WindowSystem.cs +++ b/Content.Client/Window/WindowSystem.cs @@ -14,7 +14,7 @@ namespace Content.Client.Window base.Initialize(); SubscribeLocalEvent(HandleDirtyEvent); - SubscribeLocalEvent(HandleSnapGridMove); + SubscribeLocalEvent(HandleAnchorChanged); } private void HandleDirtyEvent(WindowSmoothDirtyEvent ev) @@ -25,9 +25,9 @@ namespace Content.Client.Window } } - private static void HandleSnapGridMove(EntityUid uid, WindowComponent component, SnapGridPositionChangedEvent args) + private static void HandleAnchorChanged(EntityUid uid, WindowComponent component, AnchorStateChangedEvent args) { - component.SnapGridOnPositionChanged(); + component.AnchorStateChanged(); } public override void FrameUpdate(float frameTime) diff --git a/Content.IntegrationTests/Tests/PowerTest.cs b/Content.IntegrationTests/Tests/PowerTest.cs index e50c5558e5..191288b16a 100644 --- a/Content.IntegrationTests/Tests/PowerTest.cs +++ b/Content.IntegrationTests/Tests/PowerTest.cs @@ -9,6 +9,7 @@ using NUnit.Framework; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; +using Robust.Shared.Maths; using Robust.Shared.Physics; namespace Content.IntegrationTests.Tests @@ -29,15 +30,15 @@ namespace Content.IntegrationTests.Tests - type: PowerSupplier supplyRate: 3000 - type: Anchorable - - type: SnapGrid - offset: Center + - type: Transform + anchored: true - type: entity name: ConsumerDummy id: ConsumerDummy components: - - type: SnapGrid - offset: Center + - type: Transform + anchored: true - type: NodeContainer nodes: input: @@ -68,8 +69,8 @@ namespace Content.IntegrationTests.Tests voltage: Medium - type: BatteryDischarger activeSupplyRate: 1000 - - type: SnapGrid - offset: Center + - type: Transform + anchored: true - type: entity name: ApcDummy @@ -94,8 +95,8 @@ namespace Content.IntegrationTests.Tests output: !type:AdjacentNode nodeGroupID: Apc - - type: SnapGrid - offset: Center + - type: Transform + anchored: true - type: UserInterface interfaces: - key: enum.ApcUiKey.Key @@ -119,16 +120,16 @@ namespace Content.IntegrationTests.Tests voltage: Apc - type: Wire wireType: Apc - - type: SnapGrid - offset: Center + - type: Transform + anchored: true - type: entity name: PowerReceiverDummy id: PowerReceiverDummy components: - type: PowerReceiver - - type: SnapGrid - offset: Center + - type: Transform + anchored: true "; [Test] public async Task PowerNetTest() @@ -147,6 +148,11 @@ namespace Content.IntegrationTests.Tests mapMan.CreateMap(new MapId(1)); var grid = mapMan.CreateGrid(new MapId(1)); + // Power only works when anchored + grid.SetTile(new Vector2i(0, 0), new Tile(1)); + grid.SetTile(new Vector2i(0, 1), new Tile(1)); + grid.SetTile(new Vector2i(0, 2), new Tile(1)); + var generatorEnt = entityMan.SpawnEntity("GeneratorDummy", grid.ToCoordinates()); var consumerEnt1 = entityMan.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 1)); var consumerEnt2 = entityMan.SpawnEntity("ConsumerDummy", grid.ToCoordinates(0, 2)); @@ -197,6 +203,11 @@ namespace Content.IntegrationTests.Tests mapMan.CreateMap(new MapId(1)); var grid = mapMan.CreateGrid(new MapId(1)); + // Power only works when anchored + grid.SetTile(new Vector2i(0, 0), new Tile(1)); + grid.SetTile(new Vector2i(0, 1), new Tile(1)); + grid.SetTile(new Vector2i(0, 2), new Tile(1)); + var generatorEnt = entityMan.SpawnEntity("GeneratorDummy", grid.ToCoordinates()); var substationEnt = entityMan.SpawnEntity("SubstationDummy", grid.ToCoordinates(0, 1)); var apcEnt = entityMan.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 2)); @@ -245,6 +256,11 @@ namespace Content.IntegrationTests.Tests mapMan.CreateMap(mapId); var grid = mapMan.CreateGrid(mapId); + // Power only works when anchored + grid.SetTile(new Vector2i(0, 0), new Tile(1)); + grid.SetTile(new Vector2i(0, 1), new Tile(1)); + grid.SetTile(new Vector2i(0, 2), new Tile(1)); + var apcEnt = entityMan.SpawnEntity("ApcDummy", grid.ToCoordinates(0, 0)); var apcExtensionEnt = entityMan.SpawnEntity("ApcExtensionCableDummy", grid.ToCoordinates(0, 1)); var powerReceiverEnt = entityMan.SpawnEntity("PowerReceiverDummy", grid.ToCoordinates(0, 2)); diff --git a/Content.Server/AI/Components/AiControllerComponent.cs b/Content.Server/AI/Components/AiControllerComponent.cs index 6c90cb7eef..0ce7720bf9 100644 --- a/Content.Server/AI/Components/AiControllerComponent.cs +++ b/Content.Server/AI/Components/AiControllerComponent.cs @@ -32,7 +32,7 @@ namespace Content.Server.AI.Components } /// - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/AI/Utility/AiLogic/UtilityAI.cs b/Content.Server/AI/Utility/AiLogic/UtilityAI.cs index 4cf8330962..b314ffe24e 100644 --- a/Content.Server/AI/Utility/AiLogic/UtilityAI.cs +++ b/Content.Server/AI/Utility/AiLogic/UtilityAI.cs @@ -79,7 +79,7 @@ namespace Content.Server.AI.Utility.AiLogic } }*/ - public override void Initialize() + protected override void Initialize() { if (BehaviorSets.Count > 0) { @@ -94,7 +94,7 @@ namespace Content.Server.AI.Utility.AiLogic _planner = EntitySystem.Get(); } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); var currentOp = CurrentAction?.ActionOperators.Peek(); diff --git a/Content.Server/AME/Components/AMEControllerComponent.cs b/Content.Server/AME/Components/AMEControllerComponent.cs index 000d47df69..963fb5041a 100644 --- a/Content.Server/AME/Components/AMEControllerComponent.cs +++ b/Content.Server/AME/Components/AMEControllerComponent.cs @@ -41,7 +41,7 @@ namespace Content.Server.AME.Components private ContainerSlot _jarSlot = default!; [ViewVariables] private bool HasJar => _jarSlot.ContainedEntity != null; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/AME/Components/AMEFuelContainerComponent.cs b/Content.Server/AME/Components/AMEFuelContainerComponent.cs index cc4e79d3d8..269a4077be 100644 --- a/Content.Server/AME/Components/AMEFuelContainerComponent.cs +++ b/Content.Server/AME/Components/AMEFuelContainerComponent.cs @@ -32,7 +32,7 @@ namespace Content.Server.AME.Components set => _maxFuelAmount = value; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); _maxFuelAmount = 1000; diff --git a/Content.Server/AME/Components/AMEShieldComponent.cs b/Content.Server/AME/Components/AMEShieldComponent.cs index 6eb28faa2c..b68646dcd1 100644 --- a/Content.Server/AME/Components/AMEShieldComponent.cs +++ b/Content.Server/AME/Components/AMEShieldComponent.cs @@ -19,7 +19,7 @@ namespace Content.Server.AME.Components private AppearanceComponent? _appearance; private PointLightComponent? _pointLight; - public override void Initialize() + protected override void Initialize() { base.Initialize(); Owner.TryGetComponent(out _appearance); diff --git a/Content.Server/APC/Components/ApcComponent.cs b/Content.Server/APC/Components/ApcComponent.cs index 1c6b72f4e6..4e7d4b4f33 100644 --- a/Content.Server/APC/Components/ApcComponent.cs +++ b/Content.Server/APC/Components/ApcComponent.cs @@ -53,7 +53,7 @@ namespace Content.Server.APC.Components [ComponentDependency] private AccessReader? _accessReader = null; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Access/Components/AccessReaderComponent.cs b/Content.Server/Access/Components/AccessReaderComponent.cs index 1cedd69eaf..64ab8cafe6 100644 --- a/Content.Server/Access/Components/AccessReaderComponent.cs +++ b/Content.Server/Access/Components/AccessReaderComponent.cs @@ -107,7 +107,7 @@ namespace Content.Server.Access.Components return Array.Empty(); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Access/Components/IdCardComponent.cs b/Content.Server/Access/Components/IdCardComponent.cs index b365559954..4a3391dc67 100644 --- a/Content.Server/Access/Components/IdCardComponent.cs +++ b/Content.Server/Access/Components/IdCardComponent.cs @@ -62,7 +62,7 @@ namespace Content.Server.Access.Components : Loc.GetString("{0}'s ID card{1}", FullName, jobSuffix); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); // ReSharper disable once ConstantNullCoalescingCondition diff --git a/Content.Server/Access/Components/IdCardConsoleComponent.cs b/Content.Server/Access/Components/IdCardConsoleComponent.cs index dad601ac8f..64c88d209c 100644 --- a/Content.Server/Access/Components/IdCardConsoleComponent.cs +++ b/Content.Server/Access/Components/IdCardConsoleComponent.cs @@ -39,7 +39,7 @@ namespace Content.Server.Access.Components private bool PrivilegedIDEmpty => _privilegedIdContainer.ContainedEntities.Count < 1; private bool TargetIDEmpty => _targetIdContainer.ContainedEntities.Count < 1; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Advertise/AdvertiseComponent.cs b/Content.Server/Advertise/AdvertiseComponent.cs index c23504caa4..53e4880d16 100644 --- a/Content.Server/Advertise/AdvertiseComponent.cs +++ b/Content.Server/Advertise/AdvertiseComponent.cs @@ -40,7 +40,7 @@ namespace Content.Server.Advertise private List _advertisements = new(); - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -80,7 +80,7 @@ namespace Content.Server.Advertise RefreshTimer(false); } - public override void OnRemove() + protected override void OnRemove() { _cancellationSource.Cancel(); _cancellationSource.Dispose(); diff --git a/Content.Server/Alert/ServerAlertsComponent.cs b/Content.Server/Alert/ServerAlertsComponent.cs index d90c8bb555..f35dfc1865 100644 --- a/Content.Server/Alert/ServerAlertsComponent.cs +++ b/Content.Server/Alert/ServerAlertsComponent.cs @@ -27,7 +27,7 @@ namespace Content.Server.Alert } } - public override void OnRemove() + protected override void OnRemove() { if (EntitySystem.TryGet(out var weightlessSystem)) { diff --git a/Content.Server/Arcade/Components/BlockGameArcadeComponent.cs b/Content.Server/Arcade/Components/BlockGameArcadeComponent.cs index 2530be6f1b..5dce5324bf 100644 --- a/Content.Server/Arcade/Components/BlockGameArcadeComponent.cs +++ b/Content.Server/Arcade/Components/BlockGameArcadeComponent.cs @@ -104,7 +104,7 @@ namespace Content.Server.Arcade.Components UserInterface?.SendMessage(new BlockGameMessages.BlockGameUserStatusMessage(_player == session), session); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); if (UserInterface != null) diff --git a/Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs b/Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs index e5fac0f427..c5daf82b90 100644 --- a/Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs +++ b/Content.Server/Arcade/Components/SpaceVillainArcadeComponent.cs @@ -76,7 +76,7 @@ namespace Content.Server.Arcade.Components } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Atmos/Components/AirtightComponent.cs b/Content.Server/Atmos/Components/AirtightComponent.cs index 81699eec10..aa4818c54c 100644 --- a/Content.Server/Atmos/Components/AirtightComponent.cs +++ b/Content.Server/Atmos/Components/AirtightComponent.cs @@ -73,7 +73,7 @@ namespace Content.Server.Atmos.Components [ViewVariables] public bool FixVacuum => _fixVacuum; - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -137,14 +137,17 @@ namespace Content.Server.Atmos.Components } } - public void OnSnapGridMove(SnapGridPositionChangedEvent ev) + public void AnchorStateChanged() { - // Invalidate old position. - InvalidatePosition(ev.OldGrid, ev.OldPosition); + var gridId = Owner.Transform.GridID; + var coords = Owner.Transform.Coordinates; + + var grid = _mapManager.GetGrid(gridId); + var tilePos = grid.TileIndicesFor(coords); // Update and invalidate new position. - _lastPosition = (ev.NewGrid, ev.Position); - InvalidatePosition(ev.NewGrid, ev.Position); + _lastPosition = (gridId, tilePos); + InvalidatePosition(gridId, tilePos); } private void UpdatePosition() diff --git a/Content.Server/Atmos/Components/BaseComputerUserInterfaceComponent.cs b/Content.Server/Atmos/Components/BaseComputerUserInterfaceComponent.cs index baa9a1a0e6..195b1c2623 100644 --- a/Content.Server/Atmos/Components/BaseComputerUserInterfaceComponent.cs +++ b/Content.Server/Atmos/Components/BaseComputerUserInterfaceComponent.cs @@ -27,7 +27,7 @@ namespace Content.Server.GameObjects.Components UserInterfaceKey = key; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Atmos/Components/GasAnalyzerComponent.cs b/Content.Server/Atmos/Components/GasAnalyzerComponent.cs index cde2b8e747..0d540d46e7 100644 --- a/Content.Server/Atmos/Components/GasAnalyzerComponent.cs +++ b/Content.Server/Atmos/Components/GasAnalyzerComponent.cs @@ -31,7 +31,7 @@ namespace Content.Server.Atmos.Components [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(GasAnalyzerUiKey.Key); - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Atmos/Components/GasTankComponent.cs b/Content.Server/Atmos/Components/GasTankComponent.cs index 8779aec7d5..ac3aebb40b 100644 --- a/Content.Server/Atmos/Components/GasTankComponent.cs +++ b/Content.Server/Atmos/Components/GasTankComponent.cs @@ -124,7 +124,7 @@ namespace Content.Server.Atmos.Components [DataField("tank")] public string TankName { get; set; } = "tank"; - public override void Initialize() + protected override void Initialize() { base.Initialize(); _userInterface = Owner.GetUIOrNull(SharedGasTankUiKey.Key); diff --git a/Content.Server/Atmos/Components/GridAtmosphereComponent.cs b/Content.Server/Atmos/Components/GridAtmosphereComponent.cs index 082ce26ed4..c03c52f252 100644 --- a/Content.Server/Atmos/Components/GridAtmosphereComponent.cs +++ b/Content.Server/Atmos/Components/GridAtmosphereComponent.cs @@ -203,7 +203,7 @@ namespace Content.Server.Atmos.Components _tiles = tiles; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -234,7 +234,7 @@ namespace Content.Server.Atmos.Components RepopulateTiles(); } - public override void OnAdd() + protected override void OnAdd() { base.OnAdd(); diff --git a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs index 6657bb9cc9..f933e893b1 100644 --- a/Content.Server/Atmos/EntitySystems/AirtightSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AirtightSystem.cs @@ -9,13 +9,13 @@ namespace Content.Server.Atmos.EntitySystems { public override void Initialize() { - SubscribeLocalEvent(OnAirtightPositionChanged); + SubscribeLocalEvent(OnAirtightPositionChanged); SubscribeLocalEvent(OnAirtightRotated); } - private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent component, SnapGridPositionChangedEvent args) + private void OnAirtightPositionChanged(EntityUid uid, AirtightComponent component, AnchorStateChangedEvent args) { - component.OnSnapGridMove(args); + component.AnchorStateChanged(); } private void OnAirtightRotated(EntityUid uid, AirtightComponent airtight, RotateEvent ev) diff --git a/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs b/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs index 28a59bf74e..a06fe44367 100644 --- a/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs +++ b/Content.Server/Atmos/Piping/EntitySystems/AtmosUnsafeUnanchorSystem.cs @@ -1,5 +1,5 @@ -using Content.Server.Anchor; using Content.Server.Atmos.Piping.Components; +using Content.Server.Construction.Components; using Content.Server.GameObjects.Components.NodeContainer.Nodes; using Content.Server.NodeContainer; using Content.Shared.Atmos; diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs index 937e3c8819..d675ad21c6 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; -using Content.Server.Anchor; using Content.Server.Atmos.Piping.Binary.Components; using Content.Server.Atmos.Piping.Unary.Components; +using Content.Server.Construction.Components; using Content.Server.GameObjects.Components.NodeContainer.Nodes; using Content.Server.NodeContainer; using Content.Shared.Atmos.Piping.Unary.Components; diff --git a/Content.Server/BarSign/BarSignComponent.cs b/Content.Server/BarSign/BarSignComponent.cs index e164c15bb0..6f2d9da4da 100644 --- a/Content.Server/BarSign/BarSignComponent.cs +++ b/Content.Server/BarSign/BarSignComponent.cs @@ -76,7 +76,7 @@ namespace Content.Server.BarSign Owner.Description = prototype.Description; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Battery/Components/BatteryComponent.cs b/Content.Server/Battery/Components/BatteryComponent.cs index 22ba63e605..bc0ea33f65 100644 --- a/Content.Server/Battery/Components/BatteryComponent.cs +++ b/Content.Server/Battery/Components/BatteryComponent.cs @@ -38,7 +38,7 @@ namespace Content.Server.Battery.Components [ViewVariables] public BatteryState BatteryState { get; private set; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); UpdateStorageState(); diff --git a/Content.Server/Body/BodyComponent.cs b/Content.Server/Body/BodyComponent.cs index abb72e835d..88e0b366d2 100644 --- a/Content.Server/Body/BodyComponent.cs +++ b/Content.Server/Body/BodyComponent.cs @@ -48,7 +48,7 @@ namespace Content.Server.Body part.Owner.RandomOffset(0.25f); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Body/Circulatory/BloodstreamComponent.cs b/Content.Server/Body/Circulatory/BloodstreamComponent.cs index 6dc37e89ef..77778a4af9 100644 --- a/Content.Server/Body/Circulatory/BloodstreamComponent.cs +++ b/Content.Server/Body/Circulatory/BloodstreamComponent.cs @@ -41,7 +41,7 @@ namespace Content.Server.Body.Circulatory [ViewVariables] public SolutionContainerComponent Solution => _internalSolution; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Body/Mechanism/MechanismComponent.cs b/Content.Server/Body/Mechanism/MechanismComponent.cs index fd1ae0e308..ef19e39ecb 100644 --- a/Content.Server/Body/Mechanism/MechanismComponent.cs +++ b/Content.Server/Body/Mechanism/MechanismComponent.cs @@ -24,7 +24,7 @@ namespace Content.Server.Body.Mechanism { [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(SurgeryUIKey.Key); - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Body/Part/BodyPartComponent.cs b/Content.Server/Body/Part/BodyPartComponent.cs index 5978238fbd..307a887907 100644 --- a/Content.Server/Body/Part/BodyPartComponent.cs +++ b/Content.Server/Body/Part/BodyPartComponent.cs @@ -56,7 +56,7 @@ namespace Content.Server.Body.Part mechanism.Owner.RandomOffset(0.25f); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Body/Scanner/BodyScannerComponent.cs b/Content.Server/Body/Scanner/BodyScannerComponent.cs index c932ea4e3a..b9a3b668e3 100644 --- a/Content.Server/Body/Scanner/BodyScannerComponent.cs +++ b/Content.Server/Body/Scanner/BodyScannerComponent.cs @@ -39,7 +39,7 @@ namespace Content.Server.Body.Scanner UserInterface?.Open(session); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs b/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs index 2839e13dc3..a362cf90e6 100644 --- a/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs +++ b/Content.Server/Body/Surgery/Components/SurgeryToolComponent.cs @@ -145,7 +145,7 @@ namespace Content.Server.Body.Surgery.Components } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Botany/Components/PlantHolderComponent.cs b/Content.Server/Botany/Components/PlantHolderComponent.cs index 610e8d16fb..7f83058fde 100644 --- a/Content.Server/Botany/Components/PlantHolderComponent.cs +++ b/Content.Server/Botany/Components/PlantHolderComponent.cs @@ -120,7 +120,7 @@ namespace Content.Server.Botany.Components [ComponentDependency] private readonly SolutionContainerComponent? _solutionContainer = default!; [ComponentDependency] private readonly AppearanceComponent? _appearanceComponent = default!; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Buckle/Components/BuckleComponent.cs b/Content.Server/Buckle/Components/BuckleComponent.cs index 9459bc2b85..6dadb2cc55 100644 --- a/Content.Server/Buckle/Components/BuckleComponent.cs +++ b/Content.Server/Buckle/Components/BuckleComponent.cs @@ -388,7 +388,7 @@ namespace Content.Server.Buckle.Components UpdateBuckleStatus(); } - public override void OnRemove() + protected override void OnRemove() { BuckledTo?.Remove(this); TryUnbuckle(Owner, true); diff --git a/Content.Server/Buckle/Components/StrapComponent.cs b/Content.Server/Buckle/Components/StrapComponent.cs index da4575a895..90ec5813ef 100644 --- a/Content.Server/Buckle/Components/StrapComponent.cs +++ b/Content.Server/Buckle/Components/StrapComponent.cs @@ -132,7 +132,7 @@ namespace Content.Server.Buckle.Components } } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); diff --git a/Content.Server/Cargo/Components/CargoConsoleComponent.cs b/Content.Server/Cargo/Components/CargoConsoleComponent.cs index 969da406d2..3adcf4f9bb 100644 --- a/Content.Server/Cargo/Components/CargoConsoleComponent.cs +++ b/Content.Server/Cargo/Components/CargoConsoleComponent.cs @@ -64,7 +64,7 @@ namespace Content.Server.Cargo.Components [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(CargoConsoleUiKey.Key); - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -80,7 +80,7 @@ namespace Content.Server.Cargo.Components BankAccount = _cargoConsoleSystem.StationAccount; } - public override void OnRemove() + protected override void OnRemove() { if (UserInterface != null) { diff --git a/Content.Server/Cargo/Components/CargoOrderDatabaseComponent.cs b/Content.Server/Cargo/Components/CargoOrderDatabaseComponent.cs index ab42071acb..4b9f825880 100644 --- a/Content.Server/Cargo/Components/CargoOrderDatabaseComponent.cs +++ b/Content.Server/Cargo/Components/CargoOrderDatabaseComponent.cs @@ -10,7 +10,7 @@ namespace Content.Server.Cargo.Components public CargoOrderDatabase? Database { get; set; } public bool ConnectedToDatabase => Database != null; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/CharacterAppearance/Components/MagicMirrorComponent.cs b/Content.Server/CharacterAppearance/Components/MagicMirrorComponent.cs index 8096438fa2..cf9e88f49d 100644 --- a/Content.Server/CharacterAppearance/Components/MagicMirrorComponent.cs +++ b/Content.Server/CharacterAppearance/Components/MagicMirrorComponent.cs @@ -22,7 +22,7 @@ namespace Content.Server.CharacterAppearance.Components [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(MagicMirrorUiKey.Key); - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -32,7 +32,7 @@ namespace Content.Server.CharacterAppearance.Components } } - public override void OnRemove() + protected override void OnRemove() { if (UserInterface != null) { diff --git a/Content.Server/Chemistry/Components/ChemMasterComponent.cs b/Content.Server/Chemistry/Components/ChemMasterComponent.cs index ce66ee0c08..c39e0b3ec6 100644 --- a/Content.Server/Chemistry/Components/ChemMasterComponent.cs +++ b/Content.Server/Chemistry/Components/ChemMasterComponent.cs @@ -50,7 +50,7 @@ namespace Content.Server.Chemistry.Components /// Called once per instance of this component. Gets references to any other components needed /// by this component and initializes it's UI and other data. /// - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Chemistry/Components/ChemicalInjectionProjectileComponent.cs b/Content.Server/Chemistry/Components/ChemicalInjectionProjectileComponent.cs index c268b920c8..89ccf14f7c 100644 --- a/Content.Server/Chemistry/Components/ChemicalInjectionProjectileComponent.cs +++ b/Content.Server/Chemistry/Components/ChemicalInjectionProjectileComponent.cs @@ -26,7 +26,7 @@ namespace Content.Server.Chemistry.Components [DataField("transferEfficiency")] private float _transferEfficiency = 1f; - public override void Initialize() + protected override void Initialize() { base.Initialize(); _solutionContainer = Owner.EnsureComponent(); diff --git a/Content.Server/Chemistry/Components/HyposprayComponent.cs b/Content.Server/Chemistry/Components/HyposprayComponent.cs index 3df9575efb..b352c539b6 100644 --- a/Content.Server/Chemistry/Components/HyposprayComponent.cs +++ b/Content.Server/Chemistry/Components/HyposprayComponent.cs @@ -29,7 +29,7 @@ namespace Content.Server.Chemistry.Components [ComponentDependency] private readonly SolutionContainerComponent? _solution = default!; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Chemistry/Components/PillComponent.cs b/Content.Server/Chemistry/Components/PillComponent.cs index 6b3f53361b..95c0cb3b85 100644 --- a/Content.Server/Chemistry/Components/PillComponent.cs +++ b/Content.Server/Chemistry/Components/PillComponent.cs @@ -36,7 +36,7 @@ namespace Content.Server.Chemistry.Components [ViewVariables] private SolutionContainerComponent _contents = default!; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Chemistry/Components/ReagentDispenserComponent.cs b/Content.Server/Chemistry/Components/ReagentDispenserComponent.cs index 790b7d8c72..5b318b001d 100644 --- a/Content.Server/Chemistry/Components/ReagentDispenserComponent.cs +++ b/Content.Server/Chemistry/Components/ReagentDispenserComponent.cs @@ -59,7 +59,7 @@ namespace Content.Server.Chemistry.Components /// Called once per instance of this component. Gets references to any other components needed /// by this component and initializes it's UI and other data. /// - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs b/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs index 93587b0dff..a68230ddd1 100644 --- a/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs +++ b/Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs @@ -171,7 +171,7 @@ namespace Content.Server.Chemistry.Components protected abstract void UpdateVisuals(); - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); Inception?.Remove(this); diff --git a/Content.Server/Chemistry/Components/TransformableContainerComponent.cs b/Content.Server/Chemistry/Components/TransformableContainerComponent.cs index c99766d0ef..fc55f861c5 100644 --- a/Content.Server/Chemistry/Components/TransformableContainerComponent.cs +++ b/Content.Server/Chemistry/Components/TransformableContainerComponent.cs @@ -24,7 +24,7 @@ namespace Content.Server.Chemistry.Components public bool Transformed { get; private set; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Chemistry/Components/VaporComponent.cs b/Content.Server/Chemistry/Components/VaporComponent.cs index a6866d1804..f9b9197066 100644 --- a/Content.Server/Chemistry/Components/VaporComponent.cs +++ b/Content.Server/Chemistry/Components/VaporComponent.cs @@ -34,7 +34,7 @@ namespace Content.Server.Chemistry.Components private bool _running; private float _aliveTime; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Climbing/Components/ClimbableComponent.cs b/Content.Server/Climbing/Components/ClimbableComponent.cs index d864612009..5b928cdf54 100644 --- a/Content.Server/Climbing/Components/ClimbableComponent.cs +++ b/Content.Server/Climbing/Components/ClimbableComponent.cs @@ -30,7 +30,7 @@ namespace Content.Server.Climbing.Components [DataField("delay")] private float _climbDelay = 0.8f; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Cloning/Components/CloningPodComponent.cs b/Content.Server/Cloning/Components/CloningPodComponent.cs index 6ea991f200..3b7f81e28c 100644 --- a/Content.Server/Cloning/Components/CloningPodComponent.cs +++ b/Content.Server/Cloning/Components/CloningPodComponent.cs @@ -43,7 +43,7 @@ namespace Content.Server.Cloning.Components [ViewVariables] public CloningPodStatus Status; - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -58,7 +58,7 @@ namespace Content.Server.Cloning.Components EntitySystem.Get().UpdateUserInterface(this); } - public override void OnRemove() + protected override void OnRemove() { if (UserInterface != null) { diff --git a/Content.Server/Communications/CommunicationsConsoleComponent.cs b/Content.Server/Communications/CommunicationsConsoleComponent.cs index 6810726ef6..4ed0b34b7b 100644 --- a/Content.Server/Communications/CommunicationsConsoleComponent.cs +++ b/Content.Server/Communications/CommunicationsConsoleComponent.cs @@ -35,7 +35,7 @@ namespace Content.Server.Communications public TimeSpan AnnounceCooldown { get; } = TimeSpan.FromSeconds(90); private CancellationTokenSource _announceCooldownEndedTokenSource = new(); - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -76,7 +76,7 @@ namespace Content.Server.Communications return _gameTiming.CurTime >= LastAnnounceTime + AnnounceCooldown; } - public override void OnRemove() + protected override void OnRemove() { RoundEndSystem.OnRoundEndCountdownStarted -= UpdateBoundInterface; RoundEndSystem.OnRoundEndCountdownCancelled -= UpdateBoundInterface; diff --git a/Content.Server/Computer/ComputerComponent.cs b/Content.Server/Computer/ComputerComponent.cs index 7da6aa8634..22527a5c7f 100644 --- a/Content.Server/Computer/ComputerComponent.cs +++ b/Content.Server/Computer/ComputerComponent.cs @@ -17,7 +17,7 @@ namespace Content.Server.Computer [DataField("board")] private string? _boardPrototype; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Configurable/ConfigurationComponent.cs b/Content.Server/Configurable/ConfigurationComponent.cs index 39ffa01aa6..bb7239450a 100644 --- a/Content.Server/Configurable/ConfigurationComponent.cs +++ b/Content.Server/Configurable/ConfigurationComponent.cs @@ -47,7 +47,7 @@ namespace Content.Server.Configurable } } - public override void OnAdd() + protected override void OnAdd() { base.OnAdd(); if (UserInterface != null) @@ -56,7 +56,7 @@ namespace Content.Server.Configurable } } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); if (UserInterface != null) diff --git a/Content.Server/Anchor/AnchorableComponent.cs b/Content.Server/Construction/Components/AnchorableComponent.cs similarity index 93% rename from Content.Server/Anchor/AnchorableComponent.cs rename to Content.Server/Construction/Components/AnchorableComponent.cs index 72a2677098..bb8f86074c 100644 --- a/Content.Server/Anchor/AnchorableComponent.cs +++ b/Content.Server/Construction/Components/AnchorableComponent.cs @@ -11,7 +11,7 @@ using Robust.Shared.Physics; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; -namespace Content.Server.Anchor +namespace Content.Server.Construction.Components { // TODO: Move this component's logic to an EntitySystem. [RegisterComponent] @@ -19,8 +19,6 @@ namespace Content.Server.Anchor { public override string Name => "Anchorable"; - [ComponentDependency] private PhysicsComponent? _physicsComponent = default!; - [ViewVariables] [DataField("tool")] public ToolQuality Tool { get; private set; } = ToolQuality.Anchoring; @@ -74,9 +72,6 @@ namespace Content.Server.Anchor return false; } - if (_physicsComponent == null) - return false; - // Snap rotation to cardinal (multiple of 90) var rot = Owner.Transform.LocalRotation; Owner.Transform.LocalRotation = Math.Round(rot / (Math.PI / 2)) * (Math.PI / 2); @@ -94,7 +89,7 @@ namespace Content.Server.Anchor Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new BeforeAnchoredEvent(user, utilizing), false); - _physicsComponent.BodyType = BodyType.Static; + Owner.Transform.Anchored = true; Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new AnchoredEvent(user, utilizing), false); @@ -115,12 +110,9 @@ namespace Content.Server.Anchor return false; } - if (_physicsComponent == null) - return false; - Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new BeforeUnanchoredEvent(user, utilizing), false); - _physicsComponent.BodyType = BodyType.Dynamic; + Owner.Transform.Anchored = false; Owner.EntityManager.EventBus.RaiseLocalEvent(Owner.Uid, new UnanchoredEvent(user, utilizing), false); @@ -135,10 +127,7 @@ namespace Content.Server.Anchor /// true if toggled, false otherwise public async Task TryToggleAnchor(IEntity user, IEntity utilizing) { - if (_physicsComponent == null) - return false; - - return _physicsComponent.BodyType == BodyType.Static ? + return Owner.Transform.Anchored ? await TryUnAnchor(user, utilizing) : await TryAnchor(user, utilizing); } diff --git a/Content.Server/Construction/Components/ConstructionComponent.cs b/Content.Server/Construction/Components/ConstructionComponent.cs index 0f61c0f76d..77ace559b5 100644 --- a/Content.Server/Construction/Components/ConstructionComponent.cs +++ b/Content.Server/Construction/Components/ConstructionComponent.cs @@ -464,7 +464,7 @@ namespace Content.Server.Construction.Components return _containers.Add(id); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Construction/Components/MachineComponent.cs b/Content.Server/Construction/Components/MachineComponent.cs index ee2b274dae..503aba03e8 100644 --- a/Content.Server/Construction/Components/MachineComponent.cs +++ b/Content.Server/Construction/Components/MachineComponent.cs @@ -18,7 +18,7 @@ namespace Content.Server.Construction.Components private Container _boardContainer = default!; private Container _partContainer = default!; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Construction/Components/MachineFrameComponent.cs b/Content.Server/Construction/Components/MachineFrameComponent.cs index 6fca7d836d..b430a2f5be 100644 --- a/Content.Server/Construction/Components/MachineFrameComponent.cs +++ b/Content.Server/Construction/Components/MachineFrameComponent.cs @@ -107,7 +107,7 @@ namespace Content.Server.Construction.Components public IReadOnlyDictionary TagRequirements => _tagRequirements; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Crayon/CrayonComponent.cs b/Content.Server/Crayon/CrayonComponent.cs index 2f458aba1d..123407ce30 100644 --- a/Content.Server/Crayon/CrayonComponent.cs +++ b/Content.Server/Crayon/CrayonComponent.cs @@ -50,7 +50,7 @@ namespace Content.Server.Crayon Color = Color.FromName(_color); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); if (UserInterface != null) diff --git a/Content.Server/Cuffs/Components/CuffableComponent.cs b/Content.Server/Cuffs/Components/CuffableComponent.cs index 787982da1a..9da1f5f041 100644 --- a/Content.Server/Cuffs/Components/CuffableComponent.cs +++ b/Content.Server/Cuffs/Components/CuffableComponent.cs @@ -50,7 +50,7 @@ namespace Content.Server.Cuffs.Components private bool _uncuffing; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Destructible/DestructibleComponent.cs b/Content.Server/Destructible/DestructibleComponent.cs index daf19dcaed..d0383cb804 100644 --- a/Content.Server/Destructible/DestructibleComponent.cs +++ b/Content.Server/Destructible/DestructibleComponent.cs @@ -25,7 +25,7 @@ namespace Content.Server.Destructible public IReadOnlyList Thresholds => _thresholds; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Disposal/Mailing/DisposalMailingUnitComponent.cs b/Content.Server/Disposal/Mailing/DisposalMailingUnitComponent.cs index 6f4992adb0..f541944425 100644 --- a/Content.Server/Disposal/Mailing/DisposalMailingUnitComponent.cs +++ b/Content.Server/Disposal/Mailing/DisposalMailingUnitComponent.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; -using Content.Server.Anchor; +using Content.Server.Construction.Components; using Content.Server.DeviceNetwork; using Content.Server.DeviceNetwork.Connections; using Content.Server.Disposal.Tube.Components; @@ -555,7 +555,7 @@ namespace Content.Server.Disposal.Mailing } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -584,7 +584,7 @@ namespace Content.Server.Disposal.Mailing UpdateInterface(); } - public override void OnRemove() + protected override void OnRemove() { if (_container != null) { diff --git a/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs index 5621cbdbe5..6c68d3d0e9 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalRouterComponent.cs @@ -54,7 +54,7 @@ namespace Content.Server.Disposal.Tube.Components return Owner.Transform.LocalRotation.GetDir(); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -177,7 +177,7 @@ namespace Content.Server.Disposal.Tube.Components } } - public override void OnRemove() + protected override void OnRemove() { UserInterface?.CloseAll(); base.OnRemove(); diff --git a/Content.Server/Disposal/Tube/Components/DisposalTaggerComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalTaggerComponent.cs index a90087b595..bc4f8605af 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalTaggerComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalTaggerComponent.cs @@ -45,7 +45,7 @@ namespace Content.Server.Disposal.Tube.Components return base.NextDirection(holder); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -143,7 +143,7 @@ namespace Content.Server.Disposal.Tube.Components } } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); UserInterface?.CloseAll(); diff --git a/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs b/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs index 4a29342918..006777e18e 100644 --- a/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs +++ b/Content.Server/Disposal/Tube/Components/DisposalTubeComponent.cs @@ -1,7 +1,7 @@ #nullable enable using System; using System.Linq; -using Content.Server.Anchor; +using Content.Server.Construction.Components; using Content.Server.Disposal.Unit.Components; using Content.Shared.Acts; using Content.Shared.Disposal.Components; @@ -224,7 +224,7 @@ namespace Content.Server.Disposal.Tube.Components UpdateVisualState(); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -246,7 +246,7 @@ namespace Content.Server.Disposal.Tube.Components UpdateVisualState(); } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); diff --git a/Content.Server/Disposal/Unit/Components/DisposalHolderComponent.cs b/Content.Server/Disposal/Unit/Components/DisposalHolderComponent.cs index c9a8ac4225..a2165d22f5 100644 --- a/Content.Server/Disposal/Unit/Components/DisposalHolderComponent.cs +++ b/Content.Server/Disposal/Unit/Components/DisposalHolderComponent.cs @@ -58,14 +58,14 @@ namespace Content.Server.Disposal.Unit.Components [DataField("air")] public GasMixture Air { get; set; } = new GasMixture(Atmospherics.CellVolume); - public override void Initialize() + protected override void Initialize() { base.Initialize(); _contents = ContainerHelpers.EnsureContainer(Owner, nameof(DisposalHolderComponent)); } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); ExitDisposals(); diff --git a/Content.Server/Disposal/Unit/Components/DisposalUnitComponent.cs b/Content.Server/Disposal/Unit/Components/DisposalUnitComponent.cs index b73019adc1..2b3f9df9fe 100644 --- a/Content.Server/Disposal/Unit/Components/DisposalUnitComponent.cs +++ b/Content.Server/Disposal/Unit/Components/DisposalUnitComponent.cs @@ -4,9 +4,9 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; -using Content.Server.Anchor; using Content.Server.Atmos; using Content.Server.Atmos.EntitySystems; +using Content.Server.Construction.Components; using Content.Server.Disposal.Tube.Components; using Content.Server.DoAfter; using Content.Server.Hands.Components; @@ -487,7 +487,7 @@ namespace Content.Server.Disposal.Unit.Components } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -514,7 +514,7 @@ namespace Content.Server.Disposal.Unit.Components UpdateInterface(); } - public override void OnRemove() + protected override void OnRemove() { foreach (var entity in _container.ContainedEntities.ToArray()) { diff --git a/Content.Server/Doors/Components/AirlockComponent.cs b/Content.Server/Doors/Components/AirlockComponent.cs index 3072c99085..e1b536d87a 100644 --- a/Content.Server/Doors/Components/AirlockComponent.cs +++ b/Content.Server/Doors/Components/AirlockComponent.cs @@ -103,7 +103,7 @@ namespace Content.Server.Doors.Components [ViewVariables(VVAccess.ReadWrite)] private bool _safety = true; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Doors/Components/ServerDoorComponent.cs b/Content.Server/Doors/Components/ServerDoorComponent.cs index e368f04738..b608dc5304 100644 --- a/Content.Server/Doors/Components/ServerDoorComponent.cs +++ b/Content.Server/Doors/Components/ServerDoorComponent.cs @@ -169,7 +169,7 @@ namespace Content.Server.Doors.Components CreateDoorElectronicsBoard(); } - public override void OnRemove() + protected override void OnRemove() { _stateChangeCancelTokenSource?.Cancel(); _autoCloseCancelTokenSource?.Cancel(); diff --git a/Content.Server/Explosion/Components/ClusterFlashComponent.cs b/Content.Server/Explosion/Components/ClusterFlashComponent.cs index 8b9b8bc0d9..30ed16254d 100644 --- a/Content.Server/Explosion/Components/ClusterFlashComponent.cs +++ b/Content.Server/Explosion/Components/ClusterFlashComponent.cs @@ -67,8 +67,7 @@ namespace Content.Server.Explosion.Components return true; } - - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Explosion/Components/ExplosiveProjectileComponent.cs b/Content.Server/Explosion/Components/ExplosiveProjectileComponent.cs index d9e9f9a2da..2023e7638b 100644 --- a/Content.Server/Explosion/Components/ExplosiveProjectileComponent.cs +++ b/Content.Server/Explosion/Components/ExplosiveProjectileComponent.cs @@ -9,7 +9,7 @@ namespace Content.Server.Explosion.Components { public override string Name => "ExplosiveProjectile"; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Flash/Components/FlashProjectileComponent.cs b/Content.Server/Flash/Components/FlashProjectileComponent.cs index 31b3589642..75be83afb4 100644 --- a/Content.Server/Flash/Components/FlashProjectileComponent.cs +++ b/Content.Server/Flash/Components/FlashProjectileComponent.cs @@ -21,7 +21,7 @@ namespace Content.Server.Flash.Components private bool _flashed; - public override void Initialize() + protected override void Initialize() { base.Initialize(); // Shouldn't be using this without a ProjectileComponent because it will just immediately collide with thrower diff --git a/Content.Server/Fluids/Components/BucketComponent.cs b/Content.Server/Fluids/Components/BucketComponent.cs index c35b374f1b..cb43bcf45c 100644 --- a/Content.Server/Fluids/Components/BucketComponent.cs +++ b/Content.Server/Fluids/Components/BucketComponent.cs @@ -46,7 +46,7 @@ namespace Content.Server.Fluids.Components private string? _sound = "/Audio/Effects/Fluids/watersplash.ogg"; /// - public override void Initialize() + protected override void Initialize() { base.Initialize(); Owner.EnsureComponentWarn(); diff --git a/Content.Server/Fluids/Components/MopComponent.cs b/Content.Server/Fluids/Components/MopComponent.cs index c39b1faca3..d60d1ad970 100644 --- a/Content.Server/Fluids/Components/MopComponent.cs +++ b/Content.Server/Fluids/Components/MopComponent.cs @@ -63,7 +63,7 @@ namespace Content.Server.Fluids.Components [DataField("speed")] private float _mopSpeed = 1; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Fluids/Components/PuddleComponent.cs b/Content.Server/Fluids/Components/PuddleComponent.cs index 43d4fcebfb..3d2e1db3fa 100644 --- a/Content.Server/Fluids/Components/PuddleComponent.cs +++ b/Content.Server/Fluids/Components/PuddleComponent.cs @@ -110,7 +110,7 @@ namespace Content.Server.Fluids.Components private bool Slippery => Owner.TryGetComponent(out SlipperyComponent? slippery) && slippery.Slippery; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Fluids/Components/SprayComponent.cs b/Content.Server/Fluids/Components/SprayComponent.cs index 7a63f14769..64c8faeb8f 100644 --- a/Content.Server/Fluids/Components/SprayComponent.cs +++ b/Content.Server/Fluids/Components/SprayComponent.cs @@ -82,7 +82,7 @@ namespace Content.Server.Fluids.Components public ReagentUnit CurrentVolume => Owner.GetComponentOrNull()?.CurrentVolume ?? ReagentUnit.Zero; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs b/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs index c58a3cf141..b55133c923 100644 --- a/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs +++ b/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs @@ -41,7 +41,7 @@ namespace Content.Server.Ghost.Roles.Components [ViewVariables] public uint Identifier { get; set; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Gravity/GravityGeneratorComponent.cs b/Content.Server/Gravity/GravityGeneratorComponent.cs index 6ed0a476e0..882d5790fe 100644 --- a/Content.Server/Gravity/GravityGeneratorComponent.cs +++ b/Content.Server/Gravity/GravityGeneratorComponent.cs @@ -57,7 +57,7 @@ namespace Content.Server.Gravity [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(GravityGeneratorUiKey.Key); - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Headset/HeadsetComponent.cs b/Content.Server/Headset/HeadsetComponent.cs index 88b1ad4187..7d8d2b4218 100644 --- a/Content.Server/Headset/HeadsetComponent.cs +++ b/Content.Server/Headset/HeadsetComponent.cs @@ -41,7 +41,7 @@ namespace Content.Server.Headset public bool RadioRequested { get; set; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Instruments/InstrumentComponent.cs b/Content.Server/Instruments/InstrumentComponent.cs index 4f4ba29d4c..4a54990671 100644 --- a/Content.Server/Instruments/InstrumentComponent.cs +++ b/Content.Server/Instruments/InstrumentComponent.cs @@ -162,7 +162,7 @@ namespace Content.Server.Instruments Clean(); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Inventory/Components/HumanInventoryControllerComponent.cs b/Content.Server/Inventory/Components/HumanInventoryControllerComponent.cs index 4fa50d47e2..c1262e06ef 100644 --- a/Content.Server/Inventory/Components/HumanInventoryControllerComponent.cs +++ b/Content.Server/Inventory/Components/HumanInventoryControllerComponent.cs @@ -17,7 +17,7 @@ namespace Content.Server.Inventory.Components private InventoryComponent _inventory = default!; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Inventory/Components/InventoryComponent.cs b/Content.Server/Inventory/Components/InventoryComponent.cs index b7113eb0e5..a41eb594f5 100644 --- a/Content.Server/Inventory/Components/InventoryComponent.cs +++ b/Content.Server/Inventory/Components/InventoryComponent.cs @@ -48,7 +48,7 @@ namespace Content.Server.Inventory.Components public event Action? OnItemChanged; - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -152,7 +152,7 @@ namespace Content.Server.Inventory.Components return !TryGetSlotItem(EquipmentSlotDefines.Slots.SHOES, out ItemComponent? shoes) || EffectBlockerSystem.CanSlip(shoes.Owner); } - public override void OnRemove() + protected override void OnRemove() { var slots = _slotContainers.Keys.ToList(); diff --git a/Content.Server/Kitchen/Components/MicrowaveComponent.cs b/Content.Server/Kitchen/Components/MicrowaveComponent.cs index cfb257b596..190f2aa635 100644 --- a/Content.Server/Kitchen/Components/MicrowaveComponent.cs +++ b/Content.Server/Kitchen/Components/MicrowaveComponent.cs @@ -79,7 +79,7 @@ namespace Content.Server.Kitchen.Components [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(MicrowaveUiKey.Key); - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Kitchen/Components/ReagentGrinderComponent.cs b/Content.Server/Kitchen/Components/ReagentGrinderComponent.cs index 1e49397ecf..4b9025cc99 100644 --- a/Content.Server/Kitchen/Components/ReagentGrinderComponent.cs +++ b/Content.Server/Kitchen/Components/ReagentGrinderComponent.cs @@ -68,7 +68,7 @@ namespace Content.Server.Kitchen.Components [ViewVariables(VVAccess.ReadWrite)] [DataField("chamberCapacity")] private int _storageCap = 16; [ViewVariables(VVAccess.ReadWrite)] [DataField("workTime")] private int _workTime = 3500; //3.5 seconds, completely arbitrary for now. - public override void Initialize() + protected override void Initialize() { base.Initialize(); //A slot for the beaker where the grounds/juices will go. @@ -98,7 +98,7 @@ namespace Content.Server.Kitchen.Components } } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); if (UserInterface != null) diff --git a/Content.Server/Lathe/Components/LatheComponent.cs b/Content.Server/Lathe/Components/LatheComponent.cs index 34595d9d83..0bd32992d2 100644 --- a/Content.Server/Lathe/Components/LatheComponent.cs +++ b/Content.Server/Lathe/Components/LatheComponent.cs @@ -48,7 +48,7 @@ namespace Content.Server.Lathe.Components [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(LatheUiKey.Key); - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Light/Components/ExpendableLightComponent.cs b/Content.Server/Light/Components/ExpendableLightComponent.cs index 755fbe8e7a..0e8be41061 100644 --- a/Content.Server/Light/Components/ExpendableLightComponent.cs +++ b/Content.Server/Light/Components/ExpendableLightComponent.cs @@ -37,7 +37,7 @@ namespace Content.Server.Light.Components return TryActivate(); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Light/Components/HandheldLightComponent.cs b/Content.Server/Light/Components/HandheldLightComponent.cs index 975ca2d9a4..7fbc10d3d3 100644 --- a/Content.Server/Light/Components/HandheldLightComponent.cs +++ b/Content.Server/Light/Components/HandheldLightComponent.cs @@ -57,7 +57,7 @@ namespace Content.Server.Light.Components /// private byte? _lastLevel; - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -67,7 +67,7 @@ namespace Content.Server.Light.Components Dirty(); } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); Owner.EntityManager.EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this)); diff --git a/Content.Server/Light/Components/LightBulbComponent.cs b/Content.Server/Light/Components/LightBulbComponent.cs index 445cdbb58c..68d849a808 100644 --- a/Content.Server/Light/Components/LightBulbComponent.cs +++ b/Content.Server/Light/Components/LightBulbComponent.cs @@ -110,7 +110,7 @@ namespace Content.Server.Light.Components sprite.Color = Color; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); UpdateColor(); diff --git a/Content.Server/Light/Components/LightReplacerComponent.cs b/Content.Server/Light/Components/LightReplacerComponent.cs index 21a4044f7a..a0490b913e 100644 --- a/Content.Server/Light/Components/LightReplacerComponent.cs +++ b/Content.Server/Light/Components/LightReplacerComponent.cs @@ -36,7 +36,7 @@ namespace Content.Server.Light.Components // bulbs that were inserted inside light replacer [ViewVariables] private IContainer _insertedBulbs = default!; - public override void Initialize() + protected override void Initialize() { base.Initialize(); _insertedBulbs = ContainerHelpers.EnsureContainer(Owner, "light_replacer_storage"); diff --git a/Content.Server/Light/Components/PoweredLightComponent.cs b/Content.Server/Light/Components/PoweredLightComponent.cs index e08cc21203..82a852675a 100644 --- a/Content.Server/Light/Components/PoweredLightComponent.cs +++ b/Content.Server/Light/Components/PoweredLightComponent.cs @@ -241,7 +241,7 @@ namespace Content.Server.Light.Components } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/MachineLinking/Components/SignalLinkerComponent.cs b/Content.Server/MachineLinking/Components/SignalLinkerComponent.cs index 014f73eb26..f0b99220ad 100644 --- a/Content.Server/MachineLinking/Components/SignalLinkerComponent.cs +++ b/Content.Server/MachineLinking/Components/SignalLinkerComponent.cs @@ -11,7 +11,7 @@ namespace Content.Server.MachineLinking.Components [ViewVariables] public SignalTransmitterComponent? Link { get; set; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/MachineLinking/Components/SignalSwitchComponent.cs b/Content.Server/MachineLinking/Components/SignalSwitchComponent.cs index 12ba0370e0..46c2ad4f67 100644 --- a/Content.Server/MachineLinking/Components/SignalSwitchComponent.cs +++ b/Content.Server/MachineLinking/Components/SignalSwitchComponent.cs @@ -19,7 +19,7 @@ namespace Content.Server.MachineLinking.Components [DataField("on")] private bool _on; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/MachineLinking/Components/SignalTransmitterComponent.cs b/Content.Server/MachineLinking/Components/SignalTransmitterComponent.cs index 19225aafe4..86bd67b39c 100644 --- a/Content.Server/MachineLinking/Components/SignalTransmitterComponent.cs +++ b/Content.Server/MachineLinking/Components/SignalTransmitterComponent.cs @@ -63,7 +63,7 @@ namespace Content.Server.MachineLinking.Components } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Medical/Components/MedicalScannerComponent.cs b/Content.Server/Medical/Components/MedicalScannerComponent.cs index 0638f622bd..f837e5cef2 100644 --- a/Content.Server/Medical/Components/MedicalScannerComponent.cs +++ b/Content.Server/Medical/Components/MedicalScannerComponent.cs @@ -54,7 +54,7 @@ namespace Content.Server.Medical.Components public bool IsOccupied => _bodyContainer.ContainedEntity != null; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Mind/Components/VisitingMindComponent.cs b/Content.Server/Mind/Components/VisitingMindComponent.cs index a592968c26..11d9bfe2e7 100644 --- a/Content.Server/Mind/Components/VisitingMindComponent.cs +++ b/Content.Server/Mind/Components/VisitingMindComponent.cs @@ -11,7 +11,7 @@ namespace Content.Server.Mind.Components [ViewVariables] public Mind Mind { get; set; } = default!; - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); diff --git a/Content.Server/Mining/Components/AsteroidRockComponent.cs b/Content.Server/Mining/Components/AsteroidRockComponent.cs index c19bb769dc..000c575fff 100644 --- a/Content.Server/Mining/Components/AsteroidRockComponent.cs +++ b/Content.Server/Mining/Components/AsteroidRockComponent.cs @@ -21,7 +21,7 @@ namespace Content.Server.Mining.Components public override string Name => "AsteroidRock"; private static readonly string[] SpriteStates = {"0", "1", "2", "3", "4"}; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Morgue/Components/BodyBagEntityStorageComponent.cs b/Content.Server/Morgue/Components/BodyBagEntityStorageComponent.cs index 1231273140..1925775fe3 100644 --- a/Content.Server/Morgue/Components/BodyBagEntityStorageComponent.cs +++ b/Content.Server/Morgue/Components/BodyBagEntityStorageComponent.cs @@ -35,7 +35,7 @@ namespace Content.Server.Morgue.Components [ViewVariables] public ContainerSlot? LabelContainer { get; private set; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); _appearance?.SetData(BodyBagVisuals.Label, false); diff --git a/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs b/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs index 919c363330..4696ea08bd 100644 --- a/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs +++ b/Content.Server/Morgue/Components/MorgueEntityStorageComponent.cs @@ -48,8 +48,7 @@ namespace Content.Server.Morgue.Components [ViewVariables] [ComponentDependency] protected readonly AppearanceComponent? Appearance = null; - - public override void Initialize() + protected override void Initialize() { base.Initialize(); Appearance?.SetData(MorgueVisuals.Open, false); diff --git a/Content.Server/NodeContainer/EntitySystems/NodeContainerSystem.cs b/Content.Server/NodeContainer/EntitySystems/NodeContainerSystem.cs index 4cfb26181f..519ddee323 100644 --- a/Content.Server/NodeContainer/EntitySystems/NodeContainerSystem.cs +++ b/Content.Server/NodeContainer/EntitySystems/NodeContainerSystem.cs @@ -11,11 +11,11 @@ namespace Content.Server.NodeContainer.EntitySystems { base.Initialize(); - SubscribeLocalEvent(OnBodyTypeChanged); + SubscribeLocalEvent(OnAnchorStateChanged); SubscribeLocalEvent(OnRotateEvent); } - private void OnBodyTypeChanged(EntityUid uid, NodeContainerComponent component, PhysicsBodyTypeChangedEvent args) + private void OnAnchorStateChanged(EntityUid uid, NodeContainerComponent component, AnchorStateChangedEvent args) { component.AnchorUpdate(); } diff --git a/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs b/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs index 01b8ed8d10..c4a0a5e0a0 100644 --- a/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs +++ b/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Content.Server.NodeContainer.NodeGroups; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -10,21 +10,6 @@ namespace Content.Server.NodeContainer.EntitySystems { private readonly HashSet _dirtyNodeGroups = new(); - public override void Initialize() - { - base.Initialize(); - - SubscribeLocalEvent(OnSnapGridPositionChanged); - } - - private void OnSnapGridPositionChanged(EntityUid uid, NodeContainerComponent component, SnapGridPositionChangedEvent args) - { - foreach (var node in component.Nodes.Values) - { - node.OnSnapGridMove(); - } - } - public void AddDirtyNodeGroup(INodeGroup nodeGroup) { _dirtyNodeGroups.Add(nodeGroup); diff --git a/Content.Server/NodeContainer/NodeContainerComponent.cs b/Content.Server/NodeContainer/NodeContainerComponent.cs index 847aa0794e..9c5bdd4bec 100644 --- a/Content.Server/NodeContainer/NodeContainerComponent.cs +++ b/Content.Server/NodeContainer/NodeContainerComponent.cs @@ -29,7 +29,7 @@ namespace Content.Server.NodeContainer [DataField("examinable")] private bool _examinable = false; - public override void Initialize() + protected override void Initialize() { base.Initialize(); foreach (var node in _nodes.Values) @@ -62,6 +62,7 @@ namespace Content.Server.NodeContainer foreach (var node in Nodes.Values) { node.AnchorUpdate(); + node.AnchorStateChanged(); } } diff --git a/Content.Server/NodeContainer/Nodes/Node.cs b/Content.Server/NodeContainer/Nodes/Node.cs index a7e9cddd3f..614a5bff4c 100644 --- a/Content.Server/NodeContainer/Nodes/Node.cs +++ b/Content.Server/NodeContainer/Nodes/Node.cs @@ -41,7 +41,7 @@ namespace Content.Server.NodeContainer.Nodes /// public bool Connectable => !_deleting && Anchored; - protected bool Anchored => !NeedAnchored || !Owner.TryGetComponent(out var physics) || physics.BodyType == BodyType.Static; + protected bool Anchored => !NeedAnchored || Owner.Transform.Anchored; [ViewVariables(VVAccess.ReadWrite)] [DataField("needAnchored")] @@ -76,7 +76,7 @@ namespace Content.Server.NodeContainer.Nodes } } - public virtual void OnSnapGridMove() + public virtual void AnchorStateChanged() { } diff --git a/Content.Server/NodeContainer/Nodes/PipeNode.cs b/Content.Server/NodeContainer/Nodes/PipeNode.cs index f567c204af..8bee157688 100644 --- a/Content.Server/NodeContainer/Nodes/PipeNode.cs +++ b/Content.Server/NodeContainer/Nodes/PipeNode.cs @@ -125,11 +125,6 @@ namespace Content.Server.GameObjects.Components.NodeContainer.Nodes UpdateAdjacentConnectedDirections(); } - public override void OnSnapGridMove() - { - OnConnectedDirectionsNeedsUpdating(); - } - public void JoinPipeNet(IPipeNet pipeNet) { _pipeNet = pipeNet; diff --git a/Content.Server/Nutrition/Components/DrinkComponent.cs b/Content.Server/Nutrition/Components/DrinkComponent.cs index 676766a7ce..1455355c1b 100644 --- a/Content.Server/Nutrition/Components/DrinkComponent.cs +++ b/Content.Server/Nutrition/Components/DrinkComponent.cs @@ -81,7 +81,7 @@ namespace Content.Server.Nutrition.Components [DataField("burstSound")] private string _burstSound = "/Audio/Effects/flash_bang.ogg"; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Nutrition/Components/FoodComponent.cs b/Content.Server/Nutrition/Components/FoodComponent.cs index b4e0c44eab..48d33a79ee 100644 --- a/Content.Server/Nutrition/Components/FoodComponent.cs +++ b/Content.Server/Nutrition/Components/FoodComponent.cs @@ -54,7 +54,7 @@ namespace Content.Server.Nutrition.Components } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); Owner.EnsureComponentWarn(); diff --git a/Content.Server/Nutrition/Components/FoodContainerComponent.cs b/Content.Server/Nutrition/Components/FoodContainerComponent.cs index dc2ef954f4..3854928bca 100644 --- a/Content.Server/Nutrition/Components/FoodContainerComponent.cs +++ b/Content.Server/Nutrition/Components/FoodContainerComponent.cs @@ -37,7 +37,7 @@ namespace Content.Server.Nutrition.Components private int _count = 0; - public override void Initialize() + protected override void Initialize() { base.Initialize(); Owner.TryGetComponent(out _appearance); diff --git a/Content.Server/Nutrition/Components/SliceableFoodComponent.cs b/Content.Server/Nutrition/Components/SliceableFoodComponent.cs index 609885cf0d..57f3944f39 100644 --- a/Content.Server/Nutrition/Components/SliceableFoodComponent.cs +++ b/Content.Server/Nutrition/Components/SliceableFoodComponent.cs @@ -34,7 +34,7 @@ namespace Content.Server.Nutrition.Components [ViewVariables(VVAccess.ReadWrite)] public ushort Count; - public override void Initialize() + protected override void Initialize() { base.Initialize(); Count = _totalCount; diff --git a/Content.Server/PDA/PDAComponent.cs b/Content.Server/PDA/PDAComponent.cs index 4f1713ce26..aa8a4f8b76 100644 --- a/Content.Server/PDA/PDAComponent.cs +++ b/Content.Server/PDA/PDAComponent.cs @@ -63,7 +63,7 @@ namespace Content.Server.PDA _accessSet = new PdaAccessSet(this); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); _idSlot = ContainerHelpers.EnsureContainer(Owner, "pda_entity_container"); diff --git a/Content.Server/Paper/PaperComponent.cs b/Content.Server/Paper/PaperComponent.cs index c9705155f3..709e24f26e 100644 --- a/Content.Server/Paper/PaperComponent.cs +++ b/Content.Server/Paper/PaperComponent.cs @@ -23,7 +23,7 @@ namespace Content.Server.Paper [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(PaperUiKey.Key); - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs index 931c3fa87b..706bea36c7 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorControlBoxComponent.cs @@ -99,7 +99,7 @@ namespace Content.Server.ParticleAccelerator.Components ? ParticleAcceleratorPowerState.Level3 : ParticleAcceleratorPowerState.Level2; - public override void Initialize() + protected override void Initialize() { base.Initialize(); if (UserInterface != null) @@ -240,7 +240,7 @@ namespace Content.Server.ParticleAccelerator.Components } } - public override void OnRemove() + protected override void OnRemove() { UserInterface?.CloseAll(); base.OnRemove(); diff --git a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs index df401ad403..82fb8b9183 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPartComponent.cs @@ -8,7 +8,7 @@ namespace Content.Server.ParticleAccelerator.Components { [ViewVariables] public ParticleAcceleratorControlBoxComponent? Master; - public override void Initialize() + protected override void Initialize() { base.Initialize(); // FIXME: this has to be an entity system, full stop. @@ -21,7 +21,7 @@ namespace Content.Server.ParticleAccelerator.Components RescanIfPossible(); } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); diff --git a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPowerBoxComponent.cs b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPowerBoxComponent.cs index 6f4be1630a..c3f79a8be7 100644 --- a/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPowerBoxComponent.cs +++ b/Content.Server/ParticleAccelerator/Components/ParticleAcceleratorPowerBoxComponent.cs @@ -12,7 +12,7 @@ namespace Content.Server.ParticleAccelerator.Components public override string Name => "ParticleAcceleratorPowerBox"; [ViewVariables] public PowerConsumerComponent? PowerConsumerComponent; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Plants/Components/PottedPlantHideComponent.cs b/Content.Server/Plants/Components/PottedPlantHideComponent.cs index 485c5d4699..98ec67881d 100644 --- a/Content.Server/Plants/Components/PottedPlantHideComponent.cs +++ b/Content.Server/Plants/Components/PottedPlantHideComponent.cs @@ -19,7 +19,7 @@ namespace Content.Server.Plants.Components [ViewVariables] private SecretStashComponent _secretStash = default!; - public override void Initialize() + protected override void Initialize() { base.Initialize(); _secretStash = Owner.EnsureComponent(); diff --git a/Content.Server/Portal/Components/PortalComponent.cs b/Content.Server/Portal/Components/PortalComponent.cs index 1cf8a0eb39..ada1fa19ce 100644 --- a/Content.Server/Portal/Components/PortalComponent.cs +++ b/Content.Server/Portal/Components/PortalComponent.cs @@ -33,7 +33,7 @@ namespace Content.Server.Portal.Components public readonly List ImmuneEntities = new(); // K [ViewVariables(VVAccess.ReadWrite)] [DataField("alive_time")] private float _aliveTime = 10f; - public override void OnAdd() + protected override void OnAdd() { // This will blow up an entity it's attached to base.OnAdd(); diff --git a/Content.Server/Portal/Components/TeleporterComponent.cs b/Content.Server/Portal/Components/TeleporterComponent.cs index 4d65d8c57c..b066c2cd22 100644 --- a/Content.Server/Portal/Components/TeleporterComponent.cs +++ b/Content.Server/Portal/Components/TeleporterComponent.cs @@ -130,7 +130,7 @@ namespace Content.Server.Portal.Components } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); _state = ItemTeleporterState.Off; diff --git a/Content.Server/Power/Components/BaseCharger.cs b/Content.Server/Power/Components/BaseCharger.cs index 92c2a1813e..fcac755f49 100644 --- a/Content.Server/Power/Components/BaseCharger.cs +++ b/Content.Server/Power/Components/BaseCharger.cs @@ -41,7 +41,7 @@ namespace Content.Server.Power.Components [DataField("transferEfficiency")] private float _transferEfficiency = 0.85f; - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -61,7 +61,7 @@ namespace Content.Server.Power.Components } } - public override void OnRemove() + protected override void OnRemove() { _heldBattery = null; diff --git a/Content.Server/Power/Components/BaseNetConnectorComponent.cs b/Content.Server/Power/Components/BaseNetConnectorComponent.cs index 25d998bdbc..017b80ca65 100644 --- a/Content.Server/Power/Components/BaseNetConnectorComponent.cs +++ b/Content.Server/Power/Components/BaseNetConnectorComponent.cs @@ -25,13 +25,13 @@ namespace Content.Server.Power.Components [ViewVariables] private bool _needsNet = true; - public override void OnAdd() + protected override void OnAdd() { base.OnAdd(); _net = NullNet; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); if (_needsNet) @@ -40,7 +40,7 @@ namespace Content.Server.Power.Components } } - public override void OnRemove() + protected override void OnRemove() { ClearNet(); base.OnRemove(); diff --git a/Content.Server/Power/Components/BatteryDischargerComponent.cs b/Content.Server/Power/Components/BatteryDischargerComponent.cs index a1d1b95b0f..62335e2727 100644 --- a/Content.Server/Power/Components/BatteryDischargerComponent.cs +++ b/Content.Server/Power/Components/BatteryDischargerComponent.cs @@ -26,7 +26,7 @@ namespace Content.Server.Power.Components [DataField("activeSupplyRate")] private int _activeSupplyRate = 50; - public override void Initialize() + protected override void Initialize() { base.Initialize(); Owner.EnsureComponentWarn(); diff --git a/Content.Server/Power/Components/BatteryStorageComponent.cs b/Content.Server/Power/Components/BatteryStorageComponent.cs index df418efce3..daa1dba4d6 100644 --- a/Content.Server/Power/Components/BatteryStorageComponent.cs +++ b/Content.Server/Power/Components/BatteryStorageComponent.cs @@ -27,7 +27,7 @@ namespace Content.Server.Power.Components [ComponentDependency] private PowerConsumerComponent? _consumer = default!; - public override void Initialize() + protected override void Initialize() { base.Initialize(); Owner.EnsureComponentWarn(); diff --git a/Content.Server/Power/Components/PowerProviderComponent.cs b/Content.Server/Power/Components/PowerProviderComponent.cs index 8d4a82dc6b..1b8a35cbf2 100644 --- a/Content.Server/Power/Components/PowerProviderComponent.cs +++ b/Content.Server/Power/Components/PowerProviderComponent.cs @@ -86,7 +86,7 @@ namespace Content.Server.Power.Components } } - public override void OnRemove() + protected override void OnRemove() { Connectable = false; var receivers = _linkedReceivers.ToArray(); diff --git a/Content.Server/Power/Components/PowerReceiverComponent.cs b/Content.Server/Power/Components/PowerReceiverComponent.cs index 705d585005..3c0e608017 100644 --- a/Content.Server/Power/Components/PowerReceiverComponent.cs +++ b/Content.Server/Power/Components/PowerReceiverComponent.cs @@ -92,7 +92,7 @@ namespace Content.Server.Power.Components } } - public override void OnRemove() + protected override void OnRemove() { _provider.RemoveReceiver(this); base.OnRemove(); diff --git a/Content.Server/PowerCell/Components/PowerCellComponent.cs b/Content.Server/PowerCell/Components/PowerCellComponent.cs index b5ee6bf42f..5073f96d67 100644 --- a/Content.Server/PowerCell/Components/PowerCellComponent.cs +++ b/Content.Server/PowerCell/Components/PowerCellComponent.cs @@ -32,7 +32,7 @@ namespace Content.Server.PowerCell.Components [ViewVariables] public bool IsRigged { get; private set; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); CurrentCharge = MaxCharge; diff --git a/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs b/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs index 5a47895fd3..c2c618cd91 100644 --- a/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs +++ b/Content.Server/PowerCell/Components/PowerCellSlotComponent.cs @@ -99,7 +99,7 @@ namespace Content.Server.PowerCell.Components [DataField("startingCellType")] private string? _startingCellType = null; - public override void Initialize() + protected override void Initialize() { base.Initialize(); _cellContainer = ContainerHelpers.EnsureContainer(Owner, "cellslot_cell_container", out _); diff --git a/Content.Server/RCD/Components/RCDComponent.cs b/Content.Server/RCD/Components/RCDComponent.cs index b1c95b5b54..79365aead0 100644 --- a/Content.Server/RCD/Components/RCDComponent.cs +++ b/Content.Server/RCD/Components/RCDComponent.cs @@ -47,7 +47,7 @@ namespace Content.Server.RCD.Components Deconstruct } - public override void Initialize() + protected override void Initialize() { base.Initialize(); _ammo = MaxAmmo; diff --git a/Content.Server/Radio/Components/HandheldRadioComponent.cs b/Content.Server/Radio/Components/HandheldRadioComponent.cs index bcb4ca1bd6..61f4963d47 100644 --- a/Content.Server/Radio/Components/HandheldRadioComponent.cs +++ b/Content.Server/Radio/Components/HandheldRadioComponent.cs @@ -47,7 +47,7 @@ namespace Content.Server.Radio.Components [ViewVariables] public IReadOnlyList Channels => _channels; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Research/Components/ResearchClientComponent.cs b/Content.Server/Research/Components/ResearchClientComponent.cs index 23b8aa9b18..946e38c452 100644 --- a/Content.Server/Research/Components/ResearchClientComponent.cs +++ b/Content.Server/Research/Components/ResearchClientComponent.cs @@ -34,7 +34,7 @@ namespace Content.Server.Research.Components Server?.UnregisterClient(this); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Research/Components/ResearchConsoleComponent.cs b/Content.Server/Research/Components/ResearchConsoleComponent.cs index 1586cbb753..b6cdea4c1a 100644 --- a/Content.Server/Research/Components/ResearchConsoleComponent.cs +++ b/Content.Server/Research/Components/ResearchConsoleComponent.cs @@ -30,7 +30,7 @@ namespace Content.Server.Research.Components [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ResearchConsoleUiKey.Key); - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Research/Components/ResearchPointSourceComponent.cs b/Content.Server/Research/Components/ResearchPointSourceComponent.cs index 12374d64f9..4eaeeff0b8 100644 --- a/Content.Server/Research/Components/ResearchPointSourceComponent.cs +++ b/Content.Server/Research/Components/ResearchPointSourceComponent.cs @@ -39,7 +39,7 @@ namespace Content.Server.Research.Components [ViewVariables] public bool CanProduce => Active && (_powerReceiver is null || _powerReceiver.Powered); - public override void Initialize() + protected override void Initialize() { base.Initialize(); Owner.TryGetComponent(out _powerReceiver); diff --git a/Content.Server/Research/Components/ResearchServerComponent.cs b/Content.Server/Research/Components/ResearchServerComponent.cs index 3bb2eec75d..f8e8368afb 100644 --- a/Content.Server/Research/Components/ResearchServerComponent.cs +++ b/Content.Server/Research/Components/ResearchServerComponent.cs @@ -67,7 +67,7 @@ namespace Content.Server.Research.Components private PowerReceiverComponent? _powerReceiver; - public override void Initialize() + protected override void Initialize() { base.Initialize(); Id = ServerCount++; diff --git a/Content.Server/SMES/SmesComponent.cs b/Content.Server/SMES/SmesComponent.cs index e6c988ef3b..c511f5bf11 100644 --- a/Content.Server/SMES/SmesComponent.cs +++ b/Content.Server/SMES/SmesComponent.cs @@ -34,7 +34,7 @@ namespace Content.Server.SMES private const int VisualsChangeDelay = 1; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Shuttle/ShuttleControllerComponent.cs b/Content.Server/Shuttle/ShuttleControllerComponent.cs index 2ef4a61f22..cf51c63045 100644 --- a/Content.Server/Shuttle/ShuttleControllerComponent.cs +++ b/Content.Server/Shuttle/ShuttleControllerComponent.cs @@ -176,7 +176,7 @@ namespace Content.Server.Shuttle } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); Owner.EnsureComponent(); diff --git a/Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs b/Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs index 6e07683744..66b89dfdfa 100644 --- a/Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs +++ b/Content.Server/Singularity/Components/ContainmentFieldGeneratorComponent.cs @@ -182,7 +182,7 @@ namespace Content.Server.Singularity.Components } } - public override void OnRemove() + protected override void OnRemove() { _connection1?.Item2.Dispose(); _connection2?.Item2.Dispose(); diff --git a/Content.Server/Singularity/Components/EmitterComponent.cs b/Content.Server/Singularity/Components/EmitterComponent.cs index 0a34f6b09b..6571234b1d 100644 --- a/Content.Server/Singularity/Components/EmitterComponent.cs +++ b/Content.Server/Singularity/Components/EmitterComponent.cs @@ -64,7 +64,7 @@ namespace Content.Server.Singularity.Components [ViewVariables(VVAccess.ReadWrite)] [DataField("fireBurstDelayMin")] private TimeSpan _fireBurstDelayMin = TimeSpan.FromSeconds(2); [ViewVariables(VVAccess.ReadWrite)] [DataField("fireBurstDelayMax")] private TimeSpan _fireBurstDelayMax = TimeSpan.FromSeconds(10); - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Singularity/Components/ServerSingularityComponent.cs b/Content.Server/Singularity/Components/ServerSingularityComponent.cs index 52e47a51cc..ee8ef14421 100644 --- a/Content.Server/Singularity/Components/ServerSingularityComponent.cs +++ b/Content.Server/Singularity/Components/ServerSingularityComponent.cs @@ -113,7 +113,7 @@ namespace Content.Server.Singularity.Components return new SingularityComponentState(Level); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -175,7 +175,7 @@ namespace Content.Server.Singularity.Components Energy++; } - public override void OnRemove() + protected override void OnRemove() { _playingSound?.Stop(); SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/singularity_collapse.ogg", Owner.Transform.Coordinates); diff --git a/Content.Server/Solar/Components/SolarControlConsoleComponent.cs b/Content.Server/Solar/Components/SolarControlConsoleComponent.cs index 080dc9fc48..34d3bc1b9a 100644 --- a/Content.Server/Solar/Components/SolarControlConsoleComponent.cs +++ b/Content.Server/Solar/Components/SolarControlConsoleComponent.cs @@ -22,7 +22,7 @@ namespace Content.Server.Solar.Components public SolarControlConsoleComponent() : base(SolarControlConsoleUiKey.Key) { } - public override void Initialize() + protected override void Initialize() { base.Initialize(); _powerSolarSystem = _entitySystemManager.GetEntitySystem(); diff --git a/Content.Server/Solar/Components/SolarPanelComponent.cs b/Content.Server/Solar/Components/SolarPanelComponent.cs index b55e815e10..1c82915ed0 100644 --- a/Content.Server/Solar/Components/SolarPanelComponent.cs +++ b/Content.Server/Solar/Components/SolarPanelComponent.cs @@ -71,7 +71,7 @@ namespace Content.Server.Solar.Components } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Spawners/Components/TimedSpawnerComponent.cs b/Content.Server/Spawners/Components/TimedSpawnerComponent.cs index 168dd5f922..bb353708d5 100644 --- a/Content.Server/Spawners/Components/TimedSpawnerComponent.cs +++ b/Content.Server/Spawners/Components/TimedSpawnerComponent.cs @@ -45,7 +45,7 @@ namespace Content.Server.Spawners.Components throw new ArgumentException("MaximumEntitiesSpawned can't be lower than MinimumEntitiesSpawned!"); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); SetupTimer(); diff --git a/Content.Server/Sprite/Components/RandomSpriteStateComponent.cs b/Content.Server/Sprite/Components/RandomSpriteStateComponent.cs index 16eed265ca..6dcfd5c86c 100644 --- a/Content.Server/Sprite/Components/RandomSpriteStateComponent.cs +++ b/Content.Server/Sprite/Components/RandomSpriteStateComponent.cs @@ -19,7 +19,7 @@ namespace Content.Server.Sprite.Components [DataField("spriteLayer")] private int _spriteLayer; - public override void Initialize() + protected override void Initialize() { base.Initialize(); if (_spriteStates == null) return; diff --git a/Content.Server/Storage/Components/EntityStorageComponent.cs b/Content.Server/Storage/Components/EntityStorageComponent.cs index d91bd1ce6c..d30fb7de76 100644 --- a/Content.Server/Storage/Components/EntityStorageComponent.cs +++ b/Content.Server/Storage/Components/EntityStorageComponent.cs @@ -146,7 +146,7 @@ namespace Content.Server.Storage.Components } /// - public override void Initialize() + protected override void Initialize() { base.Initialize(); Contents = Owner.EnsureContainer(nameof(EntityStorageComponent)); diff --git a/Content.Server/Storage/Components/SecretStashComponent.cs b/Content.Server/Storage/Components/SecretStashComponent.cs index ba786ab793..68dfb18820 100644 --- a/Content.Server/Storage/Components/SecretStashComponent.cs +++ b/Content.Server/Storage/Components/SecretStashComponent.cs @@ -31,7 +31,7 @@ namespace Content.Server.Storage.Components public string SecretPartName => _secretPartNameOverride ?? Loc.GetString("{0:theName}", Owner); - public override void Initialize() + protected override void Initialize() { base.Initialize(); _itemContainer = ContainerHelpers.EnsureContainer(Owner, "stash", out _); diff --git a/Content.Server/Storage/Components/ServerStorageComponent.cs b/Content.Server/Storage/Components/ServerStorageComponent.cs index 1821841e8b..459f0d14e7 100644 --- a/Content.Server/Storage/Components/ServerStorageComponent.cs +++ b/Content.Server/Storage/Components/ServerStorageComponent.cs @@ -356,7 +356,7 @@ namespace Content.Server.Storage.Components } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Strip/StrippableComponent.cs b/Content.Server/Strip/StrippableComponent.cs index 7c933e2775..6e15fc302e 100644 --- a/Content.Server/Strip/StrippableComponent.cs +++ b/Content.Server/Strip/StrippableComponent.cs @@ -31,7 +31,7 @@ namespace Content.Server.Strip [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(StrippingUiKey.Key); - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Stunnable/Components/StunnableProjectileComponent.cs b/Content.Server/Stunnable/Components/StunnableProjectileComponent.cs index d144d1ee50..9ebd0f6aad 100644 --- a/Content.Server/Stunnable/Components/StunnableProjectileComponent.cs +++ b/Content.Server/Stunnable/Components/StunnableProjectileComponent.cs @@ -22,7 +22,7 @@ namespace Content.Server.Stunnable.Components [DataField("slowdownAmount")] private int _slowdownAmount = default; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Tiles/FloorTileItemComponent.cs b/Content.Server/Tiles/FloorTileItemComponent.cs index 345167db84..ff9f224162 100644 --- a/Content.Server/Tiles/FloorTileItemComponent.cs +++ b/Content.Server/Tiles/FloorTileItemComponent.cs @@ -25,7 +25,7 @@ namespace Content.Server.Tiles [DataField("outputs", customTypeSerializer:typeof(PrototypeIdListSerializer))] private List? _outputTiles; - public override void Initialize() + protected override void Initialize() { base.Initialize(); Owner.EnsureComponent(); diff --git a/Content.Server/Toilet/ToiletComponent.cs b/Content.Server/Toilet/ToiletComponent.cs index 0978a6cab3..24dfab1245 100644 --- a/Content.Server/Toilet/ToiletComponent.cs +++ b/Content.Server/Toilet/ToiletComponent.cs @@ -42,7 +42,7 @@ namespace Content.Server.Toilet [ViewVariables] private SecretStashComponent _secretStash = default!; - public override void Initialize() + protected override void Initialize() { base.Initialize(); _secretStash = Owner.EnsureComponent(); diff --git a/Content.Server/Tools/Components/MultitoolComponent.cs b/Content.Server/Tools/Components/MultitoolComponent.cs index 6c16e68574..bc7508f373 100644 --- a/Content.Server/Tools/Components/MultitoolComponent.cs +++ b/Content.Server/Tools/Components/MultitoolComponent.cs @@ -49,7 +49,7 @@ namespace Content.Server.Tools.Components private ToolComponent? _tool; private SpriteComponent? _sprite; - public override void Initialize() + protected override void Initialize() { base.Initialize(); Owner.TryGetComponent(out _tool); diff --git a/Content.Server/Tools/Components/WelderComponent.cs b/Content.Server/Tools/Components/WelderComponent.cs index fcb21158d3..5ddf597d6a 100644 --- a/Content.Server/Tools/Components/WelderComponent.cs +++ b/Content.Server/Tools/Components/WelderComponent.cs @@ -86,7 +86,7 @@ namespace Content.Server.Tools.Components return WelderLit; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/VendingMachines/VendingMachineComponent.cs b/Content.Server/VendingMachines/VendingMachineComponent.cs index 05b24fea67..ef4bf25c09 100644 --- a/Content.Server/VendingMachines/VendingMachineComponent.cs +++ b/Content.Server/VendingMachines/VendingMachineComponent.cs @@ -99,7 +99,7 @@ namespace Content.Server.VendingMachines Inventory = inventory; } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoBoxComponent.cs b/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoBoxComponent.cs index c3bf31b83f..a0ecd6bb92 100644 --- a/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoBoxComponent.cs +++ b/Content.Server/Weapon/Ranged/Ammunition/Components/AmmoBoxComponent.cs @@ -49,7 +49,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components [DataField("fillPrototype")] private string? _fillPrototype; - public override void Initialize() + protected override void Initialize() { base.Initialize(); _ammoContainer = ContainerHelpers.EnsureContainer(Owner, $"{Name}-container", out var existing); diff --git a/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs b/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs index c0a1c86f89..ae66abd0ff 100644 --- a/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs +++ b/Content.Server/Weapon/Ranged/Ammunition/Components/RangedMagazineComponent.cs @@ -57,7 +57,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components UpdateAppearance(); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); _ammoContainer = ContainerHelpers.EnsureContainer(Owner, $"{Name}-magazine", out var existing); diff --git a/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs b/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs index 3bfbdd025a..d6baa5e0d9 100644 --- a/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs +++ b/Content.Server/Weapon/Ranged/Ammunition/Components/SpeedLoaderComponent.cs @@ -37,7 +37,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components [DataField("fillPrototype")] private string? _fillPrototype = default; - public override void Initialize() + protected override void Initialize() { base.Initialize(); _ammoContainer = ContainerHelpers.EnsureContainer(Owner, $"{Name}-container", out var existing); diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs index b540a59328..82dc8907b2 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/BoltActionBarrelComponent.cs @@ -143,7 +143,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components SoundGunshot); } - public override void Initialize() + protected override void Initialize() { // TODO: Add existing ammo support on revolvers base.Initialize(); diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs index db7b27e9ba..e6b25e9827 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/PumpBarrelComponent.cs @@ -102,7 +102,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components _spawnedAmmo = new Stack(Capacity - 1); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs index bed6955dd1..16bf972cec 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/RevolverBarrelComponent.cs @@ -99,7 +99,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components SoundGunshot); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); _unspawnedCount = Capacity; diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs index aa99dec5cc..b15a36d0ac 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs @@ -96,7 +96,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components count); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); _powerCellContainer = ContainerHelpers.EnsureContainer(Owner, $"{Name}-powercell-container", out var existing); @@ -120,6 +120,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components protected override void Startup() { + base.Startup(); UpdateAppearance(); } diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs index 877e915447..043c2ed499 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/ServerMagazineBarrelComponent.cs @@ -172,7 +172,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components SoundGunshot); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -194,6 +194,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components protected override void Startup() { + base.Startup(); UpdateAppearance(); } diff --git a/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs b/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs index d3a32f830a..7d6925e7f4 100644 --- a/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs +++ b/Content.Server/Weapon/Ranged/Barrels/Components/ServerRangedBarrelComponent.cs @@ -132,7 +132,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components } } - public override void OnAdd() + protected override void OnAdd() { base.OnAdd(); @@ -143,7 +143,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components rangedWeaponComponent.WeaponCanFireHandler += WeaponCanFire; } - public override void OnRemove() + protected override void OnRemove() { base.OnRemove(); if (Owner.TryGetComponent(out ServerRangedWeaponComponent? rangedWeaponComponent)) diff --git a/Content.Server/Wires/Components/WiresComponent.cs b/Content.Server/Wires/Components/WiresComponent.cs index a97137d1f2..89e73228a0 100644 --- a/Content.Server/Wires/Components/WiresComponent.cs +++ b/Content.Server/Wires/Components/WiresComponent.cs @@ -149,7 +149,7 @@ namespace Content.Server.Wires.Components [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(WiresUiKey.Key); - public override void Initialize() + protected override void Initialize() { base.Initialize(); _audioSystem = EntitySystem.Get(); diff --git a/Content.Shared/Actions/Components/SharedActionsComponent.cs b/Content.Shared/Actions/Components/SharedActionsComponent.cs index fcb29abfb8..01e42498fd 100644 --- a/Content.Shared/Actions/Components/SharedActionsComponent.cs +++ b/Content.Shared/Actions/Components/SharedActionsComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -68,6 +68,7 @@ namespace Content.Shared.Actions.Components protected override void Startup() { + base.Startup(); foreach (var actionType in InnateActions) { Grant(actionType); diff --git a/Content.Shared/Body/Components/SharedBodyComponent.cs b/Content.Shared/Body/Components/SharedBodyComponent.cs index e7f46f0f5d..b31e67f6a6 100644 --- a/Content.Shared/Body/Components/SharedBodyComponent.cs +++ b/Content.Shared/Body/Components/SharedBodyComponent.cs @@ -74,7 +74,7 @@ namespace Content.Shared.Body.Components public SharedBodyPartComponent? CenterPart => CenterSlot?.Part; - public override void Initialize() + protected override void Initialize() { base.Initialize(); @@ -99,7 +99,7 @@ namespace Content.Shared.Body.Components CalculateSpeed(); } - public override void OnRemove() + protected override void OnRemove() { foreach (var slot in SlotIds.Values) { diff --git a/Content.Shared/Body/Mechanism/SharedMechanismComponent.cs b/Content.Shared/Body/Mechanism/SharedMechanismComponent.cs index 08d5cab806..47940141bb 100644 --- a/Content.Shared/Body/Mechanism/SharedMechanismComponent.cs +++ b/Content.Shared/Body/Mechanism/SharedMechanismComponent.cs @@ -116,7 +116,7 @@ namespace Content.Shared.Body.Mechanism } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Shared/Chemistry/Solution/Components/SharedSolutionContainerComponent.cs b/Content.Shared/Chemistry/Solution/Components/SharedSolutionContainerComponent.cs index ec64402c0e..f14d91eeac 100644 --- a/Content.Shared/Chemistry/Solution/Components/SharedSolutionContainerComponent.cs +++ b/Content.Shared/Chemistry/Solution/Components/SharedSolutionContainerComponent.cs @@ -71,7 +71,7 @@ namespace Content.Shared.Chemistry.Solution.Components public bool CanRefill => Capabilities.HasCap(SolutionContainerCaps.Refillable); public bool CanDrain => Capabilities.HasCap(SolutionContainerCaps.Drainable); - public override void Initialize() + protected override void Initialize() { base.Initialize(); UpdateAppearance(); diff --git a/Content.Shared/Damage/Components/DamageableComponent.cs b/Content.Shared/Damage/Components/DamageableComponent.cs index 8c76135f24..73acfab3ab 100644 --- a/Content.Shared/Damage/Components/DamageableComponent.cs +++ b/Content.Shared/Damage/Components/DamageableComponent.cs @@ -63,7 +63,7 @@ namespace Content.Shared.Damage.Components return SupportedTypes.Contains(type); } - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Shared/Inventory/SharedInventoryComponent.cs b/Content.Shared/Inventory/SharedInventoryComponent.cs index 43ffa77157..87f824f62d 100644 --- a/Content.Shared/Inventory/SharedInventoryComponent.cs +++ b/Content.Shared/Inventory/SharedInventoryComponent.cs @@ -28,7 +28,7 @@ namespace Content.Shared.Inventory [DataField("Template")] private string _templateName = "HumanInventory"; //stored for serialization purposes - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/Content.Shared/MobState/State/SharedMobStateComponent.cs b/Content.Shared/MobState/State/SharedMobStateComponent.cs index 3066bf5b73..c9bfe76b69 100644 --- a/Content.Shared/MobState/State/SharedMobStateComponent.cs +++ b/Content.Shared/MobState/State/SharedMobStateComponent.cs @@ -58,7 +58,7 @@ namespace Content.Shared.MobState.State } } - public override void OnRemove() + protected override void OnRemove() { if (Owner.TryGetComponent(out SharedAlertsComponent? status)) { diff --git a/Content.Shared/Movement/Components/SharedPlayerInputMoverComponent.cs b/Content.Shared/Movement/Components/SharedPlayerInputMoverComponent.cs index 8cf0f6cebf..bef136a2d2 100644 --- a/Content.Shared/Movement/Components/SharedPlayerInputMoverComponent.cs +++ b/Content.Shared/Movement/Components/SharedPlayerInputMoverComponent.cs @@ -114,7 +114,7 @@ namespace Content.Shared.Movement.Components public bool DiagonalMovementEnabled => _configurationManager.GetCVar(CCVars.GameDiagonalMovement); /// - public override void Initialize() + protected override void Initialize() { base.Initialize(); Owner.EnsureComponentWarn(); diff --git a/Content.Shared/Movement/Components/SharedPlayerMobMoverComponent.cs b/Content.Shared/Movement/Components/SharedPlayerMobMoverComponent.cs index 4188b70580..6f51f4f20c 100644 --- a/Content.Shared/Movement/Components/SharedPlayerMobMoverComponent.cs +++ b/Content.Shared/Movement/Components/SharedPlayerMobMoverComponent.cs @@ -83,7 +83,7 @@ namespace Content.Shared.Movement.Components } } - public override void Initialize() + protected override void Initialize() { base.Initialize(); if (!Owner.HasComponent()) diff --git a/Content.Shared/Portal/Components/SharedPortalComponent.cs b/Content.Shared/Portal/Components/SharedPortalComponent.cs index 88f167f735..eaad2fe7d1 100644 --- a/Content.Shared/Portal/Components/SharedPortalComponent.cs +++ b/Content.Shared/Portal/Components/SharedPortalComponent.cs @@ -10,7 +10,7 @@ namespace Content.Shared.Portal.Components { public override string Name => "Portal"; - public override void OnAdd() + protected override void OnAdd() { base.OnAdd(); diff --git a/Content.Shared/Pulling/Components/SharedPullableComponent.cs b/Content.Shared/Pulling/Components/SharedPullableComponent.cs index 22180840c2..0ed2464601 100644 --- a/Content.Shared/Pulling/Components/SharedPullableComponent.cs +++ b/Content.Shared/Pulling/Components/SharedPullableComponent.cs @@ -354,7 +354,7 @@ namespace Content.Shared.Pulling.Components } } - public override void OnRemove() + protected override void OnRemove() { TryStopPull(); MovingTo = null; diff --git a/Content.Shared/Pulling/Components/SharedPullerComponent.cs b/Content.Shared/Pulling/Components/SharedPullerComponent.cs index a006e1706e..83902e42c2 100644 --- a/Content.Shared/Pulling/Components/SharedPullerComponent.cs +++ b/Content.Shared/Pulling/Components/SharedPullerComponent.cs @@ -37,7 +37,7 @@ namespace Content.Shared.Pulling.Components } } - public override void OnRemove() + protected override void OnRemove() { if (Pulling != null && Pulling.TryGetComponent(out SharedPullableComponent? pullable)) diff --git a/Content.Shared/SubFloor/SubFloorHideSystem.cs b/Content.Shared/SubFloor/SubFloorHideSystem.cs index a3c4342c54..6b63950a59 100644 --- a/Content.Shared/SubFloor/SubFloorHideSystem.cs +++ b/Content.Shared/SubFloor/SubFloorHideSystem.cs @@ -54,7 +54,7 @@ namespace Content.Shared.SubFloor SubscribeLocalEvent(OnSubFloorStarted); SubscribeLocalEvent(OnSubFloorTerminating); - SubscribeLocalEvent(OnSnapGridPositionChanged); + SubscribeLocalEvent(HandleAnchorChanged); } public override void Shutdown() @@ -75,11 +75,13 @@ namespace Content.Shared.SubFloor UpdateEntity(uid); } - private void OnSnapGridPositionChanged(EntityUid uid, SubFloorHideComponent component, SnapGridPositionChangedEvent ev) + private void HandleAnchorChanged(EntityUid uid, SubFloorHideComponent component, AnchorStateChangedEvent args) { + var transform = ComponentManager.GetComponent(uid); + // We do this directly instead of calling UpdateEntity. - if(_mapManager.TryGetGrid(ev.NewGrid, out var grid)) - UpdateTile(grid, ev.Position); + if(_mapManager.TryGetGrid(transform.GridID, out var grid)) + UpdateTile(grid, grid.TileIndicesFor(transform.Coordinates)); } private void MapManagerOnTileChanged(object? sender, TileChangedEventArgs e) diff --git a/Content.Shared/Tag/TagComponent.cs b/Content.Shared/Tag/TagComponent.cs index b1b0dcae73..6bf08db2f7 100644 --- a/Content.Shared/Tag/TagComponent.cs +++ b/Content.Shared/Tag/TagComponent.cs @@ -23,7 +23,7 @@ namespace Content.Shared.Tag public IReadOnlySet Tags => _tags; - public override void Initialize() + protected override void Initialize() { base.Initialize(); diff --git a/RobustToolbox b/RobustToolbox index 40586a8f0e..713f702064 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 40586a8f0e5569151ba6d59bef8437562b8aee6d +Subproject commit 713f702064dd529a11ff3a75c2eaac2056d7466e