Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Crest of a Traveller.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<PackageReference Include="Hamunii.BepInEx.AutoPlugin" Version="2.1.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Unity.Analyzers" Version="1.26.0" PrivateAssets="all" />
<PackageReference Include="Needleforge" Version="0.8.1" />
<PackageReference Include="Silksong.FsmUtil" Version="0.3.13" />
<PackageReference Include="Silksong.FsmUtil" Version="0.3.14" />
<PackageReference Include="Silksong.UnityHelper" Version="1.1.1" />
<PackageReference Include="UnityEngine.Modules" Version="6000.0.50" IncludeAssets="compile" />
<PackageReference Include="Silksong.GameLibs" Version="*-*" PrivateAssets="all" />
Expand Down
35 changes: 13 additions & 22 deletions Mechanics/Bind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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<SpawnObjectFromGlobalPool>(flashSpawnIndex)!
.storeObject = spawnedFlash;
Expand Down Expand Up @@ -237,11 +233,8 @@ private static void StopBubbles(GameObject? go) {
/// Recolours all particle systems on all descendants of the given GameObject.
/// </summary>
private static GameObject RecolourParticles(GameObject go, Color colour) {

var descendants = Descendants(go);

while (descendants.MoveNext()) {
if (!descendants.Current.TryGetComponent<ParticleSystem>(out var partSystem))
foreach(Transform t in Descendants(go)) {
if (!t.TryGetComponent<ParticleSystem>(out var partSystem))
continue;

var colourModule = partSystem.colorOverLifetime;
Expand All @@ -259,19 +252,17 @@ private static GameObject RecolourParticles(GameObject go, Color colour) {
colourModule.color.gradient.alphaKeys
);
}

return go;
}

/// <summary>
/// Enumerates all the descendants of a GameObject.
/// </summary>
private static IEnumerator<Transform> Descendants(GameObject go) {
private static IEnumerable<Transform> 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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion TravellerCrestPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
6 changes: 3 additions & 3 deletions packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion thunderstore/thunderstore.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down