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,3 +1,4 @@
using Content.Shared.Gravity;
using Content.Shared.StepTrigger.Components;
using Robust.Shared.GameStates;
using Robust.Shared.Map.Components;
@@ -10,6 +11,7 @@ namespace Content.Shared.StepTrigger.Systems;
public sealed class StepTriggerSystem : EntitySystem
{
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
[Dependency] private readonly SharedGravitySystem _gravity = default!;
public override void Initialize()
{
@@ -121,6 +123,13 @@ public sealed class StepTriggerSystem : EntitySystem
if (!component.Active || component.CurrentlySteppedOn.Contains(otherUid))
return false;
// Can't trigger if we don't ignore weightless entities
// and the entity is flying or currently weightless
// Makes sense simulation wise to have this be part of steptrigger directly IMO
if (!component.IgnoreWeightless && TryComp<PhysicsComponent>(otherUid, out var physics) &&
(physics.BodyStatus == BodyStatus.InAir || _gravity.IsWeightless(otherUid, physics)))
return false;
var msg = new StepTriggerAttemptEvent { Source = uid, Tripper = otherUid };
RaiseLocalEvent(uid, ref msg, true);