mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-24 09:08:04 +03:00
* шприцеметы епта * Update PacifismAllowedGunComponent.cs * фикс * Update tags.yml * Update lathe.yml
40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
using Content.Server.Chemistry.Components;
|
|
using Content.Shared._Goobstation.Weapons.Ranged;
|
|
using Content.Shared.Weapons.Ranged.Events;
|
|
using Content.Shared.Weapons.Ranged.Systems;
|
|
|
|
namespace Content.Server._Goobstation.Weapons.Ranged;
|
|
|
|
/// <summary>
|
|
/// System for handling projectiles and altering their properties when fired from a Syringe Gun.
|
|
/// </summary>
|
|
public sealed class SyringeGunSystem : EntitySystem
|
|
{
|
|
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<SyringeGunComponent, AmmoShotEvent>(OnFire);
|
|
SubscribeLocalEvent<SyringeGunComponent, AttemptShootEvent>(OnShootAttempt);
|
|
}
|
|
|
|
private void OnShootAttempt(Entity<SyringeGunComponent> ent, ref AttemptShootEvent args)
|
|
{
|
|
args.ThrowItems = true;
|
|
}
|
|
|
|
private void OnFire(Entity<SyringeGunComponent> gun, ref AmmoShotEvent args)
|
|
{
|
|
foreach (var projectile in args.FiredProjectiles)
|
|
{
|
|
if (TryComp(projectile, out SolutionInjectWhileEmbeddedComponent? whileEmbedded))
|
|
{
|
|
whileEmbedded.Injections = null; // uncap the injection maximum
|
|
whileEmbedded.PierceArmorOverride = gun.Comp.PierceArmor;
|
|
whileEmbedded.SpeedMultiplier = gun.Comp.InjectionSpeedMultiplier; // store it in the component to reset it
|
|
whileEmbedded.UpdateInterval /= whileEmbedded.SpeedMultiplier;
|
|
}
|
|
if (TryComp(projectile, out SolutionInjectOnEmbedComponent? onEmbed))
|
|
onEmbed.PierceArmorOverride = gun.Comp.PierceArmor;
|
|
}
|
|
}
|
|
} |