diff --git a/Quaver.API/Maps/Structures/ScrollSpeedFactorInfo.cs b/Quaver.API/Maps/Structures/ScrollSpeedFactorInfo.cs index 9dcbaf3f0..50341447c 100644 --- a/Quaver.API/Maps/Structures/ScrollSpeedFactorInfo.cs +++ b/Quaver.API/Maps/Structures/ScrollSpeedFactorInfo.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.Text; using MoonSharp.Interpreter; +using MoonSharp.Interpreter.Interop; +using YamlDotNet.Serialization; namespace Quaver.API.Maps.Structures { @@ -23,6 +25,50 @@ public class ScrollSpeedFactorInfo : IStartTime /// public float Multiplier { get; [MoonSharpHidden] set; } + /// + /// Returns if the SSF is allowed to be edited in lua scripts + /// + [YamlIgnore] + public bool IsEditableInLuaScript + { + get; + [MoonSharpVisible(false)] + set; + } + + /// + /// Sets the start time of the SSF. + /// FOR USE IN LUA SCRIPTS ONLY. + /// + /// + /// + public void SetStartTime(float time) + { + ThrowUneditableException(); + StartTime = time; + } + + /// + /// Sets the multiplier of the SSF. + /// FOR USE IN LUA SCRIPTS ONLY. + /// + /// + /// + public void SetMultiplier(float multiplier) + { + ThrowUneditableException(); + Multiplier = multiplier; + } + + /// + /// + /// + private void ThrowUneditableException() + { + if (!IsEditableInLuaScript) + throw new InvalidOperationException("Value is not allowed to be edited in lua scripts."); + } + private sealed class StartTimeRelationalComparer : IComparer { public int Compare(ScrollSpeedFactorInfo x, ScrollSpeedFactorInfo y)