Skip to content

Commit

Permalink
bug fix, invalidate data trinkets with tinker
Browse files Browse the repository at this point in the history
  • Loading branch information
Mushymato committed Nov 11, 2024
1 parent 2bbfa4f commit 30c5362
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
>
> The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### 1.0.2

#### Fixed

- Correctly invalidate Data/Trinkets whenever the Tinker asset gets invalidated.

### 1.0.1

#### Fixed
Expand Down
8 changes: 6 additions & 2 deletions TrinketTinker/ModEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@ private static void OnAssetRequested(object? sender, AssetRequestedEventArgs e)
TrinketColorizer.OnAssetRequested(e);
}

private static void OnAssetInvalidated(object? sender, AssetsInvalidatedEventArgs e)
private void OnAssetInvalidated(object? sender, AssetsInvalidatedEventArgs e)
{
AssetManager.OnAssetInvalidated(e);
if (AssetManager.OnAssetInvalidated(e))
{
// need to invalidate this as well to ensure proper updates on Data/Trinkets
Helper.GameContent.InvalidateCache(AssetManager.TRINKET_TARGET);
}
}

private static void OnPlayerWarped(object? sender, WarpedEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion TrinketTinker/TrinketTinker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<Description>Trinket &amp; Companion framework.</Description>
<UniqueId>mushymato.TrinketTinker</UniqueId>
<UpdateKeys>Nexus:29073;GitHub:Mushymato/TrinketTinker</UpdateKeys>
<Version>1.0.1</Version>
<Version>1.0.2</Version>
<MinimumApiVersion_Behavior>UpdateFull</MinimumApiVersion_Behavior>
<MinimumGameVersion_Behavior>UpdateFull</MinimumGameVersion_Behavior>
<Dependencies_VersionBehavior>UpdateFull</Dependencies_VersionBehavior>
Expand Down
10 changes: 7 additions & 3 deletions TrinketTinker/Wheels/AssetManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,16 @@ internal static void OnAssetRequested(AssetRequestedEventArgs e)
e.Edit(Edit_Trinkets_EffectClass, AssetEditPriority.Late + 100);
}

internal static void OnAssetInvalidated(AssetsInvalidatedEventArgs e)
internal static bool OnAssetInvalidated(AssetsInvalidatedEventArgs e)
{
if (e.NamesWithoutLocale.Any(an => an.IsEquivalentTo(TinkerAsset)))
_tinkerData = null;
if (e.NamesWithoutLocale.Any(an => an.IsEquivalentTo(TASAsset)))
_tasData = null;
if (e.NamesWithoutLocale.Any(an => an.IsEquivalentTo(TinkerAsset)))
{
_tinkerData = null;
return true;
}
return false;
}

/// <summary>Ensure all trinkets that have a Tinker entry also have <see cref="EffectClass"/> </summary>
Expand Down

0 comments on commit 30c5362

Please sign in to comment.