42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
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 abstract partial class ConstantModule : NullaryComputationalModule, IParameterizedModule, IDuplicateOutputModule
|
|
{
|
|
|
|
[Export] private double PresetConstantValue { get; set; }
|
|
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<IConfigurableParameter> { ConstValue };
|
|
PostInit();
|
|
}
|
|
|
|
public override void Define()
|
|
{
|
|
this.Define(cache =>
|
|
(ConstValue!.ParameterValue, EnigmosConstant.DataPortTypes.Real)
|
|
);
|
|
}
|
|
|
|
public HashSet<IConfigurableParameter> ConfigurableParameters { get; set; } = new();
|
|
}
|