]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Double bullet speeds (#34971)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Sun, 7 Dec 2025 16:35:06 +0000 (03:35 +1100)
committerGitHub <noreply@github.com>
Sun, 7 Dec 2025 16:35:06 +0000 (16:35 +0000)
* Double bullet speeds

The only reason we had it at 20m/s was tunneling reasons.

The quick maths is (BodyA size + BodyB size) / frametime. Currently the game is doing substepping AFAIK so we can use 0.016 as the frametime therefore with a 0.40 width body we can get up to 40.625 (assuming the target is no narrower than 0.25 which given my thindows change last year should be a decently safe assumption).

* Fix

* Fix impact visuals, as they overshoot otherwise

* Revert changes

---------

Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
Content.Shared/Weapons/Ranged/Components/GunComponent.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs
Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml

index 3ec832613d2e01cab0fca5cdd832c54a4e3b0a93..8dfc32420750f7f8881b1a11eca6c04840446090 100644 (file)
@@ -212,7 +212,7 @@ public sealed partial class GunComponent : Component
     /// The base value for how fast the projectile moves.
     /// </summary>
     [DataField]
-    public float ProjectileSpeed = 25f;
+    public float ProjectileSpeed = SharedGunSystem.ProjectileSpeed;
 
     /// <summary>
     /// How fast the projectile moves.
index e9170d45dfda0c13ec148ef5fab91d6224ce3220..2061392200c3a32474db5aef3485cae7518cf6af 100644 (file)
@@ -67,6 +67,11 @@ public abstract partial class SharedGunSystem : EntitySystem
     [Dependency] private   readonly UseDelaySystem _useDelay = default!;
     [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
 
+    /// <summary>
+    /// Default projectile speed
+    /// </summary>
+    public const float ProjectileSpeed = 40f;
+
     private static readonly ProtoId<TagPrototype> TrashTag = "Trash";
 
     private const float InteractNextFire = 0.3f;
@@ -423,7 +428,7 @@ public abstract partial class SharedGunSystem : EntitySystem
         EntityUid? user = null,
         bool throwItems = false);
 
-    public void ShootProjectile(EntityUid uid, Vector2 direction, Vector2 gunVelocity, EntityUid? gunUid, EntityUid? user = null, float speed = 20f)
+    public void ShootProjectile(EntityUid uid, Vector2 direction, Vector2 gunVelocity, EntityUid? gunUid, EntityUid? user = null, float speed = ProjectileSpeed)
     {
         var physics = EnsureComp<PhysicsComponent>(uid);
         Physics.SetBodyStatus(uid, physics, BodyStatus.InAir);
index ee6b9abf39f69776a6badc1697e3ed5118f9c9dc..6b6f447f6d7fbd22552df38f5fdbd48f4832e818 100644 (file)
@@ -70,7 +70,7 @@
       projectile:
         shape:
           !type:PhysShapeAabb
-          bounds: "-0.1,-0.1,0.1,0.1"
+          bounds: "-0.1,-0.10,0.1,0.30"
         hard: false
         mask:
         - Impassable