LTCatt 6 лет назад
Родитель
Сommit
19dcb1a0fa

+ 7 - 0
data/ltw/functions/state/3/state_enter.mcfunction

@@ -1,3 +1,10 @@
 # 要求系统进入状态 3(主要阶段结束,初始化小游戏)
 scoreboard players set $state mem 3
 
+# 决定进行哪个小游戏
+# 1 跑酷;2 TNT Run;3 热土豆
+# 之后在这里加上随机……
+scoreboard players set $mini_type mem 2
+
+# 初始化小游戏
+function mini:main/game_init

+ 6 - 0
data/mini/functions/main/game_init.mcfunction

@@ -0,0 +1,6 @@
+# 初始化 TNT Run
+forceload add 1000 2000 1050 2050
+
+setblock 1000 1 2000 minecraft:structure_block{mode:"LOAD",name:"mini:tntrun"}
+
+forceload remove 1000 2000 1050 2050

+ 2 - 0
data/mini/functions/tntrun/game_init.mcfunction

@@ -0,0 +1,2 @@
+# 初始化单个小游戏
+execute if score $mini_type mem matches 2 run function mini:tntrun/game_init

+ 1 - 1
data/mini/functions/tntrun/tick1.mcfunction

@@ -9,10 +9,10 @@ execute as @a[tag=tntrun_pc,nbt={OnGround:1b}] at @s positioned ~-0.31 ~-1 ~-0.3
 execute as @a[tag=tntrun_pc,nbt={OnGround:1b}] at @s positioned ~0.31 ~-1 ~-0.31 align xyz if block ~ ~ ~ #mini:tntrun_floor positioned ~0.5 ~ ~0.5 unless entity @e[tag=tntrun_as,distance=..0.1] run summon minecraft:area_effect_cloud ~ ~ ~ {Tags:["tntrun_as","tntrun_edge"],Age: -2147483648, Duration: -1, WaitTime: -2147483648,}
 execute as @a[tag=tntrun_pc,nbt={OnGround:1b}] at @s positioned ~-0.31 ~-1 ~0.31 align xyz if block ~ ~ ~ #mini:tntrun_floor positioned ~0.5 ~ ~0.5 unless entity @e[tag=tntrun_as,distance=..0.1] run summon minecraft:area_effect_cloud ~ ~ ~ {Tags:["tntrun_as","tntrun_edge"],Age: -2147483648, Duration: -1, WaitTime: -2147483648,}
 execute as @a[tag=tntrun_pc,nbt={OnGround:1b}] at @s positioned ~ ~-1 ~ align xyz if block ~ ~ ~ minecraft:air positioned ~0.5 ~ ~0.5 run tag @e[tag=tntrun_edge,distance=..1.51] remove tntrun_edge
-scoreboard players add @e[tag=tntrun_as] tntrun_timer 1
 
 # 修改下面这一行的数字以调整方块消失的延迟(刻)
 # tntrun_timer=12
 execute as @e[tag=tntrun_as,scores={tntrun_timer=12}] at @s run setblock ~ ~ ~ air
+scoreboard players add @e[tag=tntrun_as] tntrun_timer 1
 execute as @e[tag=tntrun_as] at @s unless block ~ ~ ~ #mini:tntrun_floor run kill @s
 execute as @e[tag=tntrun_edge] at @s unless entity @a[tag=tntrun_pc,distance=..1.51] run kill @s