Spaces:
Running
Running
Download patch_store.mjs from bep40/hangmu-docker: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/spaces/bep40/hangmu-docker/resolve/main/patch_store.mjs
- Command line
-
hf download hf://spaces/bep40/hangmu-docker/patch_store.mjs
-
curl -L -o patch_store.mjs https://huggingface.co/spaces/bep40/hangmu-docker/resolve/main/patch_store.mjs
1.22 kB
| /* patch_store.mjs — ROOT CAUSE FIX: "không có nhân vật 3D". */ | |
| import fs from 'node:fs' | |
| const path = 'frontend/store.js' | |
| let s = fs.readFileSync(path, 'utf8') | |
| const marker = | |
| ` if (typeof data.inRoom === 'number') g.set({ inRoom: data.inRoom }) | |
| break | |
| }` | |
| const count = s.split(marker).length - 1 | |
| if (count !== 1) { | |
| console.error(`PATCH STORE FAILED: 'connected' marker not unique/found (count=${count})`) | |
| process.exit(1) | |
| } | |
| const inject = | |
| ` if (typeof data.inRoom === 'number') g.set({ inRoom: data.inRoom }) | |
| // ===== SELF-AVATAR (fix "không có nhân vật 3D") ===== | |
| const selfId = data.player_id || g.playerId | |
| if (selfId && !g.players.has(selfId)) { | |
| const sp = data.position || { x: 0, y: 0, z: 36 } | |
| g.players.set(selfId, { | |
| id: selfId, | |
| name: g.me?.name || 'Bạn', | |
| number: g.me?.number ?? null, | |
| pos: new THREE.Vector3(sp.x, sp.y, sp.z), | |
| rot: 0, | |
| anim: 'idle', | |
| lastSeen: Date.now(), | |
| }) | |
| g.set({ players: new Map(g.players) }) | |
| } | |
| break | |
| }` | |
| s = s.replace(marker, inject) | |
| fs.writeFileSync(path, s) | |
| console.log('patched store.js ok (SELF-AVATAR fix)') |