InAir tweaks & chasm fixes (#19707)
This commit is contained in:
@@ -42,10 +42,17 @@ public sealed partial class StepTriggerComponent : Component
|
||||
public float RequiredTriggerSpeed = 3.5f;
|
||||
|
||||
/// <summary>
|
||||
/// If any entities occupy the blacklist on the same tile then steptrigger won't work.
|
||||
/// If any entities occupy the blacklist on the same tile then steptrigger won't work.
|
||||
/// </summary>
|
||||
[DataField("blacklist")]
|
||||
public EntityWhitelist? Blacklist;
|
||||
|
||||
/// <summary>
|
||||
/// If this is true, steptrigger will still occur on entities that are in air / weightless. They do not
|
||||
/// by default.
|
||||
/// </summary>
|
||||
[DataField("ignoreWeightless")]
|
||||
public bool IgnoreWeightless = false;
|
||||
}
|
||||
|
||||
[RegisterComponent]
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user