Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin-Tel committed Nov 17, 2023
2 parents 3bd00af + 9ec80aa commit 5ec1955
Show file tree
Hide file tree
Showing 1,891 changed files with 406,726 additions and 343,514 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -338,5 +338,8 @@ dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter
resharper_braces_for_ifelse = required_for_multiline
resharper_keep_existing_attribute_arrangement = true

[*.{csproj,xml,yml,dll.config,msbuildproj,targets}]
[*.{csproj,xml,yml,yaml,dll.config,msbuildproj,targets}]
indent_size = 2

[{*.yaml,*.yml}]
ij_yaml_indent_sequence_value = false
13 changes: 10 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@ jobs:
cd RobustToolbox
git fetch --depth=1
- name: Install dependencies
run: dotnet restore

- name: Build Packaging
run: dotnet build Content.Packaging --configuration Release --no-restore /m

- name: Package server
run: dotnet run --project Content.Packaging server --platform win-x64 --platform linux-x64 --platform osx-x64 --platform linux-arm64

- name: Package client
run: |
Tools/package_server_build.py -p win-x64 linux-x64 osx-x64 linux-arm64
Tools/package_client_build.py
run: dotnet run --project Content.Packaging client --no-wipe-release

- name: Update Build Info
run: Tools/gen_build_info.py
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/test-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@ jobs:
- name: Install dependencies
run: dotnet restore

- name: Package client
run: |
Tools/package_server_build.py -p win-x64 linux-x64 osx-x64 linux-arm64
Tools/package_client_build.py
- name: Build Packaging
run: dotnet build Content.Packaging --configuration Release --no-restore /m

- name: Package server
run: dotnet run --project Content.Packaging server --platform win-x64 --platform linux-x64 --platform osx-x64 --platform linux-arm64

- name: Package client
run: dotnet run --project Content.Packaging client --no-wipe-release

- name: Update Build Info
run: Tools/gen_build_info.py

Expand Down
11 changes: 6 additions & 5 deletions Content.Client/Actions/ActionsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
using System.Linq;
using Content.Shared.Actions;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.ContentPack;
using Robust.Shared.GameStates;
using Robust.Shared.Input.Binding;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager;
using Robust.Shared.Serialization.Markdown;
using Robust.Shared.Serialization.Markdown.Mapping;
Expand Down Expand Up @@ -41,8 +41,8 @@ public sealed class ActionsSystem : SharedActionsSystem
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ActionsComponent, PlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<ActionsComponent, PlayerDetachedEvent>(OnPlayerDetached);
SubscribeLocalEvent<ActionsComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<ActionsComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);
SubscribeLocalEvent<ActionsComponent, ComponentHandleState>(HandleComponentState);

SubscribeLocalEvent<InstantActionComponent, ComponentHandleState>(OnInstantHandleState);
Expand Down Expand Up @@ -93,6 +93,7 @@ private void BaseHandleState<T>(EntityUid uid, BaseActionComponent component, Ba
component.ClientExclusive = state.ClientExclusive;
component.Priority = state.Priority;
component.AttachedEntity = EnsureEntity<T>(state.AttachedEntity, uid);
component.RaiseOnUser = state.RaiseOnUser;
component.AutoPopulate = state.AutoPopulate;
component.Temporary = state.Temporary;
component.ItemIconStyle = state.ItemIconStyle;
Expand Down Expand Up @@ -196,12 +197,12 @@ protected override void ActionRemoved(EntityUid performer, EntityUid actionId, A
return GetActions(user);
}

private void OnPlayerAttached(EntityUid uid, ActionsComponent component, PlayerAttachedEvent args)
private void OnPlayerAttached(EntityUid uid, ActionsComponent component, LocalPlayerAttachedEvent args)
{
LinkAllActions(component);
}

private void OnPlayerDetached(EntityUid uid, ActionsComponent component, PlayerDetachedEvent? args = null)
private void OnPlayerDetached(EntityUid uid, ActionsComponent component, LocalPlayerDetachedEvent? args = null)
{
UnlinkAllActions();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Robust.Client.Player;
using Robust.Shared.ContentPack;
using Robust.Shared.Network;
using Robust.Shared.Players;
using Robust.Shared.Player;
using Robust.Shared.Utility;

namespace Content.Client.Administration.Managers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public sealed partial class PlayerListControl : BoxContainer
private List<PlayerInfo> _playerList = new();
private readonly List<PlayerInfo> _sortedPlayerList = new();

public event Action<PlayerInfo?>? OnSelectionChanged;
public event Action<PlayerInfo>? OnSelectionChanged;
public IReadOnlyList<PlayerInfo> PlayerInfo => _playerList;

public Func<PlayerInfo, string, string>? OverrideText;
Expand All @@ -46,9 +46,9 @@ public PlayerListControl()
BackgroundPanel.PanelOverride = new StyleBoxFlat {BackgroundColor = new Color(32, 32, 40)};
}

private void PlayerListItemPressed(BaseButton.ButtonEventArgs args, ListData data)
private void PlayerListItemPressed(BaseButton.ButtonEventArgs? args, ListData? data)
{
if (data is not PlayerListData {Info: var selectedPlayer})
if (args == null || data is not PlayerListData {Info: var selectedPlayer})
return;
if (args.Event.Function == EngineKeyFunctions.UIClick)
{
Expand All @@ -60,7 +60,7 @@ private void PlayerListItemPressed(BaseButton.ButtonEventArgs args, ListData dat
}
else if (args.Event.Function == EngineKeyFunctions.UseSecondary && selectedPlayer.NetEntity != null)
{
_uiManager.GetUIController<VerbMenuUIController>().OpenVerbMenu(_entManager.GetEntity(selectedPlayer.NetEntity.Value));
_uiManager.GetUIController<VerbMenuUIController>().OpenVerbMenu(selectedPlayer.NetEntity.Value, true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Players;

namespace Content.Client.Administration.UI.Tabs.AdminTab
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
[GenerateTypedNameReferences]
public sealed partial class PlayerTab : Control
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IPlayerManager _playerMan = default!;

private const string ArrowUp = "↑";
private const string ArrowDown = "↓";
private readonly Color _altColor = Color.FromHex("#292B38");
private readonly Color _defaultColor = Color.FromHex("#2F2F3B");
private IEntityManager _entManager;
private readonly AdminSystem _adminSystem;
private IReadOnlyList<PlayerInfo> _players = new List<PlayerInfo>();

Expand All @@ -30,7 +32,7 @@ public sealed partial class PlayerTab : Control

public PlayerTab()
{
_entManager = IoCManager.Resolve<IEntityManager>();
IoCManager.InjectDependencies(this);
_adminSystem = _entManager.System<AdminSystem>();
RobustXamlLoader.Load(this);
RefreshPlayerList(_adminSystem.PlayerList);
Expand Down Expand Up @@ -95,13 +97,11 @@ private void RefreshPlayerList(IReadOnlyList<PlayerInfo> players)
foreach (var child in PlayerList.Children.ToArray())
{
if (child is PlayerTabEntry)
child.Orphan();
child.Dispose();
}

_players = players;

var playerManager = IoCManager.Resolve<IPlayerManager>();
PlayerCount.Text = $"Players: {playerManager.PlayerCount}";
PlayerCount.Text = $"Players: {_playerMan.PlayerCount}";

var sortedPlayers = new List<PlayerInfo>(players);
sortedPlayers.Sort(Compare);
Expand Down
10 changes: 5 additions & 5 deletions Content.Client/Alerts/ClientAlertsSystem.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Linq;
using Content.Shared.Alert;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

namespace Content.Client.Alerts;
Expand All @@ -22,8 +22,8 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<AlertsComponent, PlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<AlertsComponent, PlayerDetachedEvent>(OnPlayerDetached);
SubscribeLocalEvent<AlertsComponent, LocalPlayerAttachedEvent>(OnPlayerAttached);
SubscribeLocalEvent<AlertsComponent, LocalPlayerDetachedEvent>(OnPlayerDetached);

SubscribeLocalEvent<AlertsComponent, AfterAutoHandleStateEvent>(ClientAlertsHandleState);
}
Expand Down Expand Up @@ -69,7 +69,7 @@ private void ClientAlertsHandleState(EntityUid uid, AlertsComponent component, r
SyncAlerts?.Invoke(this, component.Alerts);
}

private void OnPlayerAttached(EntityUid uid, AlertsComponent component, PlayerAttachedEvent args)
private void OnPlayerAttached(EntityUid uid, AlertsComponent component, LocalPlayerAttachedEvent args)
{
if (_playerManager.LocalPlayer?.ControlledEntity != uid)
return;
Expand All @@ -87,7 +87,7 @@ protected override void HandleComponentShutdown(EntityUid uid, AlertsComponent c
ClearAlerts?.Invoke(this, EventArgs.Empty);
}

private void OnPlayerDetached(EntityUid uid, AlertsComponent component, PlayerDetachedEvent args)
private void OnPlayerDetached(EntityUid uid, AlertsComponent component, LocalPlayerDetachedEvent args)
{
ClearAlerts?.Invoke(this, EventArgs.Empty);
}
Expand Down
12 changes: 0 additions & 12 deletions Content.Client/CharacterInfo/CharacterInfoSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Content.Shared.CharacterInfo;
using Content.Shared.Objectives;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Client.UserInterface;

Expand All @@ -11,14 +10,11 @@ public sealed class CharacterInfoSystem : EntitySystem
[Dependency] private readonly IPlayerManager _players = default!;

public event Action<CharacterData>? OnCharacterUpdate;
public event Action? OnCharacterDetached;

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

SubscribeLocalEvent<PlayerAttachSysMessage>(OnPlayerAttached);

SubscribeNetworkEvent<CharacterInfoEvent>(OnCharacterInfoEvent);
}

Expand All @@ -33,14 +29,6 @@ public void RequestCharacterInfo()
RaiseNetworkEvent(new RequestCharacterInfoEvent(GetNetEntity(entity.Value)));
}

private void OnPlayerAttached(PlayerAttachSysMessage msg)
{
if (msg.AttachedEntity == default)
{
OnCharacterDetached?.Invoke();
}
}

private void OnCharacterInfoEvent(CharacterInfoEvent msg, EntitySessionEventArgs args)
{
var entity = GetEntity(msg.NetEntity);
Expand Down
32 changes: 24 additions & 8 deletions Content.Client/Chat/UI/SpeechBubble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Timing;
using Robust.Shared.Utility;

namespace Content.Client.Chat.UI
{
Expand All @@ -13,7 +14,8 @@ public enum SpeechType : byte
{
Emote,
Say,
Whisper
Whisper,
Looc
}

/// <summary>
Expand Down Expand Up @@ -60,12 +62,15 @@ public static SpeechBubble CreateSpeechBubble(SpeechType type, string text, Enti
case SpeechType.Whisper:
return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "whisperBox");

case SpeechType.Looc:
return new TextSpeechBubble(text, senderEntity, eyeManager, chatManager, entityManager, "emoteBox", Color.FromHex("#48d1cc"));

default:
throw new ArgumentOutOfRangeException();
}
}

public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass)
public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass, Color? fontColor = null)
{
_chatManager = chatManager;
_senderEntity = senderEntity;
Expand All @@ -75,7 +80,7 @@ public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager,
// Use text clipping so new messages don't overlap old ones being pushed up.
RectClipContent = true;

var bubble = BuildBubble(text, speechStyleClass);
var bubble = BuildBubble(text, speechStyleClass, fontColor);

AddChild(bubble);

Expand All @@ -86,7 +91,7 @@ public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager,
_verticalOffsetAchieved = -ContentSize.Y;
}

protected abstract Control BuildBubble(string text, string speechStyleClass);
protected abstract Control BuildBubble(string text, string speechStyleClass, Color? fontColor = null);

protected override void FrameUpdate(FrameEventArgs args)
{
Expand Down Expand Up @@ -164,18 +169,29 @@ public void FadeNow()

public sealed class TextSpeechBubble : SpeechBubble
{
public TextSpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass)
: base(text, senderEntity, eyeManager, chatManager, entityManager, speechStyleClass)
public TextSpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager, IEntityManager entityManager, string speechStyleClass, Color? fontColor = null)
: base(text, senderEntity, eyeManager, chatManager, entityManager, speechStyleClass, fontColor)
{
}

protected override Control BuildBubble(string text, string speechStyleClass)
protected override Control BuildBubble(string text, string speechStyleClass, Color? fontColor = null)
{
var label = new RichTextLabel
{
MaxWidth = 256,
};
label.SetMessage(text);

if (fontColor != null)
{
var msg = new FormattedMessage();
msg.PushColor(fontColor.Value);
msg.AddMarkup(text);
label.SetMessage(msg);
}
else
{
label.SetMessage(text);
}

var panel = new PanelContainer
{
Expand Down
Loading

0 comments on commit 5ec1955

Please sign in to comment.