bep40 commited on
Commit
cc6165a
·
verified ·
1 Parent(s): e562c02

v33: bỏ bảng đỏ chắn cửa hang, cờ MU vào khung gần cửa, bảng tỷ số gần lối vào, dàn bảng trong hang quanh tường không chồng

Browse files
Files changed (1) hide show
  1. patch_v33.mjs +252 -0
patch_v33.mjs ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* patch_v33.mjs — V33 (chạy TRONG Docker build, SAU patch_v32.mjs, trước esbuild):
2
+ 1) home3d.js: BỎ HOÀN TOÀN bảng đỏ chắn cửa hang (bia DI TÍCH + cột bảng đỏ);
3
+ cờ MU đưa VÀO KHUNG gần cửa hang; bảng tỷ số GẦN LỐI VÀO nhưng ngoài vùng cửa.
4
+ 2) cave3d.js: dàn các bảng QUANH TƯỜNG cách xa nhau — không chồng chéo:
5
+ EPL góc trái xa, OnThisDay góc phải xa, 2 bảng trận 2 bên giữa hang,
6
+ tường huyền thoại treo cao, 10 chân dung dàn 2 bên tường (xoay theo tường).
7
+ Áp lên source đã qua patch_v32. Exit 0 luôn, log v33_patch.log. */
8
+ import fs from 'node:fs'
9
+ import path from 'node:path'
10
+
11
+ const ROOT = process.argv[2] || '.'
12
+ const LOG = []
13
+ const warn = (m) => { LOG.push('⚠️ ' + m); console.error('[v33-patch] WARN: ' + m) }
14
+ const ok = (m) => { LOG.push('✅ ' + m); console.log('[v33-patch] OK: ' + m) }
15
+
16
+ function apply(fname, pairs) {
17
+ const fp = path.join(ROOT, fname)
18
+ if (!fs.existsSync(fp)) { warn('missing ' + fname + ' — skip'); return }
19
+ let src = fs.readFileSync(fp, 'utf8')
20
+ for (const [oldS, newS] of pairs) {
21
+ if (!src.includes(oldS)) { warn(fname + ': pattern NOT FOUND → ' + oldS.slice(0, 80).replace(/\s+/g, ' ')); continue }
22
+ src = src.split(oldS).join(newS)
23
+ }
24
+ fs.writeFileSync(fp, src)
25
+ ok(fname + ' patched (' + pairs.length + ' pairs)')
26
+ }
27
+
28
+ /* ============ 1) HOME (home3d.js) ============ */
29
+ apply('frontend/home3d.js', [
30
+ // 1a) BỎ hoàn toàn bia đá + cột bảng đỏ khỏi HomeScene — cửa hang trống 100%
31
+ [
32
+ ` <group position={layout.stele} rotation-y={layout.steleRotY}>
33
+ <StelePlate />
34
+ </group>
35
+ <group position={layout.post} rotation-y={layout.postRotY} scale={layout.postScale}>
36
+ <PostAndPlaque />
37
+ </group>`,
38
+ ` {/* V33: BỎ HOÀN TOÀN bia đá DI TÍCH + cột bảng đỏ — không còn vật nào
39
+ chắn trước cửa hang; cửa hang nhìn xuyên suốt từ bước 1. */}`,
40
+ ],
41
+ // 1b) Cờ MU: đưa VÀO KHUNG HÌNH, gần cửa hang (mobile 2 dãy khác)
42
+ [
43
+ `function HomeFlags() {
44
+ const texM = useMemo(() => drawPennantTex('MU'), [])
45
+ const texG = useMemo(() => drawPennantTex('GGMU'), [])
46
+ const flags = [
47
+ { x: -14.5, z: 7, tex: texM }, { x: 14.5, z: 7, tex: texG },
48
+ { x: -17, z: 11, tex: texG }, { x: 17, z: 11, tex: texM },
49
+ ]`,
50
+ `function HomeFlags({ mobile }) {
51
+ const texM = useMemo(() => drawPennantTex('MU'), [])
52
+ const texG = useMemo(() => drawPennantTex('GGMU'), [])
53
+ const flags = mobile ? [
54
+ { x: -4.1, z: 3.6, tex: texM }, { x: 4.1, z: 3.6, tex: texG },
55
+ { x: -5.3, z: 5.6, tex: texG }, { x: 5.3, z: 5.6, tex: texM },
56
+ ] : [
57
+ { x: -9.6, z: 5.5, tex: texM }, { x: 9.6, z: 5.5, tex: texG },
58
+ { x: -10.8, z: 8, tex: texG }, { x: 10.8, z: 8, tex: texM },
59
+ ]`,
60
+ ],
61
+ // 1c) Bảng tỷ số: prop small (mobile) + kích thước động
62
+ [
63
+ `function MuLastBoardHome({ pos = [5.4, 0, 2.2], rot = -0.55 }) {`,
64
+ `function MuLastBoardHome({ pos = [5.4, 0, 2.2], rot = -0.55, small = false }) {`,
65
+ ],
66
+ [
67
+ ` /* V32: bảng tỷ số TO HƠN (plane 6.5×4.15, khung 7×4.5) + đứng riêng trên giá —
68
+ đặt bên TRÁI sân trước (SCORE_POS) — không che lối vào cửa hang, không đè
69
+ bia đá, nhìn được toàn bộ nội dung. */
70
+ return (
71
+ <group position={pos} rotation={[0, rot, 0]}>
72
+ <mesh position={[0, 2.3, -0.14]} castShadow>
73
+ <boxGeometry args={[7.0, 4.5, 0.24]} />
74
+ <meshLambertMaterial color="#3d2a1a" flatShading />
75
+ </mesh>
76
+ <mesh position={[0, -0.3, -0.14]}>
77
+ <boxGeometry args={[0.22, 2.4, 0.22]} />
78
+ <meshLambertMaterial color="#4a3220" flatShading />
79
+ </mesh>
80
+ <mesh position={[0, 2.15, 0.05]}>
81
+ <planeGeometry args={[6.5, 4.15]} />
82
+ <meshBasicMaterial map={tex} transparent toneMapped={false} />
83
+ </mesh>
84
+ </group>
85
+ )
86
+ }`,
87
+ ` /* V33: bảng tỷ số GẦN LỐI VÀO nhưng KHÔNG chắn cửa — desktop 6.0×3.85 lề trái
88
+ (x=-8.0, ngoài vùng cửa x∈[-4.2,6.6]); mobile thu nhỏ 4.4×2.8 (small). */
89
+ const W = small ? 4.4 : 6.0, H = small ? 2.8 : 3.85
90
+ return (
91
+ <group position={pos} rotation={[0, rot, 0]}>
92
+ <mesh position={[0, H / 2 + 0.25, -0.14]} castShadow>
93
+ <boxGeometry args={[W + 0.5, H + 0.35, 0.24]} />
94
+ <meshLambertMaterial color="#3d2a1a" flatShading />
95
+ </mesh>
96
+ <mesh position={[0, -0.3, -0.14]}>
97
+ <boxGeometry args={[0.22, 2.4, 0.22]} />
98
+ <meshLambertMaterial color="#4a3220" flatShading />
99
+ </mesh>
100
+ <mesh position={[0, H / 2 + 0.25, 0.05]}>
101
+ <planeGeometry args={[W, H]} />
102
+ <meshBasicMaterial map={tex} transparent toneMapped={false} />
103
+ </mesh>
104
+ </group>
105
+ )
106
+ }`,
107
+ ],
108
+ // 1d) Vị trí bảng tỷ số: GẦN lối vào (z 2.2-2.6) nhưng ngoài vùng cửa
109
+ [
110
+ `const JERSEY_POS = {
111
+ mobile: [3.9, 0, 3.0],
112
+ desktop: [6.2, 0, 3.0],
113
+ }
114
+ const SCORE_POS = {
115
+ mobile: [-5.3, 0, 2.9],
116
+ desktop: [-7.6, 0, 2.8],
117
+ }`,
118
+ `const JERSEY_POS = {
119
+ mobile: [3.9, 0, 3.0],
120
+ desktop: [6.2, 0, 3.0],
121
+ }
122
+ const SCORE_POS = {
123
+ mobile: [-4.6, 0, 2.2],
124
+ desktop: [-8.0, 0, 2.6],
125
+ }`,
126
+ ],
127
+ // 1e) HomeForecourt: truyền mobile cho cờ + small cho bảng
128
+ [
129
+ ` <HomeFlags />
130
+ {/* V32: cột áo MU #7 (trong khung, bên phải lề) + bảng tỷ số TO hơn đặt bên
131
+ TRÁI sân trước (ngoài lối vào x∈[-5,5]) nhưng vẫn đối diện camera —
132
+ không che cửa hang, nhìn được toàn bộ nội dung bảng. */}
133
+ <JerseyStandHome pos={jp} rot={mobile ? -0.32 : -0.48} />
134
+ <MuLastBoardHome pos={sp} rot={mobile ? -0.42 : -0.6} />`,
135
+ ` <HomeFlags mobile={mobile} />
136
+ {/* V33: cờ MU gần cửa trong khung (2 bên lề) + áo #7 bên phải + bảng tỷ số
137
+ GẦN LỐI VÀO nhưng ngoài vùng cửa (lề trái) — cửa hang trống hoàn toàn. */}
138
+ <JerseyStandHome pos={jp} rot={mobile ? -0.32 : -0.48} />
139
+ <MuLastBoardHome pos={sp} rot={mobile ? -0.42 : -0.6} small={mobile} />`,
140
+ ],
141
+ ])
142
+
143
+ /* ============ 2) TRONG HANG (cave3d.js) — dàn quanh tường ============ */
144
+ apply('frontend/cave3d.js', [
145
+ // 2a) EPL: góc TRÁI xa (-38,-40), quay về tâm (0.76 rad)
146
+ [
147
+ ` return (
148
+ <group position={[-34, 7.0, -55.5]} rotation={[0, 0.42, 0]}>
149
+ <mesh position={[0, 0, -0.08]}>
150
+ <boxGeometry args={[10.6, 11.6, 0.3]} />
151
+ <meshLambertMaterial color="#3d2a1a" flatShading />
152
+ </mesh>
153
+ <mesh position={[0, 0, 0.1]}>
154
+ <planeGeometry args={[10.2, 11.2]} />
155
+ <meshBasicMaterial map={tex} transparent toneMapped={false} fog={false} />
156
+ </mesh>
157
+ </group>
158
+ )
159
+ }`,
160
+ ` return (
161
+ <group position={[-38, 7.5, -40]} rotation={[0, 0.76, 0]}>
162
+ <mesh position={[0, 0, -0.08]}>
163
+ <boxGeometry args={[10.6, 11.6, 0.3]} />
164
+ <meshLambertMaterial color="#3d2a1a" flatShading />
165
+ </mesh>
166
+ <mesh position={[0, 0, 0.1]}>
167
+ <planeGeometry args={[10.2, 11.2]} />
168
+ <meshBasicMaterial map={tex} transparent toneMapped={false} fog={false} />
169
+ </mesh>
170
+ </group>
171
+ )
172
+ }`,
173
+ ],
174
+ // 2b) 2 bảng trận: đối xứng 2 BÊN GIỮA HANG (±24, z=-22), quay vào tâm
175
+ [
176
+ ` {/* V32: 2 bảng TRẬN GẦN NHẤT / TRẬN SẮP TỚI dời XUỐNG CUỐI HANG gần lối vào,
177
+ xa cụm EPL (đã dời xuống -55.5); bảng TO hơn và tách xa nhau (~7 đơn vị)
178
+ để không che nhau, nhìn được toàn bộ nội dung từ giữa hang. */}
179
+ <MuMatchBoard pos={[-38, 6.4, -35.5]} rot={0.55} tex={lastTex} w={3.6} h={2.6} />
180
+ <MuMatchBoard pos={[-27.5, 6.4, -40.5]} rot={0.42} tex={nextTex} w={3.6} h={2.6} />`,
181
+ ` {/* V33: 2 bảng trận đối xứng 2 BÊN GIỮA HANG (±24, z=-22) — gần lối vào,
182
+ quay mặt vào giữa hang; cách xa EPL (góc trái) và OnThisDay (góc phải)
183
+ nên không bao giờ chồng chéo nhau. */}
184
+ <MuMatchBoard pos={[-24, 6.4, -22]} rot={0.83} tex={lastTex} w={3.8} h={2.8} />
185
+ <MuMatchBoard pos={[24, 6.4, -22]} rot={-0.83} tex={nextTex} w={3.8} h={2.8} />`,
186
+ ],
187
+ // 2c) OnThisDay: góc PHẢI xa (38,-40), quay về tâm
188
+ [
189
+ ` return (
190
+ <group position={[36, 7.0, -55]} rotation={[0, -0.42, 0]}>
191
+ <mesh position={[0, 0, -0.08]}>
192
+ <boxGeometry args={[8.2, 9.0, 0.3]} />
193
+ <meshLambertMaterial color="#3d2a1a" flatShading />
194
+ </mesh>
195
+ <mesh position={[0, 0, 0.1]}>
196
+ <planeGeometry args={[7.8, 8.6]} />
197
+ <meshBasicMaterial map={tex} transparent toneMapped={false} fog={false} />
198
+ </mesh>
199
+ </group>
200
+ )
201
+ }`,
202
+ ` return (
203
+ <group position={[38, 7.5, -40]} rotation={[0, -0.76, 0]}>
204
+ <mesh position={[0, 0, -0.08]}>
205
+ <boxGeometry args={[8.2, 9.0, 0.3]} />
206
+ <meshLambertMaterial color="#3d2a1a" flatShading />
207
+ </mesh>
208
+ <mesh position={[0, 0, 0.1]}>
209
+ <planeGeometry args={[7.8, 8.6]} />
210
+ <meshBasicMaterial map={tex} transparent toneMapped={false} fog={false} />
211
+ </mesh>
212
+ </group>
213
+ )
214
+ }`,
215
+ ],
216
+ // 2d) Tường huyền thoại: treo CAO 2 bên + trước lối vào (không chồng bảng thấp)
217
+ [
218
+ `const LEGEND_SLOTS = [
219
+ [-26, 11.4, -48, 0.42], [-36, 8.6, -46.5, 0.6], [24, 9.8, -50, -0.4],
220
+ ]`,
221
+ `const LEGEND_SLOTS = [
222
+ [-26, 13.2, -38, 0.76], [26, 13.2, -38, -0.76], [0, 13.8, -26, 0],
223
+ ]`,
224
+ ],
225
+ // 2e) 10 chân dung: dàn 2 BÊN TƯỜNG cách đều (không ảnh nào nấp sau màn hình lớn)
226
+ [
227
+ `const LEGENDS = [
228
+ ['rooney', 'Wayne Rooney', '2004–2017', 18, -40], ['ronaldo', 'Cristiano Ronaldo', '2003–2009, 2021–2022', 22, -37],
229
+ ['giggs', 'Ryan Giggs', '1991–2014', 20, -48], ['scholes', 'Paul Scholes', '1994–2013', 14, -50],
230
+ ['neville', 'Gary Neville', '1992–2011', -26, -44], ['ferdinand', 'Rio Ferdinand', '2002–2014', -20, -48],
231
+ ['vidic', 'Nemanja Vidić', '2006–2014', -14, -50], ['vandersar', 'Edwin van der Sar', '2005–2011', -28, -40],
232
+ ['carrick', 'Michael Carrick', '2006–2018', 8, -52], ['evra', 'Patrice Evra', '2006–2014', -8, -52],
233
+ ]`,
234
+ `const LEGENDS = [
235
+ ['rooney', 'Wayne Rooney', '2004–2017', 16, -30], ['ronaldo', 'Cristiano Ronaldo', '2003–2009, 2021–2022', 22, -23],
236
+ ['giggs', 'Ryan Giggs', '1991–2014', 28, -16], ['scholes', 'Paul Scholes', '1994–2013', 33, -8],
237
+ ['neville', 'Gary Neville', '1992–2011', -16, -30], ['ferdinand', 'Rio Ferdinand', '2002–2014', -22, -23],
238
+ ['vidic', 'Nemanja Vidić', '2006–2014', -28, -16], ['vandersar', 'Edwin van der Sar', '2005–2011', -33, -8],
239
+ ['carrick', 'Michael Carrick', '2006–2018', 20, -36], ['evra', 'Patrice Evra', '2006–2014', -20, -36],
240
+ ]`,
241
+ ],
242
+ // 2f) Chân dung treo cao hơn (y=4.0) + XOAY THEO TƯỜNG (quay mặt vào tâm hang)
243
+ [
244
+ ` {LEGENDS.map(([key, name, years, x, z]) => (
245
+ <group key={key} position={[x, 3.6, z]} rotation={[0, 0.9, 0]}>`,
246
+ ` {LEGENDS.map(([key, name, years, x, z]) => (
247
+ <group key={key} position={[x, 4.0, z]} rotation={[0, Math.atan2(-x, -z), 0]}>`,
248
+ ],
249
+ ])
250
+
251
+ fs.writeFileSync(path.join(ROOT, 'v33_patch.log'), LOG.join('\n'))
252
+ console.log('[v33-patch] done, ' + LOG.filter((l) => l.startsWith('✅')).length + ' ok / ' + LOG.filter((l) => l.startsWith('⚠️')).length + ' warn')