From fffb304de9ec02c89c9c8f191e520883fa588f48 Mon Sep 17 00:00:00 2001 From: Dmitry <57028746+DIMMoon1@users.noreply.github.com> Date: Fri, 18 Sep 2026 01:47:04 +0700 Subject: [PATCH] upstream codefix secapartment update --- .../SecApartment/SecApartmentWindow.xaml.cs | 2 +- .../Corvax/SecApartment/SquadEntry.xaml.cs | 20 +++---- .../Connection/ConnectionManager.cs | 11 ++-- .../Corvax/Api/AHelp/AHelpBotApiSystem.cs | 3 +- .../Api/AHelp/BwoinkSystem.CorvaxAHelpApi.cs | 2 +- .../Corvax/Documents/DocumentPrinterSystem.cs | 6 +- .../PeacefulRoundEndSystem.cs | 4 +- .../Corvax/SecApartment/SecApartmentSystem.cs | 55 ++++++++++--------- .../StationGoal/StationGoalPaperSystem.cs | 2 +- Content.Server/Corvax/TTS/TTSSystem.cs | 3 +- .../ServerGameTicker.StatusShell.cs | 2 +- .../ContentLocalizationManager.cs | 2 +- 12 files changed, 58 insertions(+), 54 deletions(-) diff --git a/Content.Client/Corvax/SecApartment/SecApartmentWindow.xaml.cs b/Content.Client/Corvax/SecApartment/SecApartmentWindow.xaml.cs index 2709628da6..6fbde35c15 100644 --- a/Content.Client/Corvax/SecApartment/SecApartmentWindow.xaml.cs +++ b/Content.Client/Corvax/SecApartment/SecApartmentWindow.xaml.cs @@ -1,7 +1,7 @@ using System.Linq; using System.Numerics; using Content.Client.Corvax.SecApartment.Stylesheets; -using Content.Client.GameTicking.Managers; +using Content.Client.GameTicking; using Content.Shared.SecApartment; using Content.Shared.StatusIcon; using Robust.Client.AutoGenerated; diff --git a/Content.Client/Corvax/SecApartment/SquadEntry.xaml.cs b/Content.Client/Corvax/SecApartment/SquadEntry.xaml.cs index 70987ecdb6..7b5dd350c0 100644 --- a/Content.Client/Corvax/SecApartment/SquadEntry.xaml.cs +++ b/Content.Client/Corvax/SecApartment/SquadEntry.xaml.cs @@ -186,7 +186,7 @@ public sealed partial class SquadEntry : PanelContainer Color backgroundColor; Color borderColor; - if (member.SensorStatus == null || !member.SensorStatus.IsAlive) + if (member.SensorStatus is not { } sensorStatus || !sensorStatus.IsAlive) { backgroundColor = Color.FromHex("#1a0a0a"); borderColor = Color.FromHex("#990000"); @@ -245,15 +245,15 @@ public sealed partial class SquadEntry : PanelContainer var specifier = new SpriteSpecifier.Rsi(new ResPath("Interface/Alerts/human_crew_monitoring.rsi"), "alive"); - if (member.SensorStatus != null) + if (member.SensorStatus is { } sensorStatus2) { - if (!member.SensorStatus.IsAlive) + if (!sensorStatus2.IsAlive) { specifier = new SpriteSpecifier.Rsi(new ResPath("Interface/Alerts/human_crew_monitoring.rsi"), "dead"); } - else if (member.SensorStatus.DamagePercentage != null) + else if (sensorStatus2.DamagePercentage is { } damagePercentage) { - var index = MathF.Round(4f * member.SensorStatus.DamagePercentage.Value); + var index = MathF.Round(4f * damagePercentage); if (index >= 5) specifier = new SpriteSpecifier.Rsi(new ResPath("Interface/Alerts/human_crew_monitoring.rsi"), "critical"); @@ -359,7 +359,7 @@ public sealed partial class SquadEntry : PanelContainer Color backgroundColor; Color borderColor; - if (status == null || !status.IsAlive) + if (status is not { } sensorStatus || !sensorStatus.IsAlive) { backgroundColor = Color.FromHex("#1a0a0a"); borderColor = Color.FromHex("#990000"); @@ -400,18 +400,18 @@ public sealed partial class SquadEntry : PanelContainer "alive" ); - if (status != null) + if (status is { } sensorStatus2) { - if (!status.IsAlive) + if (!sensorStatus2.IsAlive) { specifier = new SpriteSpecifier.Rsi( new ResPath("Interface/Alerts/human_crew_monitoring.rsi"), "dead" ); } - else if (status.DamagePercentage != null) + else if (sensorStatus2.DamagePercentage is { } damagePercentage) { - var index = MathF.Round(4f * status.DamagePercentage.Value); + var index = MathF.Round(4f * damagePercentage); if (index >= 5) specifier = new SpriteSpecifier.Rsi( new ResPath("Interface/Alerts/human_crew_monitoring.rsi"), diff --git a/Content.Server/Connection/ConnectionManager.cs b/Content.Server/Connection/ConnectionManager.cs index e7d435a82b..d6aa47dec4 100644 --- a/Content.Server/Connection/ConnectionManager.cs +++ b/Content.Server/Connection/ConnectionManager.cs @@ -407,12 +407,15 @@ namespace Content.Server.Connection public async Task HavePrivilegedJoin(NetUserId userId) { var adminBypass = _cfg.GetCVar(CCVars.AdminBypassMaxPlayers) && await _db.GetAdminDataForAsync(userId) != null; - var havePriorityJoin = _sponsorsMgr != null && _sponsorsMgr.HaveServerPriorityJoin(userId); // Corvax-Sponsors - var wasInGame = EntitySystem.TryGet(out var ticker) && - ticker.PlayerGameStatuses.TryGetValue(userId, out var status) && + var havePriorityJoin = _sponsorsMgr != null && _sponsorsMgr.HaveServerPriorityJoin(userId); // Corvax-Sponsors + + _ticker ??= _entityManager.SystemOrNull(); + var wasInGame = _ticker != null && + _ticker.PlayerGameStatuses.TryGetValue(userId, out var status) && status == PlayerGameStatus.JoinedGame; + return adminBypass || - havePriorityJoin || // Corvax-Sponsors + havePriorityJoin || // Corvax-Sponsors wasInGame; } // Corvax-Queue-End diff --git a/Content.Server/Corvax/Api/AHelp/AHelpBotApiSystem.cs b/Content.Server/Corvax/Api/AHelp/AHelpBotApiSystem.cs index 964946df4d..6514b19d9a 100644 --- a/Content.Server/Corvax/Api/AHelp/AHelpBotApiSystem.cs +++ b/Content.Server/Corvax/Api/AHelp/AHelpBotApiSystem.cs @@ -6,16 +6,15 @@ using System.Net.Http.Headers; using System.Net.Http.Json; using System.Security.Cryptography; using System.Text; -using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Content.Server.Administration.Systems; -using Content.Server.GameTicking; using Content.Shared.Corvax.CCCVars; using Robust.Shared; using Robust.Shared.Asynchronous; using Robust.Shared.Configuration; using Robust.Server.ServerStatus; +using Content.Shared.GameTicking; namespace Content.Server.Corvax.Api.AHelp; diff --git a/Content.Server/Corvax/Api/AHelp/BwoinkSystem.CorvaxAHelpApi.cs b/Content.Server/Corvax/Api/AHelp/BwoinkSystem.CorvaxAHelpApi.cs index 0f5b126d7d..28ac2502d5 100644 --- a/Content.Server/Corvax/Api/AHelp/BwoinkSystem.CorvaxAHelpApi.cs +++ b/Content.Server/Corvax/Api/AHelp/BwoinkSystem.CorvaxAHelpApi.cs @@ -1,5 +1,5 @@ using System.Linq; -using Content.Server.GameTicking; +using Content.Shared.GameTicking; using Robust.Shared.Network; namespace Content.Server.Administration.Systems; diff --git a/Content.Server/Corvax/Documents/DocumentPrinterSystem.cs b/Content.Server/Corvax/Documents/DocumentPrinterSystem.cs index 77346b8945..d2a7a5c4de 100644 --- a/Content.Server/Corvax/Documents/DocumentPrinterSystem.cs +++ b/Content.Server/Corvax/Documents/DocumentPrinterSystem.cs @@ -4,7 +4,7 @@ using Content.Shared.Corvax.Documents; using Content.Shared.GameTicking; using Content.Shared.Lathe; using Content.Shared.Paper; -using Content.Shared.Station; +using Content.Shared.Station.Systems; namespace Content.Server.Corvax.Documents; @@ -12,8 +12,8 @@ public sealed partial class DocumentPrinterSystem : EntitySystem { [Dependency] private ItemSlotsSystem _itemSlots = default!; [Dependency] private PaperSystem _paper = default!; - [Dependency] private SharedStationSystem _station = default!; - [Dependency] private SharedGameTicker _gameTicker = default!; + [Dependency] private StationSystem _station = default!; + [Dependency] private GameTicker _gameTicker = default!; public override void Initialize() { diff --git a/Content.Server/Corvax/PeacefulRoundEnd/PeacefulRoundEndSystem.cs b/Content.Server/Corvax/PeacefulRoundEnd/PeacefulRoundEndSystem.cs index fcda99d053..aafa7a87b7 100644 --- a/Content.Server/Corvax/PeacefulRoundEnd/PeacefulRoundEndSystem.cs +++ b/Content.Server/Corvax/PeacefulRoundEnd/PeacefulRoundEndSystem.cs @@ -1,4 +1,4 @@ -using Content.Server.GameTicking; +using Content.Shared.GameTicking; using Content.Shared.CombatMode.Pacification; using Content.Shared.Corvax.CCCVars; using Content.Shared.Mindshield.Components; @@ -22,7 +22,7 @@ public sealed partial class PeacefulRoundEndSystem : EntitySystem SubscribeLocalEvent(OnRoundEnded); } - private void OnRoundEnded(RoundEndTextAppendEvent ev) + private void OnRoundEnded(ref RoundEndTextAppendEvent ev) { if (!_isEnabled) return; foreach (var session in _playerManager.Sessions) diff --git a/Content.Server/Corvax/SecApartment/SecApartmentSystem.cs b/Content.Server/Corvax/SecApartment/SecApartmentSystem.cs index 518ea7af49..9ee2f75054 100644 --- a/Content.Server/Corvax/SecApartment/SecApartmentSystem.cs +++ b/Content.Server/Corvax/SecApartment/SecApartmentSystem.cs @@ -7,7 +7,7 @@ using Content.Shared.GameTicking; using Content.Shared.Medical.SuitSensors; using Content.Shared.Roles; using Content.Shared.SecApartment; -using Content.Shared.Station; +using Content.Shared.Station.Systems; using Content.Shared.UserInterface; using Robust.Server.GameObjects; using Robust.Shared.Map; @@ -22,7 +22,7 @@ namespace Content.Server.Corvax.SecApartment; public sealed partial class SecApartmentSystem : EntitySystem { - [Dependency] private SharedStationSystem _station = default!; + [Dependency] private StationSystem _station = default!; [Dependency] private CrewManifestSystem _crewManifest = default!; [Dependency] private UserInterfaceSystem _ui = default!; [Dependency] private IRobustRandom _random = default!; @@ -441,31 +441,35 @@ public sealed partial class SecApartmentSystem : EntitySystem if (manifest == null) return result; + TryComp(tablet, out var monitoring); + foreach (var entry in manifest.Entries) { - if (_securityJobs.Contains(entry.JobPrototype)) + if (!_securityJobs.Contains(entry.JobPrototype)) + continue; + + NetEntity? ownerUid = null; + SuitSensorStatus? status = null; + + if (monitoring != null) { - NetEntity? ownerUid = null; - SuitSensorStatus? status = null; - if (TryComp(tablet, out var monitoring)) - { - var sensor = monitoring.ConnectedSensors.Values - .FirstOrDefault(s => s.Name == entry.Name && s.Job == entry.JobTitle); + status = monitoring.ConnectedSensors.Values + .Where(s => s.Name == entry.Name && s.Job == entry.JobTitle) + .Select(s => (SuitSensorStatus?)s) + .FirstOrDefault(); - status = sensor; - ownerUid = sensor?.OwnerUid; - } - - var memberId = GenerateMemberId(entry); - result.Add(new CrewMemberInfo( - memberId, - ownerUid, - entry.Name, - entry.JobTitle, - entry.JobIcon, - status - )); + if (status is { } sensorStatus) + ownerUid = sensorStatus.OwnerUid; } + + var memberId = GenerateMemberId(entry); + result.Add(new CrewMemberInfo( + memberId, + ownerUid, + entry.Name, + entry.JobTitle, + entry.JobIcon, + status)); } return result; @@ -484,19 +488,18 @@ public sealed partial class SecApartmentSystem : EntitySystem foreach (var memberId in squad.Members.Select(m => m.MemberId)) { var memberInfo = securityCrew.FirstOrDefault(c => c.MemberId == memberId); - if (memberInfo?.SensorStatus == null) + if (memberInfo?.SensorStatus is not { } sensorStatus || !sensorStatus.IsAlive) continue; - if (!memberInfo.SensorStatus.IsAlive) + var ownerUid = GetEntity(sensorStatus.OwnerUid); + if (!Exists(ownerUid) || Terminating(ownerUid)) continue; - var ownerUid = GetEntity(memberInfo.SensorStatus.OwnerUid); var memberTransform = Transform(ownerUid); if (memberTransform.GridUid == null) continue; var mapPos = _transform.GetMapCoordinates(ownerUid); - trackedPositions.Add(mapPos.Position); mapId = mapPos.MapId; } diff --git a/Content.Server/Corvax/StationGoal/StationGoalPaperSystem.cs b/Content.Server/Corvax/StationGoal/StationGoalPaperSystem.cs index fa90217bd6..cb7a648169 100644 --- a/Content.Server/Corvax/StationGoal/StationGoalPaperSystem.cs +++ b/Content.Server/Corvax/StationGoal/StationGoalPaperSystem.cs @@ -1,6 +1,6 @@ using Content.Server.Fax; using Content.Server.MassMedia.Systems; -using Content.Server.Station.Systems; +using Content.Shared.Station.Systems; using Content.Shared.Corvax.CCCVars; using Content.Shared.Fax.Components; using Content.Shared.GameTicking; diff --git a/Content.Server/Corvax/TTS/TTSSystem.cs b/Content.Server/Corvax/TTS/TTSSystem.cs index 248d44c79a..c8a59a52e6 100644 --- a/Content.Server/Corvax/TTS/TTSSystem.cs +++ b/Content.Server/Corvax/TTS/TTSSystem.cs @@ -2,9 +2,8 @@ using System.Linq; using System.Threading.Tasks; using Content.Server.Communications; using Content.Server.Power.Components; -using Content.Server.Radio; using Content.Server.Radio.EntitySystems; -using Content.Server.Station.Systems; +using Content.Shared.Station.Systems; using Content.Shared.Chat; using Content.Shared.Corvax.CCCVars; using Content.Shared.Corvax.TTS; diff --git a/Content.Server/GameTicking/ServerGameTicker.StatusShell.cs b/Content.Server/GameTicking/ServerGameTicker.StatusShell.cs index 5d7e95430c..4d58bd2585 100644 --- a/Content.Server/GameTicking/ServerGameTicker.StatusShell.cs +++ b/Content.Server/GameTicking/ServerGameTicker.StatusShell.cs @@ -37,7 +37,7 @@ public sealed partial class ServerGameTicker ? joinQueueManager.ActualPlayersCount : _playerManager.PlayerCount; - players = _cfg.GetCVar(CCVars.AdminsCountInReportedPlayerCount) + players = Cfg.GetCVar(CCVars.AdminsCountInReportedPlayerCount) ? players : players - _adminManager.ActiveAdmins.Count(); // Corvax-Queue-End diff --git a/Content.Shared/Localizations/ContentLocalizationManager.cs b/Content.Shared/Localizations/ContentLocalizationManager.cs index b18471c2fa..bdab23a4a3 100644 --- a/Content.Shared/Localizations/ContentLocalizationManager.cs +++ b/Content.Shared/Localizations/ContentLocalizationManager.cs @@ -31,7 +31,7 @@ namespace Content.Shared.Localizations _loc.LoadCulture(culture); _loc.LoadCulture(fallbackCulture); // Corvax-Localization - _loc.SetFallbackCluture(fallbackCulture); // Corvax-Localization + _loc.SetFallbackCulture(fallbackCulture); // Corvax-Localization _loc.AddFunction(culture, "MANY", FormatMany); // Corvax-Localization: To prevent problems in auto-generated locale files _loc.AddFunction(culture, "PRESSURE", FormatPressure); _loc.AddFunction(culture, "POWERWATTS", FormatPowerWatts);