Fix a lot more errors.

This commit is contained in:
Vera Aguilera Puerto
2021-12-04 12:35:33 +01:00
parent bfccc647be
commit 424c83e39c
20 changed files with 176 additions and 241 deletions

View File

@@ -200,7 +200,7 @@ namespace Content.Server.GameTicking
} }
#region Mob Spawning Helpers #region Mob Spawning Helpers
private IEntity SpawnPlayerMob(Job job, HumanoidCharacterProfile? profile, StationId station, bool lateJoin = true) private EntityUid SpawnPlayerMob(Job job, HumanoidCharacterProfile? profile, StationId station, bool lateJoin = true)
{ {
var coordinates = lateJoin ? GetLateJoinSpawnPoint(station) : GetJobSpawnPoint(job.Prototype.ID, station); var coordinates = lateJoin ? GetLateJoinSpawnPoint(station) : GetJobSpawnPoint(job.Prototype.ID, station);
var entity = EntityManager.SpawnEntity(PlayerPrototypeName, coordinates); var entity = EntityManager.SpawnEntity(PlayerPrototypeName, coordinates);
@@ -213,14 +213,14 @@ namespace Content.Server.GameTicking
if (profile != null) if (profile != null)
{ {
EntitySystem.Get<SharedHumanoidAppearanceSystem>().UpdateFromProfile(entity, profile); _humanoidAppearanceSystem.UpdateFromProfile(entity, profile);
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName = profile.Name; EntityManager.GetComponent<MetaDataComponent>(entity).EntityName = profile.Name;
} }
return entity; return entity;
} }
private IEntity SpawnObserverMob() private EntityUid SpawnObserverMob()
{ {
var coordinates = GetObserverSpawnPoint(); var coordinates = GetObserverSpawnPoint();
return EntityManager.SpawnEntity(ObserverPrototypeName, coordinates); return EntityManager.SpawnEntity(ObserverPrototypeName, coordinates);
@@ -228,7 +228,7 @@ namespace Content.Server.GameTicking
#endregion #endregion
#region Equip Helpers #region Equip Helpers
public void EquipStartingGear(IEntity entity, StartingGearPrototype startingGear, HumanoidCharacterProfile? profile) public void EquipStartingGear(EntityUid entity, StartingGearPrototype startingGear, HumanoidCharacterProfile? profile)
{ {
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out InventoryComponent? inventory)) if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out InventoryComponent? inventory))
{ {
@@ -238,25 +238,25 @@ namespace Content.Server.GameTicking
if (!string.IsNullOrEmpty(equipmentStr)) if (!string.IsNullOrEmpty(equipmentStr))
{ {
var equipmentEntity = EntityManager.SpawnEntity(equipmentStr, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates); var equipmentEntity = EntityManager.SpawnEntity(equipmentStr, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates);
inventory.Equip(slot, IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(equipmentEntity)); inventory.Equip(slot, EntityManager.GetComponent<ItemComponent>(equipmentEntity));
} }
} }
} }
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out HandsComponent? handsComponent)) if (EntityManager.TryGetComponent(entity, out HandsComponent? handsComponent))
{ {
var inhand = startingGear.Inhand; var inhand = startingGear.Inhand;
foreach (var (hand, prototype) in inhand) foreach (var (hand, prototype) in inhand)
{ {
var inhandEntity = EntityManager.SpawnEntity(prototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates); var inhandEntity = EntityManager.SpawnEntity(prototype, EntityManager.GetComponent<TransformComponent>(entity).Coordinates);
handsComponent.TryPickupEntity(hand, inhandEntity, checkActionBlocker: false); handsComponent.TryPickupEntity(hand, inhandEntity, checkActionBlocker: false);
} }
} }
} }
public void EquipIdCard(IEntity entity, string characterName, JobPrototype jobPrototype) public void EquipIdCard(EntityUid entity, string characterName, JobPrototype jobPrototype)
{ {
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out InventoryComponent? inventory)) if (!EntityManager.TryGetComponent(entity, out InventoryComponent? inventory))
return; return;
if (!inventory.TryGetSlotItem(EquipmentSlotDefines.Slots.IDCARD, out ItemComponent? item)) if (!inventory.TryGetSlotItem(EquipmentSlotDefines.Slots.IDCARD, out ItemComponent? item))
@@ -276,8 +276,7 @@ namespace Content.Server.GameTicking
var access = IoCManager.Resolve<IEntityManager>().GetComponent<AccessComponent>(card.Owner); var access = IoCManager.Resolve<IEntityManager>().GetComponent<AccessComponent>(card.Owner);
var accessTags = access.Tags; var accessTags = access.Tags;
accessTags.UnionWith(jobPrototype.Access); accessTags.UnionWith(jobPrototype.Access);
EntityManager.EntitySysManager.GetEntitySystem<PDASystem>() _pdaSystem.SetOwner(pdaComponent, characterName);
.SetOwner(pdaComponent, characterName);
} }
#endregion #endregion

View File

@@ -1,6 +1,8 @@
using Content.Server.Administration.Logs; using Content.Server.Administration.Logs;
using Content.Server.CharacterAppearance.Systems;
using Content.Server.Chat.Managers; using Content.Server.Chat.Managers;
using Content.Server.Maps; using Content.Server.Maps;
using Content.Server.PDA;
using Content.Server.Preferences.Managers; using Content.Server.Preferences.Managers;
using Content.Server.Roles; using Content.Server.Roles;
using Content.Server.Station; using Content.Server.Station;
@@ -91,5 +93,7 @@ namespace Content.Server.GameTicking
[Dependency] private readonly IGameMapManager _gameMapManager = default!; [Dependency] private readonly IGameMapManager _gameMapManager = default!;
[Dependency] private readonly StationSystem _stationSystem = default!; [Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!; [Dependency] private readonly AdminLogSystem _adminLogSystem = default!;
[Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearanceSystem = default!;
[Dependency] private readonly PDASystem _pdaSystem = default!;
} }
} }

View File

@@ -102,7 +102,9 @@ namespace Content.Shared.Hands.Components
public void UpdateHandVisualizer() public void UpdateHandVisualizer()
{ {
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance)) var entMan = IoCManager.Resolve<IEntityManager>();
if (!entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
return; return;
var hands = new List<HandVisualState>(); var hands = new List<HandVisualState>();
@@ -111,7 +113,7 @@ namespace Content.Shared.Hands.Components
if (hand.HeldEntity == null) if (hand.HeldEntity == null)
continue; continue;
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(hand.HeldEntity, out SharedItemComponent? item) || item.RsiPath == null) if (!entMan.TryGetComponent(hand.HeldEntity.Value, out SharedItemComponent? item) || item.RsiPath == null)
continue; continue;
var handState = new HandVisualState(item.RsiPath, item.EquippedPrefix, hand.Location, item.Color); var handState = new HandVisualState(item.RsiPath, item.EquippedPrefix, hand.Location, item.Color);
@@ -217,7 +219,7 @@ namespace Content.Shared.Hands.Components
return hand.HeldEntity != null; return hand.HeldEntity != null;
} }
public bool TryGetHeldEntity(string handName, [NotNullWhen(true)] out IEntity? heldEntity) public bool TryGetHeldEntity(string handName, [NotNullWhen(true)] out EntityUid? heldEntity)
{ {
heldEntity = null; heldEntity = null;
@@ -228,13 +230,13 @@ namespace Content.Shared.Hands.Components
return heldEntity != null; return heldEntity != null;
} }
public bool TryGetActiveHeldEntity([NotNullWhen(true)] out IEntity? heldEntity) public bool TryGetActiveHeldEntity([NotNullWhen(true)] out EntityUid? heldEntity)
{ {
heldEntity = GetActiveHand()?.HeldEntity; heldEntity = GetActiveHand()?.HeldEntity;
return heldEntity != null; return heldEntity != null;
} }
public bool IsHolding(IEntity entity) public bool IsHolding(EntityUid entity)
{ {
foreach (var hand in Hands) foreach (var hand in Hands)
{ {
@@ -244,12 +246,12 @@ namespace Content.Shared.Hands.Components
return false; return false;
} }
public IEnumerable<IEntity> GetAllHeldEntities() public IEnumerable<EntityUid> GetAllHeldEntities()
{ {
foreach (var hand in Hands) foreach (var hand in Hands)
{ {
if (hand.HeldEntity != null) if (hand.HeldEntity != null)
yield return hand.HeldEntity; yield return hand.HeldEntity.Value;
} }
} }
@@ -269,7 +271,7 @@ namespace Content.Shared.Hands.Components
return acc; return acc;
} }
public bool TryGetHandHoldingEntity(IEntity entity, [NotNullWhen(true)] out Hand? handFound) public bool TryGetHandHoldingEntity(EntityUid entity, [NotNullWhen(true)] out Hand? handFound)
{ {
handFound = null; handFound = null;
@@ -330,7 +332,7 @@ namespace Content.Shared.Hands.Components
/// <summary> /// <summary>
/// Tries to drop a held entity to the target location. /// Tries to drop a held entity to the target location.
/// </summary> /// </summary>
public bool TryDropEntity(IEntity entity, EntityCoordinates coords, bool doMobChecks = true) public bool TryDropEntity(EntityUid entity, EntityCoordinates coords, bool doMobChecks = true)
{ {
if (!TryGetHandHoldingEntity(entity, out var hand)) if (!TryGetHandHoldingEntity(entity, out var hand))
return false; return false;
@@ -356,7 +358,7 @@ namespace Content.Shared.Hands.Components
/// <summary> /// <summary>
/// Attempts to move a held item from a hand into a container that is not another hand, without dropping it on the floor in-between. /// Attempts to move a held item from a hand into a container that is not another hand, without dropping it on the floor in-between.
/// </summary> /// </summary>
public bool Drop(IEntity entity, BaseContainer targetContainer, bool checkActionBlocker = true) public bool Drop(EntityUid entity, BaseContainer targetContainer, bool checkActionBlocker = true)
{ {
if (!TryGetHandHoldingEntity(entity, out var hand)) if (!TryGetHandHoldingEntity(entity, out var hand))
return false; return false;
@@ -382,7 +384,7 @@ namespace Content.Shared.Hands.Components
/// <summary> /// <summary>
/// Tries to drop a held entity directly under the player. /// Tries to drop a held entity directly under the player.
/// </summary> /// </summary>
public bool Drop(IEntity entity, bool checkActionBlocker = true) public bool Drop(EntityUid entity, bool checkActionBlocker = true)
{ {
if (!TryGetHandHoldingEntity(entity, out var hand)) if (!TryGetHandHoldingEntity(entity, out var hand))
return false; return false;
@@ -412,11 +414,11 @@ namespace Content.Shared.Hands.Components
/// </summary> /// </summary>
private bool CanRemoveHeldEntityFromHand(Hand hand) private bool CanRemoveHeldEntityFromHand(Hand hand)
{ {
var heldEntity = hand.HeldEntity; if (hand.HeldEntity == null)
if (heldEntity == null)
return false; return false;
var heldEntity = hand.HeldEntity.Value;
var handContainer = hand.Container; var handContainer = hand.Container;
if (handContainer == null) if (handContainer == null)
return false; return false;
@@ -443,11 +445,11 @@ namespace Content.Shared.Hands.Components
/// </summary> /// </summary>
private void RemoveHeldEntityFromHand(Hand hand) private void RemoveHeldEntityFromHand(Hand hand)
{ {
var heldEntity = hand.HeldEntity; if (hand.HeldEntity == null)
if (heldEntity == null)
return; return;
var heldEntity = hand.HeldEntity.Value;
var handContainer = hand.Container; var handContainer = hand.Container;
if (handContainer == null) if (handContainer == null)
return; return;
@@ -471,11 +473,11 @@ namespace Content.Shared.Hands.Components
/// </summary> /// </summary>
public void DropHeldEntity(Hand hand, EntityCoordinates targetDropLocation) public void DropHeldEntity(Hand hand, EntityCoordinates targetDropLocation)
{ {
var heldEntity = hand.HeldEntity; if (hand.HeldEntity == null)
if (heldEntity == null)
return; return;
var heldEntity = hand.HeldEntity.Value;
RemoveHeldEntityFromHand(hand); RemoveHeldEntityFromHand(hand);
EntitySystem.Get<SharedInteractionSystem>().DroppedInteraction(Owner, heldEntity); EntitySystem.Get<SharedInteractionSystem>().DroppedInteraction(Owner, heldEntity);
@@ -534,11 +536,11 @@ namespace Content.Shared.Hands.Components
private bool CanPutHeldEntityIntoContainer(Hand hand, IContainer targetContainer, bool checkActionBlocker) private bool CanPutHeldEntityIntoContainer(Hand hand, IContainer targetContainer, bool checkActionBlocker)
{ {
var heldEntity = hand.HeldEntity; if (hand.HeldEntity == null)
if (heldEntity == null)
return false; return false;
var heldEntity = hand.HeldEntity.Value;
if (checkActionBlocker && !PlayerCanDrop()) if (checkActionBlocker && !PlayerCanDrop())
return false; return false;
@@ -553,11 +555,11 @@ namespace Content.Shared.Hands.Components
/// </summary> /// </summary>
private void PutHeldEntityIntoContainer(Hand hand, IContainer targetContainer) private void PutHeldEntityIntoContainer(Hand hand, IContainer targetContainer)
{ {
var heldEntity = hand.HeldEntity; if (hand.HeldEntity == null)
if (heldEntity == null)
return; return;
var heldEntity = hand.HeldEntity.Value;
RemoveHeldEntityFromHand(hand); RemoveHeldEntityFromHand(hand);
if (!targetContainer.Insert(heldEntity)) if (!targetContainer.Insert(heldEntity))
@@ -571,7 +573,7 @@ namespace Content.Shared.Hands.Components
#region Pickup #region Pickup
public bool CanPickupEntity(string handName, IEntity entity, bool checkActionBlocker = true) public bool CanPickupEntity(string handName, EntityUid entity, bool checkActionBlocker = true)
{ {
if (!TryGetHand(handName, out var hand)) if (!TryGetHand(handName, out var hand))
return false; return false;
@@ -585,7 +587,7 @@ namespace Content.Shared.Hands.Components
return true; return true;
} }
public bool CanPickupEntityToActiveHand(IEntity entity, bool checkActionBlocker = true) public bool CanPickupEntityToActiveHand(EntityUid entity, bool checkActionBlocker = true)
{ {
return ActiveHand != null && CanPickupEntity(ActiveHand, entity, checkActionBlocker); return ActiveHand != null && CanPickupEntity(ActiveHand, entity, checkActionBlocker);
} }
@@ -593,7 +595,7 @@ namespace Content.Shared.Hands.Components
/// <summary> /// <summary>
/// Tries to pick up an entity to a specific hand. /// Tries to pick up an entity to a specific hand.
/// </summary> /// </summary>
public bool TryPickupEntity(string handName, IEntity entity, bool checkActionBlocker = true) public bool TryPickupEntity(string handName, EntityUid entity, bool checkActionBlocker = true)
{ {
if (!TryGetHand(handName, out var hand)) if (!TryGetHand(handName, out var hand))
return false; return false;
@@ -601,7 +603,7 @@ namespace Content.Shared.Hands.Components
return TryPickupEntity(hand, entity, checkActionBlocker); return TryPickupEntity(hand, entity, checkActionBlocker);
} }
public bool TryPickupEntityToActiveHand(IEntity entity, bool checkActionBlocker = true) public bool TryPickupEntityToActiveHand(EntityUid entity, bool checkActionBlocker = true)
{ {
return ActiveHand != null && TryPickupEntity(ActiveHand, entity, checkActionBlocker); return ActiveHand != null && TryPickupEntity(ActiveHand, entity, checkActionBlocker);
} }
@@ -609,7 +611,7 @@ namespace Content.Shared.Hands.Components
/// <summary> /// <summary>
/// Checks if an entity can be put into a hand's container. /// Checks if an entity can be put into a hand's container.
/// </summary> /// </summary>
protected bool CanInsertEntityIntoHand(Hand hand, IEntity entity) protected bool CanInsertEntityIntoHand(Hand hand, EntityUid entity)
{ {
var handContainer = hand.Container; var handContainer = hand.Container;
if (handContainer == null) if (handContainer == null)
@@ -636,7 +638,7 @@ namespace Content.Shared.Hands.Components
/// <summary> /// <summary>
/// Puts an entity into the player's hand, assumes that the insertion is allowed. /// Puts an entity into the player's hand, assumes that the insertion is allowed.
/// </summary> /// </summary>
public void PutEntityIntoHand(Hand hand, IEntity entity) public void PutEntityIntoHand(Hand hand, EntityUid entity)
{ {
var handContainer = hand.Container; var handContainer = hand.Container;
if (handContainer == null) if (handContainer == null)
@@ -660,7 +662,7 @@ namespace Content.Shared.Hands.Components
HandsModified(); HandsModified();
} }
private bool TryPickupEntity(Hand hand, IEntity entity, bool checkActionBlocker = true) private bool TryPickupEntity(Hand hand, EntityUid entity, bool checkActionBlocker = true)
{ {
if (!CanInsertEntityIntoHand(hand, entity)) if (!CanInsertEntityIntoHand(hand, entity))
return false; return false;
@@ -712,7 +714,7 @@ namespace Content.Shared.Hands.Components
return; return;
await EntitySystem.Get<SharedInteractionSystem>() await EntitySystem.Get<SharedInteractionSystem>()
.InteractUsing(Owner, activeHeldEntity, heldEntity, EntityCoordinates.Invalid); .InteractUsing(Owner, activeHeldEntity.Value, heldEntity.Value, EntityCoordinates.Invalid);
} }
public void ActivateItem(bool altInteract = false) public void ActivateItem(bool altInteract = false)
@@ -721,7 +723,7 @@ namespace Content.Shared.Hands.Components
return; return;
EntitySystem.Get<SharedInteractionSystem>() EntitySystem.Get<SharedInteractionSystem>()
.TryUseInteraction(Owner, heldEntity, altInteract); .TryUseInteraction(Owner, heldEntity.Value, altInteract);
} }
public void ActivateHeldEntity(string handName) public void ActivateHeldEntity(string handName)
@@ -744,14 +746,14 @@ namespace Content.Shared.Hands.Components
if (!TryGetHeldEntity(handName, out var heldEntity)) if (!TryGetHeldEntity(handName, out var heldEntity))
return false; return false;
if (!CanInsertEntityIntoHand(activeHand, heldEntity) || !CanRemoveHeldEntityFromHand(hand)) if (!CanInsertEntityIntoHand(activeHand, heldEntity.Value) || !CanRemoveHeldEntityFromHand(hand))
return false; return false;
if (checkActionBlocker && (!PlayerCanDrop() || !PlayerCanPickup())) if (checkActionBlocker && (!PlayerCanDrop() || !PlayerCanPickup()))
return false; return false;
RemoveHeldEntityFromHand(hand); RemoveHeldEntityFromHand(hand);
PutEntityIntoHand(activeHand, heldEntity); PutEntityIntoHand(activeHand, heldEntity.Value);
return true; return true;
} }
@@ -760,13 +762,13 @@ namespace Content.Shared.Hands.Components
private void DeselectActiveHeldEntity() private void DeselectActiveHeldEntity()
{ {
if (TryGetActiveHeldEntity(out var entity)) if (TryGetActiveHeldEntity(out var entity))
EntitySystem.Get<SharedInteractionSystem>().HandDeselectedInteraction(Owner, entity); EntitySystem.Get<SharedInteractionSystem>().HandDeselectedInteraction(Owner, entity.Value);
} }
private void SelectActiveHeldEntity() private void SelectActiveHeldEntity()
{ {
if (TryGetActiveHeldEntity(out var entity)) if (TryGetActiveHeldEntity(out var entity))
EntitySystem.Get<SharedInteractionSystem>().HandSelectedInteraction(Owner, entity); EntitySystem.Get<SharedInteractionSystem>().HandSelectedInteraction(Owner, entity.Value);
} }
private void HandCountChanged() private void HandCountChanged()
@@ -796,7 +798,7 @@ namespace Content.Shared.Hands.Components
/// <summary> /// <summary>
/// Tries to pick up an entity into the active hand. If it cannot, tries to pick up the entity into each other hand. /// Tries to pick up an entity into the active hand. If it cannot, tries to pick up the entity into each other hand.
/// </summary> /// </summary>
public bool TryPutInActiveHandOrAny(IEntity entity, bool checkActionBlocker = true) public bool TryPutInActiveHandOrAny(EntityUid entity, bool checkActionBlocker = true)
{ {
return TryPutInAnyHand(entity, GetActiveHand(), checkActionBlocker); return TryPutInAnyHand(entity, GetActiveHand(), checkActionBlocker);
} }
@@ -804,7 +806,7 @@ namespace Content.Shared.Hands.Components
/// <summary> /// <summary>
/// Tries to pick up an entity into the priority hand, if provided. If it cannot, tries to pick up the entity into each other hand. /// Tries to pick up an entity into the priority hand, if provided. If it cannot, tries to pick up the entity into each other hand.
/// </summary> /// </summary>
public bool TryPutInAnyHand(IEntity entity, string? priorityHandName = null, bool checkActionBlocker = true) public bool TryPutInAnyHand(EntityUid entity, string? priorityHandName = null, bool checkActionBlocker = true)
{ {
Hand? priorityHand = null; Hand? priorityHand = null;
@@ -817,7 +819,7 @@ namespace Content.Shared.Hands.Components
/// <summary> /// <summary>
/// Tries to pick up an entity into the priority hand, if provided. If it cannot, tries to pick up the entity into each other hand. /// Tries to pick up an entity into the priority hand, if provided. If it cannot, tries to pick up the entity into each other hand.
/// </summary> /// </summary>
private bool TryPutInAnyHand(IEntity entity, Hand? priorityHand = null, bool checkActionBlocker = true) private bool TryPutInAnyHand(EntityUid entity, Hand? priorityHand = null, bool checkActionBlocker = true)
{ {
if (priorityHand != null) if (priorityHand != null)
{ {
@@ -833,9 +835,9 @@ namespace Content.Shared.Hands.Components
return false; return false;
} }
protected virtual void OnHeldEntityRemovedFromHand(IEntity heldEntity, HandState handState) { } protected virtual void OnHeldEntityRemovedFromHand(EntityUid heldEntity, HandState handState) { }
protected virtual void HandlePickupAnimation(IEntity entity) { } protected virtual void HandlePickupAnimation(EntityUid entity) { }
} }
#region visualizerData #region visualizerData
@@ -890,7 +892,7 @@ namespace Content.Shared.Hands.Components
public IContainer? Container { get; set; } public IContainer? Container { get; set; }
[ViewVariables] [ViewVariables]
public IEntity? HeldEntity => Container?.ContainedEntities?.FirstOrDefault(); public EntityUid? HeldEntity => Container?.ContainedEntities?.FirstOrDefault();
public bool IsEmpty => HeldEntity == null; public bool IsEmpty => HeldEntity == null;
@@ -995,12 +997,12 @@ namespace Content.Shared.Hands.Components
public class HandCountChangedEvent : EntityEventArgs public class HandCountChangedEvent : EntityEventArgs
{ {
public HandCountChangedEvent(IEntity sender) public HandCountChangedEvent(EntityUid sender)
{ {
Sender = sender; Sender = sender;
} }
public IEntity Sender { get; } public EntityUid Sender { get; }
} }
[Serializable, NetSerializable] [Serializable, NetSerializable]

View File

@@ -22,7 +22,7 @@ namespace Content.Shared.Hands
public class EquippedHandEventArgs : UserEventArgs public class EquippedHandEventArgs : UserEventArgs
{ {
public EquippedHandEventArgs(IEntity user, HandState hand) : base(user) public EquippedHandEventArgs(EntityUid user, HandState hand) : base(user)
{ {
Hand = hand; Hand = hand;
} }
@@ -39,19 +39,19 @@ namespace Content.Shared.Hands
/// <summary> /// <summary>
/// Entity that equipped the item. /// Entity that equipped the item.
/// </summary> /// </summary>
public IEntity User { get; } public EntityUid User { get; }
/// <summary> /// <summary>
/// Item that was equipped. /// Item that was equipped.
/// </summary> /// </summary>
public IEntity Equipped { get; } public EntityUid Equipped { get; }
/// <summary> /// <summary>
/// Hand that the item was placed into. /// Hand that the item was placed into.
/// </summary> /// </summary>
public HandState Hand { get; } public HandState Hand { get; }
public EquippedHandEvent(IEntity user, IEntity equipped, HandState hand) public EquippedHandEvent(EntityUid user, EntityUid equipped, HandState hand)
{ {
User = user; User = user;
Equipped = equipped; Equipped = equipped;

View File

@@ -17,12 +17,12 @@ namespace Content.Shared.Hands
public class HandDeselectedEventArgs : EventArgs public class HandDeselectedEventArgs : EventArgs
{ {
public HandDeselectedEventArgs(IEntity user) public HandDeselectedEventArgs(EntityUid user)
{ {
User = user; User = user;
} }
public IEntity User { get; } public EntityUid User { get; }
} }
/// <summary> /// <summary>
@@ -34,14 +34,14 @@ namespace Content.Shared.Hands
/// <summary> /// <summary>
/// Entity that owns the deselected hand. /// Entity that owns the deselected hand.
/// </summary> /// </summary>
public IEntity User { get; } public EntityUid User { get; }
/// <summary> /// <summary>
/// Item in the hand that was deselected. /// Item in the hand that was deselected.
/// </summary> /// </summary>
public IEntity Item { get; } public EntityUid Item { get; }
public HandDeselectedEvent(IEntity user, IEntity item) public HandDeselectedEvent(EntityUid user, EntityUid item)
{ {
User = user; User = user;
Item = item; Item = item;

View File

@@ -17,12 +17,12 @@ namespace Content.Shared.Hands
public class HandSelectedEventArgs : EventArgs public class HandSelectedEventArgs : EventArgs
{ {
public HandSelectedEventArgs(IEntity user) public HandSelectedEventArgs(EntityUid user)
{ {
User = user; User = user;
} }
public IEntity User { get; } public EntityUid User { get; }
} }
/// <summary> /// <summary>
@@ -34,14 +34,14 @@ namespace Content.Shared.Hands
/// <summary> /// <summary>
/// Entity that owns the selected hand. /// Entity that owns the selected hand.
/// </summary> /// </summary>
public IEntity User { get; } public EntityUid User { get; }
/// <summary> /// <summary>
/// Item in the hand that was selected. /// Item in the hand that was selected.
/// </summary> /// </summary>
public IEntity Item { get; } public EntityUid Item { get; }
public HandSelectedEvent(IEntity user, IEntity item) public HandSelectedEvent(EntityUid user, EntityUid item)
{ {
User = user; User = user;
Item = item; Item = item;

View File

@@ -21,7 +21,7 @@ namespace Content.Shared.Hands
public class UnequippedHandEventArgs : UserEventArgs public class UnequippedHandEventArgs : UserEventArgs
{ {
public UnequippedHandEventArgs(IEntity user, HandState hand) : base(user) public UnequippedHandEventArgs(EntityUid user, HandState hand) : base(user)
{ {
Hand = hand; Hand = hand;
} }
@@ -38,19 +38,19 @@ namespace Content.Shared.Hands
/// <summary> /// <summary>
/// Entity that equipped the item. /// Entity that equipped the item.
/// </summary> /// </summary>
public IEntity User { get; } public EntityUid User { get; }
/// <summary> /// <summary>
/// Item that was unequipped. /// Item that was unequipped.
/// </summary> /// </summary>
public IEntity Unequipped { get; } public EntityUid Unequipped { get; }
/// <summary> /// <summary>
/// Hand that the item is removed from. /// Hand that the item is removed from.
/// </summary> /// </summary>
public HandState Hand { get; } public HandState Hand { get; }
public UnequippedHandEvent(IEntity user, IEntity unequipped, HandState hand) public UnequippedHandEvent(EntityUid user, EntityUid unequipped, HandState hand)
{ {
User = user; User = user;
Unequipped = unequipped; Unequipped = unequipped;

View File

@@ -13,32 +13,17 @@ namespace Content.Shared.Interaction
/// <summary> /// <summary>
/// Entity that triggered the interaction. /// Entity that triggered the interaction.
/// </summary> /// </summary>
public IEntity User { get; } public EntityUid User { get; }
/// <summary>
/// Entity that triggered the interaction.
/// </summary>
public EntityUid UserUid => User;
/// <summary> /// <summary>
/// Entity that the user used to interact. /// Entity that the user used to interact.
/// </summary> /// </summary>
public IEntity Used { get; } public EntityUid Used { get; }
/// <summary>
/// Entity that the user used to interact.
/// </summary>
public EntityUid UsedUid => Used;
/// <summary> /// <summary>
/// Entity that was interacted on. This can be null if the attack did not click on an entity. /// Entity that was interacted on. This can be null if the attack did not click on an entity.
/// </summary> /// </summary>
public IEntity? Target { get; } public EntityUid? Target { get; }
/// <summary>
/// Entity that was interacted on. This can be null if the attack did not click on an entity.
/// </summary>
public EntityUid? TargetUid => Target;
/// <summary> /// <summary>
/// Location that the user clicked outside of their interaction range. /// Location that the user clicked outside of their interaction range.
@@ -52,9 +37,9 @@ namespace Content.Shared.Interaction
public bool CanReach { get; } public bool CanReach { get; }
public BeforeInteractEvent( public BeforeInteractEvent(
IEntity user, EntityUid user,
IEntity used, EntityUid used,
IEntity? target, EntityUid? target,
EntityCoordinates clickLocation, EntityCoordinates clickLocation,
bool canReach) bool canReach)
{ {

View File

@@ -24,14 +24,14 @@ namespace Content.Shared.Interaction
public class ActivateEventArgs : EventArgs, ITargetedInteractEventArgs public class ActivateEventArgs : EventArgs, ITargetedInteractEventArgs
{ {
public ActivateEventArgs(IEntity user, IEntity target) public ActivateEventArgs(EntityUid user, EntityUid target)
{ {
User = user; User = user;
Target = target; Target = target;
} }
public IEntity User { get; } public EntityUid User { get; }
public IEntity Target { get; } public EntityUid Target { get; }
} }
/// <summary> /// <summary>
@@ -43,24 +43,14 @@ namespace Content.Shared.Interaction
/// <summary> /// <summary>
/// Entity that activated the target world entity. /// Entity that activated the target world entity.
/// </summary> /// </summary>
public IEntity User { get; } public EntityUid User { get; }
/// <summary>
/// Entity that activated the target world entity.
/// </summary>
public EntityUid UserUid => User;
/// <summary> /// <summary>
/// Entity that was activated in the world. /// Entity that was activated in the world.
/// </summary> /// </summary>
public IEntity Target { get; } public EntityUid Target { get; }
/// <summary> public ActivateInWorldEvent(EntityUid user, EntityUid target)
/// Entity that was activated in the world.
/// </summary>
public EntityUid TargetUid => Target;
public ActivateInWorldEvent(IEntity user, IEntity target)
{ {
User = user; User = user;
Target = target; Target = target;

View File

@@ -31,12 +31,12 @@ namespace Content.Shared.Interaction
public class AfterInteractEventArgs : EventArgs public class AfterInteractEventArgs : EventArgs
{ {
public IEntity User { get; } public EntityUid User { get; }
public EntityCoordinates ClickLocation { get; } public EntityCoordinates ClickLocation { get; }
public IEntity? Target { get; } public EntityUid? Target { get; }
public bool CanReach { get; } public bool CanReach { get; }
public AfterInteractEventArgs(IEntity user, EntityCoordinates clickLocation, IEntity? target, bool canReach) public AfterInteractEventArgs(EntityUid user, EntityCoordinates clickLocation, EntityUid? target, bool canReach)
{ {
User = user; User = user;
ClickLocation = clickLocation; ClickLocation = clickLocation;
@@ -54,32 +54,17 @@ namespace Content.Shared.Interaction
/// <summary> /// <summary>
/// Entity that triggered the interaction. /// Entity that triggered the interaction.
/// </summary> /// </summary>
public IEntity User { get; } public EntityUid User { get; }
/// <summary>
/// Entity that triggered the interaction.
/// </summary>
public EntityUid UserUid => User;
/// <summary> /// <summary>
/// Entity that the user used to interact. /// Entity that the user used to interact.
/// </summary> /// </summary>
public IEntity Used { get; } public EntityUid Used { get; }
/// <summary>
/// Entity that the user used to interact.
/// </summary>
public EntityUid UsedUid => Used;
/// <summary> /// <summary>
/// Entity that was interacted on. This can be null if the attack did not click on an entity. /// Entity that was interacted on. This can be null if the attack did not click on an entity.
/// </summary> /// </summary>
public IEntity? Target { get; } public EntityUid? Target { get; }
/// <summary>
/// Entity that was interacted on. This can be null if the attack did not click on an entity.
/// </summary>
public EntityUid? TargetUid => Target;
/// <summary> /// <summary>
/// Location that the user clicked outside of their interaction range. /// Location that the user clicked outside of their interaction range.
@@ -92,7 +77,7 @@ namespace Content.Shared.Interaction
/// </summary> /// </summary>
public bool CanReach { get; } public bool CanReach { get; }
public AfterInteractEvent(IEntity user, IEntity used, IEntity? target, public AfterInteractEvent(EntityUid user, EntityUid used, EntityUid? target,
EntityCoordinates clickLocation, bool canReach) EntityCoordinates clickLocation, bool canReach)
{ {
User = user; User = user;

View File

@@ -17,12 +17,12 @@ namespace Content.Shared.Interaction
public class DroppedEventArgs : EventArgs public class DroppedEventArgs : EventArgs
{ {
public DroppedEventArgs(IEntity user) public DroppedEventArgs(EntityUid user)
{ {
User = user; User = user;
} }
public IEntity User { get; } public EntityUid User { get; }
} }
/// <summary> /// <summary>

View File

@@ -30,7 +30,7 @@ namespace Content.Shared.Interaction
public class InteractUsingEventArgs : EventArgs, ITargetedInteractEventArgs public class InteractUsingEventArgs : EventArgs, ITargetedInteractEventArgs
{ {
public InteractUsingEventArgs(IEntity user, EntityCoordinates clickLocation, IEntity @using, IEntity target) public InteractUsingEventArgs(EntityUid user, EntityCoordinates clickLocation, EntityUid @using, EntityUid target)
{ {
User = user; User = user;
ClickLocation = clickLocation; ClickLocation = clickLocation;
@@ -38,10 +38,10 @@ namespace Content.Shared.Interaction
Target = target; Target = target;
} }
public IEntity User { get; } public EntityUid User { get; }
public EntityCoordinates ClickLocation { get; } public EntityCoordinates ClickLocation { get; }
public IEntity Using { get; } public EntityUid Using { get; }
public IEntity Target { get; } public EntityUid Target { get; }
} }
/// <summary> /// <summary>
@@ -53,39 +53,24 @@ namespace Content.Shared.Interaction
/// <summary> /// <summary>
/// Entity that triggered the interaction. /// Entity that triggered the interaction.
/// </summary> /// </summary>
public IEntity User { get; } public EntityUid User { get; }
/// <summary>
/// Entity that triggered the interaction.
/// </summary>
public EntityUid UserUid => User;
/// <summary> /// <summary>
/// Entity that the user used to interact. /// Entity that the user used to interact.
/// </summary> /// </summary>
public IEntity Used { get; } public EntityUid Used { get; }
/// <summary>
/// Entity that the user used to interact.
/// </summary>
public EntityUid UsedUid => Used;
/// <summary> /// <summary>
/// Entity that was interacted on. /// Entity that was interacted on.
/// </summary> /// </summary>
public IEntity Target { get; } public EntityUid Target { get; }
/// <summary>
/// Entity that was interacted on.
/// </summary>
public EntityUid TargetUid => Target;
/// <summary> /// <summary>
/// The original location that was clicked by the user. /// The original location that was clicked by the user.
/// </summary> /// </summary>
public EntityCoordinates ClickLocation { get; } public EntityCoordinates ClickLocation { get; }
public InteractUsingEvent(IEntity user, IEntity used, IEntity target, EntityCoordinates clickLocation) public InteractUsingEvent(EntityUid user, EntityUid used, EntityUid target, EntityCoordinates clickLocation)
{ {
User = user; User = user;
Used = used; Used = used;

View File

@@ -7,11 +7,11 @@ namespace Content.Shared.Interaction
/// <summary> /// <summary>
/// Performer of the attack /// Performer of the attack
/// </summary> /// </summary>
IEntity User { get; } EntityUid User { get; }
/// <summary> /// <summary>
/// Target of the attack /// Target of the attack
/// </summary> /// </summary>
IEntity Target { get; } EntityUid Target { get; }
} }
} }

View File

@@ -22,12 +22,12 @@ namespace Content.Shared.Interaction
public class UseEntityEventArgs : EventArgs public class UseEntityEventArgs : EventArgs
{ {
public UseEntityEventArgs(IEntity user) public UseEntityEventArgs(EntityUid user)
{ {
User = user; User = user;
} }
public IEntity User { get; } public EntityUid User { get; }
} }
/// <summary> /// <summary>
@@ -39,24 +39,14 @@ namespace Content.Shared.Interaction
/// <summary> /// <summary>
/// Entity holding the item in their hand. /// Entity holding the item in their hand.
/// </summary> /// </summary>
public IEntity User { get; } public EntityUid User { get; }
/// <summary>
/// Entity holding the item in their hand.
/// </summary>
public EntityUid UserUid => User;
/// <summary> /// <summary>
/// Item that was used. /// Item that was used.
/// </summary> /// </summary>
public IEntity Used { get; } public EntityUid Used { get; }
/// <summary> public UseInHandEvent(EntityUid user, EntityUid used)
/// Item that was used.
/// </summary>
public EntityUid UsedUid => Used;
public UseInHandEvent(IEntity user, IEntity used)
{ {
User = user; User = user;
Used = used; Used = used;

View File

@@ -90,11 +90,11 @@ namespace Content.Shared.Interaction
MapCoordinates origin, MapCoordinates origin,
MapCoordinates other, MapCoordinates other,
int collisionMask = (int) CollisionGroup.Impassable, int collisionMask = (int) CollisionGroup.Impassable,
IEntity? ignoredEnt = null) EntityUid? ignoredEnt = null)
{ {
var predicate = ignoredEnt == null var predicate = ignoredEnt == null
? null ? null
: (Ignored) (e => e == ignoredEnt?.Uid); : (Ignored) (e => e == ignoredEnt);
return UnobstructedDistance(origin, other, collisionMask, predicate); return UnobstructedDistance(origin, other, collisionMask, predicate);
} }
@@ -204,15 +204,15 @@ namespace Content.Shared.Interaction
/// True if the two points are within a given range without being obstructed. /// True if the two points are within a given range without being obstructed.
/// </returns> /// </returns>
public bool InRangeUnobstructed( public bool InRangeUnobstructed(
IEntity origin, EntityUid 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,
bool ignoreInsideBlocker = false, bool ignoreInsideBlocker = false,
bool popup = false) bool popup = false)
{ {
predicate ??= e => e == origin.Uid || e == other.Uid; predicate ??= e => e == origin || e == other;
return InRangeUnobstructed(origin, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other).MapPosition, range, collisionMask, predicate, ignoreInsideBlocker, popup); return InRangeUnobstructed(origin, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other).MapPosition, range, collisionMask, predicate, ignoreInsideBlocker, popup);
} }
@@ -249,7 +249,7 @@ namespace Content.Shared.Interaction
/// True if the two points are within a given range without being obstructed. /// True if the two points are within a given range without being obstructed.
/// </returns> /// </returns>
public bool InRangeUnobstructed( public bool InRangeUnobstructed(
IEntity origin, EntityUid origin,
IComponent other, IComponent other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
@@ -293,7 +293,7 @@ namespace Content.Shared.Interaction
/// True if the two points are within a given range without being obstructed. /// True if the two points are within a given range without being obstructed.
/// </returns> /// </returns>
public bool InRangeUnobstructed( public bool InRangeUnobstructed(
IEntity origin, EntityUid origin,
EntityCoordinates other, EntityCoordinates other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
@@ -337,7 +337,7 @@ namespace Content.Shared.Interaction
/// True if the two points are within a given range without being obstructed. /// True if the two points are within a given range without being obstructed.
/// </returns> /// </returns>
public bool InRangeUnobstructed( public bool InRangeUnobstructed(
IEntity origin, EntityUid origin,
MapCoordinates other, MapCoordinates other,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
@@ -346,7 +346,7 @@ namespace Content.Shared.Interaction
bool popup = false) bool popup = false)
{ {
var originPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin).MapPosition; var originPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin).MapPosition;
predicate ??= e => e == origin.Uid; predicate ??= e => e == origin;
var inRange = InRangeUnobstructed(originPosition, other, range, collisionMask, predicate, ignoreInsideBlocker); var inRange = InRangeUnobstructed(originPosition, other, range, collisionMask, predicate, ignoreInsideBlocker);
@@ -360,9 +360,9 @@ namespace Content.Shared.Interaction
} }
public bool InteractDoBefore( public bool InteractDoBefore(
IEntity user, EntityUid user,
IEntity used, EntityUid used,
IEntity? target, EntityUid? target,
EntityCoordinates clickLocation, EntityCoordinates clickLocation,
bool canReach) bool canReach)
{ {
@@ -376,7 +376,7 @@ namespace Content.Shared.Interaction
/// Finds components with the InteractUsing interface and calls their function /// Finds components with the InteractUsing interface and calls their function
/// NOTE: Does not have an InRangeUnobstructed check /// NOTE: Does not have an InRangeUnobstructed check
/// </summary> /// </summary>
public async Task InteractUsing(IEntity user, IEntity used, IEntity target, EntityCoordinates clickLocation) public async Task InteractUsing(EntityUid user, EntityUid used, EntityUid target, EntityCoordinates clickLocation)
{ {
if (!_actionBlockerSystem.CanInteract(user)) if (!_actionBlockerSystem.CanInteract(user))
return; return;
@@ -407,7 +407,7 @@ namespace Content.Shared.Interaction
/// <summary> /// <summary>
/// We didn't click on any entity, try doing an AfterInteract on the click location /// We didn't click on any entity, try doing an AfterInteract on the click location
/// </summary> /// </summary>
public async Task<bool> InteractDoAfter(IEntity user, IEntity used, IEntity? target, EntityCoordinates clickLocation, bool canReach) public async Task<bool> InteractDoAfter(EntityUid user, EntityUid used, EntityUid? target, EntityCoordinates clickLocation, bool canReach)
{ {
var afterInteractEvent = new AfterInteractEvent(user, used, target, clickLocation, canReach); var afterInteractEvent = new AfterInteractEvent(user, used, target, clickLocation, canReach);
RaiseLocalEvent(used, afterInteractEvent, false); RaiseLocalEvent(used, afterInteractEvent, false);
@@ -431,15 +431,15 @@ namespace Content.Shared.Interaction
/// Activates the IActivate behavior of an object /// Activates the IActivate behavior of an object
/// Verifies that the user is capable of doing the use interaction first /// Verifies that the user is capable of doing the use interaction first
/// </summary> /// </summary>
public void TryInteractionActivate(IEntity? user, IEntity? used) public void TryInteractionActivate(EntityUid? user, EntityUid? used)
{ {
if (user == null || used == null) if (user == null || used == null)
return; return;
InteractionActivate(user, used); InteractionActivate(user.Value, used.Value);
} }
protected void InteractionActivate(IEntity user, IEntity used) protected void InteractionActivate(EntityUid user, EntityUid used)
{ {
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<UseDelayComponent?>(used, out var delayComponent)) if (IoCManager.Resolve<IEntityManager>().TryGetComponent<UseDelayComponent?>(used, out var delayComponent))
{ {
@@ -486,7 +486,7 @@ namespace Content.Shared.Interaction
/// </summary> /// </summary>
/// <param name="user"></param> /// <param name="user"></param>
/// <param name="used"></param> /// <param name="used"></param>
public void TryUseInteraction(IEntity user, IEntity used, bool altInteract = false) public void TryUseInteraction(EntityUid user, EntityUid used, bool altInteract = false)
{ {
if (user != null && used != null && _actionBlockerSystem.CanUse(user)) if (user != null && used != null && _actionBlockerSystem.CanUse(user))
{ {
@@ -501,7 +501,7 @@ namespace Content.Shared.Interaction
/// Activates the IUse behaviors of an entity without first checking /// Activates the IUse behaviors of an entity without first checking
/// if the user is capable of doing the use interaction. /// if the user is capable of doing the use interaction.
/// </summary> /// </summary>
public void UseInteraction(IEntity user, IEntity used) public void UseInteraction(EntityUid user, EntityUid used)
{ {
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<UseDelayComponent?>(used, out var delayComponent)) if (IoCManager.Resolve<IEntityManager>().TryGetComponent<UseDelayComponent?>(used, out var delayComponent))
{ {
@@ -533,7 +533,7 @@ namespace Content.Shared.Interaction
/// <remarks> /// <remarks>
/// Uses the context menu verb list, and acts out the highest priority alternative interaction verb. /// Uses the context menu verb list, and acts out the highest priority alternative interaction verb.
/// </remarks> /// </remarks>
public void AltInteract(IEntity user, IEntity target) public void AltInteract(EntityUid user, EntityUid target)
{ {
// Get list of alt-interact verbs // Get list of alt-interact verbs
var verbs = _verbSystem.GetLocalVerbs(target, user, VerbType.Alternative)[VerbType.Alternative]; var verbs = _verbSystem.GetLocalVerbs(target, user, VerbType.Alternative)[VerbType.Alternative];
@@ -547,7 +547,7 @@ namespace Content.Shared.Interaction
/// Calls Thrown on all components that implement the IThrown interface /// Calls Thrown on all components that implement the IThrown interface
/// on an entity that has been thrown. /// on an entity that has been thrown.
/// </summary> /// </summary>
public void ThrownInteraction(IEntity user, IEntity thrown) public void ThrownInteraction(EntityUid user, EntityUid thrown)
{ {
var throwMsg = new ThrownEvent(user, thrown); var throwMsg = new ThrownEvent(user, thrown);
RaiseLocalEvent(thrown, throwMsg); RaiseLocalEvent(thrown, throwMsg);
@@ -574,7 +574,7 @@ namespace Content.Shared.Interaction
/// Calls Equipped on all components that implement the IEquipped interface /// Calls Equipped on all components that implement the IEquipped interface
/// on an entity that has been equipped. /// on an entity that has been equipped.
/// </summary> /// </summary>
public void EquippedInteraction(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot) public void EquippedInteraction(EntityUid user, EntityUid equipped, EquipmentSlotDefines.Slots slot)
{ {
var equipMsg = new EquippedEvent(user, equipped, slot); var equipMsg = new EquippedEvent(user, equipped, slot);
RaiseLocalEvent(equipped, equipMsg); RaiseLocalEvent(equipped, equipMsg);
@@ -594,7 +594,7 @@ namespace Content.Shared.Interaction
/// Calls Unequipped on all components that implement the IUnequipped interface /// Calls Unequipped on all components that implement the IUnequipped interface
/// on an entity that has been equipped. /// on an entity that has been equipped.
/// </summary> /// </summary>
public void UnequippedInteraction(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot) public void UnequippedInteraction(EntityUid user, EntityUid equipped, EquipmentSlotDefines.Slots slot)
{ {
var unequipMsg = new UnequippedEvent(user, equipped, slot); var unequipMsg = new UnequippedEvent(user, equipped, slot);
RaiseLocalEvent(equipped, unequipMsg); RaiseLocalEvent(equipped, unequipMsg);
@@ -615,7 +615,7 @@ namespace Content.Shared.Interaction
/// Calls EquippedHand on all components that implement the IEquippedHand interface /// Calls EquippedHand on all components that implement the IEquippedHand interface
/// on an item. /// on an item.
/// </summary> /// </summary>
public void EquippedHandInteraction(IEntity user, IEntity item, HandState hand) public void EquippedHandInteraction(EntityUid user, EntityUid item, HandState hand)
{ {
var equippedHandMessage = new EquippedHandEvent(user, item, hand); var equippedHandMessage = new EquippedHandEvent(user, item, hand);
RaiseLocalEvent(item, equippedHandMessage); RaiseLocalEvent(item, equippedHandMessage);
@@ -634,7 +634,7 @@ namespace Content.Shared.Interaction
/// Calls UnequippedHand on all components that implement the IUnequippedHand interface /// Calls UnequippedHand on all components that implement the IUnequippedHand interface
/// on an item. /// on an item.
/// </summary> /// </summary>
public void UnequippedHandInteraction(IEntity user, IEntity item, HandState hand) public void UnequippedHandInteraction(EntityUid user, EntityUid item, HandState hand)
{ {
var unequippedHandMessage = new UnequippedHandEvent(user, item, hand); var unequippedHandMessage = new UnequippedHandEvent(user, item, hand);
RaiseLocalEvent(item, unequippedHandMessage); RaiseLocalEvent(item, unequippedHandMessage);
@@ -656,7 +656,7 @@ namespace Content.Shared.Interaction
/// Activates the Dropped behavior of an object /// Activates the Dropped behavior of an object
/// Verifies that the user is capable of doing the drop interaction first /// Verifies that the user is capable of doing the drop interaction first
/// </summary> /// </summary>
public bool TryDroppedInteraction(IEntity user, IEntity item) public bool TryDroppedInteraction(EntityUid user, EntityUid item)
{ {
if (user == null || item == null || !_actionBlockerSystem.CanDrop(user)) return false; if (user == null || item == null || !_actionBlockerSystem.CanDrop(user)) return false;
@@ -668,7 +668,7 @@ namespace Content.Shared.Interaction
/// Calls Dropped on all components that implement the IDropped interface /// Calls Dropped on all components that implement the IDropped interface
/// on an entity that has been dropped. /// on an entity that has been dropped.
/// </summary> /// </summary>
public void DroppedInteraction(IEntity user, IEntity item) public void DroppedInteraction(EntityUid user, EntityUid item)
{ {
var dropMsg = new DroppedEvent(user, item); var dropMsg = new DroppedEvent(user, item);
RaiseLocalEvent(item, dropMsg); RaiseLocalEvent(item, dropMsg);
@@ -696,7 +696,7 @@ namespace Content.Shared.Interaction
/// Calls HandSelected on all components that implement the IHandSelected interface /// Calls HandSelected on all components that implement the IHandSelected interface
/// on an item entity on a hand that has just been selected. /// on an item entity on a hand that has just been selected.
/// </summary> /// </summary>
public void HandSelectedInteraction(IEntity user, IEntity item) public void HandSelectedInteraction(EntityUid user, EntityUid item)
{ {
var handSelectedMsg = new HandSelectedEvent(user, item); var handSelectedMsg = new HandSelectedEvent(user, item);
RaiseLocalEvent(item, handSelectedMsg); RaiseLocalEvent(item, handSelectedMsg);
@@ -716,7 +716,7 @@ namespace Content.Shared.Interaction
/// Calls HandDeselected on all components that implement the IHandDeselected interface /// Calls HandDeselected on all components that implement the IHandDeselected interface
/// on an item entity on a hand that has just been deselected. /// on an item entity on a hand that has just been deselected.
/// </summary> /// </summary>
public void HandDeselectedInteraction(IEntity user, IEntity item) public void HandDeselectedInteraction(EntityUid user, EntityUid item)
{ {
var handDeselectedMsg = new HandDeselectedEvent(user, item); var handDeselectedMsg = new HandDeselectedEvent(user, item);
RaiseLocalEvent(item, handDeselectedMsg); RaiseLocalEvent(item, handDeselectedMsg);

View File

@@ -23,9 +23,9 @@ namespace Content.Shared.Inventory
public abstract class UserEventArgs : EventArgs public abstract class UserEventArgs : EventArgs
{ {
public IEntity User { get; } public EntityUid User { get; }
protected UserEventArgs(IEntity user) protected UserEventArgs(EntityUid user)
{ {
User = user; User = user;
} }
@@ -33,7 +33,7 @@ namespace Content.Shared.Inventory
public class EquippedEventArgs : UserEventArgs public class EquippedEventArgs : UserEventArgs
{ {
public EquippedEventArgs(IEntity user, EquipmentSlotDefines.Slots slot) : base(user) public EquippedEventArgs(EntityUid user, EquipmentSlotDefines.Slots slot) : base(user)
{ {
Slot = slot; Slot = slot;
} }
@@ -50,19 +50,19 @@ namespace Content.Shared.Inventory
/// <summary> /// <summary>
/// Entity that equipped the item. /// Entity that equipped the item.
/// </summary> /// </summary>
public IEntity User { get; } public EntityUid User { get; }
/// <summary> /// <summary>
/// Item that was equipped. /// Item that was equipped.
/// </summary> /// </summary>
public IEntity Equipped { get; } public EntityUid Equipped { get; }
/// <summary> /// <summary>
/// Slot that the item was placed into. /// Slot that the item was placed into.
/// </summary> /// </summary>
public EquipmentSlotDefines.Slots Slot { get; } public EquipmentSlotDefines.Slots Slot { get; }
public EquippedEvent(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot) public EquippedEvent(EntityUid user, EntityUid equipped, EquipmentSlotDefines.Slots slot)
{ {
User = user; User = user;
Equipped = equipped; Equipped = equipped;

View File

@@ -23,7 +23,7 @@ namespace Content.Shared.Inventory
public class UnequippedEventArgs : UserEventArgs public class UnequippedEventArgs : UserEventArgs
{ {
public UnequippedEventArgs(IEntity user, EquipmentSlotDefines.Slots slot) : base(user) public UnequippedEventArgs(EntityUid user, EquipmentSlotDefines.Slots slot) : base(user)
{ {
Slot = slot; Slot = slot;
} }
@@ -40,19 +40,19 @@ namespace Content.Shared.Inventory
/// <summary> /// <summary>
/// Entity that equipped the item. /// Entity that equipped the item.
/// </summary> /// </summary>
public IEntity User { get; } public EntityUid User { get; }
/// <summary> /// <summary>
/// Item that was unequipped. /// Item that was unequipped.
/// </summary> /// </summary>
public IEntity Unequipped { get; } public EntityUid Unequipped { get; }
/// <summary> /// <summary>
/// Slot that the item was removed from. /// Slot that the item was removed from.
/// </summary> /// </summary>
public EquipmentSlotDefines.Slots Slot { get; } public EquipmentSlotDefines.Slots Slot { get; }
public UnequippedEvent(IEntity user, IEntity unequipped, EquipmentSlotDefines.Slots slot) public UnequippedEvent(EntityUid user, EntityUid unequipped, EquipmentSlotDefines.Slots slot)
{ {
User = user; User = user;
Unequipped = unequipped; Unequipped = unequipped;

View File

@@ -17,12 +17,12 @@ namespace Content.Shared.Throwing
public class ThrownEventArgs : EventArgs public class ThrownEventArgs : EventArgs
{ {
public ThrownEventArgs(IEntity user) public ThrownEventArgs(EntityUid user)
{ {
User = user; User = user;
} }
public IEntity User { get; } public EntityUid User { get; }
} }
/// <summary> /// <summary>
@@ -34,14 +34,14 @@ namespace Content.Shared.Throwing
/// <summary> /// <summary>
/// Entity that threw the item. /// Entity that threw the item.
/// </summary> /// </summary>
public IEntity User { get; } public EntityUid User { get; }
/// <summary> /// <summary>
/// Item that was thrown. /// Item that was thrown.
/// </summary> /// </summary>
public IEntity Thrown { get; } public EntityUid Thrown { get; }
public ThrownEvent(IEntity user, IEntity thrown) public ThrownEvent(EntityUid user, EntityUid thrown)
{ {
User = user; User = user;
Thrown = thrown; Thrown = thrown;

View File

@@ -20,7 +20,7 @@ namespace Content.Shared.Verbs
/// Raises a number of events in order to get all verbs of the given type(s) defined in local systems. This /// Raises a number of events in order to get all verbs of the given type(s) defined in local systems. This
/// does not request verbs from the server. /// does not request verbs from the server.
/// </summary> /// </summary>
public virtual Dictionary<VerbType, SortedSet<Verb>> GetLocalVerbs(IEntity target, IEntity user, VerbType verbTypes, bool force = false) public virtual Dictionary<VerbType, SortedSet<Verb>> GetLocalVerbs(EntityUid target, EntityUid user, VerbType verbTypes, bool force = false)
{ {
Dictionary<VerbType, SortedSet<Verb>> verbs = new(); Dictionary<VerbType, SortedSet<Verb>> verbs = new();
@@ -41,17 +41,17 @@ namespace Content.Shared.Verbs
// call ActionBlocker checks, just cache it for the verb request. // call ActionBlocker checks, just cache it for the verb request.
var canInteract = force || _actionBlockerSystem.CanInteract(user); var canInteract = force || _actionBlockerSystem.CanInteract(user);
IEntity? @using = null; EntityUid? @using = null;
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out SharedHandsComponent? hands) && (force || _actionBlockerSystem.CanUse(user))) if (EntityManager.TryGetComponent(user, out SharedHandsComponent? hands) && (force || _actionBlockerSystem.CanUse(user)))
{ {
hands.TryGetActiveHeldEntity(out @using); hands.TryGetActiveHeldEntity(out @using);
// Check whether the "Held" entity is a virtual pull entity. If yes, set that as the entity being "Used". // Check whether the "Held" entity is a virtual pull entity. If yes, set that as the entity being "Used".
// This allows you to do things like buckle a dragged person onto a surgery table, without click-dragging // This allows you to do things like buckle a dragged person onto a surgery table, without click-dragging
// their sprite. // their sprite.
if (@using != null && IoCManager.Resolve<IEntityManager>().TryGetComponent<HandVirtualItemComponent?>(@using, out var pull)) if (@using != null && EntityManager.TryGetComponent<HandVirtualItemComponent?>(@using.Value, out var pull))
{ {
@using = IoCManager.Resolve<IEntityManager>().GetEntity(pull.BlockingEntity); @using = EntityManager.GetEntity(pull.BlockingEntity);
} }
} }
@@ -127,7 +127,7 @@ namespace Content.Shared.Verbs
!EntityManager.TryGetEntity(targetUid, out var target)) !EntityManager.TryGetEntity(targetUid, out var target))
return; return;
IEntity? used = null; EntityUid? used = null;
if (usedUid != null) if (usedUid != null)
EntityManager.TryGetEntity(usedUid.Value, out used); EntityManager.TryGetEntity(usedUid.Value, out used);

View File

@@ -81,7 +81,7 @@ namespace Content.Shared.Verbs
/// </remarks> /// </remarks>
public class GetInteractionVerbsEvent : GetVerbsEvent public class GetInteractionVerbsEvent : GetVerbsEvent
{ {
public GetInteractionVerbsEvent(IEntity user, IEntity target, IEntity? @using, SharedHandsComponent? hands, public GetInteractionVerbsEvent(EntityUid user, EntityUid target, EntityUid? @using, SharedHandsComponent? hands,
bool canInteract, bool canAccess) : base(user, target, @using, hands, canInteract, canAccess) { } bool canInteract, bool canAccess) : base(user, target, @using, hands, canInteract, canAccess) { }
} }
@@ -97,7 +97,7 @@ namespace Content.Shared.Verbs
/// </remarks> /// </remarks>
public class GetActivationVerbsEvent : GetVerbsEvent public class GetActivationVerbsEvent : GetVerbsEvent
{ {
public GetActivationVerbsEvent(IEntity user, IEntity target, IEntity? @using, SharedHandsComponent? hands, public GetActivationVerbsEvent(EntityUid user, EntityUid target, EntityUid? @using, SharedHandsComponent? hands,
bool canInteract, bool canAccess) : base(user, target, @using, hands, canInteract, canAccess) { } bool canInteract, bool canAccess) : base(user, target, @using, hands, canInteract, canAccess) { }
} }
@@ -110,7 +110,7 @@ namespace Content.Shared.Verbs
/// </remarks> /// </remarks>
public class GetAlternativeVerbsEvent : GetVerbsEvent public class GetAlternativeVerbsEvent : GetVerbsEvent
{ {
public GetAlternativeVerbsEvent(IEntity user, IEntity target, IEntity? @using, SharedHandsComponent? hands, public GetAlternativeVerbsEvent(EntityUid user, EntityUid target, EntityUid? @using, SharedHandsComponent? hands,
bool canInteract, bool canAccess) : base(user, target, @using, hands, canInteract, canAccess) { } bool canInteract, bool canAccess) : base(user, target, @using, hands, canInteract, canAccess) { }
} }
@@ -123,7 +123,7 @@ namespace Content.Shared.Verbs
/// </remarks> /// </remarks>
public class GetOtherVerbsEvent : GetVerbsEvent public class GetOtherVerbsEvent : GetVerbsEvent
{ {
public GetOtherVerbsEvent(IEntity user, IEntity target, IEntity? @using, SharedHandsComponent? hands, public GetOtherVerbsEvent(EntityUid user, EntityUid target, EntityUid? @using, SharedHandsComponent? hands,
bool canInteract, bool canAccess) : base(user, target, @using, hands, canInteract, canAccess) { } bool canInteract, bool canAccess) : base(user, target, @using, hands, canInteract, canAccess) { }
} }
@@ -149,12 +149,12 @@ namespace Content.Shared.Verbs
/// <summary> /// <summary>
/// The entity being targeted for the verb. /// The entity being targeted for the verb.
/// </summary> /// </summary>
public readonly IEntity Target; public readonly EntityUid Target;
/// <summary> /// <summary>
/// The entity that will be "performing" the verb. /// The entity that will be "performing" the verb.
/// </summary> /// </summary>
public readonly IEntity User; public readonly EntityUid User;
/// <summary> /// <summary>
/// Can the user physically interact? /// Can the user physically interact?
@@ -181,14 +181,9 @@ namespace Content.Shared.Verbs
/// This is only ever not null when <see cref="ActionBlockerSystem.CanUse(Robust.Shared.GameObjects.EntityUid)"/> is true and the user /// This is only ever not null when <see cref="ActionBlockerSystem.CanUse(Robust.Shared.GameObjects.EntityUid)"/> is true and the user
/// has hands. /// has hands.
/// </remarks> /// </remarks>
public readonly IEntity? Using; public readonly EntityUid? Using;
// for eventual removal of IEntity. public GetVerbsEvent(EntityUid user, EntityUid target, EntityUid? @using, SharedHandsComponent? hands, bool canInteract, bool canAccess)
public EntityUid UserUid => User;
public EntityUid TargetUid => Target;
public EntityUid? UsingUid => Using;
public GetVerbsEvent(IEntity user, IEntity target, IEntity? @using, SharedHandsComponent? hands, bool canInteract, bool canAccess)
{ {
User = user; User = user;
Target = target; Target = target;