Content update for NetEntities (#18935)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
|
||||
[UISystemDependency] private readonly ClientInventorySystem _inventorySystem = default!;
|
||||
[UISystemDependency] private readonly HandsSystem _handsSystem = default!;
|
||||
[UISystemDependency] private readonly ContainerSystem _container = default!;
|
||||
|
||||
private EntityUid? _playerUid;
|
||||
private InventorySlotsComponent? _playerInventory;
|
||||
@@ -281,7 +282,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
var hoverEntity = _entities.SpawnEntity("hoverentity", MapCoordinates.Nullspace);
|
||||
var hoverSprite = _entities.GetComponent<SpriteComponent>(hoverEntity);
|
||||
var fits = _inventorySystem.CanEquip(player.Value, held, control.SlotName, out _, slotDef) &&
|
||||
container.CanInsert(held, _entities);
|
||||
_container.CanInsert(held, container);
|
||||
|
||||
hoverSprite.CopyFrom(sprite);
|
||||
hoverSprite.Color = fits ? new Color(0, 255, 0, 127) : new Color(255, 0, 0, 127);
|
||||
|
||||
Reference in New Issue
Block a user