diff --git a/Content.Client/Alerts/ClientAlertsSystem.cs b/Content.Client/Alerts/ClientAlertsSystem.cs index ab296a96195..237f24e3eae 100644 --- a/Content.Client/Alerts/ClientAlertsSystem.cs +++ b/Content.Client/Alerts/ClientAlertsSystem.cs @@ -33,7 +33,7 @@ protected override void LoadPrototypes() AlertOrder = _prototypeManager.EnumeratePrototypes().FirstOrDefault(); if (AlertOrder == null) - Log.Error("alert", "no alertOrder prototype found, alerts will be in random order"); + Log.Error("No alertOrder prototype found, alerts will be in random order"); } public IReadOnlyDictionary? ActiveAlerts diff --git a/Content.Client/Audio/ContentAudioSystem.cs b/Content.Client/Audio/ContentAudioSystem.cs index c7fc7bcf739..f62b34b492c 100644 --- a/Content.Client/Audio/ContentAudioSystem.cs +++ b/Content.Client/Audio/ContentAudioSystem.cs @@ -107,7 +107,7 @@ public void FadeIn(EntityUid? stream, AudioComponent? component = null, float du _fadingOut.Remove(stream.Value); var curVolume = component.Volume; - var change = (curVolume - MinVolume) / duration; + var change = (MinVolume - curVolume) / duration; _fadingIn.Add(stream.Value, (change, component.Volume)); component.Volume = MinVolume; } @@ -151,8 +151,8 @@ private void UpdateFades(float frameTime) continue; } - var volume = component.Volume + change * frameTime; - volume = MathF.Max(target, volume); + var volume = component.Volume - change * frameTime; + volume = MathF.Min(target, volume); _audio.SetVolume(stream, volume, component); if (component.Volume.Equals(target)) diff --git a/Content.Client/CardboardBox/CardboardBoxSystem.cs b/Content.Client/CardboardBox/CardboardBoxSystem.cs index 50f9de239d5..90a21d8e41b 100644 --- a/Content.Client/CardboardBox/CardboardBoxSystem.cs +++ b/Content.Client/CardboardBox/CardboardBoxSystem.cs @@ -1,4 +1,4 @@ -using System.Numerics; +using System.Numerics; using Content.Shared.CardboardBox; using Content.Shared.CardboardBox.Components; using Content.Shared.Examine; @@ -11,6 +11,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem { [Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly TransformSystem _transform = default!; + [Dependency] private readonly ExamineSystemShared _examine = default!; public override void Initialize() { @@ -55,7 +56,7 @@ private void OnBoxEffect(PlayBoxEffectMessage msg) foreach (var mob in mobMoverEntities) { var mapPos = _transform.GetMapCoordinates(mob); - if (!ExamineSystemShared.InRangeUnOccluded(sourcePos, mapPos, box.Distance, null)) + if (!_examine.InRangeUnOccluded(sourcePos, mapPos, box.Distance, null)) continue; var ent = Spawn(box.Effect, mapPos); diff --git a/Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs b/Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs index baf0d31f1f1..e60335bc45c 100644 --- a/Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs +++ b/Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs @@ -93,7 +93,7 @@ public void PopulateProducts() if (search.Length == 0 && _category == null || search.Length != 0 && prototype.Name.ToLowerInvariant().Contains(search) || search.Length != 0 && prototype.Description.ToLowerInvariant().Contains(search) || - search.Length == 0 && _category != null && prototype.Category.Equals(_category)) + search.Length == 0 && _category != null && Loc.GetString(prototype.Category).Equals(_category)) { var button = new CargoProductRow { @@ -122,7 +122,7 @@ public void PopulateCategories() foreach (var prototype in ProductPrototypes) { - if (!_categoryStrings.Contains(prototype.Category)) + if (!_categoryStrings.Contains(Loc.GetString(prototype.Category))) { _categoryStrings.Add(Loc.GetString(prototype.Category)); } diff --git a/Content.Client/Chat/UI/SpeechBubble.cs b/Content.Client/Chat/UI/SpeechBubble.cs index 82eccbcec84..68c937a7885 100644 --- a/Content.Client/Chat/UI/SpeechBubble.cs +++ b/Content.Client/Chat/UI/SpeechBubble.cs @@ -252,7 +252,8 @@ protected override Control BuildBubble(ChatMessage message, string speechStyleCl var bubbleContent = new RichTextLabel { MaxWidth = SpeechMaxWidth, - Margin = new Thickness(2, 6, 2, 2) + Margin = new Thickness(2, 6, 2, 2), + StyleClasses = { "bubbleContent" } }; //We'll be honest. *Yes* this is hacky. Doing this in a cleaner way would require a bottom-up refactor of how saycode handles sending chat messages. -Myr diff --git a/Content.Client/Clothing/ClientClothingSystem.cs b/Content.Client/Clothing/ClientClothingSystem.cs index 979f7430e17..fbe9d5ec5bb 100644 --- a/Content.Client/Clothing/ClientClothingSystem.cs +++ b/Content.Client/Clothing/ClientClothingSystem.cs @@ -271,7 +271,7 @@ private void RenderEquipment(EntityUid equipee, EntityUid equipment, string slot { if (!revealedLayers.Add(key)) { - Logger.Warning($"Duplicate key for clothing visuals: {key}. Are multiple components attempting to modify the same layer? Equipment: {ToPrettyString(equipment)}"); + Log.Warning($"Duplicate key for clothing visuals: {key}. Are multiple components attempting to modify the same layer? Equipment: {ToPrettyString(equipment)}"); continue; } @@ -281,6 +281,9 @@ private void RenderEquipment(EntityUid equipee, EntityUid equipment, string slot // note that every insertion requires reshuffling & remapping all the existing layers. sprite.AddBlankLayer(index); sprite.LayerMapSet(key, index); + + if (layerData.Color != null) + sprite.LayerSetColor(key, layerData.Color.Value); } else index = sprite.LayerMapReserveBlank(key); diff --git a/Content.Client/CriminalRecords/CriminalRecordsConsoleBoundUserInterface.cs b/Content.Client/CriminalRecords/CriminalRecordsConsoleBoundUserInterface.cs index 88b9c90c2ff..9047624f49b 100644 --- a/Content.Client/CriminalRecords/CriminalRecordsConsoleBoundUserInterface.cs +++ b/Content.Client/CriminalRecords/CriminalRecordsConsoleBoundUserInterface.cs @@ -37,8 +37,8 @@ protected override void Open() SendMessage(new SetStationRecordFilter(type, filterValue)); _window.OnStatusSelected += status => SendMessage(new CriminalRecordChangeStatus(status, null)); - _window.OnDialogConfirmed += (_, reason) => - SendMessage(new CriminalRecordChangeStatus(SecurityStatus.Wanted, reason)); + _window.OnDialogConfirmed += (status, reason) => + SendMessage(new CriminalRecordChangeStatus(status, reason)); _window.OnHistoryUpdated += UpdateHistory; _window.OnHistoryClosed += () => _historyWindow?.Close(); _window.OnClose += Close; diff --git a/Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml.cs b/Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml.cs index 61b5c383315..b259e08e723 100644 --- a/Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml.cs +++ b/Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml.cs @@ -219,16 +219,16 @@ private void FilterListingOfRecords(string text = "") private void SetStatus(SecurityStatus status) { - if (status == SecurityStatus.Wanted) + if (status == SecurityStatus.Wanted || status == SecurityStatus.Suspected) { - GetWantedReason(); + GetReason(status); return; } OnStatusSelected?.Invoke(status); } - private void GetWantedReason() + private void GetReason(SecurityStatus status) { if (_reasonDialog != null) { @@ -237,7 +237,7 @@ private void GetWantedReason() } var field = "reason"; - var title = Loc.GetString("criminal-records-status-wanted"); + var title = Loc.GetString("criminal-records-status-" + status.ToString().ToLower()); var placeholders = _proto.Index(ReasonPlaceholders); var placeholder = Loc.GetString("criminal-records-console-reason-placeholder", ("placeholder", _random.Pick(placeholders.Values))); // just funny it doesn't actually get used var prompt = Loc.GetString("criminal-records-console-reason"); @@ -251,7 +251,7 @@ private void GetWantedReason() if (reason.Length < 1 || reason.Length > _maxLength) return; - OnDialogConfirmed?.Invoke(SecurityStatus.Wanted, reason); + OnDialogConfirmed?.Invoke(status, reason); }; _reasonDialog.OnClose += () => { _reasonDialog = null; }; diff --git a/Content.Client/DoAfter/DoAfterOverlay.cs b/Content.Client/DoAfter/DoAfterOverlay.cs index 2957dafdb7a..2e23dd44cac 100644 --- a/Content.Client/DoAfter/DoAfterOverlay.cs +++ b/Content.Client/DoAfter/DoAfterOverlay.cs @@ -1,9 +1,9 @@ using System.Numerics; using Content.Shared.DoAfter; +using Content.Client.UserInterface.Systems; using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Shared.Enums; -using Robust.Shared.Graphics; using Robust.Client.Player; using Robust.Shared.Prototypes; using Robust.Shared.Timing; @@ -18,6 +18,7 @@ public sealed class DoAfterOverlay : Overlay private readonly IPlayerManager _player; private readonly SharedTransformSystem _transform; private readonly MetaDataSystem _meta; + private readonly ProgressColorSystem _progressColor; private readonly Texture _barTexture; private readonly ShaderInstance _shader; @@ -40,6 +41,7 @@ public DoAfterOverlay(IEntityManager entManager, IPrototypeManager protoManager, _player = player; _transform = _entManager.EntitySysManager.GetEntitySystem(); _meta = _entManager.EntitySysManager.GetEntitySystem(); + _progressColor = _entManager.System(); var sprite = new SpriteSpecifier.Rsi(new("/Textures/Interface/Misc/progress_bar.rsi"), "icon"); _barTexture = _entManager.EntitySysManager.GetEntitySystem().Frame0(sprite); @@ -125,7 +127,7 @@ protected override void Draw(in OverlayDrawArgs args) elapsedRatio = (float) Math.Min(1, elapsed.TotalSeconds / doAfter.Args.Delay.TotalSeconds); var cancelElapsed = (time - doAfter.CancelledTime.Value).TotalSeconds; var flash = Math.Floor(cancelElapsed / FlashTime) % 2 == 0; - color = new Color(1f, 0f, 0f, flash ? alpha : 0f); + color = GetProgressColor(0, flash ? alpha : 0); } else { @@ -146,14 +148,8 @@ protected override void Draw(in OverlayDrawArgs args) handle.SetTransform(Matrix3.Identity); } - public static Color GetProgressColor(float progress, float alpha = 1f) + public Color GetProgressColor(float progress, float alpha = 1f) { - if (progress >= 1.0f) - { - return new Color(0f, 1f, 0f, alpha); - } - // lerp - var hue = (5f / 18f) * progress; - return Color.FromHsv((hue, 1f, 0.75f, alpha)); + return _progressColor.GetProgressColor(progress).WithAlpha(alpha); } } diff --git a/Content.Client/Drugs/DrugOverlaySystem.cs b/Content.Client/Drugs/DrugOverlaySystem.cs index 9bfa4fdf827..60fdf12f5e3 100644 --- a/Content.Client/Drugs/DrugOverlaySystem.cs +++ b/Content.Client/Drugs/DrugOverlaySystem.cs @@ -38,6 +38,7 @@ private void OnPlayerAttached(EntityUid uid, SeeingRainbowsComponent component, private void OnPlayerDetached(EntityUid uid, SeeingRainbowsComponent component, LocalPlayerDetachedEvent args) { _overlay.Intoxication = 0; + _overlay.TimeTicker = 0; _overlayMan.RemoveOverlay(_overlay); } @@ -52,6 +53,7 @@ private void OnShutdown(EntityUid uid, SeeingRainbowsComponent component, Compon if (_player.LocalEntity == uid) { _overlay.Intoxication = 0; + _overlay.TimeTicker = 0; _overlayMan.RemoveOverlay(_overlay); } } diff --git a/Content.Client/Drugs/RainbowOverlay.cs b/Content.Client/Drugs/RainbowOverlay.cs index 6ef5d0f65ce..e62b0dfa66c 100644 --- a/Content.Client/Drugs/RainbowOverlay.cs +++ b/Content.Client/Drugs/RainbowOverlay.cs @@ -20,6 +20,7 @@ public sealed class RainbowOverlay : Overlay private readonly ShaderInstance _rainbowShader; public float Intoxication = 0.0f; + public float TimeTicker = 0.0f; private const float VisualThreshold = 10.0f; private const float PowerDivisor = 250.0f; @@ -48,7 +49,17 @@ protected override void FrameUpdate(FrameEventArgs args) return; var timeLeft = (float) (time.Value.Item2 - time.Value.Item1).TotalSeconds; - Intoxication += (timeLeft - Intoxication) * args.DeltaSeconds / 16f; + + TimeTicker += args.DeltaSeconds; + + if (timeLeft - TimeTicker > timeLeft / 16f) + { + Intoxication += (timeLeft - Intoxication) * args.DeltaSeconds / 16f; + } + else + { + Intoxication -= Intoxication/(timeLeft - TimeTicker) * args.DeltaSeconds; + } } protected override bool BeforeDraw(in OverlayDrawArgs args) diff --git a/Content.Client/IconSmoothing/IconSmoothSystem.cs b/Content.Client/IconSmoothing/IconSmoothSystem.cs index 7334c2fd432..0ab33c65202 100644 --- a/Content.Client/IconSmoothing/IconSmoothSystem.cs +++ b/Content.Client/IconSmoothing/IconSmoothSystem.cs @@ -231,7 +231,7 @@ private void CalculateNewSprite(EntityUid uid, if (!spriteQuery.TryGetComponent(uid, out var sprite)) { - Logger.Error($"Encountered a icon-smoothing entity without a sprite: {ToPrettyString(uid)}"); + Log.Error($"Encountered a icon-smoothing entity without a sprite: {ToPrettyString(uid)}"); RemCompDeferred(uid, smooth); return; } @@ -242,7 +242,7 @@ private void CalculateNewSprite(EntityUid uid, { if (!_mapManager.TryGetGrid(xform.GridUid, out grid)) { - Logger.Error($"Failed to calculate IconSmoothComponent sprite in {uid} because grid {xform.GridUid} was missing."); + Log.Error($"Failed to calculate IconSmoothComponent sprite in {uid} because grid {xform.GridUid} was missing."); return; } } diff --git a/Content.Client/Info/InfoSystem.cs b/Content.Client/Info/InfoSystem.cs index 4572f3afdca..b6979949818 100644 --- a/Content.Client/Info/InfoSystem.cs +++ b/Content.Client/Info/InfoSystem.cs @@ -12,13 +12,13 @@ public override void Initialize() { base.Initialize(); SubscribeNetworkEvent(OnRulesReceived); - Logger.DebugS("info", "Requested server info."); + Log.Debug("Requested server info."); RaiseNetworkEvent(new RequestRulesMessage()); } private void OnRulesReceived(RulesMessage message, EntitySessionEventArgs eventArgs) { - Logger.DebugS("info", "Received server rules."); + Log.Debug("Received server rules."); Rules = message; _rules.UpdateRules(); } diff --git a/Content.Client/Launcher/LauncherConnecting.cs b/Content.Client/Launcher/LauncherConnecting.cs index 9625f9e31c5..29b241ae5df 100644 --- a/Content.Client/Launcher/LauncherConnecting.cs +++ b/Content.Client/Launcher/LauncherConnecting.cs @@ -54,6 +54,7 @@ private set public event Action? PageChanged; public event Action? ConnectFailReasonChanged; public event Action? ConnectionStateChanged; + public event Action? ConnectFailed; protected override void Startup() { @@ -85,6 +86,7 @@ private void OnConnectFailed(object? _, NetConnectFailArgs args) } ConnectFailReason = args.Reason; CurrentPage = Page.ConnectFailed; + ConnectFailed?.Invoke(args); } private void OnConnectStateChanged(ClientConnectionState state) diff --git a/Content.Client/Launcher/LauncherConnectingGui.xaml b/Content.Client/Launcher/LauncherConnectingGui.xaml index 083e4ca8717..3734fa5b3ad 100644 --- a/Content.Client/Launcher/LauncherConnectingGui.xaml +++ b/Content.Client/Launcher/LauncherConnectingGui.xaml @@ -33,10 +33,6 @@