0.1.5 | Added: OpenMesa

This commit is contained in:
2026-03-07 02:31:49 +01:00
parent 22a24eec04
commit 894223dc5c
4 changed files with 79 additions and 2 deletions

View File

@@ -22,4 +22,9 @@
# v0.1.4 | Better Airport
- Added BetterAirportModule
- BetterAirportModule adds patches to make the airport more enjoyable, such as increasing the conveyor belt speed and making the terminals position at the start.
- BetterAirportModule adds patches to make the airport more enjoyable, such as increasing the conveyor belt speed and making the terminals position at the start.
# v0.1.5 | Open Mesa
- Added OpenMesaModule and OpenMesaPatch
- OpenMesaPatch makes it so that the Mesa biome is open no matter the seed.

View File

@@ -8,7 +8,7 @@
<!-- This is the display name of your mod. Example: BepInEx Template -->
<AssemblyTitle>JordanMod</AssemblyTitle>
<!-- This is the version number of your mod. -->
<Version>0.1.4</Version>
<Version>0.1.5</Version>
</PropertyGroup>
<PropertyGroup>

View File

@@ -0,0 +1,14 @@
using System;
namespace JordanMod.Modules.OpenMesa;
[Module(Enabled = true)]
class OpenMesaModule : Module
{
public override string ModuleName => "Open Mesa Module";
public override Type[] GetPatches()
{
return [typeof(OpenMesaPatch)];
}
}

View File

@@ -0,0 +1,58 @@
using System.Linq;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;
using Zorro.Core;
namespace JordanMod.Modules.OpenMesa;
class OpenMesaPatch
{
[HarmonyPatch(typeof(RunManager), nameof(RunManager.StartRun))]
[HarmonyPostfix]
public static void PostFixStartRun(RunManager __instance)
{
int seed = SceneManager.GetActiveScene().path.GetHashCode();
System.Random prng = new(seed);
var desertRockSpawners = Object.FindObjectsByType<DesertRockSpawner>(FindObjectsInactive.Include, FindObjectsSortMode.None);
foreach (var spawner in desertRockSpawners)
{
spawner.GetRefs();
var entrance = spawner.enterences;
var inside = spawner.inside;
bool hasEntrance = entrance.Cast<Transform>()
.SelectMany(container => container.Cast<Transform>())
.Any(doorObject =>
spawner.enterenceObjects.Any(e => e.name == doorObject.name) &&
(!spawner.blockerObjects.Any(b => b.name == doorObject.name) ||
!doorObject.Cast<Transform>().Any(child => child.TryGetComponent<LODGroup>(out _)))
);
if (hasEntrance) continue;
var targetEntranceContainer = entrance.GetChild(prng.Next(0, entrance.childCount));
for (int i = targetEntranceContainer.childCount - 1; i >= 0; i--)
Object.DestroyImmediate(targetEntranceContainer.GetChild(i).gameObject);
var prefab = spawner.enterenceObjects[prng.Next(0, spawner.enterenceObjects.Length)];
HelperFunctions.InstantiatePrefab(prefab, targetEntranceContainer.position, targetEntranceContainer.rotation, targetEntranceContainer)
.transform.localScale = Vector3.one * 2f;
inside.position = new Vector3(targetEntranceContainer.position.x, inside.position.y, targetEntranceContainer.position.z);
var mazeTransform = inside.FindChildRecursive("Maze");
if (mazeTransform != null)
{
// Disable Maze itself
mazeTransform.gameObject.SetActive(false);
mazeTransform.Find("Rocks")?.gameObject.SetActive(false);
mazeTransform.Find("Roof")?.gameObject.SetActive(false);
mazeTransform.Find("Floor")?.gameObject.SetActive(false);
}
}
}
}