Allow editing angle of the fired projectile (#33254)
Add Angle datafield to `ProjectileComponent`. It allows to change the angle of the fired projectile
This commit is contained in:
@@ -8,6 +8,12 @@ namespace Content.Shared.Projectiles;
|
|||||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||||
public sealed partial class ProjectileComponent : Component
|
public sealed partial class ProjectileComponent : Component
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The angle of the fired projectile.
|
||||||
|
/// </summary>
|
||||||
|
[DataField, AutoNetworkedField]
|
||||||
|
public Angle Angle;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The effect that appears when a projectile collides with an entity.
|
/// The effect that appears when a projectile collides with an entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -429,7 +429,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
|||||||
Projectiles.SetShooter(uid, projectile, user ?? gunUid);
|
Projectiles.SetShooter(uid, projectile, user ?? gunUid);
|
||||||
projectile.Weapon = 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);
|
protected abstract void Popup(string message, EntityUid? uid, EntityUid? user);
|
||||||
|
|||||||
Reference in New Issue
Block a user