Преглед на файлове

大量重构,但愿没炸

LTCatt преди 6 години
родител
ревизия
51d4516df7

+ 12 - 0
data/item/functions/bonus_item.mcfunction

@@ -0,0 +1,12 @@
+# 检查玩家拾取的奖励物品并进行处理
+
+setblock 8 12 2009 jukebox
+data modify block 8 12 2009 RecordItem set from entity @s Inventory[{"tag":{"bonus_new":1b}}]
+tellraw @a ["",{"text": ">> ","color":"aqua","bold": true},{"selector": "@s","color":"yellow"},{"text":"获得了 "},{"nbt": "RecordItem.tag.bonus_name","block": "8 12 2009","interpret": true}]
+data modify block 8 12 2009 RecordItem.tag.bonus_new set value 0b
+clear @s #item:items{"bonus_new":1b}
+fill 8 12 2009 8 12 2009 air destroy
+tag @s add bonus_op
+execute as @e[tag=!bonus_old,type=minecraft:item,nbt={"Item":{"tag":{"bonus":1b}}},limit=1] run function item:bonus_item_give
+tag @s remove bonus_op
+# TODO : [010] 将坐标迁移到主大厅

+ 3 - 0
data/item/functions/bonus_item_give.mcfunction

@@ -0,0 +1,3 @@
+tp @s @a[tag=bonus_op,limit=1]
+tag @s add bonus_old
+data modify entity @s PickupDelay set value 0

+ 0 - 1
data/item/functions/check_item.mcfunction

@@ -1 +0,0 @@
-execute as @a if data entity @s Inventory[{"tag":{"ltw_item_new":1b}}] run function item:check_item_

+ 0 - 9
data/item/functions/check_item_.mcfunction

@@ -1,9 +0,0 @@
-setblock 8 12 2009 jukebox
-data modify block 8 12 2009 RecordItem set from entity @s Inventory[{"tag":{"ltw_item_new":1b}}]
-tellraw @a [{"selector": "@s"},{"text":"获得了道具:"},{"nbt": "RecordItem.tag.ltw_item_name","block": "8 12 2009","interpret": true}]
-data modify block 8 12 2009 RecordItem.tag.ltw_item_new set value 0b
-clear @s #item:items{"ltw_item_new":1b}
-fill 8 12 2009 8 12 2009 air destroy
-tag @s add ltw_item_op
-execute as @e[tag=!ltw_item_old,type=minecraft:item,nbt={"Item":{"tag":{"ltw_item":1b}}},limit=1] run function item:check_item__
-tag @s remove ltw_item_op

+ 0 - 3
data/item/functions/check_item__.mcfunction

@@ -1,3 +0,0 @@
-tp @s @a[tag=ltw_item_op,limit=1]
-tag @s add ltw_item_old
-data modify entity @s PickupDelay set value 0

+ 6 - 9
data/item/functions/disable_throw.mcfunction

@@ -1,13 +1,10 @@
 # 强制玩家捡起自己丢弃的物品,以物品为执行者
 
-# 存储 UUID
-# execute store result score @s UUID run data get entity @s Thrower[0]
-
 # 更改 NBT
-# data merge entity @s {PickupDelay:0s}
-# data modify entity @s Owner set from entity @s Thrower
+data modify entity @s PickupDelay set value 0
+data modify entity @s Owner set from entity @s Thrower
 
-# 将物品传送给玩家
-# 修改为了每 tick 执行一次,大概不需要了?
-# tag @s add item_force_tp
-# execute as @a if score @s UUID = @e[type=item,tag=item_force_tp,limit=1] UUID run tp @e[type=item,tag=item_force_tp] @s
+# 将物品传送给与丢弃者 UUID 相同的玩家
+execute store result score @s UUID run data get entity @s Thrower[0]
+tag @s add item_force_tp
+execute as @a if score @s UUID = @e[type=item,tag=item_force_tp,limit=1] UUID run tp @e[type=item,tag=item_force_tp] @s

+ 2 - 2
data/item/functions/init.mcfunction

@@ -1,3 +1,3 @@
 # 计分板初始化
-# scoreboard objectives remove UUID
-# scoreboard objectives add UUID dummy "UUID"
+scoreboard objectives remove UUID
+scoreboard objectives add UUID dummy "UUID"

+ 1 - 1
data/item/functions/test/get_test_item.mcfunction

@@ -1 +1 @@
-summon item ~ ~ ~ {Item:{id:"fishing_rod",Count:1,tag:{"ltw_item":1b,"ltw_item_new":1b,"ltw_item_name":'{"text":"[破损的钓鱼竿]","color":"green"}'}},CustomName:'{"text":"破损的钓鱼竿","color":"green"}',Tags:["team_green"],Age:-32768,PickupDelay:0,NoGravity:1,Invulnerable:1,CustomNameVisible:1,Glowing:1}
+summon item ~ ~ ~ {Item:{id:"fishing_rod",Count:1,tag:{"bonus":1b,"bonus_new":1b,"bonus_name":'{"text":"破损的钓鱼竿","color":"green"}'}},CustomName:'{"text":"破损的钓鱼竿","color":"green"}',Tags:["team_green"],Age:-32768,PickupDelay:0,NoGravity:1,Invulnerable:1,CustomNameVisible:1,Glowing:1}

+ 0 - 2
data/item/functions/tick1.mcfunction

@@ -1,2 +0,0 @@
-execute as @e[type=item] if data entity @s Thrower run data merge entity @s {PickupDelay:0s}
-execute as @e[type=item] if data entity @s Thrower run data modify entity @s Owner set from entity @s Thrower

+ 5 - 1
data/item/functions/tick2.mcfunction

@@ -1,2 +1,6 @@
+
 # 防止玩家丢弃物品:如果物品存在 Thrower 则要求强制捡起
-# execute as @e[type=item] if data entity @s Thrower run function item:disable_throw
+execute as @e[type=item] if data entity @s Thrower run function item:disable_throw
+
+# 检查玩家拾取奖励物品
+execute as @a if data entity @s Inventory[{"tag":{"bonus_new":1b}}] run function item:bonus_item

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

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

+ 3 - 3
data/ltw/functions/main/player_leave.mcfunction

@@ -1,13 +1,13 @@
 # 任意玩家下线时触发
 execute as @a at @s run function lib:sounds/error
 
+# 由于玩家人数不足,强制结束游戏
 execute store result score $t_count mem if entity @a[tag=!watcher]
 execute if score $state mem matches 1.. if score $game_type mem matches 1 if score $t_count mem matches ..1 run function ltw:main/game_end
 execute if score $state mem matches 1.. if score $game_type mem matches 1 if score $t_count mem matches ..1 run tellraw @a {"text": "由于玩家人数不足, 游戏直接结束!","color":"red"}
 
-# 热土豆检测
-execute if score $state mem matches 5 if score $mini_type mem matches 3 run function mini:hotpm/game/check_potato
-
+# 如果携带热土豆的玩家掉线,则重新生成土豆
+execute if score $state mem matches 5 if score $mini_type mem matches 3 run function mini:hotpm/player_leave
 
 # TODO : 快捷栏最后一格固定为屏障,禁止使用,这样可以在部分小游戏中提供专用物品
 # TODO : 如果在熔炉中放入魔晶石(暂时用紫色染料代替),则显示提示并且炸毁熔炉

+ 1 - 1
data/mini/functions/colormatch/player_lose_heart.mcfunction

@@ -1,5 +1,5 @@
 # 告知玩家
-tellraw @a [{"text":">> ","color":"gold","bold": true},{"selector":"@s","color":"yellow","bold": false},{"text":" 掉入了陷阱!","color":"white","bold": false}]
+tellraw @a ["",{"text":">> ","color":"gold","bold": true},{"selector":"@s","color":"yellow"}," 掉入了陷阱!"]
 
 # 失去一颗心
 function mini:main/player_lose_heart

+ 0 - 2
data/mini/functions/hotpm/game/check_potato.mcfunction

@@ -1,2 +0,0 @@
-execute unless entity @a[tag=pm_holding] run tellraw @a [{"text":">> ","color":"gold","bold": true},{"text":"有人带着土豆跑路了,正在选取新的土豆拥有者!","color":"white","bold":false}]
-execute unless entity @a[tag=pm_holding] run function mini:hotpm/game/pm_init_first

+ 1 - 1
data/mini/functions/hotpm/game/damage_dealt2.mcfunction

@@ -6,4 +6,4 @@ function lib:sounds/hit
 # 转移土豆
 function mini:hotpm/game/pm_lost
 execute as @p[tag=pm_damage_taken,tag=!pm_damage_dealt] run function mini:hotpm/game/pm_get
-tellraw @a [{"text":">> ","color":"gold","bold":true},{"selector":"@s","color":"yellow","bold":false},{"text":" 将土豆拍在了 ","color":"white","bold":false},{"selector":"@a[tag=pm_holding]","color":"yellow","bold":false},{"text":" 的脸上!","color":"white","bold":false}]
+tellraw @a ["",{"text":">> ","color":"gold","bold":true},{"selector":"@s","color":"yellow"}," 将土豆拍在了 ",{"selector":"@a[tag=pm_holding]","color":"yellow"}," 的脸上!"]

+ 1 - 1
data/mini/functions/hotpm/game/pm_init.mcfunction

@@ -2,7 +2,7 @@
 function mini:hotpm/game/pm_get
 
 # 告知玩家
-tellraw @a [{"text":">> ","color":"gold","bold": true},{"selector":"@s","color":"yellow","bold":false},{"text":" 获得了土豆!","color":"white","bold":false}]
+tellraw @a ["",{"text":">> ","color":"red","bold": true},{"selector":"@s","color":"yellow"}," 幸运地获得了美味的土豆!"]
 
 # 土豆爆炸时间 = 2 * 存活人数 + 4(秒)
 scoreboard players set $countdown_fast mem 40

+ 4 - 0
data/mini/functions/hotpm/player_leave.mcfunction

@@ -0,0 +1,4 @@
+# 玩家下线时检测重新生成土豆
+
+execute unless entity @a[tag=pm_holding] run tellraw @a ["",{"text":">>","color":"red","bold": true},{"text":" 由于有玩家带着土豆跑路了, 正在为土豆选择更适合它的拥有者!"}]
+execute unless entity @a[tag=pm_holding] run function mini:hotpm/game/pm_init_first

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

@@ -1,6 +1,6 @@
 # 玩家失败时由玩家自己触发
 
-tellraw @a [{"text":">> ","color":"gold","bold": true},{"selector":"@s","color":"yellow","bold": false},{"text":" 爆炸了!","color":"white","bold": false}]
+tellraw @a ["",{"text":">> ","color":"gold","bold": true},{"selector":"@s","color":"yellow"}," 爆炸了!"]
 # 玩家失去土豆
 function mini:hotpm/game/pm_lost
 # 特效

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

@@ -5,7 +5,7 @@ tag @s remove mini_running
 function mini:main/update_player_count
 
 # 显示提示
-execute if entity @s[tag=!rejoining] if score $player_alive mem matches 1.. run tellraw @a [{"selector": "@s","color":"red"}," 已失败! 剩余 ",{"score": {"name": "$player_alive","objective": "mem"}}," 人!"]
+execute if entity @s[tag=!rejoining] if score $player_alive mem matches 1.. run tellraw @a ["",{"text": ">> ","color":"red"},{"selector": "@s","color":"yellow"}," 已失败! 剩余 ",{"score": {"name": "$player_alive","objective": "mem"}}," 人!"]
 execute as @a at @s run function lib:sounds/error
 
 # 给存活的玩家加分

+ 1 - 1
data/mini/functions/main/player_finished.mcfunction

@@ -5,7 +5,7 @@ tag @s remove mini_running
 function mini:main/update_player_count
 
 # 显示提示
-execute if entity @s[tag=!rejoining] if score $player_finish mem matches ..3 run tellraw @a [{"selector": "@s","color":"green"}," 已成功! 第 ",{"score": {"name": "$player_finish","objective": "mem"}}," 名!"]
+execute if entity @s[tag=!rejoining] if score $player_finish mem matches ..3 run tellraw @a ["",{"text": ">> ","color":"green"},{"selector": "@s","color":"yellow"}," 已成功! 获得了第 ",{"score": {"name": "$player_finish","objective": "mem"}}," 名!"]
 execute as @a at @s run function lib:sounds/error
 
 # 给已完成的玩家加分