예제 #1
0
        public void Step(Level level)
        {
            if (Settings.Mode == GhostModuleMode.Off)
            {
                return;
            }

            string target = level.Session.Level;

            Logger.Log("ghost", $"Stepping into {level.Session.Area.GetSID()} {target}");

            Player player = level.Tracker.GetEntity <Player>();

            // Write the ghost, even if we haven't gotten an IL PB.
            // Maybe we left the level prematurely earlier?
            if (GhostRecorder?.Data != null &&
                (Settings.Mode & GhostModuleMode.Record) == GhostModuleMode.Record)
            {
                GhostRecorder.Data.Target = target;
                GhostRecorder.Data.Run    = Run;
                GhostRecorder.Data.Write();
            }

            GhostManager?.RemoveSelf();

            level.Add(GhostManager = new GhostManager(player, level));

            if (GhostRecorder != null)
            {
                GhostRecorder.RemoveSelf();
            }
            level.Add(GhostRecorder = new GhostRecorder(player));
            GhostRecorder.Data      = new GhostData(level.Session);
            GhostRecorder.Data.Name = Settings.Name;
        }
예제 #2
0
        public void OnLoadLevel(On.Celeste.Level.orig_LoadLevel orig, Level level, Player.IntroTypes playerIntro, bool isFromLoader)
        {
            orig(level, playerIntro, isFromLoader);

            if (isFromLoader)
            {
                GhostManager?.RemoveSelf();
                GhostManager = null;
                GhostRecorder?.RemoveSelf();
                GhostRecorder = null;
                Run           = Guid.NewGuid();
            }

            Player player = level.Tracker.GetEntity <Player>();

            if (player == null)
            {
                level.Add(new Entity {
                    new Coroutine(WaitForPlayer(level))
                });
            }
            else
            {
                Step(level);
            }
        }
예제 #3
0
        public void OnLoadLevel(Level level, Player.IntroTypes playerIntro, bool isFromLoader)
        {
            if (isFromLoader)
            {
                Ghosts.Clear();
                GhostRecorder?.RemoveSelf();
                GhostRecorder = null;
            }

            Step(level);
        }
예제 #4
0
        public void OnLoadLevel(On.Celeste.Level.orig_LoadLevel orig, Level level, Player.IntroTypes playerIntro, bool isFromLoader)
        {
            orig(level, playerIntro, isFromLoader);

            if (isFromLoader)
            {
                GhostManager?.RemoveSelf();
                GhostManager = null;
                GhostRecorder?.RemoveSelf();
                GhostRecorder = null;
                Run           = Guid.NewGuid();
            }

            Step(level);
        }
예제 #5
0
        public void Step(Level level)
        {
            if (!Settings.Enabled)
            {
                return;
            }

            string target = level.Session.Level;

            Logger.Log("ghost", $"Stepping into {level.Session.Area.GetSID()} {target}");

            Player player = level.Tracker.GetEntity <Player>();

            // Write the ghost, even if we haven't gotten an IL PB.
            // Maybe we left the level prematurely earlier?
            if (GhostRecorder?.Data != null)
            {
                GhostRecorder.Data.Target = target;
                GhostRecorder.Data.Write();
            }

            // Remove any dead ghosts (heh)
            for (int i = Ghosts.Count - 1; i > -1; --i)
            {
                Ghost ghost = Ghosts[i];
                if (ghost.Player != player)
                {
                    ghost.RemoveSelf();
                }
            }
            Ghosts.Clear();

            // Read and add all ghosts.
            GhostData.ForAllGhosts(level.Session, (i, ghostData) => {
                Ghost ghost = new Ghost(player, ghostData);
                level.Add(ghost);
                Ghosts.Add(ghost);
                return(true);
            });

            if (GhostRecorder != null)
            {
                GhostRecorder.RemoveSelf();
            }
            level.Add(GhostRecorder = new GhostRecorder(player));
            GhostRecorder.Data      = new GhostData(level.Session);
            GhostRecorder.Data.Name = Settings.Name;
        }