用户:天天fUg-查看:1 回复:1 评论:1 创建时间:2024-05-18T15:12:25
var hc_console = world.querySelectorAll('.控制台').forEach((x) => {
x.enableInteract = true;
x.interactHint = '控制台'
x.interactRadius = 1;
if (x.id == "控制台") {
x.onInteract(async ({ entity }) => {
const g = await entity.player.dialog({
type: 'select',
options: ['反向牵引', '正向牵引', '制动','向右变道','向左变道','终止变道', '超级加速', '超级减速']
})
if (g) {
if (g.index == 0) {
world.querySelectorAll('.L19').forEach(async (x) => {
x.velocity.x += 0.1
})
await sleep(100)
} else if (g.index == 1) {
world.querySelectorAll('.L19').forEach(async (x) => {
x.velocity.x -= 0.1
})
await sleep(100)
} else if (g.index == 2) {
world.querySelectorAll('.L19').forEach(async (x) => {
x.velocity.x = 0
})
world.querySelectorAll('.L19').forEach(async (z) => {
z.velocity.z = 0
})
} else if (g.index == 4) {
world.querySelectorAll('.L19').forEach(async (z) => {
z.velocity.z -= 0.1
})
} else if (g.index == 3) {
world.querySelectorAll('.L19').forEach(async (z) => {
z.velocity.z += 0.1
})
await sleep(100)
} else if (g.index == 5) {
world.querySelectorAll('.L19').forEach(async (z) => {
z.velocity.z = 0
})
} else if (g.index == 6) {
world.querySelectorAll('.L19').forEach(async (x) => {
x.velocity.x += 10
})
await sleep(100)
} else {
world.querySelectorAll('.L19').forEach(async (x) => {
x.velocity.x -= 10
})
sleep(100)
}
}
})
}
if (x.id == "L19") {
x.onInteract(async ({ entity }) => {
const g = await entity.player.dialog({
type: 'select',
options: ['正向牵引', '反向牵引', '制动', '向左变轨','向右变轨','停止变轨','超级减速', '超级加速']
})
if (g) {
if (g.index == 0) {
world.querySelectorAll('.L19').forEach(async (x) => {
x.velocity.x -= 0.1
})
await sleep(100)
} else if (g.index == 1) {
world.querySelectorAll('.L19').forEach(async (x) => {
x.velocity.x += 0.1
})
await sleep(100)
} else if (g.index == 2) {
world.querySelectorAll('.L19').forEach(async (x) => {
x.velocity.x = 0
})
await sleep(100)
} else if (g.index == 4) {
world.querySelectorAll('.D01').forEach(async (z) => {
z.velocity.z -= 0.1
})
} else if (g.index == 3) {
world.querySelectorAll('.L19').forEach(async (z) => {
z.velocity.z += 0.1
})
await sleep(100)
} else if (g.index == 5) {
world.querySelectorAll('.L19').forEach(async (z) => {
z.velocity.z = 0
})
await sleep(100)
} else {
world.querySelectorAll('.L19').forEach(async (x) => {
x.velocity.x -= 10
})
await sleep(100)
}
}
})
}
})