]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fixed the guidebook listing every single rule (#28680)
authorAJCM-git <60196617+AJCM-git@users.noreply.github.com>
Fri, 7 Jun 2024 11:28:55 +0000 (07:28 -0400)
committerGitHub <noreply@github.com>
Fri, 7 Jun 2024 11:28:55 +0000 (06:28 -0500)
* Well i tried this way

* New approach (start)

* Did it

* makes spacelaw available, put it under sec

Content.Client/Guidebook/Controls/GuidebookWindow.xaml
Content.Client/Guidebook/Controls/GuidebookWindow.xaml.cs
Content.Client/UserInterface/Systems/Guidebook/GuidebookUIController.cs
Content.Shared/Guidebook/GuideEntry.cs
Resources/Prototypes/Guidebook/rules.yml
Resources/Prototypes/Guidebook/security.yml
Resources/Prototypes/Guidebook/ss14.yml

index cc6cc6e82b09ebf2fd83de87524e9c3576b21e02..b52eacfa722617e2377ba389f10a9c6faafaec7d 100644 (file)
@@ -2,7 +2,7 @@
                 xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
                 xmlns:fancyTree="clr-namespace:Content.Client.UserInterface.Controls.FancyTree"
                 xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
-                SetSize="750 700"
+                SetSize="850 700"
                 MinSize="100 200"
                 Resizable="True"
                 Title="{Loc 'guidebook-window-title'}">
                     Margin="0 5 10 5">
                 </LineEdit>
             </BoxContainer>
+            <BoxContainer Access="Internal" Name="ReturnContainer" Orientation="Horizontal" HorizontalAlignment="Right" Visible="False">
+                <Button Name="HomeButton" Text="{Loc 'ui-rules-button-home'}" Margin="0 0 10 0"/>
+            </BoxContainer>
             <ScrollContainer Name="Scroll" HScrollEnabled="False" HorizontalExpand="True" VerticalExpand="True">
                 <Control>
-                    <BoxContainer Orientation="Vertical" Name="EntryContainer" Margin="5 5 5 5" Visible="False"/>
+                    <BoxContainer Orientation="Vertical" Name="EntryContainer" Margin="5 5 5 5" Visible="False">
+                    </BoxContainer>
                     <BoxContainer Orientation="Vertical" Name="Placeholder" Margin="5 5 5 5">
                         <Label HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Loc 'guidebook-placeholder-text'}"/>
                         <Label HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Loc 'guidebook-placeholder-text-2'}"/>
index 3a67dca89da8ba910312ad3fa349cb04c63b4906..f5ee1200cc6843cc62b4293196d40e41b6105841 100644 (file)
@@ -3,6 +3,7 @@ using Content.Client.Guidebook.RichText;
 using Content.Client.UserInterface.ControlExtensions;
 using Content.Client.UserInterface.Controls;
 using Content.Client.UserInterface.Controls.FancyTree;
+using Content.Client.UserInterface.Systems.Info;
 using Content.Shared.Guidebook;
 using Robust.Client.AutoGenerated;
 using Robust.Client.UserInterface.Controls;
@@ -36,7 +37,13 @@ public sealed partial class GuidebookWindow : FancyWindow, ILinkClickHandler
     private void OnSelectionChanged(TreeItem? item)
     {
         if (item != null && item.Metadata is GuideEntry entry)
+        {
             ShowGuide(entry);
+
+            var isRulesEntry = entry.RuleEntry;
+            ReturnContainer.Visible = isRulesEntry;
+            HomeButton.OnPressed += _ => ShowGuide(entry);
+        }
         else
             ClearSelectedGuide();
     }
@@ -153,6 +160,10 @@ public sealed partial class GuidebookWindow : FancyWindow, ILinkClickHandler
             return null;
         }
 
+        var rulesProto = UserInterfaceManager.GetUIController<InfoUIController>().GetCoreRuleEntry();
+        if (entry.RuleEntry && entry.Id != rulesProto.Id)
+            return null;
+
         var item = Tree.AddItem(parent);
         item.Metadata = entry;
         var name = Loc.GetString(entry.Name);
index e30a6b3a215b011851b85ec9dc885ba636c599ea..61195f3a9a7e5e6621cd62e69b0ea32390c496f7 100644 (file)
@@ -124,6 +124,9 @@ public sealed class GuidebookUIController : UIController, IOnStateEntered<LobbyS
     {
         if (GuidebookButton != null)
             GuidebookButton.Pressed = false;
+
+        if (_guideWindow != null)
+            _guideWindow.ReturnContainer.Visible = false;
     }
 
     private void OnWindowOpen()
index 0e0e166cd55aae47310d9b0b74c0704149af90de..c6079aab08b40c82579b5e2cb01f34098c59faf6 100644 (file)
@@ -39,6 +39,8 @@ public class GuideEntry
     /// </summary>
     [DataField] public bool FilterEnabled = default!;
 
+    [DataField] public bool RuleEntry;
+
     /// <summary>
     ///     Priority for sorting top-level guides when shown in a tree / table of contents.
     ///     If the guide is the child of some other guide, the order simply determined by the order of children in <see cref="Children"/>.
index 4aad449485554ce5e7c0851965fa87bb10bc62d4..72dd47649554f93f5b57c9d1696275939bc6837b 100644 (file)
@@ -1,35 +1,41 @@
 - type: guideEntry # Default for forks and stuff. Should not be listed anywhere if the server is using a custom ruleset.
   id: DefaultRuleset
   name: guide-entry-rules
+  ruleEntry: true
   text: "/ServerInfo/Guidebook/ServerRules/DefaultRules.xml"
 
 - type: guideEntry
   id: CoreRuleset
   name: guide-entry-rules-core-only
+  ruleEntry: true
   priority: 0
   text: "/ServerInfo/Guidebook/ServerRules/WizDenCoreOnlyRules.xml"
 
 - type: guideEntry
   id: StandardRuleset
   name: guide-entry-rules-lrp
+  ruleEntry: true
   priority: 5
   text: "/ServerInfo/Guidebook/ServerRules/WizDenLRPRules.xml"
 
 - type: guideEntry
   id: MRPRuleset
   name: guide-entry-rules-mrp
+  ruleEntry: true
   priority: 10
   text: "/ServerInfo/Guidebook/ServerRules/WizDenMRPRules.xml"
 
 - type: guideEntry
   id: RoleTypes
   name: guide-entry-rules-role-types
+  ruleEntry: true
   priority: 20
   text: "/ServerInfo/Guidebook/ServerRules/RoleTypes.xml"
 
 - type: guideEntry
   id: CoreRules
   name: guide-entry-rules-core
+  ruleEntry: true
   priority: 30
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC0.xml"
   children:
 - type: guideEntry
   id: RuleC1
   name: guide-entry-rules-c1
+  ruleEntry: true
   priority: 1
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC1Admins.xml"
 
 - type: guideEntry
   id: RuleC2
   name: guide-entry-rules-c2
+  ruleEntry: true
   priority: 2
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC2DBAD.xml"
 
 - type: guideEntry
   id: RuleC3
   name: guide-entry-rules-c3
+  ruleEntry: true
   priority: 3
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC3NoHate.xml"
 
 - type: guideEntry
   id: RuleC4
   name: guide-entry-rules-c4
+  ruleEntry: true
   priority: 4
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC4NoERP.xml"
 
 - type: guideEntry
   id: RuleC5
   name: guide-entry-rules-c5
+  ruleEntry: true
   priority: 5
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC5Metacomms.xml"
 
 - type: guideEntry
   id: RuleC6
   name: guide-entry-rules-c6
+  ruleEntry: true
   priority: 6
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC6BanEvasion.xml"
 
 - type: guideEntry
   id: RuleC7
   name: guide-entry-rules-c7
+  ruleEntry: true
   priority: 7
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC7EnglishOnly.xml"
 
 - type: guideEntry
   id: RuleC8
   name: guide-entry-rules-c8
+  ruleEntry: true
   priority: 8
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC8Exploits.xml"
 
 - type: guideEntry
   id: RuleC9
   name: guide-entry-rules-c9
+  ruleEntry: true
   priority: 9
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC9Multikey.xml"
 
 - type: guideEntry
   id: RuleC10
   name: guide-entry-rules-c10
+  ruleEntry: true
   priority: 10
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC10AHelp.xml"
 
 - type: guideEntry
   id: RuleC11
   name: guide-entry-rules-c11
+  ruleEntry: true
   priority: 11
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC11AhelpThreats.xml"
 
 - type: guideEntry
   id: RuleC12
   name: guide-entry-rules-c12
+  ruleEntry: true
   priority: 12
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC12MinAge.xml"
 
 - type: guideEntry
   id: RuleC13
   name: guide-entry-rules-c13
+  ruleEntry: true
   priority: 13
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC13CharacterNames.xml"
 
 - type: guideEntry
   id: RuleC14
   name: guide-entry-rules-c14
+  ruleEntry: true
   priority: 14
   text: "/ServerInfo/Guidebook/ServerRules/CoreRules/RuleC14ICinOOC.xml"
 
 - type: guideEntry
   id: RoleplayRules
   name: guide-entry-rules-roleplay
+  ruleEntry: true
   priority: 40
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR0.xml"
   children:
 - type: guideEntry
   id: RuleR1
   name: guide-entry-rules-r1
+  ruleEntry: true
   priority: 1
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR1Silicons.xml"
 
 - type: guideEntry
   id: RuleR2
   name: guide-entry-rules-r2
+  ruleEntry: true
   priority: 2
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR2Familiars.xml"
 
 - type: guideEntry
   id: RuleR3
   name: guide-entry-rules-r3
+  ruleEntry: true
   priority: 3
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR3NormalRP.xml"
 
 - type: guideEntry
   id: RuleR4
   name: guide-entry-rules-r4
+  ruleEntry: true
   priority: 4
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR4Metashield.xml"
 
 - type: guideEntry
   id: RuleR5
   name: guide-entry-rules-r5
+  ruleEntry: true
   priority: 5
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR5Arrivals.xml"
 
 - type: guideEntry
   id: RuleR6
   name: guide-entry-rules-r6
+  ruleEntry: true
   priority: 6
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR6SelfAntag.xml"
 
 - type: guideEntry
   id: RuleR7
   name: guide-entry-rules-r7
+  ruleEntry: true
   priority: 7
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR7RoundStalling.xml"
 
 - type: guideEntry
   id: RuleR8
   name: guide-entry-rules-r8
+  ruleEntry: true
   priority: 8
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR8NoFriendlyAntag.xml"
 
 - type: guideEntry
   id: RuleR9
   name: guide-entry-rules-r9
+  ruleEntry: true
   priority: 9
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR9MassSabotage.xml"
 
 - type: guideEntry
   id: RuleR10
   name: guide-entry-rules-r10
+  ruleEntry: true
   priority: 10
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR10Subordination.xml"
 
 - type: guideEntry
   id: RuleR11
   name: guide-entry-rules-r11
+  ruleEntry: true
   priority: 11
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR11Escalation.xml"
 
 - type: guideEntry
   id: RuleR12
   name: guide-entry-rules-r12
+  ruleEntry: true
   priority: 12
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR12RoleAbandonment.xml"
 
 - type: guideEntry
   id: RuleR13
   name: guide-entry-rules-r13
+  ruleEntry: true
   priority: 13
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR13PerformRole.xml"
 
 - type: guideEntry
   id: RuleR14
   name: guide-entry-rules-r14
+  ruleEntry: true
   priority: 14
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR14SecComStandard.xml"
 
 - type: guideEntry
   id: RuleR15
   name: guide-entry-rules-r15
+  ruleEntry: true
   priority: 15
   text: "/ServerInfo/Guidebook/ServerRules/RoleplayRules/RuleR15SpaceLaw.xml"
 
 - type: guideEntry
   id: SiliconRules
   name: guide-entry-rules-silicon
+  ruleEntry: true
   priority: 50
   text: "/ServerInfo/Guidebook/ServerRules/SiliconRules/RuleS0.xml"
   children:
 - type: guideEntry
   id: RuleS1
   name: guide-entry-rules-s1
+  ruleEntry: true
   priority: 1
   text: "/ServerInfo/Guidebook/ServerRules/SiliconRules/RuleS1Laws.xml"
 
 - type: guideEntry
   id: RuleS2
   name: guide-entry-rules-s2
+  ruleEntry: true
   priority: 2
   text: "/ServerInfo/Guidebook/ServerRules/SiliconRules/RuleS2LawPriority.xml"
 
 - type: guideEntry
   id: RuleS3
   name: guide-entry-rules-s3
+  ruleEntry: true
   priority: 3
   text: "/ServerInfo/Guidebook/ServerRules/SiliconRules/RuleS3LawRedefinition.xml"
 
 - type: guideEntry
   id: RuleS4
   name: guide-entry-rules-s4
+  ruleEntry: true
   priority: 4
   text: "/ServerInfo/Guidebook/ServerRules/SiliconRules/RuleS4RequestChanges.xml"
 
 - type: guideEntry
   id: RuleS5
   name: guide-entry-rules-s5
+  ruleEntry: true
   priority: 5
   text: "/ServerInfo/Guidebook/ServerRules/SiliconRules/RuleS5FreeSilicon.xml"
 
 - type: guideEntry
   id: RuleS6
   name: guide-entry-rules-s6
+  ruleEntry: true
   priority: 6
   text: "/ServerInfo/Guidebook/ServerRules/SiliconRules/RuleS6UnreasonableOrders.xml"
 
 - type: guideEntry
   id: RuleS7
   name: guide-entry-rules-s7
+  ruleEntry: true
   priority: 7
   text: "/ServerInfo/Guidebook/ServerRules/SiliconRules/RuleS7Consistency.xml"
 
 - type: guideEntry
   id: RuleS8
   name: guide-entry-rules-s8
+  ruleEntry: true
   priority: 8
   text: "/ServerInfo/Guidebook/ServerRules/SiliconRules/RuleS8DefaultCrewDefinition.xml"
 
 - type: guideEntry
   id: RuleS9
   name: guide-entry-rules-s9
+  ruleEntry: true
   priority: 9
   text: "/ServerInfo/Guidebook/ServerRules/SiliconRules/RuleS9DefaultHarmDefinition.xml"
 
 - type: guideEntry
   id: RuleS10
   name: guide-entry-rules-s10
+  ruleEntry: true
   priority: 10
   text: "/ServerInfo/Guidebook/ServerRules/SiliconRules/RuleS10OrderConflicts.xml"
 
 - type: guideEntry
   id: SpaceLaw
   name: guide-entry-rules-space-law
-  priority: 60
+  priority: 1
   text: "/ServerInfo/Guidebook/ServerRules/SpaceLaw/SpaceLaw.xml"
   children:
   - SpaceLawCrimeList
 - type: guideEntry
   id: BanTypes
   name: guide-entry-rules-ban-types
+  ruleEntry: true
   priority: 90
   text: "/ServerInfo/Guidebook/ServerRules/BanTypes.xml"
 
 - type: guideEntry
   id: BanDurations
   name: guide-entry-rules-ban-durations
+  ruleEntry: true
   priority: 100
   text: "/ServerInfo/Guidebook/ServerRules/BanDurations.xml"
index f5e347082836ef209c53b85c41b2cbea8661dfd0..17edb030065895e3d240eead73b47485430c0b49 100644 (file)
@@ -6,6 +6,7 @@
   - Forensics
   - Defusal
   - CriminalRecords
+  - SpaceLaw
 
 - type: guideEntry
   id: Forensics
index 5b1f1dd8f97a86c44d28ea18b41ff877d0c34361..f0b72b90b43a3f7f89c9f9bce625651db71df104 100644 (file)
@@ -3,7 +3,6 @@
   name: guide-entry-ss14
   text: "/ServerInfo/Guidebook/SpaceStation14.xml"
   children:
-  - SpaceLaw
   - Controls
   - Jobs
   - Survival
@@ -22,5 +21,3 @@
   id: Glossary
   name: guide-entry-glossary
   text: "/ServerInfo/Guidebook/Glossary.xml"
-
-