Ver Fonte

重写tempo_block轮子

HerobrineXia há 6 anos atrás
pai
commit
48be931dfb

+ 7 - 0
data/lib/functions/tempo_block/block_exchange.mcfunction

@@ -0,0 +1,7 @@
+# 切换节奏方块状态
+scoreboard players add $tempo_block mem 1
+execute if score $tempo_block mem matches 2.. run scoreboard players set $tempo_block mem 0
+
+# 调用对应颜色方块 0:blue 1:red
+execute if score $tempo_block mem matches 0 run function lib:tempo_block/tempo_blue
+execute if score $tempo_block mem matches 1 run function lib:tempo_block/tempo_red

+ 2 - 0
data/lib/functions/tempo_block/debug_sound.mcfunction

@@ -0,0 +1,2 @@
+# 跑酷Tempo音效
+function mini:parkour/game/tempo_sound

+ 5 - 0
data/lib/functions/tempo_block/tempo_blue.mcfunction

@@ -0,0 +1,5 @@
+# 调用其他模块
+execute if score $state mem matches 5 if score $mini_type mem matches 1 run function mini:parkour/game/tempo_blue
+
+# Debug调用
+execute if score $tempo_debug mem matches 1 run function lib:tempo_block/tempo_blue_debug

+ 1 - 0
data/lib/functions/tempo_block/tempo_blue_debug.mcfunction

@@ -0,0 +1 @@
+function mini:parkour/game/tempo_blue

+ 5 - 0
data/lib/functions/tempo_block/tempo_red.mcfunction

@@ -0,0 +1,5 @@
+# 调用其他模块
+execute if score $state mem matches 5 if score $mini_type mem matches 1 run function mini:parkour/game/tempo_red
+
+# Debug调用
+execute if score $tempo_debug mem matches 1 run function lib:tempo_block/tempo_red_debug

+ 1 - 0
data/lib/functions/tempo_block/tempo_red_debug.mcfunction

@@ -0,0 +1 @@
+function mini:parkour/game/tempo_red

+ 6 - 0
data/lib/functions/tempo_block/tempo_sound.mcfunction

@@ -0,0 +1,6 @@
+# 调用其他模块(播放声音)
+#execute if score $state mem matches 0
+execute if score $state mem matches 5 if score $mini_type mem matches 1 run function mini:parkour/game/tempo_sound
+
+# Debug调用
+execute if score $tempo_debug mem matches 1 run function lib:tempo_block/debug_sound

+ 7 - 0
data/lib/functions/tempo_block/tick2.mcfunction

@@ -0,0 +1,7 @@
+# 节奏方块触发
+execute if score $countdown_fast mem matches 0 run function lib:tempo_block/block_exchange
+execute unless score $countdown_fast mem matches 1.. run scoreboard players set $countdown_fast mem 15
+
+# 播放音效
+execute if score $countdown_fast mem matches 5 run function lib:tempo_block/tempo_sound
+execute if score $countdown_fast mem matches 10 run function lib:tempo_block/tempo_sound

+ 4 - 0
data/ltw/functions/clock/tick2.mcfunction

@@ -8,6 +8,10 @@ execute if score $state mem matches 5 run function ltw:state/5/tick2
 execute if score $state mem matches 6 run function ltw:state/6/tick2
 execute if score $state mem matches 7 run function ltw:state/7/tick2
 
+# 调用节奏方块模块
+execute if score $tempo_enable mem matches 1 run function lib:tempo_block/tick2
+
+
 # 调用物品模块(必须最后调用
 function item:tick2
 

+ 30 - 30
data/mini/functions/parkour/game/tempo_block.mcfunction

@@ -1,35 +1,35 @@
 # 切换节奏方块状态
-scoreboard players add $parkour_block mem 1
-execute if score $parkour_block mem matches 2.. run scoreboard players set $parkour_block mem 0
+# scoreboard players add $parkour_block mem 1
+# execute if score $parkour_block mem matches 2.. run scoreboard players set $parkour_block mem 0
 
-# 蓝色
-execute if score $parkour_block mem matches 0 run setblock 1012 8 1035 air
-execute if score $parkour_block mem matches 0 run setblock 1009 10 1036 air
-execute if score $parkour_block mem matches 0 run setblock 1010 10 1033 air
-execute if score $parkour_block mem matches 0 run setblock 1013 10 1032 air
-execute if score $parkour_block mem matches 0 run setblock 1010 12 1030 air
-execute if score $parkour_block mem matches 0 run setblock 1009 16 1051 air
-execute if score $parkour_block mem matches 0 run setblock 1004 17 1050 air
-execute if score $parkour_block mem matches 0 run setblock 1009 9 1036 minecraft:warped_hyphae
-execute if score $parkour_block mem matches 0 run setblock 1013 9 1032 minecraft:warped_hyphae
-execute if score $parkour_block mem matches 0 run setblock 1010 11 1033 minecraft:warped_hyphae
-execute if score $parkour_block mem matches 0 run setblock 1010 11 1030 minecraft:warped_hyphae
+# # 蓝色
+# execute if score $parkour_block mem matches 0 run setblock 1012 8 1035 air
+# execute if score $parkour_block mem matches 0 run setblock 1009 10 1036 air
+# execute if score $parkour_block mem matches 0 run setblock 1010 10 1033 air
+# execute if score $parkour_block mem matches 0 run setblock 1013 10 1032 air
+# execute if score $parkour_block mem matches 0 run setblock 1010 12 1030 air
+# execute if score $parkour_block mem matches 0 run setblock 1009 16 1051 air
+# execute if score $parkour_block mem matches 0 run setblock 1004 17 1050 air
+# execute if score $parkour_block mem matches 0 run setblock 1009 9 1036 minecraft:warped_hyphae
+# execute if score $parkour_block mem matches 0 run setblock 1013 9 1032 minecraft:warped_hyphae
+# execute if score $parkour_block mem matches 0 run setblock 1010 11 1033 minecraft:warped_hyphae
+# execute if score $parkour_block mem matches 0 run setblock 1010 11 1030 minecraft:warped_hyphae
 
-# 红色
-execute if score $parkour_block mem matches 1 run setblock 1009 9 1036 air
-execute if score $parkour_block mem matches 1 run setblock 1013 9 1032 air
-execute if score $parkour_block mem matches 1 run setblock 1010 11 1033 air
-execute if score $parkour_block mem matches 1 run setblock 1010 11 1030 air
-execute if score $parkour_block mem matches 1 run setblock 1013 10 1032 minecraft:crimson_hyphae
-execute if score $parkour_block mem matches 1 run setblock 1012 8 1035 minecraft:crimson_hyphae
-execute if score $parkour_block mem matches 1 run setblock 1009 10 1036 minecraft:crimson_hyphae
-execute if score $parkour_block mem matches 1 run setblock 1010 10 1033 minecraft:crimson_hyphae
-execute if score $parkour_block mem matches 1 run setblock 1010 12 1030 minecraft:crimson_hyphae
-execute if score $parkour_block mem matches 1 run setblock 1009 16 1051 minecraft:crimson_hyphae
-execute if score $parkour_block mem matches 1 run setblock 1004 17 1050 minecraft:crimson_hyphae
+# # 红色
+# execute if score $parkour_block mem matches 1 run setblock 1009 9 1036 air
+# execute if score $parkour_block mem matches 1 run setblock 1013 9 1032 air
+# execute if score $parkour_block mem matches 1 run setblock 1010 11 1033 air
+# execute if score $parkour_block mem matches 1 run setblock 1010 11 1030 air
+# execute if score $parkour_block mem matches 1 run setblock 1013 10 1032 minecraft:crimson_hyphae
+# execute if score $parkour_block mem matches 1 run setblock 1012 8 1035 minecraft:crimson_hyphae
+# execute if score $parkour_block mem matches 1 run setblock 1009 10 1036 minecraft:crimson_hyphae
+# execute if score $parkour_block mem matches 1 run setblock 1010 10 1033 minecraft:crimson_hyphae
+# execute if score $parkour_block mem matches 1 run setblock 1010 12 1030 minecraft:crimson_hyphae
+# execute if score $parkour_block mem matches 1 run setblock 1009 16 1051 minecraft:crimson_hyphae
+# execute if score $parkour_block mem matches 1 run setblock 1004 17 1050 minecraft:crimson_hyphae
 
 # 音效
-execute if score $parkour_block mem matches 0 run playsound block.note_block.pling block @a[tag=parkour_portal] 1007 15 1051 1 0.6
-execute if score $parkour_block mem matches 1 run playsound block.note_block.pling block @a[tag=parkour_portal] 1007 15 1051 1 1.1
-execute if score $parkour_block mem matches 0 run playsound block.note_block.pling block @a[tag=parkour_portal] 1010 10 1033 1 0.6
-execute if score $parkour_block mem matches 1 run playsound block.note_block.pling block @a[tag=parkour_portal] 1010 10 1033 1 1.1
+# execute if score $parkour_block mem matches 0 run playsound block.note_block.pling block @a[tag=parkour_portal] 1007 15 1051 1 0.6
+# execute if score $parkour_block mem matches 1 run playsound block.note_block.pling block @a[tag=parkour_portal] 1007 15 1051 1 1.1
+# execute if score $parkour_block mem matches 0 run playsound block.note_block.pling block @a[tag=parkour_portal] 1010 10 1033 1 0.6
+# execute if score $parkour_block mem matches 1 run playsound block.note_block.pling block @a[tag=parkour_portal] 1010 10 1033 1 1.1

+ 6 - 0
data/mini/functions/parkour/game/tempo_blue.mcfunction

@@ -0,0 +1,6 @@
+# 替换方块
+execute at @e[type=armor_stand,tag=parkour_tempo,tag=tempo_red] run setblock ~ ~ ~ air
+execute at @e[type=armor_stand,tag=parkour_tempo,tag=tempo_blue] run setblock ~ ~ ~ crimson_hyphae
+
+# 播放音效 (1007 15 1051)(1010 10 1033)
+execute at @e[type=armor_stand,tag=parkour_tempo] run playsound block.note_block.pling block @a[tag=parkour_portal] ~ ~ ~ 1 0.6

+ 5 - 0
data/mini/functions/parkour/game/tempo_red.mcfunction

@@ -0,0 +1,5 @@
+execute at @e[type=armor_stand,tag=parkour_tempo,tag=tempo_blue] run setblock ~ ~ ~ air
+execute at @e[type=armor_stand,tag=parkour_tempo,tag=tempo_red] run setblock ~ ~ ~ warped_hyphae
+
+# 播放音效 (1007 15 1051)(1010 10 1033)
+execute at @e[type=armor_stand,tag=parkour_tempo] run playsound block.note_block.pling block @a[tag=parkour_portal] ~ ~ ~ 1 1.1

+ 3 - 0
data/mini/functions/parkour/game/tempo_sound.mcfunction

@@ -0,0 +1,3 @@
+# 音效
+playsound block.note_block.snare block @a[tag=parkour_portal] 1007 15 1051 1 2
+playsound block.note_block.snare block @a[tag=parkour_portal] 1010 10 1033 1 2

+ 2 - 0
data/mini/functions/parkour/game_end.mcfunction

@@ -1,2 +1,4 @@
 # 结束跑酷
 forceload remove 1000 1000 1064 1064
+
+scoreboard players set $tempo_enable mem 0

+ 18 - 0
data/mini/functions/parkour/game_init.mcfunction

@@ -2,6 +2,8 @@
 forceload add 1000 1000 1064 1064
 
 scoreboard players set $finish_mode mem 1
+scoreboard players set $tempo_enable mem 1
+scoreboard players set $countdown_fast mem 0
 
 # 生成地图
 setblock 1000 4 1000 minecraft:structure_block[mode=load]{metadata:"",mirror:"NONE",ignoreEntities:1b,powered:0b,seed:0L,author:"00ll00",rotation:"NONE",posX:0,mode:"LOAD",posY:1,sizeX:32,posZ:0,integrity:1.0f,showair:0b,name:"mini:parkour0",sizeY:32,sizeZ:32,showboundingbox:0b}
@@ -16,6 +18,22 @@ kill @e[type=arrow]
 kill @e[type=item]
 kill @e[type=falling_block,tag=parkour_block]
 kill @e[type=trident]
+kill @e[type=armor_stand,tag=parkour_tempo]
+
+# 生成节奏方块实体
+summon armor_stand 1004 17 1050 {Marker:1b,Invisible:1b,Invulnerable:1b,Small:1b,NoGravity:1b,Tags:["parkour_tempo","tempo_red"]}
+summon armor_stand 1009 16 1051 {Marker:1b,Invisible:1b,Invulnerable:1b,Small:1b,NoGravity:1b,Tags:["parkour_tempo","tempo_red"]}
+summon armor_stand 1012 8 1036 {Marker:1b,Invisible:1b,Invulnerable:1b,Small:1b,NoGravity:1b,Tags:["parkour_tempo","tempo_red"]}
+summon armor_stand 1009 10 1036 {Marker:1b,Invisible:1b,Invulnerable:1b,Small:1b,NoGravity:1b,Tags:["parkour_tempo","tempo_red"]}
+summon armor_stand 1012 10 1034 {Marker:1b,Invisible:1b,Invulnerable:1b,Small:1b,NoGravity:1b,Tags:["parkour_tempo","tempo_red"]}
+summon armor_stand 1010 10 1033 {Marker:1b,Invisible:1b,Invulnerable:1b,Small:1b,NoGravity:1b,Tags:["parkour_tempo","tempo_red"]}
+summon armor_stand 1010 12 1030 {Marker:1b,Invisible:1b,Invulnerable:1b,Small:1b,NoGravity:1b,Tags:["parkour_tempo","tempo_red"]}
+
+summon armor_stand 1014 8 1035 {Marker:1b,Invisible:1b,Invulnerable:1b,Small:1b,NoGravity:1b,Tags:["parkour_tempo","tempo_blue"]}
+summon armor_stand 1014 9 1033 {Marker:1b,Invisible:1b,Invulnerable:1b,Small:1b,NoGravity:1b,Tags:["parkour_tempo","tempo_blue"]}
+summon armor_stand 1009 9 1036 {Marker:1b,Invisible:1b,Invulnerable:1b,Small:1b,NoGravity:1b,Tags:["parkour_tempo","tempo_blue"]}
+summon armor_stand 1010 11 1033 {Marker:1b,Invisible:1b,Invulnerable:1b,Small:1b,NoGravity:1b,Tags:["parkour_tempo","tempo_blue"]}
+summon armor_stand 1010 11 1030 {Marker:1b,Invisible:1b,Invulnerable:1b,Small:1b,NoGravity:1b,Tags:["parkour_tempo","tempo_blue"]}
 
 # 生成奖励物品
 execute positioned 1004.5 18.5 1043.5 run function item:bonus_item/gameparty/auto/white

+ 0 - 10
data/mini/functions/parkour/tick2.mcfunction

@@ -1,13 +1,3 @@
-# 节奏方块触发
-execute if score $countdown_fast mem matches 0 run function mini:parkour/game/tempo_block
-execute unless score $countdown_fast mem matches 1.. run scoreboard players set $countdown_fast mem 15
-
-# 音效
-execute if score $countdown_fast mem matches 5 run playsound block.note_block.snare block @a[tag=parkour_portal] 1007 15 1051 1 2
-execute if score $countdown_fast mem matches 5 run playsound block.note_block.snare block @a[tag=parkour_portal] 1010 10 1033 1 2
-execute if score $countdown_fast mem matches 10 run playsound block.note_block.snare block @a[tag=parkour_portal] 1007 15 1051 1 2
-execute if score $countdown_fast mem matches 10 run playsound block.note_block.snare block @a[tag=parkour_portal] 1010 10 1033 1 2
-
 # 传送门粒子
 execute if score $parkour_door mem matches 0 run particle reverse_portal 1009 28 1031 1 2 1 0.1 50
 execute if score $parkour_door mem matches 1 run particle portal 1014.5 21.5 1057.0 0 1.5 1 1 15