diff --git a/DungeonFoyer/DungeonFoyer.sln b/DungeonFoyer/DungeonFoyer.sln
deleted file mode 100644
index 7047a04..0000000
--- a/DungeonFoyer/DungeonFoyer.sln
+++ /dev/null
@@ -1,25 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.10.35122.118
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DungeonFoyer", "DungeonFoyer\DungeonFoyer.csproj", "{A0E41AED-7C98-4A4D-B09B-1E59375420D9}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {A0E41AED-7C98-4A4D-B09B-1E59375420D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A0E41AED-7C98-4A4D-B09B-1E59375420D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A0E41AED-7C98-4A4D-B09B-1E59375420D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A0E41AED-7C98-4A4D-B09B-1E59375420D9}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {A173D2B7-7098-4906-881E-72A9A6F15BEC}
- EndGlobalSection
-EndGlobal
diff --git a/DungeonFoyer/DungeonFoyer/DungeonFoyer.csproj b/DungeonFoyer/DungeonFoyer/DungeonFoyer.csproj
deleted file mode 100644
index 90a92b7..0000000
--- a/DungeonFoyer/DungeonFoyer/DungeonFoyer.csproj
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {A0E41AED-7C98-4A4D-B09B-1E59375420D9}
- Library
- Properties
- DungeonFoyer
- DungeonFoyer
- v4.8
- 512
- true
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\..\..\Libraries\0Harmony.dll
-
-
- ..\..\..\Libraries\BepInEx.dll
-
-
- ..\..\..\Libraries\BepInEx.Harmony.dll
-
-
- ..\..\..\Libraries\LethalConfig.dll
-
-
-
-
-
-
-
-
-
-
- ..\..\..\Libraries\UnityEngine.dll
-
-
- ..\..\..\Libraries\UnityEngine.CoreModule.dll
-
-
- False
- ..\..\..\Libraries\UnityEngine.ImageConversionModule.dll
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DungeonFoyer/DungeonFoyer/Plugin.cs b/DungeonFoyer/DungeonFoyer/Plugin.cs
deleted file mode 100644
index 654dcd8..0000000
--- a/DungeonFoyer/DungeonFoyer/Plugin.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using BepInEx;
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.IO;
-using UnityEngine;
-using System.Reflection;
-using BepInEx.Logging;
-using HarmonyLib.Tools;
-
-namespace DungeonFoyer {
-
- [BepInDependency("ainavt.lc.lethalconfig", "1.4.2")]
- [BepInPlugin(modGUID, modName, modVersion)]
- public class Plugin : BaseUnityPlugin {
-
- public const string modGUID = "dev.ladyalice.scarletmansion.foyer";
- private const string modName = "Scarlet Foyer";
- private const string modVersion = "1.0.0";
-
- public static ManualLogSource logger { get; internal set; }
-
- void Awake(){
-
- logger = BepInEx.Logging.Logger.CreateLogSource(modGUID);
- logger.LogInfo($"Plugin {modName} has been added!");
-
- // the entire purpose this plugin is so I have a unique assembly for Lethal Config
- var assemblyPath = Assembly.GetExecutingAssembly().Location;
- var path = Path.Combine(Path.GetDirectoryName(assemblyPath), "foyer.png");
- var texture2D = LoadTexture(path);
- var icon = Sprite.Create(texture2D, new Rect(0, 0, texture2D.width, texture2D.height), Vector2.zero);
-
- LethalConfig.LethalConfigManager.SetModIcon(icon);
- LethalConfig.LethalConfigManager.SetModDescription("This is the config for the Scarlet Devil Mansion's Foyer dungeon variant.");
- }
-
- Texture2D LoadTexture(string FilePath) {
- Texture2D Tex2D;
- byte[] FileData;
-
- if (File.Exists(FilePath)){
- FileData = File.ReadAllBytes(FilePath);
- Tex2D = new Texture2D(2, 2);
- Tex2D.LoadImage(FileData);
- return Tex2D;
- }
- return null;
- }
-
- }
-}
diff --git a/DungeonFoyer/DungeonFoyer/Properties/AssemblyInfo.cs b/DungeonFoyer/DungeonFoyer/Properties/AssemblyInfo.cs
deleted file mode 100644
index 8fd70b4..0000000
--- a/DungeonFoyer/DungeonFoyer/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// アセンブリに関する一般情報は以下を通して制御されます
-// 制御されます。アセンブリに関連付けられている情報を変更するには、
-// これらの属性値を変更してください。
-[assembly: AssemblyTitle("DungeonFoyer")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("DungeonFoyer")]
-[assembly: AssemblyCopyright("Copyright © 2025")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから
-// 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、
-// その型の ComVisible 属性を true に設定してください。
-[assembly: ComVisible(false)]
-
-// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
-[assembly: Guid("a0e41aed-7c98-4a4d-b09b-1e59375420d9")]
-
-// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
-//
-// メジャー バージョン
-// マイナー バージョン
-// ビルド番号
-// リビジョン
-//
-// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
-// 既定値にすることができます:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/MimicsPatch/ScarletMansionMimicsPatch/Patch.cs b/MimicsPatch/ScarletMansionMimicsPatch/Patch.cs
index 94b9b6a..4f15df8 100644
--- a/MimicsPatch/ScarletMansionMimicsPatch/Patch.cs
+++ b/MimicsPatch/ScarletMansionMimicsPatch/Patch.cs
@@ -25,7 +25,6 @@ namespace ScarletMansionMimicsPatch {
public static void Activate() {
MimicsAPI.GetAPI().RegisterMimicEventHandler(new Patch.SDMMimicEventHandler());
- //Mimics.Mimics.InteriorWhitelist.Add();
Plugin.Instance.harmony.PatchAll(typeof(Patch));
}
diff --git a/ScarletMansion/ScarletMansion/Assets.cs b/ScarletMansion/ScarletMansion/Assets.cs
index 6602bcd..6a9c206 100644
--- a/ScarletMansion/ScarletMansion/Assets.cs
+++ b/ScarletMansion/ScarletMansion/Assets.cs
@@ -12,7 +12,6 @@ using LethalLib.Modules;
using LethalLevelLoader;
using DunGenPlus;
using ScarletMansion.ModPatch;
-using ScarletMansion.Configs;
namespace ScarletMansion {
public static class Assets {
@@ -26,10 +25,15 @@ namespace ScarletMansion {
// main assets
public static AssetBundle MainAssetBundle = null;
- public static ExtendedMod extendedMod;
+ public static DungeonFlow dungeon;
+ public static DunGenExtender dunGenExtender;
public static NetworkObjectListScriptableObject networkObjectList;
public static AudioClip entranceAudioClip;
+ // extended dungeon values
+ public static ExtendedMod extendedMod;
+ public static ExtendedDungeonFlow dungeonExtended;
+
// enemy values
public class Enemy {
@@ -62,9 +66,9 @@ namespace ScarletMansion {
public Item item;
private int _itemId;
- public Func configItemEntryFunc;
+ public Func configItemEntryFunc;
- public GlobalItem(Item item, Func configItemEntryFunc) {
+ public GlobalItem(Item item, Func configItemEntryFunc) {
this.item = item;
_itemId = -1;
this.configItemEntryFunc = configItemEntryFunc;
@@ -90,7 +94,7 @@ namespace ScarletMansion {
}
}
- public ConfigItem GetConfigItemEntry(){
+ public PluginConfig.Item GetConfigItemEntry(){
return configItemEntryFunc();
}
}
@@ -98,9 +102,9 @@ namespace ScarletMansion {
public class ScrapItem : GlobalItem {
public bool SpawnsOnMap => configScrapItemEntryFunc != null;
- public Func configScrapItemEntryFunc;
+ public Func configScrapItemEntryFunc;
- public ScrapItem(Item item, Func configScrapItemEntryFunc) : base (item, configScrapItemEntryFunc){
+ public ScrapItem(Item item, Func configScrapItemEntryFunc) : base (item, configScrapItemEntryFunc){
this.configScrapItemEntryFunc = configScrapItemEntryFunc;
}
@@ -120,7 +124,7 @@ namespace ScarletMansion {
return item;
}
- public ConfigScrapItem GetConfigScrapItemEntry(){
+ public PluginConfig.ScrapItem GetConfigScrapItemEntry(){
return configScrapItemEntryFunc();
}
@@ -134,7 +138,7 @@ namespace ScarletMansion {
public int lethalHelmetIndex = -1;
public int scarletHelmetIndex = -1;
- public Flashlight(string baseName, int lethalHelmetIndex, Func configEntryFunc) : base(null, configEntryFunc) {
+ public Flashlight(string baseName, int lethalHelmetIndex, Func configEntryFunc) : base(null, configEntryFunc) {
assetName = $"Scarlet{baseName}";
displayName = $"D. {baseName}";
this.lethalHelmetIndex = lethalHelmetIndex;
@@ -153,11 +157,10 @@ namespace ScarletMansion {
public static List globalItems;
public static List scrapItems;
- public static Dictionary> itemConfigTable = new Dictionary>(){
- { "Deco. crystal", () => ConfigMain.Instance.crystalValue },
- { "Shattered deco. crystal", () => ConfigMain.Instance.crystalBrokenValue },
- { "Doll Snow Globe", () => ConfigMain.Instance.snowGlobeValue },
- { "Gohei", () => ConfigMain.Instance.goheiValue }
+ public static Dictionary> itemConfigTable = new Dictionary>(){
+ { "Deco. crystal", () => PluginConfig.Instance.crystalValue },
+ { "Shattered deco. crystal", () => PluginConfig.Instance.crystalBrokenValue },
+ { "Doll Snow Globe", () => PluginConfig.Instance.snowGlobeValue }
};
@@ -208,9 +211,9 @@ namespace ScarletMansion {
}
- Plugin.ConfigFoyer.dungeon = Load("SDMLevel");
- Plugin.ConfigFoyer.dunGenExtender = Load("DunGenExtender");
+ dungeon = Load("SDMLevel");
networkObjectList = Load("SDMList");
+ dunGenExtender = Load("DunGenExtender");
entranceAudioClip = Load("entrance_ogg");
knight = new Enemy(
@@ -245,12 +248,12 @@ namespace ScarletMansion {
Plugin.logger.LogDebug($"Scrap Item {i.itemName} registered");
}
- key = new GlobalItem(networkObjectList.items[0], () => ConfigMain.Instance.scarletKeyValue);
+ key = new GlobalItem(networkObjectList.items[0], () => PluginConfig.Instance.scarletKeyValue);
globalItems.Add(key);
Items.RegisterItem(key.item);
- flashlight = new Flashlight("Pro Flashlight", 0, () => ConfigMain.Instance.decoProFlashlightValue);
- flashlightBB = new Flashlight("Flashlight", 1, () => ConfigMain.Instance.decoFlashlightValue);
+ flashlight = new Flashlight("Pro Flashlight", 0, () => PluginConfig.Instance.decoProFlashlightValue);
+ flashlightBB = new Flashlight("Flashlight", 1, () => PluginConfig.Instance.decoFlashlightValue);
globalItems.Add(flashlight);
globalItems.Add(flashlightBB);
@@ -262,7 +265,7 @@ namespace ScarletMansion {
onAssetsLoadEvent.Call();
}
- public static Func GetItemConfigFunction(Item item){
+ public static Func GetItemConfigFunction(Item item){
var name = item.itemName;
if (itemConfigTable.TryGetValue(name, out var result)){
return result;
diff --git a/ScarletMansion/ScarletMansion/Configs/ConfigDungeon.cs b/ScarletMansion/ScarletMansion/Configs/ConfigDungeon.cs
deleted file mode 100644
index a01d743..0000000
--- a/ScarletMansion/ScarletMansion/Configs/ConfigDungeon.cs
+++ /dev/null
@@ -1,355 +0,0 @@
-using BepInEx.Configuration;
-using DunGen.Graph;
-using DunGenPlus;
-using LethalLevelLoader;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ScarletMansion.Configs {
-
- public class ConfigDungeon : ConfigManager, IConfigDungeon where T: ConfigDungeon {
-
- public DungeonFlow dungeon;
- public DunGenExtender dunGenExtender;
- public ExtendedDungeonFlow dungeonExtended;
-
- public ConfigDungeon(ConfigFile cfg) : base(cfg) { }
-
- // ----------------------------
- // BOUNDING BOX
- // ----------------------------
- public static ConfigEntryBundle dunGenWidthBase = new ConfigEntryBundle(
- dungeonGenerationBoundingBoxPrefix,
- "Width Base",
- 120,
- "The width (left-to-right) of the dungeon's bounding box.\nThe dungeon is generated within this bounding box and cannot generate tiles outside of it.\nIncreasing this value will make the dungeon less compact but less likely to fail generation and vice versa.\nDecreasing this value too much can make it impossible for the dungeon to generate.",
- null,
- new AcceptableValueRange(40, 200)
- );
-
- public static ConfigEntryBundle dunGenLengthBase = new ConfigEntryBundle(
- dungeonGenerationBoundingBoxPrefix,
- "Length Base",
- 80,
- "The length (forward-to-back) of the dungeon's bounding box.\nThe dungeon is generated within this bounding box and cannot generate tiles outside of it.\nIncreasing this value will make the dungeon less compact but less likely to fail generation and vice versa.\nDecreasing this value too much can make it impossible for the dungeon to generate.",
- null,
- new AcceptableValueRange(40, 200)
- );
-
- public static ConfigEntryBundle dunGenWidthMultiFactor = new ConfigEntryBundle(
- dungeonGenerationBoundingBoxPrefix,
- "Width Multiplier Factor",
- 0.5f,
- "The width (left-to-right) of the dungeon's bounding box increases based on the dungeon's size. That additional width is multiplied by this value.\nThe exact formula is width = base + (base * (size - 1) * factor).\nIncreasing this value will make the dungeon less compact but less likely to fail generation on bigger moons.\nSetting this value to 0 means that the base width will be a constant value no matter how small or big the moon may be.",
- null,
- new AcceptableValueRange(0f, 4f)
- );
-
- public static ConfigEntryBundle dunGenLengthMultiFactor = new ConfigEntryBundle(
- dungeonGenerationBoundingBoxPrefix,
- "Length Multiplier Factor",
- 0.3333333f,
- "The length (forward-to-back) of the dungeon's bounding box increases based on the dungeon's size. That additional length is multiplied by this value.\nThe exact formula is length = base + (base * (size - 1) * factor).\nIncreasing this value will make the dungeon less compact but less likely to fail generation on bigger moons.\nSetting this value to 0 means that the base length will be a constant value no matter how small or big the moon may be.",
- null,
- new AcceptableValueRange(0f, 4f)
- );
-
- public int dunGenWidthBaseValue;
- public int dunGenLengthBaseValue;
- public float dunGenWidthMultiFactorValue;
- public float dunGenLengthMultiFactorValue;
-
- public int GetDunGenWidthBase => dunGenWidthBaseValue;
- public int GetDunGenLengthBase => dunGenLengthBaseValue;
- public float GetDunGenWidthMultiFactor => dunGenWidthMultiFactorValue;
- public float GetDunGenLengthMultiFactor => dunGenLengthMultiFactorValue;
-
- // ----------------------------
- // MAIN PATH
- // ----------------------------
-
- public static ConfigEntryBundle mainPathCount = new ConfigEntryBundle(
- dungeonGenerationMPathsPrefix,
- "Main Path Count",
- 3,
- "The amount of main paths that the modified dungeon generation code must generate.\nDecreasing this value will make it much less likely to fail generation but will lower the length consistency of branching paths.\nSetting the value to 1 will revert back to the vanilla dungeon generation.",
- null,
- new AcceptableValueRange(1, 3)
- );
-
- private static readonly string _mainPathLengthPostMessage = "Decreasing this value will make the dungeon less likely to fail generation but will lower the length consistency of branching paths and vice versa.\nIncreasing this value too much can make it impossible for the dungeon to generate.";
-
- public static ConfigEntryBundleMinMax mainPathLength = new ConfigEntryBundleMinMax(
- dungeonGenerationMPathsPrefix,
- "Main Path Length Min",
- "Main Path Length Max",
- 3,
- 4,
- $"The minimum allowed length of the main path. This value is multiplied by the dungeon's size.\n\n{_mainPathLengthPostMessage}",
- $"The maximum allowed length of the main path. This value is multiplied by the dungeon's size.\n\n{_mainPathLengthPostMessage}",
- null,
- new AcceptableValueRange(3, 20)
- );
-
- public int mainPathCountValue;
- public ConfigIntRange mainPathLengthValue = new ConfigIntRange("main path length");
-
- public int GetMainPathCount => mainPathCountValue;
- public ConfigIntRange GetMainPathLength => mainPathLengthValue;
-
- // ----------------------------
- // BRANCHING PATH
- // ----------------------------
-
- public static ConfigEntryBundle branchMultiSim = new ConfigEntryBundle(
- dungeonGenerationBPathPrefix,
- "Use Branch Path Multi Sim",
- true,
- "If enabled, the dungeon generation will prioritize branch paths that connect to already generated tiles.\nThis increases the chance of circular/looping paths. Slows dungeon generation times a bit at the end.\n\nOnly works when MainPathCount is more than 1.",
- null
- );
- public static ConfigEntryBundle branchSimCount = new ConfigEntryBundle(
- dungeonGenerationBPathPrefix,
- "Branch Path Simlation Count",
- 5,
- "The maximum number of valid branch paths that the dungeon generation will simulate before choosing the best path.\nIncreasing this value gives the dungeon generation a higher chance of finding a good path but impacts dungeon generation times and vice versa.",
- null,
- new AcceptableValueRange(1, 10)
- );
-
- public bool branchMultiSimValue;
- public int branchSimCountValue;
-
- public bool GetBranchMultiSim => branchMultiSimValue;
- public int GetBranchSimCount => branchSimCountValue;
-
- // ----------------------------
- // BRANCHING PATH DETAILED
- // ----------------------------
-
- private static readonly string _branchPathSectionOneMessage = "Section 1 consists of the first 30% tiles of the main path (including the mayor entrance tile).";
- private static readonly string _branchPathSectionTwoMessage = "Section 2 consists of the middle tiles (30% - 70%) of the main path.";
- private static readonly string _branchPathSectionThreeMessage = "Section 3 consists of the last 30% tiles of the main path.";
-
- public static ConfigEntryBundleBranchingPath branchPathSectionOne = new ConfigEntryBundleBranchingPath(
- dungeonGenerationBPathOnePrefix, 1, _branchPathSectionOneMessage, 4, 6, 1, 2
- );
-
- public static ConfigEntryBundleBranchingPath branchPathSectionTwo = new ConfigEntryBundleBranchingPath(
- dungeonGenerationBPathTwoPrefix, 2, _branchPathSectionTwoMessage, 2, 3, 1, 2
- );
-
- public static ConfigEntryBundleBranchingPath branchPathSectionThree = new ConfigEntryBundleBranchingPath(
- dungeonGenerationBPathThreePrefix, 3, _branchPathSectionThreeMessage, 1, 2, 0, 1
- );
-
- public ConfigBranchingPathRange branchPathSectionOneValue = new ConfigBranchingPathRange("section one");
- public ConfigBranchingPathRange branchPathSectionTwoValue = new ConfigBranchingPathRange("section two");
- public ConfigBranchingPathRange branchPathSectionThreeValue = new ConfigBranchingPathRange("section three");
-
- public ConfigBranchingPathRange GetBranchPathSectionOne => branchPathSectionOneValue;
- public ConfigBranchingPathRange GetBranchPathSectionTwo => branchPathSectionTwoValue;
- public ConfigBranchingPathRange GetBranchPathSectionThree => branchPathSectionThreeValue;
-
- // ----------------------------
- // LIGHTING
- // ----------------------------
-
- public static ConfigEntryBundle hallwayLightsWeight = new ConfigEntryBundle(
- dungeonLightingPrefix,
- "Hallway Lights Weight",
- 150,
- "The weight for a hallway wall lamp to appear on its respective walls. With the default weight of 150 against the weight of the empty wall of 50, there is a 75% chance that a wall lamp will spawn. Setting the weight to 100 will give you a 67% chance, 450=90% chance, and so on.",
- null,
- new AcceptableValueRange(0, 999)
- );
-
- public static ConfigEntryBundle ceilingLightsWeight = new ConfigEntryBundle(
- dungeonLightingPrefix,
- "Chandelier Lights Weight",
- 150,
- "The weight for a chandelier to appear on its respective ceilings. With the default weight of 150 against the weight of the empty ceiling of 50, there is a 75% chance that a chandelier will spawn. Setting the weight to 100 will give you a 67% chance, 450=90% chance, and so on.",
- null,
- new AcceptableValueRange(0, 999)
- );
-
- public static ConfigEntryBundle lightsSpawnZeroWeight = new ConfigEntryBundle(
- 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.",
- new ConfigEntryBundleExtraParameters(VerifyLightingValues, false),
- new AcceptableValueRange(0, 99)
- );
-
- public static ConfigEntryBundle lightsSpawnOneWeight = new ConfigEntryBundle(
- 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.",
- new ConfigEntryBundleExtraParameters(VerifyLightingValues, false),
- new AcceptableValueRange(0, 99)
- );
-
- public static ConfigEntryBundle lightsSpawnTwoWeight = new ConfigEntryBundle(
- 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.",
- new ConfigEntryBundleExtraParameters(VerifyLightingValues, true),
- new AcceptableValueRange(0, 99)
- );
-
- public int hallwayLightsWeightValue;
- public int ceilingLightsWeightValue;
- public int lightsSpawnZeroWeightValue;
- public int lightsSpawnOneWeightValue;
- public int lightsSpawnTwoWeightValue;
-
- public int GetHallwayLightsWeight => hallwayLightsWeightValue;
- public int GetCeilingLightsWeight => ceilingLightsWeightValue;
- public int GetLightsSpawnZeroWeight => lightsSpawnZeroWeightValue;
- public int GetLightsSpawnOneWeight => lightsSpawnOneWeightValue;
- public int GetLightsSpawnTwoWeight => lightsSpawnTwoWeightValue;
-
- public static void VerifyLightingValues(T instance){
- if (instance.lightsSpawnZeroWeightValue == 0f && instance.lightsSpawnOneWeightValue == 0f && instance.lightsSpawnTwoWeightValue == 0f){
- instance.lightsSpawnZeroWeightValue = 1;
- }
- Plugin.logger.LogDebug("Verifying lightsSpawn 0/1/2 values");
- }
-
- // ----------------------------
- // BALANCE
- // ----------------------------
-
- public static ConfigEntryBundle lootMultiplier = new ConfigEntryBundle(
- dungeonBalancePrefix,
- "Loot Multiplier",
- 1.2f,
- "Multiplies the total amount of loot for the dungeon.",
- null,
- new AcceptableValueRange(0.25f, 4f)
- );
-
- public static ConfigEntryBundle mapHazardsMultiplier = new ConfigEntryBundle(
- dungeonEnemiesPrefix,
- "Map Hazards Multiplier",
- 1.6f,
- "Multiplies the total amount of map hazards (landmines, turrets) for the dungeon.",
- null,
- new AcceptableValueRange(0.25f, 4f)
- );
-
- public static ConfigEntryBundle minIndoorEnemySpawnCount = new ConfigEntryBundle(
- dungeonEnemiesPrefix,
- "Minimum Indoor Enemy Spawn Count",
- 1,
- "Increases the minimum amount of indoor enemies that spawn with each spawn wave. For reference, Eclipse is +3.",
- null,
- new AcceptableValueRange(0, 3)
- );
-
- public static ConfigEntryBundle paintingCount = new ConfigEntryBundle(
- dungeonPaintingEventPrefix,
- "Painting Count",
- 2,
- "The maximum amount of demonic paintings that spawn in the dungeon.",
- null,
- new AcceptableValueRange(0, 10)
- );
-
- public static ConfigEntryBundleMinMax paintingExtraLoot = new ConfigEntryBundleMinMax(
- dungeonPaintingEventPrefix,
- "Painting Extra Loot Min",
- "Painting Extra Loot Max",
- 0,
- 2,
- "The minimum allowed amount of extra loot that spawns after grabbing the demonic painting.",
- "The maximum allowed amount of extra loot that spawns after grabbing the demonic painting.",
- null,
- new AcceptableValueRange(0, 3)
- );
-
- public float lootMultiplierValue;
- public float mapHazardsMultiplierValue;
- public int minIndoorEnemySpawnCountValue;
- public int paintingCountValue;
- public ConfigIntRange paintingExtraLootValue = new ConfigIntRange("painting extra loot");
-
- public float GetLootMultiplier => lootMultiplierValue;
- public float GetMapHazardsMultiplier => mapHazardsMultiplierValue;
- public int GetMinIndoorEnemySpawnCount => minIndoorEnemySpawnCountValue;
- public int GetPaintingCount => paintingCountValue;
- public ConfigIntRange GetPaintingExtraLoot => paintingExtraLootValue;
-
- // ----------------------------
- // TREASURE ROOM
- // ----------------------------
-
- public static ConfigEntryBundle treasureRoomCount = new ConfigEntryBundle(
- dungeonTreasureRoomPrefix,
- "Treasure Room Count",
- 2,
- "The maximum amount of treasure rooms that spawn in the dungeon.",
- null,
- new AcceptableValueRange(0, 10)
- );
-
- public static ConfigEntryBundleMinMax treasureRoomLoot = new ConfigEntryBundleMinMax(
- dungeonTreasureRoomPrefix,
- "Treasure Room Loot Min",
- "Treasure Room Loot Max",
- 2,
- 3,
- "The minimum allowed amount of loot that spawns in the treasure room.",
- "The maximum allowed amount of loot that spawns in the treasure room.",
- null,
- new AcceptableValueRange(0, 6)
- );
-
- public int treasureRoomCountValue;
- public ConfigIntRange treasureRoomLootValue = new ConfigIntRange("treasure room loot");
-
- public int GetTreasureRoomCount => treasureRoomCountValue;
- public ConfigIntRange GetTreasureRoomLoot => treasureRoomLootValue;
-
- // Preset helper functions idk
-
- public static ConfigEntryBundle dungeonGenerationPreset = new ConfigEntryBundle(
- presetsPrefix,
- "Preset Dungeon Generation",
- DungeonGeneration.Default,
- $"Automatically updates config values based on this preset string. If you want to disable this, change this value to \"Custom\".\nPossible values are ({GetEnumNames()}).\nPlease use the mod LethalConfig for more information on these presets.",
- new ConfigEntryBundleExtraParameters((c) => UpdateFromPresetValue((int)dungeonGenerationPreset.config.Value, dungeonGenerationChangeList), true)
- );
-
- public static ConfigEntryBundle dungeonLightingPreset = new ConfigEntryBundle(
- presetsPrefix,
- "Preset Dungeon Lighting",
- DungeonLighting.Default,
- $"Automatically updates config values based on this preset string. If you want to disable this, change this value to \"Custom\".\nPossible values are ({GetEnumNames()}).\nPlease use the mod LethalConfig for more information on these presets.",
- new ConfigEntryBundleExtraParameters((c) => UpdateFromPresetValue((int)dungeonLightingPreset.config.Value, dungeonLightingChangeList), true)
- );
-
- public static List dungeonGenerationChangeList = new List();
- public static List dungeonLightingChangeList = new List();
-
- public static string GetEnumNames() where T: Enum {
- var str = string.Empty;
- var enums = Enum.GetNames(typeof(T)).Select(e => $"\"{e}\"");
- return string.Join(", ", enums);
- }
-
- public static void UpdateFromPresetValue(int value, List changeList){
- if (value >= 0 && value < changeList.Count) {
- var target = changeList[value];
- target.UpdateChanges();
- }
- }
-
- }
-}
diff --git a/ScarletMansion/ScarletMansion/Configs/ConfigDungeonFoyer.cs b/ScarletMansion/ScarletMansion/Configs/ConfigDungeonFoyer.cs
deleted file mode 100644
index 1de51ed..0000000
--- a/ScarletMansion/ScarletMansion/Configs/ConfigDungeonFoyer.cs
+++ /dev/null
@@ -1,171 +0,0 @@
-using BepInEx.Configuration;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ScarletMansion.Configs {
-
- public class ConfigDungeonFoyer : ConfigDungeon {
-
- public ConfigDungeonFoyer(ConfigFile cfg) : base(cfg) {
-
- AutoGenerateOnChangeConfig(cfg, dungeonGenerationPreset, dungeonLightingPreset);
-
- CreateDungeonGenerationChangeList();
- CreateDungeonLightingChangeList();
-
- dungeonGenerationPreset.Bind(cfg, this);
- dungeonLightingPreset.Bind(cfg, this);
- }
-
- public static void CreateDungeonGenerationChangeList(){
- var customChangeList = new ChangeList("Custom", "Disables auto loading of preset config values.");
-
- var defaultGeneration = new ChangeList(
- "Default",
- "The default generation values. Intended for lobbies with 3+ players.",
-
- new ChangeInt ( dunGenWidthBase, 120 ),
- new ChangeInt ( dunGenLengthBase, 80 ),
- new ChangeFloat ( dunGenWidthMultiFactor, 0.5f ),
- new ChangeFloat ( dunGenLengthMultiFactor, 0.3333333f ),
-
- new ChangeInt ( mainPathCount, 3 ),
- new ChangeMinMaxInt ( mainPathLength, 3, 4 ),
-
- new ChangeBranchingPath( branchPathSectionOne, 4, 6, 1, 2 ),
- new ChangeBranchingPath( branchPathSectionTwo, 2, 3, 1, 2 ),
- new ChangeBranchingPath( branchPathSectionThree, 1, 2, 0, 1 ),
-
- new ChangeFloat ( lootMultiplier, 1.2f ),
- new ChangeFloat( mapHazardsMultiplier, 1.6f ),
- new ChangeInt( minIndoorEnemySpawnCount, 1 ),
- new ChangeInt ( paintingCount, 2 ),
- new ChangeMinMaxInt( paintingExtraLoot, 0, 2 ),
-
- new ChangeInt( treasureRoomCount, 2 ),
- new ChangeMinMaxInt( treasureRoomLoot, 2, 3 )
-
- );
-
- var smallGeneration = new ChangeList(
- "Small",
- "A smaller variation of the default generation values. Intended for lobbies with 1-3 players.",
- defaultGeneration,
-
- new ChangeInt ( mainPathCount, 2 ),
-
- new ChangeFloat ( lootMultiplier, 1.1f ),
- new ChangeFloat ( mapHazardsMultiplier, 1.3f )
-
- );
-
- var moreLootGeneration = new ChangeList(
- "More Loot, More Danger",
- "Increases the amount of loot, map hazards, and starting enemies in the mansion. Intended for lobbies with 3+ players.",
- defaultGeneration,
-
- new ChangeFloat ( lootMultiplier, 1.4f ),
- new ChangeFloat ( mapHazardsMultiplier, 2.2f ),
- new ChangeInt ( minIndoorEnemySpawnCount, 2 ),
- new ChangeInt ( paintingCount, 3 ),
- new ChangeMinMaxInt( paintingExtraLoot, 1 , 3 ),
-
- new ChangeInt( treasureRoomCount, 3 ),
- new ChangeMinMaxInt( treasureRoomLoot, 3, 4 )
-
- );
-
- var bitMoreLootGeneration = new ChangeList(
- "Bit More Loot, Bit More Danger",
- "Increases the amount of loot, map hazards, and starting enemies in the mansion a bit. Intended for lobbies with 1-3 players.",
- smallGeneration,
-
- new ChangeFloat ( lootMultiplier, 1.3f ),
- new ChangeFloat ( mapHazardsMultiplier, 1.9f ),
- new ChangeInt ( minIndoorEnemySpawnCount, 2 ),
- new ChangeInt ( paintingCount, 3 ),
-
- new ChangeInt( treasureRoomCount, 3 )
-
- );
-
- var vanillaGeneration = new ChangeList(
- "Vanilla",
- "Changes the dungeon generation to match closer to a vanilla dungeon.",
- defaultGeneration,
-
- //new ChangeMinMaxFloat ( PluginConfig.dunGenMultiplier, float.MaxValue, 10f ),
- new ChangeInt ( dunGenWidthBase, 200 ),
- new ChangeInt ( dunGenLengthBase, 200 ),
- new ChangeFloat ( dunGenWidthMultiFactor, 4f ),
- new ChangeFloat ( dunGenLengthMultiFactor, 4f ),
-
- new ChangeInt ( mainPathCount, 1 ),
- new ChangeMinMaxInt ( mainPathLength, 6, 8 ),
-
- new ChangeBranchingPath( branchPathSectionOne, 3, 5, 2, 3 ),
- new ChangeBranchingPath( branchPathSectionTwo, 2, 3, 1, 2 ),
- new ChangeBranchingPath( branchPathSectionThree, 1, 2, 0, 1 ),
-
- new ChangeFloat ( lootMultiplier, 1f ),
- new ChangeFloat ( mapHazardsMultiplier, 1f ),
- new ChangeInt ( minIndoorEnemySpawnCount, 0 )
-
- );
-
- dungeonGenerationChangeList = new List() {
- customChangeList,
- defaultGeneration,
- smallGeneration,
- moreLootGeneration,
- bitMoreLootGeneration,
- vanillaGeneration
- };
- }
-
- public static void CreateDungeonLightingChangeList(){
- var customChangeList = new ChangeList("Custom", "Disables auto loading of preset config values.");
-
- var defaultLighting = new ChangeList(
- "Default",
- "The default lighting values.",
- new ChangeInt ( hallwayLightsWeight, 150 ),
- new ChangeInt ( ceilingLightsWeight, 150 ),
- new ChangeInt ( lightsSpawnZeroWeight, 1 ),
- new ChangeInt ( lightsSpawnOneWeight, 8 ),
- new ChangeInt ( lightsSpawnTwoWeight, 2 )
- );
-
- var brightLighting = new ChangeList(
- "Bright",
- "Makes light sources much more common.",
- new ChangeInt ( hallwayLightsWeight, 450 ),
- new ChangeInt ( ceilingLightsWeight, 450 ),
- new ChangeInt ( lightsSpawnZeroWeight, 0 ),
- new ChangeInt ( lightsSpawnOneWeight, 7 ),
- new ChangeInt ( lightsSpawnTwoWeight, 3 )
- );
-
- var darkLighting = new ChangeList(
- "Dark",
- "Makes light sources much less common.",
- new ChangeInt ( hallwayLightsWeight, 50 ),
- new ChangeInt ( ceilingLightsWeight, 50 ),
- new ChangeInt ( lightsSpawnZeroWeight, 2 ),
- new ChangeInt ( lightsSpawnOneWeight, 8 ),
- new ChangeInt ( lightsSpawnTwoWeight, 0 )
- );
-
- dungeonLightingChangeList = new List() {
- customChangeList,
- defaultLighting,
- brightLighting,
- darkLighting
- };
- }
-
- }
-}
diff --git a/ScarletMansion/ScarletMansion/Configs/ConfigMain.cs b/ScarletMansion/ScarletMansion/Configs/ConfigMain.cs
deleted file mode 100644
index 6ef6086..0000000
--- a/ScarletMansion/ScarletMansion/Configs/ConfigMain.cs
+++ /dev/null
@@ -1,131 +0,0 @@
-using BepInEx.Configuration;
-using ScarletMansion.GamePatch.Components;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ScarletMansion.Configs {
- public class ConfigMain : ConfigManager {
-
- public ConfigMain(ConfigFile cfg) : base(cfg) {
- AutoGenerateOnChangeConfig(cfg);
- }
-
- public static ConfigEntryBundleItem decoFlashlight = new ConfigEntryBundleItem(dungeonItemPrefix, "Deco Pro Flashlight ", "Deco Pro Flashlight", 0, 0);
- public static ConfigEntryBundleItem decoProFlashlight = new ConfigEntryBundleItem(dungeonItemPrefix, "Deco Flashlight ", "Deco Flashlight", 0, 0);
- public static ConfigEntryBundleItem scarletKey = new ConfigEntryBundleItem(dungeonItemPrefix, "Scarlet Key ", "Scarlet Key", 0, 0);
-
-
- public ConfigItem decoFlashlightValue = new ConfigItem("Deco Flashlight");
- public ConfigItem decoProFlashlightValue = new ConfigItem("Deco Pro Flashlight");
- public ConfigItem scarletKeyValue = new ConfigItem("Scarlet Key");
-
- public static ConfigEntryBundleScrapItem crystal = new ConfigEntryBundleScrapItem("Dungeon Item Deco Crystal", "Decorative Crystal", 110, 150, 50);
- public static ConfigEntryBundleScrapItem crystalBroken = new ConfigEntryBundleScrapItem("Dungeon Item Shattered Deco Crystal", "Shattered Decorative Crystal", 60, 80, 5);
- public static ConfigEntryBundleScrapItem snowGlobe = new ConfigEntryBundleScrapItem("Dungeon Item Snow Globe", "Snow Globe", 150, 320, 40);
- public static ConfigEntryBundleScrapItem gohei = new ConfigEntryBundleScrapItem("Dungeon Item Gohei", "Gohei", 70, 160, 60);
-
-
- public ConfigScrapItem crystalValue = new ConfigScrapItem("Crystal");
- public ConfigScrapItem crystalBrokenValue = new ConfigScrapItem("Shattered Crystal");
- public ConfigScrapItem snowGlobeValue = new ConfigScrapItem("Snow Globe");
- public ConfigScrapItem goheiValue = new ConfigScrapItem("Gohei");
-
- public static ConfigEntryBundleSpawnableEnemy knightEnemy = new ConfigEntryBundleSpawnableEnemy("Dungeon Enemy Knight", "Knight", "Coil-head", 0, 13f);
- public static ConfigEntryBundleSpawnableEnemy maidEnemy = new ConfigEntryBundleSpawnableEnemy("Dungeon Enemy Maid", "Maid", "Butler", 6, 5.5f);
- public static ConfigEntryBundleEnemy revEnemy = new ConfigEntryBundleEnemy("Dungeon Enemy Revenant", "Revenant", 0, 14.5f);
-
- public ConfigSpawnableEnemy knightEnemyValue = new ConfigSpawnableEnemy();
- public ConfigSpawnableEnemy maidEnemyValue = new ConfigSpawnableEnemy();
- public ConfigEnemy revEnemyValue = new ConfigEnemy();
-
- // features
-
- public static ConfigEntryBundle shovelDamage = new ConfigEntryBundle(
- dungeonFeaturesPrefix,
- "Door Shovel Damage",
- 45,
- "The amount of damage done by swinging your shovel at a SDM door. Door health equals to 100.",
- null,
- new AcceptableValueRange(0, 100)
- );
-
- public static ConfigEntryBundle shotgunDamage = new ConfigEntryBundle(
- dungeonFeaturesPrefix,
- "Door Shotgun Damage",
- 100,
- "The amount of damage done by shotgun blasting at a SDM door. Door health equals to 100.",
- null,
- new AcceptableValueRange(0, 100)
- );
-
- public static ConfigEntryBundle lockedDoorEnemyDamageMultiplier = new ConfigEntryBundle(
- dungeonFeaturesPrefix,
- "Locked Door Enemy Damage Multiplier",
- 0.5f,
- "The damage multiplier applied to an enemy's attacks against a locked SDM door.\nSetting the value to 0 means that enemies can't break through a locked SDM door like in vanilla.",
- null,
- new AcceptableValueRange(0f, 1f)
- );
-
- public static ConfigEntryBundle useSDMFireExits = new ConfigEntryBundle(
- dungeonFeaturesPrefix,
- "Use SDM Fire Exits",
- true,
- "If enabled, the dungeon will spawn its custom fire exits. If disabled, the dungeon will instead spawn the vanilla fire exits."
- );
-
- public int shovelDamageValue;
- public int shotgunDamageValue;
- public float lockedDoorEnemyDamageMultiplierValue;
- public bool useSDMFireExitsValue;
-
- // painting
- public static ConfigEntryBundle paintingValue = new ConfigEntryBundle(
- dungeonPaintingEventPrefix,
- "Painting Value",
- 100,
- "The scrap value of demonic paintings.",
- null,
- new AcceptableValueRange(0, 400)
- );
-
- public static ConfigEntryBundle paintingSpawnEnemy = new ConfigEntryBundle(
- dungeonPaintingEventPrefix,
- "Spawn Enemy",
- true,
- "If enabled, an enemy will spawn when the bedroom's painting event ends."
- );
-
- public static ConfigEntryBundle paintingEnemyList = new ConfigEntryBundle(
- dungeonPaintingEventPrefix,
- "Enemy List",
- "default",
- $"The enemies that can spawn when the bedroom's painting event ends, in the form of a comma separated list of enemy names along with optional parameters separated or '@'.It can accept either the enemy's internal or display name.\n\nThe available parameters are:\nSpawn Logic: 's#' where '#' is either '0' for normal spawn logic or '1' for special spawn logic. Only the knight and jester have special spawn logic. When their special spawn logic is enabled, the knight will spawn properly in the bedroom and the jester will spawn already cranking.\n\nThe following string \"default\" is a preset that uses the following string \"{ScarletBedroom.ENEMY_SPAWN_LIST_DEFAULT}\"."
- );
-
- public static ConfigEntryBundle paintingEnemyEvilSkin = new ConfigEntryBundle(
- dungeonPaintingEventPrefix,
- "Invader Apperance",
- true,
- "Enemies spawned from the bedroom's painting event has a pitch black and red appearance. Only valid for the default enemy list."
- );
-
- public static ConfigEntryBundle facilityMeltdownActive = new ConfigEntryBundle(
- dungeonPaintingEventPrefix,
- "Activate Facility Meltdown",
- false,
- "If enabled, facility meltdown will activate when the bedroom's painting event ends. Requires FacilityMeltdown v2.4.7 or higher."
- );
-
-
- public int paintingValueValue;
- public bool paintingSpawnEnemyValue;
- public string paintingEnemyListValue;
- public bool paintingEnemyEvilSkinValue;
- public bool facilityMeltdownActiveValue;
-
- }
-}
diff --git a/ScarletMansion/ScarletMansion/Configs/ConfigManager.cs b/ScarletMansion/ScarletMansion/Configs/ConfigManager.cs
deleted file mode 100644
index 65f59e7..0000000
--- a/ScarletMansion/ScarletMansion/Configs/ConfigManager.cs
+++ /dev/null
@@ -1,138 +0,0 @@
-using BepInEx.Configuration;
-using HarmonyLib;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-using Unity.Netcode;
-
-namespace ScarletMansion.Configs {
- public partial class ConfigManager : SyncedInstance where T: ConfigManager {
-
- public static string GetConfigPrefix => typeof(T).Name;
- public static string GetRequestMessage = $"{GetConfigPrefix}_OnRequestConfigSync";
- public static string GetReceiveMessage = $"{GetConfigPrefix}_OnReceieveConfigSync";
-
- public const string dungeonWeightPrefix = "Dungeon Weight";
- public const string dungeonGenerationPrefix = "Dungeon Generation";
- public const string dungeonGenerationBoundingBoxPrefix = "DunGen Bounding Box";
-
- public const string dungeonGenerationMPathsPrefix = "DunGen Main Path";
- public const string dungeonGenerationBPathPrefix = "DunGen Branching Path";
- public const string dungeonGenerationBPathOnePrefix = "DunGen Branching Path 1";
- public const string dungeonGenerationBPathTwoPrefix = "DunGen Branching Path 2";
- public const string dungeonGenerationBPathThreePrefix = "DunGen Branching Path 3";
-
- public const string dungeonItemPrefix = "Dungeon Items";
- public const string dungeonEnemiesPrefix = "Dungeon Enemies";
- public const string dungeonBalancePrefix = "Dungeon Balance";
-
- public const string dungeonFeaturesPrefix = "Dungeon Features";
- public const string dungeonPaintingEventPrefix = "Dungeon Painting Event";
- public const string dungeonTreasureRoomPrefix = "Dungeon Treasure Rooms";
- public const string dungeonLightingPrefix = "Lighting";
- public const string presetsPrefix = "_Presets";
-
- public ConfigManager(ConfigFile cfg){
- InitInstance(this as T);
- }
-
- public void AutoGenerateOnChangeConfig(ConfigFile cfg, params object[] ignoreTargets){
- var fields = typeof(T).GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
- foreach(var p in fields){
- var value = p.GetValue(this);
- if (ignoreTargets.Contains(value)) continue;
-
- var valueBundle = value as ConfigEntryBundleBase;
- if (valueBundle != null){
- var targetFieldName = $"{p.Name}Value";
- var targetField = typeof(T).GetField(targetFieldName, BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
- if (targetField == null) {
- Plugin.logger.LogError($"Could not find field {targetFieldName}");
- continue;
- }
- valueBundle.Bind(cfg, this as T, new ConfigEntryBundleBase.FieldPropertyInfo(targetField), this);
- }
- }
- }
-
- public static void RequestSync(){
- if (!IsClient) return;
- using (var stream = new FastBufferWriter(IntSize, Unity.Collections.Allocator.Temp)){
- SendMessage(stream, GetRequestMessage);
- }
- }
-
- public static void OnRequestSync(ulong clientId, FastBufferReader _){
- if (!IsHost) return;
- logger.LogDebug($"Config sync request received from client: {clientId}");
-
- var array = SerializeToBytes(Instance);
- var value = array.Length;
- using (var stream = new FastBufferWriter(value + IntSize, Unity.Collections.Allocator.Temp)){
- try {
- stream.WriteValueSafe(value, default(FastBufferWriter.ForPrimitives));
- stream.WriteBytesSafe(array);
-
- SendMessage(stream, GetReceiveMessage, clientId);
- } catch (Exception e){
- logger.LogError($"Error occurred syncing config with client: {clientId}\n{e}");
- }
- }
- }
-
- public static void OnReceiveSync(ulong _, FastBufferReader reader){
- if (!reader.TryBeginRead(IntSize)){
- logger.LogError("Config sync error: Could not begin reading buffer.");
- return;
- }
-
- reader.ReadValueSafe(out int val, default(FastBufferWriter.ForPrimitives));
- if (!reader.TryBeginRead(val)){
- logger.LogError("Config sync error: Host could not sync.");
- return;
- }
-
- var data = new byte[val];
- reader.ReadBytesSafe(ref data, val);
- SyncInstance(data);
- logger.LogDebug("Successfully synced config with host.");
- }
-
- [HarmonyPatch(typeof(GameNetcodeStuff.PlayerControllerB), "ConnectClientToPlayerObject")]
- [HarmonyPostfix]
- public static void InitializeLocalPlayer(){
- if (IsHost){
- MessageManager.RegisterNamedMessageHandler(GetRequestMessage, OnRequestSync);
- Synced = true;
- return;
- }
-
- Synced = false;
- MessageManager.RegisterNamedMessageHandler(GetReceiveMessage, OnReceiveSync);
- RequestSync();
- }
-
- [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
- [HarmonyPostfix]
- public static void PlayerLeave(){
- RevertSync();
- }
-
- public override string ToString() {
- var variables = typeof(T).GetFields(BindingFlags.Public | BindingFlags.Instance);
- return string.Join(", ", variables.Select(v => $"[{v.Name}]{v.GetValue(this)}"));
- }
-
- public void SerializerTest(){
- var bytes = SerializeToBytes(Instance);
- var copy = DeserializeFromBytes(bytes);
-
- Plugin.logger.LogDebug($"Inst: {Instance.ToString()}");
- Plugin.logger.LogDebug($"Copy: {copy.ToString()}");
- }
-
- }
-}
diff --git a/ScarletMansion/ScarletMansion/Configs/ConfigManagerClasses.cs b/ScarletMansion/ScarletMansion/Configs/ConfigManagerClasses.cs
deleted file mode 100644
index 8d4bdc9..0000000
--- a/ScarletMansion/ScarletMansion/Configs/ConfigManagerClasses.cs
+++ /dev/null
@@ -1,198 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Unity.Netcode;
-using System.Runtime.Serialization.Formatters.Binary;
-using System.IO;
-using HarmonyLib;
-using BepInEx;
-using BepInEx.Configuration;
-using BepInEx.Logging;
-using UnityEngine;
-using System.Reflection;
-
-namespace ScarletMansion.Configs {
-
- public partial class ConfigManager : SyncedInstance where T: ConfigManager {
-
- public abstract class ConfigEntryBundleBase {
-
- public class FieldPropertyInfo {
- public FieldInfo fieldInfo;
- public PropertyInfo propertyInfo;
-
- public FieldPropertyInfo(FieldInfo fieldInfo){
- this.fieldInfo = fieldInfo;
- }
-
- public FieldPropertyInfo(PropertyInfo propertyInfo){
- this.propertyInfo = propertyInfo;
- }
-
- public void SetValue(object obj, object value){
- if (fieldInfo != null) fieldInfo.SetValue(obj, value);
- if (propertyInfo != null) propertyInfo.SetValue(obj, value);
- }
-
- public object GetValue(object obj){
- if (fieldInfo != null) return fieldInfo.GetValue(obj);
- if (propertyInfo != null) return propertyInfo.GetValue(obj);
- return null;
- }
-
- public Type GetFieldPropertyType(){
- if (fieldInfo != null) return fieldInfo.FieldType;
- if (propertyInfo != null) return propertyInfo.PropertyType;
- return null;
- }
- }
-
- public abstract IEnumerable GetConfigs();
- public abstract void Bind(ConfigFile cfg, T instance, FieldPropertyInfo memberInfo, object memberTarget);
-
- }
-
- public class ConfigEntryBundleExtraParameters {
- public Action onSettingsChanged;
- public bool callOnBind;
-
- public ConfigEntryBundleExtraParameters(Action onSettingsChanged, bool callOnBind){
- this.onSettingsChanged = onSettingsChanged;
- this.callOnBind = callOnBind;
- }
-
- public void CallAction(T instance, bool isBind){
- if (isBind && !callOnBind) return;
- onSettingsChanged?.Invoke(instance);
- }
- }
-
- public class ConfigEntryBundle : ConfigEntryBundleBase {
- public ConfigEntry config;
- public ConfigDefinition definition;
- public U defaultValue;
- public ConfigDescription description;
- public ConfigEntryBundleExtraParameters extra;
-
- public ConfigEntryBundle(string section, string key, U dvalue, string desc, ConfigEntryBundleExtraParameters extra = null, AcceptableValueBase valuebase = null){
- definition = new ConfigDefinition(section, key);
- defaultValue = dvalue;
- description = new ConfigDescription(desc, valuebase);
-
- if (extra == null) extra = new ConfigEntryBundleExtraParameters(null, false);
- this.extra = extra;
- }
-
- public override void Bind(ConfigFile cfg, T instance, FieldPropertyInfo memberInfo, object memberTarget) {
- config = cfg.Bind(definition, defaultValue, description);
- config.SettingChanged += (obj, args) => {
- Plugin.logger.LogDebug($"Config settings {config.Definition.Key} changed");
- memberInfo.SetValue(memberTarget, config.Value);
- extra.CallAction(instance, false);
- };
-
- memberInfo.SetValue(memberTarget, config.Value);
- extra.CallAction(instance, true);
- }
-
- public void Bind(ConfigFile cfg, T instance){
- config = cfg.Bind(definition, defaultValue, description);
- config.SettingChanged += (obj, args) => {
- Plugin.logger.LogDebug($"Config settings {config.Definition.Key} changed");
- extra.CallAction(instance, false);
- };
-
- extra.CallAction(instance, true);
- }
-
- public override IEnumerable GetConfigs() {
- yield return config;
- }
-
- }
-
- public class ConfigEntryBundleMinMax : ConfigEntryBundleBase {
- public ConfigEntryBundle min;
- public ConfigEntryBundle max;
-
- public ConfigEntryBundleMinMax(string section, string keyMin, string keyMax, U defaultValueMin, U defaultValueMax, string descMin, string descMax, ConfigEntryBundleExtraParameters extra = null, AcceptableValueBase valuebase = null){
- min = new ConfigEntryBundle(section, keyMin, defaultValueMin, descMin, extra, valuebase);
- max = new ConfigEntryBundle(section, keyMax, defaultValueMax, descMax, extra, valuebase);
- }
-
- public override void Bind(ConfigFile cfg, T instance, FieldPropertyInfo memberInfo, object memberTarget) {
- var type = memberInfo.GetFieldPropertyType();
- var minProp = type.GetProperty("min", BindingFlags.Public | BindingFlags.Instance);
- var maxProp = type.GetProperty("max", BindingFlags.Public | BindingFlags.Instance);
- min.Bind(cfg, instance, new FieldPropertyInfo(minProp), memberInfo.GetValue(memberTarget));
- max.Bind(cfg, instance, new FieldPropertyInfo(maxProp), memberInfo.GetValue(memberTarget));
- }
-
- public override IEnumerable GetConfigs() {
- yield return min.config;
- yield return max.config;
- }
- }
-
- public class ConfigEntryBundleBranchingPath : ConfigEntryBundleBase {
- public ConfigEntryBundleMinMax count;
- public ConfigEntryBundleMinMax depth;
-
- // branching path mini sections
- private static string _branchPathBranchCountMessage(int section, string minmax, string middleSection) => $"The {minmax} amount of branching paths in Section {section} of the dungeon generation process.\n{middleSection}\n\n{_branchPathPostCountMessage}";
- private static string _branchPathBranchDepthMessage(int section, string minmax, string middleSection) => $"The {minmax} length of the branching paths in Section {section} of the dungeon generation process.\n{middleSection}\n\n{_branchPathPostDepthMessage}";
-
- private static readonly string _branchPathPostGenericMessage = "This is not an enforced number and the dungeon generation will proceed if it can't fit any tiles.";
- private static readonly string _branchPathPostCountMessage = $"Each tile on the main path will try to generate a number of branching paths equal to this number. {_branchPathPostGenericMessage}";
- private static readonly string _branchPathPostDepthMessage = $"Each branching path will try to generate a number of connecting tiles equal to this number. {_branchPathPostGenericMessage}";
-
-
- public ConfigEntryBundleBranchingPath(string section, int sectionId, string extraMessage, int countMinValue, int countMaxValue, int depthMinValue, int depthMaxValue, ConfigEntryBundleExtraParameters extra = null){
- count = new ConfigEntryBundleMinMax(
- section,
- $"Section {sectionId} Count Min",
- $"Section {sectionId} Count Max",
- countMinValue,
- countMaxValue,
- _branchPathBranchCountMessage(sectionId, "minimum", extraMessage),
- _branchPathBranchCountMessage(sectionId, "maximum", extraMessage),
- extra,
- new AcceptableValueRange(0, 20)
- );
-
- depth = new ConfigEntryBundleMinMax(
- section,
- $"Section {sectionId} Depth Min",
- $"Section {sectionId} Depth Max",
- depthMinValue,
- depthMaxValue,
- _branchPathBranchDepthMessage(sectionId, "minimum", extraMessage),
- _branchPathBranchDepthMessage(sectionId, "maximum", extraMessage),
- extra,
- new AcceptableValueRange(0, 20)
- );
- }
-
- public override void Bind(ConfigFile cfg, T instance, FieldPropertyInfo memberInfo, object memberTarget) {
- var type = memberInfo.GetFieldPropertyType();
- var countField = type.GetField("count", BindingFlags.Public | BindingFlags.Instance);
- var depthField = type.GetField("depth", BindingFlags.Public | BindingFlags.Instance);
- count.Bind(cfg, instance, new FieldPropertyInfo(countField), memberInfo.GetValue(memberTarget));
- depth.Bind(cfg, instance, new FieldPropertyInfo(depthField), memberInfo.GetValue(memberTarget));
- }
-
- public override IEnumerable GetConfigs() {
- foreach(var a in count.GetConfigs()) {
- yield return a;
- }
-
- foreach(var a in depth.GetConfigs()) {
- yield return a;
- }
- }
- }
-
- }
-}
diff --git a/ScarletMansion/ScarletMansion/Configs/ConfigManagerData.cs b/ScarletMansion/ScarletMansion/Configs/ConfigManagerData.cs
deleted file mode 100644
index 9970461..0000000
--- a/ScarletMansion/ScarletMansion/Configs/ConfigManagerData.cs
+++ /dev/null
@@ -1,132 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using UnityEngine;
-
-namespace ScarletMansion.Configs {
- public abstract class ConfigNumberRange {
- private string name;
- [SerializeField] protected T _min;
- [SerializeField] protected T _max;
-
- public T min {
- get {
- return _min;
- } set {
- _min = value;
- Verify();
- }
- }
-
- public T max {
- get {
- return _max;
- } set {
- _max = value;
- Verify();
- }
- }
-
- public ConfigNumberRange(string name){
- this.name = name;
- _min = default;
- _max = default;
- }
-
- public virtual void Verify(){
- Plugin.logger.LogDebug($"Verifying min/max for {name}");
- }
-
- public override string ToString() {
- return $"({min}, {max})";
- }
-
- }
-
- [System.Serializable]
- public class ConfigIntRange : ConfigNumberRange {
-
- public ConfigIntRange(string name) : base(name) { }
-
- public override void Verify() {
- base.Verify();
- _max = Mathf.Max(_min, _max);
- }
-
- public DunGen.IntRange GetDungenIntRange(){
- return new DunGen.IntRange(min, max);
- }
-
- }
-
- [System.Serializable]
- public class ConfigFloatRange : ConfigNumberRange {
-
- public ConfigFloatRange(string name) : base(name) { }
-
- public override void Verify() {
- base.Verify();
- _max = Mathf.Max(_min, _max);
- }
-
- public DunGen.FloatRange GetDungenFloatRange(){
- return new DunGen.FloatRange(min, max);
- }
- }
-
- [System.Serializable]
- public class ConfigBranchingPathRange {
- private string name;
- public ConfigIntRange count;
- public ConfigIntRange depth;
-
- public ConfigBranchingPathRange(string name){
- this.name = name;
- count = new ConfigIntRange($"{name} count");
- depth = new ConfigIntRange($"{name} depth");
- }
-
- public void UpdateValues(DunGen.DungeonArchetype archetype){
- archetype.BranchCount = new DunGen.IntRange(count.min, count.max);
- archetype.BranchingDepth = new DunGen.IntRange(depth.min, depth.max);
- }
-
- public override string ToString() {
- return $"{count.ToString()}+{depth.ToString()}";
- }
- }
-
- [System.Serializable]
- public class ConfigItem {
- public bool enabled;
- public ConfigIntRange valueRange;
-
- public ConfigItem(string name) {
- valueRange = new ConfigIntRange($"{name} value range");
- }
- }
-
- [System.Serializable]
- public class ConfigScrapItem : ConfigItem {
- public int spawnWeight;
- public bool spawnOnAllMoons;
-
- public ConfigScrapItem(string name) : base(name) { }
- }
-
- [System.Serializable]
- public class ConfigEnemy {
- public bool enabled;
- public int health;
- public float speed;
- }
-
- [System.Serializable]
- public class ConfigSpawnableEnemy : ConfigEnemy {
- public int spawnWeightBase;
- public float spawnWeightStealPercentage;
- }
-
-}
diff --git a/ScarletMansion/ScarletMansion/Configs/Enemies.cs b/ScarletMansion/ScarletMansion/Configs/Enemies.cs
deleted file mode 100644
index 9a1daf0..0000000
--- a/ScarletMansion/ScarletMansion/Configs/Enemies.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-using BepInEx.Configuration;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ScarletMansion.Configs {
-
- public partial class ConfigManager : SyncedInstance where T: ConfigManager {
-
- public class ConfigEntryBundleEnemy : ConfigEntryBundleBase {
- public ConfigEntryBundle enabled;
- public ConfigEntryBundle health;
- public ConfigEntryBundle speed;
-
- public ConfigEntryBundleEnemy(string section, string enemyName, int baseHealth, float baseSpeed, ConfigEntryBundleExtraParameters extra = null){
- var enabledDesc = $"If disabled, {enemyName} is disabled from spawning.";
- var healthDesc = $"The health of the {enemyName}. A shovel is 1 damage.";
- var speedDesc = $"The speed of the {enemyName} during their killing/aggressive stance. The player's default speed is 4.6.";
-
- enabled = new ConfigEntryBundle(section, "Enabled", true, enabledDesc, extra);
- health = new ConfigEntryBundle(section, "Health", baseHealth, healthDesc, extra, new AcceptableValueRange(1, 20));
- speed = new ConfigEntryBundle(section, "Speed", baseSpeed, speedDesc, extra, new AcceptableValueRange(1f, 20f));
- }
-
- public override void Bind(ConfigFile cfg, T instance, FieldPropertyInfo memberInfo, object memberTarget) {
- var type = memberInfo.GetFieldPropertyType();
- var enabledProp = type.GetField("enabled", BindingFlags.Public | BindingFlags.Instance);
- var healthProp = type.GetField("health", BindingFlags.Public | BindingFlags.Instance);
- var speedProp = type.GetField("speed", BindingFlags.Public | BindingFlags.Instance);
-
- enabled.Bind(cfg, instance, new FieldPropertyInfo(enabledProp), memberInfo.GetValue(memberTarget));
- if (health.defaultValue > 0) health.Bind(cfg, instance, new FieldPropertyInfo(healthProp), memberInfo.GetValue(memberTarget));
- speed.Bind(cfg, instance, new FieldPropertyInfo(speedProp), memberInfo.GetValue(memberTarget));
-
- }
-
- public override IEnumerable GetConfigs() {
- yield return enabled.config;
- if (health.defaultValue > 0) yield return health.config;
- yield return speed.config;
- }
- }
-
- public class ConfigEntryBundleSpawnableEnemy : ConfigEntryBundleEnemy {
- public ConfigEntryBundle spawnWeightBase;
- public ConfigEntryBundle spawnWeightStealPercentage;
-
- public ConfigEntryBundleSpawnableEnemy(string section, string enemyName, string replacementEnemyName, int baseHealth, float baseSpeed, ConfigEntryBundleExtraParameters extra = null) : base(section, enemyName, baseHealth, baseSpeed, extra) {
-
- var weightBaseDesc = $"The base spawn weight of the {enemyName}. This is added onto the spawn weight stolen from the {replacementEnemyName}, or the base weight of 10 if the moon doesn't spawn the {replacementEnemyName}.";
- var weightStealPercentageDesc = $"The percentage of spawn weight that the {enemyName} steals from the {replacementEnemyName} for that moon.\nSetting this 0 means that the {replacementEnemyName}'s weight is unaffected and the {enemyName}'s weight is based entirely by Spawn Weight Base.\nSetting this 1 means the {enemyName} effectively replaces the {replacementEnemyName}.";
-
- spawnWeightBase = new ConfigEntryBundle(section, "Spawn Weight Base", 0, weightBaseDesc, extra, new AcceptableValueRange(0, 999));
- spawnWeightStealPercentage = new ConfigEntryBundle(section, "Spawn Weight Steal Percentage", 0.75f, weightStealPercentageDesc, extra, new AcceptableValueRange(0f, 1f));
- }
-
- public override void Bind(ConfigFile cfg, T instance, FieldPropertyInfo memberInfo, object memberTarget) {
- base.Bind(cfg, instance, memberInfo, memberTarget);
-
- var type = memberInfo.GetFieldPropertyType();
- var weightBaseProp = type.GetField("spawnWeightBase", BindingFlags.Public | BindingFlags.Instance);
- var weightStealPercentageProp = type.GetField("spawnWeightStealPercentage", BindingFlags.Public | BindingFlags.Instance);
-
- spawnWeightBase.Bind(cfg, instance, new FieldPropertyInfo(weightBaseProp), memberInfo.GetValue(memberTarget));
- spawnWeightStealPercentage.Bind(cfg, instance, new FieldPropertyInfo(weightStealPercentageProp), memberInfo.GetValue(memberTarget));
- }
-
- public override IEnumerable GetConfigs() {
- foreach(var a in base.GetConfigs()) {
- yield return a;
- }
- yield return spawnWeightBase.config;
- yield return spawnWeightStealPercentage.config;
- }
- }
- }
-}
diff --git a/ScarletMansion/ScarletMansion/Configs/IConfigDungeon.cs b/ScarletMansion/ScarletMansion/Configs/IConfigDungeon.cs
deleted file mode 100644
index 0f96588..0000000
--- a/ScarletMansion/ScarletMansion/Configs/IConfigDungeon.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ScarletMansion.Configs {
- public interface IConfigDungeon {
-
- int GetDunGenWidthBase { get; }
- int GetDunGenLengthBase { get; }
- float GetDunGenWidthMultiFactor { get; }
- float GetDunGenLengthMultiFactor { get; }
-
- int GetMainPathCount { get; }
- ConfigIntRange GetMainPathLength { get; }
-
- bool GetBranchMultiSim { get; }
- int GetBranchSimCount { get; }
-
- ConfigBranchingPathRange GetBranchPathSectionOne { get; }
- ConfigBranchingPathRange GetBranchPathSectionTwo { get; }
- ConfigBranchingPathRange GetBranchPathSectionThree { get; }
-
- int GetHallwayLightsWeight { get; }
- int GetCeilingLightsWeight { get; }
- int GetLightsSpawnZeroWeight { get; }
- int GetLightsSpawnOneWeight { get; }
- int GetLightsSpawnTwoWeight { get; }
-
- float GetLootMultiplier { get; }
- float GetMapHazardsMultiplier { get; }
- int GetMinIndoorEnemySpawnCount { get; }
- int GetPaintingCount { get; }
- ConfigIntRange GetPaintingExtraLoot { get; }
-
- int GetTreasureRoomCount { get; }
- ConfigIntRange GetTreasureRoomLoot { get; }
-
- }
-}
diff --git a/ScarletMansion/ScarletMansion/Configs/Items.cs b/ScarletMansion/ScarletMansion/Configs/Items.cs
deleted file mode 100644
index 62eefad..0000000
--- a/ScarletMansion/ScarletMansion/Configs/Items.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-using BepInEx.Configuration;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ScarletMansion.Configs {
-
- public partial class ConfigManager : SyncedInstance where T: ConfigManager {
-
- public class ConfigEntryBundleItem : ConfigEntryBundleBase {
- public ConfigEntryBundle enabled;
- public ConfigEntryBundleMinMax valueRange;
-
- private static string _valueMessage(string itemName, string minmax) => $"The {minmax} scrap value of {itemName}. Lethal Company multiplies all scrap values by 0.4.";
-
- public ConfigEntryBundleItem(string section, string keyPrefix, string itemName, int baseValueMin, int baseValueMax, ConfigEntryBundleExtraParameters extra = null){
- var enabledDesc = $"If disabled, {itemName} is disabled from spawning.";
-
- enabled = new ConfigEntryBundle(section, $"{keyPrefix}Enabled", true, enabledDesc, extra);
- valueRange = new ConfigEntryBundleMinMax(
- section,
- $"Value Min",
- $"Value Max",
- baseValueMin,
- baseValueMax,
- _valueMessage(itemName, "minimum"),
- _valueMessage(itemName, "maximum"),
- extra,
- new AcceptableValueRange(1, 400)
- );
- }
-
- public override void Bind(ConfigFile cfg, T instance, FieldPropertyInfo memberInfo, object memberTarget) {
- var type = memberInfo.GetFieldPropertyType();
- var enabledProp = type.GetField("enabled", BindingFlags.Public | BindingFlags.Instance);
- var valueRangeProp = type.GetField("valueRange", BindingFlags.Public | BindingFlags.Instance);
-
- enabled.Bind(cfg, instance, new FieldPropertyInfo(enabledProp), memberInfo.GetValue(memberTarget));
- if (valueRange.min.defaultValue > 0) valueRange.Bind(cfg, instance, new FieldPropertyInfo(valueRangeProp), memberInfo.GetValue(memberTarget));
-
- }
-
- public override IEnumerable GetConfigs() {
- yield return enabled.config;
- if (valueRange.min.defaultValue > 0) {
- foreach(var a in valueRange.GetConfigs()) {
- yield return a;
- }
- }
- }
- }
-
- public class ConfigEntryBundleScrapItem : ConfigEntryBundleItem {
- public ConfigEntryBundle spawnWeight;
- public ConfigEntryBundle spawnOnAllMoons;
-
- public ConfigEntryBundleScrapItem(string section, string itemName, int baseValueMin, int baseValueMax, int baseSpawnWeight, ConfigEntryBundleExtraParameters extra = null) : base(section, string.Empty, itemName, baseValueMin, baseValueMax, extra) {
-
- var weightDesc = $"The {itemName}'s spawn weight. Calculating spawn chance (%) is difficult as the total scrap weight for each moon varies from ~600 to ~850.";
- var spawnDesc = $"If enabled, the {itemName} scrap item will spawn on all moons regardless if SDM loaded.";
-
- spawnWeight = new ConfigEntryBundle(section, "Spawn Weight Base", baseSpawnWeight, weightDesc, extra, new AcceptableValueRange(0, 999));
- spawnOnAllMoons = new ConfigEntryBundle(section, "Spawn On All Moons", false, spawnDesc, extra);
- }
-
- public override void Bind(ConfigFile cfg, T instance, FieldPropertyInfo memberInfo, object memberTarget) {
- base.Bind(cfg, instance, memberInfo, memberTarget);
-
- var type = memberInfo.GetFieldPropertyType();
- var weightDescProp = type.GetField("spawnWeight", BindingFlags.Public | BindingFlags.Instance);
- var spawnDescProp = type.GetField("spawnOnAllMoons", BindingFlags.Public | BindingFlags.Instance);
-
- spawnWeight.Bind(cfg, instance, new FieldPropertyInfo(weightDescProp), memberInfo.GetValue(memberTarget));
- spawnOnAllMoons.Bind(cfg, instance, new FieldPropertyInfo(spawnDescProp), memberInfo.GetValue(memberTarget));
- }
-
- public override IEnumerable GetConfigs() {
- foreach(var a in base.GetConfigs()) {
- yield return a;
- }
- yield return spawnWeight.config;
- yield return spawnOnAllMoons.config;
- }
- }
- }
-}
diff --git a/ScarletMansion/ScarletMansion/Configs/Presets.cs b/ScarletMansion/ScarletMansion/Configs/Presets.cs
deleted file mode 100644
index 675a720..0000000
--- a/ScarletMansion/ScarletMansion/Configs/Presets.cs
+++ /dev/null
@@ -1,268 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using UnityEngine;
-using BepInEx.Configuration;
-
-namespace ScarletMansion.Configs {
-
- public partial class ConfigManager : SyncedInstance where T: ConfigManager {
-
- public enum DungeonGeneration {
- Custom,
- Default,
- Small,
- MoreLoot,
- BitMoreLoot,
- Vanilla
- }
-
- public enum DungeonLighting {
- Custom,
- Default,
- Bright,
- Dark
- }
-
- public class ChangeList {
-
- public string name;
- public string description;
- public Change[] changes;
-
- public ChangeList(string name, string description, params Change[] changes){
- this.name = name;
- this.description = description;
- this.changes = changes;
- }
-
- public ChangeList(string name, string description, ChangeList baseList, params Change[] changes){
- this.name = name;
- this.description = description;
-
- var newChanges = new List();
- foreach(var c in baseList.changes){
- newChanges.Add(c);
- }
-
- foreach(var c in changes){
- var added = false;
- for(var i = 0; i < newChanges.Count; ++i) {
- if (newChanges[i].IsEqual(c)){
- newChanges[i] = c;
- added = true;
- break;
- }
- }
-
- if (!added) newChanges.Add(c);
- }
-
- this.changes = newChanges.ToArray();
- }
-
- public void UpdateChanges(){
- Plugin.logger.LogDebug($"Updating config values with preset {name}");
- foreach(var c in changes){
- c.Update();
- }
- Plugin.Instance.Config.Save();
- Plugin.Instance.Config.Reload();
- }
-
- public override string ToString() {
- var str = string.Empty;
- foreach(var c in changes){
- str += c.ToString() + "\n";
- }
-
- if (string.IsNullOrWhiteSpace(str)){
- str = "No changes.\n";
- }
-
- return str;
- }
-
- public HashSet GetAllConfigEntries(){
- var set = new HashSet();
- foreach(var a in changes.SelectMany(c => c.configBases)){
- set.Add(a);
- }
- return set;
- }
- }
-
- public abstract class Change {
- public abstract void Update();
- public abstract bool IsEqual(Change target);
- public abstract IEnumerable configBases { get; }
- }
-
- public abstract class ChangeType : Change {
- public ConfigEntryBundle configBundle;
- public ConfigEntry configEntry => configBundle.config;
- public U value;
-
- public override IEnumerable configBases {
- get {
- yield return configEntry;
- }
- }
-
- public ChangeType(ConfigEntryBundle configBundle){
- this.configBundle = configBundle;
- this.value = configBundle.defaultValue;
- }
-
- public ChangeType(ConfigEntryBundle configBundle, U value){
- this.configBundle = configBundle;
- this.value = value;
- }
-
- public override void Update(){
- configEntry.BoxedValue = value;
- }
-
- public override bool IsEqual(Change obj) {
- var target = obj as ChangeType;
- if (target != null) {
- return configEntry.Definition == target.configEntry.Definition;
- }
- return false;
- }
-
- public override string ToString() {
- return $"{configBundle.definition.Key}: {value}";
- }
- }
-
- public class ChangeBool : ChangeType {
- public ChangeBool(ConfigEntryBundle configEntry) : base (configEntry){ }
- public ChangeBool(ConfigEntryBundle configEntry, bool value) : base (configEntry, value){ }
- }
-
- public class ChangeFloat : ChangeType {
- public ChangeFloat(ConfigEntryBundle configEntry) : base (configEntry){ }
- public ChangeFloat(ConfigEntryBundle configEntry, float value) : base (configEntry, value){ }
- }
-
- public class ChangeInt : ChangeType {
- public ChangeInt(ConfigEntryBundle configEntry) : base (configEntry){ }
- public ChangeInt(ConfigEntryBundle configEntry, int value) : base (configEntry, value){ }
- }
-
- public class ChangeMinMaxInt : Change {
- public ChangeInt min;
- public ChangeInt max;
-
- public override IEnumerable configBases {
- get {
- yield return min.configEntry;
- yield return max.configEntry;
- }
- }
-
- public ChangeMinMaxInt(ConfigEntryBundleMinMax configBundle){
- min = new ChangeInt(configBundle.min);
- max = new ChangeInt(configBundle.max);
- }
-
- public ChangeMinMaxInt(ConfigEntryBundleMinMax configBundle, int minValue, int maxValue){
- min = new ChangeInt(configBundle.min, minValue == int.MaxValue ? configBundle.min.defaultValue : minValue);
- max = new ChangeInt(configBundle.max, maxValue == int.MaxValue ? configBundle.max.defaultValue : maxValue);
- }
-
- public override void Update() {
- min.Update();
- max.Update();
- }
-
- public override bool IsEqual(Change obj) {
- var target = obj as ChangeMinMaxInt;
- if (target != null) return min.IsEqual(target.min) && max.IsEqual(target.max);
- return false;
- }
-
- public override string ToString() {
- return $"{min.ToString()}\n{max.ToString()}";
- }
- }
-
- public class ChangeMinMaxFloat : Change{
- public ChangeFloat min;
- public ChangeFloat max;
-
- public override IEnumerable configBases {
- get {
- yield return min.configEntry;
- yield return max.configEntry;
- }
- }
-
- public ChangeMinMaxFloat(ConfigEntryBundleMinMax configBundle){
- min = new ChangeFloat(configBundle.min);
- max = new ChangeFloat(configBundle.max);
- }
-
- public ChangeMinMaxFloat(ConfigEntryBundleMinMax configBundle, float minValue, float maxValue){
- min = new ChangeFloat(configBundle.min, minValue == float.MaxValue ? configBundle.min.defaultValue : minValue);
- max = new ChangeFloat(configBundle.max, maxValue == float.MaxValue ? configBundle.max.defaultValue : maxValue);
- }
-
- public override void Update() {
- min.Update();
- max.Update();
- }
-
- public override bool IsEqual(Change obj) {
- var target = obj as ChangeMinMaxFloat;
- if (target != null) return min.IsEqual(target.min) && max.IsEqual(target.max);
- return false;
- }
-
- public override string ToString() {
- return $"{min.ToString()}\n{max.ToString()}";
- }
- }
-
- public class ChangeBranchingPath : Change{
- public ChangeMinMaxInt count;
- public ChangeMinMaxInt depth;
-
- public override IEnumerable configBases {
- get {
- foreach(var a in count.configBases) yield return a;
- foreach(var a in depth.configBases) yield return a;
- }
- }
-
- public ChangeBranchingPath(ConfigEntryBundleBranchingPath configBundle){
- count = new ChangeMinMaxInt(configBundle.count);
- depth = new ChangeMinMaxInt(configBundle.depth);
- }
-
- public ChangeBranchingPath(ConfigEntryBundleBranchingPath configBundle, int countMin, int countMax, int depthMin, int depthMax){
- count = new ChangeMinMaxInt(configBundle.count, countMin, countMax);
- depth = new ChangeMinMaxInt(configBundle.depth, depthMin, depthMax);
- }
-
- public override void Update() {
- count.Update();
- depth.Update();
- }
-
- public override bool IsEqual(Change obj) {
- var target = obj as ChangeBranchingPath;
- if (target != null) return count.IsEqual(target.count) && depth.IsEqual(target.depth);
- return false;
- }
-
- public override string ToString() {
- return $"{count.ToString()}\n{depth.ToString()}";
- }
- }
- }
-
-}
diff --git a/ScarletMansion/ScarletMansion/DunGenPatch/Patch.cs b/ScarletMansion/ScarletMansion/DunGenPatch/Patch.cs
index f2b1cad..0144e34 100644
--- a/ScarletMansion/ScarletMansion/DunGenPatch/Patch.cs
+++ b/ScarletMansion/ScarletMansion/DunGenPatch/Patch.cs
@@ -13,8 +13,6 @@ using UnityEngine.Rendering.HighDefinition;
using DunGenPlus.Collections;
using GameNetcodeStuff;
using ScarletMansion.GamePatch.Components;
-using ScarletMansion.Configs;
-using DunGen.Graph;
namespace ScarletMansion.DunGenPatch {
public static class Patch {
@@ -67,58 +65,40 @@ namespace ScarletMansion.DunGenPatch {
}
- public static void UpdateDunGenExtenderProperties(ConfigDungeon dungeonConfig, DunGenExtenderProperties props, EventCallbackScenario callback) where T: ConfigDungeon {
+ public static void UpdateDunGenExtenderProperties(DunGenExtenderProperties props, EventCallbackScenario callback) {
if (callback.IsDevDebug) return;
- props.MainPathProperties.MainPathCount = dungeonConfig.mainPathCountValue;
+ props.MainPathProperties.MainPathCount = PluginConfig.Instance.mainPathCountValue;
- props.DungeonBoundsProperties.SizeBase = new Vector3(dungeonConfig.dunGenWidthBaseValue, props.DungeonBoundsProperties.SizeBase.y, dungeonConfig.dunGenLengthBaseValue);
- props.DungeonBoundsProperties.SizeFactor = new Vector3(dungeonConfig.dunGenWidthMultiFactorValue, props.DungeonBoundsProperties.SizeFactor.y, dungeonConfig.dunGenLengthMultiFactorValue);
+ props.DungeonBoundsProperties.SizeBase = new Vector3(PluginConfig.Instance.dunGenWidthBaseValue, props.DungeonBoundsProperties.SizeBase.y, PluginConfig.Instance.dunGenLengthBaseValue);
+ props.DungeonBoundsProperties.SizeFactor = new Vector3(PluginConfig.Instance.dunGenWidthMultiFactorValue, props.DungeonBoundsProperties.SizeFactor.y, PluginConfig.Instance.dunGenLengthMultiFactorValue);
- props.BranchPathMultiSimulationProperties.UseBranchPathMultiSim = dungeonConfig.branchMultiSimValue;
- props.BranchPathMultiSimulationProperties.SimulationCount = dungeonConfig.branchSimCountValue;
+ props.BranchPathMultiSimulationProperties.UseBranchPathMultiSim = PluginConfig.Instance.branchMultiSimValue;
+ props.BranchPathMultiSimulationProperties.SimulationCount = PluginConfig.Instance.branchSimCountValue;
var i = 0;
while(i < 3) {
- dungeonConfig.branchPathSectionOneValue.UpdateValues(props.LineRandomizerProperties.Archetypes[i]);
+ PluginConfig.Instance.branchPathSectionOneValue.UpdateValues(props.LineRandomizerProperties.Archetypes[i]);
++i;
}
while(i < 7) {
- dungeonConfig.branchPathSectionTwoValue.UpdateValues(props.LineRandomizerProperties.Archetypes[i]);
+ PluginConfig.Instance.branchPathSectionTwoValue.UpdateValues(props.LineRandomizerProperties.Archetypes[i]);
++i;
}
while(i < 10) {
- dungeonConfig.branchPathSectionThreeValue.UpdateValues(props.LineRandomizerProperties.Archetypes[i]);
+ PluginConfig.Instance.branchPathSectionThreeValue.UpdateValues(props.LineRandomizerProperties.Archetypes[i]);
++i;
}
- var count = dungeonConfig.treasureRoomCountValue;
+ var count = PluginConfig.Instance.treasureRoomCountValue;
props.AdditionalTilesProperties.UseAdditionalTiles = count > 0;
var addTilesProperties = props.AdditionalTilesProperties;
var copyTarget = addTilesProperties.AdditionalTileSets[0];
addTilesProperties.AdditionalTileSets = new List();
for(var j = 0; j < count; ++j) addTilesProperties.AdditionalTileSets.Add(copyTarget);
-
- Lights.ScarletLightCleanup.weights = new float[] {
- dungeonConfig.lightsSpawnZeroWeightValue,
- dungeonConfig.lightsSpawnOneWeightValue,
- dungeonConfig.lightsSpawnTwoWeightValue
- };
-
- DungeonFlow.GlobalPropSettings GetGlobalPropSetting(int id) {
- foreach(var p in dungeonConfig.dungeon.GlobalProps){
- if (p.ID == id ) return p;
- }
- return null;
- }
-
- GetGlobalPropSetting(254).Count = new DunGen.IntRange(
- dungeonConfig.paintingCountValue,
- dungeonConfig.paintingCountValue
- );
}
}
diff --git a/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletBedroom.cs b/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletBedroom.cs
index f67f1fe..de97fed 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletBedroom.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletBedroom.cs
@@ -10,7 +10,6 @@ using DunGen;
using ScarletMansion.Lights;
using ScarletMansion.GamePatch.Managers;
using GameNetcodeStuff;
-using ScarletMansion.Configs;
namespace ScarletMansion.GamePatch.Components {
public class ScarletBedroom : MonoBehaviour, IDungeonCompleteReceiver {
@@ -127,7 +126,7 @@ namespace ScarletMansion.GamePatch.Components {
private static List spawnableEnemiesTrueList;
public static void CreateRandomEnemyList(List enemies){
- var lower = ConfigMain.Instance.paintingEnemyListValue.ToLowerInvariant();
+ var lower = PluginConfig.Instance.paintingEnemyListValue.ToLowerInvariant();
if (lower == "default"){
lower = ENEMY_SPAWN_LIST_DEFAULT;
}
@@ -156,7 +155,7 @@ namespace ScarletMansion.GamePatch.Components {
public EnemyReferenceSpawnLogic GetRandomEnemy(System.Random sysRandom){
var roundManager = RoundManager.Instance;
if (!roundManager.IsServer) return null;
- if (!ConfigMain.Instance.paintingSpawnEnemyValue) return null;
+ if (!PluginConfig.Instance.paintingSpawnEnemyValue) return null;
if (spawnableEnemiesTrueList == null || spawnableEnemiesTrueList.Count == 0){
Plugin.logger.LogError($"Could not select enemy to spawn in bedroom. Empty enemy list?");
@@ -223,7 +222,7 @@ namespace ScarletMansion.GamePatch.Components {
var sysRandom = DunGenPatch.Patch.CreateSystemRandom();
Utility.Shuffle(sysRandom, itemSpawns);
- var count = sysRandom.Next(Plugin.GetConfigDungeon.GetPaintingExtraLoot.min, Plugin.GetConfigDungeon.GetPaintingExtraLoot.max + 1);
+ var count = sysRandom.Next(PluginConfig.Instance.paintingExtraLootValue.min, PluginConfig.Instance.paintingExtraLootValue.max + 1);
bonusItems = AngerManager.CreateAngerLoot(count, sysRandom);
bonusEnemy = GetRandomEnemy(sysRandom);
diff --git a/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletDoorLock.cs b/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletDoorLock.cs
index f8363fc..dc3db79 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletDoorLock.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/Components/ScarletDoorLock.cs
@@ -7,7 +7,6 @@ using UnityEngine;
using Unity.Netcode;
using ScarletMansion.GamePatch.Enemies;
using System.Security.Permissions;
-using ScarletMansion.Configs;
[assembly: SecurityPermission( SecurityAction.RequestMinimum, SkipVerification = true )]
namespace ScarletMansion.GamePatch.Components {
@@ -69,7 +68,7 @@ namespace ScarletMansion.GamePatch.Components {
direction = direction.normalized;
var timeDelta = Time.deltaTime * GetDoorDamagePerSecond(enemyScript);
- if (isLocked) timeDelta *= ConfigMain.Instance.lockedDoorEnemyDamageMultiplierValue;
+ if (isLocked) timeDelta *= PluginConfig.Instance.lockedDoorEnemyDamageMultiplierValue;
destroyMeter += timeDelta;
ApplyDoorPieceDamage(direction);
diff --git a/ScarletMansion/ScarletMansion/GamePatch/DynamicBone/DynamicBone.cs b/ScarletMansion/ScarletMansion/GamePatch/DynamicBone/DynamicBone.cs
deleted file mode 100644
index dc5ad63..0000000
--- a/ScarletMansion/ScarletMansion/GamePatch/DynamicBone/DynamicBone.cs
+++ /dev/null
@@ -1,718 +0,0 @@
-using UnityEngine;
-using System.Collections.Generic;
-
-namespace ScarletMansion.GamePatch.DynamicBone {
-
-[AddComponentMenu("Dynamic Bone/Dynamic Bone")]
-public class DynamicBone : MonoBehaviour
-{
-#if UNITY_5_3_OR_NEWER
- [Tooltip("The root of the transform hierarchy to apply physics.")]
-#endif
- public Transform m_Root = null;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("Internal physics simulation rate.")]
-#endif
- public float m_UpdateRate = 60.0f;
-
- public enum UpdateMode
- {
- Normal,
- AnimatePhysics,
- UnscaledTime,
- Default
- }
- public UpdateMode m_UpdateMode = UpdateMode.Default;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("How much the bones slowed down.")]
-#endif
- [Range(0, 1)]
- public float m_Damping = 0.1f;
- public AnimationCurve m_DampingDistrib = null;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("How much the force applied to return each bone to original orientation.")]
-#endif
- [Range(0, 1)]
- public float m_Elasticity = 0.1f;
- public AnimationCurve m_ElasticityDistrib = null;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("How much bone's original orientation are preserved.")]
-#endif
- [Range(0, 1)]
- public float m_Stiffness = 0.1f;
- public AnimationCurve m_StiffnessDistrib = null;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("How much character's position change is ignored in physics simulation.")]
-#endif
- [Range(0, 1)]
- public float m_Inert = 0;
- public AnimationCurve m_InertDistrib = null;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("How much the bones slowed down when collide.")]
-#endif
- public float m_Friction = 0;
- public AnimationCurve m_FrictionDistrib = null;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("Each bone can be a sphere to collide with colliders. Radius describe sphere's size.")]
-#endif
- public float m_Radius = 0;
- public AnimationCurve m_RadiusDistrib = null;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("If End Length is not zero, an extra bone is generated at the end of transform hierarchy.")]
-#endif
- public float m_EndLength = 0;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("If End Offset is not zero, an extra bone is generated at the end of transform hierarchy.")]
-#endif
- public Vector3 m_EndOffset = Vector3.zero;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("The force apply to bones. Partial force apply to character's initial pose is cancelled out.")]
-#endif
- public Vector3 m_Gravity = Vector3.zero;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("The force apply to bones.")]
-#endif
- public Vector3 m_Force = Vector3.zero;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("Collider objects interact with the bones.")]
-#endif
- public List m_Colliders = null;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("Bones exclude from physics simulation.")]
-#endif
- public List m_Exclusions = null;
-
-
- public enum FreezeAxis
- {
- None, X, Y, Z
- }
-#if UNITY_5_3_OR_NEWER
- [Tooltip("Constrain bones to move on specified plane.")]
-#endif
- public FreezeAxis m_FreezeAxis = FreezeAxis.None;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("Disable physics simulation automatically if character is far from camera or player.")]
-#endif
- public bool m_DistantDisable = false;
- public Transform m_ReferenceObject = null;
- public float m_DistanceToObject = 20;
-
- Vector3 m_LocalGravity = Vector3.zero;
- Vector3 m_ObjectMove = Vector3.zero;
- Vector3 m_ObjectPrevPosition = Vector3.zero;
- float m_BoneTotalLength = 0;
- float m_ObjectScale = 1.0f;
- float m_Time = 0;
- float m_Weight = 1.0f;
- bool m_DistantDisabled = false;
-
- class Particle
- {
- public Transform m_Transform = null;
- public int m_ParentIndex = -1;
- public float m_Damping = 0;
- public float m_Elasticity = 0;
- public float m_Stiffness = 0;
- public float m_Inert = 0;
- public float m_Friction = 0;
- public float m_Radius = 0;
- public float m_BoneLength = 0;
- public bool m_isCollide = false;
-
- public Vector3 m_Position = Vector3.zero;
- public Vector3 m_PrevPosition = Vector3.zero;
- public Vector3 m_EndOffset = Vector3.zero;
- public Vector3 m_InitLocalPosition = Vector3.zero;
- public Quaternion m_InitLocalRotation = Quaternion.identity;
- }
-
- List m_Particles = new List();
-
- void Start()
- {
- SetupParticles();
- }
-
- void FixedUpdate()
- {
- if (m_UpdateMode == UpdateMode.AnimatePhysics)
- PreUpdate();
- }
-
- void Update()
- {
- if (m_UpdateMode != UpdateMode.AnimatePhysics)
- PreUpdate();
- }
-
- void LateUpdate()
- {
- if (m_DistantDisable)
- CheckDistance();
-
- if (m_Weight > 0 && !(m_DistantDisable && m_DistantDisabled))
- {
-#if UNITY_5_3_OR_NEWER
- float dt = m_UpdateMode == UpdateMode.UnscaledTime ? Time.unscaledDeltaTime : Time.deltaTime;
-#else
- float dt = Time.deltaTime;
-#endif
- UpdateDynamicBones(dt);
- }
- }
-
- void PreUpdate()
- {
- if (m_Weight > 0 && !(m_DistantDisable && m_DistantDisabled))
- InitTransforms();
- }
-
- void CheckDistance()
- {
- Transform rt = m_ReferenceObject;
- if (rt == null && Camera.main != null)
- rt = Camera.main.transform;
- if (rt != null)
- {
- float d = (rt.position - transform.position).sqrMagnitude;
- bool disable = d > m_DistanceToObject * m_DistanceToObject;
- if (disable != m_DistantDisabled)
- {
- if (!disable)
- ResetParticlesPosition();
- m_DistantDisabled = disable;
- }
- }
- }
-
- void OnEnable()
- {
- ResetParticlesPosition();
- }
-
- void OnDisable()
- {
- InitTransforms();
- }
-
- void OnValidate()
- {
- m_UpdateRate = Mathf.Max(m_UpdateRate, 0);
- m_Damping = Mathf.Clamp01(m_Damping);
- m_Elasticity = Mathf.Clamp01(m_Elasticity);
- m_Stiffness = Mathf.Clamp01(m_Stiffness);
- m_Inert = Mathf.Clamp01(m_Inert);
- m_Friction = Mathf.Clamp01(m_Friction);
- m_Radius = Mathf.Max(m_Radius, 0);
-
- if (Application.isEditor && Application.isPlaying)
- {
- InitTransforms();
- SetupParticles();
- }
- }
-
- void OnDrawGizmosSelected()
- {
- if (!enabled || m_Root == null)
- return;
-
- if (Application.isEditor && !Application.isPlaying && transform.hasChanged)
- {
- InitTransforms();
- SetupParticles();
- }
-
- Gizmos.color = Color.white;
- for (int i = 0; i < m_Particles.Count; ++i)
- {
- Particle p = m_Particles[i];
- if (p.m_ParentIndex >= 0)
- {
- Particle p0 = m_Particles[p.m_ParentIndex];
- Gizmos.DrawLine(p.m_Position, p0.m_Position);
- }
- if (p.m_Radius > 0)
- Gizmos.DrawWireSphere(p.m_Position, p.m_Radius * m_ObjectScale);
- }
- }
-
- public void SetWeight(float w)
- {
- if (m_Weight != w)
- {
- if (w == 0)
- InitTransforms();
- else if (m_Weight == 0)
- ResetParticlesPosition();
- m_Weight = w;
- }
- }
-
- public float GetWeight()
- {
- return m_Weight;
- }
-
- void UpdateDynamicBones(float t)
- {
- if (m_Root == null)
- return;
-
- m_ObjectScale = Mathf.Abs(transform.lossyScale.x);
- m_ObjectMove = transform.position - m_ObjectPrevPosition;
- m_ObjectPrevPosition = transform.position;
-
- int loop = 1;
- float timeVar = 1;
-
- if (m_UpdateMode == UpdateMode.Default)
- {
- if (m_UpdateRate > 0)
- {
- timeVar = Time.deltaTime * m_UpdateRate;
- }
- else
- {
- timeVar = Time.deltaTime;
- }
- }
- else
- {
- if (m_UpdateRate > 0)
- {
- float dt = 1.0f / m_UpdateRate;
- m_Time += t;
- loop = 0;
-
- while (m_Time >= dt)
- {
- m_Time -= dt;
- if (++loop >= 3)
- {
- m_Time = 0;
- break;
- }
- }
- }
- }
-
- if (loop > 0)
- {
- for (int i = 0; i < loop; ++i)
- {
- UpdateParticles1(timeVar);
- UpdateParticles2(timeVar);
- m_ObjectMove = Vector3.zero;
- }
- }
- else
- {
- SkipUpdateParticles();
- }
-
- ApplyParticlesToTransforms();
- }
-
- public void SetupParticles()
- {
- m_Particles.Clear();
- if (m_Root == null)
- return;
-
- m_LocalGravity = m_Root.InverseTransformDirection(m_Gravity);
- m_ObjectScale = Mathf.Abs(transform.lossyScale.x);
- m_ObjectPrevPosition = transform.position;
- m_ObjectMove = Vector3.zero;
- m_BoneTotalLength = 0;
- AppendParticles(m_Root, -1, 0);
- UpdateParameters();
- }
-
- void AppendParticles(Transform b, int parentIndex, float boneLength)
- {
- Particle p = new Particle();
- p.m_Transform = b;
- p.m_ParentIndex = parentIndex;
- if (b != null)
- {
- p.m_Position = p.m_PrevPosition = b.position;
- p.m_InitLocalPosition = b.localPosition;
- p.m_InitLocalRotation = b.localRotation;
- }
- else // end bone
- {
- Transform pb = m_Particles[parentIndex].m_Transform;
- if (m_EndLength > 0)
- {
- Transform ppb = pb.parent;
- if (ppb != null)
- p.m_EndOffset = pb.InverseTransformPoint((pb.position * 2 - ppb.position)) * m_EndLength;
- else
- p.m_EndOffset = new Vector3(m_EndLength, 0, 0);
- }
- else
- {
- p.m_EndOffset = pb.InverseTransformPoint(transform.TransformDirection(m_EndOffset) + pb.position);
- }
- p.m_Position = p.m_PrevPosition = pb.TransformPoint(p.m_EndOffset);
- }
-
- if (parentIndex >= 0)
- {
- boneLength += (m_Particles[parentIndex].m_Transform.position - p.m_Position).magnitude;
- p.m_BoneLength = boneLength;
- m_BoneTotalLength = Mathf.Max(m_BoneTotalLength, boneLength);
- }
-
- int index = m_Particles.Count;
- m_Particles.Add(p);
-
- if (b != null)
- {
- for (int i = 0; i < b.childCount; ++i)
- {
- Transform child = b.GetChild(i);
- bool exclude = false;
- if (m_Exclusions != null)
- {
- exclude = m_Exclusions.Contains(child);
- }
- if (!exclude)
- AppendParticles(child, index, boneLength);
- else if (m_EndLength > 0 || m_EndOffset != Vector3.zero)
- AppendParticles(null, index, boneLength);
- }
-
- if (b.childCount == 0 && (m_EndLength > 0 || m_EndOffset != Vector3.zero))
- AppendParticles(null, index, boneLength);
- }
- }
-
- public void UpdateParameters()
- {
- if (m_Root == null)
- return;
-
- m_LocalGravity = m_Root.InverseTransformDirection(m_Gravity);
-
- for (int i = 0; i < m_Particles.Count; ++i)
- {
- Particle p = m_Particles[i];
- p.m_Damping = m_Damping;
- p.m_Elasticity = m_Elasticity;
- p.m_Stiffness = m_Stiffness;
- p.m_Inert = m_Inert;
- p.m_Friction = m_Friction;
- p.m_Radius = m_Radius;
-
- if (m_BoneTotalLength > 0)
- {
- float a = p.m_BoneLength / m_BoneTotalLength;
- if (m_DampingDistrib != null && m_DampingDistrib.keys.Length > 0)
- p.m_Damping *= m_DampingDistrib.Evaluate(a);
- if (m_ElasticityDistrib != null && m_ElasticityDistrib.keys.Length > 0)
- p.m_Elasticity *= m_ElasticityDistrib.Evaluate(a);
- if (m_StiffnessDistrib != null && m_StiffnessDistrib.keys.Length > 0)
- p.m_Stiffness *= m_StiffnessDistrib.Evaluate(a);
- if (m_InertDistrib != null && m_InertDistrib.keys.Length > 0)
- p.m_Inert *= m_InertDistrib.Evaluate(a);
- if (m_FrictionDistrib != null && m_FrictionDistrib.keys.Length > 0)
- p.m_Friction *= m_FrictionDistrib.Evaluate(a);
- if (m_RadiusDistrib != null && m_RadiusDistrib.keys.Length > 0)
- p.m_Radius *= m_RadiusDistrib.Evaluate(a);
- }
-
- p.m_Damping = Mathf.Clamp01(p.m_Damping);
- p.m_Elasticity = Mathf.Clamp01(p.m_Elasticity);
- p.m_Stiffness = Mathf.Clamp01(p.m_Stiffness);
- p.m_Inert = Mathf.Clamp01(p.m_Inert);
- p.m_Friction = Mathf.Clamp01(p.m_Friction);
- p.m_Radius = Mathf.Max(p.m_Radius, 0);
- }
- }
-
- void InitTransforms()
- {
- for (int i = 0; i < m_Particles.Count; ++i)
- {
- Particle p = m_Particles[i];
- if (p.m_Transform != null)
- {
- p.m_Transform.localPosition = p.m_InitLocalPosition;
- p.m_Transform.localRotation = p.m_InitLocalRotation;
- }
- }
- }
-
- void ResetParticlesPosition()
- {
- for (int i = 0; i < m_Particles.Count; ++i)
- {
- Particle p = m_Particles[i];
- if (p.m_Transform != null)
- {
- p.m_Position = p.m_PrevPosition = p.m_Transform.position;
- }
- else // end bone
- {
- Transform pb = m_Particles[p.m_ParentIndex].m_Transform;
- p.m_Position = p.m_PrevPosition = pb.TransformPoint(p.m_EndOffset);
- }
- p.m_isCollide = false;
- }
- m_ObjectPrevPosition = transform.position;
- }
-
- void UpdateParticles1(float timeVar)
- {
- Vector3 force = m_Gravity;
- Vector3 fdir = m_Gravity.normalized;
- Vector3 rf = m_Root.TransformDirection(m_LocalGravity);
- Vector3 pf = fdir * Mathf.Max(Vector3.Dot(rf, fdir), 0); // project current gravity to rest gravity
- force -= pf; // remove projected gravity
- force = (force + m_Force) * (m_ObjectScale * timeVar);
-
- for (int i = 0; i < m_Particles.Count; ++i)
- {
- Particle p = m_Particles[i];
- if (p.m_ParentIndex >= 0)
- {
- // verlet integration
- Vector3 v = p.m_Position - p.m_PrevPosition;
- Vector3 rmove = m_ObjectMove * p.m_Inert;
- p.m_PrevPosition = p.m_Position + rmove;
- float damping = p.m_Damping;
- if (p.m_isCollide)
- {
- damping += p.m_Friction;
- if (damping > 1)
- damping = 1;
- p.m_isCollide = false;
- }
- p.m_Position += v * (1 - damping) + force + rmove;
- }
- else
- {
- p.m_PrevPosition = p.m_Position;
- p.m_Position = p.m_Transform.position;
- }
- }
- }
-
- void UpdateParticles2(float timeVar)
- {
- Plane movePlane = new Plane();
-
- for (int i = 1; i < m_Particles.Count; ++i)
- {
- Particle p = m_Particles[i];
- Particle p0 = m_Particles[p.m_ParentIndex];
-
- float restLen;
- if (p.m_Transform != null)
- restLen = (p0.m_Transform.position - p.m_Transform.position).magnitude;
- else
- restLen = p0.m_Transform.localToWorldMatrix.MultiplyVector(p.m_EndOffset).magnitude;
-
- // keep shape
- float stiffness = Mathf.Lerp(1.0f, p.m_Stiffness, m_Weight);
- if (stiffness > 0 || p.m_Elasticity > 0)
- {
- Matrix4x4 m0 = p0.m_Transform.localToWorldMatrix;
- m0.SetColumn(3, p0.m_Position);
- Vector3 restPos;
- if (p.m_Transform != null)
- restPos = m0.MultiplyPoint3x4(p.m_Transform.localPosition);
- else
- restPos = m0.MultiplyPoint3x4(p.m_EndOffset);
-
- Vector3 d = restPos - p.m_Position;
- p.m_Position += d * (p.m_Elasticity * timeVar);
-
- if (stiffness > 0)
- {
- d = restPos - p.m_Position;
- float len = d.magnitude;
- float maxlen = restLen * (1 - stiffness) * 2;
- if (len > maxlen)
- p.m_Position += d * ((len - maxlen) / len);
- }
- }
-
- // collide
- if (m_Colliders != null)
- {
- float particleRadius = p.m_Radius * m_ObjectScale;
- for (int j = 0; j < m_Colliders.Count; ++j)
- {
- DynamicBoneColliderBase c = m_Colliders[j];
- if (c != null && c.enabled)
- p.m_isCollide |= c.Collide(ref p.m_Position, particleRadius);
- }
- }
-
- // freeze axis, project to plane
- if (m_FreezeAxis != FreezeAxis.None)
- {
- switch (m_FreezeAxis)
- {
- case FreezeAxis.X:
- movePlane.SetNormalAndPosition(p0.m_Transform.right, p0.m_Position);
- break;
- case FreezeAxis.Y:
- movePlane.SetNormalAndPosition(p0.m_Transform.up, p0.m_Position);
- break;
- case FreezeAxis.Z:
- movePlane.SetNormalAndPosition(p0.m_Transform.forward, p0.m_Position);
- break;
- }
- p.m_Position -= movePlane.normal * movePlane.GetDistanceToPoint(p.m_Position);
- }
-
- // keep length
- Vector3 dd = p0.m_Position - p.m_Position;
- float leng = dd.magnitude;
- if (leng > 0)
- p.m_Position += dd * ((leng - restLen) / leng);
- }
- }
-
- // only update stiffness and keep bone length
- void SkipUpdateParticles()
- {
- for (int i = 0; i < m_Particles.Count; ++i)
- {
- Particle p = m_Particles[i];
- if (p.m_ParentIndex >= 0)
- {
- p.m_PrevPosition += m_ObjectMove;
- p.m_Position += m_ObjectMove;
-
- Particle p0 = m_Particles[p.m_ParentIndex];
-
- float restLen;
- if (p.m_Transform != null)
- restLen = (p0.m_Transform.position - p.m_Transform.position).magnitude;
- else
- restLen = p0.m_Transform.localToWorldMatrix.MultiplyVector(p.m_EndOffset).magnitude;
-
- // keep shape
- float stiffness = Mathf.Lerp(1.0f, p.m_Stiffness, m_Weight);
- if (stiffness > 0)
- {
- Matrix4x4 m0 = p0.m_Transform.localToWorldMatrix;
- m0.SetColumn(3, p0.m_Position);
- Vector3 restPos;
- if (p.m_Transform != null)
- restPos = m0.MultiplyPoint3x4(p.m_Transform.localPosition);
- else
- restPos = m0.MultiplyPoint3x4(p.m_EndOffset);
-
- Vector3 d = restPos - p.m_Position;
- float len = d.magnitude;
- float maxlen = restLen * (1 - stiffness) * 2;
- if (len > maxlen)
- p.m_Position += d * ((len - maxlen) / len);
- }
-
- // keep length
- Vector3 dd = p0.m_Position - p.m_Position;
- float leng = dd.magnitude;
- if (leng > 0)
- p.m_Position += dd * ((leng - restLen) / leng);
- }
- else
- {
- p.m_PrevPosition = p.m_Position;
- p.m_Position = p.m_Transform.position;
- }
- }
- }
-
- static Vector3 MirrorVector(Vector3 v, Vector3 axis)
- {
- return v - axis * (Vector3.Dot(v, axis) * 2);
- }
-
- void ApplyParticlesToTransforms()
- {
-#if !UNITY_5_4_OR_NEWER
- // detect negative scale
- Vector3 ax = Vector3.right;
- Vector3 ay = Vector3.up;
- Vector3 az = Vector3.forward;
- bool nx = false, ny = false, nz = false;
-
- Vector3 loosyScale = transform.lossyScale;
- if (loosyScale.x < 0 || loosyScale.y < 0 || loosyScale.z < 0)
- {
- Transform mirrorObject = transform;
- do
- {
- Vector3 ls = mirrorObject.localScale;
- nx = ls.x < 0;
- if (nx)
- ax = mirrorObject.right;
- ny = ls.y < 0;
- if (ny)
- ay = mirrorObject.up;
- nz = ls.z < 0;
- if (nz)
- az = mirrorObject.forward;
- if (nx || ny || nz)
- break;
-
- mirrorObject = mirrorObject.parent;
- }
- while (mirrorObject != null);
- }
-#endif
-
- for (int i = 1; i < m_Particles.Count; ++i)
- {
- Particle p = m_Particles[i];
- Particle p0 = m_Particles[p.m_ParentIndex];
-
- if (p0.m_Transform.childCount <= 1) // do not modify bone orientation if has more then one child
- {
- Vector3 v;
- if (p.m_Transform != null)
- v = p.m_Transform.localPosition;
- else
- v = p.m_EndOffset;
- Vector3 v2 = p.m_Position - p0.m_Position;
-#if !UNITY_5_4_OR_NEWER
- if (nx)
- v2 = MirrorVector(v2, ax);
- if (ny)
- v2 = MirrorVector(v2, ay);
- if (nz)
- v2 = MirrorVector(v2, az);
-#endif
- Quaternion rot = Quaternion.FromToRotation(p0.m_Transform.TransformDirection(v), v2);
- p0.m_Transform.rotation = rot * p0.m_Transform.rotation;
- }
-
- if (p.m_Transform != null)
- p.m_Transform.position = p.m_Position;
- }
- }
-}
-
-}
\ No newline at end of file
diff --git a/ScarletMansion/ScarletMansion/GamePatch/DynamicBone/DynamicBoneCollider.cs b/ScarletMansion/ScarletMansion/GamePatch/DynamicBone/DynamicBoneCollider.cs
deleted file mode 100644
index 289d8a0..0000000
--- a/ScarletMansion/ScarletMansion/GamePatch/DynamicBone/DynamicBoneCollider.cs
+++ /dev/null
@@ -1,239 +0,0 @@
-using UnityEngine;
-
-namespace ScarletMansion.GamePatch.DynamicBone {
-
-[AddComponentMenu("Dynamic Bone/Dynamic Bone Collider")]
-public class DynamicBoneCollider : DynamicBoneColliderBase
-{
-#if UNITY_5_3_OR_NEWER
- [Tooltip("The radius of the sphere or capsule.")]
-#endif
- public float m_Radius = 0.5f;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("The height of the capsule.")]
-#endif
- public float m_Height = 0;
-
- void OnValidate()
- {
- m_Radius = Mathf.Max(m_Radius, 0);
- m_Height = Mathf.Max(m_Height, 0);
- }
-
- public override bool Collide(ref Vector3 particlePosition, float particleRadius)
- {
- float radius = m_Radius * Mathf.Abs(transform.lossyScale.x);
- float h = m_Height * 0.5f - m_Radius;
- if (h <= 0)
- {
- if (m_Bound == Bound.Outside)
- return OutsideSphere(ref particlePosition, particleRadius, transform.TransformPoint(m_Center), radius);
- else
- return InsideSphere(ref particlePosition, particleRadius, transform.TransformPoint(m_Center), radius);
- }
- else
- {
- Vector3 c0 = m_Center;
- Vector3 c1 = m_Center;
-
- switch (m_Direction)
- {
- case Direction.X:
- c0.x -= h;
- c1.x += h;
- break;
- case Direction.Y:
- c0.y -= h;
- c1.y += h;
- break;
- case Direction.Z:
- c0.z -= h;
- c1.z += h;
- break;
- }
- if (m_Bound == Bound.Outside)
- return OutsideCapsule(ref particlePosition, particleRadius, transform.TransformPoint(c0), transform.TransformPoint(c1), radius);
- else
- return InsideCapsule(ref particlePosition, particleRadius, transform.TransformPoint(c0), transform.TransformPoint(c1), radius);
- }
- }
-
- static bool OutsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 sphereCenter, float sphereRadius)
- {
- float r = sphereRadius + particleRadius;
- float r2 = r * r;
- Vector3 d = particlePosition - sphereCenter;
- float len2 = d.sqrMagnitude;
-
- // if is inside sphere, project onto sphere surface
- if (len2 > 0 && len2 < r2)
- {
- float len = Mathf.Sqrt(len2);
- particlePosition = sphereCenter + d * (r / len);
- return true;
- }
- return false;
- }
-
- static bool InsideSphere(ref Vector3 particlePosition, float particleRadius, Vector3 sphereCenter, float sphereRadius)
- {
- float r = sphereRadius - particleRadius;
- float r2 = r * r;
- Vector3 d = particlePosition - sphereCenter;
- float len2 = d.sqrMagnitude;
-
- // if is outside sphere, project onto sphere surface
- if (len2 > r2)
- {
- float len = Mathf.Sqrt(len2);
- particlePosition = sphereCenter + d * (r / len);
- return true;
- }
- return false;
- }
-
- static bool OutsideCapsule(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius)
- {
- float r = capsuleRadius + particleRadius;
- float r2 = r * r;
- Vector3 dir = capsuleP1 - capsuleP0;
- Vector3 d = particlePosition - capsuleP0;
- float t = Vector3.Dot(d, dir);
-
- if (t <= 0)
- {
- // check sphere1
- float len2 = d.sqrMagnitude;
- if (len2 > 0 && len2 < r2)
- {
- float len = Mathf.Sqrt(len2);
- particlePosition = capsuleP0 + d * (r / len);
- return true;
- }
- }
- else
- {
- float dl = dir.sqrMagnitude;
- if (t >= dl)
- {
- // check sphere2
- d = particlePosition - capsuleP1;
- float len2 = d.sqrMagnitude;
- if (len2 > 0 && len2 < r2)
- {
- float len = Mathf.Sqrt(len2);
- particlePosition = capsuleP1 + d * (r / len);
- return true;
- }
- }
- else if (dl > 0)
- {
- // check cylinder
- t /= dl;
- d -= dir * t;
- float len2 = d.sqrMagnitude;
- if (len2 > 0 && len2 < r2)
- {
- float len = Mathf.Sqrt(len2);
- particlePosition += d * ((r - len) / len);
- return true;
- }
- }
- }
- return false;
- }
-
- static bool InsideCapsule(ref Vector3 particlePosition, float particleRadius, Vector3 capsuleP0, Vector3 capsuleP1, float capsuleRadius)
- {
- float r = capsuleRadius - particleRadius;
- float r2 = r * r;
- Vector3 dir = capsuleP1 - capsuleP0;
- Vector3 d = particlePosition - capsuleP0;
- float t = Vector3.Dot(d, dir);
-
- if (t <= 0)
- {
- // check sphere1
- float len2 = d.sqrMagnitude;
- if (len2 > r2)
- {
- float len = Mathf.Sqrt(len2);
- particlePosition = capsuleP0 + d * (r / len);
- return true;
- }
- }
- else
- {
- float dl = dir.sqrMagnitude;
- if (t >= dl)
- {
- // check sphere2
- d = particlePosition - capsuleP1;
- float len2 = d.sqrMagnitude;
- if (len2 > r2)
- {
- float len = Mathf.Sqrt(len2);
- particlePosition = capsuleP1 + d * (r / len);
- return true;
- }
- }
- else if (dl > 0)
- {
- // check cylinder
- t /= dl;
- d -= dir * t;
- float len2 = d.sqrMagnitude;
- if (len2 > r2)
- {
- float len = Mathf.Sqrt(len2);
- particlePosition += d * ((r - len) / len);
- return true;
- }
- }
- }
- return false;
- }
-
- void OnDrawGizmosSelected()
- {
- if (!enabled)
- return;
-
- if (m_Bound == Bound.Outside)
- Gizmos.color = Color.yellow;
- else
- Gizmos.color = Color.magenta;
- float radius = m_Radius * Mathf.Abs(transform.lossyScale.x);
- float h = m_Height * 0.5f - m_Radius;
- if (h <= 0)
- {
- Gizmos.DrawWireSphere(transform.TransformPoint(m_Center), radius);
- }
- else
- {
- Vector3 c0 = m_Center;
- Vector3 c1 = m_Center;
-
- switch (m_Direction)
- {
- case Direction.X:
- c0.x -= h;
- c1.x += h;
- break;
- case Direction.Y:
- c0.y -= h;
- c1.y += h;
- break;
- case Direction.Z:
- c0.z -= h;
- c1.z += h;
- break;
- }
- Gizmos.DrawWireSphere(transform.TransformPoint(c0), radius);
- Gizmos.DrawWireSphere(transform.TransformPoint(c1), radius);
- }
- }
-}
-
-}
\ No newline at end of file
diff --git a/ScarletMansion/ScarletMansion/GamePatch/DynamicBone/DynamicBoneColliderBase.cs b/ScarletMansion/ScarletMansion/GamePatch/DynamicBone/DynamicBoneColliderBase.cs
deleted file mode 100644
index 1b53961..0000000
--- a/ScarletMansion/ScarletMansion/GamePatch/DynamicBone/DynamicBoneColliderBase.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using UnityEngine;
-
-namespace ScarletMansion.GamePatch.DynamicBone {
-
-public class DynamicBoneColliderBase : MonoBehaviour
-{
- public enum Direction
- {
- X, Y, Z
- }
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("The axis of the capsule's height.")]
-#endif
- public Direction m_Direction = Direction.Y;
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("The center of the sphere or capsule, in the object's local space.")]
-#endif
- public Vector3 m_Center = Vector3.zero;
-
- public enum Bound
- {
- Outside,
- Inside
- }
-
-#if UNITY_5_3_OR_NEWER
- [Tooltip("Constrain bones to outside bound or inside bound.")]
-#endif
- public Bound m_Bound = Bound.Outside;
-
- public virtual bool Collide(ref Vector3 particlePosition, float particleRadius)
- {
- return false;
- }
-}
-
-}
\ No newline at end of file
diff --git a/ScarletMansion/ScarletMansion/GamePatch/DynamicBone/DynamicBonePlaneCollider.cs b/ScarletMansion/ScarletMansion/GamePatch/DynamicBone/DynamicBonePlaneCollider.cs
deleted file mode 100644
index 6a9b685..0000000
--- a/ScarletMansion/ScarletMansion/GamePatch/DynamicBone/DynamicBonePlaneCollider.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-using UnityEngine;
-
-namespace ScarletMansion.GamePatch.DynamicBone {
-
-[AddComponentMenu("Dynamic Bone/Dynamic Bone Plane Collider")]
-public class DynamicBonePlaneCollider : DynamicBoneColliderBase
-{
- void OnValidate()
- {
- }
-
- public override bool Collide(ref Vector3 particlePosition, float particleRadius)
- {
- Vector3 normal = Vector3.up;
- switch (m_Direction)
- {
- case Direction.X:
- normal = transform.right;
- break;
- case Direction.Y:
- normal = transform.up;
- break;
- case Direction.Z:
- normal = transform.forward;
- break;
- }
-
- Vector3 p = transform.TransformPoint(m_Center);
- Plane plane = new Plane(normal, p);
- float d = plane.GetDistanceToPoint(particlePosition);
-
- if (m_Bound == Bound.Outside)
- {
- if (d < 0)
- {
- particlePosition -= normal * d;
- return true;
- }
- }
- else
- {
- if (d > 0)
- {
- particlePosition -= normal * d;
- return true;
- }
- }
- return false;
- }
-
- void OnDrawGizmosSelected()
- {
- if (!enabled)
- return;
-
- if (m_Bound == Bound.Outside)
- Gizmos.color = Color.yellow;
- else
- Gizmos.color = Color.magenta;
-
- Vector3 normal = Vector3.up;
- switch (m_Direction)
- {
- case Direction.X:
- normal = transform.right;
- break;
- case Direction.Y:
- normal = transform.up;
- break;
- case Direction.Z:
- normal = transform.forward;
- break;
- }
-
- Vector3 p = transform.TransformPoint(m_Center);
- Gizmos.DrawLine(p, p + normal);
- }
-}
-
-}
\ No newline at end of file
diff --git a/ScarletMansion/ScarletMansion/GamePatch/Enemies/KnightGhostVariant.cs b/ScarletMansion/ScarletMansion/GamePatch/Enemies/KnightGhostVariant.cs
index 83131d4..c536f6b 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/Enemies/KnightGhostVariant.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/Enemies/KnightGhostVariant.cs
@@ -8,7 +8,6 @@ using Unity.Netcode;
using UnityEngine.AI;
using GameNetcodeStuff;
using ScarletMansion.GamePatch.Components;
-using ScarletMansion.Configs;
namespace ScarletMansion {
@@ -27,7 +26,7 @@ namespace ScarletMansion {
public override void Start(){
base.Start();
- maxChaseSpeed = ConfigMain.Instance.revEnemyValue.speed;
+ maxChaseSpeed = PluginConfig.Instance.revEnemyValue.speed;
if (IsOwner && KnightSpawnManager.Instance) {
var index = KnightSpawnManager.Instance.GetSpawnPointIndex();
diff --git a/ScarletMansion/ScarletMansion/GamePatch/Enemies/KnightV2Variant.cs b/ScarletMansion/ScarletMansion/GamePatch/Enemies/KnightV2Variant.cs
index 41f5920..90e5269 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/Enemies/KnightV2Variant.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/Enemies/KnightV2Variant.cs
@@ -1,5 +1,4 @@
using GameNetcodeStuff;
-using ScarletMansion.Configs;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -52,7 +51,7 @@ namespace ScarletMansion.GamePatch.Enemies {
public override void Start(){
base.Start();
- currentChaseSpeed = ConfigMain.Instance.knightEnemyValue.speed;
+ currentChaseSpeed = PluginConfig.Instance.knightEnemyValue.speed;
if (IsOwner && KnightSpawnManager.Instance) {
var index = KnightSpawnManager.Instance.GetSpawnPointIndex();
diff --git a/ScarletMansion/ScarletMansion/GamePatch/Enemies/MaidVariant.cs b/ScarletMansion/ScarletMansion/GamePatch/Enemies/MaidVariant.cs
index 25d4fc9..7c32737 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/Enemies/MaidVariant.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/Enemies/MaidVariant.cs
@@ -1,7 +1,6 @@
//using System;
using System.Collections;
using GameNetcodeStuff;
-using ScarletMansion.Configs;
using ScarletMansion.GamePatch.Items;
using Unity.Netcode;
using UnityEngine;
@@ -247,8 +246,8 @@ namespace ScarletMansion.GamePatch.Enemies {
MaidVariant.murderMusicAudio = chaseMusic;
}
- enemyHP = ConfigMain.Instance.maidEnemyValue.health;
- chaseMovementSpeedBase = ConfigMain.Instance.maidEnemyValue.speed;
+ enemyHP = PluginConfig.Instance.maidEnemyValue.health;
+ chaseMovementSpeedBase = PluginConfig.Instance.maidEnemyValue.speed;
if (StartOfRound.Instance.connectedPlayersAmount == 0){
enemyHP = 2;
@@ -273,7 +272,7 @@ namespace ScarletMansion.GamePatch.Enemies {
knifeRender.SetActive(false);
if (IsServer) {
- if (ConfigMain.Instance.revEnemyValue.enabled){
+ if (PluginConfig.Instance.revEnemyValue.enabled){
var enemy = ScarletNetworkManagerUtility.CreateEnemyWithType(knightGhostEnemy, transform.position, 0f);
enemy.FindAndTunnelPlayer(transform.position);
}
diff --git a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixCeilingLightValue.cs b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixCeilingLightValue.cs
index df1dbb7..6e270c4 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixCeilingLightValue.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixCeilingLightValue.cs
@@ -11,7 +11,7 @@ namespace ScarletMansion.GamePatch.FixValues {
public void Awake(){
var weight = target.Props.Weights[1];
- var value = Plugin.GetConfigDungeon.GetCeilingLightsWeight;
+ var value = PluginConfig.Instance.ceilingLightsWeightValue;
weight.MainPathWeight = value;
weight.BranchPathWeight = value;
}
diff --git a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixFireExit.cs b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixFireExit.cs
index 28341b0..cc8c7a4 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixFireExit.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixFireExit.cs
@@ -5,7 +5,6 @@ using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using ScarletMansion.GamePatch.Components;
-using ScarletMansion.Configs;
namespace ScarletMansion.GamePatch.FixValues {
public class FixFireExit : FixBaseClass {
@@ -27,7 +26,7 @@ namespace ScarletMansion.GamePatch.FixValues {
public GameObject vanillaCube001GameObject;
public GameObject vanillaCube002GameObject;
- public bool EnableVanillaFireExit => !ConfigMain.Instance.useSDMFireExitsValue && vanillaSetup;
+ public bool EnableVanillaFireExit => !PluginConfig.Instance.useSDMFireExitsValue && vanillaSetup;
public void Awake(){
if (EnableVanillaFireExit){
diff --git a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixHallwayLightValue.cs b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixHallwayLightValue.cs
index 7652e54..5f931b1 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixHallwayLightValue.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixHallwayLightValue.cs
@@ -11,7 +11,7 @@ namespace ScarletMansion.GamePatch.FixValues {
public void Awake(){
var weight = target.Props.Weights[1];
- var value = Plugin.GetConfigDungeon.GetHallwayLightsWeight;
+ var value = PluginConfig.Instance.hallwayLightsWeightValue;
weight.MainPathWeight = value;
weight.BranchPathWeight = value;
}
diff --git a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixTreasureRoom.cs b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixTreasureRoom.cs
index 117dffb..1fd592d 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixTreasureRoom.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/FixValues/FixTreasureRoom.cs
@@ -10,7 +10,7 @@ namespace ScarletMansion.GamePatch.FixValues
{
public class FixTreasureRoom : FixBaseClass {
public void Awake(){
- var loot = Plugin.GetConfigDungeon.GetTreasureRoomLoot;
+ var loot = PluginConfig.Instance.treasureRoomLootValue;
target.propCount = new IntRange(loot.min, loot.max);
}
diff --git a/ScarletMansion/ScarletMansion/GamePatch/InitPatch.cs b/ScarletMansion/ScarletMansion/GamePatch/InitPatch.cs
index c2e729b..d13a5d5 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/InitPatch.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/InitPatch.cs
@@ -18,7 +18,6 @@ using ScarletMansion.GamePatch.Enemies;
using UnityEngine.UI;
using ScarletMansion.GamePatch.Items;
using DunGenPlus.Managers;
-using ScarletMansion.Configs;
namespace ScarletMansion.GamePatch {
@@ -171,10 +170,10 @@ namespace ScarletMansion.GamePatch {
var itemsList = round.allItemsList.itemsList;
void QuickItemFix(Item itemToFix, Item itemReference){
- if (itemToFix.itemIcon == null) itemToFix.itemIcon = itemReference.itemIcon;
- if (itemToFix.grabSFX == null) itemToFix.grabSFX = itemReference.grabSFX;
- if (itemToFix.dropSFX == null) itemToFix.dropSFX = itemReference.dropSFX;
- if (itemToFix.pocketSFX == null) itemToFix.pocketSFX = itemReference.pocketSFX;
+ itemToFix.itemIcon = itemReference.itemIcon;
+ itemToFix.grabSFX = itemReference.grabSFX;
+ itemToFix.dropSFX = itemReference.dropSFX;
+ itemToFix.pocketSFX = itemReference.pocketSFX;
}
var magClass = itemsList.FirstOrDefault(i => i.name.ToLowerInvariant() == "magnifyingglass");
@@ -182,7 +181,6 @@ namespace ScarletMansion.GamePatch {
QuickItemFix(Assets.scrapItems[0].item, magClass);
QuickItemFix(Assets.scrapItems[1].item, magClass);
QuickItemFix(Assets.scrapItems[4].item, magClass);
- Assets.scrapItems[5].item.itemIcon = magClass.itemIcon;
}
var paintClass = itemsList.FirstOrDefault(i => i.name.ToLowerInvariant() == "fancypainting");
@@ -267,16 +265,6 @@ namespace ScarletMansion.GamePatch {
Utility.FixParticleSystemMaterial(scarletScript.buffedParticleSystem, knifeScript.bloodParticle);
}
- var shovelItem = itemsList.FirstOrDefault(i => i.name.ToLowerInvariant() == "shovel");
- if (GameReadNullCheck(shovelItem, "shovel", "Item will have missing image and sound assets")){
- QuickItemFix(Assets.scrapItems[5].item, shovelItem);
- var shovelScript = shovelItem.spawnPrefab.GetComponent();
- var goheiScript = Assets.scrapItems[5].item.spawnPrefab.GetComponent();
-
- goheiScript.reelUp = shovelScript.reelUp;
- goheiScript.swing = shovelScript.swing;
- }
-
if (Assets.flashlight.item == null) {
UpdateFlashlight(Assets.flashlight, "proflashlight", 2);
}
@@ -369,19 +357,35 @@ namespace ScarletMansion.GamePatch {
}
private static IEnumerator UpdateNetworkConfig(RoundManager roundManager){
- while(ConfigMain.Synced == false || ConfigDungeonFoyer.Synced == false){
+ while(PluginConfig.Synced == false){
yield return null;
}
+ Lights.ScarletLightCleanup.weights = new float[] {
+ PluginConfig.Instance.lightsSpawnZeroWeightValue,
+ PluginConfig.Instance.lightsSpawnOneWeightValue,
+ PluginConfig.Instance.lightsSpawnTwoWeightValue
+ };
+
+ Assets.dungeon.Length = PluginConfig.Instance.mainPathLengthValue.GetDungenIntRange();
+
+ DungeonFlow.GlobalPropSettings GetGlobalPropSetting(int id) {
+ foreach(var p in Assets.dungeon.GlobalProps){
+ if (p.ID == id ) return p;
+ }
+ return null;
+ }
+
+ GetGlobalPropSetting(254).Count = new DunGen.IntRange(
+ PluginConfig.Instance.paintingCountValue,
+ PluginConfig.Instance.paintingCountValue
+ );
+
foreach(var scrap in Assets.scrapItems){
scrap.UpdateItemValue();
}
- ConfigDungeonFoyer.Instance.dungeon.Length = ConfigDungeonFoyer.Instance.mainPathLengthValue.GetDungenIntRange();
-
- ConfigDungeonFoyer.Instance.dungeonExtended.OverrideKeyPrefab = Assets.key.GetConfigItemEntry().enabled ?
- Assets.key.item.spawnPrefab :
- typeof(DungeonLoader).GetField("defaultKeyPrefab", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).GetValue(null) as GameObject;
+ Assets.dungeonExtended.OverrideKeyPrefab = Assets.key.GetConfigItemEntry().enabled ? Assets.key.item.spawnPrefab : typeof(DungeonLoader).GetField("defaultKeyPrefab", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).GetValue(null) as GameObject;
Plugin.logger.LogDebug("Set networked config values");
}
diff --git a/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletGohei.cs b/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletGohei.cs
deleted file mode 100644
index 5089e95..0000000
--- a/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletGohei.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Unity.Netcode;
-using UnityEngine;
-
-namespace ScarletMansion.GamePatch.Items {
-
- public class ScarletGohei : Shovel {
-
- [Header("Alert")]
- public AudioClip alertAudioClip;
- public LayerMask enemyLayerMask;
- public float enemyCheckTimer = 0.5f;
- public float enemyCheckPause = 8f;
- public float enemyCheckRange = 16f;
- private float checkTime;
-
- [Header("Animation")]
- public SkinnedMeshRenderer skinnedMeshRenderer;
- public float flashDuration = 1f;
-
- public override void Update(){
- base.Update();
-
- if (!isPocketed && playerHeldBy && playerHeldBy.IsOwner) {
- if (Time.time >= checkTime) {
- // check enemies
- //var enemies = RoundManager.Instance.SpawnedEnemies;
- var enemies = Physics.OverlapSphere(transform.position, enemyCheckRange, enemyLayerMask);
- var foundEnemy = enemies.Select(e => e.GetComponent()).Any(e => e && !e.isEnemyDead);
-
- // found enemy
- if (foundEnemy){
- AlertServerRpc();
- checkTime = Time.time + enemyCheckPause;
- } else {
- checkTime = Time.time + enemyCheckTimer;
- }
-
- }
- }
- }
-
- IEnumerator FlashRed(){
- var mat = skinnedMeshRenderer.material;
- var startColor = mat.color;
- var t = 0f;
- var halfDuration = flashDuration * 0.5f;
-
- while(t < halfDuration) {
- mat.color = Color.Lerp(startColor, Color.red, t / halfDuration);
- yield return null;
- t += Time.deltaTime;
- }
-
- while(t < flashDuration) {
- mat.color = Color.Lerp(Color.red, Color.white, (t - halfDuration) / halfDuration);
- yield return null;
- t += Time.deltaTime;
- }
-
- mat.color = Color.white;
- }
-
- [ServerRpc(RequireOwnership = false)]
- public void AlertServerRpc(){
- AlertClientRpc();
- }
-
- public void AlertClientRpc(){
- StartCoroutine(FlashRed());
- RoundManager.Instance.PlayAudibleNoise(transform.position, 12f, 0.9f);
- shovelAudio.PlayOneShot(alertAudioClip);
- WalkieTalkie.TransmitOneShotAudio(shovelAudio, alertAudioClip);
- }
-
- }
-}
diff --git a/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletKnife.cs b/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletKnife.cs
index 97e0f33..1d21451 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletKnife.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletKnife.cs
@@ -3,6 +3,8 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using GameNetcodeStuff;
+using OdinSerializer;
+using ScarletMansion.GamePatch.Components;
using ScarletMansion.GamePatch.Enemies;
using Unity.Netcode;
using UnityEngine;
@@ -163,7 +165,7 @@ namespace ScarletMansion.GamePatch.Items
if (flag) {
RoundManager.PlayRandomClip(knifeAudio, hitSFX);
- RoundManager.Instance.PlayAudibleNoise(base.transform.position, 17f, 0.8f);
+ UnityEngine.Object.FindObjectOfType().PlayAudibleNoise(base.transform.position, 17f, 0.8f);
if (!flag2 && num != -1) {
knifeAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
WalkieTalkie.TransmitOneShotAudio(knifeAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
diff --git a/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletPainting.cs b/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletPainting.cs
index 59e814d..6f165f6 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletPainting.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/Items/ScarletPainting.cs
@@ -8,7 +8,6 @@ using UnityEngine;
using Unity.Netcode;
using ScarletMansion.GamePatch.Components;
using ScarletMansion.GamePatch.Managers;
-using ScarletMansion.Configs;
namespace ScarletMansion.GamePatch.Items {
public class ScarletPainting : GrabbableObject {
@@ -52,7 +51,7 @@ namespace ScarletMansion.GamePatch.Items {
manager.AddPainting(this);
bedroom = manager.GetBedroomWithPainting(transform.position);
- scrapValue = ConfigMain.Instance.paintingValueValue;
+ scrapValue = PluginConfig.Instance.paintingValueValue;
grabbedByEvent = false;
} else {
transform.rotation = Quaternion.Euler(itemProperties.restingRotation); // why zeekers
diff --git a/ScarletMansion/ScarletMansion/GamePatch/LoadAssetsIntoLevelPatch.cs b/ScarletMansion/ScarletMansion/GamePatch/LoadAssetsIntoLevelPatch.cs
index c855a0d..53ffe48 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/LoadAssetsIntoLevelPatch.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/LoadAssetsIntoLevelPatch.cs
@@ -6,15 +6,12 @@ using System.Reflection.Emit;
using System.Reflection;
using DunGenPlus.Managers;
using ScarletMansion.GamePatch.Components;
-using ScarletMansion.Configs;
namespace ScarletMansion.GamePatch {
public class LoadAssetsIntoLevelPatch {
public static void AddItemsLocal(RoundManager roundManager){
- if (DunGenPlus.API.IsDevDebugModeActive()) return;
-
foreach(var item in Assets.scrapItems){
if (item.SpawnsOnMap) {
var config = item.GetConfigScrapItemEntry();
@@ -27,8 +24,6 @@ namespace ScarletMansion.GamePatch {
}
public static void AddItemsGlobal(RoundManager roundManager){
- if (DunGenPlus.API.IsDevDebugModeActive()) return;
-
foreach(var item in Assets.scrapItems){
if (item.SpawnsOnMap) {
var config = item.GetConfigScrapItemEntry();
@@ -41,15 +36,14 @@ namespace ScarletMansion.GamePatch {
}
public static void AddEnemiesLocal(RoundManager roundManager) {
- if (DunGenPlus.API.IsDevDebugModeActive()) return;
var currentEnemies = roundManager.currentLevel.Enemies;
- void AddEnemy(Assets.Enemy enemy, string sourceEnemyName, string targetEnemyName, ConfigSpawnableEnemy enemyConfig) {
+ void AddEnemy(Assets.Enemy enemy, string sourceEnemyName, string targetEnemyName, PluginConfig.SpawnableEnemy enemyConfig) {
const int minBaseWeight = 10;
if (!enemyConfig.enabled) {
- Plugin.logger.LogDebug($"{sourceEnemyName} is disabled. Not loading onto moon.");
+ Plugin.logger.LogDebug($"{sourceEnemyName} is disblaed. Not loading onto moon.");
return;
}
@@ -82,8 +76,8 @@ namespace ScarletMansion.GamePatch {
}
}
- AddEnemy(Assets.knight, "knight", "springman", ConfigMain.Instance.knightEnemyValue);
- AddEnemy(Assets.maid, "maid", "butler", ConfigMain.Instance.maidEnemyValue);
+ AddEnemy(Assets.knight, "knight", "springman", PluginConfig.Instance.knightEnemyValue);
+ AddEnemy(Assets.maid, "maid", "butler", PluginConfig.Instance.maidEnemyValue);
ScarletBedroom.CreateRandomEnemyList(currentEnemies);
}
diff --git a/ScarletMansion/ScarletMansion/GamePatch/Managers/AngerManager.cs b/ScarletMansion/ScarletMansion/GamePatch/Managers/AngerManager.cs
index da45ba0..a5fb8fe 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/Managers/AngerManager.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/Managers/AngerManager.cs
@@ -73,7 +73,7 @@ namespace ScarletMansion.GamePatch.Managers {
}
public void OnDungeonComplete(Dungeon dungeon) {
- Anger(Plugin.GetConfigDungeon.GetMinIndoorEnemySpawnCount);
+ Anger(PluginConfig.Instance.minIndoorEnemySpawnCountValue);
}
public void TriggerAngerLightBrief(float duration){
diff --git a/ScarletMansion/ScarletMansion/GamePatch/Managers/ScarletNetworkManager.cs b/ScarletMansion/ScarletMansion/GamePatch/Managers/ScarletNetworkManager.cs
index d035622..188dabe 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/Managers/ScarletNetworkManager.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/Managers/ScarletNetworkManager.cs
@@ -12,7 +12,6 @@ using ScarletMansion.GamePatch;
using ScarletMansion.GamePatch.Components;
using static LethalLevelLoader.ExtendedEvent;
using ScarletMansion.GamePatch.Managers;
-using ScarletMansion.Configs;
namespace ScarletMansion {
@@ -267,7 +266,7 @@ namespace ScarletMansion {
public void RequestEvilSkinApply(NetworkObjectReference reference, string enemyName) {
- if (ConfigMain.Instance.paintingEnemyEvilSkinValue && ScarletBedroom.ENEMY_EVIL_LIST.Contains(enemyName)) {
+ if (PluginConfig.Instance.paintingEnemyEvilSkinValue && ScarletBedroom.ENEMY_EVIL_LIST.Contains(enemyName)) {
RequestEvilSkinApplyClientRpc(reference);
}
}
diff --git a/ScarletMansion/ScarletMansion/GamePatch/RoundManagerPatch.cs b/ScarletMansion/ScarletMansion/GamePatch/RoundManagerPatch.cs
index dfd38fa..2b343e3 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/RoundManagerPatch.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/RoundManagerPatch.cs
@@ -40,14 +40,14 @@ namespace ScarletMansion.GamePatch {
public static float ModifyScrapCount(float count){
if (DunGenPatch.Patch.active == false) return count;
- Plugin.logger.LogDebug($"Scrap: {count} -> {count * Plugin.GetConfigDungeon.GetLootMultiplier}");
- return count * Plugin.GetConfigDungeon.GetLootMultiplier;
+ Plugin.logger.LogDebug($"Scrap: {count} -> {count * PluginConfig.Instance.lootMultiplierValue}");
+ return count * PluginConfig.Instance.lootMultiplierValue;
}
public static float ModifyMapCount(float count){
if (DunGenPatch.Patch.active == false) return count;
- Plugin.logger.LogDebug($"Map Hazards: {count} -> {count * Plugin.GetConfigDungeon.GetMapHazardsMultiplier}");
- return count * Plugin.GetConfigDungeon.GetMapHazardsMultiplier;
+ Plugin.logger.LogDebug($"Map Hazards: {count} -> {count * PluginConfig.Instance.mapHazardsMultiplierValue}");
+ return count * PluginConfig.Instance.mapHazardsMultiplierValue;
}
}
diff --git a/ScarletMansion/ScarletMansion/GamePatch/ShotgunItemPatch.cs b/ScarletMansion/ScarletMansion/GamePatch/ShotgunItemPatch.cs
index dd3791f..34ac973 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/ShotgunItemPatch.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/ShotgunItemPatch.cs
@@ -5,7 +5,6 @@ using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using HarmonyLib;
-using ScarletMansion.Configs;
namespace ScarletMansion.GamePatch {
public class ShotgunItemPatch {
@@ -14,7 +13,7 @@ namespace ScarletMansion.GamePatch {
[HarmonyPostfix]
public static void ShootGunPatch(ref ShotgunItem __instance, Vector3 shotgunPosition, Vector3 shotgunForward){
if (Components.ScarletDoorLock.ScarletDoorRaycast(__instance, shotgunPosition, shotgunForward, 30f, out var door)){
- var damage = ConfigMain.Instance.shotgunDamageValue;
+ var damage = PluginConfig.Instance.shotgunDamageValue;
door.ApplyDamageServerRpc(shotgunForward, damage);
}
}
diff --git a/ScarletMansion/ScarletMansion/GamePatch/ShovelPatch.cs b/ScarletMansion/ScarletMansion/GamePatch/ShovelPatch.cs
index bf0a7b4..8372a60 100644
--- a/ScarletMansion/ScarletMansion/GamePatch/ShovelPatch.cs
+++ b/ScarletMansion/ScarletMansion/GamePatch/ShovelPatch.cs
@@ -5,7 +5,6 @@ using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using HarmonyLib;
-using ScarletMansion.Configs;
namespace ScarletMansion.GamePatch {
public class ShovelPatch {
@@ -20,7 +19,7 @@ namespace ScarletMansion.GamePatch {
var position = prevTransform.position + prevTransform.right * -0.35f;
var forward = prevTransform.forward;
if (Components.ScarletDoorLock.ScarletDoorRaycast(__instance, position, forward, 1.5f + 0.8f, out var door)){
- var damage = ConfigMain.Instance.shovelDamageValue;
+ var damage = PluginConfig.Instance.shovelDamageValue;
door.ApplyDamageServerRpc(forward, damage);
}
}
diff --git a/ScarletMansion/ScarletMansion/ModPatch/FacilityMeltdownPatch.cs b/ScarletMansion/ScarletMansion/ModPatch/FacilityMeltdownPatch.cs
index cd58e0a..35f87af 100644
--- a/ScarletMansion/ScarletMansion/ModPatch/FacilityMeltdownPatch.cs
+++ b/ScarletMansion/ScarletMansion/ModPatch/FacilityMeltdownPatch.cs
@@ -1,5 +1,4 @@
-using ScarletMansion.Configs;
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -18,7 +17,7 @@ namespace ScarletMansion.ModPatch {
}
public static void Call(){
- if (StartOfRound.Instance.IsHost && ConfigMain.Instance.facilityMeltdownActiveValue){
+ if (StartOfRound.Instance.IsHost && PluginConfig.Instance.facilityMeltdownActiveValue){
FacilityMeltdown.API.MeltdownAPI.StartMeltdown(Plugin.modGUID);
GamePatch.Managers.AngerManager.Instance.TriggerAngerLightForever();
}
diff --git a/ScarletMansion/ScarletMansion/ModPatch/LethalConfigPatch.cs b/ScarletMansion/ScarletMansion/ModPatch/LethalConfigPatch.cs
index 02db3f1..ea64e6d 100644
--- a/ScarletMansion/ScarletMansion/ModPatch/LethalConfigPatch.cs
+++ b/ScarletMansion/ScarletMansion/ModPatch/LethalConfigPatch.cs
@@ -1,5 +1,4 @@
using System;
-using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -10,16 +9,18 @@ using LethalConfig.ConfigItems;
using BepInEx.Configuration;
using System.Reflection;
+using ChangeList = ScarletMansion.PresetConfig.ChangeList;
+using ConfigEntryBundleInt = ScarletMansion.PluginConfig.ConfigEntryBundle;
+using ConfigEntryBundleFloat = ScarletMansion.PluginConfig.ConfigEntryBundle;
+using ConfigEntryBundleString = ScarletMansion.PluginConfig.ConfigEntryBundle;
+using ConfigEntryBundleBool = ScarletMansion.PluginConfig.ConfigEntryBundle;
using HarmonyLib;
using LethalConfig.MonoBehaviours.Components;
using UnityEngine.UI;
using LethalConfig.MonoBehaviours;
-using ScarletMansion.Configs;
-using Microsoft.CSharp;
-using System.CodeDom.Compiler;
namespace ScarletMansion.ModPatch {
- public class LethalConfigPatch : ModPatch where T: ConfigDungeon {
+ public class LethalConfigPatch : ModPatch {
public const string section = "_Presets";
public const string descriptionPrefix = "These are a set of preset config values for your convience. Your config values will automatically update to these preset values every time SDM is loaded. These config values are a brighter shade of red. To disable this feature, set this value to Custom.";
@@ -31,8 +32,7 @@ namespace ScarletMansion.ModPatch {
public static void ForceUIUpdate(){
try {
- // zaggy said it's better
- var configMenuObject = GameObject.FindAnyObjectByType();
+ var configMenuObject = GameObject.FindObjectOfType();
configMenuObject.Close(false);
configMenuObject.Open();
} catch (Exception e) {
@@ -50,14 +50,14 @@ namespace ScarletMansion.ModPatch {
return LethalConfig.ConfigItems.Options.CanModifyResult.True();
}
- public static void CreateConfig(Assembly assembly, ConfigEntryBase configEntry) {
- if (configEntry is ConfigEntry) CreateIntConfig(assembly, configEntry as ConfigEntry);
- else if (configEntry is ConfigEntry) CreateFloatConfig(assembly, configEntry as ConfigEntry);
- else if (configEntry is ConfigEntry) CreateStringConfig(assembly, configEntry as ConfigEntry);
- else if (configEntry is ConfigEntry) CreateBoolConfig(assembly, configEntry as ConfigEntry);
+ public static void CreateConfig(ConfigEntryBase configEntry) {
+ if (configEntry is ConfigEntry) CreateIntConfig(configEntry as ConfigEntry);
+ else if (configEntry is ConfigEntry) CreateFloatConfig(configEntry as ConfigEntry);
+ else if (configEntry is ConfigEntry) CreateStringConfig(configEntry as ConfigEntry