猫史档案馆


地铁代码(手动挡)

用户:天天fUg-天天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)
                }


            }
        })
     }
 })



回复

上一页1 页 / 共 1下一页
DRboxesDRboxes

可以说明一下L+序号是什么吗?

点赞0


评论