2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.DragDrop;
|
2020-08-30 11:37:06 +02:00
|
|
|
using Content.Shared.Physics;
|
2021-03-01 15:24:46 -08:00
|
|
|
using Robust.Shared.Containers;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.GameObjects;
|
2020-08-30 11:37:06 +02:00
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
using Robust.Shared.Map;
|
2021-06-09 22:19:39 +02:00
|
|
|
using static Content.Shared.Interaction.SharedInteractionSystem;
|
2020-08-30 11:37:06 +02:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Interaction.Helpers
|
2020-08-30 11:37:06 +02:00
|
|
|
{
|
2021-11-09 11:28:27 +01:00
|
|
|
// TODO: Kill these with fire.
|
2020-10-11 13:13:45 +02:00
|
|
|
public static class SharedUnobstructedExtensions
|
2020-08-30 11:37:06 +02:00
|
|
|
{
|
|
|
|
|
private static SharedInteractionSystem SharedInteractionSystem => EntitySystem.Get<SharedInteractionSystem>();
|
|
|
|
|
|
|
|
|
|
#region Entities
|
2021-11-09 11:28:27 +01:00
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this EntityUid origin,
|
|
|
|
|
EntityUid other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
|
|
|
|
Ignored? predicate = null,
|
|
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false,
|
|
|
|
|
IEntityManager? entityManager = null)
|
|
|
|
|
{
|
2021-12-05 18:09:01 +01:00
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(origin, other, range, collisionMask, predicate, ignoreInsideBlocker, popup);
|
2021-11-09 11:28:27 +01:00
|
|
|
}
|
|
|
|
|
|
2020-08-30 11:37:06 +02:00
|
|
|
public static bool InRangeUnobstructed(
|
2021-12-04 12:47:09 +01:00
|
|
|
this EntityUid origin,
|
2020-08-30 11:37:06 +02:00
|
|
|
IComponent other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(origin, other, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker, popup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
2021-12-04 12:47:09 +01:00
|
|
|
this EntityUid origin,
|
2020-08-30 11:37:06 +02:00
|
|
|
IContainer other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
|
|
|
|
var otherEntity = other.Owner;
|
|
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(origin, otherEntity, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker, popup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
2021-12-04 12:47:09 +01:00
|
|
|
this EntityUid origin,
|
2020-09-06 16:11:53 +02:00
|
|
|
EntityCoordinates other,
|
2020-08-30 11:37:06 +02:00
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(origin, other, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker, popup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
2021-12-04 12:47:09 +01:00
|
|
|
this EntityUid origin,
|
2020-08-30 11:37:06 +02:00
|
|
|
MapCoordinates other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(origin, other, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker, popup);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Components
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this IComponent origin,
|
2021-12-04 12:47:09 +01:00
|
|
|
EntityUid other,
|
2020-08-30 11:37:06 +02:00
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
|
|
|
|
var originEntity = origin.Owner;
|
|
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originEntity, other, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker, popup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this IComponent origin,
|
|
|
|
|
IComponent other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
|
|
|
|
var originEntity = origin.Owner;
|
|
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originEntity, other, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker, popup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this IComponent origin,
|
|
|
|
|
IContainer other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
|
|
|
|
var originEntity = origin.Owner;
|
|
|
|
|
var otherEntity = other.Owner;
|
|
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originEntity, otherEntity, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker, popup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this IComponent origin,
|
2020-09-06 16:11:53 +02:00
|
|
|
EntityCoordinates other,
|
2020-08-30 11:37:06 +02:00
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
|
|
|
|
var originEntity = origin.Owner;
|
|
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originEntity, other, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker, popup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this IComponent origin,
|
|
|
|
|
MapCoordinates other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
|
|
|
|
var originEntity = origin.Owner;
|
|
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originEntity, other, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker, popup);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Containers
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this IContainer origin,
|
2021-12-04 12:47:09 +01:00
|
|
|
EntityUid other,
|
2020-08-30 11:37:06 +02:00
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false)
|
|
|
|
|
{
|
|
|
|
|
var originEntity = origin.Owner;
|
|
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originEntity, other, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this IContainer origin,
|
|
|
|
|
IComponent other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
|
|
|
|
var originEntity = origin.Owner;
|
|
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originEntity, other, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker, popup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this IContainer origin,
|
|
|
|
|
IContainer other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
|
|
|
|
var originEntity = origin.Owner;
|
|
|
|
|
var otherEntity = other.Owner;
|
|
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originEntity, otherEntity, range, collisionMask,
|
|
|
|
|
predicate, ignoreInsideBlocker, popup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this IContainer origin,
|
2020-09-06 16:11:53 +02:00
|
|
|
EntityCoordinates other,
|
2020-08-30 11:37:06 +02:00
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
|
|
|
|
var originEntity = origin.Owner;
|
|
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originEntity, other, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker, popup);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this IContainer origin,
|
|
|
|
|
MapCoordinates other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
|
|
|
|
var originEntity = origin.Owner;
|
|
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originEntity, other, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker, popup);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
2020-09-06 16:11:53 +02:00
|
|
|
#region EntityCoordinates
|
2020-08-30 11:37:06 +02:00
|
|
|
public static bool InRangeUnobstructed(
|
2020-09-06 16:11:53 +02:00
|
|
|
this EntityCoordinates origin,
|
2021-12-04 12:47:09 +01:00
|
|
|
EntityUid other,
|
2020-08-30 11:37:06 +02:00
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false)
|
|
|
|
|
{
|
2021-12-03 11:11:52 +01:00
|
|
|
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
|
2021-12-03 15:53:09 +01:00
|
|
|
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other).MapPosition;
|
2020-08-30 11:37:06 +02:00
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask,
|
|
|
|
|
predicate, ignoreInsideBlocker);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
2020-09-06 16:11:53 +02:00
|
|
|
this EntityCoordinates origin,
|
2020-08-30 11:37:06 +02:00
|
|
|
IComponent other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false)
|
|
|
|
|
{
|
2021-12-03 11:11:52 +01:00
|
|
|
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
|
2021-12-03 15:53:09 +01:00
|
|
|
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner).MapPosition;
|
2020-08-30 11:37:06 +02:00
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask,
|
|
|
|
|
predicate, ignoreInsideBlocker);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
2020-09-06 16:11:53 +02:00
|
|
|
this EntityCoordinates origin,
|
2020-08-30 11:37:06 +02:00
|
|
|
IContainer other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false)
|
|
|
|
|
{
|
2021-12-03 11:11:52 +01:00
|
|
|
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
|
2021-12-03 15:53:09 +01:00
|
|
|
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner).MapPosition;
|
2020-08-30 11:37:06 +02:00
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask,
|
|
|
|
|
predicate, ignoreInsideBlocker);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
2020-09-06 16:11:53 +02:00
|
|
|
this EntityCoordinates origin,
|
|
|
|
|
EntityCoordinates other,
|
2020-08-30 11:37:06 +02:00
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
|
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
IEntityManager? entityManager = null)
|
2020-08-30 11:37:06 +02:00
|
|
|
{
|
2020-10-11 13:32:42 +02:00
|
|
|
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
|
|
|
|
|
2020-09-06 16:11:53 +02:00
|
|
|
var originPosition = origin.ToMap(entityManager);
|
|
|
|
|
var otherPosition = other.ToMap(entityManager);
|
2020-08-30 11:37:06 +02:00
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originPosition, otherPosition, range, collisionMask,
|
|
|
|
|
predicate, ignoreInsideBlocker);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
2020-09-06 16:11:53 +02:00
|
|
|
this EntityCoordinates origin,
|
2020-08-30 11:37:06 +02:00
|
|
|
MapCoordinates other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
|
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
IEntityManager? entityManager = null)
|
2020-08-30 11:37:06 +02:00
|
|
|
{
|
2020-10-11 13:32:42 +02:00
|
|
|
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
|
|
|
|
|
2020-09-06 16:11:53 +02:00
|
|
|
var originPosition = origin.ToMap(entityManager);
|
2020-08-30 11:37:06 +02:00
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(originPosition, other, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region MapCoordinates
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this MapCoordinates origin,
|
2021-12-04 12:47:09 +01:00
|
|
|
EntityUid other,
|
2020-08-30 11:37:06 +02:00
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false)
|
|
|
|
|
{
|
2021-12-03 15:53:09 +01:00
|
|
|
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other).MapPosition;
|
2020-08-30 11:37:06 +02:00
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this MapCoordinates origin,
|
|
|
|
|
IComponent other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false)
|
|
|
|
|
{
|
2021-12-03 15:53:09 +01:00
|
|
|
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner).MapPosition;
|
2020-08-30 11:37:06 +02:00
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this MapCoordinates origin,
|
|
|
|
|
IContainer other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false)
|
|
|
|
|
{
|
2021-12-03 15:53:09 +01:00
|
|
|
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner).MapPosition;
|
2020-08-30 11:37:06 +02:00
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this MapCoordinates origin,
|
2020-09-06 16:11:53 +02:00
|
|
|
EntityCoordinates other,
|
2020-08-30 11:37:06 +02:00
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
|
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
IEntityManager? entityManager = null)
|
2020-08-30 11:37:06 +02:00
|
|
|
{
|
2020-10-11 13:32:42 +02:00
|
|
|
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
|
|
|
|
|
2020-09-06 16:11:53 +02:00
|
|
|
var otherPosition = other.ToMap(entityManager);
|
2020-08-30 11:37:06 +02:00
|
|
|
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(origin, otherPosition, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this MapCoordinates origin,
|
|
|
|
|
MapCoordinates other,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false)
|
|
|
|
|
{
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(origin, other, range, collisionMask, predicate,
|
|
|
|
|
ignoreInsideBlocker);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region EventArgs
|
|
|
|
|
public static bool InRangeUnobstructed(
|
|
|
|
|
this ITargetedInteractEventArgs args,
|
|
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
2021-06-07 05:49:43 -07:00
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(args.User, args.Target, range, collisionMask, predicate, ignoreInsideBlocker, popup);
|
2020-08-30 11:37:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
2021-06-07 05:49:43 -07:00
|
|
|
this AfterInteractEventArgs args,
|
2020-08-30 11:37:06 +02:00
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
2021-06-07 05:49:43 -07:00
|
|
|
var user = args.User;
|
|
|
|
|
var target = args.Target;
|
|
|
|
|
|
|
|
|
|
if (target == null)
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(user, args.ClickLocation, range, collisionMask, predicate, ignoreInsideBlocker, popup);
|
|
|
|
|
else
|
2021-12-04 12:47:09 +01:00
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(user, target.Value, range, collisionMask, predicate, ignoreInsideBlocker, popup);
|
2021-06-07 05:49:43 -07:00
|
|
|
|
2020-08-30 11:37:06 +02:00
|
|
|
}
|
2021-06-07 05:49:43 -07:00
|
|
|
#endregion
|
2020-08-30 11:37:06 +02:00
|
|
|
|
2021-06-07 05:49:43 -07:00
|
|
|
#region EntityEventArgs
|
2020-08-30 11:37:06 +02:00
|
|
|
public static bool InRangeUnobstructed(
|
2021-06-07 05:49:43 -07:00
|
|
|
this DragDropEvent args,
|
2020-08-30 11:37:06 +02:00
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
2020-10-11 13:32:42 +02:00
|
|
|
Ignored? predicate = null,
|
2020-08-30 11:37:06 +02:00
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
2021-06-07 05:49:43 -07:00
|
|
|
var user = args.User;
|
|
|
|
|
var dropped = args.Dragged;
|
|
|
|
|
var target = args.Target;
|
|
|
|
|
|
|
|
|
|
if (!SharedInteractionSystem.InRangeUnobstructed(user, target, range, collisionMask, predicate, ignoreInsideBlocker, popup))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (!SharedInteractionSystem.InRangeUnobstructed(user, dropped, range, collisionMask, predicate, ignoreInsideBlocker, popup))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
2020-08-30 11:37:06 +02:00
|
|
|
}
|
2021-04-01 00:04:56 -07:00
|
|
|
|
|
|
|
|
public static bool InRangeUnobstructed(
|
2021-05-22 21:06:40 -07:00
|
|
|
this AfterInteractEvent args,
|
2021-04-01 00:04:56 -07:00
|
|
|
float range = InteractionRange,
|
|
|
|
|
CollisionGroup collisionMask = CollisionGroup.Impassable,
|
|
|
|
|
Ignored? predicate = null,
|
|
|
|
|
bool ignoreInsideBlocker = false,
|
|
|
|
|
bool popup = false)
|
|
|
|
|
{
|
2021-06-07 05:49:43 -07:00
|
|
|
var user = args.User;
|
|
|
|
|
var target = args.Target;
|
|
|
|
|
|
|
|
|
|
if (target == null)
|
|
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(user, args.ClickLocation, range, collisionMask, predicate, ignoreInsideBlocker, popup);
|
|
|
|
|
else
|
2021-12-04 12:47:09 +01:00
|
|
|
return SharedInteractionSystem.InRangeUnobstructed(user, target.Value, range, collisionMask, predicate, ignoreInsideBlocker, popup);
|
2021-04-01 00:04:56 -07:00
|
|
|
}
|
|
|
|
|
#endregion
|
2020-08-30 11:37:06 +02:00
|
|
|
}
|
|
|
|
|
}
|