Initial import of IC.Rebuild
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
namespace ICRebuild.Core;
|
||||
|
||||
// Session state only. Editing the saved preset never changes the applied height.
|
||||
public sealed class HeightActivation
|
||||
{
|
||||
private float applied;
|
||||
public float Applied => Volatile.Read(ref applied);
|
||||
public bool IsApplied => Applied!=0;
|
||||
public float Toggle(bool moduleEnabled,float preset)
|
||||
{
|
||||
if(!moduleEnabled || IsApplied) { Reset(); return 0; }
|
||||
var next=Policies.FiniteClamp(preset,-10,10);
|
||||
Volatile.Write(ref applied,next);
|
||||
return next;
|
||||
}
|
||||
public void Reset() => Volatile.Write(ref applied,0);
|
||||
}
|
||||
Reference in New Issue
Block a user