// slightly uneven, doesn't really change much, but it looks better
var direction = angle.ToVec().Normalized();
var velocity = _random.NextVector2(component.MinVelocity, component.MaxVelocity);
- _gun.ShootProjectile(contentUid, direction, velocity, uid, null);
+ _gun.ShootProjectile(contentUid, direction, velocity, null);
}
}
EntityUid? user = null,
bool throwItems = false);
- public void ShootProjectile(EntityUid uid, Vector2 direction, Vector2 gunVelocity, EntityUid gunUid, EntityUid? user = null, float speed = 20f)
+ public void ShootProjectile(EntityUid uid, Vector2 direction, Vector2 gunVelocity, EntityUid? gunUid, EntityUid? user = null, float speed = 20f)
{
var physics = EnsureComp<PhysicsComponent>(uid);
Physics.SetBodyStatus(uid, physics, BodyStatus.InAir);
Physics.SetLinearVelocity(uid, finalLinear, body: physics);
var projectile = EnsureComp<ProjectileComponent>(uid);
- Projectiles.SetShooter(uid, projectile, user ?? gunUid);
projectile.Weapon = gunUid;
+ var shooter = user ?? gunUid;
+ if (shooter != null)
+ Projectiles.SetShooter(uid, projectile, shooter.Value);
TransformSystem.SetWorldRotation(uid, direction.ToWorldAngle() + projectile.Angle);
}