Compare commits

...

5 Commits

Author SHA1 Message Date
metalgearsloth
8a440d705f Version: 148.2.0 2023-08-20 15:53:35 +10:00
metalgearsloth
5849474022 Add IsPaused to EntityManager (#4277) 2023-08-20 15:50:11 +10:00
c4llv07e
b7d67c0ece Fix UserInterface.SetActiveTheme didn't update theme (#4263) 2023-08-20 03:36:38 +10:00
Pieter-Jan Briers
b04cf71bc0 Expose SpinBox.LineEditControl 2023-08-19 16:32:05 +02:00
Leon Friedrich
ea87df649a Add readonly VV attributes to various fields. (#4265) 2023-08-20 00:13:18 +10:00
11 changed files with 63 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
<Project>
<!-- This file automatically reset by Tools/version.py -->
<!-- This file automatically reset by Tools/version.py -->

View File

@@ -54,6 +54,19 @@ END TEMPLATE-->
*None yet*
## 148.2.0
### New features
* `SpinBox.LineEditControl` exposes the underlying `LineEdit`.
* Add VV attributes to various fields across overlay and sessions.
* Add IsPaused to EntityManager to check if an entity is paused.
### Bugfixes
* Fix SetActiveTheme not updating the theme.
## 148.1.0
### New features

View File

@@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Timing;
using Robust.Shared.ViewVariables;
namespace Robust.Client.Graphics
{
@@ -11,6 +12,7 @@ namespace Robust.Client.Graphics
{
[Dependency] private readonly ILogManager _logMan = default!;
[ViewVariables]
private readonly Dictionary<Type, Overlay> _overlays = new Dictionary<Type, Overlay>();
private ISawmill _logger = default!;

View File

@@ -3,14 +3,18 @@ using System.Collections.Generic;
using Robust.Shared.GameStates;
using Robust.Shared.Network;
using Robust.Shared.Players;
using Robust.Shared.ViewVariables;
namespace Robust.Client.Player
{
public interface IPlayerManager : Shared.Players.ISharedPlayerManager
{
new IEnumerable<ICommonSession> Sessions { get; }
[ViewVariables]
IReadOnlyDictionary<NetUserId, ICommonSession> SessionsDict { get; }
[ViewVariables]
LocalPlayer? LocalPlayer { get; }
/// <summary>

View File

@@ -2,6 +2,7 @@ using Robust.Shared.Enums;
using Robust.Shared.GameObjects;
using Robust.Shared.Network;
using Robust.Shared.Players;
using Robust.Shared.ViewVariables;
namespace Robust.Client.Player
{
@@ -17,11 +18,14 @@ namespace Robust.Client.Player
}
/// <inheritdoc />
[ViewVariables]
public EntityUid? AttachedEntity { get; set; }
/// <inheritdoc />
[ViewVariables]
public NetUserId UserId { get; }
[ViewVariables]
internal string Name { get; set; } = "<Unknown>";
/// <inheritdoc />
@@ -31,9 +35,11 @@ namespace Robust.Client.Player
set => this.Name = value;
}
[ViewVariables]
internal short Ping { get; set; }
/// <inheritdoc />
[ViewVariables]
public INetChannel ConnectedClient { get; internal set; } = null!;
/// <inheritdoc />

View File

@@ -14,7 +14,7 @@ namespace Robust.Client.UserInterface.Controls
public const string LeftButtonStyle = "spinbox-left";
public const string RightButtonStyle = "spinbox-right";
public const string MiddleButtonStyle = "spinbox-middle";
private LineEdit _lineEdit;
public LineEdit LineEditControl { get; }
private List<Button> _leftButtons = new();
private List<Button> _rightButtons = new();
private int _stepSize = 1;
@@ -35,7 +35,7 @@ namespace Robust.Client.UserInterface.Controls
return;
}
_value = value;
_lineEdit.Text = value.ToString();
LineEditControl.Text = value.ToString();
ValueChanged?.Invoke(new ValueChangedEventArgs(value));
}
}
@@ -52,7 +52,7 @@ namespace Robust.Client.UserInterface.Controls
return;
}
_value = value;
_lineEdit.Text = value.ToString();
LineEditControl.Text = value.ToString();
}
public event Action<ValueChangedEventArgs>? ValueChanged;
@@ -62,17 +62,17 @@ namespace Robust.Client.UserInterface.Controls
Orientation = LayoutOrientation.Horizontal;
MouseFilter = MouseFilterMode.Pass;
_lineEdit = new LineEdit
LineEditControl = new LineEdit
{
MinSize = new Vector2(40, 0),
HorizontalExpand = true
};
AddChild(_lineEdit);
AddChild(LineEditControl);
Value = 0;
_lineEdit.IsValid = (str) => int.TryParse(str, out var i) && (IsValid == null || IsValid(i));
_lineEdit.OnTextChanged += (args) =>
LineEditControl.IsValid = (str) => int.TryParse(str, out var i) && (IsValid == null || IsValid(i));
LineEditControl.OnTextChanged += (args) =>
{
if (int.TryParse(args.Text, out int i))
Value = i;
@@ -143,8 +143,8 @@ namespace Robust.Client.UserInterface.Controls
/// </summary>
public bool LineEditDisabled
{
get => !_lineEdit.Editable;
set => _lineEdit.Editable = !value;
get => !LineEditControl.Editable;
set => LineEditControl.Editable = !value;
}
/// <summary>
@@ -185,7 +185,7 @@ namespace Robust.Client.UserInterface.Controls
{
base.MouseWheel(args);
if (!_lineEdit.HasKeyboardFocus())
if (!LineEditControl.HasKeyboardFocus())
{
return;
}

View File

@@ -29,7 +29,7 @@ internal partial class UserInterfaceManager
public void SetActiveTheme(string themeName)
{
if (!_themes.TryGetValue(themeName, out var theme) || (theme == CurrentTheme)) return;
CurrentTheme = theme;
UpdateTheme(theme);
}
public void SetDefaultTheme(string themeId)

View File

@@ -661,6 +661,15 @@ namespace Robust.Shared.GameObjects
return uid.HasValue && EntityExists(uid.Value);
}
/// <inheritdoc />
public bool IsPaused(EntityUid? uid, MetaDataComponent? metadata = null)
{
if (uid == null)
return false;
return _metaQuery.Resolve(uid.Value, ref metadata) && metadata.EntityPaused;
}
public bool Deleted(EntityUid uid)
{
return !_entTraitArray[CompIdx.ArrayIndex<MetaDataComponent>()].TryGetValue(uid, out var comp) || ((MetaDataComponent) comp).EntityDeleted;

View File

@@ -182,6 +182,12 @@ public partial class EntitySystem
#region Entity Metadata
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected bool IsPaused(EntityUid? uid, MetaDataComponent? metadata = null)
{
return EntityManager.IsPaused(uid, metadata);
}
/// <summary>
/// Marks an entity as dirty.
/// </summary>

View File

@@ -134,6 +134,11 @@ namespace Robust.Shared.GameObjects
/// </summary>
bool EntityExists([NotNullWhen(true)] EntityUid? uid);
/// <summary>
/// Returns true if entity is valid and paused.
/// </summary>
bool IsPaused([NotNullWhen(true)] EntityUid? uid, MetaDataComponent? metadata = null);
/// <summary>
/// Checks whether an entity with the specified ID has been deleted or is nonexistent.
/// </summary>

View File

@@ -1,5 +1,6 @@
using System;
using System.Net;
using Robust.Shared.ViewVariables;
namespace Robust.Shared.Network
{
@@ -28,10 +29,13 @@ namespace Robust.Shared.Network
/// On the server, this is the session ID for this client.
/// On the client, this is the session ID for the client.
/// </summary>
[ViewVariables]
NetUserId UserId { get; }
[ViewVariables]
string UserName { get; }
[ViewVariables]
LoginType AuthType { get; }
/// <summary>
@@ -47,11 +51,13 @@ namespace Robust.Shared.Network
/// <summary>
/// Average round trip time in milliseconds between the remote peer and us.
/// </summary>
[ViewVariables]
short Ping { get; }
/// <summary>
/// Whether or not the channel is currently connected to a remote peer.
/// </summary>
[ViewVariables]
bool IsConnected { get; }
NetUserData UserData { get; }