private static void LevelEnterGo(On.Celeste.LevelEnter.orig_Go orig, Celeste.Session session, bool fromSaveData) { if (!fromSaveData && session.StartedFromBeginning && session.Area.Mode == AreaMode.Normal && session.Area.ChapterIndex == 1 && session.Area.GetLevelSet() == "KaydenFox/FactoryMod") { Engine.Scene = new FactoryIntroVignette(session); } else { orig(session, fromSaveData); } }
private static void modLevelEnter(On.Celeste.LevelEnter.orig_Go orig, Session session, bool fromSaveData) { // This hook is only applied when returning from the old GMHS. // We know we are returning to the start of new GMHS, so set up the session properly for that. session.FirstLevel = true; session.StartedFromBeginning = true; new DynData <Session>(session)["pauseTimerUntilAction"] = false; orig(session, fromSaveData); // and undo the hook. On.Celeste.LevelEnter.Go -= modLevelEnter; }
private static void onLevelEnterGo(On.Celeste.LevelEnter.orig_Go orig, Session session, bool fromSaveData) { if (CollabModule.Instance.SaveData.SessionsPerLevel.TryGetValue(session.Area.GetSID(), out string savedSessionXML)) { // "save and return to lobby" was used: restore the session. using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(savedSessionXML))) { session = (Session) new XmlSerializer(typeof(Session)).Deserialize(stream); fromSaveData = true; } // and remove it from the save, so that the user won't be able to use it again unless they "save and return to lobby" again. CollabModule.Instance.SaveData.SessionsPerLevel.Remove(session.Area.GetSID()); } // the mod sessions are loaded in SaveData.StartSession, but load them ahead of time here too for compatibility. loadModSessions(session); orig(session, fromSaveData); }
private static void onLevelEnterGo(On.Celeste.LevelEnter.orig_Go orig, Session session, bool fromSaveData) { if (CollabModule.Instance.SaveData.SessionsPerLevel.TryGetValue(session.Area.GetSID(), out string savedSessionXML)) { // "save and return to lobby" was used: restore the session. using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(savedSessionXML))) { session = (Session) new XmlSerializer(typeof(Session)).Deserialize(stream); SaveData.Instance.CurrentSession_Safe = session; fromSaveData = true; } // and remove it from the save, so that the user won't be able to use it again unless they "save and return to lobby" again. CollabModule.Instance.SaveData.SessionsPerLevel.Remove(session.Area.GetSID()); } if (loadModSessions(session)) { // remove the mod sessions from the save, so that the user won't be able to use them again unless they "save and return to lobby" again. CollabModule.Instance.SaveData.ModSessionsPerLevel.Remove(session.Area.GetSID()); CollabModule.Instance.SaveData.ModSessionsPerLevelBinary.Remove(session.Area.GetSID()); } orig(session, fromSaveData); }
// this one is for the normal case (entering a level from the overworld or opening a save) private void checkForceEnableVariantsOnLevelEnter(On.Celeste.LevelEnter.orig_Go orig, Session session, bool fromSaveData) { checkForceEnableVariants(session); orig(session, fromSaveData); }