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