Skip to content

Commit

Permalink
fix: Account for EnforceLegal check in RequireCycle
Browse files Browse the repository at this point in the history
  • Loading branch information
psyGamer committed Feb 4, 2025
1 parent b339cac commit bac825e
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,18 @@ private static void RequireCycle(CommandLine commandLine, int studioLine, string
AbortTas($"Cycle mode '{nameof(CycleType.TimeActiveInterval)}' needs to be inside a level");
return;
}
if (EnforceLegalCommand.EnabledWhenRunning) {
if (!level.OnInterval(interval, offset)) {
AbortTas("Cycle condition did was not met");
}
return;
}

var data = cycleData[name];

// First guess the amount of frames we need to wait for the desired interval
// Then validate and adjust to the correct value by applying the entire delta-time chain since the WaitCycle
// This is required because of floating point precision inaccuracies potentially causing issues
// This is required because doing "+= DeltaTime * wait" could lead to floating point precision inaccuracies potentially causing issues

// Exact copy from Scene.OnInterval
static bool OnInterval(float timeActive, float interval, float offset) {
Expand Down

0 comments on commit bac825e

Please sign in to comment.