diff --git a/Content.Server/Singularity/Components/EmitterComponent.cs b/Content.Server/Singularity/Components/EmitterComponent.cs
index f2d8dff5e8..817725e5ec 100644
--- a/Content.Server/Singularity/Components/EmitterComponent.cs
+++ b/Content.Server/Singularity/Components/EmitterComponent.cs
@@ -15,20 +15,12 @@ namespace Content.Server.Singularity.Components
// Whether the power switch is on AND the machine has enough power (so is actively firing)
[ViewVariables] public bool IsPowered;
- // For the "emitter fired" sound
- public const float Variation = 0.25f;
- public const float Volume = 0.5f;
- public const float Distance = 6f;
-
///
/// counts the number of consecutive shots fired.
///
[ViewVariables]
public int FireShotCounter;
- [DataField("fireSound")]
- public SoundSpecifier FireSound = new SoundPathSpecifier("/Audio/Weapons/emitter.ogg");
-
///
/// The entity that is spawned when the emitter fires.
///
diff --git a/Content.Server/Singularity/EntitySystems/EmitterSystem.cs b/Content.Server/Singularity/EntitySystems/EmitterSystem.cs
index ad0facaf3a..862c31f987 100644
--- a/Content.Server/Singularity/EntitySystems/EmitterSystem.cs
+++ b/Content.Server/Singularity/EntitySystems/EmitterSystem.cs
@@ -6,16 +6,17 @@ using Content.Server.Power.EntitySystems;
using Content.Server.Projectiles;
using Content.Server.Singularity.Components;
using Content.Server.Storage.Components;
+using Content.Server.Weapons.Ranged.Systems;
using Content.Shared.Database;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Content.Shared.Projectiles;
using Content.Shared.Singularity.Components;
+using Content.Shared.Weapons.Ranged.Components;
using JetBrains.Annotations;
-using Robust.Shared.Audio;
+using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
-using Robust.Shared.Physics.Systems;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using Timer = Robust.Shared.Timing.Timer;
@@ -28,10 +29,9 @@ namespace Content.Server.Singularity.EntitySystems
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
- [Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly ProjectileSystem _projectile = default!;
- [Dependency] private readonly SharedPhysicsSystem _physics = default!;
+ [Dependency] private readonly GunSystem _gun = default!;
public override void Initialize()
{
@@ -207,33 +207,16 @@ namespace Content.Server.Singularity.EntitySystems
private void Fire(EmitterComponent component)
{
var uid = component.Owner;
- var projectile = EntityManager.SpawnEntity(component.BoltType, EntityManager.GetComponent(uid).Coordinates);
-
- if (!EntityManager.TryGetComponent(projectile, out var physicsComponent))
- {
- Logger.Error("Emitter tried firing a bolt, but it was spawned without a PhysicsComponent");
+ if (!TryComp(uid, out var guncomp))
return;
- }
- physicsComponent.BodyStatus = BodyStatus.InAir;
+ var xform = Transform(uid);
+ var ent = Spawn(component.BoltType, xform.Coordinates);
+ var proj = EnsureComp(ent);
+ _projectile.SetShooter(proj, uid);
- if (!EntityManager.TryGetComponent(projectile, out var projectileComponent))
- {
- Logger.Error("Emitter tried firing a bolt, but it was spawned without a ProjectileComponent");
- return;
- }
-
- _projectile.SetShooter(projectileComponent, component.Owner);
-
- var worldRotation = Transform(uid).WorldRotation;
- _physics.SetLinearVelocity(physicsComponent, worldRotation.ToWorldVec() * 20f);
- Transform(projectile).WorldRotation = worldRotation;
-
- // TODO: Move to projectile's code.
- Timer.Spawn(3000, () => EntityManager.DeleteEntity(projectile));
-
- _audio.PlayPvs(component.FireSound, component.Owner,
- AudioParams.Default.WithVariation(EmitterComponent.Variation).WithVolume(EmitterComponent.Volume).WithMaxDistance(EmitterComponent.Distance));
+ var targetPos = new EntityCoordinates(uid, (0, -1));
+ _gun.Shoot(guncomp, ent, xform.Coordinates, targetPos);
}
private void UpdateAppearance(EmitterComponent component)
diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml
index fa6b2282b0..8101d4246c 100644
--- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml
+++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml
@@ -222,6 +222,7 @@
- state: projectile
shader: unshaded
- type: Ammo
+ muzzleFlash: null
- type: Physics
- type: Fixtures
fixtures:
@@ -242,6 +243,8 @@
- type: Tag
tags:
- EmitterBolt
+ - type: TimedDespawn
+ lifetime: 3
- type: entity
id: BulletKinetic
diff --git a/Resources/Prototypes/Entities/Structures/Power/Generation/Singularity/emitter.yml b/Resources/Prototypes/Entities/Structures/Power/Generation/Singularity/emitter.yml
index 9f73d3e65c..2838bc8eaa 100644
--- a/Resources/Prototypes/Entities/Structures/Power/Generation/Singularity/emitter.yml
+++ b/Resources/Prototypes/Entities/Structures/Power/Generation/Singularity/emitter.yml
@@ -34,6 +34,13 @@
shader: unshaded
visible: false
- type: Emitter
+ - type: Gun
+ fireRate: 10 #just has to be fast enough to keep up with upgrades
+ selectedMode: SemiAuto
+ availableModes:
+ - SemiAuto
+ soundGunshot:
+ path: /Audio/Weapons/emitter.ogg
- type: PowerConsumer
voltage: Medium
- type: NodeContainer