用户:CHN_流星查看:5 回复:3 评论:5 创建时间:2021-08-10T08:39:17
const iron_door2 = world.querySelector('#铁门2');
iron_door2.enableInteract = false;
iron_door2.enableDamage = true;
iron_door2.interactHint = '铁门';
iron_door2.interactRadius = 10;
iron_door2.maxHp = 100;
iron_door2.hp = 100
world.onPlayerJoin(({ entity }) => {
iron_door2.enableDamage = true;
iron_door2.player.onPress(({ button, raycast:{ hitEntity, direction } }) => {
if (button !== 'action0' || !hitEntity) {
return;
}
hitEntity.hurt(0.5, {
attacker: iron_door2,
});
let iron_door2_hp = iron_door2.hp
if (!iron_door2_hp == 0){
iron_door2.destroyed = true
world.say(`逃生者摧毁了铁门!`);
}
});
});