修复第一个点不是传送点的pathing文件

This commit is contained in:
辉鸭蛋
2024-10-26 12:30:45 +08:00
parent 11a1ce95aa
commit aa9772ffd9
26 changed files with 1481 additions and 1429 deletions

52
build/other/firstPosTp.js Normal file
View File

@@ -0,0 +1,52 @@
const fs = require('fs');
const path = require('path');
// 定义pathing目录的路径
const pathingDir = path.resolve(__dirname, '..', '..', 'repo', 'pathing');
// 递归读取目录下的所有JSON文件
function readJsonFilesRecursively(dir) {
const files = fs.readdirSync(dir, { withFileTypes: true });
files.forEach(file => {
const filePath = path.join(dir, file.name);
if (file.isDirectory()) {
readJsonFilesRecursively(filePath);
} else if (path.extname(file.name).toLowerCase() === '.json') {
processJsonFile(filePath);
}
});
}
// 处理单个JSON文件
function processJsonFile(filePath) {
try {
const data = fs.readFileSync(filePath, 'utf8');
const jsonData = JSON.parse(data);
// 检查并修改第一个position的type
if (jsonData.positions && jsonData.positions.length > 0) {
const firstPosition = jsonData.positions[0];
if (firstPosition.type !== 'teleport') {
firstPosition.type = 'teleport';
console.log(`文件 ${filePath} 中的第一个position的type已更改为teleport`);
// 将修改后的数据写回文件
fs.writeFileSync(filePath, JSON.stringify(jsonData, null, 2), 'utf8');
console.log(`文件 ${filePath} 已成功更新`);
} else {
console.log(`文件 ${filePath} 中的第一个position的type已经是teleport`);
}
} else {
console.log(`文件 ${filePath} 中没有positions数组或数组为空`);
}
} catch (err) {
console.error(`处理文件 ${filePath} 时出错:`, err);
}
}
// 开始递归读取文件
console.log(`开始处理 ${pathingDir} 目录下的所有JSON文件`);
readJsonFilesRecursively(pathingDir);
console.log('处理完成');

View File

@@ -12,7 +12,7 @@
"id": 1, "id": 1,
"x": 3595.5517578125, "x": 3595.5517578125,
"y": 3254.333251953125, "y": 3254.333251953125,
"type": "path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -11,7 +11,7 @@
{ {
"x": -201.20703125, "x": -201.20703125,
"y": 1861.82958984375, "y": 1861.82958984375,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -12,7 +12,7 @@
"id": 1, "id": 1,
"x": 4984.80078125, "x": 4984.80078125,
"y": 4463.00048828125, "y": 4463.00048828125,
"type": "path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -12,7 +12,7 @@
"id": 1, "id": 1,
"x": 1043.1806640625, "x": 1043.1806640625,
"y": -558.06298828125, "y": -558.06298828125,
"type": "path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -12,7 +12,7 @@
"id": 1, "id": 1,
"x": 2703.53955078125, "x": 2703.53955078125,
"y": -761.19091796875, "y": -761.19091796875,
"type": "path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -8,7 +8,7 @@
{ {
"x": 8918.9560546875, "x": 8918.9560546875,
"y": -2679.0810546875, "y": -2679.0810546875,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -12,7 +12,7 @@
"id": 1, "id": 1,
"action": "", "action": "",
"move_mode": "walk", "move_mode": "walk",
"type": "path", "type": "teleport",
"x": 489.7939453125, "x": 489.7939453125,
"y": 1435.13525390625 "y": 1435.13525390625
}, },

View File

@@ -14,7 +14,7 @@
"y": 1435.14208984375, "y": 1435.14208984375,
"action": "", "action": "",
"move_mode": "walk", "move_mode": "walk",
"type": "path" "type": "teleport"
}, },
{ {
"id": 2, "id": 2,

View File

@@ -12,7 +12,7 @@
"id": 1, "id": 1,
"action": "", "action": "",
"move_mode": "walk", "move_mode": "walk",
"type": "path", "type": "teleport",
"x": -416.15234375, "x": -416.15234375,
"y": 729.060546875 "y": 729.060546875
}, },

View File

@@ -12,7 +12,7 @@
"id": 1, "id": 1,
"x": -188.5517578125, "x": -188.5517578125,
"y": 972.47998046875, "y": 972.47998046875,
"type": "path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -11,7 +11,7 @@
{ {
"x": 1806.029296875, "x": 1806.029296875,
"y": 699.9052734375, "y": 699.9052734375,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -11,7 +11,7 @@
{ {
"x": 289.466796875, "x": 289.466796875,
"y": 1667.30517578125, "y": 1667.30517578125,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -11,7 +11,7 @@
{ {
"x": 1794.19140625, "x": 1794.19140625,
"y": 717.47314453125, "y": 717.47314453125,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -11,7 +11,7 @@
{ {
"x": 1813.3720703125, "x": 1813.3720703125,
"y": 712.63818359375, "y": 712.63818359375,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -11,7 +11,7 @@
{ {
"x": 1998.1064453125, "x": 1998.1064453125,
"y": -678.54541015625, "y": -678.54541015625,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -11,7 +11,7 @@
{ {
"x": 839.8701171875, "x": 839.8701171875,
"y": 1532.546875, "y": 1532.546875,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -11,7 +11,7 @@
{ {
"x": 547.7353515625, "x": 547.7353515625,
"y": 1766.80908203125, "y": 1766.80908203125,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -11,7 +11,7 @@
{ {
"x": 547.689453125, "x": 547.689453125,
"y": 1766.78662109375, "y": 1766.78662109375,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -8,7 +8,7 @@
{ {
"x": 8400.6953125, "x": 8400.6953125,
"y": -1221.4111328125, "y": -1221.4111328125,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },
@@ -56,7 +56,7 @@
}, },
{ {
"x": 8263.49759150458, "x": 8263.49759150458,
"y":-1314.0, "y": -1314,
"type": "target", "type": "target",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
@@ -98,7 +98,7 @@
}, },
{ {
"x": 8026.0003010619275, "x": 8026.0003010619275,
"y":-1274.0, "y": -1274,
"type": "path", "type": "path",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""

View File

@@ -8,7 +8,7 @@
{ {
"x": 7973.6591796875, "x": 7973.6591796875,
"y": -1557.6474609375, "y": -1557.6474609375,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -8,7 +8,7 @@
{ {
"x": 8452.509765625, "x": 8452.509765625,
"y": -1477.23046875, "y": -1477.23046875,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },
@@ -49,7 +49,7 @@
}, },
{ {
"x": 8481.252007079516, "x": 8481.252007079516,
"y":-1515.0, "y": -1515,
"type": "path", "type": "path",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""

View File

@@ -8,13 +8,13 @@
{ {
"x": 7857.5, "x": 7857.5,
"y": -1751.31982421875, "y": -1751.31982421875,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },
{ {
"x": 7808.752910265299, "x": 7808.752910265299,
"y":-1724.0, "y": -1724,
"type": "path", "type": "path",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
@@ -91,7 +91,7 @@
}, },
{ {
"x": 7736.500200707951, "x": 7736.500200707951,
"y":-1567.0, "y": -1567,
"type": "path", "type": "path",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""

View File

@@ -12,7 +12,7 @@
"id": 1, "id": 1,
"x": 4749.6357421875, "x": 4749.6357421875,
"y": 2636.186767578125, "y": 2636.186767578125,
"type": "path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -11,7 +11,7 @@
{ {
"x": -1272.5078125, "x": -1272.5078125,
"y": 2722.89111328125, "y": 2722.89111328125,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },

View File

@@ -11,7 +11,7 @@
{ {
"x": -1629.3642578125, "x": -1629.3642578125,
"y": 2834.408203125, "y": 2834.408203125,
"type":"path", "type": "teleport",
"move_mode": "walk", "move_mode": "walk",
"action": "" "action": ""
}, },
@@ -59,7 +59,7 @@
}, },
{ {
"x": -1707.9934168709715, "x": -1707.9934168709715,
"y":2934.0, "y": 2934,
"type": "path", "type": "path",
"move_mode": "fly", "move_mode": "fly",
"action": "stop_flying" "action": "stop_flying"