- add: TelefragSystem. (#333)

This commit is contained in:
Aviu00
2024-06-06 10:23:00 +00:00
committed by GitHub
parent ad65bd1e58
commit 152c9546a4
4 changed files with 45 additions and 12 deletions

View File

@@ -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);

View File

@@ -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);
}
}