More error fixes.

This commit is contained in:
Vera Aguilera Puerto
2021-12-04 12:47:09 +01:00
parent 424c83e39c
commit 151778a1b9
30 changed files with 97 additions and 123 deletions

View File

@@ -21,7 +21,7 @@ namespace Content.Shared.Actions.Behaviors
/// <summary>
/// Entity performing the action.
/// </summary>
public readonly IEntity Performer;
public readonly EntityUid Performer;
/// <summary>
/// Action being performed
/// </summary>
@@ -31,7 +31,7 @@ namespace Content.Shared.Actions.Behaviors
/// </summary>
public readonly SharedActionsComponent? PerformerActions;
public ActionEventArgs(IEntity performer, ActionType actionType)
public ActionEventArgs(EntityUid performer, ActionType actionType)
{
Performer = performer;
ActionType = actionType;

View File

@@ -18,7 +18,7 @@ namespace Content.Shared.Actions.Behaviors
public class InstantActionEventArgs : ActionEventArgs
{
public InstantActionEventArgs(IEntity performer, ActionType actionType) : base(performer, actionType)
public InstantActionEventArgs(EntityUid performer, ActionType actionType) : base(performer, actionType)
{
}
}

View File

@@ -19,9 +19,9 @@ namespace Content.Shared.Actions.Behaviors
/// <summary>
/// Entity being targeted
/// </summary>
public readonly IEntity Target;
public readonly EntityUid Target;
public TargetEntityActionEventArgs(IEntity performer, ActionType actionType, IEntity target) :
public TargetEntityActionEventArgs(EntityUid performer, ActionType actionType, EntityUid target) :
base(performer, actionType)
{
Target = target;

View File

@@ -20,9 +20,9 @@ namespace Content.Shared.Actions.Behaviors
/// <summary>
/// Entity being targeted
/// </summary>
public readonly IEntity Target;
public readonly EntityUid Target;
public TargetEntityItemActionEventArgs(IEntity performer, IEntity target, IEntity item,
public TargetEntityItemActionEventArgs(EntityUid performer, EntityUid target, EntityUid item,
ItemActionType actionType) : base(performer, item, actionType)
{
Target = target;

View File

@@ -23,7 +23,7 @@ namespace Content.Shared.Actions.Behaviors
/// </summary>
public readonly EntityCoordinates Target;
public TargetPointActionEventArgs(IEntity performer, EntityCoordinates target, ActionType actionType)
public TargetPointActionEventArgs(EntityUid performer, EntityCoordinates target, ActionType actionType)
: base(performer, actionType)
{
Target = target;

View File

@@ -24,7 +24,7 @@ namespace Content.Shared.Actions.Behaviors
/// </summary>
public readonly EntityCoordinates Target;
public TargetPointItemActionEventArgs(IEntity performer, EntityCoordinates target, IEntity item,
public TargetPointItemActionEventArgs(EntityUid performer, EntityCoordinates target, EntityUid item,
ItemActionType actionType) : base(performer, item, actionType)
{
Target = target;

View File

@@ -33,7 +33,7 @@ namespace Content.Shared.Actions.Behaviors
/// </summary>
public bool ToggledOff => !ToggledOn;
public ToggleActionEventArgs(IEntity performer, ActionType actionType, bool toggledOn) : base(performer, actionType)
public ToggleActionEventArgs(EntityUid performer, ActionType actionType, bool toggledOn) : base(performer, actionType)
{
ToggledOn = toggledOn;
}

View File

@@ -18,7 +18,7 @@ namespace Content.Shared.Actions.Behaviors.Item
public class InstantItemActionEventArgs : ItemActionEventArgs
{
public InstantItemActionEventArgs(IEntity performer, IEntity item, ItemActionType actionType) :
public InstantItemActionEventArgs(EntityUid performer, EntityUid item, ItemActionType actionType) :
base(performer, item, actionType)
{
}

View File

@@ -22,11 +22,11 @@ namespace Content.Shared.Actions.Behaviors.Item
/// <summary>
/// Entity performing the action.
/// </summary>
public readonly IEntity Performer;
public readonly EntityUid Performer;
/// <summary>
/// Item being used to perform the action
/// </summary>
public readonly IEntity Item;
public readonly EntityUid Item;
/// <summary>
/// Action being performed
/// </summary>
@@ -36,7 +36,7 @@ namespace Content.Shared.Actions.Behaviors.Item
/// </summary>
public readonly ItemActionsComponent? ItemActions;
public ItemActionEventArgs(IEntity performer, IEntity item, ItemActionType actionType)
public ItemActionEventArgs(EntityUid performer, EntityUid item, ItemActionType actionType)
{
Performer = performer;
ActionType = actionType;

View File

@@ -33,7 +33,7 @@ namespace Content.Shared.Actions.Behaviors.Item
/// </summary>
public bool ToggledOff => !ToggledOn;
public ToggleItemActionEventArgs(IEntity performer, bool toggledOn, IEntity item,
public ToggleItemActionEventArgs(EntityUid performer, bool toggledOn, EntityUid item,
ItemActionType actionType) : base(performer, item, actionType)
{
ToggledOn = toggledOn;

View File

@@ -47,7 +47,7 @@ namespace Content.Shared.Actions.Components
/// <summary>
/// Entity currently holding this in hand or equip slot. Null if not held.
/// </summary>
public IEntity? Holder { get; private set; }
public EntityUid? Holder { get; private set; }
// cached actions component of the holder, since we'll need to access it frequently
private SharedActionsComponent? _holderActionsComponent;

View File

@@ -119,13 +119,6 @@ namespace Content.Shared.Actions.Components
return false;
}
/// <seealso cref="TryGetItemActionStates(Robust.Shared.GameObjects.EntityUid,out System.Collections.Generic.IReadOnlyDictionary{Content.Shared.Actions.ItemActionType,Content.Shared.Actions.Components.ActionState}?)"/>
public bool TryGetItemActionStates(IEntity item,
[NotNullWhen((true))] out IReadOnlyDictionary<ItemActionType, ActionState>? itemActionStates)
{
return TryGetItemActionStates((EntityUid) item, out itemActionStates);
}
/// <summary>
/// Gets the item action state associated with the specified item action type for the specified item, if it has any.
/// </summary>
@@ -170,12 +163,6 @@ namespace Content.Shared.Actions.Components
.Any(state => state.Key == actionType && state.Value.Enabled);
}
/// <seealso cref="TryGetItemActionState(Content.Shared.Actions.ItemActionType,Robust.Shared.GameObjects.EntityUid,out Content.Shared.Actions.Components.ActionState)"/>
public bool TryGetItemActionState(ItemActionType actionType, IEntity item, out ActionState actionState)
{
return TryGetItemActionState(actionType, (EntityUid) item, out actionState);
}
/// <summary>
/// Gets all action types that have non-initial state (granted, have a cooldown, or toggled on).
/// </summary>

View File

@@ -39,24 +39,24 @@ namespace Content.Shared.Actions
/// <summary>
/// Perform the server-side logic of the action
/// </summary>
void DoInstantAction(IEntity player);
void DoInstantAction(EntityUid player);
/// <summary>
/// Perform the server-side logic of the toggle action
/// </summary>
/// <returns>true if the attempt to toggle was successful, meaning the state should be toggled to the
/// indicated value</returns>
bool DoToggleAction(IEntity player, bool on);
bool DoToggleAction(EntityUid player, bool on);
/// <summary>
/// Perform the server-side logic of the target point action
/// </summary>
void DoTargetPointAction(IEntity player, EntityCoordinates target);
void DoTargetPointAction(EntityUid player, EntityCoordinates target);
/// <summary>
/// Perform the server-side logic of the target entity action
/// </summary>
void DoTargetEntityAction(IEntity player, IEntity target);
void DoTargetEntityAction(EntityUid player, EntityUid target);
}
public class ActionAttempt : IActionAttempt
@@ -80,22 +80,22 @@ namespace Content.Shared.Actions
actionsComponent.ToggleAction(_action.ActionType, toggleOn);
}
public void DoInstantAction(IEntity player)
public void DoInstantAction(EntityUid player)
{
_action.InstantAction.DoInstantAction(new InstantActionEventArgs(player, _action.ActionType));
}
public bool DoToggleAction(IEntity player, bool on)
public bool DoToggleAction(EntityUid player, bool on)
{
return _action.ToggleAction.DoToggleAction(new ToggleActionEventArgs(player, _action.ActionType, on));
}
public void DoTargetPointAction(IEntity player, EntityCoordinates target)
public void DoTargetPointAction(EntityUid player, EntityCoordinates target)
{
_action.TargetPointAction.DoTargetPointAction(new TargetPointActionEventArgs(player, target, _action.ActionType));
}
public void DoTargetEntityAction(IEntity player, IEntity target)
public void DoTargetEntityAction(EntityUid player, EntityUid target)
{
_action.TargetEntityAction.DoTargetEntityAction(new TargetEntityActionEventArgs(player, _action.ActionType,
target));
@@ -142,35 +142,35 @@ namespace Content.Shared.Actions
public class ItemActionAttempt : IActionAttempt
{
private readonly ItemActionPrototype _action;
private readonly IEntity _item;
private readonly EntityUid _item;
private readonly ItemActionsComponent _itemActions;
public BaseActionPrototype Action => _action;
public ItemActionAttempt(ItemActionPrototype action, IEntity item, ItemActionsComponent itemActions)
public ItemActionAttempt(ItemActionPrototype action, EntityUid item, ItemActionsComponent itemActions)
{
_action = action;
_item = item;
_itemActions = itemActions;
}
public void DoInstantAction(IEntity player)
public void DoInstantAction(EntityUid player)
{
_action.InstantAction.DoInstantAction(new InstantItemActionEventArgs(player, _item, _action.ActionType));
}
public bool DoToggleAction(IEntity player, bool on)
public bool DoToggleAction(EntityUid player, bool on)
{
return _action.ToggleAction.DoToggleAction(new ToggleItemActionEventArgs(player, on, _item, _action.ActionType));
}
public void DoTargetPointAction(IEntity player, EntityCoordinates target)
public void DoTargetPointAction(EntityUid player, EntityCoordinates target)
{
_action.TargetPointAction.DoTargetPointAction(new TargetPointItemActionEventArgs(player, target, _item,
_action.ActionType));
}
public void DoTargetEntityAction(IEntity player, IEntity target)
public void DoTargetEntityAction(EntityUid player, EntityUid target)
{
_action.TargetEntityAction.DoTargetEntityAction(new TargetEntityItemActionEventArgs(player, target,
_item, _action.ActionType));

View File

@@ -34,7 +34,7 @@ namespace Content.Shared.Buckle.Components
bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
{
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Dragged, out SharedBuckleComponent? buckleComponent)) return false;
bool Ignored(IEntity entity) => entity == eventArgs.User || entity == eventArgs.Dragged || entity == eventArgs.Target;
bool Ignored(EntityUid entity) => entity == eventArgs.User || entity == eventArgs.Dragged || entity == eventArgs.Target;
return eventArgs.Target.InRangeUnobstructed(eventArgs.Dragged, buckleComponent.Range, predicate: Ignored);
}
@@ -73,7 +73,7 @@ namespace Content.Shared.Buckle.Components
/// <param name="entity">The entity that had its buckling status changed</param>
/// <param name="strap">The strap that the entity was buckled to or unbuckled from</param>
/// <param name="buckled">True if the entity was buckled, false otherwise</param>
protected StrapChangeMessage(IEntity entity, IEntity strap, bool buckled)
protected StrapChangeMessage(EntityUid entity, EntityUid strap, bool buckled)
{
Entity = entity;
Strap = strap;
@@ -83,12 +83,12 @@ namespace Content.Shared.Buckle.Components
/// <summary>
/// The entity that had its buckling status changed
/// </summary>
public IEntity Entity { get; }
public EntityUid Entity { get; }
/// <summary>
/// The strap that the entity was buckled to or unbuckled from
/// </summary>
public IEntity Strap { get; }
public EntityUid Strap { get; }
/// <summary>
/// True if the entity was buckled, false otherwise.
@@ -104,7 +104,7 @@ namespace Content.Shared.Buckle.Components
/// </summary>
/// <param name="entity">The entity that had its buckling status changed</param>
/// <param name="strap">The strap that the entity was buckled to or unbuckled from</param>
public StrapMessage(IEntity entity, IEntity strap) : base(entity, strap, true)
public StrapMessage(EntityUid entity, EntityUid strap) : base(entity, strap, true)
{
}
}
@@ -117,7 +117,7 @@ namespace Content.Shared.Buckle.Components
/// </summary>
/// <param name="entity">The entity that had its buckling status changed</param>
/// <param name="strap">The strap that the entity was buckled to or unbuckled from</param>
public UnStrapMessage(IEntity entity, IEntity strap) : base(entity, strap, false)
public UnStrapMessage(EntityUid entity, EntityUid strap) : base(entity, strap, false)
{
}
}

View File

@@ -7,6 +7,6 @@ namespace Content.Shared.Construction.Conditions
public interface IConstructionCondition
{
ConstructionGuideEntry? GenerateGuideEntry();
bool Condition(IEntity user, EntityCoordinates location, Direction direction);
bool Condition(EntityUid user, EntityCoordinates location, Direction direction);
}
}

View File

@@ -13,7 +13,7 @@ namespace Content.Shared.Construction.Conditions
[DataDefinition]
public class NoWindowsInTile : IConstructionCondition
{
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
{
foreach (var entity in location.GetEntitiesInTile(LookupFlags.Approximate | LookupFlags.IncludeAnchored))
{

View File

@@ -14,7 +14,7 @@ namespace Content.Shared.Construction.Conditions
[DataField("filterMobs")] private bool _filterMobs = false;
[DataField("failIfSpace")] private bool _failIfSpace = true;
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
{
var tileRef = location.GetTileRef();

View File

@@ -22,7 +22,7 @@ namespace Content.Shared.Construction.Conditions
[DataField("guideIcon")]
public SpriteSpecifier? GuideIcon = null;
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
{
if (TargetTiles == null) return true;

View File

@@ -16,7 +16,7 @@ namespace Content.Shared.Construction.Conditions
[DataDefinition]
public class WallmountCondition : IConstructionCondition
{
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
public bool Condition(EntityUid user, EntityCoordinates location, Direction direction)
{
var entManager = IoCManager.Resolve<IEntityManager>();

View File

@@ -32,7 +32,7 @@ namespace Content.Shared.Construction.Steps
return entityManager.TryGetComponent(uid, out SharedStackComponent? stack) && stack.StackTypeId.Equals(MaterialPrototypeId) && stack.Count >= Amount;
}
public bool EntityValid(IEntity entity, [NotNullWhen(true)] out SharedStackComponent? stack)
public bool EntityValid(EntityUid entity, [NotNullWhen(true)] out SharedStackComponent? stack)
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out SharedStackComponent? otherStack) && otherStack.StackTypeId.Equals(MaterialPrototypeId) && otherStack.Count >= Amount)
stack = otherStack;

View File

@@ -48,7 +48,7 @@ namespace Content.Shared.Examine
public const float ExamineRange = 16f;
protected const float ExamineDetailsRange = 3f;
private bool IsInDetailsRange(IEntity examiner, IEntity entity)
private bool IsInDetailsRange(EntityUid examiner, EntityUid entity)
{
// check if the mob is in ciritcal or dead
if (EntityManager.TryGetComponent(examiner, out MobStateComponent mobState) && mobState.IsIncapacitated())
@@ -62,14 +62,14 @@ namespace Content.Shared.Examine
}
[Pure]
public bool CanExamine(IEntity examiner, IEntity examined)
public bool CanExamine(EntityUid examiner, EntityUid examined)
{
return CanExamine(examiner, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(examined).MapPosition,
entity => entity == examiner || entity == examined);
}
[Pure]
public virtual bool CanExamine(IEntity examiner, MapCoordinates target, Ignored? predicate = null)
public virtual bool CanExamine(EntityUid examiner, MapCoordinates target, Ignored? predicate = null)
{
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(examiner, out ExaminerComponent? examinerComponent))
return false;
@@ -146,7 +146,7 @@ namespace Content.Shared.Examine
return true;
}
public static bool InRangeUnOccluded(IEntity origin, IEntity other, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
public static bool InRangeUnOccluded(EntityUid origin, EntityUid other, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
{
var originPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin).MapPosition;
var otherPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other).MapPosition;
@@ -154,7 +154,7 @@ namespace Content.Shared.Examine
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
}
public static bool InRangeUnOccluded(IEntity origin, IComponent other, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
public static bool InRangeUnOccluded(EntityUid origin, IComponent other, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
{
var originPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin).MapPosition;
var otherPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner).MapPosition;
@@ -162,7 +162,7 @@ namespace Content.Shared.Examine
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
}
public static bool InRangeUnOccluded(IEntity origin, EntityCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
public static bool InRangeUnOccluded(EntityUid origin, EntityCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
{
var originPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin).MapPosition;
var otherPos = other.ToMap(IoCManager.Resolve<IEntityManager>());
@@ -170,7 +170,7 @@ namespace Content.Shared.Examine
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
}
public static bool InRangeUnOccluded(IEntity origin, MapCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
public static bool InRangeUnOccluded(EntityUid origin, MapCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
{
var originPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(origin).MapPosition;
@@ -196,13 +196,13 @@ namespace Content.Shared.Examine
public static bool InRangeUnOccluded(AfterInteractEventArgs args, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
{
var originPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(args.User).MapPosition;
IEntity? tempQualifier = args.Target;
EntityUid? tempQualifier = args.Target;
var otherPos = (tempQualifier != null ? IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(tempQualifier) : null).MapPosition ?? args.ClickLocation.ToMap(IoCManager.Resolve<IEntityManager>());
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
}
public FormattedMessage GetExamineText(IEntity entity, IEntity? examiner)
public FormattedMessage GetExamineText(EntityUid entity, EntityUid? examiner)
{
var message = new FormattedMessage();
@@ -223,8 +223,8 @@ namespace Content.Shared.Examine
message.PushColor(Color.DarkGray);
// Raise the event and let things that subscribe to it change the message...
var isInDetailsRange = IsInDetailsRange(examiner, entity);
var examinedEvent = new ExaminedEvent(message, entity, examiner, isInDetailsRange, doNewline);
var isInDetailsRange = IsInDetailsRange(examiner.Value, entity);
var examinedEvent = new ExaminedEvent(message, entity, examiner.Value, isInDetailsRange, doNewline);
RaiseLocalEvent(entity, examinedEvent);
//Add component statuses from components that report one
@@ -266,12 +266,12 @@ namespace Content.Shared.Examine
/// <summary>
/// The entity performing the examining.
/// </summary>
public IEntity Examiner { get; }
public EntityUid Examiner { get; }
/// <summary>
/// Entity being examined, for broadcast event purposes.
/// </summary>
public IEntity Examined { get; }
public EntityUid Examined { get; }
/// <summary>
/// Whether the examiner is in range of the entity to get some extra details.
@@ -280,7 +280,7 @@ namespace Content.Shared.Examine
private bool _doNewLine;
public ExaminedEvent(FormattedMessage message, IEntity examined, IEntity examiner, bool isInDetailsRange, bool doNewLine)
public ExaminedEvent(FormattedMessage message, EntityUid examined, EntityUid examiner, bool isInDetailsRange, bool doNewLine)
{
Message = message;
Examined = examined;

View File

@@ -15,8 +15,8 @@ namespace Content.Shared.Interaction.Helpers
#region Entities
public static bool InRangeUnobstructed(
this IEntity origin,
IEntity other,
this EntityUid origin,
EntityUid other,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored? predicate = null,
@@ -44,7 +44,7 @@ namespace Content.Shared.Interaction.Helpers
}
public static bool InRangeUnobstructed(
this IEntity origin,
this EntityUid origin,
IComponent other,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
@@ -57,7 +57,7 @@ namespace Content.Shared.Interaction.Helpers
}
public static bool InRangeUnobstructed(
this IEntity origin,
this EntityUid origin,
IContainer other,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
@@ -72,7 +72,7 @@ namespace Content.Shared.Interaction.Helpers
}
public static bool InRangeUnobstructed(
this IEntity origin,
this EntityUid origin,
EntityCoordinates other,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
@@ -85,7 +85,7 @@ namespace Content.Shared.Interaction.Helpers
}
public static bool InRangeUnobstructed(
this IEntity origin,
this EntityUid origin,
MapCoordinates other,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
@@ -101,7 +101,7 @@ namespace Content.Shared.Interaction.Helpers
#region Components
public static bool InRangeUnobstructed(
this IComponent origin,
IEntity other,
EntityUid other,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored? predicate = null,
@@ -179,7 +179,7 @@ namespace Content.Shared.Interaction.Helpers
#region Containers
public static bool InRangeUnobstructed(
this IContainer origin,
IEntity other,
EntityUid other,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored? predicate = null,
@@ -256,7 +256,7 @@ namespace Content.Shared.Interaction.Helpers
#region EntityCoordinates
public static bool InRangeUnobstructed(
this EntityCoordinates origin,
IEntity other,
EntityUid other,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored? predicate = null,
@@ -338,7 +338,7 @@ namespace Content.Shared.Interaction.Helpers
#region MapCoordinates
public static bool InRangeUnobstructed(
this MapCoordinates origin,
IEntity other,
EntityUid other,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored? predicate = null,
@@ -434,7 +434,7 @@ namespace Content.Shared.Interaction.Helpers
if (target == null)
return SharedInteractionSystem.InRangeUnobstructed(user, args.ClickLocation, range, collisionMask, predicate, ignoreInsideBlocker, popup);
else
return SharedInteractionSystem.InRangeUnobstructed(user, target, range, collisionMask, predicate, ignoreInsideBlocker, popup);
return SharedInteractionSystem.InRangeUnobstructed(user, target.Value, range, collisionMask, predicate, ignoreInsideBlocker, popup);
}
#endregion
@@ -475,7 +475,7 @@ namespace Content.Shared.Interaction.Helpers
if (target == null)
return SharedInteractionSystem.InRangeUnobstructed(user, args.ClickLocation, range, collisionMask, predicate, ignoreInsideBlocker, popup);
else
return SharedInteractionSystem.InRangeUnobstructed(user, target, range, collisionMask, predicate, ignoreInsideBlocker, popup);
return SharedInteractionSystem.InRangeUnobstructed(user, target.Value, range, collisionMask, predicate, ignoreInsideBlocker, popup);
}
#endregion
}

View File

@@ -13,8 +13,8 @@ namespace Content.Shared.Interaction.Helpers
{
#region Entities
public static bool InRangeUnOccluded(
this IEntity origin,
IEntity other,
this EntityUid origin,
EntityUid other,
float range = ExamineRange,
Ignored? predicate = null,
bool ignoreInsideBlocker = true)
@@ -23,7 +23,7 @@ namespace Content.Shared.Interaction.Helpers
}
public static bool InRangeUnOccluded(
this IEntity origin,
this EntityUid origin,
IComponent other,
float range = InteractionRange,
Ignored? predicate = null,
@@ -33,7 +33,7 @@ namespace Content.Shared.Interaction.Helpers
}
public static bool InRangeUnOccluded(
this IEntity origin,
this EntityUid origin,
IContainer other,
float range = InteractionRange,
Ignored? predicate = null,
@@ -45,7 +45,7 @@ namespace Content.Shared.Interaction.Helpers
}
public static bool InRangeUnOccluded(
this IEntity origin,
this EntityUid origin,
EntityCoordinates other,
float range = InteractionRange,
Ignored? predicate = null,
@@ -55,7 +55,7 @@ namespace Content.Shared.Interaction.Helpers
}
public static bool InRangeUnOccluded(
this IEntity origin,
this EntityUid origin,
MapCoordinates other,
float range = InteractionRange,
Ignored? predicate = null,
@@ -68,7 +68,7 @@ namespace Content.Shared.Interaction.Helpers
#region Components
public static bool InRangeUnOccluded(
this IComponent origin,
IEntity other,
EntityUid other,
float range = InteractionRange,
Ignored? predicate = null,
bool ignoreInsideBlocker = true)
@@ -133,7 +133,7 @@ namespace Content.Shared.Interaction.Helpers
#region Containers
public static bool InRangeUnOccluded(
this IContainer origin,
IEntity other,
EntityUid other,
float range = InteractionRange,
Ignored? predicate = null,
bool ignoreInsideBlocker = true)
@@ -198,7 +198,7 @@ namespace Content.Shared.Interaction.Helpers
#region EntityCoordinates
public static bool InRangeUnOccluded(
this EntityCoordinates origin,
IEntity other,
EntityUid other,
float range = InteractionRange,
Ignored? predicate = null,
bool ignoreInsideBlocker = true)
@@ -275,7 +275,7 @@ namespace Content.Shared.Interaction.Helpers
#region MapCoordinates
public static bool InRangeUnOccluded(
this MapCoordinates origin,
IEntity other,
EntityUid other,
float range = InteractionRange,
Ignored? predicate = null,
bool ignoreInsideBlocker = true)

View File

@@ -21,14 +21,14 @@ namespace Content.Shared.Interaction
public class InteractHandEventArgs : EventArgs, ITargetedInteractEventArgs
{
public InteractHandEventArgs(IEntity user, IEntity target)
public InteractHandEventArgs(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>
@@ -40,24 +40,14 @@ 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 was interacted on.
/// </summary>
public IEntity Target { get; }
public EntityUid Target { get; }
/// <summary>
/// Entity that was interacted on.
/// </summary>
public EntityUid TargetUid => Target;
public InteractHandEvent(IEntity user, IEntity target)
public InteractHandEvent(EntityUid user, EntityUid target)
{
User = user;
Target = target;

View File

@@ -157,12 +157,12 @@ namespace Content.Shared.Maps
/// Helper that returns all entities in a turf.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IEnumerable<IEntity> GetEntitiesInTile(this TileRef turf, LookupFlags flags = LookupFlags.IncludeAnchored, IEntityLookup? lookupSystem = null)
public static IEnumerable<EntityUid> GetEntitiesInTile(this TileRef turf, LookupFlags flags = LookupFlags.IncludeAnchored, IEntityLookup? lookupSystem = null)
{
lookupSystem ??= IoCManager.Resolve<IEntityLookup>();
if (!GetWorldTileBox(turf, out var worldBox))
return Enumerable.Empty<IEntity>();
return Enumerable.Empty<EntityUid>();
return lookupSystem.GetEntitiesIntersecting(turf.MapIndex, worldBox, flags);
}
@@ -170,12 +170,12 @@ namespace Content.Shared.Maps
/// <summary>
/// Helper that returns all entities in a turf.
/// </summary>
public static IEnumerable<IEntity> GetEntitiesInTile(this EntityCoordinates coordinates, LookupFlags flags = LookupFlags.IncludeAnchored, IEntityLookup? lookupSystem = null)
public static IEnumerable<EntityUid> GetEntitiesInTile(this EntityCoordinates coordinates, LookupFlags flags = LookupFlags.IncludeAnchored, IEntityLookup? lookupSystem = null)
{
var turf = coordinates.GetTileRef();
if (turf == null)
return Enumerable.Empty<IEntity>();
return Enumerable.Empty<EntityUid>();
return GetEntitiesInTile(turf.Value, flags, lookupSystem);
}
@@ -183,7 +183,7 @@ namespace Content.Shared.Maps
/// <summary>
/// Helper that returns all entities in a turf.
/// </summary>
public static IEnumerable<IEntity> GetEntitiesInTile(this Vector2i indices, GridId gridId, LookupFlags flags = LookupFlags.IncludeAnchored, IEntityLookup? lookupSystem = null)
public static IEnumerable<EntityUid> GetEntitiesInTile(this Vector2i indices, GridId gridId, LookupFlags flags = LookupFlags.IncludeAnchored, IEntityLookup? lookupSystem = null)
{
return GetEntitiesInTile(indices.GetTileRef(gridId), flags, lookupSystem);
}

View File

@@ -79,7 +79,7 @@ namespace Content.Shared.MedicalScanner
}
}
public bool CanInsert(IEntity entity)
public bool CanInsert(EntityUid entity)
{
return IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity);
}

View File

@@ -28,7 +28,7 @@ namespace Content.Shared.Pulling.Components
/// The current entity pulling this component.
/// SharedPullingStateManagementSystem should be writing this. This means definitely not you.
/// </summary>
public IEntity? Puller { get; set; }
public EntityUid? Puller { get; set; }
/// <summary>
/// The pull joint.
/// SharedPullingStateManagementSystem should be writing this. This means probably not you.
@@ -71,7 +71,7 @@ namespace Content.Shared.Pulling.Components
return;
}
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedPullerComponent?>(entity, out var comp))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedPullerComponent?>(entity.Value, out var comp))
{
Logger.Error($"Entity {state.Puller.Value} for pulling had no Puller component");
// ensure it disconnects from any different puller, still

View File

@@ -20,7 +20,7 @@ namespace Content.Shared.Pulling.Components
public float SprintSpeedModifier => Pulling == null ? 1.0f : 0.75f;
[ViewVariables]
public IEntity? Pulling { get; set; }
public EntityUid? Pulling { get; set; }
protected override void Shutdown()
{

View File

@@ -7,13 +7,13 @@ namespace Content.Shared.Pulling.Events
/// </summary>
public class StartPullAttemptEvent : CancellableEntityEventArgs
{
public StartPullAttemptEvent(IEntity puller, IEntity pulled)
public StartPullAttemptEvent(EntityUid puller, EntityUid pulled)
{
Puller = puller;
Pulled = pulled;
}
public IEntity Puller { get; }
public IEntity Pulled { get; }
public EntityUid Puller { get; }
public EntityUid Pulled { get; }
}
}

View File

@@ -50,10 +50,7 @@ namespace Content.Shared.Shuttles.Components
public override ComponentState GetComponentState()
{
if(Console == null)
return new
return new PilotComponentState(((IComponent) Console).Owner);
return Console == null ? new PilotComponentState(null) : new PilotComponentState(Console.Owner);
}
[Serializable, NetSerializable]