Skip to content

Commit

Permalink
Merge pull request #2002 from space-syndicate/upstream-sync
Browse files Browse the repository at this point in the history
Upstream sync
  • Loading branch information
Morb0 authored Mar 29, 2024
2 parents 414a4ee + 9594c93 commit 4e2b5be
Show file tree
Hide file tree
Showing 378 changed files with 3,668 additions and 2,781 deletions.
2 changes: 0 additions & 2 deletions Content.Client/Alerts/ClientAlertsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Robust.Client.Player;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;

namespace Content.Client.Alerts;

Expand All @@ -13,7 +12,6 @@ public sealed class ClientAlertsSystem : AlertsSystem
{
public AlertOrderPrototype? AlertOrder { get; set; }

[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;

Expand Down
21 changes: 21 additions & 0 deletions Content.Client/Alerts/UpdateAlertSpriteEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Content.Shared.Alert;
using Robust.Client.GameObjects;

namespace Content.Client.Alerts;

/// <summary>
/// Event raised on an entity with alerts in order to allow it to update visuals for the alert sprite entity.
/// </summary>
[ByRefEvent]
public record struct UpdateAlertSpriteEvent
{
public Entity<SpriteComponent> SpriteViewEnt;

public AlertPrototype Alert;

public UpdateAlertSpriteEvent(Entity<SpriteComponent> spriteViewEnt, AlertPrototype alert)
{
SpriteViewEnt = spriteViewEnt;
Alert = alert;
}
}
1 change: 0 additions & 1 deletion Content.Client/Audio/AmbientSoundSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ protected override void QueueUpdate(EntityUid uid, AmbientSoundComponent ambienc
private static AudioParams _params = AudioParams.Default
.WithVariation(0.01f)
.WithLoop(true)
.WithAttenuation(Attenuation.LinearDistance)
.WithMaxDistance(7f);

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Audio/ContentAudioSystem.LobbyMusic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public sealed partial class ContentAudioSystem
[Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;

private readonly AudioParams _lobbySoundtrackParams = new(-5f, 1, "Master", 0, 0, 0, false, 0f);
private readonly AudioParams _roundEndSoundEffectParams = new(-5f, 1, "Master", 0, 0, 0, false, 0f);
private readonly AudioParams _lobbySoundtrackParams = new(-5f, 1, 0, 0, 0, false, 0f);
private readonly AudioParams _roundEndSoundEffectParams = new(-5f, 1, 0, 0, 0, false, 0f);

/// <summary>
/// EntityUid of lobby restart sound component.
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Clothing/ClientClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private bool TryGetDefaultVisuals(EntityUid uid, ClothingComponent clothing, str
else if (TryComp(uid, out SpriteComponent? sprite))
rsi = sprite.BaseRSI;

if (rsi == null || rsi.Path == null)
if (rsi == null)
return false;

var correctedSlot = slot;
Expand Down
2 changes: 0 additions & 2 deletions Content.Client/Doors/DoorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
using Robust.Client.GameObjects;
using Robust.Client.ResourceManagement;
using Robust.Shared.Serialization.TypeSerializers.Implementations;
using Robust.Shared.Timing;

namespace Content.Client.Doors;

public sealed class DoorSystem : SharedDoorSystem
{
[Dependency] private readonly AnimationPlayerSystem _animationSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;

public override void Initialize()
Expand Down
1 change: 0 additions & 1 deletion Content.Client/Entry/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public override void Init()
_prototypeManager.RegisterIgnore("gameMap");
_prototypeManager.RegisterIgnore("gameMapPool");
_prototypeManager.RegisterIgnore("lobbyBackground");
_prototypeManager.RegisterIgnore("advertisementsPack");
_prototypeManager.RegisterIgnore("gamePreset");
_prototypeManager.RegisterIgnore("noiseChannel");
_prototypeManager.RegisterIgnore("spaceBiome");
Expand Down
2 changes: 0 additions & 2 deletions Content.Client/IconSmoothing/IconSmoothSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ namespace Content.Client.IconSmoothing
[UsedImplicitly]
public sealed partial class IconSmoothSystem : EntitySystem
{
[Dependency] private readonly IMapManager _mapManager = default!;

private readonly Queue<EntityUid> _dirtyEntities = new();
private readonly Queue<EntityUid> _anchorChangedEntities = new();

Expand Down
1 change: 1 addition & 0 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public static void SetupContexts(IInputContextContainer contexts)
common.AddFunction(ContentKeyFunctions.ToggleFullscreen);
common.AddFunction(ContentKeyFunctions.MoveStoredItem);
common.AddFunction(ContentKeyFunctions.RotateStoredItem);
common.AddFunction(ContentKeyFunctions.SaveItemLocation);
common.AddFunction(ContentKeyFunctions.Point);
common.AddFunction(ContentKeyFunctions.ZoomOut);
common.AddFunction(ContentKeyFunctions.ZoomIn);
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Items/Systems/ItemSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private bool TryGetDefaultVisuals(EntityUid uid, ItemComponent item, string defa
else if (TryComp(uid, out SpriteComponent? sprite))
rsi = sprite.BaseRSI;

if (rsi == null || rsi.Path == null)
if (rsi == null)
return false;

var state = (item.HeldPrefix == null)
Expand Down
10 changes: 6 additions & 4 deletions Content.Client/Kitchen/UI/GrinderMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc grinder-menu-title}" MinSize="768 256">
<BoxContainer Orientation="Horizontal">
<BoxContainer Orientation="Vertical" VerticalAlignment="Top" Margin="8">
<Button Name="GrindButton" Text="{Loc grinder-menu-grind-button}" TextAlign="Center" MinSize="64 48"/>
<Control MinSize="0 16"/>
<Button Name="JuiceButton" Text="{Loc grinder-menu-juice-button}" TextAlign="Center" MinSize="64 48"/>
<BoxContainer Orientation="Vertical" VerticalAlignment="Top" Margin="8" MinWidth="100">
<Label Text="{Loc grinder-menu-auto-label}" HorizontalAlignment="Center"/>
<Button Name="AutoModeButton" Text="{Loc grinder-menu-auto-button}" TextAlign="Center" MinSize="64 48" Margin="0 0 0 16" />
<Label Text="{Loc grinder-menu-manual-label}" HorizontalAlignment="Center"/>
<Button Name="GrindButton" Text="{Loc grinder-menu-grind-button}" TextAlign="Center" MinSize="64 48" Margin="0 0 0 16" />
<Button Name="JuiceButton" Text="{Loc grinder-menu-juice-button}" TextAlign="Center" MinSize="64 48" />
</BoxContainer>

<ui:LabelledContentBox Name="ChamberContentBox" LabelText="{Loc grinder-menu-chamber-content-box-label}" ButtonText="{Loc grinder-menu-chamber-content-box-button}" VerticalExpand="True" HorizontalExpand="True" Margin="8" SizeFlagsStretchRatio="2"/>
Expand Down
14 changes: 14 additions & 0 deletions Content.Client/Kitchen/UI/GrinderMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public GrinderMenu(ReagentGrinderBoundUserInterface owner, IEntityManager entity
_entityManager = entityManager;
_prototypeManager = prototypeManager;
_owner = owner;
AutoModeButton.OnPressed += owner.ToggleAutoMode;
GrindButton.OnPressed += owner.StartGrinding;
JuiceButton.OnPressed += owner.StartJuicing;
ChamberContentBox.EjectButton.OnPressed += owner.EjectAll;
Expand Down Expand Up @@ -56,6 +57,19 @@ public void UpdateState(ReagentGrinderInterfaceState state)
GrindButton.Disabled = !state.CanGrind || !state.Powered;
JuiceButton.Disabled = !state.CanJuice || !state.Powered;

switch (state.AutoMode)
{
case GrinderAutoMode.Grind:
AutoModeButton.Text = Loc.GetString("grinder-menu-grind-button");
break;
case GrinderAutoMode.Juice:
AutoModeButton.Text = Loc.GetString("grinder-menu-juice-button");
break;
default:
AutoModeButton.Text = Loc.GetString("grinder-menu-auto-button-off");
break;
}

// TODO move this to a component state and ensure the net ids.
RefreshContentsDisplay(state.ReagentQuantities, _entityManager.GetEntityArray(state.ChamberContents), state.HasBeakerIn);
}
Expand Down
5 changes: 5 additions & 0 deletions Content.Client/Kitchen/UI/ReagentGrinderBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ protected override void ReceiveMessage(BoundUserInterfaceMessage message)
_menu?.HandleMessage(message);
}

public void ToggleAutoMode(BaseButton.ButtonEventArgs args)
{
SendMessage(new ReagentGrinderToggleAutoModeMessage());
}

public void StartGrinding(BaseButton.ButtonEventArgs? _ = null)
{
SendMessage(new ReagentGrinderStartMessage(GrinderProgram.Grind));
Expand Down
82 changes: 64 additions & 18 deletions Content.Client/LateJoin/LateJoinGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public sealed class LateJoinGui : DefaultWindow
private readonly SpriteSystem _sprites;
private readonly CrewManifestSystem _crewManifest;

private readonly Dictionary<NetEntity, Dictionary<string, JobButton>> _jobButtons = new();
private readonly Dictionary<NetEntity, Dictionary<string, List<JobButton>>> _jobButtons = new();
private readonly Dictionary<NetEntity, Dictionary<string, BoxContainer>> _jobCategories = new();
private readonly List<ScrollContainer> _jobLists = new();

Expand Down Expand Up @@ -139,7 +139,7 @@ private void RebuildUI()
var jobListScroll = new ScrollContainer()
{
VerticalExpand = true,
Children = {jobList},
Children = { jobList },
Visible = false,
};

Expand All @@ -163,11 +163,12 @@ private void RebuildUI()
var departments = _prototypeManager.EnumeratePrototypes<DepartmentPrototype>().ToArray();
Array.Sort(departments, DepartmentUIComparer.Instance);

_jobButtons[id] = new Dictionary<string, List<JobButton>>();

foreach (var department in departments)
{
var departmentName = Loc.GetString($"department-{department.ID}");
_jobCategories[id] = new Dictionary<string, BoxContainer>();
_jobButtons[id] = new Dictionary<string, JobButton>();
var stationAvailable = _gameTicker.JobsAvailable[id];
var jobsAvailable = new List<JobPrototype>();

Expand Down Expand Up @@ -223,7 +224,13 @@ private void RebuildUI()
foreach (var prototype in jobsAvailable)
{
var value = stationAvailable[prototype.ID];
var jobButton = new JobButton(prototype.ID, value);

var jobLabel = new Label
{
Margin = new Thickness(5f, 0, 0, 0)
};

var jobButton = new JobButton(jobLabel, prototype.ID, prototype.LocalizedName, value);

var jobSelector = new BoxContainer
{
Expand All @@ -241,14 +248,6 @@ private void RebuildUI()
icon.Texture = _sprites.Frame0(jobIcon.Icon);
jobSelector.AddChild(icon);

var jobLabel = new Label
{
Margin = new Thickness(5f, 0, 0, 0),
Text = value != null ?
Loc.GetString("late-join-gui-job-slot-capped", ("jobName", prototype.LocalizedName), ("amount", value)) :
Loc.GetString("late-join-gui-job-slot-uncapped", ("jobName", prototype.LocalizedName)),
};

jobSelector.AddChild(jobLabel);
jobButton.AddChild(jobSelector);
category.AddChild(jobButton);
Expand Down Expand Up @@ -280,15 +279,43 @@ private void RebuildUI()
jobButton.Disabled = true;
}

_jobButtons[id][prototype.ID] = jobButton;
if (!_jobButtons[id].ContainsKey(prototype.ID))
{
_jobButtons[id][prototype.ID] = new List<JobButton>();
}

_jobButtons[id][prototype.ID].Add(jobButton);
}
}
}
}

private void JobsAvailableUpdated(IReadOnlyDictionary<NetEntity, Dictionary<string, uint?>> _)
private void JobsAvailableUpdated(IReadOnlyDictionary<NetEntity, Dictionary<string, uint?>> updatedJobs)
{
RebuildUI();
foreach (var stationEntries in updatedJobs)
{
if (_jobButtons.ContainsKey(stationEntries.Key))
{
var jobsAvailable = stationEntries.Value;

var existingJobEntries = _jobButtons[stationEntries.Key];
foreach (var existingJobEntry in existingJobEntries)
{
if (jobsAvailable.ContainsKey(existingJobEntry.Key))
{
var updatedJobValue = jobsAvailable[existingJobEntry.Key];
foreach (var matchingJobButton in existingJobEntry.Value)
{
if (matchingJobButton.Amount != updatedJobValue)
{
matchingJobButton.RefreshLabel(updatedJobValue);
matchingJobButton.Disabled |= matchingJobButton.Amount == 0;
}
}
}
}
}
}
}

protected override void Dispose(bool disposing)
Expand All @@ -307,14 +334,33 @@ protected override void Dispose(bool disposing)

sealed class JobButton : ContainerButton
{
public Label JobLabel { get; }
public string JobId { get; }
public uint? Amount { get; }
public string JobLocalisedName { get; }
public uint? Amount { get; private set; }
private bool _initialised = false;

public JobButton(string jobId, uint? amount)
public JobButton(Label jobLabel, string jobId, string jobLocalisedName, uint? amount)
{
JobLabel = jobLabel;
JobId = jobId;
Amount = amount;
JobLocalisedName = jobLocalisedName;
RefreshLabel(amount);
AddStyleClass(StyleClassButton);
_initialised = true;
}

public void RefreshLabel(uint? amount)
{
if (Amount == amount && _initialised)
{
return;
}
Amount = amount;

JobLabel.Text = Amount != null ?
Loc.GetString("late-join-gui-job-slot-capped", ("jobName", JobLocalisedName), ("amount", Amount)) :
Loc.GetString("late-join-gui-job-slot-uncapped", ("jobName", JobLocalisedName));
}
}
}
1 change: 0 additions & 1 deletion Content.Client/NPC/PathfindingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ private void DrawScreen(OverlayDrawArgs args, DrawingHandleScreen screenHandle)

var invGridMatrix = gridXform.InvWorldMatrix;
DebugPathPoly? nearest = null;
var nearestDistance = float.MaxValue;

foreach (var poly in tile)
{
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ void AddCheckBox(string checkBoxName, bool currentState, Action<BaseButton.Butto
AddButton(ContentKeyFunctions.SwapHands);
AddButton(ContentKeyFunctions.MoveStoredItem);
AddButton(ContentKeyFunctions.RotateStoredItem);
AddButton(ContentKeyFunctions.SaveItemLocation);

AddHeader("ui-options-header-interaction-adv");
AddButton(ContentKeyFunctions.SmartEquipBackpack);
Expand Down
15 changes: 15 additions & 0 deletions Content.Client/Revenant/RevenantSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Content.Client.Alerts;
using Content.Shared.Alert;
using Content.Shared.Revenant;
using Content.Shared.Revenant.Components;
using Robust.Client.GameObjects;
Expand All @@ -13,6 +15,7 @@ public override void Initialize()
base.Initialize();

SubscribeLocalEvent<RevenantComponent, AppearanceChangeEvent>(OnAppearanceChange);
SubscribeLocalEvent<RevenantComponent, UpdateAlertSpriteEvent>(OnUpdateAlert);
}

private void OnAppearanceChange(EntityUid uid, RevenantComponent component, ref AppearanceChangeEvent args)
Expand All @@ -36,4 +39,16 @@ private void OnAppearanceChange(EntityUid uid, RevenantComponent component, ref
args.Sprite.LayerSetState(0, component.State);
}
}

private void OnUpdateAlert(Entity<RevenantComponent> ent, ref UpdateAlertSpriteEvent args)
{
if (args.Alert.AlertType != AlertType.Essence)
return;

var sprite = args.SpriteViewEnt.Comp;
var essence = Math.Clamp(ent.Comp.Essence.Int(), 0, 999);
sprite.LayerSetState(RevenantVisualLayers.Digit1, $"{(essence / 100) % 10}");
sprite.LayerSetState(RevenantVisualLayers.Digit2, $"{(essence / 10) % 10}");
sprite.LayerSetState(RevenantVisualLayers.Digit3, $"{essence % 10}");
}
}
1 change: 0 additions & 1 deletion Content.Client/Shuttles/UI/BaseShuttleControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ protected void DrawCircles(DrawingHandleScreen handle)
var cornerDistance = MathF.Sqrt(WorldRange * WorldRange + WorldRange * WorldRange);

var origin = ScalePosition(-new Vector2(Offset.X, -Offset.Y));
var distOffset = -24f;

for (var radius = minDistance; radius <= maxDistance; radius *= EquatorialMultiplier)
{
Expand Down
Loading

0 comments on commit 4e2b5be

Please sign in to comment.