Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Zekins3366 committed Jun 23, 2024
2 parents ea7dc66 + c8b01d0 commit 60dd5b6
Show file tree
Hide file tree
Showing 1,136 changed files with 86,653 additions and 16,710 deletions.
8 changes: 7 additions & 1 deletion Content.Client/BoomBox/UI/BoomBoxBoundUi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ protected override void Open()
_window.PlusVolButtonPressed += OnPlusVolButtonPressed;
_window.StartButtonPressed += OnStartButtonPressed;
_window.StopButtonPressed += OnStopButtonPressed;
_window.PlaybackSliderChanged += OnPlaybackSliderChanged;
}

private void OnPlaybackSliderChanged(float newPosition)
{
SendMessage(new BoomBoxSetTimeMessage(newPosition)); // Отправка сообщения при изменении ползунка
}

private void OnMinusVolButtonPressed()
Expand Down Expand Up @@ -64,4 +70,4 @@ protected override void Dispose(bool disposing)
if (disposing)
_window?.Dispose();
}
}
}
7 changes: 4 additions & 3 deletions Content.Client/BoomBox/UI/BoomBoxWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<DefaultWindow xmlns="https://spacestation14.io"
Title="{Loc 'boombox-ui-window'}"
MinSize="256 80"
SetSize="256 80">
MinSize="280 130"
SetSize="280 130">
<BoxContainer Orientation="Vertical" VerticalExpand="True">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<Button Name="MinusVolButton"
Expand All @@ -21,5 +21,6 @@
HorizontalExpand="True"
Disabled="True" />
</BoxContainer>
<Slider Name="PlaybackSlider" HorizontalExpand="True"/>
</BoxContainer>
</DefaultWindow>
</DefaultWindow>
9 changes: 8 additions & 1 deletion Content.Client/BoomBox/UI/BoomBoxWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public sealed partial class BoomBoxWindow : DefaultWindow
public event Action? PlusVolButtonPressed;
public event Action? StartButtonPressed;
public event Action? StopButtonPressed;
public event Action<float>? PlaybackSliderChanged;

private bool _isSliderDragging = false;

public BoomBoxWindow()
{
Expand All @@ -22,6 +25,7 @@ public BoomBoxWindow()
PlusVolButton.OnPressed += _ => PlusVolButtonPressed?.Invoke();
StartButton.OnPressed += _ => StartButtonPressed?.Invoke();
StopButton.OnPressed += _ => StopButtonPressed?.Invoke();
PlaybackSlider.OnValueChanged += args => PlaybackSliderChanged?.Invoke(args.Value);
}

public void UpdateState(BoomBoxUiState state)
Expand All @@ -30,5 +34,8 @@ public void UpdateState(BoomBoxUiState state)
PlusVolButton.Disabled = !state.CanPlusVol;
StartButton.Disabled = !state.CanStart;
StopButton.Disabled = !state.CanStop;

PlaybackSlider.MaxValue = state.SoundDuration;
PlaybackSlider.SetValueWithoutEvent(state.PlaybackPosition);
}
}
}
5 changes: 1 addition & 4 deletions Content.Client/Paper/UI/PaperWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,7 @@ public void Populate(SharedPaperComponent.PaperBoundUserInterfaceState state)
StampDisplay.RemoveStamps();
foreach(var stamper in state.StampedBy)
{
if (stamper.StampedBorderless)
StampDisplay.AddStamp(new StampWidget(true) { StampInfo = stamper });
else
StampDisplay.AddStamp(new StampWidget { StampInfo = stamper });
StampDisplay.AddStamp(new StampWidget { StampInfo = stamper });
}
}

Expand Down
20 changes: 2 additions & 18 deletions Content.Client/Paper/UI/StampWidget.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ public float Orientation

public StampDisplayInfo StampInfo {
set {
StampedByLabel.Text = Loc.GetString(value.StampedName);
StampedByLabel.Text = value.Type is StampType.Signature ? value.StampedName : Loc.GetString(value.StampedName);
StampedByLabel.FontColorOverride = value.StampedColor;
ModulateSelfOverride = value.StampedColor;
PanelOverride = value.Type is StampType.Signature ? null : _borderTexture;
}
}

Expand All @@ -45,23 +46,6 @@ public StampWidget()
_stampShader = prototypes.Index<ShaderPrototype>("PaperStamp").InstanceUnique();
}

public StampWidget(bool borderless)
{
RobustXamlLoader.Load(this);
var resCache = IoCManager.Resolve<IResourceCache>();
var borderImage = resCache.GetResource<TextureResource>(
"/Textures/Interface/Paper/paper_stamp_noborder.svg.96dpi.png");
_borderTexture = new StyleBoxTexture
{
Texture = borderImage,
};
_borderTexture.SetPatchMargin(StyleBoxTexture.Margin.All, 7.0f);
PanelOverride = _borderTexture;

var prototypes = IoCManager.Resolve<IPrototypeManager>();
_stampShader = prototypes.Index<ShaderPrototype>("PaperStamp").InstanceUnique();
}

protected override void Draw(DrawingHandleScreen handle)
{
_stampShader?.SetParameter("objCoord", GlobalPosition * UIScale * new Vector2(1, -1));
Expand Down
19 changes: 15 additions & 4 deletions Content.Client/Preferences/UI/LoadoutContainer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,28 @@ public LoadoutContainer(ProtoId<LoadoutPrototype> proto, bool disabled, Formatte

if (_protoManager.TryIndex(proto, out var loadProto))
{
var ent = _entManager.System<LoadoutSystem>().GetFirstOrNull(loadProto);
// Frontier: overrideable prototype fields (description, name, icon [via entity])
Price.Text = "$" + loadProto.Price;
if (ent != null)

bool hasDescription = !string.IsNullOrEmpty(loadProto.Description);
bool hasEntity = !string.IsNullOrEmpty(loadProto.PreviewEntity?.Id);

EntProtoId? ent = null;
if (!hasEntity || !hasDescription) {
ent = _entManager.System<LoadoutSystem>().GetFirstOrNull(loadProto);
}
var finalEnt = hasEntity ? loadProto.PreviewEntity : ent;
if (finalEnt != null)
{
_entity = _entManager.SpawnEntity(ent, MapCoordinates.Nullspace);
_entity = _entManager.SpawnEntity(finalEnt, MapCoordinates.Nullspace);
Sprite.SetEntity(_entity);

var spriteTooltip = new Tooltip();
spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(_entManager.GetComponent<MetaDataComponent>(_entity.Value).EntityDescription));
var description = hasDescription ? loadProto.Description : _entManager.GetComponent<MetaDataComponent>(_entity.Value).EntityDescription;
spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(description));
Sprite.TooltipSupplier = _ => spriteTooltip;
}
// End Frontier
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void RefreshLoadouts(RoleLoadout loadout, ICommonSession session, IDepend
var enabled = loadout.IsValid(session, loadoutProto, collection, out var reason);
var loadoutContainer = new LoadoutContainer(loadoutProto, !enabled, reason);
loadoutContainer.Select.Pressed = pressed;
loadoutContainer.Text = loadoutSystem.GetName(loadProto);
loadoutContainer.Text = string.IsNullOrEmpty(loadProto.Name) ? loadoutSystem.GetName(loadProto) : loadProto.Name; // Frontier: allow overriding loadout names

loadoutContainer.Select.OnPressed += args =>
{
Expand Down
21 changes: 13 additions & 8 deletions Content.Client/Stack/StackSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Content.Client.Stack
{
[UsedImplicitly]
public sealed class StackSystem : SharedStackSystem
public sealed partial class StackSystem : SharedStackSystem // Frontier: add partial to class definition
{
[Dependency] private readonly AppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly ItemCounterSystem _counterSystem = default!;
Expand Down Expand Up @@ -56,20 +56,25 @@ private void OnAppearanceChange(EntityUid uid, StackComponent comp, ref Appearan
if (args.Sprite == null || comp.LayerStates.Count < 1)
return;

StackLayerData data = new StackLayerData(); // Frontier: use structure to store StackLayerData

// Skip processing if no actual
if (!_appearanceSystem.TryGetData<int>(uid, StackVisuals.Actual, out var actual, args.Component))
if (!_appearanceSystem.TryGetData<int>(uid, StackVisuals.Actual, out data.Actual, args.Component))
return;

if (!_appearanceSystem.TryGetData<int>(uid, StackVisuals.MaxCount, out var maxCount, args.Component))
maxCount = comp.LayerStates.Count;
if (!_appearanceSystem.TryGetData<int>(uid, StackVisuals.MaxCount, out data.MaxCount, args.Component))
data.MaxCount = comp.LayerStates.Count;

if (!_appearanceSystem.TryGetData<bool>(uid, StackVisuals.Hide, out data.Hidden, args.Component))
data.Hidden = false;

if (!_appearanceSystem.TryGetData<bool>(uid, StackVisuals.Hide, out var hidden, args.Component))
hidden = false;
if (comp.LayerFunction != StackLayerFunction.None) // Frontier: use stack layer function to modify appearance if provided.
ApplyLayerFunction(uid, comp, ref data); // Frontier: definition in _NF/Stack/StackSystem.Layers.cs

if (comp.IsComposite)
_counterSystem.ProcessCompositeSprite(uid, actual, maxCount, comp.LayerStates, hidden, sprite: args.Sprite);
_counterSystem.ProcessCompositeSprite(uid, data.Actual, data.MaxCount, comp.LayerStates, data.Hidden, sprite: args.Sprite);
else
_counterSystem.ProcessOpaqueSprite(uid, comp.BaseLayer, actual, maxCount, comp.LayerStates, hidden, sprite: args.Sprite);
_counterSystem.ProcessOpaqueSprite(uid, comp.BaseLayer, data.Actual, data.MaxCount, comp.LayerStates, data.Hidden, sprite: args.Sprite);
}
}
}
8 changes: 4 additions & 4 deletions Content.Client/Weapons/Misc/GrapplingGunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public override void Update(float frameTime)
{
return;
}

if (distance.MaxLength <= distance.MinLength)
return;

// Corvax Frontier start
// if (distance.MaxLength <= distance.MinLength)
// return;
// Corvax Frontier end
var reelKey = _input.CmdStates.GetState(EngineKeyFunctions.UseSecondary) == BoundKeyState.Down;

if (!TryComp<CombatModeComponent>(local, out var combatMode) ||
Expand Down
56 changes: 56 additions & 0 deletions Content.Client/_NF/Stack/StackSystem.Layers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Content.Shared.Stacks.Components;
using Content.Shared.Stacks;

namespace Content.Client.Stack
{
/// <summary>
/// Data used to determine which layers of a stack's sprite are visible.
/// </summary>
public struct StackLayerData
{
public int Actual;
public int MaxCount;
public bool Hidden;
}

public sealed partial class StackSystem : SharedStackSystem
{
// Modifies a given stack component to adjust the layers to display.
private bool ApplyLayerFunction(EntityUid uid, StackComponent comp, ref StackLayerData data)
{
switch (comp.LayerFunction)
{
case StackLayerFunction.Threshold:
if (TryComp<StackLayerThresholdComponent>(uid, out var threshold))
{
ApplyThreshold(threshold, ref data);
return true;
}
break;
}
// No function applied.
return false;
}

/// <summary>
/// Sets Actual to the number of thresholds that Actual exceeds from the beginning of the list.
/// Sets MaxCount to the total number of thresholds plus one (for values under thresholds).
/// </summary>
private static void ApplyThreshold(StackLayerThresholdComponent comp, ref StackLayerData data)
{
// We must stop before we run out of thresholds or layers, whichever's smaller.
data.MaxCount = Math.Min(comp.Thresholds.Count + 1, data.MaxCount);
int newActual = 0;
foreach (var threshold in comp.Thresholds)
{
//If our value exceeds threshold, the next layer should be displayed.
//Note: we must ensure actual <= MaxCount.
if (data.Actual >= threshold && newActual < data.MaxCount)
newActual++;
else
break;
}
data.Actual = newActual;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,11 @@ public sealed partial class GasPressurePumpComponent : Component
[ViewVariables(VVAccess.ReadWrite)]
[DataField("maxTargetPressure")]
public float MaxTargetPressure = Atmospherics.MaxOutputPressure;

/// <summary>
/// Frontier - Start the pump with the map.
/// </summary>
[DataField]
public bool StartOnMapInit { get; set; } = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,11 @@ public sealed partial class GasVolumePumpComponent : Component

[DataField("lastMolesTransferred")]
public float LastMolesTransferred;

/// <summary>
/// Frontier - Start the pump with the map.
/// </summary>
[DataField]
public bool StartOnMapInit { get; set; } = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public override void Initialize()
// Bound UI subscriptions
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpChangeOutputPressureMessage>(OnOutputPressureChangeMessage);
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpToggleStatusMessage>(OnToggleStatusMessage);

SubscribeLocalEvent<GasPressurePumpComponent, MapInitEvent>(OnMapInit); // Frontier
}

private void OnInit(EntityUid uid, GasPressurePumpComponent pump, ComponentInit args)
Expand Down Expand Up @@ -153,5 +155,17 @@ private void UpdateAppearance(EntityUid uid, GasPressurePumpComponent? pump = nu

_appearance.SetData(uid, PumpVisuals.Enabled, pump.Enabled, appearance);
}

private void OnMapInit(EntityUid uid, GasPressurePumpComponent pump, MapInitEvent args) // Frontier - Init on map
{
if (pump.StartOnMapInit)
{
pump.Enabled = true;
UpdateAppearance(uid, pump);

DirtyUI(uid, pump);
_userInterfaceSystem.CloseUi(uid, GasPressurePumpUiKey.Key);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public override void Initialize()
SubscribeLocalEvent<GasVolumePumpComponent, GasVolumePumpToggleStatusMessage>(OnToggleStatusMessage);

SubscribeLocalEvent<GasVolumePumpComponent, DeviceNetworkPacketEvent>(OnPacketRecv);

SubscribeLocalEvent<GasVolumePumpComponent, MapInitEvent>(OnMapInit); // Frontier
}

private void OnInit(EntityUid uid, GasVolumePumpComponent pump, ComponentInit args)
Expand Down Expand Up @@ -206,5 +208,17 @@ private void OnPacketRecv(EntityUid uid, GasVolumePumpComponent component, Devic
return;
}
}

private void OnMapInit(EntityUid uid, GasVolumePumpComponent pump, MapInitEvent args) // Frontier - Init on map
{
if (pump.StartOnMapInit)
{
pump.Enabled = true;
UpdateAppearance(uid, pump);

DirtyUI(uid, pump);
_userInterfaceSystem.CloseUi(uid, GasVolumePumpUiKey.Key);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,11 @@ public sealed partial class GasMixerComponent : Component
[ViewVariables(VVAccess.ReadWrite)]
[DataField("inletTwoConcentration")]
public float InletTwoConcentration = 0.5f;

/// <summary>
/// Frontier - Start the pump with the map.
/// </summary>
[DataField]
public bool StartOnMapInit { get; set; } = false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public override void Initialize()
SubscribeLocalEvent<GasMixerComponent, GasMixerToggleStatusMessage>(OnToggleStatusMessage);

SubscribeLocalEvent<GasMixerComponent, AtmosDeviceDisabledEvent>(OnMixerLeaveAtmosphere);

SubscribeLocalEvent<GasMixerComponent, MapInitEvent>(OnMapInit); // Frontier
}

private void OnInit(EntityUid uid, GasMixerComponent mixer, ComponentInit args)
Expand Down Expand Up @@ -232,5 +234,17 @@ private void OnMixerAnalyzed(EntityUid uid, GasMixerComponent component, GasAnal

args.DeviceFlipped = inletOne != null && inletTwo != null && inletOne.CurrentPipeDirection.ToDirection() == inletTwo.CurrentPipeDirection.ToDirection().GetClockwise90Degrees();
}

private void OnMapInit(EntityUid uid, GasMixerComponent mixer, MapInitEvent args) // Frontier - Init on map
{
if (mixer.StartOnMapInit)
{
mixer.Enabled = true;
DirtyUI(uid, mixer);

UpdateAppearance(uid, mixer);
_userInterfaceSystem.CloseUi(uid, GasFilterUiKey.Key);
}
}
}
}
Loading

0 comments on commit 60dd5b6

Please sign in to comment.