Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Properly track obtained persistent items
Browse files Browse the repository at this point in the history
This fixes tracking of randomized persistent items, like soul totems and
lifeblood hearts.

Fixes #1
  • Loading branch information
thislooksfun committed Nov 24, 2022
1 parent 2e7d289 commit 756580f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion APMapMod/Map/PinsCustom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,20 @@ public void UpdatePinLocationState(PinDef pd)
// return;
// }

bool hasUnobtainedItems = false;
// Remove obtained rando items from list
if (pd.randoItems != null && pd.randoItems.Any())
{
List<ItemDef> newRandoItems = new();

foreach (ItemDef item in pd.randoItems)
{
if (!item.item.IsObtained() || item.item.IsPersistent())
if (!item.item.WasEverObtained())
{
hasUnobtainedItems = true;
}

if (!item.item.WasEverObtained() || item.item.IsPersistent())
{
newRandoItems.Add(item);
}
Expand Down Expand Up @@ -221,6 +227,10 @@ public void UpdatePinLocationState(PinDef pd)
{
pd.pinLocationState = PinLocationState.Cleared;
}
else if (!hasUnobtainedItems)
{
pd.pinLocationState = PinLocationState.ClearedPersistent;
}
}

// Called every time when any relevant setting is changed, or when the Map is opened
Expand Down

0 comments on commit 756580f

Please sign in to comment.