Skip to content

Commit

Permalink
Merge branch 'master' into shrmip
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardo-dabepis authored Mar 15, 2024
2 parents a5807b9 + a719ee0 commit 18960c1
Show file tree
Hide file tree
Showing 2,460 changed files with 141,013 additions and 83,590 deletions.
4 changes: 2 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4="
fi
use flake
5 changes: 1 addition & 4 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@

/Resources/ @DebugOk
/Resources/ConfigPresets/ @DebugOk
/Resources/*.yml @DebugOk
/Resources/*.yml @DebugOk @Colin-Tel
/Resources/*/SimpleStation14/ @DEATHB4DEFEAT
# /Resources/Textures/ @leonardo-dabepis # No write access
# /Resources/DeltaV/Textures/ @leonardo-dabepis
# /Resources/Nyanotrasen/Textures/ @leonardo-dabepis
/Resources/Maps/ @IamVelcroboy
/Resources/Prototypes/Maps/ @IamVelcroboy

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
username: ${{ secrets.PUBLISH_USER }}
key: ${{ secrets.PUBLISH_KEY }}
port: ${{ secrets.PUBLISH_PORT }}
script: /home/${{ secrets.PUBLISH_USER }}/publish/push.ps1 ${{ github.sha }}
script: /home/deltav/publish/push.ps1 ${{ github.sha }}

- name: Publish changelog (Discord)
run: Tools/actions_changelogs_since_last_run.py
Expand Down
72 changes: 69 additions & 3 deletions Content.Client/Actions/ActionsSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.IO;
using System.Linq;
using Content.Shared.Actions;
using Content.Shared.Mapping;
using JetBrains.Annotations;
using Robust.Client.Player;
using Robust.Shared.ContentPack;
Expand Down Expand Up @@ -78,10 +79,12 @@ private void OnWorldTargetHandleState(EntityUid uid, WorldTargetActionComponent

private void BaseHandleState<T>(EntityUid uid, BaseActionComponent component, BaseActionComponentState state) where T : BaseActionComponent
{
// TODO ACTIONS use auto comp states
component.Icon = state.Icon;
component.IconOn = state.IconOn;
component.IconColor = state.IconColor;
component.Keywords = new HashSet<string>(state.Keywords);
component.Keywords.Clear();
component.Keywords.UnionWith(state.Keywords);
component.Enabled = state.Enabled;
component.Toggled = state.Toggled;
component.Cooldown = state.Cooldown;
Expand All @@ -101,8 +104,7 @@ private void BaseHandleState<T>(EntityUid uid, BaseActionComponent component, Ba
component.ItemIconStyle = state.ItemIconStyle;
component.Sound = state.Sound;

if (_playerManager.LocalEntity == component.AttachedEntity)
ActionsUpdated?.Invoke();
UpdateAction(uid, component);
}

protected override void UpdateAction(EntityUid? actionId, BaseActionComponent? action = null)
Expand Down Expand Up @@ -310,6 +312,70 @@ public void LoadActionAssignments(string path, bool userData)
AssignSlot?.Invoke(assignments);
}

/// <summary>
/// Load actions and their toolbar assignments from a file.
/// DeltaV - Load from an existing yaml stream instead
/// </summary>
public void LoadActionAssignments(YamlStream stream)
{
if (_playerManager.LocalEntity is not { } user)
return;

if (stream.Documents[0].RootNode.ToDataNode() is not SequenceDataNode sequence)
return;

ClearAssignments?.Invoke();

var assignments = new List<SlotAssignment>();
var existingActions = GetClientActions();
var existingActionsList = existingActions.ToList();

foreach (var entry in sequence.Sequence)
{
if (entry is not MappingDataNode map)
continue;

if (!map.TryGet("action", out var actionNode))
continue;

if (!map.TryGet<ValueDataNode>("name", out var nameNode))
continue;

var action = _serialization.Read<BaseActionComponent>(actionNode, notNullableOverride: true);

// Prevent spawning actions multiple times
var existing = existingActionsList.FirstOrNull(a =>
Name(a.Id) == nameNode.Value);

EntityUid actionId;
if (existing == null)
{
actionId = Spawn(null);
AddComp(actionId, action);
_metaData.SetEntityName(actionId, nameNode.Value);
DirtyEntity(actionId);
AddActionDirect(user, actionId);
}
else
{
actionId = existing.Value.Id;
}

if (!map.TryGet("assignments", out var assignmentNode))
continue;

var nodeAssignments = _serialization.Read<List<(byte Hotbar, byte Slot)>>(assignmentNode, notNullableOverride: true);

foreach (var index in nodeAssignments)
{
var assignment = new SlotAssignment(index.Hotbar, index.Slot, actionId);
assignments.Add(assignment);
}
}

AssignSlot?.Invoke(assignments);
}

public record struct SlotAssignment(byte Hotbar, byte Slot, EntityUid ActionId);
}
}
5 changes: 5 additions & 0 deletions Content.Client/Administration/Managers/ClientAdminManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Shared.Administration.Managers;
using Robust.Client.Console;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Shared.ContentPack;
using Robust.Shared.Network;
using Robust.Shared.Player;
Expand All @@ -16,6 +17,7 @@ public sealed class ClientAdminManager : IClientAdminManager, IClientConGroupImp
[Dependency] private readonly IClientConGroupController _conGroup = default!;
[Dependency] private readonly IResourceManager _res = default!;
[Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterface = default!;

private AdminData? _adminData;
private readonly HashSet<string> _availableCommands = new();
Expand Down Expand Up @@ -101,6 +103,9 @@ private void UpdateMessageRx(MsgUpdateAdminStatus message)
{
var flagsText = string.Join("|", AdminFlagsHelper.FlagsToNames(_adminData.Flags));
_sawmill.Info($"Updated admin status: {_adminData.Active}/{_adminData.Title}/{flagsText}");

if (_adminData.Active)
_userInterface.DebugMonitors.SetMonitor(DebugMonitor.Coords, true);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Administration/Systems/BwoinkSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySes
OnBwoinkTextMessageRecieved?.Invoke(this, message);
}

public void Send(NetUserId channelId, string text)
public void Send(NetUserId channelId, string text, bool playSound)
{
// Reuse the channel ID as the 'true sender'.
// Server will ignore this and if someone makes it not ignore this (which is bad, allows impersonation!!!), that will help.
RaiseNetworkEvent(new BwoinkTextMessage(channelId, channelId, text));
RaiseNetworkEvent(new BwoinkTextMessage(channelId, channelId, text, playSound: playSound));
SendInputTextUpdated(channelId, false);
}

Expand Down
2 changes: 2 additions & 0 deletions Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<BoxContainer Orientation="Vertical" HorizontalExpand="True" SizeFlagsStretchRatio="2">
<BoxContainer Access="Public" Name="BwoinkArea" VerticalExpand="True" />
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<CheckBox Visible="True" Name="PlaySound" Access="Public" Text="{Loc 'admin-bwoink-play-sound'}" Pressed="True" />
<Control HorizontalExpand="True" MinWidth="5" />
<Button Visible="True" Name="PopOut" Access="Public" Text="{Loc 'admin-logs-pop-out'}" StyleClasses="OpenBoth" HorizontalAlignment="Left" />
<Control HorizontalExpand="True" />
<Button Visible="False" Name="Bans" Text="{Loc 'admin-player-actions-bans'}" StyleClasses="OpenRight" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public sealed partial class PlayerListControl : BoxContainer
private IEntityManager _entManager;
private IUserInterfaceManager _uiManager;

private PlayerInfo? _selectedPlayer;

public PlayerListControl()
{
_entManager = IoCManager.Resolve<IEntityManager>();
Expand All @@ -50,10 +52,14 @@ private void PlayerListItemPressed(BaseButton.ButtonEventArgs? args, ListData? d
if (args == null || data is not PlayerListData {Info: var selectedPlayer})
return;

if (selectedPlayer == _selectedPlayer)
return;

if (args.Event.Function != EngineKeyFunctions.UIClick)
return;

OnSelectionChanged?.Invoke(selectedPlayer);
_selectedPlayer = selectedPlayer;

// update label text. Only required if there is some override (e.g. unread bwoink count).
if (OverrideText != null && args.Button.Children.FirstOrDefault()?.Children?.FirstOrDefault() is Label label)
Expand Down Expand Up @@ -95,13 +101,18 @@ private void FilterList()
_sortedPlayerList.Sort((a, b) => Comparison(a, b));

PlayerListContainer.PopulateList(_sortedPlayerList.Select(info => new PlayerListData(info)).ToList());
if (_selectedPlayer != null)
PlayerListContainer.Select(new PlayerListData(_selectedPlayer));
}

public void PopulateList(IReadOnlyList<PlayerInfo>? players = null)
{
players ??= _adminSystem.PlayerList;

_playerList = players.ToList();
if (_selectedPlayer != null && !_playerList.Contains(_selectedPlayer))
_selectedPlayer = null;

FilterList();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<BoxContainer Name="VolumeBox" Orientation="Vertical" HorizontalExpand="True" Margin="0 4"/>

<!-- The temperature / heat capacity / thermal energy of the solution -->
<Collapsible Orientation="Vertical">
<Collapsible>
<CollapsibleHeading Name="ThermalHeading" Title="{Loc 'admin-solutions-window-thermals'}" />
<CollapsibleBody>
<BoxContainer Name="ThermalBox" Orientation="Vertical" HorizontalExpand="True" Margin="0 4"/>
Expand All @@ -23,7 +23,7 @@
<ScrollContainer HorizontalExpand="True" VerticalExpand="True" Margin="0 4">
<BoxContainer Name="ReagentList" Orientation="Vertical"/>
</ScrollContainer>

<Button Name="AddButton" Text="{Loc 'admin-solutions-window-add-new-button'}" HorizontalExpand="True" Margin="0 4"/>
</BoxContainer>
</DefaultWindow>
6 changes: 3 additions & 3 deletions Content.Client/Administration/UI/Notes/AdminNotesLine.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void Refresh()
SeverityRect.Texture = _sprites.Frame0(new SpriteSpecifier.Texture(new ResPath(iconPath)));
}

TimeLabel.Text = Note.CreatedAt.ToString("yyyy-MM-dd HH:mm:ss");
TimeLabel.Text = Note.CreatedAt.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
ServerLabel.Text = Note.ServerName ?? "Unknown";
RoundLabel.Text = Note.Round == null ? "Unknown round" : "Round " + Note.Round;
AdminLabel.Text = Note.CreatedByName;
Expand All @@ -91,7 +91,7 @@ private void Refresh()
if (Note.ExpiryTime.Value > DateTime.UtcNow)
{
ExpiresLabel.Text = Loc.GetString("admin-note-editor-expiry-label-params",
("date", Note.ExpiryTime.Value.ToString("yyyy-MM-dd HH:mm:ss")),
("date", Note.ExpiryTime.Value.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")),
("expiresIn", (Note.ExpiryTime.Value - DateTime.UtcNow).ToString("d'd 'hh':'mm")));
ExpiresLabel.Modulate = Color.FromHex("#86DC3D");
}
Expand All @@ -104,7 +104,7 @@ private void Refresh()

if (Note.LastEditedAt > Note.CreatedAt)
{
EditedLabel.Text = Loc.GetString("admin-notes-edited", ("author", Note.EditedByName), ("date", Note.LastEditedAt));
EditedLabel.Text = Loc.GetString("admin-notes-edited", ("author", Note.EditedByName), ("date", Note.LastEditedAt.Value.ToLocalTime()));
EditedLabel.Visible = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ public AdminNotesLinePopup(SharedAdminNote note, string playerName, bool showDel
? Loc.GetString("admin-notes-round-id-unknown")
: Loc.GetString("admin-notes-round-id", ("id", note.Round));
CreatedByLabel.Text = Loc.GetString("admin-notes-created-by", ("author", note.CreatedByName));
CreatedAtLabel.Text = Loc.GetString("admin-notes-created-at", ("date", note.CreatedAt.ToString("yyyy-MM-dd HH:mm:ss")));
CreatedAtLabel.Text = Loc.GetString("admin-notes-created-at", ("date", note.CreatedAt.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")));
EditedByLabel.Text = Loc.GetString("admin-notes-last-edited-by", ("author", note.EditedByName));
EditedAtLabel.Text = Loc.GetString("admin-notes-last-edited-at", ("date", note.LastEditedAt?.ToString("yyyy-MM-dd HH:mm:ss") ?? Loc.GetString("admin-notes-edited-never")));
EditedAtLabel.Text = Loc.GetString("admin-notes-last-edited-at", ("date", note.LastEditedAt?.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss") ?? Loc.GetString("admin-notes-edited-never")));
ExpiryTimeLabel.Text = note.ExpiryTime == null
? Loc.GetString("admin-notes-expires-never")
: Loc.GetString("admin-notes-expires", ("expires", note.ExpiryTime.Value.ToString("yyyy-MM-dd HH:mm:ss")));
: Loc.GetString("admin-notes-expires", ("expires", note.ExpiryTime.Value.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")));
NoteTextEdit.InsertAtCursor(note.Message);

if (note.NoteType is NoteType.ServerBan or NoteType.RoleBan)
Expand Down
6 changes: 3 additions & 3 deletions Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public NoteEdit(SharedAdminNote? note, string playerName, bool canCreate, bool c
{
PermanentCheckBox.Pressed = false;
UpdatePermanentCheckboxFields();
ExpiryLineEdit.Text = ExpiryTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
ExpiryLineEdit.Text = ExpiryTime.Value.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");
}
}

Expand Down Expand Up @@ -173,7 +173,7 @@ private void UpdatePermanentCheckboxFields()
ExpiryLabel.Visible = !PermanentCheckBox.Pressed;
ExpiryLineEdit.Visible = !PermanentCheckBox.Pressed;

ExpiryLineEdit.Text = !PermanentCheckBox.Pressed ? DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty;
ExpiryLineEdit.Text = !PermanentCheckBox.Pressed ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty;
}

private void OnSecretPressed(BaseButton.ButtonEventArgs _)
Expand Down Expand Up @@ -269,7 +269,7 @@ private bool ParseExpiryTime()
return false;
}

ExpiryTime = result;
ExpiryTime = result.ToUniversalTime();
ExpiryLineEdit.ModulateSelfOverride = null;
return true;
}
Expand Down
3 changes: 1 addition & 2 deletions Content.Client/Ame/UI/AmeControllerBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Content.Shared.Ame;
using Content.Shared.Ame.Components;
using JetBrains.Annotations;
using Robust.Client.GameObjects;

namespace Content.Client.Ame.UI
{
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Ame/UI/AmeWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Content.Client.UserInterface;
using Content.Shared.Ame;
using Content.Shared.Ame.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<BoxContainer xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Orientation="Vertical" Margin="2 0 2 4">
<Collapsible Orientation="Vertical">
<Collapsible>
<CollapsibleHeading Name="CAddress" />
<!-- Upper row: toggle, direction, checks -->
<CollapsibleBody Margin="20 0 0 0">
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Atmos/Monitor/UI/Widgets/ScrubberControl.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<BoxContainer xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Orientation="Vertical" Margin="2 0 2 4">
<Collapsible Orientation="Vertical">
<Collapsible>
<CollapsibleHeading Name="CAddress" />
<CollapsibleBody Margin="20 0 0 0">
<BoxContainer Orientation="Vertical">
Expand All @@ -26,7 +26,7 @@
<Button Name="CCopySettings" Text="{Loc 'air-alarm-ui-widget-copy'}" ToolTip="{Loc 'air-alarm-ui-widget-copy-tooltip'}" />
</BoxContainer>
<!-- Lower row: every single gas -->
<Collapsible Orientation="Vertical" Margin="2 2 2 2">
<Collapsible Margin="2 2 2 2">
<CollapsibleHeading Title="Gas filters" />
<CollapsibleBody Margin="20 0 0 0">
<GridContainer HorizontalExpand="True" Name="CGasContainer" Columns="3" />
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Atmos/Monitor/UI/Widgets/SensorInfo.xaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<BoxContainer xmlns="https://spacestation14.io" HorizontalExpand="True">
<Collapsible Orientation="Vertical">
<Collapsible>
<CollapsibleHeading Name="SensorAddress" />
<CollapsibleBody Margin="20 2 2 2">
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
Expand All @@ -10,7 +10,7 @@
<RichTextLabel Name="TemperatureLabel" />
<Control Name="TemperatureThresholdContainer" Margin="20 0 2 0" />
</BoxContainer>
<Collapsible Orientation="Vertical" Margin="2">
<Collapsible Margin="2">
<CollapsibleHeading Title="{Loc 'air-alarm-ui-sensor-gases'}" />
<CollapsibleBody Margin="20 0 0 0">
<BoxContainer Name="GasContainer" Orientation="Vertical" Margin="2" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<BoxContainer xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Orientation="Vertical" Margin="0 0 0 4">
<Collapsible Orientation="Vertical">
<Collapsible>
<CollapsibleHeading Name="CName" />
<CollapsibleBody Margin="20 0 0 0">
<BoxContainer Orientation="Vertical">
Expand Down
Loading

0 comments on commit 18960c1

Please sign in to comment.