diff --git a/Content.Server/Projectiles/ProjectileSystem.cs b/Content.Server/Projectiles/ProjectileSystem.cs index 10e31d81c53..d59d802d518 100644 --- a/Content.Server/Projectiles/ProjectileSystem.cs +++ b/Content.Server/Projectiles/ProjectileSystem.cs @@ -8,6 +8,7 @@ using Content.Shared.Projectiles; using Robust.Shared.Physics.Events; using Robust.Shared.Player; +using Robust.Shared.Random; namespace Content.Server.Projectiles; @@ -18,11 +19,10 @@ public sealed class ProjectileSystem : SharedProjectileSystem [Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly GunSystem _guns = default!; [Dependency] private readonly SharedCameraRecoilSystem _sharedCameraRecoil = default!; + [Dependency] private readonly IRobustRandom _random = default!; private EntityQuery _penetratableQuery; - private Random _random = new(); - public override void Initialize() { base.Initialize(); @@ -73,7 +73,7 @@ private void OnStartCollide(EntityUid uid, ProjectileComponent component, ref St _sharedCameraRecoil.KickCamera(target, direction); } - // Corvax-Next-Penetration + // Corvax-Next-Penetration-Start if (component.PenetrationScore > 0 && _penetratableQuery.TryGetComponent(target, out var penetratable) && _random.Next(component.PenetrationScore + penetratable.StoppingPower) >= penetratable.StoppingPower) @@ -87,6 +87,7 @@ private void OnStartCollide(EntityUid uid, ProjectileComponent component, ref St if (component.DeleteOnCollide && component.DamagedEntity) QueueDel(uid); + // Corvax-Next-Penetration-End if (component.ImpactEffect != null && TryComp(uid, out TransformComponent? xform)) {