diff --git a/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs b/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs index b05f273265..cef74aa386 100644 --- a/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs +++ b/Content.IntegrationTests/Tests/Interaction/Click/InteractionSystemTests.cs @@ -63,11 +63,11 @@ namespace Content.IntegrationTests.Tests.Interaction.Click await server.WaitAssertion(() => { user = sEntities.SpawnEntity(null, coords); - user.EnsureComponent(); + sEntities.EnsureComponent(user); handSys.AddHand(user, "hand", HandLocation.Left); target = sEntities.SpawnEntity(null, coords); item = sEntities.SpawnEntity(null, coords); - item.EnsureComponent(); + sEntities.EnsureComponent(item); }); await server.WaitRunTicks(1); @@ -134,11 +134,11 @@ namespace Content.IntegrationTests.Tests.Interaction.Click await server.WaitAssertion(() => { user = sEntities.SpawnEntity(null, coords); - user.EnsureComponent(); + sEntities.EnsureComponent(user); handSys.AddHand(user, "hand", HandLocation.Left); target = sEntities.SpawnEntity(null, new MapCoordinates(new Vector2(1.9f, 0), mapId)); item = sEntities.SpawnEntity(null, coords); - item.EnsureComponent(); + sEntities.EnsureComponent(item); wall = sEntities.SpawnEntity("DummyDebugWall", new MapCoordinates(new Vector2(1, 0), sEntities.GetComponent(user).MapID)); }); @@ -204,11 +204,11 @@ namespace Content.IntegrationTests.Tests.Interaction.Click await server.WaitAssertion(() => { user = sEntities.SpawnEntity(null, coords); - user.EnsureComponent(); + sEntities.EnsureComponent(user); handSys.AddHand(user, "hand", HandLocation.Left); target = sEntities.SpawnEntity(null, new MapCoordinates(new Vector2(SharedInteractionSystem.InteractionRange - 0.1f, 0), mapId)); item = sEntities.SpawnEntity(null, coords); - item.EnsureComponent(); + sEntities.EnsureComponent(item); }); await server.WaitRunTicks(1); @@ -274,11 +274,11 @@ namespace Content.IntegrationTests.Tests.Interaction.Click await server.WaitAssertion(() => { user = sEntities.SpawnEntity(null, coords); - user.EnsureComponent(); + sEntities.EnsureComponent(user); handSys.AddHand(user, "hand", HandLocation.Left); target = sEntities.SpawnEntity(null, new MapCoordinates(new Vector2(SharedInteractionSystem.InteractionRange + 0.01f, 0), mapId)); item = sEntities.SpawnEntity(null, coords); - item.EnsureComponent(); + sEntities.EnsureComponent(item); }); await server.WaitRunTicks(1); @@ -346,11 +346,11 @@ namespace Content.IntegrationTests.Tests.Interaction.Click await server.WaitAssertion(() => { user = sEntities.SpawnEntity(null, coords); - user.EnsureComponent(); + sEntities.EnsureComponent(user); handSys.AddHand(user, "hand", HandLocation.Left); target = sEntities.SpawnEntity(null, coords); item = sEntities.SpawnEntity(null, coords); - item.EnsureComponent(); + sEntities.EnsureComponent(item); containerEntity = sEntities.SpawnEntity(null, coords); container = conSystem.EnsureContainer(containerEntity, "InteractionTestContainer"); }); diff --git a/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs b/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs index 9848463e3f..666a90ce73 100644 --- a/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/SolutionInjectOnCollideSystem.cs @@ -22,16 +22,9 @@ namespace Content.Server.Chemistry.EntitySystems public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(HandleInit); SubscribeLocalEvent(HandleInjection); } - private void HandleInit(EntityUid uid, SolutionInjectOnCollideComponent component, ComponentInit args) - { - component.Owner - .EnsureComponentWarn($"{nameof(SolutionInjectOnCollideComponent)} requires a SolutionContainerManager on {component.Owner}!"); - } - private void HandleInjection(EntityUid uid, SolutionInjectOnCollideComponent component, ref StartCollideEvent args) { var target = args.OtherEntity; diff --git a/Content.Server/Ghost/Roles/GhostRoleSystem.cs b/Content.Server/Ghost/Roles/GhostRoleSystem.cs index 98a62d3970..671b91392c 100644 --- a/Content.Server/Ghost/Roles/GhostRoleSystem.cs +++ b/Content.Server/Ghost/Roles/GhostRoleSystem.cs @@ -343,7 +343,7 @@ namespace Content.Server.Ghost.Roles if (ghostRole.MakeSentient) MakeSentientCommand.MakeSentient(mob, EntityManager, ghostRole.AllowMovement, ghostRole.AllowSpeech); - mob.EnsureComponent(); + EnsureComp(mob); GhostRoleInternalCreateMindAndTransfer(args.Player, uid, mob, ghostRole); diff --git a/Content.Server/Tabletop/TabletopSystem.Session.cs b/Content.Server/Tabletop/TabletopSystem.Session.cs index ef96733a12..e9dea0c66a 100644 --- a/Content.Server/Tabletop/TabletopSystem.Session.cs +++ b/Content.Server/Tabletop/TabletopSystem.Session.cs @@ -81,7 +81,7 @@ namespace Content.Server.Tabletop CloseSessionFor(player, gamer.Tabletop, false); // Set the entity as an absolute GAMER. - attachedEntity.EnsureComponent().Tabletop = uid; + EnsureComp(attachedEntity).Tabletop = uid; // Create a camera for the gamer to use var camera = CreateCamera(tabletop, player); @@ -139,7 +139,7 @@ namespace Content.Server.Tabletop var camera = EntityManager.SpawnEntity(null, session.Position.Offset(offset)); // Add an eye component and disable FOV - var eyeComponent = camera.EnsureComponent(); + var eyeComponent = EnsureComp(camera); _eye.SetDrawFov(camera, false, eyeComponent); _eye.SetZoom(camera, tabletop.CameraZoom, eyeComponent); diff --git a/Content.Shared/Singularity/Components/SingularityDistortionComponent.cs b/Content.Shared/Singularity/Components/SingularityDistortionComponent.cs index 73313661de..1382dd45f4 100644 --- a/Content.Shared/Singularity/Components/SingularityDistortionComponent.cs +++ b/Content.Shared/Singularity/Components/SingularityDistortionComponent.cs @@ -1,31 +1,17 @@ +using Content.Shared.Singularity.EntitySystems; using Robust.Shared.GameStates; -using Robust.Shared.Serialization; namespace Content.Shared.Singularity.Components { [RegisterComponent, NetworkedComponent] [AutoGenerateComponentState] + [Access(typeof(SharedSingularitySystem))] public sealed partial class SingularityDistortionComponent : Component { - // TODO: use access and remove this funny stuff - [DataField("intensity")] - private float _intensity = 31.25f; + [DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)] + public float Intensity = 31.25f; - [DataField("falloffPower")] - private float _falloffPower = MathF.Sqrt(2f); - - [ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] - public float Intensity - { - get => _intensity; - set => this.SetAndDirtyIfChanged(ref _intensity, value); - } - - [ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] - public float FalloffPower - { - get => _falloffPower; - set => this.SetAndDirtyIfChanged(ref _falloffPower, value); - } + [DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)] + public float FalloffPower = MathF.Sqrt(2f); } } diff --git a/Content.Shared/Singularity/EntitySystems/SharedSingularitySystem.cs b/Content.Shared/Singularity/EntitySystems/SharedSingularitySystem.cs index 56be197e1d..2ea40308b9 100644 --- a/Content.Shared/Singularity/EntitySystems/SharedSingularitySystem.cs +++ b/Content.Shared/Singularity/EntitySystems/SharedSingularitySystem.cs @@ -312,6 +312,7 @@ public abstract class SharedSingularitySystem : EntitySystem comp.FalloffPower = newFalloffPower; comp.Intensity = newIntensity; + Dirty(uid, comp); } ///