add whitelist support for slow contacts (#11647)

This commit is contained in:
Nemanja
2022-10-01 21:36:44 -04:00
committed by GitHub
parent d43ed3210c
commit 0718b0f040
2 changed files with 7 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
@@ -11,6 +12,9 @@ public sealed class SlowContactsComponent : Component
[ViewVariables, DataField("sprintSpeedModifier")]
public float SprintSpeedModifier { get; set; } = 1.0f;
[DataField("ignoreWhitelist")]
public EntityWhitelist? IgnoreWhitelist;
}
[Serializable, NetSerializable]

View File

@@ -1,7 +1,6 @@
using Content.Shared.Movement.Components;
using Robust.Shared.GameStates;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems;
@@ -76,6 +75,9 @@ public sealed class SlowContactsSystem : EntitySystem
if (!TryComp<SlowContactsComponent>(ent, out var slowContactsComponent))
continue;
if (slowContactsComponent.IgnoreWhitelist != null && slowContactsComponent.IgnoreWhitelist.IsValid(ent))
continue;
walkSpeed = Math.Min(walkSpeed, slowContactsComponent.WalkSpeedModifier);
sprintSpeed = Math.Min(sprintSpeed, slowContactsComponent.SprintSpeedModifier);
remove = false;