- add: TelefragSystem. (#333)
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Numerics;
|
||||
using Content.Server._White.Other;
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared._White.BetrayalDagger;
|
||||
using Content.Shared.Coordinates.Helpers;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction.Events;
|
||||
@@ -31,6 +32,7 @@ public sealed class ExperimentalSyndicateTeleporter : EntitySystem
|
||||
[Dependency] private readonly PullingSystem _pullingSystem = default!;
|
||||
[Dependency] private readonly ContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly TelefragSystem _telefrag = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -113,12 +115,7 @@ public sealed class ExperimentalSyndicateTeleporter : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
SoundAndEffects(component, coords, oldCoords);
|
||||
|
||||
_transform.SetCoordinates(args.User, coords);
|
||||
|
||||
component.Uses--;
|
||||
component.NextUse = _timing.CurTime + component.Cooldown;
|
||||
Teleport(args.User, component, coords, oldCoords);
|
||||
}
|
||||
|
||||
private void OnExamine(EntityUid uid, ExperimentalSyndicateTeleporterComponent component, ExaminedEvent args)
|
||||
@@ -132,12 +129,7 @@ public sealed class ExperimentalSyndicateTeleporter : EntitySystem
|
||||
|
||||
var coords = xform.Coordinates.Offset(newOffset).SnapToGrid(EntityManager);
|
||||
|
||||
SoundAndEffects(component, coords, oldCoords);
|
||||
|
||||
_transform.SetCoordinates(uid, coords);
|
||||
|
||||
component.Uses--;
|
||||
component.NextUse = _timing.CurTime + component.Cooldown;
|
||||
Teleport(uid, component, coords, oldCoords);
|
||||
|
||||
if (TryCheckWall(coords))
|
||||
{
|
||||
@@ -145,6 +137,18 @@ public sealed class ExperimentalSyndicateTeleporter : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void Teleport(EntityUid uid, ExperimentalSyndicateTeleporterComponent component, EntityCoordinates coords,
|
||||
EntityCoordinates oldCoords)
|
||||
{
|
||||
SoundAndEffects(component, coords, oldCoords);
|
||||
|
||||
_telefrag.Telefrag(coords, uid);
|
||||
_transform.SetCoordinates(uid, coords);
|
||||
|
||||
component.Uses--;
|
||||
component.NextUse = _timing.CurTime + component.Cooldown;
|
||||
}
|
||||
|
||||
private void SoundAndEffects(ExperimentalSyndicateTeleporterComponent component, EntityCoordinates coords, EntityCoordinates oldCoords)
|
||||
{
|
||||
_audio.PlayPvs(component.TeleportSound, coords);
|
||||
|
||||
@@ -15,6 +15,7 @@ public sealed class BlinkSystem : EntitySystem
|
||||
[Dependency] private readonly AudioSystem _audio = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
[Dependency] private readonly PhysicsSystem _physics = default!;
|
||||
[Dependency] private readonly TelefragSystem _telefrag = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -61,6 +62,7 @@ public sealed class BlinkSystem : EntitySystem
|
||||
}
|
||||
|
||||
_transform.SetWorldPosition(user, targetPos);
|
||||
_telefrag.Telefrag(xform.Coordinates, user);
|
||||
_audio.PlayPvs(blink.BlinkSound, user);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared._White.BetrayalDagger;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Charges.Components;
|
||||
using Content.Shared.Charges.Systems;
|
||||
@@ -24,6 +25,7 @@ public sealed class DashAbilitySystem : EntitySystem
|
||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly ActionContainerSystem _actionContainer = default!;
|
||||
[Dependency] private readonly TelefragSystem _telefrag = default!; // WD
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -90,6 +92,7 @@ public sealed class DashAbilitySystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
_telefrag.Telefrag(args.Target, user);
|
||||
_transform.SetCoordinates(user, args.Target);
|
||||
_transform.AttachToGridOrMap(user);
|
||||
_audio.PlayPredicted(comp.BlinkSound, user, user);
|
||||
|
||||
24
Content.Shared/_White/BetrayalDagger/TelefragSystem.cs
Normal file
24
Content.Shared/_White/BetrayalDagger/TelefragSystem.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Standing;
|
||||
using Content.Shared.Standing.Systems;
|
||||
using Content.Shared.StatusEffect;
|
||||
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!;
|
||||
|
||||
public void Telefrag(EntityCoordinates coords, EntityUid user, float range = 0.2f)
|
||||
{
|
||||
var ents = new HashSet<Entity<StandingStateComponent>>();
|
||||
_lookup.GetEntitiesInRange(coords, range, ents);
|
||||
|
||||
foreach (var ent in ents.Where(ent => ent.Owner != user))
|
||||
{
|
||||
_standingState.TryLieDown(ent, ent, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user