소스 검색

增加玩家进入游戏的函数

HerobrineXia 6 년 전
부모
커밋
1b24dfa65e

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

@@ -2,6 +2,7 @@
 schedule function ltw:clock/tick4 4t replace
 schedule function ltw:clock/tick4 4t replace
 
 
 # 调用其他模块
 # 调用其他模块
+function ltw:main/tick4
 execute if score $state mem matches 0 run function ltw:state/0/tick4
 execute if score $state mem matches 0 run function ltw:state/0/tick4
 execute if score $state mem matches 4 run function ltw:state/4/tick4
 execute if score $state mem matches 4 run function ltw:state/4/tick4
 execute if score $state mem matches 5 run function ltw:state/5/tick4
 execute if score $state mem matches 5 run function ltw:state/5/tick4

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

@@ -16,6 +16,8 @@ scoreboard objectives remove mem
 scoreboard objectives add mem dummy "全局变量"
 scoreboard objectives add mem dummy "全局变量"
 scoreboard objectives remove total_score
 scoreboard objectives remove total_score
 scoreboard objectives add total_score dummy "得分"
 scoreboard objectives add total_score dummy "得分"
+scoreboard objectives remove leave_game
+scoreboard objectives add leave_game minecraft.custom:leave_game "离开游戏"
 
 
 # 队伍
 # 队伍
 team remove ltw
 team remove ltw

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


+ 4 - 0
data/ltw/functions/main/tick4.mcfunction

@@ -0,0 +1,4 @@
+# 离开次数为不存在,则为第一次加入游戏
+# 离开次数不为0,则离开过游戏
+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