Make APC UI work correctly with multiple users (#32465)

* Make APC UI work correctly with multiple users

* Check access only on client, when constructing UI

* Do TODO (Thanks, Robust 236.1)

---------

Co-authored-by: Eoin Mcloughlin <helloworld@eoinrul.es>
This commit is contained in:
eoineoineoin
2024-10-12 09:21:43 +01:00
committed by GitHub
parent a9ecf805e5
commit 70b7747fdd
6 changed files with 31 additions and 29 deletions

View File

@@ -178,15 +178,13 @@ namespace Content.Shared.APC
public sealed class ApcBoundInterfaceState : BoundUserInterfaceState, IEquatable<ApcBoundInterfaceState>
{
public readonly bool MainBreaker;
public readonly bool HasAccess;
public readonly int Power;
public readonly ApcExternalPowerState ApcExternalPower;
public readonly float Charge;
public ApcBoundInterfaceState(bool mainBreaker, bool hasAccess, int power, ApcExternalPowerState apcExternalPower, float charge)
public ApcBoundInterfaceState(bool mainBreaker, int power, ApcExternalPowerState apcExternalPower, float charge)
{
MainBreaker = mainBreaker;
HasAccess = hasAccess;
Power = power;
ApcExternalPower = apcExternalPower;
Charge = charge;
@@ -197,7 +195,6 @@ namespace Content.Shared.APC
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return MainBreaker == other.MainBreaker &&
HasAccess == other.HasAccess &&
Power == other.Power &&
ApcExternalPower == other.ApcExternalPower &&
MathHelper.CloseTo(Charge, other.Charge);
@@ -210,7 +207,7 @@ namespace Content.Shared.APC
public override int GetHashCode()
{
return HashCode.Combine(MainBreaker, HasAccess, Power, (int) ApcExternalPower, Charge);
return HashCode.Combine(MainBreaker, Power, (int) ApcExternalPower, Charge);
}
}