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

View File

@@ -18,7 +18,7 @@ namespace Content.Shared.Actions.Behaviors
public class InstantActionEventArgs : ActionEventArgs 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> /// <summary>
/// Entity being targeted /// Entity being targeted
/// </summary> /// </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) base(performer, actionType)
{ {
Target = target; Target = target;

View File

@@ -20,9 +20,9 @@ namespace Content.Shared.Actions.Behaviors
/// <summary> /// <summary>
/// Entity being targeted /// Entity being targeted
/// </summary> /// </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) ItemActionType actionType) : base(performer, item, actionType)
{ {
Target = target; Target = target;

View File

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

View File

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

View File

@@ -33,7 +33,7 @@ namespace Content.Shared.Actions.Behaviors
/// </summary> /// </summary>
public bool ToggledOff => !ToggledOn; 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; ToggledOn = toggledOn;
} }

View File

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

View File

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

View File

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

View File

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

View File

@@ -119,13 +119,6 @@ namespace Content.Shared.Actions.Components
return false; 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> /// <summary>
/// Gets the item action state associated with the specified item action type for the specified item, if it has any. /// Gets the item action state associated with the specified item action type for the specified item, if it has any.
/// </summary> /// </summary>
@@ -170,12 +163,6 @@ namespace Content.Shared.Actions.Components
.Any(state => state.Key == actionType && state.Value.Enabled); .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> /// <summary>
/// Gets all action types that have non-initial state (granted, have a cooldown, or toggled on). /// Gets all action types that have non-initial state (granted, have a cooldown, or toggled on).
/// </summary> /// </summary>

View File

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

View File

@@ -34,7 +34,7 @@ namespace Content.Shared.Buckle.Components
bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs) bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
{ {
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Dragged, out SharedBuckleComponent? buckleComponent)) return false; 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); 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="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="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> /// <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; Entity = entity;
Strap = strap; Strap = strap;
@@ -83,12 +83,12 @@ namespace Content.Shared.Buckle.Components
/// <summary> /// <summary>
/// The entity that had its buckling status changed /// The entity that had its buckling status changed
/// </summary> /// </summary>
public IEntity Entity { get; } public EntityUid Entity { get; }
/// <summary> /// <summary>
/// The strap that the entity was buckled to or unbuckled from /// The strap that the entity was buckled to or unbuckled from
/// </summary> /// </summary>
public IEntity Strap { get; } public EntityUid Strap { get; }
/// <summary> /// <summary>
/// True if the entity was buckled, false otherwise. /// True if the entity was buckled, false otherwise.
@@ -104,7 +104,7 @@ namespace Content.Shared.Buckle.Components
/// </summary> /// </summary>
/// <param name="entity">The entity that had its buckling status changed</param> /// <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="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> /// </summary>
/// <param name="entity">The entity that had its buckling status changed</param> /// <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="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 public interface IConstructionCondition
{ {
ConstructionGuideEntry? GenerateGuideEntry(); 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] [DataDefinition]
public class NoWindowsInTile : IConstructionCondition 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)) 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("filterMobs")] private bool _filterMobs = false;
[DataField("failIfSpace")] private bool _failIfSpace = true; [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(); var tileRef = location.GetTileRef();

View File

@@ -22,7 +22,7 @@ namespace Content.Shared.Construction.Conditions
[DataField("guideIcon")] [DataField("guideIcon")]
public SpriteSpecifier? GuideIcon = null; 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; if (TargetTiles == null) return true;

View File

@@ -16,7 +16,7 @@ namespace Content.Shared.Construction.Conditions
[DataDefinition] [DataDefinition]
public class WallmountCondition : IConstructionCondition 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>(); 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; 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) if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out SharedStackComponent? otherStack) && otherStack.StackTypeId.Equals(MaterialPrototypeId) && otherStack.Count >= Amount)
stack = otherStack; stack = otherStack;

View File

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

View File

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

View File

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

View File

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

View File

@@ -157,12 +157,12 @@ namespace Content.Shared.Maps
/// Helper that returns all entities in a turf. /// Helper that returns all entities in a turf.
/// </summary> /// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [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>(); lookupSystem ??= IoCManager.Resolve<IEntityLookup>();
if (!GetWorldTileBox(turf, out var worldBox)) if (!GetWorldTileBox(turf, out var worldBox))
return Enumerable.Empty<IEntity>(); return Enumerable.Empty<EntityUid>();
return lookupSystem.GetEntitiesIntersecting(turf.MapIndex, worldBox, flags); return lookupSystem.GetEntitiesIntersecting(turf.MapIndex, worldBox, flags);
} }
@@ -170,12 +170,12 @@ namespace Content.Shared.Maps
/// <summary> /// <summary>
/// Helper that returns all entities in a turf. /// Helper that returns all entities in a turf.
/// </summary> /// </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(); var turf = coordinates.GetTileRef();
if (turf == null) if (turf == null)
return Enumerable.Empty<IEntity>(); return Enumerable.Empty<EntityUid>();
return GetEntitiesInTile(turf.Value, flags, lookupSystem); return GetEntitiesInTile(turf.Value, flags, lookupSystem);
} }
@@ -183,7 +183,7 @@ namespace Content.Shared.Maps
/// <summary> /// <summary>
/// Helper that returns all entities in a turf. /// Helper that returns all entities in a turf.
/// </summary> /// </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); 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); return IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity);
} }

View File

@@ -28,7 +28,7 @@ namespace Content.Shared.Pulling.Components
/// The current entity pulling this component. /// The current entity pulling this component.
/// SharedPullingStateManagementSystem should be writing this. This means definitely not you. /// SharedPullingStateManagementSystem should be writing this. This means definitely not you.
/// </summary> /// </summary>
public IEntity? Puller { get; set; } public EntityUid? Puller { get; set; }
/// <summary> /// <summary>
/// The pull joint. /// The pull joint.
/// SharedPullingStateManagementSystem should be writing this. This means probably not you. /// SharedPullingStateManagementSystem should be writing this. This means probably not you.
@@ -71,7 +71,7 @@ namespace Content.Shared.Pulling.Components
return; 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"); Logger.Error($"Entity {state.Puller.Value} for pulling had no Puller component");
// ensure it disconnects from any different puller, still // 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; public float SprintSpeedModifier => Pulling == null ? 1.0f : 0.75f;
[ViewVariables] [ViewVariables]
public IEntity? Pulling { get; set; } public EntityUid? Pulling { get; set; }
protected override void Shutdown() protected override void Shutdown()
{ {

View File

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

View File

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