InAir tweaks & chasm fixes (#19707)

This commit is contained in:
Kara
2023-09-10 23:03:16 -07:00
committed by GitHub
parent 414755b455
commit 64a29f0d8a
17 changed files with 91 additions and 48 deletions

View File

@@ -1,4 +1,5 @@
using Content.Shared.ActionBlocker;
using Content.Shared.Buckle.Components;
using Content.Shared.Movement.Events;
using Content.Shared.StepTrigger.Systems;
using Robust.Shared.Network;
@@ -51,18 +52,22 @@ public sealed class ChasmSystem : EntitySystem
if (HasComp<ChasmFallingComponent>(args.Tripper))
return;
var falling = AddComp<ChasmFallingComponent>(args.Tripper);
StartFalling(uid, component, args.Tripper);
}
public void StartFalling(EntityUid chasm, ChasmComponent component, EntityUid tripper, bool playSound = true)
{
var falling = AddComp<ChasmFallingComponent>(tripper);
falling.NextDeletionTime = _timing.CurTime + falling.DeletionTime;
_blocker.UpdateCanMove(args.Tripper);
_audio.PlayPredicted(component.FallingSound, uid, args.Tripper);
_blocker.UpdateCanMove(tripper);
if (playSound)
_audio.PlayPredicted(component.FallingSound, chasm, tripper);
}
private void OnStepTriggerAttempt(EntityUid uid, ChasmComponent component, ref StepTriggerAttemptEvent args)
{
if (TryComp<PhysicsComponent>(args.Tripper, out var physics) && physics.BodyStatus == BodyStatus.InAir)
return;
args.Continue = true;
}