Browse Source

重构:player enter

LTCatt 5 years ago
parent
commit
bffaf50662

+ 1 - 0
data/lib/functions/sounds/creeper.mcfunction

@@ -0,0 +1 @@
+playsound minecraft:entity.creeper.primed ambient @a ~ ~ ~ 0.7

+ 1 - 0
data/lib/functions/sounds/dragon_growl.mcfunction

@@ -0,0 +1 @@
+playsound minecraft:entity.ender_dragon.growl player @s 0 1000000 0 1000000

+ 1 - 0
data/lib/functions/sounds/error.mcfunction

@@ -0,0 +1 @@
+playsound minecraft:block.note_block.didgeridoo block @s 0 1000000 0 1000000

+ 1 - 0
data/lib/functions/sounds/hit.mcfunction

@@ -0,0 +1 @@
+playsound minecraft:entity.arrow.hit_player player @s 0 1000000 0 1000000

+ 1 - 0
data/lib/functions/sounds/hit2.mcfunction

@@ -0,0 +1 @@
+playsound minecraft:entity.arrow.hit_player player @s 0 1000000 0 1000000 0.5

+ 1 - 0
data/lib/functions/sounds/hurt.mcfunction

@@ -0,0 +1 @@
+playsound minecraft:entity.player.hurt player @s 0 1000000 0 1000000

+ 1 - 0
data/lib/functions/sounds/levelup.mcfunction

@@ -0,0 +1 @@
+playsound minecraft:entity.player.levelup player @s 0 1000000 0 1000000

+ 1 - 0
data/lib/functions/sounds/teleport.mcfunction

@@ -0,0 +1 @@
+playsound minecraft:entity.enderman.teleport block @s 0 1000000 0 1000000

+ 1 - 0
data/lib/functions/sounds/theend.mcfunction

@@ -0,0 +1 @@
+playsound minecraft:ui.toast.challenge_complete block @s 0 1000000 0 1000000

+ 1 - 0
data/lib/functions/sounds/travel.mcfunction

@@ -0,0 +1 @@
+playsound minecraft:block.portal.travel block @s ~ ~ ~ 0.4 2

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

@@ -40,7 +40,7 @@ scoreboard players set #81 mem 81
 scoreboard players set #100 mem 100
 
 # ---------------------------------------------
-#  玩家队伍
+#  通用的玩家队伍
 # ---------------------------------------------
 team add debug "调试者"
 team modify debug color dark_gray

+ 9 - 0
data/ltw/functions/init/player.mcfunction

@@ -0,0 +1,9 @@
+# 重置玩家状态
+
+# HUD
+title @s clear
+title @s actionbar ""
+
+# 状态效果
+effect clear @s
+effect give @s saturation 1000000 0 true

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

@@ -0,0 +1,35 @@
+# 对单个玩家的处理(如果玩家中途加入就会执行此函数)
+function ltw:init/player
+
+# 状态效果
+effect give @s resistance 1000000 4 true
+effect give @s weakness 1000000 4 true
+
+# 位置与模式
+tp @s -10 8 -42 68 -20
+gamemode adventure
+
+# ——————————————————————————————————————————————
+
+# 经验、配方
+recipe take @s *
+xp set @s 0 points
+xp set @s 0 levels
+
+# 物品
+clear @s
+
+# 设置默认状态
+function ltw:state/0/sp/join_watch
+
+
+
+
+## 开启触发器
+#scoreboard players enable @s buy_trigger
+
+#execute as @s run function item:shop/refresh_gold
+#execute as @s run function item:shop/refresh_green
+
+## BGM
+#function lib:sounds/music/lobby

+ 12 - 0
data/ltw/functions/state/0/sp/join_watch.mcfunction

@@ -0,0 +1,12 @@
+
+# 物品
+clear @s lime_dye{lobby_item:1b}
+clear @s gray_dye{lobby_item:1b}
+kill @e[type=item,nbt={Item:{id:"minecraft:lime_dye",tag:{lobby_item:1b}}}]
+execute if data entity @s Inventory[{Slot:1b}] run scoreboard players set @s item_slot 1
+execute if data entity @s Inventory[{Slot:1b}] at @s run function item:pop_slot/return_item
+replaceitem entity @s hotbar.1 gray_dye{lobby_item:1b,display:{Name:'[{"text":"","color":"white","italic":false},"旁观模式 (按 ",{"keybind":"key.drop"}," 准备)"]',Lore:['[{"text":"","color":"gray","italic":false},"你将在下一局旁观游戏"]']}}
+execute at @s run function lib:sounds/hit2
+
+# 队伍
+team join hub_watch @s

+ 8 - 4
data/ltw/functions/state/0/state_enter.mcfunction

@@ -1,4 +1,4 @@
-# 要求系统进入状态 0(等待大厅)
+# 在系统进入状态时触发
 scoreboard players set $state mem 0
 
 # HUD
@@ -13,6 +13,7 @@ forceload add 31 -17 -31 -80
 
 # 规则
 function ltw:init/gamerule
+gamerule naturalRegeneration true
 
 # 队伍
 team remove hub_watch
@@ -32,14 +33,17 @@ team modify hub_play suffix " "
 function ltw:init/entity
 function ltw:state/0/sp/refresh_entity
 
-# 重置开始倒计时
-#scoreboard players set #start_countdown mem 9999999
+# 玩家
+execute as @a[team=!debug] run function ltw:state/0/player_enter
+
+# ——————————————————————————————————————————————
 
-#execute as @a[team=!debugging] run function ltw:state/0/player_enter
 
 
 
 
+# 重置开始倒计时
+#scoreboard players set #start_countdown mem 9999999
 
 # 启用节奏跑酷
 #scoreboard players set $tempo_enable mem 1