Procházet zdrojové kódy

选择奖励基础

LTCatt před 6 roky
rodič
revize
4aab7ee983

+ 2 - 1
data/ltw/functions/clock/tick1.mcfunction

@@ -2,4 +2,5 @@
 
 
 # 调用其他模块
 # 调用其他模块
 execute if score $state mem matches 3 run function ltw:state/3/tick1
 execute if score $state mem matches 3 run function ltw:state/3/tick1
-execute if score $state mem matches 5 run function ltw:state/5/tick1
+execute if score $state mem matches 5 run function ltw:state/5/tick1
+execute if score $state mem matches 7 run function ltw:state/7/tick1

+ 4 - 1
data/ltw/functions/state/0/state_enter.mcfunction

@@ -6,4 +6,7 @@ execute as @a run function ltw:state/0/player_enter
 scoreboard objectives setdisplay sidebar
 scoreboard objectives setdisplay sidebar
 
 
 # 关闭伤害
 # 关闭伤害
-gamerule fallDamage false
+gamerule fallDamage false
+
+# 清理加载区域
+forceload remove all

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

@@ -14,6 +14,7 @@ scoreboard players set $random_min mem 1
 scoreboard players set $random_max mem 3
 scoreboard players set $random_max mem 3
 function lib:random
 function lib:random
 scoreboard players operation $mini_type mem = $random mem
 scoreboard players operation $mini_type mem = $random mem
+# TODO 优化下一次游戏的选择:生成一个 1~[最大游戏编号] 的 randomarray,每次从其中取下一个数。如果数组取完了,就生成一个新数组,但是要保证新数组的开头和老数组的结尾不一样,这样就不会连续玩两次相同的游戏了
 
 
 # 初始化小游戏
 # 初始化小游戏
 function mini:main/game_init
 function mini:main/game_init

+ 8 - 1
data/ltw/functions/state/7/player_enter.mcfunction

@@ -1,9 +1,16 @@
 # 对单个玩家的处理(如果玩家中途加入就会执行此函数)
 # 对单个玩家的处理(如果玩家中途加入就会执行此函数)
-gamemode creative
 title @s clear
 title @s clear
+gamemode creative
 
 
 # 状态效果
 # 状态效果
 effect clear @s
 effect clear @s
 effect give @s saturation 1000000 0 true
 effect give @s saturation 1000000 0 true
 effect give @s instant_health 10 0 true
 effect give @s instant_health 10 0 true
 effect give @s night_vision 1000000 0 true
 effect give @s night_vision 1000000 0 true
+effect give @s resistance 1000000 4 true
+
+# 传送玩家
+tp @s[tag=!watcher] 7.0 11.4 2007.0 0 0
+
+# 调整模式
+gamemode spectator @s

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

@@ -5,6 +5,13 @@ execute as @a run function ltw:state/7/player_enter
 # HUD
 # HUD
 scoreboard objectives setdisplay sidebar total_score
 scoreboard objectives setdisplay sidebar total_score
 
 
+# 初始化跑酷地图
+forceload add 0 2000 50 2050
+
+# 生成地图
+setblock 0 10 2000 minecraft:structure_block{mode:"LOAD",name:"ltw:select"}
+setblock 0 11 2000 minecraft:redstone_block
+
 # 判断进入下一轮小游戏或结束
 # 判断进入下一轮小游戏或结束
 execute if score $game_type mem matches 1 if score $round mem matches ..3 run function ltw:state/7/continue_gameparty
 execute if score $game_type mem matches 1 if score $round mem matches ..3 run function ltw:state/7/continue_gameparty
 execute if score $game_type mem matches 1 if score $round mem matches 4.. run function ltw:main/game_end
 execute if score $game_type mem matches 1 if score $round mem matches 4.. run function ltw:main/game_end

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

@@ -0,0 +1,3 @@
+# 观察者限制
+execute as @a[gamemode=spectator] run spectate
+execute as @a[gamemode=spectator] run tp @s 7.0 11.4 2007.0