Skip to content

Commit

Permalink
Merge branch 'master' into NTR-Guards
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiserMaus committed Jan 11, 2025
2 parents 6e08cf3 + 1aaa7eb commit c0140e9
Show file tree
Hide file tree
Showing 727 changed files with 14,417 additions and 3,370 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/auto-locale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,58 @@ name: Update Locale
on:
push:
branches:
- master
- master
pull_request:
types:
- closed

permissions:
contents: write
pull-requests: read

jobs:
update-changelog:
update-locale:
runs-on: ubuntu-latest
if: github.repository == 'space-sunrise/space-station-14' && github.event.pull_request.merged == true

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Set up Python
if: steps.get_pr.outputs.PR_NUMBER != ''
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install Dependencies
run: |
pip install pyyaml PyGithub
pip install pyyaml PyGithub pydash fluent
- name: Find Locale Keys
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
python ./Tools/_sunrise/keyfinder.py
echo "Script exited with code $?"
- name: Update Yaml Locale Keys
run: |
python ./Tools/_sunrise/yamlextractor.py
echo "Script exited with code $?"
- name: Git status before commit
if: steps.get_pr.outputs.PR_NUMBER != ''
run: |
git status
- name: Commit and push changes
if: steps.get_pr.outputs.PR_NUMBER != ''
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }}
git add "Resources/Locale/*"
if git diff --cached --quiet; then
echo "No changes to commit."
else
git commit -m "Update locale [skip ci]"
git push origin HEAD:Starlight
git push origin HEAD:master
fi
14 changes: 8 additions & 6 deletions Content.Client/Administration/UI/BanPanel/BanPanel.xaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<DefaultWindow
xmlns="https://spacestation14.io"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
Title="{Loc ban-panel-title}" MinSize="350 500">
Title="{Loc ban-panel-title}"
SetSize="850 500"
Resizable="True"> <!-- Enable resizing -->
<BoxContainer Orientation="Vertical">
<TabContainer Name="Tabs" VerticalExpand="True">
<TabContainer Name="Tabs" VerticalExpand="True" HorizontalExpand="True">
<!-- Basic info -->
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True">
<BoxContainer Orientation="Horizontal" Margin="2">
<CheckBox Name="PlayerCheckbox" MinWidth="100" Text="{Loc ban-panel-player}" Pressed="True" />
<Control MinWidth="50" />
Expand Down Expand Up @@ -39,10 +41,10 @@
<TextEdit Name="ReasonTextEdit" MinHeight="100" VerticalExpand="True" HorizontalExpand="True" />
</BoxContainer>
<!-- Player List -->
<cc:PlayerListControl Name="PlayerList" VerticalExpand="True" />
<cc:PlayerListControl Name="PlayerList" VerticalExpand="True" HorizontalExpand="True" />
<!-- Role list (auto-generated) -->
<ScrollContainer>
<BoxContainer Name="RolesContainer" Orientation="Vertical" />
<ScrollContainer VerticalExpand="True" HorizontalExpand="True">
<BoxContainer Name="RolesContainer" Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True"/>
</ScrollContainer>
</TabContainer>
<Button Name="SubmitButton" Text="{Loc ban-panel-submit}" HorizontalExpand="True" />
Expand Down
82 changes: 67 additions & 15 deletions Content.Client/Administration/UI/BanPanel/BanPanel.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Numerics;
using Content.Client.Administration.UI.CustomControls;
using Content.Shared.Administration;
using Content.Shared.CCVar;
Expand Down Expand Up @@ -40,6 +41,9 @@ public sealed partial class BanPanel : DefaultWindow
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly ILogManager _logManager = default!;

private readonly string _antagCategory = Loc.GetString("ban-panel-role-selection-antag");
private readonly string _antagAllSelection = Loc.GetString("ban-panel-role-selection-antag-all-option");

private enum TabNumbers
{
BasicInfo,
Expand Down Expand Up @@ -142,6 +146,8 @@ public BanPanel()
TypeOption.AddItem(Loc.GetString("ban-panel-server"), (int) Types.Server);
TypeOption.AddItem(Loc.GetString("ban-panel-role"), (int) Types.Role);



ReasonTextEdit.Placeholder = new Rope.Leaf(Loc.GetString("ban-panel-reason"));

var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
Expand All @@ -150,7 +156,9 @@ public BanPanel()
CreateRoleGroup(proto.ID, proto.Roles.Select(p => p.Id), proto.Color);
}

CreateRoleGroup("Antagonist", prototypeManager.EnumeratePrototypes<AntagPrototype>().Select(p => p.ID), Color.Red);
var antagRoleList = prototypeManager.EnumeratePrototypes<AntagPrototype>().Select(p => p.ID).ToList();
antagRoleList.Insert(0, _antagAllSelection);
CreateRoleGroup(_antagCategory, antagRoleList, Color.Red);
}

private void CreateRoleGroup(string roleName, IEnumerable<string> roleList, Color color)
Expand All @@ -161,29 +169,48 @@ private void CreateRoleGroup(string roleName, IEnumerable<string> roleList, Colo
HorizontalExpand = true,
VerticalExpand = true,
Orientation = BoxContainer.LayoutOrientation.Vertical,
Margin = new Thickness(4)
Margin = new Thickness(4),
};
var departmentCheckbox = new CheckBox
{
Name = $"{roleName}GroupCheckbox",
Text = roleName,
Modulate = color,
HorizontalAlignment = HAlignment.Left
HorizontalAlignment = HAlignment.Left,
Margin = new Thickness(2),
};
outerContainer.AddChild(departmentCheckbox);
var innerContainer = new BoxContainer
var innerContainer = new GridContainer
{
Name = $"{roleName}GroupInnerBox",
HorizontalExpand = true,
Orientation = BoxContainer.LayoutOrientation.Horizontal
Columns = 4,
Margin = new Thickness(2)
};
departmentCheckbox.OnToggled += args =>
{
foreach (var child in innerContainer.Children)
if (args.Pressed && roleName == _antagCategory)
{
foreach (var child in innerContainer.Children)
{
if (child is CheckBox antagCheckbox && antagCheckbox.Name == $"{_antagAllSelection}RoleCheckbox")
{
antagCheckbox.Pressed = true;
}
else if (child is CheckBox otherAntagCheckbox)
{
otherAntagCheckbox.Pressed = false;
}
}
}
else
{
if (child is CheckBox c)
foreach (var child in innerContainer.Children)
{
c.Pressed = args.Pressed;
if (child is CheckBox roleChildCheckbox)
{
roleChildCheckbox.Pressed = args.Pressed;
}
}
}

Expand All @@ -195,7 +222,7 @@ private void CreateRoleGroup(string roleName, IEnumerable<string> roleList, Colo
.Warning("Departmental role ban severity could not be parsed from config!");
return;
}
SeverityOption.SelectId((int) newSeverity);
SeverityOption.SelectId((int)newSeverity);
}
else
{
Expand All @@ -217,13 +244,15 @@ private void CreateRoleGroup(string roleName, IEnumerable<string> roleList, Colo
.Warning("Role ban severity could not be parsed from config!");
return;
}
SeverityOption.SelectId((int) newSeverity);
SeverityOption.SelectId((int)newSeverity);
}
};
outerContainer.AddChild(innerContainer);

var isAntagonistGroup = roleName == _antagCategory;
foreach (var role in roleList)
{
AddRoleCheckbox(role, innerContainer, departmentCheckbox);
AddRoleCheckbox(role, innerContainer, departmentCheckbox, isAntagonistGroup);
}
RolesContainer.AddChild(new PanelContainer
{
Expand All @@ -236,19 +265,42 @@ private void CreateRoleGroup(string roleName, IEnumerable<string> roleList, Colo
RolesContainer.AddChild(new HSeparator());
}

private void AddRoleCheckbox(string role, Control container, CheckBox header)
private void AddRoleCheckbox(string role, Control container, CheckBox header, bool isAntagonistGroup = false)
{
var roleCheckbox = new CheckBox
{
Name = $"{role}RoleCheckbox",
Text = role
Text = role,
Margin = new Thickness(2),
};

roleCheckbox.OnToggled += args =>
{
if (args is { Pressed: true, Button.Parent: { } } && args.Button.Parent.Children.Where(e => e is CheckBox).All(e => ((CheckBox) e).Pressed))
header.Pressed = args.Pressed;
if (isAntagonistGroup && role == _antagAllSelection)
{
foreach (var child in container.Children)
{
if (child is CheckBox c && c != roleCheckbox)
{
c.Pressed = false;
}
}
}

if (args is { Pressed: true, Button.Parent: { } } && args.Button.Parent.Children.OfType<CheckBox>().All(e => e.Pressed))
header.Pressed = true;
else
header.Pressed = false;

// Ensure "All" checkbox logic within the antagonist group
if (isAntagonistGroup && role != _antagAllSelection)
{
var allAntagsCheckbox = container.Children.OfType<CheckBox>().FirstOrDefault(c => c.Name == $"{_antagAllSelection}RoleCheckbox");
if (allAntagsCheckbox != null && args.Pressed)
{
allAntagsCheckbox.Pressed = false;
}
}
};
container.AddChild(roleCheckbox);
_roleCheckboxes.Add(roleCheckbox);
Expand Down
9 changes: 5 additions & 4 deletions Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ public void UpdateDeviceData(string addr, IAtmosDeviceData device)
if (!_pumps.TryGetValue(addr, out var pumpControl))
{
var control= new PumpControl(pump, addr);
control.PumpDataChanged += AtmosDeviceDataChanged!.Invoke;
control.PumpDataCopied += AtmosDeviceDataCopied!.Invoke;
control.PumpDataChanged += AtmosDeviceDataChanged;
control.PumpDataCopied += AtmosDeviceDataCopied;
_pumps.Add(addr, control);
CVentContainer.AddChild(control);
}
Expand All @@ -145,8 +145,8 @@ public void UpdateDeviceData(string addr, IAtmosDeviceData device)
if (!_scrubbers.TryGetValue(addr, out var scrubberControl))
{
var control = new ScrubberControl(scrubber, addr);
control.ScrubberDataChanged += AtmosDeviceDataChanged!.Invoke;
control.ScrubberDataCopied += AtmosDeviceDataCopied!.Invoke;
control.ScrubberDataChanged += AtmosDeviceDataChanged;
control.ScrubberDataCopied += AtmosDeviceDataCopied;
_scrubbers.Add(addr, control);
CScrubberContainer.AddChild(control);
}
Expand All @@ -161,6 +161,7 @@ public void UpdateDeviceData(string addr, IAtmosDeviceData device)
{
var control = new SensorInfo(sensor, addr);
control.OnThresholdUpdate += AtmosAlarmThresholdChanged;
control.SensorDataCopied += AtmosDeviceDataCopied;
_sensors.Add(addr, control);
CSensorContainer.AddChild(control);
}
Expand Down
8 changes: 4 additions & 4 deletions Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ public PumpControl(GasVentPumpData data, string address)
PumpDataChanged?.Invoke(_address, _data);
};

_copySettings.OnPressed += _ =>
{
PumpDataCopied?.Invoke(_data);
};
_copySettings.OnPressed += _ =>
{
PumpDataCopied?.Invoke(_data);
};
}

public void ChangeData(GasVentPumpData data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ public ScrubberControl(GasVentScrubberData data, string address)
ScrubberDataChanged?.Invoke(_address, _data);
};

_copySettings.OnPressed += _ =>
{
ScrubberDataCopied?.Invoke(_data);
};
_copySettings.OnPressed += _ =>
{
ScrubberDataCopied?.Invoke(_data);
};

foreach (var value in Enum.GetValues<Gas>())
{
Expand Down
3 changes: 3 additions & 0 deletions Content.Client/Atmos/Monitor/UI/Widgets/SensorInfo.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<CollapsibleHeading Name="SensorAddress" />
<CollapsibleBody Margin="20 2 2 2">
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
<BoxContainer Orientation="Horizontal" Margin ="0 0 0 2">
<Button Name="CCopySettings" Text="{Loc 'air-alarm-ui-thresholds-copy'}" ToolTip="{Loc 'air-alarm-ui-thresholds-copy-tooltip'}" />
</BoxContainer>
<BoxContainer Orientation="Vertical" Margin="0 0 2 0" HorizontalExpand="True">
<RichTextLabel Name="AlarmStateLabel" />
<RichTextLabel Name="PressureLabel" />
Expand Down
13 changes: 10 additions & 3 deletions Content.Client/Atmos/Monitor/UI/Widgets/SensorInfo.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ namespace Content.Client.Atmos.Monitor.UI.Widgets;
public sealed partial class SensorInfo : BoxContainer
{
public Action<string, AtmosMonitorThresholdType, AtmosAlarmThreshold, Gas?>? OnThresholdUpdate;
public event Action<AtmosSensorData>? SensorDataCopied;
private string _address;

private ThresholdControl _pressureThreshold;
private ThresholdControl _temperatureThreshold;
private Dictionary<Gas, ThresholdControl> _gasThresholds = new();
private Dictionary<Gas, RichTextLabel> _gasLabels = new();
private Button _copySettings => CCopySettings;

public SensorInfo(AtmosSensorData data, string address)
{
Expand Down Expand Up @@ -56,7 +58,7 @@ public SensorInfo(AtmosSensorData data, string address)
gasThresholdControl.Margin = new Thickness(20, 2, 2, 2);
gasThresholdControl.ThresholdDataChanged += (type, alarmThreshold, arg3) =>
{
OnThresholdUpdate!(_address, type, alarmThreshold, arg3);
OnThresholdUpdate?.Invoke(_address, type, alarmThreshold, arg3);
};

_gasThresholds.Add(gas, gasThresholdControl);
Expand All @@ -72,12 +74,17 @@ public SensorInfo(AtmosSensorData data, string address)

_pressureThreshold.ThresholdDataChanged += (type, threshold, arg3) =>
{
OnThresholdUpdate!(_address, type, threshold, arg3);
OnThresholdUpdate?.Invoke(_address, type, threshold, arg3);
};

_temperatureThreshold.ThresholdDataChanged += (type, threshold, arg3) =>
{
OnThresholdUpdate!(_address, type, threshold, arg3);
OnThresholdUpdate?.Invoke(_address, type, threshold, arg3);
};

_copySettings.OnPressed += _ =>
{
SensorDataCopied?.Invoke(data);
};
}

Expand Down
Loading

0 comments on commit c0140e9

Please sign in to comment.