猫史档案馆


招代码师(https://box3.codemao.cn/e/3d喵ee71fb22f3eae8)

用户:慎重的金冠泥y5Rj慎重的金冠泥y5Rj查看:0 回复:0 评论:0 创建时间:2022-11-11T14:31:39


world.onPlayerJoin(({ entity }) => {
    entity.player.directMessage(`你好,${entity.player.name},谢谢游玩!`);
});
//场地

for(var y=1;y<9;y++){

    for(var x=0;x<256;x++){

      for(var z=0;z<256;z++){

        voxels.setVoxel(x,y,z,'water')

    }

  }

}


world.onPlayerJoin(({ entity }) => {
    entity.chixi = 0
    entity.onFluidEnter(() => {//当玩家掉到液体里
    world.say(`${entity.player.name}趋势了!`);
        entity.position.copy(entity.player.spawnPoint)
        entity.position.y += 2
        entity.chixi += 1
    })
})

var admin = [ '高冷的小林bn','Logic_','Microsoft|微软','AIO宣传部.软糖祺祺']
world.onChat(({ entity, message }) => {
    if (entity.isPlayer) {
       
        if (admin.includes(entity.player.name)) {
            if (message == '幽灵') { entity.player.spectator = true; world.say(entity.player.name + '开启了幽灵模式') }
            if (message == '解除幽灵') { entity.player.spectator = false; world.say(entity.player.name + '关闭了幽灵模式') }

        }
    }

        if (admin.includes(entity.player.name)) {
            if (message == '飞行') { entity.player.canFly= true; world.say(entity.player.name + '开启了飞行模式') }
            if (message == '解除飞行') { entity.player.canFly = false; world.say(entity.player.name + '关闭了飞行模式') }
        }
    }
);
for (const e of world.querySelectorAll('*')) {//遍历所有实体
    if (e.id.startsWith('存档点')) {//如果当前实体名左边部分刚好是"存档点", 比如 存档点-1 存档点-2...
        e.collides = true //开启碰撞
        e.fixed = true //固定实体不被推移
        e.meshScale = e.meshScale.scale(2) //放大2倍
        e.onEntityContact(({ other }) => { //每当存档点碰到另一个实体
            if (other.isPlayer) { //另一个实体是玩家
                if (e.position !== other.player.spawnPoint) { // 检测当前存档点是否玩家重生点, 避免反复在同一个存档点做多余的保存
                    other.player.directMessage('到达新的重生点') // 给玩家发消息
                    other.player.spawnPoint = e.position // 玩家重生点坐标设置成存档点的坐标
                }
            }
        })
    }
}
function textDialog(entity, content, title) {
    return entity.player.dialog({ //弹出对话框
        type: Box3DialogType.TEXT, //对话框类型为纯文本
        content, //文本内容
        title, //对话框左上角标题内容
    })
}

world.onPlayerJoin(({ entity }) => { 
    

    entity.player.onPress(({ button }) => { //每当有按钮被按下
        if (button == Box3ButtonType.ACTION1) { //如果按钮是右键
            textDialog(entity, `你趋势了${entity.chixi}次`)
        }
    })
})
// 使用第一人称视角
world.onPlayerJoin(({ entity }) => {
    entity.player.cameraMode = Box3CameraMode.FPS;
    console.log('setting camera mode:', entity.player.cameraMode);
});

console.log('fps mode enabled');


回复

上一页1 页 / 共 0下一页