* First pass

* Fix access and rename banananium to bananium

* Fix captialization of CookTimeInfoLabel

* Fix InteractUsing calls

* Remove unused [Dependency]

* Replace obsolete references to Anchored with BodyType

* Assign default value to shoving someone in disposals

* Fix naming

* Replace Initialize TryGetComponents with EnsureComponent

* Rework AnchorableComponent

* Fix singularity component

* Replace obsolete usages of Angle.South

* Fix efcore warning

* Fix container tests

* Fix DebugPressurePump invalid PressurePump yaml

* Fix getting pathfinding region of grid 0

* Fix atmos plaque missing layer and add info message when it happens

* Fix AiSteeringSystem steering in an invalid grid in entity test

* Make content able to choose which log level leads to test failures

* Revert container test fix for Acruid

* Fix sprite, pipe and saving errors
Make EntityTest print all errors instead of stopping on the first

* Reorder singularity visualizer

* Disable pvs for container occlusion adn simple predict reconcile, they use entities other than map ones

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
ShadowCommander
2021-03-31 12:41:23 -07:00
committed by GitHub
parent 0d1f6abb3b
commit 7a842f7c22
64 changed files with 496 additions and 249 deletions

View File

@@ -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<SpriteComponent>()?.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);
}
}
}
}

View File

@@ -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
}
},

View File

@@ -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");
}
}
}

View File

@@ -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<SpriteComponent>()?.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);
}
}
}
}

View File

@@ -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<SpriteComponent>()?.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);
}
}
}

View File

@@ -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<IPlayerManager>()
.GetAllPlayers().Single()
.GetAllPlayers()
.Single()
.JoinGame();
var mapMan = IoCManager.Resolve<IMapManager>();

View File

@@ -71,6 +71,8 @@ namespace Content.IntegrationTests.Tests
prototypes.Add(prototype);
}
Assert.Multiple(() =>
{
//Iterate list of prototypes to spawn
foreach (var prototype in prototypes)
{
@@ -85,6 +87,7 @@ namespace Content.IntegrationTests.Tests
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<IMapManager>();
@@ -141,6 +148,8 @@ namespace Content.IntegrationTests.Tests
});
server.Assert(() =>
{
Assert.Multiple(() =>
{
var testLocation = grid.ToCoordinates();
@@ -180,6 +189,7 @@ namespace Content.IntegrationTests.Tests
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<IMapManager>();
@@ -270,6 +284,8 @@ namespace Content.IntegrationTests.Tests
Assert.That(distinctComponents, Is.Not.Empty);
server.Assert(() =>
{
Assert.Multiple(() =>
{
foreach (var distinct in distinctComponents)
{
@@ -306,10 +322,10 @@ namespace Content.IntegrationTests.Tests
}
server.RunTicks(2);
entityManager.DeleteEntity(entity.Uid);
}
});
});
await server.WaitIdleAsync();
}

View File

@@ -1,4 +1,4 @@
#nullable enable
#nullable enable
using System.Threading.Tasks;
using Content.Server.GameObjects.Components.Movement;

View File

@@ -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<IEntitySystemManager>().LoadExtraSystemType<PredictionTestEntitySystem>();
@@ -52,6 +57,10 @@ namespace Content.IntegrationTests.Tests.Networking
},
new ServerContentIntegrationOption
{
CVarOverrides =
{
{CVars.NetPVS.Name, "false"}
},
ContentBeforeIoC = () =>
{
IoCManager.Resolve<IEntitySystemManager>().LoadExtraSystemType<PredictionTestEntitySystem>();

View File

@@ -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<PowerSupplierComponent>();

View File

@@ -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<IMapLoader>();
var mapManager = server.ResolveDependency<IMapManager>();

View File

@@ -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++;
}
}

View File

@@ -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 <entity id> <value (optional)>";
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<IEntityManager>();
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);
}
}
}

View File

@@ -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;

View File

@@ -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<PhysicsComponent>(out _physicsComponent);
}
/// <summary>
/// Checks if a tool can change the anchored status.
/// </summary>
@@ -38,14 +46,14 @@ namespace Content.Server.GameObjects.Components
/// <param name="utilizing">The tool being used, can be null if forcing it</param>
/// <param name="force">Whether or not to check if the tool is valid</param>
/// <returns>true if it is valid, false otherwise</returns>
private async Task<bool> Valid(IEntity user, IEntity? utilizing, [NotNullWhen(true)] bool force = false)
private async Task<bool> Valid(IEntity? user, IEntity? utilizing, [NotNullWhen(true)] bool force = false)
{
if (!Owner.HasComponent<IPhysBody>())
{
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
/// <param name="utilizing">The tool being used, if any</param>
/// <param name="force">Whether or not to ignore valid tool checks</param>
/// <returns>true if anchored, false otherwise</returns>
public async Task<bool> TryAnchor(IEntity user, IEntity? utilizing = null, bool force = false)
public async Task<bool> TryAnchor(IEntity? user, IEntity? utilizing = null, bool force = false)
{
if (!(await Valid(user, utilizing, force)))
{
return false;
}
var physics = Owner.GetComponent<IPhysBody>();
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
/// <param name="utilizing">The tool being used, if any</param>
/// <param name="force">Whether or not to ignore valid tool checks</param>
/// <returns>true if unanchored, false otherwise</returns>
public async Task<bool> TryUnAnchor(IEntity user, IEntity? utilizing = null, bool force = false)
public async Task<bool> TryUnAnchor(IEntity? user, IEntity? utilizing = null, bool force = false)
{
if (!(await Valid(user, utilizing, force)))
{
return false;
}
var physics = Owner.GetComponent<IPhysBody>();
physics.BodyType = BodyType.Dynamic;
if (_physicsComponent == null)
return false;
_physicsComponent.BodyType = BodyType.Dynamic;
return true;
}
@@ -120,24 +132,16 @@ namespace Content.Server.GameObjects.Components
/// <param name="utilizing">The tool being used, if any</param>
/// <param name="force">Whether or not to ignore valid tool checks</param>
/// <returns>true if toggled, false otherwise</returns>
private async Task<bool> TryToggleAnchor(IEntity user, IEntity? utilizing = null, bool force = false)
{
if (!Owner.TryGetComponent(out IPhysBody? physics))
public async Task<bool> TryToggleAnchor(IEntity? user, IEntity? utilizing = null, bool force = false)
{
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<PhysicsComponent>();
}
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{
return await TryToggleAnchor(eventArgs.User, eventArgs.Using);

View File

@@ -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<NodeContainerComponent>(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<PipeNode>().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;
}
}

View File

@@ -150,7 +150,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
if (!Owner.TryGetComponent<NodeContainerComponent>(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;
}
}

View File

@@ -85,13 +85,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
{
if (!Owner.TryGetComponent<NodeContainerComponent>(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<PipeNode>().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;
}
}

View File

@@ -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<NodeContainerComponent>(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<PipeNode>().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;
}
}

View File

@@ -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 <see cref="PipeDirection"/> as that of a <see cref="PipeNode"/> on this entity.
/// </summary>
[ViewVariables]
[DataField("initialInletDirection")]
[DataField("initialInletDirection", required: true)]
private PipeDirection _initialInletDirection = PipeDirection.None;
/// <summary>
/// Needs to be same <see cref="PipeDirection"/> as that of a <see cref="PipeNode"/> on this entity.
/// </summary>
[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<NodeContainerComponent>(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<PipeNode>();
@@ -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;
}
}

View File

@@ -78,13 +78,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers
{
if (!Owner.TryGetComponent<NodeContainerComponent>(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<PipeNode>().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;
}
}

View File

@@ -78,13 +78,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents
{
if (!Owner.TryGetComponent<NodeContainerComponent>(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<PipeNode>().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;
}
}

View File

@@ -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);
}
}

View File

@@ -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")]

View File

@@ -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")]

View File

@@ -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]

View File

@@ -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;
}

View File

@@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Construction
public override string Name => "WelderRefinable";
public async Task<bool> InteractUsing(InteractUsingEventArgs eventArgs)
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
{
// check if object is welder
if (!eventArgs.Using.TryGetComponent(out ToolComponent? tool))

View File

@@ -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);

View File

@@ -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;
/// <summary>
/// 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<PhysicsComponent>().Anchored)
Owner.EnsureComponent<PhysicsComponent>(out var physicsComponent);
if (physicsComponent.BodyType != BodyType.Static)
{
return;
}

View File

@@ -87,7 +87,7 @@ namespace Content.Server.GameObjects.Components.Disposal
/// Delay from trying to shove someone else into disposals.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
private float _draggedEntryDelay;
private float _draggedEntryDelay = 0.5f;
/// <summary>
/// Token used to cancel the automatic engage of a disposal unit

View File

@@ -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

View File

@@ -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<DoAfterSystem>();
_ammo = MaxAmmo;
_doAfterSystem = EntitySystem.Get<DoAfterSystem>();
}
///<summary>
@@ -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));

View File

@@ -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<SolutionContainerComponent>();
_storage = ContainerHelpers.EnsureContainer<Container>(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;
}
}

View File

@@ -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<SpriteComponent>(out var sprite))
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
{
sprite.LayerSetState(0, _on ? "on" : "off");
appearance.SetData(SignalSwitchVisuals.On, _on);
}
}

View File

@@ -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";

View File

@@ -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";

View File

@@ -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>();
spriteComponent.LayerSetState(0, _random.Pick(SpriteStates));
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
{
appearance.SetData(AsteroidRockVisuals.State, _random.Pick(SpriteStates));
}
}
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)

View File

@@ -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<StandingStateSystem>().Down(Owner);

View File

@@ -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";

View File

@@ -44,7 +44,7 @@ namespace Content.Server.GameObjects.Components.PA
/// <summary>
/// Power receiver for the control console itself.
/// </summary>
[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)

View File

@@ -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<SnapGridComponent>(out SnapGrid);
}
public override void HandleMessage(ComponentMessage message, IComponent? component)

View File

@@ -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>();
PowerConsumerComponent.OnReceivedPowerChanged += PowerReceivedChanged;
}
private void PowerReceivedChanged(object? sender, ReceivedPowerChangedEventArgs e)

View File

@@ -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();
}

View File

@@ -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<Direction, ContainmentFieldConnection>? 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<PhysicsComponent>(out var collidableComponent) ||
!collidableComponent.Anchored)
collidableComponent.BodyType != BodyType.Static)
{
continue;
}

View File

@@ -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<PowerConsumerComponent>(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)
{

View File

@@ -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;
}

View File

@@ -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";

View File

@@ -423,6 +423,11 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
/// <returns></returns>
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);

View File

@@ -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;
}

View File

@@ -0,0 +1,11 @@
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Atmos
{
[Serializable, NetSerializable]
public enum AtmosPlaqueVisuals
{
State
}
}

View File

@@ -0,0 +1,11 @@
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.MachineLinking
{
[Serializable, NetSerializable]
public enum SignalSwitchVisuals
{
On
}
}

View File

@@ -0,0 +1,11 @@
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Mining
{
[Serializable, NetSerializable]
public enum AsteroidRockVisuals
{
State
}
}

View File

@@ -92,11 +92,6 @@ namespace Content.Shared.GameObjects.Components.Movement
{
Owner.EnsureComponentWarn<SharedPlayerInputMoverComponent>();
}
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)

View File

@@ -65,7 +65,7 @@ namespace Content.Shared.GameObjects.Components
{
base.Startup();
if (!_prototypeManager.HasIndex<StackPrototype>(StackTypeId))
if (StackTypeId != string.Empty && !_prototypeManager.HasIndex<StackPrototype>(StackTypeId))
{
Logger.Error($"No {nameof(StackPrototype)} found with id {StackTypeId} for {Owner.Prototype?.ID ?? Owner.Name}");
}

View File

@@ -0,0 +1,11 @@
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Singularity
{
[Serializable, NetSerializable]
public enum SingularityVisuals
{
Level
}
}

View File

@@ -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
/// <summary>
/// Attempts to get the turf at map indices with grid id or null if no such turf is found.
/// </summary>
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;

View File

@@ -46,5 +46,5 @@
nodeGroupID: Pipe
pipeDirection: South
- type: PressurePump
inletDirection: North
outletDirection: South
initialInletDirection: North
initialOutletDirection: South

View File

@@ -26,3 +26,6 @@
sprite: Constructible/Power/Singularity/singularity_1.rsi
state: singularity_1
drawdepth: Items
- type: Appearance
visuals:
- type: SingularityVisualizer

View File

@@ -8,4 +8,4 @@
- type: StorageVisualizer
state: qm
- type: AccessReader
access: [["Quartermaster"]]
access: [["Cargo"]] # TODO access [["Quartermaster"]]

View File

@@ -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"]]

View File

@@ -22,3 +22,6 @@
- type: Occluder
sizeX: 32
sizeY: 32
- type: Appearance
visuals:
- type: AsteroidRockVisualizer

View File

@@ -209,6 +209,7 @@
- type: DamageStateVisualizer
normal: 0
dead: dead
- type: AsteroidRockVisualizer
- type: entity
name: goat

View File

@@ -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