Skip to content

Commit

Permalink
Made the cathedral secret door openable from inside
Browse files Browse the repository at this point in the history
* And some other stuff
  • Loading branch information
silent-destroyer committed Apr 1, 2024
1 parent 327b653 commit 57bdc3a
Show file tree
Hide file tree
Showing 9 changed files with 343 additions and 8 deletions.
1 change: 1 addition & 0 deletions TunicRandomizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
<Compile Include="src\Patches\PlayerCharacterPatches.cs" />
<Compile Include="src\Patches\OptionsGUIPatches.cs" />
<Compile Include="src\Patches\SceneLoaderPatches.cs" />
<Compile Include="src\Patches\SecretMayor.cs" />
<Compile Include="src\Patches\TextBuilderPatches.cs" />
<Compile Include="src\Patches\TunicPortals.cs" />
<Compile Include="src\Patches\SpeedrunFinishlineDisplayPatches.cs" />
Expand Down
2 changes: 2 additions & 0 deletions src/Data/ImageData.cs

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/Patches/ModelSwaps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static void InitializeItems() {
Items["GoldenTrophy_10"] = ItemRoot.transform.GetChild(42).gameObject;
Items["GoldenTrophy_11"] = ItemRoot.transform.GetChild(43).gameObject;
Items["GoldenTrophy_12"] = ItemRoot.transform.GetChild(44).gameObject;

SecretMayor.MrMayor = Items["GoldenTrophy_1"];
Items["Key"] = ItemRoot.transform.GetChild(4).gameObject;
Items["Vault Key (Red)"] = ItemRoot.transform.GetChild(23).gameObject;

Expand Down Expand Up @@ -1260,6 +1260,7 @@ public static void LoadTextures() {
CustomItemImages.Add("AbilityShuffle", CreateSprite(ImageData.Abilities, ImageMaterial, 200, 100, SpriteName: "Randomizer heading_Abilities"));
CustomItemImages.Add("Dath Stone Texture", CreateSprite(ImageData.DathSteneTexture, ImageMaterial, 200, 100, SpriteName: "Randomizer dath stone texture"));
CustomItemImages.Add("Ladder", CreateSprite(ImageData.Ladder, ImageMaterial, 160, 160, SpriteName: "Randomizer items_ladder"));
CustomItemImages.Add("Secret Mayor", CreateSprite(ImageData.SecretMayor, ImageMaterial, 1400, 675, SpriteName: "Randomizer secret_mayor"));

Inventory.GetItemByName("Librarian Sword").icon = CustomItemImages["Librarian Sword"].GetComponent<Image>().sprite;
Inventory.GetItemByName("Heir Sword").icon = CustomItemImages["Heir Sword"].GetComponent<Image>().sprite;
Expand Down
4 changes: 3 additions & 1 deletion src/Patches/OptionsGUIPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ public static void OtherSettingsPage() {
OptionsGUI.addToggle("???", "Off", "On", TunicRandomizer.Settings.CameraFlip ? 1 : 0, (OptionsGUIMultiSelect.MultiSelectAction)ToggleWeirdMode);
OptionsGUI.addToggle("More Skulls", "Off", "On", TunicRandomizer.Settings.MoreSkulls ? 1 : 0, (OptionsGUIMultiSelect.MultiSelectAction)ToggleMoreSkulls);
OptionsGUI.addToggle("Arachnophobia Mode", "Off", "On", TunicRandomizer.Settings.ArachnophobiaMode ? 1 : 0, (OptionsGUIMultiSelect.MultiSelectAction)ToggleArachnophobiaMode);

if (SecretMayor.shouldBeActive || SecretMayor.isCorrectDate()) {
OptionsGUI.addToggle("Mr Mayor", "Off", "On", SecretMayor.shouldBeActive ? 1 : 0, (OptionsGUIMultiSelect.MultiSelectAction)SecretMayor.ToggleMayorSecret);
}
}

public static void addPageButton(string pageName, Action pageMethod) {
Expand Down
5 changes: 4 additions & 1 deletion src/Patches/SceneLoaderPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public static void SceneLoader_OnSceneLoaded_PostfixPatch(Scene loadingScene, Lo
}
} else if (SceneName == "Temple") {
if (SaveFile.GetInt(HexagonQuestEnabled) == 1) {
foreach (GameObject Questagon in Resources.FindObjectsOfTypeAll<GameObject>().Where(Obj => Obj.name == "questagon")) {
foreach (GameObject Questagon in Resources.FindObjectsOfTypeAll<GameObject>().Where(Obj => Obj.name == "questagon" && Obj.scene.name == loadingScene.name)) {
Questagon.GetComponent<MeshRenderer>().materials = ModelSwaps.Items["GoldenTrophy_2"].GetComponent<MeshRenderer>().materials;
Questagon.GetComponent<MeshRenderer>().receiveShadows = false;
}
Expand Down Expand Up @@ -383,6 +383,9 @@ public static void SceneLoader_OnSceneLoaded_PostfixPatch(Scene loadingScene, Lo
if (SaveFile.GetInt("randomizer entrance rando enabled") == 1) {
StateVariable.GetStateVariableByName("SV_cathedral elevator").BoolValue = true;
}
if (GameObject.FindObjectOfType<ToggleObjectBySpell>() != null) {
GameObject.FindObjectOfType<ToggleObjectBySpell>().minDistance = 36;
}
} else if (SceneName == "Maze Room") {
foreach (Chest chest in Resources.FindObjectsOfTypeAll<Chest>().Where(chest => chest.name == "Chest: Fairy")) {
chest.transform.GetChild(4).gameObject.SetActive(false);
Expand Down
320 changes: 320 additions & 0 deletions src/Patches/SecretMayor.cs

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions src/Patches/TitleVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class TitleVersion {
public static bool DevBuild = true;
public static bool UpdateAvailable = false;
public static string UpdateVersion = "";
public static GameObject Logo;
public static void Initialize() {
UpdateVersion = PluginInfo.VERSION;
try {
Expand Down Expand Up @@ -55,10 +56,13 @@ public static void Initialize() {
VersionString.transform.localScale = Vector3.one;
GameObject.DontDestroyOnLoad(VersionString);
System.Random Random = new System.Random();

Logo = GameObject.Find("_GameGUI(Clone)/Title Canvas/Title Screen Root/Image");
if (Random.Next(100) < 10) {
GameObject Title = GameObject.Find("_GameGUI(Clone)/Title Canvas/Title Screen Root/Image");
Title.GetComponent<Image>().sprite = ModelSwaps.TuncTitleImage.GetComponent<Image>().sprite;
Logo.GetComponent<Image>().sprite = ModelSwaps.TuncTitleImage.GetComponent<Image>().sprite;
}

if (SecretMayor.shouldBeActive) {
Logo.GetComponent<Image>().sprite = ModelSwaps.FindSprite("Randomizer secret_mayor");
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/TunicRandomizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public class TunicRandomizer : BasePlugin {
public override void Load() {
TunicLogger.SetLogger(Log);
Logger = Log;
Logger.LogInfo(PluginInfo.NAME+ " v" + PluginInfo.VERSION + " loaded!");
TunicLogger.LogInfo(PluginInfo.NAME + " v" + PluginInfo.VERSION + " loaded!");

Application.runInBackground = true;

Tracker = new ItemTracker();
Expand Down Expand Up @@ -215,6 +215,8 @@ public override void Load() {

Harmony.Patch(AccessTools.Method(typeof(ConduitNode), "CheckConnectedToPower"), new HarmonyMethod(AccessTools.Method(typeof(InteractionPatches), "ConduitNode_CheckConnectedToPower_PrefixPatch")));

Harmony.Patch(AccessTools.Method(typeof(SceneLoader), "OnSceneLoaded"), null, new HarmonyMethod(AccessTools.Method(typeof(SecretMayor), "SceneLoader_OnSceneLoaded_SecretMayorPatch")));

}
}
}
Binary file modified tunic.apworld
Binary file not shown.

0 comments on commit 57bdc3a

Please sign in to comment.