Initial commit

This commit is contained in:
LadyAliceMargatroid 2024-07-25 21:46:18 -07:00
parent 1af2b57c1c
commit eebf00988e
30 changed files with 1883 additions and 21 deletions

View file

@ -0,0 +1,67 @@
using BepInEx;
using BepInEx.Logging;
using DunGen;
using DunGen.Graph;
using DunGenPlus.Generation;
using DunGenPlus.Managers;
using DunGenPlus.Patches;
using HarmonyLib;
using LethalLevelLoader;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Assertions;
namespace DunGenPlus {
[BepInPlugin(modGUID, modName, modVersion)]
[BepInProcess("Lethal Company.exe")]
public class Plugin : BaseUnityPlugin {
internal const string modGUID = "ImoutoSama.DungeonGenerationPlus";
private const string modName = "Dungeon Generation Plus";
private const string modVersion = "1.0.0";
internal readonly Harmony Harmony = new Harmony(modGUID);
internal static Plugin Instance {get; private set;}
internal static ManualLogSource logger { get; private set; }
internal static Dictionary<DungeonFlow, DunGenExtender> DunGenExtenders = new Dictionary<DungeonFlow, DunGenExtender>();
void Awake() {
if (Instance == null) Instance = this;
logger = BepInEx.Logging.Logger.CreateLogSource(modGUID);
logger.LogInfo($"Plugin {modName} has been added!");
Harmony.PatchAll(typeof(DungeonGeneratorPatch));
Harmony.PatchAll(typeof(DoorwayConnectionPatch));
Assets.LoadAssets();
DungeonManager.GlobalDungeonEvents.onBeforeDungeonGenerate.AddListener(OnDunGenExtenderLoad);
DoorwayManager.onMainEntranceTeleportSpawnedEvent.AddEvent("DoorwayCleanup", DoorwayManager.onMainEntranceTeleportSpawnedFunction);
}
void OnDunGenExtenderLoad(RoundManager roundManager) {
DunGenPlusGenerator.Deactivate();
var generator = roundManager.dungeonGenerator.Generator;
var flow = generator.DungeonFlow;
if (DunGenExtenders.TryGetValue(flow, out var value)) {
Plugin.logger.LogInfo($"Loading DunGenExtender for {flow.name}");
DunGenPlusGenerator.Activate(generator, value);
return;
}
Plugin.logger.LogInfo($"Did not load a DunGenExtenderer");
DunGenPlusGenerator.Deactivate();
}
}
}