private static void FastTravelScreen_ctor(On.Menu.FastTravelScreen.orig_ctor orig, Menu.FastTravelScreen self, ProcessManager manager, ProcessManager.ProcessID ID) { if (PlayerManager.GetCustomPlayer(self.PlayerCharacter) != null) { checkFastTravelForCustom = true; } try { orig(self, manager, ID); } finally { checkFastTravelForCustom = false; } }
private static void FastTravelScreen_InitiateRegionSwitch(On.Menu.FastTravelScreen.orig_InitiateRegionSwitch orig, Menu.FastTravelScreen self, int switchToRegion) { if (!checkFastTravelForCustom) { orig(self, switchToRegion); return; } int maxIndex = -1; foreach (SlugBaseCharacter ply in PlayerManager.customPlayers) { maxIndex = Mathf.Max(maxIndex, ply.slugcatIndex); } // Add custom characterse to the shelter list int oldLen = self.playerShelters.Length; if (oldLen < maxIndex) { ResizeToFit(ref self.playerShelters, maxIndex + 1, null); for (int i = oldLen; i < self.playerShelters.Length; i++) { self.playerShelters[i] = self.manager.rainWorld.progression.ShelterOfSaveGame(i); } } var prog = self.manager.rainWorld.progression; // Check the current slugcat for a shelter if (prog.PlayingAsSlugcat >= 0 && prog.PlayingAsSlugcat < self.playerShelters.Length && self.playerShelters[prog.PlayingAsSlugcat] != null) { self.currentShelter = self.playerShelters[prog.PlayingAsSlugcat]; } // Find the region that this shelter is in if (self.currentShelter != null) { string regionName = self.currentShelter.Substring(0, 2); for (int regionInd = 0; regionInd < self.accessibleRegions.Count; regionInd++) { if (self.allRegions[self.accessibleRegions[regionInd]].name == regionName) { Debug.Log(self.currentShelter); Debug.Log(string.Concat(new object[] { "actually found start region (including SlugBase saves): ", regionInd, " ", self.allRegions[self.accessibleRegions[regionInd]].name })); self.currentRegion = regionInd; break; } } } orig(self, self.currentRegion); }