From: MilenVolf <63782763+MilenVolf@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:11:02 +0000 (+0300) Subject: Allow editing angle of the fired projectile (#33254) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=8b154899b515e0d7552d283c3086c417ae00ab7c;p=space-station-14.git Allow editing angle of the fired projectile (#33254) Add Angle datafield to `ProjectileComponent`. It allows to change the angle of the fired projectile --- diff --git a/Content.Shared/Projectiles/ProjectileComponent.cs b/Content.Shared/Projectiles/ProjectileComponent.cs index c24cf2b5ee..8349252df2 100644 --- a/Content.Shared/Projectiles/ProjectileComponent.cs +++ b/Content.Shared/Projectiles/ProjectileComponent.cs @@ -8,6 +8,12 @@ namespace Content.Shared.Projectiles; [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] public sealed partial class ProjectileComponent : Component { + /// + /// The angle of the fired projectile. + /// + [DataField, AutoNetworkedField] + public Angle Angle; + /// /// The effect that appears when a projectile collides with an entity. /// diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index 9bd786bbe0..c7cc09e618 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -429,7 +429,7 @@ public abstract partial class SharedGunSystem : EntitySystem Projectiles.SetShooter(uid, projectile, user ?? gunUid); projectile.Weapon = gunUid; - TransformSystem.SetWorldRotation(uid, direction.ToWorldAngle()); + TransformSystem.SetWorldRotation(uid, direction.ToWorldAngle() + projectile.Angle); } protected abstract void Popup(string message, EntityUid? uid, EntityUid? user);