Don't run some things on portals that have finished their treasures

This commit is contained in:
thepaperpilot 2023-05-10 00:46:28 -05:00
parent 2a12bbe7c0
commit ae53b56e8b

View file

@ -584,6 +584,7 @@ export function createPlane(
}));
this.on("preUpdate", diff => {
if (
earnedTreasures.value.length < length &&
main.activePortals.value.some(
n => (n.state as unknown as PortalState).id === id
) &&
@ -735,6 +736,7 @@ export function createPlane(
}
this.on("preUpdate", diff => {
if (
earnedTreasures.value.length < length &&
main.activePortals.value.some(
n => (n.state as unknown as PortalState).id === id
) &&
@ -1052,9 +1054,11 @@ export function createPlane(
const totalDiff = Decimal.times(computedPlanarSpeedModifier.value, diff);
timeActive.value = Decimal.add(timeActive.value, totalDiff);
resource.value = Decimal.times(computedResourceGain.value, totalDiff).add(
resource.value
);
if (earnedTreasures.value.length < length) {
resource.value = Decimal.times(computedResourceGain.value, totalDiff).add(
resource.value
);
}
earnedTreasures.value.forEach(treasure => {
treasure.update?.(totalDiff);