diff --git a/Crest of a Traveller.csproj b/Crest of a Traveller.csproj index 45cc002..6a55e96 100644 --- a/Crest of a Traveller.csproj +++ b/Crest of a Traveller.csproj @@ -36,7 +36,7 @@ - + diff --git a/Mechanics/Bind.cs b/Mechanics/Bind.cs index 1398882..615d56b 100644 --- a/Mechanics/Bind.cs +++ b/Mechanics/Bind.cs @@ -112,12 +112,10 @@ void ReplaceSilkEffects() { FsmState healState = fsm.GetState("Heal")!; - int healIndex = - Array.FindIndex( - healState.Actions, - x => x is CallMethodProper action - && action.methodName.Value == nameof(HeroController.AddHealth) - ); + int healIndex = healState.IndexFirstActionMatching( + x => x is CallMethodProper action + && action.methodName.Value == nameof(HeroController.AddHealth) + ); healState.InsertMethod(healIndex, () => { if (!SifCrest.IsEquipped) @@ -144,12 +142,10 @@ void ReplaceSilkEffects() { // The screen flash after binding should be lifeblood blue if we healed lifeblood. - int flashSpawnIndex = - Array.FindIndex( - healState.Actions, - x => x is SpawnObjectFromGlobalPool action - && action.gameObject.Value.name.Contains("White Flash") - ); + int flashSpawnIndex = healState.IndexFirstActionMatching( + x => x is SpawnObjectFromGlobalPool action + && action.gameObject.Value.name.Contains("White Flash") + ); healState.GetAction(flashSpawnIndex)! .storeObject = spawnedFlash; @@ -237,11 +233,8 @@ private static void StopBubbles(GameObject? go) { /// Recolours all particle systems on all descendants of the given GameObject. /// private static GameObject RecolourParticles(GameObject go, Color colour) { - - var descendants = Descendants(go); - - while (descendants.MoveNext()) { - if (!descendants.Current.TryGetComponent(out var partSystem)) + foreach(Transform t in Descendants(go)) { + if (!t.TryGetComponent(out var partSystem)) continue; var colourModule = partSystem.colorOverLifetime; @@ -259,19 +252,17 @@ private static GameObject RecolourParticles(GameObject go, Color colour) { colourModule.color.gradient.alphaKeys ); } - return go; } /// /// Enumerates all the descendants of a GameObject. /// - private static IEnumerator Descendants(GameObject go) { + private static IEnumerable Descendants(GameObject go) { foreach (Transform t in go.transform) { yield return t; - var descendants = Descendants(t.gameObject); - while (descendants.MoveNext()) - yield return descendants.Current; + foreach (Transform descendant in Descendants(t.gameObject)) + yield return descendant; } } diff --git a/TravellerCrestPlugin.cs b/TravellerCrestPlugin.cs index f65078c..55abaea 100644 --- a/TravellerCrestPlugin.cs +++ b/TravellerCrestPlugin.cs @@ -26,7 +26,7 @@ namespace TravellerCrest; [BepInAutoPlugin(id: "io.github.kaycodes13.travellercrest")] [BepInDependency("org.silksong-modding.i18n", "1.0.2")] -[BepInDependency("org.silksong-modding.fsmutil", "0.3.12")] +[BepInDependency("org.silksong-modding.fsmutil", "0.3.14")] [BepInDependency("org.silksong-modding.unityhelper", "1.1.1")] [BepInDependency("io.github.needleforge", "0.8.1")] [BepInIncompatibility("com.cometcake575.architect")] diff --git a/packages.lock.json b/packages.lock.json index e07a6b8..7dc418f 100644 --- a/packages.lock.json +++ b/packages.lock.json @@ -61,9 +61,9 @@ }, "Silksong.FsmUtil": { "type": "Direct", - "requested": "[0.3.13, )", - "resolved": "0.3.13", - "contentHash": "CUZ7PKKUu3O7byEW4iEOkVOGcJPbHI28Z7D+Pn0LMxiSv/VjIjixG4JYH6GMgbE4uIbtpfF1Bon769cJt2w1RQ==", + "requested": "[0.3.14, )", + "resolved": "0.3.14", + "contentHash": "51PRA9bRdiphGpFa7OUAe5ya4mpcVyHonsDI/v2I52zv1Zw3PfWVxhJAflCnj6j2Jigk6LX7ZNPWr9lD+ayrCw==", "dependencies": { "BepInEx.Core": "5.4.21", "HarmonyX": "2.9.0", diff --git a/thunderstore/thunderstore.toml b/thunderstore/thunderstore.toml index 40ed3e7..ffc75f0 100644 --- a/thunderstore/thunderstore.toml +++ b/thunderstore/thunderstore.toml @@ -17,7 +17,7 @@ containsNsfwContent = false BepInEx-BepInExPack_Silksong = "5.4.2304" silksong_modding-I18N = "1.0.2" silksong_modding-UnityHelper = "1.1.1" -silksong_modding-FsmUtil = "0.3.12" +silksong_modding-FsmUtil = "0.3.14" Voidlings-Needleforge = "0.8.1"