OneMoreRoundWeapon.Ballistics.cs
using Sandbox;
/// <summary>
/// OMR-specific bullet collision policy.
///
/// PlayerController movement colliders are intentionally broader/simpler than
/// the animated Citizen body. They are correct for locomotion, but they should
/// not decide firearm hits. OMR tags those movement colliders as
/// "playercontroller" and excludes only that tag from firearm traces, leaving
/// model hitboxes enabled through BaseCombatWeapon's normal BulletTrace path.
/// </summary>
public partial class OneMoreRoundWeapon
{
/// <summary>
/// Ignore the holder movement/controller collision shapes when resolving
/// firearm hits. Keep this enabled for normal OMR weapons so the animated
/// model hitboxes, rather than the locomotion capsule/box, define the target.
/// </summary>
[Property, Group( "Ballistics" ), Title( "Ignore Player Movement Colliders" )]
public bool IgnorePlayerMovementColliders { get; set; } = true;
/// <summary>
/// Extend BaseCombatWeapon's trace instead of rebuilding it. This preserves
/// the engine's attacker-hierarchy ignore, hitbox usage, radius handling and
/// any future BaseCombatWeapon trace behavior, while adding only OMR's
/// movement-collider exclusion.
/// </summary>
protected override SceneTrace BulletTrace(
Ray ray,
float distance,
float radius
)
{
SceneTrace trace =
base.BulletTrace(
ray,
distance,
radius
);
if ( IgnorePlayerMovementColliders )
{
trace =
trace.WithoutTags( "playercontroller" );
}
return trace;
}
}