private void HijackExitBegin(On.Celeste.LevelExit.orig_Begin orig, LevelExit self)
        {
            orig(self);
            var settings = this.InRandomizerSettings;

            this.endingSettings = settings;
            if (settings == null || settings.Algorithm != LogicType.Endless)
            {
                return;
            }

            LevelExit.Mode mode = (LevelExit.Mode) typeof(LevelExit).GetField("mode", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(self);
            if (mode != LevelExit.Mode.Completed)
            {
                return;
            }

            var newSettings = settings.Copy();

            newSettings.EndlessLevel++;
            Audio.SetMusic(SFX.music_complete_bside);
            Audio.SetAmbience(null);

            this.genTask = Task.Run(() => {
                try {
                    return(RandoLogic.GenerateMap(newSettings));
                } catch (GenerationError e) {
                    LevelEnterExt.ErrorMessage = e.Message ?? "Failed to generate area";
                    LevelEnter.Go(new Session(new AreaKey(1).SetSID("")), false);
                    return(AreaKey.None);
                }
            });
        }
Beispiel #2
0
 // cancel on level exit
 public static void LevelExit_Begin(On.Celeste.LevelExit.orig_Begin orig, LevelExit self)
 {
     if (EmoteModMain.anim_by_game == 1)
     {
         cancelEmote();
     }
     orig(self);
 }