diff --git a/Content.Client/Administration/UI/Logs/AdminLogsControl.xaml.cs b/Content.Client/Administration/UI/Logs/AdminLogsControl.xaml.cs index eb0167fbab..8b8fea5efd 100644 --- a/Content.Client/Administration/UI/Logs/AdminLogsControl.xaml.cs +++ b/Content.Client/Administration/UI/Logs/AdminLogsControl.xaml.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using Content.Client.Administration.UI.CustomControls; using Content.Shared.Administration.Logs; using Content.Shared.Database; @@ -390,11 +391,12 @@ public partial class AdminLogsControl : Control UpdateLogs(); } - public void AddLogs(SharedAdminLog[] logs) + public void AddLogs(List logs) { - for (var i = 0; i < logs.Length; i++) + var span = CollectionsMarshal.AsSpan(logs); + for (var i = 0; i < span.Length; i++) { - ref var log = ref logs[i]; + ref var log = ref span[i]; var separator = new HSeparator(); var label = new AdminLogLabel(ref log, separator); label.Visible = ShouldShowLog(label); @@ -404,7 +406,7 @@ public partial class AdminLogsControl : Control } } - public void SetLogs(SharedAdminLog[] logs) + public void SetLogs(List logs) { LogsContainer.RemoveAllChildren(); AddLogs(logs); diff --git a/Content.Client/Commands/DebugCommands.cs b/Content.Client/Commands/DebugCommands.cs index 799db2db84..0562447586 100644 --- a/Content.Client/Commands/DebugCommands.cs +++ b/Content.Client/Commands/DebugCommands.cs @@ -97,6 +97,7 @@ namespace Content.Client.Commands shell.ConsoleHost.RegisteredCommands["togglelight"].Execute(shell, string.Empty, Array.Empty()); shell.ConsoleHost.RegisteredCommands["showsubfloorforever"].Execute(shell, string.Empty, Array.Empty()); + shell.ConsoleHost.RegisteredCommands["showmarkers"].Execute(shell, string.Empty, Array.Empty()); shell.RemoteExecuteCommand(argStr); } diff --git a/Content.Client/HUD/GameHud.cs b/Content.Client/HUD/GameHud.cs index e3a02e0170..95d601b98f 100644 --- a/Content.Client/HUD/GameHud.cs +++ b/Content.Client/HUD/GameHud.cs @@ -6,7 +6,6 @@ using Content.Client.Info; using Content.Client.Resources; using Content.Client.Stylesheets; using Content.Client.Targeting; -using Content.Shared; using Content.Shared.CCVar; using Content.Shared.HUD; using Content.Shared.Input; @@ -304,8 +303,6 @@ namespace Content.Client.HUD _rulesAndInfoWindow = new RulesAndInfoWindow(); - IoCManager.Resolve().OpenRulesAndInfoWindow += OpenRulesAndInfoWindow; - _rulesAndInfoWindow.OnClose += () => _buttonInfo.Pressed = false; _inputManager.SetInputCommand(ContentKeyFunctions.OpenInfo, @@ -431,12 +428,6 @@ namespace Content.Client.HUD LC.SetGrowVertical(VoteContainer, LC.GrowDirection.End); } - private void OpenRulesAndInfoWindow() - { - _rulesAndInfoWindow.OpenCentered(); - _buttonInfo.Pressed = true; - } - private void ButtonInfoOnOnToggled() { _buttonInfo.StyleClasses.Remove(TopButton.StyleClassRedTopButton); diff --git a/Content.Client/Info/RulesAndInfoWindow.cs b/Content.Client/Info/RulesAndInfoWindow.cs index 817c114269..383d6c6a25 100644 --- a/Content.Client/Info/RulesAndInfoWindow.cs +++ b/Content.Client/Info/RulesAndInfoWindow.cs @@ -43,7 +43,7 @@ namespace Content.Client.Info private void PopulateRules(Info rulesList) { - AddSection(rulesList, Loc.GetString("ui-info-header-rules"), "Rules.txt", true); + AddSection(rulesList, Loc.GetString("ui-rules-header"), "Rules.txt", true); } private void PopulateTutorial(Info tutorialList) diff --git a/Content.Client/Info/RulesControl.xaml b/Content.Client/Info/RulesControl.xaml new file mode 100644 index 0000000000..3b24764688 --- /dev/null +++ b/Content.Client/Info/RulesControl.xaml @@ -0,0 +1,6 @@ + diff --git a/Content.Client/Info/RulesControl.xaml.cs b/Content.Client/Info/RulesControl.xaml.cs new file mode 100644 index 0000000000..6675715b30 --- /dev/null +++ b/Content.Client/Info/RulesControl.xaml.cs @@ -0,0 +1,23 @@ +using Robust.Client.AutoGenerated; +using Robust.Client.ResourceManagement; +using Robust.Client.UserInterface.Controls; +using Robust.Client.UserInterface.XAML; +using Robust.Shared.IoC; +using Robust.Shared.Localization; + +namespace Content.Client.Info; + +[GenerateTypedNameReferences] +public partial class RulesControl : BoxContainer +{ + [Dependency] private readonly IResourceCache _resourceManager = default!; + + public RulesControl() + { + RobustXamlLoader.Load(this); + IoCManager.InjectDependencies(this); + + AddChild(new InfoSection(Loc.GetString("ui-rules-header"), + _resourceManager.ContentFileReadAllText($"/Server Info/Rules.txt"), true)); + } +} diff --git a/Content.Client/Info/RulesManager.cs b/Content.Client/Info/RulesManager.cs index 3bccbddc77..2986b9c244 100644 --- a/Content.Client/Info/RulesManager.cs +++ b/Content.Client/Info/RulesManager.cs @@ -1,10 +1,11 @@ using System; using System.Globalization; -using System.IO; using Content.Client.Lobby; using Content.Client.Viewport; using Content.Shared.CCVar; +using Robust.Client.Console; using Robust.Client.State; +using Robust.Client.UserInterface; using Robust.Shared.Configuration; using Robust.Shared.ContentPack; using Robust.Shared.IoC; @@ -16,9 +17,9 @@ public sealed class RulesManager { [Dependency] private readonly IResourceManager _resource = default!; [Dependency] private readonly IConfigurationManager _configManager = default!; + [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!; [Dependency] private readonly IStateManager _stateManager = default!; - - public event Action? OpenRulesAndInfoWindow; + [Dependency] private readonly IClientConsoleHost _consoleHost = default!; public void Initialize() { @@ -39,8 +40,10 @@ public sealed class RulesManager else SaveLastReadTime(); - if (showRules) - OpenRulesAndInfoWindow?.Invoke(); + if (!showRules) + return; + + ShowRules(_configManager.GetCVar(CCVars.RulesWaitTime)); } /// @@ -52,4 +55,25 @@ public sealed class RulesManager sw.Write(DateTime.UtcNow.ToUniversalTime()); } + + private void ShowRules(float time) + { + var rulesPopup = new RulesPopup + { + Timer = time + }; + rulesPopup.OnQuitPressed += OnQuitPressed; + rulesPopup.OnAcceptPressed += OnAcceptPressed; + _userInterfaceManager.RootControl.AddChild(rulesPopup); + } + + private void OnQuitPressed() + { + _consoleHost.ExecuteCommand("quit"); + } + + private void OnAcceptPressed() + { + SaveLastReadTime(); + } } diff --git a/Content.Client/Info/RulesPopup.xaml b/Content.Client/Info/RulesPopup.xaml new file mode 100644 index 0000000000..dc004af5a2 --- /dev/null +++ b/Content.Client/Info/RulesPopup.xaml @@ -0,0 +1,24 @@ + + + + + + + + public static readonly CVarDef SalvageForced = CVarDef.Create("salvage.forced", "", CVar.SERVERONLY); + + /* + * Rules + */ + + /// + /// Time that players have to wait before rules can be accepted. + /// + public static readonly CVarDef RulesWaitTime = + CVarDef.Create("rules.time", 45f, CVar.SERVER | CVar.REPLICATED); } } diff --git a/Content.Shared/Instruments/SharedInstrumentComponent.cs b/Content.Shared/Instruments/SharedInstrumentComponent.cs index f7c171442e..4918a7d693 100644 --- a/Content.Shared/Instruments/SharedInstrumentComponent.cs +++ b/Content.Shared/Instruments/SharedInstrumentComponent.cs @@ -20,19 +20,19 @@ public class SharedInstrumentComponent : Component [ViewVariables] public uint LastSequencerTick { get; set; } - [DataField("program")] + [DataField("program"), ViewVariables(VVAccess.ReadWrite)] public byte InstrumentProgram { get; set; } - [DataField("bank")] + [DataField("bank"), ViewVariables(VVAccess.ReadWrite)] public byte InstrumentBank { get; set; } - [DataField("allowPercussion")] + [DataField("allowPercussion"), ViewVariables(VVAccess.ReadWrite)] public bool AllowPercussion { get; set; } - [DataField("allowProgramChange")] + [DataField("allowProgramChange"), ViewVariables(VVAccess.ReadWrite)] public bool AllowProgramChange { get ; set; } - [DataField("respectMidiLimits")] + [DataField("respectMidiLimits"), ViewVariables(VVAccess.ReadWrite)] public bool RespectMidiLimits { get; set; } [ViewVariables(VVAccess.ReadWrite)] diff --git a/Resources/Changelog/Changelog.yml b/Resources/Changelog/Changelog.yml index b4e7ba7732..9a893de869 100644 --- a/Resources/Changelog/Changelog.yml +++ b/Resources/Changelog/Changelog.yml @@ -1,10 +1,4 @@ Entries: -- author: PJB - changes: - - {message: 'Restart round votes now start with everybody selecting "no", effectively - requiring 80% of the whole server to agree.', type: Tweak} - id: 271 - time: '2021-07-21T13:26:06.988275+00:00' - author: PJB changes: - {message: You can now only make the same type of vote once every 4 minutes., type: Tweak} @@ -2870,3 +2864,9 @@ Entries: - {message: Added three salvage maps, type: Add} id: 772 time: '2021-12-24T22:56:46.0000000+00:00' +- author: ShadowCommander + changes: + - {message: Rules popup on first connection now has a timer to make sure that they + get read., type: Tweak} + id: 773 + time: '2021-12-25T01:32:33.0000000+00:00' diff --git a/Resources/Locale/en-US/info/info-window.ftl b/Resources/Locale/en-US/info/info-window.ftl index fccbcdb06c..77446221ce 100644 --- a/Resources/Locale/en-US/info/info-window.ftl +++ b/Resources/Locale/en-US/info/info-window.ftl @@ -5,10 +5,6 @@ ui-info-title = Information ui-info-tab-rules = Server Rules ui-info-tab-tutorial = Tutorial -## Rules tab - -ui-info-header-rules = SS14 Official Server Rules - ## Tutorial tab ui-info-text-controls = You can review and rebind SS14s controls in the diff --git a/Resources/Locale/en-US/info/rules.ftl b/Resources/Locale/en-US/info/rules.ftl new file mode 100644 index 0000000000..9973bf8728 --- /dev/null +++ b/Resources/Locale/en-US/info/rules.ftl @@ -0,0 +1,5 @@ +# Rules + +ui-rules-header = SS14 Official Server Rules +ui-rules-accept = I have read and agree to follow the rules +ui-rules-wait = The accept button will be enabled after {$time} seconds.