Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-Engines into lavaland
  • Loading branch information
Erisfiregamer1 committed Feb 25, 2025
2 parents dd17320 + 330fa0c commit a33e32b
Show file tree
Hide file tree
Showing 1,379 changed files with 633,730 additions and 140,982 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Arcade/BlockGameMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ private Control SetupGameGrid(Texture panelTex)
{
PanelOverride = back,
HorizontalExpand = true,
SizeFlagsStretchRatio = 60
SizeFlagsStretchRatio = 34.25f
};
var backgroundPanel = new PanelContainer
{
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Arcade/UI/BlockGameBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ protected override void Open()
base.Open();

_menu = this.CreateWindow<BlockGameMenu>();
_menu.OnAction += SendAction;
}

protected override void ReceiveMessage(BoundUserInterfaceMessage message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ protected override void Open()
base.Open();

_menu = this.CreateWindow<SpaceVillainArcadeMenu>();
_menu.OnPlayerAction += SendAction;
}

protected override void ReceiveMessage(BoundUserInterfaceMessage message)
Expand Down
21 changes: 11 additions & 10 deletions Content.Client/Cargo/Systems/CargoSystem.Telepad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,33 +64,34 @@ private void OnCargoAnimComplete(EntityUid uid, CargoTelepadComponent component,

private void OnChangeData(EntityUid uid, SpriteComponent? sprite = null)
{
if (!Resolve(uid, ref sprite))
if (!Resolve(uid, ref sprite)
|| !EntityManager.TryGetComponent(uid, out AnimationPlayerComponent? animation))
return;

var entity = new Entity<AnimationPlayerComponent>(uid, animation);
_appearance.TryGetData<CargoTelepadState?>(uid, CargoTelepadVisuals.State, out var state);
AnimationPlayerComponent? player = null;

switch (state)
{
case CargoTelepadState.Teleporting:
if (_player.HasRunningAnimation(uid, TelepadBeamKey))
if (_player.HasRunningAnimation(uid, animation, TelepadBeamKey))
return;
_player.Stop(uid, player, TelepadIdleKey);
_player.Play(uid, player, CargoTelepadBeamAnimation, TelepadBeamKey);
_player.Stop(entity, animation, TelepadIdleKey);
_player.Play(entity, CargoTelepadBeamAnimation, TelepadBeamKey);
break;
case CargoTelepadState.Unpowered:
sprite.LayerSetVisible(CargoTelepadLayers.Beam, false);
_player.Stop(uid, player, TelepadBeamKey);
_player.Stop(uid, player, TelepadIdleKey);
_player.Stop(uid, animation, TelepadBeamKey);
_player.Stop(uid, animation, TelepadIdleKey);
break;
default:
sprite.LayerSetVisible(CargoTelepadLayers.Beam, true);

if (_player.HasRunningAnimation(uid, player, TelepadIdleKey) ||
_player.HasRunningAnimation(uid, player, TelepadBeamKey))
if (_player.HasRunningAnimation(uid, animation, TelepadIdleKey) ||
_player.HasRunningAnimation(uid, animation, TelepadBeamKey))
return;

_player.Play(uid, player, CargoTelepadIdleAnimation, TelepadIdleKey);
_player.Play(entity, CargoTelepadIdleAnimation, TelepadIdleKey);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Content.Client.Chemistry.UI;
using Content.Client.Items;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;
using Robust.Shared.GameStates;

namespace Content.Client.Chemistry.EntitySystems;

public sealed class FillableOneTimeInjectorSystem : SharedFillableOneTimeInjectorSystem
{
public override void Initialize()
{
base.Initialize();
Subs.ItemStatus<FillableOneTimeInjectorComponent>(ent => new FillableOneTimeInjectorStatusControl(ent, SolutionContainers));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ protected override void Open()
_window.OnReagentButtonPressed += (_, button, amount, isOutput) => SendMessage(new ChemMasterReagentAmountButtonMessage(button.Id, amount, button.IsBuffer, isOutput));
_window.OnSortMethodChanged += sortMethod => SendMessage(new ChemMasterSortMethodUpdated(sortMethod));
_window.OnTransferAmountChanged += amount => SendMessage(new ChemMasterTransferringAmountUpdated(amount));
_window.OnUpdateAmounts += amounts => SendMessage(new ChemMasterAmountsUpdated(amounts));
}

/// <summary>
Expand Down
8 changes: 7 additions & 1 deletion Content.Client/Chemistry/UI/ChemMasterWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,18 @@
</PanelContainer>
<RichTextLabel Name="AmountLabel" Text="{Loc 'chem-master-window-transferring-default-label'}" Margin="0 0 7 0" />
<LineEdit MinSize="140 0" Name="AmountLineEdit" Access="Public" PlaceHolder="{Loc 'chem-master-window-amount-placeholder'}" />
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<Button Name="SetAmountButton" Text="{Loc 'chem-master-window-set-amount-label'}" HorizontalExpand="True" StyleClasses="OpenRight"/>
<Button Name="SaveAsFrequentButton" Text="{Loc 'chem-master-window-save-as-frequent-label'}" HorizontalExpand="True" StyleClasses="OpenLeft"/>
</BoxContainer>
<RichTextLabel Text="Both of the above buttons use the textbox" />
<Control MinSize="0 5" />
<GridContainer
Name="AmountButtons"
VerticalExpand="True"
HorizontalExpand="True"
Margin="2 2 2 2"
Columns="5" />
Columns="4" />
</BoxContainer>
</BoxContainer>
</controls:FancyWindow>
55 changes: 42 additions & 13 deletions Content.Client/Chemistry/UI/ChemMasterWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ public sealed partial class ChemMasterWindow : FancyWindow
public event Action<int>? OnAmountButtonPressed;
public event Action<int>? OnSortMethodChanged;
public event Action<int>? OnTransferAmountChanged;
public event Action<List<int>>? OnUpdateAmounts;

public readonly Button[] PillTypeButtons;

private List<int> _amounts = new();

private const string TransferringAmountColor = "#ffffff";
private ReagentSortMethod _currentSortMethod = ReagentSortMethod.Alphabetical;
private ChemMasterBoundUserInterfaceState? _lastState;
Expand All @@ -48,7 +52,9 @@ public ChemMasterWindow()

AmountLabel.HorizontalAlignment = HAlignment.Center;
AmountLineEdit.OnTextEntered += SetAmount;
AmountLineEdit.OnFocusExit += SetAmount;

SetAmountButton.OnPressed += _ => SetAmountText(AmountLineEdit.Text);
SaveAsFrequentButton.OnPressed += HandleSaveAsFrequentPressed;

// Pill type selection buttons, in total there are 20 pills.
// Pill rsi file should have states named as pill1, pill2, and so on.
Expand Down Expand Up @@ -130,15 +136,19 @@ public ChemMasterWindow()
BufferTransferButton.OnPressed += HandleDiscardTransferPress;
BufferDiscardButton.OnPressed += HandleDiscardTransferPress;

var amounts = new List<int>()
{
1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 125, 150, 175, 200, 225, 250, 275, 300, 500
};
CreateAmountButtons();

OnAmountButtonPressed += amount => SetAmountText(amount.ToString());
}

private void CreateAmountButtons()
{
AmountButtons.DisposeAllChildren();

for (int i = 0; i < amounts.Count; i++)
for (int i = 0; i < _amounts.Count; i++)
{
var styleClass = StyleBase.ButtonOpenBoth;
var amount = amounts[i];
var amount = _amounts[i];
var columns = AmountButtons.Columns;

if (i == 0 || i % columns == 0)
Expand All @@ -158,8 +168,17 @@ public ChemMasterWindow()
button.OnPressed += _ => OnAmountButtonPressed?.Invoke(amount);
AmountButtons.AddChild(button);
}
}

OnAmountButtonPressed += amount => SetAmountText(amount.ToString());
private void HandleSaveAsFrequentPressed(BaseButton.ButtonEventArgs args)
{
if (!int.TryParse(AmountLineEdit.Text, out var amount)
|| _amounts.Any(a => amount == a))
return;

_amounts.Add(amount);
_amounts.Sort();
CreateAmountButtons();
}

private void HandleDiscardTransferPress(BaseButton.ButtonEventArgs args)
Expand Down Expand Up @@ -201,7 +220,7 @@ private void SortUpdated()
UpdatePanelInfo(_lastState);
}

private bool ValidateAmount(string newText)
private bool ValidateAmount(string newText, bool invokeEvent = true)
{
if (string.IsNullOrWhiteSpace(newText) || !int.TryParse(newText, out int amount))
{
Expand All @@ -210,16 +229,19 @@ private bool ValidateAmount(string newText)
}

_transferAmount = amount;
OnTransferAmountChanged?.Invoke(amount);

if (invokeEvent)
OnTransferAmountChanged?.Invoke(amount);

return true;
}

private void SetAmount(LineEdit.LineEditEventArgs args) =>
SetAmountText(args.Text);

private void SetAmountText(string newText)
private void SetAmountText(string newText, bool invokeEvent = true)
{
if (newText == _transferAmount.ToString() || !ValidateAmount(newText))
if (newText == _transferAmount.ToString() || !ValidateAmount(newText, invokeEvent))
return;

var localizedAmount = Loc.GetString(
Expand Down Expand Up @@ -274,7 +296,14 @@ public void UpdateState(BoundUserInterfaceState state)
// Ensure the Panel Info is updated, including UI elements for Buffer Volume, Output Container and so on
UpdatePanelInfo(castState);
HandleSortMethodChange(castState.SortMethod);
SetAmountText(castState.TransferringAmount.ToString());
SetAmountText(castState.TransferringAmount.ToString(), false);

if (_amounts != castState.Amounts)
{
_amounts = castState.Amounts;
_amounts.Sort();
CreateAmountButtons();
}

BufferCurrentVolume.Text = $" {castState.PillBufferCurrentVolume?.Int() ?? 0}u";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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;

namespace Content.Client.Chemistry.UI;

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

private FixedPoint2 PrevVolume;
private FixedPoint2 PrevMaxVolume;
private FixedPoint2 PrevTransferAmount;
private FillableOneTimeInjectorToggleMode PrevToggleStateIndex;

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

protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);

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

// only updates the UI if any of the details are different than they previously were
if (PrevVolume == solution.Volume
&& PrevMaxVolume == solution.MaxVolume
&& PrevTransferAmount == _parent.Comp.TransferAmount)
return;

PrevVolume = solution.Volume;
PrevMaxVolume = solution.MaxVolume;
PrevTransferAmount = _parent.Comp.TransferAmount;
var modeStringLocalized = "";

// only updates the UI if any of the details are different than they previously were
if(PrevToggleStateIndex == _parent.Comp.ToggleState)
return;

PrevToggleStateIndex = _parent.Comp.ToggleState;

// Update current volume and injector state
modeStringLocalized = Loc.GetString(
_parent.Comp.ToggleState switch
{
FillableOneTimeInjectorToggleMode.Draw => "injector-draw-text",
FillableOneTimeInjectorToggleMode.Inject => "injector-inject-text",
FillableOneTimeInjectorToggleMode.Spent => "injector-spent-text",
_ => "injector-invalid-injector-toggle-mode"
});

if (_parent.Comp.ToggleState != FillableOneTimeInjectorToggleMode.Draw)
{
_label.SetMarkup(
Loc.GetString(
"onetime-injector-simple-volume-label",
("currentVolume", solution.Volume),
("modeString", modeStringLocalized)));
}
else
{
_label.SetMarkup(
Loc.GetString(
"injector-volume-label",
("currentVolume", solution.Volume),
("totalVolume", solution.MaxVolume),
("modeString", modeStringLocalized),
("transferVolume", _parent.Comp.TransferAmount)));
}
}
}
5 changes: 5 additions & 0 deletions Content.Client/Clothing/ClientClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ private void OnGetVisuals(EntityUid uid, ClothingComponent item, GetEquipmentVis
i++;
}

if (inventory.SpeciesId != null && item.Sprite != null
&& _cache.TryGetResource<RSIResource>(SpriteSpecifierSerializer.TextureRoot / item.Sprite, out var rsi)
&& rsi.RSI.TryGetState($"{layer.State}-{inventory.SpeciesId}", out _))
layer.State = $"{layer.State}-{inventory.SpeciesId}";

args.Layers.Add((key, layer));
}
}
Expand Down
11 changes: 11 additions & 0 deletions Content.Client/Crayon/CrayonSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ protected override void FrameUpdate(FrameEventArgs args)
}

_parent.UIUpdateNeeded = false;

// Frontier: unlimited crayon, Delta V Port
if (_parent.Capacity == int.MaxValue)
{
_label.SetMarkup(Robust.Shared.Localization.Loc.GetString("crayon-drawing-label-unlimited",
("color", _parent.Color),
("state", _parent.SelectedState)));
return;
}
// End Frontier, Delta V Port

_label.SetMarkup(Robust.Shared.Localization.Loc.GetString("crayon-drawing-label",
("color",_parent.Color),
("state",_parent.SelectedState),
Expand Down
37 changes: 37 additions & 0 deletions Content.Client/DeltaV/AACTablet/UI/AACBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Content.Shared.DeltaV.AACTablet;
using Content.Shared.DeltaV.QuickPhrase;
using Robust.Shared.Prototypes;

namespace Content.Client.DeltaV.AACTablet.UI;

public sealed class AACBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private AACWindow? _window;

public AACBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}

protected override void Open()
{
base.Open();
_window?.Close();
_window = new AACWindow();
_window.OpenCentered();

_window.PhraseButtonPressed += OnPhraseButtonPressed;
_window.OnClose += Close;
}

private void OnPhraseButtonPressed(ProtoId<QuickPhrasePrototype> phraseId)
{
SendMessage(new AACTabletSendPhraseMessage(phraseId));
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_window?.Orphan();
}
}
9 changes: 9 additions & 0 deletions Content.Client/DeltaV/AACTablet/UI/AACWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="AAC Tablet"
Resizable="False"
SetSize="540 300"
MinSize="540 300">
<ScrollContainer HScrollEnabled="False" Name="WindowBody">
</ScrollContainer>
</controls:FancyWindow>
Loading

0 comments on commit a33e32b

Please sign in to comment.