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 <slambamactionman@gmail.com>
This commit is contained in:
metalgearsloth 2025-12-08 03:35:06 +11:00 committed by Vanessa
parent 4530e78e86
commit 6a8e307679
3 changed files with 8 additions and 3 deletions

View File

@ -220,7 +220,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.

View 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;
@ -438,7 +443,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);

View File

@ -85,7 +85,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