mirror of
https://git.srhtnin.garden/sarah/srhtnin.github.io.git
synced 2026-10-14 18:58:11 +02:00
Fixed GetPlantInage so that it changes to the last image when it's at
100%.. I got a bit confused when I couldn't harvest the final image.
This commit is contained in:
1 parent
bf15c48c10
commit
39a8f18fa3
1 file changed
+14
-2
@@ -596,6 +596,10 @@ function GetPlantImage(
|
||||
return null;
|
||||
}
|
||||
|
||||
if (Images.length === 1) {
|
||||
return Images[0];
|
||||
}
|
||||
|
||||
|
||||
const Progress =
|
||||
GetPlantGrowthProgress(
|
||||
@@ -603,15 +607,23 @@ function GetPlantImage(
|
||||
Plant
|
||||
);
|
||||
|
||||
if (Progress >= 1) {
|
||||
return Images[
|
||||
Images.length - 1
|
||||
];
|
||||
}
|
||||
|
||||
const GrowingImageCount =
|
||||
Images.length - 1;
|
||||
|
||||
const ImageIndex =
|
||||
Math.min(
|
||||
Math.floor(
|
||||
Progress *
|
||||
Images.length
|
||||
GrowingImageCount
|
||||
),
|
||||
|
||||
Images.length - 1
|
||||
GrowingImageCount - 1
|
||||
);
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user