Skip to content

Commit

Permalink
Merge branch 'master' into uplink-nicities
Browse files Browse the repository at this point in the history
  • Loading branch information
EmoGarbage404 authored Mar 31, 2024
2 parents 340b1c7 + 950a644 commit d98570c
Show file tree
Hide file tree
Showing 638 changed files with 6,502 additions and 4,160 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
16 changes: 0 additions & 16 deletions Content.Client/Chemistry/Components/HyposprayComponent.cs

This file was deleted.

15 changes: 15 additions & 0 deletions Content.Client/Chemistry/EntitySystems/HypospraySystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Content.Client.Chemistry.UI;
using Content.Client.Items;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;

namespace Content.Client.Chemistry.EntitySystems;

public sealed class HypospraySystem : SharedHypospraySystem
{
public override void Initialize()
{
base.Initialize();
Subs.ItemStatus<HyposprayComponent>(ent => new HyposprayStatusControl(ent, _solutionContainers));
}
}
13 changes: 0 additions & 13 deletions Content.Client/Chemistry/EntitySystems/InjectorSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Content.Client.Chemistry.Components;
using Content.Client.Chemistry.UI;
using Content.Client.Items;
using Content.Shared.Chemistry.Components;
Expand All @@ -13,17 +12,5 @@ public override void Initialize()
{
base.Initialize();
Subs.ItemStatus<InjectorComponent>(ent => new InjectorStatusControl(ent, SolutionContainers));
SubscribeLocalEvent<HyposprayComponent, ComponentHandleState>(OnHandleHyposprayState);
Subs.ItemStatus<HyposprayComponent>(ent => new HyposprayStatusControl(ent));
}

private void OnHandleHyposprayState(EntityUid uid, HyposprayComponent component, ref ComponentHandleState args)
{
if (args.Current is not HyposprayComponentState cState)
return;

component.CurrentVolume = cState.CurVolume;
component.TotalVolume = cState.MaxVolume;
component.UiUpdateNeeded = true;
}
}
48 changes: 32 additions & 16 deletions Content.Client/Chemistry/UI/HyposprayStatusControl.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Content.Client.Chemistry.Components;
using Content.Client.Message;
using Content.Client.Stylesheets;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.FixedPoint;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;
Expand All @@ -9,34 +11,48 @@ namespace Content.Client.Chemistry.UI;

public sealed class HyposprayStatusControl : Control
{
private readonly HyposprayComponent _parent;
private readonly Entity<HyposprayComponent> _parent;
private readonly RichTextLabel _label;
private readonly SharedSolutionContainerSystem _solutionContainers;

public HyposprayStatusControl(HyposprayComponent parent)
private FixedPoint2 PrevVolume;
private FixedPoint2 PrevMaxVolume;
private bool PrevOnlyAffectsMobs;

public HyposprayStatusControl(Entity<HyposprayComponent> parent, SharedSolutionContainerSystem solutionContainers)
{
_parent = parent;
_label = new RichTextLabel {StyleClasses = {StyleNano.StyleClassItemStatus}};
_solutionContainers = solutionContainers;
_label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } };
AddChild(_label);

Update();
}

protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
if (!_parent.UiUpdateNeeded)

if (!_solutionContainers.TryGetSolution(_parent.Owner, _parent.Comp.SolutionName, out _, out var solution))
return;
Update();
}

public void Update()
{
// only updates the UI if any of the details are different than they previously were
if (PrevVolume == solution.Volume
&& PrevMaxVolume == solution.MaxVolume
&& PrevOnlyAffectsMobs == _parent.Comp.OnlyAffectsMobs)
return;

PrevVolume = solution.Volume;
PrevMaxVolume = solution.MaxVolume;
PrevOnlyAffectsMobs = _parent.Comp.OnlyAffectsMobs;

_parent.UiUpdateNeeded = false;
var modeStringLocalized = Loc.GetString(_parent.Comp.OnlyAffectsMobs switch
{
false => "hypospray-all-mode-text",
true => "hypospray-mobs-only-mode-text",
});

_label.SetMarkup(Loc.GetString(
"hypospray-volume-text",
("currentVolume", _parent.CurrentVolume),
("totalVolume", _parent.TotalVolume)));
_label.SetMarkup(Loc.GetString("hypospray-volume-label",
("currentVolume", solution.Volume),
("totalVolume", solution.MaxVolume),
("modeString", modeStringLocalized)));
}
}
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
15 changes: 12 additions & 3 deletions Content.Client/Disposal/Systems/DisposalUnitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem

private const string AnimationKey = "disposal_unit_animation";

private const string DefaultFlushState = "disposal-flush";
private const string DefaultChargeState = "disposal-charging";

public override void Initialize()
{
base.Initialize();
Expand Down Expand Up @@ -101,12 +104,18 @@ private void UpdateState(EntityUid uid, SharedDisposalUnitComponent unit, Sprite
sprite.LayerSetVisible(DisposalUnitVisualLayers.Base, state == VisualState.Anchored);
sprite.LayerSetVisible(DisposalUnitVisualLayers.BaseFlush, state is VisualState.Flushing or VisualState.Charging);

var chargingState = sprite.LayerMapTryGet(DisposalUnitVisualLayers.BaseCharging, out var chargingLayer)
? sprite.LayerGetState(chargingLayer)
: new RSI.StateId(DefaultChargeState);

// This is a transient state so not too worried about replaying in range.
if (state == VisualState.Flushing)
{
if (!_animationSystem.HasRunningAnimation(uid, AnimationKey))
{
var flushState = new RSI.StateId("disposal-flush");
var flushState = sprite.LayerMapTryGet(DisposalUnitVisualLayers.BaseFlush, out var flushLayer)
? sprite.LayerGetState(flushLayer)
: new RSI.StateId(DefaultFlushState);

// Setup the flush animation to play
var anim = new Animation
Expand All @@ -124,7 +133,7 @@ private void UpdateState(EntityUid uid, SharedDisposalUnitComponent unit, Sprite
// Return to base state (though, depending on how the unit is
// configured we might get an appearance change event telling
// us to go to charging state)
new AnimationTrackSpriteFlick.KeyFrame("disposal-charging", (float) unit.FlushDelay.TotalSeconds)
new AnimationTrackSpriteFlick.KeyFrame(chargingState, (float) unit.FlushDelay.TotalSeconds)
}
},
}
Expand All @@ -147,7 +156,7 @@ private void UpdateState(EntityUid uid, SharedDisposalUnitComponent unit, Sprite
}
else if (state == VisualState.Charging)
{
sprite.LayerSetState(DisposalUnitVisualLayers.BaseFlush, new RSI.StateId("disposal-charging"));
sprite.LayerSetState(DisposalUnitVisualLayers.BaseFlush, chargingState);
}
else
{
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 @@ -106,7 +106,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
38 changes: 37 additions & 1 deletion Content.Client/Fluids/PuddleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Content.Client.IconSmoothing;
using Content.Shared.Chemistry.Components;
using Content.Shared.Fluids;
using Content.Shared.Fluids.Components;
using Robust.Client.GameObjects;
using Robust.Shared.Map;

namespace Content.Client.Fluids;

Expand All @@ -21,7 +23,7 @@ private void OnPuddleAppearance(EntityUid uid, PuddleComponent component, ref Ap
if (args.Sprite == null)
return;

float volume = 1f;
var volume = 1f;

if (args.AppearanceData.TryGetValue(PuddleVisuals.CurrentVolume, out var volumeObj))
{
Expand Down Expand Up @@ -64,4 +66,38 @@ private void OnPuddleAppearance(EntityUid uid, PuddleComponent component, ref Ap
args.Sprite.Color *= baseColor;
}
}

#region Spill

// Maybe someday we'll have clientside prediction for entity spawning, but not today.
// Until then, these methods do nothing on the client.
/// <inheritdoc/>
public override bool TrySplashSpillAt(EntityUid uid, EntityCoordinates coordinates, Solution solution, out EntityUid puddleUid, bool sound = true, EntityUid? user = null)
{
puddleUid = EntityUid.Invalid;
return false;
}

/// <inheritdoc/>
public override bool TrySpillAt(EntityCoordinates coordinates, Solution solution, out EntityUid puddleUid, bool sound = true)
{
puddleUid = EntityUid.Invalid;
return false;
}

/// <inheritdoc/>
public override bool TrySpillAt(EntityUid uid, Solution solution, out EntityUid puddleUid, bool sound = true, TransformComponent? transformComponent = null)
{
puddleUid = EntityUid.Invalid;
return false;
}

/// <inheritdoc/>
public override bool TrySpillAt(TileRef tileRef, Solution solution, out EntityUid puddleUid, bool sound = true, bool tileReact = true)
{
puddleUid = EntityUid.Invalid;
return false;
}

#endregion Spill
}
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
Loading

0 comments on commit d98570c

Please sign in to comment.