diff --git a/.github/workflows/build-map-renderer.yml b/.github/workflows/build-map-renderer.yml index 7e9e203f26..a20023a057 100644 --- a/.github/workflows/build-map-renderer.yml +++ b/.github/workflows/build-map-renderer.yml @@ -8,6 +8,10 @@ on: types: [ opened, reopened, synchronize, ready_for_review ] branches: [ master, staging, stable ] +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name != 'merge_group' }} + jobs: build: if: github.actor != 'PJBot' && github.event.pull_request.draft == false diff --git a/.github/workflows/build-test-debug.yml b/.github/workflows/build-test-debug.yml index ebd00d2f3c..a01d09f60a 100644 --- a/.github/workflows/build-test-debug.yml +++ b/.github/workflows/build-test-debug.yml @@ -8,6 +8,10 @@ on: types: [ opened, reopened, synchronize, ready_for_review ] branches: [ master, staging, stable ] +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name != 'merge_group' }} + jobs: build: if: github.actor != 'IanComradeBot' && github.event.pull_request.draft == false diff --git a/.github/workflows/check-crlf.yml b/.github/workflows/check-crlf.yml index 552ca4b097..5e4b0d0341 100644 --- a/.github/workflows/check-crlf.yml +++ b/.github/workflows/check-crlf.yml @@ -4,6 +4,10 @@ on: pull_request: types: [ opened, reopened, synchronize, ready_for_review ] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true # We only care about latest. + jobs: build: name: CRLF Check diff --git a/.github/workflows/no-submodule-update.yml b/.github/workflows/no-submodule-update.yml index f2a9d72e37..10354eaed2 100644 --- a/.github/workflows/no-submodule-update.yml +++ b/.github/workflows/no-submodule-update.yml @@ -2,13 +2,36 @@ name: No submodule update checker on: pull_request: + types: [ opened, reopened, synchronize, ready_for_review ] paths: - 'RobustToolbox' +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + jobs: this_aint_right: name: Submodule update in pr found + if: github.actor != 'PJBot' && github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - - name: Fail - run: exit 1 + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - name: Check changed files + shell: pwsh + run: | + $changedFiles = @(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}") + + if ($changedFiles.Count -eq 1 -and $changedFiles[0] -eq "RobustToolbox") { + Write-Host "Only RobustToolbox was changed; allowing standalone submodule update." + exit 0 + } + + Write-Host "RobustToolbox was updated alongside other files:" + foreach ($file in $changedFiles) { + Write-Host " - $file" + } + exit 1 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1a9b417abf..35f385f625 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -79,6 +79,11 @@ jobs: # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # DISCORD_WEBHOOK_URL: ${{ secrets.CHANGELOG_DISCORD_WEBHOOK }} + - name: Publish changelog (Discord) + run: Tools/actions_changelogs_since_last_run.py + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DISCORD_WEBHOOK_URL: ${{ secrets.CHANGELOG_DISCORD_WEBHOOK }} # - name: Publish changelog (RSS) # continue-on-error: true diff --git a/.github/workflows/rsi-diff.yml b/.github/workflows/rsi-diff.yml index 8ae6105ad3..079a476fe4 100644 --- a/.github/workflows/rsi-diff.yml +++ b/.github/workflows/rsi-diff.yml @@ -2,9 +2,14 @@ name: Diff RSIs on: pull_request_target: + types: [ opened, reopened, synchronize, ready_for_review ] paths: - '**.rsi/**.png' +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + jobs: diff: name: Diff diff --git a/.github/workflows/test-packaging.yml b/.github/workflows/test-packaging.yml index 28fd5036c9..4e161359fa 100644 --- a/.github/workflows/test-packaging.yml +++ b/.github/workflows/test-packaging.yml @@ -26,6 +26,10 @@ on: - 'RobustToolbox' - 'RobustToolbox/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name != 'merge_group' }} + jobs: build: name: Test Packaging diff --git a/.github/workflows/validate-rgas.yml b/.github/workflows/validate-rgas.yml index 66be781c9c..05caaa6a89 100644 --- a/.github/workflows/validate-rgas.yml +++ b/.github/workflows/validate-rgas.yml @@ -6,6 +6,10 @@ on: pull_request: types: [ opened, reopened, synchronize, ready_for_review ] +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name != 'merge_group' }} + jobs: yaml-schema-validation: name: YAML RGA schema validator diff --git a/.github/workflows/validate-rsis.yml b/.github/workflows/validate-rsis.yml index 70491a0ee2..7cb82a6e18 100644 --- a/.github/workflows/validate-rsis.yml +++ b/.github/workflows/validate-rsis.yml @@ -5,12 +5,18 @@ on: branches: [ master, staging, stable ] merge_group: pull_request: + types: [ opened, reopened, synchronize, ready_for_review ] paths: - '**.rsi/**' +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name != 'merge_group' }} + jobs: validate_rsis: name: Validate RSIs + if: github.actor != 'PJBot' && github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 diff --git a/.github/workflows/validate_mapfiles.yml b/.github/workflows/validate_mapfiles.yml index 82004991ba..8458f4bfa7 100644 --- a/.github/workflows/validate_mapfiles.yml +++ b/.github/workflows/validate_mapfiles.yml @@ -6,6 +6,10 @@ on: pull_request: types: [ opened, reopened, synchronize, ready_for_review ] +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name != 'merge_group' }} + jobs: yaml-schema-validation: name: YAML map schema validator diff --git a/.github/workflows/yaml-linter.yml b/.github/workflows/yaml-linter.yml index 15c17499ef..5b6a796193 100644 --- a/.github/workflows/yaml-linter.yml +++ b/.github/workflows/yaml-linter.yml @@ -7,6 +7,10 @@ on: pull_request: types: [ opened, reopened, synchronize, ready_for_review ] +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name != 'merge_group' }} + jobs: build: name: YAML Linter diff --git a/.gitignore b/.gitignore index fa68594da8..1ed759db39 100644 --- a/.gitignore +++ b/.gitignore @@ -303,6 +303,10 @@ ehthumbs.db # Merge driver stuff Content.Tools/test/out.yml +# Local changelog Discord debug files. +Resources/Changelog/Old.yml +Resources/Changelog/DiscordDebug.md + # Windows desktop.ini diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 7f4efc8c9a..96838b16d6 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -13,13 +13,35 @@ "/consoleloggerparameters:'ForceNoAlign;NoSummary'" // Do not generate summary otherwise it leads to duplicate errors in Problems panel ], "group": { - "kind": "build", - "isDefault": true + "kind": "build" }, "presentation": { "reveal": "silent" }, - "problemMatcher": "$msCompile" + "problemMatcher": "$msCompile", + "runOptions": { + "instanceLimit": 1 + } + }, + { + "label": "build (C# Dev Kit)", + "detail": "needs C# Dev Kit extention. use the (build) task instead if you dont have the extention.", + "type": "dotnet", + "task": "build", + "icon": { + "id": "build", + "color": "terminal.ansiBlue" + }, + "group": { + "kind": "build" + }, + "presentation": { + "reveal": "silent" + }, + "problemMatcher": "$msCompile", + "runOptions": { + "instanceLimit": 1 + } }, { "label": "build-yaml-linter", diff --git a/Content.Client/Access/AgentIdCardSystem.cs b/Content.Client/Access/AgentIdCardSystem.cs new file mode 100644 index 0000000000..21b73a9841 --- /dev/null +++ b/Content.Client/Access/AgentIdCardSystem.cs @@ -0,0 +1,18 @@ +using Content.Shared.Access.Systems; +using Robust.Client.GameObjects; + +namespace Content.Client.Access; + +/// +public sealed partial class AgentIdCardSystem : SharedAgentIdCardSystem +{ + [Dependency] private UserInterfaceSystem _ui = default!; + + public override void UpdateUi(EntityUid entity) + { + if (_ui.TryGetOpenUi(entity, AgentIDCardUiKey.Key, out var bui)) + { + bui.Update(); + } + } +} diff --git a/Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs b/Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs index 050756fcd1..69868abbdd 100644 --- a/Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs +++ b/Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs @@ -1,61 +1,64 @@ +using Content.Shared.Access.Components; using Content.Shared.Access.Systems; using Content.Shared.StatusIcon; -using Robust.Client.GameObjects; using Robust.Client.UserInterface; using Robust.Shared.Prototypes; -namespace Content.Client.Access.UI +namespace Content.Client.Access.UI; + +/// +/// Initializes a and updates it when new server messages are received. +/// +public sealed class AgentIDCardBoundUserInterface(EntityUid owner, Enum uiKey) : BoundUserInterface(owner, uiKey) { - /// - /// Initializes a and updates it when new server messages are received. - /// - public sealed class AgentIDCardBoundUserInterface : BoundUserInterface + private AgentIDCardWindow? _window; + + protected override void Open() { - private AgentIDCardWindow? _window; + base.Open(); - public AgentIDCardBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) - { - } + if (!EntMan.TryGetComponent(Owner, out AgentIDCardComponent? agent)) + return; - protected override void Open() - { - base.Open(); + _window = this.CreateWindow(); - _window = this.CreateWindow(); + _window.OnNameChanged += OnNameChanged; + _window.OnJobChanged += OnJobChanged; + _window.OnJobIconChanged += OnJobIconChanged; - _window.OnNameChanged += OnNameChanged; - _window.OnJobChanged += OnJobChanged; - _window.OnJobIconChanged += OnJobIconChanged; - } + ProtoId currentIcon = default; + if (EntMan.TryGetComponent(Owner, out var card)) + currentIcon = card.JobIcon; - private void OnNameChanged(string newName) - { - SendMessage(new AgentIDCardNameChangedMessage(newName)); - } + _window.SetAllowedIcons(agent.IconGroups, currentIcon); + Update(); + } - private void OnJobChanged(string newJob) - { - SendMessage(new AgentIDCardJobChangedMessage(newJob)); - } + public override void Update() + { + base.Update(); - public void OnJobIconChanged(ProtoId newJobIconId) - { - SendMessage(new AgentIDCardJobIconChangedMessage(newJobIconId)); - } + if (_window == null) + return; - /// - /// Update the UI state based on server-sent info - /// - /// - protected override void UpdateState(BoundUserInterfaceState state) - { - base.UpdateState(state); - if (_window == null || state is not AgentIDCardBoundUserInterfaceState cast) - return; + if (!EntMan.TryGetComponent(Owner, out var card)) + return; - _window.SetCurrentName(cast.CurrentName); - _window.SetCurrentJob(cast.CurrentJob); - _window.SetAllowedIcons(cast.CurrentJobIconId); - } + _window.Update(card); + } + + private void OnNameChanged(string newName) + { + SendPredictedMessage(new AgentIDCardNameChangedMessage(newName)); + } + + private void OnJobChanged(string newJob) + { + SendPredictedMessage(new AgentIDCardJobChangedMessage(newJob)); + } + + private void OnJobIconChanged(ProtoId newJobIconId) + { + SendPredictedMessage(new AgentIDCardJobIconChangedMessage(newJobIconId)); } } diff --git a/Content.Client/Access/UI/AgentIDCardWindow.xaml b/Content.Client/Access/UI/AgentIDCardWindow.xaml index 7d091e4e16..6030851114 100644 --- a/Content.Client/Access/UI/AgentIDCardWindow.xaml +++ b/Content.Client/Access/UI/AgentIDCardWindow.xaml @@ -1,14 +1,71 @@ - - - + diff --git a/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs b/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs index 6a1255d2d8..d4b3824118 100644 --- a/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs +++ b/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs @@ -1,96 +1,183 @@ using Content.Client.Stylesheets; +using Content.Client.UserInterface.Controls; +using Content.Shared.Access.Components; +using Content.Shared.CCVar; using Content.Shared.StatusIcon; using Robust.Client.AutoGenerated; using Robust.Client.GameObjects; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; -using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.XAML; +using Robust.Shared.Configuration; using Robust.Shared.Prototypes; using System.Numerics; -using System.Linq; -namespace Content.Client.Access.UI +namespace Content.Client.Access.UI; + +[GenerateTypedNameReferences] +public sealed partial class AgentIDCardWindow : FancyWindow { - [GenerateTypedNameReferences] - public sealed partial class AgentIDCardWindow : DefaultWindow + [Dependency] private IConfigurationManager _cfgManager = default!; + [Dependency] private IEntitySystemManager _entitySystem = default!; + [Dependency] private IPrototypeManager _prototypeManager = default!; + private readonly SpriteSystem _spriteSystem; + + public event Action? OnNameChanged; + public event Action? OnJobChanged; + + public event Action>? OnJobIconChanged; + + public AgentIDCardWindow() { - [Dependency] private IPrototypeManager _prototypeManager = default!; - [Dependency] private IEntitySystemManager _entitySystem = default!; - private readonly SpriteSystem _spriteSystem; + RobustXamlLoader.Load(this); + IoCManager.InjectDependencies(this); + _spriteSystem = _entitySystem.GetEntitySystem(); - private const int JobIconColumnCount = 10; + NameLineEdit.OnTextEntered += e => CommitName(e.Text); + NameLineEdit.OnFocusExit += e => CommitName(e.Text); - public event Action? OnNameChanged; - public event Action? OnJobChanged; + JobLineEdit.OnTextEntered += e => CommitJob(e.Text); + JobLineEdit.OnFocusExit += e => CommitJob(e.Text); - public event Action>? OnJobIconChanged; + NameLineEdit.IsValid = s => s.Length <= _cfgManager.GetCVar(CCVars.MaxNameLength); + JobLineEdit.IsValid = s => s.Length <= _cfgManager.GetCVar(CCVars.MaxIdJobLength); - public AgentIDCardWindow() + AgentTabs.SetTabTitle(0, Loc.GetString("agent-id-ui-tab-settings")); + AgentTabs.SetTabTitle(1, Loc.GetString("agent-id-ui-tab-job-icons")); + } + + /// + /// Creates the job icons tab. + /// + public void SetAllowedIcons(IReadOnlyList> jobGroups, ProtoId currentIcon) + { + JobGroupGrid.DisposeAllChildren(); + IconGrid.DisposeAllChildren(); + + var jobGroupButtonGroup = new ButtonGroup(); + ContainerButton? firstGroupButton = null; + IReadOnlyList>? firstGroupIcons = null; + ContainerButton? matchingGroupButton = null; + IReadOnlyList>? matchingGroupIcons = null; + + foreach (var group in jobGroups) { - RobustXamlLoader.Load(this); - IoCManager.InjectDependencies(this); - _spriteSystem = _entitySystem.GetEntitySystem(); + if (!_prototypeManager.TryIndex(group, out var groupProto)) + continue; - NameLineEdit.OnTextEntered += e => OnNameChanged?.Invoke(e.Text); - NameLineEdit.OnFocusExit += e => OnNameChanged?.Invoke(e.Text); + var groupButton = CreateGroupButton(groupProto, jobGroupButtonGroup); + groupButton.OnPressed += _ => SetJobIcons(groupProto.Icons); - JobLineEdit.OnTextEntered += e => OnJobChanged?.Invoke(e.Text); - JobLineEdit.OnFocusExit += e => OnJobChanged?.Invoke(e.Text); - } + JobGroupGrid.AddChild(groupButton); - public void SetAllowedIcons(string currentJobIconId) - { - IconGrid.RemoveAllChildren(); + firstGroupButton ??= groupButton; + firstGroupIcons ??= groupProto.Icons; - var jobIconButtonGroup = new ButtonGroup(); - var i = 0; - var icons = _prototypeManager.EnumeratePrototypes().Where(icon => icon.AllowSelection).ToList(); - icons.Sort((x, y) => string.Compare(x.LocalizedJobName, y.LocalizedJobName, StringComparison.CurrentCulture)); - foreach (var jobIcon in icons) + // Prefer the group that actually contains the card's current icon so + // the opened window shows the relevant set rather than always the first. + if (matchingGroupButton == null && groupProto.Icons.Contains(currentIcon)) { - String styleBase = StyleClass.ButtonOpenBoth; - var modulo = i % JobIconColumnCount; - if (modulo == 0) - styleBase = StyleClass.ButtonOpenRight; - else if (modulo == JobIconColumnCount - 1) - styleBase = StyleClass.ButtonOpenLeft; - - // Generate buttons - var jobIconButton = new Button - { - Access = AccessLevel.Public, - StyleClasses = { styleBase }, - MaxSize = new Vector2(42, 28), - Group = jobIconButtonGroup, - Pressed = currentJobIconId == jobIcon.ID, - ToolTip = jobIcon.LocalizedJobName - }; - - // Generate buttons textures - var jobIconTexture = new TextureRect - { - Texture = _spriteSystem.Frame0(jobIcon.Icon), - TextureScale = new Vector2(2.5f, 2.5f), - Stretch = TextureRect.StretchMode.KeepCentered, - }; - - jobIconButton.AddChild(jobIconTexture); - jobIconButton.OnPressed += _ => OnJobIconChanged?.Invoke(jobIcon.ID); - IconGrid.AddChild(jobIconButton); - - i++; + matchingGroupButton = groupButton; + matchingGroupIcons = groupProto.Icons; } } - public void SetCurrentName(string name) - { - NameLineEdit.Text = name; - } + var selectedButton = matchingGroupButton ?? firstGroupButton; + var selectedIcons = matchingGroupIcons ?? firstGroupIcons; - public void SetCurrentJob(string job) + if (selectedButton == null || selectedIcons == null) + return; + + selectedButton.Pressed = true; + SetJobIcons(selectedIcons); + } + + /// + /// Creates the job icon subgroup within the job icons tab. + /// + private void SetJobIcons(IReadOnlyList> jobIcons) + { + IconGrid.DisposeAllChildren(); + + foreach (var icon in jobIcons) { - JobLineEdit.Text = job; + if (!_prototypeManager.TryIndex(icon, out var iconProto)) + continue; + + var texture = _spriteSystem.Frame0(iconProto.Icon); + + // Create new button + var jobIconButton = new TextureButton + { + Access = AccessLevel.Public, + ToolTip = Loc.GetString(iconProto.JobName), + TextureNormal = texture, + SetSize = new Vector2(32, 32), + }; + + // Finish button and add to UI + jobIconButton.OnPressed += _ => OnJobIconChanged?.Invoke(iconProto.ID); + + IconGrid.AddChild(jobIconButton); } } + + public void Update(IdCardComponent card) + { + var name = card.FullName ?? string.Empty; + var job = card.LocalizedJobTitle ?? string.Empty; + + NameLineEdit.Text = name; + CurrentName.Text = name; + JobLineEdit.Text = job; + CurrentJob.Text = job; + + var jobIconProto = _prototypeManager.Index(card.JobIcon); + CurrentJobIcon.Texture = _spriteSystem.Frame0(jobIconProto.Icon); + } + + private ContainerButton CreateGroupButton(JobIconGroupPrototype groupProto, ButtonGroup buttonGroup) + { + var button = new ContainerButton + { + Access = AccessLevel.Public, + Group = buttonGroup, + ToggleMode = true, + StyleClasses = { StyleClass.ButtonOpenBoth }, + Margin = new Thickness(8, 2) + }; + + button.AddChild(new BoxContainer + { + SeparationOverride = 8, + Children = + { + new TextureRect + { + Texture = _spriteSystem.Frame0(groupProto.Sprite), + Stretch = TextureRect.StretchMode.KeepAspectCentered, + SetSize = new Vector2(32, 32), + VerticalAlignment = VAlignment.Center, + }, + new Label + { + Text = Loc.GetString(groupProto.GroupName), + HorizontalExpand = true, + VerticalAlignment = VAlignment.Center, + }, + }, + }); + + return button; + } + + private void CommitJob(string job) + { + OnJobChanged?.Invoke(job); + } + + private void CommitName(string name) + { + OnNameChanged?.Invoke(name); + } } diff --git a/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml b/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml index fdaa838201..1c67a6c581 100644 --- a/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml +++ b/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml @@ -17,7 +17,7 @@ + + + + HorizontalExpand="True"> - - + + + - - - - - - - + + + + This is here just to seperate the two buttons on the UI. I hate this. + + diff --git a/Content.Client/Silicons/Laws/SiliconLawEditUi/SiliconLawContainer.xaml.cs b/Content.Client/Silicons/Laws/SiliconLawEditUi/SiliconLawContainer.xaml.cs index 2e44b820df..b07e53d225 100644 --- a/Content.Client/Silicons/Laws/SiliconLawEditUi/SiliconLawContainer.xaml.cs +++ b/Content.Client/Silicons/Laws/SiliconLawEditUi/SiliconLawContainer.xaml.cs @@ -2,6 +2,7 @@ using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.XAML; +using Robust.Shared.Random; using Robust.Shared.Utility; namespace Content.Client.Silicons.Laws.SiliconLawEditUi; @@ -9,10 +10,9 @@ namespace Content.Client.Silicons.Laws.SiliconLawEditUi; [GenerateTypedNameReferences] public sealed partial class SiliconLawContainer : BoxContainer { - public const string StyleClassSiliconLawPositionLabel = "SiliconLawPositionLabel"; + [Dependency] private IRobustRandom _random = default!; - public static readonly string CorruptedString = - Loc.GetString("ion-storm-law-scrambled-number", ("length", 5)); + public const string StyleClassSiliconLawPositionLabel = "SiliconLawPositionLabel"; private SiliconLaw? _law; @@ -24,6 +24,7 @@ public sealed partial class SiliconLawContainer : BoxContainer public SiliconLawContainer() { RobustXamlLoader.Load(this); + IoCManager.InjectDependencies(this); MoveUp.OnPressed += _ => MoveLawUp?.Invoke(_law!); MoveDown.OnPressed += _ => MoveLawDown?.Invoke(_law!); @@ -31,11 +32,22 @@ public sealed partial class SiliconLawContainer : BoxContainer { if (Corrupted.Pressed) { - _law!.LawIdentifierOverride = CorruptedString; + _law!.LawIdentifierOverride = Loc.GetString( + "ion-storm-law-scrambled-number", + ( + "length", + _random.Next( + SharedSiliconLawSystem.IonStormIdentifierMinLength, + SharedSiliconLawSystem.IonStormIdentifierMaxLength + ) + ) + ); + _law!.Corrupted = true; } else { _law!.LawIdentifierOverride = null; + _law!.Corrupted = false; } }; @@ -49,13 +61,6 @@ public sealed partial class SiliconLawContainer : BoxContainer _law = law; LawContent.TextRope = new Rope.Leaf(Loc.GetString(law.LawString)); PositionText.Text = law.Order.ToString(); - if (!string.IsNullOrEmpty(law.LawIdentifierOverride)) - { - Corrupted.Pressed = true; - } - else - { - Corrupted.Pressed = false; - } + Corrupted.Pressed = law.Corrupted; } } diff --git a/Content.Client/Silicons/Laws/SiliconLawEditUi/SiliconLawUi.xaml b/Content.Client/Silicons/Laws/SiliconLawEditUi/SiliconLawUi.xaml index 19dcbac620..41e99800a0 100644 --- a/Content.Client/Silicons/Laws/SiliconLawEditUi/SiliconLawUi.xaml +++ b/Content.Client/Silicons/Laws/SiliconLawEditUi/SiliconLawUi.xaml @@ -2,21 +2,42 @@ xmlns="https://spacestation14.io" xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" Title="{Loc silicon-law-ui-title}" - MinSize="560 400" -> + MinSize="300 225" + SetSize="450 525"> this shit does not layout properly unless I put the horizontal boxcontainer inside of a vertical one ???? - - - - + + + + - - - + + + diff --git a/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml b/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml index d16aa56664..1dfb0f1e6b 100644 --- a/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml +++ b/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml @@ -1,19 +1,27 @@ - - - - - - - -