Crawling Part 1: The Knockdownening (#36881)
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> Co-authored-by: ScarKy0 <scarky0@onet.eu>
This commit is contained in:
committed by
GitHub
parent
cfb0a95035
commit
dec2d42a1d
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Damage.Systems;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Inventory;
|
||||
using Robust.Shared.Network;
|
||||
@@ -23,8 +24,10 @@ namespace Content.Shared.Slippery;
|
||||
public sealed class SlipperySystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly MovementModStatusSystem _movementMod = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedStunSystem _stun = default!;
|
||||
[Dependency] private readonly SharedStaminaSystem _stamina = default!;
|
||||
[Dependency] private readonly StatusEffectsSystem _statusEffects = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||
@@ -115,27 +118,21 @@ public sealed class SlipperySystem : EntitySystem
|
||||
{
|
||||
_physics.SetLinearVelocity(other, physics.LinearVelocity * component.SlipData.LaunchForwardsMultiplier, body: physics);
|
||||
|
||||
if (component.SlipData.SuperSlippery && requiresContact)
|
||||
{
|
||||
var sliding = EnsureComp<SlidingComponent>(other);
|
||||
sliding.CollidingEntities.Add(uid);
|
||||
// Why the fuck does this assertion stack overflow every once in a while
|
||||
DebugTools.Assert(_physics.GetContactingEntities(other, physics).Contains(uid));
|
||||
}
|
||||
if (component.AffectsSliding && requiresContact)
|
||||
EnsureComp<SlidingComponent>(other);
|
||||
}
|
||||
|
||||
var playSound = !_statusEffects.HasStatusEffect(other, "KnockedDown");
|
||||
|
||||
_stun.TryParalyze(other, component.SlipData.ParalyzeTime, true);
|
||||
|
||||
// Preventing from playing the slip sound when you are already knocked down.
|
||||
if (playSound)
|
||||
// Preventing from playing the slip sound and stunning when you are already knocked down.
|
||||
if (!HasComp<KnockedDownComponent>(other))
|
||||
{
|
||||
_stun.TryStun(other, component.SlipData.StunTime, true);
|
||||
_stamina.TakeStaminaDamage(other, component.StaminaDamage); // Note that this can stamCrit
|
||||
_movementMod.TryFriction(other, component.FrictionStatusTime, true, component.SlipData.SlipFriction, component.SlipData.SlipFriction);
|
||||
_audio.PlayPredicted(component.SlipSound, other, other);
|
||||
}
|
||||
_stun.TryKnockdown(other, component.SlipData.KnockdownTime, true, true);
|
||||
|
||||
_adminLogger.Add(LogType.Slip, LogImpact.Low,
|
||||
$"{ToPrettyString(other):mob} slipped on collision with {ToPrettyString(uid):entity}");
|
||||
_adminLogger.Add(LogType.Slip, LogImpact.Low, $"{ToPrettyString(other):mob} slipped on collision with {ToPrettyString(uid):entity}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user