From 51b7af73f76e82fac4f5cfedc1ae2846a5cab0ff Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 8 Dec 2025 03:35:06 +1100 Subject: [PATCH] Double bullet speeds (#34971) * 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 --- Content.Shared/Weapons/Ranged/Components/GunComponent.cs | 2 +- Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs | 7 ++++++- .../Objects/Weapons/Guns/Projectiles/projectiles.yml | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Content.Shared/Weapons/Ranged/Components/GunComponent.cs b/Content.Shared/Weapons/Ranged/Components/GunComponent.cs index 3ec832613d..8dfc324207 100644 --- a/Content.Shared/Weapons/Ranged/Components/GunComponent.cs +++ b/Content.Shared/Weapons/Ranged/Components/GunComponent.cs @@ -212,7 +212,7 @@ public sealed partial class GunComponent : Component /// The base value for how fast the projectile moves. /// [DataField] - public float ProjectileSpeed = 25f; + public float ProjectileSpeed = SharedGunSystem.ProjectileSpeed; /// /// How fast the projectile moves. diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index e9170d45df..2061392200 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -67,6 +67,11 @@ public abstract partial class SharedGunSystem : EntitySystem [Dependency] private readonly UseDelaySystem _useDelay = default!; [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; + /// + /// Default projectile speed + /// + public const float ProjectileSpeed = 40f; + private static readonly ProtoId 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(uid); Physics.SetBodyStatus(uid, physics, BodyStatus.InAir); diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml index ee6b9abf39..6b6f447f6d 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml @@ -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 -- 2.52.0