Fixes taser bolts not moving when being shot
This commit is contained in:
@@ -21,7 +21,7 @@ namespace Content.Server.GameObjects.Components.Items
|
|||||||
/// <param name="pushbackRatio">The ratio of impulse applied to the thrower</param>
|
/// <param name="pushbackRatio">The ratio of impulse applied to the thrower</param>
|
||||||
internal static void TryThrow(this IEntity entity, Vector2 direction, IEntity? user = null, float pushbackRatio = 1.0f)
|
internal static void TryThrow(this IEntity entity, Vector2 direction, IEntity? user = null, float pushbackRatio = 1.0f)
|
||||||
{
|
{
|
||||||
if (direction == Vector2.Zero || !entity.TryGetComponent(out PhysicsComponent? physicsComponent))
|
if (entity.Deleted || direction == Vector2.Zero || !entity.TryGetComponent(out PhysicsComponent? physicsComponent))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Content.Shared.GameObjects.Components.Damage;
|
|||||||
using Content.Shared.GameObjects.Components.Weapons.Ranged;
|
using Content.Shared.GameObjects.Components.Weapons.Ranged;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
|
using Robust.Shared.Asynchronous;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -364,9 +365,16 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
|
|||||||
var projectileComponent = projectile.GetComponent<ProjectileComponent>();
|
var projectileComponent = projectile.GetComponent<ProjectileComponent>();
|
||||||
projectileComponent.IgnoreEntity(shooter);
|
projectileComponent.IgnoreEntity(shooter);
|
||||||
|
|
||||||
|
// FIXME: Work around issue where inserting and removing an entity from a container,
|
||||||
|
// then setting its linear velocity in the same tick resets velocity back to zero.
|
||||||
|
// See SharedBroadPhaseSystem.HandleContainerInsert()... It sets Awake to false, which causes this.
|
||||||
|
projectile.SpawnTimer(TimeSpan.FromMilliseconds(25), () =>
|
||||||
|
{
|
||||||
projectile
|
projectile
|
||||||
.GetComponent<IPhysBody>()
|
.GetComponent<IPhysBody>()
|
||||||
.LinearVelocity = projectileAngle.ToVec() * velocity;
|
.LinearVelocity = projectileAngle.ToVec() * velocity;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
projectile.Transform.LocalRotation = projectileAngle + MathHelper.PiOver2;
|
projectile.Transform.LocalRotation = projectileAngle + MathHelper.PiOver2;
|
||||||
}
|
}
|
||||||
|
|||||||
4
Resources/Changelog/Parts/taser.yml
Normal file
4
Resources/Changelog/Parts/taser.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
author: Zumorica
|
||||||
|
changes:
|
||||||
|
- type: Fix
|
||||||
|
message: Fixes taser bolts not moving after being fired.
|
||||||
Reference in New Issue
Block a user