diff --git a/bun.lockb b/bun.lockb index 9aa0d04..8069714 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index ec66b90..70e190b 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "pixi.js": "^7.0.0", "pixi.js-legacy": "^7.4.2", "prom-client": "^15.1.3", + "random-seed": "^0.3.0", "react": "^18.3.1", "react-confetti-boom": "^1.0.0", "react-dom": "^18.3.1", @@ -49,11 +50,11 @@ "zod": "^3.23.8" }, "devDependencies": { - "vite-imagetools": "^7.0.4", - "tailwindcss": "^4.0.0-alpha.26", "@eslint/compat": "^1.2.0", "@eslint/js": "^9.12.0", + "@tailwindcss/vite": "next", "@types/bun": "latest", + "@types/random-seed": "^0.3.5", "@types/react": "^18.3.11", "@types/react-dom": "^18.3.1", "@vitejs/plugin-react-swc": "^3.7.1", @@ -62,9 +63,10 @@ "eslint-plugin-react": "^7.37.1", "eslint-plugin-react-hooks": "5.0.0", "globals": "^15.11.0", + "tailwindcss": "^4.0.0-alpha.26", "typescript": "^5.6.3", "typescript-eslint": "^8.8.1", "vite": "^5.4.8", - "@tailwindcss/vite": "next" + "vite-imagetools": "^7.0.4" } } diff --git a/src/components/Board.tsx b/src/components/Board.tsx index cb0137e..e60a2c9 100644 --- a/src/components/Board.tsx +++ b/src/components/Board.tsx @@ -42,7 +42,8 @@ import "@pixi/canvas-sprite-tiling"; import "@pixi/canvas-sprite"; import "@pixi/canvas-text"; import { themes } from "../themes"; -import { hashStr, weightedPickRandom } from "../../shared/utils"; +import { weightedPickRandom } from "../../shared/utils"; +import gen from "random-seed"; interface BoardProps { className?: string; @@ -280,10 +281,11 @@ const Tile = ({ const resolveSprite = useCallback( (lt: LoadedTexture) => { if (Array.isArray(lt)) { + const rng = gen.create(game.uuid + ";" + x + ";" + y); return weightedPickRandom( lt, (i) => i.weight, - (tw) => hashStr(game.uuid + ";" + x + ";" + y) * tw, + (tw) => rng.floatBetween(0, tw), ).sprite; } return lt;