Stunnable New Status and Cleanup (#38618)

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru>
This commit is contained in:
Princess Cheeseballs
2025-07-21 10:22:11 -07:00
committed by GitHub
parent 2b2b9b11b8
commit e85bc1bb8c
56 changed files with 620 additions and 316 deletions

View File

@@ -2,11 +2,9 @@ using Content.Shared.Administration.Logs;
using Content.Shared.Damage.Systems;
using Content.Shared.Database;
using Content.Shared.Inventory;
using Robust.Shared.Network;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems;
using Content.Shared.Popups;
using Content.Shared.StatusEffect;
using Content.Shared.StatusEffectNew;
using Content.Shared.StepTrigger.Systems;
using Content.Shared.Stunnable;
using Content.Shared.Throwing;
@@ -16,7 +14,6 @@ using Robust.Shared.Containers;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Physics.Events;
using Robust.Shared.Utility;
namespace Content.Shared.Slippery;
@@ -27,8 +24,8 @@ public sealed class SlipperySystem : EntitySystem
[Dependency] private readonly MovementModStatusSystem _movementMod = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedStunSystem _stun = default!;
[Dependency] private readonly StatusEffectsSystem _status = 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!;
[Dependency] private readonly SpeedModifierContactsSystem _speedModifier = default!;
@@ -90,7 +87,7 @@ public sealed class SlipperySystem : EntitySystem
private bool CanSlip(EntityUid uid, EntityUid toSlip)
{
return !_container.IsEntityInContainer(uid)
&& _statusEffects.CanApplyEffect(toSlip, "Stun"); //Should be KnockedDown instead?
&& _status.CanAddStatusEffect(toSlip, SharedStunSystem.StunId); //Should be KnockedDown instead?
}
public void TrySlip(EntityUid uid, SlipperyComponent component, EntityUid other, bool requiresContact = true)
@@ -125,12 +122,18 @@ public sealed class SlipperySystem : EntitySystem
// 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);
_stun.TryUpdateStunDuration(other, component.SlipData.StunTime);
_stamina.TakeStaminaDamage(other, component.StaminaDamage); // Note that this can stamCrit
_movementMod.TryFriction(other, component.FrictionStatusTime, true, component.SlipData.SlipFriction, component.SlipData.SlipFriction);
_movementMod.TryUpdateFrictionModDuration(
other,
component.FrictionStatusTime,
component.SlipData.SlipFriction,
component.SlipData.SlipFriction
);
_audio.PlayPredicted(component.SlipSound, other, other);
}
_stun.TryKnockdown(other, component.SlipData.KnockdownTime, true, true);
_stun.TryKnockdown(other, component.SlipData.KnockdownTime, true, force: true);
_adminLogger.Add(LogType.Slip, LogImpact.Low, $"{ToPrettyString(other):mob} slipped on collision with {ToPrettyString(uid):entity}");
}