From 19cc8366fb3675996e2443ca289fb232023947d9 Mon Sep 17 00:00:00 2001 From: Aviu00 <93730715+Aviu00@users.noreply.github.com> Date: Thu, 15 Feb 2024 01:52:07 +0900 Subject: [PATCH] Bugfixes (#69) * - fix: Fix bans. * - fix: Fix all roles for admins. * - fix: No command headrevs. * - tweak: Now round ends on rev win. * - fix: Ash now smimmune. * - fix: Ghost role cvar fix. * - fix: Security icons only work on humans. --- Content.Client/Overlays/ShowSecurityIconsSystem.cs | 5 +++-- .../Players/PlayTimeTracking/JobRequirementsManager.cs | 6 ++++++ Content.Server/Administration/Managers/BanManager.cs | 2 +- Content.Server/Connection/ConnectionManager.cs | 2 +- Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs | 4 +++- Content.Shared/CCVar/CCVars.cs | 2 +- .../Prototypes/Entities/Objects/Specific/Medical/morgue.yml | 1 + 7 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Content.Client/Overlays/ShowSecurityIconsSystem.cs b/Content.Client/Overlays/ShowSecurityIconsSystem.cs index ddf827cc03..f1df9f3a2f 100644 --- a/Content.Client/Overlays/ShowSecurityIconsSystem.cs +++ b/Content.Client/Overlays/ShowSecurityIconsSystem.cs @@ -2,6 +2,7 @@ using System.Linq; using Content.Shared._Miracle.Components; using Content.Shared.Access.Components; using Content.Shared.Access.Systems; +using Content.Shared.Humanoid; using Content.Shared.IdentityManagement.Components; using Content.Shared.Inventory; using Content.Shared.Mindshield.Components; @@ -31,10 +32,10 @@ public sealed class ShowSecurityIconsSystem : EquipmentHudSystem(OnGetStatusIconsEvent); + SubscribeLocalEvent(OnGetStatusIconsEvent); } - private void OnGetStatusIconsEvent(EntityUid uid, StatusIconComponent _, ref GetStatusIconsEvent @event) + private void OnGetStatusIconsEvent(EntityUid uid, HumanoidAppearanceComponent _, ref GetStatusIconsEvent @event) { if (!IsActive || @event.InContainer) { diff --git a/Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs b/Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs index 0929b90a41..cbd4e87bdd 100644 --- a/Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs +++ b/Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using Content.Client.Administration.Managers; using Content.Shared.CCVar; using Content.Shared.Players; using Content.Shared.Players.PlayTimeTracking; @@ -20,6 +21,7 @@ public sealed class JobRequirementsManager [Dependency] private readonly IEntityManager _entManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPrototypeManager _prototypes = default!; + [Dependency] private readonly IClientAdminManager _adminManager = default!; // WD private readonly Dictionary _roles = new(); private readonly List _roleBans = new(); @@ -37,6 +39,7 @@ public sealed class JobRequirementsManager _net.RegisterNetMessage(RxPlayTime); _client.RunLevelChanged += ClientOnRunLevelChanged; + _adminManager.AdminStatusUpdated += () => Updated?.Invoke(); // WD } private void ClientOnRunLevelChanged(object? sender, RunLevelChangedEventArgs e) @@ -98,6 +101,9 @@ public sealed class JobRequirementsManager if (player == null) return true; + if (_adminManager.IsActive()) // WD + return true; + return CheckRoleTime(job.Requirements, out reason); } diff --git a/Content.Server/Administration/Managers/BanManager.cs b/Content.Server/Administration/Managers/BanManager.cs index 670adfe82a..0a28d7a0b0 100644 --- a/Content.Server/Administration/Managers/BanManager.cs +++ b/Content.Server/Administration/Managers/BanManager.cs @@ -103,7 +103,7 @@ public sealed class BanManager : IBanManager, IPostInjectInit //Miracle edit start private async Task CacheDbServerBans(NetUserId userId, IPAddress? address = null, ImmutableArray? hwId = null) { - var serverBans = await _db.GetServerBansAsync(address, userId, hwId, false); + var serverBans = await _db.GetServerBansAsync(address, userId, hwId, false, _cfg.GetCVar(CCVars.AdminLogsServerName)); var userServerBans = new HashSet(serverBans); diff --git a/Content.Server/Connection/ConnectionManager.cs b/Content.Server/Connection/ConnectionManager.cs index 7669bd470f..fca5e048d2 100644 --- a/Content.Server/Connection/ConnectionManager.cs +++ b/Content.Server/Connection/ConnectionManager.cs @@ -170,7 +170,7 @@ namespace Content.Server.Connection } //WD-EDIT - var bans = await _db.GetServerBansAsync(addr, userId, hwId, includeUnbanned: false); + var bans = await _db.GetServerBansAsync(addr, userId, hwId, includeUnbanned: false, _cfg.GetCVar(CCVars.AdminLogsServerName)); if (bans.Count > 0 && bans.Any(x=> x.ExpirationTime == null)) //Miracle edit { var firstBan = bans[0]; diff --git a/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs b/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs index 7ef3206d2b..e680e6c364 100644 --- a/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs @@ -87,7 +87,8 @@ public sealed class RevolutionaryRuleSystem : GameRuleSystem !HasComp(x)).ToList(); // WD if (chosen.Any()) GiveHeadRev(chosen, comp.HeadRevPrototypeId, comp); else diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 4a4688ffe0..3951d3bb64 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1839,7 +1839,7 @@ namespace Content.Shared.CCVar /// The time you must spend reading the rules, before the "Request" button is enabled /// public static readonly CVarDef GhostRoleTime = - CVarDef.Create("ghost.role_time", 3f, CVar.REPLICATED); + CVarDef.Create("ghost.role_time", 3f, CVar.SERVER | CVar.REPLICATED); /* * Fire alarm diff --git a/Resources/Prototypes/Entities/Objects/Specific/Medical/morgue.yml b/Resources/Prototypes/Entities/Objects/Specific/Medical/morgue.yml index c34ca70c45..af844a7f96 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Medical/morgue.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Medical/morgue.yml @@ -108,6 +108,7 @@ - type: Tag tags: - Trash + - SMImmune - type: SolutionContainerManager solutions: food: