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:
@@ -1,4 +1,4 @@
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -36,19 +36,9 @@ namespace Content.Client.Power.APC.UI
|
||||
{
|
||||
var castState = (ApcBoundInterfaceState) state;
|
||||
|
||||
if (BreakerButton != null)
|
||||
if (!BreakerButton.Disabled)
|
||||
{
|
||||
if(castState.HasAccess == false)
|
||||
{
|
||||
BreakerButton.Disabled = true;
|
||||
BreakerButton.ToolTip = Loc.GetString("apc-component-insufficient-access");
|
||||
}
|
||||
else
|
||||
{
|
||||
BreakerButton.Disabled = false;
|
||||
BreakerButton.ToolTip = null;
|
||||
BreakerButton.Pressed = castState.MainBreaker;
|
||||
}
|
||||
BreakerButton.Pressed = castState.MainBreaker;
|
||||
}
|
||||
|
||||
if (PowerLabel != null)
|
||||
@@ -86,6 +76,20 @@ namespace Content.Client.Power.APC.UI
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAccessEnabled(bool hasAccess)
|
||||
{
|
||||
if(hasAccess)
|
||||
{
|
||||
BreakerButton.Disabled = false;
|
||||
BreakerButton.ToolTip = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
BreakerButton.Disabled = true;
|
||||
BreakerButton.ToolTip = Loc.GetString("apc-component-insufficient-access");
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateChargeBarColor(float charge)
|
||||
{
|
||||
if (ChargeBar == null)
|
||||
|
||||
Reference in New Issue
Block a user