Nerf bullet impulses (#14145)
This commit is contained in:
@@ -38,7 +38,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||||||
[Dependency] private readonly StunSystem _stun = default!;
|
[Dependency] private readonly StunSystem _stun = default!;
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
|
|
||||||
public const float DamagePitchVariation = MeleeWeaponSystem.DamagePitchVariation;
|
public const float DamagePitchVariation = SharedMeleeWeaponSystem.DamagePitchVariation;
|
||||||
public const float GunClumsyChance = 0.5f;
|
public const float GunClumsyChance = 0.5f;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
|
|||||||
@@ -40,18 +40,18 @@ public abstract partial class SharedGunSystem : EntitySystem
|
|||||||
[Dependency] protected readonly IRobustRandom Random = default!;
|
[Dependency] protected readonly IRobustRandom Random = default!;
|
||||||
[Dependency] protected readonly ISharedAdminLogManager Logs = default!;
|
[Dependency] protected readonly ISharedAdminLogManager Logs = default!;
|
||||||
[Dependency] protected readonly DamageableSystem Damageable = default!;
|
[Dependency] protected readonly DamageableSystem Damageable = default!;
|
||||||
[Dependency] private readonly SharedGravitySystem Gravity = default!;
|
[Dependency] protected readonly ExamineSystemShared Examine = default!;
|
||||||
[Dependency] private readonly ItemSlotsSystem _slots = default!;
|
[Dependency] private readonly ItemSlotsSystem _slots = default!;
|
||||||
[Dependency] protected readonly SharedActionsSystem Actions = default!;
|
[Dependency] protected readonly SharedActionsSystem Actions = default!;
|
||||||
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
|
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
|
||||||
[Dependency] private readonly SharedCombatModeSystem _combatMode = default!;
|
[Dependency] private readonly SharedCombatModeSystem _combatMode = default!;
|
||||||
[Dependency] protected readonly SharedContainerSystem Containers = default!;
|
[Dependency] protected readonly SharedContainerSystem Containers = default!;
|
||||||
[Dependency] protected readonly ExamineSystemShared Examine = default!;
|
|
||||||
[Dependency] protected readonly SharedPhysicsSystem Physics = default!;
|
[Dependency] protected readonly SharedPhysicsSystem Physics = default!;
|
||||||
[Dependency] protected readonly SharedPopupSystem PopupSystem = default!;
|
[Dependency] protected readonly SharedPopupSystem PopupSystem = default!;
|
||||||
[Dependency] protected readonly ThrowingSystem ThrowingSystem = default!;
|
[Dependency] protected readonly ThrowingSystem ThrowingSystem = default!;
|
||||||
[Dependency] protected readonly TagSystem TagSystem = default!;
|
[Dependency] protected readonly TagSystem TagSystem = default!;
|
||||||
[Dependency] protected readonly SharedAudioSystem Audio = default!;
|
[Dependency] protected readonly SharedAudioSystem Audio = default!;
|
||||||
|
[Dependency] private readonly SharedGravitySystem _gravity = default!;
|
||||||
[Dependency] protected readonly SharedProjectileSystem Projectiles = default!;
|
[Dependency] protected readonly SharedProjectileSystem Projectiles = default!;
|
||||||
|
|
||||||
protected ISawmill Sawmill = default!;
|
protected ISawmill Sawmill = default!;
|
||||||
@@ -301,7 +301,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
|||||||
// Projectiles cause impulses especially important in non gravity environments
|
// Projectiles cause impulses especially important in non gravity environments
|
||||||
if (TryComp<PhysicsComponent>(user, out var userPhysics))
|
if (TryComp<PhysicsComponent>(user, out var userPhysics))
|
||||||
{
|
{
|
||||||
if (Gravity.IsWeightless(user, userPhysics))
|
if (_gravity.IsWeightless(user, userPhysics))
|
||||||
CauseImpulse(fromCoordinates, toCoordinates.Value, userPhysics);
|
CauseImpulse(fromCoordinates, toCoordinates.Value, userPhysics);
|
||||||
}
|
}
|
||||||
Dirty(gun);
|
Dirty(gun);
|
||||||
@@ -391,7 +391,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
|||||||
var toMap = toCoordinates.ToMapPos(EntityManager);
|
var toMap = toCoordinates.ToMapPos(EntityManager);
|
||||||
var shotDirection = (toMap - fromMap).Normalized;
|
var shotDirection = (toMap - fromMap).Normalized;
|
||||||
|
|
||||||
const float impulseStrength = 85.0f; //The bullet impulse strength, TODO: In the future we might want to make it more projectile dependent
|
const float impulseStrength = 5.0f;
|
||||||
var impulseVector = shotDirection * impulseStrength;
|
var impulseVector = shotDirection * impulseStrength;
|
||||||
Physics.ApplyLinearImpulse(userPhysics.Owner, -impulseVector, body: userPhysics);
|
Physics.ApplyLinearImpulse(userPhysics.Owner, -impulseVector, body: userPhysics);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user