Esempio n. 1
0
        private void TrySlip(SlipperyComponent component, EntityUid other)
        {
            if (HasComp <KnockedDownComponent>(other))
            {
                return;
            }

            var ev = new SlipAttemptEvent();

            RaiseLocalEvent(other, ev, false);
            if (ev.Cancelled)
            {
                return;
            }

            if (TryComp(other, out PhysicsComponent? physics))
            {
                physics.LinearVelocity *= component.LaunchForwardsMultiplier;
            }

            var playSound = !_statusEffectsSystem.HasStatusEffect(other, "KnockedDown");

            _stunSystem.TryParalyze(other, TimeSpan.FromSeconds(component.ParalyzeTime), true);

            // Preventing from playing the slip sound when you are already knocked down.
            if (playSound)
            {
                PlaySound(component);
            }

            _adminLogger.Add(LogType.Slip, LogImpact.Low,
                             $"{ToPrettyString(other):mob} slipped on collision with {ToPrettyString(component.Owner):entity}");
        }
Esempio n. 2
0
 private static void OnNoSlipAttempt(EntityUid uid, NoSlipComponent component, SlipAttemptEvent args)
 {
     args.Cancel();
 }