using Godot; using Nocturnis.DataStructures.ConfigurableParameters; using Nocturnis.Enigmos.Modules; using Nocturnis.Enigmos.Modules.ComputationalModules; using Nocturnis.Enigmos.Ports; using Nocturnis.GlobalManagement.Constants; using Nocturnis.GlobalManagement.Providers; namespace Enigmos.Modules.ComputationalModules.Nullary; public partial class ConstantModule : NullaryComputationalModule, IParameterizedModule, IDuplicateOutputModule { [Export] private double PresetConstantValue { get; set; } public override IEnumerable Ports => base.Ports.Union(DataOutPorts); private IDoubleParameter? ConstValue { get; set; } public override void Init() { base.Init(); this.DataOutInit("Output", 4); this.SetOutputType(EnigmosConstant.DataPortTypes.Real); ConstValue = GlobalProvider.DataStructureProvider!.NewDoubleParameter( "Constant Value", -1, 1, UsingPreset ? PresetConstantValue : 0 ); ConfigurableParameters = new HashSet { ConstValue }; PostInit(); } public override void Define() { this.Define(cache => (ConstValue!.ParameterValue, EnigmosConstant.DataPortTypes.Real) ); } public HashSet ConfigurableParameters { get; set; } = new(); }