Fix a lot more errors.
This commit is contained in:
@@ -200,7 +200,7 @@ namespace Content.Server.GameTicking
|
||||
}
|
||||
|
||||
#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 entity = EntityManager.SpawnEntity(PlayerPrototypeName, coordinates);
|
||||
@@ -213,14 +213,14 @@ namespace Content.Server.GameTicking
|
||||
|
||||
if (profile != null)
|
||||
{
|
||||
EntitySystem.Get<SharedHumanoidAppearanceSystem>().UpdateFromProfile(entity, profile);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName = profile.Name;
|
||||
_humanoidAppearanceSystem.UpdateFromProfile(entity, profile);
|
||||
EntityManager.GetComponent<MetaDataComponent>(entity).EntityName = profile.Name;
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
private IEntity SpawnObserverMob()
|
||||
private EntityUid SpawnObserverMob()
|
||||
{
|
||||
var coordinates = GetObserverSpawnPoint();
|
||||
return EntityManager.SpawnEntity(ObserverPrototypeName, coordinates);
|
||||
@@ -228,7 +228,7 @@ namespace Content.Server.GameTicking
|
||||
#endregion
|
||||
|
||||
#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))
|
||||
{
|
||||
@@ -238,25 +238,25 @@ namespace Content.Server.GameTicking
|
||||
if (!string.IsNullOrEmpty(equipmentStr))
|
||||
{
|
||||
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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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 accessTags = access.Tags;
|
||||
accessTags.UnionWith(jobPrototype.Access);
|
||||
EntityManager.EntitySysManager.GetEntitySystem<PDASystem>()
|
||||
.SetOwner(pdaComponent, characterName);
|
||||
_pdaSystem.SetOwner(pdaComponent, characterName);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.CharacterAppearance.Systems;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.Maps;
|
||||
using Content.Server.PDA;
|
||||
using Content.Server.Preferences.Managers;
|
||||
using Content.Server.Roles;
|
||||
using Content.Server.Station;
|
||||
@@ -91,5 +93,7 @@ namespace Content.Server.GameTicking
|
||||
[Dependency] private readonly IGameMapManager _gameMapManager = default!;
|
||||
[Dependency] private readonly StationSystem _stationSystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!;
|
||||
[Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearanceSystem = default!;
|
||||
[Dependency] private readonly PDASystem _pdaSystem = default!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,9 @@ namespace Content.Shared.Hands.Components
|
||||
|
||||
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;
|
||||
|
||||
var hands = new List<HandVisualState>();
|
||||
@@ -111,7 +113,7 @@ namespace Content.Shared.Hands.Components
|
||||
if (hand.HeldEntity == null)
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public bool TryGetHeldEntity(string handName, [NotNullWhen(true)] out IEntity? heldEntity)
|
||||
public bool TryGetHeldEntity(string handName, [NotNullWhen(true)] out EntityUid? heldEntity)
|
||||
{
|
||||
heldEntity = null;
|
||||
|
||||
@@ -228,13 +230,13 @@ namespace Content.Shared.Hands.Components
|
||||
return heldEntity != null;
|
||||
}
|
||||
|
||||
public bool TryGetActiveHeldEntity([NotNullWhen(true)] out IEntity? heldEntity)
|
||||
public bool TryGetActiveHeldEntity([NotNullWhen(true)] out EntityUid? heldEntity)
|
||||
{
|
||||
heldEntity = GetActiveHand()?.HeldEntity;
|
||||
return heldEntity != null;
|
||||
}
|
||||
|
||||
public bool IsHolding(IEntity entity)
|
||||
public bool IsHolding(EntityUid entity)
|
||||
{
|
||||
foreach (var hand in Hands)
|
||||
{
|
||||
@@ -244,12 +246,12 @@ namespace Content.Shared.Hands.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
public IEnumerable<IEntity> GetAllHeldEntities()
|
||||
public IEnumerable<EntityUid> GetAllHeldEntities()
|
||||
{
|
||||
foreach (var hand in Hands)
|
||||
{
|
||||
if (hand.HeldEntity != null)
|
||||
yield return hand.HeldEntity;
|
||||
yield return hand.HeldEntity.Value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +271,7 @@ namespace Content.Shared.Hands.Components
|
||||
return acc;
|
||||
}
|
||||
|
||||
public bool TryGetHandHoldingEntity(IEntity entity, [NotNullWhen(true)] out Hand? handFound)
|
||||
public bool TryGetHandHoldingEntity(EntityUid entity, [NotNullWhen(true)] out Hand? handFound)
|
||||
{
|
||||
handFound = null;
|
||||
|
||||
@@ -330,7 +332,7 @@ namespace Content.Shared.Hands.Components
|
||||
/// <summary>
|
||||
/// Tries to drop a held entity to the target location.
|
||||
/// </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))
|
||||
return false;
|
||||
@@ -356,7 +358,7 @@ namespace Content.Shared.Hands.Components
|
||||
/// <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.
|
||||
/// </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))
|
||||
return false;
|
||||
@@ -382,7 +384,7 @@ namespace Content.Shared.Hands.Components
|
||||
/// <summary>
|
||||
/// Tries to drop a held entity directly under the player.
|
||||
/// </summary>
|
||||
public bool Drop(IEntity entity, bool checkActionBlocker = true)
|
||||
public bool Drop(EntityUid entity, bool checkActionBlocker = true)
|
||||
{
|
||||
if (!TryGetHandHoldingEntity(entity, out var hand))
|
||||
return false;
|
||||
@@ -412,11 +414,11 @@ namespace Content.Shared.Hands.Components
|
||||
/// </summary>
|
||||
private bool CanRemoveHeldEntityFromHand(Hand hand)
|
||||
{
|
||||
var heldEntity = hand.HeldEntity;
|
||||
|
||||
if (heldEntity == null)
|
||||
if (hand.HeldEntity == null)
|
||||
return false;
|
||||
|
||||
var heldEntity = hand.HeldEntity.Value;
|
||||
|
||||
var handContainer = hand.Container;
|
||||
if (handContainer == null)
|
||||
return false;
|
||||
@@ -443,11 +445,11 @@ namespace Content.Shared.Hands.Components
|
||||
/// </summary>
|
||||
private void RemoveHeldEntityFromHand(Hand hand)
|
||||
{
|
||||
var heldEntity = hand.HeldEntity;
|
||||
|
||||
if (heldEntity == null)
|
||||
if (hand.HeldEntity == null)
|
||||
return;
|
||||
|
||||
var heldEntity = hand.HeldEntity.Value;
|
||||
|
||||
var handContainer = hand.Container;
|
||||
if (handContainer == null)
|
||||
return;
|
||||
@@ -471,11 +473,11 @@ namespace Content.Shared.Hands.Components
|
||||
/// </summary>
|
||||
public void DropHeldEntity(Hand hand, EntityCoordinates targetDropLocation)
|
||||
{
|
||||
var heldEntity = hand.HeldEntity;
|
||||
|
||||
if (heldEntity == null)
|
||||
if (hand.HeldEntity == null)
|
||||
return;
|
||||
|
||||
var heldEntity = hand.HeldEntity.Value;
|
||||
|
||||
RemoveHeldEntityFromHand(hand);
|
||||
|
||||
EntitySystem.Get<SharedInteractionSystem>().DroppedInteraction(Owner, heldEntity);
|
||||
@@ -534,11 +536,11 @@ namespace Content.Shared.Hands.Components
|
||||
|
||||
private bool CanPutHeldEntityIntoContainer(Hand hand, IContainer targetContainer, bool checkActionBlocker)
|
||||
{
|
||||
var heldEntity = hand.HeldEntity;
|
||||
|
||||
if (heldEntity == null)
|
||||
if (hand.HeldEntity == null)
|
||||
return false;
|
||||
|
||||
var heldEntity = hand.HeldEntity.Value;
|
||||
|
||||
if (checkActionBlocker && !PlayerCanDrop())
|
||||
return false;
|
||||
|
||||
@@ -553,11 +555,11 @@ namespace Content.Shared.Hands.Components
|
||||
/// </summary>
|
||||
private void PutHeldEntityIntoContainer(Hand hand, IContainer targetContainer)
|
||||
{
|
||||
var heldEntity = hand.HeldEntity;
|
||||
|
||||
if (heldEntity == null)
|
||||
if (hand.HeldEntity == null)
|
||||
return;
|
||||
|
||||
var heldEntity = hand.HeldEntity.Value;
|
||||
|
||||
RemoveHeldEntityFromHand(hand);
|
||||
|
||||
if (!targetContainer.Insert(heldEntity))
|
||||
@@ -571,7 +573,7 @@ namespace Content.Shared.Hands.Components
|
||||
|
||||
#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))
|
||||
return false;
|
||||
@@ -585,7 +587,7 @@ namespace Content.Shared.Hands.Components
|
||||
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);
|
||||
}
|
||||
@@ -593,7 +595,7 @@ namespace Content.Shared.Hands.Components
|
||||
/// <summary>
|
||||
/// Tries to pick up an entity to a specific hand.
|
||||
/// </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))
|
||||
return false;
|
||||
@@ -601,7 +603,7 @@ namespace Content.Shared.Hands.Components
|
||||
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);
|
||||
}
|
||||
@@ -609,7 +611,7 @@ namespace Content.Shared.Hands.Components
|
||||
/// <summary>
|
||||
/// Checks if an entity can be put into a hand's container.
|
||||
/// </summary>
|
||||
protected bool CanInsertEntityIntoHand(Hand hand, IEntity entity)
|
||||
protected bool CanInsertEntityIntoHand(Hand hand, EntityUid entity)
|
||||
{
|
||||
var handContainer = hand.Container;
|
||||
if (handContainer == null)
|
||||
@@ -636,7 +638,7 @@ namespace Content.Shared.Hands.Components
|
||||
/// <summary>
|
||||
/// Puts an entity into the player's hand, assumes that the insertion is allowed.
|
||||
/// </summary>
|
||||
public void PutEntityIntoHand(Hand hand, IEntity entity)
|
||||
public void PutEntityIntoHand(Hand hand, EntityUid entity)
|
||||
{
|
||||
var handContainer = hand.Container;
|
||||
if (handContainer == null)
|
||||
@@ -660,7 +662,7 @@ namespace Content.Shared.Hands.Components
|
||||
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))
|
||||
return false;
|
||||
@@ -712,7 +714,7 @@ namespace Content.Shared.Hands.Components
|
||||
return;
|
||||
|
||||
await EntitySystem.Get<SharedInteractionSystem>()
|
||||
.InteractUsing(Owner, activeHeldEntity, heldEntity, EntityCoordinates.Invalid);
|
||||
.InteractUsing(Owner, activeHeldEntity.Value, heldEntity.Value, EntityCoordinates.Invalid);
|
||||
}
|
||||
|
||||
public void ActivateItem(bool altInteract = false)
|
||||
@@ -721,7 +723,7 @@ namespace Content.Shared.Hands.Components
|
||||
return;
|
||||
|
||||
EntitySystem.Get<SharedInteractionSystem>()
|
||||
.TryUseInteraction(Owner, heldEntity, altInteract);
|
||||
.TryUseInteraction(Owner, heldEntity.Value, altInteract);
|
||||
}
|
||||
|
||||
public void ActivateHeldEntity(string handName)
|
||||
@@ -744,14 +746,14 @@ namespace Content.Shared.Hands.Components
|
||||
if (!TryGetHeldEntity(handName, out var heldEntity))
|
||||
return false;
|
||||
|
||||
if (!CanInsertEntityIntoHand(activeHand, heldEntity) || !CanRemoveHeldEntityFromHand(hand))
|
||||
if (!CanInsertEntityIntoHand(activeHand, heldEntity.Value) || !CanRemoveHeldEntityFromHand(hand))
|
||||
return false;
|
||||
|
||||
if (checkActionBlocker && (!PlayerCanDrop() || !PlayerCanPickup()))
|
||||
return false;
|
||||
|
||||
RemoveHeldEntityFromHand(hand);
|
||||
PutEntityIntoHand(activeHand, heldEntity);
|
||||
PutEntityIntoHand(activeHand, heldEntity.Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -760,13 +762,13 @@ namespace Content.Shared.Hands.Components
|
||||
private void DeselectActiveHeldEntity()
|
||||
{
|
||||
if (TryGetActiveHeldEntity(out var entity))
|
||||
EntitySystem.Get<SharedInteractionSystem>().HandDeselectedInteraction(Owner, entity);
|
||||
EntitySystem.Get<SharedInteractionSystem>().HandDeselectedInteraction(Owner, entity.Value);
|
||||
}
|
||||
|
||||
private void SelectActiveHeldEntity()
|
||||
{
|
||||
if (TryGetActiveHeldEntity(out var entity))
|
||||
EntitySystem.Get<SharedInteractionSystem>().HandSelectedInteraction(Owner, entity);
|
||||
EntitySystem.Get<SharedInteractionSystem>().HandSelectedInteraction(Owner, entity.Value);
|
||||
}
|
||||
|
||||
private void HandCountChanged()
|
||||
@@ -796,7 +798,7 @@ namespace Content.Shared.Hands.Components
|
||||
/// <summary>
|
||||
/// Tries to pick up an entity into the active hand. If it cannot, tries to pick up the entity into each other hand.
|
||||
/// </summary>
|
||||
public bool TryPutInActiveHandOrAny(IEntity entity, bool checkActionBlocker = true)
|
||||
public bool TryPutInActiveHandOrAny(EntityUid entity, bool checkActionBlocker = true)
|
||||
{
|
||||
return TryPutInAnyHand(entity, GetActiveHand(), checkActionBlocker);
|
||||
}
|
||||
@@ -804,7 +806,7 @@ namespace Content.Shared.Hands.Components
|
||||
/// <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.
|
||||
/// </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;
|
||||
|
||||
@@ -817,7 +819,7 @@ namespace Content.Shared.Hands.Components
|
||||
/// <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.
|
||||
/// </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)
|
||||
{
|
||||
@@ -833,9 +835,9 @@ namespace Content.Shared.Hands.Components
|
||||
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
|
||||
@@ -890,7 +892,7 @@ namespace Content.Shared.Hands.Components
|
||||
public IContainer? Container { get; set; }
|
||||
|
||||
[ViewVariables]
|
||||
public IEntity? HeldEntity => Container?.ContainedEntities?.FirstOrDefault();
|
||||
public EntityUid? HeldEntity => Container?.ContainedEntities?.FirstOrDefault();
|
||||
|
||||
public bool IsEmpty => HeldEntity == null;
|
||||
|
||||
@@ -995,12 +997,12 @@ namespace Content.Shared.Hands.Components
|
||||
|
||||
public class HandCountChangedEvent : EntityEventArgs
|
||||
{
|
||||
public HandCountChangedEvent(IEntity sender)
|
||||
public HandCountChangedEvent(EntityUid sender)
|
||||
{
|
||||
Sender = sender;
|
||||
}
|
||||
|
||||
public IEntity Sender { get; }
|
||||
public EntityUid Sender { get; }
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Content.Shared.Hands
|
||||
|
||||
public class EquippedHandEventArgs : UserEventArgs
|
||||
{
|
||||
public EquippedHandEventArgs(IEntity user, HandState hand) : base(user)
|
||||
public EquippedHandEventArgs(EntityUid user, HandState hand) : base(user)
|
||||
{
|
||||
Hand = hand;
|
||||
}
|
||||
@@ -39,19 +39,19 @@ namespace Content.Shared.Hands
|
||||
/// <summary>
|
||||
/// Entity that equipped the item.
|
||||
/// </summary>
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Item that was equipped.
|
||||
/// </summary>
|
||||
public IEntity Equipped { get; }
|
||||
public EntityUid Equipped { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Hand that the item was placed into.
|
||||
/// </summary>
|
||||
public HandState Hand { get; }
|
||||
|
||||
public EquippedHandEvent(IEntity user, IEntity equipped, HandState hand)
|
||||
public EquippedHandEvent(EntityUid user, EntityUid equipped, HandState hand)
|
||||
{
|
||||
User = user;
|
||||
Equipped = equipped;
|
||||
|
||||
@@ -17,12 +17,12 @@ namespace Content.Shared.Hands
|
||||
|
||||
public class HandDeselectedEventArgs : EventArgs
|
||||
{
|
||||
public HandDeselectedEventArgs(IEntity user)
|
||||
public HandDeselectedEventArgs(EntityUid user)
|
||||
{
|
||||
User = user;
|
||||
}
|
||||
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -34,14 +34,14 @@ namespace Content.Shared.Hands
|
||||
/// <summary>
|
||||
/// Entity that owns the deselected hand.
|
||||
/// </summary>
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Item in the hand that was deselected.
|
||||
/// </summary>
|
||||
public IEntity Item { get; }
|
||||
public EntityUid Item { get; }
|
||||
|
||||
public HandDeselectedEvent(IEntity user, IEntity item)
|
||||
public HandDeselectedEvent(EntityUid user, EntityUid item)
|
||||
{
|
||||
User = user;
|
||||
Item = item;
|
||||
|
||||
@@ -17,12 +17,12 @@ namespace Content.Shared.Hands
|
||||
|
||||
public class HandSelectedEventArgs : EventArgs
|
||||
{
|
||||
public HandSelectedEventArgs(IEntity user)
|
||||
public HandSelectedEventArgs(EntityUid user)
|
||||
{
|
||||
User = user;
|
||||
}
|
||||
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -34,14 +34,14 @@ namespace Content.Shared.Hands
|
||||
/// <summary>
|
||||
/// Entity that owns the selected hand.
|
||||
/// </summary>
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Item in the hand that was selected.
|
||||
/// </summary>
|
||||
public IEntity Item { get; }
|
||||
public EntityUid Item { get; }
|
||||
|
||||
public HandSelectedEvent(IEntity user, IEntity item)
|
||||
public HandSelectedEvent(EntityUid user, EntityUid item)
|
||||
{
|
||||
User = user;
|
||||
Item = item;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Content.Shared.Hands
|
||||
|
||||
public class UnequippedHandEventArgs : UserEventArgs
|
||||
{
|
||||
public UnequippedHandEventArgs(IEntity user, HandState hand) : base(user)
|
||||
public UnequippedHandEventArgs(EntityUid user, HandState hand) : base(user)
|
||||
{
|
||||
Hand = hand;
|
||||
}
|
||||
@@ -38,19 +38,19 @@ namespace Content.Shared.Hands
|
||||
/// <summary>
|
||||
/// Entity that equipped the item.
|
||||
/// </summary>
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Item that was unequipped.
|
||||
/// </summary>
|
||||
public IEntity Unequipped { get; }
|
||||
public EntityUid Unequipped { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Hand that the item is removed from.
|
||||
/// </summary>
|
||||
public HandState Hand { get; }
|
||||
|
||||
public UnequippedHandEvent(IEntity user, IEntity unequipped, HandState hand)
|
||||
public UnequippedHandEvent(EntityUid user, EntityUid unequipped, HandState hand)
|
||||
{
|
||||
User = user;
|
||||
Unequipped = unequipped;
|
||||
|
||||
@@ -13,32 +13,17 @@ namespace Content.Shared.Interaction
|
||||
/// <summary>
|
||||
/// Entity that triggered the interaction.
|
||||
/// </summary>
|
||||
public IEntity User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that triggered the interaction.
|
||||
/// </summary>
|
||||
public EntityUid UserUid => User;
|
||||
public EntityUid User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that the user used to interact.
|
||||
/// </summary>
|
||||
public IEntity Used { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that the user used to interact.
|
||||
/// </summary>
|
||||
public EntityUid UsedUid => Used;
|
||||
public EntityUid Used { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that was interacted on. This can be null if the attack did not click on an entity.
|
||||
/// </summary>
|
||||
public IEntity? 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;
|
||||
public EntityUid? Target { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Location that the user clicked outside of their interaction range.
|
||||
@@ -52,9 +37,9 @@ namespace Content.Shared.Interaction
|
||||
public bool CanReach { get; }
|
||||
|
||||
public BeforeInteractEvent(
|
||||
IEntity user,
|
||||
IEntity used,
|
||||
IEntity? target,
|
||||
EntityUid user,
|
||||
EntityUid used,
|
||||
EntityUid? target,
|
||||
EntityCoordinates clickLocation,
|
||||
bool canReach)
|
||||
{
|
||||
|
||||
@@ -24,14 +24,14 @@ namespace Content.Shared.Interaction
|
||||
|
||||
public class ActivateEventArgs : EventArgs, ITargetedInteractEventArgs
|
||||
{
|
||||
public ActivateEventArgs(IEntity user, IEntity target)
|
||||
public ActivateEventArgs(EntityUid user, EntityUid target)
|
||||
{
|
||||
User = user;
|
||||
Target = target;
|
||||
}
|
||||
|
||||
public IEntity User { get; }
|
||||
public IEntity Target { get; }
|
||||
public EntityUid User { get; }
|
||||
public EntityUid Target { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -43,24 +43,14 @@ namespace Content.Shared.Interaction
|
||||
/// <summary>
|
||||
/// Entity that activated the target world entity.
|
||||
/// </summary>
|
||||
public IEntity User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that activated the target world entity.
|
||||
/// </summary>
|
||||
public EntityUid UserUid => User;
|
||||
public EntityUid User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that was activated in the world.
|
||||
/// </summary>
|
||||
public IEntity Target { get; }
|
||||
public EntityUid Target { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that was activated in the world.
|
||||
/// </summary>
|
||||
public EntityUid TargetUid => Target;
|
||||
|
||||
public ActivateInWorldEvent(IEntity user, IEntity target)
|
||||
public ActivateInWorldEvent(EntityUid user, EntityUid target)
|
||||
{
|
||||
User = user;
|
||||
Target = target;
|
||||
|
||||
@@ -31,12 +31,12 @@ namespace Content.Shared.Interaction
|
||||
|
||||
public class AfterInteractEventArgs : EventArgs
|
||||
{
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
public EntityCoordinates ClickLocation { get; }
|
||||
public IEntity? Target { get; }
|
||||
public EntityUid? Target { 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;
|
||||
ClickLocation = clickLocation;
|
||||
@@ -54,32 +54,17 @@ namespace Content.Shared.Interaction
|
||||
/// <summary>
|
||||
/// Entity that triggered the interaction.
|
||||
/// </summary>
|
||||
public IEntity User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that triggered the interaction.
|
||||
/// </summary>
|
||||
public EntityUid UserUid => User;
|
||||
public EntityUid User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that the user used to interact.
|
||||
/// </summary>
|
||||
public IEntity Used { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that the user used to interact.
|
||||
/// </summary>
|
||||
public EntityUid UsedUid => Used;
|
||||
public EntityUid Used { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that was interacted on. This can be null if the attack did not click on an entity.
|
||||
/// </summary>
|
||||
public IEntity? 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;
|
||||
public EntityUid? Target { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Location that the user clicked outside of their interaction range.
|
||||
@@ -92,7 +77,7 @@ namespace Content.Shared.Interaction
|
||||
/// </summary>
|
||||
public bool CanReach { get; }
|
||||
|
||||
public AfterInteractEvent(IEntity user, IEntity used, IEntity? target,
|
||||
public AfterInteractEvent(EntityUid user, EntityUid used, EntityUid? target,
|
||||
EntityCoordinates clickLocation, bool canReach)
|
||||
{
|
||||
User = user;
|
||||
|
||||
@@ -17,12 +17,12 @@ namespace Content.Shared.Interaction
|
||||
|
||||
public class DroppedEventArgs : EventArgs
|
||||
{
|
||||
public DroppedEventArgs(IEntity user)
|
||||
public DroppedEventArgs(EntityUid user)
|
||||
{
|
||||
User = user;
|
||||
}
|
||||
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Content.Shared.Interaction
|
||||
|
||||
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;
|
||||
ClickLocation = clickLocation;
|
||||
@@ -38,10 +38,10 @@ namespace Content.Shared.Interaction
|
||||
Target = target;
|
||||
}
|
||||
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
public EntityCoordinates ClickLocation { get; }
|
||||
public IEntity Using { get; }
|
||||
public IEntity Target { get; }
|
||||
public EntityUid Using { get; }
|
||||
public EntityUid Target { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -53,39 +53,24 @@ namespace Content.Shared.Interaction
|
||||
/// <summary>
|
||||
/// Entity that triggered the interaction.
|
||||
/// </summary>
|
||||
public IEntity User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that triggered the interaction.
|
||||
/// </summary>
|
||||
public EntityUid UserUid => User;
|
||||
public EntityUid User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that the user used to interact.
|
||||
/// </summary>
|
||||
public IEntity Used { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that the user used to interact.
|
||||
/// </summary>
|
||||
public EntityUid UsedUid => Used;
|
||||
public EntityUid Used { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that was interacted on.
|
||||
/// </summary>
|
||||
public IEntity Target { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity that was interacted on.
|
||||
/// </summary>
|
||||
public EntityUid TargetUid => Target;
|
||||
public EntityUid Target { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The original location that was clicked by the user.
|
||||
/// </summary>
|
||||
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;
|
||||
Used = used;
|
||||
|
||||
@@ -7,11 +7,11 @@ namespace Content.Shared.Interaction
|
||||
/// <summary>
|
||||
/// Performer of the attack
|
||||
/// </summary>
|
||||
IEntity User { get; }
|
||||
EntityUid User { get; }
|
||||
/// <summary>
|
||||
/// Target of the attack
|
||||
/// </summary>
|
||||
IEntity Target { get; }
|
||||
EntityUid Target { get; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,12 @@ namespace Content.Shared.Interaction
|
||||
|
||||
public class UseEntityEventArgs : EventArgs
|
||||
{
|
||||
public UseEntityEventArgs(IEntity user)
|
||||
public UseEntityEventArgs(EntityUid user)
|
||||
{
|
||||
User = user;
|
||||
}
|
||||
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -39,24 +39,14 @@ namespace Content.Shared.Interaction
|
||||
/// <summary>
|
||||
/// Entity holding the item in their hand.
|
||||
/// </summary>
|
||||
public IEntity User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Entity holding the item in their hand.
|
||||
/// </summary>
|
||||
public EntityUid UserUid => User;
|
||||
public EntityUid User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Item that was used.
|
||||
/// </summary>
|
||||
public IEntity Used { get; }
|
||||
public EntityUid Used { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Item that was used.
|
||||
/// </summary>
|
||||
public EntityUid UsedUid => Used;
|
||||
|
||||
public UseInHandEvent(IEntity user, IEntity used)
|
||||
public UseInHandEvent(EntityUid user, EntityUid used)
|
||||
{
|
||||
User = user;
|
||||
Used = used;
|
||||
|
||||
@@ -90,11 +90,11 @@ namespace Content.Shared.Interaction
|
||||
MapCoordinates origin,
|
||||
MapCoordinates other,
|
||||
int collisionMask = (int) CollisionGroup.Impassable,
|
||||
IEntity? ignoredEnt = null)
|
||||
EntityUid? ignoredEnt = null)
|
||||
{
|
||||
var predicate = ignoredEnt == null
|
||||
? null
|
||||
: (Ignored) (e => e == ignoredEnt?.Uid);
|
||||
: (Ignored) (e => e == ignoredEnt);
|
||||
|
||||
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.
|
||||
/// </returns>
|
||||
public bool InRangeUnobstructed(
|
||||
IEntity origin,
|
||||
IEntity other,
|
||||
EntityUid origin,
|
||||
EntityUid other,
|
||||
float range = InteractionRange,
|
||||
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
||||
Ignored? predicate = null,
|
||||
bool ignoreInsideBlocker = 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);
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ namespace Content.Shared.Interaction
|
||||
/// True if the two points are within a given range without being obstructed.
|
||||
/// </returns>
|
||||
public bool InRangeUnobstructed(
|
||||
IEntity origin,
|
||||
EntityUid origin,
|
||||
IComponent other,
|
||||
float range = InteractionRange,
|
||||
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.
|
||||
/// </returns>
|
||||
public bool InRangeUnobstructed(
|
||||
IEntity origin,
|
||||
EntityUid origin,
|
||||
EntityCoordinates other,
|
||||
float range = InteractionRange,
|
||||
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.
|
||||
/// </returns>
|
||||
public bool InRangeUnobstructed(
|
||||
IEntity origin,
|
||||
EntityUid origin,
|
||||
MapCoordinates other,
|
||||
float range = InteractionRange,
|
||||
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
||||
@@ -346,7 +346,7 @@ namespace Content.Shared.Interaction
|
||||
bool popup = false)
|
||||
{
|
||||
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);
|
||||
|
||||
@@ -360,9 +360,9 @@ namespace Content.Shared.Interaction
|
||||
}
|
||||
|
||||
public bool InteractDoBefore(
|
||||
IEntity user,
|
||||
IEntity used,
|
||||
IEntity? target,
|
||||
EntityUid user,
|
||||
EntityUid used,
|
||||
EntityUid? target,
|
||||
EntityCoordinates clickLocation,
|
||||
bool canReach)
|
||||
{
|
||||
@@ -376,7 +376,7 @@ namespace Content.Shared.Interaction
|
||||
/// Finds components with the InteractUsing interface and calls their function
|
||||
/// NOTE: Does not have an InRangeUnobstructed check
|
||||
/// </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))
|
||||
return;
|
||||
@@ -407,7 +407,7 @@ namespace Content.Shared.Interaction
|
||||
/// <summary>
|
||||
/// We didn't click on any entity, try doing an AfterInteract on the click location
|
||||
/// </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);
|
||||
RaiseLocalEvent(used, afterInteractEvent, false);
|
||||
@@ -431,15 +431,15 @@ namespace Content.Shared.Interaction
|
||||
/// Activates the IActivate behavior of an object
|
||||
/// Verifies that the user is capable of doing the use interaction first
|
||||
/// </summary>
|
||||
public void TryInteractionActivate(IEntity? user, IEntity? used)
|
||||
public void TryInteractionActivate(EntityUid? user, EntityUid? used)
|
||||
{
|
||||
if (user == null || used == null)
|
||||
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))
|
||||
{
|
||||
@@ -486,7 +486,7 @@ namespace Content.Shared.Interaction
|
||||
/// </summary>
|
||||
/// <param name="user"></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))
|
||||
{
|
||||
@@ -501,7 +501,7 @@ namespace Content.Shared.Interaction
|
||||
/// Activates the IUse behaviors of an entity without first checking
|
||||
/// if the user is capable of doing the use interaction.
|
||||
/// </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))
|
||||
{
|
||||
@@ -533,7 +533,7 @@ namespace Content.Shared.Interaction
|
||||
/// <remarks>
|
||||
/// Uses the context menu verb list, and acts out the highest priority alternative interaction verb.
|
||||
/// </remarks>
|
||||
public void AltInteract(IEntity user, IEntity target)
|
||||
public void AltInteract(EntityUid user, EntityUid target)
|
||||
{
|
||||
// Get list of alt-interact verbs
|
||||
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
|
||||
/// on an entity that has been thrown.
|
||||
/// </summary>
|
||||
public void ThrownInteraction(IEntity user, IEntity thrown)
|
||||
public void ThrownInteraction(EntityUid user, EntityUid thrown)
|
||||
{
|
||||
var throwMsg = new ThrownEvent(user, thrown);
|
||||
RaiseLocalEvent(thrown, throwMsg);
|
||||
@@ -574,7 +574,7 @@ namespace Content.Shared.Interaction
|
||||
/// Calls Equipped on all components that implement the IEquipped interface
|
||||
/// on an entity that has been equipped.
|
||||
/// </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);
|
||||
RaiseLocalEvent(equipped, equipMsg);
|
||||
@@ -594,7 +594,7 @@ namespace Content.Shared.Interaction
|
||||
/// Calls Unequipped on all components that implement the IUnequipped interface
|
||||
/// on an entity that has been equipped.
|
||||
/// </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);
|
||||
RaiseLocalEvent(equipped, unequipMsg);
|
||||
@@ -615,7 +615,7 @@ namespace Content.Shared.Interaction
|
||||
/// Calls EquippedHand on all components that implement the IEquippedHand interface
|
||||
/// on an item.
|
||||
/// </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);
|
||||
RaiseLocalEvent(item, equippedHandMessage);
|
||||
@@ -634,7 +634,7 @@ namespace Content.Shared.Interaction
|
||||
/// Calls UnequippedHand on all components that implement the IUnequippedHand interface
|
||||
/// on an item.
|
||||
/// </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);
|
||||
RaiseLocalEvent(item, unequippedHandMessage);
|
||||
@@ -656,7 +656,7 @@ namespace Content.Shared.Interaction
|
||||
/// Activates the Dropped behavior of an object
|
||||
/// Verifies that the user is capable of doing the drop interaction first
|
||||
/// </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;
|
||||
|
||||
@@ -668,7 +668,7 @@ namespace Content.Shared.Interaction
|
||||
/// Calls Dropped on all components that implement the IDropped interface
|
||||
/// on an entity that has been dropped.
|
||||
/// </summary>
|
||||
public void DroppedInteraction(IEntity user, IEntity item)
|
||||
public void DroppedInteraction(EntityUid user, EntityUid item)
|
||||
{
|
||||
var dropMsg = new DroppedEvent(user, item);
|
||||
RaiseLocalEvent(item, dropMsg);
|
||||
@@ -696,7 +696,7 @@ namespace Content.Shared.Interaction
|
||||
/// Calls HandSelected on all components that implement the IHandSelected interface
|
||||
/// on an item entity on a hand that has just been selected.
|
||||
/// </summary>
|
||||
public void HandSelectedInteraction(IEntity user, IEntity item)
|
||||
public void HandSelectedInteraction(EntityUid user, EntityUid item)
|
||||
{
|
||||
var handSelectedMsg = new HandSelectedEvent(user, item);
|
||||
RaiseLocalEvent(item, handSelectedMsg);
|
||||
@@ -716,7 +716,7 @@ namespace Content.Shared.Interaction
|
||||
/// Calls HandDeselected on all components that implement the IHandDeselected interface
|
||||
/// on an item entity on a hand that has just been deselected.
|
||||
/// </summary>
|
||||
public void HandDeselectedInteraction(IEntity user, IEntity item)
|
||||
public void HandDeselectedInteraction(EntityUid user, EntityUid item)
|
||||
{
|
||||
var handDeselectedMsg = new HandDeselectedEvent(user, item);
|
||||
RaiseLocalEvent(item, handDeselectedMsg);
|
||||
|
||||
@@ -23,9 +23,9 @@ namespace Content.Shared.Inventory
|
||||
|
||||
public abstract class UserEventArgs : EventArgs
|
||||
{
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
|
||||
protected UserEventArgs(IEntity user)
|
||||
protected UserEventArgs(EntityUid user)
|
||||
{
|
||||
User = user;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ namespace Content.Shared.Inventory
|
||||
|
||||
public class EquippedEventArgs : UserEventArgs
|
||||
{
|
||||
public EquippedEventArgs(IEntity user, EquipmentSlotDefines.Slots slot) : base(user)
|
||||
public EquippedEventArgs(EntityUid user, EquipmentSlotDefines.Slots slot) : base(user)
|
||||
{
|
||||
Slot = slot;
|
||||
}
|
||||
@@ -50,19 +50,19 @@ namespace Content.Shared.Inventory
|
||||
/// <summary>
|
||||
/// Entity that equipped the item.
|
||||
/// </summary>
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Item that was equipped.
|
||||
/// </summary>
|
||||
public IEntity Equipped { get; }
|
||||
public EntityUid Equipped { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Slot that the item was placed into.
|
||||
/// </summary>
|
||||
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;
|
||||
Equipped = equipped;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Shared.Inventory
|
||||
|
||||
public class UnequippedEventArgs : UserEventArgs
|
||||
{
|
||||
public UnequippedEventArgs(IEntity user, EquipmentSlotDefines.Slots slot) : base(user)
|
||||
public UnequippedEventArgs(EntityUid user, EquipmentSlotDefines.Slots slot) : base(user)
|
||||
{
|
||||
Slot = slot;
|
||||
}
|
||||
@@ -40,19 +40,19 @@ namespace Content.Shared.Inventory
|
||||
/// <summary>
|
||||
/// Entity that equipped the item.
|
||||
/// </summary>
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Item that was unequipped.
|
||||
/// </summary>
|
||||
public IEntity Unequipped { get; }
|
||||
public EntityUid Unequipped { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Slot that the item was removed from.
|
||||
/// </summary>
|
||||
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;
|
||||
Unequipped = unequipped;
|
||||
|
||||
@@ -17,12 +17,12 @@ namespace Content.Shared.Throwing
|
||||
|
||||
public class ThrownEventArgs : EventArgs
|
||||
{
|
||||
public ThrownEventArgs(IEntity user)
|
||||
public ThrownEventArgs(EntityUid user)
|
||||
{
|
||||
User = user;
|
||||
}
|
||||
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -34,14 +34,14 @@ namespace Content.Shared.Throwing
|
||||
/// <summary>
|
||||
/// Entity that threw the item.
|
||||
/// </summary>
|
||||
public IEntity User { get; }
|
||||
public EntityUid User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Item that was thrown.
|
||||
/// </summary>
|
||||
public IEntity Thrown { get; }
|
||||
public EntityUid Thrown { get; }
|
||||
|
||||
public ThrownEvent(IEntity user, IEntity thrown)
|
||||
public ThrownEvent(EntityUid user, EntityUid thrown)
|
||||
{
|
||||
User = user;
|
||||
Thrown = thrown;
|
||||
|
||||
@@ -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
|
||||
/// does not request verbs from the server.
|
||||
/// </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();
|
||||
|
||||
@@ -41,17 +41,17 @@ namespace Content.Shared.Verbs
|
||||
// call ActionBlocker checks, just cache it for the verb request.
|
||||
var canInteract = force || _actionBlockerSystem.CanInteract(user);
|
||||
|
||||
IEntity? @using = null;
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out SharedHandsComponent? hands) && (force || _actionBlockerSystem.CanUse(user)))
|
||||
EntityUid? @using = null;
|
||||
if (EntityManager.TryGetComponent(user, out SharedHandsComponent? hands) && (force || _actionBlockerSystem.CanUse(user)))
|
||||
{
|
||||
hands.TryGetActiveHeldEntity(out @using);
|
||||
|
||||
// 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
|
||||
// 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))
|
||||
return;
|
||||
|
||||
IEntity? used = null;
|
||||
EntityUid? used = null;
|
||||
if (usedUid != null)
|
||||
EntityManager.TryGetEntity(usedUid.Value, out used);
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Content.Shared.Verbs
|
||||
/// </remarks>
|
||||
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) { }
|
||||
|
||||
}
|
||||
@@ -97,7 +97,7 @@ namespace Content.Shared.Verbs
|
||||
/// </remarks>
|
||||
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) { }
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Content.Shared.Verbs
|
||||
/// </remarks>
|
||||
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) { }
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Content.Shared.Verbs
|
||||
/// </remarks>
|
||||
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) { }
|
||||
}
|
||||
|
||||
@@ -149,12 +149,12 @@ namespace Content.Shared.Verbs
|
||||
/// <summary>
|
||||
/// The entity being targeted for the verb.
|
||||
/// </summary>
|
||||
public readonly IEntity Target;
|
||||
public readonly EntityUid Target;
|
||||
|
||||
/// <summary>
|
||||
/// The entity that will be "performing" the verb.
|
||||
/// </summary>
|
||||
public readonly IEntity User;
|
||||
public readonly EntityUid User;
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// has hands.
|
||||
/// </remarks>
|
||||
public readonly IEntity? Using;
|
||||
public readonly EntityUid? Using;
|
||||
|
||||
// for eventual removal of IEntity.
|
||||
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)
|
||||
public GetVerbsEvent(EntityUid user, EntityUid target, EntityUid? @using, SharedHandsComponent? hands, bool canInteract, bool canAccess)
|
||||
{
|
||||
User = user;
|
||||
Target = target;
|
||||
|
||||
Reference in New Issue
Block a user