diff --git a/Content.Client/GameObjects/Components/Atmos/AtmosPlaqueVisualizer.cs b/Content.Client/GameObjects/Components/Atmos/AtmosPlaqueVisualizer.cs new file mode 100644 index 0000000000..93c0413f5a --- /dev/null +++ b/Content.Client/GameObjects/Components/Atmos/AtmosPlaqueVisualizer.cs @@ -0,0 +1,37 @@ +using Content.Shared.GameObjects.Components.Atmos; +using JetBrains.Annotations; +using Robust.Client.GameObjects; +using Robust.Shared.GameObjects; +using Robust.Shared.Serialization.Manager.Attributes; + +namespace Content.Client.GameObjects.Components.Atmos +{ + [UsedImplicitly] + public class AtmosPlaqueVisualizer : AppearanceVisualizer + { + [field: DataField("layer")] + private int Layer { get; } + + public override void InitializeEntity(IEntity entity) + { + base.InitializeEntity(entity); + + entity.GetComponentOrNull()?.LayerMapReserveBlank(Layer); + } + + public override void OnChangeData(AppearanceComponent component) + { + base.OnChangeData(component); + + if (!component.Owner.TryGetComponent(out SpriteComponent? sprite)) + { + return; + } + + if (!component.TryGetData(AtmosPlaqueVisuals.State, out string state)) + { + sprite.LayerSetState(Layer, state); + } + } + } +} diff --git a/Content.Client/GameObjects/Components/Kitchen/MicrowaveBoundUserInterface.cs b/Content.Client/GameObjects/Components/Kitchen/MicrowaveBoundUserInterface.cs index 60445684e7..a95db5e44b 100644 --- a/Content.Client/GameObjects/Components/Kitchen/MicrowaveBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Kitchen/MicrowaveBoundUserInterface.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using Content.Shared.Chemistry; using Content.Shared.Kitchen; @@ -90,7 +90,7 @@ namespace Content.Client.GameObjects.Components.Kitchen var currentlySelectedTimeButton = (Button) _menu.CookTimeButtonVbox.GetChild(cState.ActiveButtonIndex); currentlySelectedTimeButton.Pressed = true; var label = cState.ActiveButtonIndex <= 0 ? Loc.GetString("INSTANT") : cState.CurrentCookTime.ToString(); - _menu._cookTimeInfoLabel.Text = $"{Loc.GetString("COOK TIME")}: {label}"; + _menu.CookTimeInfoLabel.Text = $"{Loc.GetString("COOK TIME")}: {label}"; } } @@ -173,7 +173,7 @@ namespace Content.Client.GameObjects.Components.Kitchen public ItemList IngredientsList { get; } public ItemList IngredientsListReagents { get; } - public Label _cookTimeInfoLabel { get; } + public Label CookTimeInfoLabel { get; } public MicrowaveMenu(MicrowaveBoundUserInterface owner) { @@ -283,7 +283,7 @@ namespace Content.Client.GameObjects.Components.Kitchen var cookTimeOneSecondButton = (Button) CookTimeButtonVbox.GetChild(0); cookTimeOneSecondButton.Pressed = true; - _cookTimeInfoLabel = new Label + CookTimeInfoLabel = new Label { Text = Loc.GetString("COOK TIME: 1"), Align = Label.AlignMode.Center, @@ -310,7 +310,7 @@ namespace Content.Client.GameObjects.Components.Kitchen Children = { - _cookTimeInfoLabel + CookTimeInfoLabel } }, diff --git a/Content.Client/GameObjects/Components/MachineLinking/SignalSwitchVisualizer.cs b/Content.Client/GameObjects/Components/MachineLinking/SignalSwitchVisualizer.cs new file mode 100644 index 0000000000..bbec78b277 --- /dev/null +++ b/Content.Client/GameObjects/Components/MachineLinking/SignalSwitchVisualizer.cs @@ -0,0 +1,42 @@ +using Content.Shared.GameObjects.Components.MachineLinking; +using JetBrains.Annotations; +using Robust.Client.GameObjects; +using Robust.Shared.GameObjects; +using Robust.Shared.Serialization.Manager.Attributes; + +namespace Content.Client.GameObjects.Components.MachineLinking +{ + [UsedImplicitly] + public class SignalSwitchVisualizer : AppearanceVisualizer + { + [field: DataField("layer")] + private int Layer { get; } + + public override void InitializeEntity(IEntity entity) + { + base.InitializeEntity(entity); + + if (entity.TryGetComponent(out SpriteComponent? sprite)) + { + sprite.LayerMapReserveBlank(Layer); + } + } + + public override void OnChangeData(AppearanceComponent component) + { + base.OnChangeData(component); + + if (!component.Owner.TryGetComponent(out SpriteComponent? sprite)) + { + return; + } + + if (!component.TryGetData(SignalSwitchVisuals.On, out bool on)) + { + return; + } + + sprite.LayerSetState(0, on ? "on" : "off"); + } + } +} diff --git a/Content.Client/GameObjects/Components/Mining/AsteroidRockVisualizer.cs b/Content.Client/GameObjects/Components/Mining/AsteroidRockVisualizer.cs new file mode 100644 index 0000000000..fa2cc59db7 --- /dev/null +++ b/Content.Client/GameObjects/Components/Mining/AsteroidRockVisualizer.cs @@ -0,0 +1,38 @@ +using Content.Shared.GameObjects.Components.Mining; +using JetBrains.Annotations; +using Robust.Client.GameObjects; +using Robust.Shared.GameObjects; +using Robust.Shared.Serialization.Manager.Attributes; + +namespace Content.Client.GameObjects.Components.Mining +{ + [UsedImplicitly] + public class AsteroidRockVisualizer : AppearanceVisualizer + { + [field: DataField("layer")] + private int Layer { get; } = 0; + + public override void InitializeEntity(IEntity entity) + { + base.InitializeEntity(entity); + + entity.GetComponentOrNull()?.LayerMapReserveBlank(Layer); + } + + public override void OnChangeData(AppearanceComponent component) + { + base.OnChangeData(component); + + if (!component.Owner.TryGetComponent(out SpriteComponent? sprite)) + { + return; + } + + if (component.TryGetData(AsteroidRockVisuals.State, out string state)) + { + sprite.LayerMapReserveBlank(Layer); + sprite.LayerSetState(0, state); + } + } + } +} diff --git a/Content.Client/GameObjects/Components/Singularity/SingularityVisualizer.cs b/Content.Client/GameObjects/Components/Singularity/SingularityVisualizer.cs new file mode 100644 index 0000000000..ffa7115bdb --- /dev/null +++ b/Content.Client/GameObjects/Components/Singularity/SingularityVisualizer.cs @@ -0,0 +1,40 @@ +using Content.Shared.GameObjects.Components.Singularity; +using JetBrains.Annotations; +using Robust.Client.GameObjects; +using Robust.Shared.GameObjects; +using Robust.Shared.Serialization.Manager.Attributes; + +namespace Content.Client.GameObjects.Components.Singularity +{ + [UsedImplicitly] + public class SingularityVisualizer : AppearanceVisualizer + { + [field: DataField("layer")] + private int Layer { get; } = 0; + + public override void InitializeEntity(IEntity entity) + { + base.InitializeEntity(entity); + + entity.GetComponentOrNull()?.LayerMapReserveBlank(Layer); + } + + public override void OnChangeData(AppearanceComponent component) + { + base.OnChangeData(component); + + if (!component.Owner.TryGetComponent(out SpriteComponent? sprite)) + { + return; + } + + if (!component.TryGetData(SingularityVisuals.Level, out int level)) + { + return; + } + + sprite.LayerSetRSI(Layer, "Constructible/Power/Singularity/singularity_" + level + ".rsi"); + sprite.LayerSetState(Layer, "singularity_" + level); + } + } +} diff --git a/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs b/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs index 70a0b3e549..fb930cf735 100644 --- a/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs +++ b/Content.IntegrationTests/Tests/ContainerOcclusionTest.cs @@ -1,10 +1,10 @@ -using System; using System.Linq; using System.Threading.Tasks; using Content.Server.GameObjects.Components.Items.Storage; using NUnit.Framework; using Robust.Client.GameObjects; using Robust.Server.Player; +using Robust.Shared; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; @@ -37,15 +37,31 @@ namespace Content.IntegrationTests.Tests private async Task<(ClientIntegrationInstance c, ServerIntegrationInstance s)> Start() { - var optsServer = new ServerIntegrationOptions {ExtraPrototypes = ExtraPrototypes}; - var optsClient = new ClientIntegrationOptions {ExtraPrototypes = ExtraPrototypes}; + var optsServer = new ServerIntegrationOptions + { + CVarOverrides = + { + {CVars.NetPVS.Name, "false"} + }, + ExtraPrototypes = ExtraPrototypes + }; + var optsClient = new ClientIntegrationOptions + { + + CVarOverrides = + { + {CVars.NetPVS.Name, "false"} + }, + ExtraPrototypes = ExtraPrototypes + }; var (c, s) = await StartConnectedServerDummyTickerClientPair(optsClient, optsServer); s.Post(() => { IoCManager.Resolve() - .GetAllPlayers().Single() + .GetAllPlayers() + .Single() .JoinGame(); var mapMan = IoCManager.Resolve(); diff --git a/Content.IntegrationTests/Tests/EntityTest.cs b/Content.IntegrationTests/Tests/EntityTest.cs index eaf805b469..216e630032 100644 --- a/Content.IntegrationTests/Tests/EntityTest.cs +++ b/Content.IntegrationTests/Tests/EntityTest.cs @@ -71,19 +71,22 @@ namespace Content.IntegrationTests.Tests prototypes.Add(prototype); } - //Iterate list of prototypes to spawn - foreach (var prototype in prototypes) + Assert.Multiple(() => { - Assert.DoesNotThrow(() => - { - Logger.LogS(LogLevel.Debug, "EntityTest", $"Testing: {prototype.ID}"); - testEntity = entityMan.SpawnEntity(prototype.ID, testLocation); - server.RunTicks(2); - Assert.That(testEntity.Initialized); - entityMan.DeleteEntity(testEntity.Uid); - }, "Entity '{0}' threw an exception.", - prototype.ID); - } + //Iterate list of prototypes to spawn + foreach (var prototype in prototypes) + { + Assert.DoesNotThrow(() => + { + Logger.LogS(LogLevel.Debug, "EntityTest", $"Testing: {prototype.ID}"); + testEntity = entityMan.SpawnEntity(prototype.ID, testLocation); + server.RunTicks(2); + Assert.That(testEntity.Initialized); + entityMan.DeleteEntity(testEntity.Uid); + }, "Entity '{0}' threw an exception.", + prototype.ID); + } + }); }); await server.WaitIdleAsync(); @@ -106,7 +109,11 @@ namespace Content.IntegrationTests.Tests - type: entity id: AllComponentsOneToOneDeleteTestEntity"; - var server = StartServerDummyTicker(new ServerContentIntegrationOption {ExtraPrototypes = testEntity}); + var server = StartServerDummyTicker(new ServerContentIntegrationOption + { + ExtraPrototypes = testEntity, + FailureLogLevel = LogLevel.Error + }); await server.WaitIdleAsync(); var mapManager = server.ResolveDependency(); @@ -142,43 +149,46 @@ namespace Content.IntegrationTests.Tests server.Assert(() => { - var testLocation = grid.ToCoordinates(); - - foreach (var type in componentFactory.AllRegisteredTypes) + Assert.Multiple(() => { - var component = (Component) componentFactory.GetComponent(type); + var testLocation = grid.ToCoordinates(); - // If this component is ignored - if (skipComponents.Contains(component.Name)) + foreach (var type in componentFactory.AllRegisteredTypes) { - continue; - } + var component = (Component) componentFactory.GetComponent(type); - var entity = entityManager.SpawnEntity("AllComponentsOneToOneDeleteTestEntity", testLocation); - - Assert.That(entity.Initialized); - - // The component may already exist if it is a mandatory component - // such as MetaData or Transform - if (entity.HasComponent(type)) - { - continue; - } - - component.Owner = entity; - - Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {component.Name}"); - - Assert.DoesNotThrow(() => + // If this component is ignored + if (skipComponents.Contains(component.Name)) { - entityManager.ComponentManager.AddComponent(entity, component); - }, "Component '{0}' threw an exception.", - component.Name); + continue; + } - server.RunTicks(2); + var entity = entityManager.SpawnEntity("AllComponentsOneToOneDeleteTestEntity", testLocation); - entityManager.DeleteEntity(entity.Uid); - } + Assert.That(entity.Initialized); + + // The component may already exist if it is a mandatory component + // such as MetaData or Transform + if (entity.HasComponent(type)) + { + continue; + } + + component.Owner = entity; + + Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {component.Name}"); + + Assert.DoesNotThrow(() => + { + entityManager.ComponentManager.AddComponent(entity, component); + }, "Component '{0}' threw an exception.", + component.Name); + + server.RunTicks(2); + + entityManager.DeleteEntity(entity.Uid); + } + }); }); await server.WaitIdleAsync(); @@ -201,7 +211,11 @@ namespace Content.IntegrationTests.Tests - type: entity id: AllComponentsOneEntityDeleteTestEntity"; - var server = StartServerDummyTicker(new ServerContentIntegrationOption {ExtraPrototypes = testEntity}); + var server = StartServerDummyTicker(new ServerContentIntegrationOption + { + ExtraPrototypes = testEntity, + FailureLogLevel = LogLevel.Error + }); await server.WaitIdleAsync(); var mapManager = server.ResolveDependency(); @@ -271,44 +285,46 @@ namespace Content.IntegrationTests.Tests server.Assert(() => { - foreach (var distinct in distinctComponents) + Assert.Multiple(() => { - var testLocation = grid.ToCoordinates(); - var entity = entityManager.SpawnEntity("AllComponentsOneEntityDeleteTestEntity", testLocation); - - Assert.That(entity.Initialized); - - foreach (var type in distinct.components) + foreach (var distinct in distinctComponents) { - var component = (Component) componentFactory.GetComponent(type); + var testLocation = grid.ToCoordinates(); + var entity = entityManager.SpawnEntity("AllComponentsOneEntityDeleteTestEntity", testLocation); - // If the entity already has this component, if it was ensured or added by another - if (entity.HasComponent(component.GetType())) + Assert.That(entity.Initialized); + + foreach (var type in distinct.components) { - continue; - } + var component = (Component) componentFactory.GetComponent(type); - // If this component is ignored - if (skipComponents.Contains(component.Name)) - { - continue; - } - - component.Owner = entity; - - Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {component.Name}"); - - Assert.DoesNotThrow(() => + // If the entity already has this component, if it was ensured or added by another + if (entity.HasComponent(component.GetType())) { - entityManager.ComponentManager.AddComponent(entity, component); - }, "Component '{0}' threw an exception.", - component.Name); + continue; + } + + // If this component is ignored + if (skipComponents.Contains(component.Name)) + { + continue; + } + + component.Owner = entity; + + Logger.LogS(LogLevel.Debug, "EntityTest", $"Adding component: {component.Name}"); + + Assert.DoesNotThrow(() => + { + entityManager.ComponentManager.AddComponent(entity, component); + }, "Component '{0}' threw an exception.", + component.Name); + } + + server.RunTicks(2); + entityManager.DeleteEntity(entity.Uid); } - - server.RunTicks(2); - - entityManager.DeleteEntity(entity.Uid); - } + }); }); await server.WaitIdleAsync(); diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs index 25a664674f..34500424c0 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/Movement/ClimbUnitTest.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System.Threading.Tasks; using Content.Server.GameObjects.Components.Movement; diff --git a/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs b/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs index 80694f79b8..3708c0abe0 100644 --- a/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs +++ b/Content.IntegrationTests/Tests/Networking/SimplePredictReconcileTest.cs @@ -8,6 +8,7 @@ using NUnit.Framework; using Robust.Client.GameObjects; using Robust.Client.GameStates; using Robust.Server.Player; +using Robust.Shared; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Map; @@ -43,7 +44,11 @@ namespace Content.IntegrationTests.Tests.Networking // This test is designed around specific timing values and when I wrote it interpolation was off. // As such, I would have to update half this test to make sure it works with interpolation. // I'm kinda lazy. - CVarOverrides = {{"net.interp", "false"}}, + CVarOverrides = + { + {CVars.NetInterp.Name, "false"}, + {CVars.NetPVS.Name, "false"} + }, ContentBeforeIoC = () => { IoCManager.Resolve().LoadExtraSystemType(); @@ -52,6 +57,10 @@ namespace Content.IntegrationTests.Tests.Networking }, new ServerContentIntegrationOption { + CVarOverrides = + { + {CVars.NetPVS.Name, "false"} + }, ContentBeforeIoC = () => { IoCManager.Resolve().LoadExtraSystemType(); diff --git a/Content.IntegrationTests/Tests/PowerTest.cs b/Content.IntegrationTests/Tests/PowerTest.cs index 7d99b87f89..bc710ea8ef 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.Physics; namespace Content.IntegrationTests.Tests { @@ -89,6 +90,12 @@ namespace Content.IntegrationTests.Tests nodeGroupID: Apc - type: SnapGrid offset: Center + - type: UserInterface + interfaces: + - key: enum.ApcUiKey.Key + type: ApcBoundUserInterface + - type: AccessReader + access: [['Engineering']] - type: entity name: ApcExtensionCableDummy @@ -138,7 +145,7 @@ namespace Content.IntegrationTests.Tests if (generatorEnt.TryGetComponent(out PhysicsComponent? physics)) { - physics.Anchored = true; + physics.BodyType = BodyType.Static; } supplier = generatorEnt.GetComponent(); diff --git a/Content.IntegrationTests/Tests/SaveLoadMapTest.cs b/Content.IntegrationTests/Tests/SaveLoadMapTest.cs index a5c56e29aa..0769aca59c 100644 --- a/Content.IntegrationTests/Tests/SaveLoadMapTest.cs +++ b/Content.IntegrationTests/Tests/SaveLoadMapTest.cs @@ -4,6 +4,7 @@ using Robust.Server.Maps; using Robust.Shared.ContentPack; using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Log; using Robust.Shared.Map; using Robust.Shared.Maths; using Robust.Shared.Utility; @@ -18,7 +19,10 @@ namespace Content.IntegrationTests.Tests { const string mapPath = @"/Maps/Test/TestMap.yml"; - var server = StartServer(); + var server = StartServer(new ServerContentIntegrationOption + { + FailureLogLevel = LogLevel.Error + }); await server.WaitIdleAsync(); var mapLoader = server.ResolveDependency(); var mapManager = server.ResolveDependency(); diff --git a/Content.Server/Commands/GameTicking/FixRotationsCommand.cs b/Content.Server/Commands/GameTicking/FixRotationsCommand.cs index 54329f1227..c2b8c6edc6 100644 --- a/Content.Server/Commands/GameTicking/FixRotationsCommand.cs +++ b/Content.Server/Commands/GameTicking/FixRotationsCommand.cs @@ -1,4 +1,4 @@ -using Content.Server.Administration; +using Content.Server.Administration; using Content.Shared.GameObjects.Components; using Content.Server.GameObjects.Components; using Content.Shared.Administration; @@ -83,9 +83,9 @@ namespace Content.Server.Commands.GameTicking continue; } - if (childEntity.Transform.LocalRotation != Angle.South) + if (childEntity.Transform.LocalRotation != Angle.Zero) { - childEntity.Transform.LocalRotation = Angle.South; + childEntity.Transform.LocalRotation = Angle.Zero; changed++; } } diff --git a/Content.Server/Commands/SetAnchorCommand.cs b/Content.Server/Commands/SetAnchorCommand.cs index c605039fe3..94b7215503 100644 --- a/Content.Server/Commands/SetAnchorCommand.cs +++ b/Content.Server/Commands/SetAnchorCommand.cs @@ -1,9 +1,11 @@ #nullable enable using Content.Server.Administration; +using Content.Server.GameObjects.Components; using Content.Shared.Administration; using Robust.Shared.Console; using Robust.Shared.GameObjects; using Robust.Shared.IoC; +using Robust.Shared.Physics; namespace Content.Server.Commands { @@ -13,7 +15,7 @@ namespace Content.Server.Commands public string Command => "setanchor"; public string Description => "Sets the anchoring state of an entity."; public string Help => "setanchor "; - public void Execute(IConsoleShell shell, string argStr, string[] args) + public async void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length == 0 || args.Length > 2) { @@ -31,7 +33,7 @@ namespace Content.Server.Commands var entityManager = IoCManager.Resolve(); - if (!entityManager.TryGetEntity(entId, out var entity) || entity.Deleted || !entity.TryGetComponent(out PhysicsComponent? physics)) + if (!entityManager.TryGetEntity(entId, out var entity) || entity.Deleted || !entity.TryGetComponent(out AnchorableComponent? anchorable)) { shell.WriteLine("Invalid entity specified!"); return; @@ -45,11 +47,14 @@ namespace Content.Server.Commands return; } - physics.Anchored = value; + if (value) + await anchorable.TryAnchor(default, force: true); + else + await anchorable.TryUnAnchor(default, force: true); return; } - physics.Anchored = !physics.Anchored; + await anchorable.TryToggleAnchor(default, force: true); } } } diff --git a/Content.Server/Database/ServerDbBase.cs b/Content.Server/Database/ServerDbBase.cs index 263988a537..ef048901f2 100644 --- a/Content.Server/Database/ServerDbBase.cs +++ b/Content.Server/Database/ServerDbBase.cs @@ -26,6 +26,7 @@ namespace Content.Server.Database .Preference .Include(p => p.Profiles).ThenInclude(h => h.Jobs) .Include(p => p.Profiles).ThenInclude(h => h.Antags) + .AsSingleQuery() .SingleOrDefaultAsync(p => p.UserId == userId.UserId); if (prefs is null) return null; diff --git a/Content.Server/GameObjects/Components/AnchorableComponent.cs b/Content.Server/GameObjects/Components/AnchorableComponent.cs index af5de39bd7..4c6edc2df0 100644 --- a/Content.Server/GameObjects/Components/AnchorableComponent.cs +++ b/Content.Server/GameObjects/Components/AnchorableComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System; using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; @@ -20,6 +20,8 @@ namespace Content.Server.GameObjects.Components { public override string Name => "Anchorable"; + [ComponentDependency] private PhysicsComponent? _physicsComponent = default!; + [ViewVariables] [DataField("tool")] public ToolQuality Tool { get; private set; } = ToolQuality.Anchoring; @@ -31,6 +33,12 @@ namespace Content.Server.GameObjects.Components [DataField("snap")] public bool Snap { get; private set; } + public override void Initialize() + { + base.Initialize(); + Owner.EnsureComponent(out _physicsComponent); + } + /// /// Checks if a tool can change the anchored status. /// @@ -38,14 +46,14 @@ namespace Content.Server.GameObjects.Components /// The tool being used, can be null if forcing it /// Whether or not to check if the tool is valid /// true if it is valid, false otherwise - private async Task Valid(IEntity user, IEntity? utilizing, [NotNullWhen(true)] bool force = false) + private async Task Valid(IEntity? user, IEntity? utilizing, [NotNullWhen(true)] bool force = false) { if (!Owner.HasComponent()) { return false; } - if (!force) + if (user != null && !force) { if (utilizing == null || !utilizing.TryGetComponent(out ToolComponent? tool) || @@ -65,15 +73,17 @@ namespace Content.Server.GameObjects.Components /// The tool being used, if any /// Whether or not to ignore valid tool checks /// true if anchored, false otherwise - public async Task TryAnchor(IEntity user, IEntity? utilizing = null, bool force = false) + public async Task TryAnchor(IEntity? user, IEntity? utilizing = null, bool force = false) { if (!(await Valid(user, utilizing, force))) { return false; } - var physics = Owner.GetComponent(); - physics.BodyType = BodyType.Static; + if (_physicsComponent == null) + return false; + + _physicsComponent.BodyType = BodyType.Static; // Snap rotation to cardinal (multiple of 90) var rot = Owner.Transform.LocalRotation; @@ -100,15 +110,17 @@ namespace Content.Server.GameObjects.Components /// The tool being used, if any /// Whether or not to ignore valid tool checks /// true if unanchored, false otherwise - public async Task TryUnAnchor(IEntity user, IEntity? utilizing = null, bool force = false) + public async Task TryUnAnchor(IEntity? user, IEntity? utilizing = null, bool force = false) { if (!(await Valid(user, utilizing, force))) { return false; } - var physics = Owner.GetComponent(); - physics.BodyType = BodyType.Dynamic; + if (_physicsComponent == null) + return false; + + _physicsComponent.BodyType = BodyType.Dynamic; return true; } @@ -120,24 +132,16 @@ namespace Content.Server.GameObjects.Components /// The tool being used, if any /// Whether or not to ignore valid tool checks /// true if toggled, false otherwise - private async Task TryToggleAnchor(IEntity user, IEntity? utilizing = null, bool force = false) + public async Task TryToggleAnchor(IEntity? user, IEntity? utilizing = null, bool force = false) { - if (!Owner.TryGetComponent(out IPhysBody? physics)) - { + if (_physicsComponent == null) return false; - } - return physics.BodyType == BodyType.Static ? + return _physicsComponent.BodyType == BodyType.Static ? await TryUnAnchor(user, utilizing, force) : await TryAnchor(user, utilizing, force); } - public override void Initialize() - { - base.Initialize(); - Owner.EnsureComponent(); - } - async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { return await TryToggleAnchor(eventArgs.User, eventArgs.Using); diff --git a/Content.Server/GameObjects/Components/Atmos/Piping/GasCanisterPortComponent.cs b/Content.Server/GameObjects/Components/Atmos/Piping/GasCanisterPortComponent.cs index 03392c1846..315bebea6a 100644 --- a/Content.Server/GameObjects/Components/Atmos/Piping/GasCanisterPortComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/Piping/GasCanisterPortComponent.cs @@ -1,10 +1,10 @@ #nullable enable +using System.Linq; using Content.Server.GameObjects.Components.NodeContainer; using Content.Server.GameObjects.Components.NodeContainer.Nodes; using Robust.Shared.GameObjects; using Robust.Shared.Log; using Robust.Shared.ViewVariables; -using System.Linq; namespace Content.Server.GameObjects.Components.Atmos.Piping { @@ -81,13 +81,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping { if (!Owner.TryGetComponent(out var container)) { - Logger.Error($"{nameof(GasCanisterPortComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}."); + Logger.Warning($"{nameof(GasCanisterPortComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}."); return; } _gasPort = container.Nodes.OfType().FirstOrDefault(); if (_gasPort == null) { - Logger.Error($"{nameof(GasCanisterPortComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); + Logger.Warning($"{nameof(GasCanisterPortComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); return; } } diff --git a/Content.Server/GameObjects/Components/Atmos/Piping/GasFilterComponent.cs b/Content.Server/GameObjects/Components/Atmos/Piping/GasFilterComponent.cs index 37d815736e..d442f6807b 100644 --- a/Content.Server/GameObjects/Components/Atmos/Piping/GasFilterComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/Piping/GasFilterComponent.cs @@ -150,7 +150,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping if (!Owner.TryGetComponent(out var container)) { - Logger.Error($"{typeof(GasFilterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}."); + Logger.Warning($"{typeof(GasFilterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}."); return; } @@ -162,7 +162,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping if (_inletPipe == null || _filterOutletPipe == null || _outletPipe == null) { - Logger.Error($"{nameof(GasFilterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); + Logger.Warning($"{nameof(GasFilterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); return; } } diff --git a/Content.Server/GameObjects/Components/Atmos/Piping/GasGeneratorComponent.cs b/Content.Server/GameObjects/Components/Atmos/Piping/GasGeneratorComponent.cs index c8d9de799f..e10f44a496 100644 --- a/Content.Server/GameObjects/Components/Atmos/Piping/GasGeneratorComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/Piping/GasGeneratorComponent.cs @@ -85,13 +85,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping { if (!Owner.TryGetComponent(out var container)) { - Logger.Error($"{nameof(GasGeneratorComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}."); + Logger.Warning($"{nameof(GasGeneratorComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}."); return; } Pipe = container.Nodes.OfType().FirstOrDefault(); if (Pipe == null) { - Logger.Error($"{nameof(GasGeneratorComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); + Logger.Warning($"{nameof(GasGeneratorComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); return; } } diff --git a/Content.Server/GameObjects/Components/Atmos/Piping/PipeHeaterComponent.cs b/Content.Server/GameObjects/Components/Atmos/Piping/PipeHeaterComponent.cs index 234c9ac7cc..eada074075 100644 --- a/Content.Server/GameObjects/Components/Atmos/Piping/PipeHeaterComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/Piping/PipeHeaterComponent.cs @@ -1,10 +1,10 @@ #nullable enable +using System.Linq; using Content.Server.GameObjects.Components.NodeContainer; using Content.Server.GameObjects.Components.NodeContainer.Nodes; using Robust.Shared.GameObjects; using Robust.Shared.Log; using Robust.Shared.ViewVariables; -using System.Linq; namespace Content.Server.GameObjects.Components.Atmos.Piping { @@ -52,13 +52,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping { if (!Owner.TryGetComponent(out var container)) { - Logger.Error($"{nameof(PipeHeaterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}."); + Logger.Warning($"{nameof(PipeHeaterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}."); return; } _heaterPipe = container.Nodes.OfType().FirstOrDefault(); if (_heaterPipe == null) { - Logger.Error($"{nameof(PipeHeaterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); + Logger.Warning($"{nameof(PipeHeaterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); return; } } diff --git a/Content.Server/GameObjects/Components/Atmos/Piping/Pumps/BasePumpComponent.cs b/Content.Server/GameObjects/Components/Atmos/Piping/Pumps/BasePumpComponent.cs index 7b9e5a3258..432c607fd6 100644 --- a/Content.Server/GameObjects/Components/Atmos/Piping/Pumps/BasePumpComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/Piping/Pumps/BasePumpComponent.cs @@ -8,8 +8,6 @@ using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; using Robust.Shared.GameObjects; using Robust.Shared.Log; -using Robust.Shared.Prototypes; -using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; @@ -41,14 +39,14 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps /// Needs to be same as that of a on this entity. /// [ViewVariables] - [DataField("initialInletDirection")] + [DataField("initialInletDirection", required: true)] private PipeDirection _initialInletDirection = PipeDirection.None; /// /// Needs to be same as that of a on this entity. /// [ViewVariables] - [DataField("initialOutletDirection")] + [DataField("initialOutletDirection", required: true)] private PipeDirection _initialOutletDirection = PipeDirection.None; [ViewVariables] @@ -110,7 +108,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps if (!Owner.TryGetComponent(out var container)) { - Logger.Error($"{nameof(BasePumpComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}."); + Logger.Warning($"{nameof(BasePumpComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}."); return; } var pipeNodes = container.Nodes.OfType(); @@ -118,7 +116,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps _outletPipe = pipeNodes.Where(pipe => pipe.PipeDirection == _initialOutletDirection).FirstOrDefault(); if (_inletPipe == null || _outletPipe == null) { - Logger.Error($"{nameof(BasePumpComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); + Logger.Warning($"{nameof(BasePumpComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); return; } } diff --git a/Content.Server/GameObjects/Components/Atmos/Piping/Scrubbers/BaseSiphonComponent.cs b/Content.Server/GameObjects/Components/Atmos/Piping/Scrubbers/BaseSiphonComponent.cs index e6f24f166f..eb3527e6a6 100644 --- a/Content.Server/GameObjects/Components/Atmos/Piping/Scrubbers/BaseSiphonComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/Piping/Scrubbers/BaseSiphonComponent.cs @@ -78,13 +78,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers { if (!Owner.TryGetComponent(out var container)) { - Logger.Error($"{nameof(BaseSiphonComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}."); + Logger.Warning($"{nameof(BaseSiphonComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}."); return; } _scrubberOutlet = container.Nodes.OfType().FirstOrDefault(); if (_scrubberOutlet == null) { - Logger.Error($"{nameof(BaseSiphonComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); + Logger.Warning($"{nameof(BaseSiphonComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); return; } } diff --git a/Content.Server/GameObjects/Components/Atmos/Piping/Vents/BaseVentComponent.cs b/Content.Server/GameObjects/Components/Atmos/Piping/Vents/BaseVentComponent.cs index 2a58dd5284..6215f1dc17 100644 --- a/Content.Server/GameObjects/Components/Atmos/Piping/Vents/BaseVentComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/Piping/Vents/BaseVentComponent.cs @@ -78,13 +78,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents { if (!Owner.TryGetComponent(out var container)) { - Logger.Error($"{nameof(BaseVentComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}."); + Logger.Warning($"{nameof(BaseVentComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}."); return; } _ventInlet = container.Nodes.OfType().FirstOrDefault(); if (_ventInlet == null) { - Logger.Error($"{nameof(BaseVentComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); + Logger.Warning($"{nameof(BaseVentComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}."); return; } } diff --git a/Content.Server/GameObjects/Components/AtmosPlaqueComponent.cs b/Content.Server/GameObjects/Components/AtmosPlaqueComponent.cs index c6af05b98a..abbdef74ee 100644 --- a/Content.Server/GameObjects/Components/AtmosPlaqueComponent.cs +++ b/Content.Server/GameObjects/Components/AtmosPlaqueComponent.cs @@ -1,3 +1,4 @@ +using Content.Shared.GameObjects.Components.Atmos; using Robust.Server.GameObjects; using Robust.Shared.GameObjects; using Robust.Shared.IoC; @@ -10,9 +11,10 @@ namespace Content.Server.GameObjects.Components [RegisterComponent] public sealed class AtmosPlaqueComponent : Component, IMapInit { + public override string Name => "AtmosPlaque"; + [DataField("plaqueType")] private PlaqueType _type = PlaqueType.Unset; - public override string Name => "AtmosPlaque"; [ViewVariables(VVAccess.ReadWrite)] public PlaqueType Type @@ -82,11 +84,11 @@ namespace Content.Server.GameObjects.Components _ => "Uhm", }; - if (Owner.TryGetComponent(out SpriteComponent? sprite)) + if (Owner.TryGetComponent(out AppearanceComponent? appearance)) { var state = _type == PlaqueType.Zumos ? "zumosplaque" : "atmosplaque"; - sprite.LayerSetState(0, state); + appearance.SetData(AtmosPlaqueVisuals.State, state); } } diff --git a/Content.Server/GameObjects/Components/Botany/ProduceComponent.cs b/Content.Server/GameObjects/Components/Botany/ProduceComponent.cs index 6684f226f9..b5a9fac0fc 100644 --- a/Content.Server/GameObjects/Components/Botany/ProduceComponent.cs +++ b/Content.Server/GameObjects/Components/Botany/ProduceComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using Content.Server.Botany; using Content.Server.GameObjects.Components.Chemistry; using Content.Shared.Chemistry; @@ -16,8 +16,6 @@ namespace Content.Server.GameObjects.Components.Botany [RegisterComponent] public class ProduceComponent : Component, ISerializationHooks { - [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - public override string Name => "Produce"; [DataField("seed")] diff --git a/Content.Server/GameObjects/Components/Botany/SeedComponent.cs b/Content.Server/GameObjects/Components/Botany/SeedComponent.cs index 8fdbee0804..76085183db 100644 --- a/Content.Server/GameObjects/Components/Botany/SeedComponent.cs +++ b/Content.Server/GameObjects/Components/Botany/SeedComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using Content.Server.Botany; using Content.Shared.GameObjects.EntitySystems; using Robust.Shared.GameObjects; @@ -15,8 +15,6 @@ namespace Content.Server.GameObjects.Components.Botany [RegisterComponent] public class SeedComponent : Component, IExamine { - [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - public override string Name => "Seed"; [DataField("seed")] diff --git a/Content.Server/GameObjects/Components/Chemistry/PillComponent.cs b/Content.Server/GameObjects/Components/Chemistry/PillComponent.cs index ebe60b9f7f..46c7fa044d 100644 --- a/Content.Server/GameObjects/Components/Chemistry/PillComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/PillComponent.cs @@ -22,8 +22,6 @@ namespace Content.Server.GameObjects.Components.Chemistry [RegisterComponent] public class PillComponent : FoodComponent, IUse, IAfterInteract { - [Dependency] private readonly IEntitySystemManager _entitySystem = default!; - public override string Name => "Pill"; [ViewVariables] diff --git a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs index af1a685a87..24ef4b2416 100644 --- a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs +++ b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs @@ -18,7 +18,6 @@ using Robust.Shared.Localization; using Robust.Shared.Log; using Robust.Shared.Physics; using Robust.Shared.Prototypes; -using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; @@ -461,7 +460,7 @@ namespace Content.Server.GameObjects.Components.Construction if (string.IsNullOrEmpty(_graphIdentifier)) { - Logger.Error($"Prototype {Owner.Prototype?.ID}'s construction component didn't have a graph identifier!"); + Logger.Warning($"Prototype {Owner.Prototype?.ID}'s construction component didn't have a graph identifier!"); return; } diff --git a/Content.Server/GameObjects/Components/Construction/WelderRefinableComponent.cs b/Content.Server/GameObjects/Components/Construction/WelderRefinableComponent.cs index 68e46f2862..a73bb19907 100644 --- a/Content.Server/GameObjects/Components/Construction/WelderRefinableComponent.cs +++ b/Content.Server/GameObjects/Components/Construction/WelderRefinableComponent.cs @@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Construction public override string Name => "WelderRefinable"; - public async Task InteractUsing(InteractUsingEventArgs eventArgs) + async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { // check if object is welder if (!eventArgs.Using.TryGetComponent(out ToolComponent? tool)) diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs index d20953b59a..ee17f79d5f 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalTaggerComponent.cs @@ -16,6 +16,7 @@ using Robust.Server.GameObjects; using Robust.Server.Player; using Robust.Shared.Player; using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalTaggerComponent; +using Robust.Shared.Physics; namespace Content.Server.GameObjects.Components.Disposal { @@ -32,7 +33,7 @@ namespace Content.Server.GameObjects.Components.Disposal [ViewVariables] public bool Anchored => !Owner.TryGetComponent(out PhysicsComponent? physics) || - physics.Anchored; + physics.BodyType == BodyType.Static; [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalTaggerUiKey.Key); diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalTubeComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalTubeComponent.cs index 8bd528b3e0..f0102384cd 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalTubeComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalTubeComponent.cs @@ -19,6 +19,7 @@ using Robust.Shared.Serialization; using Robust.Shared.Timing; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; +using Robust.Shared.Physics; namespace Content.Server.GameObjects.Components.Disposal { @@ -43,7 +44,7 @@ namespace Content.Server.GameObjects.Components.Disposal [ViewVariables] private bool Anchored => !Owner.TryGetComponent(out PhysicsComponent? physics) || - physics.Anchored; + physics.BodyType == BodyType.Static; /// /// The directions that this tube can connect to others from @@ -196,7 +197,7 @@ namespace Content.Server.GameObjects.Components.Disposal return; } - if (physics.Anchored) + if (physics.BodyType == BodyType.Static) { OnAnchor(); } @@ -230,7 +231,8 @@ namespace Content.Server.GameObjects.Components.Disposal { base.Startup(); - if (!Owner.EnsureComponent().Anchored) + Owner.EnsureComponent(out var physicsComponent); + if (physicsComponent.BodyType != BodyType.Static) { return; } diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs index 90fa7fbc33..3e63cda197 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalUnitComponent.cs @@ -87,7 +87,7 @@ namespace Content.Server.GameObjects.Components.Disposal /// Delay from trying to shove someone else into disposals. /// [ViewVariables(VVAccess.ReadWrite)] - private float _draggedEntryDelay; + private float _draggedEntryDelay = 0.5f; /// /// Token used to cancel the automatic engage of a disposal unit diff --git a/Content.Server/GameObjects/Components/Items/RCD/RCDAmmoComponent.cs b/Content.Server/GameObjects/Components/Items/RCD/RCDAmmoComponent.cs index d20a4377ec..cfcb705e77 100644 --- a/Content.Server/GameObjects/Components/Items/RCD/RCDAmmoComponent.cs +++ b/Content.Server/GameObjects/Components/Items/RCD/RCDAmmoComponent.cs @@ -34,13 +34,13 @@ namespace Content.Server.GameObjects.Components.Items.RCD return false; } - if (rcdComponent.maxAmmo - rcdComponent._ammo < refillAmmo) + if (rcdComponent.MaxAmmo - rcdComponent._ammo < refillAmmo) { rcdComponent.Owner.PopupMessage(eventArgs.User, Loc.GetString("The RCD is full!")); return true; } - rcdComponent._ammo = Math.Min(rcdComponent.maxAmmo, rcdComponent._ammo + refillAmmo); + rcdComponent._ammo = Math.Min(rcdComponent.MaxAmmo, rcdComponent._ammo + refillAmmo); rcdComponent.Owner.PopupMessage(eventArgs.User, Loc.GetString("You refill the RCD.")); //Deleting a held item causes a lot of errors diff --git a/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs b/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs index 129e4b6eea..cc11f684d7 100644 --- a/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs +++ b/Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs @@ -31,10 +31,10 @@ namespace Content.Server.GameObjects.Components.Items.RCD public override string Name => "RCD"; private RcdMode _mode = 0; //What mode are we on? Can be floors, walls, deconstruct. private readonly RcdMode[] _modes = (RcdMode[]) Enum.GetValues(typeof(RcdMode)); - [ViewVariables(VVAccess.ReadWrite)] [DataField("maxAmmo")] public int maxAmmo = 5; + [ViewVariables(VVAccess.ReadWrite)] [DataField("maxAmmo")] public int MaxAmmo = 5; public int _ammo; //How much "ammo" we have left. You can refill this with RCD ammo. [ViewVariables(VVAccess.ReadWrite)] [DataField("delay")] private float _delay = 2f; - private DoAfterSystem doAfterSystem = default!; + private DoAfterSystem _doAfterSystem = default!; ///Enum to store the different mode states for clarity. private enum RcdMode @@ -48,8 +48,8 @@ namespace Content.Server.GameObjects.Components.Items.RCD public override void Initialize() { base.Initialize(); - _ammo = maxAmmo; - doAfterSystem = EntitySystem.Get(); + _ammo = MaxAmmo; + _doAfterSystem = EntitySystem.Get(); } /// @@ -113,7 +113,7 @@ namespace Content.Server.GameObjects.Components.Items.RCD ExtraCheck = () => IsRCDStillValid(eventArgs, mapGrid, tile, snapPos, startingMode) //All of the sanity checks are here }; - var result = await doAfterSystem.DoAfter(doAfterEventArgs); + var result = await _doAfterSystem.DoAfter(doAfterEventArgs); if (result == DoAfterStatus.Cancelled) { return true; @@ -139,7 +139,7 @@ namespace Content.Server.GameObjects.Components.Items.RCD //Walls are a special behaviour, and require us to build a new object with a transform rather than setting a grid tile, thus we early return to avoid the tile set code. case RcdMode.Walls: var ent = _serverEntityManager.SpawnEntity("solid_wall", mapGrid.GridTileToLocal(snapPos)); - ent.Transform.LocalRotation = Angle.South; // Walls always need to point south. + ent.Transform.LocalRotation = Angle.Zero; // Walls always need to point south. break; case RcdMode.Airlock: var airlock = _serverEntityManager.SpawnEntity("Airlock", mapGrid.GridTileToLocal(snapPos)); diff --git a/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs b/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs index c89f435a82..89c1d7a02d 100644 --- a/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs +++ b/Content.Server/GameObjects/Components/Kitchen/MicrowaveComponent.cs @@ -40,7 +40,7 @@ namespace Content.Server.GameObjects.Components.Kitchen #region YAMLSERIALIZE [DataField("cookTime")] - private int _cookTimeDefault = 5; + private uint _cookTimeDefault = 5; [DataField("cookTimeMultiplier")] private int _cookTimeMultiplier = 1000; //For upgrades and stuff I guess? [DataField("failureResult")] @@ -78,6 +78,8 @@ namespace Content.Server.GameObjects.Components.Kitchen { base.Initialize(); + _currentCookTimerTime = _cookTimeDefault; + Owner.EnsureComponent(); _storage = ContainerHelpers.EnsureContainer(Owner, "microwave_entity_container", out var existed); @@ -99,7 +101,7 @@ namespace Content.Server.GameObjects.Components.Kitchen switch (message.Message) { case MicrowaveStartCookMessage msg : - wzhzhzh(); + Wzhzhzh(); break; case MicrowaveEjectMessage msg : if (_hasContents) @@ -251,7 +253,7 @@ namespace Content.Server.GameObjects.Components.Kitchen // ReSharper disable once InconsistentNaming // ReSharper disable once IdentifierTypo - private void wzhzhzh() + private void Wzhzhzh() { if (!_hasContents) { @@ -500,7 +502,7 @@ namespace Content.Server.GameObjects.Components.Kitchen _currentCookTimerTime = 10; ClickSound(); _uiDirty = true; - wzhzhzh(); + Wzhzhzh(); return SuicideKind.Heat; } } diff --git a/Content.Server/GameObjects/Components/MachineLinking/SignalSwitchComponent.cs b/Content.Server/GameObjects/Components/MachineLinking/SignalSwitchComponent.cs index 8c1bd3c9d2..0c9ca69532 100644 --- a/Content.Server/GameObjects/Components/MachineLinking/SignalSwitchComponent.cs +++ b/Content.Server/GameObjects/Components/MachineLinking/SignalSwitchComponent.cs @@ -1,12 +1,11 @@ -using Content.Shared.GameObjects.EntitySystems.ActionBlocker; +using Content.Shared.GameObjects.Components.MachineLinking; +using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using Content.Shared.GameObjects.Verbs; using Content.Shared.Interfaces; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; using Robust.Shared.GameObjects; using Robust.Shared.Localization; -using Robust.Shared.Prototypes; -using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.GameObjects.Components.MachineLinking @@ -56,9 +55,9 @@ namespace Content.Server.GameObjects.Components.MachineLinking private void UpdateSprite() { - if (Owner.TryGetComponent(out var sprite)) + if (Owner.TryGetComponent(out AppearanceComponent? appearance)) { - sprite.LayerSetState(0, _on ? "on" : "off"); + appearance.SetData(SignalSwitchVisuals.On, _on); } } diff --git a/Content.Server/GameObjects/Components/Markers/ConditionalSpawnerComponent.cs b/Content.Server/GameObjects/Components/Markers/ConditionalSpawnerComponent.cs index a52b135989..5a65ddfbce 100644 --- a/Content.Server/GameObjects/Components/Markers/ConditionalSpawnerComponent.cs +++ b/Content.Server/GameObjects/Components/Markers/ConditionalSpawnerComponent.cs @@ -15,7 +15,6 @@ namespace Content.Server.GameObjects.Components.Markers public class ConditionalSpawnerComponent : Component, IMapInit { [Dependency] private readonly IGameTicker _gameTicker = default!; - [Dependency] private readonly IReflectionManager _reflectionManager = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; public override string Name => "ConditionalSpawner"; diff --git a/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs b/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs index 177be613a3..2c0b95a876 100644 --- a/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs +++ b/Content.Server/GameObjects/Components/Metabolism/MetabolismComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System; using System.Collections.Generic; using System.Linq; @@ -27,8 +27,6 @@ namespace Content.Server.GameObjects.Components.Metabolism [RegisterComponent] public class MetabolismComponent : Component { - [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - [ComponentDependency] private readonly IBody? _body = default!; public override string Name => "Metabolism"; diff --git a/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs b/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs index 055a80bea6..b469036177 100644 --- a/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs +++ b/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Content.Server.GameObjects.Components.Weapon.Melee; using Content.Shared.Damage; using Content.Shared.GameObjects.Components.Damage; +using Content.Shared.GameObjects.Components.Mining; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Server.GameObjects; using Robust.Shared.Audio; @@ -24,8 +25,10 @@ namespace Content.Server.GameObjects.Components.Mining { base.Initialize(); - var spriteComponent = Owner.EnsureComponent(); - spriteComponent.LayerSetState(0, _random.Pick(SpriteStates)); + if (Owner.TryGetComponent(out AppearanceComponent? appearance)) + { + appearance.SetData(AsteroidRockVisuals.State, _random.Pick(SpriteStates)); + } } async Task IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) diff --git a/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs b/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs index c312b953a7..81dc7838db 100644 --- a/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using Content.Server.GameObjects.EntitySystems; using Content.Server.Interfaces.GameObjects; using Content.Server.Utility; @@ -22,8 +22,6 @@ namespace Content.Server.GameObjects.Components.Mobs [ComponentReference(typeof(SharedStunnableComponent))] public class StunnableComponent : SharedStunnableComponent, IDisarmedAct { - [Dependency] private readonly IGameTiming _gameTiming = default!; - protected override void OnKnockdown() { EntitySystem.Get().Down(Owner); diff --git a/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs b/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs index 364d3bf803..37d9bce432 100644 --- a/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs @@ -28,8 +28,6 @@ namespace Content.Server.GameObjects.Components.Nutrition [ComponentReference(typeof(IAfterInteract))] public class FoodComponent : Component, IUse, IAfterInteract { - [Dependency] private readonly IEntitySystemManager _entitySystem = default!; - public override string Name => "Food"; [ViewVariables] [DataField("useSound")] protected virtual string? UseSound { get; set; } = "/Audio/Items/eatfood.ogg"; diff --git a/Content.Server/GameObjects/Components/PA/ParticleAcceleratorControlBoxComponent.cs b/Content.Server/GameObjects/Components/PA/ParticleAcceleratorControlBoxComponent.cs index d1d55561f3..30c336f3f5 100644 --- a/Content.Server/GameObjects/Components/PA/ParticleAcceleratorControlBoxComponent.cs +++ b/Content.Server/GameObjects/Components/PA/ParticleAcceleratorControlBoxComponent.cs @@ -44,7 +44,7 @@ namespace Content.Server.GameObjects.Components.PA /// /// Power receiver for the control console itself. /// - [ViewVariables] private PowerReceiverComponent? _powerReceiverComponent; + [ViewVariables] private PowerReceiverComponent _powerReceiverComponent = default!; [ViewVariables] private ParticleAcceleratorFuelChamberComponent? _partFuelChamber; [ViewVariables] private ParticleAcceleratorEndCapComponent? _partEndCap; @@ -104,12 +104,9 @@ namespace Content.Server.GameObjects.Components.PA UserInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage; } - if (!Owner.TryGetComponent(out _powerReceiverComponent)) - { - Logger.Error("ParticleAcceleratorControlBox was created without PowerReceiverComponent"); - return; - } - _powerReceiverComponent.Load = 250; + Owner.EnsureComponent(out _powerReceiverComponent); + + _powerReceiverComponent!.Load = 250; } public override void HandleMessage(ComponentMessage message, IComponent? component) diff --git a/Content.Server/GameObjects/Components/PA/ParticleAcceleratorPartComponent.cs b/Content.Server/GameObjects/Components/PA/ParticleAcceleratorPartComponent.cs index 20bb7e7f1f..b74b9de74b 100644 --- a/Content.Server/GameObjects/Components/PA/ParticleAcceleratorPartComponent.cs +++ b/Content.Server/GameObjects/Components/PA/ParticleAcceleratorPartComponent.cs @@ -15,10 +15,7 @@ namespace Content.Server.GameObjects.Components.PA base.Initialize(); // FIXME: this has to be an entity system, full stop. - if (!Owner.TryGetComponent(out SnapGrid)) - { - Logger.Error("ParticleAcceleratorControlBox was created without SnapGridComponent"); - } + Owner.EnsureComponent(out SnapGrid); } public override void HandleMessage(ComponentMessage message, IComponent? component) diff --git a/Content.Server/GameObjects/Components/PA/ParticleAcceleratorPowerBoxComponent.cs b/Content.Server/GameObjects/Components/PA/ParticleAcceleratorPowerBoxComponent.cs index 4736c34a03..6b9b52cb0c 100644 --- a/Content.Server/GameObjects/Components/PA/ParticleAcceleratorPowerBoxComponent.cs +++ b/Content.Server/GameObjects/Components/PA/ParticleAcceleratorPowerBoxComponent.cs @@ -1,7 +1,6 @@ #nullable enable using Content.Server.GameObjects.Components.Power.PowerNetComponents; using Robust.Shared.GameObjects; -using Robust.Shared.Log; using Robust.Shared.ViewVariables; namespace Content.Server.GameObjects.Components.PA @@ -16,13 +15,9 @@ namespace Content.Server.GameObjects.Components.PA public override void Initialize() { base.Initialize(); - if (Owner.TryGetComponent(out PowerConsumerComponent)) - { - PowerConsumerComponent.OnReceivedPowerChanged += PowerReceivedChanged; - return; - } - Logger.Error($"ParticleAcceleratorPowerBoxComponent Component initialized without PowerConsumerComponent."); + PowerConsumerComponent = Owner.EnsureComponentWarn(); + PowerConsumerComponent.OnReceivedPowerChanged += PowerReceivedChanged; } private void PowerReceivedChanged(object? sender, ReceivedPowerChangedEventArgs e) diff --git a/Content.Server/GameObjects/Components/Power/PowerNetComponents/RadiationCollectorComponent.cs b/Content.Server/GameObjects/Components/Power/PowerNetComponents/RadiationCollectorComponent.cs index de97b82fdf..6fc041c302 100644 --- a/Content.Server/GameObjects/Components/Power/PowerNetComponents/RadiationCollectorComponent.cs +++ b/Content.Server/GameObjects/Components/Power/PowerNetComponents/RadiationCollectorComponent.cs @@ -9,6 +9,7 @@ using Robust.Server.GameObjects; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; +using Robust.Shared.Physics; using Robust.Shared.Timing; namespace Content.Server.GameObjects.Components.Power.PowerNetComponents @@ -37,7 +38,7 @@ namespace Content.Server.GameObjects.Components.Power.PowerNetComponents private void OnAnchoredChanged() { - if(_collidableComponent != null && _collidableComponent.Anchored) + if(_collidableComponent != null && _collidableComponent.BodyType == BodyType.Static) Owner.SnapToGrid(); } diff --git a/Content.Server/GameObjects/Components/Singularity/ContainmentFieldGeneratorComponent.cs b/Content.Server/GameObjects/Components/Singularity/ContainmentFieldGeneratorComponent.cs index 0ed970f06b..66f45fe331 100644 --- a/Content.Server/GameObjects/Components/Singularity/ContainmentFieldGeneratorComponent.cs +++ b/Content.Server/GameObjects/Components/Singularity/ContainmentFieldGeneratorComponent.cs @@ -19,8 +19,6 @@ namespace Content.Server.GameObjects.Components.Singularity [RegisterComponent] public class ContainmentFieldGeneratorComponent : Component, IStartCollide { - [Dependency] private readonly IPhysicsManager _physicsManager = null!; - public override string Name => "ContainmentFieldGenerator"; private int _powerBuffer; @@ -84,7 +82,7 @@ namespace Content.Server.GameObjects.Components.Singularity private void OnAnchoredChanged() { - if(_collidableComponent?.Anchored != true) + if(_collidableComponent?.BodyType != BodyType.Static) { _connection1?.Item2.Dispose(); _connection2?.Item2.Dispose(); @@ -106,7 +104,7 @@ namespace Content.Server.GameObjects.Components.Singularity private bool TryGenerateFieldConnection([NotNullWhen(true)] ref Tuple? propertyFieldTuple) { if (propertyFieldTuple != null) return false; - if(_collidableComponent?.Anchored == false) return false; + if(_collidableComponent?.BodyType != BodyType.Static) return false; foreach (var direction in new[] {Direction.North, Direction.East, Direction.South, Direction.West}) { @@ -135,7 +133,7 @@ namespace Content.Server.GameObjects.Components.Singularity !fieldGeneratorComponent.HasFreeConnections() || IsConnectedWith(fieldGeneratorComponent) || !ent.TryGetComponent(out var collidableComponent) || - !collidableComponent.Anchored) + collidableComponent.BodyType != BodyType.Static) { continue; } diff --git a/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs b/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs index e6d4bc2a22..028f3c219b 100644 --- a/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs +++ b/Content.Server/GameObjects/Components/Singularity/EmitterComponent.cs @@ -17,6 +17,7 @@ using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Log; +using Robust.Shared.Physics; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; @@ -70,11 +71,7 @@ namespace Content.Server.GameObjects.Components.Singularity { base.Initialize(); - if (!Owner.TryGetComponent(out _powerConsumer!)) - { - Logger.Error($"EmitterComponent {Owner} created with no PowerConsumerComponent"); - return; - } + Owner.EnsureComponent(out _powerConsumer); _powerConsumer.OnReceivedPowerChanged += OnReceivedPowerChanged; } @@ -104,7 +101,7 @@ namespace Content.Server.GameObjects.Components.Singularity return; } - if (Owner.TryGetComponent(out PhysicsComponent? phys) && phys.Anchored) + if (Owner.TryGetComponent(out PhysicsComponent? phys) && phys.BodyType == BodyType.Static) { if (!_isOn) { diff --git a/Content.Server/GameObjects/Components/Singularity/ServerSingularityComponent.cs b/Content.Server/GameObjects/Components/Singularity/ServerSingularityComponent.cs index cc9aaca84d..242c162a80 100644 --- a/Content.Server/GameObjects/Components/Singularity/ServerSingularityComponent.cs +++ b/Content.Server/GameObjects/Components/Singularity/ServerSingularityComponent.cs @@ -1,21 +1,19 @@ #nullable enable using System.Linq; using Content.Server.GameObjects.Components.StationEvents; +using Content.Shared.GameObjects.Components.Singularity; +using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameObjects; -using Robust.Shared.Log; using Robust.Shared.Map; using Robust.Shared.Physics; using Robust.Shared.Physics.Collision; -using Robust.Server.GameObjects; -using Content.Shared.GameObjects.Components.Singularity; using Robust.Shared.Physics.Collision.Shapes; using Robust.Shared.Player; using Robust.Shared.Players; using Robust.Shared.Timing; - namespace Content.Server.GameObjects.Components.Singularity { [RegisterComponent] @@ -62,8 +60,10 @@ namespace Content.Server.GameObjects.Components.Singularity if(_radiationPulseComponent != null) _radiationPulseComponent.RadsPerSecond = 10 * value; - _spriteComponent?.LayerSetRSI(0, "Constructible/Power/Singularity/singularity_" + _level + ".rsi"); - _spriteComponent?.LayerSetState(0, "singularity_" + _level); + if (Owner.TryGetComponent(out AppearanceComponent? appearance)) + { + appearance.SetData(SingularityVisuals.Level, _level); + } if (_collidableComponent != null && _collidableComponent.Fixtures.Any() && _collidableComponent.Fixtures[0].Shape is PhysShapeCircle circle) { @@ -87,9 +87,9 @@ namespace Content.Server.GameObjects.Components.Singularity _ => 0 }; - private PhysicsComponent? _collidableComponent; - private SpriteComponent? _spriteComponent; - private RadiationPulseComponent? _radiationPulseComponent; + private PhysicsComponent _collidableComponent = default!; + private RadiationPulseComponent _radiationPulseComponent = default!; + private SpriteComponent _spriteComponent = default!; private IPlayingAudioStream? _playingSound; public override ComponentState GetComponentState(ICommonSession player) @@ -101,6 +101,10 @@ namespace Content.Server.GameObjects.Components.Singularity { base.Initialize(); + Owner.EnsureComponent(out _radiationPulseComponent); + Owner.EnsureComponent(out _collidableComponent); + Owner.EnsureComponent(out _spriteComponent); + var audioParams = AudioParams.Default; audioParams.Loop = true; audioParams.MaxDistance = 20f; @@ -108,14 +112,7 @@ namespace Content.Server.GameObjects.Components.Singularity SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/singularity_form.ogg", Owner); Timer.Spawn(5200,() => _playingSound = SoundSystem.Play(Filter.Pvs(Owner), "/Audio/Effects/singularity.ogg", Owner, audioParams)); - if (!Owner.TryGetComponent(out _spriteComponent)) - Logger.Error("SingularityComponent was spawned without SpriteComponent"); - if (!Owner.TryGetComponent(out _radiationPulseComponent)) - Logger.Error("SingularityComponent was spawned without RadiationPulseComponent"); - if (!Owner.TryGetComponent(out _collidableComponent)) - Logger.Error("SingularityComponent was spawned without CollidableComponent!"); - else - _collidableComponent.Hard = false; + _collidableComponent!.Hard = false; Level = 1; } diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs index 0d629986a1..e16cf9c42d 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs @@ -24,7 +24,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee [RegisterComponent] public class MeleeWeaponComponent : Component, IAttack, IHandSelected { - [Dependency] private readonly IPhysicsManager _physicsManager = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; public override string Name => "MeleeWeapon"; diff --git a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs index 99885ff2ed..7bef2dd87d 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Pathfinding/Accessible/AiReachableSystem.cs @@ -423,6 +423,11 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible /// public PathfindingRegion? GetRegion(IEntity entity) { + if (!entity.Transform.GridID.IsValid()) + { + return null; + } + var entityTile = _mapManager.GetGrid(entity.Transform.GridID).GetTileRef(entity.Transform.Coordinates); var entityNode = _pathfindingSystem.GetNode(entityTile); return GetRegion(entityNode); diff --git a/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs index 23f6b08a4c..a2b04dda14 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs @@ -245,7 +245,10 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering private SteeringStatus Steer(IEntity entity, IAiSteeringRequest steeringRequest, float frameTime) { // Main optimisation to be done below is the redundant calls and adding more variables - if (entity.Deleted || !entity.TryGetComponent(out AiControllerComponent? controller) || !ActionBlockerSystem.CanMove(entity)) + if (entity.Deleted || + !entity.TryGetComponent(out AiControllerComponent? controller) || + !ActionBlockerSystem.CanMove(entity) || + !entity.Transform.GridID.IsValid()) { return SteeringStatus.NoPath; } diff --git a/Content.Shared/GameObjects/Components/Atmos/AtmosPlaqueVisuals.cs b/Content.Shared/GameObjects/Components/Atmos/AtmosPlaqueVisuals.cs new file mode 100644 index 0000000000..c7e088c40f --- /dev/null +++ b/Content.Shared/GameObjects/Components/Atmos/AtmosPlaqueVisuals.cs @@ -0,0 +1,11 @@ +using System; +using Robust.Shared.Serialization; + +namespace Content.Shared.GameObjects.Components.Atmos +{ + [Serializable, NetSerializable] + public enum AtmosPlaqueVisuals + { + State + } +} diff --git a/Content.Shared/GameObjects/Components/MachineLinking/SignalSwitchVisuals.cs b/Content.Shared/GameObjects/Components/MachineLinking/SignalSwitchVisuals.cs new file mode 100644 index 0000000000..3e975f52d8 --- /dev/null +++ b/Content.Shared/GameObjects/Components/MachineLinking/SignalSwitchVisuals.cs @@ -0,0 +1,11 @@ +using System; +using Robust.Shared.Serialization; + +namespace Content.Shared.GameObjects.Components.MachineLinking +{ + [Serializable, NetSerializable] + public enum SignalSwitchVisuals + { + On + } +} diff --git a/Content.Shared/GameObjects/Components/Mining/AsteroidRockVisuals.cs b/Content.Shared/GameObjects/Components/Mining/AsteroidRockVisuals.cs new file mode 100644 index 0000000000..1c0dff20a3 --- /dev/null +++ b/Content.Shared/GameObjects/Components/Mining/AsteroidRockVisuals.cs @@ -0,0 +1,11 @@ +using System; +using Robust.Shared.Serialization; + +namespace Content.Shared.GameObjects.Components.Mining +{ + [Serializable, NetSerializable] + public enum AsteroidRockVisuals + { + State + } +} diff --git a/Content.Shared/GameObjects/Components/Movement/SharedPlayerMobMoverComponent.cs b/Content.Shared/GameObjects/Components/Movement/SharedPlayerMobMoverComponent.cs index ebb762020f..adc244d5f5 100644 --- a/Content.Shared/GameObjects/Components/Movement/SharedPlayerMobMoverComponent.cs +++ b/Content.Shared/GameObjects/Components/Movement/SharedPlayerMobMoverComponent.cs @@ -92,11 +92,6 @@ namespace Content.Shared.GameObjects.Components.Movement { Owner.EnsureComponentWarn(); } - - if (Owner.TryGetComponent(out IPhysBody? body) && body.BodyType != BodyType.KinematicController) - { - Logger.WarningS("mover", $"Attached {nameof(SharedPlayerMobMoverComponent)} to a mob that's BodyType is not KinematicController!'"); - } } public override ComponentState GetComponentState(ICommonSession session) diff --git a/Content.Shared/GameObjects/Components/SharedStackComponent.cs b/Content.Shared/GameObjects/Components/SharedStackComponent.cs index 74d3155007..d0282bda95 100644 --- a/Content.Shared/GameObjects/Components/SharedStackComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedStackComponent.cs @@ -65,7 +65,7 @@ namespace Content.Shared.GameObjects.Components { base.Startup(); - if (!_prototypeManager.HasIndex(StackTypeId)) + if (StackTypeId != string.Empty && !_prototypeManager.HasIndex(StackTypeId)) { Logger.Error($"No {nameof(StackPrototype)} found with id {StackTypeId} for {Owner.Prototype?.ID ?? Owner.Name}"); } diff --git a/Content.Shared/GameObjects/Components/Singularity/SingularityVisuals.cs b/Content.Shared/GameObjects/Components/Singularity/SingularityVisuals.cs new file mode 100644 index 0000000000..139f14b58b --- /dev/null +++ b/Content.Shared/GameObjects/Components/Singularity/SingularityVisuals.cs @@ -0,0 +1,11 @@ +using System; +using Robust.Shared.Serialization; + +namespace Content.Shared.GameObjects.Components.Singularity +{ + [Serializable, NetSerializable] + public enum SingularityVisuals + { + Level + } +} diff --git a/Content.Shared/Maps/TurfHelpers.cs b/Content.Shared/Maps/TurfHelpers.cs index 6451324b7d..cbc776da61 100644 --- a/Content.Shared/Maps/TurfHelpers.cs +++ b/Content.Shared/Maps/TurfHelpers.cs @@ -1,4 +1,4 @@ -#nullable enable +#nullable enable using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; @@ -19,7 +19,7 @@ namespace Content.Shared.Maps /// /// Attempts to get the turf at map indices with grid id or null if no such turf is found. /// - public static TileRef GetTileRef(this Vector2i Vector2i, GridId gridId, IMapManager? mapManager = null) + public static TileRef GetTileRef(this Vector2i vector2i, GridId gridId, IMapManager? mapManager = null) { if (!gridId.IsValid()) return default; @@ -29,7 +29,7 @@ namespace Content.Shared.Maps if (!mapManager.TryGetGrid(gridId, out var grid)) return default; - if (!grid.TryGetTileRef(Vector2i, out var tile)) + if (!grid.TryGetTileRef(vector2i, out var tile)) return default; return tile; diff --git a/Resources/Prototypes/Entities/Constructible/Piping/pumps.yml b/Resources/Prototypes/Entities/Constructible/Piping/pumps.yml index b0de3e1c1e..958d0c6460 100644 --- a/Resources/Prototypes/Entities/Constructible/Piping/pumps.yml +++ b/Resources/Prototypes/Entities/Constructible/Piping/pumps.yml @@ -31,7 +31,7 @@ - type: PipeConnectorVisualizer - type: PumpVisualizer - type: PipeNetDevice - + - type: entity parent: PumpBase id: DebugPressurePump @@ -46,5 +46,5 @@ nodeGroupID: Pipe pipeDirection: South - type: PressurePump - inletDirection: North - outletDirection: South + initialInletDirection: North + initialOutletDirection: South diff --git a/Resources/Prototypes/Entities/Constructible/Specific/Engines/Singularity/singularity.yml b/Resources/Prototypes/Entities/Constructible/Specific/Engines/Singularity/singularity.yml index 73cacc544d..093e000194 100644 --- a/Resources/Prototypes/Entities/Constructible/Specific/Engines/Singularity/singularity.yml +++ b/Resources/Prototypes/Entities/Constructible/Specific/Engines/Singularity/singularity.yml @@ -26,3 +26,6 @@ sprite: Constructible/Power/Singularity/singularity_1.rsi state: singularity_1 drawdepth: Items + - type: Appearance + visuals: + - type: SingularityVisualizer diff --git a/Resources/Prototypes/Entities/Constructible/Storage/Closets/Secure/cargo.yml b/Resources/Prototypes/Entities/Constructible/Storage/Closets/Secure/cargo.yml index b2aff156ae..17ca50c7dc 100644 --- a/Resources/Prototypes/Entities/Constructible/Storage/Closets/Secure/cargo.yml +++ b/Resources/Prototypes/Entities/Constructible/Storage/Closets/Secure/cargo.yml @@ -8,4 +8,4 @@ - type: StorageVisualizer state: qm - type: AccessReader - access: [["Quartermaster"]] + access: [["Cargo"]] # TODO access [["Quartermaster"]] diff --git a/Resources/Prototypes/Entities/Constructible/Storage/Closets/Secure/security.yml b/Resources/Prototypes/Entities/Constructible/Storage/Closets/Secure/security.yml index 93af4d4fb1..902066a865 100644 --- a/Resources/Prototypes/Entities/Constructible/Storage/Closets/Secure/security.yml +++ b/Resources/Prototypes/Entities/Constructible/Storage/Closets/Secure/security.yml @@ -22,7 +22,7 @@ - type: StorageVisualizer state: warden - type: AccessReader - access: [["Brig"]] + access: [["Security"]] # TODO access [["Brig"]] # Security Officer - type: entity @@ -48,4 +48,4 @@ - type: StorageVisualizer state: cabinet - type: AccessReader - access: [["Detective"]] + access: [["Service"]] # TODO access [["Detective"]] diff --git a/Resources/Prototypes/Entities/Constructible/Walls/asteroid.yml b/Resources/Prototypes/Entities/Constructible/Walls/asteroid.yml index f22280f170..981b10fe84 100644 --- a/Resources/Prototypes/Entities/Constructible/Walls/asteroid.yml +++ b/Resources/Prototypes/Entities/Constructible/Walls/asteroid.yml @@ -22,3 +22,6 @@ - type: Occluder sizeX: 32 sizeY: 32 + - type: Appearance + visuals: + - type: AsteroidRockVisualizer diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index de4a70ec5b..ee225496c7 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -209,6 +209,7 @@ - type: DamageStateVisualizer normal: 0 dead: dead + - type: AsteroidRockVisualizer - type: entity name: goat diff --git a/Resources/Prototypes/Stacks/Materials/materials.yml b/Resources/Prototypes/Stacks/Materials/materials.yml index 3aac2aadfd..91cda5f129 100644 --- a/Resources/Prototypes/Stacks/Materials/materials.yml +++ b/Resources/Prototypes/Stacks/Materials/materials.yml @@ -1,8 +1,8 @@ - type: stack - id: Banananium - name: banananium + id: Bananium + name: bananium icon: /Textures/Objects/Materials/materials.rsi/bananium.png - spawn: MaterialBanananium1 + spawn: MaterialBananium1 - type: stack id: Diamond