Update Setup
parent
4c0ecde7a5
commit
af1aad8de1
9
Setup.md
9
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,10 +71,11 @@ 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);
|
||||
|
@ -82,3 +83,5 @@ public class Plugin : BaseUnityPlugin {
|
|||
}
|
||||
|
||||
```
|
||||
|
||||
> **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`.
|
||||
|
|
Loading…
Reference in New Issue