upstream codefix

secapartment update
This commit is contained in:
Dmitry 2026-09-18 01:47:04 +07:00
parent 73ffef2ac0
commit fffb304de9
12 changed files with 58 additions and 54 deletions

View file

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

View file

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

View file

@ -407,12 +407,15 @@ namespace Content.Server.Connection
public async Task<bool> 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<GameTicker>(out var ticker) &&
ticker.PlayerGameStatuses.TryGetValue(userId, out var status) &&
var havePriorityJoin = _sponsorsMgr != null && _sponsorsMgr.HaveServerPriorityJoin(userId); // Corvax-Sponsors
_ticker ??= _entityManager.SystemOrNull<ServerGameTicker>();
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

View file

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

View file

@ -1,5 +1,5 @@
using System.Linq;
using Content.Server.GameTicking;
using Content.Shared.GameTicking;
using Robust.Shared.Network;
namespace Content.Server.Administration.Systems;

View file

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

View file

@ -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<RoundEndTextAppendEvent>(OnRoundEnded);
}
private void OnRoundEnded(RoundEndTextAppendEvent ev)
private void OnRoundEnded(ref RoundEndTextAppendEvent ev)
{
if (!_isEnabled) return;
foreach (var session in _playerManager.Sessions)

View file

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

View file

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

View file

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

View file

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

View file

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