From af1aad8de1d69edf67763bcac410cee943401580 Mon Sep 17 00:00:00 2001 From: Raphtalia Date: Tue, 3 Sep 2024 03:06:16 +0000 Subject: [PATCH] Update Setup --- Setup.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Setup.md b/Setup.md index ef26aee..6496639 100644 --- a/Setup.md +++ b/Setup.md @@ -60,7 +60,7 @@ public class Plugin : BaseUnityPlugin { extender.Events.OnModifyDunGenExtenderProperties.AddListener(UpdateDunGenExtenderProperties); } - void UpdateDunGenExtenderProperties(DunGenExtenderProperties props) { + void UpdateDunGenExtenderProperties(DunGenExtenderProperties props, EventCallbackScenario callback) { // code that modifies the properties stuff } } @@ -71,14 +71,17 @@ You may want to use these callbacks if you want to have configs for your dungeon > **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. +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/4413d12ea3710b00a7bce3db5f236deb61855f00/ScarletMansion/ScarletMansion/DunGenPatch/Patch.cs#L73) of how my interior uses it. ```cs public class Plugin : BaseUnityPlugin { - void UpdateDunGenExtenderProperties(DunGenExtenderProperties props) { + void UpdateDunGenExtenderProperties(DunGenExtenderProperties props, EventCallbackScenario callback) { + if (callback.IsDevDebug) return; props.MainPathCount = PluginConfig.Instance.mainPathCountValue; props.DungeonSizeBase = new Vector3(PluginConfig.Instance.dunGenWidthBaseValue, props.DungeonSizeBase.y, PluginConfig.Instance.dunGenLengthBaseValue); props.DungeonSizeFactor = new Vector3(PluginConfig.Instance.dunGenWidthMultiFactorValue, props.DungeonSizeFactor.y, PluginConfig.Instance.dunGenLengthMultiFactorValue); } } -``` \ No newline at end of file +``` + +> **NOTE:** The purpose of `EventCallbackScenario` is purely for DevDebug mode. That mode replicates how Lethal Company generates dungeons for perfect accuracy, which also includes invoking the event `DunGenExtender.Events.OnModifyDunGenExtenderProperties`. If you don't want that callback to called and affect the dungeon generation during DevDebug mode, then you can return early by checking for `EventCallbackScenario.IsDevDebug`.