Skip to content

Commit

Permalink
Merge branch 'master' into fix_ifrit
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian16199 authored Mar 7, 2024
2 parents d14f4b6 + f767c45 commit ab69f6b
Show file tree
Hide file tree
Showing 2,062 changed files with 105,456 additions and 62,129 deletions.
5 changes: 1 addition & 4 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@

/Resources/ @DebugOk
/Resources/ConfigPresets/ @DebugOk
/Resources/*.yml @DebugOk
/Resources/*.yml @DebugOk @Colin-Tel
/Resources/*/SimpleStation14/ @DEATHB4DEFEAT
# /Resources/Textures/ @leonardo-dabepis # No write access
# /Resources/DeltaV/Textures/ @leonardo-dabepis
# /Resources/Nyanotrasen/Textures/ @leonardo-dabepis
/Resources/Maps/ @IamVelcroboy
/Resources/Prototypes/Maps/ @IamVelcroboy

Expand Down
5 changes: 5 additions & 0 deletions Content.Client/Administration/Managers/ClientAdminManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Shared.Administration.Managers;
using Robust.Client.Console;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Shared.ContentPack;
using Robust.Shared.Network;
using Robust.Shared.Player;
Expand All @@ -16,6 +17,7 @@ public sealed class ClientAdminManager : IClientAdminManager, IClientConGroupImp
[Dependency] private readonly IClientConGroupController _conGroup = default!;
[Dependency] private readonly IResourceManager _res = default!;
[Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterface = default!;

private AdminData? _adminData;
private readonly HashSet<string> _availableCommands = new();
Expand Down Expand Up @@ -101,6 +103,9 @@ private void UpdateMessageRx(MsgUpdateAdminStatus message)
{
var flagsText = string.Join("|", AdminFlagsHelper.FlagsToNames(_adminData.Flags));
_sawmill.Info($"Updated admin status: {_adminData.Active}/{_adminData.Title}/{flagsText}");

if (_adminData.Active)
_userInterface.DebugMonitors.SetMonitor(DebugMonitor.Coords, true);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Administration/Systems/BwoinkSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySes
OnBwoinkTextMessageRecieved?.Invoke(this, message);
}

public void Send(NetUserId channelId, string text)
public void Send(NetUserId channelId, string text, bool playSound)
{
// Reuse the channel ID as the 'true sender'.
// Server will ignore this and if someone makes it not ignore this (which is bad, allows impersonation!!!), that will help.
RaiseNetworkEvent(new BwoinkTextMessage(channelId, channelId, text));
RaiseNetworkEvent(new BwoinkTextMessage(channelId, channelId, text, playSound: playSound));
SendInputTextUpdated(channelId, false);
}

Expand Down
2 changes: 2 additions & 0 deletions Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<BoxContainer Orientation="Vertical" HorizontalExpand="True" SizeFlagsStretchRatio="2">
<BoxContainer Access="Public" Name="BwoinkArea" VerticalExpand="True" />
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<CheckBox Visible="True" Name="PlaySound" Access="Public" Text="{Loc 'admin-bwoink-play-sound'}" Pressed="True" />
<Control HorizontalExpand="True" MinWidth="5" />
<Button Visible="True" Name="PopOut" Access="Public" Text="{Loc 'admin-logs-pop-out'}" StyleClasses="OpenBoth" HorizontalAlignment="Left" />
<Control HorizontalExpand="True" />
<Button Visible="False" Name="Bans" Text="{Loc 'admin-player-actions-bans'}" StyleClasses="OpenRight" />
Expand Down
3 changes: 1 addition & 2 deletions Content.Client/Ame/UI/AmeControllerBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Content.Shared.Ame;
using Content.Shared.Ame.Components;
using JetBrains.Annotations;
using Robust.Client.GameObjects;

namespace Content.Client.Ame.UI
{
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Ame/UI/AmeWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Content.Client.UserInterface;
using Content.Shared.Ame;
using Content.Shared.Ame.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
Expand Down
90 changes: 90 additions & 0 deletions Content.Client/Atmos/UI/SpaceHeaterBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
using Content.Shared.Atmos.Piping.Portable.Components;
using JetBrains.Annotations;
using Robust.Client.UserInterface.Controls;

namespace Content.Client.Atmos.UI;

/// <summary>
/// Initializes a <see cref="SpaceHeaterWindow"/> and updates it when new server messages are received.
/// </summary>
[UsedImplicitly]
public sealed class SpaceHeaterBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private SpaceHeaterWindow? _window;

public SpaceHeaterBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}

protected override void Open()
{
base.Open();

_window = new SpaceHeaterWindow();

if (State != null)
UpdateState(State);

_window.OpenCentered();

_window.OnClose += Close;

_window.ToggleStatusButton.OnPressed += _ => OnToggleStatusButtonPressed();
_window.IncreaseTempRange.OnPressed += _ => OnTemperatureRangeChanged(_window.TemperatureChangeDelta);
_window.DecreaseTempRange.OnPressed += _ => OnTemperatureRangeChanged(-_window.TemperatureChangeDelta);
_window.ModeSelector.OnItemSelected += OnModeChanged;

_window.PowerLevelSelector.OnItemSelected += OnPowerLevelChange;
}

private void OnToggleStatusButtonPressed()
{
_window?.SetActive(!_window.Active);
SendMessage(new SpaceHeaterToggleMessage());
}

private void OnTemperatureRangeChanged(float changeAmount)
{
SendMessage(new SpaceHeaterChangeTemperatureMessage(changeAmount));
}

private void OnModeChanged(OptionButton.ItemSelectedEventArgs args)
{
_window?.ModeSelector.SelectId(args.Id);
SendMessage(new SpaceHeaterChangeModeMessage((SpaceHeaterMode)args.Id));
}

private void OnPowerLevelChange(RadioOptionItemSelectedEventArgs<int> args)
{
_window?.PowerLevelSelector.Select(args.Id);
SendMessage(new SpaceHeaterChangePowerLevelMessage((SpaceHeaterPowerLevel)args.Id));
}

/// <summary>
/// Update the UI state based on server-sent info
/// </summary>
/// <param name="state"></param>
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
if (_window == null || state is not SpaceHeaterBoundUserInterfaceState cast)
return;

_window.SetActive(cast.Enabled);
_window.ModeSelector.SelectId((int)cast.Mode);
_window.PowerLevelSelector.Select((int)cast.PowerLevel);

_window.MinTemp = cast.MinTemperature;
_window.MaxTemp = cast.MaxTemperature;
_window.SetTemperature(cast.TargetTemperature);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;
_window?.Dispose();
}
}
34 changes: 34 additions & 0 deletions Content.Client/Atmos/UI/SpaceHeaterWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
MinSize="280 160" Title="Temperature Control Unit">

<BoxContainer Name="VboxContainer" Orientation="Vertical" Margin="5 5 5 5" SeparationOverride="10">

<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<Button Text="{Loc comp-space-heater-ui-status-disabled}" Access="Public" Name="ToggleStatusButton"/>
</BoxContainer>
<BoxContainer Orientation="Horizontal" SeparationOverride="5">
<Label Text="{Loc comp-space-heater-ui-mode}"/>
<OptionButton Access="Public" Name="ModeSelector"/>
</BoxContainer>
</BoxContainer>

<BoxContainer Orientation="Horizontal" HorizontalExpand="True" SeparationOverride="5">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<Label Text="{Loc comp-space-heater-ui-thermostat}"/>
</BoxContainer>
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" HorizontalAlignment="Right">
<Button Text="{Loc comp-space-heater-ui-decrease-temperature-range}" Access="Public" Name="DecreaseTempRange" StyleClasses="OpenRight"/>
<LineEdit Name ="Thermostat" MinSize="55 0"></LineEdit>
<Button Text="{Loc comp-space-heater-ui-increase-temperature-range}" Access="Public" Name="IncreaseTempRange" StyleClasses="OpenLeft"/>
</BoxContainer>
</BoxContainer>

<BoxContainer Orientation="Horizontal" HorizontalExpand="True" SeparationOverride="5">
<Label Text="{Loc comp-space-heater-ui-power-consumption}"/>
<BoxContainer Name="PowerLevelSelectorHBox" Access="Public" SeparationOverride="2"/>
</BoxContainer>

</BoxContainer>
</DefaultWindow>
73 changes: 73 additions & 0 deletions Content.Client/Atmos/UI/SpaceHeaterWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping.Portable.Components;

namespace Content.Client.Atmos.UI;

/// <summary>
/// Client-side UI used to control a space heater.
/// </summary>
[GenerateTypedNameReferences]
public sealed partial class SpaceHeaterWindow : DefaultWindow
{
// To account for a minimum delta temperature for atmos equalization to trigger we use a fixed step for target temperature increment/decrement
public int TemperatureChangeDelta = 5;
public bool Active;

// Temperatures range bounds in Kelvin (K)
public float MinTemp;
public float MaxTemp;

public RadioOptions<int> PowerLevelSelector;

public SpaceHeaterWindow()
{
RobustXamlLoader.Load(this);

// Add the Mode selector list
foreach (var value in Enum.GetValues<SpaceHeaterMode>())
{
ModeSelector.AddItem(Loc.GetString($"comp-space-heater-mode-{value}"), (int)value);
}

// Add the Power level radio buttons
PowerLevelSelectorHBox.AddChild(PowerLevelSelector = new RadioOptions<int>(RadioOptionsLayout.Horizontal));
PowerLevelSelector.FirstButtonStyle = "OpenRight";
PowerLevelSelector.LastButtonStyle = "OpenLeft";
PowerLevelSelector.ButtonStyle = "OpenBoth";
foreach (var value in Enum.GetValues<SpaceHeaterPowerLevel>())
{
PowerLevelSelector.AddItem(Loc.GetString($"comp-space-heater-ui-{value}-power-consumption"), (int)value);
}

// Only allow temperature increment/decrement of TemperatureChangeDelta
Thermostat.Editable = false;
}

public void SetActive(bool active)
{
Active = active;
ToggleStatusButton.Pressed = active;

if (active)
{
ToggleStatusButton.Text = Loc.GetString("comp-space-heater-ui-status-enabled");
}
else
{
ToggleStatusButton.Text = Loc.GetString("comp-space-heater-ui-status-disabled");
}
}

public void SetTemperature(float targetTemperature)
{
Thermostat.SetText($"{targetTemperature - Atmospherics.T0C} °C");

IncreaseTempRange.Disabled = targetTemperature + TemperatureChangeDelta > MaxTemp;
DecreaseTempRange.Disabled = targetTemperature - TemperatureChangeDelta < MinTemp;
}
}

Loading

0 comments on commit ab69f6b

Please sign in to comment.