PA ui cleanup + bugfixes (#28750)

* ui and visual aspect + radio

* finish jank ui shit and finish radio

* remove radio

* send it

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Nemanja
2024-07-21 01:27:18 -04:00
committed by GitHub
parent edb05e36bb
commit 0b5fe2a9ac
15 changed files with 462 additions and 566 deletions

View File

@@ -101,6 +101,7 @@ public sealed partial class ParticleAcceleratorSystem
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(player):player} has turned {ToPrettyString(uid)} off");
comp.Enabled = false;
SetStrength(uid, ParticleAcceleratorPowerState.Standby, user, comp);
UpdatePowerDraw(uid, comp);
PowerOff(uid, comp);
UpdateUI(uid, comp);
@@ -174,12 +175,14 @@ public sealed partial class ParticleAcceleratorSystem
var pos = Transform(uid);
if (_timing.CurTime > comp.EffectCooldown)
{
_chat.SendAdminAlert(player, Loc.GetString("particle-accelerator-admin-power-strength-warning",
_chat.SendAdminAlert(player,
Loc.GetString("particle-accelerator-admin-power-strength-warning",
("machine", ToPrettyString(uid)),
("powerState", strength),
("powerState", GetPANumericalLevel(strength)),
("coordinates", pos.Coordinates)));
_audio.PlayGlobal("/Audio/Misc/adminlarm.ogg",
Filter.Empty().AddPlayers(_adminManager.ActiveAdmins), false,
Filter.Empty().AddPlayers(_adminManager.ActiveAdmins),
false,
AudioParams.Default.WithVolume(-8f));
comp.EffectCooldown = _timing.CurTime + comp.CooldownDuration;
}
@@ -230,7 +233,7 @@ public sealed partial class ParticleAcceleratorSystem
powerConsumer.DrawRate = powerDraw;
}
private void UpdateUI(EntityUid uid, ParticleAcceleratorControlBoxComponent? comp = null)
public void UpdateUI(EntityUid uid, ParticleAcceleratorControlBoxComponent? comp = null)
{
if (!Resolve(uid, ref comp))
return;
@@ -247,7 +250,9 @@ public sealed partial class ParticleAcceleratorSystem
receive = powerConsumer.ReceivedPower;
}
_uiSystem.SetUiState(uid, ParticleAcceleratorControlBoxUiKey.Key, new ParticleAcceleratorUIState(
_uiSystem.SetUiState(uid,
ParticleAcceleratorControlBoxUiKey.Key,
new ParticleAcceleratorUIState(
comp.Assembled,
comp.Enabled,
comp.SelectedStrength,
@@ -396,4 +401,16 @@ public sealed partial class ParticleAcceleratorSystem
UpdateUI(uid, comp);
}
public static int GetPANumericalLevel(ParticleAcceleratorPowerState state)
{
return state switch
{
ParticleAcceleratorPowerState.Level0 => 1,
ParticleAcceleratorPowerState.Level1 => 2,
ParticleAcceleratorPowerState.Level2 => 3,
ParticleAcceleratorPowerState.Level3 => 4,
_ => 0
};
}
}