state_enter.mcfunction 836 B

123456789101112131415161718192021
  1. # 要求系统进入状态 3(主要阶段结束,初始化小游戏)
  2. scoreboard players set $state mem 3
  3. execute as @a run function ltw:state/3/player_enter
  4. # HUD
  5. scoreboard objectives setdisplay belowName total_score
  6. scoreboard objectives setdisplay sidebar total_score
  7. scoreboard objectives setdisplay list total_score
  8. # 初始化倒计时
  9. scoreboard players set $countdown mem 10
  10. # 小游戏编号
  11. # 1 跑酷;2 TNT Run;3 热土豆;4 陷阱迷阵
  12. # 优化下一次游戏的选择:生成一个 1~[最大游戏编号] 的 randomarray,每次从其中取下一个数。
  13. execute unless data storage ltw:mini types[0] run function ltw:state/3/newarray
  14. execute store result score $mini_type mem run data get storage ltw:mini types[0]
  15. data remove storage ltw:mini types[0]
  16. # 初始化小游戏
  17. function mini:main/game_init