]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Allow editing angle of the fired projectile (#33254)
authorMilenVolf <63782763+MilenVolf@users.noreply.github.com>
Tue, 12 Nov 2024 19:11:02 +0000 (22:11 +0300)
committerGitHub <noreply@github.com>
Tue, 12 Nov 2024 19:11:02 +0000 (20:11 +0100)
Add Angle datafield to `ProjectileComponent`. It allows to change the angle of the fired projectile

Content.Shared/Projectiles/ProjectileComponent.cs
Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs

index c24cf2b5ee548c7a9062e41c343701aa178c5575..8349252df2b71844c1d11265b503deb6d3cafa0d 100644 (file)
@@ -8,6 +8,12 @@ namespace Content.Shared.Projectiles;
 [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
 public sealed partial class ProjectileComponent : Component
 {
+    /// <summary>
+    ///     The angle of the fired projectile.
+    /// </summary>
+    [DataField, AutoNetworkedField]
+    public Angle Angle;
+
     /// <summary>
     ///     The effect that appears when a projectile collides with an entity.
     /// </summary>
index 9bd786bbe08f0f69f4f68397750b4ea82ddca2df..c7cc09e618bdb5a2eccece7902af6d01d73f2449 100644 (file)
@@ -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);