From 7b8182f8044aea9fbc82e972d0695f27bab06df1 Mon Sep 17 00:00:00 2001 From: Raphtalia Date: Tue, 20 Aug 2024 13:13:17 +0000 Subject: [PATCH] Update Setup --- Setup.md | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/Setup.md b/Setup.md index aaa5d39..ef26aee 100644 --- a/Setup.md +++ b/Setup.md @@ -1,18 +1,26 @@ This guide is to setup DungeonGenerationPlus inside your Unity project and interior mod. If you have already setup the plugin, [see here](https://git.touhou.dev/Raphtalia/DungeonGenerationPlus_LethalCompany_Mod/wiki/Quick-Setup) to setting up multiple main paths. # Setting up your Unity project -See [nomnom's guide](https://github.com/nomnomab/unity-lc-project-patcher) to setup your Unity project for Lethal Company modding. +See [nomnom's guide](https://github.com/nomnomab/unity-lc-project-patcher/blob/master/README.md) to setup your Unity project for Lethal Company modding. -See [Major's guide](https://www.youtube.com/watch?v=lsQl7P0PYs0) for the tutorial in creating an interior. +See Major's guide for the tutorial in creating an interior. + +[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/lsQl7P0PYs0/0.jpg)](https://www.youtube.com/watch?v=lsQl7P0PYs0) # Setting up the plugin in your Unity project -Download the `DunGenPlus.dll` through [Thunderstore](https://thunderstore.io/c/lethal-company/p/Alice/DungeonGenerationPlus/) or through this [Github repository](https://git.touhou.dev/Raphtalia/DungeonGenerationPlus_LethalCompany_Mod/src/branch/main/DunGenPlus/DunGenPlus/DunGenPlus/DunGenPlus.dll). Drag and drop the `.dll` file into your interior Unity project. This mod also requires the [LethalLevelLoader](https://thunderstore.io/c/lethal-company/p/IAmBatby/LethalLevelLoader/) plugin to be installed in your Unity project. With just those simple steps, the mod is installed. You can now setup and use this mod's features. +Download the `DunGenPlus.dll` through [Thunderstore](https://thunderstore.io/c/lethal-company/p/Alice/DungeonGenerationPlus/) or through this [Github repository](https://git.touhou.dev/Raphtalia/DungeonGenerationPlus_LethalCompany_Mod/src/branch/main/DunGenPlus/DunGenPlus/DunGenPlus/DunGenPlus.dll). Drag and drop the `.dll` file into your interior Unity project, anywhere under `PathToUnityProject/Assets/`. This mod also requires the [LethalLevelLoader](https://github.com/IAmBatby/LethalLevelLoader/blob/main/README.md) plugin to be installed in your Unity project. With just those simple steps, the mod is installed. You can now setup and use this mod's features. -This goes without saying, this mod also requires the DungeonGenerationPlus mod to be installed in your Lethal Company mod pack. +By using DungeonGenerationPlus, your mod becomes depended on this mod. DungeonGenerationPlus **MUST** be a mod installed into your Lethal Company mod pack. If you'd like to use this mod's API and callback features, reference the same `DunGenPlus.dll` file in your project solution thing. +```XML + + ..\..\..\Libraries\DunGenPlus.dll + +``` + # Setting up the DunGenExtender asset Inside the Project tab, right click to open the Assets tab. Select `Create/DunGenExtender` to create the `DunGenExtender` asset. Inside that asset, reference the `DungeonFlow` that will be linked to this Extender asset. Finally, set it's AssetBundle name to the same one as your interior's asset, `DungeonFlow` or `ExtendedDungeonFlow` whichever it may be. @@ -42,13 +50,8 @@ After any of the two previous steps, verify that the Extender was registered by # Setting up the API Callbacks -After your interior is selected but before the dungeon generation, a copy of the DunGenExtender's properties is created and passed to an event caller handler thing. If you want to modify these properties before they are used in the dungeon generation, you can register a function call to this event caller handler thing. +After your interior is selected but before the dungeon generation, a copy of the `DunGenExtender's` properties is created and passed to this event caller handler thing. If you want to modify these properties before they are used in the dungeon generation, you can register a function call to this event caller handler thing. -You may want to use these callbacks if you want to have configs for your dungeon generation. For example, my interior has a config to allow the player to specify how many multiple main paths they want spawned. Small party groups may want only two main paths, large party groups may want three, or maybe they just want a vanilla experience with just one main path. As such, I use this callback to easily modify the `MainPathCount`. - -> **NOTE:** The copy of the DunGenExtender's properties is only a shallow copy. You can replace any value in the copy and it won't affect the original properties. However if you modify any reference value such as the list `NormalNodeArchetypes` by adding or removing elements, then it will change the value in the original properties. - -The following is a code example of how to register a function call and how you may want to use it. ```cs public class Plugin : BaseUnityPlugin { void Awake() { @@ -57,6 +60,20 @@ public class Plugin : BaseUnityPlugin { extender.Events.OnModifyDunGenExtenderProperties.AddListener(UpdateDunGenExtenderProperties); } + void UpdateDunGenExtenderProperties(DunGenExtenderProperties props) { + // code that modifies the properties stuff + } +} + +``` + +You may want to use these callbacks if you want to have configs for your dungeon generation. For example, my interior has a config to allow the player to specify how many multiple main paths they want spawned. Small party groups may want only two main paths, large party groups may want three, or maybe they just want a vanilla experience with just one main path. As such, I use this callback to easily modify the `MainPathCount`. + +> **NOTE:** The copy of the `DunGenExtender's` properties is only a shallow copy. You can replace any value in the copy and it won't affect the corresponding value in the original properties. You **CANNOT** modify any value if it's a reference value. The list `NormalNodeArchetypes` is a reference value; it is the same object for the original and copied properties. You can replace this value in the copy as it will still exist in the original properties. If you modify the value by adding or removing elements, then the changes would be reflected in the original properties as well since they are both the same object. + +The following is a code example of how you may want to use it. Here is also an [example](https://git.touhou.dev/Raphtalia/SDM_LethalCompany_Mod/src/commit/523e7ed898edfe5445b9726c324cdb6a4d424de4/ScarletMansion/ScarletMansion/DunGenPatch/Patch.cs#L61) of how my interior uses it. +```cs +public class Plugin : BaseUnityPlugin { void UpdateDunGenExtenderProperties(DunGenExtenderProperties props) { props.MainPathCount = PluginConfig.Instance.mainPathCountValue; props.DungeonSizeBase = new Vector3(PluginConfig.Instance.dunGenWidthBaseValue, props.DungeonSizeBase.y, PluginConfig.Instance.dunGenLengthBaseValue);