Browse Source

重构:死亡检测

LTCatt 5 years ago
parent
commit
92c797bab2

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

@@ -1,6 +1,9 @@
 # 每 2 Tick 执行一次
 schedule function ltw:clock/tick2 2t replace
 
+# 死亡检测
+execute as @a[x=-29,y=39,z=-78,distance=..3] at @s run function ltw:main/player_death
+
 # 调用其他模块
 execute if score $state mem matches 0 run function ltw:state/0/tick2
 # execute if score $state mem matches 3 run function ltw:state/3/tick2
@@ -12,11 +15,8 @@ execute if score $state mem matches 0 run function ltw:state/0/tick2
 # 物品模块必须最后调用,以清理弹出的临时物品
 function item:tick2
 
-# TODO: 未完成的重构
 
-# # 死亡触发
-# execute as @a[x=-12,y=7,z=-102,distance=..5] at @s run function ltw:main/player_death
-# execute as @a[x=-12,y=7,z=-102,distance=..5] run tp @s -13 9 -42
+# TODO: 未完成的重构
 
 # # 特殊方块给予效果
 # function lib:effect/floating

+ 7 - 0
data/ltw/functions/main/player_death.mcfunction

@@ -0,0 +1,7 @@
+# 当玩家死亡后触发
+
+# 调用其他模块
+execute if score $state mem matches 0 run function ltw:state/0/player_enter
+
+# TODO: 未完成的重构
+# execute if score $state mem matches 5 run function ltw:state/5/player_death

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

@@ -3,6 +3,9 @@
 # 存储 UUID
 execute store result score @s UUID run data get entity @s UUID[0]
 
+# 初始化重生点
+spawnpoint @s -29 39 -78
+
 # 如果在主大厅
 execute if score $state mem matches 0 run function ltw:state/0/player_enter
 
@@ -20,8 +23,6 @@ execute if score $state mem matches 0 run function ltw:state/0/player_enter
 #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

+ 2 - 0
data/ltw/functions/main/tick20.mcfunction

@@ -1,3 +1,5 @@
+
+# 玩家加入游戏的检测
 # 离开次数为不存在,则为第一次加入游戏
 # 离开次数不为 0,则离开过游戏
 execute as @a unless score @s leave_game matches 0 run function ltw:main/player_enter

+ 1 - 1
data/ltw/functions/state/0/player_enter.mcfunction

@@ -9,7 +9,7 @@ scoreboard players set @s music_now 2
 # 状态效果
 
 # 位置与模式
-tp @s -10 8 -42 68 -20
+tp @s -14 10 -40 218 0
 gamemode adventure
 
 # ——————————————————————————————————————————————

+ 0 - 2
data/old/ltw/functions/main/player_death.mcfunction

@@ -1,2 +0,0 @@
-# 当玩家死亡后触发
-execute if score $state mem matches 5 run function ltw:state/5/player_death