Fix 3000 errors
This commit is contained in:
@@ -18,7 +18,7 @@ namespace Content.Client.AI
|
|||||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||||
|
|
||||||
private AiDebugMode _tooltips = AiDebugMode.None;
|
private AiDebugMode _tooltips = AiDebugMode.None;
|
||||||
private readonly Dictionary<IEntity, PanelContainer> _aiBoxes = new();
|
private readonly Dictionary<EntityUid, PanelContainer> _aiBoxes = new();
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
@@ -37,7 +37,7 @@ namespace Content.Client.AI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var deletedEntities = new List<IEntity>(0);
|
var deletedEntities = new List<EntityUid>(0);
|
||||||
foreach (var (entity, panel) in _aiBoxes)
|
foreach (var (entity, panel) in _aiBoxes)
|
||||||
{
|
{
|
||||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Deleted)
|
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||||
@@ -78,8 +78,7 @@ namespace Content.Client.AI
|
|||||||
if ((_tooltips & AiDebugMode.Thonk) != 0)
|
if ((_tooltips & AiDebugMode.Thonk) != 0)
|
||||||
{
|
{
|
||||||
// I guess if it's out of range we don't know about it?
|
// I guess if it's out of range we don't know about it?
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entity = message.EntityUid;
|
||||||
var entity = entityManager.GetEntity(message.EntityUid);
|
|
||||||
TryCreatePanel(entity);
|
TryCreatePanel(entity);
|
||||||
|
|
||||||
// Probably shouldn't access by index but it's a debugging tool so eh
|
// Probably shouldn't access by index but it's a debugging tool so eh
|
||||||
@@ -95,8 +94,7 @@ namespace Content.Client.AI
|
|||||||
{
|
{
|
||||||
if ((_tooltips & AiDebugMode.Paths) != 0)
|
if ((_tooltips & AiDebugMode.Paths) != 0)
|
||||||
{
|
{
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entity = message.EntityUid;
|
||||||
var entity = entityManager.GetEntity(message.EntityUid);
|
|
||||||
TryCreatePanel(entity);
|
TryCreatePanel(entity);
|
||||||
|
|
||||||
var label = (Label) _aiBoxes[entity].GetChild(0).GetChild(1);
|
var label = (Label) _aiBoxes[entity].GetChild(0).GetChild(1);
|
||||||
@@ -110,8 +108,7 @@ namespace Content.Client.AI
|
|||||||
{
|
{
|
||||||
if ((_tooltips & AiDebugMode.Paths) != 0)
|
if ((_tooltips & AiDebugMode.Paths) != 0)
|
||||||
{
|
{
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entity = message.EntityUid;
|
||||||
var entity = entityManager.GetEntity(message.EntityUid);
|
|
||||||
TryCreatePanel(entity);
|
TryCreatePanel(entity);
|
||||||
|
|
||||||
var label = (Label) _aiBoxes[entity].GetChild(0).GetChild(1);
|
var label = (Label) _aiBoxes[entity].GetChild(0).GetChild(1);
|
||||||
@@ -154,7 +151,7 @@ namespace Content.Client.AI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TryCreatePanel(IEntity entity)
|
private bool TryCreatePanel(EntityUid entity)
|
||||||
{
|
{
|
||||||
if (!_aiBoxes.ContainsKey(entity))
|
if (!_aiBoxes.ContainsKey(entity))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ namespace Content.Client.AI
|
|||||||
private void DrawCachedRegions(DrawingHandleScreen screenHandle, Box2 viewport)
|
private void DrawCachedRegions(DrawingHandleScreen screenHandle, Box2 viewport)
|
||||||
{
|
{
|
||||||
var attachedEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
var attachedEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
if (attachedEntity == null || !CachedRegions.TryGetValue(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attachedEntity).GridID, out var entityRegions))
|
if (attachedEntity == default || !CachedRegions.TryGetValue(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attachedEntity.Value).GridID, out var entityRegions))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -305,7 +305,7 @@ namespace Content.Client.AI
|
|||||||
screenTile.X + 15.0f,
|
screenTile.X + 15.0f,
|
||||||
screenTile.Y + 15.0f);
|
screenTile.Y + 15.0f);
|
||||||
|
|
||||||
screenHandle.DrawRect(box, _cachedRegionColors[IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attachedEntity).GridID][region]);
|
screenHandle.DrawRect(box, _cachedRegionColors[IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attachedEntity.Value).GridID][region]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -336,7 +336,7 @@ namespace Content.Client.AI
|
|||||||
private void DrawRegions(DrawingHandleScreen screenHandle, Box2 viewport)
|
private void DrawRegions(DrawingHandleScreen screenHandle, Box2 viewport)
|
||||||
{
|
{
|
||||||
var attachedEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
var attachedEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
if (attachedEntity == null || !Regions.TryGetValue(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attachedEntity).GridID, out var entityRegions))
|
if (attachedEntity == default || !Regions.TryGetValue(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attachedEntity.Value).GridID, out var entityRegions))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -356,7 +356,7 @@ namespace Content.Client.AI
|
|||||||
screenTile.X + 15.0f,
|
screenTile.X + 15.0f,
|
||||||
screenTile.Y + 15.0f);
|
screenTile.Y + 15.0f);
|
||||||
|
|
||||||
screenHandle.DrawRect(box, _regionColors[IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attachedEntity).GridID][chunk][region]);
|
screenHandle.DrawRect(box, _regionColors[IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(attachedEntity.Value).GridID][chunk][region]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Content.Client.AME.Visualizers
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class AMEControllerVisualizer : AppearanceVisualizer
|
public class AMEControllerVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity);
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Content.Client.AME.Visualizers
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class AMEVisualizer : AppearanceVisualizer
|
public class AMEVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity);
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity);
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace Content.Client.Actions
|
|||||||
return new((in PointerInputCmdHandler.PointerInputCmdArgs args) =>
|
return new((in PointerInputCmdHandler.PointerInputCmdArgs args) =>
|
||||||
{
|
{
|
||||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
if (playerEntity == null ||
|
if (playerEntity == default ||
|
||||||
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return false;
|
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return false;
|
||||||
|
|
||||||
actionsComponent.HandleHotbarKeybind(slot, args);
|
actionsComponent.HandleHotbarKeybind(slot, args);
|
||||||
@@ -98,7 +98,7 @@ namespace Content.Client.Actions
|
|||||||
return new((in PointerInputCmdHandler.PointerInputCmdArgs args) =>
|
return new((in PointerInputCmdHandler.PointerInputCmdArgs args) =>
|
||||||
{
|
{
|
||||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
if (playerEntity == null ||
|
if (playerEntity == default ||
|
||||||
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return false;
|
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return false;
|
||||||
|
|
||||||
actionsComponent.HandleChangeHotbarKeybind(hotbar, args);
|
actionsComponent.HandleChangeHotbarKeybind(hotbar, args);
|
||||||
@@ -110,7 +110,7 @@ namespace Content.Client.Actions
|
|||||||
private bool TargetingOnUse(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
private bool TargetingOnUse(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||||
{
|
{
|
||||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
if (playerEntity == null ||
|
if (playerEntity == default ||
|
||||||
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return false;
|
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return false;
|
||||||
|
|
||||||
return actionsComponent.TargetingOnUse(args);
|
return actionsComponent.TargetingOnUse(args);
|
||||||
@@ -119,7 +119,7 @@ namespace Content.Client.Actions
|
|||||||
private void ToggleActionsMenu()
|
private void ToggleActionsMenu()
|
||||||
{
|
{
|
||||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
if (playerEntity == null ||
|
if (playerEntity == default ||
|
||||||
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return;
|
!EntityManager.TryGetComponent<ClientActionsComponent?>(playerEntity.Value, out var actionsComponent)) return;
|
||||||
|
|
||||||
actionsComponent.ToggleActionsMenu();
|
actionsComponent.ToggleActionsMenu();
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using Content.Client.Actions.Assignments;
|
using Content.Client.Actions.Assignments;
|
||||||
using Content.Client.Actions.UI;
|
using Content.Client.Actions.UI;
|
||||||
using Content.Client.Hands;
|
|
||||||
using Content.Client.Inventory;
|
|
||||||
using Content.Client.Items.Managers;
|
using Content.Client.Items.Managers;
|
||||||
using Content.Shared.Actions.Components;
|
using Content.Shared.Actions.Components;
|
||||||
using Content.Shared.Actions.Prototypes;
|
using Content.Shared.Actions.Prototypes;
|
||||||
@@ -226,7 +224,7 @@ namespace Content.Client.Actions
|
|||||||
/// Highlights the item slot (inventory or hand) that contains this item
|
/// Highlights the item slot (inventory or hand) that contains this item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
public void HighlightItemSlot(IEntity item)
|
public void HighlightItemSlot(EntityUid item)
|
||||||
{
|
{
|
||||||
StopHighlightingItemSlots();
|
StopHighlightingItemSlots();
|
||||||
|
|
||||||
@@ -236,7 +234,7 @@ namespace Content.Client.Actions
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stops highlighting any item slots we are currently highlighting.
|
/// Stops highlighting any item slots we are currently highlighting.
|
||||||
/// </summary>
|
/// </summary>H
|
||||||
public void StopHighlightingItemSlots()
|
public void StopHighlightingItemSlots()
|
||||||
{
|
{
|
||||||
if (_highlightedEntity == default)
|
if (_highlightedEntity == default)
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace Content.Client.Actions.UI
|
|||||||
/// Item the action is provided by, only valid if Action is an ItemActionPrototype. May be null
|
/// Item the action is provided by, only valid if Action is an ItemActionPrototype. May be null
|
||||||
/// if the item action is not yet tied to an item.
|
/// if the item action is not yet tied to an item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEntity? Item { get; private set; }
|
public EntityUid Item { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the action in this slot should be shown as toggled on. Separate from Depressed.
|
/// Whether the action in this slot should be shown as toggled on. Separate from Depressed.
|
||||||
@@ -231,7 +231,7 @@ namespace Content.Client.Actions.UI
|
|||||||
{
|
{
|
||||||
ActionPrototype actionPrototype => new ActionAttempt(actionPrototype),
|
ActionPrototype actionPrototype => new ActionAttempt(actionPrototype),
|
||||||
ItemActionPrototype itemActionPrototype =>
|
ItemActionPrototype itemActionPrototype =>
|
||||||
(Item != null && IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemActionsComponent?>(Item, out var itemActions)) ?
|
(Item != default && IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemActionsComponent?>(Item, out var itemActions)) ?
|
||||||
new ItemActionAttempt(itemActionPrototype, Item, itemActions) : null,
|
new ItemActionAttempt(itemActionPrototype, Item, itemActions) : null,
|
||||||
_ => null
|
_ => null
|
||||||
};
|
};
|
||||||
@@ -245,7 +245,7 @@ namespace Content.Client.Actions.UI
|
|||||||
_beingHovered = true;
|
_beingHovered = true;
|
||||||
DrawModeChanged();
|
DrawModeChanged();
|
||||||
if (Action is not ItemActionPrototype) return;
|
if (Action is not ItemActionPrototype) return;
|
||||||
if (Item == null) return;
|
if (Item == default) return;
|
||||||
_actionsComponent.HighlightItemSlot(Item);
|
_actionsComponent.HighlightItemSlot(Item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ namespace Content.Client.Actions.UI
|
|||||||
if (Action != null && Action == action) return;
|
if (Action != null && Action == action) return;
|
||||||
|
|
||||||
Action = action;
|
Action = action;
|
||||||
Item = null;
|
Item = default;
|
||||||
_depressed = false;
|
_depressed = false;
|
||||||
ToggledOn = false;
|
ToggledOn = false;
|
||||||
ActionEnabled = actionEnabled;
|
ActionEnabled = actionEnabled;
|
||||||
@@ -395,10 +395,10 @@ namespace Content.Client.Actions.UI
|
|||||||
public void Assign(ItemActionPrototype action)
|
public void Assign(ItemActionPrototype action)
|
||||||
{
|
{
|
||||||
// already assigned
|
// already assigned
|
||||||
if (Action != null && Action == action && Item == null) return;
|
if (Action != null && Action == action && Item == default) return;
|
||||||
|
|
||||||
Action = action;
|
Action = action;
|
||||||
Item = null;
|
Item = default;
|
||||||
_depressed = false;
|
_depressed = false;
|
||||||
ToggledOn = false;
|
ToggledOn = false;
|
||||||
ActionEnabled = false;
|
ActionEnabled = false;
|
||||||
@@ -415,7 +415,7 @@ namespace Content.Client.Actions.UI
|
|||||||
/// <param name="action">action to assign</param>
|
/// <param name="action">action to assign</param>
|
||||||
/// <param name="item">item the action is provided by</param>
|
/// <param name="item">item the action is provided by</param>
|
||||||
/// <param name="actionEnabled">whether action should initially appear enable or disabled</param>
|
/// <param name="actionEnabled">whether action should initially appear enable or disabled</param>
|
||||||
public void Assign(ItemActionPrototype action, IEntity item, bool actionEnabled)
|
public void Assign(ItemActionPrototype action, EntityUid item, bool actionEnabled)
|
||||||
{
|
{
|
||||||
// already assigned
|
// already assigned
|
||||||
if (Action != null && Action == action && Item == item) return;
|
if (Action != null && Action == action && Item == item) return;
|
||||||
@@ -439,7 +439,7 @@ namespace Content.Client.Actions.UI
|
|||||||
{
|
{
|
||||||
if (!HasAssignment) return;
|
if (!HasAssignment) return;
|
||||||
Action = null;
|
Action = null;
|
||||||
Item = null;
|
Item = default;
|
||||||
ToggledOn = false;
|
ToggledOn = false;
|
||||||
_depressed = false;
|
_depressed = false;
|
||||||
Cooldown = null;
|
Cooldown = null;
|
||||||
@@ -502,7 +502,7 @@ namespace Content.Client.Actions.UI
|
|||||||
SetActionIcon(Action.Icon.Frame0());
|
SetActionIcon(Action.Icon.Frame0());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Item != null)
|
if (Item != default)
|
||||||
{
|
{
|
||||||
SetItemIcon(IoCManager.Resolve<IEntityManager>().TryGetComponent<ISpriteComponent?>(Item, out var spriteComponent) ? spriteComponent : null);
|
SetItemIcon(IoCManager.Resolve<IEntityManager>().TryGetComponent<ISpriteComponent?>(Item, out var spriteComponent) ? spriteComponent : null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -378,10 +378,10 @@ namespace Content.Client.Actions.UI
|
|||||||
private void UpdateActionSlot(EntityUid item, ItemActionType itemActionType, ActionSlot actionSlot,
|
private void UpdateActionSlot(EntityUid item, ItemActionType itemActionType, ActionSlot actionSlot,
|
||||||
ActionAssignment? assignedActionType)
|
ActionAssignment? assignedActionType)
|
||||||
{
|
{
|
||||||
if (!_entityManager.TryGetEntity(item, out var itemEntity)) return;
|
if (!_entityManager.EntityExists(item)) return;
|
||||||
if (_actionManager.TryGet(itemActionType, out var action))
|
if (_actionManager.TryGet(itemActionType, out var action))
|
||||||
{
|
{
|
||||||
actionSlot.Assign(action, itemEntity, true);
|
actionSlot.Assign(action, item, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -420,7 +420,7 @@ namespace Content.Client.Actions.UI
|
|||||||
|
|
||||||
// if we are targeting with an action now on cooldown, stop targeting if we should
|
// if we are targeting with an action now on cooldown, stop targeting if we should
|
||||||
if (SelectingTargetFor?.Action != null && SelectingTargetFor.Action == action &&
|
if (SelectingTargetFor?.Action != null && SelectingTargetFor.Action == action &&
|
||||||
SelectingTargetFor.Item == itemEntity &&
|
SelectingTargetFor.Item == item &&
|
||||||
actionState.IsOnCooldown(_gameTiming) && action.DeselectOnCooldown)
|
actionState.IsOnCooldown(_gameTiming) && action.DeselectOnCooldown)
|
||||||
{
|
{
|
||||||
StopTargeting();
|
StopTargeting();
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using Robust.Client.Graphics;
|
||||||
using Content.Shared.Administration.Events;
|
|
||||||
using Robust.Client.Graphics;
|
|
||||||
using Robust.Client.ResourceManagement;
|
using Robust.Client.ResourceManagement;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -36,7 +34,8 @@ namespace Content.Client.Administration
|
|||||||
foreach (var playerInfo in _system.PlayerList)
|
foreach (var playerInfo in _system.PlayerList)
|
||||||
{
|
{
|
||||||
// Otherwise the entity can not exist yet
|
// Otherwise the entity can not exist yet
|
||||||
if (!_entityManager.TryGetEntity(playerInfo.EntityUid, out var entity))
|
var entity = playerInfo.EntityUid;
|
||||||
|
if (!_entityManager.EntityExists(entity))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Content.Shared.Chemistry.Components;
|
using Content.Shared.Chemistry.Components;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.Console;
|
using Robust.Client.Console;
|
||||||
@@ -7,8 +9,6 @@ using Robust.Client.UserInterface.XAML;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Content.Client.Administration.UI.ManageSolutions
|
namespace Content.Client.Administration.UI.ManageSolutions
|
||||||
{
|
{
|
||||||
@@ -46,8 +46,8 @@ namespace Content.Client.Administration.UI.ManageSolutions
|
|||||||
{
|
{
|
||||||
_target = target;
|
_target = target;
|
||||||
|
|
||||||
var targetName = _entityManager.TryGetEntity(target, out var entity)
|
var targetName = _entityManager.EntityExists(target)
|
||||||
? IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName
|
? IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(target).EntityName
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
|
|
||||||
Title = Loc.GetString("admin-solutions-window-title", ("targetName", targetName));
|
Title = Loc.GetString("admin-solutions-window-title", ("targetName", targetName));
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
|||||||
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||||
foreach (var grid in _data)
|
foreach (var grid in _data)
|
||||||
{
|
{
|
||||||
IEntity? tempQualifier = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
var tempQualifier = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||||
var playerGrid = (tempQualifier != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier) : null).GridID;
|
var playerGrid = (tempQualifier != default ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier.Value) : null)?.GridID;
|
||||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Client.Atmos.EntitySystems;
|
using Content.Client.Atmos.EntitySystems;
|
||||||
using Content.Shared.Atmos;
|
|
||||||
using Content.Shared.Atmos.Prototypes;
|
using Content.Shared.Atmos.Prototypes;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
@@ -28,8 +27,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
|||||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||||
foreach (var grid in _gridData)
|
foreach (var grid in _gridData)
|
||||||
{
|
{
|
||||||
IEntity? tempQualifier = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
var tempQualifier = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||||
var playerGrid = (tempQualifier != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier) : null).GridID;
|
var playerGrid = (tempQualifier != default ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier.Value) : null)?.GridID;
|
||||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Client.Atmos.EntitySystems;
|
using Content.Client.Atmos.EntitySystems;
|
||||||
using Content.Shared.Atmos;
|
|
||||||
using Content.Shared.Atmos.Prototypes;
|
using Content.Shared.Atmos.Prototypes;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
@@ -28,8 +27,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
|||||||
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
_gridData = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||||
foreach (var grid in _gridData)
|
foreach (var grid in _gridData)
|
||||||
{
|
{
|
||||||
IEntity? tempQualifier = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
var tempQualifier = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||||
var playerGrid = (tempQualifier != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier) : null).GridID;
|
var playerGrid = (tempQualifier != default ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier.Value) : null)?.GridID;
|
||||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ namespace Content.Client.Administration.UI.Tabs.AtmosTab
|
|||||||
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
_data = IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0);
|
||||||
foreach (var grid in _data)
|
foreach (var grid in _data)
|
||||||
{
|
{
|
||||||
IEntity? tempQualifier = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
var tempQualifier = IoCManager.Resolve<IPlayerManager>().LocalPlayer?.ControlledEntity;
|
||||||
var playerGrid = (tempQualifier != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier) : null).GridID;
|
var playerGrid = (tempQualifier != default ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier.Value) : null)?.GridID;
|
||||||
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
GridOptions.AddItem($"{grid.Index} {(playerGrid == grid.Index ? " (Current)" : "")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Content.Client.Animations
|
|||||||
{
|
{
|
||||||
public static class ReusableAnimations
|
public static class ReusableAnimations
|
||||||
{
|
{
|
||||||
public static void AnimateEntityPickup(IEntity entity, EntityCoordinates initialPosition, Vector2 finalPosition)
|
public static void AnimateEntityPickup(EntityUid entity, EntityCoordinates initialPosition, Vector2 finalPosition)
|
||||||
{
|
{
|
||||||
var animatableClone = IoCManager.Resolve<IEntityManager>().SpawnEntity("clientsideclone", initialPosition);
|
var animatableClone = IoCManager.Resolve<IEntityManager>().SpawnEntity("clientsideclone", initialPosition);
|
||||||
string val = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName;
|
string val = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName;
|
||||||
@@ -28,7 +28,7 @@ namespace Content.Client.Animations
|
|||||||
|
|
||||||
var animations = IoCManager.Resolve<IEntityManager>().GetComponent<AnimationPlayerComponent>(animatableClone);
|
var animations = IoCManager.Resolve<IEntityManager>().GetComponent<AnimationPlayerComponent>(animatableClone);
|
||||||
animations.AnimationCompleted += (_) => {
|
animations.AnimationCompleted += (_) => {
|
||||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) animatableClone);
|
IoCManager.Resolve<IEntityManager>().DeleteEntity(animatableClone);
|
||||||
};
|
};
|
||||||
|
|
||||||
animations.Play(new Animation
|
animations.Play(new Animation
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
[DataField("layer")]
|
[DataField("layer")]
|
||||||
private int Layer { get; }
|
private int Layer { get; }
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Atmos.Visualizers
|
namespace Content.Client.Atmos.Visualizers
|
||||||
@@ -20,7 +21,8 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(component.TryGetData(DataKey, out bool enabled) && sprite.LayerMapTryGet(LayerMap, out var layer))
|
if(component.TryGetData(DataKey, out bool enabled) && sprite.LayerMapTryGet(LayerMap, out var layer))
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Atmos.Components;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -23,7 +22,7 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
[DataField("sprite")]
|
[DataField("sprite")]
|
||||||
private string? _sprite;
|
private string? _sprite;
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Atmos.Visualizers
|
namespace Content.Client.Atmos.Visualizers
|
||||||
@@ -18,7 +19,8 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
[DataField("insertedTankState")]
|
[DataField("insertedTankState")]
|
||||||
private readonly string _insertedTankState = string.Empty;
|
private readonly string _insertedTankState = string.Empty;
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
@@ -32,7 +32,8 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
[DataField("stateConnected")]
|
[DataField("stateConnected")]
|
||||||
private string? _stateConnected;
|
private string? _stateConnected;
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
@@ -30,7 +30,8 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,11 +37,12 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
Logger.Error($"{nameof(PipeConnectorVisualizer)} could not load to load RSI {rsiString}.");
|
Logger.Error($"{nameof(PipeConnectorVisualizer)} could not load to load RSI {rsiString}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ISpriteComponent?>(entity, out var sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent<ISpriteComponent?>(entity, out var sprite))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_connectorRsi == null)
|
if (_connectorRsi == null)
|
||||||
@@ -52,7 +53,7 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
sprite.LayerMapReserveBlank(layerKey);
|
sprite.LayerMapReserveBlank(layerKey);
|
||||||
var layer = sprite.LayerMapGet(layerKey);
|
var layer = sprite.LayerMapGet(layerKey);
|
||||||
sprite.LayerSetRSI(layer, _connectorRsi);
|
sprite.LayerSetRSI(layer, _connectorRsi);
|
||||||
var layerState = _baseState + ((PipeDirection) layerKey).ToString();
|
var layerState = _baseState + ((PipeDirection) layerKey);
|
||||||
sprite.LayerSetState(layer, layerState);
|
sprite.LayerSetState(layer, layerState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,10 +62,11 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent<TransformComponent>(out var xform))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent<TransformComponent>(component.Owner, out var xform))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent<ISpriteComponent>(out var sprite))
|
if (!entities.TryGetComponent<ISpriteComponent>(component.Owner, out var sprite))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!component.TryGetData(PipeColorVisuals.Color, out Color color))
|
if (!component.TryGetData(PipeColorVisuals.Color, out Color color))
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Atmos.Piping.Unary.Visuals;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Client.Atmos.Visualizers
|
namespace Content.Client.Atmos.Visualizers
|
||||||
{
|
{
|
||||||
@@ -18,7 +19,8 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!component.TryGetData(ScrubberVisuals.State, out ScrubberState state))
|
if (!component.TryGetData(ScrubberVisuals.State, out ScrubberState state))
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Atmos.Visuals;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Client.Atmos.Visualizers
|
namespace Content.Client.Atmos.Visualizers
|
||||||
{
|
{
|
||||||
@@ -17,7 +18,8 @@ namespace Content.Client.Atmos.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!component.TryGetData(VentPumpVisuals.State, out VentPumpState state))
|
if (!component.TryGetData(VentPumpVisuals.State, out VentPumpState state))
|
||||||
|
|||||||
@@ -90,17 +90,17 @@ namespace Content.Client.Audio
|
|||||||
_accumulator -= _cooldown;
|
_accumulator -= _cooldown;
|
||||||
|
|
||||||
var player = _playerManager.LocalPlayer?.ControlledEntity;
|
var player = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
if (player == null)
|
if (player == default)
|
||||||
{
|
{
|
||||||
ClearSounds();
|
ClearSounds();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(player).Coordinates;
|
var coordinates = EntityManager.GetComponent<TransformComponent>(player.Value).Coordinates;
|
||||||
|
|
||||||
foreach (var (comp, (stream, _)) in _playingSounds.ToArray())
|
foreach (var (comp, (stream, _)) in _playingSounds.ToArray())
|
||||||
{
|
{
|
||||||
if (!comp.Deleted && comp.Enabled && IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner).Coordinates.TryDistance(EntityManager, coordinates, out var range) &&
|
if (!comp.Deleted && comp.Enabled && EntityManager.GetComponent<TransformComponent>(comp.Owner).Coordinates.TryDistance(EntityManager, coordinates, out var range) &&
|
||||||
range <= comp.Range)
|
range <= comp.Range)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@@ -136,11 +136,11 @@ namespace Content.Client.Audio
|
|||||||
foreach (var entity in _lookup.GetEntitiesInRange(coordinates, _maxAmbientRange,
|
foreach (var entity in _lookup.GetEntitiesInRange(coordinates, _maxAmbientRange,
|
||||||
LookupFlags.Approximate | LookupFlags.IncludeAnchored))
|
LookupFlags.Approximate | LookupFlags.IncludeAnchored))
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out AmbientSoundComponent? ambientComp) ||
|
if (!EntityManager.TryGetComponent(entity, out AmbientSoundComponent? ambientComp) ||
|
||||||
_playingSounds.ContainsKey(ambientComp) ||
|
_playingSounds.ContainsKey(ambientComp) ||
|
||||||
!ambientComp.Enabled ||
|
!ambientComp.Enabled ||
|
||||||
// We'll also do this crude distance check because it's what we're doing in the active loop above.
|
// We'll also do this crude distance check because it's what we're doing in the active loop above.
|
||||||
!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates.TryDistance(EntityManager, coordinates, out var range) ||
|
!EntityManager.GetComponent<TransformComponent>(entity).Coordinates.TryDistance(EntityManager, coordinates, out var range) ||
|
||||||
range > ambientComp.Range - RangeBuffer)
|
range > ambientComp.Range - RangeBuffer)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Content.Client.Body.UI
|
|||||||
private BodyScannerDisplay? _display;
|
private BodyScannerDisplay? _display;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private IEntity? _entity;
|
private EntityUid _entity;
|
||||||
|
|
||||||
public BodyScannerBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) { }
|
public BodyScannerBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) { }
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ namespace Content.Client.Body.UI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetEntity(scannerState.Uid, out _entity))
|
if (!IoCManager.Resolve<IEntityManager>().EntityExists(scannerState.Uid))
|
||||||
{
|
{
|
||||||
throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner} at {IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Owner).MapPosition}");
|
throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner} at {IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner.Owner).MapPosition}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Shared.Body.Components;
|
using Content.Shared.Body.Components;
|
||||||
using Content.Shared.Body.Part;
|
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
@@ -14,7 +13,7 @@ namespace Content.Client.Body.UI
|
|||||||
{
|
{
|
||||||
public sealed class BodyScannerDisplay : SS14Window
|
public sealed class BodyScannerDisplay : SS14Window
|
||||||
{
|
{
|
||||||
private IEntity? _currentEntity;
|
private EntityUid _currentEntity;
|
||||||
private SharedBodyPartComponent? _currentBodyPart;
|
private SharedBodyPartComponent? _currentBodyPart;
|
||||||
|
|
||||||
public BodyScannerDisplay(BodyScannerBoundUserInterface owner)
|
public BodyScannerDisplay(BodyScannerBoundUserInterface owner)
|
||||||
@@ -103,7 +102,7 @@ namespace Content.Client.Body.UI
|
|||||||
|
|
||||||
private RichTextLabel MechanismInfoLabel { get; }
|
private RichTextLabel MechanismInfoLabel { get; }
|
||||||
|
|
||||||
public void UpdateDisplay(IEntity entity)
|
public void UpdateDisplay(EntityUid entity)
|
||||||
{
|
{
|
||||||
if(entity == null)
|
if(entity == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Content.Client.Botany
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class PlantHolderVisualizer : AppearanceVisualizer
|
public class PlantHolderVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Content.Client.Buckle
|
|||||||
_buckled = buckle.Buckled;
|
_buckled = buckle.Buckled;
|
||||||
LastEntityBuckledTo = buckle.LastEntityBuckledTo;
|
LastEntityBuckledTo = buckle.LastEntityBuckledTo;
|
||||||
DontCollide = buckle.DontCollide;
|
DontCollide = buckle.DontCollide;
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(OwnerUid, out SpriteComponent? ownerSprite))
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SpriteComponent? ownerSprite))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Cabinet;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Cabinet
|
namespace Content.Client.Cabinet
|
||||||
@@ -19,7 +20,8 @@ namespace Content.Client.Cabinet
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (component.Owner.TryGetComponent<SpriteComponent>(out var sprite)
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (entities.TryGetComponent(component.Owner, out SpriteComponent sprite)
|
||||||
&& component.TryGetData(ItemCabinetVisuals.IsOpen, out bool isOpen)
|
&& component.TryGetData(ItemCabinetVisuals.IsOpen, out bool isOpen)
|
||||||
&& component.TryGetData(ItemCabinetVisuals.ContainsItem, out bool contains))
|
&& component.TryGetData(ItemCabinetVisuals.ContainsItem, out bool contains))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace Content.Client.CharacterAppearance.Systems
|
|||||||
{
|
{
|
||||||
foreach (var (part, _) in body.Parts)
|
foreach (var (part, _) in body.Parts)
|
||||||
{
|
{
|
||||||
if (EntityManager.TryGetComponent(part.OwnerUid, out SpriteComponent? partSprite))
|
if (EntityManager.TryGetComponent(part.Owner, out SpriteComponent? partSprite))
|
||||||
{
|
{
|
||||||
partSprite!.Color = component.Appearance.SkinColor;
|
partSprite!.Color = component.Appearance.SkinColor;
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ namespace Content.Client.CharacterAppearance.Systems
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entityManager.HasComponent<SpriteComponent>(args.Args.Part.OwnerUid))
|
if (!entityManager.HasComponent<SpriteComponent>(args.Args.Part.Owner))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ namespace Content.Client.CharacterAppearance.Systems
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EntityManager.HasComponent<SpriteComponent>(args.Args.Part.OwnerUid))
|
if (!EntityManager.HasComponent<SpriteComponent>(args.Args.Part.Owner))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ namespace Content.Client.CharacterInterface
|
|||||||
|
|
||||||
private void HandleOpenCharacterMenu()
|
private void HandleOpenCharacterMenu()
|
||||||
{
|
{
|
||||||
if (_playerManager.LocalPlayer?.ControlledEntity == null
|
if (_playerManager.LocalPlayer?.ControlledEntity == default
|
||||||
|| !IoCManager.Resolve<IEntityManager>().TryGetComponent(_playerManager.LocalPlayer.ControlledEntity, out CharacterInterfaceComponent? characterInterface))
|
|| !EntityManager.TryGetComponent(_playerManager.LocalPlayer.ControlledEntity, out CharacterInterfaceComponent? characterInterface))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,7 +231,9 @@ namespace Content.Client.Chat.Managers
|
|||||||
ChatPermissionsUpdated?.Invoke(new ChatPermissionsUpdatedEventArgs {OldSelectableChannels = oldSelectable});
|
ChatPermissionsUpdated?.Invoke(new ChatPermissionsUpdatedEventArgs {OldSelectableChannels = oldSelectable});
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsGhost => _playerManager.LocalPlayer?.ControlledEntity is {} uid && _entityManager.HasComponent<GhostComponent>(uid);
|
public bool IsGhost => _playerManager.LocalPlayer?.ControlledEntity is {} uid &&
|
||||||
|
uid.IsValid() &&
|
||||||
|
_entityManager.HasComponent<GhostComponent>(uid);
|
||||||
|
|
||||||
public void FrameUpdate(FrameEventArgs delta)
|
public void FrameUpdate(FrameEventArgs delta)
|
||||||
{
|
{
|
||||||
@@ -241,11 +243,11 @@ namespace Content.Client.Chat.Managers
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var (entityUid, queueData) in _queuedSpeechBubbles.ShallowClone())
|
foreach (var (entity, queueData) in _queuedSpeechBubbles.ShallowClone())
|
||||||
{
|
{
|
||||||
if (!_entityManager.TryGetEntity(entityUid, out var entity))
|
if (!_entityManager.EntityExists(entity))
|
||||||
{
|
{
|
||||||
_queuedSpeechBubbles.Remove(entityUid);
|
_queuedSpeechBubbles.Remove(entity);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +259,7 @@ namespace Content.Client.Chat.Managers
|
|||||||
|
|
||||||
if (queueData.MessageQueue.Count == 0)
|
if (queueData.MessageQueue.Count == 0)
|
||||||
{
|
{
|
||||||
_queuedSpeechBubbles.Remove(entityUid);
|
_queuedSpeechBubbles.Remove(entity);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,7 +414,7 @@ namespace Content.Client.Chat.Managers
|
|||||||
|
|
||||||
private void AddSpeechBubble(MsgChatMessage msg, SpeechBubble.SpeechType speechType)
|
private void AddSpeechBubble(MsgChatMessage msg, SpeechBubble.SpeechType speechType)
|
||||||
{
|
{
|
||||||
if (!_entityManager.TryGetEntity(msg.SenderEntity, out var entity))
|
if (!_entityManager.EntityExists(msg.SenderEntity))
|
||||||
{
|
{
|
||||||
Logger.WarningS("chat", "Got local chat message with invalid sender entity: {0}", msg.SenderEntity);
|
Logger.WarningS("chat", "Got local chat message with invalid sender entity: {0}", msg.SenderEntity);
|
||||||
return;
|
return;
|
||||||
@@ -422,7 +424,7 @@ namespace Content.Client.Chat.Managers
|
|||||||
|
|
||||||
foreach (var message in messages)
|
foreach (var message in messages)
|
||||||
{
|
{
|
||||||
EnqueueSpeechBubble(entity, message, speechType);
|
EnqueueSpeechBubble(msg.SenderEntity, message, speechType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,7 +474,7 @@ namespace Content.Client.Chat.Managers
|
|||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EnqueueSpeechBubble(IEntity entity, string contents, SpeechBubble.SpeechType speechType)
|
private void EnqueueSpeechBubble(EntityUid entity, string contents, SpeechBubble.SpeechType speechType)
|
||||||
{
|
{
|
||||||
// Don't enqueue speech bubbles for other maps. TODO: Support multiple viewports/maps?
|
// Don't enqueue speech bubbles for other maps. TODO: Support multiple viewports/maps?
|
||||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).MapID != _eyeManager.CurrentMap)
|
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).MapID != _eyeManager.CurrentMap)
|
||||||
@@ -491,7 +493,7 @@ namespace Content.Client.Chat.Managers
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateSpeechBubble(IEntity entity, SpeechBubbleData speechData)
|
private void CreateSpeechBubble(EntityUid entity, SpeechBubbleData speechData)
|
||||||
{
|
{
|
||||||
var bubble =
|
var bubble =
|
||||||
SpeechBubble.CreateSpeechBubble(speechData.Type, speechData.Message, entity, _eyeManager, this);
|
SpeechBubble.CreateSpeechBubble(speechData.Type, speechData.Message, entity, _eyeManager, this);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace Content.Client.Chat.UI
|
|||||||
private const float EntityVerticalOffset = 0.5f;
|
private const float EntityVerticalOffset = 0.5f;
|
||||||
|
|
||||||
private readonly IEyeManager _eyeManager;
|
private readonly IEyeManager _eyeManager;
|
||||||
private readonly IEntity _senderEntity;
|
private readonly EntityUid _senderEntity;
|
||||||
private readonly IChatManager _chatManager;
|
private readonly IChatManager _chatManager;
|
||||||
|
|
||||||
private float _timeLeft = TotalTime;
|
private float _timeLeft = TotalTime;
|
||||||
@@ -46,7 +46,7 @@ namespace Content.Client.Chat.UI
|
|||||||
|
|
||||||
public float ContentHeight { get; private set; }
|
public float ContentHeight { get; private set; }
|
||||||
|
|
||||||
public static SpeechBubble CreateSpeechBubble(SpeechType type, string text, IEntity senderEntity, IEyeManager eyeManager, IChatManager chatManager)
|
public static SpeechBubble CreateSpeechBubble(SpeechType type, string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
@@ -61,7 +61,7 @@ namespace Content.Client.Chat.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpeechBubble(string text, IEntity senderEntity, IEyeManager eyeManager, IChatManager chatManager)
|
public SpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager)
|
||||||
{
|
{
|
||||||
_chatManager = chatManager;
|
_chatManager = chatManager;
|
||||||
_senderEntity = senderEntity;
|
_senderEntity = senderEntity;
|
||||||
@@ -162,7 +162,7 @@ namespace Content.Client.Chat.UI
|
|||||||
public class EmoteSpeechBubble : SpeechBubble
|
public class EmoteSpeechBubble : SpeechBubble
|
||||||
|
|
||||||
{
|
{
|
||||||
public EmoteSpeechBubble(string text, IEntity senderEntity, IEyeManager eyeManager, IChatManager chatManager)
|
public EmoteSpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager)
|
||||||
: base(text, senderEntity, eyeManager, chatManager)
|
: base(text, senderEntity, eyeManager, chatManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -188,7 +188,7 @@ namespace Content.Client.Chat.UI
|
|||||||
|
|
||||||
public class SaySpeechBubble : SpeechBubble
|
public class SaySpeechBubble : SpeechBubble
|
||||||
{
|
{
|
||||||
public SaySpeechBubble(string text, IEntity senderEntity, IEyeManager eyeManager, IChatManager chatManager)
|
public SaySpeechBubble(string text, EntityUid senderEntity, IEyeManager eyeManager, IChatManager chatManager)
|
||||||
: base(text, senderEntity, eyeManager, chatManager)
|
: base(text, senderEntity, eyeManager, chatManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.Animations;
|
using Robust.Client.Animations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
@@ -36,11 +37,12 @@ namespace Content.Client.Chemistry.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
if (component.TryGetData<bool>(FoamVisuals.State, out var state))
|
if (component.TryGetData<bool>(FoamVisuals.State, out var state))
|
||||||
{
|
{
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
if (component.Owner.TryGetComponent(out AnimationPlayerComponent? animPlayer))
|
if (entities.TryGetComponent(component.Owner, out AnimationPlayerComponent? animPlayer))
|
||||||
{
|
{
|
||||||
if (!animPlayer.HasRunningAnimation(AnimationKey))
|
if (!animPlayer.HasRunningAnimation(AnimationKey))
|
||||||
animPlayer.Play(_foamDissolve, AnimationKey);
|
animPlayer.Play(_foamDissolve, AnimationKey);
|
||||||
@@ -50,7 +52,7 @@ namespace Content.Client.Chemistry.Visualizers
|
|||||||
|
|
||||||
if (component.TryGetData<Color>(FoamVisuals.Color, out var color))
|
if (component.TryGetData<Color>(FoamVisuals.Color, out var color))
|
||||||
{
|
{
|
||||||
if (component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
if (entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
sprite.Color = color;
|
sprite.Color = color;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
|
||||||
namespace Content.Client.Chemistry.Visualizers
|
namespace Content.Client.Chemistry.Visualizers
|
||||||
@@ -13,9 +14,10 @@ namespace Content.Client.Chemistry.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
if (component.TryGetData<Color>(SmokeVisuals.Color, out var color))
|
if (component.TryGetData<Color>(SmokeVisuals.Color, out var color))
|
||||||
{
|
{
|
||||||
if (component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
if (entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
sprite.Color = color;
|
sprite.Color = color;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.Chemistry;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
@@ -25,7 +26,8 @@ namespace Content.Client.Chemistry.Visualizers
|
|||||||
if (!component.TryGetData(SolutionContainerVisuals.VisualState,
|
if (!component.TryGetData(SolutionContainerVisuals.VisualState,
|
||||||
out SolutionContainerVisualState state)) return;
|
out SolutionContainerVisualState state)) return;
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite)) return;
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite)) return;
|
||||||
if (!sprite.LayerMapTryGet(_layer, out var fillLayer)) return;
|
if (!sprite.LayerMapTryGet(_layer, out var fillLayer)) return;
|
||||||
|
|
||||||
var fillPercent = state.FilledVolumePercent;
|
var fillPercent = state.FilledVolumePercent;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using Content.Shared.Targeting;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.Input.Binding;
|
using Robust.Shared.Input.Binding;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
@@ -35,7 +34,7 @@ namespace Content.Client.CombatMode
|
|||||||
public bool IsInCombatMode()
|
public bool IsInCombatMode()
|
||||||
{
|
{
|
||||||
var entity = _playerManager.LocalPlayer?.ControlledEntity;
|
var entity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
if (entity == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out CombatModeComponent? combatMode))
|
if (entity == default || !EntityManager.TryGetComponent(entity.Value, out CombatModeComponent? combatMode))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Content.Client.Computer
|
|||||||
private string BodyBrokenState = "broken";
|
private string BodyBrokenState = "broken";
|
||||||
private string ScreenBroken = "computer_broken";
|
private string ScreenBroken = "computer_broken";
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ using Robust.Shared.Map;
|
|||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
|
|
||||||
namespace Content.Client.Construction
|
namespace Content.Client.Construction
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -111,7 +110,7 @@ namespace Content.Client.Construction
|
|||||||
|
|
||||||
private void HandlePlayerAttached(PlayerAttachSysMessage msg)
|
private void HandlePlayerAttached(PlayerAttachSysMessage msg)
|
||||||
{
|
{
|
||||||
var available = IsCrafingAvailable(msg.AttachedEntity);
|
var available = IsCraftingAvailable(msg.AttachedEntity);
|
||||||
UpdateCraftingAvailability(available);
|
UpdateCraftingAvailability(available);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,9 +130,9 @@ namespace Content.Client.Construction
|
|||||||
CraftingEnabled = available;
|
CraftingEnabled = available;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsCrafingAvailable(IEntity? entity)
|
private static bool IsCraftingAvailable(EntityUid? entity)
|
||||||
{
|
{
|
||||||
if (entity == null)
|
if (entity == default)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// TODO: Decide if entity can craft, using capabilities or something
|
// TODO: Decide if entity can craft, using capabilities or something
|
||||||
@@ -145,9 +144,7 @@ namespace Content.Client.Construction
|
|||||||
if (!args.EntityUid.IsValid() || !args.EntityUid.IsClientSide())
|
if (!args.EntityUid.IsValid() || !args.EntityUid.IsClientSide())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var entity = EntityManager.GetEntity(args.EntityUid);
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ConstructionGhostComponent?>(args.EntityUid, out var ghostComp))
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ConstructionGhostComponent?>(entity, out var ghostComp))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TryStartConstruction(ghostComp.GhostId);
|
TryStartConstruction(ghostComp.GhostId);
|
||||||
@@ -159,10 +156,14 @@ namespace Content.Client.Construction
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void SpawnGhost(ConstructionPrototype prototype, EntityCoordinates loc, Direction dir)
|
public void SpawnGhost(ConstructionPrototype prototype, EntityCoordinates loc, Direction dir)
|
||||||
{
|
{
|
||||||
var user = _playerManager.LocalPlayer?.ControlledEntity;
|
if (_playerManager.LocalPlayer?.ControlledEntity is not { } user ||
|
||||||
|
!user.IsValid())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// This InRangeUnobstructed should probably be replaced with "is there something blocking us in that tile?"
|
// This InRangeUnobstructed should probably be replaced with "is there something blocking us in that tile?"
|
||||||
if (user == null || GhostPresent(loc) || !user.InRangeUnobstructed(loc, 20f, ignoreInsideBlocker: prototype.CanBuildInImpassable)) return;
|
if (GhostPresent(loc) || !user.InRangeUnobstructed(loc, 20f, ignoreInsideBlocker: prototype.CanBuildInImpassable)) return;
|
||||||
|
|
||||||
foreach (var condition in prototype.Conditions)
|
foreach (var condition in prototype.Conditions)
|
||||||
{
|
{
|
||||||
@@ -226,7 +227,7 @@ namespace Content.Client.Construction
|
|||||||
{
|
{
|
||||||
if (_ghosts.TryGetValue(ghostId, out var ghost))
|
if (_ghosts.TryGetValue(ghostId, out var ghost))
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity((EntityUid) ghost.Owner);
|
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(ghost.Owner);
|
||||||
_ghosts.Remove(ghostId);
|
_ghosts.Remove(ghostId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,7 +239,7 @@ namespace Content.Client.Construction
|
|||||||
{
|
{
|
||||||
foreach (var (_, ghost) in _ghosts)
|
foreach (var (_, ghost) in _ghosts)
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity((EntityUid) ghost.Owner);
|
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(ghost.Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ghosts.Clear();
|
_ghosts.Clear();
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using Content.Client.Stylesheets;
|
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -14,7 +13,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The entity that can be accessed by interacting with this element.
|
/// The entity that can be accessed by interacting with this element.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEntity? Entity;
|
public EntityUid Entity;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many entities are accessible through this element's sub-menus.
|
/// How many entities are accessible through this element's sub-menus.
|
||||||
@@ -24,10 +23,10 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
public int Count;
|
public int Count;
|
||||||
|
|
||||||
public Label CountLabel;
|
public readonly Label CountLabel;
|
||||||
public SpriteView EntityIcon = new SpriteView { OverrideDirection = Direction.South};
|
public readonly SpriteView EntityIcon = new() { OverrideDirection = Direction.South};
|
||||||
|
|
||||||
public EntityMenuElement(IEntity? entity = null) : base()
|
public EntityMenuElement(EntityUid entity = default)
|
||||||
{
|
{
|
||||||
CountLabel = new Label { StyleClasses = { StyleClassEntityMenuCountText } };
|
CountLabel = new Label { StyleClasses = { StyleClassEntityMenuCountText } };
|
||||||
Icon.AddChild(new LayoutContainer() { Children = { EntityIcon, CountLabel } });
|
Icon.AddChild(new LayoutContainer() { Children = { EntityIcon, CountLabel } });
|
||||||
@@ -37,7 +36,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
LayoutContainer.SetGrowVertical(CountLabel, LayoutContainer.GrowDirection.Begin);
|
LayoutContainer.SetGrowVertical(CountLabel, LayoutContainer.GrowDirection.Begin);
|
||||||
|
|
||||||
Entity = entity;
|
Entity = entity;
|
||||||
if (Entity != null)
|
if (Entity != default)
|
||||||
{
|
{
|
||||||
Count = 1;
|
Count = 1;
|
||||||
CountLabel.Visible = false;
|
CountLabel.Visible = false;
|
||||||
@@ -48,7 +47,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
Entity = null;
|
Entity = default;
|
||||||
Count = 0;
|
Count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,12 +55,12 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
/// Update the icon and text of this element based on the given entity or this element's own entity if none
|
/// Update the icon and text of this element based on the given entity or this element's own entity if none
|
||||||
/// is provided.
|
/// is provided.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateEntity(IEntity? entity = null)
|
public void UpdateEntity(EntityUid entity = default)
|
||||||
{
|
{
|
||||||
if (Entity != null && IoCManager.Resolve<IEntityManager>().EntityExists(Entity))
|
if (Entity != default && IoCManager.Resolve<IEntityManager>().EntityExists(Entity) && !entity.Valid)
|
||||||
entity ??= Entity;
|
entity = Entity;
|
||||||
|
|
||||||
if (entity == null)
|
if (entity == default)
|
||||||
{
|
{
|
||||||
Text = string.Empty;
|
Text = string.Empty;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ using Robust.Shared.Input.Binding;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.Client.ContextMenu.UI
|
namespace Content.Client.ContextMenu.UI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -51,7 +51,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This is used remove GUI elements when the entities are deleted. or leave the LOS.
|
/// This is used remove GUI elements when the entities are deleted. or leave the LOS.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public Dictionary<IEntity, EntityMenuElement> Elements = new();
|
public Dictionary<EntityUid, EntityMenuElement> Elements = new();
|
||||||
|
|
||||||
public EntityMenuPresenter(VerbSystem verbSystem) : base()
|
public EntityMenuPresenter(VerbSystem verbSystem) : base()
|
||||||
{
|
{
|
||||||
@@ -77,7 +77,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Given a list of entities, sort them into groups and them to a new entity menu.
|
/// Given a list of entities, sort them into groups and them to a new entity menu.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void OpenRootMenu(List<IEntity> entities)
|
public void OpenRootMenu(List<EntityUid> entities)
|
||||||
{
|
{
|
||||||
// close any old menus first.
|
// close any old menus first.
|
||||||
if (RootMenu.Visible)
|
if (RootMenu.Visible)
|
||||||
@@ -101,8 +101,12 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
|
|
||||||
// get an entity associated with this element
|
// get an entity associated with this element
|
||||||
var entity = entityElement.Entity;
|
var entity = entityElement.Entity;
|
||||||
entity ??= GetFirstEntityOrNull(element.SubMenu);
|
if (!entity.Valid)
|
||||||
if (entity == null)
|
{
|
||||||
|
entity = GetFirstEntityOrNull(element.SubMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!entity.Valid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// open verb menu?
|
// open verb menu?
|
||||||
@@ -173,9 +177,8 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
if (!RootMenu.Visible)
|
if (!RootMenu.Visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var player = _playerManager.LocalPlayer?.ControlledEntity;
|
if (_playerManager.LocalPlayer?.ControlledEntity is not { } player ||
|
||||||
|
!player.IsValid())
|
||||||
if (player == null)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Do we need to do in-range unOccluded checks?
|
// Do we need to do in-range unOccluded checks?
|
||||||
@@ -193,7 +196,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
/// Add menu elements for a list of grouped entities;
|
/// Add menu elements for a list of grouped entities;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="entityGroups"> A list of entity groups. Entities are grouped together based on prototype.</param>
|
/// <param name="entityGroups"> A list of entity groups. Entities are grouped together based on prototype.</param>
|
||||||
private void AddToUI(List<List<IEntity>> entityGroups)
|
private void AddToUI(List<List<EntityUid>> entityGroups)
|
||||||
{
|
{
|
||||||
// If there is only a single group. We will just directly list individual entities
|
// If there is only a single group. We will just directly list individual entities
|
||||||
if (entityGroups.Count == 1)
|
if (entityGroups.Count == 1)
|
||||||
@@ -226,7 +229,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Given a group of entities, add a menu element that has a pop-up sub-menu listing group members
|
/// Given a group of entities, add a menu element that has a pop-up sub-menu listing group members
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void AddGroupToUI(List<IEntity> group)
|
private void AddGroupToUI(List<EntityUid> group)
|
||||||
{
|
{
|
||||||
EntityMenuElement element = new();
|
EntityMenuElement element = new();
|
||||||
ContextMenuPopup subMenu = new(this, element);
|
ContextMenuPopup subMenu = new(this, element);
|
||||||
@@ -245,7 +248,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove an entity from the entity context menu.
|
/// Remove an entity from the entity context menu.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void RemoveEntity(IEntity entity)
|
private void RemoveEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
// find the element associated with this entity
|
// find the element associated with this entity
|
||||||
if (!Elements.TryGetValue(entity, out var element))
|
if (!Elements.TryGetValue(entity, out var element))
|
||||||
@@ -323,17 +326,17 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Recursively look through a sub-menu and return the first entity.
|
/// Recursively look through a sub-menu and return the first entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private IEntity? GetFirstEntityOrNull(ContextMenuPopup? menu)
|
private EntityUid GetFirstEntityOrNull(ContextMenuPopup? menu)
|
||||||
{
|
{
|
||||||
if (menu == null)
|
if (menu == null)
|
||||||
return null;
|
return default;
|
||||||
|
|
||||||
foreach (var element in menu.MenuBody.Children)
|
foreach (var element in menu.MenuBody.Children)
|
||||||
{
|
{
|
||||||
if (element is not EntityMenuElement entityElement)
|
if (element is not EntityMenuElement entityElement)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (entityElement.Entity != null)
|
if (entityElement.Entity != default)
|
||||||
{
|
{
|
||||||
if (!((!IoCManager.Resolve<IEntityManager>().EntityExists(entityElement.Entity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entityElement.Entity).EntityLifeStage) >= EntityLifeStage.Deleted))
|
if (!((!IoCManager.Resolve<IEntityManager>().EntityExists(entityElement.Entity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entityElement.Entity).EntityLifeStage) >= EntityLifeStage.Deleted))
|
||||||
return entityElement.Entity;
|
return entityElement.Entity;
|
||||||
@@ -342,11 +345,11 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
|
|
||||||
// if the element has no entity, its a group of entities with another attached sub-menu.
|
// if the element has no entity, its a group of entities with another attached sub-menu.
|
||||||
var entity = GetFirstEntityOrNull(entityElement.SubMenu);
|
var entity = GetFirstEntityOrNull(entityElement.SubMenu);
|
||||||
if (entity != null)
|
if (entity != default)
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return default;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OpenSubMenu(ContextMenuElement element)
|
public override void OpenSubMenu(ContextMenuElement element)
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using System.Linq;
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
|
|
||||||
namespace Content.Client.ContextMenu.UI
|
namespace Content.Client.ContextMenu.UI
|
||||||
{
|
{
|
||||||
@@ -18,7 +17,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
GroupingContextMenuType = obj;
|
GroupingContextMenuType = obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<List<IEntity>> GroupEntities(IEnumerable<IEntity> entities, int depth = 0)
|
private List<List<EntityUid>> GroupEntities(IEnumerable<EntityUid> entities, int depth = 0)
|
||||||
{
|
{
|
||||||
if (GroupingContextMenuType == 0)
|
if (GroupingContextMenuType == 0)
|
||||||
{
|
{
|
||||||
@@ -32,9 +31,9 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed class PrototypeAndStatesContextMenuComparer : IEqualityComparer<IEntity>
|
private sealed class PrototypeAndStatesContextMenuComparer : IEqualityComparer<EntityUid>
|
||||||
{
|
{
|
||||||
private static readonly List<Func<IEntity, IEntity, bool>> EqualsList = new()
|
private static readonly List<Func<EntityUid, EntityUid, bool>> EqualsList = new()
|
||||||
{
|
{
|
||||||
(a, b) => IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(a).EntityPrototype!.ID == IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(b).EntityPrototype!.ID,
|
(a, b) => IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(a).EntityPrototype!.ID == IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(b).EntityPrototype!.ID,
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
@@ -51,7 +50,7 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
return xStates.OrderBy(t => t).SequenceEqual(yStates.OrderBy(t => t));
|
return xStates.OrderBy(t => t).SequenceEqual(yStates.OrderBy(t => t));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
private static readonly List<Func<IEntity, int>> GetHashCodeList = new()
|
private static readonly List<Func<EntityUid, int>> GetHashCodeList = new()
|
||||||
{
|
{
|
||||||
e => EqualityComparer<string>.Default.GetHashCode(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(e).EntityPrototype!.ID),
|
e => EqualityComparer<string>.Default.GetHashCode(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(e).EntityPrototype!.ID),
|
||||||
e =>
|
e =>
|
||||||
@@ -73,17 +72,17 @@ namespace Content.Client.ContextMenu.UI
|
|||||||
_depth = step > Count ? Count : step;
|
_depth = step > Count ? Count : step;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(IEntity? x, IEntity? y)
|
public bool Equals(EntityUid x, EntityUid y)
|
||||||
{
|
{
|
||||||
if (x == null)
|
if (x == default)
|
||||||
{
|
{
|
||||||
return y == null;
|
return y == default;
|
||||||
}
|
}
|
||||||
|
|
||||||
return y != null && EqualsList[_depth](x, y);
|
return y != default && EqualsList[_depth](x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetHashCode(IEntity e)
|
public int GetHashCode(EntityUid e)
|
||||||
{
|
{
|
||||||
return GetHashCodeList[_depth](e);
|
return GetHashCodeList[_depth](e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.Conveyor;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Conveyor.Visualizers
|
namespace Content.Client.Conveyor.Visualizers
|
||||||
@@ -21,7 +22,8 @@ namespace Content.Client.Conveyor.Visualizers
|
|||||||
|
|
||||||
private void ChangeState(AppearanceComponent appearance)
|
private void ChangeState(AppearanceComponent appearance)
|
||||||
{
|
{
|
||||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(appearance.Owner, out ISpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -40,7 +42,7 @@ namespace Content.Client.Conveyor.Visualizers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.MachineLinking;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Conveyor.Visualizers
|
namespace Content.Client.Conveyor.Visualizers
|
||||||
@@ -20,7 +21,8 @@ namespace Content.Client.Conveyor.Visualizers
|
|||||||
|
|
||||||
private void ChangeState(AppearanceComponent appearance)
|
private void ChangeState(AppearanceComponent appearance)
|
||||||
{
|
{
|
||||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(appearance.Owner, out ISpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -38,7 +40,7 @@ namespace Content.Client.Conveyor.Visualizers
|
|||||||
sprite.LayerSetState(0, texture);
|
sprite.LayerSetState(0, texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ namespace Content.Client.Damage
|
|||||||
public readonly string? Color;
|
public readonly string? Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ namespace Content.Client.Damage
|
|||||||
InitializeVisualizer(entity, damageData);
|
InitializeVisualizer(entity, damageData);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void VerifyVisualizerSetup(IEntity entity, DamageVisualizerDataComponent damageData)
|
private void VerifyVisualizerSetup(EntityUid entity, DamageVisualizerDataComponent damageData)
|
||||||
{
|
{
|
||||||
if (_thresholds.Count < 1)
|
if (_thresholds.Count < 1)
|
||||||
{
|
{
|
||||||
@@ -289,7 +289,7 @@ namespace Content.Client.Damage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeVisualizer(IEntity entity, DamageVisualizerDataComponent damageData)
|
private void InitializeVisualizer(EntityUid entity, DamageVisualizerDataComponent damageData)
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out SpriteComponent? spriteComponent)
|
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out SpriteComponent? spriteComponent)
|
||||||
|| !IoCManager.Resolve<IEntityManager>().TryGetComponent<DamageableComponent?>(entity, out var damageComponent)
|
|| !IoCManager.Resolve<IEntityManager>().TryGetComponent<DamageableComponent?>(entity, out var damageComponent)
|
||||||
@@ -504,7 +504,8 @@ namespace Content.Client.Damage
|
|||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
if (!component.Owner.TryGetComponent<DamageVisualizerDataComponent>(out var damageData))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out DamageVisualizerDataComponent damageData))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!damageData.Valid)
|
if (!damageData.Valid)
|
||||||
@@ -525,8 +526,9 @@ namespace Content.Client.Damage
|
|||||||
|
|
||||||
private void HandleDamage(AppearanceComponent component, DamageVisualizerDataComponent damageData)
|
private void HandleDamage(AppearanceComponent component, DamageVisualizerDataComponent damageData)
|
||||||
{
|
{
|
||||||
if (!component.Owner.TryGetComponent<SpriteComponent>(out var spriteComponent)
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|| !component.Owner.TryGetComponent<DamageableComponent>(out var damageComponent))
|
if (!entities.TryGetComponent(component.Owner, out SpriteComponent spriteComponent)
|
||||||
|
|| !entities.TryGetComponent(component.Owner, out DamageableComponent damageComponent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_targetLayers != null && _damageOverlayGroups != null)
|
if (_targetLayers != null && _damageOverlayGroups != null)
|
||||||
|
|||||||
@@ -70,7 +70,8 @@ namespace Content.Client.Disposal.Visualizers
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(appearance.Owner, out ISpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -144,7 +145,7 @@ namespace Content.Client.Disposal.Visualizers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ namespace Content.Client.Disposal.Visualizers
|
|||||||
|
|
||||||
private void ChangeState(AppearanceComponent appearance)
|
private void ChangeState(AppearanceComponent appearance)
|
||||||
{
|
{
|
||||||
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(appearance.Owner, out ISpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -53,7 +54,7 @@ namespace Content.Client.Disposal.Visualizers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Client.DoAfter
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const float ExcessTime = 0.5f;
|
public const float ExcessTime = 0.5f;
|
||||||
|
|
||||||
private IEntity? _attachedEntity;
|
private EntityUid _attachedEntity;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -51,7 +51,7 @@ namespace Content.Client.DoAfter
|
|||||||
var currentTime = _gameTiming.CurTime;
|
var currentTime = _gameTiming.CurTime;
|
||||||
|
|
||||||
// Can't see any I guess?
|
// Can't see any I guess?
|
||||||
if (_attachedEntity == null || (!IoCManager.Resolve<IEntityManager>().EntityExists(_attachedEntity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(_attachedEntity).EntityLifeStage) >= EntityLifeStage.Deleted)
|
if (_attachedEntity == default || (!EntityManager.EntityExists(_attachedEntity) ? EntityLifeStage.Deleted : EntityManager.GetComponent<MetaDataComponent>(_attachedEntity).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var viewbox = _eyeManager.GetWorldViewport().Enlarged(2.0f);
|
var viewbox = _eyeManager.GetWorldViewport().Enlarged(2.0f);
|
||||||
@@ -59,23 +59,23 @@ namespace Content.Client.DoAfter
|
|||||||
foreach (var comp in EntityManager.EntityQuery<DoAfterComponent>(true))
|
foreach (var comp in EntityManager.EntityQuery<DoAfterComponent>(true))
|
||||||
{
|
{
|
||||||
var doAfters = comp.DoAfters.ToList();
|
var doAfters = comp.DoAfters.ToList();
|
||||||
var compPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner).WorldPosition;
|
var compPos = EntityManager.GetComponent<TransformComponent>(comp.Owner).WorldPosition;
|
||||||
|
|
||||||
if (doAfters.Count == 0 ||
|
if (doAfters.Count == 0 ||
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner).MapID != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_attachedEntity).MapID ||
|
EntityManager.GetComponent<TransformComponent>(comp.Owner).MapID != EntityManager.GetComponent<TransformComponent>(_attachedEntity).MapID ||
|
||||||
!viewbox.Contains(compPos))
|
!viewbox.Contains(compPos))
|
||||||
{
|
{
|
||||||
comp.Disable();
|
comp.Disable();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var range = (compPos - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_attachedEntity).WorldPosition).Length +
|
var range = (compPos - EntityManager.GetComponent<TransformComponent>(_attachedEntity).WorldPosition).Length +
|
||||||
0.01f;
|
0.01f;
|
||||||
|
|
||||||
if (comp.Owner != _attachedEntity &&
|
if (comp.Owner != _attachedEntity &&
|
||||||
!ExamineSystemShared.InRangeUnOccluded(
|
!ExamineSystemShared.InRangeUnOccluded(
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_attachedEntity).MapPosition,
|
EntityManager.GetComponent<TransformComponent>(_attachedEntity).MapPosition,
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner).MapPosition, range,
|
EntityManager.GetComponent<TransformComponent>(comp.Owner).MapPosition, range,
|
||||||
entity => entity == comp.Owner || entity == _attachedEntity))
|
entity => entity == comp.Owner || entity == _attachedEntity))
|
||||||
{
|
{
|
||||||
comp.Disable();
|
comp.Disable();
|
||||||
@@ -84,7 +84,7 @@ namespace Content.Client.DoAfter
|
|||||||
|
|
||||||
comp.Enable();
|
comp.Enable();
|
||||||
|
|
||||||
var userGrid = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner).Coordinates;
|
var userGrid = EntityManager.GetComponent<TransformComponent>(comp.Owner).Coordinates;
|
||||||
|
|
||||||
// Check cancellations / finishes
|
// Check cancellations / finishes
|
||||||
foreach (var (id, doAfter) in doAfters)
|
foreach (var (id, doAfter) in doAfters)
|
||||||
@@ -116,8 +116,8 @@ namespace Content.Client.DoAfter
|
|||||||
|
|
||||||
if (doAfter.BreakOnTargetMove)
|
if (doAfter.BreakOnTargetMove)
|
||||||
{
|
{
|
||||||
if (EntityManager.TryGetEntity(doAfter.TargetUid, out var targetEntity) &&
|
if (EntityManager.EntityExists(doAfter.TargetUid) &&
|
||||||
!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(targetEntity).Coordinates.InRange(EntityManager, doAfter.TargetGrid,
|
!EntityManager.GetComponent<TransformComponent>(doAfter.TargetUid).Coordinates.InRange(EntityManager, doAfter.TargetGrid,
|
||||||
doAfter.MovementThreshold))
|
doAfter.MovementThreshold))
|
||||||
{
|
{
|
||||||
comp.Cancel(id, currentTime);
|
comp.Cancel(id, currentTime);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace Content.Client.DoAfter.UI
|
|||||||
// We'll store cancellations for a little bit just so we can flash the graphic to indicate it's cancelled
|
// We'll store cancellations for a little bit just so we can flash the graphic to indicate it's cancelled
|
||||||
private readonly Dictionary<byte, TimeSpan> _cancelledDoAfters = new();
|
private readonly Dictionary<byte, TimeSpan> _cancelledDoAfters = new();
|
||||||
|
|
||||||
public IEntity? AttachedEntity { get; set; }
|
public EntityUid AttachedEntity { get; set; }
|
||||||
private ScreenCoordinates _playerPosition;
|
private ScreenCoordinates _playerPosition;
|
||||||
|
|
||||||
public DoAfterGui()
|
public DoAfterGui()
|
||||||
@@ -146,14 +146,8 @@ namespace Content.Client.DoAfter.UI
|
|||||||
{
|
{
|
||||||
base.FrameUpdate(args);
|
base.FrameUpdate(args);
|
||||||
|
|
||||||
IEntity? tempQualifier = AttachedEntity;
|
if (!AttachedEntity.IsValid() ||
|
||||||
if (tempQualifier != null)
|
!_entityManager.TryGetComponent(AttachedEntity, out DoAfterComponent? doAfterComponent))
|
||||||
{
|
|
||||||
IoCManager.Resolve<IEntityManager>().EntityExists(tempQualifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RETURNED_VALUE != true ||
|
|
||||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(AttachedEntity, out DoAfterComponent? doAfterComponent))
|
|
||||||
{
|
{
|
||||||
Visible = false;
|
Visible = false;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Client.Wires.Visualizers;
|
using Content.Client.Wires.Visualizers;
|
||||||
using Content.Shared.Audio;
|
|
||||||
using Content.Shared.Doors;
|
using Content.Shared.Doors;
|
||||||
using Content.Shared.Sound;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.Animations;
|
using Robust.Client.Animations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
@@ -110,7 +108,7 @@ namespace Content.Client.Doors
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AnimationPlayerComponent>(entity))
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AnimationPlayerComponent>(entity))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,9 +54,9 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
// entity performing the drag action
|
// entity performing the drag action
|
||||||
|
|
||||||
private IEntity? _dragger;
|
private EntityUid _dragger;
|
||||||
private readonly List<IDraggable> _draggables = new();
|
private readonly List<IDraggable> _draggables = new();
|
||||||
private IEntity? _dragShadow;
|
private EntityUid _dragShadow;
|
||||||
|
|
||||||
// time since mouse down over the dragged entity
|
// time since mouse down over the dragged entity
|
||||||
private float _mouseDownTime;
|
private float _mouseDownTime;
|
||||||
@@ -68,7 +68,7 @@ namespace Content.Client.DragDrop
|
|||||||
// can ignore any events sent to this system
|
// can ignore any events sent to this system
|
||||||
private bool _isReplaying;
|
private bool _isReplaying;
|
||||||
|
|
||||||
private DragDropHelper<IEntity> _dragDropHelper = default!;
|
private DragDropHelper<EntityUid> _dragDropHelper = default!;
|
||||||
|
|
||||||
private ShaderInstance? _dropTargetInRangeShader;
|
private ShaderInstance? _dropTargetInRangeShader;
|
||||||
private ShaderInstance? _dropTargetOutOfRangeShader;
|
private ShaderInstance? _dropTargetOutOfRangeShader;
|
||||||
@@ -77,7 +77,7 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
_dragDropHelper = new DragDropHelper<IEntity>(OnBeginDrag, OnContinueDrag, OnEndDrag);
|
_dragDropHelper = new DragDropHelper<EntityUid>(OnBeginDrag, OnContinueDrag, OnEndDrag);
|
||||||
|
|
||||||
_dropTargetInRangeShader = _prototypeManager.Index<ShaderPrototype>(ShaderDropTargetInRange).Instance();
|
_dropTargetInRangeShader = _prototypeManager.Index<ShaderPrototype>(ShaderDropTargetInRange).Instance();
|
||||||
_dropTargetOutOfRangeShader = _prototypeManager.Index<ShaderPrototype>(ShaderDropTargetOutOfRange).Instance();
|
_dropTargetOutOfRangeShader = _prototypeManager.Index<ShaderPrototype>(ShaderDropTargetOutOfRange).Instance();
|
||||||
@@ -118,33 +118,32 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
private bool OnUseMouseDown(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
private bool OnUseMouseDown(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||||
{
|
{
|
||||||
if (args.Session?.AttachedEntity == null)
|
if (args.Session?.AttachedEntity is not {Valid: true} dragger)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dragger = args.Session.AttachedEntity;
|
|
||||||
// cancel any current dragging if there is one (shouldn't be because they would've had to have lifted
|
// cancel any current dragging if there is one (shouldn't be because they would've had to have lifted
|
||||||
// the mouse, canceling the drag, but just being cautious)
|
// the mouse, canceling the drag, but just being cautious)
|
||||||
_dragDropHelper.EndDrag();
|
_dragDropHelper.EndDrag();
|
||||||
|
|
||||||
// possibly initiating a drag
|
// possibly initiating a drag
|
||||||
// check if the clicked entity is draggable
|
// check if the clicked entity is draggable
|
||||||
if (!EntityManager.TryGetEntity(args.EntityUid, out var entity))
|
if (!EntityManager.EntityExists(args.EntityUid))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the entity is reachable
|
// check if the entity is reachable
|
||||||
if (!_interactionSystem.InRangeUnobstructed(dragger, entity))
|
if (!_interactionSystem.InRangeUnobstructed(dragger, args.EntityUid))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var canDrag = false;
|
var canDrag = false;
|
||||||
foreach (var draggable in IoCManager.Resolve<IEntityManager>().GetComponents<IDraggable>(entity))
|
foreach (var draggable in EntityManager.GetComponents<IDraggable>(args.EntityUid))
|
||||||
{
|
{
|
||||||
var dragEventArgs = new StartDragDropEvent(dragger, entity);
|
var dragEventArgs = new StartDragDropEvent(dragger, args.EntityUid);
|
||||||
|
|
||||||
if (!draggable.CanStartDrag(dragEventArgs))
|
if (!draggable.CanStartDrag(dragEventArgs))
|
||||||
{
|
{
|
||||||
@@ -161,7 +160,7 @@ namespace Content.Client.DragDrop
|
|||||||
}
|
}
|
||||||
|
|
||||||
// wait to initiate a drag
|
// wait to initiate a drag
|
||||||
_dragDropHelper.MouseDown(entity);
|
_dragDropHelper.MouseDown(args.EntityUid);
|
||||||
_dragger = dragger;
|
_dragger = dragger;
|
||||||
_mouseDownTime = 0;
|
_mouseDownTime = 0;
|
||||||
|
|
||||||
@@ -176,19 +175,19 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
private bool OnBeginDrag()
|
private bool OnBeginDrag()
|
||||||
{
|
{
|
||||||
if (_dragDropHelper.Dragged == null || (!IoCManager.Resolve<IEntityManager>().EntityExists(_dragDropHelper.Dragged) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(_dragDropHelper.Dragged).EntityLifeStage) >= EntityLifeStage.Deleted)
|
if (_dragDropHelper.Dragged == default || (!EntityManager.EntityExists(_dragDropHelper.Dragged) ? EntityLifeStage.Deleted : EntityManager.GetComponent<MetaDataComponent>(_dragDropHelper.Dragged).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||||
{
|
{
|
||||||
// something happened to the clicked entity or we moved the mouse off the target so
|
// something happened to the clicked entity or we moved the mouse off the target so
|
||||||
// we shouldn't replay the original click
|
// we shouldn't replay the original click
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SpriteComponent?>(_dragDropHelper.Dragged, out var draggedSprite))
|
if (EntityManager.TryGetComponent<SpriteComponent?>(_dragDropHelper.Dragged, out var draggedSprite))
|
||||||
{
|
{
|
||||||
// pop up drag shadow under mouse
|
// pop up drag shadow under mouse
|
||||||
var mousePos = _eyeManager.ScreenToMap(_dragDropHelper.MouseScreenPosition);
|
var mousePos = _eyeManager.ScreenToMap(_dragDropHelper.MouseScreenPosition);
|
||||||
_dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos);
|
_dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos);
|
||||||
var dragSprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(_dragShadow);
|
var dragSprite = EntityManager.GetComponent<SpriteComponent>(_dragShadow);
|
||||||
dragSprite.CopyFrom(draggedSprite);
|
dragSprite.CopyFrom(draggedSprite);
|
||||||
dragSprite.RenderOrder = EntityManager.CurrentTick.Value;
|
dragSprite.RenderOrder = EntityManager.CurrentTick.Value;
|
||||||
dragSprite.Color = dragSprite.Color.WithAlpha(0.7f);
|
dragSprite.Color = dragSprite.Color.WithAlpha(0.7f);
|
||||||
@@ -196,7 +195,7 @@ namespace Content.Client.DragDrop
|
|||||||
dragSprite.DrawDepth = (int) DrawDepth.Overlays;
|
dragSprite.DrawDepth = (int) DrawDepth.Overlays;
|
||||||
if (!dragSprite.NoRotation)
|
if (!dragSprite.NoRotation)
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_dragShadow).WorldRotation = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_dragDropHelper.Dragged).WorldRotation;
|
EntityManager.GetComponent<TransformComponent>(_dragShadow).WorldRotation = EntityManager.GetComponent<TransformComponent>(_dragDropHelper.Dragged).WorldRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
HighlightTargets();
|
HighlightTargets();
|
||||||
@@ -207,13 +206,13 @@ namespace Content.Client.DragDrop
|
|||||||
}
|
}
|
||||||
|
|
||||||
Logger.Warning("Unable to display drag shadow for {0} because it" +
|
Logger.Warning("Unable to display drag shadow for {0} because it" +
|
||||||
" has no sprite component.", IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(_dragDropHelper.Dragged).EntityName);
|
" has no sprite component.", EntityManager.GetComponent<MetaDataComponent>(_dragDropHelper.Dragged).EntityName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool OnContinueDrag(float frameTime)
|
private bool OnContinueDrag(float frameTime)
|
||||||
{
|
{
|
||||||
if (_dragDropHelper.Dragged == null || (!IoCManager.Resolve<IEntityManager>().EntityExists(_dragDropHelper.Dragged) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(_dragDropHelper.Dragged).EntityLifeStage) >= EntityLifeStage.Deleted)
|
if (_dragDropHelper.Dragged == default || (!EntityManager.EntityExists(_dragDropHelper.Dragged) ? EntityLifeStage.Deleted : EntityManager.GetComponent<MetaDataComponent>(_dragDropHelper.Dragged).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -221,7 +220,7 @@ namespace Content.Client.DragDrop
|
|||||||
DebugTools.AssertNotNull(_dragger);
|
DebugTools.AssertNotNull(_dragger);
|
||||||
|
|
||||||
// still in range of the thing we are dragging?
|
// still in range of the thing we are dragging?
|
||||||
if (!_interactionSystem.InRangeUnobstructed(_dragger!, _dragDropHelper.Dragged))
|
if (!_interactionSystem.InRangeUnobstructed(_dragger, _dragDropHelper.Dragged))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -230,10 +229,10 @@ namespace Content.Client.DragDrop
|
|||||||
var mousePos = _eyeManager.ScreenToMap(_dragDropHelper.MouseScreenPosition);
|
var mousePos = _eyeManager.ScreenToMap(_dragDropHelper.MouseScreenPosition);
|
||||||
// TODO: would use MapPosition instead if it had a setter, but it has no setter.
|
// TODO: would use MapPosition instead if it had a setter, but it has no setter.
|
||||||
// is that intentional, or should we add a setter for Transform.MapPosition?
|
// is that intentional, or should we add a setter for Transform.MapPosition?
|
||||||
if (_dragShadow == null)
|
if (_dragShadow == default)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_dragShadow).WorldPosition = mousePos.Position;
|
EntityManager.GetComponent<TransformComponent>(_dragShadow).WorldPosition = mousePos.Position;
|
||||||
|
|
||||||
_targetRecheckTime += frameTime;
|
_targetRecheckTime += frameTime;
|
||||||
if (_targetRecheckTime > TargetRecheckInterval)
|
if (_targetRecheckTime > TargetRecheckInterval)
|
||||||
@@ -248,22 +247,22 @@ namespace Content.Client.DragDrop
|
|||||||
private void OnEndDrag()
|
private void OnEndDrag()
|
||||||
{
|
{
|
||||||
RemoveHighlights();
|
RemoveHighlights();
|
||||||
if (_dragShadow != null)
|
if (_dragShadow != default)
|
||||||
{
|
{
|
||||||
EntityManager.DeleteEntity(_dragShadow);
|
EntityManager.DeleteEntity(_dragShadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityManager.EventBus.RaiseEvent(EventSource.Local, new OutlineToggleMessage(true));
|
EntityManager.EventBus.RaiseEvent(EventSource.Local, new OutlineToggleMessage(true));
|
||||||
_dragShadow = null;
|
_dragShadow = default;
|
||||||
_draggables.Clear();
|
_draggables.Clear();
|
||||||
_dragger = null;
|
_dragger = default;
|
||||||
_mouseDownTime = 0;
|
_mouseDownTime = 0;
|
||||||
_savedMouseDown = null;
|
_savedMouseDown = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool OnUseMouseUp(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
private bool OnUseMouseUp(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||||
{
|
{
|
||||||
if (_dragDropHelper.IsDragging == false || _dragDropHelper.Dragged == null)
|
if (_dragDropHelper.IsDragging == false || _dragDropHelper.Dragged == default)
|
||||||
{
|
{
|
||||||
// haven't started the drag yet, quick mouseup, definitely treat it as a normal click by
|
// haven't started the drag yet, quick mouseup, definitely treat it as a normal click by
|
||||||
// replaying the original cmd
|
// replaying the original cmd
|
||||||
@@ -287,7 +286,7 @@ namespace Content.Client.DragDrop
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_dragger == null)
|
if (_dragger == default)
|
||||||
{
|
{
|
||||||
_dragDropHelper.EndDrag();
|
_dragDropHelper.EndDrag();
|
||||||
return false;
|
return false;
|
||||||
@@ -295,7 +294,7 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
// now when ending the drag, we will not replay the click because
|
// now when ending the drag, we will not replay the click because
|
||||||
// by this time we've determined the input was actually a drag attempt
|
// by this time we've determined the input was actually a drag attempt
|
||||||
var range = (args.Coordinates.ToMapPos(EntityManager) - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_dragger).MapPosition.Position).Length + 0.01f;
|
var range = (args.Coordinates.ToMapPos(EntityManager) - EntityManager.GetComponent<TransformComponent>(_dragger).MapPosition.Position).Length + 0.01f;
|
||||||
// tell the server we are dropping if we are over a valid drop target in range.
|
// tell the server we are dropping if we are over a valid drop target in range.
|
||||||
// We don't use args.EntityUid here because drag interactions generally should
|
// We don't use args.EntityUid here because drag interactions generally should
|
||||||
// work even if there's something "on top" of the drop target
|
// work even if there's something "on top" of the drop target
|
||||||
@@ -330,7 +329,7 @@ namespace Content.Client.DragDrop
|
|||||||
if (!draggable.CanDrop(dropArgs)) continue;
|
if (!draggable.CanDrop(dropArgs)) continue;
|
||||||
|
|
||||||
// tell the server about the drop attempt
|
// tell the server about the drop attempt
|
||||||
RaiseNetworkEvent(new DragDropRequestEvent(args.Coordinates, _dragDropHelper.Dragged!,
|
RaiseNetworkEvent(new DragDropRequestEvent(args.Coordinates, _dragDropHelper.Dragged,
|
||||||
entity));
|
entity));
|
||||||
|
|
||||||
draggable.Drop(dropArgs);
|
draggable.Drop(dropArgs);
|
||||||
@@ -340,9 +339,11 @@ namespace Content.Client.DragDrop
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outOfRange)
|
if (outOfRange &&
|
||||||
|
_playerManager.LocalPlayer?.ControlledEntity is { } player &&
|
||||||
|
player.IsValid())
|
||||||
{
|
{
|
||||||
_playerManager.LocalPlayer?.ControlledEntity?.PopupMessage(Loc.GetString("drag-drop-system-out-of-range-text"));
|
player.PopupMessage(Loc.GetString("drag-drop-system-out-of-range-text"));
|
||||||
}
|
}
|
||||||
|
|
||||||
_dragDropHelper.EndDrag();
|
_dragDropHelper.EndDrag();
|
||||||
@@ -351,10 +352,10 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
private void HighlightTargets()
|
private void HighlightTargets()
|
||||||
{
|
{
|
||||||
if (_dragDropHelper.Dragged == null ||
|
if (_dragDropHelper.Dragged == default ||
|
||||||
(!IoCManager.Resolve<IEntityManager>().EntityExists(_dragDropHelper.Dragged) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(_dragDropHelper.Dragged).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
(!EntityManager.EntityExists(_dragDropHelper.Dragged) ? EntityLifeStage.Deleted : EntityManager.GetComponent<MetaDataComponent>(_dragDropHelper.Dragged).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||||
_dragShadow == null ||
|
_dragShadow == default ||
|
||||||
(!IoCManager.Resolve<IEntityManager>().EntityExists(_dragShadow) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(_dragShadow).EntityLifeStage) >= EntityLifeStage.Deleted)
|
(!EntityManager.EntityExists(_dragShadow) ? EntityLifeStage.Deleted : EntityManager.GetComponent<MetaDataComponent>(_dragShadow).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||||
{
|
{
|
||||||
Logger.Warning("Programming error. Can't highlight drag and drop targets, not currently " +
|
Logger.Warning("Programming error. Can't highlight drag and drop targets, not currently " +
|
||||||
"dragging anything or dragged entity / shadow was deleted.");
|
"dragging anything or dragged entity / shadow was deleted.");
|
||||||
@@ -374,12 +375,12 @@ namespace Content.Client.DragDrop
|
|||||||
var pvsEntities = IoCManager.Resolve<IEntityLookup>().GetEntitiesIntersecting(_eyeManager.CurrentMap, bounds, LookupFlags.Approximate | LookupFlags.IncludeAnchored);
|
var pvsEntities = IoCManager.Resolve<IEntityLookup>().GetEntitiesIntersecting(_eyeManager.CurrentMap, bounds, LookupFlags.Approximate | LookupFlags.IncludeAnchored);
|
||||||
foreach (var pvsEntity in pvsEntities)
|
foreach (var pvsEntity in pvsEntities)
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(pvsEntity, out ISpriteComponent? inRangeSprite) ||
|
if (!EntityManager.TryGetComponent(pvsEntity, out ISpriteComponent? inRangeSprite) ||
|
||||||
!inRangeSprite.Visible ||
|
!inRangeSprite.Visible ||
|
||||||
pvsEntity == _dragDropHelper.Dragged) continue;
|
pvsEntity == _dragDropHelper.Dragged) continue;
|
||||||
|
|
||||||
// check if it's able to be dropped on by current dragged entity
|
// check if it's able to be dropped on by current dragged entity
|
||||||
var dropArgs = new DragDropEvent(_dragger!, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(pvsEntity).Coordinates, _dragDropHelper.Dragged, pvsEntity);
|
var dropArgs = new DragDropEvent(_dragger, EntityManager.GetComponent<TransformComponent>(pvsEntity).Coordinates, _dragDropHelper.Dragged, pvsEntity);
|
||||||
|
|
||||||
var valid = ValidDragDrop(dropArgs);
|
var valid = ValidDragDrop(dropArgs);
|
||||||
if (valid == null) continue;
|
if (valid == null) continue;
|
||||||
@@ -422,7 +423,7 @@ namespace Content.Client.DragDrop
|
|||||||
|
|
||||||
bool? valid = null;
|
bool? valid = null;
|
||||||
|
|
||||||
foreach (var comp in IoCManager.Resolve<IEntityManager>().GetComponents<IDragDropOn>(eventArgs.Target))
|
foreach (var comp in EntityManager.GetComponents<IDragDropOn>(eventArgs.Target))
|
||||||
{
|
{
|
||||||
if (!comp.CanDragDropOn(eventArgs))
|
if (!comp.CanDragDropOn(eventArgs))
|
||||||
{
|
{
|
||||||
@@ -440,7 +441,7 @@ namespace Content.Client.DragDrop
|
|||||||
// Need at least one IDraggable to return true or else we can't do shit
|
// Need at least one IDraggable to return true or else we can't do shit
|
||||||
valid = false;
|
valid = false;
|
||||||
|
|
||||||
foreach (var comp in IoCManager.Resolve<IEntityManager>().GetComponents<IDraggable>(eventArgs.User))
|
foreach (var comp in EntityManager.GetComponents<IDraggable>(eventArgs.User))
|
||||||
{
|
{
|
||||||
if (!comp.CanDrop(eventArgs)) continue;
|
if (!comp.CanDrop(eventArgs)) continue;
|
||||||
valid = true;
|
valid = true;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ using Robust.Client.Graphics;
|
|||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Shared.Containers;
|
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Input.Binding;
|
using Robust.Shared.Input.Binding;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -33,8 +32,8 @@ namespace Content.Client.Examine
|
|||||||
|
|
||||||
public const string StyleClassEntityTooltip = "entity-tooltip";
|
public const string StyleClassEntityTooltip = "entity-tooltip";
|
||||||
|
|
||||||
private IEntity? _examinedEntity;
|
private EntityUid _examinedEntity;
|
||||||
private IEntity? _playerEntity;
|
private EntityUid _playerEntity;
|
||||||
private Popup? _examineTooltipOpen;
|
private Popup? _examineTooltipOpen;
|
||||||
private CancellationTokenSource? _requestCancelTokenSource;
|
private CancellationTokenSource? _requestCancelTokenSource;
|
||||||
|
|
||||||
@@ -51,8 +50,8 @@ namespace Content.Client.Examine
|
|||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
if (_examineTooltipOpen == null || !_examineTooltipOpen.Visible) return;
|
if (_examineTooltipOpen is not {Visible: true}) return;
|
||||||
if (_examinedEntity == null || _playerEntity == null) return;
|
if (!_examinedEntity.Valid || !_playerEntity.Valid) return;
|
||||||
|
|
||||||
if (!CanExamine(_playerEntity, _examinedEntity))
|
if (!CanExamine(_playerEntity, _examinedEntity))
|
||||||
CloseTooltip();
|
CloseTooltip();
|
||||||
@@ -64,7 +63,7 @@ namespace Content.Client.Examine
|
|||||||
base.Shutdown();
|
base.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanExamine(IEntity examiner, MapCoordinates target, Ignored? predicate = null)
|
public override bool CanExamine(EntityUid examiner, MapCoordinates target, Ignored? predicate = null)
|
||||||
{
|
{
|
||||||
var b = _eyeManager.GetWorldViewbounds();
|
var b = _eyeManager.GetWorldViewbounds();
|
||||||
if (!b.Contains(target.Position))
|
if (!b.Contains(target.Position))
|
||||||
@@ -73,16 +72,16 @@ namespace Content.Client.Examine
|
|||||||
return base.CanExamine(examiner, target, predicate);
|
return base.CanExamine(examiner, target, predicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool HandleExamine(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
|
private bool HandleExamine(ICommonSession? session, EntityCoordinates coords, EntityUid entity)
|
||||||
{
|
{
|
||||||
if (!uid.IsValid() || !EntityManager.TryGetEntity(uid, out var entity))
|
if (!entity.IsValid() || !EntityManager.EntityExists(entity))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
_playerEntity = _playerManager.LocalPlayer?.ControlledEntity ?? default;
|
||||||
|
|
||||||
if (_playerEntity == null || !CanExamine(_playerEntity, entity))
|
if (_playerEntity == default || !CanExamine(_playerEntity, entity))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -104,7 +103,7 @@ namespace Content.Client.Examine
|
|||||||
args.Verbs.Add(verb);
|
args.Verbs.Add(verb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void DoExamine(IEntity entity)
|
public async void DoExamine(EntityUid entity)
|
||||||
{
|
{
|
||||||
// Close any examine tooltip that might already be opened
|
// Close any examine tooltip that might already be opened
|
||||||
CloseTooltip();
|
CloseTooltip();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Explosion;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Explosion
|
namespace Content.Client.Explosion
|
||||||
@@ -17,7 +18,8 @@ namespace Content.Client.Explosion
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent<ISpriteComponent>(out var sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent<ISpriteComponent>(component.Owner, out var sprite))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace Content.Client.Flash
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Yes, this code is awful. I'm just porting it to an entity system so don't blame me.
|
// Yes, this code is awful. I'm just porting it to an entity system so don't blame me.
|
||||||
if (_playerManager.LocalPlayer != null && _playerManager.LocalPlayer.Session.AttachedEntityUid != uid)
|
if (_playerManager.LocalPlayer != null && _playerManager.LocalPlayer.Session.AttachedEntity != uid)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ using Robust.Shared.Maths;
|
|||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
|
|
||||||
namespace Content.Client.Fluids
|
namespace Content.Client.Fluids
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
@@ -21,7 +20,7 @@ namespace Content.Client.Fluids
|
|||||||
// Whether the underlying solution color should be used
|
// Whether the underlying solution color should be used
|
||||||
[DataField("recolor")] public bool Recolor;
|
[DataField("recolor")] public bool Recolor;
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
@@ -46,8 +45,9 @@ namespace Content.Client.Fluids
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
if (component.TryGetData<float>(PuddleVisuals.VolumeScale, out var volumeScale) &&
|
if (component.TryGetData<float>(PuddleVisuals.VolumeScale, out var volumeScale) &&
|
||||||
component.Owner.TryGetComponent<SpriteComponent>(out var spriteComponent))
|
entities.TryGetComponent<SpriteComponent>(component.Owner, out var spriteComponent))
|
||||||
{
|
{
|
||||||
var cappedScale = Math.Min(1.0f, volumeScale * 0.75f +0.25f);
|
var cappedScale = Math.Min(1.0f, volumeScale * 0.75f +0.25f);
|
||||||
UpdateVisual(component, spriteComponent, cappedScale);
|
UpdateVisual(component, spriteComponent, cappedScale);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using Content.Shared.Ghost;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Robust.Client.UserInterface.Controls;
|
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
@@ -36,7 +35,7 @@ namespace Content.Client.Ghost
|
|||||||
|
|
||||||
foreach (var ghost in EntityManager.GetAllComponents(typeof(GhostComponent), true))
|
foreach (var ghost in EntityManager.GetAllComponents(typeof(GhostComponent), true))
|
||||||
{
|
{
|
||||||
if (EntityManager.TryGetComponent(ghost.OwnerUid, out SpriteComponent? sprite))
|
if (EntityManager.TryGetComponent(ghost.Owner, out SpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
sprite.Visible = value;
|
sprite.Visible = value;
|
||||||
}
|
}
|
||||||
@@ -60,7 +59,7 @@ namespace Content.Client.Ghost
|
|||||||
|
|
||||||
private void OnGhostInit(EntityUid uid, GhostComponent component, ComponentInit args)
|
private void OnGhostInit(EntityUid uid, GhostComponent component, ComponentInit args)
|
||||||
{
|
{
|
||||||
if (EntityManager.TryGetComponent(component.OwnerUid, out SpriteComponent? sprite))
|
if (EntityManager.TryGetComponent(component.Owner, out SpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
sprite.Visible = GhostVisibility;
|
sprite.Visible = GhostVisibility;
|
||||||
}
|
}
|
||||||
@@ -101,7 +100,7 @@ namespace Content.Client.Ghost
|
|||||||
|
|
||||||
private void OnGhostWarpsResponse(GhostWarpsResponseEvent msg)
|
private void OnGhostWarpsResponse(GhostWarpsResponseEvent msg)
|
||||||
{
|
{
|
||||||
var entity = _playerManager.LocalPlayer?.ControlledEntity?.Uid;
|
var entity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
|
|
||||||
if (entity == null ||
|
if (entity == null ||
|
||||||
!EntityManager.TryGetComponent(entity.Value, out GhostComponent? ghost))
|
!EntityManager.TryGetComponent(entity.Value, out GhostComponent? ghost))
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Content.Client.Gravity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ namespace Content.Client.Hands
|
|||||||
/// The item being held in this hand.
|
/// The item being held in this hand.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public IEntity? HeldItem { get; }
|
public EntityUid HeldItem { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The button in the gui associated with this hand. Assumed to be set by gui shortly after being received from the client HandsComponent.
|
/// The button in the gui associated with this hand. Assumed to be set by gui shortly after being received from the client HandsComponent.
|
||||||
@@ -258,7 +258,7 @@ namespace Content.Client.Hands
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public HandButton HandButton { get; set; } = default!;
|
public HandButton HandButton { get; set; } = default!;
|
||||||
|
|
||||||
public GuiHand(string name, HandLocation handLocation, IEntity? heldItem)
|
public GuiHand(string name, HandLocation handLocation, EntityUid heldItem)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
HandLocation = handLocation;
|
HandLocation = handLocation;
|
||||||
|
|||||||
@@ -1,24 +1,22 @@
|
|||||||
|
using System;
|
||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.ResourceManagement;
|
using Robust.Client.ResourceManagement;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Content.Client.Hands
|
namespace Content.Client.Hands
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class HandsVisualizer : AppearanceVisualizer
|
public class HandsVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent<ISpriteComponent>(out var sprite)) return;
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent<ISpriteComponent>(component.Owner, out var sprite)) return;
|
||||||
if (!component.TryGetData(HandsVisuals.VisualState, out HandsVisualState visualState)) return;
|
if (!component.TryGetData(HandsVisuals.VisualState, out HandsVisualState visualState)) return;
|
||||||
|
|
||||||
foreach (HandLocation location in Enum.GetValues(typeof(HandLocation)))
|
foreach (HandLocation location in Enum.GetValues(typeof(HandLocation)))
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Content.Client.Hands
|
|||||||
var sys = EntitySystem.Get<HandsSystem>();
|
var sys = EntitySystem.Get<HandsSystem>();
|
||||||
var handEntity = sys.GetActiveHandEntity();
|
var handEntity = sys.GetActiveHandEntity();
|
||||||
|
|
||||||
if (handEntity == null || !_cfg.GetCVar(CCVars.HudHeldItemShow) || !IoCManager.Resolve<IEntityManager>().HasComponent<ISpriteComponent>(handEntity))
|
if (handEntity == default || !_cfg.GetCVar(CCVars.HudHeldItemShow) || !IoCManager.Resolve<IEntityManager>().HasComponent<ISpriteComponent>(handEntity))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var screen = args.ScreenHandle;
|
var screen = args.ScreenHandle;
|
||||||
|
|||||||
@@ -56,13 +56,13 @@ namespace Content.Client.Hands
|
|||||||
|
|
||||||
private void HandlePickupAnimation(PickupAnimationMessage msg)
|
private void HandlePickupAnimation(PickupAnimationMessage msg)
|
||||||
{
|
{
|
||||||
if (!EntityManager.TryGetEntity(msg.EntityUid, out var entity))
|
if (!msg.EntityUid.IsValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_gameTiming.IsFirstTimePredicted)
|
if (!_gameTiming.IsFirstTimePredicted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ReusableAnimations.AnimateEntityPickup(entity, msg.InitialPosition, msg.FinalPosition);
|
ReusableAnimations.AnimateEntityPickup(msg.EntityUid, msg.InitialPosition, msg.FinalPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HandsGuiState GetGuiState()
|
public HandsGuiState GetGuiState()
|
||||||
@@ -77,10 +77,10 @@ namespace Content.Client.Hands
|
|||||||
return new HandsGuiState(states, hands.ActiveHand);
|
return new HandsGuiState(states, hands.ActiveHand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEntity? GetActiveHandEntity()
|
public EntityUid GetActiveHandEntity()
|
||||||
{
|
{
|
||||||
if (GetPlayerHandsComponent() is not { ActiveHand: { } active } hands)
|
if (GetPlayerHandsComponent() is not { ActiveHand: { } active } hands)
|
||||||
return null;
|
return default;
|
||||||
|
|
||||||
return hands.GetHand(active).HeldEntity;
|
return hands.GetHand(active).HeldEntity;
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ namespace Content.Client.Hands
|
|||||||
{
|
{
|
||||||
var player = _playerManager.LocalPlayer?.ControlledEntity;
|
var player = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
|
|
||||||
if (player == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(player, out HandsComponent? hands))
|
if (player is not {Valid: true} || !EntityManager.TryGetComponent(player.Value, out HandsComponent? hands))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return hands;
|
return hands;
|
||||||
@@ -106,7 +106,7 @@ namespace Content.Client.Hands
|
|||||||
var pressedEntity = pressedHand.HeldEntity;
|
var pressedEntity = pressedHand.HeldEntity;
|
||||||
var activeEntity = activeHand.HeldEntity;
|
var activeEntity = activeHand.HeldEntity;
|
||||||
|
|
||||||
if (pressedHand == activeHand && activeEntity != null)
|
if (pressedHand == activeHand && activeEntity != default)
|
||||||
{
|
{
|
||||||
// use item in hand
|
// use item in hand
|
||||||
// it will always be attack_self() in my heart.
|
// it will always be attack_self() in my heart.
|
||||||
@@ -114,21 +114,21 @@ namespace Content.Client.Hands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pressedHand != activeHand && pressedEntity == null)
|
if (pressedHand != activeHand && pressedEntity == default)
|
||||||
{
|
{
|
||||||
// change active hand
|
// change active hand
|
||||||
RaiseNetworkEvent(new RequestSetHandEvent(handName));
|
RaiseNetworkEvent(new RequestSetHandEvent(handName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pressedHand != activeHand && pressedEntity != null && activeEntity != null)
|
if (pressedHand != activeHand && pressedEntity != default && activeEntity != default)
|
||||||
{
|
{
|
||||||
// use active item on held item
|
// use active item on held item
|
||||||
RaiseNetworkEvent(new ClientInteractUsingInHandMsg(pressedHand.Name));
|
RaiseNetworkEvent(new ClientInteractUsingInHandMsg(pressedHand.Name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pressedHand != activeHand && pressedEntity != null && activeEntity == null)
|
if (pressedHand != activeHand && pressedEntity != default && activeEntity == default)
|
||||||
{
|
{
|
||||||
// use active item on held item
|
// use active item on held item
|
||||||
RaiseNetworkEvent(new MoveItemFromHandMsg(pressedHand.Name));
|
RaiseNetworkEvent(new MoveItemFromHandMsg(pressedHand.Name));
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Content.Client.HealthOverlay
|
|||||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||||
|
|
||||||
private readonly Dictionary<EntityUid, HealthOverlayGui> _guis = new();
|
private readonly Dictionary<EntityUid, HealthOverlayGui> _guis = new();
|
||||||
private IEntity? _attachedEntity;
|
private EntityUid _attachedEntity;
|
||||||
private bool _enabled;
|
private bool _enabled;
|
||||||
|
|
||||||
public bool Enabled
|
public bool Enabled
|
||||||
@@ -55,7 +55,7 @@ namespace Content.Client.HealthOverlay
|
|||||||
}
|
}
|
||||||
|
|
||||||
_guis.Clear();
|
_guis.Clear();
|
||||||
_attachedEntity = null;
|
_attachedEntity = default;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandlePlayerAttached(PlayerAttachSysMessage message)
|
private void HandlePlayerAttached(PlayerAttachSysMessage message)
|
||||||
|
|||||||
@@ -16,8 +16,9 @@ namespace Content.Client.HealthOverlay.UI
|
|||||||
public class HealthOverlayGui : BoxContainer
|
public class HealthOverlayGui : BoxContainer
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||||
|
[Dependency] private readonly IEntityManager _entities = default!;
|
||||||
|
|
||||||
public HealthOverlayGui(IEntity entity)
|
public HealthOverlayGui(EntityUid entity)
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
IoCManager.Resolve<IUserInterfaceManager>().StateRoot.AddChild(this);
|
IoCManager.Resolve<IUserInterfaceManager>().StateRoot.AddChild(this);
|
||||||
@@ -62,7 +63,7 @@ namespace Content.Client.HealthOverlay.UI
|
|||||||
|
|
||||||
public HealthOverlayBar CritBar { get; }
|
public HealthOverlayBar CritBar { get; }
|
||||||
|
|
||||||
public IEntity Entity { get; }
|
public EntityUid Entity { get; }
|
||||||
|
|
||||||
public void SetVisibility(bool val)
|
public void SetVisibility(bool val)
|
||||||
{
|
{
|
||||||
@@ -72,13 +73,13 @@ namespace Content.Client.HealthOverlay.UI
|
|||||||
|
|
||||||
private void MoreFrameUpdate(FrameEventArgs args)
|
private void MoreFrameUpdate(FrameEventArgs args)
|
||||||
{
|
{
|
||||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Entity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Entity).EntityLifeStage) >= EntityLifeStage.Deleted)
|
if ((!_entities.EntityExists(Entity) ? EntityLifeStage.Deleted : _entities.GetComponent<MetaDataComponent>(Entity).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Entity, out MobStateComponent? mobState) ||
|
if (!_entities.TryGetComponent(Entity, out MobStateComponent? mobState) ||
|
||||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(Entity, out DamageableComponent? damageable))
|
!_entities.TryGetComponent(Entity, out DamageableComponent? damageable))
|
||||||
{
|
{
|
||||||
CritBar.Visible = false;
|
CritBar.Visible = false;
|
||||||
HealthBar.Visible = false;
|
HealthBar.Visible = false;
|
||||||
@@ -138,8 +139,8 @@ namespace Content.Client.HealthOverlay.UI
|
|||||||
|
|
||||||
MoreFrameUpdate(args);
|
MoreFrameUpdate(args);
|
||||||
|
|
||||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Entity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Entity).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
if ((!_entities.EntityExists(Entity) ? EntityLifeStage.Deleted : _entities.GetComponent<MetaDataComponent>(Entity).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||||
_eyeManager.CurrentMap != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Entity).MapID)
|
_eyeManager.CurrentMap != _entities.GetComponent<TransformComponent>(Entity).MapID)
|
||||||
{
|
{
|
||||||
Visible = false;
|
Visible = false;
|
||||||
return;
|
return;
|
||||||
@@ -147,7 +148,7 @@ namespace Content.Client.HealthOverlay.UI
|
|||||||
|
|
||||||
Visible = true;
|
Visible = true;
|
||||||
|
|
||||||
var screenCoordinates = _eyeManager.CoordinatesToScreen(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Entity).Coordinates);
|
var screenCoordinates = _eyeManager.CoordinatesToScreen(_entities.GetComponent<TransformComponent>(Entity).Coordinates);
|
||||||
var playerPosition = UserInterfaceManager.ScreenToUIPosition(screenCoordinates);
|
var playerPosition = UserInterfaceManager.ScreenToUIPosition(screenCoordinates);
|
||||||
LayoutContainer.SetPosition(this, new Vector2(playerPosition.X - Width / 2, playerPosition.Y - Height - 30.0f));
|
LayoutContainer.SetPosition(this, new Vector2(playerPosition.X - Width / 2, playerPosition.Y - Height - 30.0f));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,12 +51,12 @@ namespace Content.Client.IconSmoothing
|
|||||||
// Yes, we updates ALL smoothing entities surrounding us even if they would never smooth with us.
|
// Yes, we updates ALL smoothing entities surrounding us even if they would never smooth with us.
|
||||||
// This is simpler to implement. If you want to optimize it be my guest.
|
// This is simpler to implement. If you want to optimize it be my guest.
|
||||||
var senderEnt = ev.Sender;
|
var senderEnt = ev.Sender;
|
||||||
if (IoCManager.Resolve<IEntityManager>().EntityExists(senderEnt) &&
|
if (EntityManager.EntityExists(senderEnt) &&
|
||||||
_mapManager.TryGetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(senderEnt).GridID, out var grid1) &&
|
_mapManager.TryGetGrid(EntityManager.GetComponent<TransformComponent>(senderEnt).GridID, out var grid1) &&
|
||||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(senderEnt, out IconSmoothComponent? iconSmooth)
|
EntityManager.TryGetComponent(senderEnt, out IconSmoothComponent? iconSmooth)
|
||||||
&& iconSmooth.Running)
|
&& iconSmooth.Running)
|
||||||
{
|
{
|
||||||
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(senderEnt).Coordinates;
|
var coords = EntityManager.GetComponent<TransformComponent>(senderEnt).Coordinates;
|
||||||
|
|
||||||
_dirtyEntities.Enqueue(senderEnt);
|
_dirtyEntities.Enqueue(senderEnt);
|
||||||
AddValidEntities(grid1.GetInDir(coords, Direction.North));
|
AddValidEntities(grid1.GetInDir(coords, Direction.North));
|
||||||
@@ -130,7 +130,7 @@ namespace Content.Client.IconSmoothing
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class IconSmoothDirtyEvent : EntityEventArgs
|
public sealed class IconSmoothDirtyEvent : EntityEventArgs
|
||||||
{
|
{
|
||||||
public IconSmoothDirtyEvent(IEntity sender, (GridId grid, Vector2i pos)? lastPosition, IconSmoothingMode mode)
|
public IconSmoothDirtyEvent(EntityUid sender, (GridId grid, Vector2i pos)? lastPosition, IconSmoothingMode mode)
|
||||||
{
|
{
|
||||||
LastPosition = lastPosition;
|
LastPosition = lastPosition;
|
||||||
Mode = mode;
|
Mode = mode;
|
||||||
@@ -139,6 +139,6 @@ namespace Content.Client.IconSmoothing
|
|||||||
|
|
||||||
public (GridId grid, Vector2i pos)? LastPosition { get; }
|
public (GridId grid, Vector2i pos)? LastPosition { get; }
|
||||||
public IconSmoothingMode Mode { get; }
|
public IconSmoothingMode Mode { get; }
|
||||||
public IEntity Sender { get; }
|
public EntityUid Sender { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,11 +135,11 @@ namespace Content.Client.Instruments.UI
|
|||||||
var instrument = _owner.Instrument;
|
var instrument = _owner.Instrument;
|
||||||
|
|
||||||
// If either the entity or component are null, return.
|
// If either the entity or component are null, return.
|
||||||
if (instrumentEnt == null || instrument == null)
|
if (instrumentEnt == default || instrument == default)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If we're a handheld instrument, we might be in a container. Get it just in case.
|
// If we're a handheld instrument, we might be in a container. Get it just in case.
|
||||||
instrumentEnt.TryGetContainerMan(out var conMan);
|
instrumentEnt.Value.TryGetContainerMan(out var conMan);
|
||||||
|
|
||||||
var localPlayer = IoCManager.Resolve<IPlayerManager>().LocalPlayer;
|
var localPlayer = IoCManager.Resolve<IPlayerManager>().LocalPlayer;
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ namespace Content.Client.Instruments.UI
|
|||||||
|| conMan.Owner != localPlayer.ControlledEntity))) return false;
|
|| conMan.Owner != localPlayer.ControlledEntity))) return false;
|
||||||
|
|
||||||
// We check that we're in range unobstructed just in case.
|
// We check that we're in range unobstructed just in case.
|
||||||
return localPlayer.InRangeUnobstructed(instrumentEnt,
|
return localPlayer.InRangeUnobstructed(instrumentEnt.Value,
|
||||||
predicate: (e) => e == instrumentEnt || e == localPlayer.ControlledEntity);
|
predicate: (e) => e == instrumentEnt || e == localPlayer.ControlledEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ namespace Content.Client.Interactable
|
|||||||
{
|
{
|
||||||
public override bool CanAccessViaStorage(EntityUid user, EntityUid target)
|
public override bool CanAccessViaStorage(EntityUid user, EntityUid target)
|
||||||
{
|
{
|
||||||
if (!EntityManager.TryGetEntity(target, out var entity))
|
if (!EntityManager.EntityExists(target))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!entity.TryGetContainer(out var container))
|
if (!target.TryGetContainer(out var container))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!EntityManager.TryGetComponent(container.Owner, out ClientStorageComponent storage))
|
if (!EntityManager.TryGetComponent(container.Owner, out ClientStorageComponent storage))
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Content.Client.Interactable
|
|||||||
|
|
||||||
public static bool InRangeUnobstructed(
|
public static bool InRangeUnobstructed(
|
||||||
this LocalPlayer origin,
|
this LocalPlayer origin,
|
||||||
IEntity other,
|
EntityUid other,
|
||||||
float range = InteractionRange,
|
float range = InteractionRange,
|
||||||
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
||||||
Ignored? predicate = null,
|
Ignored? predicate = null,
|
||||||
@@ -78,7 +78,7 @@ namespace Content.Client.Interactable
|
|||||||
bool popup = false)
|
bool popup = false)
|
||||||
{
|
{
|
||||||
var originEntity = origin.ControlledEntity;
|
var originEntity = origin.ControlledEntity;
|
||||||
if (originEntity == null)
|
if (originEntity == default)
|
||||||
{
|
{
|
||||||
// TODO: Take into account the player's camera position?
|
// TODO: Take into account the player's camera position?
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Client.Clothing;
|
using Content.Client.Clothing;
|
||||||
using Content.Shared.CharacterAppearance;
|
using Content.Shared.CharacterAppearance;
|
||||||
using Content.Shared.Chemistry;
|
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
using Content.Shared.Movement.Components;
|
|
||||||
using Content.Shared.Movement.EntitySystems;
|
using Content.Shared.Movement.EntitySystems;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -24,9 +22,9 @@ namespace Content.Client.Inventory
|
|||||||
[ComponentReference(typeof(SharedInventoryComponent))]
|
[ComponentReference(typeof(SharedInventoryComponent))]
|
||||||
public class ClientInventoryComponent : SharedInventoryComponent
|
public class ClientInventoryComponent : SharedInventoryComponent
|
||||||
{
|
{
|
||||||
private readonly Dictionary<Slots, IEntity> _slots = new();
|
private readonly Dictionary<Slots, EntityUid> _slots = new();
|
||||||
|
|
||||||
public IReadOnlyDictionary<Slots, IEntity> AllSlots => _slots;
|
public IReadOnlyDictionary<Slots, EntityUid> AllSlots => _slots;
|
||||||
|
|
||||||
[ViewVariables] public InventoryInterfaceController InterfaceController { get; private set; } = default!;
|
[ViewVariables] public InventoryInterfaceController InterfaceController { get; private set; } = default!;
|
||||||
|
|
||||||
@@ -78,9 +76,9 @@ namespace Content.Client.Inventory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsEquipped(IEntity item)
|
public override bool IsEquipped(EntityUid item)
|
||||||
{
|
{
|
||||||
return item != null && _slots.Values.Any(e => e == item);
|
return item != default && _slots.Values.Any(e => e == item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||||
@@ -92,9 +90,9 @@ namespace Content.Client.Inventory
|
|||||||
|
|
||||||
var doneSlots = new HashSet<Slots>();
|
var doneSlots = new HashSet<Slots>();
|
||||||
|
|
||||||
foreach (var (slot, entityUid) in state.Entities)
|
foreach (var (slot, entity) in state.Entities)
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().TryGetEntity(entityUid, out var entity))
|
if (!IoCManager.Resolve<IEntityManager>().EntityExists(entity))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -108,9 +106,7 @@ namespace Content.Client.Inventory
|
|||||||
|
|
||||||
if (state.HoverEntity != null)
|
if (state.HoverEntity != null)
|
||||||
{
|
{
|
||||||
var (slot, (entityUid, fits)) = state.HoverEntity.Value;
|
var (slot, (entity, fits)) = state.HoverEntity.Value;
|
||||||
var entity = IoCManager.Resolve<IEntityManager>().GetEntity(entityUid);
|
|
||||||
|
|
||||||
InterfaceController?.HoverInSlot(slot, entity, fits);
|
InterfaceController?.HoverInSlot(slot, entity, fits);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,14 +122,14 @@ namespace Content.Client.Inventory
|
|||||||
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(((IComponent) this).Owner);
|
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(((IComponent) this).Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _setSlot(Slots slot, IEntity entity)
|
private void _setSlot(Slots slot, EntityUid entity)
|
||||||
{
|
{
|
||||||
SetSlotVisuals(slot, entity);
|
SetSlotVisuals(slot, entity);
|
||||||
|
|
||||||
InterfaceController?.AddToSlot(slot, entity);
|
InterfaceController?.AddToSlot(slot, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SetSlotVisuals(Slots slot, IEntity entity)
|
internal void SetSlotVisuals(Slots slot, EntityUid entity)
|
||||||
{
|
{
|
||||||
if (_sprite == null)
|
if (_sprite == null)
|
||||||
{
|
{
|
||||||
@@ -230,12 +226,12 @@ namespace Content.Client.Inventory
|
|||||||
_playerAttached = true;
|
_playerAttached = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetSlot(Slots slot, [NotNullWhen(true)] out IEntity? item)
|
public bool TryGetSlot(Slots slot, [NotNullWhen(true)] out EntityUid item)
|
||||||
{
|
{
|
||||||
return _slots.TryGetValue(slot, out item);
|
return _slots.TryGetValue(slot, out item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryFindItemSlots(IEntity item, [NotNullWhen(true)] out Slots? slots)
|
public bool TryFindItemSlots(EntityUid item, [NotNullWhen(true)] out Slots? slots)
|
||||||
{
|
{
|
||||||
slots = null;
|
slots = null;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Content.Client.HUD;
|
using Content.Client.HUD;
|
||||||
using Content.Client.Items.Components;
|
|
||||||
using Content.Shared.Input;
|
using Content.Shared.Input;
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
using Content.Shared.Movement.EntitySystems;
|
using Content.Shared.Movement.EntitySystems;
|
||||||
@@ -36,7 +35,7 @@ namespace Content.Client.Inventory
|
|||||||
// jesus christ, this is duplicated to server/client, should really just be shared..
|
// jesus christ, this is duplicated to server/client, should really just be shared..
|
||||||
private void OnSlipAttemptEvent(EntityUid uid, ClientInventoryComponent component, SlipAttemptEvent args)
|
private void OnSlipAttemptEvent(EntityUid uid, ClientInventoryComponent component, SlipAttemptEvent args)
|
||||||
{
|
{
|
||||||
if (component.TryGetSlot(EquipmentSlotDefines.Slots.SHOES, out IEntity? shoes))
|
if (component.TryGetSlot(EquipmentSlotDefines.Slots.SHOES, out EntityUid shoes))
|
||||||
{
|
{
|
||||||
RaiseLocalEvent(shoes, args, false);
|
RaiseLocalEvent(shoes, args, false);
|
||||||
}
|
}
|
||||||
@@ -46,7 +45,7 @@ namespace Content.Client.Inventory
|
|||||||
{
|
{
|
||||||
foreach (var (_, ent) in component.AllSlots)
|
foreach (var (_, ent) in component.AllSlots)
|
||||||
{
|
{
|
||||||
if (ent != null)
|
if (ent != default)
|
||||||
{
|
{
|
||||||
RaiseLocalEvent(ent, args, false);
|
RaiseLocalEvent(ent, args, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ using System.Linq;
|
|||||||
using Content.Client.HUD;
|
using Content.Client.HUD;
|
||||||
using Content.Client.Items.Managers;
|
using Content.Client.Items.Managers;
|
||||||
using Content.Client.Items.UI;
|
using Content.Client.Items.UI;
|
||||||
using Content.Shared;
|
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.ResourceManagement;
|
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
@@ -15,7 +13,6 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using static Content.Shared.Inventory.EquipmentSlotDefines;
|
using static Content.Shared.Inventory.EquipmentSlotDefines;
|
||||||
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
||||||
|
|
||||||
@@ -155,7 +152,7 @@ namespace Content.Client.Inventory
|
|||||||
return buttons;
|
return buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddToSlot(Slots slot, IEntity entity)
|
public override void AddToSlot(Slots slot, EntityUid entity)
|
||||||
{
|
{
|
||||||
base.AddToSlot(slot, entity);
|
base.AddToSlot(slot, entity);
|
||||||
|
|
||||||
@@ -184,7 +181,7 @@ namespace Content.Client.Inventory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void HoverInSlot(Slots slot, IEntity entity, bool fits)
|
public override void HoverInSlot(Slots slot, EntityUid entity, bool fits)
|
||||||
{
|
{
|
||||||
base.HoverInSlot(slot, entity, fits);
|
base.HoverInSlot(slot, entity, fits);
|
||||||
|
|
||||||
@@ -213,7 +210,7 @@ namespace Content.Client.Inventory
|
|||||||
private void ClearButton(ItemSlotButton button, Slots slot)
|
private void ClearButton(ItemSlotButton button, Slots slot)
|
||||||
{
|
{
|
||||||
button.OnPressed = (e) => AddToInventory(e, slot);
|
button.OnPressed = (e) => AddToInventory(e, slot);
|
||||||
_itemSlotManager.SetItemSlot(button, null);
|
_itemSlotManager.SetItemSlot(button, default);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PlayerAttached()
|
public override void PlayerAttached()
|
||||||
|
|||||||
@@ -46,11 +46,11 @@ namespace Content.Client.Inventory
|
|||||||
/// specified slot, if any. Empty if none.</returns>
|
/// specified slot, if any. Empty if none.</returns>
|
||||||
public abstract IEnumerable<ItemSlotButton> GetItemSlotButtons(EquipmentSlotDefines.Slots slot);
|
public abstract IEnumerable<ItemSlotButton> GetItemSlotButtons(EquipmentSlotDefines.Slots slot);
|
||||||
|
|
||||||
public virtual void AddToSlot(EquipmentSlotDefines.Slots slot, IEntity entity)
|
public virtual void AddToSlot(EquipmentSlotDefines.Slots slot, EntityUid entity)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void HoverInSlot(EquipmentSlotDefines.Slots slot, IEntity entity, bool fits)
|
public virtual void HoverInSlot(EquipmentSlotDefines.Slots slot, EntityUid entity, bool fits)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ namespace Content.Client.Items.Managers
|
|||||||
{
|
{
|
||||||
public interface IItemSlotManager
|
public interface IItemSlotManager
|
||||||
{
|
{
|
||||||
bool OnButtonPressed(GUIBoundKeyEventArgs args, IEntity? item);
|
bool OnButtonPressed(GUIBoundKeyEventArgs args, EntityUid item);
|
||||||
void UpdateCooldown(ItemSlotButton? cooldownTexture, IEntity? entity);
|
void UpdateCooldown(ItemSlotButton? cooldownTexture, EntityUid entity);
|
||||||
bool SetItemSlot(ItemSlotButton button, IEntity? entity);
|
bool SetItemSlot(ItemSlotButton button, EntityUid entity);
|
||||||
void HoverInSlot(ItemSlotButton button, IEntity? entity, bool fits);
|
void HoverInSlot(ItemSlotButton button, EntityUid entity, bool fits);
|
||||||
event Action<EntitySlotHighlightedEventArgs>? EntityHighlightedUpdated;
|
event Action<EntitySlotHighlightedEventArgs>? EntityHighlightedUpdated;
|
||||||
bool IsHighlighted(EntityUid uid);
|
bool IsHighlighted(EntityUid uid);
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,8 @@ using Content.Shared.Hands.Components;
|
|||||||
using Content.Shared.Input;
|
using Content.Shared.Input;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
|
||||||
using Robust.Client.Input;
|
|
||||||
using Robust.Client.Player;
|
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Input;
|
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -32,9 +28,9 @@ namespace Content.Client.Items.Managers
|
|||||||
|
|
||||||
public event Action<EntitySlotHighlightedEventArgs>? EntityHighlightedUpdated;
|
public event Action<EntitySlotHighlightedEventArgs>? EntityHighlightedUpdated;
|
||||||
|
|
||||||
public bool SetItemSlot(ItemSlotButton button, IEntity? entity)
|
public bool SetItemSlot(ItemSlotButton button, EntityUid entity)
|
||||||
{
|
{
|
||||||
if (entity == null)
|
if (entity == default)
|
||||||
{
|
{
|
||||||
button.SpriteView.Sprite = null;
|
button.SpriteView.Sprite = null;
|
||||||
button.StorageButton.Visible = false;
|
button.StorageButton.Visible = false;
|
||||||
@@ -42,31 +38,31 @@ namespace Content.Client.Items.Managers
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ISpriteComponent? sprite;
|
ISpriteComponent? sprite;
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out HandVirtualItemComponent? virtPull)
|
if (_entityManager.TryGetComponent(entity, out HandVirtualItemComponent? virtPull)
|
||||||
&& _entityManager.TryGetComponent(virtPull.BlockingEntity, out ISpriteComponent pulledSprite))
|
&& _entityManager.TryGetComponent(virtPull.BlockingEntity, out ISpriteComponent pulledSprite))
|
||||||
{
|
{
|
||||||
sprite = pulledSprite;
|
sprite = pulledSprite;
|
||||||
}
|
}
|
||||||
else if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out sprite))
|
else if (!_entityManager.TryGetComponent(entity, out sprite))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.ClearHover();
|
button.ClearHover();
|
||||||
button.SpriteView.Sprite = sprite;
|
button.SpriteView.Sprite = sprite;
|
||||||
button.StorageButton.Visible = IoCManager.Resolve<IEntityManager>().HasComponent<ClientStorageComponent>(entity);
|
button.StorageButton.Visible = _entityManager.HasComponent<ClientStorageComponent>(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
button.Entity = entity ?? default;
|
button.Entity = entity;
|
||||||
|
|
||||||
// im lazy
|
// im lazy
|
||||||
button.UpdateSlotHighlighted();
|
button.UpdateSlotHighlighted();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnButtonPressed(GUIBoundKeyEventArgs args, IEntity? item)
|
public bool OnButtonPressed(GUIBoundKeyEventArgs args, EntityUid item)
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == default)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (args.Function == ContentKeyFunctions.ExamineEntity)
|
if (args.Function == ContentKeyFunctions.ExamineEntity)
|
||||||
@@ -94,7 +90,7 @@ namespace Content.Client.Items.Managers
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateCooldown(ItemSlotButton? button, IEntity? entity)
|
public void UpdateCooldown(ItemSlotButton? button, EntityUid entity)
|
||||||
{
|
{
|
||||||
var cooldownDisplay = button?.CooldownDisplay;
|
var cooldownDisplay = button?.CooldownDisplay;
|
||||||
|
|
||||||
@@ -103,9 +99,9 @@ namespace Content.Client.Items.Managers
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity == null ||
|
if (entity == default ||
|
||||||
(!IoCManager.Resolve<IEntityManager>().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
(!_entityManager.EntityExists(entity) ? EntityLifeStage.Deleted : _entityManager.GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out ItemCooldownComponent? cooldown) ||
|
!_entityManager.TryGetComponent(entity, out ItemCooldownComponent? cooldown) ||
|
||||||
!cooldown.CooldownStart.HasValue ||
|
!cooldown.CooldownStart.HasValue ||
|
||||||
!cooldown.CooldownEnd.HasValue)
|
!cooldown.CooldownEnd.HasValue)
|
||||||
{
|
{
|
||||||
@@ -124,23 +120,23 @@ namespace Content.Client.Items.Managers
|
|||||||
cooldownDisplay.Visible = ratio > -1f;
|
cooldownDisplay.Visible = ratio > -1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HoverInSlot(ItemSlotButton button, IEntity? entity, bool fits)
|
public void HoverInSlot(ItemSlotButton button, EntityUid entity, bool fits)
|
||||||
{
|
{
|
||||||
if (entity == null || !button.MouseIsHovering)
|
if (entity == default || !button.MouseIsHovering)
|
||||||
{
|
{
|
||||||
button.ClearHover();
|
button.ClearHover();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<SpriteComponent>(entity))
|
if (!_entityManager.HasComponent<SpriteComponent>(entity))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set green / red overlay at 50% transparency
|
// Set green / red overlay at 50% transparency
|
||||||
var hoverEntity = _entityManager.SpawnEntity("hoverentity", MapCoordinates.Nullspace);
|
var hoverEntity = _entityManager.SpawnEntity("hoverentity", MapCoordinates.Nullspace);
|
||||||
var hoverSprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(hoverEntity);
|
var hoverSprite = _entityManager.GetComponent<SpriteComponent>(hoverEntity);
|
||||||
hoverSprite.CopyFrom(IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(entity));
|
hoverSprite.CopyFrom(_entityManager.GetComponent<SpriteComponent>(entity));
|
||||||
hoverSprite.Color = fits ? new Color(0, 255, 0, 127) : new Color(255, 0, 0, 127);
|
hoverSprite.Color = fits ? new Color(0, 255, 0, 127) : new Color(255, 0, 0, 127);
|
||||||
|
|
||||||
button.HoverSpriteView.Sprite = hoverSprite;
|
button.HoverSpriteView.Sprite = hoverSprite;
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ namespace Content.Client.Items.UI
|
|||||||
ISpriteComponent? tempQualifier = HoverSpriteView.Sprite;
|
ISpriteComponent? tempQualifier = HoverSpriteView.Sprite;
|
||||||
if (tempQualifier != null)
|
if (tempQualifier != null)
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) tempQualifier.Owner);
|
IoCManager.Resolve<IEntityManager>().DeleteEntity(tempQualifier.Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
HoverSpriteView.Sprite = null;
|
HoverSpriteView.Sprite = null;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Content.Client.Items.UI
|
|||||||
private readonly PanelContainer _panel;
|
private readonly PanelContainer _panel;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private IEntity? _entity;
|
private EntityUid _entity;
|
||||||
|
|
||||||
public ItemStatusPanel(Texture texture, StyleBox.Margin cutout, StyleBox.Margin flat, Label.AlignMode textAlign)
|
public ItemStatusPanel(Texture texture, StyleBox.Margin cutout, StyleBox.Margin flat, Label.AlignMode textAlign)
|
||||||
{
|
{
|
||||||
@@ -130,12 +130,12 @@ namespace Content.Client.Items.UI
|
|||||||
UpdateItemName();
|
UpdateItemName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(IEntity? entity)
|
public void Update(EntityUid entity)
|
||||||
{
|
{
|
||||||
if (entity == null)
|
if (entity == default)
|
||||||
{
|
{
|
||||||
ClearOldStatus();
|
ClearOldStatus();
|
||||||
_entity = null;
|
_entity = default;
|
||||||
_panel.Visible = false;
|
_panel.Visible = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -153,17 +153,17 @@ namespace Content.Client.Items.UI
|
|||||||
|
|
||||||
private void UpdateItemName()
|
private void UpdateItemName()
|
||||||
{
|
{
|
||||||
if (_entity == null)
|
if (_entity == default)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(_entity, out HandVirtualItemComponent? virtualItem)
|
if (_entityManager.TryGetComponent(_entity, out HandVirtualItemComponent? virtualItem)
|
||||||
&& _entityManager.TryGetEntity(virtualItem.BlockingEntity, out var blockEnt))
|
&& _entityManager.EntityExists(virtualItem.BlockingEntity))
|
||||||
{
|
{
|
||||||
_itemNameLabel.Text = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(blockEnt).EntityName;
|
_itemNameLabel.Text = _entityManager.GetComponent<MetaDataComponent>(virtualItem.BlockingEntity).EntityName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_itemNameLabel.Text = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(_entity).EntityName;
|
_itemNameLabel.Text = _entityManager.GetComponent<MetaDataComponent>(_entity).EntityName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ namespace Content.Client.Items.UI
|
|||||||
|
|
||||||
ClearOldStatus();
|
ClearOldStatus();
|
||||||
|
|
||||||
foreach (var statusComponent in IoCManager.Resolve<IEntityManager>().GetComponents<IItemStatus>(_entity!))
|
foreach (var statusComponent in _entityManager.GetComponents<IItemStatus>(_entity))
|
||||||
{
|
{
|
||||||
var control = statusComponent.MakeControl();
|
var control = statusComponent.MakeControl();
|
||||||
_statusContents.AddChild(control);
|
_statusContents.AddChild(control);
|
||||||
@@ -194,7 +194,7 @@ namespace Content.Client.Items.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
var collectMsg = new ItemStatusCollectMessage();
|
var collectMsg = new ItemStatusCollectMessage();
|
||||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(_entity, collectMsg);
|
_entityManager.EventBus.RaiseLocalEvent(_entity, collectMsg);
|
||||||
|
|
||||||
foreach (var control in collectMsg.Controls)
|
foreach (var control in collectMsg.Controls)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace Content.Client.Kitchen.UI
|
|||||||
BeakerContentBox.EjectButton.Disabled = true;
|
BeakerContentBox.EjectButton.Disabled = true;
|
||||||
ChamberContentBox.EjectButton.Disabled = true;
|
ChamberContentBox.EjectButton.Disabled = true;
|
||||||
break;
|
break;
|
||||||
case SharedReagentGrinderComponent.ReagentGrinderWorkCompleteMessage doneMessage:
|
case SharedReagentGrinderComponent.ReagentGrinderWorkCompleteMessage:
|
||||||
GrindButton.Disabled = false;
|
GrindButton.Disabled = false;
|
||||||
JuiceButton.Disabled = false;
|
JuiceButton.Disabled = false;
|
||||||
GrindButton.Modulate = Color.White;
|
GrindButton.Modulate = Color.White;
|
||||||
@@ -93,9 +93,9 @@ namespace Content.Client.Kitchen.UI
|
|||||||
_chamberVisualContents.Clear();
|
_chamberVisualContents.Clear();
|
||||||
|
|
||||||
ChamberContentBox.BoxContents.Clear();
|
ChamberContentBox.BoxContents.Clear();
|
||||||
foreach (var uid in containedSolids)
|
foreach (var entity in containedSolids)
|
||||||
{
|
{
|
||||||
if (!_entityManager.TryGetEntity(uid, out var entity))
|
if (!_entityManager.EntityExists(entity))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@ namespace Content.Client.Kitchen.UI
|
|||||||
|
|
||||||
var solidItem = ChamberContentBox.BoxContents.AddItem(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName, texture);
|
var solidItem = ChamberContentBox.BoxContents.AddItem(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName, texture);
|
||||||
var solidIndex = ChamberContentBox.BoxContents.IndexOf(solidItem);
|
var solidIndex = ChamberContentBox.BoxContents.IndexOf(solidItem);
|
||||||
_chamberVisualContents.Add(solidIndex, uid);
|
_chamberVisualContents.Add(solidIndex, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Refresh beaker contents
|
//Refresh beaker contents
|
||||||
|
|||||||
@@ -108,24 +108,24 @@ namespace Content.Client.Kitchen.UI
|
|||||||
|
|
||||||
_solids.Clear();
|
_solids.Clear();
|
||||||
_menu.IngredientsList.Clear();
|
_menu.IngredientsList.Clear();
|
||||||
foreach (var t in containedSolids)
|
foreach (var entity in containedSolids)
|
||||||
{
|
{
|
||||||
if (!_entityManager.TryGetEntity(t, out var entity))
|
if (!_entityManager.EntityExists(entity))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Deleted)
|
if ((!_entityManager.EntityExists(entity) ? EntityLifeStage.Deleted : _entityManager.GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture? texture;
|
Texture? texture;
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out IconComponent? iconComponent))
|
if (_entityManager.TryGetComponent(entity, out IconComponent? iconComponent))
|
||||||
{
|
{
|
||||||
texture = iconComponent.Icon?.Default;
|
texture = iconComponent.Icon?.Default;
|
||||||
}
|
}
|
||||||
else if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out SpriteComponent? spriteComponent))
|
else if (_entityManager.TryGetComponent(entity, out SpriteComponent? spriteComponent))
|
||||||
{
|
{
|
||||||
texture = spriteComponent.Icon?.Default;
|
texture = spriteComponent.Icon?.Default;
|
||||||
}
|
}
|
||||||
@@ -134,9 +134,9 @@ namespace Content.Client.Kitchen.UI
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var solidItem = _menu.IngredientsList.AddItem(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName, texture);
|
var solidItem = _menu.IngredientsList.AddItem(_entityManager.GetComponent<MetaDataComponent>(entity).EntityName, texture);
|
||||||
var solidIndex = _menu.IngredientsList.IndexOf(solidItem);
|
var solidIndex = _menu.IngredientsList.IndexOf(solidItem);
|
||||||
_solids.Add(solidIndex, t);
|
_solids.Add(solidIndex, entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.Kudzu;
|
using Content.Shared.Kudzu;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Kudzu;
|
namespace Content.Client.Kudzu;
|
||||||
@@ -14,7 +15,8 @@ public class KudzuVisualizer : AppearanceVisualizer
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent(out SpriteComponent? sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace Content.Client.Lathe.Visualizers
|
|||||||
return animation;
|
return animation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AnimationPlayerComponent>(entity))
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AnimationPlayerComponent>(entity))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace Content.Client.Lathe.Visualizers
|
|||||||
return animation;
|
return animation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AnimationPlayerComponent>(entity))
|
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AnimationPlayerComponent>(entity))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,9 +51,9 @@ namespace Content.Client.Light.Components
|
|||||||
[ViewVariables] protected float MaxTime { get; set; }
|
[ViewVariables] protected float MaxTime { get; set; }
|
||||||
|
|
||||||
private float _maxTime = default;
|
private float _maxTime = default;
|
||||||
private IEntity _parent = default!;
|
private EntityUid _parent = default!;
|
||||||
|
|
||||||
public void Initialize(IEntity parent, IRobustRandom random)
|
public void Initialize(EntityUid parent, IRobustRandom random)
|
||||||
{
|
{
|
||||||
_random = random;
|
_random = random;
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
@@ -128,7 +128,7 @@ namespace Content.Client.Light.Components
|
|||||||
|
|
||||||
if (Property == "Enabled") // special case for boolean
|
if (Property == "Enabled") // special case for boolean
|
||||||
{
|
{
|
||||||
ApplyProperty(interpolateValue < 0.5f? true : false);
|
ApplyProperty(interpolateValue < 0.5f);
|
||||||
return (-1, playingTime);
|
return (-1, playingTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ namespace Content.Client.Light.Components
|
|||||||
|
|
||||||
if (Property == "Enabled") // special case for boolean
|
if (Property == "Enabled") // special case for boolean
|
||||||
{
|
{
|
||||||
ApplyProperty(interpolateValue < EndValue? true : false);
|
ApplyProperty(interpolateValue < EndValue);
|
||||||
return (-1, playingTime);
|
return (-1, playingTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ namespace Content.Client.Light.Components
|
|||||||
ApplyProperty(InterpolateLinear(_randomValue3, _randomValue4, interpolateValue));
|
ApplyProperty(InterpolateLinear(_randomValue3, _randomValue4, interpolateValue));
|
||||||
break;
|
break;
|
||||||
case AnimationInterpolationMode.Cubic:
|
case AnimationInterpolationMode.Cubic:
|
||||||
ApplyProperty(InterpolateCubic(_randomValue1!, _randomValue2, _randomValue3, _randomValue4, interpolateValue));
|
ApplyProperty(InterpolateCubic(_randomValue1, _randomValue2, _randomValue3, _randomValue4, interpolateValue));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case AnimationInterpolationMode.Nearest:
|
case AnimationInterpolationMode.Nearest:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.Light.Component;
|
using Content.Shared.Light.Component;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Light.Visualizers
|
namespace Content.Client.Light.Visualizers
|
||||||
@@ -12,7 +13,8 @@ namespace Content.Client.Light.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent(out SpriteComponent? sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!component.TryGetData(EmergencyLightVisuals.On, out bool on))
|
if (!component.TryGetData(EmergencyLightVisuals.On, out bool on))
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using Content.Client.Light.Components;
|
||||||
using Content.Client.Light.Components;
|
|
||||||
using Content.Shared.Light.Component;
|
using Content.Shared.Light.Component;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Client.Light.Visualizers
|
namespace Content.Client.Light.Visualizers
|
||||||
@@ -16,9 +16,10 @@ namespace Content.Client.Light.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
if (component.TryGetData(ExpendableLightVisuals.Behavior, out string lightBehaviourID))
|
if (component.TryGetData(ExpendableLightVisuals.Behavior, out string lightBehaviourID))
|
||||||
{
|
{
|
||||||
if (component.Owner.TryGetComponent<LightBehaviourComponent>(out var lightBehaviour))
|
if (entities.TryGetComponent(component.Owner, out LightBehaviourComponent lightBehaviour))
|
||||||
{
|
{
|
||||||
lightBehaviour.StopLightBehaviour();
|
lightBehaviour.StopLightBehaviour();
|
||||||
|
|
||||||
@@ -26,7 +27,7 @@ namespace Content.Client.Light.Visualizers
|
|||||||
{
|
{
|
||||||
lightBehaviour.StartLightBehaviour(lightBehaviourID);
|
lightBehaviour.StartLightBehaviour(lightBehaviourID);
|
||||||
}
|
}
|
||||||
else if (component.Owner.TryGetComponent<PointLightComponent>(out var light))
|
else if (entities.TryGetComponent(component.Owner, out PointLightComponent light))
|
||||||
{
|
{
|
||||||
light.Enabled = false;
|
light.Enabled = false;
|
||||||
}
|
}
|
||||||
@@ -39,7 +40,7 @@ namespace Content.Client.Light.Visualizers
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (component.TryGetData(ExpendableLightVisuals.State, out ExpendableLightState state)
|
if (component.TryGetData(ExpendableLightVisuals.State, out ExpendableLightState state)
|
||||||
&& component.Owner.TryGetComponent<ExpendableLightComponent>(out var expendableLight))
|
&& entities.TryGetComponent(component.Owner, out ExpendableLightComponent expendableLight))
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Light;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
|
||||||
namespace Content.Client.Light.Visualizers
|
namespace Content.Client.Light.Visualizers
|
||||||
@@ -13,7 +14,8 @@ namespace Content.Client.Light.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent<SpriteComponent>(out var sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out SpriteComponent sprite))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// update sprite state
|
// update sprite state
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using Robust.Client.GameObjects;
|
|||||||
using Robust.Shared.Animations;
|
using Robust.Shared.Animations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
@@ -28,7 +27,8 @@ namespace Content.Client.Light.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite)) return;
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite)) return;
|
||||||
if (!component.TryGetData(PoweredLightVisuals.BulbState, out PoweredLightState state)) return;
|
if (!component.TryGetData(PoweredLightVisuals.BulbState, out PoweredLightState state)) return;
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Content.Client.Lobby.UI
|
|||||||
public class LobbyCharacterPreviewPanel : Control
|
public class LobbyCharacterPreviewPanel : Control
|
||||||
{
|
{
|
||||||
private readonly IClientPreferencesManager _preferencesManager;
|
private readonly IClientPreferencesManager _preferencesManager;
|
||||||
private IEntity _previewDummy;
|
private EntityUid _previewDummy;
|
||||||
private readonly Label _summaryLabel;
|
private readonly Label _summaryLabel;
|
||||||
private readonly BoxContainer _loaded;
|
private readonly BoxContainer _loaded;
|
||||||
private readonly Label _unloaded;
|
private readonly Label _unloaded;
|
||||||
@@ -98,11 +98,11 @@ namespace Content.Client.Lobby.UI
|
|||||||
_preferencesManager.OnServerDataLoaded -= UpdateUI;
|
_preferencesManager.OnServerDataLoaded -= UpdateUI;
|
||||||
|
|
||||||
if (!disposing) return;
|
if (!disposing) return;
|
||||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) _previewDummy);
|
IoCManager.Resolve<IEntityManager>().DeleteEntity(_previewDummy);
|
||||||
_previewDummy = null!;
|
_previewDummy = default;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SpriteView MakeSpriteView(IEntity entity, Direction direction)
|
private static SpriteView MakeSpriteView(EntityUid entity, Direction direction)
|
||||||
{
|
{
|
||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
@@ -136,7 +136,7 @@ namespace Content.Client.Lobby.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GiveDummyJobClothes(IEntity dummy, HumanoidCharacterProfile profile)
|
public static void GiveDummyJobClothes(EntityUid dummy, HumanoidCharacterProfile profile)
|
||||||
{
|
{
|
||||||
var protoMan = IoCManager.Resolve<IPrototypeManager>();
|
var protoMan = IoCManager.Resolve<IPrototypeManager>();
|
||||||
|
|
||||||
@@ -144,6 +144,7 @@ namespace Content.Client.Lobby.UI
|
|||||||
|
|
||||||
var highPriorityJob = profile.JobPriorities.FirstOrDefault(p => p.Value == JobPriority.High).Key;
|
var highPriorityJob = profile.JobPriorities.FirstOrDefault(p => p.Value == JobPriority.High).Key;
|
||||||
|
|
||||||
|
// ReSharper disable once ConstantNullCoalescingCondition
|
||||||
var job = protoMan.Index<JobPrototype>(highPriorityJob ?? SharedGameTicker.FallbackOverflowJob);
|
var job = protoMan.Index<JobPrototype>(highPriorityJob ?? SharedGameTicker.FallbackOverflowJob);
|
||||||
|
|
||||||
inventory.ClearAllSlotVisuals();
|
inventory.ClearAllSlotVisuals();
|
||||||
@@ -160,7 +161,7 @@ namespace Content.Client.Lobby.UI
|
|||||||
{
|
{
|
||||||
var item = entityMan.SpawnEntity(itemType, MapCoordinates.Nullspace);
|
var item = entityMan.SpawnEntity(itemType, MapCoordinates.Nullspace);
|
||||||
inventory.SetSlotVisuals(slot, item);
|
inventory.SetSlotVisuals(slot, item);
|
||||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) item);
|
IoCManager.Resolve<IEntityManager>().DeleteEntity(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Content.Client.MachineLinking
|
|||||||
[DataField("layer")]
|
[DataField("layer")]
|
||||||
private int Layer { get; }
|
private int Layer { get; }
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
@@ -27,7 +27,8 @@ namespace Content.Client.MachineLinking
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent(out SpriteComponent? sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
using System.Text;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Text;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Content.Shared.Damage.Prototypes;
|
||||||
|
using Content.Shared.FixedPoint;
|
||||||
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
|
using Robust.Client.UserInterface.XAML;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using static Content.Shared.MedicalScanner.SharedMedicalScannerComponent;
|
using static Content.Shared.MedicalScanner.SharedMedicalScannerComponent;
|
||||||
using Content.Shared.Damage.Prototypes;
|
|
||||||
using Content.Shared.FixedPoint;
|
|
||||||
using Robust.Client.AutoGenerated;
|
|
||||||
using Robust.Client.UserInterface.XAML;
|
|
||||||
|
|
||||||
namespace Content.Client.MedicalScanner.UI
|
namespace Content.Client.MedicalScanner.UI
|
||||||
{
|
{
|
||||||
@@ -27,9 +25,10 @@ namespace Content.Client.MedicalScanner.UI
|
|||||||
{
|
{
|
||||||
var text = new StringBuilder();
|
var text = new StringBuilder();
|
||||||
|
|
||||||
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
if (!state.Entity.HasValue ||
|
if (!state.Entity.HasValue ||
|
||||||
!state.HasDamage() ||
|
!state.HasDamage() ||
|
||||||
!IoCManager.Resolve<IEntityManager>().TryGetEntity(state.Entity.Value, out var entity))
|
!entities.EntityExists(state.Entity.Value))
|
||||||
{
|
{
|
||||||
Diagnostics.Text = Loc.GetString("medical-scanner-window-no-patient-data-text");
|
Diagnostics.Text = Loc.GetString("medical-scanner-window-no-patient-data-text");
|
||||||
ScanButton.Disabled = true;
|
ScanButton.Disabled = true;
|
||||||
@@ -37,7 +36,7 @@ namespace Content.Client.MedicalScanner.UI
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
text.Append($"{Loc.GetString("medical-scanner-window-entity-health-text", ("entityName", Name: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName))}\n");
|
text.Append($"{Loc.GetString("medical-scanner-window-entity-health-text", ("entityName", Name: entities.GetComponent<MetaDataComponent>(state.Entity.Value).EntityName))}\n");
|
||||||
|
|
||||||
var totalDamage = state.DamagePerType.Values.Sum();
|
var totalDamage = state.DamagePerType.Values.Sum();
|
||||||
|
|
||||||
@@ -46,12 +45,12 @@ namespace Content.Client.MedicalScanner.UI
|
|||||||
HashSet<string> shownTypes = new();
|
HashSet<string> shownTypes = new();
|
||||||
|
|
||||||
// Show the total damage and type breakdown for each damage group.
|
// Show the total damage and type breakdown for each damage group.
|
||||||
foreach (var (damageGroupID, damageAmount) in state.DamagePerGroup)
|
foreach (var (damageGroupId, damageAmount) in state.DamagePerGroup)
|
||||||
{
|
{
|
||||||
text.Append($"\n{Loc.GetString("medical-scanner-window-damage-group-text", ("damageGroup", damageGroupID), ("amount", damageAmount))}");
|
text.Append($"\n{Loc.GetString("medical-scanner-window-damage-group-text", ("damageGroup", damageGroupId), ("amount", damageAmount))}");
|
||||||
|
|
||||||
// Show the damage for each type in that group.
|
// Show the damage for each type in that group.
|
||||||
var group = IoCManager.Resolve<IPrototypeManager>().Index<DamageGroupPrototype>(damageGroupID);
|
var group = IoCManager.Resolve<IPrototypeManager>().Index<DamageGroupPrototype>(damageGroupId);
|
||||||
foreach (var type in group.DamageTypes)
|
foreach (var type in group.DamageTypes)
|
||||||
{
|
{
|
||||||
if (state.DamagePerType.TryGetValue(type, out var typeAmount))
|
if (state.DamagePerType.TryGetValue(type, out var typeAmount))
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Content.Client.Mining
|
|||||||
[DataField("layer")]
|
[DataField("layer")]
|
||||||
private int Layer { get; } = 0;
|
private int Layer { get; } = 0;
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace Content.Client.MobState.Overlays
|
|||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
|
[Dependency] private readonly IEntityManager _entities = default!;
|
||||||
|
|
||||||
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
public override OverlaySpace Space => OverlaySpace.WorldSpace;
|
||||||
private readonly ShaderInstance _gradientCircleShader;
|
private readonly ShaderInstance _gradientCircleShader;
|
||||||
@@ -24,15 +25,14 @@ namespace Content.Client.MobState.Overlays
|
|||||||
_gradientCircleShader = _prototypeManager.Index<ShaderPrototype>("GradientCircleMask").Instance();
|
_gradientCircleShader = _prototypeManager.Index<ShaderPrototype>("GradientCircleMask").Instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool LocalPlayerHasState(IPlayerManager pm, bool critical, bool dead) {
|
public static bool LocalPlayerHasState(IPlayerManager pm, bool critical, bool dead, IEntityManager? entities = null) {
|
||||||
var playerEntity = pm.LocalPlayer?.ControlledEntity;
|
if (pm.LocalPlayer?.ControlledEntity is not {Valid: true} player)
|
||||||
|
|
||||||
if (playerEntity == null)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<MobStateComponent?>(playerEntity, out var mobState))
|
IoCManager.Resolve(ref entities);
|
||||||
|
if (entities.TryGetComponent<MobStateComponent?>(player, out var mobState))
|
||||||
{
|
{
|
||||||
if (critical)
|
if (critical)
|
||||||
if (mobState.IsCritical())
|
if (mobState.IsCritical())
|
||||||
@@ -47,7 +47,7 @@ namespace Content.Client.MobState.Overlays
|
|||||||
|
|
||||||
protected override void Draw(in OverlayDrawArgs args)
|
protected override void Draw(in OverlayDrawArgs args)
|
||||||
{
|
{
|
||||||
if (!LocalPlayerHasState(_playerManager, true, false))
|
if (!LocalPlayerHasState(_playerManager, true, false, _entities))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var worldHandle = args.WorldHandle;
|
var worldHandle = args.WorldHandle;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Labels;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
|
||||||
namespace Content.Client.Morgue.Visualizers
|
namespace Content.Client.Morgue.Visualizers
|
||||||
{
|
{
|
||||||
@@ -12,7 +13,8 @@ namespace Content.Client.Morgue.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Morgue.Visualizers
|
namespace Content.Client.Morgue.Visualizers
|
||||||
@@ -23,7 +24,11 @@ namespace Content.Client.Morgue.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite)) return;
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (component.TryGetData(MorgueVisuals.Open, out bool open))
|
if (component.TryGetData(MorgueVisuals.Open, out bool open))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.Morgue;
|
using Content.Shared.Morgue;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Morgue.Visualizers
|
namespace Content.Client.Morgue.Visualizers
|
||||||
@@ -23,7 +24,11 @@ namespace Content.Client.Morgue.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite)) return;
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (component.TryGetData(MorgueVisuals.Open, out bool open))
|
if (component.TryGetData(MorgueVisuals.Open, out bool open))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Content.Client.Movement.Components
|
|||||||
var user = eventArgs.User;
|
var user = eventArgs.User;
|
||||||
var target = eventArgs.Target;
|
var target = eventArgs.Target;
|
||||||
var dragged = eventArgs.Dragged;
|
var dragged = eventArgs.Dragged;
|
||||||
bool Ignored(IEntity entity) => entity == target || entity == user || entity == dragged;
|
bool Ignored(EntityUid entity) => entity == target || entity == user || entity == dragged;
|
||||||
|
|
||||||
return user.InRangeUnobstructed(target, Range, predicate: Ignored) && user.InRangeUnobstructed(dragged, Range, predicate: Ignored);
|
return user.InRangeUnobstructed(target, Range, predicate: Ignored) && user.InRangeUnobstructed(dragged, Range, predicate: Ignored);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,8 @@ using Content.Client.Resources;
|
|||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Input;
|
using Robust.Client.Input;
|
||||||
using Robust.Client.ResourceManagement;
|
using Robust.Client.ResourceManagement;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
@@ -79,14 +77,12 @@ namespace Content.Client.NodeContainer
|
|||||||
|
|
||||||
var mousePos = _inputManager.MouseScreenPosition.Position;
|
var mousePos = _inputManager.MouseScreenPosition.Position;
|
||||||
|
|
||||||
var entity = _entityManager.GetEntity(node.Entity);
|
var gridId = _entityManager.GetComponent<TransformComponent>(node.Entity).GridID;
|
||||||
|
|
||||||
var gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).GridID;
|
|
||||||
var grid = _mapManager.GetGrid(gridId);
|
var grid = _mapManager.GetGrid(gridId);
|
||||||
var gridTile = grid.TileIndicesFor(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates);
|
var gridTile = grid.TileIndicesFor(_entityManager.GetComponent<TransformComponent>(node.Entity).Coordinates);
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append($"entity: {entity}\n");
|
sb.Append($"entity: {node.Entity}\n");
|
||||||
sb.Append($"group id: {group.GroupId}\n");
|
sb.Append($"group id: {group.GroupId}\n");
|
||||||
sb.Append($"node: {node.Name}\n");
|
sb.Append($"node: {node.Name}\n");
|
||||||
sb.Append($"type: {node.Type}\n");
|
sb.Append($"type: {node.Type}\n");
|
||||||
@@ -120,10 +116,10 @@ namespace Content.Client.NodeContainer
|
|||||||
if (!_system.Entities.TryGetValue(entity, out var nodeData))
|
if (!_system.Entities.TryGetValue(entity, out var nodeData))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var gridId = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).GridID;
|
var gridId = _entityManager.GetComponent<TransformComponent>(entity).GridID;
|
||||||
var grid = _mapManager.GetGrid(gridId);
|
var grid = _mapManager.GetGrid(gridId);
|
||||||
var gridDict = _gridIndex.GetOrNew(gridId);
|
var gridDict = _gridIndex.GetOrNew(gridId);
|
||||||
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates;
|
var coords = _entityManager.GetComponent<TransformComponent>(entity).Coordinates;
|
||||||
|
|
||||||
// TODO: This probably shouldn't be capable of returning NaN...
|
// TODO: This probably shouldn't be capable of returning NaN...
|
||||||
if (float.IsNaN(coords.Position.X) || float.IsNaN(coords.Position.Y))
|
if (float.IsNaN(coords.Position.X) || float.IsNaN(coords.Position.Y))
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Content.Client.Nutrition.Visualizers
|
|||||||
[DataField("state")]
|
[DataField("state")]
|
||||||
private string? _state;
|
private string? _state;
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.Nutrition.Components;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization.Manager.Attributes;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.Nutrition.Visualizers
|
namespace Content.Client.Nutrition.Visualizers
|
||||||
@@ -19,7 +20,8 @@ namespace Content.Client.Nutrition.Visualizers
|
|||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|
||||||
if (!component.Owner.TryGetComponent<ISpriteComponent>(out var sprite))
|
var entities = IoCManager.Resolve<IEntityManager>();
|
||||||
|
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent sprite))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Content.Client.PDA
|
|||||||
IDLight
|
IDLight
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(EntityUid entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity);
|
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(entity);
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ namespace Content.Client.Parallax
|
|||||||
// Threshold
|
// Threshold
|
||||||
noiseVal = MathF.Max(0, noiseVal - Threshold);
|
noiseVal = MathF.Max(0, noiseVal - Threshold);
|
||||||
noiseVal *= threshVal;
|
noiseVal *= threshVal;
|
||||||
noiseVal = (float) MathF.Pow(noiseVal, powFactor);
|
noiseVal = MathF.Pow(noiseVal, powFactor);
|
||||||
|
|
||||||
// Get colors based on noise values.
|
// Get colors based on noise values.
|
||||||
var srcColor = Color.InterpolateBetween(OuterColor, InnerColor, noiseVal)
|
var srcColor = Color.InterpolateBetween(OuterColor, InnerColor, noiseVal)
|
||||||
@@ -408,7 +408,7 @@ namespace Content.Client.Parallax
|
|||||||
// Threshold
|
// Threshold
|
||||||
noiseVal = MathF.Max(0, noiseVal - MaskThreshold);
|
noiseVal = MathF.Max(0, noiseVal - MaskThreshold);
|
||||||
noiseVal *= threshVal;
|
noiseVal *= threshVal;
|
||||||
noiseVal = (float) MathF.Pow(noiseVal, powFactor);
|
noiseVal = MathF.Pow(noiseVal, powFactor);
|
||||||
|
|
||||||
var randomThresh = random.NextFloat();
|
var randomThresh = random.NextFloat();
|
||||||
if (randomThresh > noiseVal)
|
if (randomThresh > noiseVal)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user