Просмотр исходного кода

重构:玩家重新加入主大厅

Haihang Yin 5 лет назад
Родитель
Сommit
e5c1456e62

+ 3 - 1
data/ltw/functions/clock/tick20.mcfunction

@@ -4,9 +4,11 @@ schedule function ltw:clock/tick20 20t replace
 # 恢复生命
 execute if score $state mem matches 0 run effect give @a instant_health 1 10 true
 
+# 调用其他模块
+function ltw:main/tick20
+
 # TODO: 未完成的重构
 
-# # 调用其他模块
 # function item:tick20
 # function lib:bossbar/tick20
 # execute if score $state mem matches 3 run function ltw:state/3/tick20

+ 0 - 1
data/ltw/functions/clock/tick5.mcfunction

@@ -7,4 +7,3 @@ execute if score $state mem matches 0 run function ltw:state/0/tick5
 # TODO: 未完成的重构
 
 # execute if score $state mem matches 5 run function ltw:state/5/tick5
-# function ltw:main/tick5

+ 2 - 2
data/ltw/functions/init/all.mcfunction

@@ -25,6 +25,8 @@ scoreboard objectives remove temp2
 scoreboard objectives add temp2 dummy "缓存 2"
 scoreboard objectives remove UUID
 scoreboard objectives add UUID dummy "UUID"
+scoreboard objectives remove leave_game
+scoreboard objectives add leave_game minecraft.custom:leave_game "离开游戏计数"
 
 # ---------------------------------------------
 #  数字常量
@@ -145,8 +147,6 @@ function ltw:state/0/state_enter
 # scoreboard objectives add total_score dummy "得分"
 # scoreboard objectives remove total_score_disp
 # scoreboard objectives add total_score_disp dummy "得分"
-# scoreboard objectives remove leave_game
-# scoreboard objectives add leave_game minecraft.custom:leave_game "离开游戏"
 # scoreboard objectives remove effect_floating
 # scoreboard objectives add effect_floating dummy "悬浮计时"
 # scoreboard objectives remove game_id

+ 30 - 0
data/ltw/functions/main/player_enter.mcfunction

@@ -0,0 +1,30 @@
+# 当玩家加入游戏时触发
+
+# 存储 UUID
+execute store result score @s UUID run data get entity @s UUID[0]
+
+# 如果在主大厅
+execute if score $state mem matches 0 run function ltw:state/0/player_enter
+
+
+# TODO: 未完成的重构
+## 如果是旁观者或局号不对头:开始旁观
+#execute if entity @s[team=!playing] run function ltw:main/player_enter_watcher
+#execute if entity @s[team=playing] unless score @s game_id = $ game_id run function ltw:main/player_enter_watcher
+## 如果不是旁观且局号正确:游戏中掉线
+#execute if entity @s[team=playing] if score @s game_id = $ game_id run function ltw:main/player_enter_rejoin
+
+#execute as @a at @s run function lib:sounds/hit
+
+# 更新 Bossbar
+#bossbar set ltw:notice players @a
+#function lib:bossbar/show
+
+# 初始化重生点
+#spawnpoint @s -12 7 -102
+# 处理进度
+#advancement revoke @s only lib:damage_dealt
+#advancement revoke @s only lib:damage_taken
+#advancement revoke @s only item:container/place
+#advancement revoke @s only item:special/consume_enchanted_apple
+#advancement revoke @s only item:special/consume_golden_apple

+ 4 - 1
data/old/ltw/functions/main/tick5.mcfunction → data/ltw/functions/main/tick20.mcfunction

@@ -1,5 +1,8 @@
 # 离开次数为不存在,则为第一次加入游戏
 # 离开次数不为 0,则离开过游戏
-function ltw:main/player_changed
 execute as @a unless score @s leave_game matches 0 run function ltw:main/player_enter
 execute as @a unless score @s leave_game matches 0 run scoreboard players set @s leave_game 0
+
+# TODO: 未完成的重构
+
+#function ltw:main/player_changed

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

@@ -10,7 +10,6 @@ tag @s add mini_rank4
 # 重新加入阶段
 tag @s add rejoining
 function mini:main/update_player_count
-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

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

@@ -13,7 +13,6 @@ scoreboard players reset @s total_score_disp
 
 # 重新加入阶段
 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

+ 31 - 55
data/old/ltw/functions/main/player_enter.mcfunction → documents/老 TODO.txt

@@ -1,55 +1,31 @@
-# 当玩家加入游戏时触发
-
-spawnpoint @s -12 7 -102
-
-advancement revoke @s only lib:damage_dealt
-advancement revoke @s only lib:damage_taken
-advancement revoke @s only item:container/place
-advancement revoke @s only item:special/consume_enchanted_apple
-advancement revoke @s only item:special/consume_golden_apple
-
-execute as @a at @s run function lib:sounds/hit
-
-# 存储UUID
-execute store result score @s UUID run data get entity @s UUID[0]
-
-# 如果是旁观者或局号不对头:开始旁观
-execute if entity @s[team=!playing] run function ltw:main/player_enter_watcher
-execute if entity @s[team=playing] unless score @s game_id = $ game_id run function ltw:main/player_enter_watcher
-# 如果不是旁观且局号正确:游戏中掉线
-execute if entity @s[team=playing] if score @s game_id = $ game_id run function ltw:main/player_enter_rejoin
-
-# 更新 Bossbar
-bossbar set ltw:notice players @a
-function lib:bossbar/show
-
-# 无指定人员
-# FIXM: 如果服务器异常关闭,玩家在再次加入的时候不会触发进入事件(由于没有离开游戏计数)
-# FIXM: 通过在每次进入阶段 3 时 kill 使用过不死图腾的玩家来解决不死图腾假死
-# FIXM: {贸易} 确认是否能进行三次交易?
-# FIXM: 如果玩家隐身,则不显示尾迹
-
-# 龙猫
-# TOD: {钻石/贸易} 减少水;分别刷出不同的额外方块;增加一个池子
-# TOD: {土豆} 移除黄色指示器
-# TOD: 确认玩家看不到隐身玩家
-# FIXM: 再次确认音乐 Bug,是否不能在同 tick 执行?
-# FIXM: {钻石} 玩家会列入钻石的记分板(由于在 belowName 里显示)
-
-# HIM
-
-
-# ——————————————
-#  小游戏最佳实践
-# ——————————————
-
-# 需要有玩家交互
-#     即使是间接交互也比没有好,PVP 击退可能是不错的选项,但最好不要纯 PVP 砍人
-# 必须能体现玩家的技术或策略
-#    单纯的狂点左键或长按 W 是没有意思的,至少要给玩家发挥的空间
-# 结果不能仅依靠玩家的熟练度
-#    全靠玩家水平不是说不行,而是这不适合“派对游戏”,跑酷就是一个负面例子
-# 规则应该尽量简单易学
-#    除非必要,不要增加单个游戏的规则复杂度,这会提高学习成本,让新人难以入门
-# 在制作时考虑给道具留下发挥空间
-#    玩家有远程攻击,有鞘翅,有生命果,有护甲和剑,有击退棒,让它们可以得到应用
+
+# 无指定人员
+# FIXM: 如果服务器异常关闭,玩家在再次加入的时候不会触发进入事件(由于没有离开游戏计数)
+# FIXM: 通过在每次进入阶段 3 时 kill 使用过不死图腾的玩家来解决不死图腾假死
+# FIXM: {贸易} 确认是否能进行三次交易?
+# FIXM: 如果玩家隐身,则不显示尾迹
+
+# 龙猫
+# TOD: {钻石/贸易} 减少水;分别刷出不同的额外方块;增加一个池子
+# TOD: {土豆} 移除黄色指示器
+# TOD: 确认玩家看不到隐身玩家
+# FIXM: 再次确认音乐 Bug,是否不能在同 tick 执行?
+# FIXM: {钻石} 玩家会列入钻石的记分板(由于在 belowName 里显示)
+
+# HIM
+
+
+# ——————————————
+#  小游戏最佳实践
+# ——————————————
+
+# 需要有玩家交互
+#     即使是间接交互也比没有好,PVP 击退可能是不错的选项,但最好不要纯 PVP 砍人
+# 必须能体现玩家的技术或策略
+#    单纯的狂点左键或长按 W 是没有意思的,至少要给玩家发挥的空间
+# 结果不能仅依靠玩家的熟练度
+#    全靠玩家水平不是说不行,而是这不适合“派对游戏”,跑酷就是一个负面例子
+# 规则应该尽量简单易学
+#    除非必要,不要增加单个游戏的规则复杂度,这会提高学习成本,让新人难以入门
+# 在制作时考虑给道具留下发挥空间
+#    玩家有远程攻击,有鞘翅,有生命果,有护甲和剑,有击退棒,让它们可以得到应用