Content update for NetEntities (#18935)

This commit is contained in:
metalgearsloth
2023-09-11 09:42:41 +10:00
committed by GitHub
parent 389c8d1a2c
commit 5a0fc68be2
526 changed files with 3058 additions and 2215 deletions

View File

@@ -67,12 +67,12 @@ namespace Content.Client.Actions
return; return;
component.Actions.Clear(); component.Actions.Clear();
component.Actions.UnionWith(state.Actions); component.Actions.UnionWith(GetEntitySet(state.Actions));
_actionHoldersQueue.Enqueue(uid); _actionHoldersQueue.Enqueue(uid);
} }
protected override void AddActionInternal(EntityUid holderId, EntityUid actionId, IContainer container, ActionsComponent holder) protected override void AddActionInternal(EntityUid holderId, EntityUid actionId, BaseContainer container, ActionsComponent holder)
{ {
// Sometimes the client receives actions from the server, before predicting that newly added components will add // Sometimes the client receives actions from the server, before predicting that newly added components will add
// their own shared actions. Just in case those systems ever decided to directly access action properties (e.g., // their own shared actions. Just in case those systems ever decided to directly access action properties (e.g.,
@@ -87,7 +87,7 @@ namespace Content.Client.Actions
} }
} }
public override void AddAction(EntityUid holderId, EntityUid actionId, EntityUid? provider, ActionsComponent? holder = null, BaseActionComponent? action = null, bool dirty = true, IContainer? actionContainer = null) public override void AddAction(EntityUid holderId, EntityUid actionId, EntityUid? provider, ActionsComponent? holder = null, BaseActionComponent? action = null, bool dirty = true, BaseContainer? actionContainer = null)
{ {
if (!Resolve(holderId, ref holder, false)) if (!Resolve(holderId, ref holder, false))
return; return;
@@ -195,7 +195,7 @@ namespace Content.Client.Actions
} }
else else
{ {
var request = new RequestPerformActionEvent(actionId); var request = new RequestPerformActionEvent(GetNetEntity(actionId));
EntityManager.RaisePredictiveEvent(request); EntityManager.RaisePredictiveEvent(request);
} }
} }

View File

@@ -35,20 +35,21 @@ namespace Content.Client.Administration
foreach (var playerInfo in _system.PlayerList) foreach (var playerInfo in _system.PlayerList)
{ {
var entity = _entityManager.GetEntity(playerInfo.NetEntity);
// Otherwise the entity can not exist yet // Otherwise the entity can not exist yet
if (!_entityManager.EntityExists(playerInfo.EntityUid)) if (entity == null || !_entityManager.EntityExists(entity))
{ {
continue; continue;
} }
var entity = playerInfo.EntityUid.Value;
// if not on the same map, continue // if not on the same map, continue
if (_entityManager.GetComponent<TransformComponent>(entity).MapID != _eyeManager.CurrentMap) if (_entityManager.GetComponent<TransformComponent>(entity.Value).MapID != _eyeManager.CurrentMap)
{ {
continue; continue;
} }
var aabb = _entityLookup.GetWorldAABB(entity); var aabb = _entityLookup.GetWorldAABB(entity.Value);
// if not on screen, continue // if not on screen, continue
if (!aabb.Intersects(in viewport)) if (!aabb.Intersects(in viewport))

View File

@@ -24,12 +24,14 @@ namespace Content.Client.Administration.Systems
// View variables verbs // View variables verbs
if (_clientConGroupController.CanViewVar()) if (_clientConGroupController.CanViewVar())
{ {
Verb verb = new(); Verb verb = new()
verb.Category = VerbCategory.Debug; {
verb.Text = "View Variables"; Category = VerbCategory.Debug,
verb.Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/vv.svg.192dpi.png")); Text = "View Variables",
verb.Act = () => _clientConsoleHost.ExecuteCommand($"vv {args.Target}"); Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/vv.svg.192dpi.png")),
verb.ClientExclusive = true; // opening VV window is client-side. Don't ask server to run this verb. Act = () => _clientConsoleHost.ExecuteCommand($"vv {GetNetEntity(args.Target)}"),
ClientExclusive = true // opening VV window is client-side. Don't ask server to run this verb.
};
args.Verbs.Add(verb); args.Verbs.Add(verb);
} }
} }

View File

@@ -18,7 +18,6 @@ namespace Content.Client.Administration.UI.CustomControls
public sealed partial class PlayerListControl : BoxContainer public sealed partial class PlayerListControl : BoxContainer
{ {
private readonly AdminSystem _adminSystem; private readonly AdminSystem _adminSystem;
private readonly VerbSystem _verbSystem;
private List<PlayerInfo> _playerList = new(); private List<PlayerInfo> _playerList = new();
private readonly List<PlayerInfo> _sortedPlayerList = new(); private readonly List<PlayerInfo> _sortedPlayerList = new();
@@ -29,11 +28,14 @@ namespace Content.Client.Administration.UI.CustomControls
public Func<PlayerInfo, string, string>? OverrideText; public Func<PlayerInfo, string, string>? OverrideText;
public Comparison<PlayerInfo>? Comparison; public Comparison<PlayerInfo>? Comparison;
private IEntityManager _entManager;
private IUserInterfaceManager _uiManager;
public PlayerListControl() public PlayerListControl()
{ {
_adminSystem = EntitySystem.Get<AdminSystem>(); _entManager = IoCManager.Resolve<IEntityManager>();
_verbSystem = EntitySystem.Get<VerbSystem>(); _uiManager = IoCManager.Resolve<IUserInterfaceManager>();
IoCManager.InjectDependencies(this); _adminSystem = _entManager.System<AdminSystem>();
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
// Fill the Option data // Fill the Option data
PlayerListContainer.ItemPressed += PlayerListItemPressed; 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) if (OverrideText != null && args.Button.Children.FirstOrDefault()?.Children?.FirstOrDefault() is Label label)
label.Text = GetText(selectedPlayer); 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));
} }
} }

View File

@@ -12,9 +12,11 @@ namespace Content.Client.Administration.UI.ManageSolutions
public sealed class EditSolutionsEui : BaseEui public sealed class EditSolutionsEui : BaseEui
{ {
private readonly EditSolutionsWindow _window; private readonly EditSolutionsWindow _window;
private IEntityManager _entManager;
public EditSolutionsEui() public EditSolutionsEui()
{ {
_entManager = IoCManager.Resolve<IEntityManager>();
_window = new EditSolutionsWindow(); _window = new EditSolutionsWindow();
_window.OnClose += () => SendMessage(new CloseEuiMessage()); _window.OnClose += () => SendMessage(new CloseEuiMessage());
} }
@@ -34,7 +36,7 @@ namespace Content.Client.Administration.UI.ManageSolutions
public override void HandleState(EuiStateBase baseState) public override void HandleState(EuiStateBase baseState)
{ {
var state = (EditSolutionsEuiState) baseState; var state = (EditSolutionsEuiState) baseState;
_window.SetTargetEntity(state.Target); _window.SetTargetEntity(_entManager.GetEntity(state.Target));
_window.UpdateSolutions(state.Solutions); _window.UpdateSolutions(state.Solutions);
_window.UpdateReagents(); _window.UpdateReagents();
} }

View File

@@ -9,8 +9,11 @@ namespace Content.Client.Administration.UI.SetOutfit
public sealed class SetOutfitEui : BaseEui public sealed class SetOutfitEui : BaseEui
{ {
private readonly SetOutfitMenu _window; private readonly SetOutfitMenu _window;
private IEntityManager _entManager;
public SetOutfitEui() public SetOutfitEui()
{ {
_entManager = IoCManager.Resolve<IEntityManager>();
_window = new SetOutfitMenu(); _window = new SetOutfitMenu();
_window.OnClose += OnClosed; _window.OnClose += OnClosed;
} }
@@ -34,7 +37,7 @@ namespace Content.Client.Administration.UI.SetOutfit
public override void HandleState(EuiStateBase state) public override void HandleState(EuiStateBase state)
{ {
var outfitState = (SetOutfitEuiState) state; var outfitState = (SetOutfitEuiState) state;
_window.TargetEntityId = outfitState.TargetEntityId; _window.TargetEntityId = _entManager.GetEntity(outfitState.TargetNetEntity);
} }
} }

View File

@@ -10,6 +10,7 @@ namespace Content.Client.Administration.UI.SpawnExplosion;
[UsedImplicitly] [UsedImplicitly]
public sealed class SpawnExplosionEui : BaseEui public sealed class SpawnExplosionEui : BaseEui
{ {
[Dependency] private readonly EntityManager _entManager = default!;
[Dependency] private readonly IOverlayManager _overlayManager = default!; [Dependency] private readonly IOverlayManager _overlayManager = default!;
private readonly SpawnExplosionWindow _window; private readonly SpawnExplosionWindow _window;
@@ -69,7 +70,14 @@ public sealed class SpawnExplosionEui : BaseEui
_overlayManager.AddOverlay(_debugOverlay); _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.SpaceTiles = data.Explosion.SpaceTiles;
_debugOverlay.Intensity = data.Explosion.Intensity; _debugOverlay.Intensity = data.Explosion.Intensity;
_debugOverlay.Slope = data.Slope; _debugOverlay.Slope = data.Slope;

View File

@@ -104,7 +104,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
private void OnTeleportButtonPressed(BaseButton.ButtonEventArgs obj) private void OnTeleportButtonPressed(BaseButton.ButtonEventArgs obj)
{ {
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand( 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) private void OnSubmitButtonPressed(BaseButton.ButtonEventArgs obj)
@@ -112,7 +112,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
if (MapPath.Text.Length == 0) return; if (MapPath.Text.Length == 0) return;
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand( 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}");
} }
} }
} }

View File

@@ -38,8 +38,9 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
if (_data == null) if (_data == null)
return; return;
var dataList = _data.ToList(); var dataList = _data.ToList();
var entManager = IoCManager.Resolve<IEntityManager>();
var selectedGrid = dataList[GridOptions.SelectedId].Owner; var selectedGrid = dataList[GridOptions.SelectedId].Owner;
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {selectedGrid}"); IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {entManager.GetNetEntity(selectedGrid)}");
} }
} }
} }

View File

@@ -47,7 +47,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
var selectedGrid = _data[GridOptions.SelectedId]; var selectedGrid = _data[GridOptions.SelectedId];
IoCManager.Resolve<IClientConsoleHost>() 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}");
} }
} }
} }

View File

@@ -18,6 +18,7 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
private const string ArrowDown = "↓"; private const string ArrowDown = "↓";
private readonly Color _altColor = Color.FromHex("#292B38"); private readonly Color _altColor = Color.FromHex("#292B38");
private readonly Color _defaultColor = Color.FromHex("#2F2F3B"); private readonly Color _defaultColor = Color.FromHex("#2F2F3B");
private IEntityManager _entManager;
private readonly AdminSystem _adminSystem; private readonly AdminSystem _adminSystem;
private IReadOnlyList<PlayerInfo> _players = new List<PlayerInfo>(); private IReadOnlyList<PlayerInfo> _players = new List<PlayerInfo>();
@@ -29,7 +30,8 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
public PlayerTab() public PlayerTab()
{ {
_adminSystem = EntitySystem.Get<AdminSystem>(); _entManager = IoCManager.Resolve<IEntityManager>();
_adminSystem = _entManager.System<AdminSystem>();
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
RefreshPlayerList(_adminSystem.PlayerList); RefreshPlayerList(_adminSystem.PlayerList);
@@ -119,7 +121,7 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
player.Antag ? "YES" : "NO", player.Antag ? "YES" : "NO",
new StyleBoxFlat(useAltColor ? _altColor : _defaultColor), new StyleBoxFlat(useAltColor ? _altColor : _defaultColor),
player.Connected); player.Connected);
entry.PlayerUid = player.EntityUid; entry.PlayerUid = _entManager.GetEntity(player.NetEntity);
entry.OnPressed += args => OnEntryPressed?.Invoke(args); entry.OnPressed += args => OnEntryPressed?.Invoke(args);
PlayerList.AddChild(entry); PlayerList.AddChild(entry);

View File

@@ -56,7 +56,7 @@ namespace Content.Client.Atmos.EntitySystems
private void HandleAtmosDebugOverlayMessage(AtmosDebugOverlayMessage message) private void HandleAtmosDebugOverlayMessage(AtmosDebugOverlayMessage message)
{ {
_tileData[message.GridId] = message; _tileData[GetEntity(message.GridId)] = message;
} }
private void HandleAtmosDebugOverlayDisableMessage(AtmosDebugOverlayDisableMessage ev) private void HandleAtmosDebugOverlayDisableMessage(AtmosDebugOverlayDisableMessage ev)

View File

@@ -65,8 +65,10 @@ namespace Content.Client.Atmos.EntitySystems
private void HandleGasOverlayUpdate(GasOverlayUpdateEvent ev) private void HandleGasOverlayUpdate(GasOverlayUpdateEvent ev)
{ {
foreach (var (grid, removedIndicies) in ev.RemovedChunks) foreach (var (nent, removedIndicies) in ev.RemovedChunks)
{ {
var grid = GetEntity(nent);
if (!TryComp(grid, out GasTileOverlayComponent? comp)) if (!TryComp(grid, out GasTileOverlayComponent? comp))
continue; continue;
@@ -76,8 +78,10 @@ namespace Content.Client.Atmos.EntitySystems
} }
} }
foreach (var (grid, gridData) in ev.UpdatedChunks) foreach (var (nent, gridData) in ev.UpdatedChunks)
{ {
var grid = GetEntity(nent);
if (!TryComp(grid, out GasTileOverlayComponent? comp)) if (!TryComp(grid, out GasTileOverlayComponent? comp))
continue; continue;

View File

@@ -68,7 +68,7 @@ namespace Content.Client.Atmos.UI
_ => GridIcon.OverrideDirection _ => GridIcon.OverrideDirection
}; };
GridIcon.SetEntity(msg.DeviceUid); GridIcon.SetEntity(IoCManager.Resolve<IEntityManager>().GetEntity(msg.DeviceUid));
LeftPanel.RemoveAllChildren(); LeftPanel.RemoveAllChildren();
MiddlePanel.RemoveAllChildren(); MiddlePanel.RemoveAllChildren();
RightPanel.RemoveAllChildren(); RightPanel.RemoveAllChildren();

View File

@@ -17,7 +17,9 @@ public sealed class BeamSystem : SharedBeamSystem
//TODO: Sometime in the future this needs to be replaced with tiled sprites //TODO: Sometime in the future this needs to be replaced with tiled sprites
private void BeamVisualizerMessage(BeamVisualizerEvent args) private void BeamVisualizerMessage(BeamVisualizerEvent args)
{ {
if (TryComp<SpriteComponent>(args.Beam, out var sprites)) var beam = GetEntity(args.Beam);
if (TryComp<SpriteComponent>(beam, out var sprites))
{ {
sprites.Rotation = args.UserAngle; sprites.Rotation = args.UserAngle;

View File

@@ -23,7 +23,7 @@ internal sealed partial class ToolshedVisualizeWindow : DefaultWindow
protected override Vector2 ContentsMinimumSize => new(500, 700); protected override Vector2 ContentsMinimumSize => new(500, 700);
public void Update((string name, EntityUid entity)[] entities) public void Update((string name, NetEntity entity)[] entities)
{ {
StatusLabel.Text = _loc.GetString("ui-bql-results-status", ("count", entities.Length)); StatusLabel.Text = _loc.GetString("ui-bql-results-status", ("count", entities.Length));
ItemList.RemoveAllChildren(); ItemList.RemoveAllChildren();

View File

@@ -25,8 +25,8 @@ internal sealed class BuckleSystem : SharedBuckleSystem
return; return;
component.Buckled = state.Buckled; component.Buckled = state.Buckled;
component.BuckledTo = state.BuckledTo; component.BuckledTo = EnsureEntity<BuckleComponent>(state.BuckledTo, uid);
component.LastEntityBuckledTo = state.LastEntityBuckledTo; component.LastEntityBuckledTo = EnsureEntity<BuckleComponent>(state.LastEntityBuckledTo, uid);
component.DontCollide = state.DontCollide; component.DontCollide = state.DontCollide;
ActionBlockerSystem.UpdateCanMove(uid); ActionBlockerSystem.UpdateCanMove(uid);

View File

@@ -13,7 +13,7 @@ public sealed class CameraRecoilSystem : SharedCameraRecoilSystem
private void OnCameraKick(CameraKickEvent ev) private void OnCameraKick(CameraKickEvent ev)
{ {
KickCamera(ev.Euid, ev.Recoil); KickCamera(GetEntity(ev.NetEntity), ev.Recoil);
} }
public override void KickCamera(EntityUid uid, Vector2 recoil, CameraRecoilComponent? component = null) public override void KickCamera(EntityUid uid, Vector2 recoil, CameraRecoilComponent? component = null)

View File

@@ -19,12 +19,14 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
private void OnBoxEffect(PlayBoxEffectMessage msg) private void OnBoxEffect(PlayBoxEffectMessage msg)
{ {
if (!TryComp<CardboardBoxComponent>(msg.Source, out var box)) var source = GetEntity(msg.Source);
if (!TryComp<CardboardBoxComponent>(source, out var box))
return; return;
var xformQuery = GetEntityQuery<TransformComponent>(); var xformQuery = GetEntityQuery<TransformComponent>();
if (!xformQuery.TryGetComponent(msg.Source, out var xform)) if (!xformQuery.TryGetComponent(source, out var xform))
return; return;
var sourcePos = xform.MapPosition; var sourcePos = xform.MapPosition;
@@ -32,12 +34,13 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
//Any mob that can move should be surprised? //Any mob that can move should be surprised?
//God mind rework needs to come faster so it can just check for mind //God mind rework needs to come faster so it can just check for mind
//TODO: Replace with Mind Query when mind rework is in. //TODO: Replace with Mind Query when mind rework is in.
var mobMoverEntities = new HashSet<EntityUid>(); var mobMoverEntities = new List<EntityUid>();
var mover = GetEntity(msg.Mover);
//Filter out entities in range to see that they're a mob and add them to the mobMoverEntities hash for faster lookup //Filter out entities in range to see that they're a mob and add them to the mobMoverEntities hash for faster lookup
foreach (var moverComp in _entityLookup.GetComponentsInRange<MobMoverComponent>(xform.Coordinates, box.Distance)) foreach (var moverComp in _entityLookup.GetComponentsInRange<MobMoverComponent>(xform.Coordinates, box.Distance))
{ {
if (moverComp.Owner == msg.Mover) if (moverComp.Owner == mover)
continue; continue;
mobMoverEntities.Add(moverComp.Owner); mobMoverEntities.Add(moverComp.Owner);
@@ -57,5 +60,6 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
sprite.Offset = new Vector2(0, 1); sprite.Offset = new Vector2(0, 1);
entTransform.AttachParent(mob); entTransform.AttachParent(mob);
} }
} }
} }

View File

@@ -17,8 +17,11 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
[ViewVariables] [ViewVariables]
private Control? _activeUiFragment; private Control? _activeUiFragment;
private IEntityManager _entManager;
protected CartridgeLoaderBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) protected CartridgeLoaderBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{ {
_entManager = IoCManager.Resolve<IEntityManager>();
} }
protected override void UpdateState(BoundUserInterfaceState state) protected override void UpdateState(BoundUserInterfaceState state)
@@ -31,13 +34,16 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
return; return;
} }
var programs = GetCartridgeComponents(loaderUiState.Programs); // TODO move this to a component state and ensure the net ids.
var programs = GetCartridgeComponents(_entManager.GetEntityList(loaderUiState.Programs));
UpdateAvailablePrograms(programs); UpdateAvailablePrograms(programs);
_activeProgram = loaderUiState.ActiveUI; var activeUI = _entManager.GetEntity(loaderUiState.ActiveUI);
var ui = RetrieveCartridgeUI(loaderUiState.ActiveUI); _activeProgram = activeUI;
var comp = RetrieveCartridgeComponent(loaderUiState.ActiveUI);
var ui = RetrieveCartridgeUI(activeUI);
var comp = RetrieveCartridgeComponent(activeUI);
var control = ui?.GetUIFragmentRoot(); var control = ui?.GetUIFragmentRoot();
//Prevent the same UI fragment from getting disposed and attached multiple times //Prevent the same UI fragment from getting disposed and attached multiple times
@@ -60,7 +66,7 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
protected void ActivateCartridge(EntityUid cartridgeUid) protected void ActivateCartridge(EntityUid cartridgeUid)
{ {
var message = new CartridgeLoaderUiMessage(cartridgeUid, CartridgeUiMessageAction.Activate); var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(cartridgeUid), CartridgeUiMessageAction.Activate);
SendMessage(message); SendMessage(message);
} }
@@ -69,19 +75,19 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
if (!_activeProgram.HasValue) if (!_activeProgram.HasValue)
return; return;
var message = new CartridgeLoaderUiMessage(_activeProgram.Value, CartridgeUiMessageAction.Deactivate); var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(_activeProgram.Value), CartridgeUiMessageAction.Deactivate);
SendMessage(message); SendMessage(message);
} }
protected void InstallCartridge(EntityUid cartridgeUid) protected void InstallCartridge(EntityUid cartridgeUid)
{ {
var message = new CartridgeLoaderUiMessage(cartridgeUid, CartridgeUiMessageAction.Install); var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(cartridgeUid), CartridgeUiMessageAction.Install);
SendMessage(message); SendMessage(message);
} }
protected void UninstallCartridge(EntityUid cartridgeUid) protected void UninstallCartridge(EntityUid cartridgeUid)
{ {
var message = new CartridgeLoaderUiMessage(cartridgeUid, CartridgeUiMessageAction.Uninstall); var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(cartridgeUid), CartridgeUiMessageAction.Uninstall);
SendMessage(message); SendMessage(message);
} }
@@ -126,7 +132,7 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
private void SendCartridgeUiReadyEvent(EntityUid cartridgeUid) private void SendCartridgeUiReadyEvent(EntityUid cartridgeUid)
{ {
var message = new CartridgeLoaderUiMessage(cartridgeUid, CartridgeUiMessageAction.UIReady); var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(cartridgeUid), CartridgeUiMessageAction.UIReady);
SendMessage(message); SendMessage(message);
} }

View File

@@ -30,7 +30,7 @@ public sealed class CharacterInfoSystem : EntitySystem
return; return;
} }
RaiseNetworkEvent(new RequestCharacterInfoEvent(entity.Value)); RaiseNetworkEvent(new RequestCharacterInfoEvent(GetNetEntity(entity.Value)));
} }
private void OnPlayerAttached(PlayerAttachSysMessage msg) private void OnPlayerAttached(PlayerAttachSysMessage msg)
@@ -43,7 +43,9 @@ public sealed class CharacterInfoSystem : EntitySystem
private void OnCharacterInfoEvent(CharacterInfoEvent msg, EntitySessionEventArgs args) private void OnCharacterInfoEvent(CharacterInfoEvent msg, EntitySessionEventArgs args)
{ {
var data = new CharacterData(msg.EntityUid, msg.JobTitle, msg.Objectives, msg.Briefing, Name(msg.EntityUid)); var entity = GetEntity(msg.NetEntity);
var data = new CharacterData(entity, msg.JobTitle, msg.Objectives, msg.Briefing, Name(entity));
OnCharacterUpdate?.Invoke(data); OnCharacterUpdate?.Invoke(data);
} }

View File

@@ -169,10 +169,12 @@ public sealed class ClientClothingSystem : ClothingSystem
private void OnVisualsChanged(EntityUid uid, InventoryComponent component, VisualsChangedEvent args) private void OnVisualsChanged(EntityUid uid, InventoryComponent component, VisualsChangedEvent args)
{ {
if (!TryComp(args.Item, out ClothingComponent? clothing) || clothing.InSlot == null) var item = GetEntity(args.Item);
if (!TryComp(item, out ClothingComponent? clothing) || clothing.InSlot == null)
return; return;
RenderEquipment(uid, args.Item, clothing.InSlot, component, null, clothing); RenderEquipment(uid, item, clothing.InSlot, component, null, clothing);
} }
private void OnDidUnequip(EntityUid uid, SpriteComponent component, DidUnequipEvent args) private void OnDidUnequip(EntityUid uid, SpriteComponent component, DidUnequipEvent args)

View File

@@ -8,6 +8,5 @@ namespace Content.Client.Construction
public sealed partial class ConstructionGhostComponent : Component public sealed partial class ConstructionGhostComponent : Component
{ {
[ViewVariables] public ConstructionPrototype? Prototype { get; set; } [ViewVariables] public ConstructionPrototype? Prototype { get; set; }
[ViewVariables] public int GhostId { get; set; }
} }
} }

View File

@@ -1,12 +1,7 @@
using System.Collections.Generic; using System.Linq;
using System.Linq;
using Content.Shared.Construction;
using Content.Shared.Construction.Prototypes; using Content.Shared.Construction.Prototypes;
using Robust.Client.Graphics;
using Robust.Client.Placement; using Robust.Client.Placement;
using Robust.Client.Utility; using Robust.Client.Utility;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map; using Robust.Shared.Map;
namespace Content.Client.Construction namespace Content.Client.Construction
@@ -39,9 +34,9 @@ namespace Content.Client.Construction
/// <inheritdoc /> /// <inheritdoc />
public override bool HijackDeletion(EntityUid entity) public override bool HijackDeletion(EntityUid entity)
{ {
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out ConstructionGhostComponent? ghost)) if (IoCManager.Resolve<IEntityManager>().HasComponent<ConstructionGhostComponent>(entity))
{ {
_constructionSystem.ClearGhost(ghost.GhostId); _constructionSystem.ClearGhost(entity.GetHashCode());
} }
return true; return true;
} }

View File

@@ -27,11 +27,9 @@ namespace Content.Client.Construction
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
private readonly Dictionary<int, ConstructionGhostComponent> _ghosts = new(); private readonly Dictionary<int, EntityUid> _ghosts = new();
private readonly Dictionary<string, ConstructionGuide> _guideCache = new(); private readonly Dictionary<string, ConstructionGuide> _guideCache = new();
private int _nextId;
public bool CraftingEnabled { get; private set; } public bool CraftingEnabled { get; private set; }
/// <inheritdoc /> /// <inheritdoc />
@@ -39,6 +37,7 @@ namespace Content.Client.Construction
{ {
base.Initialize(); base.Initialize();
UpdatesOutsidePrediction = true;
SubscribeLocalEvent<PlayerAttachSysMessage>(HandlePlayerAttached); SubscribeLocalEvent<PlayerAttachSysMessage>(HandlePlayerAttached);
SubscribeNetworkEvent<AckStructureConstructionMessage>(HandleAckStructure); SubscribeNetworkEvent<AckStructureConstructionMessage>(HandleAckStructure);
SubscribeNetworkEvent<ResponseConstructionGuide>(OnConstructionGuideReceived); SubscribeNetworkEvent<ResponseConstructionGuide>(OnConstructionGuideReceived);
@@ -107,6 +106,7 @@ namespace Content.Client.Construction
private void HandleAckStructure(AckStructureConstructionMessage msg) private void HandleAckStructure(AckStructureConstructionMessage msg)
{ {
// We get sent a NetEntity but it actually corresponds to our local Entity.
ClearGhost(msg.GhostId); ClearGhost(msg.GhostId);
} }
@@ -150,13 +150,13 @@ namespace Content.Client.Construction
private bool HandleUse(in PointerInputCmdHandler.PointerInputCmdArgs args) private bool HandleUse(in PointerInputCmdHandler.PointerInputCmdArgs args)
{ {
if (!args.EntityUid.IsValid() || !args.EntityUid.IsClientSide()) if (!args.EntityUid.IsValid() || !IsClientSide(args.EntityUid))
return false; return false;
if (!EntityManager.TryGetComponent<ConstructionGhostComponent?>(args.EntityUid, out var ghostComp)) if (!HasComp<ConstructionGhostComponent>(args.EntityUid))
return false; return false;
TryStartConstruction(ghostComp.GhostId); TryStartConstruction(args.EntityUid);
return true; return true;
} }
@@ -196,9 +196,8 @@ namespace Content.Client.Construction
ghost = EntityManager.SpawnEntity("constructionghost", loc); ghost = EntityManager.SpawnEntity("constructionghost", loc);
var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value); var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value);
comp.Prototype = prototype; comp.Prototype = prototype;
comp.GhostId = _nextId++;
EntityManager.GetComponent<TransformComponent>(ghost.Value).LocalRotation = dir.ToAngle(); EntityManager.GetComponent<TransformComponent>(ghost.Value).LocalRotation = dir.ToAngle();
_ghosts.Add(comp.GhostId, comp); _ghosts.Add(ghost.Value.Id, ghost.Value);
var sprite = EntityManager.GetComponent<SpriteComponent>(ghost.Value); var sprite = EntityManager.GetComponent<SpriteComponent>(ghost.Value);
sprite.Color = new Color(48, 255, 48, 128); sprite.Color = new Color(48, 255, 48, 128);
@@ -247,23 +246,25 @@ namespace Content.Client.Construction
{ {
foreach (var ghost in _ghosts) foreach (var ghost in _ghosts)
{ {
if (EntityManager.GetComponent<TransformComponent>(ghost.Value.Owner).Coordinates.Equals(loc)) return true; if (EntityManager.GetComponent<TransformComponent>(ghost.Value).Coordinates.Equals(loc))
return true;
} }
return false; return false;
} }
public void TryStartConstruction(int ghostId) public void TryStartConstruction(EntityUid ghostId, ConstructionGhostComponent? ghostComp = null)
{ {
var ghost = _ghosts[ghostId]; if (!Resolve(ghostId, ref ghostComp))
return;
if (ghost.Prototype == null) if (ghostComp.Prototype == null)
{ {
throw new ArgumentException($"Can't start construction for a ghost with no prototype. Ghost id: {ghostId}"); throw new ArgumentException($"Can't start construction for a ghost with no prototype. Ghost id: {ghostId}");
} }
var transform = EntityManager.GetComponent<TransformComponent>(ghost.Owner); var transform = EntityManager.GetComponent<TransformComponent>(ghostId);
var msg = new TryStartStructureConstructionMessage(transform.Coordinates, ghost.Prototype.ID, transform.LocalRotation, ghostId); var msg = new TryStartStructureConstructionMessage(GetNetCoordinates(transform.Coordinates), ghostComp.Prototype.ID, transform.LocalRotation, ghostId.Id);
RaiseNetworkEvent(msg); RaiseNetworkEvent(msg);
} }
@@ -280,11 +281,11 @@ namespace Content.Client.Construction
/// </summary> /// </summary>
public void ClearGhost(int ghostId) public void ClearGhost(int ghostId)
{ {
if (_ghosts.TryGetValue(ghostId, out var ghost)) if (!_ghosts.TryGetValue(ghostId, out var ghost))
{ return;
EntityManager.QueueDeleteEntity(ghost.Owner);
_ghosts.Remove(ghostId); EntityManager.QueueDeleteEntity(ghost);
} _ghosts.Remove(ghostId);
} }
/// <summary> /// <summary>
@@ -292,9 +293,9 @@ namespace Content.Client.Construction
/// </summary> /// </summary>
public void ClearAllGhosts() public void ClearAllGhosts()
{ {
foreach (var (_, ghost) in _ghosts) foreach (var ghost in _ghosts.Values)
{ {
EntityManager.QueueDeleteEntity(ghost.Owner); EntityManager.QueueDeleteEntity(ghost);
} }
_ghosts.Clear(); _ghosts.Clear();

View File

@@ -49,7 +49,8 @@ namespace Content.Client.ContextMenu.UI
private string? SearchPlayerName(EntityUid entity) private string? SearchPlayerName(EntityUid entity)
{ {
return _adminSystem.PlayerList.FirstOrDefault(player => player.EntityUid == entity)?.Username; var netEntity = _entityManager.GetNetEntity(entity);
return _adminSystem.PlayerList.FirstOrDefault(player => player.NetEntity == netEntity)?.Username;
} }
/// <summary> /// <summary>
@@ -77,12 +78,12 @@ namespace Content.Client.ContextMenu.UI
var representation = _entityManager.ToPrettyString(entity); var representation = _entityManager.ToPrettyString(entity);
var name = representation.Name; var name = representation.Name;
var id = representation.Uid; var id = representation.Uid.ToString();
var prototype = representation.Prototype; var prototype = representation.Prototype;
var playerName = representation.Session?.Name ?? SearchPlayerName(entity); var playerName = representation.Session?.Name ?? SearchPlayerName(entity);
var deleted = representation.Deleted; var deleted = representation.Deleted;
return $"{name} ({id}{(prototype != null ? $", {prototype}" : "")}{(playerName != null ? $", {playerName}" : "")}){(deleted ? "D" : "")}"; return $"{name} ({id} / {_entityManager.GetNetEntity(entity).ToString()}{(prototype != null ? $", {prototype}" : "")}{(playerName != null ? $", {playerName}" : "")}){(deleted ? "D" : "")}";
} }
private string GetEntityDescription(EntityUid entity) private string GetEntityDescription(EntityUid entity)

View File

@@ -133,8 +133,16 @@ namespace Content.Client.ContextMenu.UI
var func = args.Function; var func = args.Function;
var funcId = _inputManager.NetworkBindMap.KeyFunctionID(func); var funcId = _inputManager.NetworkBindMap.KeyFunctionID(func);
var message = new FullInputCmdMessage(_gameTiming.CurTick, _gameTiming.TickFraction, funcId, var message = new ClientFullInputCmdMessage(
BoundKeyState.Down, _entityManager.GetComponent<TransformComponent>(entity.Value).Coordinates, args.PointerLocation, entity.Value); _gameTiming.CurTick,
_gameTiming.TickFraction,
funcId)
{
State = BoundKeyState.Down,
Coordinates = _entityManager.GetComponent<TransformComponent>(entity.Value).Coordinates,
ScreenCoordinates = args.PointerLocation,
Uid = entity.Value,
};
var session = _playerManager.LocalPlayer?.Session; var session = _playerManager.LocalPlayer?.Session;
if (session != null) if (session != null)

View File

@@ -30,10 +30,10 @@ public sealed class CrewManifestSystem : EntitySystem
/// <summary> /// <summary>
/// Requests a crew manifest from the server. /// Requests a crew manifest from the server.
/// </summary> /// </summary>
/// <param name="uid">EntityUid of the entity we're requesting the crew manifest from.</param> /// <param name="netEntity">EntityUid of the entity we're requesting the crew manifest from.</param>
public void RequestCrewManifest(EntityUid uid) public void RequestCrewManifest(NetEntity netEntity)
{ {
RaiseNetworkEvent(new RequestCrewManifestMessage(uid)); RaiseNetworkEvent(new RequestCrewManifestMessage(netEntity));
} }
private void OnPrototypesReload(PrototypesReloadedEventArgs _) private void OnPrototypesReload(PrototypesReloadedEventArgs _)

View File

@@ -70,7 +70,7 @@ public sealed class DecalPlacementSystem : EntitySystem
return false; return false;
var decal = new Decal(coords.Position, _decalId, _decalColor, _decalAngle, _zIndex, _cleanable); var decal = new Decal(coords.Position, _decalId, _decalColor, _decalAngle, _zIndex, _cleanable);
RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, coords)); RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, GetNetCoordinates(coords)));
return true; return true;
}, },
@@ -90,7 +90,7 @@ public sealed class DecalPlacementSystem : EntitySystem
_erasing = true; _erasing = true;
RaiseNetworkEvent(new RequestDecalRemovalEvent(coords)); RaiseNetworkEvent(new RequestDecalRemovalEvent(GetNetCoordinates(coords)));
return true; return true;
}, (session, coords, uid) => }, (session, coords, uid) =>
@@ -128,7 +128,7 @@ public sealed class DecalPlacementSystem : EntitySystem
args.Target = args.Target.Offset(new Vector2(-0.5f, -0.5f)); args.Target = args.Target.Offset(new Vector2(-0.5f, -0.5f));
var decal = new Decal(args.Target.Position, args.DecalId, args.Color, Angle.FromDegrees(args.Rotation), args.ZIndex, args.Cleanable); var decal = new Decal(args.Target.Position, args.DecalId, args.Color, Angle.FromDegrees(args.Rotation), args.ZIndex, args.Cleanable);
RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, args.Target)); RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, GetNetCoordinates(args.Target)));
} }
private void OnFillSlot(FillActionSlotEvent ev) private void OnFillSlot(FillActionSlotEvent ev)

View File

@@ -92,13 +92,16 @@ namespace Content.Client.Decals
private void OnChunkUpdate(DecalChunkUpdateEvent ev) private void OnChunkUpdate(DecalChunkUpdateEvent ev)
{ {
foreach (var (gridId, updatedGridChunks) in ev.Data) foreach (var (netGrid, updatedGridChunks) in ev.Data)
{ {
if (updatedGridChunks.Count == 0) continue; if (updatedGridChunks.Count == 0)
continue;
var gridId = GetEntity(netGrid);
if (!TryComp(gridId, out DecalGridComponent? gridComp)) if (!TryComp(gridId, out DecalGridComponent? gridComp))
{ {
Logger.Error($"Received decal information for an entity without a decal component: {ToPrettyString(gridId)}"); Log.Error($"Received decal information for an entity without a decal component: {ToPrettyString(gridId)}");
continue; continue;
} }
@@ -106,13 +109,16 @@ namespace Content.Client.Decals
} }
// Now we'll cull old chunks out of range as the server will send them to us anyway. // Now we'll cull old chunks out of range as the server will send them to us anyway.
foreach (var (gridId, chunks) in ev.RemovedChunks) foreach (var (netGrid, chunks) in ev.RemovedChunks)
{ {
if (chunks.Count == 0) continue; if (chunks.Count == 0)
continue;
var gridId = GetEntity(netGrid);
if (!TryComp(gridId, out DecalGridComponent? gridComp)) if (!TryComp(gridId, out DecalGridComponent? gridComp))
{ {
Logger.Error($"Received decal information for an entity without a decal component: {ToPrettyString(gridId)}"); Log.Error($"Received decal information for an entity without a decal component: {ToPrettyString(gridId)}");
continue; continue;
} }

View File

@@ -46,7 +46,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
component.Powered = state.Powered; component.Powered = state.Powered;
component.Engaged = state.Engaged; component.Engaged = state.Engaged;
component.RecentlyEjected.Clear(); component.RecentlyEjected.Clear();
component.RecentlyEjected.AddRange(state.RecentlyEjected); component.RecentlyEjected.AddRange(EnsureEntityList<DisposalUnitComponent>(state.RecentlyEjected, uid));
} }
public override bool HasDisposals(EntityUid? uid) public override bool HasDisposals(EntityUid? uid)

View File

@@ -193,27 +193,29 @@ public sealed class DragDropSystem : SharedDragDropSystem
// the mouse, canceling the drag, but just being cautious) // the mouse, canceling the drag, but just being cautious)
EndDrag(); EndDrag();
var entity = args.EntityUid;
// possibly initiating a drag // possibly initiating a drag
// check if the clicked entity is draggable // check if the clicked entity is draggable
if (!Exists(args.EntityUid)) if (!Exists(entity))
{ {
return false; return false;
} }
// check if the entity is reachable // check if the entity is reachable
if (!_interactionSystem.InRangeUnobstructed(dragger, args.EntityUid)) if (!_interactionSystem.InRangeUnobstructed(dragger, entity))
{ {
return false; return false;
} }
var ev = new CanDragEvent(); var ev = new CanDragEvent();
RaiseLocalEvent(args.EntityUid, ref ev); RaiseLocalEvent(entity, ref ev);
if (ev.Handled != true) if (ev.Handled != true)
return false; return false;
_draggedEntity = args.EntityUid; _draggedEntity = entity;
_state = DragState.MouseDown; _state = DragState.MouseDown;
_mouseDownScreenPos = _inputManager.MouseScreenPosition; _mouseDownScreenPos = _inputManager.MouseScreenPosition;
_mouseDownTime = 0; _mouseDownTime = 0;
@@ -309,14 +311,32 @@ public sealed class DragDropSystem : SharedDragDropSystem
// adjust the timing info based on the current tick so it appears as if it happened now // adjust the timing info based on the current tick so it appears as if it happened now
var replayMsg = savedValue.OriginalMessage; var replayMsg = savedValue.OriginalMessage;
var adjustedInputMsg = new FullInputCmdMessage(args.OriginalMessage.Tick, switch (replayMsg)
args.OriginalMessage.SubTick, {
replayMsg.InputFunctionId, replayMsg.State, replayMsg.Coordinates, replayMsg.ScreenCoordinates, case ClientFullInputCmdMessage clientInput:
replayMsg.Uid); replayMsg = new ClientFullInputCmdMessage(args.OriginalMessage.Tick,
args.OriginalMessage.SubTick,
replayMsg.InputFunctionId)
{
State = replayMsg.State,
Coordinates = clientInput.Coordinates,
ScreenCoordinates = clientInput.ScreenCoordinates,
Uid = clientInput.Uid,
};
break;
case FullInputCmdMessage fullInput:
replayMsg = new FullInputCmdMessage(args.OriginalMessage.Tick,
args.OriginalMessage.SubTick,
replayMsg.InputFunctionId, replayMsg.State, fullInput.Coordinates, fullInput.ScreenCoordinates,
fullInput.Uid);
break;
default:
throw new ArgumentOutOfRangeException();
}
if (savedValue.Session != null) if (savedValue.Session != null)
{ {
_inputSystem.HandleInputCommand(savedValue.Session, EngineKeyFunctions.Use, adjustedInputMsg, _inputSystem.HandleInputCommand(savedValue.Session, EngineKeyFunctions.Use, replayMsg,
true); true);
} }
@@ -340,10 +360,11 @@ public sealed class DragDropSystem : SharedDragDropSystem
} }
IEnumerable<EntityUid> entities; IEnumerable<EntityUid> entities;
var coords = args.Coordinates;
if (_stateManager.CurrentState is GameplayState screen) if (_stateManager.CurrentState is GameplayState screen)
{ {
entities = screen.GetClickableEntities(args.Coordinates); entities = screen.GetClickableEntities(coords);
} }
else else
{ {
@@ -371,7 +392,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
} }
// tell the server about the drop attempt // tell the server about the drop attempt
RaiseNetworkEvent(new DragDropRequestEvent(_draggedEntity.Value, entity)); RaiseNetworkEvent(new DragDropRequestEvent(GetNetEntity(_draggedEntity.Value), GetNetEntity(entity)));
EndDrag(); EndDrag();
return true; return true;
} }

View File

@@ -31,7 +31,7 @@ public sealed class ColorFlashEffectSystem : SharedColorFlashEffectSystem
if (!_timing.IsFirstTimePredicted) if (!_timing.IsFirstTimePredicted)
return; return;
OnColorFlashEffect(new ColorFlashEffectEvent(color, entities)); OnColorFlashEffect(new ColorFlashEffectEvent(color, GetNetEntityList(entities)));
} }
private void OnEffectAnimationCompleted(EntityUid uid, ColorFlashEffectComponent component, AnimationCompletedEvent args) private void OnEffectAnimationCompleted(EntityUid uid, ColorFlashEffectComponent component, AnimationCompletedEvent args)
@@ -77,8 +77,10 @@ public sealed class ColorFlashEffectSystem : SharedColorFlashEffectSystem
{ {
var color = ev.Color; var color = ev.Color;
foreach (var ent in ev.Entities) foreach (var nent in ev.Entities)
{ {
var ent = GetEntity(nent);
if (Deleted(ent)) if (Deleted(ent))
{ {
continue; continue;

View File

@@ -110,19 +110,21 @@ namespace Content.Client.Examine
private bool HandleExamine(in PointerInputCmdHandler.PointerInputCmdArgs args) private bool HandleExamine(in PointerInputCmdHandler.PointerInputCmdArgs args)
{ {
if (!args.EntityUid.IsValid() || !EntityManager.EntityExists(args.EntityUid)) var entity = args.EntityUid;
if (!args.EntityUid.IsValid() || !EntityManager.EntityExists(entity))
{ {
return false; return false;
} }
_playerEntity = _playerManager.LocalPlayer?.ControlledEntity ?? default; _playerEntity = _playerManager.LocalPlayer?.ControlledEntity ?? default;
if (_playerEntity == default || !CanExamine(_playerEntity, args.EntityUid)) if (_playerEntity == default || !CanExamine(_playerEntity, entity))
{ {
return false; return false;
} }
DoExamine(args.EntityUid); DoExamine(entity);
return true; return true;
} }
@@ -157,8 +159,10 @@ namespace Content.Client.Examine
// Tooltips coming in from the server generally prioritize // Tooltips coming in from the server generally prioritize
// opening at the old tooltip rather than the cursor/another entity, // opening at the old tooltip rather than the cursor/another entity,
// since there's probably one open already if it's coming in from the server. // since there's probably one open already if it's coming in from the server.
OpenTooltip(player.Value, ev.EntityUid, ev.CenterAtCursor, ev.OpenAtOldTooltip, ev.KnowTarget); var entity = GetEntity(ev.EntityUid);
UpdateTooltipInfo(player.Value, ev.EntityUid, ev.Message, ev.Verbs);
OpenTooltip(player.Value, entity, ev.CenterAtCursor, ev.OpenAtOldTooltip, ev.KnowTarget);
UpdateTooltipInfo(player.Value, entity, ev.Message, ev.Verbs);
} }
public override void SendExamineTooltip(EntityUid player, EntityUid target, FormattedMessage message, bool getVerbs, bool centerAtCursor) public override void SendExamineTooltip(EntityUid player, EntityUid target, FormattedMessage message, bool getVerbs, bool centerAtCursor)
@@ -358,12 +362,10 @@ namespace Content.Client.Examine
FormattedMessage message; FormattedMessage message;
// Basically this just predicts that we can't make out the entity if we have poor vision. // Basically this just predicts that we can't make out the entity if we have poor vision.
var canSeeClearly = true; var canSeeClearly = !HasComp<BlurryVisionComponent>(playerEnt);
if (HasComp<BlurryVisionComponent>(playerEnt))
canSeeClearly = false;
OpenTooltip(playerEnt.Value, entity, centeredOnCursor, false, knowTarget: canSeeClearly); OpenTooltip(playerEnt.Value, entity, centeredOnCursor, false, knowTarget: canSeeClearly);
if (entity.IsClientSide() if (IsClientSide(entity)
|| _client.RunLevel == ClientRunLevel.SinglePlayerGame) // i.e. a replay || _client.RunLevel == ClientRunLevel.SinglePlayerGame) // i.e. a replay
{ {
message = GetExamineText(entity, playerEnt); message = GetExamineText(entity, playerEnt);
@@ -376,7 +378,7 @@ namespace Content.Client.Examine
_idCounter += 1; _idCounter += 1;
if (_idCounter == int.MaxValue) if (_idCounter == int.MaxValue)
_idCounter = 0; _idCounter = 0;
RaiseNetworkEvent(new ExamineSystemMessages.RequestExamineInfoMessage(entity, _idCounter, true)); RaiseNetworkEvent(new ExamineSystemMessages.RequestExamineInfoMessage(GetNetEntity(entity), _idCounter, true));
} }
RaiseLocalEvent(entity, new ClientExaminedEvent(entity, playerEnt.Value)); RaiseLocalEvent(entity, new ClientExaminedEvent(entity, playerEnt.Value));

View File

@@ -4,6 +4,7 @@ using Robust.Client.Graphics;
using Robust.Client.ResourceManagement; using Robust.Client.ResourceManagement;
using Robust.Shared.GameStates; using Robust.Shared.GameStates;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Client.Explosion; namespace Content.Client.Explosion;
@@ -39,7 +40,13 @@ public sealed class ExplosionOverlaySystem : EntitySystem
component.Epicenter = state.Epicenter; component.Epicenter = state.Epicenter;
component.SpaceTiles = state.SpaceTiles; component.SpaceTiles = state.SpaceTiles;
component.Tiles = state.Tiles; component.Tiles.Clear();
foreach (var (nent, data) in state.Tiles)
{
component.Tiles[GetEntity(nent)] = data;
}
component.Intensity = state.Intensity; component.Intensity = state.Intensity;
component.ExplosionType = state.ExplosionType; component.ExplosionType = state.ExplosionType;
component.SpaceMatrix = state.SpaceMatrix; component.SpaceMatrix = state.SpaceMatrix;

View File

@@ -8,14 +8,16 @@ namespace Content.Client.Fax.AdminUI;
[UsedImplicitly] [UsedImplicitly]
public sealed class AdminFaxEui : BaseEui public sealed class AdminFaxEui : BaseEui
{ {
private IEntityManager _entManager;
private readonly AdminFaxWindow _window; private readonly AdminFaxWindow _window;
public AdminFaxEui() public AdminFaxEui()
{ {
_entManager = IoCManager.Resolve<IEntityManager>();
_window = new AdminFaxWindow(); _window = new AdminFaxWindow();
_window.OnClose += () => SendMessage(new AdminFaxEuiMsg.Close()); _window.OnClose += () => SendMessage(new AdminFaxEuiMsg.Close());
_window.OnFollowFax += uid => SendMessage(new AdminFaxEuiMsg.Follow(uid)); _window.OnFollowFax += uid => SendMessage(new AdminFaxEuiMsg.Follow(_entManager.GetNetEntity(uid)));
_window.OnMessageSend += args => SendMessage(new AdminFaxEuiMsg.Send(args.uid, args.title, _window.OnMessageSend += args => SendMessage(new AdminFaxEuiMsg.Send(_entManager.GetNetEntity(args.uid), args.title,
args.stampedBy, args.message, args.stampSprite, args.stampColor)); args.stampedBy, args.message, args.stampSprite, args.stampColor));
} }

View File

@@ -20,7 +20,7 @@ public sealed class PuddleDebugOverlaySystem : SharedPuddleDebugOverlaySystem
private void RenderDebugData(PuddleOverlayDebugMessage message) private void RenderDebugData(PuddleOverlayDebugMessage message)
{ {
TileData[message.GridUid] = message; TileData[GetEntity(message.GridUid)] = message;
if (_overlay != null) if (_overlay != null)
return; return;

View File

@@ -22,8 +22,8 @@ namespace Content.Client.GameTicking.Managers
[Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedAudioSystem _audio = default!;
[ViewVariables] private bool _initialized; [ViewVariables] private bool _initialized;
private Dictionary<EntityUid, Dictionary<string, uint?>> _jobsAvailable = new(); private Dictionary<NetEntity, Dictionary<string, uint?>> _jobsAvailable = new();
private Dictionary<EntityUid, string> _stationNames = new(); private Dictionary<NetEntity, string> _stationNames = new();
/// <summary> /// <summary>
/// The current round-end window. Could be used to support re-opening the window after closing it. /// The current round-end window. Could be used to support re-opening the window after closing it.
@@ -41,14 +41,14 @@ namespace Content.Client.GameTicking.Managers
[ViewVariables] public TimeSpan RoundStartTimeSpan { get; private set; } [ViewVariables] public TimeSpan RoundStartTimeSpan { get; private set; }
[ViewVariables] public new bool Paused { get; private set; } [ViewVariables] public new bool Paused { get; private set; }
[ViewVariables] public IReadOnlyDictionary<EntityUid, Dictionary<string, uint?>> JobsAvailable => _jobsAvailable; [ViewVariables] public IReadOnlyDictionary<NetEntity, Dictionary<string, uint?>> JobsAvailable => _jobsAvailable;
[ViewVariables] public IReadOnlyDictionary<EntityUid, string> StationNames => _stationNames; [ViewVariables] public IReadOnlyDictionary<NetEntity, string> StationNames => _stationNames;
public event Action? InfoBlobUpdated; public event Action? InfoBlobUpdated;
public event Action? LobbyStatusUpdated; public event Action? LobbyStatusUpdated;
public event Action? LobbySongUpdated; public event Action? LobbySongUpdated;
public event Action? LobbyLateJoinStatusUpdated; public event Action? LobbyLateJoinStatusUpdated;
public event Action<IReadOnlyDictionary<EntityUid, Dictionary<string, uint?>>>? LobbyJobsAvailableUpdated; public event Action<IReadOnlyDictionary<NetEntity, Dictionary<string, uint?>>>? LobbyJobsAvailableUpdated;
public override void Initialize() public override void Initialize()
{ {
@@ -89,8 +89,18 @@ namespace Content.Client.GameTicking.Managers
private void UpdateJobsAvailable(TickerJobsAvailableEvent message) private void UpdateJobsAvailable(TickerJobsAvailableEvent message)
{ {
_jobsAvailable = message.JobsAvailableByStation; foreach (var (job, data) in message.JobsAvailableByStation)
_stationNames = message.StationNames; {
_jobsAvailable.Clear();
_jobsAvailable[job] = data;
}
_stationNames.Clear();
foreach (var weh in message.StationNames)
{
_stationNames[weh.Key] = weh.Value;
}
LobbyJobsAvailableUpdated?.Invoke(JobsAvailable); LobbyJobsAvailableUpdated?.Invoke(JobsAvailable);
} }

View File

@@ -174,9 +174,13 @@ namespace Content.Client.Gameplay
EntityCoordinates.FromMap(_mapManager, mousePosWorld); EntityCoordinates.FromMap(_mapManager, mousePosWorld);
} }
var message = new FullInputCmdMessage(_timing.CurTick, _timing.TickFraction, funcId, kArgs.State, var message = new ClientFullInputCmdMessage(_timing.CurTick, _timing.TickFraction, funcId)
coordinates , kArgs.PointerLocation, {
entityToClick ?? default); // TODO make entityUid nullable State = kArgs.State,
Coordinates = coordinates,
ScreenCoordinates = kArgs.PointerLocation,
Uid = entityToClick ?? default,
}; // TODO make entityUid nullable
// client side command handlers will always be sent the local player session. // client side command handlers will always be sent the local player session.
var session = _playerManager.LocalPlayer?.Session; var session = _playerManager.LocalPlayer?.Session;

View File

@@ -20,7 +20,7 @@ public sealed class GatewayBoundUserInterface : BoundUserInterface
_window = new GatewayWindow(); _window = new GatewayWindow();
_window.OpenPortal += destination => _window.OpenPortal += destination =>
{ {
SendMessage(new GatewayOpenPortalMessage(destination)); SendMessage(new GatewayOpenPortalMessage(EntMan.GetNetEntity(destination)));
}; };
_window.OnClose += Close; _window.OnClose += Close;
_window?.OpenCentered(); _window?.OpenCentered();

View File

@@ -16,10 +16,11 @@ namespace Content.Client.Gateway.UI;
public sealed partial class GatewayWindow : FancyWindow, public sealed partial class GatewayWindow : FancyWindow,
IComputerWindow<EmergencyConsoleBoundUserInterfaceState> IComputerWindow<EmergencyConsoleBoundUserInterfaceState>
{ {
private readonly IEntityManager _entManager;
private readonly IGameTiming _timing; private readonly IGameTiming _timing;
public event Action<EntityUid>? OpenPortal; public event Action<EntityUid>? OpenPortal;
private List<(EntityUid, string, TimeSpan, bool)> _destinations = default!; private List<(NetEntity, string, TimeSpan, bool)> _destinations = default!;
private EntityUid? _current; private EntityUid? _current;
private TimeSpan _nextClose; private TimeSpan _nextClose;
private TimeSpan _lastOpen; private TimeSpan _lastOpen;
@@ -29,13 +30,15 @@ public sealed partial class GatewayWindow : FancyWindow,
public GatewayWindow() public GatewayWindow()
{ {
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
_timing = IoCManager.Resolve<IGameTiming>(); var dependencies = IoCManager.Instance!;
_entManager = dependencies.Resolve<IEntityManager>();
_timing = dependencies.Resolve<IGameTiming>();
} }
public void UpdateState(GatewayBoundUserInterfaceState state) public void UpdateState(GatewayBoundUserInterfaceState state)
{ {
_destinations = state.Destinations; _destinations = state.Destinations;
_current = state.Current; _current = _entManager.GetEntity(state.Current);
_nextClose = state.NextClose; _nextClose = state.NextClose;
_lastOpen = state.LastOpen; _lastOpen = state.LastOpen;
@@ -64,7 +67,7 @@ public sealed partial class GatewayWindow : FancyWindow,
var now = _timing.CurTime; var now = _timing.CurTime;
foreach (var dest in _destinations) foreach (var dest in _destinations)
{ {
var uid = dest.Item1; var uid = _entManager.GetEntity(dest.Item1);
var name = dest.Item2; var name = dest.Item2;
var nextReady = dest.Item3; var nextReady = dest.Item3;
var busy = dest.Item4; var busy = dest.Item4;
@@ -101,7 +104,7 @@ public sealed partial class GatewayWindow : FancyWindow,
OpenPortal?.Invoke(uid); OpenPortal?.Invoke(uid);
}; };
if (uid == state.Current) if (uid == _entManager.GetEntity(state.Current))
{ {
openButton.AddStyleClass(StyleBase.ButtonCaution); openButton.AddStyleClass(StyleBase.ButtonCaution);
} }

View File

@@ -124,7 +124,7 @@ namespace Content.Client.Hands.Systems
#region PickupAnimation #region PickupAnimation
private void HandlePickupAnimation(PickupAnimationEvent msg) private void HandlePickupAnimation(PickupAnimationEvent msg)
{ {
PickupAnimation(msg.ItemUid, msg.InitialPosition, msg.FinalPosition, msg.InitialAngle); PickupAnimation(GetEntity(msg.ItemUid), GetCoordinates(msg.InitialPosition), msg.FinalPosition, msg.InitialAngle);
} }
public override void PickupAnimation(EntityUid item, EntityCoordinates initialPosition, Vector2 finalPosition, Angle initialAngle, public override void PickupAnimation(EntityUid item, EntityCoordinates initialPosition, Vector2 finalPosition, Angle initialAngle,
@@ -382,7 +382,7 @@ namespace Content.Client.Hands.Systems
// update hands visuals if this item is in a hand (rather then inventory or other container). // update hands visuals if this item is in a hand (rather then inventory or other container).
if (component.Hands.TryGetValue(args.ContainerId, out var hand)) if (component.Hands.TryGetValue(args.ContainerId, out var hand))
{ {
UpdateHandVisuals(uid, args.Item, hand, component); UpdateHandVisuals(uid, GetEntity(args.Item), hand, component);
} }
} }
#endregion #endregion

View File

@@ -24,13 +24,16 @@ namespace Content.Client.HealthAnalyzer.UI
{ {
var text = new StringBuilder(); var text = new StringBuilder();
var entities = IoCManager.Resolve<IEntityManager>(); var entities = IoCManager.Resolve<IEntityManager>();
var target = entities.GetEntity(msg.TargetEntity);
if (msg.TargetEntity != null && entities.TryGetComponent<DamageableComponent>(msg.TargetEntity, out var damageable)) if (msg.TargetEntity != null && entities.TryGetComponent<DamageableComponent>(target, out var damageable))
{ {
string entityName = "Unknown"; string entityName = "Unknown";
if (msg.TargetEntity != null && if (msg.TargetEntity != null &&
entities.TryGetComponent<MetaDataComponent>(msg.TargetEntity.Value, out var metaData)) entities.HasComponent<MetaDataComponent>(target.Value))
entityName = Identity.Name(msg.TargetEntity.Value, entities); {
entityName = Identity.Name(target.Value, entities);
}
IReadOnlyDictionary<string, FixedPoint2> damagePerGroup = damageable.DamagePerGroup; IReadOnlyDictionary<string, FixedPoint2> damagePerGroup = damageable.DamagePerGroup;
IReadOnlyDictionary<string, FixedPoint2> damagePerType = damageable.Damage.DamageDict; IReadOnlyDictionary<string, FixedPoint2> damagePerType = damageable.Damage.DamageDict;

View File

@@ -197,7 +197,7 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
profile.Appearance.EyeColor, profile.Appearance.EyeColor,
_markingManager); _markingManager);
DebugTools.Assert(uid.IsClientSide()); DebugTools.Assert(IsClientSide(uid));
var state = new HumanoidAppearanceState(markings, var state = new HumanoidAppearanceState(markings,
new(), new(),

View File

@@ -54,10 +54,10 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
public void SetMaster(EntityUid uid, EntityUid? masterUid) public void SetMaster(EntityUid uid, EntityUid? masterUid)
{ {
if (!TryComp(uid, out InstrumentComponent? instrument)) if (!HasComp<InstrumentComponent>(uid))
return; return;
RaiseNetworkEvent(new InstrumentSetMasterEvent(uid, masterUid)); RaiseNetworkEvent(new InstrumentSetMasterEvent(GetNetEntity(uid), GetNetEntity(masterUid)));
} }
public void SetFilteredChannel(EntityUid uid, int channel, bool value) public void SetFilteredChannel(EntityUid uid, int channel, bool value)
@@ -68,7 +68,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
if(value) if(value)
instrument.Renderer?.SendMidiEvent(RobustMidiEvent.AllNotesOff((byte)channel, 0), false); instrument.Renderer?.SendMidiEvent(RobustMidiEvent.AllNotesOff((byte)channel, 0), false);
RaiseNetworkEvent(new InstrumentSetFilteredChannelEvent(uid, channel, value)); RaiseNetworkEvent(new InstrumentSetFilteredChannelEvent(GetNetEntity(uid), channel, value));
} }
public override void SetupRenderer(EntityUid uid, bool fromStateChange, SharedInstrumentComponent? component = null) public override void SetupRenderer(EntityUid uid, bool fromStateChange, SharedInstrumentComponent? component = null)
@@ -109,7 +109,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
if (!fromStateChange) if (!fromStateChange)
{ {
RaiseNetworkEvent(new InstrumentStartMidiEvent(uid)); RaiseNetworkEvent(new InstrumentStartMidiEvent(GetNetEntity(uid)));
} }
} }
@@ -189,7 +189,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
if (!fromStateChange && _netManager.IsConnected) if (!fromStateChange && _netManager.IsConnected)
{ {
RaiseNetworkEvent(new InstrumentStopMidiEvent(uid)); RaiseNetworkEvent(new InstrumentStopMidiEvent(GetNetEntity(uid)));
} }
} }
@@ -282,7 +282,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
private void OnMidiEventRx(InstrumentMidiEventEvent midiEv) private void OnMidiEventRx(InstrumentMidiEventEvent midiEv)
{ {
var uid = midiEv.Uid; var uid = GetEntity(midiEv.Uid);
if (!TryComp(uid, out InstrumentComponent? instrument)) if (!TryComp(uid, out InstrumentComponent? instrument))
return; return;
@@ -354,12 +354,12 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
private void OnMidiStart(InstrumentStartMidiEvent ev) private void OnMidiStart(InstrumentStartMidiEvent ev)
{ {
SetupRenderer(ev.Uid, true); SetupRenderer(GetEntity(ev.Uid), true);
} }
private void OnMidiStop(InstrumentStopMidiEvent ev) private void OnMidiStop(InstrumentStopMidiEvent ev)
{ {
EndRenderer(ev.Uid, true); EndRenderer(GetEntity(ev.Uid), true);
} }
public override void Update(float frameTime) public override void Update(float frameTime)
@@ -425,7 +425,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
if (eventCount == 0) if (eventCount == 0)
continue; continue;
RaiseNetworkEvent(new InstrumentMidiEventEvent(uid, events)); RaiseNetworkEvent(new InstrumentMidiEventEvent(GetNetEntity(uid), events));
instrument.SentWithinASec += eventCount; instrument.SentWithinASec += eventCount;

View File

@@ -32,12 +32,13 @@ public sealed partial class BandMenu : DefaultWindow
Timer.Spawn(0, Close); Timer.Spawn(0, Close);
} }
public void Populate((EntityUid, string)[] nearby) public void Populate((NetEntity, string)[] nearby, IEntityManager entManager)
{ {
BandList.Clear(); BandList.Clear();
foreach (var (uid, name) in nearby) foreach (var (nent, name) in nearby)
{ {
var uid = entManager.GetEntity(nent);
var item = BandList.AddItem(name, null, true, uid); var item = BandList.AddItem(name, null, true, uid);
item.Selected = _owner.Instrument?.Master == uid; item.Selected = _owner.Instrument?.Master == uid;
} }

View File

@@ -10,15 +10,15 @@ namespace Content.Client.Instruments.UI
{ {
public sealed class InstrumentBoundUserInterface : BoundUserInterface public sealed class InstrumentBoundUserInterface : BoundUserInterface
{ {
[Dependency] public readonly IEntityManager Entities = default!; public IEntityManager Entities => EntMan;
[Dependency] public readonly IMidiManager MidiManager = default!; [Dependency] public readonly IMidiManager MidiManager = default!;
[Dependency] public readonly IFileDialogManager FileDialogManager = default!; [Dependency] public readonly IFileDialogManager FileDialogManager = default!;
[Dependency] public readonly IPlayerManager PlayerManager = default!; [Dependency] public readonly IPlayerManager PlayerManager = default!;
[Dependency] public readonly ILocalizationManager Loc = default!; [Dependency] public readonly ILocalizationManager Loc = default!;
public readonly InstrumentSystem Instruments = default!; public readonly InstrumentSystem Instruments;
public readonly ActionBlockerSystem ActionBlocker = default!; public readonly ActionBlockerSystem ActionBlocker;
public readonly SharedInteractionSystem Interactions = default!; public readonly SharedInteractionSystem Interactions;
[ViewVariables] private InstrumentMenu? _instrumentMenu; [ViewVariables] private InstrumentMenu? _instrumentMenu;
[ViewVariables] private BandMenu? _bandMenu; [ViewVariables] private BandMenu? _bandMenu;
@@ -40,7 +40,7 @@ namespace Content.Client.Instruments.UI
switch (message) switch (message)
{ {
case InstrumentBandResponseBuiMessage bandRx: case InstrumentBandResponseBuiMessage bandRx:
_bandMenu?.Populate(bandRx.Nearby); _bandMenu?.Populate(bandRx.Nearby, EntMan);
break; break;
default: default:
break; break;

View File

@@ -282,7 +282,7 @@ namespace Content.Client.Inventory
return; return;
EntityManager.RaisePredictiveEvent( EntityManager.RaisePredictiveEvent(
new InteractInventorySlotEvent(item.Value, altInteract: false)); new InteractInventorySlotEvent(GetNetEntity(item.Value), altInteract: false));
} }
public void UIInventoryAltActivateItem(string slot, EntityUid uid) public void UIInventoryAltActivateItem(string slot, EntityUid uid)
@@ -290,7 +290,7 @@ namespace Content.Client.Inventory
if (!TryGetSlotEntity(uid, slot, out var item)) if (!TryGetSlotEntity(uid, slot, out var item))
return; return;
EntityManager.RaisePredictiveEvent(new InteractInventorySlotEvent(item.Value, altInteract: true)); EntityManager.RaisePredictiveEvent(new InteractInventorySlotEvent(GetNetEntity(item.Value), altInteract: true));
} }
public sealed class SlotData public sealed class SlotData

View File

@@ -44,7 +44,7 @@ public sealed class ItemSystem : SharedItemSystem
{ {
// if the item is in a container, it might be equipped to hands or inventory slots --> update visuals. // if the item is in a container, it might be equipped to hands or inventory slots --> update visuals.
if (Container.TryGetContainingContainer(uid, out var container)) if (Container.TryGetContainingContainer(uid, out var container))
RaiseLocalEvent(container.Owner, new VisualsChangedEvent(uid, container.ID)); RaiseLocalEvent(container.Owner, new VisualsChangedEvent(GetNetEntity(uid), container.ID));
} }
/// <summary> /// <summary>

View File

@@ -57,7 +57,9 @@ namespace Content.Client.Kitchen.UI
ChamberContentBox.EjectButton.Disabled = state.ChamberContents.Length <= 0; ChamberContentBox.EjectButton.Disabled = state.ChamberContents.Length <= 0;
GrindButton.Disabled = !state.CanGrind || !state.Powered; GrindButton.Disabled = !state.CanGrind || !state.Powered;
JuiceButton.Disabled = !state.CanJuice || !state.Powered; JuiceButton.Disabled = !state.CanJuice || !state.Powered;
RefreshContentsDisplay(state.ReagentQuantities, state.ChamberContents, state.HasBeakerIn);
// TODO move this to a component state and ensure the net ids.
RefreshContentsDisplay(state.ReagentQuantities, _entityManager.GetEntityArray(state.ChamberContents), state.HasBeakerIn);
} }
public void HandleMessage(BoundUserInterfaceMessage message) public void HandleMessage(BoundUserInterfaceMessage message)

View File

@@ -20,8 +20,11 @@ namespace Content.Client.Kitchen.UI
[ViewVariables] [ViewVariables]
private readonly Dictionary<int, ReagentQuantity> _reagents = new(); private readonly Dictionary<int, ReagentQuantity> _reagents = new();
private IEntityManager _entManager;
public MicrowaveBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) public MicrowaveBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{ {
_entManager = IoCManager.Resolve<IEntityManager>();
} }
protected override void Open() protected override void Open()
@@ -34,7 +37,7 @@ namespace Content.Client.Kitchen.UI
_menu.EjectButton.OnPressed += _ => SendMessage(new MicrowaveEjectMessage()); _menu.EjectButton.OnPressed += _ => SendMessage(new MicrowaveEjectMessage());
_menu.IngredientsList.OnItemSelected += args => _menu.IngredientsList.OnItemSelected += args =>
{ {
SendMessage(new MicrowaveEjectSolidIndexedMessage(_solids[args.ItemIndex])); SendMessage(new MicrowaveEjectSolidIndexedMessage(EntMan.GetNetEntity(_solids[args.ItemIndex])));
}; };
_menu.OnCookTimeSelected += (args, buttonIndex) => _menu.OnCookTimeSelected += (args, buttonIndex) =>
@@ -57,7 +60,6 @@ namespace Content.Client.Kitchen.UI
_menu?.Dispose(); _menu?.Dispose();
} }
protected override void UpdateState(BoundUserInterfaceState state) protected override void UpdateState(BoundUserInterfaceState state)
{ {
base.UpdateState(state); base.UpdateState(state);
@@ -67,7 +69,9 @@ namespace Content.Client.Kitchen.UI
} }
_menu?.ToggleBusyDisableOverlayPanel(cState.IsMicrowaveBusy); _menu?.ToggleBusyDisableOverlayPanel(cState.IsMicrowaveBusy);
RefreshContentsDisplay(cState.ContainedSolids);
// TODO move this to a component state and ensure the net ids.
RefreshContentsDisplay(_entManager.GetEntityArray(cState.ContainedSolids));
if (_menu == null) return; if (_menu == null) return;

View File

@@ -74,7 +74,7 @@ namespace Content.Client.Kitchen.UI
public void EjectChamberContent(EntityUid uid) public void EjectChamberContent(EntityUid uid)
{ {
SendMessage(new ReagentGrinderEjectChamberContentMessage(uid)); SendMessage(new ReagentGrinderEjectChamberContentMessage(EntMan.GetNetEntity(uid)));
} }
} }
} }

View File

@@ -23,17 +23,18 @@ namespace Content.Client.LateJoin
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IClientConsoleHost _consoleHost = default!; [Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly IConfigurationManager _configManager = default!; [Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IEntitySystemManager _entitySystem = default!; [Dependency] private readonly IEntitySystemManager _entitySystem = default!;
[Dependency] private readonly JobRequirementsManager _jobRequirements = default!; [Dependency] private readonly JobRequirementsManager _jobRequirements = default!;
public event Action<(EntityUid, string)> SelectedId; public event Action<(NetEntity, string)> SelectedId;
private readonly ClientGameTicker _gameTicker; private readonly ClientGameTicker _gameTicker;
private readonly SpriteSystem _sprites; private readonly SpriteSystem _sprites;
private readonly CrewManifestSystem _crewManifest; private readonly CrewManifestSystem _crewManifest;
private readonly Dictionary<EntityUid, Dictionary<string, JobButton>> _jobButtons = new(); private readonly Dictionary<NetEntity, Dictionary<string, JobButton>> _jobButtons = new();
private readonly Dictionary<EntityUid, Dictionary<string, BoxContainer>> _jobCategories = new(); private readonly Dictionary<NetEntity, Dictionary<string, BoxContainer>> _jobCategories = new();
private readonly List<ScrollContainer> _jobLists = new(); private readonly List<ScrollContainer> _jobLists = new();
private readonly Control _base; private readonly Control _base;
@@ -281,7 +282,7 @@ namespace Content.Client.LateJoin
} }
} }
private void JobsAvailableUpdated(IReadOnlyDictionary<EntityUid, Dictionary<string, uint?>> _) private void JobsAvailableUpdated(IReadOnlyDictionary<NetEntity, Dictionary<string, uint?>> _)
{ {
RebuildUI(); RebuildUI();
} }

View File

@@ -205,7 +205,7 @@ namespace Content.Client.Light
public static Color GetCurrentRgbColor(TimeSpan curTime, TimeSpan offset, RgbLightControllerComponent rgb) public static Color GetCurrentRgbColor(TimeSpan curTime, TimeSpan offset, RgbLightControllerComponent rgb)
{ {
return Color.FromHsv(new Vector4( return Color.FromHsv(new Vector4(
(float) (((curTime.TotalSeconds - offset.TotalSeconds) * rgb.CycleRate + Math.Abs(rgb.Owner.GetHashCode() * 0.1)) % 1), (float) (((curTime.TotalSeconds - offset.TotalSeconds) * rgb.CycleRate + Math.Abs(rgb.Owner.Id * 0.1)) % 1),
1.0f, 1.0f,
1.0f, 1.0f,
1.0f 1.0f

View File

@@ -47,11 +47,11 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
_dragging = grid; _dragging = grid;
_localPosition = localPosition; _localPosition = localPosition;
if (TryComp<PhysicsComponent>(grid, out var body)) if (HasComp<PhysicsComponent>(grid))
{ {
RaiseNetworkEvent(new GridDragVelocityRequest() RaiseNetworkEvent(new GridDragVelocityRequest()
{ {
Grid = grid, Grid = GetNetEntity(grid),
LinearVelocity = Vector2.Zero LinearVelocity = Vector2.Zero
}); });
} }
@@ -69,7 +69,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
var distance = _lastMousePosition.Value.Position - xform.WorldPosition; var distance = _lastMousePosition.Value.Position - xform.WorldPosition;
RaiseNetworkEvent(new GridDragVelocityRequest() RaiseNetworkEvent(new GridDragVelocityRequest()
{ {
Grid = _dragging.Value, Grid = GetNetEntity(_dragging.Value),
LinearVelocity = distance.LengthSquared() > 0f ? (distance / (float) tickTime.TotalSeconds) * 0.25f : Vector2.Zero, LinearVelocity = distance.LengthSquared() > 0f ? (distance / (float) tickTime.TotalSeconds) * 0.25f : Vector2.Zero,
}); });
} }
@@ -125,7 +125,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
RaiseNetworkEvent(new GridDragRequestPosition() RaiseNetworkEvent(new GridDragRequestPosition()
{ {
Grid = _dragging.Value, Grid = GetNetEntity(_dragging.Value),
WorldPosition = requestedGridOrigin, WorldPosition = requestedGridOrigin,
}); });
} }

View File

@@ -67,20 +67,14 @@ namespace Content.Client.MassMedia.Ui
var stringContent = Rope.Collapse(_menu.ContentInput.TextRope); var stringContent = Rope.Collapse(_menu.ContentInput.TextRope);
if (stringContent == null || stringContent.Length == 0) return; if (stringContent == null || stringContent.Length == 0)
if (_gameTicker == null) return; return;
NewsArticle article = new NewsArticle();
var stringName = _menu.NameInput.Text; var stringName = _menu.NameInput.Text;
var name = (stringName.Length <= 25 ? stringName.Trim() : $"{stringName.Trim().Substring(0, 25)}..."); var name = (stringName.Length <= 25 ? stringName.Trim() : $"{stringName.Trim().Substring(0, 25)}...");
article.Name = name;
article.Content = stringContent;
article.ShareTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan);
_menu.ContentInput.TextRope = new Rope.Leaf(string.Empty); _menu.ContentInput.TextRope = new Rope.Leaf(string.Empty);
_menu.NameInput.Text = string.Empty; _menu.NameInput.Text = string.Empty;
SendMessage(new NewsWriteShareMessage(name, stringContent));
SendMessage(new NewsWriteShareMessage(article));
} }
private void OnDeleteButtonPressed(int articleNum) private void OnDeleteButtonPressed(int articleNum)

View File

@@ -20,9 +20,11 @@ public sealed partial class MechGrabberUi : UIFragment
return; return;
_fragment = new MechGrabberUiFragment(); _fragment = new MechGrabberUiFragment();
_fragment.OnEjectAction += e => _fragment.OnEjectAction += e =>
{ {
userInterface.SendMessage(new MechGrabberEjectMessage(fragmentOwner.Value, e)); var entManager = IoCManager.Resolve<IEntityManager>();
userInterface.SendMessage(new MechGrabberEjectMessage(entManager.GetNetEntity(fragmentOwner.Value), entManager.GetNetEntity(e)));
}; };
} }

View File

@@ -23,7 +23,7 @@ public sealed partial class MechGrabberUiFragment : BoxContainer
SpaceLabel.Text = $"{state.Contents.Count}/{state.MaxContents}"; SpaceLabel.Text = $"{state.Contents.Count}/{state.MaxContents}";
for (var i = 0; i < state.Contents.Count; i++) for (var i = 0; i < state.Contents.Count; i++)
{ {
var ent = state.Contents[i]; var ent = _entity.GetEntity(state.Contents[i]);
if (!_entity.TryGetComponent<MetaDataComponent>(ent, out var meta)) if (!_entity.TryGetComponent<MetaDataComponent>(ent, out var meta))
continue; continue;

View File

@@ -22,7 +22,8 @@ public sealed partial class MechSoundboardUi : UIFragment
_fragment = new MechSoundboardUiFragment(); _fragment = new MechSoundboardUiFragment();
_fragment.OnPlayAction += sound => _fragment.OnPlayAction += sound =>
{ {
userInterface.SendMessage(new MechSoundboardPlayMessage(fragmentOwner.Value, sound)); // TODO: IDK dog
userInterface.SendMessage(new MechSoundboardPlayMessage(IoCManager.Resolve<IEntityManager>().GetNetEntity(fragmentOwner.Value), sound));
}; };
} }

View File

@@ -27,7 +27,7 @@ public sealed class MechBoundUserInterface : BoundUserInterface
_menu.OnRemoveButtonPressed += uid => _menu.OnRemoveButtonPressed += uid =>
{ {
SendMessage(new MechEquipmentRemoveMessage(uid)); SendMessage(new MechEquipmentRemoveMessage(EntMan.GetNetEntity(uid)));
}; };
} }
@@ -54,7 +54,7 @@ public sealed class MechBoundUserInterface : BoundUserInterface
continue; continue;
foreach (var (attached, estate) in state.EquipmentStates) foreach (var (attached, estate) in state.EquipmentStates)
{ {
if (ent == attached) if (ent == EntMan.GetEntity(attached))
ui.UpdateState(estate); ui.UpdateState(estate);
} }
} }

View File

@@ -64,15 +64,18 @@ namespace Content.Client.Medical.CrewMonitoring
// add a row for each sensor // add a row for each sensor
foreach (var sensor in stSensors.OrderBy(a => a.Name)) foreach (var sensor in stSensors.OrderBy(a => a.Name))
{ {
var sensorEntity = _entManager.GetEntity(sensor.SuitSensorUid);
var coordinates = _entManager.GetCoordinates(sensor.Coordinates);
// add button with username // add button with username
var nameButton = new CrewMonitoringButton() var nameButton = new CrewMonitoringButton()
{ {
SuitSensorUid = sensor.SuitSensorUid, SuitSensorUid = sensorEntity,
Coordinates = sensor.Coordinates, Coordinates = coordinates,
Text = sensor.Name, Text = sensor.Name,
Margin = new Thickness(5f, 5f), Margin = new Thickness(5f, 5f),
}; };
if (sensor.SuitSensorUid == _trackedButton?.SuitSensorUid) if (sensorEntity == _trackedButton?.SuitSensorUid)
nameButton.AddStyleClass(StyleNano.StyleClassButtonColorGreen); nameButton.AddStyleClass(StyleNano.StyleClassButtonColorGreen);
SetColorLabel(nameButton.Label, sensor.TotalDamage, sensor.IsAlive); SetColorLabel(nameButton.Label, sensor.TotalDamage, sensor.IsAlive);
SensorsTable.AddChild(nameButton); SensorsTable.AddChild(nameButton);
@@ -113,10 +116,10 @@ namespace Content.Client.Medical.CrewMonitoring
SensorsTable.AddChild(box); SensorsTable.AddChild(box);
_rowsContent.Add(box); _rowsContent.Add(box);
if (sensor.Coordinates != null && NavMap.Visible) if (coordinates != null && NavMap.Visible)
{ {
NavMap.TrackedCoordinates.TryAdd(sensor.Coordinates.Value, NavMap.TrackedCoordinates.TryAdd(coordinates.Value,
(true, sensor.SuitSensorUid == _trackedButton?.SuitSensorUid ? StyleNano.PointGreen : StyleNano.PointRed)); (true, sensorEntity == _trackedButton?.SuitSensorUid ? StyleNano.PointGreen : StyleNano.PointRed));
nameButton.OnButtonUp += args => nameButton.OnButtonUp += args =>
{ {
@@ -124,8 +127,8 @@ namespace Content.Client.Medical.CrewMonitoring
//Make previous point red //Make previous point red
NavMap.TrackedCoordinates[_trackedButton.Coordinates.Value] = (true, StyleNano.PointRed); NavMap.TrackedCoordinates[_trackedButton.Coordinates.Value] = (true, StyleNano.PointRed);
NavMap.TrackedCoordinates[sensor.Coordinates.Value] = (true, StyleNano.PointGreen); NavMap.TrackedCoordinates[coordinates.Value] = (true, StyleNano.PointGreen);
NavMap.CenterToCoordinates(sensor.Coordinates.Value); NavMap.CenterToCoordinates(coordinates.Value);
nameButton.AddStyleClass(StyleNano.StyleClassButtonColorGreen); nameButton.AddStyleClass(StyleNano.StyleClassButtonColorGreen);
if (_trackedButton != null) if (_trackedButton != null)
@@ -145,7 +148,7 @@ namespace Content.Client.Medical.CrewMonitoring
private BoxContainer GetPositionBox(SuitSensorStatus sensor, Vector2 monitorCoordsInStationSpace, bool snap, float precision) private BoxContainer GetPositionBox(SuitSensorStatus sensor, Vector2 monitorCoordsInStationSpace, bool snap, float precision)
{ {
EntityCoordinates? coordinates = sensor.Coordinates; EntityCoordinates? coordinates = _entManager.GetCoordinates(sensor.Coordinates);
var box = new BoxContainer() { Orientation = LayoutOrientation.Horizontal }; var box = new BoxContainer() { Orientation = LayoutOrientation.Horizontal };
if (coordinates == null || _stationUid == null) if (coordinates == null || _stationUid == null)

View File

@@ -46,7 +46,7 @@ public sealed class HTNSystem : EntitySystem
private void OnHTNMessage(HTNMessage ev) private void OnHTNMessage(HTNMessage ev)
{ {
if (!TryComp<HTNComponent>(ev.Uid, out var htn)) if (!TryComp<HTNComponent>(GetEntity(ev.Uid), out var htn))
return; return;
htn.DebugText = ev.Text; htn.DebugText = ev.Text;

View File

@@ -61,10 +61,12 @@ public sealed class NPCSteeringSystem : SharedNPCSteeringSystem
foreach (var data in ev.Data) foreach (var data in ev.Data)
{ {
if (!Exists(data.EntityUid)) var entity = GetEntity(data.EntityUid);
if (!Exists(entity))
continue; continue;
var comp = EnsureComp<NPCSteeringComponent>(data.EntityUid); var comp = EnsureComp<NPCSteeringComponent>(entity);
comp.Direction = data.Direction; comp.Direction = data.Direction;
comp.DangerMap = data.Danger; comp.DangerMap = data.Danger;
comp.InterestMap = data.Interest; comp.InterestMap = data.Interest;

View File

@@ -60,8 +60,8 @@ namespace Content.Client.NPC
private PathfindingDebugMode _modes = PathfindingDebugMode.None; private PathfindingDebugMode _modes = PathfindingDebugMode.None;
// It's debug data IDC if it doesn't support snapshots I just want something fast. // It's debug data IDC if it doesn't support snapshots I just want something fast.
public Dictionary<EntityUid, Dictionary<Vector2i, List<PathfindingBreadcrumb>>> Breadcrumbs = new(); public Dictionary<NetEntity, Dictionary<Vector2i, List<PathfindingBreadcrumb>>> Breadcrumbs = new();
public Dictionary<EntityUid, Dictionary<Vector2i, Dictionary<Vector2i, List<DebugPathPoly>>>> Polys = new(); public Dictionary<NetEntity, Dictionary<Vector2i, Dictionary<Vector2i, List<DebugPathPoly>>>> Polys = new();
public readonly List<(TimeSpan Time, PathRouteMessage Message)> Routes = new(); public readonly List<(TimeSpan Time, PathRouteMessage Message)> Routes = new();
public override void Initialize() public override void Initialize()
@@ -184,7 +184,9 @@ namespace Content.Client.NPC
foreach (var grid in _mapManager.FindGridsIntersecting(mouseWorldPos.MapId, aabb)) foreach (var grid in _mapManager.FindGridsIntersecting(mouseWorldPos.MapId, aabb))
{ {
if (found || !_system.Breadcrumbs.TryGetValue(grid.Owner, out var crumbs) || !xformQuery.TryGetComponent(grid.Owner, out var gridXform)) var netGrid = _entManager.GetNetEntity(grid.Owner);
if (found || !_system.Breadcrumbs.TryGetValue(netGrid, out var crumbs) || !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
continue; continue;
var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv(); var (_, _, worldMatrix, invWorldMatrix) = gridXform.GetWorldPositionRotationMatrixWithInv();
@@ -257,7 +259,7 @@ namespace Content.Client.NPC
if (!_mapManager.TryFindGridAt(mouseWorldPos, out var gridUid, out var grid) || !xformQuery.TryGetComponent(gridUid, out var gridXform)) if (!_mapManager.TryFindGridAt(mouseWorldPos, out var gridUid, out var grid) || !xformQuery.TryGetComponent(gridUid, out var gridXform))
return; return;
if (!_system.Polys.TryGetValue(gridUid, out var data)) if (!_system.Polys.TryGetValue(_entManager.GetNetEntity(gridUid), out var data))
return; return;
var tileRef = grid.GetTileRef(mouseWorldPos); var tileRef = grid.GetTileRef(mouseWorldPos);
@@ -333,7 +335,9 @@ namespace Content.Client.NPC
{ {
foreach (var grid in _mapManager.FindGridsIntersecting(mouseWorldPos.MapId, aabb)) foreach (var grid in _mapManager.FindGridsIntersecting(mouseWorldPos.MapId, aabb))
{ {
if (!_system.Breadcrumbs.TryGetValue(grid.Owner, out var crumbs) || var netGrid = _entManager.GetNetEntity(grid.Owner);
if (!_system.Breadcrumbs.TryGetValue(netGrid, out var crumbs) ||
!xformQuery.TryGetComponent(grid.Owner, out var gridXform)) !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
{ {
continue; continue;
@@ -390,7 +394,9 @@ namespace Content.Client.NPC
{ {
foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, aabb)) foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, aabb))
{ {
if (!_system.Polys.TryGetValue(grid.Owner, out var data) || var netGrid = _entManager.GetNetEntity(grid.Owner);
if (!_system.Polys.TryGetValue(netGrid, out var data) ||
!xformQuery.TryGetComponent(grid.Owner, out var gridXform)) !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
continue; continue;
@@ -424,7 +430,9 @@ namespace Content.Client.NPC
{ {
foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, aabb)) foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, aabb))
{ {
if (!_system.Polys.TryGetValue(grid.Owner, out var data) || var netGrid = _entManager.GetNetEntity(grid.Owner);
if (!_system.Polys.TryGetValue(netGrid, out var data) ||
!xformQuery.TryGetComponent(grid.Owner, out var gridXform)) !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
continue; continue;
@@ -450,10 +458,10 @@ namespace Content.Client.NPC
Color color; Color color;
Vector2 neighborPos; Vector2 neighborPos;
if (neighborPoly.EntityId != poly.GraphUid) if (neighborPoly.NetEntity != poly.GraphUid)
{ {
color = Color.Green; color = Color.Green;
var neighborMap = neighborPoly.ToMap(_entManager); var neighborMap = _entManager.GetCoordinates(neighborPoly).ToMap(_entManager);
if (neighborMap.MapId != args.MapId) if (neighborMap.MapId != args.MapId)
continue; continue;
@@ -478,7 +486,9 @@ namespace Content.Client.NPC
{ {
foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, args.WorldBounds)) foreach (var grid in _mapManager.FindGridsIntersecting(args.MapId, args.WorldBounds))
{ {
if (!_system.Breadcrumbs.TryGetValue(grid.Owner, out var crumbs) || var netGrid = _entManager.GetNetEntity(grid.Owner);
if (!_system.Breadcrumbs.TryGetValue(netGrid, out var crumbs) ||
!xformQuery.TryGetComponent(grid.Owner, out var gridXform)) !xformQuery.TryGetComponent(grid.Owner, out var gridXform))
continue; continue;
@@ -506,7 +516,7 @@ namespace Content.Client.NPC
{ {
foreach (var node in route.Message.Path) foreach (var node in route.Message.Path)
{ {
if (!_entManager.TryGetComponent<TransformComponent>(node.GraphUid, out var graphXform)) if (!_entManager.TryGetComponent<TransformComponent>(_entManager.GetEntity(node.GraphUid), out var graphXform))
continue; continue;
worldHandle.SetTransform(graphXform.WorldMatrix); worldHandle.SetTransform(graphXform.WorldMatrix);
@@ -525,12 +535,14 @@ namespace Content.Client.NPC
foreach (var (node, cost) in route.Message.Costs) foreach (var (node, cost) in route.Message.Costs)
{ {
if (matrix != node.GraphUid) var graph = _entManager.GetEntity(node.GraphUid);
if (matrix != graph)
{ {
if (!_entManager.TryGetComponent<TransformComponent>(node.GraphUid, out var graphXform)) if (!_entManager.TryGetComponent<TransformComponent>(graph, out var graphXform))
continue; continue;
matrix = node.GraphUid; matrix = graph;
worldHandle.SetTransform(graphXform.WorldMatrix); worldHandle.SetTransform(graphXform.WorldMatrix);
} }

View File

@@ -69,7 +69,7 @@ namespace Content.Client.NodeContainer
Entities = Groups.Values Entities = Groups.Values
.SelectMany(g => g.Nodes, (data, nodeData) => (data, nodeData)) .SelectMany(g => g.Nodes, (data, nodeData) => (data, nodeData))
.GroupBy(n => n.nodeData.Entity) .GroupBy(n => GetEntity(n.nodeData.Entity))
.ToDictionary(g => g.Key, g => g.ToArray()); .ToDictionary(g => g.Key, g => g.ToArray());
NodeLookup = Groups.Values NodeLookup = Groups.Values

View File

@@ -77,7 +77,7 @@ namespace Content.Client.NodeContainer
var node = _system.NodeLookup[(groupId, nodeId)]; var node = _system.NodeLookup[(groupId, nodeId)];
var xform = _entityManager.GetComponent<TransformComponent>(node.Entity); var xform = _entityManager.GetComponent<TransformComponent>(_entityManager.GetEntity(node.Entity));
if (!_mapManager.TryGetGrid(xform.GridUid, out var grid)) if (!_mapManager.TryGetGrid(xform.GridUid, out var grid))
return; return;
var gridTile = grid.TileIndicesFor(xform.Coordinates); var gridTile = grid.TileIndicesFor(xform.Coordinates);

View File

@@ -31,7 +31,7 @@ public sealed class PointingSystem : SharedPointingSystem
private void AddPointingVerb(GetVerbsEvent<Verb> args) private void AddPointingVerb(GetVerbsEvent<Verb> args)
{ {
if (args.Target.IsClientSide()) if (IsClientSide(args.Target))
return; return;
// Really this could probably be a properly predicted event, but that requires reworking pointing. For now // Really this could probably be a properly predicted event, but that requires reworking pointing. For now
@@ -57,7 +57,7 @@ public sealed class PointingSystem : SharedPointingSystem
Text = Loc.GetString("pointing-verb-get-data-text"), Text = Loc.GetString("pointing-verb-get-data-text"),
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/point.svg.192dpi.png")), Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/point.svg.192dpi.png")),
ClientExclusive = true, ClientExclusive = true,
Act = () => RaiseNetworkEvent(new PointingAttemptEvent(args.Target)) Act = () => RaiseNetworkEvent(new PointingAttemptEvent(GetNetEntity(args.Target)))
}; };
args.Verbs.Add(verb); args.Verbs.Add(verb);

View File

@@ -61,9 +61,9 @@ namespace Content.Client.Popups
if (recordReplay && _replayRecording.IsRecording) if (recordReplay && _replayRecording.IsRecording)
{ {
if (entity != null) if (entity != null)
_replayRecording.RecordClientMessage(new PopupEntityEvent(message, type, entity.Value)); _replayRecording.RecordClientMessage(new PopupEntityEvent(message, type, GetNetEntity(entity.Value)));
else else
_replayRecording.RecordClientMessage(new PopupCoordinatesEvent(message, type, coordinates)); _replayRecording.RecordClientMessage(new PopupCoordinatesEvent(message, type, GetNetCoordinates(coordinates)));
} }
var label = new WorldPopupLabel(coordinates) var label = new WorldPopupLabel(coordinates)
@@ -170,13 +170,15 @@ namespace Content.Client.Popups
private void OnPopupCoordinatesEvent(PopupCoordinatesEvent ev) private void OnPopupCoordinatesEvent(PopupCoordinatesEvent ev)
{ {
PopupMessage(ev.Message, ev.Type, ev.Coordinates, null, false); PopupMessage(ev.Message, ev.Type, GetCoordinates(ev.Coordinates), null, false);
} }
private void OnPopupEntityEvent(PopupEntityEvent ev) private void OnPopupEntityEvent(PopupEntityEvent ev)
{ {
if (TryComp(ev.Uid, out TransformComponent? transform)) var entity = GetEntity(ev.Uid);
PopupMessage(ev.Message, ev.Type, transform.Coordinates, ev.Uid, false);
if (TryComp(entity, out TransformComponent? transform))
PopupMessage(ev.Message, ev.Type, transform.Coordinates, entity, false);
} }
private void OnRoundRestart(RoundRestartCleanupEvent ev) private void OnRoundRestart(RoundRestartCleanupEvent ev)

View File

@@ -19,10 +19,12 @@ public sealed class ProjectileSystem : SharedProjectileSystem
private void OnProjectileImpact(ImpactEffectEvent ev) private void OnProjectileImpact(ImpactEffectEvent ev)
{ {
if (Deleted(ev.Coordinates.EntityId)) var coords = GetCoordinates(ev.Coordinates);
if (Deleted(coords.EntityId))
return; return;
var ent = Spawn(ev.Prototype, ev.Coordinates); var ent = Spawn(ev.Prototype, coords);
if (TryComp<SpriteComponent>(ent, out var sprite)) if (TryComp<SpriteComponent>(ent, out var sprite))
{ {

View File

@@ -59,8 +59,10 @@ public sealed class RadiationDebugOverlay : Overlay
handle.DrawString(_font, screenCenter, ray.Rads.ToString("F2"), 2f, Color.White); handle.DrawString(_font, screenCenter, ray.Rads.ToString("F2"), 2f, Color.White);
} }
foreach (var (gridUid, blockers) in ray.Blockers) foreach (var (netGrid, blockers) in ray.Blockers)
{ {
var gridUid = _entityManager.GetEntity(netGrid);
if (!_mapManager.TryGetGrid(gridUid, out var grid)) if (!_mapManager.TryGetGrid(gridUid, out var grid))
continue; continue;
@@ -82,8 +84,10 @@ public sealed class RadiationDebugOverlay : Overlay
var handle = args.ScreenHandle; var handle = args.ScreenHandle;
var query = _entityManager.GetEntityQuery<TransformComponent>(); var query = _entityManager.GetEntityQuery<TransformComponent>();
foreach (var (gridUid, resMap) in resistance) foreach (var (netGrid, resMap) in resistance)
{ {
var gridUid = _entityManager.GetEntity(netGrid);
if (!_mapManager.TryGetGrid(gridUid, out var grid)) if (!_mapManager.TryGetGrid(gridUid, out var grid))
continue; continue;
if (query.TryGetComponent(gridUid, out var trs) && trs.MapID != args.MapId) if (query.TryGetComponent(gridUid, out var trs) && trs.MapID != args.MapId)
@@ -119,8 +123,10 @@ public sealed class RadiationDebugOverlay : Overlay
continue; continue;
} }
foreach (var (gridUid, blockers) in ray.Blockers) foreach (var (netGrid, blockers) in ray.Blockers)
{ {
var gridUid = _entityManager.GetEntity(netGrid);
if (!_mapManager.TryGetGrid(gridUid, out var grid)) if (!_mapManager.TryGetGrid(gridUid, out var grid))
continue; continue;
var (destTile, _) = blockers.Last(); var (destTile, _) = blockers.Last();

View File

@@ -26,7 +26,7 @@ public sealed class GeigerSystem : SharedGeigerSystem
component.CurrentRadiation = state.CurrentRadiation; component.CurrentRadiation = state.CurrentRadiation;
component.DangerLevel = state.DangerLevel; component.DangerLevel = state.DangerLevel;
component.IsEnabled = state.IsEnabled; component.IsEnabled = state.IsEnabled;
component.User = state.User; component.User = EnsureEntity<GeigerComponent>(state.User, uid);
component.UiUpdateNeeded = true; component.UiUpdateNeeded = true;
} }

View File

@@ -10,7 +10,7 @@ public sealed class RadiationSystem : EntitySystem
[Dependency] private readonly IOverlayManager _overlayMan = default!; [Dependency] private readonly IOverlayManager _overlayMan = default!;
public List<RadiationRay>? Rays; public List<RadiationRay>? Rays;
public Dictionary<EntityUid, Dictionary<Vector2i, float>>? ResistanceGrids; public Dictionary<NetEntity, Dictionary<Vector2i, float>>? ResistanceGrids;
public override void Initialize() public override void Initialize()
{ {
@@ -40,15 +40,13 @@ public sealed class RadiationSystem : EntitySystem
var str = $"Radiation update: {ev.ElapsedTimeMs}ms with. Receivers: {ev.ReceiversCount}, " + var str = $"Radiation update: {ev.ElapsedTimeMs}ms with. Receivers: {ev.ReceiversCount}, " +
$"Sources: {ev.SourcesCount}, Rays: {ev.Rays.Count}"; $"Sources: {ev.SourcesCount}, Rays: {ev.Rays.Count}";
Logger.Info(str); Log.Info(str);
Rays = ev.Rays; Rays = ev.Rays;
} }
private void OnResistanceUpdate(OnRadiationOverlayResistanceUpdateEvent ev) private void OnResistanceUpdate(OnRadiationOverlayResistanceUpdateEvent ev)
{ {
if (!_overlayMan.TryGetOverlay(out RadiationDebugOverlay? overlay))
return;
ResistanceGrids = ev.Grids; ResistanceGrids = ev.Grids;
} }
} }

View File

@@ -55,7 +55,7 @@ public sealed partial class ReplaySpectatorSystem
return; return;
} }
if (!player.IsClientSide() || !HasComp<ReplaySpectatorComponent>(player)) if (!IsClientSide(player) || !HasComp<ReplaySpectatorComponent>(player))
{ {
// Player is trying to move -> behave like the ghost-on-move component. // Player is trying to move -> behave like the ghost-on-move component.
SpawnSpectatorGhost(new EntityCoordinates(player, default), true); SpawnSpectatorGhost(new EntityCoordinates(player, default), true);
@@ -113,12 +113,9 @@ public sealed partial class ReplaySpectatorSystem
_dir = dir; _dir = dir;
} }
public override bool HandleCmdMessage(ICommonSession? session, InputCmdMessage message) public override bool HandleCmdMessage(IEntityManager entManager, ICommonSession? session, IFullInputCmdMessage message)
{ {
if (message is not FullInputCmdMessage full) if (message.State == BoundKeyState.Down)
return false;
if (full.State == BoundKeyState.Down)
_sys.Direction |= _dir; _sys.Direction |= _dir;
else else
_sys.Direction &= ~_dir; _sys.Direction &= ~_dir;

View File

@@ -167,7 +167,7 @@ public sealed partial class ReplaySpectatorSystem
private void OnDetached(EntityUid uid, ReplaySpectatorComponent component, PlayerDetachedEvent args) private void OnDetached(EntityUid uid, ReplaySpectatorComponent component, PlayerDetachedEvent args)
{ {
if (uid.IsClientSide()) if (IsClientSide(uid))
QueueDel(uid); QueueDel(uid);
else else
RemCompDeferred(uid, component); RemCompDeferred(uid, component);

View File

@@ -51,7 +51,7 @@ public sealed partial class ReplaySpectatorSystem
if (old == null) if (old == null)
return; return;
if (old.Value.IsClientSide()) if (IsClientSide(old.Value))
Del(old.Value); Del(old.Value);
else else
RemComp<ReplaySpectatorComponent>(old.Value); RemComp<ReplaySpectatorComponent>(old.Value);
@@ -77,7 +77,7 @@ public sealed partial class ReplaySpectatorSystem
if (old != null) if (old != null)
{ {
if (old.Value.IsClientSide()) if (IsClientSide(old.Value))
QueueDel(old.Value); QueueDel(old.Value);
else else
RemComp<ReplaySpectatorComponent>(old.Value); RemComp<ReplaySpectatorComponent>(old.Value);
@@ -100,12 +100,14 @@ public sealed partial class ReplaySpectatorSystem
return; return;
} }
if (!EntityUid.TryParse(args[0], out var uid)) if (!NetEntity.TryParse(args[0], out var netEntity))
{ {
shell.WriteError(Loc.GetString("cmd-parse-failure-uid", ("arg", args[0]))); shell.WriteError(Loc.GetString("cmd-parse-failure-uid", ("arg", args[0])));
return; return;
} }
var uid = GetEntity(netEntity);
if (!Exists(uid)) if (!Exists(uid))
{ {
shell.WriteError(Loc.GetString("cmd-parse-failure-entity-exist", ("arg", args[0]))); shell.WriteError(Loc.GetString("cmd-parse-failure-entity-exist", ("arg", args[0])));
@@ -120,7 +122,7 @@ public sealed partial class ReplaySpectatorSystem
if (args.Length != 1) if (args.Length != 1)
return CompletionResult.Empty; return CompletionResult.Empty;
return CompletionResult.FromHintOptions(CompletionHelper.EntityUids(args[0], return CompletionResult.FromHintOptions(CompletionHelper.NetEntities(args[0],
EntityManager), Loc.GetString("cmd-replay-spectate-hint")); EntityManager), Loc.GetString("cmd-replay-spectate-hint"));
} }
} }

View File

@@ -125,7 +125,9 @@ namespace Content.Client.RoundEnd
VerticalExpand = true, VerticalExpand = true,
}; };
if (_entityManager.HasComponent<SpriteComponent>(playerInfo.PlayerEntityUid)) var playerUid = _entityManager.GetEntity(playerInfo.PlayerNetEntity);
if (_entityManager.HasComponent<SpriteComponent>(playerUid))
{ {
var spriteView = new SpriteView var spriteView = new SpriteView
{ {
@@ -134,7 +136,7 @@ namespace Content.Client.RoundEnd
SetSize = new Vector2(32, 32), SetSize = new Vector2(32, 32),
VerticalExpand = true, VerticalExpand = true,
}; };
spriteView.SetEntity(playerInfo.PlayerEntityUid); spriteView.SetEntity(playerUid);
hBox.AddChild(spriteView); hBox.AddChild(spriteView);
} }

View File

@@ -63,15 +63,18 @@ public sealed class FultonSystem : SharedFultonSystem
private void OnFultonMessage(FultonAnimationMessage ev) private void OnFultonMessage(FultonAnimationMessage ev)
{ {
if (Deleted(ev.Entity) || !TryComp<SpriteComponent>(ev.Entity, out var entSprite)) var entity = GetEntity(ev.Entity);
var coordinates = GetCoordinates(ev.Coordinates);
if (Deleted(entity) || !TryComp<SpriteComponent>(entity, out var entSprite))
return; return;
var animationEnt = Spawn(null, ev.Coordinates); var animationEnt = Spawn(null, coordinates);
// TODO: Spawn fulton layer // TODO: Spawn fulton layer
var sprite = AddComp<SpriteComponent>(animationEnt); var sprite = AddComp<SpriteComponent>(animationEnt);
_serManager.CopyTo(entSprite, ref sprite, notNullableOverride: true); _serManager.CopyTo(entSprite, ref sprite, notNullableOverride: true);
if (TryComp<AppearanceComponent>(ev.Entity, out var entAppearance)) if (TryComp<AppearanceComponent>(entity, out var entAppearance))
{ {
var appearance = AddComp<AppearanceComponent>(animationEnt); var appearance = AddComp<AppearanceComponent>(animationEnt);
_serManager.CopyTo(entAppearance, ref appearance, notNullableOverride: true); _serManager.CopyTo(entAppearance, ref appearance, notNullableOverride: true);

View File

@@ -38,7 +38,7 @@ public sealed class RadarConsoleBoundUserInterface : BoundUserInterface
base.UpdateState(state); base.UpdateState(state);
if (state is not RadarConsoleBoundInterfaceState cState) return; if (state is not RadarConsoleBoundInterfaceState cState) return;
_window?.SetMatrix(cState.Coordinates, cState.Angle); _window?.SetMatrix(EntMan.GetCoordinates(cState.Coordinates), cState.Angle);
_window?.UpdateState(cState); _window?.UpdateState(cState);
} }
} }

View File

@@ -28,7 +28,7 @@ public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
_window.OnClose += OnClose; _window.OnClose += OnClose;
} }
private void OnDestinationPressed(EntityUid obj) private void OnDestinationPressed(NetEntity obj)
{ {
SendMessage(new ShuttleConsoleFTLRequestMessage() SendMessage(new ShuttleConsoleFTLRequestMessage()
{ {
@@ -51,17 +51,17 @@ public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
} }
} }
private void OnStopAutodockPressed(EntityUid obj) private void OnStopAutodockPressed(NetEntity obj)
{ {
SendMessage(new StopAutodockRequestMessage() { DockEntity = obj }); SendMessage(new StopAutodockRequestMessage() { DockEntity = obj });
} }
private void OnAutodockPressed(EntityUid obj) private void OnAutodockPressed(NetEntity obj)
{ {
SendMessage(new AutodockRequestMessage() { DockEntity = obj }); SendMessage(new AutodockRequestMessage() { DockEntity = obj });
} }
private void OnUndockPressed(EntityUid obj) private void OnUndockPressed(NetEntity obj)
{ {
SendMessage(new UndockRequestMessage() { DockEntity = obj }); SendMessage(new UndockRequestMessage() { DockEntity = obj });
} }
@@ -71,7 +71,7 @@ public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
base.UpdateState(state); base.UpdateState(state);
if (state is not ShuttleConsoleBoundInterfaceState cState) return; if (state is not ShuttleConsoleBoundInterfaceState cState) return;
_window?.SetMatrix(cState.Coordinates, cState.Angle); _window?.SetMatrix(EntMan.GetCoordinates(cState.Coordinates), cState.Angle);
_window?.UpdateState(cState); _window?.UpdateState(cState);
} }
} }

View File

@@ -44,8 +44,9 @@ namespace Content.Client.Shuttles.Systems
{ {
if (args.Current is not PilotComponentState state) return; if (args.Current is not PilotComponentState state) return;
var console = state.Console.GetValueOrDefault(); var console = EnsureEntity<PilotComponent>(state.Console, uid);
if (!console.IsValid())
if (console == null)
{ {
component.Console = null; component.Console = null;
_input.Contexts.SetActiveContext("human"); _input.Contexts.SetActiveContext("human");

View File

@@ -47,7 +47,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
{ {
if (_overlay == null) return; if (_overlay == null) return;
_overlay.StationUid = ev.StationUid; _overlay.StationUid = GetEntity(ev.StationUid);
_overlay.Position = ev.Position; _overlay.Position = ev.Position;
} }
} }

View File

@@ -32,7 +32,7 @@ public class DockingControl : Control
private int ScaledMinimapRadius => (int) (MapGridControl.UIDisplayRadius * UIScale); private int ScaledMinimapRadius => (int) (MapGridControl.UIDisplayRadius * UIScale);
private float MinimapScale => _range != 0 ? ScaledMinimapRadius / _range : 0f; private float MinimapScale => _range != 0 ? ScaledMinimapRadius / _range : 0f;
public EntityUid? ViewedDock; public NetEntity? ViewedDock;
public EntityUid? GridEntity; public EntityUid? GridEntity;
public EntityCoordinates? Coordinates; public EntityCoordinates? Coordinates;
@@ -41,7 +41,7 @@ public class DockingControl : Control
/// <summary> /// <summary>
/// Stored by GridID then by docks /// Stored by GridID then by docks
/// </summary> /// </summary>
public Dictionary<EntityUid, List<DockingInterfaceState>> Docks = new(); public Dictionary<NetEntity, List<DockingInterfaceState>> Docks = new();
public DockingControl() public DockingControl()
{ {
@@ -204,7 +204,7 @@ public class DockingControl : Control
} }
// Draw any docks on that grid // Draw any docks on that grid
if (Docks.TryGetValue(grid.Owner, out var gridDocks)) if (Docks.TryGetValue(_entManager.GetNetEntity(grid.Owner), out var gridDocks))
{ {
foreach (var dock in gridDocks) foreach (var dock in gridDocks)
{ {

View File

@@ -124,7 +124,7 @@ public sealed class RadarControl : MapGridControl
foreach (var state in ls.Docks) foreach (var state in ls.Docks)
{ {
var coordinates = state.Coordinates; var coordinates = state.Coordinates;
var grid = _docks.GetOrNew(coordinates.EntityId); var grid = _docks.GetOrNew(_entManager.GetEntity(coordinates.NetEntity));
grid.Add(state); grid.Add(state);
} }
} }
@@ -324,7 +324,7 @@ public sealed class RadarControl : MapGridControl
{ {
foreach (var state in docks) foreach (var state in docks)
{ {
var ent = state.Entity; var ent = _entManager.GetEntity(state.Entity);
var position = state.Coordinates.Position; var position = state.Coordinates.Position;
var uiPosition = matrix.Transform(position); var uiPosition = matrix.Transform(position);

View File

@@ -22,7 +22,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
private readonly IEntityManager _entManager; private readonly IEntityManager _entManager;
private readonly IGameTiming _timing; private readonly IGameTiming _timing;
private EntityUid? _shuttleUid; private EntityUid? _shuttleEntity;
/// <summary> /// <summary>
/// Currently selected dock button for camera. /// Currently selected dock button for camera.
@@ -32,19 +32,19 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
/// <summary> /// <summary>
/// Stored by grid entityid then by states /// Stored by grid entityid then by states
/// </summary> /// </summary>
private readonly Dictionary<EntityUid, List<DockingInterfaceState>> _docks = new(); private readonly Dictionary<NetEntity, List<DockingInterfaceState>> _docks = new();
private readonly Dictionary<BaseButton, EntityUid> _destinations = new(); private readonly Dictionary<BaseButton, NetEntity> _destinations = new();
/// <summary> /// <summary>
/// Next FTL state change. /// Next FTL state change.
/// </summary> /// </summary>
public TimeSpan FTLTime; public TimeSpan FTLTime;
public Action<EntityUid>? UndockPressed; public Action<NetEntity>? UndockPressed;
public Action<EntityUid>? StartAutodockPressed; public Action<NetEntity>? StartAutodockPressed;
public Action<EntityUid>? StopAutodockPressed; public Action<NetEntity>? StopAutodockPressed;
public Action<EntityUid>? DestinationPressed; public Action<NetEntity>? DestinationPressed;
public ShuttleConsoleWindow() public ShuttleConsoleWindow()
{ {
@@ -89,7 +89,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
public void SetMatrix(EntityCoordinates? coordinates, Angle? angle) public void SetMatrix(EntityCoordinates? coordinates, Angle? angle)
{ {
_shuttleUid = coordinates?.EntityId; _shuttleEntity = coordinates?.EntityId;
RadarScreen.SetMatrix(coordinates, angle); RadarScreen.SetMatrix(coordinates, angle);
} }
@@ -101,7 +101,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
MaxRadarRange.Text = $"{scc.MaxRange:0}"; MaxRadarRange.Text = $"{scc.MaxRange:0}";
} }
private void UpdateFTL(List<(EntityUid Entity, string Destination, bool Enabled)> destinations, FTLState state, TimeSpan time) private void UpdateFTL(List<(NetEntity Entity, string Destination, bool Enabled)> destinations, FTLState state, TimeSpan time)
{ {
HyperspaceDestinations.DisposeAllChildren(); HyperspaceDestinations.DisposeAllChildren();
_destinations.Clear(); _destinations.Clear();
@@ -183,14 +183,15 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
foreach (var dock in docks) foreach (var dock in docks)
{ {
var grid = _docks.GetOrNew(dock.Coordinates.EntityId); var grid = _docks.GetOrNew(dock.Coordinates.NetEntity);
grid.Add(dock); grid.Add(dock);
} }
DockPorts.DisposeAllChildren(); DockPorts.DisposeAllChildren();
DockingScreen.Docks = _docks; DockingScreen.Docks = _docks;
var shuttleNetEntity = _entManager.GetNetEntity(_shuttleEntity);
if (_shuttleUid != null && _docks.TryGetValue(_shuttleUid.Value, out var gridDocks)) if (shuttleNetEntity != null && _docks.TryGetValue(shuttleNetEntity.Value, out var gridDocks))
{ {
var index = 1; var index = 1;
@@ -233,7 +234,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
private void OnDockMouseEntered(GUIMouseHoverEventArgs obj, DockingInterfaceState state) private void OnDockMouseEntered(GUIMouseHoverEventArgs obj, DockingInterfaceState state)
{ {
RadarScreen.HighlightedDock = state.Entity; RadarScreen.HighlightedDock = _entManager.GetEntity(state.Entity);
} }
private void OnDockMouseExited(GUIMouseHoverEventArgs obj, DockingInterfaceState state) private void OnDockMouseExited(GUIMouseHoverEventArgs obj, DockingInterfaceState state)
@@ -246,8 +247,6 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
/// </summary> /// </summary>
private void OnDockToggled(BaseButton.ButtonEventArgs obj, DockingInterfaceState state) private void OnDockToggled(BaseButton.ButtonEventArgs obj, DockingInterfaceState state)
{ {
var ent = state.Entity;
if (_selectedDock != null) if (_selectedDock != null)
{ {
// If it got untoggled via other means then we'll stop viewing the old dock. // If it got untoggled via other means then we'll stop viewing the old dock.
@@ -274,9 +273,9 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
} }
else else
{ {
if (_shuttleUid != null) if (_shuttleEntity != null)
{ {
DockingScreen.Coordinates = state.Coordinates; DockingScreen.Coordinates = _entManager.GetCoordinates(state.Coordinates);
DockingScreen.Angle = state.Angle; DockingScreen.Angle = state.Angle;
} }
else else
@@ -288,9 +287,9 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
UndockButton.Disabled = false; UndockButton.Disabled = false;
RadarScreen.Visible = false; RadarScreen.Visible = false;
DockingScreen.Visible = true; DockingScreen.Visible = true;
DockingScreen.ViewedDock = ent; DockingScreen.ViewedDock = state.Entity;
StartAutodockPressed?.Invoke(ent); StartAutodockPressed?.Invoke(state.Entity);
DockingScreen.GridEntity = _shuttleUid; DockingScreen.GridEntity = _shuttleEntity;
_selectedDock = obj.Button; _selectedDock = obj.Button;
} }
} }
@@ -310,13 +309,13 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
{ {
base.Draw(handle); base.Draw(handle);
if (!_entManager.TryGetComponent<PhysicsComponent>(_shuttleUid, out var gridBody) || if (!_entManager.TryGetComponent<PhysicsComponent>(_shuttleEntity, out var gridBody) ||
!_entManager.TryGetComponent<TransformComponent>(_shuttleUid, out var gridXform)) !_entManager.TryGetComponent<TransformComponent>(_shuttleEntity, out var gridXform))
{ {
return; return;
} }
if (_entManager.TryGetComponent<MetaDataComponent>(_shuttleUid, out var metadata) && metadata.EntityPaused) if (_entManager.TryGetComponent<MetaDataComponent>(_shuttleEntity, out var metadata) && metadata.EntityPaused)
{ {
FTLTime += _timing.FrameTime; FTLTime += _timing.FrameTime;
} }

View File

@@ -39,7 +39,7 @@ public sealed class BorgBoundUserInterface : BoundUserInterface
_menu.RemoveModuleButtonPressed += module => _menu.RemoveModuleButtonPressed += module =>
{ {
SendMessage(new BorgRemoveModuleBuiMessage(module)); SendMessage(new BorgRemoveModuleBuiMessage(EntMan.GetNetEntity(module)));
}; };
_menu.OnClose += Close; _menu.OnClose += Close;

View File

@@ -6,6 +6,6 @@ public sealed class TimedDespawnSystem : SharedTimedDespawnSystem
{ {
protected override bool CanDelete(EntityUid uid) protected override bool CanDelete(EntityUid uid)
{ {
return uid.IsClientSide(); return IsClientSide(uid);
} }
} }

View File

@@ -27,6 +27,7 @@ public sealed class StationSystem : EntitySystem
private void StationsUpdated(StationsUpdatedEvent ev) private void StationsUpdated(StationsUpdatedEvent ev)
{ {
_stations.Clear(); _stations.Clear();
_stations.UnionWith(ev.Stations); // TODO this needs to be dona in component states and with the Ensure() methods
_stations.UnionWith(GetEntitySet(ev.Stations));
} }
} }

View File

@@ -26,7 +26,7 @@ public sealed class GeneralStationRecordConsoleBoundUserInterface : BoundUserInt
private void OnKeySelected(StationRecordKey? key) private void OnKeySelected(StationRecordKey? key)
{ {
SendMessage(new SelectGeneralStationRecord(key)); SendMessage(new SelectGeneralStationRecord(EntMan.System<SharedStationRecordsSystem>().Convert(key)));
} }
private void OnFiltersChanged( private void OnFiltersChanged(

View File

@@ -123,7 +123,7 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
RecordContainer.RemoveAllChildren(); RecordContainer.RemoveAllChildren();
} }
} }
private void PopulateRecordListing(Dictionary<StationRecordKey, string> listing, StationRecordKey? selected) private void PopulateRecordListing(Dictionary<(NetEntity, uint), string> listing, (NetEntity, uint)? selected)
{ {
RecordListing.Clear(); RecordListing.Clear();
RecordListing.ClearSelected(); RecordListing.ClearSelected();
@@ -134,7 +134,7 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
{ {
var item = RecordListing.AddItem(name); var item = RecordListing.AddItem(name);
item.Metadata = key; item.Metadata = key;
if (selected != null && key.ID == selected.Value.ID) if (selected != null && key.Item1 == selected.Value.Item1 && key.Item2 == selected.Value.Item2)
{ {
item.Selected = true; item.Selected = true;
} }

View File

@@ -0,0 +1,7 @@
using Content.Shared.StationRecords;
namespace Content.Client.StationRecords;
public sealed class StationRecordsSystem : SharedStationRecordsSystem
{
}

View File

@@ -54,7 +54,7 @@ namespace Content.Client.Storage
if (args.Event.Function == EngineKeyFunctions.UIClick) if (args.Event.Function == EngineKeyFunctions.UIClick)
{ {
SendMessage(new StorageInteractWithItemEvent(entity)); SendMessage(new StorageInteractWithItemEvent(EntMan.GetNetEntity(entity)));
} }
else if (EntMan.EntityExists(entity)) else if (EntMan.EntityExists(entity))
{ {
@@ -76,11 +76,11 @@ namespace Content.Client.Storage
else if (args.Function == ContentKeyFunctions.ActivateItemInWorld) else if (args.Function == ContentKeyFunctions.ActivateItemInWorld)
{ {
EntMan.EntityNetManager?.SendSystemNetworkMessage( EntMan.EntityNetManager?.SendSystemNetworkMessage(
new InteractInventorySlotEvent(entity, altInteract: false)); new InteractInventorySlotEvent(EntMan.GetNetEntity(entity), altInteract: false));
} }
else if (args.Function == ContentKeyFunctions.AltActivateItemInWorld) else if (args.Function == ContentKeyFunctions.AltActivateItemInWorld)
{ {
EntMan.RaisePredictiveEvent(new InteractInventorySlotEvent(entity, altInteract: true)); EntMan.RaisePredictiveEvent(new InteractInventorySlotEvent(EntMan.GetNetEntity(entity), altInteract: true));
} }
else else
{ {

View File

@@ -19,18 +19,20 @@ public sealed class StorageSystem : EntitySystem
/// <param name="msg"></param> /// <param name="msg"></param>
public void HandleAnimatingInsertingEntities(AnimateInsertingEntitiesEvent msg) public void HandleAnimatingInsertingEntities(AnimateInsertingEntitiesEvent msg)
{ {
if (!TryComp(msg.Storage, out ClientStorageComponent? storage)) var store = GetEntity(msg.Storage);
if (!HasComp<ClientStorageComponent>(store))
return; return;
TryComp(msg.Storage, out TransformComponent? transformComp); TryComp(store, out TransformComponent? transformComp);
for (var i = 0; msg.StoredEntities.Count > i; i++) for (var i = 0; msg.StoredEntities.Count > i; i++)
{ {
var entity = msg.StoredEntities[i]; var entity = GetEntity(msg.StoredEntities[i]);
var initialPosition = msg.EntityPositions[i]; var initialPosition = msg.EntityPositions[i];
if (EntityManager.EntityExists(entity) && transformComp != null) if (EntityManager.EntityExists(entity) && transformComp != null)
{ {
ReusableAnimations.AnimateEntityPickup(entity, initialPosition, transformComp.LocalPosition, msg.EntityAngles[i], EntityManager); ReusableAnimations.AnimateEntityPickup(entity, GetCoordinates(initialPosition), transformComp.LocalPosition, msg.EntityAngles[i], EntityManager);
} }
} }
} }

View File

@@ -88,7 +88,7 @@ namespace Content.Client.Storage.UI
/// </summary> /// </summary>
public void BuildEntityList(StorageBoundUserInterfaceState state) public void BuildEntityList(StorageBoundUserInterfaceState state)
{ {
var list = state.StoredEntities.ConvertAll(uid => new EntityListData(uid)); var list = state.StoredEntities.ConvertAll(nent => new EntityListData(_entityManager.GetEntity(nent)));
EntityList.PopulateList(list); EntityList.PopulateList(list);
//Sets information about entire storage container current capacity //Sets information about entire storage container current capacity

View File

@@ -80,7 +80,9 @@ public sealed class SurveillanceCameraMonitorBoundUserInterface : BoundUserInter
return; return;
} }
if (cast.ActiveCamera == null) var active = EntMan.GetEntity(cast.ActiveCamera);
if (active == null)
{ {
_window.UpdateState(null, cast.Subnets, cast.ActiveAddress, cast.ActiveSubnet, cast.Cameras); _window.UpdateState(null, cast.Subnets, cast.ActiveAddress, cast.ActiveSubnet, cast.Cameras);
@@ -95,17 +97,17 @@ public sealed class SurveillanceCameraMonitorBoundUserInterface : BoundUserInter
{ {
if (_currentCamera == null) if (_currentCamera == null)
{ {
_eyeLerpingSystem.AddEye(cast.ActiveCamera.Value); _eyeLerpingSystem.AddEye(active.Value);
_currentCamera = cast.ActiveCamera; _currentCamera = active;
} }
else if (_currentCamera != cast.ActiveCamera) else if (_currentCamera != active)
{ {
_eyeLerpingSystem.RemoveEye(_currentCamera.Value); _eyeLerpingSystem.RemoveEye(_currentCamera.Value);
_eyeLerpingSystem.AddEye(cast.ActiveCamera.Value); _eyeLerpingSystem.AddEye(active.Value);
_currentCamera = cast.ActiveCamera; _currentCamera = active;
} }
if (EntMan.TryGetComponent<EyeComponent>(cast.ActiveCamera, out var eye)) if (EntMan.TryGetComponent<EyeComponent>(active, out var eye))
{ {
_window.UpdateState(eye.Eye, cast.Subnets, cast.ActiveAddress, cast.ActiveSubnet, cast.Cameras); _window.UpdateState(eye.Eye, cast.Subnets, cast.ActiveAddress, cast.ActiveSubnet, cast.Cameras);
} }

View File

@@ -109,7 +109,7 @@ namespace Content.Client.Tabletop
// Only send new position to server when Delay is reached // Only send new position to server when Delay is reached
if (_timePassed >= Delay && _table != null) if (_timePassed >= Delay && _table != null)
{ {
RaisePredictiveEvent(new TabletopMoveEvent(_draggedEntity.Value, clampedCoords, _table.Value)); RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), clampedCoords, GetNetEntity(_table.Value)));
_timePassed -= Delay; _timePassed -= Delay;
} }
} }
@@ -125,15 +125,15 @@ namespace Content.Client.Tabletop
// Close the currently opened window, if it exists // Close the currently opened window, if it exists
_window?.Close(); _window?.Close();
_table = msg.TableUid; _table = GetEntity(msg.TableUid);
// Get the camera entity that the server has created for us // Get the camera entity that the server has created for us
var camera = msg.CameraUid; var camera = GetEntity(msg.CameraUid);
if (!EntityManager.TryGetComponent<EyeComponent>(camera, out var eyeComponent)) if (!EntityManager.TryGetComponent<EyeComponent>(camera, out var eyeComponent))
{ {
// If there is no eye, print error and do not open any window // If there is no eye, print error and do not open any window
Logger.Error("Camera entity does not have eye component!"); Log.Error("Camera entity does not have eye component!");
return; return;
} }
@@ -159,7 +159,7 @@ namespace Content.Client.Tabletop
{ {
if (_table != null) if (_table != null)
{ {
RaiseNetworkEvent(new TabletopStopPlayingEvent(_table.Value)); RaiseNetworkEvent(new TabletopStopPlayingEvent(GetNetEntity(_table.Value)));
} }
StopDragging(); StopDragging();
@@ -182,9 +182,11 @@ namespace Content.Client.Tabletop
{ {
if (_draggedEntity != null && _table != null) if (_draggedEntity != null && _table != null)
{ {
var ev = new TabletopRequestTakeOut(); var ev = new TabletopRequestTakeOut
ev.Entity = _draggedEntity.Value; {
ev.TableUid = _table.Value; Entity = GetNetEntity(_draggedEntity.Value),
TableUid = GetNetEntity(_table.Value)
};
RaiseNetworkEvent(ev); RaiseNetworkEvent(ev);
} }
return false; return false;
@@ -196,8 +198,10 @@ namespace Content.Client.Tabletop
if (_playerManager.LocalPlayer is not {ControlledEntity: { } playerEntity}) if (_playerManager.LocalPlayer is not {ControlledEntity: { } playerEntity})
return false; return false;
var entity = args.EntityUid;
// Return if can not see table or stunned/no hands // Return if can not see table or stunned/no hands
if (!CanSeeTable(playerEntity, _table) || !CanDrag(playerEntity, args.EntityUid, out _)) if (!CanSeeTable(playerEntity, _table) || !CanDrag(playerEntity, entity, out _))
{ {
return false; return false;
} }
@@ -208,7 +212,7 @@ namespace Content.Client.Tabletop
return false; return false;
} }
StartDragging(args.EntityUid, viewport); StartDragging(entity, viewport);
return true; return true;
} }
@@ -247,7 +251,7 @@ namespace Content.Client.Tabletop
/// <param name="viewport">The viewport in which we are dragging.</param> /// <param name="viewport">The viewport in which we are dragging.</param>
private void StartDragging(EntityUid draggedEntity, ScalingViewport viewport) private void StartDragging(EntityUid draggedEntity, ScalingViewport viewport)
{ {
RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(draggedEntity, true)); RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(GetNetEntity(draggedEntity), true));
_draggedEntity = draggedEntity; _draggedEntity = draggedEntity;
_viewport = viewport; _viewport = viewport;
@@ -262,8 +266,8 @@ namespace Content.Client.Tabletop
// Set the dragging player on the component to noone // Set the dragging player on the component to noone
if (broadcast && _draggedEntity != null && EntityManager.HasComponent<TabletopDraggableComponent>(_draggedEntity.Value)) if (broadcast && _draggedEntity != null && EntityManager.HasComponent<TabletopDraggableComponent>(_draggedEntity.Value))
{ {
RaisePredictiveEvent(new TabletopMoveEvent(_draggedEntity.Value, Transform(_draggedEntity.Value).MapPosition, _table!.Value)); RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transform(_draggedEntity.Value).MapPosition, GetNetEntity(_table!.Value)));
RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(_draggedEntity.Value, false)); RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(GetNetEntity(_draggedEntity.Value), false));
} }
_draggedEntity = null; _draggedEntity = null;

View File

@@ -240,7 +240,7 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
_actionsSystem.PerformAction(user, actionComp, actionId, action, action.Event, _timing.CurTime); _actionsSystem.PerformAction(user, actionComp, actionId, action, action.Event, _timing.CurTime);
} }
else else
EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(actionId, coords)); EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(EntityManager.GetNetEntity(actionId), EntityManager.GetNetCoordinates(coords)));
if (!action.Repeat) if (!action.Repeat)
StopTargeting(); StopTargeting();
@@ -253,7 +253,9 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
if (_actionsSystem == null) if (_actionsSystem == null)
return false; return false;
if (!_actionsSystem.ValidateEntityTarget(user, args.EntityUid, action)) var entity = args.EntityUid;
if (!_actionsSystem.ValidateEntityTarget(user, entity, action))
{ {
if (action.DeselectOnMiss) if (action.DeselectOnMiss)
StopTargeting(); StopTargeting();
@@ -265,14 +267,14 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
{ {
if (action.Event != null) if (action.Event != null)
{ {
action.Event.Target = args.EntityUid; action.Event.Target = entity;
action.Event.Performer = user; action.Event.Performer = user;
} }
_actionsSystem.PerformAction(user, actionComp, actionId, action, action.Event, _timing.CurTime); _actionsSystem.PerformAction(user, actionComp, actionId, action, action.Event, _timing.CurTime);
} }
else else
EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(actionId, args.EntityUid)); EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(EntityManager.GetNetEntity(actionId), EntityManager.GetNetEntity(args.EntityUid)));
if (!action.Repeat) if (!action.Repeat)
StopTargeting(); StopTargeting();
@@ -741,9 +743,11 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
{ {
if (_actionsSystem != null && _actionsSystem.TryGetActionData(_menuDragHelper.Dragged?.ActionId, out var action)) if (_actionsSystem != null && _actionsSystem.TryGetActionData(_menuDragHelper.Dragged?.ActionId, out var action))
{ {
if (action.EntityIcon != null) var entIcon = action.EntityIcon;
if (entIcon != null)
{ {
_dragShadow.Texture = EntityManager.GetComponent<SpriteComponent>(action.EntityIcon.Value).Icon? _dragShadow.Texture = EntityManager.GetComponent<SpriteComponent>(entIcon.Value).Icon?
.GetFrame(RSI.State.Direction.South, 0); .GetFrame(RSI.State.Direction.South, 0);
} }
else if (action.Icon != null) else if (action.Icon != null)
@@ -958,11 +962,13 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
SelectingTargetFor = actionId; SelectingTargetFor = actionId;
// override "held-item" overlay // override "held-item" overlay
var provider = action.Provider;
if (action.TargetingIndicator && _overlays.TryGetOverlay<ShowHandItemOverlay>(out var handOverlay)) if (action.TargetingIndicator && _overlays.TryGetOverlay<ShowHandItemOverlay>(out var handOverlay))
{ {
if (action.ItemIconStyle == ItemActionIconStyle.BigItem && action.Provider != null) if (action.ItemIconStyle == ItemActionIconStyle.BigItem && action.Provider != null)
{ {
handOverlay.EntityOverride = action.Provider; handOverlay.EntityOverride = provider;
} }
else if (action.Toggled && action.IconOn != null) else if (action.Toggled && action.IconOn != null)
handOverlay.IconOverride = _spriteSystem.Frame0(action.IconOn); handOverlay.IconOverride = _spriteSystem.Frame0(action.IconOn);
@@ -979,9 +985,10 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
return; return;
Func<EntityUid, bool>? predicate = null; Func<EntityUid, bool>? predicate = null;
var attachedEnt = entityAction.AttachedEntity;
if (!entityAction.CanTargetSelf) if (!entityAction.CanTargetSelf)
predicate = e => e != entityAction.AttachedEntity; predicate = e => e != attachedEnt;
var range = entityAction.CheckCanAccess ? action.Range : -1; var range = entityAction.CheckCanAccess ? action.Range : -1;

View File

@@ -41,7 +41,6 @@ public sealed class ChatUIController : UIController
[Dependency] private readonly IClientAdminManager _admin = default!; [Dependency] private readonly IClientAdminManager _admin = default!;
[Dependency] private readonly IChatManager _manager = default!; [Dependency] private readonly IChatManager _manager = default!;
[Dependency] private readonly IConfigurationManager _config = default!; [Dependency] private readonly IConfigurationManager _config = default!;
[Dependency] private readonly IEntityManager _entities = default!;
[Dependency] private readonly IEyeManager _eye = default!; [Dependency] private readonly IEyeManager _eye = default!;
[Dependency] private readonly IInputManager _input = default!; [Dependency] private readonly IInputManager _input = default!;
[Dependency] private readonly IClientNetManager _net = default!; [Dependency] private readonly IClientNetManager _net = default!;
@@ -390,7 +389,9 @@ public sealed class ChatUIController : UIController
private void AddSpeechBubble(ChatMessage msg, SpeechBubble.SpeechType speechType) private void AddSpeechBubble(ChatMessage msg, SpeechBubble.SpeechType speechType)
{ {
if (!_entities.EntityExists(msg.SenderEntity)) var ent = EntityManager.GetEntity(msg.SenderEntity);
if (!EntityManager.EntityExists(ent))
{ {
_sawmill.Debug("Got local chat message with invalid sender entity: {0}", msg.SenderEntity); _sawmill.Debug("Got local chat message with invalid sender entity: {0}", msg.SenderEntity);
return; return;
@@ -401,14 +402,14 @@ public sealed class ChatUIController : UIController
foreach (var message in messages) foreach (var message in messages)
{ {
EnqueueSpeechBubble(msg.SenderEntity, message, speechType); EnqueueSpeechBubble(ent, message, speechType);
} }
} }
private void CreateSpeechBubble(EntityUid entity, SpeechBubbleData speechData) private void CreateSpeechBubble(EntityUid entity, SpeechBubbleData speechData)
{ {
var bubble = var bubble =
SpeechBubble.CreateSpeechBubble(speechData.Type, speechData.Message, entity, _eye, _manager, _entities); SpeechBubble.CreateSpeechBubble(speechData.Type, speechData.Message, entity, _eye, _manager, EntityManager);
bubble.OnDied += SpeechBubbleDied; bubble.OnDied += SpeechBubbleDied;
@@ -445,7 +446,7 @@ public sealed class ChatUIController : UIController
private void EnqueueSpeechBubble(EntityUid entity, string contents, SpeechBubble.SpeechType speechType) private void EnqueueSpeechBubble(EntityUid entity, string contents, SpeechBubble.SpeechType speechType)
{ {
// Don't enqueue speech bubbles for other maps. TODO: Support multiple viewports/maps? // Don't enqueue speech bubbles for other maps. TODO: Support multiple viewports/maps?
if (_entities.GetComponent<TransformComponent>(entity).MapID != _eye.CurrentMap) if (EntityManager.GetComponent<TransformComponent>(entity).MapID != _eye.CurrentMap)
return; return;
if (!_queuedSpeechBubbles.TryGetValue(entity, out var queueData)) if (!_queuedSpeechBubbles.TryGetValue(entity, out var queueData))
@@ -562,7 +563,7 @@ public sealed class ChatUIController : UIController
foreach (var (entity, queueData) in _queuedSpeechBubbles.ShallowClone()) foreach (var (entity, queueData) in _queuedSpeechBubbles.ShallowClone())
{ {
if (!_entities.EntityExists(entity)) if (!EntityManager.EntityExists(entity))
{ {
_queuedSpeechBubbles.Remove(entity); _queuedSpeechBubbles.Remove(entity);
continue; continue;
@@ -593,14 +594,14 @@ public sealed class ChatUIController : UIController
var predicate = static (EntityUid uid, (EntityUid compOwner, EntityUid? attachedEntity) data) var predicate = static (EntityUid uid, (EntityUid compOwner, EntityUid? attachedEntity) data)
=> uid == data.compOwner || uid == data.attachedEntity; => uid == data.compOwner || uid == data.attachedEntity;
var playerPos = player != null var playerPos = player != null
? _entities.GetComponent<TransformComponent>(player.Value).MapPosition ? EntityManager.GetComponent<TransformComponent>(player.Value).MapPosition
: MapCoordinates.Nullspace; : MapCoordinates.Nullspace;
var occluded = player != null && _examine.IsOccluded(player.Value); var occluded = player != null && _examine.IsOccluded(player.Value);
foreach (var (ent, bubs) in _activeSpeechBubbles) foreach (var (ent, bubs) in _activeSpeechBubbles)
{ {
if (_entities.Deleted(ent)) if (EntityManager.Deleted(ent))
{ {
SetBubbles(bubs, false); SetBubbles(bubs, false);
continue; continue;
@@ -612,7 +613,7 @@ public sealed class ChatUIController : UIController
continue; continue;
} }
var otherPos = _entities.GetComponent<TransformComponent>(ent).MapPosition; var otherPos = EntityManager.GetComponent<TransformComponent>(ent).MapPosition;
if (occluded && !ExamineSystemShared.InRangeUnOccluded( if (occluded && !ExamineSystemShared.InRangeUnOccluded(
playerPos, playerPos,

View File

@@ -20,7 +20,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
} }
public void UpdateWarps(IEnumerable<GhostWarp> warps) public void UpdateWarps(IEnumerable<GhostWarp> warps, IEntityManager entManager)
{ {
// Server COULD send these sorted but how about we just use the client to do it instead // Server COULD send these sorted but how about we just use the client to do it instead
_warps = warps _warps = warps
@@ -33,7 +33,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls
? Loc.GetString("ghost-target-window-current-button", ("name", w.DisplayName)) ? Loc.GetString("ghost-target-window-current-button", ("name", w.DisplayName))
: w.DisplayName; : w.DisplayName;
return (name, w.Entity); return (name, entManager.GetEntity(w.Entity));
}) })
.ToList(); .ToList();
} }

View File

@@ -11,6 +11,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
[UsedImplicitly] [UsedImplicitly]
public sealed class MakeGhostRoleEui : BaseEui public sealed class MakeGhostRoleEui : BaseEui
{ {
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IClientConsoleHost _consoleHost = default!; [Dependency] private readonly IClientConsoleHost _consoleHost = default!;
@@ -32,7 +33,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
return; return;
} }
_window.SetEntity(uiState.EntityUid); _window.SetEntity(_entManager.GetEntity(uiState.EntityUid));
} }
public override void Opened() public override void Opened()

View File

@@ -96,7 +96,7 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
if (Gui?.TargetWindow is not { } window) if (Gui?.TargetWindow is not { } window)
return; return;
window.UpdateWarps(msg.Warps); window.UpdateWarps(msg.Warps, EntityManager);
window.Populate(); window.Populate();
} }
@@ -107,7 +107,7 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
private void OnWarpClicked(EntityUid player) private void OnWarpClicked(EntityUid player)
{ {
var msg = new GhostWarpToTargetRequestEvent(player); var msg = new GhostWarpToTargetRequestEvent(EntityManager.GetNetEntity(player));
_net.SendSystemNetworkMessage(msg); _net.SendSystemNetworkMessage(msg);
} }

Some files were not shown because too many files have changed in this diff Show More