Skip to content

Commit 65ee578

Browse files
committed
fix: 正确显示玩家周围的区块加载区域
1 parent 6e7f4ad commit 65ee578

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

Taskfile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ vars:
66

77
tasks:
88

9-
build-monkey-versioned:
9+
build:
1010
desc: Build tampermonkey script and output versioned userscript file
1111
cmds:
1212
- pnpm install

src/core/mapProjection.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,12 +731,14 @@ export function createMapProjection(deps: MapProjectionDeps) {
731731
function buildChunkCircleCellsLatLngs(map: any, centerX: number, centerZ: number, chunkRadius: number) {
732732
const cx = Math.floor(centerX / 16);
733733
const cz = Math.floor(centerZ / 16);
734-
const radiusSq = chunkRadius * chunkRadius;
734+
const radius = chunkRadius;
735735
const cells: any[] = [];
736736

737737
for (let dx = -chunkRadius; dx <= chunkRadius; dx += 1) {
738738
for (let dz = -chunkRadius; dz <= chunkRadius; dz += 1) {
739-
if ((dx * dx) + (dz * dz) > radiusSq) continue;
739+
// Use Chebyshev distance (max(|dx|, |dz|)) so the area is a square of chunks
740+
// around the center chunk, matching chunk-distance semantics.
741+
if (Math.max(Math.abs(dx), Math.abs(dz)) > radius) continue;
740742

741743
const chunkX = cx + dx;
742744
const chunkZ = cz + dz;

src/ui/components/OverlaySettingsPanel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ function closeHelp() {
382382
</div>
383383
<div class="n-row">
384384
<label>区块半径 l(按玩家所在区块向外)</label>
385-
<input v-model="state.form.REPORTER_CHUNK_RADIUS" @input="markDisplayInputsDirty" id="nodemc-overlay-reporter-chunk-radius" type="number" min="0" max="64" step="1" />
385+
<input v-model="state.form.REPORTER_CHUNK_RADIUS" @input="markDisplayInputsDirty" id="nodemc-overlay-reporter-chunk-radius" type="number" min="1" max="64" step="1" />
386386
</div>
387387
<div class="n-row">
388388
<label>区块范围颜色(#RRGGBB,留空跟随阵营色)</label>

0 commit comments

Comments
 (0)