diff --git a/.editorconfig b/.editorconfig index 8a5cf43521..a87e5e0651 100644 --- a/.editorconfig +++ b/.editorconfig @@ -77,6 +77,8 @@ csharp_style_expression_bodied_methods = false:suggestion #csharp_style_expression_bodied_operators = false:silent csharp_style_expression_bodied_properties = true:suggestion +csharp_style_namespace_declarations = file_scoped:suggestion + # Pattern matching preferences #csharp_style_pattern_matching_over_as_with_null_check = true:suggestion #csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion diff --git a/.github/workflows/build-docfx.yml b/.github/workflows/build-docfx.yml index 3ef0497496..1f010b7291 100644 --- a/.github/workflows/build-docfx.yml +++ b/.github/workflows/build-docfx.yml @@ -27,7 +27,7 @@ jobs: run: dotnet restore - name: Build Project - run: dotnet build --no-restore /p:WarningsAsErrors=nullable + run: dotnet build --no-restore - name: Build DocFX uses: nikeee/docfx-action@v1.0.0 diff --git a/.github/workflows/build-map-renderer.yml b/.github/workflows/build-map-renderer.yml index 951177e1ad..852888cc6c 100644 --- a/.github/workflows/build-map-renderer.yml +++ b/.github/workflows/build-map-renderer.yml @@ -42,7 +42,7 @@ jobs: run: dotnet restore - name: Build Project - run: dotnet build Content.MapRenderer --configuration Release --no-restore /p:WarningsAsErrors=nullable /m + run: dotnet build Content.MapRenderer --configuration Release --no-restore /m - name: Run Map Renderer run: dotnet run --project Content.MapRenderer Dev diff --git a/.github/workflows/build-test-debug.yml b/.github/workflows/build-test-debug.yml index 2672269591..43d621cdf7 100644 --- a/.github/workflows/build-test-debug.yml +++ b/.github/workflows/build-test-debug.yml @@ -42,7 +42,7 @@ jobs: run: dotnet restore - name: Build Project - run: dotnet build --configuration DebugOpt --no-restore /p:WarningsAsErrors=nullable /m + run: dotnet build --configuration DebugOpt --no-restore /m - name: Run Content.Tests run: dotnet test --no-build --configuration DebugOpt Content.Tests/Content.Tests.csproj -- NUnit.ConsoleOut=0 diff --git a/.github/workflows/labeler-needsreview.yml b/.github/workflows/labeler-needsreview.yml index 4827562eaa..a4a87b4979 100644 --- a/.github/workflows/labeler-needsreview.yml +++ b/.github/workflows/labeler-needsreview.yml @@ -2,7 +2,7 @@ on: pull_request_target: - types: [review_requested] + types: [review_requested, opened] jobs: add_label: diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 8554c97ee8..b2aeb6197a 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -27,7 +27,7 @@ If you believe someone is violating the code of conduct, we ask that you report Original text courtesy of the [Speak Up! project](http://web.archive.org/web/20141109123859/http://speakup.io/coc.html). -## On Comunity Moderation +## On Community Moderation Deviating from the Code of Conduct on the Github repository may result in moderative actions taken by project Maintainers. This can involve your content being edited or deleted, and may result in a temporary or permanent block from the repository. diff --git a/Content.Benchmarks/PvsBenchmark.cs b/Content.Benchmarks/PvsBenchmark.cs index 1edbcb6448..51a013539e 100644 --- a/Content.Benchmarks/PvsBenchmark.cs +++ b/Content.Benchmarks/PvsBenchmark.cs @@ -6,7 +6,6 @@ using BenchmarkDotNet.Attributes; using Content.IntegrationTests; using Content.IntegrationTests.Pair; using Content.Server.Mind; -using Content.Server.Warps; using Content.Shared.Warps; using Robust.Shared; using Robust.Shared.Analyzers; diff --git a/Content.Benchmarks/SpawnEquipDeleteBenchmark.cs b/Content.Benchmarks/SpawnEquipDeleteBenchmark.cs index 0638d945aa..9b878eac40 100644 --- a/Content.Benchmarks/SpawnEquipDeleteBenchmark.cs +++ b/Content.Benchmarks/SpawnEquipDeleteBenchmark.cs @@ -8,6 +8,7 @@ using Robust.Shared; using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; using Robust.Shared.Map; +using Robust.Shared.Prototypes; namespace Content.Benchmarks; @@ -18,9 +19,11 @@ namespace Content.Benchmarks; [Virtual, MemoryDiagnoser] public class SpawnEquipDeleteBenchmark { + private static readonly EntProtoId Mob = "MobHuman"; + private static readonly ProtoId CaptainStartingGear = "CaptainGear"; + private TestPair _pair = default!; private StationSpawningSystem _spawnSys = default!; - private const string Mob = "MobHuman"; private StartingGearPrototype _gear = default!; private EntityUid _entity; private EntityCoordinates _coords; @@ -39,7 +42,7 @@ public class SpawnEquipDeleteBenchmark var mapData = await _pair.CreateTestMap(); _coords = mapData.GridCoords; _spawnSys = server.System(); - _gear = server.ProtoMan.Index("CaptainGear"); + _gear = server.ProtoMan.Index(CaptainStartingGear); } [GlobalCleanup] diff --git a/Content.Client/Access/UI/GroupedAccessLevelChecklist.xaml.cs b/Content.Client/Access/UI/GroupedAccessLevelChecklist.xaml.cs index da68653ce5..4f07c31009 100644 --- a/Content.Client/Access/UI/GroupedAccessLevelChecklist.xaml.cs +++ b/Content.Client/Access/UI/GroupedAccessLevelChecklist.xaml.cs @@ -15,6 +15,8 @@ namespace Content.Client.Access.UI; [GenerateTypedNameReferences] public sealed partial class GroupedAccessLevelChecklist : BoxContainer { + private static readonly ProtoId GeneralAccessGroup = "General"; + [Dependency] private readonly IPrototypeManager _protoManager = default!; private bool _isMonotone; @@ -63,7 +65,7 @@ public sealed partial class GroupedAccessLevelChecklist : BoxContainer // Ensure that the 'general' access group is added to handle // misc. access levels that aren't associated with any group - if (_protoManager.TryIndex("General", out var generalAccessProto)) + if (_protoManager.TryIndex(GeneralAccessGroup, out var generalAccessProto)) _groupedAccessLevels.TryAdd(generalAccessProto, new()); // Assign known access levels with their associated groups diff --git a/Content.Client/Actions/ActionsSystem.cs b/Content.Client/Actions/ActionsSystem.cs index 23ff23997f..8efe0b2367 100644 --- a/Content.Client/Actions/ActionsSystem.cs +++ b/Content.Client/Actions/ActionsSystem.cs @@ -211,7 +211,7 @@ namespace Content.Client.Actions else { var request = new RequestPerformActionEvent(GetNetEntity(action)); - EntityManager.RaisePredictiveEvent(request); + RaisePredictiveEvent(request); } } @@ -334,7 +334,12 @@ namespace Content.Client.Actions private void OnEntityTargetAttempt(Entity ent, ref ActionTargetAttemptEvent args) { - if (args.Handled || args.Input.EntityUid is not { Valid: true } entity) + if (args.Handled) + return; + + args.Handled = true; + + if (args.Input.EntityUid is not { Valid: true } entity) return; // let world target component handle it @@ -345,8 +350,6 @@ namespace Content.Client.Actions return; } - args.Handled = true; - var action = args.Action; var user = args.User; diff --git a/Content.Client/Administration/AdminNameOverlay.cs b/Content.Client/Administration/AdminNameOverlay.cs index 0d424cbff0..abeed65732 100644 --- a/Content.Client/Administration/AdminNameOverlay.cs +++ b/Content.Client/Administration/AdminNameOverlay.cs @@ -1,3 +1,4 @@ +using System.Collections.Frozen; using System.Linq; using System.Numerics; using Content.Client.Administration.Systems; @@ -24,6 +25,7 @@ internal sealed class AdminNameOverlay : Overlay private readonly EntityLookupSystem _entityLookup; private readonly IUserInterfaceManager _userInterfaceManager; private readonly SharedRoleSystem _roles; + private readonly IPrototypeManager _prototypeManager; private readonly Font _font; private readonly Font _fontBold; private AdminOverlayAntagFormat _overlayFormat; @@ -36,8 +38,9 @@ internal sealed class AdminNameOverlay : Overlay private float _overlayMergeDistance; //TODO make this adjustable via GUI? - private readonly ProtoId[] _filter = - ["SoloAntagonist", "TeamAntagonist", "SiliconAntagonist", "FreeAgent"]; + private static readonly FrozenSet> Filter = + new ProtoId[] {"SoloAntagonist", "TeamAntagonist", "SiliconAntagonist", "FreeAgent"} + .ToFrozenSet(); private readonly string _antagLabelClassic = Loc.GetString("admin-overlay-antag-classic"); @@ -49,7 +52,8 @@ internal sealed class AdminNameOverlay : Overlay EntityLookupSystem entityLookup, IUserInterfaceManager userInterfaceManager, IConfigurationManager config, - SharedRoleSystem roles) + SharedRoleSystem roles, + IPrototypeManager prototypeManager) { _system = system; _entityManager = entityManager; @@ -57,6 +61,7 @@ internal sealed class AdminNameOverlay : Overlay _entityLookup = entityLookup; _userInterfaceManager = userInterfaceManager; _roles = roles; + _prototypeManager = prototypeManager; ZIndex = 200; // Setting these to a specific ttf would break the antag symbols _font = resourceCache.NotoStack(); @@ -125,6 +130,14 @@ internal sealed class AdminNameOverlay : Overlay foreach (var info in sortable.OrderBy(s => s.Item4.Y).ToList()) { var playerInfo = info.Item1; + var rolePrototype = playerInfo.RoleProto == null + ? null + : _prototypeManager.Index(playerInfo.RoleProto.Value); + + var roleName = Loc.GetString(rolePrototype?.Name ?? RoleTypePrototype.FallbackName); + var roleColor = rolePrototype?.Color ?? RoleTypePrototype.FallbackColor; + var roleSymbol = rolePrototype?.Symbol ?? RoleTypePrototype.FallbackSymbol; + var aabb = info.Item2; var entity = info.Item3; var screenCoordinatesCenter = info.Item4; @@ -209,7 +222,7 @@ internal sealed class AdminNameOverlay : Overlay switch (_overlaySymbolStyle) { case AdminOverlayAntagSymbolStyle.Specific: - symbol = playerInfo.RoleProto.Symbol; + symbol = roleSymbol; break; case AdminOverlayAntagSymbolStyle.Basic: symbol = Loc.GetString("player-tab-antag-prefix"); @@ -225,17 +238,17 @@ internal sealed class AdminNameOverlay : Overlay switch (_overlayFormat) { case AdminOverlayAntagFormat.Roletype: - color = playerInfo.RoleProto.Color; - symbol = _filter.Contains(playerInfo.RoleProto) ? symbol : string.Empty; - text = _filter.Contains(playerInfo.RoleProto) - ? Loc.GetString(playerInfo.RoleProto.Name).ToUpper() + color = roleColor; + symbol = IsFiltered(playerInfo.RoleProto) ? symbol : string.Empty; + text = IsFiltered(playerInfo.RoleProto) + ? roleName.ToUpper() : string.Empty; break; case AdminOverlayAntagFormat.Subtype: - color = playerInfo.RoleProto.Color; - symbol = _filter.Contains(playerInfo.RoleProto) ? symbol : string.Empty; - text = _filter.Contains(playerInfo.RoleProto) - ? _roles.GetRoleSubtypeLabel(playerInfo.RoleProto.Name, playerInfo.Subtype).ToUpper() + color = roleColor; + symbol = IsFiltered(playerInfo.RoleProto) ? symbol : string.Empty; + text = IsFiltered(playerInfo.RoleProto) + ? _roles.GetRoleSubtypeLabel(roleName, playerInfo.Subtype).ToUpper() : string.Empty; break; default: @@ -258,4 +271,12 @@ internal sealed class AdminNameOverlay : Overlay drawnOverlays.Add((screenCoordinatesCenter, currentOffset)); } } + + private static bool IsFiltered(ProtoId? roleProtoId) + { + if (roleProtoId == null) + return false; + + return Filter.Contains(roleProtoId.Value); + } } diff --git a/Content.Client/Administration/Components/HeadstandComponent.cs b/Content.Client/Administration/Components/HeadstandComponent.cs deleted file mode 100644 index a4e3bfc5aa..0000000000 --- a/Content.Client/Administration/Components/HeadstandComponent.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Content.Shared.Administration.Components; -using Robust.Shared.GameStates; - -namespace Content.Client.Administration.Components; - -[RegisterComponent] -public sealed partial class HeadstandComponent : SharedHeadstandComponent -{ - -} diff --git a/Content.Client/Administration/Systems/AdminSystem.Overlay.cs b/Content.Client/Administration/Systems/AdminSystem.Overlay.cs index a630df4521..e000bdc0ba 100644 --- a/Content.Client/Administration/Systems/AdminSystem.Overlay.cs +++ b/Content.Client/Administration/Systems/AdminSystem.Overlay.cs @@ -4,6 +4,7 @@ using Robust.Client.Graphics; using Robust.Client.ResourceManagement; using Robust.Client.UserInterface; using Robust.Shared.Configuration; +using Robust.Shared.Prototypes; namespace Content.Client.Administration.Systems { @@ -17,6 +18,7 @@ namespace Content.Client.Administration.Systems [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!; [Dependency] private readonly SharedRoleSystem _roles = default!; + [Dependency] private readonly IPrototypeManager _proto = default!; private AdminNameOverlay _adminNameOverlay = default!; @@ -33,7 +35,8 @@ namespace Content.Client.Administration.Systems _entityLookup, _userInterfaceManager, _configurationManager, - _roles); + _roles, + _proto); _adminManager.AdminStatusUpdated += OnAdminStatusUpdated; } diff --git a/Content.Client/Administration/Systems/HeadstandSystem.cs b/Content.Client/Administration/Systems/HeadstandSystem.cs index d0634e4ddd..8ab337f3cc 100644 --- a/Content.Client/Administration/Systems/HeadstandSystem.cs +++ b/Content.Client/Administration/Systems/HeadstandSystem.cs @@ -1,4 +1,4 @@ -using Content.Client.Administration.Components; +using Content.Shared.Administration.Components; using Robust.Client.GameObjects; namespace Content.Client.Administration.Systems; diff --git a/Content.Client/Administration/UI/AdminCamera/AdminCameraControl.xaml b/Content.Client/Administration/UI/AdminCamera/AdminCameraControl.xaml new file mode 100644 index 0000000000..1413eff00c --- /dev/null +++ b/Content.Client/Administration/UI/AdminCamera/AdminCameraControl.xaml @@ -0,0 +1,20 @@ + + + + + + + + + +