using Content.Shared.Physics; using Content.Shared.Tag; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; namespace Content.Shared.Singularity.Components; [RegisterComponent, NetworkedComponent] public sealed partial class ContainmentFieldGeneratorComponent : Component { private int _powerBuffer; /// /// Store power with a cap. Decrease over time if not being powered from source. /// [DataField("powerBuffer")] public int PowerBuffer { get => _powerBuffer; set => _powerBuffer = Math.Clamp(value, 0, 25); //have this decrease over time if not hit by a bolt } /// /// The minimum the field generator needs to start generating a connection /// [ViewVariables(VVAccess.ReadWrite)] [DataField("powerMinimum")] public int PowerMinimum = 6; /// /// How much power should this field generator receive from a collision /// [ViewVariables(VVAccess.ReadWrite)] [DataField("power")] public int PowerReceived = 3; /// /// How much power should this field generator lose if not powered? /// [ViewVariables(VVAccess.ReadWrite)] [DataField("powerLoss")] public int PowerLoss = 2; /// /// Used to check if it's received power recently. /// [DataField("accumulator")] public float Accumulator; /// /// How many seconds should the generators wait before losing power? /// [DataField("threshold")] public float Threshold = 20f; /// /// How many tiles should this field check before giving up? /// [DataField("maxLength")] public float MaxLength = 8F; /// /// What collision should power this generator? /// It really shouldn't be anything but an emitter bolt but it's here for fun. /// [ViewVariables(VVAccess.ReadWrite)] [DataField("idTag", customTypeSerializer: typeof(PrototypeIdSerializer))] public string IDTag = "EmitterBolt"; /// /// Which fixture ID should test collision with from the entity that powers the generator? /// Prevents the generator from being powered by fly-by fixtures. /// [DataField] public string SourceFixtureId = "projectile"; /// /// Is the generator toggled on? /// [ViewVariables] public bool Enabled; /// /// Is this generator connected to fields? /// [ViewVariables(VVAccess.ReadWrite)] public bool IsConnected; /// /// The masks the raycast should not go through /// [DataField("collisionMask")] public int CollisionMask = (int) (CollisionGroup.MobMask | CollisionGroup.Impassable | CollisionGroup.MachineMask | CollisionGroup.Opaque); /// /// A collection of connections that the generator has based on direction. /// Stores a list of fields connected between generators in this direction. /// [ViewVariables] public Dictionary, List)> Connections = new(); /// /// What fields should this spawn? /// [ViewVariables(VVAccess.ReadWrite)] [DataField("createdField", customTypeSerializer: typeof(PrototypeIdSerializer))] public string CreatedField = "ContainmentField"; } [Serializable, NetSerializable] public enum ContainmentFieldGeneratorVisuals : byte { PowerLight, FieldLight, OnLight, } [Serializable, NetSerializable] public enum PowerLevelVisuals : byte { NoPower, LowPower, MediumPower, HighPower, } [Serializable, NetSerializable] public enum FieldLevelVisuals : byte { NoLevel, On, OneField, MultipleFields, }