From 8b154899b515e0d7552d283c3086c417ae00ab7c Mon Sep 17 00:00:00 2001 From: MilenVolf <63782763+MilenVolf@users.noreply.github.com> Date: Tue, 12 Nov 2024 22:11:02 +0300 Subject: [PATCH] Allow editing angle of the fired projectile (#33254) Add Angle datafield to `ProjectileComponent`. It allows to change the angle of the fired projectile --- Content.Shared/Projectiles/ProjectileComponent.cs | 6 ++++++ Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) 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); -- 2.52.0