LTCatt hace 6 años
padre
commit
12acafcd68

+ 1 - 0
data/ltw/functions/init.mcfunction

@@ -4,6 +4,7 @@
 forceload remove all
 time set noon
 weather clear
+difficulty normal
 gamerule doDaylightCycle false
 gamerule doFireTick false
 gamerule doMobSpawning false

+ 7 - 1
data/ltw/functions/main/player_leave.mcfunction

@@ -1 +1,7 @@
-say [test] 有玩家离开游戏!
+# 任意玩家下线时触发
+
+execute store result score $t_count mem if entity @a[tag=!watcher]
+execute if score $state mem matches 1.. if score $game_type mem matches 1 if score $t_count mem matches ..2 run function ltw:main/game_end
+execute if score $state mem matches 1.. if score $game_type mem matches 1 if score $t_count mem matches ..2 run tellraw @a {"text": "由于玩家人数不足, 游戏直接结束!","color":"red"}
+
+# TODO 小游戏结束逻辑可能导致卡住

+ 1 - 1
data/mini/functions/hotpm/player_enter.mcfunction

@@ -23,7 +23,7 @@ gamemode spectator @s
 gamemode adventure @s[tag=!watcher,tag=!rejoining]
 
 # 设置玩家生命数量
-scoreboard players set @s[tag=!watcher,tag=!rejoining] mini_heart 3
+scoreboard players set @s[tag=!watcher,tag=!rejoining] mini_heart 2
 function mini:main/player_max_health
 
 # 重新加入处理

+ 3 - 3
data/mini/functions/main/game_end.mcfunction

@@ -12,15 +12,15 @@ tag @a remove mini_rank4
 # 1
 scoreboard players set $t_score_max mini_score -2147483648
 execute as @a run function mini:main/get_max_score
-execute as @a unless entity @a[tag=mini_rank1] if score @s mini_score = $t_score_max mini_score run tag @s add mini_rank1
+execute as @a unless entity @a[tag=mini_rank1] if score @s mini_score = $t_score_max mini_score run tag @s[tag=!watcher] add mini_rank1
 # 2
 scoreboard players set $t_score_max mini_score -2147483648
 execute as @a[tag=!mini_rank1] run function mini:main/get_max_score
-execute as @a[tag=!mini_rank1] unless entity @a[tag=mini_rank2] if score @s mini_score = $t_score_max mini_score run tag @s add mini_rank2
+execute as @a[tag=!mini_rank1] unless entity @a[tag=mini_rank2] if score @s mini_score = $t_score_max mini_score run tag @s[tag=!watcher] add mini_rank2
 # 3
 scoreboard players set $t_score_max mini_score -2147483648
 execute as @a[tag=!mini_rank1,tag=!mini_rank2] run function mini:main/get_max_score
-execute as @a[tag=!mini_rank1,tag=!mini_rank2] unless entity @a[tag=mini_rank3] if score @s mini_score = $t_score_max mini_score run tag @s add mini_rank3
+execute as @a[tag=!mini_rank1,tag=!mini_rank2] unless entity @a[tag=mini_rank3] if score @s mini_score = $t_score_max mini_score run tag @s[tag=!watcher] add mini_rank3
 # 4
 tag @a[tag=!mini_rank1,tag=!mini_rank2,tag=!mini_rank3,tag=!watcher] add mini_rank4