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

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

@@ -1,11 +1,7 @@
 # 当玩家加入游戏时触发
 
-# 如果未开始游戏,拖回等待大厅
-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
+# 如果是旁观者或局号不对头:开始旁观
+execute if entity @s[tag=watcher] run function ltw:main/player_enter_watcher
+execute if entity @s[tag=!watcher] unless score @s game_id = $ game_id run function ltw:main/player_enter_watcher
+# 如果不是旁观且局号正确:游戏中掉线
+execute if entity @s[tag=!watcher] if score @s game_id = $ game_id run function ltw:main/player_enter_rejoin

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

@@ -1 +1,20 @@
-say 重新链接……
+# 作为玩家加入服务器
+tag @s remove watcher
+
+# 清除名次
+tag @s remove mini_rank1
+tag @s remove mini_rank2
+tag @s remove mini_rank3
+tag @s add mini_rank4
+
+# 重新加入阶段
+tag @s add rejoining
+execute if score $state mem matches 0 run function ltw:state/0/player_enter
+execute if score $state mem matches 3 run function ltw:state/3/player_enter
+execute if score $state mem matches 4 run function ltw:state/4/player_enter
+execute if score $state mem matches 5 run function ltw:state/5/player_enter
+execute if score $state mem matches 6 run function ltw:state/6/player_enter
+execute if score $state mem matches 7 run function ltw:state/7/player_enter
+tag @s remove rejoining
+
+# TODO : 如果玩家在奖励选择阶段重连,玩家应该跳过此次奖励选择

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

@@ -1 +1,18 @@
-say 作为旁观者……
+# 作为旁观者加入服务器
+tag @s add watcher
+
+# 清除名次
+tag @s remove mini_rank1
+tag @s remove mini_rank2
+tag @s remove mini_rank3
+tag @s remove mini_rank4
+
+# 重新加入阶段
+tag @s add rejoining
+execute if score $state mem matches 0 run function ltw:state/0/player_enter
+execute if score $state mem matches 3 run function ltw:state/3/player_enter
+execute if score $state mem matches 4 run function ltw:state/4/player_enter
+execute if score $state mem matches 5 run function ltw:state/5/player_enter
+execute if score $state mem matches 6 run function ltw:state/6/player_enter
+execute if score $state mem matches 7 run function ltw:state/7/player_enter
+tag @s remove rejoining

+ 2 - 2
data/ltw/functions/state/7/player_enter.mcfunction

@@ -10,7 +10,7 @@ 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
+tp @s 7.0 11.4 2007.0 0 0
 
 # 调整模式
-gamemode spectator @s
+gamemode spectator

+ 11 - 9
data/mini/functions/hotpm/player_enter.mcfunction

@@ -14,15 +14,17 @@ tag @s remove pm_hoding
 tag @s remove pm_damage_dealt
 tag @s remove pm_damage_taken
 
-# 调整模式
-gamemode adventure @s[tag=!watcher]
-gamemode spectator @s[tag=watcher]
-
 # 传送玩家
-spreadplayers 1023 3021 5 5 false @s[tag=!watcher]
-schedule function mini:hotpm/player_enter2 1t replace
-# schedule: tp @a ~ 25 ~
+spreadplayers 1023 3021 5 5 false @s[tag=!watcher,tag=!rejoining]
+execute if entity @s[tag=!watcher,tag=!rejoining] run schedule function mini:hotpm/player_enter2 1t replace
+
+# 调整模式
+gamemode spectator @s
+gamemode adventure @s[tag=!watcher,tag=!rejoining]
 
 # 3秒后给予土豆
-schedule function mini:hotpm/pm_init_first 3s replace
-# TODO 灭火无效
+execute if entity @s[tag=!watcher,tag=!rejoining] run schedule function mini:hotpm/pm_init_first 3s replace
+# TODO 灭火无效
+
+# 重新加入处理
+execute if entity @s[tag=rejoining] run function mini:hotpm/player_failed

+ 1 - 1
data/mini/functions/hotpm/player_enter2.mcfunction

@@ -1,2 +1,2 @@
 # spreadplayer 后不能立即传送,所以延迟 1tick
-execute as @a[tag=!watcher] at @s run tp @s ~ 25 ~
+execute as @a at @s run tp @s ~ 25 ~

+ 5 - 3
data/mini/functions/main/player_enter.mcfunction

@@ -1,7 +1,9 @@
 # 单个玩家开始小游戏时执行
-tag @s[tag=!watcher] add mini_running
-scoreboard players set @s[tag=!watcher] mini_score 0
-scoreboard players set @s[tag=watcher] mini_score -9999999
+tag @s remove mini_running
+tag @s[tag=!rejoining,tag=!watcher] add mini_running
+scoreboard players set @s mini_score 0
+scoreboard players set @s[tag=rejoining] mini_score -1000
+scoreboard players set @s[tag=watcher] mini_score -1000000
 
 execute if score $mini_type mem matches 1 run function mini:parkour/player_enter
 execute if score $mini_type mem matches 2 run function mini:tntrun/player_enter

+ 2 - 2
data/mini/functions/main/player_failed.mcfunction

@@ -3,9 +3,9 @@
 # 计数
 tag @s remove mini_running
 execute store result score $t_alive mem if entity @a[tag=mini_running,tag=!watcher]
-execute if score $t_alive mem matches 1.. run tellraw @a [{"selector": "@s","color":"red"}," 已失败! 剩余 ",{"score": {"name": "$t_alive","objective": "mem"}}," 人!"]
+execute if entity @s[tag=!rejoining] if score $t_alive mem matches 1.. run tellraw @a [{"selector": "@s","color":"red"}," 已失败! 剩余 ",{"score": {"name": "$t_alive","objective": "mem"}}," 人!"]
 
-# 给存活的玩减分
+# 给存活的玩家加分
 scoreboard players add @a[tag=mini_running] mini_score 1
 
 # 进入旁观

+ 3 - 3
data/mini/functions/parkour/player_enter.mcfunction

@@ -10,8 +10,8 @@ effect give @s night_vision 1000000 0 true
 effect give @s resistance 1000000 4 true
 
 # 传送玩家
-tp @s[tag=!watcher] 1005 15 1005
+tp @s[tag=!watcher,tag=!rejoining] 1005 15 1005
 
 # 调整模式
-gamemode adventure @s[tag=!watcher]
-gamemode spectator @s[tag=watcher]
+gamemode spectator @s
+gamemode adventure @s[tag=!watcher,tag=!rejoining]

+ 8 - 5
data/mini/functions/tntrun/player_enter.mcfunction

@@ -10,15 +10,18 @@ effect give @s night_vision 1000000 0 true
 effect give @s resistance 1000000 4 true
 
 # 传送玩家
-spreadplayers 1011.5 2011.5 7 7 false @s[tag=!watcher]
-schedule function mini:tntrun/player_enter2 1t replace
+spreadplayers 1011.5 2011.5 7 7 false @s[tag=!watcher,tag=!rejoining]
+execute if entity @s[tag=!watcher,tag=!rejoining] run schedule function mini:tntrun/player_enter2 1t replace
 # schedule: tp @a ~ ~-3 ~
 
 # 两秒后才开始 TNT 掉落
 tag @s remove tntrun_pc
-schedule function mini:tntrun/player_enter3 2s replace
+execute if entity @s[tag=!watcher,tag=!rejoining] run schedule function mini:tntrun/player_enter3 2s replace
 # schedule: tag @a add tntrun_pc
 
 # 调整模式
-gamemode adventure @s[tag=!watcher]
-gamemode spectator @s[tag=watcher]
+gamemode spectator @s
+gamemode adventure @s[tag=!watcher,tag=!rejoining]
+
+# 重新加入处理
+execute if entity @s[tag=rejoining] run function mini:tntrun/player_failed

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

@@ -1,2 +1,2 @@
 # spreadplayer 后不能立即传送,所以延迟 1tick
-execute as @a[tag=!watcher] at @s run tp @s ~ ~-3 ~
+execute as @a[tag=!watcher,tag=!rejoining] at @s run tp @s ~ ~-3 ~

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

@@ -1,2 +1,2 @@
 # 让玩家可以触发地板掉落
-tag @a[tag=!watcher] add tntrun_pc
+tag @a add tntrun_pc