2024-06-06 10:23:00 +00:00
|
|
|
using System.Linq;
|
|
|
|
|
using Content.Shared.Standing;
|
|
|
|
|
using Content.Shared.Standing.Systems;
|
|
|
|
|
using Robust.Shared.Map;
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared._White.BetrayalDagger;
|
|
|
|
|
|
|
|
|
|
public sealed class TelefragSystem : EntitySystem
|
|
|
|
|
{
|
|
|
|
|
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
|
|
|
|
[Dependency] private readonly SharedStandingStateSystem _standingState = default!;
|
|
|
|
|
|
2024-06-29 20:03:28 +00:00
|
|
|
public void Telefrag(EntityCoordinates coords, EntityUid user, float range = 0.4f)
|
2024-06-06 10:23:00 +00:00
|
|
|
{
|
|
|
|
|
var ents = new HashSet<Entity<StandingStateComponent>>();
|
|
|
|
|
_lookup.GetEntitiesInRange(coords, range, ents);
|
|
|
|
|
|
|
|
|
|
foreach (var ent in ents.Where(ent => ent.Owner != user))
|
|
|
|
|
{
|
2024-06-29 20:03:28 +00:00
|
|
|
_standingState.TryLieDown(ent, ent, SharedStandingStateSystem.DropHeldItemsBehavior.DropIfStanding);
|
2024-06-06 10:23:00 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|