diff --git a/Content.Client/Administration/UI/Tabs/AdminTab/RoleBanWindow.xaml.cs b/Content.Client/Administration/UI/Tabs/AdminTab/RoleBanWindow.xaml.cs index 888dc11c66..1a27579084 100644 --- a/Content.Client/Administration/UI/Tabs/AdminTab/RoleBanWindow.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/AdminTab/RoleBanWindow.xaml.cs @@ -42,7 +42,7 @@ public sealed partial class RoleBanWindow : DefaultWindow var prototypeManager = IoCManager.Resolve(); foreach (var proto in prototypeManager.EnumeratePrototypes()) { - CreateRoleGroup(proto.ID, proto.Roles.Select(x => x.Id), proto.Color); + CreateRoleGroup(proto.ID, proto.Roles, proto.Color); } CreateRoleGroup("Antagonist", prototypeManager.EnumeratePrototypes().Select(p => p.ID), diff --git a/Content.Client/Audio/AudioUIController.cs b/Content.Client/Audio/AudioUIController.cs index 16e1edd252..ef903672fd 100644 --- a/Content.Client/Audio/AudioUIController.cs +++ b/Content.Client/Audio/AudioUIController.cs @@ -54,7 +54,7 @@ public sealed class AudioUIController : UIController { if (!string.IsNullOrEmpty(value)) { - var resource = GetSoundOrFallback(value, CCVars.UIClickSound.DefaultValue); + var resource = _cache.GetResource(value); var source = _audioManager.CreateAudioSource(resource); @@ -77,7 +77,7 @@ public sealed class AudioUIController : UIController { if (!string.IsNullOrEmpty(value)) { - var hoverResource = GetSoundOrFallback(value, CCVars.UIHoverSound.DefaultValue); + var hoverResource = _cache.GetResource(value); var hoverSource = _audioManager.CreateAudioSource(hoverResource); @@ -95,12 +95,4 @@ public sealed class AudioUIController : UIController UIManager.SetHoverSound(null); } } - - private AudioResource GetSoundOrFallback(string path, string fallback) - { - if (!_cache.TryGetResource(path, out AudioResource? resource)) - return _cache.GetResource(fallback); - - return resource; - } } diff --git a/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs b/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs index ce2c64c6e5..84b787a4ec 100644 --- a/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs +++ b/Content.Client/Audio/ContentAudioSystem.AmbientMusic.cs @@ -31,8 +31,8 @@ public sealed partial class ContentAudioSystem [Dependency] private readonly RulesSystem _rules = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; - private readonly TimeSpan _minAmbienceTime = TimeSpan.FromSeconds(5); - private readonly TimeSpan _maxAmbienceTime = TimeSpan.FromSeconds(10); + private readonly TimeSpan _minAmbienceTime = TimeSpan.FromSeconds(30); + private readonly TimeSpan _maxAmbienceTime = TimeSpan.FromSeconds(60); private const float AmbientMusicFadeTime = 10f; private static float _volumeSlider; diff --git a/Content.Client/Input/ContentContexts.cs b/Content.Client/Input/ContentContexts.cs index 6756208a1a..fd6eee0e7b 100644 --- a/Content.Client/Input/ContentContexts.cs +++ b/Content.Client/Input/ContentContexts.cs @@ -82,7 +82,6 @@ namespace Content.Client.Input human.AddFunction(ContentKeyFunctions.Arcade3); human.AddFunction(ContentKeyFunctions.LieDown); // WD EDIT human.AddFunction(ContentKeyFunctions.OfferItem); // WD EDIT - human.AddFunction(ContentKeyFunctions.LookUp); // WD EDIT // actions should be common (for ghosts, mobs, etc) common.AddFunction(ContentKeyFunctions.OpenActionsMenu); diff --git a/Content.Client/LateJoin/LateJoinGui.cs b/Content.Client/LateJoin/LateJoinGui.cs index 225ac3eac2..7a1f463bfb 100644 --- a/Content.Client/LateJoin/LateJoinGui.cs +++ b/Content.Client/LateJoin/LateJoinGui.cs @@ -4,9 +4,7 @@ using Content.Client.CrewManifest; using Content.Client.GameTicking.Managers; using Content.Client.UserInterface.Controls; using Content.Client.Players.PlayTimeTracking; -using Content.Client.Preferences; using Content.Shared.CCVar; -using Content.Shared.Preferences; using Content.Shared.Roles; using Content.Shared.StatusIcon; using Robust.Client.Console; @@ -28,7 +26,6 @@ namespace Content.Client.LateJoin [Dependency] private readonly IConfigurationManager _configManager = default!; [Dependency] private readonly IEntitySystemManager _entitySystem = default!; [Dependency] private readonly JobRequirementsManager _jobRequirements = default!; - [Dependency] private readonly IClientPreferencesManager _preferencesManager = default!; public event Action<(NetEntity, string)> SelectedId; @@ -257,7 +254,7 @@ namespace Content.Client.LateJoin jobButton.OnPressed += _ => SelectedId.Invoke((id, jobButton.JobId)); - if (!_jobRequirements.IsAllowed(prototype, (HumanoidCharacterProfile?)_preferencesManager.Preferences?.SelectedCharacter, out var reason)) + if (!_jobRequirements.IsAllowed(prototype, out var reason)) { jobButton.Disabled = true; diff --git a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs index 2a077806a2..7cd48d338f 100644 --- a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs +++ b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs @@ -193,7 +193,6 @@ namespace Content.Client.Options.UI.Tabs AddButton(ContentKeyFunctions.SaveItemLocation); AddButton(ContentKeyFunctions.OfferItem); // WD EDIT AddButton(ContentKeyFunctions.LieDown); // WD EDIT - AddButton(ContentKeyFunctions.LookUp); // WD EDIT AddCheckBox("ui-options-function-auto-get-up", _cfg.GetCVar(WhiteCVars.AutoGetUp), HandleToggleAutoGetUp); // WD EDIT AddHeader("ui-options-header-interaction-adv"); diff --git a/Content.Client/PDA/PdaMenu.xaml.cs b/Content.Client/PDA/PdaMenu.xaml.cs index c62acd0fc5..630861d084 100644 --- a/Content.Client/PDA/PdaMenu.xaml.cs +++ b/Content.Client/PDA/PdaMenu.xaml.cs @@ -26,13 +26,13 @@ namespace Content.Client.PDA public const int ProgramContentView = 3; - private string _pdaOwnerName = Loc.GetString("comp-pda-ui-unknown"); + private string _pdaOwner = Loc.GetString("comp-pda-ui-unknown"); private string _owner = Loc.GetString("comp-pda-ui-unknown"); private string _jobTitle = Loc.GetString("comp-pda-ui-unassigned"); private string _stationName = Loc.GetString("comp-pda-ui-unknown"); private string _alertLevel = Loc.GetString("comp-pda-ui-unknown"); private string _instructions = Loc.GetString("comp-pda-ui-unknown"); - + private int _currentView; @@ -96,7 +96,7 @@ namespace Content.Client.PDA PdaOwnerButton.OnPressed += _ => { - _clipboard.SetText(_pdaOwnerName); + _clipboard.SetText(_pdaOwner); }; IdInfoButton.OnPressed += _ => @@ -125,7 +125,7 @@ namespace Content.Client.PDA _clipboard.SetText(_instructions); }; - + HideAllViews(); @@ -138,9 +138,9 @@ namespace Content.Client.PDA if (state.PdaOwnerInfo.ActualOwnerName != null) { - _pdaOwnerName = state.PdaOwnerInfo.ActualOwnerName; + _pdaOwner = state.PdaOwnerInfo.ActualOwnerName; PdaOwnerLabel.SetMarkup(Loc.GetString("comp-pda-ui-owner", - ("actualOwnerName", _pdaOwnerName))); + ("actualOwnerName", _pdaOwner))); } @@ -160,7 +160,7 @@ namespace Content.Client.PDA _stationName = state.StationName ?? Loc.GetString("comp-pda-ui-unknown"); StationNameLabel.SetMarkup(Loc.GetString("comp-pda-ui-station", ("station", _stationName))); - + var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan); diff --git a/Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs b/Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs index 2170ee377e..2da87d13ca 100644 --- a/Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs +++ b/Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs @@ -1,10 +1,8 @@ using System.Diagnostics.CodeAnalysis; using Content.Client.Administration.Managers; -using Content.Client.Lobby; using Content.Shared.CCVar; using Content.Shared.Players; using Content.Shared.Players.PlayTimeTracking; -using Content.Shared.Preferences; using Content.Shared.Roles; using Robust.Client; using Robust.Client.Player; @@ -24,7 +22,7 @@ public sealed class JobRequirementsManager : ISharedPlaytimeManager [Dependency] private readonly IEntityManager _entManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPrototypeManager _prototypes = default!; - [Dependency] private readonly IClientAdminManager _adminManager = default!; + [Dependency] private readonly IClientAdminManager _adminManager = default!; // WD private readonly Dictionary _roles = new(); private readonly List _roleBans = new(); @@ -42,6 +40,7 @@ public sealed class JobRequirementsManager : ISharedPlaytimeManager _net.RegisterNetMessage(RxPlayTime); _client.RunLevelChanged += ClientOnRunLevelChanged; + _adminManager.AdminStatusUpdated += () => Updated?.Invoke(); // WD } private void ClientOnRunLevelChanged(object? sender, RunLevelChangedEventArgs e) @@ -83,8 +82,7 @@ public sealed class JobRequirementsManager : ISharedPlaytimeManager Updated?.Invoke(); } - - public bool IsAllowed(JobPrototype job, HumanoidCharacterProfile? profile, [NotNullWhen(false)] out FormattedMessage? reason) + public bool IsAllowed(JobPrototype job, [NotNullWhen(false)] out FormattedMessage? reason) { reason = null; @@ -98,16 +96,11 @@ public sealed class JobRequirementsManager : ISharedPlaytimeManager if (player == null) return true; - return CheckRoleRequirements(job, profile, out reason); + return _adminManager.IsActive() || // WD + CheckRoleTime(job.Requirements, out reason); } - public bool CheckRoleRequirements(JobPrototype job, HumanoidCharacterProfile? profile, [NotNullWhen(false)] out FormattedMessage? reason) - { - var reqs = _entManager.System().GetJobRequirement(job); - return CheckRoleRequirements(reqs, profile, out reason); - } - - public bool CheckRoleRequirements(HashSet? requirements, HumanoidCharacterProfile? profile, [NotNullWhen(false)] out FormattedMessage? reason) + public bool CheckRoleTime(HashSet? requirements, [NotNullWhen(false)] out FormattedMessage? reason) { reason = null; @@ -115,13 +108,9 @@ public sealed class JobRequirementsManager : ISharedPlaytimeManager return true; var reasons = new List(); - var isAdmin = _adminManager.IsAdmin(true); // WD foreach (var requirement in requirements) { - if (requirement.IgnoreIfAdmin && isAdmin) // WD - continue; - - if (requirement.Check(_entManager, _prototypes, profile, _roles, out var jobReason)) + if (JobRequirements.TryRequirementMet(requirement, _roles, out var jobReason, _entManager, _prototypes)) continue; reasons.Add(jobReason.ToMarkup()); diff --git a/Content.Client/Preferences/UI/AntagPreferenceSelector.cs b/Content.Client/Preferences/UI/AntagPreferenceSelector.cs index 4829cec1aa..654c393b26 100644 --- a/Content.Client/Preferences/UI/AntagPreferenceSelector.cs +++ b/Content.Client/Preferences/UI/AntagPreferenceSelector.cs @@ -1,5 +1,4 @@ using Content.Client.Players.PlayTimeTracking; -using Content.Shared.Preferences; using Content.Shared.Roles; using Robust.Client.UserInterface.Controls; @@ -16,7 +15,7 @@ public sealed class AntagPreferenceSelector : RequirementsSelector? PreferenceChanged; - public AntagPreferenceSelector(AntagPrototype proto, ButtonGroup btnGroup, HumanoidCharacterProfile profile) + public AntagPreferenceSelector(AntagPrototype proto, ButtonGroup btnGroup) : base(proto, btnGroup) { Options.OnItemSelected += args => PreferenceChanged?.Invoke(Preference); @@ -29,12 +28,12 @@ public sealed class AntagPreferenceSelector : RequirementsSelector(); - if (!requirements.CheckRoleRequirements(proto.Requirements, profile, out var reason)) + if (proto.Requirements != null && !requirements.CheckRoleTime(proto.Requirements, out var reason)) { LockRequirements(reason); } diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs index 75254d8d3e..a2b118818a 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs @@ -557,16 +557,12 @@ namespace Content.Client.Preferences.UI _antagPreferences.Clear(); var btnGroup = new ButtonGroup(); - var character = (HumanoidCharacterProfile?) _preferencesManager.Preferences?.SelectedCharacter; - if (character == null) - return; - foreach (var antag in _prototypeManager.EnumeratePrototypes().OrderBy(a => Loc.GetString(a.Name))) { if (!antag.SetPreference) continue; - var selector = new AntagPreferenceSelector(antag, btnGroup, character) + var selector = new AntagPreferenceSelector(antag, btnGroup) { Margin = new Thickness(3f, 3f, 3f, 0f), }; @@ -594,10 +590,6 @@ namespace Content.Client.Preferences.UI _jobCategories.Clear(); var firstCategory = true; - var character = (HumanoidCharacterProfile?) _preferencesManager.Preferences?.SelectedCharacter; - if (character == null) - return; - var departments = _prototypeManager.EnumeratePrototypes().ToArray(); Array.Sort(departments, DepartmentUIComparer.Instance); @@ -658,12 +650,12 @@ namespace Content.Client.Preferences.UI // Clone so we don't modify the underlying loadout. Profile?.Loadouts.TryGetValue(LoadoutSystem.GetJobPrototype(job.ID), out loadout); loadout = loadout?.Clone(); - var selector = new JobPrioritySelector(loadout, job, jobLoadoutGroup, _prototypeManager, character) + var selector = new JobPrioritySelector(loadout, job, jobLoadoutGroup, _prototypeManager) { Margin = new Thickness(3f, 3f, 3f, 0f), }; - if (!_requirements.IsAllowed(job, (HumanoidCharacterProfile?)_preferencesManager.Preferences?.SelectedCharacter, out var reason)) + if (!_requirements.IsAllowed(job, out var reason)) { selector.LockRequirements(reason); } diff --git a/Content.Client/Preferences/UI/JobPrioritySelector.cs b/Content.Client/Preferences/UI/JobPrioritySelector.cs index e15b934e8d..243c78f07e 100644 --- a/Content.Client/Preferences/UI/JobPrioritySelector.cs +++ b/Content.Client/Preferences/UI/JobPrioritySelector.cs @@ -20,7 +20,7 @@ public sealed class JobPrioritySelector : RequirementsSelector public event Action? PriorityChanged; - public JobPrioritySelector(RoleLoadout? loadout, JobPrototype proto, ButtonGroup btnGroup, IPrototypeManager protoMan, HumanoidCharacterProfile profile) + public JobPrioritySelector(RoleLoadout? loadout, JobPrototype proto, ButtonGroup btnGroup, IPrototypeManager protoMan) : base(proto, btnGroup) { Options.OnItemSelected += args => PriorityChanged?.Invoke(Priority); @@ -41,6 +41,6 @@ public sealed class JobPrioritySelector : RequirementsSelector var jobIcon = protoMan.Index(proto.Icon); icon.Texture = jobIcon.Icon.Frame0(); - Setup(loadout, profile, items, proto.LocalizedName, 200, proto.LocalizedDescription, icon); + Setup(loadout, items, proto.LocalizedName, 200, proto.LocalizedDescription, icon); } } diff --git a/Content.Client/Preferences/UI/LoadoutGroupContainer.xaml.cs b/Content.Client/Preferences/UI/LoadoutGroupContainer.xaml.cs index 9e903788a6..8511fbc304 100644 --- a/Content.Client/Preferences/UI/LoadoutGroupContainer.xaml.cs +++ b/Content.Client/Preferences/UI/LoadoutGroupContainer.xaml.cs @@ -1,6 +1,5 @@ using System.Linq; using Content.Shared.Clothing; -using Content.Shared.Preferences; using Content.Shared.Preferences.Loadouts; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.Controls; @@ -18,18 +17,18 @@ public sealed partial class LoadoutGroupContainer : BoxContainer public event Action>? OnLoadoutPressed; public event Action>? OnLoadoutUnpressed; - public LoadoutGroupContainer(HumanoidCharacterProfile profile, RoleLoadout loadout, LoadoutGroupPrototype groupProto, ICommonSession session, IDependencyCollection collection) + public LoadoutGroupContainer(RoleLoadout loadout, LoadoutGroupPrototype groupProto, ICommonSession session, IDependencyCollection collection) { RobustXamlLoader.Load(this); _groupProto = groupProto; - RefreshLoadouts(profile, loadout, session, collection); + RefreshLoadouts(loadout, session, collection); } /// /// Updates button availabilities and buttons. /// - public void RefreshLoadouts(HumanoidCharacterProfile profile, RoleLoadout loadout, ICommonSession session, IDependencyCollection collection) + public void RefreshLoadouts(RoleLoadout loadout, ICommonSession session, IDependencyCollection collection) { var protoMan = collection.Resolve(); var loadoutSystem = collection.Resolve().System(); @@ -75,7 +74,7 @@ public sealed partial class LoadoutGroupContainer : BoxContainer var matchingLoadout = selected.FirstOrDefault(e => e.Prototype == loadoutProto); var pressed = matchingLoadout != null; - var enabled = loadout.IsValid(profile, session, loadoutProto, collection, out var reason); + var enabled = loadout.IsValid(session, loadoutProto, collection, out var reason); var loadoutContainer = new LoadoutContainer(loadoutProto, !enabled, reason); loadoutContainer.Select.Pressed = pressed; loadoutContainer.Text = loadoutSystem.GetName(loadProto); diff --git a/Content.Client/Preferences/UI/LoadoutWindow.xaml.cs b/Content.Client/Preferences/UI/LoadoutWindow.xaml.cs index f732ae2adb..79f1e4a833 100644 --- a/Content.Client/Preferences/UI/LoadoutWindow.xaml.cs +++ b/Content.Client/Preferences/UI/LoadoutWindow.xaml.cs @@ -1,6 +1,5 @@ using Content.Client.Lobby; using Content.Client.UserInterface.Controls; -using Content.Shared.Preferences; using Content.Shared.Preferences.Loadouts; using Content.Shared.Preferences.Loadouts.Effects; using Robust.Client.AutoGenerated; @@ -18,12 +17,9 @@ public sealed partial class LoadoutWindow : FancyWindow private List _groups = new(); - public HumanoidCharacterProfile Profile; - - public LoadoutWindow(HumanoidCharacterProfile profile, RoleLoadout loadout, RoleLoadoutPrototype proto, ICommonSession session, IDependencyCollection collection) + public LoadoutWindow(RoleLoadout loadout, RoleLoadoutPrototype proto, ICommonSession session, IDependencyCollection collection) { RobustXamlLoader.Load(this); - Profile = profile; var protoManager = collection.Resolve(); foreach (var group in proto.Groups) @@ -31,7 +27,7 @@ public sealed partial class LoadoutWindow : FancyWindow if (!protoManager.TryIndex(group, out var groupProto)) continue; - var container = new LoadoutGroupContainer(profile, loadout, protoManager.Index(group), session, collection); + var container = new LoadoutGroupContainer(loadout, protoManager.Index(group), session, collection); LoadoutGroupsContainer.AddTab(container, Loc.GetString(groupProto.Name)); _groups.Add(container); @@ -58,7 +54,7 @@ public sealed partial class LoadoutWindow : FancyWindow { foreach (var group in _groups) { - group.RefreshLoadouts(Profile, loadout, session, collection); + group.RefreshLoadouts(loadout, session, collection); } } } diff --git a/Content.Client/Preferences/UI/RequirementsSelector.cs b/Content.Client/Preferences/UI/RequirementsSelector.cs index 2b0ae7eb1d..e016661ee6 100644 --- a/Content.Client/Preferences/UI/RequirementsSelector.cs +++ b/Content.Client/Preferences/UI/RequirementsSelector.cs @@ -3,7 +3,6 @@ using Content.Client.Lobby; using Content.Client.Stylesheets; using Content.Client.UserInterface.Controls; using Content.Shared.Clothing; -using Content.Shared.Preferences; using Content.Shared.Preferences.Loadouts; using Content.Shared.Preferences.Loadouts.Effects; using Content.Shared.Roles; @@ -76,7 +75,7 @@ public abstract class RequirementsSelector : BoxContainer where T : IPrototyp /// /// Actually adds the controls, must be called in the inheriting class' constructor. /// - protected void Setup(RoleLoadout? loadout, HumanoidCharacterProfile profile, (string, int)[] items, string title, int titleSize, string? description, TextureRect? icon = null) + protected void Setup(RoleLoadout? loadout, (string, int)[] items, string title, int titleSize, string? description, TextureRect? icon = null) { _loadout = loadout; @@ -132,7 +131,7 @@ public abstract class RequirementsSelector : BoxContainer where T : IPrototyp _loadout ??= new RoleLoadout(LoadoutSystem.GetJobPrototype(Proto.ID)); _loadout.SetDefault(protoManager); - _loadoutWindow = new LoadoutWindow(profile, _loadout, protoManager.Index(_loadout.Role), session, collection) + _loadoutWindow = new LoadoutWindow(_loadout, protoManager.Index(_loadout.Role), session, collection) { Title = Loc.GetString(Proto.ID + "-loadout"), }; @@ -151,7 +150,7 @@ public abstract class RequirementsSelector : BoxContainer where T : IPrototyp if (!_loadout.RemoveLoadout(selectedGroup, selectedLoadout, protoManager)) return; - _loadout.EnsureValid(profile, session, collection); + _loadout.EnsureValid(session, collection); _loadoutWindow.RefreshLoadouts(_loadout, session, collection); var controller = UserInterfaceManager.GetUIController(); controller.ReloadProfile(); @@ -163,7 +162,7 @@ public abstract class RequirementsSelector : BoxContainer where T : IPrototyp if (!_loadout.AddLoadout(selectedGroup, selectedLoadout, protoManager)) return; - _loadout.EnsureValid(profile, session, collection); + _loadout.EnsureValid(session, collection); _loadoutWindow.RefreshLoadouts(_loadout, session, collection); var controller = UserInterfaceManager.GetUIController(); controller.ReloadProfile(); diff --git a/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs b/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs index 403d842fb5..1200fa0d96 100644 --- a/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs +++ b/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs @@ -23,7 +23,6 @@ using Content.Shared._White; using Content.Shared._White.Cult.Components; using Content.Shared._White.Utils; using Content.Shared._White.Cult.Systems; -using Content.Shared._White.Radio; using Robust.Client.Graphics; using Robust.Client.Input; using Robust.Client.Player; @@ -576,12 +575,6 @@ public sealed class ChatUIController : UIController FilterableChannels |= ChatChannel.Changeling; CanSendChannels |= ChatSelectChannel.Changeling; } - - if (_entities.HasComponent(localEnt)) - { - FilterableChannels |= ChatChannel.Network; - CanSendChannels |= ChatSelectChannel.Network; - } // WD EDIT END SelectableChannels = CanSendChannels; diff --git a/Content.Client/UserInterface/Systems/Chat/Controls/ChannelFilterPopup.xaml.cs b/Content.Client/UserInterface/Systems/Chat/Controls/ChannelFilterPopup.xaml.cs index 95898ad512..9e38651743 100644 --- a/Content.Client/UserInterface/Systems/Chat/Controls/ChannelFilterPopup.xaml.cs +++ b/Content.Client/UserInterface/Systems/Chat/Controls/ChannelFilterPopup.xaml.cs @@ -24,11 +24,8 @@ public sealed partial class ChannelFilterPopup : Popup ChatChannel.AdminAlert, ChatChannel.AdminChat, ChatChannel.Server, - // WD EDIT START ChatChannel.Changeling, - ChatChannel.Cult, - ChatChannel.Network - // WD EDIT END + ChatChannel.Cult // WD EDIT }; private readonly Dictionary _filterStates = new(); diff --git a/Content.Client/UserInterface/Systems/Ghost/Controls/Roles/GhostRolesEui.cs b/Content.Client/UserInterface/Systems/Ghost/Controls/Roles/GhostRolesEui.cs index 6b183362e5..33358a68a4 100644 --- a/Content.Client/UserInterface/Systems/Ghost/Controls/Roles/GhostRolesEui.cs +++ b/Content.Client/UserInterface/Systems/Ghost/Controls/Roles/GhostRolesEui.cs @@ -93,7 +93,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles bool hasAccess = true; FormattedMessage? reason; - if (!requirementsManager.CheckRoleRequirements(group.Key.Requirements, null, out reason)) + if (!requirementsManager.CheckRoleTime(group.Key.Requirements, out reason)) { hasAccess = false; } diff --git a/Content.Client/_White/CartridgeLoader/Cartridges/MessagesUi.cs b/Content.Client/_White/CartridgeLoader/Cartridges/MessagesUi.cs deleted file mode 100644 index b444d3ccc5..0000000000 --- a/Content.Client/_White/CartridgeLoader/Cartridges/MessagesUi.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Content.Client.UserInterface.Fragments; -using Content.Shared._White.CartridgeLoader.Cartridges; -using Content.Shared.CartridgeLoader; -using Robust.Client.UserInterface; - -namespace Content.Client._White.CartridgeLoader.Cartridges; - -public sealed partial class MessagesUi : UIFragment -{ - private MessagesUiFragment _fragment; - - public override Control GetUIFragmentRoot() - { - return _fragment; - } - - public override void Setup(BoundUserInterface userInterface, EntityUid? fragmentOwner) - { - _fragment = new MessagesUiFragment(); - _fragment.OnMessageSent += note => SendMessagesMessage(MessagesUiAction.Send, note, null, userInterface); - _fragment.OnButtonPressed += userUid => SendMessagesMessage(MessagesUiAction.ChangeChat, null, userUid, userInterface); - } - - public override void UpdateState(BoundUserInterfaceState state) - { - if (state is not MessagesUiState messagesState) - return; - - _fragment.UpdateState(messagesState.Mode, messagesState.Users, messagesState.Messages, messagesState.Name); - } - - private void SendMessagesMessage(MessagesUiAction action, string? stringInput, int? uidInput, BoundUserInterface userInterface) - { - var messagesMessage = new MessagesUiMessageEvent(action, stringInput, uidInput); - var message = new CartridgeUiMessage(messagesMessage); - userInterface.SendMessage(message); - } -} diff --git a/Content.Client/_White/CartridgeLoader/Cartridges/MessagesUiFragment.cs b/Content.Client/_White/CartridgeLoader/Cartridges/MessagesUiFragment.cs deleted file mode 100644 index 5cbb77167b..0000000000 --- a/Content.Client/_White/CartridgeLoader/Cartridges/MessagesUiFragment.cs +++ /dev/null @@ -1,125 +0,0 @@ -using System.Numerics; -using Robust.Client.AutoGenerated; -using Robust.Client.UserInterface.Controls; -using Robust.Client.UserInterface.XAML; -using Content.Shared._White.CartridgeLoader.Cartridges; -using Content.Shared.Roles; -using Robust.Shared.Prototypes; - -namespace Content.Client._White.CartridgeLoader.Cartridges; - -[GenerateTypedNameReferences] -public sealed partial class MessagesUiFragment : BoxContainer -{ - public event Action? OnMessageSent; - public event Action? OnButtonPressed; - - private string _searchText = string.Empty; - - public MessagesUiFragment() - { - RobustXamlLoader.Load(this); - Input.OnTextEntered += _ => - { - if (!string.IsNullOrEmpty(Input.Text)) - OnMessageSent?.Invoke(Input.Text); - Input.Clear(); - }; - - BackButton.OnPressed += _ => OnButtonPressed?.Invoke(null); - SearchBar.OnTextChanged += OnSearchTextChanged; - - UpdateState(MessagesUiStateMode.UserList, [], [], null); - } - - public void UpdateState(MessagesUiStateMode mode, List<(MessagesUserData, int?)>? users, List<(string, int?)>? messages, string? name) - { - MessageContainer.DisposeAllChildren(); - Input.Orphan(); - BackButton.Orphan(); - - SearchBar.Visible = false; - - if (mode == MessagesUiStateMode.Chat && messages != null) - { - HeaderLabel.Text = name; - - foreach (var (senderName, message) in messages) - { - AddNote($"{senderName} {message}"); - } - - OverContainer.AddChild(Input); - HeaderBox.AddChild(BackButton); - BackButton.SetPositionInParent(0); - } - else if (mode == MessagesUiStateMode.Error) - { - HeaderLabel.Text = Loc.GetString("messages-pda-error-header"); - AddNote(Loc.GetString("messages-pda-error-message")); - } - else if (mode == MessagesUiStateMode.UserList && users != null) - { - SearchBar.Visible = true; - HeaderLabel.Text = Loc.GetString("messages-pda-chat-choice"); - foreach (var (messagesUser, userUid) in users) - { - AddButton(userUid, messagesUser.Name + ", " + messagesUser.Job, messagesUser.Department); - } - } - } - - /// - /// Adding a button for selecting a chat - /// - private void AddButton(int? userUid, string userName, string departmentId) - { - var styleClass = IoCManager.Resolve().Index(departmentId).ButtonStyle; - - var button = new Button - { - Text = userName, - HorizontalExpand = true, - ClipText = true, - StyleClasses = { styleClass }, - MinWidth = 60 - }; - button.OnPressed += _ => OnButtonPressed?.Invoke(userUid); - MessageContainer.AddChild(button); - } - - /// - /// Adding a text label to the message container - /// - private void AddNote(string note) - { - MessageContainer.AddChild(new Label - { - Text = note, - HorizontalExpand = true, - ClipText = false - }); - } - - private bool ButtonIsVisible(Button button) - { - return string.IsNullOrEmpty(_searchText) || button.Text == null || button.Text.Contains(_searchText, StringComparison.OrdinalIgnoreCase); - } - - private void UpdateVisibleButtons() - { - foreach (var child in MessageContainer.Children) - { - if (child is Button button) - button.Visible = ButtonIsVisible(button); - } - } - - private void OnSearchTextChanged(LineEdit.LineEditEventArgs args) - { - _searchText = args.Text; - - UpdateVisibleButtons(); - MessagesScroll.SetScrollValue(Vector2.Zero); - } -} diff --git a/Content.Client/_White/CartridgeLoader/Cartridges/MessagesUiFragment.xaml b/Content.Client/_White/CartridgeLoader/Cartridges/MessagesUiFragment.xaml deleted file mode 100644 index 2871d8693b..0000000000 --- a/Content.Client/_White/CartridgeLoader/Cartridges/MessagesUiFragment.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - - - -