From be9db264dd51fda3243bdd7c8fbe02fbe346a156 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Fri, 6 Sep 2024 12:48:50 +1200 Subject: [PATCH 01/34] Minor toolshed fixes / tweaks (#5315) * Don't use markup for type names * Cache TypeTypeParser completions * Cache all type parsers * Release notes * More IConError fixes * a --- RELEASE-NOTES.md | 1 + .../Errors/NotForServerConsoleError.cs | 2 +- .../Errors/SessionHasNoEntityError.cs | 2 +- .../Toolshed/Syntax/ParserContext.cs | 2 +- Robust.Shared/Toolshed/Syntax/ValueRef.cs | 3 +-- .../Toolshed/ToolshedManager.Parsing.cs | 12 +++++++--- .../Toolshed/TypeParsers/StringTypeParser.cs | 2 +- .../Toolshed/TypeParsers/TypeTypeParser.cs | 23 +++++++------------ 8 files changed, 23 insertions(+), 24 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 7e477bed387..49713b58c42 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -46,6 +46,7 @@ END TEMPLATE--> ### Bugfixes * Fixed equality checks for `MarkupNode` not properly handling attributes. +* Fixed toolshed commands failing to generate error messages when working with array types * Fixed `MarkupNode` not having a `GetHashCode()` implementation. ### Other diff --git a/Robust.Shared/Toolshed/Errors/NotForServerConsoleError.cs b/Robust.Shared/Toolshed/Errors/NotForServerConsoleError.cs index cdd8ddff140..77ef43fb06b 100644 --- a/Robust.Shared/Toolshed/Errors/NotForServerConsoleError.cs +++ b/Robust.Shared/Toolshed/Errors/NotForServerConsoleError.cs @@ -8,7 +8,7 @@ public sealed class NotForServerConsoleError : IConError { public FormattedMessage DescribeInner() { - return FormattedMessage.FromMarkupOrThrow( + return FormattedMessage.FromUnformatted( "You must be logged in with a client to use this, the server console isn't workable."); } diff --git a/Robust.Shared/Toolshed/Errors/SessionHasNoEntityError.cs b/Robust.Shared/Toolshed/Errors/SessionHasNoEntityError.cs index 3fddf8c78ed..d835a5bc3cd 100644 --- a/Robust.Shared/Toolshed/Errors/SessionHasNoEntityError.cs +++ b/Robust.Shared/Toolshed/Errors/SessionHasNoEntityError.cs @@ -9,7 +9,7 @@ public record SessionHasNoEntityError(ICommonSession Session) : IConError { public FormattedMessage DescribeInner() { - return FormattedMessage.FromMarkupOrThrow($"The user {Session.Name} has no attached entity."); + return FormattedMessage.FromUnformatted($"The user {Session.Name} has no attached entity."); } public string? Expression { get; set; } diff --git a/Robust.Shared/Toolshed/Syntax/ParserContext.cs b/Robust.Shared/Toolshed/Syntax/ParserContext.cs index 1b684898db2..bf2a4308e0d 100644 --- a/Robust.Shared/Toolshed/Syntax/ParserContext.cs +++ b/Robust.Shared/Toolshed/Syntax/ParserContext.cs @@ -352,7 +352,7 @@ public record OutOfInputError : IConError { public FormattedMessage DescribeInner() { - return FormattedMessage.FromMarkupOrThrow("Ran out of input data when data was expected."); + return FormattedMessage.FromUnformatted("Ran out of input data when data was expected."); } public string? Expression { get; set; } diff --git a/Robust.Shared/Toolshed/Syntax/ValueRef.cs b/Robust.Shared/Toolshed/Syntax/ValueRef.cs index cb0d5042d81..2716cb60da1 100644 --- a/Robust.Shared/Toolshed/Syntax/ValueRef.cs +++ b/Robust.Shared/Toolshed/Syntax/ValueRef.cs @@ -103,8 +103,7 @@ public record BadVarTypeError(Type Got, Type Expected, string VarName) : IConErr { public FormattedMessage DescribeInner() { - return FormattedMessage.FromMarkupOrThrow( - $"Got unexpected type {Got.PrettyName()} in {VarName}, expected {Expected.PrettyName()}"); + return FormattedMessage.FromUnformatted($"Got unexpected type {Got.PrettyName()} in {VarName}, expected {Expected.PrettyName()}"); } public string? Expression { get; set; } diff --git a/Robust.Shared/Toolshed/ToolshedManager.Parsing.cs b/Robust.Shared/Toolshed/ToolshedManager.Parsing.cs index b346c99a8f9..8171749b5c7 100644 --- a/Robust.Shared/Toolshed/ToolshedManager.Parsing.cs +++ b/Robust.Shared/Toolshed/ToolshedManager.Parsing.cs @@ -16,7 +16,7 @@ namespace Robust.Shared.Toolshed; public sealed partial class ToolshedManager { - private readonly Dictionary _consoleTypeParsers = new(); + private readonly Dictionary _consoleTypeParsers = new(); private readonly Dictionary _genericTypeParsers = new(); private readonly List<(Type, Type)> _constrainedParsers = new(); @@ -55,6 +55,14 @@ private void InitializeParser() if (_consoleTypeParsers.TryGetValue(t, out var parser)) return parser; + parser = FindParserForType(t); + _consoleTypeParsers.TryAdd(t, parser); + return parser; + + } + + private ITypeParser? FindParserForType(Type t) + { if (t.IsConstructedGenericType) { if (_genericTypeParsers.TryGetValue(t.GetGenericTypeDefinition(), out var genParser)) @@ -65,7 +73,6 @@ private void InitializeParser() var builtParser = (ITypeParser) _typeFactory.CreateInstanceUnchecked(concreteParser, true); builtParser.PostInject(); - _consoleTypeParsers.Add(builtParser.Parses, builtParser); return builtParser; } catch (SecurityException) @@ -86,7 +93,6 @@ private void InitializeParser() var builtParser = (ITypeParser) _typeFactory.CreateInstanceUnchecked(concreteParser, true); builtParser.PostInject(); - _consoleTypeParsers.Add(builtParser.Parses, builtParser); return builtParser; } catch (SecurityException) diff --git a/Robust.Shared/Toolshed/TypeParsers/StringTypeParser.cs b/Robust.Shared/Toolshed/TypeParsers/StringTypeParser.cs index f4d4c3b7a3e..7c901803e7c 100644 --- a/Robust.Shared/Toolshed/TypeParsers/StringTypeParser.cs +++ b/Robust.Shared/Toolshed/TypeParsers/StringTypeParser.cs @@ -93,7 +93,7 @@ public record struct StringMustStartWithQuote : IConError { public FormattedMessage DescribeInner() { - return FormattedMessage.FromMarkupOrThrow("A string must start with a quote."); + return FormattedMessage.FromUnformatted("A string must start with a quote."); } public string? Expression { get; set; } diff --git a/Robust.Shared/Toolshed/TypeParsers/TypeTypeParser.cs b/Robust.Shared/Toolshed/TypeParsers/TypeTypeParser.cs index e8803fe7c54..243301abf44 100644 --- a/Robust.Shared/Toolshed/TypeParsers/TypeTypeParser.cs +++ b/Robust.Shared/Toolshed/TypeParsers/TypeTypeParser.cs @@ -10,7 +10,6 @@ using Robust.Shared.Console; using Robust.Shared.ContentPack; using Robust.Shared.IoC; -using Robust.Shared.Log; using Robust.Shared.Maths; using Robust.Shared.Toolshed.Errors; using Robust.Shared.Toolshed.Syntax; @@ -56,6 +55,7 @@ internal sealed class TypeTypeParser : TypeParser }; private readonly HashSet _ambiguousTypes = new(); + private CompletionResult? _optionsCache; public override void PostInject() { @@ -75,6 +75,8 @@ public override void PostInject() } } } + + _optionsCache = CompletionResult.FromHintOptions(Types.Select(x => new CompletionOption(x.Key)), "C# level type"); } public override bool TryParse(ParserContext parserContext, [NotNullWhen(true)] out object? result, out IConError? error) @@ -168,8 +170,7 @@ public override bool TryParse(ParserContext parserContext, [NotNullWhen(true)] o string? argName) { // TODO: Suggest generics. - var options = Types.Select(x => new CompletionOption(x.Key)); - return ValueTask.FromResult<(CompletionResult? result, IConError? error)>((CompletionResult.FromHintOptions(options, "C# level type"), null)); + return ValueTask.FromResult<(CompletionResult? result, IConError? error)>((_optionsCache, null)); } } @@ -177,9 +178,7 @@ public record struct ExpectedNextType() : IConError { public FormattedMessage DescribeInner() { - var msg = new FormattedMessage(); - msg.AddText($"Expected another type in the generic arguments."); - return msg; + return FormattedMessage.FromUnformatted("Expected another type in the generic arguments."); } public string? Expression { get; set; } @@ -191,9 +190,7 @@ public record struct ExpectedGeneric() : IConError { public FormattedMessage DescribeInner() { - var msg = new FormattedMessage(); - msg.AddText($"Expected a generic type, did you forget the angle brackets?"); - return msg; + return FormattedMessage.FromUnformatted("Expected a generic type, did you forget the angle brackets?"); } public string? Expression { get; set; } @@ -205,9 +202,7 @@ public record struct UnknownType(string T) : IConError { public FormattedMessage DescribeInner() { - var msg = new FormattedMessage(); - msg.AddText($"The type {T} is not known and cannot be used."); - return msg; + return FormattedMessage.FromUnformatted($"The type {T} is not known and cannot be used."); } public string? Expression { get; set; } @@ -220,9 +215,7 @@ internal record struct TypeIsSandboxViolation(Type T) : IConError { public FormattedMessage DescribeInner() { - var msg = new FormattedMessage(); - msg.AddText($"The type {T.PrettyName()} is not permitted under sandbox rules."); - return msg; + return FormattedMessage.FromUnformatted($"The type {T.PrettyName()} is not permitted under sandbox rules."); } public string? Expression { get; set; } From 405ed378c09a29d6c7ba7a72264556b422b4505f Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Fri, 6 Sep 2024 22:51:34 +1200 Subject: [PATCH 02/34] Re-attempt `FlushEntities()` on failure (#5423) --- RELEASE-NOTES.md | 2 +- .../GameStates/PvsSystem.DataStorage.cs | 3 ++- Robust.Shared/GameObjects/EntityManager.cs | 24 +++++++++++++++---- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 49713b58c42..1834bc39166 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -51,7 +51,7 @@ END TEMPLATE--> ### Other -*None yet* +* If `EntityManager.FlushEntities()` fails to delete all entities, it will now attempt to do so a second time before throwing an exception. ### Internal diff --git a/Robust.Server/GameStates/PvsSystem.DataStorage.cs b/Robust.Server/GameStates/PvsSystem.DataStorage.cs index f34f747d5b9..b9927938b68 100644 --- a/Robust.Server/GameStates/PvsSystem.DataStorage.cs +++ b/Robust.Server/GameStates/PvsSystem.DataStorage.cs @@ -300,7 +300,8 @@ private void OnEntityDeleted(Entity entity) /// private void AfterEntityFlush() { - DebugTools.Assert(EntityManager.EntityCount == 0); + if (EntityManager.EntityCount > 0) + throw new Exception("Cannot reset PVS data without first deleting all entities."); ClearPvsData(); ShrinkDataMemory(); diff --git a/Robust.Shared/GameObjects/EntityManager.cs b/Robust.Shared/GameObjects/EntityManager.cs index 7ba519b7eae..b3abee1daac 100644 --- a/Robust.Shared/GameObjects/EntityManager.cs +++ b/Robust.Shared/GameObjects/EntityManager.cs @@ -693,6 +693,25 @@ public bool Deleted([NotNullWhen(false)] EntityUid? uid) public virtual void FlushEntities() { BeforeEntityFlush?.Invoke(); + FlushEntitiesInternal(); + + if (Entities.Count != 0) + _sawmill.Error("Failed to flush all entities"); + +#if EXCEPTION_TOLERANCE + // Attempt to flush entities a second time, just in case something somehow caused an entity to be spawned + // while flushing entities + FlushEntitiesInternal(); +#endif + + if (Entities.Count != 0) + throw new Exception("Failed to flush all entities"); + + AfterEntityFlush?.Invoke(); + } + + private void FlushEntitiesInternal() + { QueuedDeletions.Clear(); QueuedDeletionsSet.Clear(); @@ -738,11 +757,6 @@ public virtual void FlushEntities() #endif } } - - if (Entities.Count != 0) - _sawmill.Error("Entities were spawned while flushing entities."); - - AfterEntityFlush?.Invoke(); } /// From 5eb5ddd96e6b7af3087df46ee08ae76e321e1cc0 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sun, 8 Sep 2024 17:22:48 +1000 Subject: [PATCH 03/34] Add some entitylookup methods (#5431) --- .../GameObjects/Systems/EntityLookup.Queries.cs | 13 +++++++++++++ .../EntityLookupSystem.ComponentQueries.cs | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs b/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs index f332a94c54c..5dde1eaed7c 100644 --- a/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs +++ b/Robust.Shared/GameObjects/Systems/EntityLookup.Queries.cs @@ -703,6 +703,19 @@ public HashSet GetEntitiesInRange(MapId mapId, Vector2 worldPos, floa return entities; } + public void GetEntitiesIntersecting( + MapId mapId, + IPhysShape shape, + Transform transform, + HashSet entities, + LookupFlags flags = LookupFlags.All) + { + if (mapId == MapId.Nullspace) + return; + + AddEntitiesIntersecting(mapId, entities, shape, transform, flags: flags); + } + public void GetEntitiesInRange(MapId mapId, Vector2 worldPos, float range, HashSet entities, LookupFlags flags = DefaultFlags) { DebugTools.Assert(range > 0, "Range must be a positive float"); diff --git a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs index 6b001b024e3..35e7887dc1e 100644 --- a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs +++ b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs @@ -784,6 +784,22 @@ public void GetLocalEntitiesIntersecting( #endregion + /// + /// Gets entities with the specified component with the specified grid. + /// + public void GetGridEntities(EntityUid gridUid, HashSet> entities) where TComp1 : IComponent + { + var query = AllEntityQuery(); + + while (query.MoveNext(out var uid, out var comp, out var xform)) + { + if (xform.GridUid != gridUid) + continue; + + entities.Add((uid, comp)); + } + } + /// /// Gets entities with the specified component with the specified parent. /// From dbc4e80e6186dd71f7b3f0cbde72606c2e986a75 Mon Sep 17 00:00:00 2001 From: metalgearsloth Date: Sun, 8 Sep 2024 17:55:56 +1000 Subject: [PATCH 04/34] Version: 233.1.0 --- MSBuild/Robust.Engine.Version.props | 2 +- RELEASE-NOTES.md | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/MSBuild/Robust.Engine.Version.props b/MSBuild/Robust.Engine.Version.props index 61514327453..9c5b9a74d07 100644 --- a/MSBuild/Robust.Engine.Version.props +++ b/MSBuild/Robust.Engine.Version.props @@ -1,4 +1,4 @@ - 233.0.2 + 233.1.0 diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 1834bc39166..47e734429f9 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -39,6 +39,26 @@ END TEMPLATE--> ### New features +*None yet* + +### Bugfixes + +*None yet* + +### Other + +*None yet* + +### Internal + +*None yet* + + +## 233.1.0 + +### New features + +* Add GetGridEntities and another GetEntitiesIntersecting overload to EntityLookupSystem. * `MarkupNode` is now `IEquatable`. It already supported equality checks, now it implements the interface. * Added `Entity` overloads to the following `SharedMapSystem` methods: `GetTileRef`, `GetAnchoredEntities`, `TileIndicesFor`. * Added `EntityUid`-only overloads to the following `SharedTransformSystem` methods: `AnchorEntity`, `Unanchor`. @@ -53,10 +73,6 @@ END TEMPLATE--> * If `EntityManager.FlushEntities()` fails to delete all entities, it will now attempt to do so a second time before throwing an exception. -### Internal - -*None yet* - ## 233.0.2 From 814e5bcf17db12cabaa7a0311d4dbc10cc569fa8 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Mon, 9 Sep 2024 08:23:12 +0200 Subject: [PATCH 05/34] Mark large replays as requiring Server GC. This should significantly improve loading performance of large replays. System can be controlled by replay.server_gc_size_threshold, which defaults to 50 MiB. This is the engine-side of https://github.com/space-wizards/SS14.Launcher/issues/177 --- Robust.Shared/CVars.cs | 10 ++++++++++ .../Replays/SharedReplayRecordingManager.cs | 13 ++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Robust.Shared/CVars.cs b/Robust.Shared/CVars.cs index c781d1eabee..6404bd1bfb4 100644 --- a/Robust.Shared/CVars.cs +++ b/Robust.Shared/CVars.cs @@ -1636,6 +1636,16 @@ protected CVars() public static readonly CVarDef ReplayMaxUncompressedSize = CVarDef.Create("replay.max_uncompressed_size", 1024L * 1024, CVar.ARCHIVE); + /// + /// Size of the replay (in kilobytes) at which point the replay is considered "large", + /// and replay clients should enable server GC (if possible) to improve performance. + /// + /// + /// Set to -1 to never make replays use server GC. + /// + public static readonly CVarDef ReplayServerGCSizeThreshold = + CVarDef.Create("replay.server_gc_size_threshold", 50L * 1024); + /// /// Uncompressed size of individual files created by the replay (in kilobytes), where each file contains data /// for one or more ticks. Actual files may be slightly larger, this is just a threshold for the file to get diff --git a/Robust.Shared/Replays/SharedReplayRecordingManager.cs b/Robust.Shared/Replays/SharedReplayRecordingManager.cs index b5d842d53b4..656e9ff83b5 100644 --- a/Robust.Shared/Replays/SharedReplayRecordingManager.cs +++ b/Robust.Shared/Replays/SharedReplayRecordingManager.cs @@ -58,6 +58,7 @@ internal abstract partial class SharedReplayRecordingManager : IReplayRecordingM // Config variables. private long _maxCompressedSize; private long _maxUncompressedSize; + private long _serverGCSizeThreshold; private int _tickBatchSize; private bool _enabled; @@ -71,6 +72,7 @@ public virtual void Initialize() NetConf.OnValueChanged(CVars.ReplayMaxCompressedSize, (v) => _maxCompressedSize = SaturatingMultiplyKb(v), true); NetConf.OnValueChanged(CVars.ReplayMaxUncompressedSize, (v) => _maxUncompressedSize = SaturatingMultiplyKb(v), true); + NetConf.OnValueChanged(CVars.ReplayServerGCSizeThreshold, (v) => _serverGCSizeThreshold = SaturatingMultiplyKb(v), true); NetConf.OnValueChanged(CVars.ReplayTickBatchSize, (v) => _tickBatchSize = Math.Min(v, MaxTickBatchSize) * 1024, true); NetConf.OnValueChanged(CVars.NetPvsCompressLevel, OnCompressionChanged); } @@ -238,7 +240,6 @@ public virtual bool TryStartRecording( try { - WriteContentBundleInfo(_recState); WriteInitialMetadata(name, _recState); } catch @@ -391,6 +392,7 @@ private void WriteFinalMetadata(RecordingState recState) // this just overwrites the previous yml with additional data. var document = new YamlDocument(yamlMetadata.ToYaml()); WriteYaml(recState, ReplayZipFolder / FileMetaFinal, document); + WriteContentBundleInfo(recState); UpdateWriteTasks(); Reset(); @@ -412,6 +414,7 @@ private void WriteContentBundleInfo(RecordingState recState) var document = new JsonObject { + ["server_gc"] = ShouldEnableServerGC(recState), ["engine_version"] = info.EngineVersion, ["base_build"] = new JsonObject { @@ -429,6 +432,14 @@ private void WriteContentBundleInfo(RecordingState recState) WriteBytes(recState, new ResPath("rt_content_bundle.json"), bytes); } + private bool ShouldEnableServerGC(RecordingState recState) + { + if (_serverGCSizeThreshold < 0) + return false; + + return recState.CompressedSize >= _serverGCSizeThreshold; + } + /// /// Get information describing the server build. /// This will be embedded in replay content bundles to allow the launcher to directly load them. From f682fb9cc76e74876121ace2b988a7f3ba307b84 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Mon, 9 Sep 2024 11:22:07 +0200 Subject: [PATCH 06/34] Obsolete some useless type proxies on IResourceCache These aren't even used, but they're pretty objectively bad ideas so let's obsolete them so we can get rid of them later. --- Robust.Client/ResourceManagement/IResourceCache.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Robust.Client/ResourceManagement/IResourceCache.cs b/Robust.Client/ResourceManagement/IResourceCache.cs index 113d7e74d82..dd13909bbec 100644 --- a/Robust.Client/ResourceManagement/IResourceCache.cs +++ b/Robust.Client/ResourceManagement/IResourceCache.cs @@ -48,7 +48,10 @@ T GetFallback() event Action OnRawTextureLoaded; event Action OnRsiLoaded; + [Obsolete("Fetch these through IoC directly instead")] IClyde Clyde { get; } + + [Obsolete("Fetch these through IoC directly instead")] IFontManager FontManager { get; } } From 48d70a09c61daf35fbfcf5e92ec6337975d1c952 Mon Sep 17 00:00:00 2001 From: Kara Date: Wed, 11 Sep 2024 02:38:26 -0700 Subject: [PATCH 07/34] Remove most fully-obsoleted code (#5433) --- Robust.Client/Audio/Midi/IMidiRenderer.cs | 6 -- Robust.Client/Audio/Midi/MidiRenderer.cs | 8 --- Robust.Client/Credits/CreditsManager.cs | 9 --- .../EntitySystems/AnimationPlayerSystem.cs | 9 --- .../GameStates/IClientGameStateManager.cs | 3 - .../CustomControls/SS14Window.cs | 10 --- Robust.Server/GameStates/PvsOverrideSystem.cs | 7 -- .../ServerStatus/IStatusHandlerContext.cs | 32 --------- Robust.Server/ServerStatus/IStatusHost.cs | 13 ---- .../ServerStatus/StatusHost.Acz.Sources.cs | 16 ----- Robust.Server/ServerStatus/StatusHost.cs | 62 ----------------- Robust.Shared/Audio/SoundSpecifier.cs | 20 ------ .../Containers/ContainerManagerComponent.cs | 27 -------- .../Containers/SharedContainerSystem.cs | 10 --- .../Appearance/AppearanceComponent.cs | 13 ---- .../Components/Timers/TimerExtensions.cs | 52 -------------- .../Transform/TransformComponent.cs | 38 ----------- .../GameObjects/EntityManager.Components.cs | 18 ----- .../GameObjects/EntitySystem.Proxy.cs | 10 --- .../GameObjects/IEntityManager.Components.cs | 13 ---- .../EntityLookupSystem.ComponentQueries.cs | 14 ---- .../SharedTransformSystem.Component.cs | 7 -- Robust.Shared/Log/Logger.cs | 56 --------------- .../Map/Components/MapGridComponent.cs | 68 ------------------- Robust.Shared/Map/EntityCoordinates.cs | 31 --------- Robust.Shared/Map/IMapManager.cs | 9 --- .../Map/MapManager.GridCollection.cs | 23 ------- .../Systems/SharedPhysicsSystem.Components.cs | 36 ---------- .../Systems/SharedPhysicsSystem.Queries.cs | 7 -- Robust.Shared/Player/Filter.cs | 19 ------ Robust.Shared/Player/ICommonSession.cs | 5 +- Robust.Shared/Player/ISharedPlayerManager.cs | 3 - Robust.Shared/Prototypes/IPrototypeManager.cs | 63 ----------------- Robust.Shared/Prototypes/PrototypeManager.cs | 32 --------- Robust.UnitTesting/RobustIntegrationTest.cs | 2 - 35 files changed, 1 insertion(+), 750 deletions(-) delete mode 100644 Robust.Client/UserInterface/CustomControls/SS14Window.cs diff --git a/Robust.Client/Audio/Midi/IMidiRenderer.cs b/Robust.Client/Audio/Midi/IMidiRenderer.cs index 216fe2c09d2..483694faa7c 100644 --- a/Robust.Client/Audio/Midi/IMidiRenderer.cs +++ b/Robust.Client/Audio/Midi/IMidiRenderer.cs @@ -33,12 +33,6 @@ public interface IMidiRenderer : IDisposable /// bool LoopMidi { get; set; } - /// - /// This increases all note on velocities to 127. - /// - [Obsolete($"Use {nameof(VelocityOverride)} instead, you can set it to 127 to achieve the same effect.")] - bool VolumeBoost { get; set; } - /// /// The midi program (instrument) the renderer is using. /// diff --git a/Robust.Client/Audio/Midi/MidiRenderer.cs b/Robust.Client/Audio/Midi/MidiRenderer.cs index 98425503a0e..bed5537c38d 100644 --- a/Robust.Client/Audio/Midi/MidiRenderer.cs +++ b/Robust.Client/Audio/Midi/MidiRenderer.cs @@ -205,14 +205,6 @@ public bool LoopMidi } } - [ViewVariables(VVAccess.ReadWrite)] - [Obsolete($"Use {nameof(VelocityOverride)} instead, you can set it to 127 to achieve the same effect.")] - public bool VolumeBoost - { - get => VelocityOverride == 127; - set => VelocityOverride = value ? 127 : null; - } - [ViewVariables(VVAccess.ReadWrite)] public EntityUid? TrackingEntity { get; set; } = null; diff --git a/Robust.Client/Credits/CreditsManager.cs b/Robust.Client/Credits/CreditsManager.cs index c247041294e..6acc0df488c 100644 --- a/Robust.Client/Credits/CreditsManager.cs +++ b/Robust.Client/Credits/CreditsManager.cs @@ -14,15 +14,6 @@ namespace Robust.Client.Credits /// public static class CreditsManager { - /// - /// Gets a list of open source software used in the engine and their license. - /// - [Obsolete("Use overload that takes in an explicit resource manager instead.")] - public static IEnumerable GetLicenses() - { - return GetLicenses(IoCManager.Resolve()); - } - /// /// Gets a list of open source software used in the engine and their license. /// diff --git a/Robust.Client/GameObjects/EntitySystems/AnimationPlayerSystem.cs b/Robust.Client/GameObjects/EntitySystems/AnimationPlayerSystem.cs index ed760390419..8d3323d6f4a 100644 --- a/Robust.Client/GameObjects/EntitySystems/AnimationPlayerSystem.cs +++ b/Robust.Client/GameObjects/EntitySystems/AnimationPlayerSystem.cs @@ -99,15 +99,6 @@ public void Play(EntityUid uid, AnimationPlayerComponent? component, Animation a Play(new Entity(uid, component), animation, key); } - /// - /// Start playing an animation. - /// - [Obsolete("Use Play(EntityUid ent, Animation animation, string key) instead")] - public void Play(AnimationPlayerComponent component, Animation animation, string key) - { - Play(new Entity(component.Owner, component), animation, key); - } - public void Play(Entity ent, Animation animation, string key) { AddComponent(ent); diff --git a/Robust.Client/GameStates/IClientGameStateManager.cs b/Robust.Client/GameStates/IClientGameStateManager.cs index 45fa9fd6f54..fc50155b693 100644 --- a/Robust.Client/GameStates/IClientGameStateManager.cs +++ b/Robust.Client/GameStates/IClientGameStateManager.cs @@ -34,9 +34,6 @@ public interface IClientGameStateManager /// int GetApplicableStateCount(); - [Obsolete("use GetApplicableStateCount()")] - int CurrentBufferSize => GetApplicableStateCount(); - /// /// Total number of game states currently in the state buffer. /// diff --git a/Robust.Client/UserInterface/CustomControls/SS14Window.cs b/Robust.Client/UserInterface/CustomControls/SS14Window.cs deleted file mode 100644 index f5483cfbf18..00000000000 --- a/Robust.Client/UserInterface/CustomControls/SS14Window.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace Robust.Client.UserInterface.CustomControls; - -[Obsolete("Use DefaultWindow instead")] -[Virtual] -public class SS14Window : DefaultWindow -{ - -} diff --git a/Robust.Server/GameStates/PvsOverrideSystem.cs b/Robust.Server/GameStates/PvsOverrideSystem.cs index 5f3a468232b..bef471af085 100644 --- a/Robust.Server/GameStates/PvsOverrideSystem.cs +++ b/Robust.Server/GameStates/PvsOverrideSystem.cs @@ -250,13 +250,6 @@ public void AddSessionOverride(NetEntity entity, ICommonSession session, bool re AddSessionOverride(uid.Value, session); } - [Obsolete("Use variant that takes in an EntityUid")] - public void AddSessionOverrides(NetEntity entity, Filter filter, bool removeExistingOverride = true) - { - if (TryGetEntity(entity, out var uid)) - AddSessionOverrides(uid.Value, filter); - } - [Obsolete("Don't use this, clear specific overrides")] public void ClearOverride(NetEntity entity) { diff --git a/Robust.Server/ServerStatus/IStatusHandlerContext.cs b/Robust.Server/ServerStatus/IStatusHandlerContext.cs index 2c212ac64bf..740fb14701a 100644 --- a/Robust.Server/ServerStatus/IStatusHandlerContext.cs +++ b/Robust.Server/ServerStatus/IStatusHandlerContext.cs @@ -24,34 +24,8 @@ public interface IStatusHandlerContext IDictionary ResponseHeaders { get; } bool KeepAlive { get; set; } - [Obsolete("Use async versions instead")] - T? RequestBodyJson(); Task RequestBodyJsonAsync(); - [Obsolete("Use async versions instead")] - void Respond( - string text, - HttpStatusCode code = HttpStatusCode.OK, - string contentType = "text/plain"); - - [Obsolete("Use async versions instead")] - void Respond( - string text, - int code = 200, - string contentType = "text/plain"); - - [Obsolete("Use async versions instead")] - void Respond( - byte[] data, - HttpStatusCode code = HttpStatusCode.OK, - string contentType = "text/plain"); - - [Obsolete("Use async versions instead")] - void Respond( - byte[] data, - int code = 200, - string contentType = "text/plain"); - Task RespondNoContentAsync(); Task RespondAsync( @@ -74,14 +48,8 @@ Task RespondAsync( int code = 200, string contentType = "text/plain"); - [Obsolete("Use async versions instead")] - void RespondError(HttpStatusCode code); - Task RespondErrorAsync(HttpStatusCode code); - [Obsolete("Use async versions instead")] - void RespondJson(object jsonData, HttpStatusCode code = HttpStatusCode.OK); - Task RespondJsonAsync(object jsonData, HttpStatusCode code = HttpStatusCode.OK); Task RespondStreamAsync(HttpStatusCode code = HttpStatusCode.OK); diff --git a/Robust.Server/ServerStatus/IStatusHost.cs b/Robust.Server/ServerStatus/IStatusHost.cs index 8add077c034..d76ce80b0ec 100644 --- a/Robust.Server/ServerStatus/IStatusHost.cs +++ b/Robust.Server/ServerStatus/IStatusHost.cs @@ -27,19 +27,6 @@ public interface IStatusHost /// event Action OnInfoRequest; - /// - /// Set information used by automatic-client-zipping to determine the layout of your dev setup, - /// and which assembly files to send. - /// - /// - /// The name of your client project in the bin/ folder on the top of your project. - /// - /// - /// The list of client assemblies to send from the aforementioned folder. - /// - [Obsolete("This API is deprecated as it cannot share information with standalone packaging. Use SetMagicAczProvider instead")] - void SetAczInfo(string clientBinFolder, string[] clientAssemblyNames); - void SetMagicAczProvider(IMagicAczProvider provider); /// diff --git a/Robust.Server/ServerStatus/StatusHost.Acz.Sources.cs b/Robust.Server/ServerStatus/StatusHost.Acz.Sources.cs index b806e58416d..c181159c98b 100644 --- a/Robust.Server/ServerStatus/StatusHost.Acz.Sources.cs +++ b/Robust.Server/ServerStatus/StatusHost.Acz.Sources.cs @@ -171,22 +171,6 @@ private async Task SourceAczViaMagic(AssetPass pass, IPackageLogger logger // -- Information Input -- - public void SetAczInfo(string clientBinFolder, string[] clientAssemblyNames) - { - _aczLock.Wait(); - try - { - if (_aczPrepared != null) - throw new InvalidOperationException("ACZ already prepared"); - - _aczInfo = (clientBinFolder, clientAssemblyNames); - } - finally - { - _aczLock.Release(); - } - } - public void SetMagicAczProvider(IMagicAczProvider provider) { _magicAczProvider = provider; diff --git a/Robust.Server/ServerStatus/StatusHost.cs b/Robust.Server/ServerStatus/StatusHost.cs index 062c1dd8c07..1f74a6cf9b8 100644 --- a/Robust.Server/ServerStatus/StatusHost.cs +++ b/Robust.Server/ServerStatus/StatusHost.cs @@ -269,57 +269,11 @@ public ContextImpl(HttpListenerContext context) _responseHeaders = new Dictionary(); } - public T? RequestBodyJson() - { - return JsonSerializer.Deserialize(RequestBody); - } - public async Task RequestBodyJsonAsync() { return await JsonSerializer.DeserializeAsync(RequestBody); } - public void Respond(string text, HttpStatusCode code = HttpStatusCode.OK, string contentType = MediaTypeNames.Text.Plain) - { - Respond(text, (int)code, contentType); - } - - public void Respond(string text, int code = 200, string contentType = MediaTypeNames.Text.Plain) - { - _context.Response.StatusCode = code; - _context.Response.ContentType = contentType; - - if (RequestMethod == HttpMethod.Head) - { - return; - } - - using var writer = new StreamWriter(_context.Response.OutputStream, EncodingHelpers.UTF8); - - writer.Write(text); - } - - public void Respond(byte[] data, HttpStatusCode code = HttpStatusCode.OK, string contentType = MediaTypeNames.Text.Plain) - { - Respond(data, (int)code, contentType); - } - - public void Respond(byte[] data, int code = 200, string contentType = MediaTypeNames.Text.Plain) - { - _context.Response.StatusCode = code; - _context.Response.ContentType = contentType; - _context.Response.ContentLength64 = data.Length; - - if (RequestMethod == HttpMethod.Head) - { - _context.Response.Close(); - return; - } - - _context.Response.OutputStream.Write(data); - _context.Response.Close(); - } - public Task RespondNoContentAsync() { RespondShared(); @@ -373,27 +327,11 @@ public async Task RespondAsync(byte[] data, int code = 200, string contentType = _context.Response.Close(); } - public void RespondError(HttpStatusCode code) - { - Respond(code.ToString(), code); - } - public Task RespondErrorAsync(HttpStatusCode code) { return RespondAsync(code.ToString(), code); } - public void RespondJson(object jsonData, HttpStatusCode code = HttpStatusCode.OK) - { - RespondShared(); - - _context.Response.ContentType = "application/json"; - - JsonSerializer.Serialize(_context.Response.OutputStream, jsonData); - - _context.Response.Close(); - } - public async Task RespondJsonAsync(object jsonData, HttpStatusCode code = HttpStatusCode.OK) { RespondShared(); diff --git a/Robust.Shared/Audio/SoundSpecifier.cs b/Robust.Shared/Audio/SoundSpecifier.cs index 37137305486..f88254edc23 100644 --- a/Robust.Shared/Audio/SoundSpecifier.cs +++ b/Robust.Shared/Audio/SoundSpecifier.cs @@ -17,9 +17,6 @@ public abstract partial class SoundSpecifier { [DataField("params")] public AudioParams Params { get; set; } = AudioParams.Default; - - [Obsolete("Use SharedAudioSystem.GetSound(), or just pass sound specifier directly into SharedAudioSystem.")] - public abstract string GetSound(IRobustRandom? rand = null, IPrototypeManager? proto = null); } [Serializable, NetSerializable] @@ -45,12 +42,6 @@ public SoundPathSpecifier(ResPath path, AudioParams? @params = null) if (@params.HasValue) Params = @params.Value; } - - [Obsolete("Use SharedAudioSystem.GetSound(), or just pass sound specifier directly into SharedAudioSystem.")] - public override string GetSound(IRobustRandom? rand = null, IPrototypeManager? proto = null) - { - return Path.ToString(); - } } [Serializable, NetSerializable] @@ -70,15 +61,4 @@ public SoundCollectionSpecifier(string collection, AudioParams? @params = null) if (@params.HasValue) Params = @params.Value; } - - [Obsolete("Use SharedAudioSystem.GetSound(), or just pass sound specifier directly into SharedAudioSystem.")] - public override string GetSound(IRobustRandom? rand = null, IPrototypeManager? proto = null) - { - if (Collection == null) - return string.Empty; - - IoCManager.Resolve(ref rand, ref proto); - var soundCollection = proto.Index(Collection); - return rand.Pick(soundCollection.PickFiles).ToString(); - } } diff --git a/Robust.Shared/Containers/ContainerManagerComponent.cs b/Robust.Shared/Containers/ContainerManagerComponent.cs index e86e266a42b..9ce385dd1a6 100644 --- a/Robust.Shared/Containers/ContainerManagerComponent.cs +++ b/Robust.Shared/Containers/ContainerManagerComponent.cs @@ -33,19 +33,6 @@ void ISerializationHooks.AfterDeserialization() } } - [Obsolete] - public T MakeContainer(EntityUid uid, string id) - where T : BaseContainer - => _entMan.System().MakeContainer(uid, id, this); - - [Obsolete] - public BaseContainer GetContainer(string id) - => _entMan.System().GetContainer(Owner, id, this); - - [Obsolete] - public bool HasContainer(string id) - => _entMan.System().HasContainer(Owner, id, this); - [Obsolete] public bool TryGetContainer(string id, [NotNullWhen(true)] out BaseContainer? container) => _entMan.System().TryGetContainer(Owner, id, out container, this); @@ -54,20 +41,6 @@ public bool TryGetContainer(string id, [NotNullWhen(true)] out BaseContainer? co public bool TryGetContainer(EntityUid entity, [NotNullWhen(true)] out BaseContainer? container) => _entMan.System().TryGetContainingContainer(Owner, entity, out container, this); - [Obsolete] - public bool ContainsEntity(EntityUid entity) - => _entMan.System().ContainsEntity(Owner, entity, this); - - [Obsolete] - public bool Remove(EntityUid toremove, - TransformComponent? xform = null, - MetaDataComponent? meta = null, - bool reparent = true, - bool force = false, - EntityCoordinates? destination = null, - Angle? localRotation = null) - => _entMan.System().RemoveEntity(Owner, toremove, this, xform, meta, reparent, force, destination, localRotation); - [Obsolete] public AllContainersEnumerable GetAllContainers() => _entMan.System().GetAllContainers(Owner, this); diff --git a/Robust.Shared/Containers/SharedContainerSystem.cs b/Robust.Shared/Containers/SharedContainerSystem.cs index 88f9e0be181..dafba34fba9 100644 --- a/Robust.Shared/Containers/SharedContainerSystem.cs +++ b/Robust.Shared/Containers/SharedContainerSystem.cs @@ -193,16 +193,6 @@ public bool TryGetContainer( return true; } - [Obsolete("Use variant without skipExistCheck argument")] - public bool TryGetContainingContainer( - EntityUid uid, - EntityUid containedUid, - [NotNullWhen(true)] out BaseContainer? container, - bool skipExistCheck) - { - return TryGetContainingContainer(uid, containedUid, out container); - } - public bool TryGetContainingContainer( EntityUid uid, EntityUid containedUid, diff --git a/Robust.Shared/GameObjects/Components/Appearance/AppearanceComponent.cs b/Robust.Shared/GameObjects/Components/Appearance/AppearanceComponent.cs index daef024d494..e805df1838f 100644 --- a/Robust.Shared/GameObjects/Components/Appearance/AppearanceComponent.cs +++ b/Robust.Shared/GameObjects/Components/Appearance/AppearanceComponent.cs @@ -46,17 +46,4 @@ public sealed partial class AppearanceComponent : Component get { return _appearanceDataInit; } set { AppearanceData = value ?? AppearanceData; _appearanceDataInit = value; } } - - [Obsolete("Use SharedAppearanceSystem instead")] - public bool TryGetData(Enum key, [NotNullWhen(true)] out T data) - { - if (AppearanceData.TryGetValue(key, out var dat) && dat is T) - { - data = (T)dat; - return true; - } - - data = default!; - return false; - } } diff --git a/Robust.Shared/GameObjects/Components/Timers/TimerExtensions.cs b/Robust.Shared/GameObjects/Components/Timers/TimerExtensions.cs index 43812b5caf4..a4402e8279f 100644 --- a/Robust.Shared/GameObjects/Components/Timers/TimerExtensions.cs +++ b/Robust.Shared/GameObjects/Components/Timers/TimerExtensions.cs @@ -15,43 +15,6 @@ private static TimerComponent EnsureTimerComponent(this EntityUid entity) return entMan.EnsureComponent(entity); } - public static void AddTimer(this EntityUid entity, Timer timer, CancellationToken cancellationToken = default) - { - entity - .EnsureTimerComponent() - .AddTimer(timer, cancellationToken); - } - - /// - /// Creates a task that will complete after a given delay. - /// The task is resumed on the main game logic thread. - /// - /// The entity to add the timer to. - /// The length of time, in milliseconds, to delay for. - /// - /// The task that can be awaited. - public static Task DelayTask(this EntityUid entity, int milliseconds, CancellationToken cancellationToken = default) - { - return entity - .EnsureTimerComponent() - .Delay(milliseconds, cancellationToken); - } - - /// - /// Creates a task that will complete after a given delay. - /// The task is resumed on the main game logic thread. - /// - /// The entity to add the timer to. - /// The length of time to delay for. - /// - /// The task that can be awaited. - public static Task DelayTask(this EntityUid entity, TimeSpan duration, CancellationToken cancellationToken = default) - { - return entity - .EnsureTimerComponent() - .Delay((int) duration.TotalMilliseconds, cancellationToken); - } - /// /// Schedule an action to be fired after a certain delay. /// The action will be resumed on the main game logic thread. @@ -84,21 +47,6 @@ public static void SpawnTimer(this EntityUid entity, TimeSpan duration, Action o .Spawn((int) duration.TotalMilliseconds, onFired, cancellationToken); } - /// - /// Schedule an action that repeatedly fires after a delay specified in milliseconds. - /// - /// The entity to add the timer to. - /// The length of time, in milliseconds, to delay before firing the repeated action. - /// The action to fire. - /// The CancellationToken for stopping the Timer. - [Obsolete("Use a system update loop instead")] - public static void SpawnRepeatingTimer(this EntityUid entity, int milliseconds, Action onFired, CancellationToken cancellationToken) - { - entity - .EnsureTimerComponent() - .SpawnRepeating(milliseconds, onFired, cancellationToken); - } - /// /// Schedule an action that repeatedly fires after a delay. /// diff --git a/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs b/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs index a086c5d307e..174b68e3643 100644 --- a/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs +++ b/Robust.Shared/GameObjects/Components/Transform/TransformComponent.cs @@ -386,9 +386,6 @@ public bool Anchored } } - [Obsolete("Use ChildEnumerator")] - public IEnumerable ChildEntities => _children; - public TransformChildrenEnumerator ChildEnumerator => new(_children.GetEnumerator()); [ViewVariables] public int ChildCount => _children.Count; @@ -405,16 +402,6 @@ public void AttachToGridOrMap() _entMan.EntitySysManager.GetEntitySystem().AttachToGridOrMap(Owner, this); } - /// - /// Sets another entity as the parent entity, maintaining world position. - /// - /// - [Obsolete("Use TransformSystem.SetParent() instead")] - public void AttachParent(TransformComponent newParent) - { - _entMan.EntitySysManager.GetEntitySystem().SetParent(Owner, this, newParent.Owner, newParent); - } - internal void UpdateChildMapIdsRecursive( MapId newMapId, EntityUid? newUid, @@ -458,14 +445,6 @@ public void AttachParent(EntityUid parent) return (worldPos, worldRot); } - /// - [Obsolete("Use the system method instead")] - public (Vector2 WorldPosition, Angle WorldRotation) GetWorldPositionRotation(EntityQuery xforms) - { - var (worldPos, worldRot, _) = GetWorldPositionRotationMatrix(xforms); - return (worldPos, worldRot); - } - /// /// Get the WorldPosition, WorldRotation, and WorldMatrix of this entity faster than each individually. /// @@ -502,16 +481,6 @@ public void AttachParent(EntityUid parent) return GetWorldPositionRotationMatrix(xforms); } - /// - /// Get the WorldPosition, WorldRotation, and InvWorldMatrix of this entity faster than each individually. - /// - [Obsolete("Use the system method instead")] - public (Vector2 WorldPosition, Angle WorldRotation, Matrix3x2 InvWorldMatrix) GetWorldPositionRotationInvMatrix() - { - var xformQuery = _entMan.GetEntityQuery(); - return GetWorldPositionRotationInvMatrix(xformQuery); - } - /// /// Get the WorldPosition, WorldRotation, and InvWorldMatrix of this entity faster than each individually. /// @@ -654,13 +623,6 @@ public readonly struct AnchorStateChangedEvent( /// If true, the entity is being detached to null-space /// public readonly bool Detaching = detaching; - - [Obsolete("Use constructor that takes in EntityUid")] - public AnchorStateChangedEvent(TransformComponent transform, bool detaching = false) - : this(transform.Owner, transform, detaching) - { - - } } /// diff --git a/Robust.Shared/GameObjects/EntityManager.Components.cs b/Robust.Shared/GameObjects/EntityManager.Components.cs index 2ab8298cd4e..12bb3f926e0 100644 --- a/Robust.Shared/GameObjects/EntityManager.Components.cs +++ b/Robust.Shared/GameObjects/EntityManager.Components.cs @@ -281,24 +281,6 @@ public static implicit operator T(CompInitializeHandle handle) } } - /// - [Obsolete] - public CompInitializeHandle AddComponentUninitialized(EntityUid uid) where T : IComponent, new() - { - var reg = _componentFactory.GetRegistration(); - var newComponent = (T)_componentFactory.GetComponent(reg); -#pragma warning disable CS0618 // Type or member is obsolete - newComponent.Owner = uid; -#pragma warning restore CS0618 // Type or member is obsolete - - if (!uid.IsValid() || !EntityExists(uid)) - throw new ArgumentException($"Entity {uid} is not valid.", nameof(uid)); - - AddComponentInternal(uid, newComponent, false, true, null); - - return new CompInitializeHandle(this, uid, newComponent, reg.Idx); - } - public void AddComponent( EntityUid uid, EntityPrototype.ComponentRegistryEntry entry, diff --git a/Robust.Shared/GameObjects/EntitySystem.Proxy.cs b/Robust.Shared/GameObjects/EntitySystem.Proxy.cs index fa9b6bc8730..d1ad1e07b4c 100644 --- a/Robust.Shared/GameObjects/EntitySystem.Proxy.cs +++ b/Robust.Shared/GameObjects/EntitySystem.Proxy.cs @@ -141,16 +141,6 @@ protected void DirtyEntity(EntityUid uid, MetaDataComponent? meta = null) EntityManager.DirtyEntity(uid, meta); } - /// - /// Marks a component as dirty. This also implicitly dirties the entity this component belongs to. - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - [Obsolete("Use Dirty(EntityUid, Component, MetaDataComponent?")] - protected void Dirty(IComponent component, MetaDataComponent? meta = null) - { - EntityManager.Dirty(component.Owner, component, meta); - } - /// [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void Dirty(EntityUid uid, IComponent component, MetaDataComponent? meta = null) diff --git a/Robust.Shared/GameObjects/IEntityManager.Components.cs b/Robust.Shared/GameObjects/IEntityManager.Components.cs index 0a749eb4010..e0e7a83b15e 100644 --- a/Robust.Shared/GameObjects/IEntityManager.Components.cs +++ b/Robust.Shared/GameObjects/IEntityManager.Components.cs @@ -74,19 +74,6 @@ public partial interface IEntityManager /// IComponent AddComponent(EntityUid uid, ushort netId, MetaDataComponent? meta = null); - /// - /// Adds an uninitialized Component type to an entity. - /// - /// - /// This function returns a disposable initialize handle that you can use in a statement, to set up a component - /// before initialization is ran on it. - /// - /// Concrete component type to add. - /// Entity being modified. - /// Component initialization handle. When you are done setting up the component, make sure to dispose this. - [Obsolete] - EntityManager.CompInitializeHandle AddComponentUninitialized(EntityUid uid) where T : IComponent, new(); - /// /// Adds a Component to an entity. If the entity is already Initialized, the component will /// automatically be Initialized and Started. diff --git a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs index 35e7887dc1e..02280cecfde 100644 --- a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs +++ b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.ComponentQueries.cs @@ -634,12 +634,6 @@ public void GetEntitiesInRange(Type type, MapCoordinates coordinates, float rang GetEntitiesInRange(type, coordinates.MapId, coordinates.Position, range, entities, flags); } - [Obsolete] - public HashSet GetComponentsInRange(MapCoordinates coordinates, float range) where T : IComponent - { - return GetComponentsInRange(coordinates.MapId, coordinates.Position, range); - } - public void GetEntitiesInRange(MapCoordinates coordinates, float range, HashSet> entities, LookupFlags flags = DefaultFlags) where T : IComponent { GetEntitiesInRange(coordinates.MapId, coordinates.Position, range, entities, flags); @@ -668,14 +662,6 @@ public void GetEntitiesInRange(Type type, MapId mapId, Vector2 worldPos, float r GetEntitiesIntersecting(type, mapId, circle, transform, entities, flags); } - [Obsolete] - public HashSet GetComponentsInRange(MapId mapId, Vector2 worldPos, float range) where T : IComponent - { - var entities = new HashSet>(); - GetEntitiesInRange(mapId, worldPos, range, entities); - return [..entities.Select(e => e.Comp)]; - } - public void GetEntitiesInRange(MapId mapId, Vector2 worldPos, float range, HashSet> entities, LookupFlags flags = DefaultFlags) where T : IComponent { var shape = new PhysShapeCircle(range, worldPos); diff --git a/Robust.Shared/GameObjects/Systems/SharedTransformSystem.Component.cs b/Robust.Shared/GameObjects/Systems/SharedTransformSystem.Component.cs index aed80ff5cba..92888a839c1 100644 --- a/Robust.Shared/GameObjects/Systems/SharedTransformSystem.Component.cs +++ b/Robust.Shared/GameObjects/Systems/SharedTransformSystem.Component.cs @@ -1107,13 +1107,6 @@ public void SetWorldRotation(TransformComponent component, Angle angle, EntityQu #region Set Position+Rotation - [MethodImpl(MethodImplOptions.AggressiveInlining)] - [Obsolete("Use override with EntityUid")] - public void SetWorldPositionRotation(TransformComponent component, Vector2 worldPos, Angle worldRot) - { - SetWorldPositionRotation(component.Owner, worldPos, worldRot, component); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] public void SetWorldPositionRotation(EntityUid uid, Vector2 worldPos, Angle worldRot, TransformComponent? component = null) { diff --git a/Robust.Shared/Log/Logger.cs b/Robust.Shared/Log/Logger.cs index 0beeacebdb5..f0ee62ddcbb 100644 --- a/Robust.Shared/Log/Logger.cs +++ b/Robust.Shared/Log/Logger.cs @@ -100,13 +100,6 @@ public static void Log(LogLevel logLevel, string message) [Obsolete("Use ISawmill.Log")] public static void DebugS(string sawmill, string message) => LogS(LogLevel.Debug, sawmill, message); - /// - /// Log a message as debug, taking in a format string and format list using the regular syntax. - /// - /// - [Obsolete("Use ISawmill.Debug")] - public static void Debug(string message, params object?[] args) => Log(LogLevel.Debug, message, args); - /// /// Log a message as debug. /// @@ -128,13 +121,6 @@ public static void Log(LogLevel logLevel, string message) [Obsolete("Use ISawmill.Info")] public static void InfoS(string sawmill, string message) => LogS(LogLevel.Info, sawmill, message); - /// - /// Log a message as info, taking in a format string and format list using the regular syntax. - /// - /// - [Obsolete("Use ISawmill.Info")] - public static void Info(string message, params object?[] args) => Log(LogLevel.Info, message, args); - /// /// Log a message as info. /// @@ -156,13 +142,6 @@ public static void Log(LogLevel logLevel, string message) [Obsolete("Use ISawmill.Warning")] public static void WarningS(string sawmill, string message) => LogS(LogLevel.Warning, sawmill, message); - /// - /// Log a message as warning, taking in a format string and format list using the regular syntax. - /// - /// - [Obsolete("Use ISawmill.Warning")] - public static void Warning(string message, params object?[] args) => Log(LogLevel.Warning, message, args); - /// /// Log a message as warning. /// @@ -177,13 +156,6 @@ public static void Log(LogLevel logLevel, string message) [Obsolete("Use ISawmill.Error")] public static void ErrorS(string sawmill, string message, params object?[] args) => LogS(LogLevel.Error, sawmill, message, args); - /// - /// Log a message as error, taking in a format string and format list using the regular syntax. - /// - /// - [Obsolete("Use ISawmill.Error")] - public static void ErrorS(string sawmill, Exception exception, string message, params object?[] args) => LogS(LogLevel.Error, sawmill, exception, message, args); - /// /// Log a message as error. /// @@ -204,33 +176,5 @@ public static void Log(LogLevel logLevel, string message) /// [Obsolete("Use ISawmill.Error")] public static void Error(string message) => Log(LogLevel.Error, message); - - /// - /// Log a message as fatal, taking in a format string and format list using the regular syntax. - /// - /// - [Obsolete("Use ISawmill.Fatal")] - public static void FatalS(string sawmill, string message, params object?[] args) => LogS(LogLevel.Fatal, sawmill, message, args); - - /// - /// Log a message as fatal. - /// - /// - [Obsolete("Use ISawmill.Fatal")] - public static void FatalS(string sawmill, string message) => LogS(LogLevel.Fatal, sawmill, message); - - /// - /// Log a message as fatal, taking in a format string and format list using the regular syntax. - /// - /// - [Obsolete("Use ISawmill.Fatal")] - public static void Fatal(string message, params object?[] args) => Log(LogLevel.Fatal, message, args); - - /// - /// Log a message as fatal. - /// - /// - [Obsolete("Use ISawmill.Fatal")] - public static void Fatal(string message) => Log(LogLevel.Fatal, message); } } diff --git a/Robust.Shared/Map/Components/MapGridComponent.cs b/Robust.Shared/Map/Components/MapGridComponent.cs index 882d6a821d1..e4a646faf39 100644 --- a/Robust.Shared/Map/Components/MapGridComponent.cs +++ b/Robust.Shared/Map/Components/MapGridComponent.cs @@ -75,12 +75,6 @@ public sealed partial class MapGridComponent : Component #region TileAccess - [Obsolete("Use the MapSystem method")] - public TileRef GetTileRef(MapCoordinates coords) - { - return MapSystem.GetTileRef(Owner, this, coords); - } - [Obsolete("Use the MapSystem method")] public TileRef GetTileRef(EntityCoordinates coords) { @@ -123,20 +117,6 @@ public void SetTiles(List<(Vector2i GridIndices, Tile Tile)> tiles) MapSystem.SetTiles(Owner, this, tiles); } - [Obsolete("Use the MapSystem method")] - public IEnumerable GetLocalTilesIntersecting(Box2Rotated localArea, bool ignoreEmpty = true, - Predicate? predicate = null) - { - return MapSystem.GetLocalTilesIntersecting(Owner, this, localArea, ignoreEmpty, predicate); - } - - [Obsolete("Use the MapSystem method")] - public IEnumerable GetTilesIntersecting(Box2Rotated worldArea, bool ignoreEmpty = true, - Predicate? predicate = null) - { - return MapSystem.GetTilesIntersecting(Owner, this, worldArea, ignoreEmpty, predicate); - } - [Obsolete("Use the MapSystem method")] public IEnumerable GetTilesIntersecting(Box2 worldArea, bool ignoreEmpty = true, Predicate? predicate = null) @@ -202,18 +182,6 @@ public AnchoredEntitiesEnumerator GetAnchoredEntitiesEnumerator(Vector2i pos) return MapSystem.GetAnchoredEntitiesEnumerator(Owner, this, pos); } - [Obsolete("Use the MapSystem method")] - public IEnumerable GetLocalAnchoredEntities(Box2 localAABB) - { - return MapSystem.GetLocalAnchoredEntities(Owner, this, localAABB); - } - - [Obsolete("Use the MapSystem method")] - public IEnumerable GetAnchoredEntities(Box2 worldAABB) - { - return MapSystem.GetAnchoredEntities(Owner, this, worldAABB); - } - [Obsolete("Use the MapSystem method")] public Vector2i TileIndicesFor(EntityCoordinates coords) { @@ -226,24 +194,6 @@ public Vector2i TileIndicesFor(MapCoordinates worldPos) return MapSystem.TileIndicesFor(Owner, this, worldPos); } - [Obsolete("Use the MapSystem method")] - public IEnumerable GetInDir(EntityCoordinates position, Direction dir) - { - return MapSystem.GetInDir(Owner, this, position, dir); - } - - [Obsolete("Use the MapSystem method")] - public IEnumerable GetLocal(EntityCoordinates coords) - { - return MapSystem.GetLocal(Owner, this, coords); - } - - [Obsolete("Use the MapSystem method")] - public IEnumerable GetCardinalNeighborCells(EntityCoordinates coords) - { - return MapSystem.GetCardinalNeighborCells(Owner, this, coords); - } - [Obsolete("Use the MapSystem method")] public IEnumerable GetCellsInSquareArea(EntityCoordinates coords, int n) { @@ -288,18 +238,6 @@ public Vector2i CoordinatesToTile(EntityCoordinates coords) return MapSystem.CoordinatesToTile(Owner, this, coords); } - [Obsolete("Use the MapSystem method")] - public bool CollidesWithGrid(Vector2i indices) - { - return MapSystem.CollidesWithGrid(Owner, this, indices); - } - - [Obsolete("Use the MapSystem method")] - public Vector2i GridTileToChunkIndices(Vector2i gridTile) - { - return MapSystem.GridTileToChunkIndices(Owner, this, gridTile); - } - [Obsolete("Use the MapSystem method")] public EntityCoordinates GridTileToLocal(Vector2i gridTile) { @@ -312,12 +250,6 @@ public Vector2 GridTileToWorldPos(Vector2i gridTile) return MapSystem.GridTileToWorldPos(Owner, this, gridTile); } - [Obsolete("Use the MapSystem method")] - public MapCoordinates GridTileToWorld(Vector2i gridTile) - { - return MapSystem.GridTileToWorld(Owner, this, gridTile); - } - [Obsolete("Use the MapSystem method")] public bool TryGetTileRef(Vector2i indices, out TileRef tile) { diff --git a/Robust.Shared/Map/EntityCoordinates.cs b/Robust.Shared/Map/EntityCoordinates.cs index de887eb6acc..011eb4bc8b5 100644 --- a/Robust.Shared/Map/EntityCoordinates.cs +++ b/Robust.Shared/Map/EntityCoordinates.cs @@ -76,61 +76,30 @@ public bool IsValid(IEntityManager entityManager) return true; } - [Obsolete("Use SharedTransformSystem.ToMapCoordinates()")] - public MapCoordinates ToMap(IEntityManager entityManager) - { - return ToMap(entityManager, entityManager.System()); - } - [Obsolete("Use SharedTransformSystem.ToMapCoordinates()")] public MapCoordinates ToMap(IEntityManager entityManager, SharedTransformSystem transformSystem) { return transformSystem.ToMapCoordinates(this); } - [Obsolete("Use SharedTransformSystem.ToMapCoordinates()")] - public Vector2 ToMapPos(IEntityManager entityManager) - { - return ToMap(entityManager, entityManager.System()).Position; - } - [Obsolete("Use SharedTransformSystem.ToMapCoordinates()")] public Vector2 ToMapPos(IEntityManager entityManager, SharedTransformSystem transformSystem) { return ToMap(entityManager, transformSystem).Position; } - [Obsolete("Use SharedTransformSystem.ToCoordinates()")] - public static EntityCoordinates FromMap(EntityUid entity, MapCoordinates coordinates, IEntityManager? entMan = null) - { - IoCManager.Resolve(ref entMan); - return FromMap(entity, coordinates, entMan.System(), entMan); - } - [Obsolete("Use SharedTransformSystem.ToCoordinates()")] public static EntityCoordinates FromMap(EntityUid entity, MapCoordinates coordinates, SharedTransformSystem transformSystem, IEntityManager? entMan = null) { return transformSystem.ToCoordinates(entity, coordinates); } - [Obsolete("Use SharedTransformSystem.ToCoordinates()")] - public static EntityCoordinates FromMap(IEntityManager entityManager, EntityUid entityUid, MapCoordinates coordinates) - { - return FromMap(entityUid, coordinates, entityManager.System(), entityManager); - } - [Obsolete("Use SharedTransformSystem.ToCoordinates()")] public static EntityCoordinates FromMap(IMapManager mapManager, MapCoordinates coordinates) { return IoCManager.Resolve().System().ToCoordinates(coordinates); } - [Obsolete("Use overload with TransformSystem")] - public Vector2i ToVector2i(IEntityManager entityManager, IMapManager mapManager) - { - return ToVector2i(entityManager, mapManager, entityManager.System()); - } - /// /// Converts this set of coordinates to Vector2i. /// diff --git a/Robust.Shared/Map/IMapManager.cs b/Robust.Shared/Map/IMapManager.cs index 918a160103d..db37657a152 100644 --- a/Robust.Shared/Map/IMapManager.cs +++ b/Robust.Shared/Map/IMapManager.cs @@ -71,15 +71,6 @@ public interface IMapManager Entity CreateGridEntity(MapId currentMapId, GridCreateOptions? options = null); Entity CreateGridEntity(EntityUid map, GridCreateOptions? options = null); - [Obsolete("Use GetComponent(uid)")] - MapGridComponent GetGrid(EntityUid gridId); - - [Obsolete("Use TryGetComponent(uid, out MapGridComponent? grid)")] - bool TryGetGrid([NotNullWhen(true)] EntityUid? euid, [NotNullWhen(true)] out MapGridComponent? grid); - - [Obsolete("Use HasComponent(uid)")] - bool GridExists([NotNullWhen(true)] EntityUid? euid); - IEnumerable GetAllMapGrids(MapId mapId); IEnumerable> GetAllGrids(MapId mapId); diff --git a/Robust.Shared/Map/MapManager.GridCollection.cs b/Robust.Shared/Map/MapManager.GridCollection.cs index 67d6393168b..50aba226ea2 100644 --- a/Robust.Shared/Map/MapManager.GridCollection.cs +++ b/Robust.Shared/Map/MapManager.GridCollection.cs @@ -39,35 +39,12 @@ public Entity CreateGridEntity(EntityUid map, GridCreateOption return CreateGrid(map, options.Value.ChunkSize, default); } - [Obsolete("Use GetComponent(uid)")] - public MapGridComponent GetGrid(EntityUid gridId) - => EntityManager.GetComponent(gridId); - [Obsolete("Use HasComponent(uid)")] public bool IsGrid(EntityUid uid) { return EntityManager.HasComponent(uid); } - [Obsolete("Use TryGetComponent(uid, out MapGridComponent? grid)")] - public bool TryGetGrid([NotNullWhen(true)] EntityUid? euid, [MaybeNullWhen(false)] out MapGridComponent grid) - { - if (EntityManager.TryGetComponent(euid, out MapGridComponent? comp)) - { - grid = comp; - return true; - } - - grid = default; - return false; - } - - [Obsolete("Use HasComponent(uid)")] - public bool GridExists([NotNullWhen(true)] EntityUid? euid) - { - return EntityManager.HasComponent(euid); - } - public IEnumerable GetAllMapGrids(MapId mapId) { var query = EntityManager.AllEntityQueryEnumerator(); diff --git a/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Components.cs b/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Components.cs index 730f5e18ebf..3d542c7c809 100644 --- a/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Components.cs +++ b/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Components.cs @@ -242,12 +242,6 @@ public void ResetDynamics(EntityUid uid, PhysicsComponent body, bool dirty = tru Dirty(uid, body); } - [Obsolete("Use overload that takes EntityUid")] - public void ResetDynamics(PhysicsComponent body, bool dirty = true) - { - ResetDynamics(body.Owner, body, dirty); - } - public void ResetMassData(EntityUid uid, FixturesComponent? manager = null, PhysicsComponent? body = null) { if (!PhysicsQuery.Resolve(uid, ref body)) @@ -392,12 +386,6 @@ public void SetAngularDamping(EntityUid uid, PhysicsComponent body, float value, Dirty(uid, body); } - [Obsolete("Use overload that takes EntityUid")] - public void SetAngularDamping(PhysicsComponent body, float value, bool dirty = true) - { - SetAngularDamping(body.Owner, body, value, dirty); - } - public void SetLinearDamping(EntityUid uid, PhysicsComponent body, float value, bool dirty = true) { if (MathHelper.CloseTo(body.LinearDamping, value)) @@ -409,12 +397,6 @@ public void SetLinearDamping(EntityUid uid, PhysicsComponent body, float value, Dirty(uid, body); } - [Obsolete("Use overload that takes EntityUid")] - public void SetLinearDamping(PhysicsComponent body, float value, bool dirty = true) - { - SetLinearDamping(body.Owner, body, value, dirty); - } - [Obsolete("Use SetAwake with EntityUid")] public void SetAwake(EntityUid uid, PhysicsComponent body, bool value, bool updateSleepTime = true) { @@ -524,12 +506,6 @@ public void SetBodyStatus(EntityUid uid, PhysicsComponent body, BodyStatus statu Dirty(uid, body); } - [Obsolete("Use overload that takes EntityUid")] - public void SetBodyStatus(PhysicsComponent body, BodyStatus status, bool dirty = true) - { - SetBodyStatus(body.Owner, body, status, dirty); - } - /// /// Sets the property; this handles whether the body is enabled. /// @@ -609,12 +585,6 @@ public void SetFriction(EntityUid uid, PhysicsComponent body, float value, bool Dirty(uid, body); } - [Obsolete("Use overload that takes EntityUid")] - public void SetFriction(PhysicsComponent body, float value, bool dirty = true) - { - SetFriction(body.Owner, body, value, dirty); - } - public void SetInertia(EntityUid uid, PhysicsComponent body, float value, bool dirty = true) { DebugTools.Assert(!float.IsNaN(value)); @@ -634,12 +604,6 @@ public void SetInertia(EntityUid uid, PhysicsComponent body, float value, bool d } } - [Obsolete("Use overload that takes EntityUid")] - public void SetInertia(PhysicsComponent body, float value, bool dirty = true) - { - SetInertia(body.Owner, body, value, dirty); - } - public void SetLocalCenter(EntityUid uid, PhysicsComponent body, Vector2 value) { if (body.BodyType != BodyType.Dynamic) return; diff --git a/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Queries.cs b/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Queries.cs index b76401dcafa..69893eaf9d4 100644 --- a/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Queries.cs +++ b/Robust.Shared/Physics/Systems/SharedPhysicsSystem.Queries.cs @@ -178,13 +178,6 @@ public IEnumerable> GetCollidingEntities(MapId mapId, i return bodies; } - - [Obsolete("Use override that takes in a entity Uid")] - public HashSet GetContactingEntities(PhysicsComponent body, bool approximate = false) - { - return GetContactingEntities(body.Owner, body); - } - public HashSet GetContactingEntities(EntityUid uid, PhysicsComponent? body = null, bool approximate = false) { // HashSet to ensure that we only return each entity once, instead of once per colliding fixture. diff --git a/Robust.Shared/Player/Filter.cs b/Robust.Shared/Player/Filter.cs index c96bb0daace..3876c5e3b99 100644 --- a/Robust.Shared/Player/Filter.cs +++ b/Robust.Shared/Player/Filter.cs @@ -49,16 +49,6 @@ public Filter AddPlayersByPvs(EntityUid origin, float rangeMultiplier = 2f, IEnt return AddPlayersByPvs(transformSystem.GetMapCoordinates(transform), rangeMultiplier, entityManager, playerMan, cfgMan); } - /// - /// Adds all players inside an entity's PVS. - /// The current PVS range will be multiplied by . - /// - [Obsolete("Use overload that takes in managers")] - public Filter AddPlayersByPvs(TransformComponent origin, float rangeMultiplier = 2f) - { - return AddPlayersByPvs(origin.MapPosition, rangeMultiplier); - } - /// /// Adds all players inside an entity's PVS. /// The current PVS range will be multiplied by . @@ -372,15 +362,6 @@ public static Filter Pvs(EntityUid origin, float rangeMultiplier = 2f, IEntityMa return Empty().AddPlayersByPvs(origin, rangeMultiplier, entityManager, playerManager, cfgManager); } - /// - /// A filter with every player whose PVS overlaps this point. - /// - [Obsolete("Use overload that takes in managers")] - public static Filter Pvs(TransformComponent origin, float rangeMultiplier = 2f) - { - return Empty().AddPlayersByPvs(origin, rangeMultiplier); - } - /// /// A filter with every player whose PVS overlaps this point. /// diff --git a/Robust.Shared/Player/ICommonSession.cs b/Robust.Shared/Player/ICommonSession.cs index b5ef46aa906..7e5c9dfc62e 100644 --- a/Robust.Shared/Player/ICommonSession.cs +++ b/Robust.Shared/Player/ICommonSession.cs @@ -44,7 +44,7 @@ public interface ICommonSession /// On the Server every player has a network channel, /// on the Client only the LocalPlayer has a network channel, and that channel points to the server. /// - INetChannel Channel { get; [Obsolete] set; } + INetChannel Channel { get; set; } LoginType AuthType { get; } @@ -65,9 +65,6 @@ public interface ICommonSession /// SessionData Data { get; } - [Obsolete("Just use the Channel field instead.")] - INetChannel ConnectedClient => Channel; - /// /// If true, this indicates that this is a client-side session, and should be ignored when applying a server's /// game state. diff --git a/Robust.Shared/Player/ISharedPlayerManager.cs b/Robust.Shared/Player/ISharedPlayerManager.cs index 159bb581fd2..7631067ea18 100644 --- a/Robust.Shared/Player/ISharedPlayerManager.cs +++ b/Robust.Shared/Player/ISharedPlayerManager.cs @@ -167,7 +167,4 @@ bool SetAttachedEntity([NotNullWhen(true)] ICommonSession? session, EntityUid? e /// Set the session's status to . /// void JoinGame(ICommonSession session); - - [Obsolete("Use GetSessionById()")] - ICommonSession GetSessionByUserId(NetUserId user) => GetSessionById(user); } diff --git a/Robust.Shared/Prototypes/IPrototypeManager.cs b/Robust.Shared/Prototypes/IPrototypeManager.cs index deea42796e7..22211c2495a 100644 --- a/Robust.Shared/Prototypes/IPrototypeManager.cs +++ b/Robust.Shared/Prototypes/IPrototypeManager.cs @@ -161,61 +161,6 @@ bool TryGetInstances([NotNullWhen(true)] out FrozenDictionary? ins bool HasMapping(string id); bool TryGetMapping(Type kind, string id, [NotNullWhen(true)] out MappingDataNode? mappings); - /// - /// Returns whether a prototype variant exists. - /// - /// Identifier for the prototype variant. - /// Whether the prototype variant exists. - [Obsolete("Variant is outdated naming, use *kind* functions instead")] - bool HasVariant(string variant); - - /// - /// Returns the Type for a prototype variant. - /// - /// Identifier for the prototype variant. - /// The specified prototype Type. - /// - /// Thrown when the specified prototype variant isn't registered or doesn't exist. - /// - [Obsolete("Variant is outdated naming, use *kind* functions instead")] - Type GetVariantType(string variant); - - /// - /// Attempts to get the Type for a prototype variant. - /// - /// Identifier for the prototype variant. - /// The specified prototype Type, or null. - /// Whether the prototype type was found and isn't null. - [Obsolete("Variant is outdated naming, use *kind* functions instead")] - bool TryGetVariantType(string variant, [NotNullWhen(true)] out Type? prototype); - - /// - /// Attempts to get a prototype's variant. - /// - /// - /// - /// - [Obsolete("Variant is outdated naming, use *kind* functions instead")] - bool TryGetVariantFrom(Type type, [NotNullWhen(true)] out string? variant); - - /// - /// Attempts to get a prototype's variant. - /// - /// The prototype in question. - /// Identifier for the prototype variant, or null. - /// Whether the prototype variant was successfully retrieved. - [Obsolete("Variant is outdated naming, use *kind* functions instead")] - bool TryGetVariantFrom(IPrototype prototype, [NotNullWhen(true)] out string? variant); - - /// - /// Attempts to get a prototype's variant. - /// - /// Identifier for the prototype variant, or null. - /// The prototype in question. - /// Whether the prototype variant was successfully retrieved. - [Obsolete("Variant is outdated naming, use *kind* functions instead")] - bool TryGetVariantFrom([NotNullWhen(true)] out string? variant) where T : class, IPrototype; - /// /// Returns whether a prototype kind exists. /// @@ -355,14 +300,6 @@ void ReloadPrototypes(Dictionary> modified, /// void RegisterIgnore(string name); - /// - /// Loads a single prototype class type into the manager. - /// - /// A prototype class type that implements IPrototype. This type also - /// requires a with a non-empty class string. - [Obsolete("Prototype type is outdated naming, use *king* functions instead")] - void RegisterType(Type protoClass); - /// /// Loads several prototype kinds into the manager. Note that this will re-build a frozen dictionary and should be avoided if possible. /// diff --git a/Robust.Shared/Prototypes/PrototypeManager.cs b/Robust.Shared/Prototypes/PrototypeManager.cs index 4116395d32a..d063ee20d66 100644 --- a/Robust.Shared/Prototypes/PrototypeManager.cs +++ b/Robust.Shared/Prototypes/PrototypeManager.cs @@ -806,30 +806,6 @@ public bool TryGetMapping(Type kind, string id, [NotNullWhen(true)] out MappingD return _kinds[kind].Results.TryGetValue(id, out mappings); } - [Obsolete("Variant is outdated naming, use *kind* functions instead")] - public bool HasVariant(string variant) => HasKind(variant); - - [Obsolete("Variant is outdated naming, use *kind* functions instead")] - public Type GetVariantType(string variant) => GetKindType(variant); - - [Obsolete("Variant is outdated naming, use *kind* functions instead")] - public bool TryGetVariantType(string variant, [NotNullWhen(true)] out Type? prototype) - { - return TryGetKindType(variant, out prototype); - } - - [Obsolete("Variant is outdated naming, use *kind* functions instead")] - public bool TryGetVariantFrom(Type type, [NotNullWhen(true)] out string? variant) - { - return TryGetKindFrom(type, out variant); - } - - [Obsolete("Variant is outdated naming, use *kind* functions instead")] - public bool TryGetVariantFrom([NotNullWhen(true)] out string? variant) where T : class, IPrototype - { - return TryGetKindFrom(out variant); - } - public bool HasKind(string kind) { return _kindNames.ContainsKey(kind); @@ -918,20 +894,12 @@ public bool TryGetKindFrom([NotNullWhen(true)] out string? kind) where T : cl return TryGetKindFrom(typeof(T), out kind); } - [Obsolete("Variant is outdated naming, use *kind* functions instead")] - public bool TryGetVariantFrom(IPrototype prototype, [NotNullWhen(true)] out string? variant) - { - return TryGetKindFrom(prototype, out variant); - } - /// public void RegisterIgnore(string name) { _ignoredPrototypeTypes.Add(name); } - void IPrototypeManager.RegisterType(Type type) => RegisterKind(type); - static string CalculatePrototypeName(Type type) { const string prototype = "Prototype"; diff --git a/Robust.UnitTesting/RobustIntegrationTest.cs b/Robust.UnitTesting/RobustIntegrationTest.cs index c983acf8136..9a6f7db880e 100644 --- a/Robust.UnitTesting/RobustIntegrationTest.cs +++ b/Robust.UnitTesting/RobustIntegrationTest.cs @@ -830,8 +830,6 @@ public async Task RemoveAllDummySessions() public sealed class ClientIntegrationInstance : IntegrationInstance { - [Obsolete("Use Session instead")] - public LocalPlayer? Player => ((IPlayerManager) PlayerMan).LocalPlayer; public ICommonSession? Session => ((IPlayerManager) PlayerMan).LocalSession; public NetUserId? User => Session?.UserId; public EntityUid? AttachedEntity => Session?.AttachedEntity; From 4faef1bfd3b70a80ae5d72898cfc81032426a8de Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Thu, 12 Sep 2024 13:53:36 +1000 Subject: [PATCH 08/34] Add another lookup override (#5436) --- .../Systems/EntityLookupSystem.LocalQueries.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.LocalQueries.cs b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.LocalQueries.cs index d0ec3fae883..93bb4874016 100644 --- a/Robust.Shared/GameObjects/Systems/EntityLookupSystem.LocalQueries.cs +++ b/Robust.Shared/GameObjects/Systems/EntityLookupSystem.LocalQueries.cs @@ -68,6 +68,16 @@ public HashSet GetLocalEntitiesIntersecting(EntityUid gridId, Vector2 return intersecting; } + /// + /// Gets entities intersecting to the relative broadphase entity. Does NOT turn the transform into local terms. + /// + public void GetLocalEntitiesIntersecting(EntityUid gridUid, IPhysShape shape, Transform localTransform, HashSet intersecting, LookupFlags flags = DefaultFlags, BroadphaseComponent? lookup = null) + { + var localAABB = shape.ComputeAABB(localTransform, 0); + AddEntitiesIntersecting(gridUid, intersecting, shape, localAABB, localTransform, flags: flags, lookup: lookup); + AddContained(intersecting, flags); + } + /// /// Gets the entities intersecting the specified broadphase entity using a local AABB. /// From dbe6f6588067eed6800c3e211a1a95c3e8a46f62 Mon Sep 17 00:00:00 2001 From: metalgearsloth Date: Thu, 12 Sep 2024 13:56:27 +1000 Subject: [PATCH 09/34] Version: 234.0.0 --- MSBuild/Robust.Engine.Version.props | 2 +- RELEASE-NOTES.md | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/MSBuild/Robust.Engine.Version.props b/MSBuild/Robust.Engine.Version.props index 9c5b9a74d07..ef0b48e216f 100644 --- a/MSBuild/Robust.Engine.Version.props +++ b/MSBuild/Robust.Engine.Version.props @@ -1,4 +1,4 @@ - 233.1.0 + 234.0.0 diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 47e734429f9..1d08fe6dd02 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -54,6 +54,22 @@ END TEMPLATE--> *None yet* +## 234.0.0 + +### Breaking changes + +* Remove a lot of obsoleted code that has been obsoleted for a while. + +### New features + +* Add another GetLocalEntitiesIntersecting override. + +### Other + +* Mark large replays as requiring Server GC. +* Obsolete some IResourceCache proxies. + + ## 233.1.0 ### New features From 45b7500d9365d7a541da2133bbb4fb5070698426 Mon Sep 17 00:00:00 2001 From: Fildrance Date: Thu, 12 Sep 2024 10:41:40 +0300 Subject: [PATCH 10/34] feat: added audio system predicted method for only one receiver (#5435) * feat: added audio system predicted method for only one receiver * renamed to PlayLocal * tweak --------- Co-authored-by: pa.pecherskij Co-authored-by: metalgearsloth --- RELEASE-NOTES.md | 4 ++-- Robust.Client/Audio/AudioSystem.cs | 11 +++++++++++ Robust.Server/Audio/AudioSystem.cs | 11 +++++++++++ Robust.Shared/Audio/Systems/SharedAudioSystem.cs | 9 +++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 1d08fe6dd02..309e31ad7f0 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -39,7 +39,7 @@ END TEMPLATE--> ### New features -*None yet* +* SharedAudioSystem now has PlayLocal which only runs audio locally on the client. ### Bugfixes @@ -74,7 +74,7 @@ END TEMPLATE--> ### New features -* Add GetGridEntities and another GetEntitiesIntersecting overload to EntityLookupSystem. +* Add GetGridEntities and another GetEntitiesIntersecting overload to EntityLookupSystem. * `MarkupNode` is now `IEquatable`. It already supported equality checks, now it implements the interface. * Added `Entity` overloads to the following `SharedMapSystem` methods: `GetTileRef`, `GetAnchoredEntities`, `TileIndicesFor`. * Added `EntityUid`-only overloads to the following `SharedTransformSystem` methods: `AnchorEntity`, `Unanchor`. diff --git a/Robust.Client/Audio/AudioSystem.cs b/Robust.Client/Audio/AudioSystem.cs index 2eabb9fbb24..d7630edaacd 100644 --- a/Robust.Client/Audio/AudioSystem.cs +++ b/Robust.Client/Audio/AudioSystem.cs @@ -453,6 +453,17 @@ public override (EntityUid Entity, AudioComponent Component)? PlayPredicted(Soun return null; // uhh Lets hope predicted audio never needs to somehow store the playing audio.... } + /// + public override (EntityUid Entity, AudioComponent Component)? PlayLocal( + SoundSpecifier? sound, + EntityUid source, + EntityUid? soundInitiator, + AudioParams? audioParams = null + ) + { + return PlayPredicted(sound, source, soundInitiator, audioParams); + } + public override (EntityUid Entity, AudioComponent Component)? PlayPredicted(SoundSpecifier? sound, EntityCoordinates coordinates, EntityUid? user, AudioParams? audioParams = null) { if (Timing.IsFirstTimePredicted && sound != null) diff --git a/Robust.Server/Audio/AudioSystem.cs b/Robust.Server/Audio/AudioSystem.cs index 0bb6b1b30c5..916d9ce0e32 100644 --- a/Robust.Server/Audio/AudioSystem.cs +++ b/Robust.Server/Audio/AudioSystem.cs @@ -175,6 +175,17 @@ public override (EntityUid Entity, AudioComponent Component)? PlayPvs(string? fi return (entity, entity.Comp); } + /// + public override (EntityUid Entity, AudioComponent Component)? PlayLocal( + SoundSpecifier? sound, + EntityUid source, + EntityUid? soundInitiator, + AudioParams? audioParams = null + ) + { + return null; + } + /// public override (EntityUid Entity, AudioComponent Component)? PlayPredicted(SoundSpecifier? sound, EntityUid source, EntityUid? user, AudioParams? audioParams = null) { diff --git a/Robust.Shared/Audio/Systems/SharedAudioSystem.cs b/Robust.Shared/Audio/Systems/SharedAudioSystem.cs index 7bed97f5ef3..9fff8c8fb94 100644 --- a/Robust.Shared/Audio/Systems/SharedAudioSystem.cs +++ b/Robust.Shared/Audio/Systems/SharedAudioSystem.cs @@ -574,6 +574,15 @@ public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPvs public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPvs(string? filename, EntityUid uid, AudioParams? audioParams = null); + /// + /// Plays a predicted sound following an entity for only one entity. The client-side system plays this sound as normal, server will do nothing. + /// + /// The sound specifier that points the audio file(s) that should be played. + /// The UID of the entity "emitting" the audio. + /// The UID of the user that initiated this sound. This is usually some player's controlled entity. + [return: NotNullIfNotNull("sound")] + public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayLocal(SoundSpecifier? sound, EntityUid source, EntityUid? soundInitiator, AudioParams? audioParams = null); + /// /// Plays a predicted sound following an entity. The server will send the sound to every player in PVS range, /// unless that player is attached to the "user" entity that initiated the sound. The client-side system plays From f7287b181d51b46717a430c875644b51b9f181df Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:48:37 +1000 Subject: [PATCH 11/34] Fix audioparams for playglobal (#5437) --- Robust.Shared/Audio/Systems/SharedAudioSystem.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Robust.Shared/Audio/Systems/SharedAudioSystem.cs b/Robust.Shared/Audio/Systems/SharedAudioSystem.cs index 9fff8c8fb94..e58c0ed36c1 100644 --- a/Robust.Shared/Audio/Systems/SharedAudioSystem.cs +++ b/Robust.Shared/Audio/Systems/SharedAudioSystem.cs @@ -428,7 +428,7 @@ public TimeSpan GetAudioLength(string filename) [return: NotNullIfNotNull("sound")] public (EntityUid Entity, Components.AudioComponent Component)? PlayGlobal(SoundSpecifier? sound, Filter playerFilter, bool recordReplay, AudioParams? audioParams = null) { - return sound == null ? null : PlayGlobal(GetSound(sound), playerFilter, recordReplay, sound.Params); + return sound == null ? null : PlayGlobal(GetSound(sound), playerFilter, recordReplay, audioParams ?? sound.Params); } /// @@ -445,9 +445,9 @@ public TimeSpan GetAudioLength(string filename) /// The sound specifier that points the audio file(s) that should be played. /// The player that will hear the sound. [return: NotNullIfNotNull("sound")] - public (EntityUid Entity, Components.AudioComponent Component)? PlayGlobal(SoundSpecifier? sound, ICommonSession recipient) + public (EntityUid Entity, Components.AudioComponent Component)? PlayGlobal(SoundSpecifier? sound, ICommonSession recipient, AudioParams? audioParams = null) { - return sound == null ? null : PlayGlobal(GetSound(sound), recipient, sound.Params); + return sound == null ? null : PlayGlobal(GetSound(sound), recipient, audioParams ?? sound.Params); } public abstract void LoadStream(Entity entity, T stream); @@ -468,7 +468,7 @@ public TimeSpan GetAudioLength(string filename) [return: NotNullIfNotNull("sound")] public (EntityUid Entity, Components.AudioComponent Component)? PlayGlobal(SoundSpecifier? sound, EntityUid recipient, AudioParams? audioParams = null) { - return sound == null ? null : PlayGlobal(GetSound(sound), recipient, sound.Params); + return sound == null ? null : PlayGlobal(GetSound(sound), recipient, audioParams ?? sound.Params); } /// From 0f60ad9018f54f9b49da1810bbffa01e2c5975f7 Mon Sep 17 00:00:00 2001 From: metalgearsloth Date: Thu, 12 Sep 2024 17:56:50 +1000 Subject: [PATCH 12/34] Version: 234.1.0 --- MSBuild/Robust.Engine.Version.props | 2 +- RELEASE-NOTES.md | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/MSBuild/Robust.Engine.Version.props b/MSBuild/Robust.Engine.Version.props index ef0b48e216f..2b318b4e856 100644 --- a/MSBuild/Robust.Engine.Version.props +++ b/MSBuild/Robust.Engine.Version.props @@ -1,4 +1,4 @@ - 234.0.0 + 234.1.0 diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 309e31ad7f0..fcd09827bc9 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -39,7 +39,7 @@ END TEMPLATE--> ### New features -* SharedAudioSystem now has PlayLocal which only runs audio locally on the client. +*None yet* ### Bugfixes @@ -54,6 +54,17 @@ END TEMPLATE--> *None yet* +## 234.1.0 + +### New features + +* SharedAudioSystem now has PlayLocal which only runs audio locally on the client. + +### Bugfixes + +* Fix AudioParams not being passed through on PlayGlobal methods. + + ## 234.0.0 ### Breaking changes From 4949b34c88ef414df914d4ce59096e9cd370104e Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Sat, 14 Sep 2024 00:34:30 +1200 Subject: [PATCH 13/34] Fix "to" and "take" toolshed commands (#5438) --- RELEASE-NOTES.md | 2 +- Resources/Locale/en-US/toolshed-commands.ftl | 4 ++-- .../Toolshed/Commands/Generic/ListGeneration/ToCommand.cs | 2 +- Robust.Shared/Toolshed/Commands/Generic/TakeCommand.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index fcd09827bc9..871c680c048 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -43,7 +43,7 @@ END TEMPLATE--> ### Bugfixes -*None yet* +* Fixed the "to" and "take" toolshed commands not working as intended. ### Other diff --git a/Resources/Locale/en-US/toolshed-commands.ftl b/Resources/Locale/en-US/toolshed-commands.ftl index 53603d88f70..0ec32fd9b48 100644 --- a/Resources/Locale/en-US/toolshed-commands.ftl +++ b/Resources/Locale/en-US/toolshed-commands.ftl @@ -219,9 +219,9 @@ command-description-MulVecCommand = command-description-DivVecCommand = Divides every element in the input by a scalar (single value). command-description-rng-to = - Returns a number from its input to its argument (i.e. n..m inclusive) + Returns a number between the input (inclusive) and the argument (exclusive). command-description-rng-from = - Returns a number to its input from its argument (i.e. m..n inclusive) + Returns a number between the argument (inclusive) and the input (exclusive)) command-description-rng-prob = Returns a boolean based on the input probability/chance (from 0 to 1) command-description-sum = diff --git a/Robust.Shared/Toolshed/Commands/Generic/ListGeneration/ToCommand.cs b/Robust.Shared/Toolshed/Commands/Generic/ListGeneration/ToCommand.cs index d7e722e5d72..ab03f8ba5e9 100644 --- a/Robust.Shared/Toolshed/Commands/Generic/ListGeneration/ToCommand.cs +++ b/Robust.Shared/Toolshed/Commands/Generic/ListGeneration/ToCommand.cs @@ -15,5 +15,5 @@ public IEnumerable To( [CommandArgument] ValueRef end ) where T : INumber - => Enumerable.Range(int.CreateTruncating(start), int.CreateTruncating(end.Evaluate(ctx)!)).Select(T.CreateTruncating); + => Enumerable.Range(int.CreateTruncating(start), int.CreateTruncating(end.Evaluate(ctx)! - start)).Select(T.CreateTruncating); } diff --git a/Robust.Shared/Toolshed/Commands/Generic/TakeCommand.cs b/Robust.Shared/Toolshed/Commands/Generic/TakeCommand.cs index 72e1d22bba8..f5716b49de9 100644 --- a/Robust.Shared/Toolshed/Commands/Generic/TakeCommand.cs +++ b/Robust.Shared/Toolshed/Commands/Generic/TakeCommand.cs @@ -7,7 +7,7 @@ namespace Robust.Shared.Toolshed.Commands.Generic; [ToolshedCommand] public sealed class TakeCommand : ToolshedCommand { - [CommandImplementation] + [CommandImplementation, TakesPipedTypeAsGeneric] public IEnumerable Take( [CommandInvocationContext] IInvocationContext ctx, [PipedArgument] IEnumerable input, From f5c1d870f904ca1a5d67ae6db20c17e181a26df9 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Mon, 16 Sep 2024 16:06:04 +1200 Subject: [PATCH 14/34] Improve FlushEntities() error logs (#5427) * Improve FlushEntities() error logs * log count before flush --- Robust.Shared/GameObjects/EntityManager.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Robust.Shared/GameObjects/EntityManager.cs b/Robust.Shared/GameObjects/EntityManager.cs index b3abee1daac..bec9e9afbf0 100644 --- a/Robust.Shared/GameObjects/EntityManager.cs +++ b/Robust.Shared/GameObjects/EntityManager.cs @@ -692,11 +692,23 @@ public bool Deleted([NotNullWhen(false)] EntityUid? uid) /// public virtual void FlushEntities() { + _sawmill.Info($"Flushing entities. Entity count: {Entities.Count}"); BeforeEntityFlush?.Invoke(); FlushEntitiesInternal(); if (Entities.Count != 0) - _sawmill.Error("Failed to flush all entities"); + { + _sawmill.Error($"Failed to flush all entities. Entity count: {Entities.Count}"); + // Dump entity info, but avoid dumping ~50k errors if for whatever reason we failed to delete almost all entities. + // Using 512 as the limit, in case the problem entities are related to player counts on high-pop servers. + if (Entities.Count < 512) + { + foreach (var uid in Entities) + { + _sawmill.Error($"Entity exists after flush: {ToPrettyString(uid)}"); + } + } + } #if EXCEPTION_TOLERANCE // Attempt to flush entities a second time, just in case something somehow caused an entity to be spawned @@ -705,7 +717,7 @@ public virtual void FlushEntities() #endif if (Entities.Count != 0) - throw new Exception("Failed to flush all entities"); + throw new Exception($"Failed to flush all entities. Entity count: {Entities.Count}"); AfterEntityFlush?.Invoke(); } From f81e30a0312026db8479875fa212c9eab6bafcf9 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Mon, 16 Sep 2024 16:12:20 +1200 Subject: [PATCH 15/34] Try fix invalid PVS index bug (#5422) * Try fix invalid PVS index bug * bounds check * More Asserts * fix assert? * remove deletion * a * A! --- RELEASE-NOTES.md | 6 ++++++ Robust.Server/GameStates/PvsData.cs | 10 ++++++++++ Robust.Server/GameStates/PvsSystem.DataStorage.cs | 9 +++------ Robust.Server/GameStates/PvsSystem.Dirty.cs | 2 +- Robust.Server/GameStates/PvsSystem.Entity.cs | 2 +- Robust.Server/GameStates/PvsSystem.Overrides.cs | 3 +++ Robust.Server/GameStates/PvsSystem.ToSendSet.cs | 4 ++-- .../GameObjects/Components/MetaDataComponent.cs | 5 ++++- .../Commands/Generic/ListGeneration/ToCommand.cs | 2 +- Robust.Shared/Utility/ResizableMemoryRegion.cs | 8 ++++---- 10 files changed, 35 insertions(+), 16 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 871c680c048..a4b414631dc 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -43,7 +43,13 @@ END TEMPLATE--> ### Bugfixes +<<<<<<< HEAD +* Fixed equality checks for `MarkupNode` not properly handling attributes. +* Fixed `MarkupNode` not having a `GetHashCode()` implementation. +* Fixed a PVS error that could occur when trying to delete the first entity that gets created in a round. +======= * Fixed the "to" and "take" toolshed commands not working as intended. +>>>>>>> f5c1d870f904ca1a5d67ae6db20c17e181a26df9 ### Other diff --git a/Robust.Server/GameStates/PvsData.cs b/Robust.Server/GameStates/PvsData.cs index f6778464a93..c4df89b5c44 100644 --- a/Robust.Server/GameStates/PvsData.cs +++ b/Robust.Server/GameStates/PvsData.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -190,6 +191,15 @@ internal struct PvsMetadata private byte Pad0; public uint Marker; #endif + + [Conditional("DEBUG")] + public void Validate(MetaDataComponent comp) + { + DebugTools.AssertEqual(NetEntity, comp.NetEntity); + DebugTools.AssertEqual(VisMask, comp.VisibilityMask); + DebugTools.AssertEqual(LifeStage, comp.EntityLifeStage); + DebugTools.Assert(LastModifiedTick == comp.EntityLastModifiedTick || LastModifiedTick.Value == 0); + } } [StructLayout(LayoutKind.Sequential, Size = 16)] diff --git a/Robust.Server/GameStates/PvsSystem.DataStorage.cs b/Robust.Server/GameStates/PvsSystem.DataStorage.cs index b9927938b68..814d82945a1 100644 --- a/Robust.Server/GameStates/PvsSystem.DataStorage.cs +++ b/Robust.Server/GameStates/PvsSystem.DataStorage.cs @@ -245,8 +245,6 @@ private static void FreeSessionDataMemory(PvsSession session) private void OnEntityAdded(Entity entity) { - DebugTools.Assert(entity.Comp.PvsData.Index == default); - AssignEntityPointer(entity.Comp); } @@ -255,6 +253,7 @@ private void OnEntityAdded(Entity entity) /// private void AssignEntityPointer(MetaDataComponent meta) { + DebugTools.Assert(meta.PvsData == PvsIndex.Invalid); if (_dataFreeListHead == PvsIndex.Invalid) { ExpandEntityCapacity(); @@ -267,8 +266,6 @@ private void AssignEntityPointer(MetaDataComponent meta) ref var freeLink = ref Unsafe.As(ref metadata); _dataFreeListHead = freeLink.NextFree; - // TODO: re-introduce this assert. - // DebugTools.AssertEqual(((PvsMetadata*) ptr)->NetEntity, NetEntity.Invalid); DebugTools.AssertNotEqual(meta.NetEntity, NetEntity.Invalid); meta.PvsData = index; @@ -287,9 +284,9 @@ private void AssignEntityPointer(MetaDataComponent meta) private void OnEntityDeleted(Entity entity) { var ptr = entity.Comp.PvsData; - entity.Comp.PvsData = default; + entity.Comp.PvsData = PvsIndex.Invalid; - if (ptr == default) + if (ptr == PvsIndex.Invalid) return; _incomingReturns.Add(ptr); diff --git a/Robust.Server/GameStates/PvsSystem.Dirty.cs b/Robust.Server/GameStates/PvsSystem.Dirty.cs index 98bab6daf07..c7a180ccb79 100644 --- a/Robust.Server/GameStates/PvsSystem.Dirty.cs +++ b/Robust.Server/GameStates/PvsSystem.Dirty.cs @@ -49,7 +49,7 @@ private void OnEntityAdd(Entity e) private void OnEntityDirty(Entity uid) { - if (uid.Comp.PvsData != default) + if (uid.Comp.PvsData != PvsIndex.Invalid) { ref var meta = ref _metadataMemory.GetRef(uid.Comp.PvsData.Index); meta.LastModifiedTick = uid.Comp.EntityLastModifiedTick; diff --git a/Robust.Server/GameStates/PvsSystem.Entity.cs b/Robust.Server/GameStates/PvsSystem.Entity.cs index 19774a4c80a..70748a196cf 100644 --- a/Robust.Server/GameStates/PvsSystem.Entity.cs +++ b/Robust.Server/GameStates/PvsSystem.Entity.cs @@ -107,7 +107,7 @@ private void AssertNullspace(EntityUid uid) internal void SyncMetadata(MetaDataComponent meta) { - if (meta.PvsData == default) + if (meta.PvsData == PvsIndex.Invalid) return; ref var ptr = ref _metadataMemory.GetRef(meta.PvsData.Index); diff --git a/Robust.Server/GameStates/PvsSystem.Overrides.cs b/Robust.Server/GameStates/PvsSystem.Overrides.cs index 0b395579b60..badd3964145 100644 --- a/Robust.Server/GameStates/PvsSystem.Overrides.cs +++ b/Robust.Server/GameStates/PvsSystem.Overrides.cs @@ -3,6 +3,7 @@ using System.Runtime.InteropServices; using Robust.Shared.GameObjects; using Robust.Shared.Timing; +using Robust.Shared.Utility; namespace Robust.Server.GameStates; @@ -25,6 +26,7 @@ private void AddAllOverrides(PvsSession session) foreach (ref var ent in CollectionsMarshal.AsSpan(_cachedGlobalOverride)) { ref var meta = ref _metadataMemory.GetRef(ent.Ptr.Index); + meta.Validate(ent.Meta); if ((mask & meta.VisMask) == meta.VisMask) AddEntity(session, ref ent, ref meta, fromTick); } @@ -51,6 +53,7 @@ private void AddForcedEntities(PvsSession session) foreach (ref var ent in CollectionsMarshal.AsSpan(_cachedForceOverride)) { ref var meta = ref _metadataMemory.GetRef(ent.Ptr.Index); + meta.Validate(ent.Meta); if ((mask & meta.VisMask) == meta.VisMask) AddEntity(session, ref ent, ref meta, fromTick); } diff --git a/Robust.Server/GameStates/PvsSystem.ToSendSet.cs b/Robust.Server/GameStates/PvsSystem.ToSendSet.cs index ffe505994ba..5dfa5b949bd 100644 --- a/Robust.Server/GameStates/PvsSystem.ToSendSet.cs +++ b/Robust.Server/GameStates/PvsSystem.ToSendSet.cs @@ -57,6 +57,7 @@ private void AddPvsChunk(PvsChunk chunk, float distance, PvsSession session) foreach (ref var ent in span) { ref var meta = ref _metadataMemory.GetRef(ent.Ptr.Index); + meta.Validate(ent.Meta); if ((mask & meta.VisMask) == meta.VisMask) AddEntity(session, ref ent, ref meta, fromTick); } @@ -78,8 +79,7 @@ private void AddEntity(PvsSession session, ref PvsChunk.ChunkEntity ent, ref Pvs if (meta.LifeStage >= EntityLifeStage.Terminating) { - Log.Error($"Attempted to send deleted entity: {ToPrettyString(ent.Uid)}, lifestage is {meta.LifeStage}.\n{Environment.StackTrace}"); - EntityManager.QueueDeleteEntity(ent.Uid); + Log.Error($"Attempted to send deleted entity: {ToPrettyString(ent.Uid)}, Meta lifestage: {ent.Meta.EntityLifeStage}, PVS lifestage: {meta.LifeStage}.\n{Environment.StackTrace}"); return; } diff --git a/Robust.Shared/GameObjects/Components/MetaDataComponent.cs b/Robust.Shared/GameObjects/Components/MetaDataComponent.cs index fe58fe2a40b..a4b00b0d0c3 100644 --- a/Robust.Shared/GameObjects/Components/MetaDataComponent.cs +++ b/Robust.Shared/GameObjects/Components/MetaDataComponent.cs @@ -204,7 +204,7 @@ private protected override void ClearTicks() /// /// Offset into internal PVS data. /// - internal PvsIndex PvsData; + internal PvsIndex PvsData = PvsIndex.Invalid; } [Flags] @@ -254,5 +254,8 @@ internal readonly record struct PvsIndex(int Index) /// An invalid index. This is also used as a marker value in the free list. /// public static readonly PvsIndex Invalid = new PvsIndex(-1); + // TODO PVS + // Consider making 0 an invalid value. + // it prevents default structs from accidentally being used. } } diff --git a/Robust.Shared/Toolshed/Commands/Generic/ListGeneration/ToCommand.cs b/Robust.Shared/Toolshed/Commands/Generic/ListGeneration/ToCommand.cs index ab03f8ba5e9..c5057899ac5 100644 --- a/Robust.Shared/Toolshed/Commands/Generic/ListGeneration/ToCommand.cs +++ b/Robust.Shared/Toolshed/Commands/Generic/ListGeneration/ToCommand.cs @@ -15,5 +15,5 @@ public IEnumerable To( [CommandArgument] ValueRef end ) where T : INumber - => Enumerable.Range(int.CreateTruncating(start), int.CreateTruncating(end.Evaluate(ctx)! - start)).Select(T.CreateTruncating); + => Enumerable.Range(int.CreateTruncating(start), 1 + int.CreateTruncating(end.Evaluate(ctx)! - start)).Select(T.CreateTruncating); } diff --git a/Robust.Shared/Utility/ResizableMemoryRegion.cs b/Robust.Shared/Utility/ResizableMemoryRegion.cs index acdcae53b73..7bd6ac4ab52 100644 --- a/Robust.Shared/Utility/ResizableMemoryRegion.cs +++ b/Robust.Shared/Utility/ResizableMemoryRegion.cs @@ -254,8 +254,8 @@ public Span GetSpan() where TCast : unmanaged public ref T GetRef(int index) { // If the memory region is disposed, CurrentSize is 0 and this check always fails. - if (index >= CurrentSize) - ThrowIndexOutOfRangeException(); + if (index >= CurrentSize || index < 0) + ThrowIndexOutOfRangeException(CurrentSize, index); return ref *(BaseAddress + index); } @@ -302,9 +302,9 @@ private static void ThrowNotInitialized() } [MethodImpl(MethodImplOptions.NoInlining)] - private static void ThrowIndexOutOfRangeException() + private static void ThrowIndexOutOfRangeException(int size, int index) { - throw new IndexOutOfRangeException(); + throw new IndexOutOfRangeException($"Index was outside the bounds of the memory region. Size: {size}, Index: {index}"); } private void ReleaseUnmanagedResources() From 786acae47aeedd5e550b7651e958404312495182 Mon Sep 17 00:00:00 2001 From: Lgibb18 <65973111+Lgibb18@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:13:59 +0500 Subject: [PATCH 16/34] Fix tags with controls in RichText and OutputPanel (#5428) * Controls in RichText fixes * useless * Get FormattedMessage from RichTextLabel * dont go through nodes * Comments and minor changes --------- Co-authored-by: ElectroJr --- RELEASE-NOTES.md | 4 +--- .../UserInterface/Controls/OutputPanel.cs | 15 ++++++++++++--- .../UserInterface/Controls/RichTextLabel.cs | 2 +- Robust.Client/UserInterface/RichTextEntry.cs | 18 ++++++++++++++---- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index a4b414631dc..d57d9856d52 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -43,13 +43,11 @@ END TEMPLATE--> ### Bugfixes -<<<<<<< HEAD * Fixed equality checks for `MarkupNode` not properly handling attributes. * Fixed `MarkupNode` not having a `GetHashCode()` implementation. * Fixed a PVS error that could occur when trying to delete the first entity that gets created in a round. -======= * Fixed the "to" and "take" toolshed commands not working as intended. ->>>>>>> f5c1d870f904ca1a5d67ae6db20c17e181a26df9 +* Rich text controls within an `OutputPanel` control will now become invisible when they are out of view. ### Other diff --git a/Robust.Client/UserInterface/Controls/OutputPanel.cs b/Robust.Client/UserInterface/Controls/OutputPanel.cs index c23f4ceaa9e..71497838547 100644 --- a/Robust.Client/UserInterface/Controls/OutputPanel.cs +++ b/Robust.Client/UserInterface/Controls/OutputPanel.cs @@ -127,6 +127,7 @@ protected internal override void Draw(DrawingHandleScreen handle) var style = _getStyleBox(); var font = _getFont(); + var lineSeparation = font.GetLineSeparation(UIScale); style?.Draw(handle, PixelSizeBox, UIScale); var contentBox = _getContentBox(); @@ -141,18 +142,26 @@ protected internal override void Draw(DrawingHandleScreen handle) { if (entryOffset + entry.Height < 0) { - entryOffset += entry.Height + font.GetLineSeparation(UIScale); + // Controls within the entry are the children of this control, which means they are drawn separately + // after this Draw call, so we have to mark them as invisible to prevent them from being drawn. + // + // An alternative option is to ensure that the control position updating logic in entry.Draw is always + // run, and then setting RectClipContent = true to use scissor box testing to handle the controls + // visibility + entry.HideControls(); + entryOffset += entry.Height + lineSeparation; continue; } if (entryOffset > contentBox.Height) { - break; + entry.HideControls(); + continue; } entry.Draw(_tagManager, handle, font, contentBox, entryOffset, context, UIScale); - entryOffset += entry.Height + font.GetLineSeparation(UIScale); + entryOffset += entry.Height + lineSeparation; } } diff --git a/Robust.Client/UserInterface/Controls/RichTextLabel.cs b/Robust.Client/UserInterface/Controls/RichTextLabel.cs index 69402fcb3a5..7e7c03c9d4d 100644 --- a/Robust.Client/UserInterface/Controls/RichTextLabel.cs +++ b/Robust.Client/UserInterface/Controls/RichTextLabel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Numerics; using JetBrains.Annotations; using Robust.Client.Graphics; diff --git a/Robust.Client/UserInterface/RichTextEntry.cs b/Robust.Client/UserInterface/RichTextEntry.cs index 432280bb06a..c6dd38da7cf 100644 --- a/Robust.Client/UserInterface/RichTextEntry.cs +++ b/Robust.Client/UserInterface/RichTextEntry.cs @@ -118,9 +118,6 @@ public void Update(MarkupTagManager tagManager, Font defaultFont, float maxSizeX if (_tagControls == null || !_tagControls.TryGetValue(nodeIndex, out var control)) continue; - if (ProcessRune(ref this, new Rune(' '), out breakLine)) - continue; - control.Measure(new Vector2(Width, Height)); var desiredSize = control.DesiredPixelSize; @@ -167,6 +164,16 @@ void CheckLineBreak(ref RichTextEntry src, int? line) } } + internal readonly void HideControls() + { + if (_tagControls == null) + return; + foreach (var control in _tagControls.Values) + { + control.Visible = false; + } + } + public readonly void Draw( MarkupTagManager tagManager, DrawingHandleScreen handle, @@ -216,8 +223,11 @@ public readonly void Draw( if (_tagControls == null || !_tagControls.TryGetValue(nodeIndex, out var control)) continue; - var invertedScale = 1f / uiScale; + // Controls may have been previously hidden via HideControls due to being "out-of frame". + // If this ever gets replaced with RectClipContents / scissor box testing, this can be removed. + control.Visible = true; + var invertedScale = 1f / uiScale; control.Position = new Vector2(baseLine.X * invertedScale, (baseLine.Y - defaultFont.GetAscent(uiScale)) * invertedScale); control.Measure(new Vector2(Width, Height)); var advanceX = control.DesiredPixelSize.X; From 4f95c07ab3eb05d68e2a7892990adaa310107dd8 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Mon, 16 Sep 2024 21:34:42 +0200 Subject: [PATCH 17/34] Add missing Roslyn components to solution --- RobustToolbox.sln | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/RobustToolbox.sln b/RobustToolbox.sln index 5eefb5aa730..2be6b3df1ce 100644 --- a/RobustToolbox.sln +++ b/RobustToolbox.sln @@ -55,6 +55,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CefGlue", "cefglue\CefGlue\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Xaml", "Robust.Xaml\Robust.Xaml.csproj", "{EC7BA4C0-A02F-40E8-B4FC-9A96D91BD1EC}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Serialization.Generator", "Robust.Serialization.Generator\Robust.Serialization.Generator.csproj", "{26001B63-7C22-43F7-9690-D6F5D6B9711C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Roslyn", "Roslyn", "{50CEB810-1E9A-4C14-9EDE-DABCC15ECE73}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Robust.Shared.CompNetworkGenerator", "Robust.Shared.CompNetworkGenerator\Robust.Shared.CompNetworkGenerator.csproj", "{6AD8DA1A-C807-47B7-A251-97BE0AB381DB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -239,6 +245,22 @@ Global {EC7BA4C0-A02F-40E8-B4FC-9A96D91BD1EC}.Release|Any CPU.Build.0 = Release|Any CPU {EC7BA4C0-A02F-40E8-B4FC-9A96D91BD1EC}.Release|x64.ActiveCfg = Release|Any CPU {EC7BA4C0-A02F-40E8-B4FC-9A96D91BD1EC}.Release|x64.Build.0 = Release|Any CPU + {26001B63-7C22-43F7-9690-D6F5D6B9711C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {26001B63-7C22-43F7-9690-D6F5D6B9711C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {26001B63-7C22-43F7-9690-D6F5D6B9711C}.Debug|x64.ActiveCfg = Debug|Any CPU + {26001B63-7C22-43F7-9690-D6F5D6B9711C}.Debug|x64.Build.0 = Debug|Any CPU + {26001B63-7C22-43F7-9690-D6F5D6B9711C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {26001B63-7C22-43F7-9690-D6F5D6B9711C}.Release|Any CPU.Build.0 = Release|Any CPU + {26001B63-7C22-43F7-9690-D6F5D6B9711C}.Release|x64.ActiveCfg = Release|Any CPU + {26001B63-7C22-43F7-9690-D6F5D6B9711C}.Release|x64.Build.0 = Release|Any CPU + {6AD8DA1A-C807-47B7-A251-97BE0AB381DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6AD8DA1A-C807-47B7-A251-97BE0AB381DB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6AD8DA1A-C807-47B7-A251-97BE0AB381DB}.Debug|x64.ActiveCfg = Debug|Any CPU + {6AD8DA1A-C807-47B7-A251-97BE0AB381DB}.Debug|x64.Build.0 = Debug|Any CPU + {6AD8DA1A-C807-47B7-A251-97BE0AB381DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6AD8DA1A-C807-47B7-A251-97BE0AB381DB}.Release|Any CPU.Build.0 = Release|Any CPU + {6AD8DA1A-C807-47B7-A251-97BE0AB381DB}.Release|x64.ActiveCfg = Release|Any CPU + {6AD8DA1A-C807-47B7-A251-97BE0AB381DB}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -250,6 +272,11 @@ Global {1CDC9C4F-668E-47A3-8A44-216E95644BEB} = {1B1FC7C4-0212-4B3E-90D4-C7B58759E4B0} {B05EFB71-AEC7-4C6E-984A-A1BCC58F9AD1} = {1B1FC7C4-0212-4B3E-90D4-C7B58759E4B0} {6BC71226-BA9C-4CD6-9838-03AC076F9518} = {2D787B3C-65EB-43AA-BC6F-289A34ADFDDD} + {3173712A-9E75-4685-B657-9AF9B7D54EFB} = {50CEB810-1E9A-4C14-9EDE-DABCC15ECE73} + {A773F7D4-8EF5-4144-A0DF-3B393B4C1B3A} = {50CEB810-1E9A-4C14-9EDE-DABCC15ECE73} + {26001B63-7C22-43F7-9690-D6F5D6B9711C} = {50CEB810-1E9A-4C14-9EDE-DABCC15ECE73} + {EFB7A05D-71D0-47D1-B7B4-35D4FF661F13} = {50CEB810-1E9A-4C14-9EDE-DABCC15ECE73} + {6AD8DA1A-C807-47B7-A251-97BE0AB381DB} = {50CEB810-1E9A-4C14-9EDE-DABCC15ECE73} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {57757344-0FF4-4842-8A68-141CAA18A35D} From 5218bf70b076efabf0e9cfb45fefce04d65ae029 Mon Sep 17 00:00:00 2001 From: ike709 Date: Mon, 16 Sep 2024 15:31:10 -0500 Subject: [PATCH 18/34] Bump cefglue (#5441) * Bump cefglue * Another bump * Third time's the charm --------- Co-authored-by: ike709 Co-authored-by: Pieter-Jan Briers --- cefglue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cefglue b/cefglue index e265d67a21d..e89d3a86d4c 160000 --- a/cefglue +++ b/cefglue @@ -1 +1 @@ -Subproject commit e265d67a21d0e526178f72326bd45f36d85ad6ca +Subproject commit e89d3a86d4cd111fdd5e433c8890edefed98b7fa From 2fda62a27411575b49f0aed12b07c637dce077af Mon Sep 17 00:00:00 2001 From: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:51:54 -0700 Subject: [PATCH 19/34] Fix physics.maxlinvelocity not being a replicated cvar (#5445) --- Robust.Shared/CVars.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Robust.Shared/CVars.cs b/Robust.Shared/CVars.cs index 6404bd1bfb4..ebd4e29b2e2 100644 --- a/Robust.Shared/CVars.cs +++ b/Robust.Shared/CVars.cs @@ -1288,7 +1288,7 @@ protected CVars() /// Default is 35 m/s. Around half a tile per tick at 60 ticks per second. /// public static readonly CVarDef MaxLinVelocity = - CVarDef.Create("physics.maxlinvelocity", 35f); + CVarDef.Create("physics.maxlinvelocity", 35f, CVar.SERVER | CVar.REPLICATED); /// /// Maximum angular velocity in full rotations per second. From 19a87fb67afd2d34064916227e19ba85e98ba820 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Wed, 18 Sep 2024 13:43:49 +1200 Subject: [PATCH 20/34] Remove incorrect NotNullIfNotNull attributes in SharedAudioSystem (#5449) --- RELEASE-NOTES.md | 2 +- .../Audio/Systems/SharedAudioSystem.cs | 25 ------------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index d57d9856d52..7868d1caa86 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -35,7 +35,7 @@ END TEMPLATE--> ### Breaking changes -*None yet* +* Several different `AudioSystem` methods were incorrectly given a `[return: NotNullIfNotNull]` attribute. Content code that uses these methods needs to be updated to perform null checks. ### New features diff --git a/Robust.Shared/Audio/Systems/SharedAudioSystem.cs b/Robust.Shared/Audio/Systems/SharedAudioSystem.cs index e58c0ed36c1..4d79ff0e3d0 100644 --- a/Robust.Shared/Audio/Systems/SharedAudioSystem.cs +++ b/Robust.Shared/Audio/Systems/SharedAudioSystem.cs @@ -417,7 +417,6 @@ public TimeSpan GetAudioLength(string filename) /// /// The resource path to the OGG Vorbis file to play. /// The set of players that will hear the sound. - [return: NotNullIfNotNull("filename")] public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayGlobal(string? filename, Filter playerFilter, bool recordReplay, AudioParams? audioParams = null); /// @@ -425,7 +424,6 @@ public TimeSpan GetAudioLength(string filename) /// /// The sound specifier that points the audio file(s) that should be played. /// The set of players that will hear the sound. - [return: NotNullIfNotNull("sound")] public (EntityUid Entity, Components.AudioComponent Component)? PlayGlobal(SoundSpecifier? sound, Filter playerFilter, bool recordReplay, AudioParams? audioParams = null) { return sound == null ? null : PlayGlobal(GetSound(sound), playerFilter, recordReplay, audioParams ?? sound.Params); @@ -436,7 +434,6 @@ public TimeSpan GetAudioLength(string filename) /// /// The resource path to the OGG Vorbis file to play. /// The player that will hear the sound. - [return: NotNullIfNotNull("filename")] public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayGlobal(string? filename, ICommonSession recipient, AudioParams? audioParams = null); /// @@ -444,7 +441,6 @@ public TimeSpan GetAudioLength(string filename) /// /// The sound specifier that points the audio file(s) that should be played. /// The player that will hear the sound. - [return: NotNullIfNotNull("sound")] public (EntityUid Entity, Components.AudioComponent Component)? PlayGlobal(SoundSpecifier? sound, ICommonSession recipient, AudioParams? audioParams = null) { return sound == null ? null : PlayGlobal(GetSound(sound), recipient, audioParams ?? sound.Params); @@ -457,7 +453,6 @@ public TimeSpan GetAudioLength(string filename) /// /// The resource path to the OGG Vorbis file to play. /// The player that will hear the sound. - [return: NotNullIfNotNull("filename")] public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayGlobal(string? filename, EntityUid recipient, AudioParams? audioParams = null); /// @@ -465,7 +460,6 @@ public TimeSpan GetAudioLength(string filename) /// /// The sound specifier that points the audio file(s) that should be played. /// The player that will hear the sound. - [return: NotNullIfNotNull("sound")] public (EntityUid Entity, Components.AudioComponent Component)? PlayGlobal(SoundSpecifier? sound, EntityUid recipient, AudioParams? audioParams = null) { return sound == null ? null : PlayGlobal(GetSound(sound), recipient, audioParams ?? sound.Params); @@ -477,7 +471,6 @@ public TimeSpan GetAudioLength(string filename) /// The resource path to the OGG Vorbis file to play. /// The set of players that will hear the sound. /// The UID of the entity "emitting" the audio. - [return: NotNullIfNotNull("filename")] public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayEntity(string? filename, Filter playerFilter, EntityUid uid, bool recordReplay, AudioParams? audioParams = null); /// @@ -486,7 +479,6 @@ public TimeSpan GetAudioLength(string filename) /// The resource path to the OGG Vorbis file to play. /// The player that will hear the sound. /// The UID of the entity "emitting" the audio. - [return: NotNullIfNotNull("filename")] public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayEntity(string? filename, ICommonSession recipient, EntityUid uid, AudioParams? audioParams = null); /// @@ -495,7 +487,6 @@ public TimeSpan GetAudioLength(string filename) /// The resource path to the OGG Vorbis file to play. /// The player that will hear the sound. /// The UID of the entity "emitting" the audio. - [return: NotNullIfNotNull("filename")] public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayEntity(string? filename, EntityUid recipient, EntityUid uid, AudioParams? audioParams = null); /// @@ -504,7 +495,6 @@ public TimeSpan GetAudioLength(string filename) /// The sound specifier that points the audio file(s) that should be played. /// The set of players that will hear the sound. /// The UID of the entity "emitting" the audio. - [return: NotNullIfNotNull("sound")] public (EntityUid Entity, Components.AudioComponent Component)? PlayEntity(SoundSpecifier? sound, Filter playerFilter, EntityUid uid, bool recordReplay, AudioParams? audioParams = null) { return sound == null ? null : PlayEntity(GetSound(sound), playerFilter, uid, recordReplay, audioParams ?? sound.Params); @@ -516,7 +506,6 @@ public TimeSpan GetAudioLength(string filename) /// The sound specifier that points the audio file(s) that should be played. /// The player that will hear the sound. /// The UID of the entity "emitting" the audio. - [return: NotNullIfNotNull("sound")] public (EntityUid Entity, Components.AudioComponent Component)? PlayEntity(SoundSpecifier? sound, ICommonSession recipient, EntityUid uid, AudioParams? audioParams = null) { return sound == null ? null : PlayEntity(GetSound(sound), recipient, uid, audioParams ?? sound.Params); @@ -528,7 +517,6 @@ public TimeSpan GetAudioLength(string filename) /// The sound specifier that points the audio file(s) that should be played. /// The player that will hear the sound. /// The UID of the entity "emitting" the audio. - [return: NotNullIfNotNull("sound")] public (EntityUid Entity, Components.AudioComponent Component)? PlayEntity(SoundSpecifier? sound, EntityUid recipient, EntityUid uid, AudioParams? audioParams = null) { return sound == null ? null : PlayEntity(GetSound(sound), recipient, uid, audioParams ?? sound.Params); @@ -539,7 +527,6 @@ public TimeSpan GetAudioLength(string filename) /// /// The sound specifier that points the audio file(s) that should be played. /// The UID of the entity "emitting" the audio. - [return: NotNullIfNotNull("sound")] public (EntityUid Entity, Components.AudioComponent Component)? PlayPvs(SoundSpecifier? sound, EntityUid uid, AudioParams? audioParams = null) { return sound == null ? null : PlayPvs(GetSound(sound), uid, audioParams ?? sound.Params); @@ -550,7 +537,6 @@ public TimeSpan GetAudioLength(string filename) /// /// The sound specifier that points the audio file(s) that should be played. /// The EntityCoordinates to attach the audio source to. - [return: NotNullIfNotNull("sound")] public (EntityUid Entity, Components.AudioComponent Component)? PlayPvs(SoundSpecifier? sound, EntityCoordinates coordinates, AudioParams? audioParams = null) { return sound == null ? null : PlayPvs(GetSound(sound), coordinates, audioParams ?? sound.Params); @@ -561,7 +547,6 @@ public TimeSpan GetAudioLength(string filename) /// /// The sound specifier that points the audio file(s) that should be played. /// The EntityCoordinates to attach the audio source to. - [return: NotNullIfNotNull("filename")] public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPvs(string? filename, EntityCoordinates coordinates, AudioParams? audioParams = null); @@ -570,7 +555,6 @@ public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPvs /// /// The resource path to the OGG Vorbis file to play. /// The UID of the entity "emitting" the audio. - [return: NotNullIfNotNull("filename")] public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPvs(string? filename, EntityUid uid, AudioParams? audioParams = null); @@ -580,7 +564,6 @@ public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPvs /// The sound specifier that points the audio file(s) that should be played. /// The UID of the entity "emitting" the audio. /// The UID of the user that initiated this sound. This is usually some player's controlled entity. - [return: NotNullIfNotNull("sound")] public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayLocal(SoundSpecifier? sound, EntityUid source, EntityUid? soundInitiator, AudioParams? audioParams = null); /// @@ -591,7 +574,6 @@ public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPvs /// The sound specifier that points the audio file(s) that should be played. /// The UID of the entity "emitting" the audio. /// The UID of the user that initiated this sound. This is usually some player's controlled entity. - [return: NotNullIfNotNull("sound")] public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPredicted(SoundSpecifier? sound, EntityUid source, EntityUid? user, AudioParams? audioParams = null); /// @@ -602,7 +584,6 @@ public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPvs /// The sound specifier that points the audio file(s) that should be played. /// The entitycoordinates "emitting" the audio /// The UID of the user that initiated this sound. This is usually some player's controlled entity. - [return: NotNullIfNotNull("sound")] public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPredicted(SoundSpecifier? sound, EntityCoordinates coordinates, EntityUid? user, AudioParams? audioParams = null); /// @@ -611,7 +592,6 @@ public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPvs /// The resource path to the OGG Vorbis file to play. /// The set of players that will hear the sound. /// The coordinates at which to play the audio. - [return: NotNullIfNotNull("filename")] public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayStatic(string? filename, Filter playerFilter, EntityCoordinates coordinates, bool recordReplay, AudioParams? audioParams = null); /// @@ -620,7 +600,6 @@ public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPvs /// The resource path to the OGG Vorbis file to play. /// The player that will hear the sound. /// The coordinates at which to play the audio. - [return: NotNullIfNotNull("filename")] public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayStatic(string? filename, ICommonSession recipient, EntityCoordinates coordinates, AudioParams? audioParams = null); /// @@ -629,7 +608,6 @@ public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPvs /// The resource path to the OGG Vorbis file to play. /// The player that will hear the sound. /// The coordinates at which to play the audio. - [return: NotNullIfNotNull("filename")] public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayStatic(string? filename, EntityUid recipient, EntityCoordinates coordinates, AudioParams? audioParams = null); /// @@ -638,7 +616,6 @@ public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPvs /// The sound specifier that points the audio file(s) that should be played. /// The set of players that will hear the sound. /// The coordinates at which to play the audio. - [return: NotNullIfNotNull("sound")] public (EntityUid Entity, Components.AudioComponent Component)? PlayStatic(SoundSpecifier? sound, Filter playerFilter, EntityCoordinates coordinates, bool recordReplay, AudioParams? audioParams = null) { return sound == null ? null : PlayStatic(GetSound(sound), playerFilter, coordinates, recordReplay, audioParams); @@ -650,7 +627,6 @@ public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPvs /// The sound specifier that points the audio file(s) that should be played. /// The player that will hear the sound. /// The coordinates at which to play the audio. - [return: NotNullIfNotNull("sound")] public (EntityUid Entity, Components.AudioComponent Component)? PlayStatic(SoundSpecifier? sound, ICommonSession recipient, EntityCoordinates coordinates, AudioParams? audioParams = null) { return sound == null ? null : PlayStatic(GetSound(sound), recipient, coordinates, audioParams ?? sound.Params); @@ -662,7 +638,6 @@ public abstract (EntityUid Entity, Components.AudioComponent Component)? PlayPvs /// The sound specifier that points the audio file(s) that should be played. /// The player that will hear the sound. /// The coordinates at which to play the audio. - [return: NotNullIfNotNull("sound")] public (EntityUid Entity, Components.AudioComponent Component)? PlayStatic(SoundSpecifier? sound, EntityUid recipient, EntityCoordinates coordinates, AudioParams? audioParams = null) { return sound == null ? null : PlayStatic(GetSound(sound), recipient, coordinates, audioParams ?? sound.Params); From afffb3344608df2fd6bdcce2a6da6ae396ff77d2 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Wed, 18 Sep 2024 13:44:16 +1200 Subject: [PATCH 21/34] Stop empty audio system filters from playing sounds for all players (#5444) * Fix audio system empty filter bug * The nullable attributes are lying --- RELEASE-NOTES.md | 1 + Robust.Server/Audio/AudioSystem.cs | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 7868d1caa86..e680b23661d 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -43,6 +43,7 @@ END TEMPLATE--> ### Bugfixes +* Fixed filtered AudioSystem methods playing a sound for all players when given an empty filter. * Fixed equality checks for `MarkupNode` not properly handling attributes. * Fixed `MarkupNode` not having a `GetHashCode()` implementation. * Fixed a PVS error that could occur when trying to delete the first entity that gets created in a round. diff --git a/Robust.Server/Audio/AudioSystem.cs b/Robust.Server/Audio/AudioSystem.cs index 916d9ce0e32..981c01e770e 100644 --- a/Robust.Server/Audio/AudioSystem.cs +++ b/Robust.Server/Audio/AudioSystem.cs @@ -66,32 +66,26 @@ public override void SetMapAudio(Entity? audio) private void AddAudioFilter(EntityUid uid, AudioComponent component, Filter filter) { - var count = filter.Count; + DebugTools.Assert(component.IncludedEntities == null); + component.IncludedEntities = new(); - if (count == 0) + if (filter.Count == 0) return; _pvs.AddSessionOverrides(uid, filter); - - var ents = new HashSet(count); - foreach (var session in filter.Recipients) { - var ent = session.AttachedEntity; - - if (ent == null) - continue; - - ents.Add(ent.Value); + if (session.AttachedEntity is {} ent) + component.IncludedEntities.Add(ent); } - - DebugTools.Assert(component.IncludedEntities == null); - component.IncludedEntities = ents; } /// public override (EntityUid Entity, AudioComponent Component)? PlayGlobal(string? filename, Filter playerFilter, bool recordReplay, AudioParams? audioParams = null) { + if (string.IsNullOrEmpty(filename)) + return null; + var entity = SetupAudio(filename, audioParams); AddAudioFilter(entity, entity.Comp, playerFilter); entity.Comp.Global = true; From 9be0f032e80c6b4ebe0d1180a5835f6e7d95dbb1 Mon Sep 17 00:00:00 2001 From: eoineoineoin Date: Wed, 18 Sep 2024 02:45:01 +0100 Subject: [PATCH 22/34] Fix DistanceJoints drawn by physics debug system (#5439) Co-authored-by: Eoin Mcloughlin --- Robust.Client/Debugging/DebugPhysicsSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Robust.Client/Debugging/DebugPhysicsSystem.cs b/Robust.Client/Debugging/DebugPhysicsSystem.cs index 757dd5a955a..c916c264648 100644 --- a/Robust.Client/Debugging/DebugPhysicsSystem.cs +++ b/Robust.Client/Debugging/DebugPhysicsSystem.cs @@ -544,7 +544,7 @@ private void DrawJoint(DrawingHandleWorld worldHandle, Joint joint) switch (joint) { case DistanceJoint: - worldHandle.DrawLine(xf1, xf2, JointColor); + worldHandle.DrawLine(p1, p2, JointColor); break; case PrismaticJoint prisma: var pA = Transform.Mul(xfa, joint.LocalAnchorA); From 0fa21ee2d235b9fba383f23aef978ccbad20d689 Mon Sep 17 00:00:00 2001 From: Plykiya <58439124+Plykiya@users.noreply.github.com> Date: Tue, 17 Sep 2024 18:48:13 -0700 Subject: [PATCH 23/34] Completely obsolete noSpawn (#5364) --- Robust.Shared/Prototypes/EntityPrototype.cs | 7 ------- Robust.Shared/Prototypes/PrototypeManager.Categories.cs | 4 ---- 2 files changed, 11 deletions(-) diff --git a/Robust.Shared/Prototypes/EntityPrototype.cs b/Robust.Shared/Prototypes/EntityPrototype.cs index 0e19eaeb438..e97d14b1071 100644 --- a/Robust.Shared/Prototypes/EntityPrototype.cs +++ b/Robust.Shared/Prototypes/EntityPrototype.cs @@ -96,16 +96,9 @@ public sealed partial class EntityPrototype : IPrototype, IInheritingPrototype, [DataField("localizationId")] public string? CustomLocalizationID { get; private set; } - /// /// If true, this object should not show up in the entity spawn panel. /// - [ViewVariables] - [NeverPushInheritance] - [DataField("noSpawn")] - [Obsolete("Use HideSpawnMenu")] - public bool NoSpawn { get; private set; } - [Access(typeof(PrototypeManager))] public bool HideSpawnMenu { get; internal set; } diff --git a/Robust.Shared/Prototypes/PrototypeManager.Categories.cs b/Robust.Shared/Prototypes/PrototypeManager.Categories.cs index 33389f95721..feba747cf2b 100644 --- a/Robust.Shared/Prototypes/PrototypeManager.Categories.cs +++ b/Robust.Shared/Prototypes/PrototypeManager.Categories.cs @@ -149,10 +149,6 @@ private IReadOnlySet UpdateCategories(EntProtoId id, categories.GetOrNew(category).Add(protoInstance); } -#pragma warning disable CS0618 // Type or member is obsolete - protoInstance.HideSpawnMenu |= protoInstance.NoSpawn; -#pragma warning restore CS0618 // Type or member is obsolete - return set; } } From 8d03feb84f0f6fff2531f6c6acd13adef25ca91e Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Wed, 18 Sep 2024 12:08:36 +1000 Subject: [PATCH 24/34] Transform precision thing (#5451) Just noticed it but probably doesn't affect anything really, we'll go from 64bit to 32bit after the math operations and not before. --- Robust.Shared/Physics/Transform.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Robust.Shared/Physics/Transform.cs b/Robust.Shared/Physics/Transform.cs index 8297079753b..149c11ce022 100644 --- a/Robust.Shared/Physics/Transform.cs +++ b/Robust.Shared/Physics/Transform.cs @@ -23,6 +23,7 @@ using System; using System.Numerics; using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; using JetBrains.Annotations; using Robust.Shared.Maths; using Robust.Shared.Utility; @@ -166,10 +167,10 @@ public Quaternion2D(float angle) public Quaternion2D(Angle angle) { - var radians = (float) angle.Theta; + var radians = angle.Theta; - C = MathF.Cos(radians); - S = MathF.Sin(radians); + C = (float) Math.Cos(radians); + S = (float) Math.Sin(radians); } public Quaternion2D Set(float angle) From c86cb0b7951cc4a662c7292138c5f45d868c5f58 Mon Sep 17 00:00:00 2001 From: metalgearsloth Date: Wed, 18 Sep 2024 12:13:35 +1000 Subject: [PATCH 25/34] Version: 235.0.0 --- MSBuild/Robust.Engine.Version.props | 2 +- RELEASE-NOTES.md | 30 +++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/MSBuild/Robust.Engine.Version.props b/MSBuild/Robust.Engine.Version.props index 2b318b4e856..5936870c994 100644 --- a/MSBuild/Robust.Engine.Version.props +++ b/MSBuild/Robust.Engine.Version.props @@ -1,4 +1,4 @@ - 234.1.0 + 235.0.0 diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index e680b23661d..9006162384d 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -35,7 +35,7 @@ END TEMPLATE--> ### Breaking changes -* Several different `AudioSystem` methods were incorrectly given a `[return: NotNullIfNotNull]` attribute. Content code that uses these methods needs to be updated to perform null checks. +*None yet* ### New features @@ -43,6 +43,28 @@ END TEMPLATE--> ### Bugfixes +*None yet* + +### Other + +*None yet* + +### Internal + +*None yet* + + +## 235.0.0 + +### Breaking changes + +* Several different `AudioSystem` methods were incorrectly given a `[return: NotNullIfNotNull]` attribute. Content code that uses these methods needs to be updated to perform null checks. +* noSpawn is no longer obsolete and is now removed in lieu of the EntityCategory HideSpawnMenu. + +### Bugfixes + +* physics.maxlinvelocity is now a replicated cvar. +* Fix DistanceJoint debug drawing in physics not using the local anchors. * Fixed filtered AudioSystem methods playing a sound for all players when given an empty filter. * Fixed equality checks for `MarkupNode` not properly handling attributes. * Fixed `MarkupNode` not having a `GetHashCode()` implementation. @@ -52,11 +74,7 @@ END TEMPLATE--> ### Other -*None yet* - -### Internal - -*None yet* +* Improve precision for Quaternion2D constructor from angles. ## 234.1.0 From ad929c99558c2e5d59bf1bec21c70d60e0474526 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Sat, 21 Sep 2024 02:43:12 +1200 Subject: [PATCH 26/34] Fix ICommonSession.Ping (#5453) --- RELEASE-NOTES.md | 2 +- Robust.Client/Player/PlayerManager.cs | 3 --- Robust.Server/Player/PlayerManager.cs | 3 +-- Robust.Shared/GameStates/SessionState.cs | 5 ++++- Robust.Shared/Network/Messages/MsgPlayerList.cs | 2 -- Robust.Shared/Player/CommonSession.cs | 7 ++++++- Robust.Shared/Player/ICommonSession.cs | 5 ++++- Robust.Shared/Player/SharedPlayerManager.State.cs | 3 +++ 8 files changed, 19 insertions(+), 11 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 9006162384d..2dcfd1f5b8a 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -43,7 +43,7 @@ END TEMPLATE--> ### Bugfixes -*None yet* +* Fixed `ICommonSession.Ping` always returning zero instead of the ping. Note that this will still return zero for client-side code when trying to get the ping of other players. ### Other diff --git a/Robust.Client/Player/PlayerManager.cs b/Robust.Client/Player/PlayerManager.cs index babeca1f5d4..376a12bef86 100644 --- a/Robust.Client/Player/PlayerManager.cs +++ b/Robust.Client/Player/PlayerManager.cs @@ -261,7 +261,6 @@ private bool UpdatePlayerList(IEnumerable remotePlayers, bool full // This is a new userid, so we create a new session. DebugTools.Assert(state.UserId != LocalPlayer?.UserId); var newSession = (ICommonSessionInternal)CreateAndAddSession(state.UserId, state.Name); - newSession.SetPing(state.Ping); SetStatus(newSession, state.Status); SetAttachedEntity(newSession, controlled, out _, true); dirty = true; @@ -271,7 +270,6 @@ private bool UpdatePlayerList(IEnumerable remotePlayers, bool full // Check if the data is actually different if (session.Name == state.Name && session.Status == state.Status - && session.Ping == state.Ping && session.AttachedEntity == controlled) { continue; @@ -280,7 +278,6 @@ private bool UpdatePlayerList(IEnumerable remotePlayers, bool full dirty = true; var local = (ICommonSessionInternal)session; local.SetName(state.Name); - local.SetPing(state.Ping); SetStatus(local, state.Status); SetAttachedEntity(local, controlled, out _, true); } diff --git a/Robust.Server/Player/PlayerManager.cs b/Robust.Server/Player/PlayerManager.cs index 33288620630..c9f11c70edf 100644 --- a/Robust.Server/Player/PlayerManager.cs +++ b/Robust.Server/Player/PlayerManager.cs @@ -137,8 +137,7 @@ private void HandlePlayerListReq(MsgPlayerListReq message) { UserId = client.UserId, Name = client.Name, - Status = client.Status, - Ping = client.Channel!.Ping + Status = client.Status }; list.Add(info); } diff --git a/Robust.Shared/GameStates/SessionState.cs b/Robust.Shared/GameStates/SessionState.cs index 78a193800ef..3fda4152cda 100644 --- a/Robust.Shared/GameStates/SessionState.cs +++ b/Robust.Shared/GameStates/SessionState.cs @@ -21,6 +21,10 @@ public sealed class SessionState [ViewVariables] public SessionStatus Status { get; set; } + // TODO PlayerManager + // Network ping information, though probably do it outside of SessionState to avoid re-sending the name and such + // for all players every few seconds. + [Obsolete("Ping data is not currently networked")] [ViewVariables] public short Ping { get; set; } @@ -34,7 +38,6 @@ public SessionState Clone() UserId = UserId, Name = Name, Status = Status, - Ping = Ping, ControlledEntity = ControlledEntity }; } diff --git a/Robust.Shared/Network/Messages/MsgPlayerList.cs b/Robust.Shared/Network/Messages/MsgPlayerList.cs index 113769ed963..ecfed856dcc 100644 --- a/Robust.Shared/Network/Messages/MsgPlayerList.cs +++ b/Robust.Shared/Network/Messages/MsgPlayerList.cs @@ -25,7 +25,6 @@ public override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer UserId = new NetUserId(buffer.ReadGuid()), Name = buffer.ReadString(), Status = (SessionStatus)buffer.ReadByte(), - Ping = buffer.ReadInt16() }; Plyrs.Add(plyNfo); } @@ -40,7 +39,6 @@ public override void WriteToBuffer(NetOutgoingMessage buffer, IRobustSerializer buffer.Write(ply.UserId.UserId); buffer.Write(ply.Name); buffer.Write((byte) ply.Status); - buffer.Write(ply.Ping); } } } diff --git a/Robust.Shared/Player/CommonSession.cs b/Robust.Shared/Player/CommonSession.cs index bf520b4ddd0..78166dac330 100644 --- a/Robust.Shared/Player/CommonSession.cs +++ b/Robust.Shared/Player/CommonSession.cs @@ -20,7 +20,12 @@ internal sealed class CommonSession : ICommonSessionInternal public string Name { get; set; } = ""; [ViewVariables] - public short Ping { get; set; } + public short Ping + { + get => Channel?.Ping ?? _ping; + set => _ping = value; + } + private short _ping; [ViewVariables] public DateTime ConnectedTime { get; set; } diff --git a/Robust.Shared/Player/ICommonSession.cs b/Robust.Shared/Player/ICommonSession.cs index 7e5c9dfc62e..94177574e91 100644 --- a/Robust.Shared/Player/ICommonSession.cs +++ b/Robust.Shared/Player/ICommonSession.cs @@ -33,9 +33,12 @@ public interface ICommonSession string Name { get; } /// - /// Current connection latency of this session from the server to their client. + /// Current connection latency of this session. If is not null this simply returns + /// . This is not currently usable by client-side code that wants to try access ping + /// information of other players. /// short Ping { get; } + // TODO PlayerManager ping networking. /// /// The current network channel for this session. diff --git a/Robust.Shared/Player/SharedPlayerManager.State.cs b/Robust.Shared/Player/SharedPlayerManager.State.cs index 19956162541..bbdd8831e3a 100644 --- a/Robust.Shared/Player/SharedPlayerManager.State.cs +++ b/Robust.Shared/Player/SharedPlayerManager.State.cs @@ -18,6 +18,9 @@ public void GetPlayerStates(GameTick fromTick, List states) if (LastStateUpdate < fromTick) return; + // TODO PlayerManager delta states + // Track last update tick/time per session, and only send sessions that actually changed. + states.EnsureCapacity(InternalSessions.Count); foreach (var player in InternalSessions.Values) { From 46291af1be5acd657b9f1fe2ab01842f3ff037f1 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Sat, 21 Sep 2024 04:57:08 -0700 Subject: [PATCH 27/34] Add ProtoId parser to Toolshed (#5220) * Add ProtoId parser to Toolshed * Change obsolete FromMarkup to FromMarkupOrThrow --- .../Toolshed/TypeParsers/ProtoIdTypeParser.cs | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Robust.Shared/Toolshed/TypeParsers/ProtoIdTypeParser.cs diff --git a/Robust.Shared/Toolshed/TypeParsers/ProtoIdTypeParser.cs b/Robust.Shared/Toolshed/TypeParsers/ProtoIdTypeParser.cs new file mode 100644 index 00000000000..99ca63f2949 --- /dev/null +++ b/Robust.Shared/Toolshed/TypeParsers/ProtoIdTypeParser.cs @@ -0,0 +1,59 @@ +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Threading.Tasks; +using Robust.Shared.Console; +using Robust.Shared.IoC; +using Robust.Shared.Maths; +using Robust.Shared.Prototypes; +using Robust.Shared.Toolshed.Errors; +using Robust.Shared.Toolshed.Syntax; +using Robust.Shared.Utility; + +namespace Robust.Shared.Toolshed.TypeParsers; + +internal sealed class ProtoIdTypeParser : TypeParser> + where T : class, IPrototype +{ + [Dependency] private readonly IPrototypeManager _prototype = default!; + + public override bool TryParse(ParserContext parserContext, [NotNullWhen(true)] out object? result, out IConError? error) + { + var proto = parserContext.GetWord(ParserContext.IsToken); + + if (proto is null || !_prototype.HasMapping(proto)) + { + _prototype.TryGetKindFrom(out var kind); + DebugTools.AssertNotNull(kind); + + error = new NotAValidProtoId(proto ?? "[null]", kind!); + result = null; + return false; + } + + result = new ProtoId(proto); + error = null; + return true; + } + + public override ValueTask<(CompletionResult? result, IConError? error)> TryAutocomplete(ParserContext parserContext, string? argName) + { + var options = CompletionHelper.PrototypeIDs(); + + _prototype.TryGetKindFrom(out var kind); + DebugTools.AssertNotNull(kind); + + return ValueTask.FromResult<(CompletionResult? result, IConError? error)>((CompletionResult.FromHintOptions(options, $"<{kind} protoId>"), null)); + } +} + +public record NotAValidProtoId(string Proto, string Kind) : IConError +{ + public FormattedMessage DescribeInner() + { + return FormattedMessage.FromMarkupOrThrow($"{Proto} is not a valid {Kind} prototype"); + } + + public string? Expression { get; set; } + public Vector2i? IssueSpan { get; set; } + public StackTrace? Trace { get; set; } +} From e714dcc83c5e967c9db19132561a4e025e2d6572 Mon Sep 17 00:00:00 2001 From: eoineoineoin Date: Sun, 22 Sep 2024 13:41:27 +0100 Subject: [PATCH 28/34] Fix TabContainer click detection when UIScale was not == 1.0 (#5456) * Fix tabcontainer click detection when UIScale was not == 1.0 * Remove whitespace --------- Co-authored-by: Eoin Mcloughlin --- .../UserInterface/Controls/TabContainer.cs | 45 +++++-------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/Robust.Client/UserInterface/Controls/TabContainer.cs b/Robust.Client/UserInterface/Controls/TabContainer.cs index 623ac18ac1a..5ffd9724ce1 100644 --- a/Robust.Client/UserInterface/Controls/TabContainer.cs +++ b/Robust.Client/UserInterface/Controls/TabContainer.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Numerics; using Robust.Client.Graphics; using Robust.Shared.Input; @@ -21,6 +22,8 @@ public class TabContainer : Container private int _currentTab; private bool _tabsVisible = true; + // The right-most coordinate of each tab header + private List _tabRight = new(); public int CurrentTab { @@ -157,11 +160,14 @@ protected internal override void Draw(DrawingHandleScreen handle) var headerOffset = 0f; + _tabRight.Clear(); + // Then, draw the tabs. for (var i = 0; i < ChildCount; i++) { if (!GetTabVisible(i)) { + _tabRight.Add(headerOffset); continue; } @@ -214,6 +220,8 @@ protected internal override void Draw(DrawingHandleScreen handle) } headerOffset += boxAdvance; + // Remember the right-most point of this tab, for testing clicked areas + _tabRight.Add(headerOffset); } } @@ -283,46 +291,17 @@ protected internal override void KeyBindDown(GUIBoundKeyEventArgs args) args.Handle(); var relX = args.RelativePixelPosition.X; - - var font = _getFont(); - var boxActive = _getTabBoxActive(); - var boxInactive = _getTabBoxInactive(); - - var headerOffset = 0f; - + float tabLeft = 0; for (var i = 0; i < ChildCount; i++) { - if (!GetTabVisible(i)) + if (relX > tabLeft && relX <= _tabRight[i]) { - continue; - } - - var title = GetActualTabTitle(i); - - var titleLength = 0; - // Get string length. - foreach (var rune in title.EnumerateRunes()) - { - if (!font.TryGetCharMetrics(rune, UIScale, out var metrics)) - { - continue; - } - - titleLength += metrics.Advance; - } - - var active = _currentTab == i; - var box = active ? boxActive : boxInactive; - var boxAdvance = titleLength + (box?.MinimumSize.X ?? 0); - - if (headerOffset < relX && headerOffset + boxAdvance > relX) - { - // Got em. CurrentTab = i; return; } - headerOffset += boxAdvance; + // Next tab starts here + tabLeft = _tabRight[i]; } } From 41ec2dc1314383c5b822b52bf1c0eb68e30dc603 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:39:33 +1200 Subject: [PATCH 29/34] Try improve PVS exception tolerance a bit more (#5454) --- Robust.Server/GameStates/PvsChunk.cs | 10 ++++++---- Robust.Server/GameStates/PvsSystem.Chunks.cs | 1 + Robust.Server/GameStates/PvsSystem.cs | 3 ++- Robust.Shared/GameObjects/EntityManager.cs | 9 +++++++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Robust.Server/GameStates/PvsChunk.cs b/Robust.Server/GameStates/PvsChunk.cs index 38ec670b45d..dc77564a1fb 100644 --- a/Robust.Server/GameStates/PvsChunk.cs +++ b/Robust.Server/GameStates/PvsChunk.cs @@ -141,9 +141,10 @@ public bool PopulateContents(EntityQuery meta, EntityQuery= EntityLifeStage.Terminating) { - DebugTools.Assert($"PVS chunk contains a deleted entity: {child}"); + DebugTools.Assert($"PVS chunk contains a delete or terminating entity: {child}"); MarkDirty(); return false; } @@ -188,9 +189,10 @@ public bool PopulateContents(EntityQuery meta, EntityQuery= EntityLifeStage.Terminating) { - DebugTools.Assert($"PVS chunk contains a deleted entity: {child}"); + DebugTools.Assert($"PVS chunk contains a delete or terminating entity: {child}"); MarkDirty(); return false; } diff --git a/Robust.Server/GameStates/PvsSystem.Chunks.cs b/Robust.Server/GameStates/PvsSystem.Chunks.cs index 40cafb0bb94..a7ac09043a4 100644 --- a/Robust.Server/GameStates/PvsSystem.Chunks.cs +++ b/Robust.Server/GameStates/PvsSystem.Chunks.cs @@ -232,6 +232,7 @@ internal void ProcessVisibleChunksSequential() [MethodImpl(MethodImplOptions.AggressiveInlining)] private void AddEntityToChunk(EntityUid uid, MetaDataComponent meta, PvsChunkLocation location) { + DebugTools.Assert(meta.EntityLifeStage < EntityLifeStage.Terminating); ref var chunk = ref CollectionsMarshal.GetValueRefOrAddDefault(_chunks, location, out var existing); if (!existing) { diff --git a/Robust.Server/GameStates/PvsSystem.cs b/Robust.Server/GameStates/PvsSystem.cs index 7a53079a01e..bb63968cd1b 100644 --- a/Robust.Server/GameStates/PvsSystem.cs +++ b/Robust.Server/GameStates/PvsSystem.cs @@ -129,7 +129,6 @@ public override void Initialize() SubscribeLocalEvent(OnMapChanged); SubscribeLocalEvent(OnGridRemoved); - SubscribeLocalEvent(OnEntityTerminating); SubscribeLocalEvent(OnTransformStartup); _playerManager.PlayerStatusChanged += OnPlayerStatusChanged; @@ -137,6 +136,7 @@ public override void Initialize() EntityManager.EntityAdded += OnEntityAdded; EntityManager.EntityDeleted += OnEntityDeleted; EntityManager.AfterEntityFlush += AfterEntityFlush; + EntityManager.BeforeEntityTerminating += OnEntityTerminating; Subs.CVar(_configManager, CVars.NetPVS, SetPvs, true); Subs.CVar(_configManager, CVars.NetMaxUpdateRange, OnViewsizeChanged, true); @@ -162,6 +162,7 @@ public override void Shutdown() EntityManager.EntityAdded -= OnEntityAdded; EntityManager.EntityDeleted -= OnEntityDeleted; EntityManager.AfterEntityFlush -= AfterEntityFlush; + EntityManager.BeforeEntityTerminating -= OnEntityTerminating; _parallelMgr.ParallelCountChanged -= ResetParallelism; diff --git a/Robust.Shared/GameObjects/EntityManager.cs b/Robust.Shared/GameObjects/EntityManager.cs index bec9e9afbf0..6aa976d10b9 100644 --- a/Robust.Shared/GameObjects/EntityManager.cs +++ b/Robust.Shared/GameObjects/EntityManager.cs @@ -93,6 +93,14 @@ public abstract partial class EntityManager : IEntityManager public event Action>? EntityAdded; public event Action>? EntityInitialized; public event Action>? EntityDeleted; + + /// + /// Internal termination event handlers. This is mainly for exception tolerance, we want to ensure that PVS, + /// and other important engine systems can get updated before some content code throws an exception. + /// + internal event TerminatingEventHandler? BeforeEntityTerminating; + public delegate void TerminatingEventHandler(ref EntityTerminatingEvent ev); + public event Action? BeforeEntityFlush; public event Action? AfterEntityFlush; @@ -556,6 +564,7 @@ private void RecursiveFlagEntityTermination(EntityUid uid, try { var ev = new EntityTerminatingEvent((uid, metadata)); + BeforeEntityTerminating?.Invoke(ref ev); EventBus.RaiseLocalEvent(uid, ref ev, true); } catch (Exception e) From abb3f65fe42ca84e6717ea51600edad40d0802a2 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:40:16 +1200 Subject: [PATCH 30/34] Make EnsureEntityDictionary use TryAdd (#5461) --- RELEASE-NOTES.md | 1 + Robust.Shared/GameObjects/EntityManager.Network.cs | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 2dcfd1f5b8a..a4a8cdca1e0 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -43,6 +43,7 @@ END TEMPLATE--> ### Bugfixes +* Auto-networked dictionaries now use `TryAdd()` to avoid duplicate key errors when a dictionary contains multiple unknown networked entities. * Fixed `ICommonSession.Ping` always returning zero instead of the ping. Note that this will still return zero for client-side code when trying to get the ping of other players. ### Other diff --git a/Robust.Shared/GameObjects/EntityManager.Network.cs b/Robust.Shared/GameObjects/EntityManager.Network.cs index df5cdcf5895..370d43269a0 100644 --- a/Robust.Shared/GameObjects/EntityManager.Network.cs +++ b/Robust.Shared/GameObjects/EntityManager.Network.cs @@ -391,7 +391,7 @@ public void EnsureEntityDictionary(Dictionary entities.EnsureCapacity(netEntities.Count); foreach (var pair in netEntities) { - entities.Add(EnsureEntity(pair.Key, callerEntity), pair.Value); + entities.TryAdd(EnsureEntity(pair.Key, callerEntity), pair.Value); } } @@ -402,7 +402,7 @@ public void EnsureEntityDictionaryNullableValue(Dictionary(pair.Key, callerEntity), pair.Value); + entities.TryAdd(EnsureEntity(pair.Key, callerEntity), pair.Value); } } @@ -413,7 +413,7 @@ public void EnsureEntityDictionary(Dictionary netE entities.EnsureCapacity(netEntities.Count); foreach (var pair in netEntities) { - entities.Add(pair.Key, EnsureEntity(pair.Value, callerEntity)); + entities.TryAdd(pair.Key, EnsureEntity(pair.Value, callerEntity)); } } @@ -424,7 +424,7 @@ public void EnsureEntityDictionary(Dictionary net entities.EnsureCapacity(netEntities.Count); foreach (var pair in netEntities) { - entities.Add(pair.Key, EnsureEntity(pair.Value, callerEntity)); + entities.TryAdd(pair.Key, EnsureEntity(pair.Value, callerEntity)); } } @@ -435,7 +435,7 @@ public void EnsureEntityDictionary(Dictionary netEn entities.EnsureCapacity(netEntities.Count); foreach (var pair in netEntities) { - entities.Add(EnsureEntity(pair.Key, callerEntity), EnsureEntity(pair.Value, callerEntity)); + entities.TryAdd(EnsureEntity(pair.Key, callerEntity), EnsureEntity(pair.Value, callerEntity)); } } @@ -446,7 +446,7 @@ public void EnsureEntityDictionary(Dictionary netE entities.EnsureCapacity(netEntities.Count); foreach (var pair in netEntities) { - entities.Add(EnsureEntity(pair.Key, callerEntity), EnsureEntity(pair.Value, callerEntity)); + entities.TryAdd(EnsureEntity(pair.Key, callerEntity), EnsureEntity(pair.Value, callerEntity)); } } From b84917e8e422a9cf77be64a96c4d31687e8d196b Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:40:42 +1200 Subject: [PATCH 31/34] Obsolete some static localization methods (#5460) --- Robust.Shared/Localization/Loc.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Robust.Shared/Localization/Loc.cs b/Robust.Shared/Localization/Loc.cs index 2e19b6ac6cc..e12decae8ab 100644 --- a/Robust.Shared/Localization/Loc.cs +++ b/Robust.Shared/Localization/Loc.cs @@ -1,8 +1,6 @@ using System; using System.Diagnostics.CodeAnalysis; -using System.Globalization; using JetBrains.Annotations; -using Robust.Shared.ContentPack; using Robust.Shared.IoC; namespace Robust.Shared.Localization @@ -36,6 +34,7 @@ public static string GetString(string messageId) return LocalizationManager.GetString(messageId); } + [Obsolete("Use ILocalizationManager")] public static bool TryGetString(string messageId, [NotNullWhen(true)] out string? message) { return LocalizationManager.TryGetString(messageId, out message); @@ -49,6 +48,7 @@ public static string GetString(string messageId, params (string,object)[] args) return LocalizationManager.GetString(messageId, args); } + [Obsolete("Use ILocalizationManager")] public static bool TryGetString( string messageId, [NotNullWhen(true)] out string? value, From dbe297b1fc9bfd83996f648b6bab75291d8988d6 Mon Sep 17 00:00:00 2001 From: Stalen <33173619+stalengd@users.noreply.github.com> Date: Tue, 24 Sep 2024 02:43:00 +0300 Subject: [PATCH 32/34] Activate XAML hot reload on file rename (for VS support) (#5429) --- .../UserInterface/XAML/Proxy/XamlHotReloadManager.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Robust.Client/UserInterface/XAML/Proxy/XamlHotReloadManager.cs b/Robust.Client/UserInterface/XAML/Proxy/XamlHotReloadManager.cs index 39669abaa3a..d40fd02c13b 100644 --- a/Robust.Client/UserInterface/XAML/Proxy/XamlHotReloadManager.cs +++ b/Robust.Client/UserInterface/XAML/Proxy/XamlHotReloadManager.cs @@ -58,16 +58,16 @@ private FileSystemWatcher CreateWatcher(string location) var watcher = new FileSystemWatcher(location) { IncludeSubdirectories = true, - NotifyFilter = NotifyFilters.LastWrite, + NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName, }; - watcher.Changed += (_, args) => + void OnWatcherEvent(object sender, FileSystemEventArgs args) { switch (args.ChangeType) { - case WatcherChangeTypes.Renamed: case WatcherChangeTypes.Deleted: return; + case WatcherChangeTypes.Renamed: case WatcherChangeTypes.Created: case WatcherChangeTypes.Changed: case WatcherChangeTypes.All: @@ -98,7 +98,10 @@ private FileSystemWatcher CreateWatcher(string location) _xamlProxyManager.SetImplementation(resourceFileName, newText); }); - }; + } + + watcher.Changed += OnWatcherEvent; + watcher.Renamed += OnWatcherEvent; watcher.EnableRaisingEvents = true; return watcher; } From fb9b0ae89be0cfe8745b3206b894a6b3d0859907 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sat, 28 Sep 2024 14:13:05 +1000 Subject: [PATCH 33/34] Remove IsTouching set on physics prediction (#5468) Just because an entity sleeps doesn't mean it's not touching necessarily. This causes client to mispredict against server and continuously fire collision events if we try to move into an entity. Easiest way to reproduced is to walk into a locked airlock and watch it flicker constantly. --- Robust.Client/Physics/PhysicsSystem.Predict.cs | 1 - Robust.Shared/Physics/Dynamics/Contacts/Contact.cs | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Robust.Client/Physics/PhysicsSystem.Predict.cs b/Robust.Client/Physics/PhysicsSystem.Predict.cs index af16a3fd023..c21ea92d38d 100644 --- a/Robust.Client/Physics/PhysicsSystem.Predict.cs +++ b/Robust.Client/Physics/PhysicsSystem.Predict.cs @@ -156,7 +156,6 @@ internal void UpdateIsTouching(List toUpdate) if (activeA == false && activeB == false) { - contact.IsTouching = false; continue; } diff --git a/Robust.Shared/Physics/Dynamics/Contacts/Contact.cs b/Robust.Shared/Physics/Dynamics/Contacts/Contact.cs index e588fc93952..fb27d6eae5a 100644 --- a/Robust.Shared/Physics/Dynamics/Contacts/Contact.cs +++ b/Robust.Shared/Physics/Dynamics/Contacts/Contact.cs @@ -35,6 +35,7 @@ using Robust.Shared.Physics.Collision.Shapes; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Systems; +using Robust.Shared.ViewVariables; namespace Robust.Shared.Physics.Dynamics.Contacts { @@ -94,11 +95,13 @@ internal Contact(IManifoldManager manifoldManager) /// /// Determines whether the contact is touching. /// + [ViewVariables] public bool IsTouching { get; internal set; } /// Enable/disable this contact. This can be used inside the pre-solve /// contact listener. The contact is only disabled for the current /// time step (or sub-step in continuous collisions). + [ViewVariables] public bool Enabled { get; set; } /// From 74e7e61a98f12c2b729cce75337cb5f3bdfd13fa Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sat, 28 Sep 2024 14:33:37 +1000 Subject: [PATCH 34/34] Revert "Make resetting contacts on the client only set is touching if it is true" (#5469) This reverts commit cdb94748c8cebad7633f056d01bdf6520888a93c. --- Robust.Shared/Physics/Dynamics/Contacts/Contact.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Robust.Shared/Physics/Dynamics/Contacts/Contact.cs b/Robust.Shared/Physics/Dynamics/Contacts/Contact.cs index fb27d6eae5a..177cc73da01 100644 --- a/Robust.Shared/Physics/Dynamics/Contacts/Contact.cs +++ b/Robust.Shared/Physics/Dynamics/Contacts/Contact.cs @@ -31,6 +31,8 @@ using System.Collections.Generic; using System.Numerics; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; +using Robust.Shared.Maths; using Robust.Shared.Physics.Collision; using Robust.Shared.Physics.Collision.Shapes; using Robust.Shared.Physics.Components; @@ -259,9 +261,7 @@ internal void UpdateIsTouching(Transform bodyATransform, Transform bodyBTransfor { var manifold = Manifold; Evaluate(ref manifold, bodyATransform, bodyBTransform); - - if (IsTouching) - IsTouching = manifold.PointCount > 0; + IsTouching = manifold.PointCount > 0; } }