Skip to content

Commit 11241b2

Browse files
DebugOkDangerRevolution
authored andcommitted
Merge pull request #973 from DebugOk/2024/03/15-merge-upstream
Merge upstream
1 parent 0548c63 commit 11241b2

File tree

451 files changed

+13030
-8893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

451 files changed

+13030
-8893
lines changed

Content.Client/Alerts/ClientAlertsSystem.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected override void LoadPrototypes()
3333

3434
AlertOrder = _prototypeManager.EnumeratePrototypes<AlertOrderPrototype>().FirstOrDefault();
3535
if (AlertOrder == null)
36-
Log.Error("alert", "no alertOrder prototype found, alerts will be in random order");
36+
Log.Error("No alertOrder prototype found, alerts will be in random order");
3737
}
3838

3939
public IReadOnlyDictionary<AlertKey, AlertState>? ActiveAlerts

Content.Client/Audio/ContentAudioSystem.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public void FadeIn(EntityUid? stream, AudioComponent? component = null, float du
107107

108108
_fadingOut.Remove(stream.Value);
109109
var curVolume = component.Volume;
110-
var change = (curVolume - MinVolume) / duration;
110+
var change = (MinVolume - curVolume) / duration;
111111
_fadingIn.Add(stream.Value, (change, component.Volume));
112112
component.Volume = MinVolume;
113113
}
@@ -151,8 +151,8 @@ private void UpdateFades(float frameTime)
151151
continue;
152152
}
153153

154-
var volume = component.Volume + change * frameTime;
155-
volume = MathF.Max(target, volume);
154+
var volume = component.Volume - change * frameTime;
155+
volume = MathF.Min(target, volume);
156156
_audio.SetVolume(stream, volume, component);
157157

158158
if (component.Volume.Equals(target))

Content.Client/CardboardBox/CardboardBoxSystem.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Numerics;
1+
using System.Numerics;
22
using Content.Shared.CardboardBox;
33
using Content.Shared.CardboardBox.Components;
44
using Content.Shared.Examine;
@@ -11,6 +11,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
1111
{
1212
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
1313
[Dependency] private readonly TransformSystem _transform = default!;
14+
[Dependency] private readonly ExamineSystemShared _examine = default!;
1415

1516
public override void Initialize()
1617
{
@@ -55,7 +56,7 @@ private void OnBoxEffect(PlayBoxEffectMessage msg)
5556
foreach (var mob in mobMoverEntities)
5657
{
5758
var mapPos = _transform.GetMapCoordinates(mob);
58-
if (!ExamineSystemShared.InRangeUnOccluded(sourcePos, mapPos, box.Distance, null))
59+
if (!_examine.InRangeUnOccluded(sourcePos, mapPos, box.Distance, null))
5960
continue;
6061

6162
var ent = Spawn(box.Effect, mapPos);

Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void PopulateProducts()
9393
if (search.Length == 0 && _category == null ||
9494
search.Length != 0 && prototype.Name.ToLowerInvariant().Contains(search) ||
9595
search.Length != 0 && prototype.Description.ToLowerInvariant().Contains(search) ||
96-
search.Length == 0 && _category != null && prototype.Category.Equals(_category))
96+
search.Length == 0 && _category != null && Loc.GetString(prototype.Category).Equals(_category))
9797
{
9898
var button = new CargoProductRow
9999
{
@@ -122,7 +122,7 @@ public void PopulateCategories()
122122

123123
foreach (var prototype in ProductPrototypes)
124124
{
125-
if (!_categoryStrings.Contains(prototype.Category))
125+
if (!_categoryStrings.Contains(Loc.GetString(prototype.Category)))
126126
{
127127
_categoryStrings.Add(Loc.GetString(prototype.Category));
128128
}

Content.Client/Chat/UI/SpeechBubble.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ protected override Control BuildBubble(ChatMessage message, string speechStyleCl
252252
var bubbleContent = new RichTextLabel
253253
{
254254
MaxWidth = SpeechMaxWidth,
255-
Margin = new Thickness(2, 6, 2, 2)
255+
Margin = new Thickness(2, 6, 2, 2),
256+
StyleClasses = { "bubbleContent" }
256257
};
257258

258259
//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

Content.Client/Clothing/ClientClothingSystem.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ private void RenderEquipment(EntityUid equipee, EntityUid equipment, string slot
271271
{
272272
if (!revealedLayers.Add(key))
273273
{
274-
Logger.Warning($"Duplicate key for clothing visuals: {key}. Are multiple components attempting to modify the same layer? Equipment: {ToPrettyString(equipment)}");
274+
Log.Warning($"Duplicate key for clothing visuals: {key}. Are multiple components attempting to modify the same layer? Equipment: {ToPrettyString(equipment)}");
275275
continue;
276276
}
277277

@@ -281,6 +281,9 @@ private void RenderEquipment(EntityUid equipee, EntityUid equipment, string slot
281281
// note that every insertion requires reshuffling & remapping all the existing layers.
282282
sprite.AddBlankLayer(index);
283283
sprite.LayerMapSet(key, index);
284+
285+
if (layerData.Color != null)
286+
sprite.LayerSetColor(key, layerData.Color.Value);
284287
}
285288
else
286289
index = sprite.LayerMapReserveBlank(key);

Content.Client/CriminalRecords/CriminalRecordsConsoleBoundUserInterface.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ protected override void Open()
3737
SendMessage(new SetStationRecordFilter(type, filterValue));
3838
_window.OnStatusSelected += status =>
3939
SendMessage(new CriminalRecordChangeStatus(status, null));
40-
_window.OnDialogConfirmed += (_, reason) =>
41-
SendMessage(new CriminalRecordChangeStatus(SecurityStatus.Wanted, reason));
40+
_window.OnDialogConfirmed += (status, reason) =>
41+
SendMessage(new CriminalRecordChangeStatus(status, reason));
4242
_window.OnHistoryUpdated += UpdateHistory;
4343
_window.OnHistoryClosed += () => _historyWindow?.Close();
4444
_window.OnClose += Close;

Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -219,16 +219,16 @@ private void FilterListingOfRecords(string text = "")
219219

220220
private void SetStatus(SecurityStatus status)
221221
{
222-
if (status == SecurityStatus.Wanted)
222+
if (status == SecurityStatus.Wanted || status == SecurityStatus.Suspected)
223223
{
224-
GetWantedReason();
224+
GetReason(status);
225225
return;
226226
}
227227

228228
OnStatusSelected?.Invoke(status);
229229
}
230230

231-
private void GetWantedReason()
231+
private void GetReason(SecurityStatus status)
232232
{
233233
if (_reasonDialog != null)
234234
{
@@ -237,7 +237,7 @@ private void GetWantedReason()
237237
}
238238

239239
var field = "reason";
240-
var title = Loc.GetString("criminal-records-status-wanted");
240+
var title = Loc.GetString("criminal-records-status-" + status.ToString().ToLower());
241241
var placeholders = _proto.Index<DatasetPrototype>(ReasonPlaceholders);
242242
var placeholder = Loc.GetString("criminal-records-console-reason-placeholder", ("placeholder", _random.Pick(placeholders.Values))); // just funny it doesn't actually get used
243243
var prompt = Loc.GetString("criminal-records-console-reason");
@@ -251,7 +251,7 @@ private void GetWantedReason()
251251
if (reason.Length < 1 || reason.Length > _maxLength)
252252
return;
253253

254-
OnDialogConfirmed?.Invoke(SecurityStatus.Wanted, reason);
254+
OnDialogConfirmed?.Invoke(status, reason);
255255
};
256256

257257
_reasonDialog.OnClose += () => { _reasonDialog = null; };

Content.Client/DoAfter/DoAfterOverlay.cs

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using System.Numerics;
22
using Content.Shared.DoAfter;
3+
using Content.Client.UserInterface.Systems;
34
using Robust.Client.GameObjects;
45
using Robust.Client.Graphics;
56
using Robust.Shared.Enums;
6-
using Robust.Shared.Graphics;
77
using Robust.Client.Player;
88
using Robust.Shared.Prototypes;
99
using Robust.Shared.Timing;
@@ -18,6 +18,7 @@ public sealed class DoAfterOverlay : Overlay
1818
private readonly IPlayerManager _player;
1919
private readonly SharedTransformSystem _transform;
2020
private readonly MetaDataSystem _meta;
21+
private readonly ProgressColorSystem _progressColor;
2122

2223
private readonly Texture _barTexture;
2324
private readonly ShaderInstance _shader;
@@ -40,6 +41,7 @@ public DoAfterOverlay(IEntityManager entManager, IPrototypeManager protoManager,
4041
_player = player;
4142
_transform = _entManager.EntitySysManager.GetEntitySystem<SharedTransformSystem>();
4243
_meta = _entManager.EntitySysManager.GetEntitySystem<MetaDataSystem>();
44+
_progressColor = _entManager.System<ProgressColorSystem>();
4345
var sprite = new SpriteSpecifier.Rsi(new("/Textures/Interface/Misc/progress_bar.rsi"), "icon");
4446
_barTexture = _entManager.EntitySysManager.GetEntitySystem<SpriteSystem>().Frame0(sprite);
4547

@@ -125,7 +127,7 @@ protected override void Draw(in OverlayDrawArgs args)
125127
elapsedRatio = (float) Math.Min(1, elapsed.TotalSeconds / doAfter.Args.Delay.TotalSeconds);
126128
var cancelElapsed = (time - doAfter.CancelledTime.Value).TotalSeconds;
127129
var flash = Math.Floor(cancelElapsed / FlashTime) % 2 == 0;
128-
color = new Color(1f, 0f, 0f, flash ? alpha : 0f);
130+
color = GetProgressColor(0, flash ? alpha : 0);
129131
}
130132
else
131133
{
@@ -146,14 +148,8 @@ protected override void Draw(in OverlayDrawArgs args)
146148
handle.SetTransform(Matrix3.Identity);
147149
}
148150

149-
public static Color GetProgressColor(float progress, float alpha = 1f)
151+
public Color GetProgressColor(float progress, float alpha = 1f)
150152
{
151-
if (progress >= 1.0f)
152-
{
153-
return new Color(0f, 1f, 0f, alpha);
154-
}
155-
// lerp
156-
var hue = (5f / 18f) * progress;
157-
return Color.FromHsv((hue, 1f, 0.75f, alpha));
153+
return _progressColor.GetProgressColor(progress).WithAlpha(alpha);
158154
}
159155
}

Content.Client/Drugs/DrugOverlaySystem.cs

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ private void OnPlayerAttached(EntityUid uid, SeeingRainbowsComponent component,
3838
private void OnPlayerDetached(EntityUid uid, SeeingRainbowsComponent component, LocalPlayerDetachedEvent args)
3939
{
4040
_overlay.Intoxication = 0;
41+
_overlay.TimeTicker = 0;
4142
_overlayMan.RemoveOverlay(_overlay);
4243
}
4344

@@ -52,6 +53,7 @@ private void OnShutdown(EntityUid uid, SeeingRainbowsComponent component, Compon
5253
if (_player.LocalEntity == uid)
5354
{
5455
_overlay.Intoxication = 0;
56+
_overlay.TimeTicker = 0;
5557
_overlayMan.RemoveOverlay(_overlay);
5658
}
5759
}

Content.Client/Drugs/RainbowOverlay.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public sealed class RainbowOverlay : Overlay
2020
private readonly ShaderInstance _rainbowShader;
2121

2222
public float Intoxication = 0.0f;
23+
public float TimeTicker = 0.0f;
2324

2425
private const float VisualThreshold = 10.0f;
2526
private const float PowerDivisor = 250.0f;
@@ -48,7 +49,17 @@ protected override void FrameUpdate(FrameEventArgs args)
4849
return;
4950

5051
var timeLeft = (float) (time.Value.Item2 - time.Value.Item1).TotalSeconds;
51-
Intoxication += (timeLeft - Intoxication) * args.DeltaSeconds / 16f;
52+
53+
TimeTicker += args.DeltaSeconds;
54+
55+
if (timeLeft - TimeTicker > timeLeft / 16f)
56+
{
57+
Intoxication += (timeLeft - Intoxication) * args.DeltaSeconds / 16f;
58+
}
59+
else
60+
{
61+
Intoxication -= Intoxication/(timeLeft - TimeTicker) * args.DeltaSeconds;
62+
}
5263
}
5364

5465
protected override bool BeforeDraw(in OverlayDrawArgs args)

Content.Client/IconSmoothing/IconSmoothSystem.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ private void CalculateNewSprite(EntityUid uid,
231231

232232
if (!spriteQuery.TryGetComponent(uid, out var sprite))
233233
{
234-
Logger.Error($"Encountered a icon-smoothing entity without a sprite: {ToPrettyString(uid)}");
234+
Log.Error($"Encountered a icon-smoothing entity without a sprite: {ToPrettyString(uid)}");
235235
RemCompDeferred(uid, smooth);
236236
return;
237237
}
@@ -242,7 +242,7 @@ private void CalculateNewSprite(EntityUid uid,
242242
{
243243
if (!_mapManager.TryGetGrid(xform.GridUid, out grid))
244244
{
245-
Logger.Error($"Failed to calculate IconSmoothComponent sprite in {uid} because grid {xform.GridUid} was missing.");
245+
Log.Error($"Failed to calculate IconSmoothComponent sprite in {uid} because grid {xform.GridUid} was missing.");
246246
return;
247247
}
248248
}

Content.Client/Info/InfoSystem.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ public override void Initialize()
1212
{
1313
base.Initialize();
1414
SubscribeNetworkEvent<RulesMessage>(OnRulesReceived);
15-
Logger.DebugS("info", "Requested server info.");
15+
Log.Debug("Requested server info.");
1616
RaiseNetworkEvent(new RequestRulesMessage());
1717
}
1818

1919
private void OnRulesReceived(RulesMessage message, EntitySessionEventArgs eventArgs)
2020
{
21-
Logger.DebugS("info", "Received server rules.");
21+
Log.Debug("Received server rules.");
2222
Rules = message;
2323
_rules.UpdateRules();
2424
}

Content.Client/Launcher/LauncherConnecting.cs

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ private set
5454
public event Action<Page>? PageChanged;
5555
public event Action<string?>? ConnectFailReasonChanged;
5656
public event Action<ClientConnectionState>? ConnectionStateChanged;
57+
public event Action<NetConnectFailArgs>? ConnectFailed;
5758

5859
protected override void Startup()
5960
{
@@ -85,6 +86,7 @@ private void OnConnectFailed(object? _, NetConnectFailArgs args)
8586
}
8687
ConnectFailReason = args.Reason;
8788
CurrentPage = Page.ConnectFailed;
89+
ConnectFailed?.Invoke(args);
8890
}
8991

9092
private void OnConnectStateChanged(ClientConnectionState state)

Content.Client/Launcher/LauncherConnectingGui.xaml

-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333
<Button Name="ReconnectButton" Text="{Loc 'connecting-reconnect'}"
3434
HorizontalAlignment="Center"
3535
VerticalExpand="True" VerticalAlignment="Bottom" />
36-
<Button Name="RedialButton" Text="{Loc 'connecting-redial'}"
37-
Disabled="True"
38-
HorizontalAlignment="Center"
39-
VerticalExpand="True" VerticalAlignment="Bottom" />
4036
</BoxContainer>
4137
</Control>
4238
<Label Name="ConnectingAddress" StyleClasses="LabelSubText" HorizontalAlignment="Center" />

0 commit comments

Comments
 (0)