Kaynağa Gözat

玩家离开判定

HerobrineXia 6 yıl önce
ebeveyn
işleme
2e3e436dc6

+ 8 - 0
data/mini/functions/main/player_changed.mcfunction

@@ -0,0 +1,8 @@
+# 计算玩家数量
+execute store result score $alive_now mem if entity @a[tag=mini_running,tag=!watcher]
+
+# 比较玩家数量
+execute unless score $alive_now mem = $alive mem run function mini:main/player_leave
+
+# 重置玩家数量
+execute unless score $alive_now mem = $alive mem run scoreboard players operation $alive mem = $alive_now mem

+ 0 - 0
data/mini/functions/main/player_leave.mcfunction


+ 2 - 0
data/mini/functions/main/player_lose_heart.mcfunction

@@ -3,5 +3,7 @@
 execute if score @s mini_heart matches 1.. run scoreboard players remove @s mini_heart 1
 # 计算血量
 function mini:main/player_max_health
+# 修改血量
+effect give @s minecraft:instant_health 1 0
 # 生命值归0判定失败
 execute if score @s mini_heart matches 0 run function mini:main/player_failed

+ 1 - 0
data/mini/functions/main/tick4.mcfunction

@@ -1,3 +1,4 @@
+function mini:main/player_changed
 execute if score $mini_type mem matches 1 run function mini:parkour/tick4
 execute if score $mini_type mem matches 2 run function mini:tntrun/tick4
 execute if score $mini_type mem matches 3 run function mini:hotpm/tick4