From a46f833b2762ec332d4f3693944c3a02dc3a1eca Mon Sep 17 00:00:00 2001 From: LadyAliceMargatroid Date: Fri, 7 Feb 2025 08:32:29 -0800 Subject: [PATCH] Redone some code due to changes to DunGenPlus Added audio to radios Made dungeon bigger but branch paths shorter Increased lighting chance --- .../ScarletMansionMimicsPatch/Patch.cs | 6 ------ .../ScarletMansion/Configs/ConfigDungeon.cs | 6 +++--- .../Configs/ConfigDungeonBasement.cs | 16 ++++++++-------- .../Configs/ConfigDungeonFoyer.cs | 14 +++++++------- .../Components/FloorCleanUpParent.cs | 8 ++++++-- .../GamePatch/Components/ScarletRadio.cs | 10 ++++++++++ .../FixValues/FixHallwayLightValueScaleVer.cs | 19 +++++++++++++++++++ ScarletMansion/ScarletMansion/Plugin.cs | 2 -- .../ScarletMansion/ScarletMansion.csproj | 1 + 9 files changed, 54 insertions(+), 28 deletions(-) create mode 100644 ScarletMansion/ScarletMansion/GamePatch/FixValues/FixHallwayLightValueScaleVer.cs diff --git a/MimicsPatch/ScarletMansionMimicsPatch/Patch.cs b/MimicsPatch/ScarletMansionMimicsPatch/Patch.cs index d9a2f94..f4e2ec9 100644 --- a/MimicsPatch/ScarletMansionMimicsPatch/Patch.cs +++ b/MimicsPatch/ScarletMansionMimicsPatch/Patch.cs @@ -46,12 +46,6 @@ namespace ScarletMansionMimicsPatch { public override bool IsMyInteriorLoaded => ScarletMansion.DunGenPatch.Patch.active; public override void OnMimicCreated(MimicDoor mimicDoor, Doorway doorway) { - var c = doorway.transform.parent.GetComponentInChildren(); - if (c != null) { - c.overrideConnector = true; - c.overrideNoDoorway = true; - } - var fixfireexit = doorway.GetComponentInChildren(true); fixfireexit.ForcefullyEnableDoorway(); diff --git a/ScarletMansion/ScarletMansion/Configs/ConfigDungeon.cs b/ScarletMansion/ScarletMansion/Configs/ConfigDungeon.cs index 9ef15e2..b3fe355 100644 --- a/ScarletMansion/ScarletMansion/Configs/ConfigDungeon.cs +++ b/ScarletMansion/ScarletMansion/Configs/ConfigDungeon.cs @@ -181,7 +181,7 @@ namespace ScarletMansion.Configs { dungeonLightingPrefix, "0 Lights Weight", 1, - "The weight that none of the spawned light sources (desk lamps, wall lamps, chandeliers) in a given tile will emit light. With the default weight spread of [1, 7, 2], there is a 10% chance that even in a room filled with lamps, none of them will emit light.", + "The weight that none of the spawned light sources (desk lamps, wall lamps, chandeliers) in a given tile will emit light. With the default weight spread of [1, 6, 3], there is a 10% chance that even in a room filled with lamps, none of them will emit light.", new ConfigEntryBundleExtraParameters(VerifyLightingValues, false), new AcceptableValueRange(0, 99) ); @@ -190,7 +190,7 @@ namespace ScarletMansion.Configs { dungeonLightingPrefix, "1 Light Weight", 7, - "The weight that only 1 of the spawned light sources (desk lamps, wall lamps, chandeliers) in a given tile will emit light. With the default weight spread of [1, 7, 2], there is a 70% chance that even in a room filled with lamps, only one of them will emit light.", + "The weight that only 1 of the spawned light sources (desk lamps, wall lamps, chandeliers) in a given tile will emit light. With the default weight spread of [1, 6, 3], there is a 60% chance that even in a room filled with lamps, only one of them will emit light.", new ConfigEntryBundleExtraParameters(VerifyLightingValues, false), new AcceptableValueRange(0, 99) ); @@ -199,7 +199,7 @@ namespace ScarletMansion.Configs { dungeonLightingPrefix, "2 Lights Weight", 2, - "The weight that only 2 of the spawned light sources (desk lamps, wall lamps, chandeliers) in a given tile will emit light. With the default weight spread of [1, 7, 2], there is a 20% chance that even in a room filled with lamps, only two of them will emit light.", + "The weight that only 2 of the spawned light sources (desk lamps, wall lamps, chandeliers) in a given tile will emit light. With the default weight spread of [1, 6, 3], there is a 30% chance that even in a room filled with lamps, only two of them will emit light.", new ConfigEntryBundleExtraParameters(VerifyLightingValues, true), new AcceptableValueRange(0, 99) ); diff --git a/ScarletMansion/ScarletMansion/Configs/ConfigDungeonBasement.cs b/ScarletMansion/ScarletMansion/Configs/ConfigDungeonBasement.cs index 00e22a8..d4eb615 100644 --- a/ScarletMansion/ScarletMansion/Configs/ConfigDungeonBasement.cs +++ b/ScarletMansion/ScarletMansion/Configs/ConfigDungeonBasement.cs @@ -33,9 +33,9 @@ namespace ScarletMansion.Configs new ChangeFloat ( dunGenLengthMultiFactor, 0.3333333f ), new ChangeInt ( mainPathCount, 3 ), - new ChangeMinMaxInt ( mainPathLength, 4, 5 ), + new ChangeMinMaxInt ( mainPathLength, 6, 7 ), - new ChangeBranchingPath( branchPathSectionOne, 2, 4, 1, 2 ), + new ChangeBranchingPath( branchPathSectionOne, 1, 2, 1, 2 ), new ChangeBranchingPath( branchPathSectionTwo, 1, 2, 1, 2 ), new ChangeBranchingPath( branchPathSectionThree, 0, 1, 0, 1 ), @@ -135,8 +135,8 @@ namespace ScarletMansion.Configs new ChangeInt ( hallwayLightsWeight, 150 ), new ChangeInt ( ceilingLightsWeight, 150 ), new ChangeInt ( lightsSpawnZeroWeight, 1 ), - new ChangeInt ( lightsSpawnOneWeight, 8 ), - new ChangeInt ( lightsSpawnTwoWeight, 2 ) + new ChangeInt ( lightsSpawnOneWeight, 6 ), + new ChangeInt ( lightsSpawnTwoWeight, 3 ) ); var brightLighting = new ChangeList( @@ -145,8 +145,8 @@ namespace ScarletMansion.Configs new ChangeInt ( hallwayLightsWeight, 450 ), new ChangeInt ( ceilingLightsWeight, 450 ), new ChangeInt ( lightsSpawnZeroWeight, 0 ), - new ChangeInt ( lightsSpawnOneWeight, 7 ), - new ChangeInt ( lightsSpawnTwoWeight, 3 ) + new ChangeInt ( lightsSpawnOneWeight, 3 ), + new ChangeInt ( lightsSpawnTwoWeight, 7 ) ); var darkLighting = new ChangeList( @@ -154,8 +154,8 @@ namespace ScarletMansion.Configs "Makes light sources much less common.", new ChangeInt ( hallwayLightsWeight, 50 ), new ChangeInt ( ceilingLightsWeight, 50 ), - new ChangeInt ( lightsSpawnZeroWeight, 2 ), - new ChangeInt ( lightsSpawnOneWeight, 8 ), + new ChangeInt ( lightsSpawnZeroWeight, 3 ), + new ChangeInt ( lightsSpawnOneWeight, 7 ), new ChangeInt ( lightsSpawnTwoWeight, 0 ) ); diff --git a/ScarletMansion/ScarletMansion/Configs/ConfigDungeonFoyer.cs b/ScarletMansion/ScarletMansion/Configs/ConfigDungeonFoyer.cs index 1de51ed..07a0c8d 100644 --- a/ScarletMansion/ScarletMansion/Configs/ConfigDungeonFoyer.cs +++ b/ScarletMansion/ScarletMansion/Configs/ConfigDungeonFoyer.cs @@ -33,7 +33,7 @@ namespace ScarletMansion.Configs { new ChangeFloat ( dunGenLengthMultiFactor, 0.3333333f ), new ChangeInt ( mainPathCount, 3 ), - new ChangeMinMaxInt ( mainPathLength, 3, 4 ), + new ChangeMinMaxInt ( mainPathLength, 4, 5 ), new ChangeBranchingPath( branchPathSectionOne, 4, 6, 1, 2 ), new ChangeBranchingPath( branchPathSectionTwo, 2, 3, 1, 2 ), @@ -135,8 +135,8 @@ namespace ScarletMansion.Configs { new ChangeInt ( hallwayLightsWeight, 150 ), new ChangeInt ( ceilingLightsWeight, 150 ), new ChangeInt ( lightsSpawnZeroWeight, 1 ), - new ChangeInt ( lightsSpawnOneWeight, 8 ), - new ChangeInt ( lightsSpawnTwoWeight, 2 ) + new ChangeInt ( lightsSpawnOneWeight, 6 ), + new ChangeInt ( lightsSpawnTwoWeight, 3 ) ); var brightLighting = new ChangeList( @@ -145,8 +145,8 @@ namespace ScarletMansion.Configs { new ChangeInt ( hallwayLightsWeight, 450 ), new ChangeInt ( ceilingLightsWeight, 450 ), new ChangeInt ( lightsSpawnZeroWeight, 0 ), - new ChangeInt ( lightsSpawnOneWeight, 7 ), - new ChangeInt ( lightsSpawnTwoWeight, 3 ) + new ChangeInt ( lightsSpawnOneWeight, 3 ), + new ChangeInt ( lightsSpawnTwoWeight, 7 ) ); var darkLighting = new ChangeList( @@ -154,8 +154,8 @@ namespace ScarletMansion.Configs { "Makes light sources much less common.", new ChangeInt ( hallwayLightsWeight, 50 ), new ChangeInt ( ceilingLightsWeight, 50 ), - new ChangeInt ( lightsSpawnZeroWeight, 2 ), - new ChangeInt ( lightsSpawnOneWeight, 8 ), + new ChangeInt ( lightsSpawnZeroWeight, 3 ), + new ChangeInt ( lightsSpawnOneWeight, 7 ), new ChangeInt ( lightsSpawnTwoWeight, 0 ) ); diff --git a/ScarletMansion/ScarletMansion/GamePatch/Components/FloorCleanUpParent.cs b/ScarletMansion/ScarletMansion/GamePatch/Components/FloorCleanUpParent.cs index 00467a0..f3252c9 100644 --- a/ScarletMansion/ScarletMansion/GamePatch/Components/FloorCleanUpParent.cs +++ b/ScarletMansion/ScarletMansion/GamePatch/Components/FloorCleanUpParent.cs @@ -7,7 +7,7 @@ using UnityEngine; using DunGen; namespace ScarletMansion { - public class FloorCleanUpParent : MonoBehaviour, IDungeonCompleteReceiver { + public class FloorCleanUpParent : MonoBehaviour { public FloorCleanup[] children; @@ -15,7 +15,11 @@ namespace ScarletMansion { children = GetComponentsInChildren(); } - public void OnDungeonComplete(Dungeon dungeon) { + void Awake(){ + DunGenPlus.Managers.DoorwayManager.AddActionHook(DunGenPlus.Components.Scripting.DunGenScriptingHook.OnMainEntranceTeleportSpawned, OnDungeonComplete); + } + + public void OnDungeonComplete() { var anyChanges = true; while(anyChanges) { anyChanges = false; diff --git a/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletRadio.cs b/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletRadio.cs index 4594213..4af622b 100644 --- a/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletRadio.cs +++ b/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletRadio.cs @@ -21,6 +21,11 @@ namespace ScarletMansion.GamePatch.Components { [Header("Songs")] public AudioClip[] audioClips; + [Header("SFX")] + public AudioSource sfxAudioSource; + public AudioClip clickBigClip; + public AudioClip clickSmallClip; + [Header("References")] public AudioSource audioSource; public float maxVolume = 1f; @@ -103,6 +108,7 @@ namespace ScarletMansion.GamePatch.Components { if (playing) AttemptTurnOn(); else AttemptTurnOff(); + sfxAudioSource.PlayOneShot(clickBigClip); } [ServerRpc(RequireOwnership = false)] @@ -115,6 +121,8 @@ namespace ScarletMansion.GamePatch.Components { public void ToggleVolumeSwitchClientRpc(int volume){ this.volume = volume; audioSource.volume = maxVolume * (volume * 0.1f); + + sfxAudioSource.PlayOneShot(clickSmallClip); } [ServerRpc(RequireOwnership = false)] @@ -132,6 +140,8 @@ namespace ScarletMansion.GamePatch.Components { if (playing && audioSource.isPlaying) audioSource.Stop(); audioSource.clip = audioClips[audioIndex]; AttemptTurnOn(); + + sfxAudioSource.PlayOneShot(clickBigClip); } public void AttemptTurnOff(){ diff --git a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixHallwayLightValueScaleVer.cs b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixHallwayLightValueScaleVer.cs new file mode 100644 index 0000000..f490fd9 --- /dev/null +++ b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixHallwayLightValueScaleVer.cs @@ -0,0 +1,19 @@ +using DunGen; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ScarletMansion.GamePatch.FixValues +{ + public class FixHallwayLightValueScaleVer: FixBaseClass { + public void Awake(){ + var weight = target.Props.Weights[1]; + var value = Plugin.CurrentConfigDungeon.GetHallwayLightsWeight; + weight.MainPathWeight = value; + weight.BranchPathWeight = value; + } + + } +} diff --git a/ScarletMansion/ScarletMansion/Plugin.cs b/ScarletMansion/ScarletMansion/Plugin.cs index 621326b..63d7922 100644 --- a/ScarletMansion/ScarletMansion/Plugin.cs +++ b/ScarletMansion/ScarletMansion/Plugin.cs @@ -62,8 +62,6 @@ namespace ScarletMansion { var foyerFile = new ConfigFile(Path.Combine(Paths.ConfigPath, $"{modGUID}.foyer.cfg"), true); ConfigFoyer = new ConfigDungeonFoyer(foyerFile); - ConfigFoyer.SerializerTest(); - var basementFile = new ConfigFile(Path.Combine(Paths.ConfigPath, $"{modGUID}.basement.cfg"), true); ConfigBasement = new ConfigDungeonBasement(basementFile); diff --git a/ScarletMansion/ScarletMansion/ScarletMansion.csproj b/ScarletMansion/ScarletMansion/ScarletMansion.csproj index 47deec1..9141b6b 100644 --- a/ScarletMansion/ScarletMansion/ScarletMansion.csproj +++ b/ScarletMansion/ScarletMansion/ScarletMansion.csproj @@ -213,6 +213,7 @@ +