diff --git a/.github/Schemas/mapfile_requirements.txt b/.github/Schemas/mapfile_requirements.txt new file mode 100644 index 00000000000..aa4d4d0668b --- /dev/null +++ b/.github/Schemas/mapfile_requirements.txt @@ -0,0 +1 @@ +pyyaml==6.0.2 diff --git a/.github/Schemas/rga.yml b/.github/Schemas/rga.yml new file mode 100644 index 00000000000..a83e6c43346 --- /dev/null +++ b/.github/Schemas/rga.yml @@ -0,0 +1,20 @@ +# If this gets updated, make sure to also update https://github.com/space-wizards/RobustToolboxSpecifications + +list(include('attribution'), min=1) +--- +attribution: + files: list(str()) + license: license() + copyright: str() + source: url() + +# Example +# - files: ["deprecated.png"] +# license: "MIT" +# copyright: "created by 20kdc" +# source: "https://github.com/ParadiseSS13/Paradise" +# +# - files: ["arcadeblue2.png", "boxing.png", "carpetclown.png", "carpetoffice.png", "gym.png", "metaldiamond.png"] +# license: "CC-BY-NC-SA-3.0" +# copyright: "by WALPVRGIS for Goonstation, taken at commit 236551b95a5b24917c72f3069223026b2dc4e690 from floors.dmi" +# source: "https://github.com/goonstation/goonstation" diff --git a/.github/Schemas/rga_requirements.txt b/.github/Schemas/rga_requirements.txt new file mode 100644 index 00000000000..af6467bc963 --- /dev/null +++ b/.github/Schemas/rga_requirements.txt @@ -0,0 +1,2 @@ +validators +pyyaml==6.0.2 diff --git a/.github/Schemas/rga_validators.py b/.github/Schemas/rga_validators.py new file mode 100644 index 00000000000..7c13194dd79 --- /dev/null +++ b/.github/Schemas/rga_validators.py @@ -0,0 +1,29 @@ +from yamale.validators import Validator +import validators + +class License(Validator): + tag = "license" + licenses = [ + "CC-BY-3.0", + "CC-BY-4.0", + "CC-BY-SA-3.0", + "CC-BY-SA-4.0", + "CC-BY-NC-3.0", + "CC-BY-NC-4.0", + "CC-BY-NC-SA-3.0", + "CC-BY-NC-SA-4.0", + "CC-BY-ND-4.0", + "CC0-1.0", + "MIT", + "Custom" # implies that the license is described in the copyright field. + ] + + def _is_valid(self, value): + return value in self.licenses + +class Url(Validator): + tag = "url" + + def _is_valid(self, value): + # Source field is required to ensure its not neglected, but there may be no applicable URL + return (value == "NA") or validators.url(value) diff --git a/.github/workflows/validate-rgas.yml b/.github/workflows/validate-rgas.yml index 72ce39ceff6..7d8be69f765 100644 --- a/.github/workflows/validate-rgas.yml +++ b/.github/workflows/validate-rgas.yml @@ -19,7 +19,7 @@ jobs: uses: space-wizards/submodule-dependency@v0.1.5 - uses: PaulRitter/yaml-schema-validator@v1 with: - schema: RobustToolbox/Schemas/rga.yml + schema: .github/Schemas/rga.yml path_pattern: .*attributions.ya?ml$ validators_path: RobustToolbox/Schemas/rga_validators.py - validators_requirements: RobustToolbox/Schemas/rga_requirements.txt + validators_requirements: .github/Schemas/rga_requirements.txt diff --git a/.github/workflows/validate_mapfiles.yml b/.github/workflows/validate_mapfiles.yml index 190ee97d8fe..1a4fcaa4b2d 100644 --- a/.github/workflows/validate_mapfiles.yml +++ b/.github/workflows/validate_mapfiles.yml @@ -22,4 +22,4 @@ jobs: schema: RobustToolbox/Schemas/mapfile.yml path_pattern: .*Resources/Maps/.* validators_path: RobustToolbox/Schemas/mapfile_validators.py - validators_requirements: RobustToolbox/Schemas/mapfile_requirements.txt + validators_requirements: .github/Schemas/mapfile_requirements.txt diff --git a/Content.Client/Advertise/Systems/SpeakOnUIClosedSystem.cs b/Content.Client/Advertise/Systems/SpeakOnUIClosedSystem.cs new file mode 100644 index 00000000000..4e82ec4d006 --- /dev/null +++ b/Content.Client/Advertise/Systems/SpeakOnUIClosedSystem.cs @@ -0,0 +1,5 @@ +using Content.Shared.Advertise.Systems; + +namespace Content.Client.Advertise.Systems; + +public sealed class SpeakOnUIClosedSystem : SharedSpeakOnUIClosedSystem; diff --git a/Content.Client/Atmos/Components/PipeColorVisualsComponent.cs b/Content.Client/Atmos/Components/PipeColorVisualsComponent.cs index 355b10cb4a4..9b24b1adc25 100644 --- a/Content.Client/Atmos/Components/PipeColorVisualsComponent.cs +++ b/Content.Client/Atmos/Components/PipeColorVisualsComponent.cs @@ -1,8 +1,4 @@ -using Robust.Shared.GameObjects; - namespace Content.Client.Atmos.Components; [RegisterComponent] -public sealed partial class PipeColorVisualsComponent : Component -{ -} +public sealed partial class PipeColorVisualsComponent : Component; diff --git a/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml b/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml index 96f136abf0e..a5eddfdf064 100644 --- a/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml +++ b/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml @@ -1,6 +1,5 @@ @@ -62,7 +61,7 @@ - + diff --git a/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml.cs b/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml.cs index b95fdf12b16..a086f76f272 100644 --- a/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml.cs +++ b/Content.Client/Atmos/Consoles/AtmosAlarmEntryContainer.xaml.cs @@ -136,8 +136,9 @@ public void UpdateEntry(AtmosAlertsComputerEntry entry, bool isFocus, AtmosAlert GasGridContainer.RemoveAllChildren(); var gasData = focusData.Value.GasData.Where(g => g.Key != Gas.Oxygen); + var keyValuePairs = gasData.ToList(); - if (gasData.Count() == 0) + if (keyValuePairs.Count == 0) { // No other gases var gasLabel = new Label() @@ -158,7 +159,7 @@ public void UpdateEntry(AtmosAlertsComputerEntry entry, bool isFocus, AtmosAlert else { // Add an entry for each gas - foreach ((var gas, (var mol, var percent, var alert)) in gasData) + foreach ((var gas, (var mol, var percent, var alert)) in keyValuePairs) { FixedPoint2 gasPercent = percent * 100f; var gasAbbreviation = Atmospherics.GasAbbreviations.GetValueOrDefault(gas, Loc.GetString("gas-unknown-abbreviation")); diff --git a/Content.Client/Atmos/Consoles/AtmosAlertsComputerBoundUserInterface.cs b/Content.Client/Atmos/Consoles/AtmosAlertsComputerBoundUserInterface.cs index a31eb898fef..8abf0cbd73a 100644 --- a/Content.Client/Atmos/Consoles/AtmosAlertsComputerBoundUserInterface.cs +++ b/Content.Client/Atmos/Consoles/AtmosAlertsComputerBoundUserInterface.cs @@ -16,8 +16,6 @@ protected override void Open() _menu = new AtmosAlertsComputerWindow(this, Owner); _menu.OpenCentered(); _menu.OnClose += Close; - - EntMan.TryGetComponent(Owner, out var xform); } protected override void UpdateState(BoundUserInterfaceState state) @@ -26,9 +24,6 @@ protected override void UpdateState(BoundUserInterfaceState state) var castState = (AtmosAlertsComputerBoundInterfaceState) state; - if (castState == null) - return; - EntMan.TryGetComponent(Owner, out var xform); _menu?.UpdateUI(xform?.Coordinates, castState.AirAlarms, castState.FireAlarms, castState.FocusData); } diff --git a/Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml b/Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml index 8824a776ee6..e5ede1b92e3 100644 --- a/Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml +++ b/Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml @@ -1,7 +1,6 @@ (OnInit); - SubscribeLocalEvent(OnAppearanceChanged, after: new[] { typeof(SubFloorHideSystem) }); + SubscribeLocalEvent(OnAppearanceChanged, after: [typeof(SubFloorHideSystem)]); } private void OnInit(EntityUid uid, PipeAppearanceComponent component, ComponentInit args) @@ -84,7 +82,8 @@ private void OnAppearanceChanged(EntityUid uid, PipeAppearanceComponent componen layer.Visible &= visible; - if (!visible) continue; + if (!visible) + continue; layer.Color = color; } diff --git a/Content.Client/Atmos/Monitor/AtmosAlarmableVisualsSystem.cs b/Content.Client/Atmos/Monitor/AtmosAlarmableVisualsSystem.cs index 019f25f376b..18ca2234752 100644 --- a/Content.Client/Atmos/Monitor/AtmosAlarmableVisualsSystem.cs +++ b/Content.Client/Atmos/Monitor/AtmosAlarmableVisualsSystem.cs @@ -1,12 +1,7 @@ -using System.Collections.Generic; using Content.Shared.Atmos.Monitor; using Content.Shared.Power; using Robust.Client.GameObjects; using Robust.Client.Graphics; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; -using Robust.Shared.Maths; -using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Client.Atmos.Monitor; @@ -27,7 +22,7 @@ protected override void OnAppearanceChange(EntityUid uid, AtmosAlarmableVisualsC { foreach (var visLayer in component.HideOnDepowered) { - if (args.Sprite.LayerMapTryGet(visLayer, out int powerVisibilityLayer)) + if (args.Sprite.LayerMapTryGet(visLayer, out var powerVisibilityLayer)) args.Sprite.LayerSetVisible(powerVisibilityLayer, powered); } } @@ -36,7 +31,7 @@ protected override void OnAppearanceChange(EntityUid uid, AtmosAlarmableVisualsC { foreach (var (setLayer, powerState) in component.SetOnDepowered) { - if (args.Sprite.LayerMapTryGet(setLayer, out int setStateLayer)) + if (args.Sprite.LayerMapTryGet(setLayer, out var setStateLayer)) args.Sprite.LayerSetState(setStateLayer, new RSI.StateId(powerState)); } } diff --git a/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs b/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs index 2ae15188355..650f96eec97 100644 --- a/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs +++ b/Content.Client/Atmos/Monitor/UI/AirAlarmBoundUserInterface.cs @@ -1,11 +1,7 @@ using Content.Shared.Atmos; using Content.Shared.Atmos.Monitor; using Content.Shared.Atmos.Monitor.Components; -using Robust.Client.GameObjects; using Robust.Client.UserInterface; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; -using Robust.Shared.Log; namespace Content.Client.Atmos.Monitor.UI; @@ -30,7 +26,6 @@ protected override void Open() _window.AirAlarmModeChanged += OnAirAlarmModeChanged; _window.AutoModeChanged += OnAutoModeChanged; _window.ResyncAllRequested += ResyncAllDevices; - _window.AirAlarmTabChange += OnTabChanged; } private void ResyncAllDevices() @@ -63,11 +58,6 @@ private void OnThresholdChanged(string address, AtmosMonitorThresholdType type, SendMessage(new AirAlarmUpdateAlarmThresholdMessage(address, type, threshold, gas)); } - private void OnTabChanged(AirAlarmTab tab) - { - SendMessage(new AirAlarmTabSetMessage(tab)); - } - protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); @@ -84,6 +74,7 @@ protected override void Dispose(bool disposing) { base.Dispose(disposing); - if (disposing) _window?.Dispose(); + if (disposing) + _window?.Dispose(); } } diff --git a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs index eeec11c7660..f0201dc81ba 100644 --- a/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs +++ b/Content.Client/Atmos/Monitor/UI/AirAlarmWindow.xaml.cs @@ -8,7 +8,6 @@ using Content.Shared.Atmos.Piping.Unary.Components; using Content.Shared.Temperature; using Robust.Client.AutoGenerated; -using Robust.Client.GameObjects; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.XAML; @@ -23,7 +22,6 @@ public sealed partial class AirAlarmWindow : FancyWindow public event Action? AirAlarmModeChanged; public event Action? AutoModeChanged; public event Action? ResyncAllRequested; - public event Action? AirAlarmTabChange; private RichTextLabel _address => CDeviceAddress; private RichTextLabel _deviceTotal => CDeviceTotal; @@ -60,7 +58,7 @@ public AirAlarmWindow() AirAlarmMode.Fill => "air-alarm-ui-mode-fill", AirAlarmMode.Panic => "air-alarm-ui-mode-panic", AirAlarmMode.None => "air-alarm-ui-mode-none", - _ => "error" + _ => "error", }; _modes.AddItem(Loc.GetString(text)); } @@ -71,7 +69,7 @@ public AirAlarmWindow() AirAlarmModeChanged!.Invoke((AirAlarmMode) args.Id); }; - _autoMode.OnToggled += args => + _autoMode.OnToggled += _ => { AutoModeChanged!.Invoke(_autoMode.Pressed); }; @@ -80,11 +78,6 @@ public AirAlarmWindow() _tabContainer.SetTabTitle(1, Loc.GetString("air-alarm-ui-window-tab-scrubbers")); _tabContainer.SetTabTitle(2, Loc.GetString("air-alarm-ui-window-tab-sensors")); - _tabContainer.OnTabChanged += idx => - { - AirAlarmTabChange!((AirAlarmTab) idx); - }; - _resyncDevices.OnPressed += _ => { _ventDevices.RemoveAllChildren(); @@ -117,8 +110,6 @@ public void UpdateState(AirAlarmUIState state) { UpdateDeviceData(addr, dev); } - - _tabContainer.CurrentTab = (int) state.Tab; } public void UpdateModeSelector(AirAlarmMode mode) @@ -139,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); } @@ -154,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); } @@ -170,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); } @@ -184,22 +176,18 @@ public void UpdateDeviceData(string addr, IAtmosDeviceData device) public static Color ColorForThreshold(float amount, AtmosAlarmThreshold threshold) { - threshold.CheckThreshold(amount, out AtmosAlarmType curAlarm); + threshold.CheckThreshold(amount, out var curAlarm); return ColorForAlarm(curAlarm); } public static Color ColorForAlarm(AtmosAlarmType curAlarm) { - if(curAlarm == AtmosAlarmType.Danger) + return curAlarm switch { - return StyleNano.DangerousRedFore; - } - else if(curAlarm == AtmosAlarmType.Warning) - { - return StyleNano.ConcerningOrangeFore; - } - - return StyleNano.GoodGreenFore; + AtmosAlarmType.Danger => StyleNano.DangerousRedFore, + AtmosAlarmType.Warning => StyleNano.ConcerningOrangeFore, + _ => StyleNano.GoodGreenFore, + }; } diff --git a/Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml.cs b/Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml.cs index 17b03b84684..8502cd2712b 100644 --- a/Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml.cs +++ b/Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml.cs @@ -1,12 +1,8 @@ -using System; -using Content.Shared.Atmos.Monitor; using Content.Shared.Atmos.Monitor.Components; using Content.Shared.Atmos.Piping.Unary.Components; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.Controls; -using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.XAML; -using Robust.Shared.Localization; namespace Content.Client.Atmos.Monitor.UI.Widgets; @@ -25,7 +21,7 @@ public sealed partial class PumpControl : BoxContainer private OptionButton _pressureCheck => CPressureCheck; private FloatSpinBox _externalBound => CExternalBound; private FloatSpinBox _internalBound => CInternalBound; - private Button _copySettings => CCopySettings; + private Button _copySettings => CCopySettings; public PumpControl(GasVentPumpData data, string address) { @@ -86,11 +82,11 @@ public PumpControl(GasVentPumpData data, string address) _data.PressureChecks = (VentPressureBound) args.Id; PumpDataChanged?.Invoke(_address, _data); }; - - _copySettings.OnPressed += _ => - { - PumpDataCopied?.Invoke(_data); - }; + + _copySettings.OnPressed += _ => + { + PumpDataCopied?.Invoke(_data); + }; } public void ChangeData(GasVentPumpData data) diff --git a/Content.Client/Atmos/Monitor/UI/Widgets/ScrubberControl.xaml.cs b/Content.Client/Atmos/Monitor/UI/Widgets/ScrubberControl.xaml.cs index f2241bcd8da..d03ac77ab31 100644 --- a/Content.Client/Atmos/Monitor/UI/Widgets/ScrubberControl.xaml.cs +++ b/Content.Client/Atmos/Monitor/UI/Widgets/ScrubberControl.xaml.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; using Content.Shared.Atmos; -using Content.Shared.Atmos.Monitor; using Content.Shared.Atmos.Monitor.Components; using Content.Shared.Atmos.Piping.Unary.Components; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.Controls; -using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.XAML; -using Robust.Shared.Localization; namespace Content.Client.Atmos.Monitor.UI.Widgets; @@ -27,7 +21,7 @@ public sealed partial class ScrubberControl : BoxContainer private OptionButton _pumpDirection => CPumpDirection; private FloatSpinBox _volumeRate => CVolumeRate; private CheckBox _wideNet => CWideNet; - private Button _copySettings => CCopySettings; + private Button _copySettings => CCopySettings; private GridContainer _gases => CGasContainer; private Dictionary _gasControls = new(); @@ -77,11 +71,11 @@ public ScrubberControl(GasVentScrubberData data, string address) _data.PumpDirection = (ScrubberPumpDirection) args.Id; ScrubberDataChanged?.Invoke(_address, _data); }; - - _copySettings.OnPressed += _ => - { - ScrubberDataCopied?.Invoke(_data); - }; + + _copySettings.OnPressed += _ => + { + ScrubberDataCopied?.Invoke(_data); + }; foreach (var value in Enum.GetValues()) { diff --git a/Content.Client/Atmos/Monitor/UI/Widgets/SensorInfo.xaml b/Content.Client/Atmos/Monitor/UI/Widgets/SensorInfo.xaml index 005e6807b37..c50dadc9c7d 100644 --- a/Content.Client/Atmos/Monitor/UI/Widgets/SensorInfo.xaml +++ b/Content.Client/Atmos/Monitor/UI/Widgets/SensorInfo.xaml @@ -3,6 +3,9 @@ + +