Skip to content

Commit

Permalink
Fixed a minor bug in 7A-3k with checkpoints 28 and 20 due to the fact…
Browse files Browse the repository at this point in the history
… that there is both a transition and a checkpoint trigger, might be still a bit janky #patch
  • Loading branch information
Paloys committed Sep 14, 2022
1 parent 8c0f63b commit 64e3c5d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
23 changes: 16 additions & 7 deletions GoldenTrainer/GoldenTrainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ public GoldenTrainerModule()
{
Instance = this;
}

// If you need to store settings:

public override Type SettingsType => typeof(GoldenTrainerSettings);
public static GoldenTrainerSettings Settings => (GoldenTrainerSettings)Instance._Settings;

private bool DeathCausedByMod { get; set; }

private bool TransitionedAfterTransitionToCheck { get; set; }

private int _completionCount;

Expand All @@ -46,8 +47,7 @@ public int CompletionCount
private int _latestSummitCheckpointTriggered = -1;

private ILHook _dieGoldenHook;



public override void Load()
{
Logger.SetLogLevel("GoldenTrainer", LogLevel.Verbose);
Expand Down Expand Up @@ -93,6 +93,7 @@ private void RespawnAtEnd(On.Celeste.Level.orig_TransitionTo orig, Level self, L
{
Player p = self.Tracker.GetEntity<Player>();
Instance.DeathCausedByMod = true;
Instance.TransitionedAfterTransitionToCheck = true;
p.Die(p.Position, true, false);
}
else
Expand Down Expand Up @@ -189,7 +190,8 @@ private void SummitCheckpointHandler(ILContext il)

private static bool SummitCheckpointUpdateHook(Player p, SummitCheckpoint self)
{
if (Instance._latestSummitCheckpointTriggered != self.Number && Settings.ActivateMod) {
var temp = false;
if (Instance._latestSummitCheckpointTriggered != self.Number && Settings.ActivateMod && !Instance.TransitionedAfterTransitionToCheck) {
Instance.CompletionCount++;
if (Instance.CompletionCount < Settings.NumberOfCompletions)
{
Expand All @@ -201,8 +203,16 @@ private static bool SummitCheckpointUpdateHook(Player p, SummitCheckpoint self)
Instance.CompletionCount = 0;
Instance._latestSummitCheckpointTriggered = self.Number; // Check because for some reason it triggers twice ???
}
temp = Instance.TransitionedAfterTransitionToCheck;
}
else if (Instance.TransitionedAfterTransitionToCheck)
{
temp = Instance.TransitionedAfterTransitionToCheck;
Instance.TransitionedAfterTransitionToCheck = false;
}
return Instance.CompletionCount < Settings.NumberOfCompletions && Instance._latestSummitCheckpointTriggered != self.Number && Settings.ActivateMod;
return Instance.CompletionCount < Settings.NumberOfCompletions &&
Instance._latestSummitCheckpointTriggered != self.Number && Settings.ActivateMod &&
!temp;
}

private Session OnSessionRestart(On.Celeste.Session.orig_Restart orig, Session self, string intoLevel = null)
Expand Down Expand Up @@ -233,7 +243,6 @@ private void AutoSkipCutscene(On.Celeste.Level.orig_Update orig, Level self)
orig(self);
if (!self.InCutscene || self.SkippingCutscene || !Settings.SkipCutscenesAutomatically) return;
self.SkipCutscene();
Logger.Log(LogLevel.Info, "GoldenTrainer", "Skipping cutscene");
}
}
}
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ Once you have installed the mod via the Everest/Olympus launcher, you can setup
- If you want the mod to be activated or not
- The required number of completions before switching to another screen.

### Todo :
- Fix a minor bug in 7A-3k with checkpoints 28 and 20 due to the fact that there is both a transition and a checkpoint trigger

### Contact me :
I'm on the [official Celeste discord server](https://discord.gg/6qjaePQ) as Paloys#7527, feel free to dm me if you have a question !
2 changes: 1 addition & 1 deletion everest.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- Name: GoldenTrainer
Version: 1.4.0
Version: 1.4.2
DLL: GoldenTrainer/bin/x86/Debug/GoldenTrainer.dll
Dependencies:
- Name: Everest
Expand Down

0 comments on commit 64e3c5d

Please sign in to comment.