mirror of
https://git.srhtnin.garden/sarah/srhtnin.github.io.git
synced 2026-10-14 18:58:11 +02:00
Changed the preview to be random for lists that are Type Once, since
that's more correct.
This commit is contained in:
1 parent
495e1a230a
commit
c723177564
1 file changed
+91
-4
@@ -373,10 +373,11 @@ function RenderMutationRecipePreviewListCell(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ItemIndex =
|
const ItemIndex =
|
||||||
(
|
GetMutationRecipePreviewItemIndex(
|
||||||
Frame +
|
Entry,
|
||||||
Entry.Offset
|
Frame,
|
||||||
) % Items.length;
|
Items.length
|
||||||
|
);
|
||||||
|
|
||||||
ApplyMutationRecipePreviewCellDisplay(
|
ApplyMutationRecipePreviewCellDisplay(
|
||||||
Entry,
|
Entry,
|
||||||
@@ -388,6 +389,92 @@ function RenderMutationRecipePreviewListCell(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function GetMutationRecipePreviewItemIndex(
|
||||||
|
Entry,
|
||||||
|
Frame,
|
||||||
|
ItemCount
|
||||||
|
) {
|
||||||
|
if (Entry.List?.Mode !== "Once") {
|
||||||
|
return (
|
||||||
|
Frame +
|
||||||
|
Entry.Offset
|
||||||
|
) % ItemCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Permutation =
|
||||||
|
CreateMutationRecipePreviewPermutation(
|
||||||
|
ItemCount,
|
||||||
|
Entry.ListNumber,
|
||||||
|
Frame
|
||||||
|
);
|
||||||
|
|
||||||
|
return Permutation[
|
||||||
|
Entry.Offset % ItemCount
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function CreateMutationRecipePreviewPermutation(
|
||||||
|
ItemCount,
|
||||||
|
ListNumber,
|
||||||
|
Frame
|
||||||
|
) {
|
||||||
|
const Permutation =
|
||||||
|
Array.from(
|
||||||
|
{ length: ItemCount },
|
||||||
|
(_, Index) => Index
|
||||||
|
);
|
||||||
|
|
||||||
|
if (ItemCount < 2 || Frame === 0) {
|
||||||
|
return Permutation;
|
||||||
|
}
|
||||||
|
|
||||||
|
let State =
|
||||||
|
(
|
||||||
|
Math.imul(
|
||||||
|
Frame + 1,
|
||||||
|
0x9e3779b1
|
||||||
|
) ^
|
||||||
|
Math.imul(
|
||||||
|
ListNumber + 1,
|
||||||
|
0x85ebca6b
|
||||||
|
) ^
|
||||||
|
Math.imul(
|
||||||
|
ItemCount,
|
||||||
|
0xc2b2ae35
|
||||||
|
)
|
||||||
|
) >>> 0;
|
||||||
|
|
||||||
|
if (State === 0) {
|
||||||
|
State = 0x6d2b79f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (
|
||||||
|
let Index = ItemCount - 1;
|
||||||
|
Index > 0;
|
||||||
|
Index--
|
||||||
|
) {
|
||||||
|
State ^= State << 13;
|
||||||
|
State ^= State >>> 17;
|
||||||
|
State ^= State << 5;
|
||||||
|
State >>>= 0;
|
||||||
|
|
||||||
|
const SwapIndex =
|
||||||
|
State % (Index + 1);
|
||||||
|
|
||||||
|
[
|
||||||
|
Permutation[Index],
|
||||||
|
Permutation[SwapIndex]
|
||||||
|
] = [
|
||||||
|
Permutation[SwapIndex],
|
||||||
|
Permutation[Index]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Permutation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function GetMutationRecipePreviewItemDisplay(
|
function GetMutationRecipePreviewItemDisplay(
|
||||||
Item,
|
Item,
|
||||||
PlantCatalogue
|
PlantCatalogue
|
||||||
|
|||||||
Reference in new issue
Block a user