private void randomizeTransition(On.Celeste.Level.orig_TransitionTo orig, Level self, LevelData next, Vector2 direction)
        {
            if (!Settings.Enabled)
            {
                orig(self, next, direction);
            }
            else
            {
                Player ply = self.Entities.FindFirst <Player>();

                bool eligible = (computeDistance(lastPos, ply.Position) > 20 || self.Session.LevelData.Spawns.Count == 1 || (++counter > 300));
                if (lastPos == Vector2.Zero)
                {
                    eligible = true;
                }

                if (!eligible)
                {
                    setPlayerPos(ply, lastPos);
                }
                else
                {
                    counter = 0;
                    LevelData nextRandom = listOfLevels[0];
                    listOfLevels.Remove(nextRandom);
                    Vector2 nearestSpawn = findNearestSpawn(nextRandom.Spawns, ply.Position);
                    setPlayerPos(ply, nearestSpawn);
                    lastPos = nearestSpawn;
                    orig(self, nextRandom, direction);
                }
            }
        }
Exemple #2
0
        private static void TransitionLightSources(On.Celeste.Level.orig_TransitionTo orig, Level transitionLevel, LevelData next, Vector2 direction)
        {
            lightSources = new List <Component>();
            bloomSources = new List <Component>();

            DisableAllLights(transitionLevel);
            orig(transitionLevel, next, direction);
        }
        private static void onLevelTransitionTo(On.Celeste.Level.orig_TransitionTo orig, Level self, LevelData next, Vector2 direction)
        {
            if (leaveTheoBehind)
            {
                // freeze all Theo Crystals that the player isn't carrying, to prevent them from crashing the game or being weird.
                Player player = self.Tracker.GetEntity <Player>();
                foreach (TheoCrystal crystal in self.Tracker.GetEntities <TheoCrystal>())
                {
                    if (player?.Holding?.Entity != crystal)
                    {
                        crystal.RemoveTag(Tags.TransitionUpdate);
                    }
                }
            }

            orig(self, next, direction);
        }