Added Yukari pit hallway tile

Changed generation to use dungeonflow nodes
Made map smaller
Updated mimics patch to not be dumb
This commit is contained in:
LadyAliceMargatroid 2024-05-01 03:51:41 -07:00
parent cdadd75ee9
commit 6613191d7e
14 changed files with 223 additions and 84 deletions

View File

@ -8,6 +8,7 @@ using UnityEngine;
using DunGen; using DunGen;
using System.Security; using System.Security;
using System.Security.Permissions; using System.Security.Permissions;
using DunGen.Graph;
[assembly: SecurityPermission( SecurityAction.RequestMinimum, SkipVerification = true )] [assembly: SecurityPermission( SecurityAction.RequestMinimum, SkipVerification = true )]
namespace ScarletMansion.DunGenPatch { namespace ScarletMansion.DunGenPatch {
@ -117,7 +118,6 @@ namespace ScarletMansion.DunGenPatch {
// as such, the final node of an alternate main path CANNOT be a node that can be pruned // as such, the final node of an alternate main path CANNOT be a node that can be pruned
// luckily, the last node is my Nodes section has tiles that won't be pruned // luckily, the last node is my Nodes section has tiles that won't be pruned
// so i'm just using that so the final node cannot be a target for pruning // so i'm just using that so the final node cannot be a target for pruning
var finalNode = gen.DungeonFlow.Nodes.OrderBy(x => x.Position).LastOrDefault();
for (var b = 0; b < altCount; ++b) { for (var b = 0; b < altCount; ++b) {
RandomizeLineArchetypes(gen, true); RandomizeLineArchetypes(gen, true);
@ -128,6 +128,9 @@ namespace ScarletMansion.DunGenPatch {
var newMainPathTiles = new List<TileProxy>(); var newMainPathTiles = new List<TileProxy>();
newMainPathTiles.Add(mainTile); newMainPathTiles.Add(mainTile);
var nodes = gen.DungeonFlow.Nodes.Skip(2);
var nodesVisited = new List<GraphNode>(nodes.Count());
// most of this code is a mix of the GenerateMainPath() // most of this code is a mix of the GenerateMainPath()
// and GenerateBranch() code // and GenerateBranch() code
for(var t = 1; t < targetLength; ++t){ for(var t = 1; t < targetLength; ++t){
@ -138,6 +141,8 @@ namespace ScarletMansion.DunGenPatch {
yield break; yield break;
} }
if (lineAtDepth != gen.previousLineSegment){ if (lineAtDepth != gen.previousLineSegment){
gen.currentArchetype = lineAtDepth.GetRandomArchetype(gen.RandomStream, archetypes); gen.currentArchetype = lineAtDepth.GetRandomArchetype(gen.RandomStream, archetypes);
gen.previousLineSegment = lineAtDepth; gen.previousLineSegment = lineAtDepth;
@ -146,9 +151,18 @@ namespace ScarletMansion.DunGenPatch {
// terrible solution but FUCK it // terrible solution but FUCK it
// and yet it worked // and yet it worked
// this is how my last node cannot be a target of pruning // this is how my last node cannot be a target of pruning
GraphNode graphNode = null;
foreach(var g in nodes) {
if (lineDepthRatio >= g.Position && !nodesVisited.Contains(g)) {
graphNode = g;
nodesVisited.Add(g);
break;
}
}
List<TileSet> useableTileSets; List<TileSet> useableTileSets;
if (lineDepthRatio >= 1f){ if (graphNode != null) {
useableTileSets = finalNode.TileSets; useableTileSets = graphNode.TileSets;
} else { } else {
useableTileSets = gen.currentArchetype.TileSets; useableTileSets = gen.currentArchetype.TileSets;
} }
@ -178,6 +192,7 @@ namespace ScarletMansion.DunGenPatch {
} }
var tileProxy = gen.AddTile(previousTile, useableTileSets, lineDepthRatio, gen.currentArchetype, TilePlacementResult.None); var tileProxy = gen.AddTile(previousTile, useableTileSets, lineDepthRatio, gen.currentArchetype, TilePlacementResult.None);
if (tileProxy == null) { if (tileProxy == null) {
@ -215,6 +230,7 @@ namespace ScarletMansion.DunGenPatch {
} }
} }
Patch.callAlternative = false; Patch.callAlternative = false;
if (!Patch.startAnalysis) Plugin.logger.LogInfo($"Created {altCount} alt. paths, creating branches now"); if (!Patch.startAnalysis) Plugin.logger.LogInfo($"Created {altCount} alt. paths, creating branches now");

View File

@ -0,0 +1,89 @@
using GameNetcodeStuff;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace ScarletMansion.GamePatch.Components
{
public class ScarletYukariTrigger : MonoBehaviour {
public static int audioClipIndex = -1;
public bool sinkingLocalPlayer;
public float movementHinderence = 1.6f;
public float sinkingSpeedMultiplier = 0.21f;
private void OnTriggerStay(Collider other) {
var otherGameObject = other.gameObject;
if (!otherGameObject.CompareTag("Player")) {
return;
}
var comp = otherGameObject.GetComponent<PlayerControllerB>();
if (comp != GameNetworkManager.Instance.localPlayerController) return;
// sanity check
if (audioClipIndex == -1) comp.statusEffectAudioIndex = 0;
comp.statusEffectAudioIndex = audioClipIndex;
if (comp.isSinking) return;
if (sinkingLocalPlayer){
if (!comp.CheckConditionsForSinkingInQuicksand()) {
StopSinkingLocalPlayer(comp);
}
return;
}
if (comp.CheckConditionsForSinkingInQuicksand()){
Debug.Log("Set local player to sinking");
sinkingLocalPlayer = true;
comp.sourcesCausingSinking++;
comp.isMovementHindered++;
comp.hinderedMultiplier *= movementHinderence;
comp.sinkingSpeedMultiplier = sinkingSpeedMultiplier;
}
}
private void OnTriggerExit(Collider other){
OnExit(other);
}
public void OnExit(Collider other){
if (!sinkingLocalPlayer) {
Debug.Log("Yukari is not sinking local player");
return;
}
Debug.Log("Yukari is sinking something");
var otherGameObject = other.gameObject;
if (!otherGameObject.CompareTag("Player")){
return;
}
Debug.Log("Yukari is sinking a player");
var comp = otherGameObject.GetComponent<PlayerControllerB>();
if (comp != GameNetworkManager.Instance.localPlayerController) return;
Debug.Log("Yukari is sinking local player");
StopSinkingLocalPlayer(comp);
}
private void StopSinkingLocalPlayer(PlayerControllerB player) {
if (!sinkingLocalPlayer) return;
Plugin.logger.LogInfo("Stopping");
sinkingLocalPlayer = false;
player.sourcesCausingSinking = Mathf.Clamp(player.sourcesCausingSinking - 1, 0, 100);
player.isMovementHindered = Mathf.Clamp(player.isMovementHindered - 1, 0, 100);
player.hinderedMultiplier = Mathf.Clamp(player.hinderedMultiplier / movementHinderence - 1, 1f, 100f);
}
}
}

View File

@ -12,6 +12,7 @@ using LethalLib.Modules;
using Unity.Netcode; using Unity.Netcode;
using LethalLevelLoader; using LethalLevelLoader;
using static UnityEngine.GraphicsBuffer; using static UnityEngine.GraphicsBuffer;
using ScarletMansion.GamePatch.Components;
namespace ScarletMansion.GamePatch { namespace ScarletMansion.GamePatch {
@ -42,6 +43,7 @@ namespace ScarletMansion.GamePatch {
[HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPatch(typeof(StartOfRound), "Awake")]
[HarmonyPrefix] [HarmonyPrefix]
public static void StartOfRound_Start(ref StartOfRound __instance) { public static void StartOfRound_Start(ref StartOfRound __instance) {
ScarletYukariTrigger.audioClipIndex = -1;
__instance.StartCoroutine(WaitForNetworkObject(__instance, CreateNetworkManager)); __instance.StartCoroutine(WaitForNetworkObject(__instance, CreateNetworkManager));
@ -59,24 +61,11 @@ namespace ScarletMansion.GamePatch {
FixMapReferences(__instance); FixMapReferences(__instance);
FixItemPrefabValues(__instance); FixItemPrefabValues(__instance);
// fix audio clips
var statusEffectClips = __instance.statusEffectClips.ToList();
/* ScarletYukariTrigger.audioClipIndex = statusEffectClips.Count;
foreach(var l in __instance.levels) { statusEffectClips.Add(Assets.networkObjectList.sinkingAudioClip);
foreach(var i in l.dungeonFlowTypes){ __instance.statusEffectClips = statusEffectClips.ToArray();
if (i.id == 1) i.rarity = 0;
}
}
*/
/*
// my heart can't handle it
foreach(var lev in __instance.levels){
lev.maxDaytimeEnemyPowerCount = 0;
lev.maxEnemyPowerCount = 0;
lev.maxOutsideEnemyPowerCount = 0;
}
*/
// DunGenAnalyis.Analysis(Assets.dungeon, __instance, RoundManager.Instance); // DunGenAnalyis.Analysis(Assets.dungeon, __instance, RoundManager.Instance);
} }

View File

@ -29,5 +29,6 @@ namespace ScarletMansion {
//public GameObject mainMenuPrefab; //public GameObject mainMenuPrefab;
[Header("Main Prefabs")] [Header("Main Prefabs")]
public GameObject scarletNetworkManager; public GameObject scarletNetworkManager;
public AudioClip sinkingAudioClip;
} }
} }

View File

@ -1,37 +0,0 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using BepInEx;
using HarmonyLib;
using System.Reflection;
using System.Reflection.Emit;
using DunGen;
using ScarletMansion.GamePatch.FixValues;
using UnityEngine.Events;
using GameNetcodeStuff;
using ScarletMansion.GamePatch.Components;
using System.IO;
namespace ScarletMansion.ModPatch {
public class MimicsPatch : ModPatch {
public override string version => "2.6.0";
public MimicsPatch(string guid) : base(guid) { }
public override void AddPatch() {
var assemblyPath = Assembly.GetExecutingAssembly().Location;
var folderPath = Path.GetDirectoryName(assemblyPath);
var pathAssemblyPath = Path.Combine(folderPath, "ScarletMansionMimicsPatch.dll");
var assembly = Assembly.LoadFile(pathAssemblyPath);
var type = assembly.GetType("ScarletMansion.ModPatch.Patch");
Activator.CreateInstance(type);
}
}
}

View File

@ -13,16 +13,15 @@ namespace ScarletMansion.ModPatch {
public const string lethalConfigGuid = "ainavt.lc.lethalconfig"; public const string lethalConfigGuid = "ainavt.lc.lethalconfig";
public const string facilityMeldownGuid = "me.loaforc.facilitymeltdown"; public const string facilityMeldownGuid = "me.loaforc.facilitymeltdown";
public const string reserveFlashlightGuid = "FlipMods.ReservedFlashlightSlot"; public const string reserveFlashlightGuid = "FlipMods.ReservedFlashlightSlot";
public const string mimicsGuid = "x753.Mimics";
public static readonly ModPatch[] modPatches = new ModPatch[] { public static readonly ModPatch[] modPatches = new ModPatch[] {
new AdvancedCompanyPatch(advancedCompanyGuid), new AdvancedCompanyPatch(advancedCompanyGuid),
new LethalConfigPatch(lethalConfigGuid), new LethalConfigPatch(lethalConfigGuid),
new FacilityMeltdownPatch(facilityMeldownGuid), new FacilityMeltdownPatch(facilityMeldownGuid),
new ReservedItemSlotPatch(reserveFlashlightGuid), new ReservedItemSlotPatch(reserveFlashlightGuid)
new MimicsPatch(mimicsGuid)
}; };
public static void GetActiveMods(){ public static void GetActiveMods(){
foreach(var m in modPatches) foreach(var m in modPatches)
m.CheckIfActive(); m.CheckIfActive();

View File

@ -24,16 +24,16 @@ namespace ScarletMansion {
[BepInDependency("imabatby.lethallevelloader", "1.2.0.1")] [BepInDependency("imabatby.lethallevelloader", "1.2.0.1")]
[BepInDependency("evaisa.lethallib", "0.13.2")] [BepInDependency("evaisa.lethallib", "0.13.2")]
[BepInDependency(ModCompability.advancedCompanyGuid, BepInDependency.DependencyFlags.SoftDependency)] [BepInDependency(ModCompability.advancedCompanyGuid, BepInDependency.DependencyFlags.SoftDependency)]
[BepInDependency(ModCompability.lethalConfigGuid, BepInDependency.DependencyFlags.SoftDependency)] [BepInDependency(ModCompability.lethalConfigGuid, BepInDependency.DependencyFlags.SoftDependency)]
[BepInDependency(ModCompability.facilityMeldownGuid, BepInDependency.DependencyFlags.SoftDependency)] [BepInDependency(ModCompability.facilityMeldownGuid, BepInDependency.DependencyFlags.SoftDependency)]
[BepInDependency(ModCompability.reserveFlashlightGuid, BepInDependency.DependencyFlags.SoftDependency)] [BepInDependency(ModCompability.reserveFlashlightGuid, BepInDependency.DependencyFlags.SoftDependency)]
[BepInDependency(ModCompability.mimicsGuid, BepInDependency.DependencyFlags.SoftDependency)]
[BepInProcess("Lethal Company.exe")] [BepInProcess("Lethal Company.exe")]
public class Plugin : BaseUnityPlugin { public class Plugin : BaseUnityPlugin {
public const string modGUID = "ImoutoSama.ScarletMansion"; public const string modGUID = "ImoutoSama.ScarletMansion";
private const string modName = "Scarlet Mansion"; private const string modName = "Scarlet Mansion";
private const string modVersion = "1.3.10"; private const string modVersion = "1.3.12";
public readonly Harmony harmony = new Harmony(modGUID); public readonly Harmony harmony = new Harmony(modGUID);

View File

@ -187,11 +187,11 @@ namespace ScarletMansion {
private static readonly string _branchPathPostDepthMessage = $"Each branching path will try to generate a number of connecting tiles equal to this number. {_branchPathPostGenericMessage}"; private static readonly string _branchPathPostDepthMessage = $"Each branching path will try to generate a number of connecting tiles equal to this number. {_branchPathPostGenericMessage}";
public static ConfigEntryBundleBranchingPath branchPathSectionOne = new ConfigEntryBundleBranchingPath( public static ConfigEntryBundleBranchingPath branchPathSectionOne = new ConfigEntryBundleBranchingPath(
dungeonGenerationBPathOnePrefix, 1, _branchPathSectionOneMessage, 6, 8, 3, 4 dungeonGenerationBPathOnePrefix, 1, _branchPathSectionOneMessage, 6, 8, 0, 2
); );
public static ConfigEntryBundleBranchingPath branchPathSectionTwo = new ConfigEntryBundleBranchingPath( public static ConfigEntryBundleBranchingPath branchPathSectionTwo = new ConfigEntryBundleBranchingPath(
dungeonGenerationBPathTwoPrefix, 2, _branchPathSectionTwoMessage, 2, 3, 1, 2 dungeonGenerationBPathTwoPrefix, 2, _branchPathSectionTwoMessage, 2, 3, 0, 1
); );
public static ConfigEntryBundleBranchingPath branchPathSectionThree = new ConfigEntryBundleBranchingPath( public static ConfigEntryBundleBranchingPath branchPathSectionThree = new ConfigEntryBundleBranchingPath(
@ -380,8 +380,8 @@ namespace ScarletMansion {
public static ConfigEntryBundle<int> hallwayLightsWeight = new ConfigEntryBundle<int>( public static ConfigEntryBundle<int> hallwayLightsWeight = new ConfigEntryBundle<int>(
dungeonLightingPrefix, dungeonLightingPrefix,
"Hallway Lights Weight", "Hallway Lights Weight",
225, 75,
"The weight for a hallway wall lamp to appear on its respective walls. With the default weight of 225 against the weight of the empty wall of 75, there is a 60% chance that a wall lamp will spawn. Increasing the weight to 675 will give you a 90% chance, 75 = 50%, and so on.", "The weight for a hallway wall lamp to appear on its respective walls. With the default weight of 75 against the weight of the empty wall of 75, there is a 50% chance that a wall lamp will spawn. Increasing the weight to 225 will give you a 75% chance, 675=90% chance, and so on.",
null, null,
new AcceptableValueRange<int>(0, 999) new AcceptableValueRange<int>(0, 999)
); );
@ -389,8 +389,8 @@ namespace ScarletMansion {
public static ConfigEntryBundle<int> ceilingLightsWeight = new ConfigEntryBundle<int>( public static ConfigEntryBundle<int> ceilingLightsWeight = new ConfigEntryBundle<int>(
dungeonLightingPrefix, dungeonLightingPrefix,
"Chandelier Lights Weight", "Chandelier Lights Weight",
225, 75,
"The weight for a chandelier to appear on its respective ceilings. With the default weight of 225 against the weight of the empty ceiling of 75, there is a 75% chance that a chandelier will spawn. Increasing the weight to 675 will give you a 90%, 75 = 50%, and so on.", "The weight for a chandelier to appear on its respective ceilings. With the default weight of 75 against the weight of the empty ceiling of 75, there is a 50% chance that a chandelier will spawn. Increasing the weight to 225 will give you a 75% chance, 675=90% chance, and so on.",
null, null,
new AcceptableValueRange<int>(0, 999) new AcceptableValueRange<int>(0, 999)
); );

View File

@ -129,11 +129,12 @@ namespace ScarletMansion {
//new ChangeInt ( PluginConfig.lightsSpawnThreeWeight ) //new ChangeInt ( PluginConfig.lightsSpawnThreeWeight )
); );
public static ChangeList brightLighting = new ChangeList( public static ChangeList brightLighting = new ChangeList(
"Bright", "Bright",
"Makes light sources much more common.", "Makes light sources much more common.",
new ChangeInt ( PluginConfig.hallwayLightsWeight, 675 ), new ChangeInt ( PluginConfig.hallwayLightsWeight, 225 ),
new ChangeInt ( PluginConfig.ceilingLightsWeight, 675 ), new ChangeInt ( PluginConfig.ceilingLightsWeight, 225 ),
new ChangeInt ( PluginConfig.lightsSpawnZeroWeight, 1 ), new ChangeInt ( PluginConfig.lightsSpawnZeroWeight, 1 ),
new ChangeInt ( PluginConfig.lightsSpawnOneWeight, 6 ), new ChangeInt ( PluginConfig.lightsSpawnOneWeight, 6 ),
new ChangeInt ( PluginConfig.lightsSpawnTwoWeight, 3 ) new ChangeInt ( PluginConfig.lightsSpawnTwoWeight, 3 )
@ -143,8 +144,8 @@ namespace ScarletMansion {
public static ChangeList darkLighting = new ChangeList( public static ChangeList darkLighting = new ChangeList(
"Dark", "Dark",
"Makes light sources much less common.", "Makes light sources much less common.",
new ChangeInt ( PluginConfig.hallwayLightsWeight, 75 ), new ChangeInt ( PluginConfig.hallwayLightsWeight, 25 ),
new ChangeInt ( PluginConfig.ceilingLightsWeight, 75 ), new ChangeInt ( PluginConfig.ceilingLightsWeight, 25 ),
new ChangeInt ( PluginConfig.lightsSpawnZeroWeight, 3 ), new ChangeInt ( PluginConfig.lightsSpawnZeroWeight, 3 ),
new ChangeInt ( PluginConfig.lightsSpawnOneWeight, 7 ), new ChangeInt ( PluginConfig.lightsSpawnOneWeight, 7 ),
new ChangeInt ( PluginConfig.lightsSpawnTwoWeight, 0 ) new ChangeInt ( PluginConfig.lightsSpawnTwoWeight, 0 )

View File

@ -184,6 +184,7 @@
<Compile Include="GamePatch\Components\ScarletPlayerControllerB.cs" /> <Compile Include="GamePatch\Components\ScarletPlayerControllerB.cs" />
<Compile Include="GamePatch\Components\ScarletProp.cs" /> <Compile Include="GamePatch\Components\ScarletProp.cs" />
<Compile Include="GamePatch\Components\ScarletVent.cs" /> <Compile Include="GamePatch\Components\ScarletVent.cs" />
<Compile Include="GamePatch\Components\ScarletYukariTrigger.cs" />
<Compile Include="GamePatch\DoorLockPatch.cs" /> <Compile Include="GamePatch\DoorLockPatch.cs" />
<Compile Include="GamePatch\Enemies\KnightVariant.cs" /> <Compile Include="GamePatch\Enemies\KnightVariant.cs" />
<Compile Include="GamePatch\EnemyVentPatch.cs" /> <Compile Include="GamePatch\EnemyVentPatch.cs" />
@ -228,7 +229,6 @@
<Compile Include="ModPatch\AdvancedCompanyPatch.cs" /> <Compile Include="ModPatch\AdvancedCompanyPatch.cs" />
<Compile Include="ModPatch\FacilityMeltdownPatch.cs" /> <Compile Include="ModPatch\FacilityMeltdownPatch.cs" />
<Compile Include="ModPatch\LethalConfigPatch.cs" /> <Compile Include="ModPatch\LethalConfigPatch.cs" />
<Compile Include="ModPatch\MimicsPatch.cs" />
<Compile Include="ModPatch\ModCompability.cs" /> <Compile Include="ModPatch\ModCompability.cs" />
<Compile Include="ModPatch\ModPatch.cs" /> <Compile Include="ModPatch\ModPatch.cs" />
<Compile Include="ModPatch\ReservedItemSlotPatch.cs" /> <Compile Include="ModPatch\ReservedItemSlotPatch.cs" />

View File

@ -179,6 +179,17 @@ namespace ScarletMansion {
return null; return null;
} }
public static void PrintToParent(Transform t) {
Plugin.logger.LogInfo(t.name);
var parent = t.parent;
var i = 0;
while (parent != null) {
var header = new string(' ', ++i);
Plugin.logger.LogInfo($"{header}{parent.name}");
parent = parent.parent;
}
}
public static List<SpawnableItemWithRarity> GetDungeonItems(){ public static List<SpawnableItemWithRarity> GetDungeonItems(){
return LoadAssetsIntoLevelPatch.GetItems(RoundManager.Instance.currentLevel.spawnableScrap); return LoadAssetsIntoLevelPatch.GetItems(RoundManager.Instance.currentLevel.spawnableScrap);
} }

View File

@ -15,25 +15,28 @@ using DunGen;
using ScarletMansion.GamePatch.FixValues; using ScarletMansion.GamePatch.FixValues;
using UnityEngine.Events; using UnityEngine.Events;
using GameNetcodeStuff; using GameNetcodeStuff;
using ScarletMansion;
using ScarletMansion.GamePatch.Components; using ScarletMansion.GamePatch.Components;
using ScarletMansion.DunGenPatch;
namespace ScarletMansion.ModPatch { namespace ScarletMansionMimicsPatch {
public class Patch { public class Patch {
public Patch() { public static void Activate() {
MimicsAPI.GetAPI().RegisterMimicEventHandler(new SDMMimicEventHandler()); MimicsAPI.GetAPI().RegisterMimicEventHandler(new Patch.SDMMimicEventHandler());
Plugin.Instance.harmony.PatchAll(typeof(Patch)); Plugin.Instance.harmony.PatchAll(typeof(Patch));
} }
public class SDMMimicEventHandler : MimicEventHandler public class SDMMimicEventHandler : MimicEventHandler
{ {
public override string ModGUID => Plugin.modGUID; public override string ModGUID => Plugin.modGUID;
public override bool IsMyInteriorLoaded => DunGenPatch.Patch.active; public override bool IsMyInteriorLoaded => ScarletMansion.DunGenPatch.Patch.active;
public override void OnMimicCreated(MimicDoor mimicDoor, Doorway doorway) { public override void OnMimicCreated(MimicDoor mimicDoor, Doorway doorway) {
var c = doorway.transform.parent.GetComponentInChildren<DunGenPatch.Doorways.DoorwayCleanup>(); var c = doorway.transform.parent.GetComponentInChildren<ScarletMansion.DunGenPatch.Doorways.DoorwayCleanup>();
if (c != null) { if (c != null) {
c.overrideConnector = true; c.overrideConnector = true;
c.overrideNoDoorway = true; c.overrideNoDoorway = true;
@ -42,9 +45,9 @@ namespace ScarletMansion.ModPatch {
var fixfireexit = doorway.GetComponentInChildren<FixFireExit>(true); var fixfireexit = doorway.GetComponentInChildren<FixFireExit>(true);
fixfireexit.ForcefullyEnableDoorway(); fixfireexit.ForcefullyEnableDoorway();
var mimicDoorMesh = Utility.FindChildRecurvisely(mimicDoor.transform, "DoorMesh"); var mimicDoorMesh = ScarletMansion.Utility.FindChildRecurvisely(mimicDoor.transform, "DoorMesh");
var mimicFrame = Utility.FindChildRecurvisely(mimicDoor.transform, "Frame"); var mimicFrame = ScarletMansion.Utility.FindChildRecurvisely(mimicDoor.transform, "Frame");
var mimicLight = Utility.FindChildRecurvisely(mimicDoor.transform, "Light"); var mimicLight = ScarletMansion.Utility.FindChildRecurvisely(mimicDoor.transform, "Light");
if (fixfireexit.EnableVanillaFireExit){ if (fixfireexit.EnableVanillaFireExit){
FixDoorwayForVanillaFireExit(fixfireexit, mimicDoorMesh, mimicFrame, mimicLight); FixDoorwayForVanillaFireExit(fixfireexit, mimicDoorMesh, mimicFrame, mimicLight);

View File

@ -0,0 +1,66 @@
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using ScarletMansion;
using ScarletMansion.DunGenPatch;
using ScarletMansion.GamePatch.Managers;
using ScarletMansion.GamePatch;
using ScarletMansion.ModPatch;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using Mimics.API;
using BepInEx.Bootstrap;
namespace ScarletMansionMimicsPatch {
[BepInPlugin(modGUID, modName, modVersion)]
[BepInDependency("ImoutoSama.ScarletMansion", "1.3.12")]
[BepInDependency(targetModGUID, BepInDependency.DependencyFlags.SoftDependency)]
public class Plugin : BaseUnityPlugin {
public const string modGUID = "ImoutoSama.ScarletMansionMimicsPatch";
private const string modName = "Scarlet Mansion Mimics Patch";
private const string modVersion = "1.0.0";
public const string targetModGUID = "x753.Mimics";
public const string targetModVersion = "2.6.0";
public readonly Harmony harmony = new Harmony(modGUID);
public static Plugin Instance {get; private set;}
public static ManualLogSource logger { get; internal set; }
void Awake(){
if (Instance == null) Instance = this;
logger = BepInEx.Logging.Logger.CreateLogSource(modGUID);
logger.LogInfo($"Plugin {modName} has been added!");
var modLoaded = Chainloader.PluginInfos.ContainsKey(targetModGUID);
if (!modLoaded) return;
bool validVersion;
var pluginInfo = Chainloader.PluginInfos[targetModGUID];
var loadedVersion = pluginInfo.Metadata.Version;
if (string.IsNullOrWhiteSpace(targetModVersion)){
validVersion = true;
} else {
var requiredVersion = new Version(targetModVersion);
validVersion = loadedVersion >= requiredVersion;
}
if (validVersion){
logger.LogInfo($"Plugin {modName} has been added!");
Patch.Activate();
}
}
}
}

View File

@ -63,6 +63,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Patch.cs" /> <Compile Include="Patch.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />