Content update for NetEntities (#18935)
This commit is contained in:
@@ -67,12 +67,12 @@ namespace Content.Client.Actions
|
||||
return;
|
||||
|
||||
component.Actions.Clear();
|
||||
component.Actions.UnionWith(state.Actions);
|
||||
component.Actions.UnionWith(GetEntitySet(state.Actions));
|
||||
|
||||
_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
|
||||
// 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))
|
||||
return;
|
||||
@@ -195,7 +195,7 @@ namespace Content.Client.Actions
|
||||
}
|
||||
else
|
||||
{
|
||||
var request = new RequestPerformActionEvent(actionId);
|
||||
var request = new RequestPerformActionEvent(GetNetEntity(actionId));
|
||||
EntityManager.RaisePredictiveEvent(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,20 +35,21 @@ namespace Content.Client.Administration
|
||||
|
||||
foreach (var playerInfo in _system.PlayerList)
|
||||
{
|
||||
var entity = _entityManager.GetEntity(playerInfo.NetEntity);
|
||||
|
||||
// Otherwise the entity can not exist yet
|
||||
if (!_entityManager.EntityExists(playerInfo.EntityUid))
|
||||
if (entity == null || !_entityManager.EntityExists(entity))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var entity = playerInfo.EntityUid.Value;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
var aabb = _entityLookup.GetWorldAABB(entity);
|
||||
var aabb = _entityLookup.GetWorldAABB(entity.Value);
|
||||
|
||||
// if not on screen, continue
|
||||
if (!aabb.Intersects(in viewport))
|
||||
|
||||
@@ -24,12 +24,14 @@ namespace Content.Client.Administration.Systems
|
||||
// View variables verbs
|
||||
if (_clientConGroupController.CanViewVar())
|
||||
{
|
||||
Verb verb = new();
|
||||
verb.Category = VerbCategory.Debug;
|
||||
verb.Text = "View Variables";
|
||||
verb.Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/vv.svg.192dpi.png"));
|
||||
verb.Act = () => _clientConsoleHost.ExecuteCommand($"vv {args.Target}");
|
||||
verb.ClientExclusive = true; // opening VV window is client-side. Don't ask server to run this verb.
|
||||
Verb verb = new()
|
||||
{
|
||||
Category = VerbCategory.Debug,
|
||||
Text = "View Variables",
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/vv.svg.192dpi.png")),
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace Content.Client.Administration.UI.CustomControls
|
||||
public sealed partial class PlayerListControl : BoxContainer
|
||||
{
|
||||
private readonly AdminSystem _adminSystem;
|
||||
private readonly VerbSystem _verbSystem;
|
||||
|
||||
private List<PlayerInfo> _playerList = new();
|
||||
private readonly List<PlayerInfo> _sortedPlayerList = new();
|
||||
@@ -29,11 +28,14 @@ namespace Content.Client.Administration.UI.CustomControls
|
||||
public Func<PlayerInfo, string, string>? OverrideText;
|
||||
public Comparison<PlayerInfo>? Comparison;
|
||||
|
||||
private IEntityManager _entManager;
|
||||
private IUserInterfaceManager _uiManager;
|
||||
|
||||
public PlayerListControl()
|
||||
{
|
||||
_adminSystem = EntitySystem.Get<AdminSystem>();
|
||||
_verbSystem = EntitySystem.Get<VerbSystem>();
|
||||
IoCManager.InjectDependencies(this);
|
||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||
_uiManager = IoCManager.Resolve<IUserInterfaceManager>();
|
||||
_adminSystem = _entManager.System<AdminSystem>();
|
||||
RobustXamlLoader.Load(this);
|
||||
// Fill the Option data
|
||||
PlayerListContainer.ItemPressed += PlayerListItemPressed;
|
||||
@@ -56,9 +58,9 @@ namespace Content.Client.Administration.UI.CustomControls
|
||||
if (OverrideText != null && args.Button.Children.FirstOrDefault()?.Children?.FirstOrDefault() is Label label)
|
||||
label.Text = GetText(selectedPlayer);
|
||||
}
|
||||
else if (args.Event.Function == EngineKeyFunctions.UseSecondary && selectedPlayer.EntityUid != null)
|
||||
else if (args.Event.Function == EngineKeyFunctions.UseSecondary && selectedPlayer.NetEntity != null)
|
||||
{
|
||||
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<VerbMenuUIController>().OpenVerbMenu(selectedPlayer.EntityUid.Value);
|
||||
_uiManager.GetUIController<VerbMenuUIController>().OpenVerbMenu(_entManager.GetEntity(selectedPlayer.NetEntity.Value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,11 @@ namespace Content.Client.Administration.UI.ManageSolutions
|
||||
public sealed class EditSolutionsEui : BaseEui
|
||||
{
|
||||
private readonly EditSolutionsWindow _window;
|
||||
private IEntityManager _entManager;
|
||||
|
||||
public EditSolutionsEui()
|
||||
{
|
||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||
_window = new EditSolutionsWindow();
|
||||
_window.OnClose += () => SendMessage(new CloseEuiMessage());
|
||||
}
|
||||
@@ -34,7 +36,7 @@ namespace Content.Client.Administration.UI.ManageSolutions
|
||||
public override void HandleState(EuiStateBase baseState)
|
||||
{
|
||||
var state = (EditSolutionsEuiState) baseState;
|
||||
_window.SetTargetEntity(state.Target);
|
||||
_window.SetTargetEntity(_entManager.GetEntity(state.Target));
|
||||
_window.UpdateSolutions(state.Solutions);
|
||||
_window.UpdateReagents();
|
||||
}
|
||||
|
||||
@@ -9,8 +9,11 @@ namespace Content.Client.Administration.UI.SetOutfit
|
||||
public sealed class SetOutfitEui : BaseEui
|
||||
{
|
||||
private readonly SetOutfitMenu _window;
|
||||
private IEntityManager _entManager;
|
||||
|
||||
public SetOutfitEui()
|
||||
{
|
||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||
_window = new SetOutfitMenu();
|
||||
_window.OnClose += OnClosed;
|
||||
}
|
||||
@@ -34,7 +37,7 @@ namespace Content.Client.Administration.UI.SetOutfit
|
||||
public override void HandleState(EuiStateBase state)
|
||||
{
|
||||
var outfitState = (SetOutfitEuiState) state;
|
||||
_window.TargetEntityId = outfitState.TargetEntityId;
|
||||
_window.TargetEntityId = _entManager.GetEntity(outfitState.TargetNetEntity);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Content.Client.Administration.UI.SpawnExplosion;
|
||||
[UsedImplicitly]
|
||||
public sealed class SpawnExplosionEui : BaseEui
|
||||
{
|
||||
[Dependency] private readonly EntityManager _entManager = default!;
|
||||
[Dependency] private readonly IOverlayManager _overlayManager = default!;
|
||||
|
||||
private readonly SpawnExplosionWindow _window;
|
||||
@@ -69,7 +70,14 @@ public sealed class SpawnExplosionEui : BaseEui
|
||||
_overlayManager.AddOverlay(_debugOverlay);
|
||||
}
|
||||
|
||||
_debugOverlay.Tiles = data.Explosion.Tiles;
|
||||
var tiles = new Dictionary<EntityUid, Dictionary<int, List<Vector2i>>>();
|
||||
_debugOverlay.Tiles.Clear();
|
||||
|
||||
foreach (var (nent, det) in data.Explosion.Tiles)
|
||||
{
|
||||
tiles[_entManager.GetEntity(nent)] = det;
|
||||
}
|
||||
|
||||
_debugOverlay.SpaceTiles = data.Explosion.SpaceTiles;
|
||||
_debugOverlay.Intensity = data.Explosion.Intensity;
|
||||
_debugOverlay.Slope = data.Slope;
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
||||
private void OnTeleportButtonPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||
$"tp {XCoordinate.Value} {YCoordinate.Value} {MapOptions.SelectedId}");
|
||||
$"tp {XCoordinate.Value} {YCoordinate.Value} {new NetEntity(MapOptions.SelectedId)}");
|
||||
}
|
||||
|
||||
private void OnSubmitButtonPressed(BaseButton.ButtonEventArgs obj)
|
||||
@@ -112,7 +112,7 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
||||
if (MapPath.Text.Length == 0) return;
|
||||
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand(
|
||||
$"loadbp {MapOptions.SelectedId} \"{MapPath.Text}\" {XCoordinate.Value} {YCoordinate.Value} {RotationSpin.Value}");
|
||||
$"loadbp {new NetEntity(MapOptions.SelectedId)} \"{MapPath.Text}\" {XCoordinate.Value} {YCoordinate.Value} {RotationSpin.Value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,9 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
if (_data == null)
|
||||
return;
|
||||
var dataList = _data.ToList();
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
var selectedGrid = dataList[GridOptions.SelectedId].Owner;
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {selectedGrid}");
|
||||
IoCManager.Resolve<IClientConsoleHost>().ExecuteCommand($"addatmos {entManager.GetNetEntity(selectedGrid)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
||||
|
||||
var selectedGrid = _data[GridOptions.SelectedId];
|
||||
IoCManager.Resolve<IClientConsoleHost>()
|
||||
.ExecuteCommand($"settemp {TileXSpin.Value} {TileYSpin.Value} {selectedGrid} {TemperatureSpin.Value}");
|
||||
.ExecuteCommand($"settemp {TileXSpin.Value} {TileYSpin.Value} {IoCManager.Resolve<IEntityManager>().GetNetEntity(selectedGrid)} {TemperatureSpin.Value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
|
||||
private const string ArrowDown = "↓";
|
||||
private readonly Color _altColor = Color.FromHex("#292B38");
|
||||
private readonly Color _defaultColor = Color.FromHex("#2F2F3B");
|
||||
private IEntityManager _entManager;
|
||||
private readonly AdminSystem _adminSystem;
|
||||
private IReadOnlyList<PlayerInfo> _players = new List<PlayerInfo>();
|
||||
|
||||
@@ -29,7 +30,8 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
|
||||
|
||||
public PlayerTab()
|
||||
{
|
||||
_adminSystem = EntitySystem.Get<AdminSystem>();
|
||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||
_adminSystem = _entManager.System<AdminSystem>();
|
||||
RobustXamlLoader.Load(this);
|
||||
RefreshPlayerList(_adminSystem.PlayerList);
|
||||
|
||||
@@ -119,7 +121,7 @@ namespace Content.Client.Administration.UI.Tabs.PlayerTab
|
||||
player.Antag ? "YES" : "NO",
|
||||
new StyleBoxFlat(useAltColor ? _altColor : _defaultColor),
|
||||
player.Connected);
|
||||
entry.PlayerUid = player.EntityUid;
|
||||
entry.PlayerUid = _entManager.GetEntity(player.NetEntity);
|
||||
entry.OnPressed += args => OnEntryPressed?.Invoke(args);
|
||||
PlayerList.AddChild(entry);
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Content.Client.Atmos.EntitySystems
|
||||
|
||||
private void HandleAtmosDebugOverlayMessage(AtmosDebugOverlayMessage message)
|
||||
{
|
||||
_tileData[message.GridId] = message;
|
||||
_tileData[GetEntity(message.GridId)] = message;
|
||||
}
|
||||
|
||||
private void HandleAtmosDebugOverlayDisableMessage(AtmosDebugOverlayDisableMessage ev)
|
||||
|
||||
@@ -65,8 +65,10 @@ namespace Content.Client.Atmos.EntitySystems
|
||||
|
||||
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))
|
||||
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))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Content.Client.Atmos.UI
|
||||
_ => GridIcon.OverrideDirection
|
||||
};
|
||||
|
||||
GridIcon.SetEntity(msg.DeviceUid);
|
||||
GridIcon.SetEntity(IoCManager.Resolve<IEntityManager>().GetEntity(msg.DeviceUid));
|
||||
LeftPanel.RemoveAllChildren();
|
||||
MiddlePanel.RemoveAllChildren();
|
||||
RightPanel.RemoveAllChildren();
|
||||
|
||||
@@ -17,7 +17,9 @@ public sealed class BeamSystem : SharedBeamSystem
|
||||
//TODO: Sometime in the future this needs to be replaced with tiled sprites
|
||||
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;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ internal sealed partial class ToolshedVisualizeWindow : DefaultWindow
|
||||
|
||||
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));
|
||||
ItemList.RemoveAllChildren();
|
||||
|
||||
@@ -25,8 +25,8 @@ internal sealed class BuckleSystem : SharedBuckleSystem
|
||||
return;
|
||||
|
||||
component.Buckled = state.Buckled;
|
||||
component.BuckledTo = state.BuckledTo;
|
||||
component.LastEntityBuckledTo = state.LastEntityBuckledTo;
|
||||
component.BuckledTo = EnsureEntity<BuckleComponent>(state.BuckledTo, uid);
|
||||
component.LastEntityBuckledTo = EnsureEntity<BuckleComponent>(state.LastEntityBuckledTo, uid);
|
||||
component.DontCollide = state.DontCollide;
|
||||
|
||||
ActionBlockerSystem.UpdateCanMove(uid);
|
||||
|
||||
@@ -13,7 +13,7 @@ public sealed class CameraRecoilSystem : SharedCameraRecoilSystem
|
||||
|
||||
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)
|
||||
|
||||
@@ -19,12 +19,14 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
||||
|
||||
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;
|
||||
|
||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||
|
||||
if (!xformQuery.TryGetComponent(msg.Source, out var xform))
|
||||
if (!xformQuery.TryGetComponent(source, out var xform))
|
||||
return;
|
||||
|
||||
var sourcePos = xform.MapPosition;
|
||||
@@ -32,12 +34,13 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
||||
//Any mob that can move should be surprised?
|
||||
//God mind rework needs to come faster so it can just check for mind
|
||||
//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
|
||||
foreach (var moverComp in _entityLookup.GetComponentsInRange<MobMoverComponent>(xform.Coordinates, box.Distance))
|
||||
{
|
||||
if (moverComp.Owner == msg.Mover)
|
||||
if (moverComp.Owner == mover)
|
||||
continue;
|
||||
|
||||
mobMoverEntities.Add(moverComp.Owner);
|
||||
@@ -57,5 +60,6 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
||||
sprite.Offset = new Vector2(0, 1);
|
||||
entTransform.AttachParent(mob);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,11 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
|
||||
[ViewVariables]
|
||||
private Control? _activeUiFragment;
|
||||
|
||||
private IEntityManager _entManager;
|
||||
|
||||
protected CartridgeLoaderBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||
}
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
@@ -31,13 +34,16 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
|
||||
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);
|
||||
|
||||
_activeProgram = loaderUiState.ActiveUI;
|
||||
var activeUI = _entManager.GetEntity(loaderUiState.ActiveUI);
|
||||
|
||||
var ui = RetrieveCartridgeUI(loaderUiState.ActiveUI);
|
||||
var comp = RetrieveCartridgeComponent(loaderUiState.ActiveUI);
|
||||
_activeProgram = activeUI;
|
||||
|
||||
var ui = RetrieveCartridgeUI(activeUI);
|
||||
var comp = RetrieveCartridgeComponent(activeUI);
|
||||
var control = ui?.GetUIFragmentRoot();
|
||||
|
||||
//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)
|
||||
{
|
||||
var message = new CartridgeLoaderUiMessage(cartridgeUid, CartridgeUiMessageAction.Activate);
|
||||
var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(cartridgeUid), CartridgeUiMessageAction.Activate);
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
@@ -69,19 +75,19 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
|
||||
if (!_activeProgram.HasValue)
|
||||
return;
|
||||
|
||||
var message = new CartridgeLoaderUiMessage(_activeProgram.Value, CartridgeUiMessageAction.Deactivate);
|
||||
var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(_activeProgram.Value), CartridgeUiMessageAction.Deactivate);
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
protected void InstallCartridge(EntityUid cartridgeUid)
|
||||
{
|
||||
var message = new CartridgeLoaderUiMessage(cartridgeUid, CartridgeUiMessageAction.Install);
|
||||
var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(cartridgeUid), CartridgeUiMessageAction.Install);
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
protected void UninstallCartridge(EntityUid cartridgeUid)
|
||||
{
|
||||
var message = new CartridgeLoaderUiMessage(cartridgeUid, CartridgeUiMessageAction.Uninstall);
|
||||
var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(cartridgeUid), CartridgeUiMessageAction.Uninstall);
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
@@ -126,7 +132,7 @@ public abstract class CartridgeLoaderBoundUserInterface : BoundUserInterface
|
||||
|
||||
private void SendCartridgeUiReadyEvent(EntityUid cartridgeUid)
|
||||
{
|
||||
var message = new CartridgeLoaderUiMessage(cartridgeUid, CartridgeUiMessageAction.UIReady);
|
||||
var message = new CartridgeLoaderUiMessage(_entManager.GetNetEntity(cartridgeUid), CartridgeUiMessageAction.UIReady);
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public sealed class CharacterInfoSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
RaiseNetworkEvent(new RequestCharacterInfoEvent(entity.Value));
|
||||
RaiseNetworkEvent(new RequestCharacterInfoEvent(GetNetEntity(entity.Value)));
|
||||
}
|
||||
|
||||
private void OnPlayerAttached(PlayerAttachSysMessage msg)
|
||||
@@ -43,7 +43,9 @@ public sealed class CharacterInfoSystem : EntitySystem
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -169,10 +169,12 @@ public sealed class ClientClothingSystem : ClothingSystem
|
||||
|
||||
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;
|
||||
|
||||
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)
|
||||
|
||||
@@ -8,6 +8,5 @@ namespace Content.Client.Construction
|
||||
public sealed partial class ConstructionGhostComponent : Component
|
||||
{
|
||||
[ViewVariables] public ConstructionPrototype? Prototype { get; set; }
|
||||
[ViewVariables] public int GhostId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Shared.Construction;
|
||||
using System.Linq;
|
||||
using Content.Shared.Construction.Prototypes;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Placement;
|
||||
using Robust.Client.Utility;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Client.Construction
|
||||
@@ -39,9 +34,9 @@ namespace Content.Client.Construction
|
||||
/// <inheritdoc />
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -27,11 +27,9 @@ namespace Content.Client.Construction
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = 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 int _nextId;
|
||||
|
||||
public bool CraftingEnabled { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -39,6 +37,7 @@ namespace Content.Client.Construction
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
UpdatesOutsidePrediction = true;
|
||||
SubscribeLocalEvent<PlayerAttachSysMessage>(HandlePlayerAttached);
|
||||
SubscribeNetworkEvent<AckStructureConstructionMessage>(HandleAckStructure);
|
||||
SubscribeNetworkEvent<ResponseConstructionGuide>(OnConstructionGuideReceived);
|
||||
@@ -107,6 +106,7 @@ namespace Content.Client.Construction
|
||||
|
||||
private void HandleAckStructure(AckStructureConstructionMessage msg)
|
||||
{
|
||||
// We get sent a NetEntity but it actually corresponds to our local Entity.
|
||||
ClearGhost(msg.GhostId);
|
||||
}
|
||||
|
||||
@@ -150,13 +150,13 @@ namespace Content.Client.Construction
|
||||
|
||||
private bool HandleUse(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||
{
|
||||
if (!args.EntityUid.IsValid() || !args.EntityUid.IsClientSide())
|
||||
if (!args.EntityUid.IsValid() || !IsClientSide(args.EntityUid))
|
||||
return false;
|
||||
|
||||
if (!EntityManager.TryGetComponent<ConstructionGhostComponent?>(args.EntityUid, out var ghostComp))
|
||||
if (!HasComp<ConstructionGhostComponent>(args.EntityUid))
|
||||
return false;
|
||||
|
||||
TryStartConstruction(ghostComp.GhostId);
|
||||
TryStartConstruction(args.EntityUid);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -196,9 +196,8 @@ namespace Content.Client.Construction
|
||||
ghost = EntityManager.SpawnEntity("constructionghost", loc);
|
||||
var comp = EntityManager.GetComponent<ConstructionGhostComponent>(ghost.Value);
|
||||
comp.Prototype = prototype;
|
||||
comp.GhostId = _nextId++;
|
||||
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);
|
||||
sprite.Color = new Color(48, 255, 48, 128);
|
||||
|
||||
@@ -247,23 +246,25 @@ namespace Content.Client.Construction
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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}");
|
||||
}
|
||||
|
||||
var transform = EntityManager.GetComponent<TransformComponent>(ghost.Owner);
|
||||
var msg = new TryStartStructureConstructionMessage(transform.Coordinates, ghost.Prototype.ID, transform.LocalRotation, ghostId);
|
||||
var transform = EntityManager.GetComponent<TransformComponent>(ghostId);
|
||||
var msg = new TryStartStructureConstructionMessage(GetNetCoordinates(transform.Coordinates), ghostComp.Prototype.ID, transform.LocalRotation, ghostId.Id);
|
||||
RaiseNetworkEvent(msg);
|
||||
}
|
||||
|
||||
@@ -280,11 +281,11 @@ namespace Content.Client.Construction
|
||||
/// </summary>
|
||||
public void ClearGhost(int ghostId)
|
||||
{
|
||||
if (_ghosts.TryGetValue(ghostId, out var ghost))
|
||||
{
|
||||
EntityManager.QueueDeleteEntity(ghost.Owner);
|
||||
_ghosts.Remove(ghostId);
|
||||
}
|
||||
if (!_ghosts.TryGetValue(ghostId, out var ghost))
|
||||
return;
|
||||
|
||||
EntityManager.QueueDeleteEntity(ghost);
|
||||
_ghosts.Remove(ghostId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -292,9 +293,9 @@ namespace Content.Client.Construction
|
||||
/// </summary>
|
||||
public void ClearAllGhosts()
|
||||
{
|
||||
foreach (var (_, ghost) in _ghosts)
|
||||
foreach (var ghost in _ghosts.Values)
|
||||
{
|
||||
EntityManager.QueueDeleteEntity(ghost.Owner);
|
||||
EntityManager.QueueDeleteEntity(ghost);
|
||||
}
|
||||
|
||||
_ghosts.Clear();
|
||||
|
||||
@@ -49,7 +49,8 @@ namespace Content.Client.ContextMenu.UI
|
||||
|
||||
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>
|
||||
@@ -77,12 +78,12 @@ namespace Content.Client.ContextMenu.UI
|
||||
var representation = _entityManager.ToPrettyString(entity);
|
||||
|
||||
var name = representation.Name;
|
||||
var id = representation.Uid;
|
||||
var id = representation.Uid.ToString();
|
||||
var prototype = representation.Prototype;
|
||||
var playerName = representation.Session?.Name ?? SearchPlayerName(entity);
|
||||
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)
|
||||
|
||||
@@ -133,8 +133,16 @@ namespace Content.Client.ContextMenu.UI
|
||||
var func = args.Function;
|
||||
var funcId = _inputManager.NetworkBindMap.KeyFunctionID(func);
|
||||
|
||||
var message = new FullInputCmdMessage(_gameTiming.CurTick, _gameTiming.TickFraction, funcId,
|
||||
BoundKeyState.Down, _entityManager.GetComponent<TransformComponent>(entity.Value).Coordinates, args.PointerLocation, entity.Value);
|
||||
var message = new ClientFullInputCmdMessage(
|
||||
_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;
|
||||
if (session != null)
|
||||
|
||||
@@ -30,10 +30,10 @@ public sealed class CrewManifestSystem : EntitySystem
|
||||
/// <summary>
|
||||
/// Requests a crew manifest from the server.
|
||||
/// </summary>
|
||||
/// <param name="uid">EntityUid of the entity we're requesting the crew manifest from.</param>
|
||||
public void RequestCrewManifest(EntityUid uid)
|
||||
/// <param name="netEntity">EntityUid of the entity we're requesting the crew manifest from.</param>
|
||||
public void RequestCrewManifest(NetEntity netEntity)
|
||||
{
|
||||
RaiseNetworkEvent(new RequestCrewManifestMessage(uid));
|
||||
RaiseNetworkEvent(new RequestCrewManifestMessage(netEntity));
|
||||
}
|
||||
|
||||
private void OnPrototypesReload(PrototypesReloadedEventArgs _)
|
||||
|
||||
@@ -70,7 +70,7 @@ public sealed class DecalPlacementSystem : EntitySystem
|
||||
return false;
|
||||
|
||||
var decal = new Decal(coords.Position, _decalId, _decalColor, _decalAngle, _zIndex, _cleanable);
|
||||
RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, coords));
|
||||
RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, GetNetCoordinates(coords)));
|
||||
|
||||
return true;
|
||||
},
|
||||
@@ -90,7 +90,7 @@ public sealed class DecalPlacementSystem : EntitySystem
|
||||
|
||||
_erasing = true;
|
||||
|
||||
RaiseNetworkEvent(new RequestDecalRemovalEvent(coords));
|
||||
RaiseNetworkEvent(new RequestDecalRemovalEvent(GetNetCoordinates(coords)));
|
||||
|
||||
return true;
|
||||
}, (session, coords, uid) =>
|
||||
@@ -128,7 +128,7 @@ public sealed class DecalPlacementSystem : EntitySystem
|
||||
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);
|
||||
RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, args.Target));
|
||||
RaiseNetworkEvent(new RequestDecalPlacementEvent(decal, GetNetCoordinates(args.Target)));
|
||||
}
|
||||
|
||||
private void OnFillSlot(FillActionSlotEvent ev)
|
||||
|
||||
@@ -92,13 +92,16 @@ namespace Content.Client.Decals
|
||||
|
||||
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))
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
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))
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
|
||||
component.Powered = state.Powered;
|
||||
component.Engaged = state.Engaged;
|
||||
component.RecentlyEjected.Clear();
|
||||
component.RecentlyEjected.AddRange(state.RecentlyEjected);
|
||||
component.RecentlyEjected.AddRange(EnsureEntityList<DisposalUnitComponent>(state.RecentlyEjected, uid));
|
||||
}
|
||||
|
||||
public override bool HasDisposals(EntityUid? uid)
|
||||
|
||||
@@ -193,27 +193,29 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
// the mouse, canceling the drag, but just being cautious)
|
||||
EndDrag();
|
||||
|
||||
var entity = args.EntityUid;
|
||||
|
||||
// possibly initiating a drag
|
||||
// check if the clicked entity is draggable
|
||||
if (!Exists(args.EntityUid))
|
||||
if (!Exists(entity))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if the entity is reachable
|
||||
if (!_interactionSystem.InRangeUnobstructed(dragger, args.EntityUid))
|
||||
if (!_interactionSystem.InRangeUnobstructed(dragger, entity))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var ev = new CanDragEvent();
|
||||
|
||||
RaiseLocalEvent(args.EntityUid, ref ev);
|
||||
RaiseLocalEvent(entity, ref ev);
|
||||
|
||||
if (ev.Handled != true)
|
||||
return false;
|
||||
|
||||
_draggedEntity = args.EntityUid;
|
||||
_draggedEntity = entity;
|
||||
_state = DragState.MouseDown;
|
||||
_mouseDownScreenPos = _inputManager.MouseScreenPosition;
|
||||
_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
|
||||
var replayMsg = savedValue.OriginalMessage;
|
||||
|
||||
var adjustedInputMsg = new FullInputCmdMessage(args.OriginalMessage.Tick,
|
||||
args.OriginalMessage.SubTick,
|
||||
replayMsg.InputFunctionId, replayMsg.State, replayMsg.Coordinates, replayMsg.ScreenCoordinates,
|
||||
replayMsg.Uid);
|
||||
switch (replayMsg)
|
||||
{
|
||||
case ClientFullInputCmdMessage clientInput:
|
||||
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)
|
||||
{
|
||||
_inputSystem.HandleInputCommand(savedValue.Session, EngineKeyFunctions.Use, adjustedInputMsg,
|
||||
_inputSystem.HandleInputCommand(savedValue.Session, EngineKeyFunctions.Use, replayMsg,
|
||||
true);
|
||||
}
|
||||
|
||||
@@ -340,10 +360,11 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
}
|
||||
|
||||
IEnumerable<EntityUid> entities;
|
||||
var coords = args.Coordinates;
|
||||
|
||||
if (_stateManager.CurrentState is GameplayState screen)
|
||||
{
|
||||
entities = screen.GetClickableEntities(args.Coordinates);
|
||||
entities = screen.GetClickableEntities(coords);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -371,7 +392,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
||||
}
|
||||
|
||||
// tell the server about the drop attempt
|
||||
RaiseNetworkEvent(new DragDropRequestEvent(_draggedEntity.Value, entity));
|
||||
RaiseNetworkEvent(new DragDropRequestEvent(GetNetEntity(_draggedEntity.Value), GetNetEntity(entity)));
|
||||
EndDrag();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public sealed class ColorFlashEffectSystem : SharedColorFlashEffectSystem
|
||||
if (!_timing.IsFirstTimePredicted)
|
||||
return;
|
||||
|
||||
OnColorFlashEffect(new ColorFlashEffectEvent(color, entities));
|
||||
OnColorFlashEffect(new ColorFlashEffectEvent(color, GetNetEntityList(entities)));
|
||||
}
|
||||
|
||||
private void OnEffectAnimationCompleted(EntityUid uid, ColorFlashEffectComponent component, AnimationCompletedEvent args)
|
||||
@@ -77,8 +77,10 @@ public sealed class ColorFlashEffectSystem : SharedColorFlashEffectSystem
|
||||
{
|
||||
var color = ev.Color;
|
||||
|
||||
foreach (var ent in ev.Entities)
|
||||
foreach (var nent in ev.Entities)
|
||||
{
|
||||
var ent = GetEntity(nent);
|
||||
|
||||
if (Deleted(ent))
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -110,19 +110,21 @@ namespace Content.Client.Examine
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
_playerEntity = _playerManager.LocalPlayer?.ControlledEntity ?? default;
|
||||
|
||||
if (_playerEntity == default || !CanExamine(_playerEntity, args.EntityUid))
|
||||
if (_playerEntity == default || !CanExamine(_playerEntity, entity))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DoExamine(args.EntityUid);
|
||||
DoExamine(entity);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -157,8 +159,10 @@ namespace Content.Client.Examine
|
||||
// Tooltips coming in from the server generally prioritize
|
||||
// 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.
|
||||
OpenTooltip(player.Value, ev.EntityUid, ev.CenterAtCursor, ev.OpenAtOldTooltip, ev.KnowTarget);
|
||||
UpdateTooltipInfo(player.Value, ev.EntityUid, ev.Message, ev.Verbs);
|
||||
var entity = GetEntity(ev.EntityUid);
|
||||
|
||||
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)
|
||||
@@ -358,12 +362,10 @@ namespace Content.Client.Examine
|
||||
FormattedMessage message;
|
||||
|
||||
// Basically this just predicts that we can't make out the entity if we have poor vision.
|
||||
var canSeeClearly = true;
|
||||
if (HasComp<BlurryVisionComponent>(playerEnt))
|
||||
canSeeClearly = false;
|
||||
var canSeeClearly = !HasComp<BlurryVisionComponent>(playerEnt);
|
||||
|
||||
OpenTooltip(playerEnt.Value, entity, centeredOnCursor, false, knowTarget: canSeeClearly);
|
||||
if (entity.IsClientSide()
|
||||
if (IsClientSide(entity)
|
||||
|| _client.RunLevel == ClientRunLevel.SinglePlayerGame) // i.e. a replay
|
||||
{
|
||||
message = GetExamineText(entity, playerEnt);
|
||||
@@ -376,7 +378,7 @@ namespace Content.Client.Examine
|
||||
_idCounter += 1;
|
||||
if (_idCounter == int.MaxValue)
|
||||
_idCounter = 0;
|
||||
RaiseNetworkEvent(new ExamineSystemMessages.RequestExamineInfoMessage(entity, _idCounter, true));
|
||||
RaiseNetworkEvent(new ExamineSystemMessages.RequestExamineInfoMessage(GetNetEntity(entity), _idCounter, true));
|
||||
}
|
||||
|
||||
RaiseLocalEvent(entity, new ClientExaminedEvent(entity, playerEnt.Value));
|
||||
|
||||
@@ -4,6 +4,7 @@ using Robust.Client.Graphics;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.Explosion;
|
||||
|
||||
@@ -39,7 +40,13 @@ public sealed class ExplosionOverlaySystem : EntitySystem
|
||||
|
||||
component.Epicenter = state.Epicenter;
|
||||
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.ExplosionType = state.ExplosionType;
|
||||
component.SpaceMatrix = state.SpaceMatrix;
|
||||
|
||||
@@ -8,14 +8,16 @@ namespace Content.Client.Fax.AdminUI;
|
||||
[UsedImplicitly]
|
||||
public sealed class AdminFaxEui : BaseEui
|
||||
{
|
||||
private IEntityManager _entManager;
|
||||
private readonly AdminFaxWindow _window;
|
||||
|
||||
public AdminFaxEui()
|
||||
{
|
||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||
_window = new AdminFaxWindow();
|
||||
_window.OnClose += () => SendMessage(new AdminFaxEuiMsg.Close());
|
||||
_window.OnFollowFax += uid => SendMessage(new AdminFaxEuiMsg.Follow(uid));
|
||||
_window.OnMessageSend += args => SendMessage(new AdminFaxEuiMsg.Send(args.uid, args.title,
|
||||
_window.OnFollowFax += uid => SendMessage(new AdminFaxEuiMsg.Follow(_entManager.GetNetEntity(uid)));
|
||||
_window.OnMessageSend += args => SendMessage(new AdminFaxEuiMsg.Send(_entManager.GetNetEntity(args.uid), args.title,
|
||||
args.stampedBy, args.message, args.stampSprite, args.stampColor));
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public sealed class PuddleDebugOverlaySystem : SharedPuddleDebugOverlaySystem
|
||||
|
||||
private void RenderDebugData(PuddleOverlayDebugMessage message)
|
||||
{
|
||||
TileData[message.GridUid] = message;
|
||||
TileData[GetEntity(message.GridUid)] = message;
|
||||
if (_overlay != null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace Content.Client.GameTicking.Managers
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
|
||||
[ViewVariables] private bool _initialized;
|
||||
private Dictionary<EntityUid, Dictionary<string, uint?>> _jobsAvailable = new();
|
||||
private Dictionary<EntityUid, string> _stationNames = new();
|
||||
private Dictionary<NetEntity, Dictionary<string, uint?>> _jobsAvailable = new();
|
||||
private Dictionary<NetEntity, string> _stationNames = new();
|
||||
|
||||
/// <summary>
|
||||
/// 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 new bool Paused { get; private set; }
|
||||
|
||||
[ViewVariables] public IReadOnlyDictionary<EntityUid, Dictionary<string, uint?>> JobsAvailable => _jobsAvailable;
|
||||
[ViewVariables] public IReadOnlyDictionary<EntityUid, string> StationNames => _stationNames;
|
||||
[ViewVariables] public IReadOnlyDictionary<NetEntity, Dictionary<string, uint?>> JobsAvailable => _jobsAvailable;
|
||||
[ViewVariables] public IReadOnlyDictionary<NetEntity, string> StationNames => _stationNames;
|
||||
|
||||
public event Action? InfoBlobUpdated;
|
||||
public event Action? LobbyStatusUpdated;
|
||||
public event Action? LobbySongUpdated;
|
||||
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()
|
||||
{
|
||||
@@ -89,8 +89,18 @@ namespace Content.Client.GameTicking.Managers
|
||||
|
||||
private void UpdateJobsAvailable(TickerJobsAvailableEvent message)
|
||||
{
|
||||
_jobsAvailable = message.JobsAvailableByStation;
|
||||
_stationNames = message.StationNames;
|
||||
foreach (var (job, data) in message.JobsAvailableByStation)
|
||||
{
|
||||
_jobsAvailable.Clear();
|
||||
_jobsAvailable[job] = data;
|
||||
}
|
||||
|
||||
_stationNames.Clear();
|
||||
foreach (var weh in message.StationNames)
|
||||
{
|
||||
_stationNames[weh.Key] = weh.Value;
|
||||
}
|
||||
|
||||
LobbyJobsAvailableUpdated?.Invoke(JobsAvailable);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,9 +174,13 @@ namespace Content.Client.Gameplay
|
||||
EntityCoordinates.FromMap(_mapManager, mousePosWorld);
|
||||
}
|
||||
|
||||
var message = new FullInputCmdMessage(_timing.CurTick, _timing.TickFraction, funcId, kArgs.State,
|
||||
coordinates , kArgs.PointerLocation,
|
||||
entityToClick ?? default); // TODO make entityUid nullable
|
||||
var message = new ClientFullInputCmdMessage(_timing.CurTick, _timing.TickFraction, funcId)
|
||||
{
|
||||
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.
|
||||
var session = _playerManager.LocalPlayer?.Session;
|
||||
|
||||
@@ -20,7 +20,7 @@ public sealed class GatewayBoundUserInterface : BoundUserInterface
|
||||
_window = new GatewayWindow();
|
||||
_window.OpenPortal += destination =>
|
||||
{
|
||||
SendMessage(new GatewayOpenPortalMessage(destination));
|
||||
SendMessage(new GatewayOpenPortalMessage(EntMan.GetNetEntity(destination)));
|
||||
};
|
||||
_window.OnClose += Close;
|
||||
_window?.OpenCentered();
|
||||
|
||||
@@ -16,10 +16,11 @@ namespace Content.Client.Gateway.UI;
|
||||
public sealed partial class GatewayWindow : FancyWindow,
|
||||
IComputerWindow<EmergencyConsoleBoundUserInterfaceState>
|
||||
{
|
||||
private readonly IEntityManager _entManager;
|
||||
private readonly IGameTiming _timing;
|
||||
|
||||
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 TimeSpan _nextClose;
|
||||
private TimeSpan _lastOpen;
|
||||
@@ -29,13 +30,15 @@ public sealed partial class GatewayWindow : FancyWindow,
|
||||
public GatewayWindow()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
_timing = IoCManager.Resolve<IGameTiming>();
|
||||
var dependencies = IoCManager.Instance!;
|
||||
_entManager = dependencies.Resolve<IEntityManager>();
|
||||
_timing = dependencies.Resolve<IGameTiming>();
|
||||
}
|
||||
|
||||
public void UpdateState(GatewayBoundUserInterfaceState state)
|
||||
{
|
||||
_destinations = state.Destinations;
|
||||
_current = state.Current;
|
||||
_current = _entManager.GetEntity(state.Current);
|
||||
_nextClose = state.NextClose;
|
||||
_lastOpen = state.LastOpen;
|
||||
|
||||
@@ -64,7 +67,7 @@ public sealed partial class GatewayWindow : FancyWindow,
|
||||
var now = _timing.CurTime;
|
||||
foreach (var dest in _destinations)
|
||||
{
|
||||
var uid = dest.Item1;
|
||||
var uid = _entManager.GetEntity(dest.Item1);
|
||||
var name = dest.Item2;
|
||||
var nextReady = dest.Item3;
|
||||
var busy = dest.Item4;
|
||||
@@ -101,7 +104,7 @@ public sealed partial class GatewayWindow : FancyWindow,
|
||||
OpenPortal?.Invoke(uid);
|
||||
};
|
||||
|
||||
if (uid == state.Current)
|
||||
if (uid == _entManager.GetEntity(state.Current))
|
||||
{
|
||||
openButton.AddStyleClass(StyleBase.ButtonCaution);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace Content.Client.Hands.Systems
|
||||
#region PickupAnimation
|
||||
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,
|
||||
@@ -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).
|
||||
if (component.Hands.TryGetValue(args.ContainerId, out var hand))
|
||||
{
|
||||
UpdateHandVisuals(uid, args.Item, hand, component);
|
||||
UpdateHandVisuals(uid, GetEntity(args.Item), hand, component);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -24,13 +24,16 @@ namespace Content.Client.HealthAnalyzer.UI
|
||||
{
|
||||
var text = new StringBuilder();
|
||||
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";
|
||||
if (msg.TargetEntity != null &&
|
||||
entities.TryGetComponent<MetaDataComponent>(msg.TargetEntity.Value, out var metaData))
|
||||
entityName = Identity.Name(msg.TargetEntity.Value, entities);
|
||||
entities.HasComponent<MetaDataComponent>(target.Value))
|
||||
{
|
||||
entityName = Identity.Name(target.Value, entities);
|
||||
}
|
||||
|
||||
IReadOnlyDictionary<string, FixedPoint2> damagePerGroup = damageable.DamagePerGroup;
|
||||
IReadOnlyDictionary<string, FixedPoint2> damagePerType = damageable.Damage.DamageDict;
|
||||
|
||||
@@ -197,7 +197,7 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem
|
||||
profile.Appearance.EyeColor,
|
||||
_markingManager);
|
||||
|
||||
DebugTools.Assert(uid.IsClientSide());
|
||||
DebugTools.Assert(IsClientSide(uid));
|
||||
|
||||
var state = new HumanoidAppearanceState(markings,
|
||||
new(),
|
||||
|
||||
@@ -54,10 +54,10 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
|
||||
|
||||
public void SetMaster(EntityUid uid, EntityUid? masterUid)
|
||||
{
|
||||
if (!TryComp(uid, out InstrumentComponent? instrument))
|
||||
if (!HasComp<InstrumentComponent>(uid))
|
||||
return;
|
||||
|
||||
RaiseNetworkEvent(new InstrumentSetMasterEvent(uid, masterUid));
|
||||
RaiseNetworkEvent(new InstrumentSetMasterEvent(GetNetEntity(uid), GetNetEntity(masterUid)));
|
||||
}
|
||||
|
||||
public void SetFilteredChannel(EntityUid uid, int channel, bool value)
|
||||
@@ -68,7 +68,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
|
||||
if(value)
|
||||
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)
|
||||
@@ -109,7 +109,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
|
||||
|
||||
if (!fromStateChange)
|
||||
{
|
||||
RaiseNetworkEvent(new InstrumentStartMidiEvent(uid));
|
||||
RaiseNetworkEvent(new InstrumentStartMidiEvent(GetNetEntity(uid)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
|
||||
|
||||
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)
|
||||
{
|
||||
var uid = midiEv.Uid;
|
||||
var uid = GetEntity(midiEv.Uid);
|
||||
|
||||
if (!TryComp(uid, out InstrumentComponent? instrument))
|
||||
return;
|
||||
@@ -354,12 +354,12 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
|
||||
|
||||
private void OnMidiStart(InstrumentStartMidiEvent ev)
|
||||
{
|
||||
SetupRenderer(ev.Uid, true);
|
||||
SetupRenderer(GetEntity(ev.Uid), true);
|
||||
}
|
||||
|
||||
private void OnMidiStop(InstrumentStopMidiEvent ev)
|
||||
{
|
||||
EndRenderer(ev.Uid, true);
|
||||
EndRenderer(GetEntity(ev.Uid), true);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
@@ -425,7 +425,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
|
||||
if (eventCount == 0)
|
||||
continue;
|
||||
|
||||
RaiseNetworkEvent(new InstrumentMidiEventEvent(uid, events));
|
||||
RaiseNetworkEvent(new InstrumentMidiEventEvent(GetNetEntity(uid), events));
|
||||
|
||||
instrument.SentWithinASec += eventCount;
|
||||
|
||||
|
||||
@@ -32,12 +32,13 @@ public sealed partial class BandMenu : DefaultWindow
|
||||
Timer.Spawn(0, Close);
|
||||
}
|
||||
|
||||
public void Populate((EntityUid, string)[] nearby)
|
||||
public void Populate((NetEntity, string)[] nearby, IEntityManager entManager)
|
||||
{
|
||||
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);
|
||||
item.Selected = _owner.Instrument?.Master == uid;
|
||||
}
|
||||
|
||||
@@ -10,15 +10,15 @@ namespace Content.Client.Instruments.UI
|
||||
{
|
||||
public sealed class InstrumentBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[Dependency] public readonly IEntityManager Entities = default!;
|
||||
public IEntityManager Entities => EntMan;
|
||||
[Dependency] public readonly IMidiManager MidiManager = default!;
|
||||
[Dependency] public readonly IFileDialogManager FileDialogManager = default!;
|
||||
[Dependency] public readonly IPlayerManager PlayerManager = default!;
|
||||
[Dependency] public readonly ILocalizationManager Loc = default!;
|
||||
|
||||
public readonly InstrumentSystem Instruments = default!;
|
||||
public readonly ActionBlockerSystem ActionBlocker = default!;
|
||||
public readonly SharedInteractionSystem Interactions = default!;
|
||||
public readonly InstrumentSystem Instruments;
|
||||
public readonly ActionBlockerSystem ActionBlocker;
|
||||
public readonly SharedInteractionSystem Interactions;
|
||||
|
||||
[ViewVariables] private InstrumentMenu? _instrumentMenu;
|
||||
[ViewVariables] private BandMenu? _bandMenu;
|
||||
@@ -40,7 +40,7 @@ namespace Content.Client.Instruments.UI
|
||||
switch (message)
|
||||
{
|
||||
case InstrumentBandResponseBuiMessage bandRx:
|
||||
_bandMenu?.Populate(bandRx.Nearby);
|
||||
_bandMenu?.Populate(bandRx.Nearby, EntMan);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace Content.Client.Inventory
|
||||
return;
|
||||
|
||||
EntityManager.RaisePredictiveEvent(
|
||||
new InteractInventorySlotEvent(item.Value, altInteract: false));
|
||||
new InteractInventorySlotEvent(GetNetEntity(item.Value), altInteract: false));
|
||||
}
|
||||
|
||||
public void UIInventoryAltActivateItem(string slot, EntityUid uid)
|
||||
@@ -290,7 +290,7 @@ namespace Content.Client.Inventory
|
||||
if (!TryGetSlotEntity(uid, slot, out var item))
|
||||
return;
|
||||
|
||||
EntityManager.RaisePredictiveEvent(new InteractInventorySlotEvent(item.Value, altInteract: true));
|
||||
EntityManager.RaisePredictiveEvent(new InteractInventorySlotEvent(GetNetEntity(item.Value), altInteract: true));
|
||||
}
|
||||
|
||||
public sealed class SlotData
|
||||
|
||||
@@ -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 (Container.TryGetContainingContainer(uid, out var container))
|
||||
RaiseLocalEvent(container.Owner, new VisualsChangedEvent(uid, container.ID));
|
||||
RaiseLocalEvent(container.Owner, new VisualsChangedEvent(GetNetEntity(uid), container.ID));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -57,7 +57,9 @@ namespace Content.Client.Kitchen.UI
|
||||
ChamberContentBox.EjectButton.Disabled = state.ChamberContents.Length <= 0;
|
||||
GrindButton.Disabled = !state.CanGrind || !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)
|
||||
|
||||
@@ -20,8 +20,11 @@ namespace Content.Client.Kitchen.UI
|
||||
[ViewVariables]
|
||||
private readonly Dictionary<int, ReagentQuantity> _reagents = new();
|
||||
|
||||
private IEntityManager _entManager;
|
||||
|
||||
public MicrowaveBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
@@ -34,7 +37,7 @@ namespace Content.Client.Kitchen.UI
|
||||
_menu.EjectButton.OnPressed += _ => SendMessage(new MicrowaveEjectMessage());
|
||||
_menu.IngredientsList.OnItemSelected += args =>
|
||||
{
|
||||
SendMessage(new MicrowaveEjectSolidIndexedMessage(_solids[args.ItemIndex]));
|
||||
SendMessage(new MicrowaveEjectSolidIndexedMessage(EntMan.GetNetEntity(_solids[args.ItemIndex])));
|
||||
};
|
||||
|
||||
_menu.OnCookTimeSelected += (args, buttonIndex) =>
|
||||
@@ -57,7 +60,6 @@ namespace Content.Client.Kitchen.UI
|
||||
_menu?.Dispose();
|
||||
}
|
||||
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
@@ -67,7 +69,9 @@ namespace Content.Client.Kitchen.UI
|
||||
}
|
||||
|
||||
_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;
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Content.Client.Kitchen.UI
|
||||
|
||||
public void EjectChamberContent(EntityUid uid)
|
||||
{
|
||||
SendMessage(new ReagentGrinderEjectChamberContentMessage(uid));
|
||||
SendMessage(new ReagentGrinderEjectChamberContentMessage(EntMan.GetNetEntity(uid)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,17 +23,18 @@ namespace Content.Client.LateJoin
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
||||
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystem = 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 SpriteSystem _sprites;
|
||||
private readonly CrewManifestSystem _crewManifest;
|
||||
|
||||
private readonly Dictionary<EntityUid, Dictionary<string, JobButton>> _jobButtons = new();
|
||||
private readonly Dictionary<EntityUid, Dictionary<string, BoxContainer>> _jobCategories = new();
|
||||
private readonly Dictionary<NetEntity, Dictionary<string, JobButton>> _jobButtons = new();
|
||||
private readonly Dictionary<NetEntity, Dictionary<string, BoxContainer>> _jobCategories = new();
|
||||
private readonly List<ScrollContainer> _jobLists = new();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace Content.Client.Light
|
||||
public static Color GetCurrentRgbColor(TimeSpan curTime, TimeSpan offset, RgbLightControllerComponent rgb)
|
||||
{
|
||||
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
|
||||
|
||||
@@ -47,11 +47,11 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
||||
_dragging = grid;
|
||||
_localPosition = localPosition;
|
||||
|
||||
if (TryComp<PhysicsComponent>(grid, out var body))
|
||||
if (HasComp<PhysicsComponent>(grid))
|
||||
{
|
||||
RaiseNetworkEvent(new GridDragVelocityRequest()
|
||||
{
|
||||
Grid = grid,
|
||||
Grid = GetNetEntity(grid),
|
||||
LinearVelocity = Vector2.Zero
|
||||
});
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
||||
var distance = _lastMousePosition.Value.Position - xform.WorldPosition;
|
||||
RaiseNetworkEvent(new GridDragVelocityRequest()
|
||||
{
|
||||
Grid = _dragging.Value,
|
||||
Grid = GetNetEntity(_dragging.Value),
|
||||
LinearVelocity = distance.LengthSquared() > 0f ? (distance / (float) tickTime.TotalSeconds) * 0.25f : Vector2.Zero,
|
||||
});
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
||||
|
||||
RaiseNetworkEvent(new GridDragRequestPosition()
|
||||
{
|
||||
Grid = _dragging.Value,
|
||||
Grid = GetNetEntity(_dragging.Value),
|
||||
WorldPosition = requestedGridOrigin,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,20 +67,14 @@ namespace Content.Client.MassMedia.Ui
|
||||
|
||||
var stringContent = Rope.Collapse(_menu.ContentInput.TextRope);
|
||||
|
||||
if (stringContent == null || stringContent.Length == 0) return;
|
||||
if (_gameTicker == null) return;
|
||||
if (stringContent == null || stringContent.Length == 0)
|
||||
return;
|
||||
|
||||
NewsArticle article = new NewsArticle();
|
||||
var stringName = _menu.NameInput.Text;
|
||||
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.NameInput.Text = string.Empty;
|
||||
|
||||
SendMessage(new NewsWriteShareMessage(article));
|
||||
SendMessage(new NewsWriteShareMessage(name, stringContent));
|
||||
}
|
||||
|
||||
private void OnDeleteButtonPressed(int articleNum)
|
||||
|
||||
@@ -20,9 +20,11 @@ public sealed partial class MechGrabberUi : UIFragment
|
||||
return;
|
||||
|
||||
_fragment = new MechGrabberUiFragment();
|
||||
|
||||
_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)));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public sealed partial class MechGrabberUiFragment : BoxContainer
|
||||
SpaceLabel.Text = $"{state.Contents.Count}/{state.MaxContents}";
|
||||
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))
|
||||
continue;
|
||||
|
||||
@@ -22,7 +22,8 @@ public sealed partial class MechSoundboardUi : UIFragment
|
||||
_fragment = new MechSoundboardUiFragment();
|
||||
_fragment.OnPlayAction += sound =>
|
||||
{
|
||||
userInterface.SendMessage(new MechSoundboardPlayMessage(fragmentOwner.Value, sound));
|
||||
// TODO: IDK dog
|
||||
userInterface.SendMessage(new MechSoundboardPlayMessage(IoCManager.Resolve<IEntityManager>().GetNetEntity(fragmentOwner.Value), sound));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public sealed class MechBoundUserInterface : BoundUserInterface
|
||||
|
||||
_menu.OnRemoveButtonPressed += uid =>
|
||||
{
|
||||
SendMessage(new MechEquipmentRemoveMessage(uid));
|
||||
SendMessage(new MechEquipmentRemoveMessage(EntMan.GetNetEntity(uid)));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public sealed class MechBoundUserInterface : BoundUserInterface
|
||||
continue;
|
||||
foreach (var (attached, estate) in state.EquipmentStates)
|
||||
{
|
||||
if (ent == attached)
|
||||
if (ent == EntMan.GetEntity(attached))
|
||||
ui.UpdateState(estate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,15 +64,18 @@ namespace Content.Client.Medical.CrewMonitoring
|
||||
// add a row for each sensor
|
||||
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
|
||||
var nameButton = new CrewMonitoringButton()
|
||||
{
|
||||
SuitSensorUid = sensor.SuitSensorUid,
|
||||
Coordinates = sensor.Coordinates,
|
||||
SuitSensorUid = sensorEntity,
|
||||
Coordinates = coordinates,
|
||||
Text = sensor.Name,
|
||||
Margin = new Thickness(5f, 5f),
|
||||
};
|
||||
if (sensor.SuitSensorUid == _trackedButton?.SuitSensorUid)
|
||||
if (sensorEntity == _trackedButton?.SuitSensorUid)
|
||||
nameButton.AddStyleClass(StyleNano.StyleClassButtonColorGreen);
|
||||
SetColorLabel(nameButton.Label, sensor.TotalDamage, sensor.IsAlive);
|
||||
SensorsTable.AddChild(nameButton);
|
||||
@@ -113,10 +116,10 @@ namespace Content.Client.Medical.CrewMonitoring
|
||||
SensorsTable.AddChild(box);
|
||||
_rowsContent.Add(box);
|
||||
|
||||
if (sensor.Coordinates != null && NavMap.Visible)
|
||||
if (coordinates != null && NavMap.Visible)
|
||||
{
|
||||
NavMap.TrackedCoordinates.TryAdd(sensor.Coordinates.Value,
|
||||
(true, sensor.SuitSensorUid == _trackedButton?.SuitSensorUid ? StyleNano.PointGreen : StyleNano.PointRed));
|
||||
NavMap.TrackedCoordinates.TryAdd(coordinates.Value,
|
||||
(true, sensorEntity == _trackedButton?.SuitSensorUid ? StyleNano.PointGreen : StyleNano.PointRed));
|
||||
|
||||
nameButton.OnButtonUp += args =>
|
||||
{
|
||||
@@ -124,8 +127,8 @@ namespace Content.Client.Medical.CrewMonitoring
|
||||
//Make previous point red
|
||||
NavMap.TrackedCoordinates[_trackedButton.Coordinates.Value] = (true, StyleNano.PointRed);
|
||||
|
||||
NavMap.TrackedCoordinates[sensor.Coordinates.Value] = (true, StyleNano.PointGreen);
|
||||
NavMap.CenterToCoordinates(sensor.Coordinates.Value);
|
||||
NavMap.TrackedCoordinates[coordinates.Value] = (true, StyleNano.PointGreen);
|
||||
NavMap.CenterToCoordinates(coordinates.Value);
|
||||
|
||||
nameButton.AddStyleClass(StyleNano.StyleClassButtonColorGreen);
|
||||
if (_trackedButton != null)
|
||||
@@ -145,7 +148,7 @@ namespace Content.Client.Medical.CrewMonitoring
|
||||
|
||||
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 };
|
||||
|
||||
if (coordinates == null || _stationUid == null)
|
||||
|
||||
@@ -46,7 +46,7 @@ public sealed class HTNSystem : EntitySystem
|
||||
|
||||
private void OnHTNMessage(HTNMessage ev)
|
||||
{
|
||||
if (!TryComp<HTNComponent>(ev.Uid, out var htn))
|
||||
if (!TryComp<HTNComponent>(GetEntity(ev.Uid), out var htn))
|
||||
return;
|
||||
|
||||
htn.DebugText = ev.Text;
|
||||
|
||||
@@ -61,10 +61,12 @@ public sealed class NPCSteeringSystem : SharedNPCSteeringSystem
|
||||
|
||||
foreach (var data in ev.Data)
|
||||
{
|
||||
if (!Exists(data.EntityUid))
|
||||
var entity = GetEntity(data.EntityUid);
|
||||
|
||||
if (!Exists(entity))
|
||||
continue;
|
||||
|
||||
var comp = EnsureComp<NPCSteeringComponent>(data.EntityUid);
|
||||
var comp = EnsureComp<NPCSteeringComponent>(entity);
|
||||
comp.Direction = data.Direction;
|
||||
comp.DangerMap = data.Danger;
|
||||
comp.InterestMap = data.Interest;
|
||||
|
||||
@@ -60,8 +60,8 @@ namespace Content.Client.NPC
|
||||
private PathfindingDebugMode _modes = PathfindingDebugMode.None;
|
||||
|
||||
// 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<EntityUid, Dictionary<Vector2i, Dictionary<Vector2i, List<DebugPathPoly>>>> Polys = new();
|
||||
public Dictionary<NetEntity, Dictionary<Vector2i, List<PathfindingBreadcrumb>>> Breadcrumbs = new();
|
||||
public Dictionary<NetEntity, Dictionary<Vector2i, Dictionary<Vector2i, List<DebugPathPoly>>>> Polys = new();
|
||||
public readonly List<(TimeSpan Time, PathRouteMessage Message)> Routes = new();
|
||||
|
||||
public override void Initialize()
|
||||
@@ -184,7 +184,9 @@ namespace Content.Client.NPC
|
||||
|
||||
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;
|
||||
|
||||
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))
|
||||
return;
|
||||
|
||||
if (!_system.Polys.TryGetValue(gridUid, out var data))
|
||||
if (!_system.Polys.TryGetValue(_entManager.GetNetEntity(gridUid), out var data))
|
||||
return;
|
||||
|
||||
var tileRef = grid.GetTileRef(mouseWorldPos);
|
||||
@@ -333,7 +335,9 @@ namespace Content.Client.NPC
|
||||
{
|
||||
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))
|
||||
{
|
||||
continue;
|
||||
@@ -390,7 +394,9 @@ namespace Content.Client.NPC
|
||||
{
|
||||
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))
|
||||
continue;
|
||||
|
||||
@@ -424,7 +430,9 @@ namespace Content.Client.NPC
|
||||
{
|
||||
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))
|
||||
continue;
|
||||
|
||||
@@ -450,10 +458,10 @@ namespace Content.Client.NPC
|
||||
Color color;
|
||||
Vector2 neighborPos;
|
||||
|
||||
if (neighborPoly.EntityId != poly.GraphUid)
|
||||
if (neighborPoly.NetEntity != poly.GraphUid)
|
||||
{
|
||||
color = Color.Green;
|
||||
var neighborMap = neighborPoly.ToMap(_entManager);
|
||||
var neighborMap = _entManager.GetCoordinates(neighborPoly).ToMap(_entManager);
|
||||
|
||||
if (neighborMap.MapId != args.MapId)
|
||||
continue;
|
||||
@@ -478,7 +486,9 @@ namespace Content.Client.NPC
|
||||
{
|
||||
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))
|
||||
continue;
|
||||
|
||||
@@ -506,7 +516,7 @@ namespace Content.Client.NPC
|
||||
{
|
||||
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;
|
||||
|
||||
worldHandle.SetTransform(graphXform.WorldMatrix);
|
||||
@@ -525,12 +535,14 @@ namespace Content.Client.NPC
|
||||
|
||||
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;
|
||||
|
||||
matrix = node.GraphUid;
|
||||
matrix = graph;
|
||||
worldHandle.SetTransform(graphXform.WorldMatrix);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Content.Client.NodeContainer
|
||||
|
||||
Entities = Groups.Values
|
||||
.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());
|
||||
|
||||
NodeLookup = Groups.Values
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Content.Client.NodeContainer
|
||||
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))
|
||||
return;
|
||||
var gridTile = grid.TileIndicesFor(xform.Coordinates);
|
||||
|
||||
@@ -31,7 +31,7 @@ public sealed class PointingSystem : SharedPointingSystem
|
||||
|
||||
private void AddPointingVerb(GetVerbsEvent<Verb> args)
|
||||
{
|
||||
if (args.Target.IsClientSide())
|
||||
if (IsClientSide(args.Target))
|
||||
return;
|
||||
|
||||
// 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"),
|
||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/point.svg.192dpi.png")),
|
||||
ClientExclusive = true,
|
||||
Act = () => RaiseNetworkEvent(new PointingAttemptEvent(args.Target))
|
||||
Act = () => RaiseNetworkEvent(new PointingAttemptEvent(GetNetEntity(args.Target)))
|
||||
};
|
||||
|
||||
args.Verbs.Add(verb);
|
||||
|
||||
@@ -61,9 +61,9 @@ namespace Content.Client.Popups
|
||||
if (recordReplay && _replayRecording.IsRecording)
|
||||
{
|
||||
if (entity != null)
|
||||
_replayRecording.RecordClientMessage(new PopupEntityEvent(message, type, entity.Value));
|
||||
_replayRecording.RecordClientMessage(new PopupEntityEvent(message, type, GetNetEntity(entity.Value)));
|
||||
else
|
||||
_replayRecording.RecordClientMessage(new PopupCoordinatesEvent(message, type, coordinates));
|
||||
_replayRecording.RecordClientMessage(new PopupCoordinatesEvent(message, type, GetNetCoordinates(coordinates)));
|
||||
}
|
||||
|
||||
var label = new WorldPopupLabel(coordinates)
|
||||
@@ -170,13 +170,15 @@ namespace Content.Client.Popups
|
||||
|
||||
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)
|
||||
{
|
||||
if (TryComp(ev.Uid, out TransformComponent? transform))
|
||||
PopupMessage(ev.Message, ev.Type, transform.Coordinates, ev.Uid, false);
|
||||
var entity = GetEntity(ev.Uid);
|
||||
|
||||
if (TryComp(entity, out TransformComponent? transform))
|
||||
PopupMessage(ev.Message, ev.Type, transform.Coordinates, entity, false);
|
||||
}
|
||||
|
||||
private void OnRoundRestart(RoundRestartCleanupEvent ev)
|
||||
|
||||
@@ -19,10 +19,12 @@ public sealed class ProjectileSystem : SharedProjectileSystem
|
||||
|
||||
private void OnProjectileImpact(ImpactEffectEvent ev)
|
||||
{
|
||||
if (Deleted(ev.Coordinates.EntityId))
|
||||
var coords = GetCoordinates(ev.Coordinates);
|
||||
|
||||
if (Deleted(coords.EntityId))
|
||||
return;
|
||||
|
||||
var ent = Spawn(ev.Prototype, ev.Coordinates);
|
||||
var ent = Spawn(ev.Prototype, coords);
|
||||
|
||||
if (TryComp<SpriteComponent>(ent, out var sprite))
|
||||
{
|
||||
|
||||
@@ -59,8 +59,10 @@ public sealed class RadiationDebugOverlay : Overlay
|
||||
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))
|
||||
continue;
|
||||
|
||||
@@ -82,8 +84,10 @@ public sealed class RadiationDebugOverlay : Overlay
|
||||
|
||||
var handle = args.ScreenHandle;
|
||||
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))
|
||||
continue;
|
||||
if (query.TryGetComponent(gridUid, out var trs) && trs.MapID != args.MapId)
|
||||
@@ -119,8 +123,10 @@ public sealed class RadiationDebugOverlay : Overlay
|
||||
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))
|
||||
continue;
|
||||
var (destTile, _) = blockers.Last();
|
||||
|
||||
@@ -26,7 +26,7 @@ public sealed class GeigerSystem : SharedGeigerSystem
|
||||
component.CurrentRadiation = state.CurrentRadiation;
|
||||
component.DangerLevel = state.DangerLevel;
|
||||
component.IsEnabled = state.IsEnabled;
|
||||
component.User = state.User;
|
||||
component.User = EnsureEntity<GeigerComponent>(state.User, uid);
|
||||
component.UiUpdateNeeded = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ public sealed class RadiationSystem : EntitySystem
|
||||
[Dependency] private readonly IOverlayManager _overlayMan = default!;
|
||||
|
||||
public List<RadiationRay>? Rays;
|
||||
public Dictionary<EntityUid, Dictionary<Vector2i, float>>? ResistanceGrids;
|
||||
public Dictionary<NetEntity, Dictionary<Vector2i, float>>? ResistanceGrids;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -40,15 +40,13 @@ public sealed class RadiationSystem : EntitySystem
|
||||
|
||||
var str = $"Radiation update: {ev.ElapsedTimeMs}ms with. Receivers: {ev.ReceiversCount}, " +
|
||||
$"Sources: {ev.SourcesCount}, Rays: {ev.Rays.Count}";
|
||||
Logger.Info(str);
|
||||
Log.Info(str);
|
||||
|
||||
Rays = ev.Rays;
|
||||
}
|
||||
|
||||
private void OnResistanceUpdate(OnRadiationOverlayResistanceUpdateEvent ev)
|
||||
{
|
||||
if (!_overlayMan.TryGetOverlay(out RadiationDebugOverlay? overlay))
|
||||
return;
|
||||
ResistanceGrids = ev.Grids;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public sealed partial class ReplaySpectatorSystem
|
||||
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.
|
||||
SpawnSpectatorGhost(new EntityCoordinates(player, default), true);
|
||||
@@ -113,12 +113,9 @@ public sealed partial class ReplaySpectatorSystem
|
||||
_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)
|
||||
return false;
|
||||
|
||||
if (full.State == BoundKeyState.Down)
|
||||
if (message.State == BoundKeyState.Down)
|
||||
_sys.Direction |= _dir;
|
||||
else
|
||||
_sys.Direction &= ~_dir;
|
||||
|
||||
@@ -167,7 +167,7 @@ public sealed partial class ReplaySpectatorSystem
|
||||
|
||||
private void OnDetached(EntityUid uid, ReplaySpectatorComponent component, PlayerDetachedEvent args)
|
||||
{
|
||||
if (uid.IsClientSide())
|
||||
if (IsClientSide(uid))
|
||||
QueueDel(uid);
|
||||
else
|
||||
RemCompDeferred(uid, component);
|
||||
|
||||
@@ -51,7 +51,7 @@ public sealed partial class ReplaySpectatorSystem
|
||||
if (old == null)
|
||||
return;
|
||||
|
||||
if (old.Value.IsClientSide())
|
||||
if (IsClientSide(old.Value))
|
||||
Del(old.Value);
|
||||
else
|
||||
RemComp<ReplaySpectatorComponent>(old.Value);
|
||||
@@ -77,7 +77,7 @@ public sealed partial class ReplaySpectatorSystem
|
||||
|
||||
if (old != null)
|
||||
{
|
||||
if (old.Value.IsClientSide())
|
||||
if (IsClientSide(old.Value))
|
||||
QueueDel(old.Value);
|
||||
else
|
||||
RemComp<ReplaySpectatorComponent>(old.Value);
|
||||
@@ -100,12 +100,14 @@ public sealed partial class ReplaySpectatorSystem
|
||||
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])));
|
||||
return;
|
||||
}
|
||||
|
||||
var uid = GetEntity(netEntity);
|
||||
|
||||
if (!Exists(uid))
|
||||
{
|
||||
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)
|
||||
return CompletionResult.Empty;
|
||||
|
||||
return CompletionResult.FromHintOptions(CompletionHelper.EntityUids(args[0],
|
||||
return CompletionResult.FromHintOptions(CompletionHelper.NetEntities(args[0],
|
||||
EntityManager), Loc.GetString("cmd-replay-spectate-hint"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,9 @@ namespace Content.Client.RoundEnd
|
||||
VerticalExpand = true,
|
||||
};
|
||||
|
||||
if (_entityManager.HasComponent<SpriteComponent>(playerInfo.PlayerEntityUid))
|
||||
var playerUid = _entityManager.GetEntity(playerInfo.PlayerNetEntity);
|
||||
|
||||
if (_entityManager.HasComponent<SpriteComponent>(playerUid))
|
||||
{
|
||||
var spriteView = new SpriteView
|
||||
{
|
||||
@@ -134,7 +136,7 @@ namespace Content.Client.RoundEnd
|
||||
SetSize = new Vector2(32, 32),
|
||||
VerticalExpand = true,
|
||||
};
|
||||
spriteView.SetEntity(playerInfo.PlayerEntityUid);
|
||||
spriteView.SetEntity(playerUid);
|
||||
hBox.AddChild(spriteView);
|
||||
}
|
||||
|
||||
|
||||
@@ -63,15 +63,18 @@ public sealed class FultonSystem : SharedFultonSystem
|
||||
|
||||
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;
|
||||
|
||||
var animationEnt = Spawn(null, ev.Coordinates);
|
||||
var animationEnt = Spawn(null, coordinates);
|
||||
// TODO: Spawn fulton layer
|
||||
var sprite = AddComp<SpriteComponent>(animationEnt);
|
||||
_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);
|
||||
_serManager.CopyTo(entAppearance, ref appearance, notNullableOverride: true);
|
||||
|
||||
@@ -38,7 +38,7 @@ public sealed class RadarConsoleBoundUserInterface : BoundUserInterface
|
||||
base.UpdateState(state);
|
||||
if (state is not RadarConsoleBoundInterfaceState cState) return;
|
||||
|
||||
_window?.SetMatrix(cState.Coordinates, cState.Angle);
|
||||
_window?.SetMatrix(EntMan.GetCoordinates(cState.Coordinates), cState.Angle);
|
||||
_window?.UpdateState(cState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
|
||||
_window.OnClose += OnClose;
|
||||
}
|
||||
|
||||
private void OnDestinationPressed(EntityUid obj)
|
||||
private void OnDestinationPressed(NetEntity obj)
|
||||
{
|
||||
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 });
|
||||
}
|
||||
|
||||
private void OnAutodockPressed(EntityUid obj)
|
||||
private void OnAutodockPressed(NetEntity obj)
|
||||
{
|
||||
SendMessage(new AutodockRequestMessage() { DockEntity = obj });
|
||||
}
|
||||
|
||||
private void OnUndockPressed(EntityUid obj)
|
||||
private void OnUndockPressed(NetEntity obj)
|
||||
{
|
||||
SendMessage(new UndockRequestMessage() { DockEntity = obj });
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
|
||||
base.UpdateState(state);
|
||||
if (state is not ShuttleConsoleBoundInterfaceState cState) return;
|
||||
|
||||
_window?.SetMatrix(cState.Coordinates, cState.Angle);
|
||||
_window?.SetMatrix(EntMan.GetCoordinates(cState.Coordinates), cState.Angle);
|
||||
_window?.UpdateState(cState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,8 +44,9 @@ namespace Content.Client.Shuttles.Systems
|
||||
{
|
||||
if (args.Current is not PilotComponentState state) return;
|
||||
|
||||
var console = state.Console.GetValueOrDefault();
|
||||
if (!console.IsValid())
|
||||
var console = EnsureEntity<PilotComponent>(state.Console, uid);
|
||||
|
||||
if (console == null)
|
||||
{
|
||||
component.Console = null;
|
||||
_input.Contexts.SetActiveContext("human");
|
||||
|
||||
@@ -47,7 +47,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
|
||||
{
|
||||
if (_overlay == null) return;
|
||||
|
||||
_overlay.StationUid = ev.StationUid;
|
||||
_overlay.StationUid = GetEntity(ev.StationUid);
|
||||
_overlay.Position = ev.Position;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class DockingControl : Control
|
||||
private int ScaledMinimapRadius => (int) (MapGridControl.UIDisplayRadius * UIScale);
|
||||
private float MinimapScale => _range != 0 ? ScaledMinimapRadius / _range : 0f;
|
||||
|
||||
public EntityUid? ViewedDock;
|
||||
public NetEntity? ViewedDock;
|
||||
public EntityUid? GridEntity;
|
||||
|
||||
public EntityCoordinates? Coordinates;
|
||||
@@ -41,7 +41,7 @@ public class DockingControl : Control
|
||||
/// <summary>
|
||||
/// Stored by GridID then by docks
|
||||
/// </summary>
|
||||
public Dictionary<EntityUid, List<DockingInterfaceState>> Docks = new();
|
||||
public Dictionary<NetEntity, List<DockingInterfaceState>> Docks = new();
|
||||
|
||||
public DockingControl()
|
||||
{
|
||||
@@ -204,7 +204,7 @@ public class DockingControl : Control
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
||||
@@ -124,7 +124,7 @@ public sealed class RadarControl : MapGridControl
|
||||
foreach (var state in ls.Docks)
|
||||
{
|
||||
var coordinates = state.Coordinates;
|
||||
var grid = _docks.GetOrNew(coordinates.EntityId);
|
||||
var grid = _docks.GetOrNew(_entManager.GetEntity(coordinates.NetEntity));
|
||||
grid.Add(state);
|
||||
}
|
||||
}
|
||||
@@ -324,7 +324,7 @@ public sealed class RadarControl : MapGridControl
|
||||
{
|
||||
foreach (var state in docks)
|
||||
{
|
||||
var ent = state.Entity;
|
||||
var ent = _entManager.GetEntity(state.Entity);
|
||||
var position = state.Coordinates.Position;
|
||||
var uiPosition = matrix.Transform(position);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
||||
private readonly IEntityManager _entManager;
|
||||
private readonly IGameTiming _timing;
|
||||
|
||||
private EntityUid? _shuttleUid;
|
||||
private EntityUid? _shuttleEntity;
|
||||
|
||||
/// <summary>
|
||||
/// Currently selected dock button for camera.
|
||||
@@ -32,19 +32,19 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
||||
/// <summary>
|
||||
/// Stored by grid entityid then by states
|
||||
/// </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>
|
||||
/// Next FTL state change.
|
||||
/// </summary>
|
||||
public TimeSpan FTLTime;
|
||||
|
||||
public Action<EntityUid>? UndockPressed;
|
||||
public Action<EntityUid>? StartAutodockPressed;
|
||||
public Action<EntityUid>? StopAutodockPressed;
|
||||
public Action<EntityUid>? DestinationPressed;
|
||||
public Action<NetEntity>? UndockPressed;
|
||||
public Action<NetEntity>? StartAutodockPressed;
|
||||
public Action<NetEntity>? StopAutodockPressed;
|
||||
public Action<NetEntity>? DestinationPressed;
|
||||
|
||||
public ShuttleConsoleWindow()
|
||||
{
|
||||
@@ -89,7 +89,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
||||
|
||||
public void SetMatrix(EntityCoordinates? coordinates, Angle? angle)
|
||||
{
|
||||
_shuttleUid = coordinates?.EntityId;
|
||||
_shuttleEntity = coordinates?.EntityId;
|
||||
RadarScreen.SetMatrix(coordinates, angle);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
||||
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();
|
||||
_destinations.Clear();
|
||||
@@ -183,14 +183,15 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
||||
|
||||
foreach (var dock in docks)
|
||||
{
|
||||
var grid = _docks.GetOrNew(dock.Coordinates.EntityId);
|
||||
var grid = _docks.GetOrNew(dock.Coordinates.NetEntity);
|
||||
grid.Add(dock);
|
||||
}
|
||||
|
||||
DockPorts.DisposeAllChildren();
|
||||
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;
|
||||
|
||||
@@ -233,7 +234,7 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
||||
|
||||
private void OnDockMouseEntered(GUIMouseHoverEventArgs obj, DockingInterfaceState state)
|
||||
{
|
||||
RadarScreen.HighlightedDock = state.Entity;
|
||||
RadarScreen.HighlightedDock = _entManager.GetEntity(state.Entity);
|
||||
}
|
||||
|
||||
private void OnDockMouseExited(GUIMouseHoverEventArgs obj, DockingInterfaceState state)
|
||||
@@ -246,8 +247,6 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
||||
/// </summary>
|
||||
private void OnDockToggled(BaseButton.ButtonEventArgs obj, DockingInterfaceState state)
|
||||
{
|
||||
var ent = state.Entity;
|
||||
|
||||
if (_selectedDock != null)
|
||||
{
|
||||
// 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
|
||||
{
|
||||
if (_shuttleUid != null)
|
||||
if (_shuttleEntity != null)
|
||||
{
|
||||
DockingScreen.Coordinates = state.Coordinates;
|
||||
DockingScreen.Coordinates = _entManager.GetCoordinates(state.Coordinates);
|
||||
DockingScreen.Angle = state.Angle;
|
||||
}
|
||||
else
|
||||
@@ -288,9 +287,9 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
||||
UndockButton.Disabled = false;
|
||||
RadarScreen.Visible = false;
|
||||
DockingScreen.Visible = true;
|
||||
DockingScreen.ViewedDock = ent;
|
||||
StartAutodockPressed?.Invoke(ent);
|
||||
DockingScreen.GridEntity = _shuttleUid;
|
||||
DockingScreen.ViewedDock = state.Entity;
|
||||
StartAutodockPressed?.Invoke(state.Entity);
|
||||
DockingScreen.GridEntity = _shuttleEntity;
|
||||
_selectedDock = obj.Button;
|
||||
}
|
||||
}
|
||||
@@ -310,13 +309,13 @@ public sealed partial class ShuttleConsoleWindow : FancyWindow,
|
||||
{
|
||||
base.Draw(handle);
|
||||
|
||||
if (!_entManager.TryGetComponent<PhysicsComponent>(_shuttleUid, out var gridBody) ||
|
||||
!_entManager.TryGetComponent<TransformComponent>(_shuttleUid, out var gridXform))
|
||||
if (!_entManager.TryGetComponent<PhysicsComponent>(_shuttleEntity, out var gridBody) ||
|
||||
!_entManager.TryGetComponent<TransformComponent>(_shuttleEntity, out var gridXform))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_entManager.TryGetComponent<MetaDataComponent>(_shuttleUid, out var metadata) && metadata.EntityPaused)
|
||||
if (_entManager.TryGetComponent<MetaDataComponent>(_shuttleEntity, out var metadata) && metadata.EntityPaused)
|
||||
{
|
||||
FTLTime += _timing.FrameTime;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public sealed class BorgBoundUserInterface : BoundUserInterface
|
||||
|
||||
_menu.RemoveModuleButtonPressed += module =>
|
||||
{
|
||||
SendMessage(new BorgRemoveModuleBuiMessage(module));
|
||||
SendMessage(new BorgRemoveModuleBuiMessage(EntMan.GetNetEntity(module)));
|
||||
};
|
||||
|
||||
_menu.OnClose += Close;
|
||||
|
||||
@@ -6,6 +6,6 @@ public sealed class TimedDespawnSystem : SharedTimedDespawnSystem
|
||||
{
|
||||
protected override bool CanDelete(EntityUid uid)
|
||||
{
|
||||
return uid.IsClientSide();
|
||||
return IsClientSide(uid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ public sealed class StationSystem : EntitySystem
|
||||
private void StationsUpdated(StationsUpdatedEvent ev)
|
||||
{
|
||||
_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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public sealed class GeneralStationRecordConsoleBoundUserInterface : BoundUserInt
|
||||
|
||||
private void OnKeySelected(StationRecordKey? key)
|
||||
{
|
||||
SendMessage(new SelectGeneralStationRecord(key));
|
||||
SendMessage(new SelectGeneralStationRecord(EntMan.System<SharedStationRecordsSystem>().Convert(key)));
|
||||
}
|
||||
|
||||
private void OnFiltersChanged(
|
||||
|
||||
@@ -123,7 +123,7 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
|
||||
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.ClearSelected();
|
||||
@@ -134,7 +134,7 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
|
||||
{
|
||||
var item = RecordListing.AddItem(name);
|
||||
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;
|
||||
}
|
||||
|
||||
7
Content.Client/StationRecords/StationRecordsSystem.cs
Normal file
7
Content.Client/StationRecords/StationRecordsSystem.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Content.Shared.StationRecords;
|
||||
|
||||
namespace Content.Client.StationRecords;
|
||||
|
||||
public sealed class StationRecordsSystem : SharedStationRecordsSystem
|
||||
{
|
||||
}
|
||||
@@ -54,7 +54,7 @@ namespace Content.Client.Storage
|
||||
|
||||
if (args.Event.Function == EngineKeyFunctions.UIClick)
|
||||
{
|
||||
SendMessage(new StorageInteractWithItemEvent(entity));
|
||||
SendMessage(new StorageInteractWithItemEvent(EntMan.GetNetEntity(entity)));
|
||||
}
|
||||
else if (EntMan.EntityExists(entity))
|
||||
{
|
||||
@@ -76,11 +76,11 @@ namespace Content.Client.Storage
|
||||
else if (args.Function == ContentKeyFunctions.ActivateItemInWorld)
|
||||
{
|
||||
EntMan.EntityNetManager?.SendSystemNetworkMessage(
|
||||
new InteractInventorySlotEvent(entity, altInteract: false));
|
||||
new InteractInventorySlotEvent(EntMan.GetNetEntity(entity), altInteract: false));
|
||||
}
|
||||
else if (args.Function == ContentKeyFunctions.AltActivateItemInWorld)
|
||||
{
|
||||
EntMan.RaisePredictiveEvent(new InteractInventorySlotEvent(entity, altInteract: true));
|
||||
EntMan.RaisePredictiveEvent(new InteractInventorySlotEvent(EntMan.GetNetEntity(entity), altInteract: true));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -19,18 +19,20 @@ public sealed class StorageSystem : EntitySystem
|
||||
/// <param name="msg"></param>
|
||||
public void HandleAnimatingInsertingEntities(AnimateInsertingEntitiesEvent msg)
|
||||
{
|
||||
if (!TryComp(msg.Storage, out ClientStorageComponent? storage))
|
||||
var store = GetEntity(msg.Storage);
|
||||
|
||||
if (!HasComp<ClientStorageComponent>(store))
|
||||
return;
|
||||
|
||||
TryComp(msg.Storage, out TransformComponent? transformComp);
|
||||
TryComp(store, out TransformComponent? transformComp);
|
||||
|
||||
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];
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Content.Client.Storage.UI
|
||||
/// </summary>
|
||||
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);
|
||||
|
||||
//Sets information about entire storage container current capacity
|
||||
|
||||
@@ -80,7 +80,9 @@ public sealed class SurveillanceCameraMonitorBoundUserInterface : BoundUserInter
|
||||
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);
|
||||
|
||||
@@ -95,17 +97,17 @@ public sealed class SurveillanceCameraMonitorBoundUserInterface : BoundUserInter
|
||||
{
|
||||
if (_currentCamera == null)
|
||||
{
|
||||
_eyeLerpingSystem.AddEye(cast.ActiveCamera.Value);
|
||||
_currentCamera = cast.ActiveCamera;
|
||||
_eyeLerpingSystem.AddEye(active.Value);
|
||||
_currentCamera = active;
|
||||
}
|
||||
else if (_currentCamera != cast.ActiveCamera)
|
||||
else if (_currentCamera != active)
|
||||
{
|
||||
_eyeLerpingSystem.RemoveEye(_currentCamera.Value);
|
||||
_eyeLerpingSystem.AddEye(cast.ActiveCamera.Value);
|
||||
_currentCamera = cast.ActiveCamera;
|
||||
_eyeLerpingSystem.AddEye(active.Value);
|
||||
_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);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace Content.Client.Tabletop
|
||||
// Only send new position to server when Delay is reached
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -125,15 +125,15 @@ namespace Content.Client.Tabletop
|
||||
// Close the currently opened window, if it exists
|
||||
_window?.Close();
|
||||
|
||||
_table = msg.TableUid;
|
||||
_table = GetEntity(msg.TableUid);
|
||||
|
||||
// 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 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;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace Content.Client.Tabletop
|
||||
{
|
||||
if (_table != null)
|
||||
{
|
||||
RaiseNetworkEvent(new TabletopStopPlayingEvent(_table.Value));
|
||||
RaiseNetworkEvent(new TabletopStopPlayingEvent(GetNetEntity(_table.Value)));
|
||||
}
|
||||
|
||||
StopDragging();
|
||||
@@ -182,9 +182,11 @@ namespace Content.Client.Tabletop
|
||||
{
|
||||
if (_draggedEntity != null && _table != null)
|
||||
{
|
||||
var ev = new TabletopRequestTakeOut();
|
||||
ev.Entity = _draggedEntity.Value;
|
||||
ev.TableUid = _table.Value;
|
||||
var ev = new TabletopRequestTakeOut
|
||||
{
|
||||
Entity = GetNetEntity(_draggedEntity.Value),
|
||||
TableUid = GetNetEntity(_table.Value)
|
||||
};
|
||||
RaiseNetworkEvent(ev);
|
||||
}
|
||||
return false;
|
||||
@@ -196,8 +198,10 @@ namespace Content.Client.Tabletop
|
||||
if (_playerManager.LocalPlayer is not {ControlledEntity: { } playerEntity})
|
||||
return false;
|
||||
|
||||
var entity = args.EntityUid;
|
||||
|
||||
// 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;
|
||||
}
|
||||
@@ -208,7 +212,7 @@ namespace Content.Client.Tabletop
|
||||
return false;
|
||||
}
|
||||
|
||||
StartDragging(args.EntityUid, viewport);
|
||||
StartDragging(entity, viewport);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -247,7 +251,7 @@ namespace Content.Client.Tabletop
|
||||
/// <param name="viewport">The viewport in which we are dragging.</param>
|
||||
private void StartDragging(EntityUid draggedEntity, ScalingViewport viewport)
|
||||
{
|
||||
RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(draggedEntity, true));
|
||||
RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(GetNetEntity(draggedEntity), true));
|
||||
|
||||
_draggedEntity = draggedEntity;
|
||||
_viewport = viewport;
|
||||
@@ -262,8 +266,8 @@ namespace Content.Client.Tabletop
|
||||
// Set the dragging player on the component to noone
|
||||
if (broadcast && _draggedEntity != null && EntityManager.HasComponent<TabletopDraggableComponent>(_draggedEntity.Value))
|
||||
{
|
||||
RaisePredictiveEvent(new TabletopMoveEvent(_draggedEntity.Value, Transform(_draggedEntity.Value).MapPosition, _table!.Value));
|
||||
RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(_draggedEntity.Value, false));
|
||||
RaisePredictiveEvent(new TabletopMoveEvent(GetNetEntity(_draggedEntity.Value), Transform(_draggedEntity.Value).MapPosition, GetNetEntity(_table!.Value)));
|
||||
RaisePredictiveEvent(new TabletopDraggingPlayerChangedEvent(GetNetEntity(_draggedEntity.Value), false));
|
||||
}
|
||||
|
||||
_draggedEntity = null;
|
||||
|
||||
@@ -240,7 +240,7 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
_actionsSystem.PerformAction(user, actionComp, actionId, action, action.Event, _timing.CurTime);
|
||||
}
|
||||
else
|
||||
EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(actionId, coords));
|
||||
EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(EntityManager.GetNetEntity(actionId), EntityManager.GetNetCoordinates(coords)));
|
||||
|
||||
if (!action.Repeat)
|
||||
StopTargeting();
|
||||
@@ -253,7 +253,9 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
if (_actionsSystem == null)
|
||||
return false;
|
||||
|
||||
if (!_actionsSystem.ValidateEntityTarget(user, args.EntityUid, action))
|
||||
var entity = args.EntityUid;
|
||||
|
||||
if (!_actionsSystem.ValidateEntityTarget(user, entity, action))
|
||||
{
|
||||
if (action.DeselectOnMiss)
|
||||
StopTargeting();
|
||||
@@ -265,14 +267,14 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
{
|
||||
if (action.Event != null)
|
||||
{
|
||||
action.Event.Target = args.EntityUid;
|
||||
action.Event.Target = entity;
|
||||
action.Event.Performer = user;
|
||||
}
|
||||
|
||||
_actionsSystem.PerformAction(user, actionComp, actionId, action, action.Event, _timing.CurTime);
|
||||
}
|
||||
else
|
||||
EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(actionId, args.EntityUid));
|
||||
EntityManager.RaisePredictiveEvent(new RequestPerformActionEvent(EntityManager.GetNetEntity(actionId), EntityManager.GetNetEntity(args.EntityUid)));
|
||||
|
||||
if (!action.Repeat)
|
||||
StopTargeting();
|
||||
@@ -741,9 +743,11 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
{
|
||||
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);
|
||||
}
|
||||
else if (action.Icon != null)
|
||||
@@ -958,11 +962,13 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
SelectingTargetFor = actionId;
|
||||
|
||||
// override "held-item" overlay
|
||||
var provider = action.Provider;
|
||||
|
||||
if (action.TargetingIndicator && _overlays.TryGetOverlay<ShowHandItemOverlay>(out var handOverlay))
|
||||
{
|
||||
if (action.ItemIconStyle == ItemActionIconStyle.BigItem && action.Provider != null)
|
||||
{
|
||||
handOverlay.EntityOverride = action.Provider;
|
||||
handOverlay.EntityOverride = provider;
|
||||
}
|
||||
else if (action.Toggled && action.IconOn != null)
|
||||
handOverlay.IconOverride = _spriteSystem.Frame0(action.IconOn);
|
||||
@@ -979,9 +985,10 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
return;
|
||||
|
||||
Func<EntityUid, bool>? predicate = null;
|
||||
var attachedEnt = entityAction.AttachedEntity;
|
||||
|
||||
if (!entityAction.CanTargetSelf)
|
||||
predicate = e => e != entityAction.AttachedEntity;
|
||||
predicate = e => e != attachedEnt;
|
||||
|
||||
var range = entityAction.CheckCanAccess ? action.Range : -1;
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ public sealed class ChatUIController : UIController
|
||||
[Dependency] private readonly IClientAdminManager _admin = default!;
|
||||
[Dependency] private readonly IChatManager _manager = default!;
|
||||
[Dependency] private readonly IConfigurationManager _config = default!;
|
||||
[Dependency] private readonly IEntityManager _entities = default!;
|
||||
[Dependency] private readonly IEyeManager _eye = default!;
|
||||
[Dependency] private readonly IInputManager _input = default!;
|
||||
[Dependency] private readonly IClientNetManager _net = default!;
|
||||
@@ -390,7 +389,9 @@ public sealed class ChatUIController : UIController
|
||||
|
||||
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);
|
||||
return;
|
||||
@@ -401,14 +402,14 @@ public sealed class ChatUIController : UIController
|
||||
|
||||
foreach (var message in messages)
|
||||
{
|
||||
EnqueueSpeechBubble(msg.SenderEntity, message, speechType);
|
||||
EnqueueSpeechBubble(ent, message, speechType);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateSpeechBubble(EntityUid entity, SpeechBubbleData speechData)
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -445,7 +446,7 @@ public sealed class ChatUIController : UIController
|
||||
private void EnqueueSpeechBubble(EntityUid entity, string contents, SpeechBubble.SpeechType speechType)
|
||||
{
|
||||
// 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;
|
||||
|
||||
if (!_queuedSpeechBubbles.TryGetValue(entity, out var queueData))
|
||||
@@ -562,7 +563,7 @@ public sealed class ChatUIController : UIController
|
||||
|
||||
foreach (var (entity, queueData) in _queuedSpeechBubbles.ShallowClone())
|
||||
{
|
||||
if (!_entities.EntityExists(entity))
|
||||
if (!EntityManager.EntityExists(entity))
|
||||
{
|
||||
_queuedSpeechBubbles.Remove(entity);
|
||||
continue;
|
||||
@@ -593,14 +594,14 @@ public sealed class ChatUIController : UIController
|
||||
var predicate = static (EntityUid uid, (EntityUid compOwner, EntityUid? attachedEntity) data)
|
||||
=> uid == data.compOwner || uid == data.attachedEntity;
|
||||
var playerPos = player != null
|
||||
? _entities.GetComponent<TransformComponent>(player.Value).MapPosition
|
||||
? EntityManager.GetComponent<TransformComponent>(player.Value).MapPosition
|
||||
: MapCoordinates.Nullspace;
|
||||
|
||||
var occluded = player != null && _examine.IsOccluded(player.Value);
|
||||
|
||||
foreach (var (ent, bubs) in _activeSpeechBubbles)
|
||||
{
|
||||
if (_entities.Deleted(ent))
|
||||
if (EntityManager.Deleted(ent))
|
||||
{
|
||||
SetBubbles(bubs, false);
|
||||
continue;
|
||||
@@ -612,7 +613,7 @@ public sealed class ChatUIController : UIController
|
||||
continue;
|
||||
}
|
||||
|
||||
var otherPos = _entities.GetComponent<TransformComponent>(ent).MapPosition;
|
||||
var otherPos = EntityManager.GetComponent<TransformComponent>(ent).MapPosition;
|
||||
|
||||
if (occluded && !ExamineSystemShared.InRangeUnOccluded(
|
||||
playerPos,
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls
|
||||
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
|
||||
_warps = warps
|
||||
@@ -33,7 +33,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls
|
||||
? Loc.GetString("ghost-target-window-current-button", ("name", w.DisplayName))
|
||||
: w.DisplayName;
|
||||
|
||||
return (name, w.Entity);
|
||||
return (name, entManager.GetEntity(w.Entity));
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
|
||||
[UsedImplicitly]
|
||||
public sealed class MakeGhostRoleEui : BaseEui
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
||||
|
||||
@@ -32,7 +33,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
|
||||
return;
|
||||
}
|
||||
|
||||
_window.SetEntity(uiState.EntityUid);
|
||||
_window.SetEntity(_entManager.GetEntity(uiState.EntityUid));
|
||||
}
|
||||
|
||||
public override void Opened()
|
||||
|
||||
@@ -96,7 +96,7 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
|
||||
if (Gui?.TargetWindow is not { } window)
|
||||
return;
|
||||
|
||||
window.UpdateWarps(msg.Warps);
|
||||
window.UpdateWarps(msg.Warps, EntityManager);
|
||||
window.Populate();
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
|
||||
|
||||
private void OnWarpClicked(EntityUid player)
|
||||
{
|
||||
var msg = new GhostWarpToTargetRequestEvent(player);
|
||||
var msg = new GhostWarpToTargetRequestEvent(EntityManager.GetNetEntity(player));
|
||||
_net.SendSystemNetworkMessage(msg);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user