Skip to content

Commit

Permalink
Merge branch 'master' into shrmip
Browse files Browse the repository at this point in the history
  • Loading branch information
NullWanderer authored Mar 27, 2024
2 parents 02a6441 + ca30042 commit 194ad6e
Show file tree
Hide file tree
Showing 724 changed files with 302,649 additions and 254,551 deletions.
10 changes: 1 addition & 9 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
# Last match in file takes precedence.

/Content.*/ @DebugOk
/Content.*/SimpleStation14/ @DEATHB4DEFEAT

/Resources/ @DebugOk
/Resources/ConfigPresets/ @DebugOk
/Resources/*.yml @DebugOk @Colin-Tel
/Resources/*.yml @Colin-Tel
/Resources/*/SimpleStation14/ @DEATHB4DEFEAT
/Resources/Maps/ @IamVelcroboy
/Resources/Prototypes/Maps/ @IamVelcroboy

/Tools/ @DebugOk

/* @DebugOk # Standalone files in root, shouldn't apply to subdirectories
/.github/ @DebugOk # Workflows, codeowners, templates, etc
15 changes: 15 additions & 0 deletions .github/workflows/check-crlf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CRLF Check

on:
pull_request:
types: [ opened, reopened, synchronize, ready_for_review ]

jobs:
build:
name: CRLF Check
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Check for CRLF
run: Tools/check_crlf.py
2 changes: 1 addition & 1 deletion Content.Client/Alerts/ClientAlertsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override void LoadPrototypes()

AlertOrder = _prototypeManager.EnumeratePrototypes<AlertOrderPrototype>().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<AlertKey, AlertState>? ActiveAlerts
Expand Down
6 changes: 3 additions & 3 deletions Content.Client/Audio/ContentAudioSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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))
Expand Down
5 changes: 3 additions & 2 deletions Content.Client/CardboardBox/CardboardBoxSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Numerics;
using System.Numerics;
using Content.Shared.CardboardBox;
using Content.Shared.CardboardBox.Components;
using Content.Shared.Examine;
Expand All @@ -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()
{
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Cargo/UI/CargoConsoleMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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));
}
Expand Down
3 changes: 2 additions & 1 deletion Content.Client/Chat/UI/SpeechBubble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion Content.Client/Clothing/ClientClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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<DatasetPrototype>(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");
Expand All @@ -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; };
Expand Down
16 changes: 6 additions & 10 deletions Content.Client/DoAfter/DoAfterOverlay.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -40,6 +41,7 @@ public DoAfterOverlay(IEntityManager entManager, IPrototypeManager protoManager,
_player = player;
_transform = _entManager.EntitySysManager.GetEntitySystem<SharedTransformSystem>();
_meta = _entManager.EntitySysManager.GetEntitySystem<MetaDataSystem>();
_progressColor = _entManager.System<ProgressColorSystem>();
var sprite = new SpriteSpecifier.Rsi(new("/Textures/Interface/Misc/progress_bar.rsi"), "icon");
_barTexture = _entManager.EntitySysManager.GetEntitySystem<SpriteSystem>().Frame0(sprite);

Expand Down Expand Up @@ -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
{
Expand All @@ -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);
}
}
2 changes: 2 additions & 0 deletions Content.Client/Drugs/DrugOverlaySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}
}
Expand Down
13 changes: 12 additions & 1 deletion Content.Client/Drugs/RainbowOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/IconSmoothing/IconSmoothSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Info/InfoSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public override void Initialize()
{
base.Initialize();
SubscribeNetworkEvent<RulesMessage>(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();
}
Expand Down
2 changes: 2 additions & 0 deletions Content.Client/Launcher/LauncherConnecting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ private set
public event Action<Page>? PageChanged;
public event Action<string?>? ConnectFailReasonChanged;
public event Action<ClientConnectionState>? ConnectionStateChanged;
public event Action<NetConnectFailArgs>? ConnectFailed;

protected override void Startup()
{
Expand Down Expand Up @@ -85,6 +86,7 @@ private void OnConnectFailed(object? _, NetConnectFailArgs args)
}
ConnectFailReason = args.Reason;
CurrentPage = Page.ConnectFailed;
ConnectFailed?.Invoke(args);
}

private void OnConnectStateChanged(ClientConnectionState state)
Expand Down
4 changes: 0 additions & 4 deletions Content.Client/Launcher/LauncherConnectingGui.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
<Button Name="ReconnectButton" Text="{Loc 'connecting-reconnect'}"
HorizontalAlignment="Center"
VerticalExpand="True" VerticalAlignment="Bottom" />
<Button Name="RedialButton" Text="{Loc 'connecting-redial'}"
Disabled="True"
HorizontalAlignment="Center"
VerticalExpand="True" VerticalAlignment="Bottom" />
</BoxContainer>
</Control>
<Label Name="ConnectingAddress" StyleClasses="LabelSubText" HorizontalAlignment="Center" />
Expand Down
Loading

0 comments on commit 194ad6e

Please sign in to comment.