using Content.Shared.Materials; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared._NF.Manufacturing.Components; /// /// An entity with this will produce an entity over time after accumulating charge. /// Entities are output after a given amount of energy is accumulated. /// At high power input, energy accumulated diminishes logarithmically. /// [RegisterComponent, AutoGenerateComponentPause] public sealed partial class EntitySpawnPowerConsumerComponent : Component { #region Generation /// /// The name of the node to be connected/disconnected. /// [DataField(serverOnly: true)] public string NodeName = "input"; /// /// The period between depositing money into a sector account. /// Also the T in Tk*a^(log10(x/T)-R) for rate calculation /// [DataField(serverOnly: true)] public TimeSpan SpawnCheckPeriod = TimeSpan.FromSeconds(20); /// /// The next time this power plant is selling accumulated power. /// Should not be changedduring runtime, will cause errors in deposit amounts. /// [DataField(serverOnly: true, customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField] public TimeSpan NextSpawnCheck; /// /// The total energy accumulated, in joules. /// [DataField(serverOnly: true)] public float AccumulatedEnergy; /// /// The total energy accumulated this spawn check, in joules. /// [DataField(serverOnly: true)] public float AccumulatedSpawnCheckEnergy; /// /// The material to use, if any. /// [DataField(serverOnly: true)] public ProtoId? Material; /// /// The amount of material to use for one unit of output. /// [DataField(serverOnly: true)] public int MaterialAmount; /// /// If true, the machine is currently producing an entity, and has consumed any requisite materials. /// [DataField(serverOnly: true)] public bool Processing; /// /// The name of the container to output the created entity. /// [DataField(serverOnly: true)] public string SlotName = "output"; /// /// The entity prototype ID to spawn when enough energy is accumulated. /// [DataField(serverOnly: true, required: true)] public EntProtoId Spawn; /// /// The necessary energy to spawn a unit in the output slot. /// [DataField(serverOnly: true, required: true)] public float EnergyPerSpawn; #endregion Generation #region Efficiency Scaling /// /// The maximum power to increase without logarithmic reduction. /// [DataField(serverOnly: true)] public float LinearMaxValue = 3_000_000; /// /// The base on power the logarithmic mode: a in Tk*a^(log10(x/T)-R) /// [DataField(serverOnly: true)] public float LogarithmRateBase = 2.5f; /// /// The coefficient of the logarithmic mode: k in Tk*a^(log10(x/T)-R) /// Note: should be set to LinearMaxValue for a continuous function. /// [DataField(serverOnly: true)] public float LogarithmCoefficient = 3_000_000f; /// /// The exponential subtrahend of the logarithmic mode: R in Tk*a^(log10(x/T)-R) /// Note: should be set to log10(LinearMaxValue) for a continuous function. /// [DataField(serverOnly: true)] public float LogarithmSubtrahend = 6.0f; // log10(1_000_000) #endregion Efficiency Scaling /// /// Maximum effective power to store towards spawning an item. /// [DataField(serverOnly: true)] public float MaxEffectivePower = 15_000_000; // 80s per entity, ~910 MW /// /// The minimum requestable power. /// [DataField] public float MinimumRequestablePower = 500; // 500 W /// /// The maximum requestable power. /// [DataField] public float MaximumRequestablePower = 100_000_000_000; // 100 GW }