Bunch more error fixes.

This commit is contained in:
Vera Aguilera Puerto
2021-12-04 12:59:44 +01:00
parent 151778a1b9
commit 2ff16a580b
31 changed files with 120 additions and 151 deletions

View File

@@ -20,13 +20,13 @@ namespace Content.Shared.Alert
/// <summary>
/// Player clicking the alert
/// </summary>
public readonly IEntity Player;
public readonly EntityUid Player;
/// <summary>
/// Alert that was clicked
/// </summary>
public readonly AlertPrototype Alert;
public ClickAlertEventArgs(IEntity player, AlertPrototype alert)
public ClickAlertEventArgs(EntityUid player, AlertPrototype alert)
{
Player = player;
Alert = alert;

View File

@@ -143,7 +143,7 @@ namespace Content.Shared.Body.Components
var i = 0;
foreach (var mechanism in _mechanisms)
{
mechanismIds[i] = mechanism.OwnerUid;
mechanismIds[i] = mechanism.Owner;
i++;
}
@@ -183,7 +183,7 @@ namespace Content.Shared.Body.Components
return SurgeryDataComponent?.CheckSurgery(surgery) ?? false;
}
public bool AttemptSurgery(SurgeryType toolType, IBodyPartContainer target, ISurgeon surgeon, IEntity performer)
public bool AttemptSurgery(SurgeryType toolType, IBodyPartContainer target, ISurgeon surgeon, EntityUid performer)
{
DebugTools.AssertNotNull(toolType);
DebugTools.AssertNotNull(target);
@@ -370,7 +370,7 @@ namespace Content.Shared.Body.Components
continue;
}
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out SharedMechanismComponent? mechanism))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Value, out SharedMechanismComponent? mechanism))
{
continue;
}

View File

@@ -15,7 +15,7 @@ namespace Content.Shared.Body.Components
protected readonly Dictionary<int, object> OptionsCache = new();
protected SharedBodyComponent? BodyCache;
protected int IdHash;
protected IEntity? PerformerCache;
protected EntityUid? PerformerCache;
private SharedBodyPartComponent? _part;
public SharedBodyComponent? Body => Part?.Body;

View File

@@ -15,7 +15,7 @@ namespace Content.Shared.Body.Surgery
SharedMechanismComponent target,
IBodyPartContainer container,
ISurgeon surgeon,
IEntity performer);
EntityUid performer);
/// <summary>
/// How long it takes to perform a single surgery step in seconds.

View File

@@ -9,7 +9,7 @@ namespace Content.Shared.Body.Surgery
/// </summary>
public interface ISurgeryData : IComponent
{
public delegate void SurgeryAction(IBodyPartContainer container, ISurgeon surgeon, IEntity performer);
public delegate void SurgeryAction(IBodyPartContainer container, ISurgeon surgeon, EntityUid performer);
/// <summary>
/// The <see cref="SharedBodyPartComponent"/> this
@@ -78,6 +78,6 @@ namespace Content.Shared.Body.Surgery
/// <param name="performer">The entity performing the surgery.</param>
/// <returns>True if successful, false otherwise.</returns>
public bool PerformSurgery(SurgeryType surgeryType, IBodyPartContainer container, ISurgeon surgeon,
IEntity performer);
EntityUid performer);
}
}

View File

@@ -17,7 +17,7 @@ namespace Content.Shared.Construction.Conditions
[DataField("tileNotBlocked")]
private readonly TileNotBlocked _tileNotBlocked = new();
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
{
var result = false;

View File

@@ -171,9 +171,6 @@ namespace Content.Shared.Containers.ItemSlots
// Convenience properties
public bool HasItem => ContainerSlot.ContainedEntity != null;
public IEntity? Item => ContainerSlot.ContainedEntity;
// and to make it easier for whenever IEntity is removed
public EntityUid? ItemUid => ContainerSlot.ContainedEntity;
public EntityUid? Item => ContainerSlot.ContainedEntity;
}
}

View File

@@ -120,7 +120,7 @@ namespace Content.Shared.Containers.ItemSlots
continue;
args.Handled = true;
TryEjectToHands(uid, slot, args.UserUid);
TryEjectToHands(uid, slot, args.User);
break;
}
}
@@ -139,12 +139,12 @@ namespace Content.Shared.Containers.ItemSlots
if (args.Handled)
return;
if (!EntityManager.TryGetComponent(args.UserUid, out SharedHandsComponent? hands))
if (!EntityManager.TryGetComponent(args.User, out SharedHandsComponent? hands))
return;
foreach (var slot in itemSlots.Slots.Values)
{
if (!CanInsert(uid, args.UsedUid, slot, swap: slot.Swap, popup: args.UserUid))
if (!CanInsert(uid, args.Used, slot, swap: slot.Swap, popup: args.User))
continue;
// Drop the held item onto the floor. Return if the user cannot drop.
@@ -152,7 +152,7 @@ namespace Content.Shared.Containers.ItemSlots
return;
if (slot.Item != null)
hands.TryPutInAnyHand(slot.Item);
hands.TryPutInAnyHand(slot.Item.Value);
Insert(uid, slot, args.Used);
args.Handled = true;
@@ -166,7 +166,7 @@ namespace Content.Shared.Containers.ItemSlots
/// Insert an item into a slot. This does not perform checks, so make sure to also use <see
/// cref="CanInsert"/> or just use <see cref="TryInsert"/> instead.
/// </summary>
private void Insert(EntityUid uid, ItemSlot slot, IEntity item)
private void Insert(EntityUid uid, ItemSlot slot, EntityUid item)
{
slot.ContainerSlot.Insert(item);
// ContainerSlot automatically raises a directed EntInsertedIntoContainerMessage
@@ -208,7 +208,7 @@ namespace Content.Shared.Containers.ItemSlots
/// Tries to insert item into a specific slot.
/// </summary>
/// <returns>False if failed to insert item</returns>
public bool TryInsert(EntityUid uid, string id, IEntity item, ItemSlotsComponent? itemSlots = null)
public bool TryInsert(EntityUid uid, string id, EntityUid item, ItemSlotsComponent? itemSlots = null)
{
if (!Resolve(uid, ref itemSlots))
return false;
@@ -223,7 +223,7 @@ namespace Content.Shared.Containers.ItemSlots
/// Tries to insert item into a specific slot.
/// </summary>
/// <returns>False if failed to insert item</returns>
public bool TryInsert(EntityUid uid, ItemSlot slot, IEntity item)
public bool TryInsert(EntityUid uid, ItemSlot slot, EntityUid item)
{
if (!CanInsert(uid, item, slot))
return false;
@@ -244,14 +244,14 @@ namespace Content.Shared.Containers.ItemSlots
if (!hands.TryGetActiveHeldEntity(out var item))
return false;
if (!CanInsert(uid, item, slot))
if (!CanInsert(uid, item.Value, slot))
return false;
// hands.Drop(item) checks CanDrop action blocker
if (!_actionBlockerSystem.CanInteract(user) && hands.Drop(item))
if (!_actionBlockerSystem.CanInteract(user) && hands.Drop(item.Value))
return false;
Insert(uid, slot, item);
Insert(uid, slot, item.Value);
return true;
}
#endregion
@@ -261,7 +261,7 @@ namespace Content.Shared.Containers.ItemSlots
/// Eject an item into a slot. This does not perform checks (e.g., is the slot locked?), so you should
/// probably just use <see cref="TryEject"/> instead.
/// </summary>
private void Eject(EntityUid uid, ItemSlot slot, IEntity item)
private void Eject(EntityUid uid, ItemSlot slot, EntityUid item)
{
slot.ContainerSlot.Remove(item);
// ContainerSlot automatically raises a directed EntRemovedFromContainerMessage
@@ -274,7 +274,7 @@ namespace Content.Shared.Containers.ItemSlots
/// Try to eject an item from a slot.
/// </summary>
/// <returns>False if item slot is locked or has no item inserted</returns>
public bool TryEject(EntityUid uid, ItemSlot slot, [NotNullWhen(true)] out IEntity? item)
public bool TryEject(EntityUid uid, ItemSlot slot, [NotNullWhen(true)] out EntityUid? item)
{
item = null;
@@ -282,7 +282,7 @@ namespace Content.Shared.Containers.ItemSlots
return false;
item = slot.Item;
Eject(uid, slot, item);
Eject(uid, slot, item.Value);
return true;
}
@@ -290,7 +290,7 @@ namespace Content.Shared.Containers.ItemSlots
/// Try to eject item from a slot.
/// </summary>
/// <returns>False if the id is not valid, the item slot is locked, or it has no item inserted</returns>
public bool TryEject(EntityUid uid, string id, [NotNullWhen(true)] out IEntity? item, ItemSlotsComponent? itemSlots = null)
public bool TryEject(EntityUid uid, string id, [NotNullWhen(true)] out EntityUid? item, ItemSlotsComponent? itemSlots = null)
{
item = null;
@@ -317,7 +317,7 @@ namespace Content.Shared.Containers.ItemSlots
return false;
if (user != null && EntityManager.TryGetComponent(user.Value, out SharedHandsComponent? hands))
hands.TryPutInAnyHand(item);
hands.TryPutInAnyHand(item.Value);
return true;
}
@@ -344,7 +344,7 @@ namespace Content.Shared.Containers.ItemSlots
var verbSubject = slot.Name != string.Empty
? Loc.GetString(slot.Name)
: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(slot.Item!).EntityName ?? string.Empty;
: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(slot.Item!.Value).EntityName ?? string.Empty;
Verb verb = new();
verb.Act = () => TryEjectToHands(uid, slot, args.User);
@@ -379,7 +379,7 @@ namespace Content.Shared.Containers.ItemSlots
var verbSubject = slot.Name != string.Empty
? Loc.GetString(slot.Name)
: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(slot.Item!).EntityName ?? string.Empty;
: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(slot.Item!.Value).EntityName ?? string.Empty;
Verb takeVerb = new();
takeVerb.Act = () => TryEjectToHands(uid, slot, args.User);
@@ -400,15 +400,15 @@ namespace Content.Shared.Containers.ItemSlots
foreach (var slot in itemSlots.Slots.Values)
{
if (!CanInsert(uid, args.Using, slot))
if (!CanInsert(uid, args.Using.Value, slot))
continue;
var verbSubject = slot.Name != string.Empty
? Loc.GetString(slot.Name)
: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(args.Using).EntityName ?? string.Empty;
: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(args.Using.Value).EntityName ?? string.Empty;
Verb insertVerb = new();
insertVerb.Act = () => Insert(uid, slot, args.Using);
insertVerb.Act = () => Insert(uid, slot, args.Using.Value);
if (slot.InsertVerbText != null)
{
@@ -448,7 +448,7 @@ namespace Content.Shared.Containers.ItemSlots
/// <summary>
/// Get the contents of some item slot.
/// </summary>
public IEntity? GetItem(EntityUid uid, string id, ItemSlotsComponent? itemSlots = null)
public EntityUid? GetItem(EntityUid uid, string id, ItemSlotsComponent? itemSlots = null)
{
if (!Resolve(uid, ref itemSlots))
return null;

View File

@@ -16,26 +16,6 @@ namespace Content.Shared.Coordinates
return new(id, x, y);
}
public static EntityCoordinates ToCoordinates(this EntityUid id)
{
return ToCoordinates(id, Vector2.Zero);
}
public static EntityCoordinates ToCoordinates(this IEntity entity, Vector2 offset)
{
return ToCoordinates((EntityUid) entity, offset);
}
public static EntityCoordinates ToCoordinates(this IEntity entity, float x, float y)
{
return new(entity, x, y);
}
public static EntityCoordinates ToCoordinates(this IEntity entity)
{
return ToCoordinates((EntityUid) entity, Vector2.Zero);
}
public static EntityCoordinates ToCoordinates(this IMapGrid grid, Vector2 offset)
{
return ToCoordinates(grid.GridEntityId, offset);

View File

@@ -47,7 +47,7 @@ namespace Content.Shared.Disposal
}
}
public virtual bool CanInsert(SharedDisposalUnitComponent component, IEntity entity)
public virtual bool CanInsert(SharedDisposalUnitComponent component, EntityUid entity)
{
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(component.Owner).Anchored)
return false;
@@ -71,11 +71,5 @@ namespace Content.Shared.Disposal
return true;
}
public bool CanInsert(SharedDisposalUnitComponent component, EntityUid entityId)
{
var entity = EntityManager.GetEntity(entityId);
return CanInsert(component, entity);
}
}
}

View File

@@ -97,7 +97,7 @@ namespace Content.Shared.Doors
/// </summary>
protected List<EntityUid> CurrentlyCrushing = new();
public bool IsCrushing(IEntity entity)
public bool IsCrushing(EntityUid entity)
{
return CurrentlyCrushing.Contains(entity);
}

View File

@@ -23,15 +23,15 @@ namespace Content.Shared.Interaction
[PublicAPI]
public class RangedInteractEventArgs : EventArgs
{
public RangedInteractEventArgs(IEntity user, IEntity @using, EntityCoordinates clickLocation)
public RangedInteractEventArgs(EntityUid user, EntityUid @using, EntityCoordinates clickLocation)
{
User = user;
Using = @using;
ClickLocation = clickLocation;
}
public IEntity User { get; }
public IEntity Using { get; }
public EntityUid User { get; }
public EntityUid Using { get; }
public EntityCoordinates ClickLocation { get; }
}

View File

@@ -34,7 +34,7 @@ namespace Content.Shared.Interaction
public class RotateToFaceSystem : EntitySystem
{
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
public bool TryFaceCoordinates(IEntity user, Vector2 coordinates)
public bool TryFaceCoordinates(EntityUid user, Vector2 coordinates)
{
var diff = coordinates - IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).MapPosition.Position;
if (diff.LengthSquared <= 0.01f)
@@ -43,7 +43,7 @@ namespace Content.Shared.Interaction
return TryFaceAngle(user, diffAngle);
}
public bool TryFaceAngle(IEntity user, Angle diffAngle)
public bool TryFaceAngle(EntityUid user, Angle diffAngle)
{
if (_actionBlockerSystem.CanChangeDirection(user))
{

View File

@@ -44,7 +44,7 @@ namespace Content.Shared.Inventory
/// <returns>true if the item is equipped to an equip slot (NOT inside an equipped container
/// like inside a backpack)</returns>
public abstract bool IsEquipped(IEntity item);
public abstract bool IsEquipped(EntityUid item);
[Serializable, NetSerializable]
protected class InventoryComponentState : ComponentState

View File

@@ -110,7 +110,7 @@ namespace Content.Shared.Item
/// <summary>
/// If a player can pick up this item.
/// </summary>
public bool CanPickup(IEntity user, bool popup = true)
public bool CanPickup(EntityUid user, bool popup = true)
{
if (!EntitySystem.Get<ActionBlockerSystem>().CanPickup(user))
return false;

View File

@@ -18,7 +18,7 @@ namespace Content.Shared.MobState
CurrentMobState = currentMobState;
}
public IEntity Entity => Component.Owner;
public EntityUid Entity => Component.Owner;
public MobStateComponent Component { get; }

View File

@@ -14,7 +14,7 @@ namespace Content.Shared.Movement.Components
public static class GravityExtensions
{
public static bool IsWeightless(this IEntity entity, PhysicsComponent? body = null, EntityCoordinates? coords = null, IMapManager? mapManager = null, IEntityManager? entityManager = null)
public static bool IsWeightless(this EntityUid entity, PhysicsComponent? body = null, EntityCoordinates? coords = null, IMapManager? mapManager = null, IEntityManager? entityManager = null)
{
if (body == null)
IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out body);

View File

@@ -4,9 +4,9 @@ namespace Content.Shared.Movement
{
public sealed class RelayMovementEntityEvent : EntityEventArgs
{
public IEntity Entity { get; }
public EntityUid Entity { get; }
public RelayMovementEntityEvent(IEntity entity)
public RelayMovementEntityEvent(EntityUid entity)
{
Entity = entity;
}

View File

@@ -13,7 +13,7 @@ namespace Content.Shared.Popups
/// <param name="source">The entity above which the message will appear.</param>
/// <param name="viewer">The entity that will see the message.</param>
/// <param name="message">The message to show.</param>
public static void PopupMessage(this IEntity source, IEntity viewer, string message)
public static void PopupMessage(this EntityUid source, EntityUid viewer, string message)
{
var popupSystem = EntitySystem.Get<SharedPopupSystem>();
@@ -25,7 +25,7 @@ namespace Content.Shared.Popups
/// </summary>
/// <param name="viewer">The entity that will see the message.</param>
/// <param name="message">The message to be seen.</param>
public static void PopupMessage(this IEntity viewer, string message)
public static void PopupMessage(this EntityUid viewer, string message)
{
viewer.PopupMessage(viewer, message);
}
@@ -36,7 +36,7 @@ namespace Content.Shared.Popups
/// <param name="coordinates">Location on a grid that the message floats up from.</param>
/// <param name="viewer">The client attached entity that the message is being sent to.</param>
/// <param name="message">Text contents of the message.</param>
public static void PopupMessage(this EntityCoordinates coordinates, IEntity viewer, string message)
public static void PopupMessage(this EntityCoordinates coordinates, EntityUid viewer, string message)
{
var popupSystem = EntitySystem.Get<SharedPopupSystem>();
popupSystem.PopupCoordinates(message, coordinates, Filter.Entities(viewer));
@@ -49,7 +49,7 @@ namespace Content.Shared.Popups
/// The client attached entity that the message is being sent to.
/// </param>
/// <param name="message">Text contents of the message.</param>
public static void PopupMessageCursor(this IEntity viewer, string message)
public static void PopupMessageCursor(this EntityUid viewer, string message)
{
var popupSystem = EntitySystem.Get<SharedPopupSystem>();
popupSystem.PopupCursor(message, Filter.Entities(viewer));

View File

@@ -27,7 +27,7 @@ namespace Content.Shared.Pulling
{
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
public bool CanPull(IEntity puller, IEntity pulled)
public bool CanPull(EntityUid puller, EntityUid pulled)
{
if (!IoCManager.Resolve<IEntityManager>().HasComponent<SharedPullerComponent>(puller))
{
@@ -73,7 +73,7 @@ namespace Content.Shared.Pulling
return !startPull.Cancelled;
}
public bool TogglePull(IEntity puller, SharedPullableComponent pullable)
public bool TogglePull(EntityUid puller, SharedPullableComponent pullable)
{
if (pullable.Puller == puller)
{
@@ -84,7 +84,7 @@ namespace Content.Shared.Pulling
// -- Core attempted actions --
public bool TryStopPull(SharedPullableComponent pullable, IEntity? user = null)
public bool TryStopPull(SharedPullableComponent pullable, EntityUid? user = null)
{
if (!pullable.BeingPulled)
{
@@ -100,13 +100,13 @@ namespace Content.Shared.Pulling
return true;
}
public bool TryStartPull(IEntity puller, IEntity pullable)
public bool TryStartPull(EntityUid puller, EntityUid pullable)
{
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedPullerComponent?>(puller, out var pullerComp))
if (!EntityManager.TryGetComponent<SharedPullerComponent?>(puller, out var pullerComp))
{
return false;
}
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedPullableComponent?>(pullable, out var pullableComp))
if (!EntityManager.TryGetComponent<SharedPullableComponent?>(pullable, out var pullableComp))
{
return false;
}
@@ -121,17 +121,17 @@ namespace Content.Shared.Pulling
// Pulling a new object : Perform sanity checks.
if (!EntitySystem.Get<SharedPullingSystem>().CanPull(puller.Owner, pullable.Owner))
if (!CanPull(puller.Owner, pullable.Owner))
{
return false;
}
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<PhysicsComponent?>(puller.Owner, out var pullerPhysics))
if (!EntityManager.TryGetComponent<PhysicsComponent?>(puller.Owner, out var pullerPhysics))
{
return false;
}
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<PhysicsComponent?>(pullable.Owner, out var pullablePhysics))
if (!EntityManager.TryGetComponent<PhysicsComponent?>(pullable.Owner, out var pullablePhysics))
{
return false;
}
@@ -143,7 +143,7 @@ namespace Content.Shared.Pulling
var oldPullable = puller.Pulling;
if (oldPullable != null)
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedPullableComponent?>(oldPullable, out var oldPullableComp))
if (EntityManager.TryGetComponent<SharedPullableComponent?>(oldPullable.Value, out var oldPullableComp))
{
if (!TryStopPull(oldPullableComp))
{

View File

@@ -30,7 +30,7 @@ namespace Content.Shared.Pulling
/// <summary>
/// A mapping of pullers to the entity that they are pulling.
/// </summary>
private readonly Dictionary<IEntity, IEntity> _pullers =
private readonly Dictionary<EntityUid, EntityUid> _pullers =
new();
private readonly HashSet<SharedPullableComponent> _moving = new();
@@ -100,21 +100,21 @@ namespace Content.Shared.Pulling
}
// Raise a "you are being pulled" alert if the pulled entity has alerts.
private static void PullableHandlePullStarted(EntityUid uid, SharedPullableComponent component, PullStartedMessage args)
private void PullableHandlePullStarted(EntityUid uid, SharedPullableComponent component, PullStartedMessage args)
{
if (args.Pulled.Owner != uid)
return;
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner, out SharedAlertsComponent? alerts))
if (EntityManager.TryGetComponent(component.Owner, out SharedAlertsComponent? alerts))
alerts.ShowAlert(AlertType.Pulled);
}
private static void PullableHandlePullStopped(EntityUid uid, SharedPullableComponent component, PullStoppedMessage args)
private void PullableHandlePullStopped(EntityUid uid, SharedPullableComponent component, PullStoppedMessage args)
{
if (args.Pulled.Owner != uid)
return;
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner, out SharedAlertsComponent? alerts))
if (EntityManager.TryGetComponent(component.Owner, out SharedAlertsComponent? alerts))
alerts.ClearAlert(AlertType.Pulled);
}
@@ -165,17 +165,17 @@ namespace Content.Shared.Pulling
// The pulled object may have already been deleted.
// TODO: Work out why. Monkey + meat spike is a good test for this,
// assuming you're still pulling the monkey when it gets gibbed.
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(pulled) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(pulled).EntityLifeStage) >= EntityLifeStage.Deleted)
if ((!EntityManager.EntityExists(pulled.Value) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(pulled.Value).EntityLifeStage) >= EntityLifeStage.Deleted)
{
return;
}
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(pulled, out IPhysBody? physics))
if (!EntityManager.TryGetComponent(pulled.Value, out IPhysBody? physics))
{
return;
}
UpdatePulledRotation(puller, pulled);
UpdatePulledRotation(puller, pulled.Value);
physics.WakeBody();
}
@@ -183,16 +183,16 @@ namespace Content.Shared.Pulling
// TODO: When Joint networking is less shitcodey fix this to use a dedicated joints message.
private void HandleContainerInsert(EntInsertedIntoContainerMessage message)
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(message.Entity, out SharedPullableComponent? pullable))
if (EntityManager.TryGetComponent(message.Entity, out SharedPullableComponent? pullable))
{
TryStopPull(pullable);
}
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(message.Entity, out SharedPullerComponent? puller))
if (EntityManager.TryGetComponent(message.Entity, out SharedPullerComponent? puller))
{
if (puller.Pulling == null) return;
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(puller.Pulling, out SharedPullableComponent? pulling))
if (!EntityManager.TryGetComponent(puller.Pulling.Value, out SharedPullableComponent? pulling))
{
return;
}
@@ -203,19 +203,17 @@ namespace Content.Shared.Pulling
private bool HandleMovePulledObject(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
{
var player = session?.AttachedEntity;
if (player == null)
{
if (session?.AttachedEntityUid == null)
return false;
}
var player = session.AttachedEntityUid.Value;
if (!TryGetPulled(player, out var pulled))
{
return false;
}
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(pulled, out SharedPullableComponent? pullable))
if (!EntityManager.TryGetComponent(pulled.Value, out SharedPullableComponent? pullable))
{
return false;
}
@@ -225,32 +223,32 @@ namespace Content.Shared.Pulling
return false;
}
private void SetPuller(IEntity puller, IEntity pulled)
private void SetPuller(EntityUid puller, EntityUid pulled)
{
_pullers[puller] = pulled;
}
private bool RemovePuller(IEntity puller)
private bool RemovePuller(EntityUid puller)
{
return _pullers.Remove(puller);
}
public IEntity? GetPulled(IEntity by)
public EntityUid? GetPulled(EntityUid by)
{
return _pullers.GetValueOrDefault(by);
}
public bool TryGetPulled(IEntity by, [NotNullWhen(true)] out IEntity? pulled)
public bool TryGetPulled(EntityUid by, [NotNullWhen(true)] out EntityUid? pulled)
{
return (pulled = GetPulled(by)) != null;
}
public bool IsPulling(IEntity puller)
public bool IsPulling(EntityUid puller)
{
return _pullers.ContainsKey(puller);
}
private void UpdatePulledRotation(IEntity puller, IEntity pulled)
private void UpdatePulledRotation(EntityUid puller, EntityUid pulled)
{
// TODO: update once ComponentReference works with directed event bus.
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(pulled, out RotatableComponent? rotatable))

View File

@@ -9,7 +9,7 @@ namespace Content.Shared.Random.Helpers
{
public static class SharedEntityExtensions
{
public static void RandomOffset(this IEntity entity, float minX, float maxX, float minY, float maxY)
public static void RandomOffset(this EntityUid entity, float minX, float maxX, float minY, float maxY)
{
DebugTools.AssertNotNull(entity);
DebugTools.Assert(minX <= maxX, $"Minimum X value ({minX}) must be smaller than or equal to the maximum X value ({maxX})");
@@ -23,7 +23,7 @@ namespace Content.Shared.Random.Helpers
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).LocalPosition += offset;
}
public static void RandomOffset(this IEntity entity, float min, float max)
public static void RandomOffset(this EntityUid entity, float min, float max)
{
DebugTools.AssertNotNull(entity);
DebugTools.Assert(min <= max, $"Minimum value ({min}) must be smaller than or equal to the maximum value ({max})");
@@ -31,7 +31,7 @@ namespace Content.Shared.Random.Helpers
entity.RandomOffset(min, max, min, max);
}
public static void RandomOffset(this IEntity entity, float value)
public static void RandomOffset(this EntityUid entity, float value)
{
value = Math.Abs(value);
entity.RandomOffset(-value, value);

View File

@@ -9,6 +9,6 @@ namespace Content.Shared.Roles
[ImplicitDataDefinitionForInheritors]
public abstract class JobSpecial
{
public abstract void AfterEquip(IEntity mob);
public abstract void AfterEquip(EntityUid mob);
}
}

View File

@@ -18,14 +18,14 @@ namespace Content.Shared.Storage
{
public override string Name => "Storage";
public abstract IReadOnlyList<IEntity>? StoredEntities { get; }
public abstract IReadOnlyList<EntityUid>? StoredEntities { get; }
/// <summary>
/// Removes from the storage container and updates the stored value
/// </summary>
/// <param name="entity">The entity to remove</param>
/// <returns>True if no longer in storage, false otherwise</returns>
public abstract bool Remove(IEntity entity);
public abstract bool Remove(EntityUid entity);
bool IDraggable.CanDrop(CanDropEvent args)
{

View File

@@ -14,7 +14,7 @@ namespace Content.Shared.Strip.Components
{
public override string Name => "Strippable";
public bool CanBeStripped(IEntity by)
public bool CanBeStripped(EntityUid by)
{
return by != Owner
&& IoCManager.Resolve<IEntityManager>().HasComponent<SharedHandsComponent>(@by)

View File

@@ -18,7 +18,7 @@ namespace Content.Shared.Tag
/// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception>
public static bool AddTag(this IEntity entity, string id)
public static bool AddTag(this EntityUid entity, string id)
{
return entity.EnsureComponent(out TagComponent tagComponent) &&
tagComponent.AddTag(id);
@@ -35,7 +35,7 @@ namespace Content.Shared.Tag
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public static bool AddTags(this IEntity entity, params string[] ids)
public static bool AddTags(this EntityUid entity, params string[] ids)
{
return entity.EnsureComponent(out TagComponent tagComponent) &&
tagComponent.AddTags(ids);
@@ -52,7 +52,7 @@ namespace Content.Shared.Tag
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public static bool AddTags(this IEntity entity, IEnumerable<string> ids)
public static bool AddTags(this EntityUid entity, IEnumerable<string> ids)
{
return entity.EnsureComponent(out TagComponent tagComponent) &&
tagComponent.AddTags(ids);
@@ -70,7 +70,7 @@ namespace Content.Shared.Tag
/// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception>
public static bool TryAddTag(this IEntity entity, string id)
public static bool TryAddTag(this EntityUid entity, string id)
{
return IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out TagComponent? tagComponent) &&
tagComponent.AddTag(id);
@@ -88,7 +88,7 @@ namespace Content.Shared.Tag
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public static bool TryAddTags(this IEntity entity, params string[] ids)
public static bool TryAddTags(this EntityUid entity, params string[] ids)
{
return IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out TagComponent? tagComponent) &&
tagComponent.AddTags(ids);
@@ -106,7 +106,7 @@ namespace Content.Shared.Tag
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public static bool TryAddTags(this IEntity entity, IEnumerable<string> ids)
public static bool TryAddTags(this EntityUid entity, IEnumerable<string> ids)
{
return IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out TagComponent? tagComponent) &&
tagComponent.AddTags(ids);
@@ -121,7 +121,7 @@ namespace Content.Shared.Tag
/// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception>
public static bool HasTag(this IEntity entity, string id)
public static bool HasTag(this EntityUid entity, string id)
{
return IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out TagComponent? tagComponent) &&
tagComponent.HasTag(id);
@@ -136,7 +136,7 @@ namespace Content.Shared.Tag
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public static bool HasAllTags(this IEntity entity, params string[] ids)
public static bool HasAllTags(this EntityUid entity, params string[] ids)
{
return IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out TagComponent? tagComponent) &&
tagComponent.HasAllTags(ids);
@@ -151,7 +151,7 @@ namespace Content.Shared.Tag
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public static bool HasAllTags(this IEntity entity, IEnumerable<string> ids)
public static bool HasAllTags(this EntityUid entity, IEnumerable<string> ids)
{
return IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out TagComponent? tagComponent) &&
tagComponent.HasAllTags(ids);
@@ -166,7 +166,7 @@ namespace Content.Shared.Tag
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public static bool HasAnyTag(this IEntity entity, params string[] ids)
public static bool HasAnyTag(this EntityUid entity, params string[] ids)
{
return IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out TagComponent? tagComponent) &&
tagComponent.HasAnyTag(ids);
@@ -181,7 +181,7 @@ namespace Content.Shared.Tag
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public static bool HasAnyTag(this IEntity entity, IEnumerable<string> ids)
public static bool HasAnyTag(this EntityUid entity, IEnumerable<string> ids)
{
return IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out TagComponent? tagComponent) &&
tagComponent.HasAnyTag(ids);
@@ -198,7 +198,7 @@ namespace Content.Shared.Tag
/// <exception cref="UnknownPrototypeException">
/// Thrown if no <see cref="TagPrototype"/> exists with the given id.
/// </exception>
public static bool RemoveTag(this IEntity entity, string id)
public static bool RemoveTag(this EntityUid entity, string id)
{
return IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out TagComponent? tagComponent) &&
tagComponent.RemoveTag(id);
@@ -215,7 +215,7 @@ namespace Content.Shared.Tag
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
/// </returns>
public static bool RemoveTags(this IEntity entity, params string[] ids)
public static bool RemoveTags(this EntityUid entity, params string[] ids)
{
return IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out TagComponent? tagComponent) &&
tagComponent.RemoveTags(ids);
@@ -232,7 +232,7 @@ namespace Content.Shared.Tag
/// <exception cref="UnknownPrototypeException">
/// Thrown if one of the ids represents an unregistered <see cref="TagPrototype"/>.
/// </exception>
public static bool RemoveTags(this IEntity entity, IEnumerable<string> ids)
public static bool RemoveTags(this EntityUid entity, IEnumerable<string> ids)
{
return IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out TagComponent? tagComponent) &&
tagComponent.RemoveTags(ids);

View File

@@ -13,19 +13,19 @@ namespace Content.Shared.Throwing
/// <summary>
/// The entity that threw <see cref="Thrown"/>.
/// </summary>
public IEntity? User { get; }
public EntityUid? User { get; }
/// <summary>
/// The entity thrown by <see cref="User"/> that hit <see cref="Target"/>
/// </summary>
public IEntity Thrown { get; }
public EntityUid Thrown { get; }
/// <summary>
/// The entity hit with <see cref="Thrown"/> by <see cref="User"/>
/// </summary>
public IEntity Target { get; }
public EntityUid Target { get; }
public ThrowEvent(IEntity? user, IEntity thrown, IEntity target)
public ThrowEvent(EntityUid? user, EntityUid thrown, EntityUid target)
{
User = user;
Thrown = thrown;
@@ -38,7 +38,7 @@ namespace Content.Shared.Throwing
/// </summary>
public class ThrowHitByEvent : ThrowEvent
{
public ThrowHitByEvent(IEntity? user, IEntity thrown, IEntity target) : base(user, thrown, target)
public ThrowHitByEvent(EntityUid? user, EntityUid thrown, EntityUid target) : base(user, thrown, target)
{
}
}
@@ -48,7 +48,7 @@ namespace Content.Shared.Throwing
/// </summary>
public class ThrowDoHitEvent : ThrowEvent
{
public ThrowDoHitEvent(IEntity? user, IEntity thrown, IEntity target) : base(user, thrown, target)
public ThrowDoHitEvent(EntityUid? user, EntityUid thrown, EntityUid target) : base(user, thrown, target)
{
}
}

View File

@@ -10,7 +10,7 @@ namespace Content.Shared.Throwing
{
public override string Name => "ThrownItem";
public IEntity? Thrower { get; set; }
public EntityUid? Thrower { get; set; }
}
[Serializable, NetSerializable]

View File

@@ -136,7 +136,7 @@ namespace Content.Shared.Throwing
/// <summary>
/// Raises collision events on the thrown and target entities.
/// </summary>
public void ThrowCollideInteraction(IEntity? user, IPhysBody thrown, IPhysBody target)
public void ThrowCollideInteraction(EntityUid? user, IPhysBody thrown, IPhysBody target)
{
if (user is not null)
_adminLogSystem.Add(LogType.ThrowHit, LogImpact.Low,

View File

@@ -18,7 +18,7 @@ namespace Content.Shared.Transform
transform.AttachParent(grandParent);
}
public static void AttachToGrandparent(this IEntity entity)
public static void AttachToGrandparent(this EntityUid entity)
{
AttachToGrandparent(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity));
}

View File

@@ -12,12 +12,12 @@ namespace Content.Shared.Weapons.Melee
/// <summary>
/// Entity used to attack, for broadcast purposes.
/// </summary>
public IEntity Used { get; }
public EntityUid Used { get; }
/// <summary>
/// Entity that triggered the attack.
/// </summary>
public IEntity User { get; }
public EntityUid User { get; }
/// <summary>
/// The original location that was clicked by the user.
@@ -32,9 +32,9 @@ namespace Content.Shared.Weapons.Melee
/// <summary>
/// Entity that was attacked.
/// </summary>
public IEntity? TargetEntity { get; }
public EntityUid? TargetEntity { get; }
public ClickAttackEvent(IEntity used, IEntity user, EntityCoordinates clickLocation, EntityUid target = default)
public ClickAttackEvent(EntityUid used, EntityUid user, EntityCoordinates clickLocation, EntityUid target = default)
{
Used = used;
User = user;
@@ -54,19 +54,19 @@ namespace Content.Shared.Weapons.Melee
/// <summary>
/// Entity used to attack, for broadcast purposes.
/// </summary>
public IEntity Used { get; }
public EntityUid Used { get; }
/// <summary>
/// Entity that triggered the attack.
/// </summary>
public IEntity User { get; }
public EntityUid User { get; }
/// <summary>
/// The original location that was clicked by the user.
/// </summary>
public EntityCoordinates ClickLocation { get; }
public WideAttackEvent(IEntity used, IEntity user, EntityCoordinates clickLocation)
public WideAttackEvent(EntityUid used, EntityUid user, EntityCoordinates clickLocation)
{
Used = used;
User = user;
@@ -82,19 +82,19 @@ namespace Content.Shared.Weapons.Melee
/// <summary>
/// Entity used to attack, for broadcast purposes.
/// </summary>
public IEntity Used { get; }
public EntityUid Used { get; }
/// <summary>
/// Entity that triggered the attack.
/// </summary>
public IEntity User { get; }
public EntityUid User { get; }
/// <summary>
/// The original location that was clicked by the user.
/// </summary>
public EntityCoordinates ClickLocation { get; }
public AttackedEvent(IEntity used, IEntity user, EntityCoordinates clickLocation)
public AttackedEvent(EntityUid used, EntityUid user, EntityCoordinates clickLocation)
{
Used = used;
User = user;