Skip to content

Instantly share code, notes, and snippets.

@Cobertos
Created March 11, 2024 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cobertos/08e8ec1dff28f44333513416d62037bc to your computer and use it in GitHub Desktop.
Save Cobertos/08e8ec1dff28f44333513416d62037bc to your computer and use it in GitHub Desktop.
Portal DunGen Test Plugin.cs
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