Created
March 11, 2024 23:15
-
-
Save Cobertos/08e8ec1dff28f44333513416d62037bc to your computer and use it in GitHub Desktop.
Portal DunGen Test Plugin.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BepInEx; | |
using BepInEx.Logging; | |
using System.Reflection; | |
using System.IO; | |
using DunGen; | |
using LethalLevelLoader; | |
using UnityEngine; | |
using MonoMod.Cil; | |
using MonoMod.RuntimeDetour; | |
namespace PortalDunGen | |
{ | |
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)] | |
[BepInDependency(LethalLib.Plugin.ModGUID)] | |
public class PortalDunGenPlugin : BaseUnityPlugin | |
{ | |
public ManualLogSource mls; | |
public static AssetBundle assets; | |
// Configs | |
/*private ConfigEntry<int> configSCPRarity; | |
private ConfigEntry<string> configMoons; | |
private ConfigEntry<int> configLengthOverride;*/ | |
private void Awake() { | |
mls = BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_GUID); | |
string sAssemblyLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); | |
assets = AssetBundle.LoadFromFile(Path.Combine(sAssemblyLocation, "portaldungen.compressed")); | |
if (assets == null) { | |
mls.LogError("Failed to load Portal DunGen assets."); | |
return; | |
} | |
DunGen.Graph.DungeonFlow flow = assets.LoadAsset<DunGen.Graph.DungeonFlow>("Assets/Flow.asset"); | |
if (flow == null) { | |
mls.LogError("Failed to load Portal DunGen Dungeon Flow."); | |
return; | |
} | |
ExtendedDungeonFlow extendedDungeon = ScriptableObject.CreateInstance<ExtendedDungeonFlow>(); | |
extendedDungeon.dungeonFlow = flow; | |
//extendedDungeon.dungeonFirstTimeAudio = assets.LoadAsset<AudioClip>("assets/Mods/SCP/snd/Horror8.ogg");`` | |
extendedDungeon.manualContentSourceNameReferenceList.Add(new StringWithRarity("Lethal Company", 99999)); | |
//extendedDungeon.manualContentSourceNameReferenceList.Add(new StringWithRarity("Custom", 99999)); | |
PatchedContent.RegisterExtendedDungeonFlow(extendedDungeon); | |
mls.LogInfo($"Portal DunGen for Lethal Company [Version {PluginInfo.PLUGIN_VERSION}] successfully loaded."); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment