Przeglądaj źródła

Merge branch 'master' of github.com:LTCatt/LTW3

HerobrineXia 6 lat temu
rodzic
commit
f5c6f3400b

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

@@ -18,6 +18,9 @@ scoreboard objectives remove total_score
 scoreboard objectives add total_score dummy "得分"
 scoreboard objectives remove leave_game
 scoreboard objectives add leave_game minecraft.custom:leave_game "离开游戏"
+scoreboard objectives remove game_id
+scoreboard objectives add game_id dummy "游戏编号"
+scoreboard players set $ game_id 0
 
 # 队伍
 team remove ltw

+ 5 - 2
data/ltw/functions/main/player_enter.mcfunction

@@ -4,5 +4,8 @@
 execute if score $state mem matches 0 run function ltw:state/0/player_enter
 
 # 如果已开始游戏
-#   如果玩家是旁观者
-#     如果
+#   如果是旁观者或局号不对头:开始旁观
+execute if score $state mem matches 1.. if entity @s[tag=watcher] run function ltw:main/player_enter_watcher
+execute if score $state mem matches 1.. if entity @s[tag=!watcher] unless score @s game_id = $ game_id run function ltw:main/player_enter_watcher
+#   如果不是旁观且局号正确:游戏中掉线
+execute if score $state mem matches 1.. if entity @s[tag=!watcher] if score @s game_id = $ game_id run function ltw:main/player_enter_rejoin

+ 1 - 0
data/ltw/functions/main/player_enter_rejoin.mcfunction

@@ -0,0 +1 @@
+say 重新链接……

+ 1 - 0
data/ltw/functions/main/player_enter_watcher.mcfunction

@@ -0,0 +1 @@
+say 作为旁观者……

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

@@ -11,11 +11,13 @@ execute if score $count mem matches 9.. run tellraw @a [{"text": "小游戏模
 execute if score $count mem matches 3..8 run tag @a remove watcher
 execute if score $count mem matches 3..8 run tag @a[tag=!hub_gameparty] add watcher
 
-# 重置数据
+# 设置数据
 scoreboard players reset * total_score
 scoreboard players set @a[tag=!watcher] total_score 0
 scoreboard players set $round mem 1
 scoreboard players set $game_type mem 1
+scoreboard players add $ game_id 1
+scoreboard players operation @a game_id = $ game_id
 
 # 开始小游戏
 execute if score $count mem matches 3..8 run function ltw:state/3/state_enter

+ 1 - 1
data/test/functions/start_hotpm.mcfunction

@@ -1,7 +1,7 @@
 # 测试用:快速开始 Hot Potato
 
 tag @a remove watcher
-scoreboard players set $game_type mem 1
+function ltw:state/0/start_gameparty
 scoreboard players set $round mem 100
 scoreboard players set $mini_type mem 3
 function mini:main/game_init

+ 1 - 1
data/test/functions/start_parkour.mcfunction

@@ -1,7 +1,7 @@
 # 测试用:快速开始跑酷
 
 tag @a remove watcher
-scoreboard players set $game_type mem 1
+function ltw:state/0/start_gameparty
 scoreboard players set $round mem 100
 scoreboard players set $mini_type mem 1
 function mini:main/game_init

+ 1 - 1
data/test/functions/start_tntrun.mcfunction

@@ -1,7 +1,7 @@
 # 测试用:快速开始 TNT Run
 
 tag @a remove watcher
-scoreboard players set $game_type mem 1
+function ltw:state/0/start_gameparty
 scoreboard players set $round mem 100
 scoreboard players set $mini_type mem 2
 function mini:main/game_init