Skip to content

Commit

Permalink
Merge pull request #330 from formlessnameless/dev
Browse files Browse the repository at this point in the history
Upstream merge
  • Loading branch information
formlessnameless authored Sep 23, 2024
2 parents ac75729 + 5317722 commit 8360496
Show file tree
Hide file tree
Showing 90 changed files with 47,450 additions and 32,926 deletions.
16 changes: 0 additions & 16 deletions Content.Client/Buckle/BuckleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<BuckleComponent, ComponentHandleState>(OnHandleState);
SubscribeLocalEvent<BuckleComponent, AppearanceChangeEvent>(OnAppearanceChange);
SubscribeLocalEvent<StrapComponent, MoveEvent>(OnStrapMoveEvent);
}
Expand Down Expand Up @@ -57,21 +56,6 @@ private void OnStrapMoveEvent(EntityUid uid, StrapComponent component, ref MoveE
}
}

private void OnHandleState(Entity<BuckleComponent> ent, ref ComponentHandleState args)
{
if (args.Current is not BuckleState state)
return;

ent.Comp.DontCollide = state.DontCollide;
ent.Comp.BuckleTime = state.BuckleTime;
var strapUid = EnsureEntity<BuckleComponent>(state.BuckledTo, ent);

SetBuckledTo(ent, strapUid == null ? null : new (strapUid.Value, null));

var (uid, component) = ent;

}

private void OnAppearanceChange(EntityUid uid, BuckleComponent component, ref AppearanceChangeEvent args)
{
if (!TryComp<RotationVisualsComponent>(uid, out var rotVisuals))
Expand Down
1 change: 1 addition & 0 deletions Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Orientation="Vertical">
<BoxContainer Orientation="Horizontal" Margin="0 0 0 5">
<SpriteView OverrideDirection="South" Scale="2 2" Name="SpriteView" Access="Public" SetSize="64 64" />
<TextureRect Name="NoDataTex" Access="Public" SetSize="64 64" Visible="false" Stretch="KeepAspectCentered" TexturePath="/Textures/Interface/Misc/health_analyzer_out_of_range.png"/>
<BoxContainer Margin="5 0 0 0" Orientation="Vertical" VerticalAlignment="Top">
<RichTextLabel Name="NameLabel" SetWidth="150" />
<Label Name="SpeciesLabel" VerticalAlignment="Top" StyleClasses="LabelSubText" />
Expand Down
2 changes: 2 additions & 0 deletions Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public void Populate(HealthAnalyzerScannedUserMessage msg)
// Patient Information

SpriteView.SetEntity(target.Value);
SpriteView.Visible = msg.ScanMode.HasValue && msg.ScanMode.Value;
NoDataTex.Visible = !SpriteView.Visible;

var name = new FormattedMessage();
name.PushColor(Color.White);
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Lobby/UI/LobbyGui.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Stretch="KeepAspectCovered" />
<BoxContainer Name="MainContainer" VerticalExpand="True" HorizontalExpand="True" Orientation="Horizontal"
Margin="10 10 10 10" SeparationOverride="2">
<SplitContainer State="Auto" HorizontalExpand="True">
<SplitContainer State="Auto" ResizeMode="NotResizable" HorizontalExpand="True">
<!-- LHS Controls -->
<BoxContainer Name="LeftSide" Orientation="Vertical" SeparationOverride="4" HorizontalExpand="True">
<Control Name="DefaultState" VerticalExpand="True">
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Store/Ui/StoreListingControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void UpdateBuyButtonText()
if (_data.RestockTime > stationTime)
{
var timeLeftToBuy = stationTime - _data.RestockTime;
StoreItemBuyButton.Text = timeLeftToBuy.Duration().ToString(@"mm\:ss");
StoreItemBuyButton.Text = timeLeftToBuy.Duration().ToString(@"mm\:ss");
}
else
{
Expand Down
3 changes: 3 additions & 0 deletions Content.Client/UserInterface/Controls/DialogWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public DialogWindow(string title, List<QuickDialogEntry> entries, bool ok = true
Prompts.AddChild(box);
}

// Grab keyboard focus for the first dialog entry
_promptLines[0].Item2.GrabKeyboardFocus();

OkButton.OnPressed += _ => Confirm();

CancelButton.OnPressed += _ =>
Expand Down
20 changes: 4 additions & 16 deletions Content.Client/VendingMachines/VendingMachineBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,17 @@ protected override void Open()
{
base.Open();

var vendingMachineSys = EntMan.System<VendingMachineSystem>();

_cachedInventory = vendingMachineSys.GetAllInventory(Owner);

_menu = this.CreateWindow<VendingMachineMenu>();
_menu.OpenCenteredLeft();
_menu.Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName;

_menu.OnItemSelected += OnItemSelected;

_menu.Populate(_cachedInventory);

_menu.OpenCenteredLeft();
Refresh();
}

protected override void UpdateState(BoundUserInterfaceState state)
public void Refresh()
{
base.UpdateState(state);

if (state is not VendingMachineInterfaceState newState)
return;

_cachedInventory = newState.Inventory;
var system = EntMan.System<VendingMachineSystem>();
_cachedInventory = system.GetAllInventory(Owner);

_menu?.Populate(_cachedInventory);
}
Expand Down
10 changes: 10 additions & 0 deletions Content.Client/VendingMachines/VendingMachineSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,23 @@ public sealed class VendingMachineSystem : SharedVendingMachineSystem
{
[Dependency] private readonly AnimationPlayerSystem _animationPlayer = default!;
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly SharedUserInterfaceSystem _uiSystem = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<VendingMachineComponent, AppearanceChangeEvent>(OnAppearanceChange);
SubscribeLocalEvent<VendingMachineComponent, AnimationCompletedEvent>(OnAnimationCompleted);
SubscribeLocalEvent<VendingMachineComponent, AfterAutoHandleStateEvent>(OnVendingAfterState);
}

private void OnVendingAfterState(EntityUid uid, VendingMachineComponent component, ref AfterAutoHandleStateEvent args)
{
if (_uiSystem.TryGetOpenUi<VendingMachineBoundUserInterface>(uid, VendingMachineUiKey.Key, out var bui))
{
bui.Refresh();
}
}

private void OnAnimationCompleted(EntityUid uid, VendingMachineComponent component, AnimationCompletedEvent args)
Expand Down
71 changes: 25 additions & 46 deletions Content.Server/Administration/Commands/RoleBanListCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Linq;
using System.Text;
using Content.Server.Administration.BanList;
using Content.Server.EUI;
using Content.Server.Database;
using Content.Shared.Administration;
using Robust.Server.Player;
Expand All @@ -10,6 +12,12 @@ namespace Content.Server.Administration.Commands;
[AdminCommand(AdminFlags.Ban)]
public sealed class RoleBanListCommand : IConsoleCommand
{
[Dependency] private readonly IServerDbManager _dbManager = default!;

[Dependency] private readonly EuiManager _eui = default!;

[Dependency] private readonly IPlayerLocator _locator = default!;

public string Command => "rolebanlist";
public string Description => Loc.GetString("cmd-rolebanlist-desc");
public string Help => Loc.GetString("cmd-rolebanlist-help");
Expand All @@ -29,66 +37,37 @@ public async void Execute(IConsoleShell shell, string argStr, string[] args)
return;
}

var dbMan = IoCManager.Resolve<IServerDbManager>();

var target = args[0];
var data = await _locator.LookupIdByNameOrIdAsync(args[0]);

var locator = IoCManager.Resolve<IPlayerLocator>();
var located = await locator.LookupIdByNameOrIdAsync(target);
if (located == null)
if (data == null)
{
shell.WriteError("Unable to find a player with that name or id.");
return;
}

var targetUid = located.UserId;
var targetHWid = located.LastHWId;
var targetAddress = located.LastAddress;

var bans = await dbMan.GetServerRoleBansAsync(targetAddress, targetUid, targetHWid, includeUnbanned);

if (bans.Count == 0)
if (shell.Player is not { } player)
{
shell.WriteLine("That user has no bans in their record.");
return;
}

var bansString = new StringBuilder("Bans in record:\n");
var bans = await _dbManager.GetServerRoleBansAsync(data.LastAddress, data.UserId, data.LastHWId, includeUnbanned);

var first = true;
foreach (var ban in bans)
{
if (!first)
bansString.Append("\n\n");
else
first = false;

bansString
.Append("Ban ID: ")
.Append(ban.Id)
.Append('\n')
.Append("Role: ")
.Append(ban.Role)
.Append('\n')
.Append("Banned on ")
.Append(ban.BanTime);

if (ban.ExpirationTime != null)
if (bans.Count == 0)
{
bansString
.Append(" until ")
.Append(ban.ExpirationTime.Value);
shell.WriteLine("That user has no bans in their record.");
return;
}

bansString
.Append('\n');

bansString
.Append("Reason: ")
.Append(ban.Reason);
foreach (var ban in bans)
{
var msg = $"ID: {ban.Id}: Role: {ban.Role} Reason: {ban.Reason}";
shell.WriteLine(msg);
}
return;
}

shell.WriteLine(bansString.ToString());
var ui = new BanListEui();
_eui.OpenEui(ui, player);
await ui.ChangeBanListPlayer(data.UserId);

}

public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Content.Server.Atmos.Piping.Unary.Components
{
// The world if people documented their shit.
[AutoGenerateComponentPause]
[RegisterComponent]
public sealed partial class GasVentPumpComponent : Component
{
Expand All @@ -15,31 +16,25 @@ public sealed partial class GasVentPumpComponent : Component
[ViewVariables]
public bool IsDirty { get; set; } = false;

[ViewVariables(VVAccess.ReadWrite)]
[DataField("inlet")]
[DataField]
public string Inlet { get; set; } = "pipe";

[ViewVariables(VVAccess.ReadWrite)]
[DataField("outlet")]
[DataField]
public string Outlet { get; set; } = "pipe";

[ViewVariables(VVAccess.ReadWrite)]
[DataField("pumpDirection")]
[DataField]
public VentPumpDirection PumpDirection { get; set; } = VentPumpDirection.Releasing;

[ViewVariables(VVAccess.ReadWrite)]
[DataField("pressureChecks")]
[DataField]
public VentPressureBound PressureChecks { get; set; } = VentPressureBound.ExternalBound;

[ViewVariables(VVAccess.ReadOnly)]
[DataField("underPressureLockout")]
[DataField]
public bool UnderPressureLockout { get; set; } = false;

/// <summary>
/// In releasing mode, do not pump when environment pressure is below this limit.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("underPressureLockoutThreshold")]
[DataField]
public float UnderPressureLockoutThreshold = 80; // this must be tuned in conjunction with atmos.mmos_spacing_speed

/// <summary>
Expand All @@ -55,12 +50,30 @@ public sealed partial class GasVentPumpComponent : Component
/// repressurizing of the development map take about 30 minutes using an oxygen tank (high pressure)
/// </remarks>

[ViewVariables(VVAccess.ReadWrite)]
[DataField("underPressureLockoutLeaking")]
[DataField]
public float UnderPressureLockoutLeaking = 0.0001f;
/// <summary>
/// Is the vent pressure lockout currently manually disabled?
/// </summary>
[DataField]
public bool IsPressureLockoutManuallyDisabled = false;
/// <summary>
/// The time when the manual pressure lockout will be reenabled.
/// </summary>
[DataField]
[AutoPausedField]
public TimeSpan ManualLockoutReenabledAt;
/// <summary>
/// How long the lockout should remain manually disabled after being interacted with.
/// </summary>
[DataField]
public TimeSpan ManualLockoutDisabledDuration = TimeSpan.FromSeconds(30); // Enough time to fill a 5x5 room
/// <summary>
/// How long the doAfter should take when attempting to manually disable the pressure lockout.
/// </summary>
public float ManualLockoutDisableDoAfter = 2.0f;

[ViewVariables(VVAccess.ReadWrite)]
[DataField("externalPressureBound")]
[DataField]
public float ExternalPressureBound
{
get => _externalPressureBound;
Expand All @@ -72,8 +85,7 @@ public float ExternalPressureBound

private float _externalPressureBound = Atmospherics.OneAtmosphere;

[ViewVariables(VVAccess.ReadWrite)]
[DataField("internalPressureBound")]
[DataField]
public float InternalPressureBound
{
get => _internalPressureBound;
Expand All @@ -88,8 +100,7 @@ public float InternalPressureBound
/// <summary>
/// Max pressure of the target gas (NOT relative to source).
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("maxPressure")]
[DataField]
public float MaxPressure = Atmospherics.MaxOutputPressure;

/// <summary>
Expand All @@ -100,8 +111,7 @@ public float InternalPressureBound
/// is too high, and the vent is connected to a large pipe-net, then someone can nearly instantly flood a
/// room with gas.
/// </remarks>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("targetPressureChange")]
[DataField]
public float TargetPressureChange = Atmospherics.OneAtmosphere;

/// <summary>
Expand All @@ -111,29 +121,26 @@ public float InternalPressureBound
/// Vents cannot suck a pipe completely empty, instead pressurizing a section to a max of
/// pipe pressure * PumpPower (in kPa). So a 51 kPa pipe is required for 101 kPA sections at PumpPower 2.0
/// </remarks>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("PumpPower")]
[DataField]
public float PumpPower = 2.0f;

#region Machine Linking
/// <summary>
/// Whether or not machine linking is enabled for this component.
/// </summary>
[DataField("canLink")]
[DataField]
public bool CanLink = false;

[DataField("pressurizePort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string PressurizePort = "Pressurize";

[DataField("depressurizePort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string DepressurizePort = "Depressurize";

[ViewVariables(VVAccess.ReadWrite)]
[DataField("pressurizePressure")]
[DataField]
public float PressurizePressure = Atmospherics.OneAtmosphere;

[ViewVariables(VVAccess.ReadWrite)]
[DataField("depressurizePressure")]
[DataField]
public float DepressurizePressure = 0;

// When true, ignore under-pressure lockout. Used to re-fill rooms in air alarm "Fill" mode.
Expand Down
Loading

0 comments on commit 8360496

Please sign in to comment.