Content update for NetEntities (#18935)
This commit is contained in:
@@ -18,7 +18,6 @@ namespace Content.Client.Administration.UI.CustomControls
|
||||
public sealed partial class PlayerListControl : BoxContainer
|
||||
{
|
||||
private readonly AdminSystem _adminSystem;
|
||||
private readonly VerbSystem _verbSystem;
|
||||
|
||||
private List<PlayerInfo> _playerList = new();
|
||||
private readonly List<PlayerInfo> _sortedPlayerList = new();
|
||||
@@ -29,11 +28,14 @@ namespace Content.Client.Administration.UI.CustomControls
|
||||
public Func<PlayerInfo, string, string>? OverrideText;
|
||||
public Comparison<PlayerInfo>? Comparison;
|
||||
|
||||
private IEntityManager _entManager;
|
||||
private IUserInterfaceManager _uiManager;
|
||||
|
||||
public PlayerListControl()
|
||||
{
|
||||
_adminSystem = EntitySystem.Get<AdminSystem>();
|
||||
_verbSystem = EntitySystem.Get<VerbSystem>();
|
||||
IoCManager.InjectDependencies(this);
|
||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||
_uiManager = IoCManager.Resolve<IUserInterfaceManager>();
|
||||
_adminSystem = _entManager.System<AdminSystem>();
|
||||
RobustXamlLoader.Load(this);
|
||||
// Fill the Option data
|
||||
PlayerListContainer.ItemPressed += PlayerListItemPressed;
|
||||
@@ -56,9 +58,9 @@ namespace Content.Client.Administration.UI.CustomControls
|
||||
if (OverrideText != null && args.Button.Children.FirstOrDefault()?.Children?.FirstOrDefault() is Label label)
|
||||
label.Text = GetText(selectedPlayer);
|
||||
}
|
||||
else if (args.Event.Function == EngineKeyFunctions.UseSecondary && selectedPlayer.EntityUid != null)
|
||||
else if (args.Event.Function == EngineKeyFunctions.UseSecondary && selectedPlayer.NetEntity != null)
|
||||
{
|
||||
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<VerbMenuUIController>().OpenVerbMenu(selectedPlayer.EntityUid.Value);
|
||||
_uiManager.GetUIController<VerbMenuUIController>().OpenVerbMenu(_entManager.GetEntity(selectedPlayer.NetEntity.Value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,11 @@ namespace Content.Client.Administration.UI.ManageSolutions
|
||||
public sealed class EditSolutionsEui : BaseEui
|
||||
{
|
||||
private readonly EditSolutionsWindow _window;
|
||||
private IEntityManager _entManager;
|
||||
|
||||
public EditSolutionsEui()
|
||||
{
|
||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||
_window = new EditSolutionsWindow();
|
||||
_window.OnClose += () => SendMessage(new CloseEuiMessage());
|
||||
}
|
||||
@@ -34,7 +36,7 @@ namespace Content.Client.Administration.UI.ManageSolutions
|
||||
public override void HandleState(EuiStateBase baseState)
|
||||
{
|
||||
var state = (EditSolutionsEuiState) baseState;
|
||||
_window.SetTargetEntity(state.Target);
|
||||
_window.SetTargetEntity(_entManager.GetEntity(state.Target));
|
||||
_window.UpdateSolutions(state.Solutions);
|
||||
_window.UpdateReagents();
|
||||
}
|
||||
|
||||
@@ -9,8 +9,11 @@ namespace Content.Client.Administration.UI.SetOutfit
|
||||
public sealed class SetOutfitEui : BaseEui
|
||||
{
|
||||
private readonly SetOutfitMenu _window;
|
||||
private IEntityManager _entManager;
|
||||
|
||||
public SetOutfitEui()
|
||||
{
|
||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||
_window = new SetOutfitMenu();
|
||||
_window.OnClose += OnClosed;
|
||||
}
|
||||
@@ -34,7 +37,7 @@ namespace Content.Client.Administration.UI.SetOutfit
|
||||
public override void HandleState(EuiStateBase state)
|
||||
{
|
||||
var outfitState = (SetOutfitEuiState) state;
|
||||
_window.TargetEntityId = outfitState.TargetEntityId;
|
||||
_window.TargetEntityId = _entManager.GetEntity(outfitState.TargetNetEntity);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Content.Client.Administration.UI.SpawnExplosion;
|
||||
[UsedImplicitly]
|
||||
public sealed class SpawnExplosionEui : BaseEui
|
||||
{
|
||||
[Dependency] private readonly EntityManager _entManager = default!;
|
||||
[Dependency] private readonly IOverlayManager _overlayManager = default!;
|
||||
|
||||
private readonly SpawnExplosionWindow _window;
|
||||
@@ -69,7 +70,14 @@ public sealed class SpawnExplosionEui : BaseEui
|
||||
_overlayManager.AddOverlay(_debugOverlay);
|
||||
}
|
||||
|
||||
_debugOverlay.Tiles = data.Explosion.Tiles;
|
||||
var tiles = new Dictionary<EntityUid, Dictionary<int, List<Vector2i>>>();
|
||||
_debugOverlay.Tiles.Clear();
|
||||
|
||||
foreach (var (nent, det) in data.Explosion.Tiles)
|
||||
{
|
||||
tiles[_entManager.GetEntity(nent)] = det;
|
||||
}
|
||||
|
||||
_debugOverlay.SpaceTiles = data.Explosion.SpaceTiles;
|
||||
_debugOverlay.Intensity = data.Explosion.Intensity;
|
||||
_debugOverlay.Slope = data.Slope;
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
||||
private void OnTeleportButtonPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||
$"tp {XCoordinate.Value} {YCoordinate.Value} {MapOptions.SelectedId}");
|
||||
$"tp {XCoordinate.Value} {YCoordinate.Value} {new NetEntity(MapOptions.SelectedId)}");
|
||||
}
|
||||
|
||||
private void OnSubmitButtonPressed(BaseButton.ButtonEventArgs obj)
|
||||
@@ -112,7 +112,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
||||
if (MapPath.Text.Length == 0) return;
|
||||
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||
$"loadbp {MapOptions.SelectedId} \"{MapPath.Text}\" {XCoordinate.Value} {YCoordinate.Value} {RotationSpin.Value}");
|
||||
$"loadbp {new NetEntity(MapOptions.SelectedId)} \"{MapPath.Text}\" {XCoordinate.Value} {YCoordinate.Value} {RotationSpin.Value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,9 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
if (_data == null)
|
||||
return;
|
||||
var dataList = _data.ToList();
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
var selectedGrid = dataList[GridOptions.SelectedId].Owner;
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {selectedGrid}");
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {entManager.GetNetEntity(selectedGrid)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
|
||||
var selectedGrid = _data[GridOptions.SelectedId];
|
||||
IoCManager.Resolve<IClientConsoleHost>()
|
||||
.ExecuteCommand($"settemp {TileXSpin.Value} {TileYSpin.Value} {selectedGrid} {TemperatureSpin.Value}");
|
||||
.ExecuteCommand($"settemp {TileXSpin.Value} {TileYSpin.Value} {IoCManager.Resolve<IEntityManager>().GetNetEntity(selectedGrid)} {TemperatureSpin.Value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
|
||||
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>();
|
||||
|
||||
@@ -29,7 +30,8 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
|
||||
|
||||
public PlayerTab()
|
||||
{
|
||||
_adminSystem = EntitySystem.Get<AdminSystem>();
|
||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||
_adminSystem = _entManager.System<AdminSystem>();
|
||||
RobustXamlLoader.Load(this);
|
||||
RefreshPlayerList(_adminSystem.PlayerList);
|
||||
|
||||
@@ -119,7 +121,7 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
|
||||
player.Antag ? "YES" : "NO",
|
||||
new StyleBoxFlat(useAltColor ? _altColor : _defaultColor),
|
||||
player.Connected);
|
||||
entry.PlayerUid = player.EntityUid;
|
||||
entry.PlayerUid = _entManager.GetEntity(player.NetEntity);
|
||||
entry.OnPressed += args => OnEntryPressed?.Invoke(args);
|
||||
PlayerList.AddChild(entry);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user