Skip to content

Commit

Permalink
Merge pull request #60 from psyGamer/midway-times
Browse files Browse the repository at this point in the history
Added midway chapter/file times
  • Loading branch information
DemoJameson authored Dec 13, 2023
2 parents ea100c7 + 23b1128 commit 2b843c7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using Celeste;
using Celeste.Mod;
using Monocle;
using TAS.Communication;
using TAS.Module;
using TAS.Utils;
Expand Down Expand Up @@ -67,12 +68,31 @@ private static void ChapterTimeCommand() {
// dummy
}

[TasCommand("MidwayFileTime", AliasNames = new[] {"MidwayFileTime:", "MidwayFileTime:"}, CalcChecksum = false)]
private static void MidwayFileTimeCommand() {
if (TasStartFileTime != null && SaveData.Instance != null) {
UpdateAllMetadata("MidwayFileTime",
_ => GameInfo.FormatTime(SaveData.Instance.Time - TasStartFileTime.Value),
command => Manager.Controller.CurrentCommands.Contains(command));
}
}

[TasCommand("MidwayChapterTime", AliasNames = new[] {"MidwayChapterTime:", "MidwayChapterTime:"}, CalcChecksum = false)]
private static void MidwayChapterTimeCommand() {
if (!Manager.Running || Engine.Scene is not Level level || !level.Session.StartedFromBeginning) {
return;
}
UpdateAllMetadata("MidwayChapterTime",
_ => GameInfo.GetChapterTime(level),
command => Manager.Controller.CurrentCommands.Contains(command));
}

private static void UpdateChapterTime(Level level) {
if (!Manager.Running || !level.Session.StartedFromBeginning) {
return;
}

UpdateAllMetadata("ChapterTime", command => GameInfo.GetChapterTime(level));
UpdateAllMetadata("ChapterTime", _ => GameInfo.GetChapterTime(level));
}

public static void UpdateRecordCount(InputController inputController) {
Expand Down
5 changes: 5 additions & 0 deletions Docs/Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ NOTE: These commands require [TAS Recorder](https://gamebanana.com/tools/14085)!
- e.g. `ChapterTime: 0:49.334(2902)`
- After completing the whole level from the beginning, auto updating the chapter time.

### MidwayFileTime / MidwayChapterTime
- e.g. `MidwayFileTime: 1:04.107(3771)`
- e.g. `MidwayChapterTime: 1:41.677(5981)`
- Same as `FileTime`/`ChapterTime`, except it updates when the command is executed.

### AnalogueMode
- `AnalogueMode, (Mode)`
- `AnalogMode, (Mode)` also works
Expand Down

0 comments on commit 2b843c7

Please sign in to comment.