2020-10-28 19:19:47 +01:00
|
|
|
using System;
|
|
|
|
|
using System.Threading;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Power.Components;
|
2021-12-26 17:07:28 +13:00
|
|
|
using Content.Shared.Access.Components;
|
2021-07-10 17:35:33 +02:00
|
|
|
using Content.Shared.Sound;
|
2020-10-28 19:19:47 +01:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-03-05 01:08:38 +01:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-10-28 19:19:47 +01:00
|
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
|
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Singularity.Components
|
2020-10-28 19:19:47 +01:00
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class EmitterComponent : Component
|
2020-10-28 19:19:47 +01:00
|
|
|
{
|
2021-07-24 13:42:05 +02:00
|
|
|
public CancellationTokenSource? TimerCancel;
|
2020-10-28 19:19:47 +01:00
|
|
|
|
|
|
|
|
// whether the power switch is in "on"
|
2021-07-24 13:42:05 +02:00
|
|
|
[ViewVariables] public bool IsOn;
|
2020-10-28 19:19:47 +01:00
|
|
|
// Whether the power switch is on AND the machine has enough power (so is actively firing)
|
2021-07-24 13:42:05 +02:00
|
|
|
[ViewVariables] public bool IsPowered;
|
2020-10-28 19:19:47 +01:00
|
|
|
|
2021-03-14 15:02:22 -07:00
|
|
|
// For the "emitter fired" sound
|
2021-07-24 13:42:05 +02:00
|
|
|
public const float Variation = 0.25f;
|
|
|
|
|
public const float Volume = 0.5f;
|
|
|
|
|
public const float Distance = 3f;
|
2020-10-28 19:19:47 +01:00
|
|
|
|
2021-07-24 13:42:05 +02:00
|
|
|
[ViewVariables] public int FireShotCounter;
|
2020-10-28 19:19:47 +01:00
|
|
|
|
2021-08-10 16:18:57 -07:00
|
|
|
[ViewVariables] [DataField("fireSound")] public SoundSpecifier FireSound = new SoundPathSpecifier("/Audio/Weapons/emitter.ogg");
|
2021-07-24 13:42:05 +02:00
|
|
|
[ViewVariables] [DataField("boltType")] public string BoltType = "EmitterBolt";
|
|
|
|
|
[ViewVariables] [DataField("powerUseActive")] public int PowerUseActive = 500;
|
|
|
|
|
[ViewVariables] [DataField("fireBurstSize")] public int FireBurstSize = 3;
|
|
|
|
|
[ViewVariables] [DataField("fireInterval")] public TimeSpan FireInterval = TimeSpan.FromSeconds(2);
|
|
|
|
|
[ViewVariables] [DataField("fireBurstDelayMin")] public TimeSpan FireBurstDelayMin = TimeSpan.FromSeconds(2);
|
|
|
|
|
[ViewVariables] [DataField("fireBurstDelayMax")] public TimeSpan FireBurstDelayMax = TimeSpan.FromSeconds(10);
|
2020-10-28 19:19:47 +01:00
|
|
|
}
|
|
|
|
|
}
|